Posts

Showing posts from June, 2012

Trouble with NSTextField in Swift using xcode 6.1 (OSX) -

i started swift not objective c. can teach me how , set nstextfield in swift using xcode 6.1 under osx? you , set value of nstextfield stringvalue property. instance, if have @iboutlet in app: @iboutlet weak var textfield: nstextfield! getting value: println("textfield \(textfield.stringvalue)") setting value: textfield.stringvalue = "this string"

content management system - Site Does Not Reflect Edits Inside Wordpress CMS -

anything inside our wordpress cms of our pages not reflect on actual website. it's if it's disconnected. other pages confirmed connected though. why , should happens selected pages? btw, should've indicated sample of problematic pages. here's one: http://www.criminal-lawyers.com.au/courts/locations . look template of effected pages. take page on admin panel on right side of page can see page attribute section ,look on template set page. may static template not accept content. just change template default template. then view page .if content reflected request developer in selected template also. (notice:entire style of page lost.you need reselect previous template , save after seeing change )

Django displaying records as adjacent numbers for the same foreign key? -

i have application has different organisations , user belongs 1 organisation.the user creates files on organisation , organisation. the problem arise when try display "pk" attribute of files created, if create file in organisation "a", pause, creates record in database in organisation "b" , create new file in organisation "a". details display this. organisation title pk record 1 1 record 3 3 organisation b title pk record 2 2 how can make sure id's contiguos every organisation, this. organisation title pk record 1 1 record 2 2 organisation b title pk record 1 1

python - Image Not Displaying From The Path That is Manually Saved to Another Model in Django -

i have 2 models imagefield . i using sorl-thumbnail generate thumbnail . first model has form binded while second gets imagefield populated first one, when saved. models.py : #the first model class newimage(models.model): thumbnail = models.imagefield(upload_to='photos') time_created = models.datetimefield() #second class users(models.model): name = models.charfield(max_length=100) address = models.charfield(max_length=200) thumbnail = models.imagefield(upload_to='photos') time_created = models.datetimefield() forms.py : class imageform(forms.modelform): class meta: model = newimage fields = {'thumbnail'} views.py : def saveimage(request): if request.method == 'post': user = users.objects.get(id = 1) imageform = imageform(request.post, request.files or none) if imageform.is_valid(): upload_image = imageform.save(commit=false) upload_image.time_created = ti...

python - Overriding default error messages in email input widget in django -

i trying override default invalid email error message in django. django doc says, following code should work, it's not. how can adjust it? class bootstrapauthenticationform(authenticationform): forms.form.error_css_class = 'error' email = forms.emailfield(max_length=254, error_messages={'required': 'please enter valid email address.', 'invalid': 'please enter valid email address.'}, widget=forms.emailinput({ 'required': true, 'class': 'form-control', 'placeholder': 'e-mail address', })) and, error_css_class not working properly: there no change @ all. what's wrong setting? thanks in advance. you can use emailvalidator: email = forms.emailfield(max_length=254,...

node.js - How to change the output color of gulp-debug? -

Image
hi due crash gulp, not debug whats happening behind. installed gulp-debug. think 's throwing lines of errors unreadable condition in windows system due output color. how , change output color. @pgreen2, reply. gulp --no-color allows complete no-color , cannot distinguish b/w input , output. there other way change particular blue color itself? i searched across folders , noticed hard coded. developers have stated // don't use 'blue' not visible on cmd.exe . replaced hexadecimal color in float.patch under core-util-is in array of colors. -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - '#fff8dc' : [34, 39], // blue got changed here - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39...

Convert Javascript object to C# object -

i'm setting facebook canvas payments , requires callback when order successful. have code below , i'm using ajax pass callback data method can it. don't know set parameter method can pass data correctly. fb.ui(obj, function (data) { $.ajax({ type: "get", datatype: "json", contenttype: "application/json", url: "/home/finishorder", data: myjsobject, async: true }); }); public class orderdetails { public string payment_id { get; set; } public decimal amount { get; set; } public string currency { get; set; } public int quantity { get; set; } public string request_id { get; set; } public string status { get; set; } public string signed_request { get; set; } } public void finishorder(orderdetails orderdet...

terminal - How to take snapshot in vlc using command line in ubuntu -

i using easycap dc60+ in ubuntu , watch easycap video on vlc using following command: vlc -vvv v4l2:///dev/video1:input=1:norm=pal-i:width=720:height=576 --input-slave=alsa://plughw:1,0 --v4l2-standard=pal_i and want take snapshot of vlc using command line. i use command on terminal show error , first instance of vlc not work vlc -i dummy v4l2:///dev/video0 --video-filter scene --no-audio --scene-path /home/stoppal/test --scene-prefix image_prefix --scene-format png vlc://quit --run-time=1 this error occure [0x19d6aa8] dummy interface: using dummy interface module... libv4l2: error set_fmt gave different result try_fmt! maybe @ page https://wiki.videolan.org/how_to_create_thumbnails/

excel how to paste formula from column to row -

i want copy column formula row 1 : b c d 1 ='sheet1'!b2.......='sheet1'!b3............='sheet1'!b4............='sheet1'!b5 2 ='sheet1'!b3 3 ='sheet1'!b4 4 ='sheet1'!b5 5 ='sheet1'!b6 but when copy formula column b, cell(b1) become ='sheet1'!c3, there way transpose formula without change 1 one? when right-click (to paste copied selection), comes paste special option. click , select transpose . should you. , changing b3 (in formula) $b3 should stop changing formula

php - Redirecting issue to a random id in Laravel -

in laravel 4.2 have route defined this: route::get('author/{id}/edit', ...); when tried redirect link random id previous 1 failed: return redirect::to('author/{id}'); // or return redirect::to('author/(:any)'); but works when use redirect id manually like: return redirect::to('author/8'); // or return redirect::to('author/9'); how redirect random id or how use redirect parameters? best practice use named routes, way can point named route. when url changes, application still work based on name of route. in case, use: route::get('author/{id}/edit', ['as' => 'author.edit', 'uses' => 'authorcontroller@edit']); this way name of route 'author.edit'. when try redirect route, can use redirect::route('author.edit', $authorid); i tested this, , works random id, example: return redirect::route('author.edit', rand());

android - how to set different ids for different estimote beacons? -

suppose, android app detecting 3 beacons in range default uuid value. so, how can set/change name each beacons in anndroid (to identify each beacon)? appreciations suggestions... thanks first of need estimote sdk can create beacondetection service this public class beaconmyservice extends service { private static final string tag = "beaconmyservice"; private final handler handler = new handler(); private beaconmanager beaconmanager; private static final region all_estimote_beacons_region = new region("rid", null, null, null); @override public int onstartcommand(intent intent, int flags, int startid) { if (beaconmanager.isbluetoothenabled()) { connecttoservice(); } return service.start_not_sticky; } private void connecttoservice() { beaconmanager.connect(new beaconmanager.servicereadycallback() { @override public void o...

java - JAXB element possibly altering encoding of string -

i've created web service , generated java files using cxf wsdl2java tool. parameters passed stored jaxbelements. when send values (in arabic) web service class show question marks. when print value of jaxbelement before reaches web service it's correct. encoding changing between test client , web service? , if how can preserve arabic characters?

Load testing via JMeter for asp.net web service so how to handle vivewstate,viewstate1,viewstate2 and eventvalidation things for end to end flow -

steps followed me: create thread group->http request default added recording controller in thread group added view result tree after that- workbench- http proxy server added listener-view result tree i recorded script want know how correlate pages or flow got actual result from login(get)-login(post) calculte in page then click on continue button , got new page and fill details , again click on continue button thing save in database after redirect payment gateway , after got final result so please let me explain ho load testing flow i believe need go trough following articles: correlation in jmeter in general asp.net login testing jmeter in particular the whole idea to make first http request first page extract dynamic parameters , save them jmeter variables via 1 of following postprocessors: regular expression extractor css/jquery extractor xpath extractor populate second http request using jmeter variables step 2 if need go...

dust.js - how to write some variable(name and value) in dust template using helper -

i have client side dust template , corresponding helper. helper : function(chunk, context, bodies, params) { }; now want write key value pair(from helper) can read in dust template. e.g.if write (k,v) in helper, in dust template {k} should output 'v' thanks, shantanu a helper in dust receives current chunk , context . can push new values onto context stack, , call chunk.render() . { "helper": function(chunk, context, bodies, params) { var obj = { "k": "value" }; return chunk.render(bodies.block, context.push(obj)); } } here, rendering default body ( bodies.block ), using existing context obj , pushed onto context stack. {#helper}{k}{/helper} {! k accessible inside context of helper !}

python - Elastic Search query filtering -

i have uploaded data elastic server " job id , job place , job req , job desc ". index my_index , doctype = job_list. i need write query find particular term " data analyst " , should give me matching results specified field " job place " . ie, data analyst term matching in documents , , need have "job place" information only. any help. tried curd . not working. if in python good. from elasticsearch import elasticsearch es = elasticsearch([{'host': 'your_host', 'port': 9200}]) q = {"filter": {"term": {"job desc": "data analyst"} }, "_source": { "include": ['job place'] } } # assume want "data analyst" in "job desc" field result = es.search(index='my_index', doc_type='job_list', body=q)

python UnicodeEncodeError on startup and not able to run any script -

when startup python following error: * python 2.7.8 (default, jun 30 2014, 16:03:49) [msc v.1500 32 bit (intel)] on win32. * unicodeencodeerror: 'ascii' codec can't encode character u'\xe9' in position 12: ordinal not in range(128) * remote python engine active * unicodeencodeerror: 'ascii' codec can't encode character u'\xe9' in position 12: ordinal not in range(128) i have python 2.7 installed problem appears when using portable version. idle of portable version runs without problem more used pyscripter environment. does know how rid of error? -rené

c++ - Bitmask as member enum with default parameter -

i can't figure out how implement bitmask parameter class. createmenudlg function i've searched google quite bit, finding sorts of forum questions ask bitmasks, bitfields, etc. , posts minimal example code i keep finding people using #define wouldn't work class since need call main dialog this: dialogmenu *p_dlgmenu = new dialogmenu( this, &p_dlgmenu, ); p_dlgmenu->createmenudlg( ( dialogmenu::closes | dialogmenu::window_handler ), dialogmenu::dlg_checkout ); here's code: class dialogmenu : public cdialog { declare_dynamic(dialogmenu) public: enum dlgflags { hides = 2^0, closes = (2^0)+1, window_handler = 2^1, msg_handler = (2^1)+1, dlg_shopping_menu = 2^2, dlg_dynamic_menu = (2^2)+1, }; dlgflags operator|=( dlgflags first, flgflags second) { return (dlgflags)( (unsigned)first | (unsigned)second ); } enum dlgtype { dlg_checkout, dlg_inventory_edit, dlg_shippin...

c# - How solve circular reference in Caliburn.Micro -

i working caliburn.micro v2.0.1 on windows 8.1 unversal (winrt) project. i followed caliburn.micro working winrt example. my code looks follows: app.xaml.cs protected override void onlaunched(launchactivatedeventargs args) { initialize(); displayrootviewfor<loginviewmodel>(); } protected override void prepareviewfirst(frame rootframe) { _container.registernavigationservice(rootframe); } loginviewmodel.cs public loginviewmodel(inavigationservice navigationservice, ...) { ... } the issue the onlaunched called first. initialize() configures winrt container. the displayrootviewfor<loginviewmodel> invokes instance of loginviewmodel , results in null exception because navigationservice has not yet been registered prepareviewfirst(frame) prepareviewfirst(frame) not yet called, having dependency on rootframe should configured onlaunched thus loginviewmodel dependent on registernavigationservice , registernavigationservice de...

Force child classes to implement protocol swift -

how can forced child class implement protocol declared in parent class? i tried this: protocol myprotocol { var myvar : string { } } class parentclass: myprotocol { var myvar = "parent" } class childclass: parentclass { } but child class doesn't force me override myvar. this possible ? thank much, morgan as far knowledge not possible in swift. if try conforming parent class's protocol, leads error "cannot override stored property". since protocol conformed in parentclass. protocol myprotocol { var myvar : string { } } class parentclass: myprotocol { var myvar = "parent" } class childclass: parentclass { var myvar = "hello" // throws compilation error, "cannot override stored property" since it's conformed parentclass itself. } added: in general words multi-level implementation of interface not possible, in ios words protocol's should implemented @ single level...

javascript - Validate request parameters in SailsJS -

in sailsjs, validate request parameters using same mechanism when models validated when model actions performed. so when define model use "attributes" option specify parameter properties, , used validation. but if you'd validate login form or email form on server side, there no model needed , you'd validate parameters? so i'd able this: //login validation req.validate({ email: { required: true, email: true }, password: { required: true } }); //send email validation req.validate({ subject: { required: true, type: 'string' }, to: { required: true, type: 'string' }, body: { required: true, type: 'string' } }); a function req.validate mixed in requests , called if req.options.usage set request, i've played bit don't quite understand it's doing. there no documentation on nor in "anchor" what's used validation. any or suggestions on how achieve (preferably undocumented sailsjs feature)?...

javascript - Browser freezes while appending data to DOM -

here's scenario. i've built grid min. 1 max. 132 columns more 10k rows. using knockout data binding. data fetched $.ajax function of jquery . on first call fetches 100 rows , 100 rows on each scroll. if less 100 returns rows. the browser not freeze when ajax call made browser freezes after ajax call. once we've data @ client side, binds table . browser freezes second or 2 while appending rows data table. function demodata(args){ var self = this; self.datalist = ko.observablearray(); self.filldata = function () { self.tablelistpager = new scrollpagerforaccordian($("#tblgrid"), 40, self.filldetaildata); $.ajax({ //api call }); self.loaddetaildata(data); } self.filldetaildata = function (pageno) { $.ajax({ //api call }); } self.loaddetaildata = function (res) { self.datalist.push(); } function scrollpagerforaccordian(el, recheight, callback) { } even tried put self.loaddetaildata(data) in web worke...

jquery - how to get difference between two dates using javascript -

this question has answer here: get difference between 2 dates in javascript? [duplicate] 8 answers i calculating number of days between 'from' , 'to' date. example, if date mm/dd/yyyy , date mm/dd/yyyy. how result using javascript? from date like:11/25/2014 date :11/27/2014 i need result 2 using javascript> the implementation john resig : // date difference. // @see http://ejohn.org/projects/javascript-pretty-date/ function prettydate(date, now){ var diff = (((now || (new date())).gettime() - date.gettime()) / 1000), day_diff = math.floor(diff / 86400); if (isnan(day_diff) || day_diff < 0 || day_diff >= 31) return this.format(date, 'yyyy-mm-dd'); return day_diff == 0 && ( diff < 60 && "just now" || diff < 120 && "1 minute...

javascript - Using AJAX to call PHP function on button click -

i creating file upload script. what wanted upload file without refreshing page here's code: upload.php <?php function upload(){ if(!empty($_files['file1']['name'][0])){ $files = $_files['file1']; $uploaded = array(); $failed = array(); $allowed = array('jpg','txt','png'); foreach ($files ['name'] $position => $file_name) { $file_tmp = $files['tmp_name'][$position]; $file_size = $files['size'][$position]; $file_error = $files['error'][$position]; $file_ext = explode('.', $file_name); $file_ext = strtolower(end($file_ext)); if (in_array($file_ext,$allowed)) { if ($file_error === 0) { if($file_size<=20971520){ $file_name_new = uniqid('',true).'.'.$file_ext; $file_destination = 'test_uploads/'.$file_name_new; if (move_uploaded_file($file_tmp, $file_destinatio...

javascript - Number of specific files in a folder -

i need know how many files of specified type (eg. jpg) reside in server folder. something like var numberoffiles = countfilesinfolder(); //i made method is there javascript or ajax solution? ajax method should invoke? //edit: i'm not seeking php/ajax solution, outputting , xml , reading via javascript.

wsdl - OpenESB - different environments -

i developing service layer app provides catalog of webservices, orchestrating them using openesb. i create bpels importing external wsdl definitions using http://localhost:8080/services/myservice?wsdl . the problem -- these bpels depend on specific url, , when deploy on production server, esb layer stops working. how can make bpels independent of specific endpoint? can refer uris external config file? to must create application configuration , application variable , add them on http address. example: "http://${myhtttpaddress}:${myhttpport}/service1/myservice?wsdl"/>. applications , variable set in administrative console , can changed each environment. regards paul

How to find a best fit circle/ellipse using R? -

Image
i've been reading few methods fit circle data (like this ). see how methods work on real data , thought of using r this. tried searching rseek packages can came nothing useful. so, there packages compute best fit circle given data set (similar how lm() fit linear model data set)? otherwise, how might 1 perform such task in r? here's naive implementation of function minimises ss(a,b,r) paper: fitss <- function(xy, a0=mean(xy[,1]), b0=mean(xy[,2]), r0 = mean(sqrt((xy[,1]-a0)^2 + (xy[,2]-b0)^2)), ...){ ss <- function(abr){ sum((abr[3] - sqrt((xy[,1]-abr[1])^2 + (xy[,2]-abr[2])^2))^2) } optim(c(a0,b0,r0), ss, ...) } i've written couple of supporting functions generate random data on circles , plot circles. hence: > xy = sim_circles(10) > f = fitss(xy) > plot(xy,asp=1,xlim=c(-2,2),ylim=c(-2,2)) > lines(circlexy(f$par)) note doesn't use gradi...

SQL Server - Order by part of a result -

i wondering if lend me hand. i have quite lengthy sql query. what want break down column stores date , order results year. part of query follows: select convert(char(8), dateadd(minute, -601, pay.expiry), 10) dailydate table order dailydate this gives me 'dailydate' outputted in following format: 12-07-14 the year last 2 digits. is there way can sort results based on 2 digits? any great. cheers, use query. select convert(char(8), dateadd(minute, -601, dailydate ), 10) dailydate table order substring(convert(char(8), dateadd(minute, -601, dailydate ), 10), 7, 2), substring(convert(char(8), dateadd(minute, -601, dailydate ), 10), 4, 2)

Android Bluetooth device scan/discovery for CLassic and Low Energy Devices sequentially -

i developing android app searches classic , low energy bluetooth devices such when press "search" button show me bluetooth devices (low energy , classic) in range. since classic bt discovery , le scanning different things, have implement them separately , combine them in 1 function such that searchfirstlowenergythenclassic() or searchfirstclassicthenlowenergy() in order implement this, have know when discovery/scanning ends start scan/discovery other technology. here implementation: started classic bt discovery received bluetoothadapter.action_discovery_finished started ble scaning -> onreceive action equals(action_discovery_finished) stop search when ble scan ended this looks ok there problem when extend behavior. when want search, start searching first le scan or classic discovery based on last connected technology. example if last time device connected classic bt device, searchfirstclassicthenlowenergy() run. otherwise, searchfirstlowenergythenclassic...

webdav - How to attach a cookie to the request from Windows Explorer (IT Hit Web Dav) -

i in process of placing federation authentication webdav feature trying implement using hit web dav library. library documentation under adding webdav existing project , mentions: neither microsoft miniredirector nor mac os x finder nor versions of microsoft office support forms/cookies authentication. in addition that, had on sources (from 2010) , read cookie cannot sent through windows explorer. however, using windows 7 , have mapped webdav folder microsoft sharepoint using microsoft miniredirect , can see (using fiddler web debugging tool) cookie federation authentication token sent along request. from research understood should using internet explorer achieve this. not sure if misunderstanding something, there way attach cookie request windows explorer? ps. have logged in webapp internet explorer logged in federation gateway successfully. ok here comments , process far. might helpful working on this. i using internet explorer, added web app host trusted...

datetime - Parsing dates with correct time zone in perl with core modules only -

i have several checks dates read database. instance, have compare them perl script's local time. have determine calendar date of parsed date. in order have readable code, i have identical time zone information in both generated ( localtime ) , parsed ( strptime ) time objects. the solution should 1-file only, task should done core perl modules (version 5.10). datetime module doesn't seem option. the closest have come time::piece , there seems no way time object parsing identical 1 obtained time::piece::localtime() . use time::piece; use strict; use warnings; use 5.010; sub mystrptime1 { $datestr = shift; $tzoffset = sprintf '%+03d00', localtime->tzoffset->hours; $t = time::piece->strptime("$datestr $tzoffset", '%y%m%d %h:%m:%s %z'); } sub mystrptime2 { $datestr = shift; $t = time::piece->strptime($datestr, '%y%m%d %h:%m:%s'); # interpreted gmt, subtract time zone offset :-( return $t - time::p...

format - how could I handle an iterative naming system for this? -

i have dataset of kind, dataset contains missing values (i'm representing them x). id va vb ... vn | id va vb ... vn | 1 a1 b1 ... n1 | 1 a1 x ... n1 | 2 a2 b2 ... n2 |=== 2 x b2 ... x | 3 a3 b3 ... n3 |=== 3 a3 b3 ... n3 | .................. | .................. | n bn ... nn | n x bn ... nn | i want add observations id using 1 variable column, call variable var: inverted proc format id; var var;. id var 1 a1 .. 1 n1 2 b2 .. 3 a3 3 b3 .. 3 n3 .. n bn .. n nn so tried split olddataset in different datasets (newa newb ...newn) where, in each dataset have not-missing observations stored in column called var. merge newa newb ... newn in newdataset , apply proc sort restoring order id. the problem arised when realized "n" not known prior analysis 'cause want setup generalized code won't work 1 dataset, , va vb vn result of p...

gulp - "require not defined" when testing with proxyquireify stubs -

hello have project uses gulp build framework, , used karma jasmine testing. i trying integrate proxyquireify mock requires, added proxyquireify browserify plugin in karma config, using karma-browserify. but results in error when running tests, in first line, saying 'require undefined'. what doing wrong? here karma config // karma configuration // generated on wed nov 26 2014 17:57:28 gmt+0530 (ist) module.exports = function(config) { config.set({ // base path used resolve patterns (eg. files, exclude) basepath: '', // frameworks use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['browserify', 'jasmine'], // list of files / patterns load in browser files: [ './components/renderer/**/*.spec.js', './components/tracker/**/*.spec.js' ], // list of files exclude exclude: [ ], // preprocess matching files before servin...

Linux, BlueZ, Initiating an hid BlueTooth Connection -

use-case ubuntu machine simulating keyboard ubuntu machine ( virtual keyboard ) imitates connection remote device controlled question in normal scenario, hid desc reported through sdp, , thus, when device connects keyboard knows hid desc used, in use-case, virtual keyboard ( ubuntu machine ) initiate connection, , thus, it's not triggered using sdp, having said, how should send device hidreport descriptor used? possible, at-all, connect keyboard device in manner? can push hid report desc device ( controlled ) ? implementation pair device ubuntu machine ( done manually ) initiate l2cap connection on psms 0x11 & 0x13 handshake all working far, point when expect report hid descriptor device, how should done ? as far understand it, hid host reads service descriptor once. afterwards, can initiate connection must conform have told host via sdp. i have not come across way push information hid host later. if need change something, must clear host...

which function gives me the dataprovider loop counter in testNG -

i'm logging testresults db while testng runs testcases. i'm using excel sheet provide input data . for eg: tablename row1 col1 row2 col2 tablename i want know, row getting executed ? there might function in dataprovider class storing counter. please me counter value. thanks in advance. not sure try do; data provider can hardly allow information want. possible access method arguments directly if 1 implement itestlistener interface. @override public void onteststart(itestresult result) { object[] params = result.getparameters(); }

windows - Batch rename w/ Powershell - needs to look up and match file_id with title in csv -

i know batch renaming possible via powershell, far didn't find answer solves problem: i have staple of pdfs named id: eg. 332906.pdf 331339.pdf 343807.pdf ... i produced simple csv out of spreadsheet contains id in first column , corresponding filename want in second one: appid;fullname i.d. 332906;mike miller_332906; 331339;tom hanks_331339; 343807;scarlett jo_343807; .... .... i have on office computer can't download additional programms or use programming lanugages, have cmd box , powershell. can that? thank help! edit: spreadsheet changed csv; csv example added you may have problem column heading as-is, if change below: appid,fullname_id 332906,mike miller_332906, 331339,tom hanks_331339, 343807,scarlett jo_343807, you can run simple script file rename: $c = import-csv .\path\to.csv $c | % { mv "$($_.appid).pdf" "$($_.fullname_id).pdf" } what create powershell object containing data csv file. $c | % { .. } means...

c# - Waiting for multiple async request -

i'm working on application sending tcp requests server. problem on client side. responses handled via delegates keep things asynchronous. here signature of 1 request method : public void requestone(object data, mycallback callback) but i'm dealing delegate dictionary (resquest,delegate) keep track of requests supposed update client state. i don't think it's right way it. i'm looking better architecture. any ideas / pattern ?

javascript - How do I update a Google Map Engine Table? -

i have table in google maps engine update dynamically javascript in google site. i've found this page explains how append features existing table, i'm struggling figure out how modify code update table instead of append it. believe need modify processresponse , processerrorresponse functions. however, i'm new javascript/jquery/json, , i'm not sure how determine should have instead of #insert-table-features-response . there here explain me? edit: put way, how can make request shown below javascript? post https://www.googleapis.com/mapsengine/v1/tables/{your_table_key}/features/batchpatch?key={your_api_key} content-type: application/json authorization: bearer {. . .} x-javascript-user-agent: google apis explorer { "features": [ { "geometry": { "type": "point", "coordinates": [ -82, 35 ] }, "properties": { "lat": 35, "long": -82, ...

x11 - Register hotkey with only modifiers in Linux -

i'm using this sample set hotkey in program in linux x11 graphic system. problem don't understand how set hotkey combinations ctrl + alt , ctrl + shift , i.e. without key, modifers. i'm trying this: keycode key = xkeysymtokeycode(display, 0); //no key code xgrabkey(display, key, controlmask | shiftmask, grabwin, true, grabmodeasync, grabmodeasync); but it's not working. however, working (kind of): keycode key = xkeysymtokeycode(display, xk_alt_l); //alt key xgrabkey(display, key, controlmask, grabwin, true, grabmodeasync, grabmodeasync); i don't solution, because: logically wrong it's fires when ctrl + alt pressed, not alt + ctrl , i.e. pressing order important it's blocking other combinations in windows ctrl , alt keys. what doing wrong?

fwrite - Php Lock files when writte -

i testing code using little database in txt files. important problem have found is: when users write @ same time 1 file. solve using flock . os of computer windows xampp installed ( comment because understand flocks works fine on linux no windows ) need test on linux server. actually have tested code loading same script in 20 windows @ same time. firsts results works fine, after test database file appears empty. my code : $file_db=file("test.db"); $fd=fopen("".$db_name."","w"); if (flock($fd, lock_ex)) { ftruncate($fd,0); ($i=0;$i<sizeof($file_db);$i++) { fputs($fd,"$file_db[$i]"."\n"); } fflush($fd); flock($fd, lock_un); fclose($fd); } else { print "db busy"; } how it's possible script deletes database file content. proper way: use flock fixing of existing code or use other alternative technique of flock ? i have re-wro...

java - Using client-server to move object on screen -

so i'm trying use client-server keylistener. when messages "#left" or "#right" sent server, should update graphical object , shift left calling map.repaint() method. instead, shifts object once , no further responses happen. posted below code. can offer solution? // server @override protected void handlemessagefromclient(object msg, connectiontoclient client) { // todo auto-generated method stub if(msg instanceof string) { string message = msg.tostring(); if(message.equals("#connect")) { string error = "already connected"; matcher match = null; (int = 0; < matches.size(); i++) { if(matches.get(i).contains(client)) { match = matches.get(i); try { client.sendtoclient(error); ...

asp.net - Response.write only shows the first record from the database (this.session.sessionid) -

i've got problem past few days. explain short i've did. have table created in database called 'cart'. cart cointains: clientid, artical number, , quantity. in clientid, session.sessionid stored. in artical number 1012. , in quantity number 1 or 3. what to, retrieve records, session.session id of user. work in page, first record of 4-5 records in cart table shown. think comes due problem looks this.session.sessionid and when found one, doesn't further that. i've tried loop through query sessions is. won't let me loop because doesn't know for ? if loop whole query outside of this: for (int = 0; < sessies.length; i++) show more records.. first records.. know stupid try can try.. looked on internet couldn't find solution this. hope response somebody. gratefull. used following code: using (sqlconnection cn = new sqlconnection(configurationmanager.connectionstrings["garageconnectionstring"].tostring())) { string se...

opencv - What can I detect with the haar classifier? -

lets want train cascade recognize 1 object, object has different shapes. example if want recognize cup. know there cups in many shapes have similarities. or example: steering wheel. can tell object steering wheel has different shapes. question: can train cascade recognize of different shapes of 1 object? if train 1 cascade many false positives due high variance of positive samples. however if have, 20 stable classifiers, focused on different shapes, can or , use them. suggestions on steering wheel case do not use steered wheels positives, use 0 - degree wheels, make classifier converge onto something. group wheels similarity in shape (color not important boosted cascade , background not important because cars have similar gauge displays) , train cascades on these groups search wheel in rotations - note symmetries - since boosted cascade rotation invariant - , steering wheel steered.

Access 2003 SQL Syntax error -

i new access 2003 , been stuck on query have wrote while now. tables , column names, operators , brackets believe correct getting syntax error after inserted following join operation from (tdailyentries inner join tledgers on tledgers.action = tdailyentries.actionno) inner join (tprojects below full code select distinct tprojects.cc_io projectno, year([datefrom]) & " accrual " & monthname(month([datefrom])) & " - "+[companyname] & " ( "+([lastname]) & ")" [line/item/text], tusers.lastname last_name, tdailyentries.userid userid, contractordailyrate dailyrate, contractordailyhours hours, round(contractordailyrate / contractordailyhours, 2) hourlyrate, round(sum(tdailyentries.calculateddailyhours), 2) monthlyhours, round((hourlyrate * monthlyhours), 2) charge, round(charge+round((charge*0.2),2),2) accruals, tprojects.project project (tdailyentries inner join tledgers on tledgers.action = tdailyentries.actionno) ...

c# - Fill a datatable with products from the magento SOAP api -

i working on stock update application magento website. have api installed , works correctly. want fill datatable product sku's website. log in code: string mlogin = mservice.login("user", "pasword"); label1.text = convert.tostring(mlogin); thanks.

asp.net - the browser saved my javascript function name and buged my site -

hello guys today spent half day trying figure out why website went crazy , finnaly managed figure out , wondering can prevent in future. here happened : got simple js file function standardalert( ) { grid1.save() window.alert( "the information has been saved!" ) } now today been doing changes on site , added function different name shows different window.alert from moment on every time clicked save button had error on error log : "invalid postback or callback argument. event validation enabled using in configuration or <%@ page enableeventvalidation="true" %> in page...." i been going crazy.. checking old backups changing , forth changes made today. eventully few minutes ago finnaly found out problem. browser saved old function name , everytime clicked save button had onclientclick event assosiated old function name got error. ofcourse uplodaed different versions of js file didnt matter browser! so question how c...

java - Using JSTL url and param tag -

i have list of sizes user can choose from, posssible build parameter based on link user clicks? for example, there following html <ul class="options list-unstyled"> <h4 class="m_9">select size</h4> <li><a href="?size=s">s</a></li> <li><a href="?size=m">m</a></li> <li><a href="?size=l">l</a></li> <li><a href="?size=xl">xl</a></li> <div class="clearfix"></div> </ul> and there in controller @requestmapping(value = "/addprodtocart", method = requestmethod.post) public modelandview cart(@requestparam("productid") integer id, @requestparam("size") string size) {} disregarding productid size requestparam equal ever 1 user clicked. temp...

oauth - Client ID for Android application with different flavors -

i'm creating app has 15 (!) flavors. app works google play services, need register client id application. every flavor has own applicationid (package name) , google developers console needs package name certificate sha1 fingerprint. flavors use single keystore. should register 15 different android apps on google developers console? possible single client id different flavors? package name identifies app, 15 different packages means 15 apks. 1 project work on has on 20 , works fine.

Processing image and find outer edge. Find an algorithm -

Image
i have problem 1 steps have do. important problem. have image, example: the second step's select part of image: ok. if have image in cache, selected area: early steps have done. problem last step, task select (exactly outer) border area. here's example how should looks: my ask's algorithm or steps have last effect. it's feasible images? prefered language's c#/c/js if know knowledge solution nice! had find algorithm detect edge, not outer edge. maybe try following: pick random 10 pixels borders of selection (it important borders) get average rgb of pixels get max = max color distance between pixels perform white flood fill tolerance = k*max, starting 1 of edge pixels this way should able flood fill gray background in selection

vb.net - How can I use a Resource as a string parameter? -

i want use xml-file dataset save changes. datatable.readxml("c:\test.xml") works fine. want use xml resource file. tried dim xmldoc string xmldoc = myapplication.my.resources.xmltestfile datatable.readxml(xmldoc) gives me error illigal sign in path , debugging shows me xmldoc empty. could me working? readxml requires filename not content use dim ds new dataset() using stringreader new stringreader(.......resource.here.......) ds = new dataset() ds.readxml(stringreader) end using dim dt datatable = ds.tables(0)

haskell - Why does cabal download and compile from source? -

when make new project. say, web app using snap. generate skeleton using snap init barebones , make new sandbox , install dependencies. this takes forever. seriously. if have ever worked pretty other web framework (node.js express, example), process identical takes fraction of time. i'm aware node dependencies not require compilation find strange isn't considered bigger problem. example, never able run yesod app on cheap vps because vps isn't powerful enough compile , can't upload 500mb of precompiled libraries. the question is, why doesn't repository host binaries instead of code? .net compiled (to bytecode) can use it's dlls without need recompilation. there of course drawbacks of hosting binaries more storage space needed, multiple binaries per library multiple oss... problems seems insignificant huge benefits such as no more compile errors much faster setup new projects significantly less memory needed knowing library doesn't support os b...

Printing lists in python without spaces -

i doing program changes number in base 10 base 7, did : num = int(raw_input("")) mod = int(0) list = [] while num> 0: mod = num%7 num = num/7 list.append(mod) list.reverse() in range (0,len(list)): print list[i], but if number 210 prints 4 2 0 how rid of spaces you can use join list comprehension: >>> l=range(5) >>> print l [0, 1, 2, 3, 4] >>> ''.join(str(i) in l) '01234' also, don't use list variable name since built-in function.

Eclipse doesn't start after installing VisualVM plugin -

i tried install visualvm plugin. eclipse doesn't start , log file looks like: !session 2014-11-27 16:40:55.574 ----------------------------------------------- eclipse.buildid=4.3.0.i20130605-2000 java.version=1.6.0_39 java.vendor=sun microsystems inc. bootloader constants: os=win32, arch=x86_64, ws=win32, nl=de_de framework arguments: -product org.eclipse.epp.package.java.product -clearpersistedstate command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product -clean -clearpersistedstate !entry org.eclipse.update.configurator 4 0 2014-11-27 16:41:01.775 !message unable find feature.xml in directory: c:\program files\eclipse\features\visualvm_launcher_1.1.1.jar i copied files zip right place! even starting eclipse following params -clean -clearpersistedstate don't help. just copying visualvm_launcher_1.1.1.jar file features folder won't work, needs folder not file. visual vm plugin distributed p2 update site, b...

android - Detect if free app has been purchased for money -

we planning on changing our paid app, "free" (demo) app in-app purchase unlock full game. our problem making transition have customers who've paid app. therefore need ensure wont have pay they've bought once. have looked every possible solution can think of, without luck. licensing out of question, return valid free apps. any suggestions appreciated. fallback we'll have create 2 apps, rather prefer keep single one. regards jannek edit: thanks feedback. didn't find solution, ended using first achievement unlock game default. covers 80% of our players. unfortunately 80% of pirates. remaining 20% setup token server, can unlock game entering last 8 digits purchase info. this allows give out promo codes on google play. a couple of unsatisfying solutions: update app before make free. collect ids somehow of people use , record them. downside miss people update or use app. release paid app new package. convert old 1 "pre-paid licenc...

javascript - How to decrypt a field sent from client to Node server using CryptoJS? -

i trying adapt following solution node application decrypt field sent client browser via post: how decrypt cryptojs using aes? seem going round in circles in getting values match in console. values encryption of 'hello' match both applied server , client (sending 'hello' there no decryption value showing either. the server side code in node post route: var enc_key = "c2vjcmv0"; //'secret' app.post('/hello', function (req, res) { console.log('post /hello'); var key = cryptojs.enc.base64.parse(enc_key); console.log('key: ' + key); console.log('client msg ("hello"): ' + req.body.msg_hello); var encrypted = cryptojs.aes.encrypt("hello", key, { mode: cryptojs.mode.ecb, padding: cryptojs.pad.pkcs7 }); console.log('server msg "hello" encrypted to: ' + encrypted); var decrypted = cryptojs.aes.decrypt(encrypted, key, { ...