Posts

Showing posts from February, 2011

python - How do I make my program give me the value of a certain cell in a CSV? -

i having problems trying make program find cell in csv file. program ask 8 digit number. if in csv file, row should written text file. should proceed ask user how of product want buy. quantity multiplied give final price. price written variable named totalprice. my initial problem quantity since cannot retrieve third column of row of entered gtin-8 number in csv file. my code is: import csv import sys import re import os additem = "" gtinnum = "" quantity = 0 totalprice = 0 restart = "" f = open("chocolatecsv.csv", "rt") def restart(): restart = input("would restart? y/n") if restart.lower() == "y": gtinquestion() else: print(receiptcont) sys.exit() def quantityquestion(): quantity = input("how like?") def scangtin(): global rows rows = re.split('\n', f.read()) global receiptcont receiptcont = receipt.read() index, row in e

objective c - Post multiple image using share extension in iOS -

i want share or post multiple image in app using app share extension. using below code. for (nsitemprovider* itemprovider in ((nsextensionitem*)self.extensioncontext.inputitems[0]).attachments ) { if([itemprovider hasitemconformingtotypeidentifier:@"public.png"]) { nslog(@"itemprovider = %@", itemprovider); [itemprovider loaditemfortypeidentifier:@"public.png" options:nil completionhandler: ^(id<nssecurecoding> item, nserror *error) { nsdata *imgdata; if([(nsobject*)item iskindofclass:[nsurl class]]) { imgdata = [nsdata datawithcontentsofurl:(nsurl*)item]; } if([(nsobject*)item iskindofclass:[uiimage class]]) { //imgdata = uiimagejpegrepresentation((uiimage*)item, 1.0); imgdata = uiimagepngrepresentation((uiimage*)item); } nsdictionary *dict = @{ @"im

django - pycharm is not showing autocomplete for my own modules -

i using pycharm django project. made app named 'music' , there created model named 'album'. inside views using loop details stored in database this all_albums = album.objects.all() album in all_albums: album.artist however when type album. don't autocomplete suggestions artist or else have defined in class. how make pycharm include own modules in autocomplete? one way, using docstrings: for each in qs: payment = each """@type : payment """ print payment.deadline another way, using assert: for each in qs: assert isinstance(each, payment) print each.deadline you can google 'pycharm type hinting' or similar find out more.

NoSQL documentation, is there anything like a ER model or Relational model equivalent for NoSQL databases? -

my question fortunately there in title, i'm wondering, how 1 go making documentation nosql databases?, there kind of equivalent? or missing whole point? different nosql databases can have different models, since nosql umbrella term encompasses more or less not captured relational model. nature of there nothing comparable works of them. said, key-value stores can modeled using reduced form of er (only tables pk , 1 value) , use object models model storage in object databases (anything based on json) instance.

java - Long running JDBC transaction: Closed Connection -

i using c3p0 connection pooling , facing "closed connection" error large data sets. expect transaction atomic , run max 2 hours. for large data sets, take around 40-45 minutes in processing. when try persist data in db, exceptions in following sequence: [warn] [c3p0] pooledconnection has signalled connection error still in use! [warn] [c3p0] error has occurred [ java.sql.sqlrecoverableexception: closed connection ] not reported listeners! [error] org.hibernate.transaction.jdbctransaction: not toggle autocommit java.sql.sqlrecoverableexception: closed connection [error] org.hibernate.transaction.jdbctransaction: jdbc rollback failed [error] org.springframework.transaction.interceptor.transactioninterceptor: application exception overridden rollback exception. i have tried exploring solution lot , tried update configuration accordingly. here c3p0 configuration: <bean id="datasource" class="com.mchange.v2.c3p0.combopooleddatasource"> &l

multithreading - How can I display success page, while running long PHP script in background that requires POST Data? -

i have long running php script requires $_post data user. use able submit data , "successfully started" page. however, after show user page still want run php script in background take while. thoughts on how this? forking, multiprocessing, calling external script? keep in mind need submit $_post data long running script.

postgresql - Using price contraints or a function in Postgres for "money" type? -

i'm trying make sure sales prices in postgres database end in either .99 or .00. if price 34.00, i'd database leave alone. if price 34.34 i'd changed 34.99. can done entirely inside of postgres, function, or system of contraints? want make sure it's possible before start hammering away @ it.

c# - ResourceManager set wrong on save -

Image
i having issue every time change resource files, resourcemanager set invalid path. example namespace bundlrs_mvc6.resources { ... global::system.resources.resourcemanager temp = new global::system.resourcemanager("bundlrs_mvc6.homeindexviewresources", typeof(homeindexviewresources).gettypeinfo().assembly); should be: (note resources) namespace bundlrs_mvc6.resources { ... global::system.resources.resourcemanager temp = new global::system.resources.resourcemanager("bundlrs_mvc6.resources.homeindexviewresources", typeof(homeindexviewresources).gettypeinfo().assembly); folder structure: i using visual studio 2015 should move resource files to: namespace bundlrs_mvc6 instead of namespace bundlrs_mvc6.resources if so, why? this issue fixed coreclr 1.0.0 rtm release

hadoop - Spark - Finding overlapping values Or A variation of finding mutual friends -

i have problem i'm trying solve using spark. i'm new spark not sure best way design it. input: group1=user1,user2 group2=user1,user2,user3 group3=user2,user4 group4=user1,user4 group5=user3,user5 group6=user3,user4,user5 group7=user2,user4 group8=user1,user5 group9=user2,user4,user5 group10=user4,user5 i want find mutual group count between each pair of users. above input, output i'm expecting be: output: 1st user || 2nd user || mutual/intersection count || union count ------------------------------------------------------------ user1 user2 2 7 user1 user3 1 6 user1 user4 1 9 user2 user4 3 8 i think there several ways solve problem, 1 of solution be: create key,value pair key user , value group group key, have list of groups user belong to then find intersection/union between 2 groups example: (

How do you add a menu to a vs code extension? -

i can't find information on creating menu in vs code extension. possible? there examples somewhere? it's not possible. a requested feature , though. edit with release of version 1.3, there menu contribution points .

Force Emacs to NOT change the encoding -

i'll try put possible, since myself don't understand what's going on. if have buffer opened in emacs, , it's in, let's utf-8 (could really), , paste text in encoding (from pdf example), emacs change original encoding (utf8) new encoding... this pain in ass, because screws thousands of other text lines, new line can correctly displayed... so guess question is, how can tell emacs never change encoding of file? if character can't represented in present encoding, don't show (or show messed happens). thanks specifying -*- coding: utf-8 -*- (or whatever encoding want) @ top of file force encoding particular file. relevant manual page here . for more systematic approach, might want investigate docstring file-coding-system-alist variable, forces encodings based on filenames.

java - Connect to pc localhost via android phone without using emulator -

i using async task login users though php login page here java android code : protected string doinbackground(string... urls) { string result = ""; for(int = 0; <= 0; ++i) { result = this.invokepost(urls[i], this.postdata); } return result; } private string invokepost(string requesturl, hashmap<string, string> postdataparams) { string response = ""; try { url url = new url(requesturl); httpurlconnection e = (httpurlconnection)url.openconnection(); /* e.setreadtimeout(15000); e.setconnecttimeout(15000);*/ e.setrequestmethod("post"); e.setdoinput(true); e.setdooutput(true); outputstream os = e.getoutputstream(); bufferedwriter writer = new bufferedwriter(new outputstreamwriter(os, "utf-8")); writer.write(this.getpostdatastring(postdataparams)); writer.flush(); writer.close(); os.close();

php - How to update one table based on another one? -

i have these 2 tables: // user +----+-------+------------+ | id | name | total_rep | +----+-------+------------+ | 1 | jack | 100 | | 2 | peter | 334 | | 3 | john | 1 | | 4 | ali | 5463 | +----+-------+------------+ // rep +----+------------+---------+------+ | id | reputation | id_user | done | +----+------------+---------+------+ | 1 | 5 | 2 | 1 | | 2 | 2 | 3 | 1 | | 3 | 15 | 2 | null | | 4 | 10 | 2 | null | | 5 | 5 | 4 | 1 | | 6 | 10 | 3 | null | +----+------------+---------+------+ i'm trying sum number of reputation column rep table done null specific user , add total_rep column user table. expected output: // specific user $id = 2; // user +----+-------+------------+ | id | name | total_rep | +----+-------+------------+ | 1 | jack | 100 | | 2 | peter | 359 | -- updated | 3 | john | 1 | | 4

Convert string output(bash script) -

how convert output vendor_id : genuineintel vendor_id = genuineintel using cut command? #!/bin/bash vendorid=`cat /proc/cpuinfo | grep 'vendor_id'|cut -d`=`-f 5` vendor_id: genuineintel echo $vendorid you can use tr anslate: vendorid=$(grep 'vender_id' /proc/cpuinfo | tr ':' '=') printf "%s\n" "$vendorid" i changed backticks $(..) since easier nest. remember double quote variable expansions $vendorid -> "$vendorid" or undergo word splitting . tr in case change colons equal signs, eg: % echo "a:b:c" | tr ':' '=' a=b=c

c - MQTT synchronous message reception at the subscriber -

i have simple publisher , subscriber written in c. using paho mqtt libraries , mosquitto broker. followed instructions site - https://www.eclipse.org/paho/clients/c/ (the publisher code same in link) the subscriber code in second file - #include "stdio.h" #include "stdlib.h" #include "string.h" #include "mqttclient.h" #define address "tcp://localhost:7777" #define clientid "cppclientsub" #define topic "mqtt examples" #define payload "hello world!" #define qos 2 #define timeout 10000l volatile int count; volatile mqttclient_deliverytoken deliveredtoken; void delivered(void *context, mqttclient_deliverytoken dt) { printf("message token value %d delivery confirmed\n", dt); deliveredtoken = dt; } int msgarrvd(void *context, char *topicname, int topiclen, mqttclient_message *message) { int i; char* payloadptr; count = count +

ios - How would I go about saving snaps (UIImage) to the sandbox? -

i'm creating theos tweak jailbroken iphone , i'm stuck on feature. far can block screenshot detection , replay detection, add infinite text, , have app open directly feed. feature i'm stuck on saving incoming , outgoing snaps (and stories, 1 step @ time). used flexible tweak cydia assist me , noticed snaps have "uiimage." know have somehow convert uiimage *.jpg or *.png , save somewhere (i'm looking save app's documents directory). i searched around site , found following may helpful: // convert uiimage jpeg nsdata *imgdata = uiimagejpegrepresentation(image, 1); // 1 compression quality // identify home directory , file name nsstring *jpgpath = [nshomedirectory() stringbyappendingpathcomponent:@"documents/test.jpg"]; // write file. choose yes atomically enforce or none write. use no flag if partially written files okay can occur in cases of corruption [imgdata writetofile:jpgpath atomically:yes]; and // create paths output i

iphone - CloudFront, S3 and CORS with video files - other files OK -

Image
i'm struggling cloudfront , s3 add access-control-allow-origin: * headers of video files stored on s3 (for inline video on iphones - seems working everywhere else inline video working on iphones same domain, assume it's cors related). only first file in bucket has right headers curl -i -h "origin: https ://example.com" http://cdn.example.com/0000d723-5c73-4d71-953c-d7e29e70f17b.jpg http/1.1 200 ok content-type: application/octet-stream content-length: 80962 connection: keep-alive date: thu, 02 jun 2016 00:38:50 gmt access-control-allow-origin: https://beek.co access-control-allow-methods: access-control-max-age: 3000 access-control-allow-credentials: true x-amz-meta-md5-hash: 18692618d1f6865694f08fb2dcd12201 last-modified: wed, 15 feb 2012 03:08:14 gmt etag: "18692618d1f6865694f08fb2dcd12201" accept-ranges: bytes server: amazons3 vary: origin,access-control-request-headers,access-control-request-method age: 63 x-cache: hit cloudfront via: 1.1 284d225

android - How to disable and reenable Javascript in XWalkView? -

i'm using xwalkview stable 18.48.477.13 on android , wanted disable javascript since it's default enabled. the standard android webview has method websettings.setjavascriptenabled enable or disable js. so knows how disable , reenable javascript in xwalkview? maybe xwalkview.pausetimers() , xwalkview.resumetimers(), affect xwalkview instances not need in case. there's class xwalksettings websettings. method setjavascriptenabled in xwalksettings not yet exposed external. api available in crosswalk-21.

java - Android Drawing app crashing -

i new android programming , started out simple drawing app. found , collated code after browsing code doesn't seem work. app opens having white screen doesn't when touch , drag. no lines or seen. white screen. here code. package com.drawing.emeraldsoul.drawingapp; import android.app.activity; import android.content.res.resources; import android.content.context; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.path; import android.util.attributeset; import android.view.motionevent; import android.view.view; class myview extends view { // setup initial color private final int paintcolor = color.black; // defines paint , canvas private paint drawpaint; private path path = new path(); public myview(context context, attributeset attrs) { super(context, attrs); setfocusable(true); setfocusableintouchmode(true); setuppaint(); } // setup paint color , stroke styles private void setuppaint(

Parse currency into numbers in Python -

i learnt format numbers currency in python python module babel provides babel.numbers.format_currency format numbers currency. instance, from babel.numbers import format_currency s = format_currency(123456.789, 'usd', locale='en_us') # u'$123,456.79' s = format_currency(123456.789, 'eur', locale='fr_fr') # u'123\xa0456,79\xa0\u20ac' how reverse, currency numbers, such $123,456,789.00 --> 123456789 ? babel provides babel.numbers.parse_number parse local numbers, didn't found parse_currency . so, ideal way parse local currency numbers? i went through python: removing characters except digits string . # way 1 import string all=string.maketrans('','') nodigs=all.translate(all, string.digits) s = '$123,456.79' n = s.translate(all, nodigs) # 12345679, lost `.` # way 2 import re n = re.sub("\d", "", s) # 12345679 it doesn't take care decimal separator .

windows - computer freezes after about 7,000 iterations of an .exe in a batch -

i searched command line applications report on mp3 tags , found three: mpgtx, id3 , id3tool. unfortunately 3 of them freeze computer after reporting 7,000 items. have 120k items. i've tried straight .exe, start , call part of experimentation. i've tried calling separate batch file in place of executable line. no luck. here's simplified code fails: /l %%g in (1, 1, 100000) ( id3.exe "filename.mp3" >nul ) mpgtx runs out of cpu. id3 , id3tool show plentiful cpu , memory (in process explorer) before freeze computer. thoughts on how use these tools, or on alternate tools without problem win/xp? thx exiftool worked ... because has it's own recursive switch , doesn't called 100,000 times. http://www.sno.phy.queensu.ca/~phil/exiftool/ review: "insanely great tool long learning curve ..."

How to ensure resources show up in chef server run log details -

i have cookbook uses custom lwrps; in actions of these lwrps, call other resources (file, directory, execute, etc). inner resources not show in run history 'details' section on chef server, show in info log during provisioning on node. how can ensure show in details section well? nested resources explicitly suppressed reporting data: https://github.com/chef/chef/blob/master/lib/chef/resource_reporter.rb#l312-l315 you have build own system this.

networking - Network monitoring tool -

i looking turnkey solution server monitoring, disk space usage notifies of events such particular drive getting low on space via email, text or both. the client has 11 machines need monitoring , money not issue them run time critical operation. any insights personal experiences appreciated. try either zabbix, nagios or pandora fms . they're basic monitoring solutions can in greater or lesser measure heavily depending on infrastructure , time mentioned. in position, small amount of devices i'd try 1 out has open source edition pandora fms or opennms.

android - How to add GoBackSupport to three WebView Fragments? -

this situation: have three webview fragments , if press backbutton application closes. want these webview fragments goback previous page . tried: @override public boolean onkeydown(int keycode, keyevent event) { if ((keycode == keyevent.keycode_back) && webview.cangoback()) { webview.goback(); return true; } return super.onkeydown(keycode, event); } but still does not work in fragments . how make these webview fragments goback ? addition: handle navigationdrawer , there code in mainactivity.class : @override public void onbackpressed() { drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); if (drawer.isdraweropen(gravitycompat.start)) { drawer.closedrawer(gravitycompat.start); } else { super.onbackpressed(); } } @override public boolean onbackpressed() { webview.goback(); return tr

oauth 2.0 - iOS Square Connect Merchant Authorization Issue -

i'm having trouble authorizing merchant in square oauth flow , using afnetworking 2.0 in objective-c. called method 'openurl' brought square log in page. here can log in merchant, never returns app. recommendations , code examples on need work appreciated lost here. in advance! open url call the 'openurl' call redirects user ' https://connect.squareup.com/oauth2/authorize ' client id , redirect url on safari. after logging in , pressing "allow" permissions, doesn't jump app. code tried follows: nsstring *urlstring= @"https://connect.squareup.com/oauth2/authorize"; nsstring *clientid = @"client_id=[client_id]"; nsstring *responsetype = @"response_type=code"; nsstring *fullurl = [nsstring stringwithformat:@"%@?%@&%@", urlstring, clientid, responsetype]; [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:fullurl]]; i thinking may have urlschemes , url identifier. should

html - Make a table with a line under features to product 3 same with features 1&2. Make a vert line right of features to feature 3 same with product 1& 2 -

i want have vertical line between features , product way down. same between product 1&2 , product 2&3. i want have horizontal under features , features 1&2 reaches way product 3. <html> <head> <title>11-1</title> <style> .table { ; border-collapse: collapse; border-spacing: 0; border-width: 0; border-right: 0; border-left: 0; border-top: 0; border-bottom: ; text-align: center; width: 100%; } th { border: none; } tr td { border-left: none; border-right: none; } </style> <head> <body> <table class="table" border="1px"> <tr> <th style="background-color:silver;text-align:left ;">features</th> <th style="background-color:silver" ;>product 1</th> <th st

javascript - proper way of adding properties to prototypes in my code -

hey im trying add 'event' , callback function "fun" prototype of myevents , don't understand 1 part of code below! function myevents(events){ this.events={}; } myevents.prototype.adding=function(event,func){ var array=[] this.array.push(func); this.array.push(event); this.events[event] = array; //i don't understand part-why necessary? } could please explain? thank you!! most trying this: //constructor function function myevents(){ this.events={}; } //extending prototype function called adding myevents.prototype.adding = function(event,func){ this.events[event] = func } //instantiating new object using new operator on constructor function my_new_obj = new myevents() //calling adding function on prototype , passing 2 arguments my_new_obj.adding('test',function greet(){console.log('hello')}) //calling function added my_new_obj['events']['test']() also, note can powerful because methods (functions) ad

c# - Resizing pictureBox and changing minimumsize -

so have code resizing picturebox: class sizeablepicturebox : picturebox { public sizeablepicturebox() { this.resizeredraw = true; } protected override void onpaint(painteventargs e) { base.onpaint(e); var rc = new rectangle(this.clientsize.width - grab, this.clientsize.height - grab, grab, grab); controlpaint.drawsizegrip(e.graphics, this.backcolor, rc); } protected override void wndproc(ref message m) { base.wndproc(ref m); if (m.msg == 0x84) { // trap wm_nchittest var pos = this.pointtoclient(new point(m.lparam.toint32() & 0xffff, m.lparam.toint32() >> 16)); if (pos.x >= this.clientsize.width - grab && pos.y >= this.clientsize.height - grab) m.result = new intptr(17); // ht_bottomright } } private const int grab = 16; } i found here on stackoverflow, , works great. however, change minimumsize on it, since ca

python - Non-global variable recognized/accepted in defined function -

i learning , experimenting python , accidentally found strange (to me) case. searched as could not find other how use global , local variables or how use 'for' loop. have following code (python 3.2 on android qpython3), modified simplicity: def get_number(): x=5**i print(x) return(x) in range(1,5): y=get_number() print(y) i realized made mistake using variable in called function did not define global. , yet, when ran script worked(!) giving me following output: hon.sh "/storage/emulated/0/com.hipipal.qpyplus/scripts3/ak_scripts/.last_tmp.py" && exit < 5 5 25 25 125 125 625 625 #[qpython] press enter exit could please explain how/why variable recognised within called function , having value has in calling function, though not defined global? scope resolution variable follows legb rule, i.e. python tries find variable in following scopes (decreasing precedence): local -> enclosed -> global ->

namespaces - c# Inconsistent Accessibility Prevents Private Classes as parameters for Protected Methods -

here simplified example of how want code work. please note code not compile: namespace specificnamespace { class utilityobject { //properties } public abstract class entity { protected void dostuff(utilityobject utilityobject) { //does stuff } } // include implementations of entity } namespace generalnamespace { public static class world { public static list<specificnamespace.entity> entities = new list<specificnamespace.entity>(); } } it doesn't compile because of line: protected void dostuff(utilityobject utilityobject) inconsistent accessibility: parameter type 'utilityobject' less accessable method 'entity.dostuff(utilityobject utilityobject)' but swear, going implement entity classes declared inside of specificnamespace , therefore class has reference protected method entity.dostuff have access utillityobject . since no class outside

web services - WebService Project Java on Gradle Project -

i'm developing webservice in java using netbeans , using gradle depency mannagement. i found this article developing web projects gradle. uses gretty plugin. followed instructions ( changed servlet container jetty tomcat ) , develop/deploy web project , open "home page" servlet. the problem webservice classes not working properly. requests made browser returns 404 error code. testing, made new webproject using netbeans time without gradle , works charm. here follows code: build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'org.akhikhl.gretty:gretty:+' } } apply plugin: 'java' apply plugin: 'war' apply plugin: 'org.akhikhl.gretty' gretty { port = 8088 contextpath = '/sisvendas' servletcontainer = 'tomcat8' } repositories { mavencentral() } dependencies { testcompile group: 'junit', name: 'junit', version: '4.1

linux - Passing argument from C to Assembly -

i'm trying make program in c uses function assembly. below can see code: sum_c.c #include <stdio.h> extern int _assemblysum(int x, int y); int main(int argc, char *argv[]){ int total; total = _assemblysum(4, 2); printf("%d\n", total); return 0; } assembly_sum.asm section .data section .text global _assemblysum _assemblysum: push rbp mov rbp, rsp mov rax, [rbp+16] mov rbx, [rbp+24] add rax, rbx pop rbp ret compile nasm -f elf64 assembly_sum.asm -o assembly_sum.o gcc c_sum.c assembly_sum.o -o sum ./sum when run program random numbers -1214984584 or 2046906200. know need use registers rdi, rsi, rdx , rcx because 64bit gnu/linux compiler uses them ( passing arguments c 64bit linux assembly ). how can that? you may have confused calling convention being used. linux uses 64-bit system v calling convention. under convention, registers preferred on stack passing of integer type parameters. reg

google bigquery - Parsing fields out of textPayload in stackdriver logging -

here line tomcat access log: 127.0.0.1 - - [24/may/2016:17:53:05 -0700] "post /users http/1.1" 200 10676 is there way parse out various fields here client ip, http request method, request path, response code, etc., , load separate columns in bigquery table? the table @ bottom of this page links fluent catch-all config , believe different logs should parsed out , loaded differently in configurable manner ease of querying? or missing fundamental here? it might not mean - guess : how loading log gbq table each log line becomes row in table , parse table below (code not pretending optimal - show idea) select regexp_extract(log_line, r'(?: (?:.+?)){0} (.+?) '), regexp_extract(log_line, r'(?: (?:.+?)){1} (.+?) '), regexp_extract(log_line, r'(?: (?:.+?)){2} (.+?) '), regexp_extract(log_line, r'(?: (?:.+?)){3} (.+?) '), regexp_extract(log_line, r'(?: (?:.+?)){4} (.+?) '), regexp_extract(log_line, r'(

magento - How to properly override a core JS file in Magento2 -

we attempting override behavior of bundle products in magento2, specifically, enable user defined quantities checkbox type products within bundle. we have written extension, , followed instructions how replace default js component found here: http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/custom_js.html our requirejs-config.js within our extension's frontend (app/code/endertech/bundleextended/view/frontend/) view looks like: var config = { "map": { "*": { 'magento_bundle/js/price-bundle': "endertech_bundleextended/js/price-bundle" } } }; this having effect of loading both core magento2 price-bundle.js , our modified version... , customization we've added our modified version not executing... presumably because magento2 core version loading first. we expected revision prevent core version loading in favor of ours. perhaps approaching problem wrong direction, or have

sql - MySQL select query returns 250K+ results, delete query only deletes one? -

i don't understand this. i've dropped table , recreated multiple times, , it's same every time. when run query: select * `squares` mbrcontains(polyfromtext('polygon((-34 166, -34 171, -41 171, -41 166, -34 166))'), `coordinate`); i'm returned on 250,000 results, correct. when try , alter query delete based on clause, so: delete `squares` mbrcontains(polyfromtext('polygon((-34 166, -34 171, -41 171, -41 166, -34 166))'), `coordinate`); mysql sees fit delete single row @ time. i'm not going click 'go' 250k+ times. why this? here's table structure... `squares` ( `square_id` int(7) unsigned not null, `ref_coord_lat` double(8,6) not null, `ref_coord_long` double(9,6) not null, `coordinate` point not null, primary key (`square_id`), key `ref_coord_lat` (`ref_coord_lat`), key `ref_coord_long` (`ref_coord_long`), spatial `coordinate` (`coordinate`) ) engine=myisam default charset=latin1; if it's use, my

basex - XQuery Replace Value With Conditional Failing -

i in middle of creating xquery replace-value of node action in xquery . but seems code not working therefore if-else statement going else. this code: declare function local:replacing($contextdata element()) element()* { copy $pipeline := $contextdata/handler/data/* modify( if(not(empty(data($pipeline/payload/sample/transactiontype)))) replace value of node $pipeline/payload/sample/transactiontype 'xxx' else (), if(not(empty(data($pipeline/payload/sample/revision)))) replace value of node $pipeline/payload/sample/revision 'xxx' else () ) return $pipeline }; i try against sample xml result not xxx when field revision having value. (this goes else statement) let $result := <root> <handler> <data> <root> <payload> <sample> <transactiontype></transactiontype> <revision>123</revision> <board>

osx - Mac to extract HTML from Mail messages -

i trying extract html emails using applescript . came across stackexchange post -- mac automator/applescript(?) extract url's mail messages -- tries extract urls email content. extraction code is: on run {input, parameters} set mailcontentlist {} tell application "mail" repeat selectedmail in input set end of mailcontentlist content of selectedmail end repeat end tell return mailcontentlist end run this extracts visible content, not entire html content. tried adding with properties {visible:false} after content , after input no luck either. you raw source source property set end of mailcontentlist source of selectedmail but have extract html portion "manually".

jBPM Maven dependencies not showing in pom.xml -

when create new jbpm project in eclipse , select create maven project pom.xml generated without dependency section. while can manually add dependencies, shouldn't plugin automatically? missing something? are using 6.4.0.final? there issues version of eclipse wizard, should fixed in following update site: http://downloads.jboss.org/jbpm/release/6.4.1.final/updatesite/

instagram - How to get around Instgram oauth failures after they enforced sandbox mode? -

i have been using instagram api on website year , worked until today when enforced sandbox mode on applications. oauth error on request make client-id. simple requests following: https://api.instagram.com/v1/users/search?q=[username]&client_id=[clientid] how around problem? have checked not calling more 20 recent media in api calls suggested documentation. from instagram api changelog all api endpoints require valid access_token you need authorise user app. instagram account registered client need follow authentication steps here instagram api authentication . note in sandbox mode other sandbox users visible. i.e if try , recent media usera not sandbox users, come no user found.

python - Scrapy KeyError while using pipeline -

can explain me why error? didn't it. try store extracted data database via scrapy pipeline, worked project following error: traceback (most recent call last): file "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 588, in _runcallbacks current.result = callback(current.result, *args, **kw) file "/home/darknet/darknet/pipelines.py", line 11, in process_item length = range(len(item['quantity'])) file "/usr/lib/python2.7/dist-packages/scrapy/item.py", line 56, in __getitem__ return self._values[key] keyerror: 'quantity' my pipeline: import darknet darknet.items import darknetitem models import db models import blackmarket class mysqlpipeline(object): def process_item(self, item, spider): length = range(len(item['quantity'])) x in length: record = blackmarket(product=item['product'][x], quantity=item['quantity'

javascript - How to get response from RESTful API using ajax by Another Domain? -

i have used ajax code gives error "xmlhttprequest can not load" after using "access-control-allow-origin: '*'" in java script code gives error "unexpected error" . have searched on internet last 3-4 days not getting solution here guys please me solve problem . this code:` jquery.noconflict(); jquery(document).ready(function( $ ){ var encryptedtext = "hdeao+i4qk9umgylbhe490rfcqq"; new ajax.request('http://example.com/json/service', { access-control-allow-origin: '*', method: 'post', contenttype: 'application/json', postbody: '{"abc":{"request":'+encryptedtext+'}}', onsuccess: function(transport){ var myobject = eval('(' + transport.responsetext + ')'); alert("success"); }, onfailure : function(){ alert("fail"); }, }); });` i have used prototype.js in project.

Oracle client connectivity issue from SQL Server -

i have user running ssis package connects oracle server. when user runs package failing error "oracle home not found". i'm local admin on server when execute package succeeds. i'm pretty sure user need not local admin have other servers users able connect oracle out admin rights. kindly let me know permission levels might need check user in order resolve issue. note: os of server windows server 2012 , oracle provider installed of version 12

java - Android "Hello World" Error -

i'm new android development. i'm running eclipse adt plugin , installed necessary dependencies. open eclipse, select 'new android applciation' , set. when run app, error message saying /home/parallels/workspace/test/androidmanifest.xml: 2: /home/parallels/workspace/test/androidmanifest.xml: syntax error: newline unexpected so in android manifest , it's default, eclipse generated code, right? what's problem here? <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versioncode="1" android:versionname="1.0"> <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_nam

What language is this javascript? -

i dont know javascript real code ?? // summary config var _0x7b08 = ["\x6b\x20\x33\x28\x68\x29\x7b\x33\x2e\x38\x3d\x33\x2e\x38\x7c\x7c\x30\x3b\x33\x2e\x38\x2b\x2b\x3b\x32\x20\x67\x3d\x37\x2e\x35\x2e\x6f\x28\x22\x2f\x6e\x2f\x75\x2f\x22\x29\x3d\x3d\x2d\x31\x26\x26\x37\x2e\x35\x2e\x6f\x28\x22\x2f\x6e\x3f\x22\x29\x3d\x3d\x2d\x31\x2c\x63\x3d\x37\x2e\x35\x2e\x6f\x28\x22\x2f\x6e\x2f\x75\x2f\x22\x29\x21\x3d\x2d\x31\x3b\x36\x28\x33\x2e\x38\x3c\x3d\x34\x2e\x4d\x29\x7b\x39\x7d\x36\x28\x67\x26\x26\x21\x34\x2e\x59\x29\x7b\x39\x7d\x36\x28\x63\x26\x26\x21\x34\x2e\x31\x35\x29\x7b\x39\x7d\x32\x20\x65\x3d\x6d\x2e\x72\x28\x68\x29\x2c\x66\x3d\x65\x2e\x31\x34\x28\x22\x45\x22\x29\x3b\x36\x28\x34\x2e\x4b\x29\x7b\x32\x20\x61\x3d\x27\x3c\x4e\x20\x50\x3d\x22\x54\x22\x3e\x27\x3b\x32\x20\x64\x3d\x33\x2e\x6c\x28\x65\x2e\x6a\x2c\x34\x2e\x31\x32\x29\x7d\x31\x33\x7b\x32\x20\x61\x3d\x22\x22\x2c\x64\x3d\x33\x2e\x6c\x28\x65\x2e\x6a\x2c\x34\x2e\x31\x39\x29\x7d\x65\x2e\x6a\x3d\x61\x2b\x64\x2b\x22\x2e\x2e\x2e\x2

performance - Django Slow on Production, fast in test -

our web sites hosted django extremely slow on production server: database access seems slow (mysql), downloading file slow (i tried x-sendfile, without impact). profiling using based on this snippet , heaviest: ncalls tottime percall cumtime percall filename:lineno(function) 11570 0.577 0.000 0.577 0.000 /var/lib/python-support/python2.6/mysqldb/times.py:43(datetime_or_none) 5786 0.500 0.000 0.617 0.000 /usr/local/lib/python2.6/dist-packages/django/db/models/base.py:244(__init__) 5796 0.205 0.000 0.576 0.000 /usr/local/lib/python2.6/dist-packages/django/forms/widgets.py:411(render_option) 8 0.190 0.024 1.014 0.127 /var/lib/python-support/python2.6/mysqldb/cursors.py:282(_fetch_row) 21.6% 0.577 /var/lib/python-support/python2.6/mysqldb/times.py 19.4% 0.520 /usr/local/lib/python2.6/dist-packages/django/db/models/base.py 9.5% 0.253 /usr/local/lib/python2.6/dist-packages/django/forms/widgets.py 7.4% 0.199 /var

How to allow single child selection in android expandable list view? -

i using expandable list view child.i tried set single child selection in parent.please me dont know how do. public view getchildview(final int i, final int i1, boolean b, view view, viewgroup viewgroup) { final childviewholder childviewholder; if(view==null) { childviewholder=new childviewholder(); view=((layoutinflater)context.getsystemservice(context.layout_inflater_service)). inflate(r.layout.product_listview_child_itemnew,null); childviewholder.choice1=(textview)view.findviewbyid(r.id.textview1); childviewholder.choice1.settextcolor(color.parsecolor("#000000")); childviewholder.checkbox1=(checkbox)view.findviewbyid(r.id.checkbox1); //childviewholder.checkbox1.settag(getquestion.get(i)); view.settag(childviewholder); } else { childviewholder=(childviewholder)view.gettag(); } childviewholder.checkbox1.s