Posts

Showing posts from July, 2010

php - AddressVerify API — do not have permissions to make this API call -

i have called addressverify api of paypal in sandbox mode returns error, [l_errorcode0] => 10002 [l_shortmessage0] => authentication/authorization failed [l_longmessage0] => not have permissions make api call [l_severitycode0] => error my code addressverification is, function verify_address($paypalconfig, $email, $street, $zipcode) { $paypal = new paypal($paypalconfig); $avfields = array( 'email' => $email, 'street' => $street, 'zip' => $zipcode, ); $paypalrequestdata = array( 'avfields' => $avfields, ); $paypalresult = $paypal->addressverify($paypalrequestdata); return $paypalresult; } i want know there setting enable api call or other method call api successfully? address verification not enabled sandbox. so, need open support request or make phone call enable that.

iphone - Drawing by finger move responding slow in iPad -

below code working responding slow, not draw fast finger movement. think subview “testview” cause of basic requirement of application. in homeview.h file iboutlet uiimageview *imgdraw; iboutlet uiview *testview; @private cgpoint currentpoint; cgpoint previouspoint1; cgpoint previouspoint2; here i’m using testview sub view in homeview draw within testview , here imgdraw existing within testview. in homeview.m file - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event { mouseswiped = yes; uitouch *touch = [touches anyobject]; currentpoint = [touch locationinview:testview]; previouspoint2 = previouspoint1; previouspoint1 = [touch previouslocationinview:self.view]; currentpoint = [touch locationinview:self.view]; // calculate mid point. cgpoint mid1 = midpoint(previouspoint1, previouspoint2); cgpoint mid2 = midpoint(currentpoint, previouspoint1); uigraphicsbeginimagecontext(testview.frame.size); [img...

c# - Compare multi rows with a row in SQL Server 2008 -

i have asp.net c# project, study case, "a university website" i have table called agenda , contain 9 columns [agendaid] uniqueidentifier [matirelid] [instructorid] [classid] [addeddate] [semester] [starttime] [endtime] [dayschedule] and shows material available, instructor, in days, in time start , end, in class, in same semester. what need: when add new row, should check if overlapping of existing row. if have overlapping , give me error. ps: instructorid, matirelid , classid foreign keys other tables. prefer make in stored procedure in sql server 2008. kindly & best regards assuming all columns have match duplicate - you'd use this: create procedure dbo.insertnewrow @agendaid uniqueidentifier., @matirelid int, -- did not mention *types* columns have - adapt needed! @instructorid int, @classid int, @addeddate datetime, @semester int @starttime time(7), @endtime ...

Kindle USB-connection -

how kindle distinguish pc connection , charging via grid? i'm trying implement adapter , needs kindle on when it's plugged in. you should take @ usb battery charging specification , @ section 3.

php - Refresh a access token with google analytics api -

i try refresh access token google analytics api (php) i've invalid_grant error ... that's process: 1. save first acces token in database offline request, response is: {"access_token":"ya29.ahes6zspmuykfx06bw89lnlfra5memwdthycuj6d7brmdcq","token_type":"bearer","expires_in":3600,"refresh_token":"1\/1xlo8pls2pb0nps-t-lt07jww_stbwyg3igrb08zbka","created":1338810086} 2. check token info, if "expires_in" < 0 try refresh token: if ($infoat['expires_in'] <= 0) { $row = $database->loadobject("select refresh token id=1"); $client->refreshtoken($row['refresh']); } and i've invalid_grant error ... any ? lot , sorry english ...

azure webjobs - ASP.NET long running task ideas -

very have send data , third party accounting systems asp.net sites using sql server. data imports take awhile , i'm trying find best method handle long running tasks ability update user if want see how it's doing. questions of pros , cons methods below , recommend , why? old style asp response.write: i use quite bit , @ moment go method because it's fast. haven't had many problems it. thought app pool recycling issue don't think recycle while in middle of request. using iframe proposed here http://encosia.com/easy-incremental-status-updates-for-long-requests/ : similar above method except asynchronous.i'm not sure if allow asp.net restart a separate windows app calls web service site: i have used method takes little longer set , stop running when app pool recycles. not use method windows workflow: have not used seems like(especially small data updates) overkill windows service: same above. seems difficult ajax, separate thread , timer poll cached res...

wpf - Listbox of hyperlinks won't show clicked hyperlink as selected or current item -

i have listbox hyperlinks in 1 of grid cells. when click on of items in listbox, current item first record in listbox , selected item null. here wpf. doing wrong? <datatemplate x:key="celltemplate.inputmanagerslist"> <stackpanel orientation="horizontal"> <listbox itemssource="{binding path=inputmanagers}" horizontalalignment="left"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <textblock> <hyperlink name="inputmanagername" command="{binding relativesource={relativesource findancestor, ancestortype={x:type usercontrol}}, path=datacontext.openinputmanagerviewcommand}" commandparameter="{binding relativesource={rel...

jquery - Creating a transparent image with only CSS and HTML -

Image
is possible create image css/html only, without javascript? because content dynamic , image transparent. you have split image layers: the colorful background the white layer transparent circle the eye , other icons put inside circle it this: html: <div class="colorful-box"> <div class="box-with-circle"> <span class="eye icon"/>lorem ipsum eye </div> </div> <div class="colorful-box"> <div class="box-with-circle"> <span class="ear icon"/>lorem ipsum ear instead </div> </div> css: .colorful-box{ background: url(link-to-the-colorfull-background.jpg); width: 400px; height: 100px; float: left; } .box-with-circle{ background: url(white-box-with-transparent-circle.png); margin: 10px; width: 380px; height: 80px; float: left; } .icon{ width: 80px; height: 80px; floa...

javascript - App gets force close in android -

i have developed phonegap android app.i have been running app in background when button clicked using android service , show notification , alert.and show ads(inmobi) using javascript.both background process , ads working fine.but got error(sometimes) in logcat , app gets force closed.in background process getting values server using web service here logcat error: java.net.unknownhostexception: host unresolved:mypath @ java.net.socket.connect(socket.java:1038) @ org.apache.harmony.luni.internal.net.www.protocol.http.httpconnection. <init>(httpconnection.java:62) @ org.apache.harmony.luni.internal.net.www.protocol.http.httpconnectionpool. get(httpconnectionpool.java:88) @ org.apache.harmony.luni.internal.net.www.protocol.http.httpurlconnectionimpl. gethttpconnection(httpurlconnectionimpl.java:927) @ org.apache.harmony.luni.internal.net.www.protocol.http.httpurlconnectionimpl. connect(httpurlconnectionimpl.java:909) @ org.ksoap2.transport.serviceconnectionse.connect(service...

android - Render Html Elements on WebView for EPub Reader -

i'm making epub reader the library paul siegmann http://www.siegmann.nl/epublib/android i extracted table of contents listview , , item linked webview displays content of chosen chapter. i don't find problem in displaying e-pub file has pure text elements, when comes e-pub file containing html elements (links, images), can't displayed. does know how render html elements on webview according case? here classes: public class epubreaderactivity extends listactivity { private layoutinflater inflater; private list<rowdata> contentdetails; public static final string book_name = "ferring.epub"; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); inflater = (layoutinflater) getsystemservice(activity.layout_inflater_service); contentdetails = new arraylist<rowdata>(); assetmanager assetmanager = getassets();...

reporting services - SQL Case for WHERE clause IN -

i trying pass report parameter stored procedure (@time) dictate category values returned in data set via clause , don't know syntax accomplish correctly. suspect case/if need used , i've done before not when needing clause in. declare @time nvarchar set @time = 'reg' --possible values of 'reg' , 'ot' select f.[category] [category] foo f @time = case @time when 'reg' f.[category] in (a, b, c, d) when 'ot' f.[category] in (e, f, g) end first, when declare character variable, should include length. so, declaring @time 1 character. think want 3-characters. second, when declare nvarchar() variable, assign nvarchar() it. syntax n'reg' rather 'reg'. third, in in list? intend these constants or columns in data? and, finally, want clause like: where (case when @time ='reg' , f.[category] in (a, b, c, d) 'true' when @time ='ot' f.[category] in (e, f,...

Java ProcessBuilder memory -

i wondering if knew certainty whether processbuilder/runtime.exec() executes inside space of jvm's memory or whether uses separate system memory , somehow sends output java. not find documentation on subject. i assume former due security issues , being able read output, make absolutely sure. the new process runs outside java process started it. allocation of memory new process managed operating system, part of process management . the java class processbuilder , provides interface starting , communicating new process, runs inside java process.

ajax - jQuery merge loop returns? -

i'm trying loop results 1 using ajax send of them once here's code more explanation : <div class='item'>name1</div> <div class='item'>name2</div> jquery $(".item").each(function(){ var value = $(this).text(); }); ^ returns both name1 , name2 not @ once, need merge them can send them both ajax request this how want ( invalid code ) $(".item").each(function(){ var value1 = $(this[0]).text(); // tho dont wanna use numbers, wanna of them var value2 = $(this[1]).text(); var final = value1 + value2; // name1name2 }); $.get('go.php', {items : final}, function(... this invalid code ^ give example of how should end with first problem merging, don't know how should be, , second want call var final outside loop wont repeat request fiddle: http://jsfiddle.net/iambriansreed/wf3sf/ try: var final = []; $(".item").each(function(){ final.push(this.innerhtml); })...

javascript - Multiple Markers with Data in Text Bubble from Google Map -

i trying create google map canvas markers of indicating 2 separate starbucks locations. when click on each marker, text bubble populate information google maps has regarding location (address, phone...). know how place marker on page, having trouble figuring out how populate bubble data google maps. start checking out google places library section of developer's guide familiar how works , can use placesservice api doc when ready start coding. of related javascript classes in area of api doc.

html5 - Create play buttons for facebook timeline like Spotify? -

i know spotify facebook partner special privileges. facebook's opengraph api has been around while, possible create html5 player works on people's timelines? i'm not sure it's called. ticker - multiple audio links? i want supply list of play buttons. when each play button clicked, needs play song , play next. since competing service, don't want use spotify's api. our company uses custom flash-based player, users have click , load flash player reduces click-through , doesn't work on non-flash based browsers. are there other companies have non-flash players embed facebook news feeds/timelines? the music open graph actions restricted facebook white listed developers. there several music services have access it, they're known (pandora, i<3radio, etc). there no form or application process white listed, must invited.

php - Mustache vs other engines. Maybe I should use another template engine? -

i'm passing object mustache , object has method 1 parameter. possible mustache , php? {{object.method(parameter)}} if gets laborious achieve mustache, template engine recommend? remember need pass parameters object methods while in view context (like helpers). nearest possible mustache syntax welcome. this not possible in mustache. that said, solve whatever you're looking solve proper viewmodel, more mustache approach. if absolutely must able pass parameters object methods, we're talking logic in templates. while not inherently bad thing, not mustache thing :) for solid templating language php (besides mustache, of course), i'd recommend twig.

MATLAB: How to load an array without delimiter from file -

i have been using load function until load space separated files arrays in matlab. wastes lots of space me since values either 0 or 1. instead of writing files 0 1 1 0 1 1 1 0 i removed spaces create half big files like: 0110 1110 however load doesn't work correctly more (creates matrix think first number, 2x1 instead of 2x4). looked around importdata, reading file line line , lots of other stuff couldn't find clear solution. want read matrix file doesn't have delimiter. every number element of array does know of clean way this? thanks here 1 way: data.txt 0110 1110 matlab %# read file lines cell array of strings fid = fopen('data.txt','rt'); c = textscan(fid, '%s', 'delimiter',''); fclose(fid); %# extract digits c = cell2mat(cellfun(@(s)s-'0', c{1}, 'uniform',false)); result: c = 0 1 1 0 1 1 1 0 if concerned memory, maybe cast boolean: c = logica...

vb.net - Line Count (File Qty) from Listbox Items -

here current code using add files , check number of lines in each file selected (file qty). added seperate listbox viewing. dim selecteditems = (from in listbox2.items).toarray() each selecteditem in selecteditems listbox1.items.add(selecteditem) listbox2.items.remove(selecteditem) dim fileqty = selecteditem.tostring dim linecount = system.io.file.readalllines(textbox1_path.text + "\" + fileqty).length listbox6.items.remove(linecount) next i'm not sure how count files selected obtain grand total. if getselecteditems(), give indexes of selected files. .count on have number of selected items. or count number of times did for. give same answer.

MySQL COUNT on WHERE Statement -

pleas me on why count condition on statement commits error, , how fix it?. select jq.taskqueueid,jq.jobid (select p.taskid `curenttaskid`, p.taskname `currenttaskname`, p.processingtype `currentprocessingtype`, p1.taskid `prevtaskid`, p1.taskname `prevtaskname`, p1.processingtype `prevprocessingtype` projecttask p left join projecttask p1 on p.sequenceno=p1.nexttasksequence , p.projectid=p1.projectid p.taskid=18) task inner join taskslogs tl on tl.taskid=task.`prevtaskid` , tl.statusdefinitionid=1 inner join jobqueue jq on tl.taskqueueid=jq.taskqueueid count(jq.taskqueueid)=count(tl.taskqueueid) to use aggregate function count() need grouping of data, if want use condition can't use th...

Loading external python modules for Pig UDFs on Amazon EMR -

i've created python udf convert datetimes different timezones. script uses pytz doesn't ship python (or jython). i've tried couple things: bootstrapping pig install it's own jython , including pytz in jython installation. can't pig use newly installed jython, keeps reverting amazon's jython. setting pythonpath local directory new modules have been installed setting hadoop_classpath/pig_classpath new installation of jython each of these ends "importerror: no module named pytz" when try load udf script. script loads fine if remove pytz it's external module that's giving problems. edit: put comment thought i'd make edit: i've tried every way know of pig recognize jython jar. hasn't worked. amazon's jython here: /home/hadoop/.versions/pig-0.9.2/lib/pig/jython.jar, recognizing sys.path: /home/hadoop/lib/lib. can't figure out how build external libraries against jar. could manually hack sys.path inside of ...

iphone - loading a nib file that is instantiated from a storyboard -

so pretty new story board concept. have view nibs dropped in storyboard , each corresponding uiviewcontroller subclass have, tried loading nib file using following code: testviewcontroller *vc = [[testviewcontroller alloc] initwithnibname:@"testviewcontroller" bundle:nil]; [self.view setbackgroundcolor:[uicolor bluecolor]]; [self.view setframe:cgrectmake(0, self.profilepicture_.frameheight + self.profilepicture_.framey + 10, self.scrollview_.framewidth, 100)]; [self.view addsubview:vc.view]; however, gives me following error: *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'could not load nib in bundle: 'nsbundle </users/aditya15417/library/application support/iphone simulator/5.1/applications/64e6cec9-e6dc-4af5-bf16-11bfb6415bdc/pulse.app> (loaded)' name 'testviewcontroller'' so question is, if have nib in story board not possible use initwithnibname? if there way, how do thi...

ruby on rails - Can't start unicorn in production - can't convert Pathname into String (TypeError) -

i have rails 3 (spree) application can start in development not production. if run bundle exec unicorn -c config/unicorn.rb -d -e development works. however, bundle exec unicorn -c config/unicorn.rb -d -e production , returns with: master failed start, check stderr log details here's unicorn.stder.log file: i, [2012-06-04t17:31:54.497851 #10431] info -- : listening on addr=/tmp/unicorn-uspatriottactical.socket fd=5 i, [2012-06-04t17:31:54.499222 #10431] info -- : refreshing gem list /var/rails/uspatriottactical/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require': can't convert pathname string (typeerror) /var/rails/uspatriottactical/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require' /var/rails/uspatriottactical/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require' /var/rails/uspatriottactical/shared/bundle/ruby/1.9.1/ge...

javascript - Phonegap deviceNotReady event? -

like others , i'm trying tell difference between javascript code running in mobile browser , in phonegap webuiview. standard solution wait deviceready event fire, because after fires, know you're in phonegap. how long wait? i have code want run possible because don't want users sit around waiting. don't want run before phonegap initialized, if it's going initialize. i'm looking devicenotready event fires when after cordova.js code has run , determined there's nothing attach to. or variable can poll tell difference between cordova still loading , cordova having given trying load. there difference? i hate solution, it's best i've come with. please tell me there's better this: function whenloaded(callback,timeout) { var when_loaded_needs_running = true; document.addeventlistener('deviceready', function() { if( when_loaded_needs_running ) { when_loaded_needs_running = false; callback...

.net - how to use list object in a object in wcf -

i have wcf service, have mentioned below 3 class in used first 2 class object client side.. on studentsinformation class have pass list ie contains list of subects there name , mark, avg etc.. tried pass list..i want make database updation according number of subjects, , how check in webclient... (ie how pass data in list) can me..with this [datacontract(name = "studentsinformation")] public class studentsinformation { [datamember] public int id { get; set; } [datamember] public string name { get; set; } [datamember] public string total { get; set; } [datamember] public list<subjects> subjectslist { get; set; } } [datacontract(name = "subjects")] public class subjects { [datamember] public string subjname { get; set; } [datamember] public int mark { get; set; } [datamember] public int avg { get; set; } } [datacon...

ruby - Why Am I Getting a SystemStackError In This Code? -

class x class << self def attr_string arg eval("def #{arg}; return #{arg.to_s}; end") end end end is code working with. trying make class macro, attr_accessor. when call foo = 50 x.attr_string :foo x.foo i systemstackerror . why this? class x def attr_string arg (class << self; self; end).class_eval define_method arg arg end end end end or little cleaner class x def self.attr_string arg self.class.instance_eval define_method(arg) { arg.to_s } end end end

php - For in random order no repeating numbers -

whats best way random "for" without repeating number? for ($i = 1; $i <= 10; $i++) { echo $i; } i think ways complicated lot amount of code.. there standard function im willing? $numbers = range(1,10); shuffle($numbers); foreach($numbers $i) { // stuff } that give numbers 1 10 no repetition in random order.

php - Decode JSON result stdClass Object() to a formatted HTML -

how 1 decode json html list, , able dumb 'div' or dom element, or missing something? stdclass object ( [msc] => 26771010150 [number] => 2677410930 [status] => ok [msc_mcc] => 652 [imsi] => 652010151221139 [mcc] => 652 [operator_country] => botswana [msc_operator_name] => mascom wireless (pty) ltd. [msc_operator_country] => botswana [msc_mnc] => 01 [mnc] => 01 [id] => 928692391 [msc_location] => [operator_name] => mascom wireless (pty) ltd. ) wherever decoding json in php, instead of use json_decode($json,true) it return associative array can use in html easily.

Stop jQuery animation when a modal layer (or tab changes) appear top of the animation -

i writing jquery animation plugin using sequence of images.. need pause animation when modal layer opens or tab changes on top of animation. can't figure out tie animation stop.. here doing.. http://designs.phases.dk/flip/ the animation starts once images loaded.. if click on link "open popup" modal layer appears.. animation still continues.. trying find way stop it.. you can trigger "pause" link's click event pause animation. $('.fancybox').click(function(){ $('.pause').trigger('click'); }

fortran - Error: This name does not have a type, and must have an explicit type -

here code: program fortran_project1 implicit none integer:: real*4:: norm integer,parameter:: n=5 real*4,dimension(n)::x0,norm_x0 write(*,*) 'parametrhaye matrix x0 ra vared konid' norm=0 i=1,n read(*,*) x0(i) norm=norm + x0(i)**2 enddo norm=sqrt(norm) norm_x0(:)=1.0d0 i=1,n norm_x0(i)=x(i)/norm enddo write(*,'(a,\)') 'x0=' write(*,'(f,\)') (x0(i),i=1,n-1) write(*,'(f)') x(n) write(*,'(a5,x,f)') 'norm_x0=',norm write(*,'(a7,\)') 'norm_x0=' i=1,n-1 write(*,'(2x,f8.6,\)') norm_x0 enddo write(*,'(2x,f8.6)') norm_x0 endprogram fortran_project1 error: --------------------configuration: f5 - win32 debug-------------------- compiling fortran... c:\fortran\f5\f5.f90 c:\fortran\f5\f5.f90(16) : error: name not have type, , must have explicit type. [x] norm_x0(i)=x(i)/norm -------------------^ error executing df.exe. f5.obj - 1 error(s), 0 warning(s) from compaq compiler. need ...

python - Comparing numpy datatypes to strings -

many numpy functions take dtype arguments either strings (like "float64" ) or numpy datatypes (like numpy.float64 ) or python datatypes (like float ). i need compare 2 datatypes , want support flexible interface. there function under of these forms equivalent? i.e. want minimal function f such f("float64") == f(numpy.float64) == f(float) what numpy use internally? you should read scalars page of numpy documentation, describes data type hierarchy. for comparing dtypes themselves, can use np.issubdtype . examples: >>> import numpy np >>> np.issubdtype(np.int32, int) true >>> np.issubdtype(np.int32, float) false >>> np.issubdtype(float, np.floating) true >>> np.issubdtype(float, np.inexact) true >>> np.issubdtype(np.float32, float) true >>> np.issubdtype(np.float32, int) false >>> np.issubdtype(np.float32, np.floating) true

map - CouchDB View with 2 Keys -

i looking general solution problem couchdb views. for example, have view result this: {"total_rows":4,"offset":0,"rows":[ {"id":"1","key":["imported","1"],"value":null}, {"id":"2","key":["imported","2"],"value":null}, {"id":"3","key":["imported","3"],"value":null}, {"id":"4","key":["mapped","4"],"value":null}, {"id":"5,"key":["mapped","5"],"value":null} ] 1) if want select "imported" documents use this: view?startkey=["imported"]&endkey=["imported",{}] 2) if want select imported documents higher id 2: view?startkey=["imported",2]&endkey=["imported",{}] 3) if want select imported documents id...

visual studio 2010 - Hooking the IIS SMTP Server OnReceived Event using COM Interop not working. (Note: this isn't CDO, or System.Net.Mail) -

i working windows 2008r2 smtp server , need wrapper onreceived event. download has com , il modifications vs 2003 , 2005. neither work vs2010, regular vbscript works fine. the event i'm dealing server side, , nothing cdo or system.net.mail.client the iis smtp dll requires custom interop code (with custom il) in order work. issue interop code runs vs2003 , vs2005. i need working copy of microsoft.exchange.transport.eventwrappers.dll. , see options as find copy of vs2003/05 install that, build , compile. port custom il vs2010 (i don't know how) find trusted version of file , download (perhaps msft) does have idea on how can dll?

iphone - Cocos2D Scene Deallocation -

when dealloc method of cocos2d scene called? right when scene loaded? or after scene has finished loading? additionally, must in dealloc method if plan on overwriting it? apparently, cocos2d automatically removes nodes attached scene when scene deallocated. however, if plan on overwriting it, methods must call? how can manage scene make sure leak free, 100%? in advance! ccscene's deallocator follows same rules other object's. run when reference count ccscene reaches zero. a scene default doesn't care replace it, if you're changing scene transition, there period of time when 2 scenes exist @ same time. when transition ends, transition release reference first scene, last such reference, , first scene deallocated. in scene deallocator, put cclog see when it's run. put 1 in each make sure. in general, manually release object created using method starting alloc , new or copy , whether or not it's cocos2d object or otherwise. other creatio...

time series - Hourly Date Sequence In R -

i trying produce sequence of dates @ hourly intervals. example tried following: > seq(as.date("1912-02-24 23:00:00"), as.date("1912-02-25 08:32:00"), by="hour") which produces error, yet works fine by= year, month, day. the documentation seq.posixt {base} states should work hour, sec, min, etc, yet of these produce error. > ?seq.posixt thanks in advance. well, don't give answer ;-) what about: seq(as.posixct("1912-02-24 23:00:00"), as.posixct("1912-02-25 08:32:00"), by="hour") (also works as.posixlt ).

creating facebook canvas app with cakephp -

i'd create facebook canvas app cakephp 2.0. tutorials i've found seem out of date. tell me how can integrate facebook-php sdk cakephp 2.0 ? any appreciate :-) i recommend using webtechnik plugin integrate seemlessly cakephp app in facebook : https://github.com/webtechnick/cakephp-facebook-plugin

python - Correct the color on an image -

i have image taken , had bayer filter applied it. trying correct color because depenging on filter apply (bg 2 rgb example) comes out tint, yellow, blue, green, pink etc... using python image library try , fix image. i have taken image of visible spectrum , can make 1 or 2 colors right multiplying correct pixel weight other colors go off. example can make white great blue turns pink. is there way besides modifying bayer filter can process image, in python pil fix color imbalance. thanks!

image - where to find 2d textures of earth -

google images no good. there free 2d images of earth, preferably in raw format make easier read open gl texture, use map onto 3d sphere. there's blue marble has newer high res photos (up 500 m/pixel). sort of resolution need?

sqlite3 - Nested Update Query in SQLite -

i'm trying update range of records based on join on same table in sqlite3 using application sqliteman, can't seem right syntax , have tried number of methods. latest iteration of update query below update workcodes wc2 set wc2.subcodeof = wc1.id workcodes wc1 inner join workcodes wc2 on wc1.jemenawc=wc2.workcode i think want try sub-select: update workcodes wc2 set wc2.subcodeof = ( select wc1.id workcodes wc1 wc1.jemenawc = wc2.workcode )

iphone - Allow change of orientation to landscape for only one tab in UITabViewController -

is possible? how might accomplish this? not possible according apple docs. the word possible may need asterisk it. looks apple didn't envision (or want) doing this. but, depending on requirements are, there may workaround. disclaimer: kind of hack. i'm not claiming ui, trying show eli what's possible. i built example, starting xcode template building tabbed application . has 2 view controllers: firstviewcontroller , secondviewcontroller . decided make firstviewcontroller landscape-only view. in interface builder (xcode ui design mode), set orientation of firstviewcontroller's view landscape, , made size 480 wide 251 high (i'm assuming iphone/ipod here). solution now, seems necessary have tab bar's view controllers claim support autorotation portrait , landscape. example: - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { // return yes supported orientations return (interfa...

PHP: inconsistent results for gethostbyname() and checkdnsrr() -

i'm writing simple form check if .com domain available. i'm evaluating 3 methods (@dns_get_record, gethostbyname() , checkdnsrr()) bunch of test domain names below code, getting not available entries gethostbyname() , checkdnsrr(), can see @ http://suggestmyname.com/nonwp/arraypush.php if refresh few times. don't issue when running on local testing server, know why inconsistency? not of domains being checked on remote server, on local testing server. $sdomains = array(); array_push($sdomains, 'etc.com'); function domainavailable1($domain){ $results = @dns_get_record($domain, dns_any); return empty($results); } function domainavailable2($domain){ return gethostbyname($domain) == $domain; } function domainavailable3($domain){ return !checkdnsrr($domain, 'any'); } echo '<table><tr><td>@dns_get_record</td><td>gethostbyname</td><td>checkdnsrr</td></tr>'; foreach($sdomains $sdomain){ if...

php - Associative array to Json -

i able generate json output in following format: {"a":{"ax":1,"abx":2},"b":{"bax":1,"bbx":2},"c":3,"d":4,"e":5} although have found respective code this: $arr = array('a' => array('ax' => 1, 'abx' => 2), 'b' => array('bax' => 1, 'bbx' => 2), 'c' => 3, 'd' => 4, 'e' => 5); , i'm struggling generate output using data sql query. have tried array_push() , array_merge() , closest have managed this: [{"a":{"ax":1,"abx":2}},{"b":{"bax":1,"bbx":2}}, ....] any ideas? first should query data table , move array, after this,use json_encode($array) function. place array inside parameters. then output bee in json form. $query="select * employees"; $result=mysql_query($query); while($row=mysql_fetch_array($res...

ide - Sublime Text2 class variables hint php -

hi guys know how can make sublimetext2 suggest class variables , functions me in php file - similar eclipse , aptana? ie when type $this-> popup of accessible properties. right gives me list of everything. thanks guys checkout plugin, need package manager install it https://github.com/kronuz/sublimecodeintel

python - GAE Webapp: the cost of importing a bunch of request handlers -

my python gae app's central application file looks this: import webapp2 import homepage import user_auth import user_confirm import admin_user import admin_config import config app = webapp2.wsgiapplication([ (user_auth.get_login_url(), user_auth.loginhandler), (user_auth.get_logout_url(), user_auth.logouthandler), ("/user/confirm", user_confirm.userconfirmhandler), ("/admin/config", admin_config.adminconfighandler), ("/admin/user/add", admin_user.adminadduserhandler), ("/admin/user", admin_user.adminuserhandler), ("/", homepage.homepagehandler), ], debug=true) as can see, must import bunch of request handlers, each request, 1 of them used, other imports useless! that's b...

prolog - Why is my list not being populated? -

for assignment asked write predicate route/3 succeeds if there route start finish , visiting town in list visits . i've come idea solution reason visits list empty after route terminates , can't figure out why is. i'm not looking solution question, point me in right direction. here code far: note calls write debugging reasons. road('wellington', 'palmerston north', 143). road('palmerston north', 'wanganui', 74). road('palmerston north', 'napier', 178). road('palmerston north', 'taupo', 259). road('wanganui', 'taupo', 231). road('wanganui', 'new plymouth', 163). road('wanganui', 'napier', 252). road('napier', 'taupo', 147). road('napier', 'gisborne', 215). road('new plymouth', 'hamilton', 242). road('new plymouth', 'taupo', 289). road('taupo', 'hamilton', 153). road(...

spree - how can i match html tags with no id with deface -

trying add column table in configuration menu, table has empty <th> </th> looks, when add column, adds after looks ugly, adding this deface::override.new(:virtual_path => "spree/admin/user_groups/index", :name => "minimum_order_column", :insert_after => "code[erb-loud]:contains('description')", :partial => "spree/admin/user_groups/minimum_order_column") first weird thing adds after empty th, seems easy fix if remove it admin/user_groups spree_user_groups deface uses css selectors in general it's dirty work. you should able th[3] or th:last find <th> http://deface.heroku.com/ great tool in testing selectors.

MATLAB: power function curve fitting -

i know matlab code form of power polynomial y = x m . require numerical value of m fitting curve set of data. initial program follows: load n = a(:, 1); t = a(:, 2); p = polyfit(log(n), log(t), 1); f = (p, t); plot(t, n, '-', t, f, '-'); my doubt above polyfit function used curve fitting equation y = bx m not fitting data set, require b = 1. third parameter of polyfit degree of polynomial, m in case. you can pass parameter larger m polyfit . then, if assumption model correct p[m + 1] largest component of p (and close 1), while others should close zero.

Tried to read incoming SMS content but getting Error in Blackberry -

hi friends trying read incoming sms getting warning . invocation of questionable method: java.lang.string.(string) found in: mypackage.myapp$listeningthread.run() here code public class myapp extends uiapplication { //private listeningthread listener; public static void main(string[] args) { myapp theapp = new myapp(); theapp.entereventdispatcher(); } public myapp() { invokeandwait(new runnable() { public void run() { listeningthread listener = new listeningthread(); listener.start(); } }); pushscreen(new myscreen()); } private static class listeningthread extends thread { private boolean _stop = false; private datagramconnection _dc; public synchronized void stop() { _stop = true; try { _dc.close(); // close connection thread returns. } catch (ioexception e) { system.err.println(e.tostring()); } } public void run() { try {...

iphone - How to send JSON data over NSURLConnection -

i have created method connects web service , posts string , receives string response. however, trying post json dictionary created using nsjsonserialization. however, xcode giving me error. have tried convert initial code. relevant lines below... nsdata* logindatajson = [nsjsonserialization datawithjsonobject:logindatadictionary options:nsjsonwritingprettyprinted error:&error]; [request setvalue:logindatajson forhttpheaderfield:@"logindatajson"]; [request sethttpbody:[logindatajson datausingencoding:nsutf8stringencoding]]; the second line heres complains using nsdata nsstring required. third line complains logindatajson may not respond datausingenconding i seem forcing nsdata object (because nsjsonserialization gives me) cannot used. best trying convert json string use existing request code, or should/can change request code accept nsdata opposed nsstring? have tried use frameworks jsonkit or restkit? restkit specially used webservice communication jso...

c++ - Crash using aho-corasick algorothm? -

Image
i got code aho-corasick algorithm here: http://www.komodia.com/aho-corasick . i used guide said, added lines , built tree. i did change using std wstring std string should not matter. changed typedef. when use , search something, if not results found there no problem. when results found, std out of range exception. it crashes here: if (aiterator==pnode->amap.end()) //no, check if have failure node if (!pnode->pfailurenode) { //no failure node, start @ root again pnode=&m_aroot; //reset search string smatchedstring=""; //did switch? if (bswitch) //we need on --icount; //exit loop break; } else { //what depth difference? unsigned short usdepth; usdepth=pnode-...

c# - Service layer, implement timed cache -

so right have come project i'm taking on responsibility for. one part found halfway implemented service layer cache. apparently cache in service layer implemented avoid high amount of calls database cluster. service layer hosted on 2 servers performance , stability if 1 server goes down. now problem, or rather, best pattern implementation of timed cache? objects changes or updated, countries etc cached , never released if not pool reset. because we, or rather predecessors, have 2 active services on 2 separate machines i'm thinking implementing timed cache. alternative have services talk each others of course taking account not dependent on each others if 1 goes down other work fine. right there 12 dictionaries items cached. of these updated. these dictionaries resides in 1 class not singleton implemented singleton instantiated once. how advice me solve interesting problem , why way? why not setup cache cluster consisting out 1 or multiple servers, using ...

knitr - How to get R to output body scripts to format HTML tables using a similar approach as gvisTable? -

i work out how generate formatted html tables in way not require use of styles placed in html header. i've broadly asked question already , received 1 answer mentioned using header , answer involves using pandoc ( update: see bottom of post regarding new answer posted since asking question . i'd have r function writes html formatting required formatted html table in 1 place. i've been playing around gvistable , capable of writing relevant information in 1 place: the following code ```{r results='asis'} simpledata <- data.frame(matrix(1:9, nrow=3)) tab2 <- gvistable(simpledata, options=list(width = 600, height = 300)) print(tab2, "chart") ``` will output following r markdown document: <!-- jsheader --> <script type="text/javascript" src="http://www.google.com/jsapi"> </script> <script type="text/javascript"> // jsdata function gvisdatatableid273f3d05cccd () { ...

PHP Sorting by date? -

i'm making news feed stores dates string tuesday 05 june 2012 04:14:44 pm . i want 2 things. sort news feed date (newest oldest) if date today's date, show time(which sorted). i change storage store " unix timestamp ". can print out whatever format of date like . , also, it's number , sortable.

jquery - Checking when all li's have been dynamically removed -

i've got function handles various types of behaviour property listing (my shortlist) <ul><li> setup. 1 type of behaviour removing property listing item <li> when click button within each item, that's working fine if statement check when items have been removed isn't working. can tell me i'm doing wrong? here's part of function handles removing items via onclick event of button , dodgy if statement: // remove item shortlist $(this).find('.btn-minus').click(function() { var btnremove = $(this); var proptile = $(this).parents('.property-tile'); var proplist = $('#property-listings'); // if ie 8 / 7 if ($('html').hasclass('lte8')) { proptile.hide('slide', 300, function() { btnremove.data("tooltip").hide(); }); } // other browsers else { proptile.fadeout(200, function() { btnremove.data("tooltip...

android - ViewPageIndicator - What is the use of GoogleMusicAdapter in SampleTabsStyled class? -

i using viewpageindicator , actionbarsherlock in app. rename sampletabsstyled class , use in app. going right. want know something why has googlemusicadapter subclass of sampletabsstyled class? 2.what use of testfragmentadapter class? can rename , reuse it? the googlemusicadapter class sets different names tabs shown in example, think clearer if declaration of content array inside nested class. so, can skip use of class , use directly testfragmentadapter suggest. hope helps!

android - Strange Spinner. How to fix it? -

Image
this code populate spinner. looks strange , ugly. @override protected void onpostexecute(final list<string> result) { system.out.println("result: " + result); final spinneradapter adapter = new arrayadapter<string>(searchtopactivity.this, android.r.layout.simple_spinner_dropdown_item, new string[]{"test1", "test2"}); countryspinner.setadapter(adapter); } <spinner android:id="@+id/countryspinner" android:layout_width="match_parent" android:layout_height="wrap_content" /> how fix this (searchtopactivity.this, android.r.layout.simple_spinner_dropdown_item, new string[]{"test1", "test2"}) change android.r.layout.simple_spinner_dropdown_item android.r.layout.simple_spinner_item refer http://developer.android.com/resources/tutorials/views/hello-spinner.html

OpenCL ignores kernel -

i'm familiarizing myself opencl. found simple example in internet. the kernel is: __kernel void vector_add(__global const int *a, __global const int *b, __global int *c) { // index of current element processed int = get_global_id(0); // operation c[i] = a[i] + b[i]; } i compile , run it. result is: 0 + 1024 = 0 1 + 1023 = 0 2 + 1022 = 0 3 + 1021 = 0 4 + 1020 = 0 5 + 1019 = 0 6 + 1018 = 0 7 + 1017 = 0 8 + 1016 = 0 9 + 1015 = 0 10 + 1014 = 0 11 + 1013 = 0 12 + 1012 = 0 13 + 1011 = 0 14 + 1010 = 0 15 + 1009 = 0 16 + 1008 = 0 17 + 1007 = 0 18 + 1006 = 0 19 + 1005 = 0 20 + 1004 = 0 21 + 1003 = 0 22 + 1002 = 0 23 + 1001 = 0 24 + 1000 = 0 25 + 999 = 0 26 + 998 = 916789344 27 + 997 = 32756 28 + 996 = -1 29 + 995 = 0 ... i noticed not depend on *.cl file content. if change c[i] = a[i] + b[i]; on c[i] = 3.; result same. if remove kernel file - result same. what can problem? p.s. example, i'm trying compile, have found here: http://www.thebigblob.com/ge...

css - Div vertical-align in a gwt-page -

i trying set div element on right top of web-page contains span, label , button. want bring elements in alignment regarding vertical high (preferably @ middle of div element). vertical-align: middle not work elements cling top of div. influenced external div or panel (since use gwt). should interfere in default attributes of gwt widgets? other solution can suggest? code: <div class="{style.toprightdisplay}"> <span style="float:left;">eingeloggt als: </span> <g:html ui:field="loginhtml" addstylenames="{style.loginhtml}"></g:html> <g:button ui:field="logoutbutton" addstylenames="{style.button}">logout</g:button> </div> .button { float: right; margin-right: 15px; } .loginhtml { float: left; } .toprightdisplay { float: right; height: 20px; width: 200px...

c++ - QSortFilterProxyModel sort multiple columns -

i trying implement table sortable on more 1 column. qt's qsortfilterproxymodel supports sorting on 1 column (at least in qt 4.6.2). i've found this solution dimkanovikov on github, lacks dynamic updating on added rows. mean this, model changed , begininsertrows(), beginremoverows(), corresponding end..-methods , datachanged() signals emitted. ideally these rows updated, model should @ least react such changes. there's faq item on qt's site sorts qtablewidget, lacks dynamic updating, too. i new qt , i'd pointers on how should go this. you can set sorting role of qsortfilterproxymodel different default qt::displayrole with setsortrole(qt::userrole) . then, in model's data() method return proper sort key if gets called role qt::userrole , e.g. concatenating strings of involved columns.

mysql - ExecuteNonQuery Result in C# -

how can know if create database successfully? using "create database demodb" sql command. executenonquery() method returns 0. should use understand if created database successfully? executenonquery throws mysqlexception exception if there error. returns 0 if successful don't need check return value; if returns has succeeded. example here exception when try create database exists: can't create database 'name' ; database exists

python - Counting words from tokenized url -

very new python , hoping guys give me help. i have book great war, , want count times country appears in book. far have this: >>> __future__ import division >>> import nltk, re, pprint >>> urllib import urlopen >>> url = "http://www.gutenberg.org/files/29270/29270.txt" >>> raw = urlopen(url).read() >>> type(raw) <type 'str'> >>> len(raw) 1067008 >>> raw[:75] 'the project gutenberg ebook of story of great war, volume ii (of\r\nv' >>> tokenization. break string words , punctuation. >>> tokens = nltk.word_tokenize(raw) >>> type(tokens) <type 'list'> >>> len(tokens) 189743 >>> tokens[:10] //vind de eerste 10 tokens ['the', 'project', 'gutenberg', 'ebook', 'of', 'the', 'story', 'of', 'the', 'great'] >>> correcting beginning , e...