Posts

Showing posts from March, 2010

caching - ColdFusion Client Variable Showing Outdated Value Intermittently -

we have legacy coldfusion application using 150 client variables manage session state. client variables centrally stored in sql server database within 6 application server clustered environment using round-robin load balancer. the problem when code updates client variable new value, old value still being used , displayed though new value updated appropriately in cdata table. happens intermittently in average of 1 out of 1000 updates being made client variable using cfset tag. race conditions , caching issues possible explanations. “suspect” old value still being cached on 1 of 6 application servers. adobe's documentation states client variables cached memory not go further details. 1) has experienced issue , found resolution? 2) implications of moving sticky session while keep using client variables? i think first take closely @ database commits. client vars retrieved @ "beginning" of request , updated @ "end" of request changes. consider

web services - GET Request with Content-Type and Accept header with JAX-RS Jersey 2.2 -

i try access open data web service gives me traffic infos. documentation says requests have get , need contain accept: application/json , content-type: application/json . don't understand why need content-type ok: i tried retrieve data accept: header i'm getting 415 unsupported media type . trying way (but i'm not sure if setting both headers correctly): string entity = clientbuilder.newclient().target(livedatauri) .path(livedatapath) .request(mediatype.application_json) .accept(mediatype.application_json) .get(string.class); as see using jersey 2.2 , i'm still getting 415 unsupported media type . edit so got work don't understand why. isn't accept(mediatype.application_json) , header("content-type","application/json") same? string responseentity = clientbuilder.newclient() .target(livedatauri) .path(livedatapath) .request(mediatype.application_json) .header("content-type", "

sql - Rails with postgres - activerecord query: sort by column ASC, then group by column -

i have model laps, belongs :car so each car has many laps, need query pull in top 10 fastest laps, pull in fastest lap per each car. in other words, not want 1 car allowed have 5 of top 10 fastest laps in list. each lap has :car_id field. want group on column, , pull out lap min(lap.time) row grouping. (aka fastest lap time unique :car_id). so postgres, best approach this? can order laps first, group, , pull first group. or grouping not keep sort order? here schema lap model: create_table "laps", force: true |t| t.decimal "time" t.string "video_url" t.integer "car_id" t.datetime "created_at" t.datetime "updated_at" t.integer "user_id" t.boolean "approved" end do have use 2 combined queries this? i can unique car id's lap doing this: select('distinct on (car_id) *') but, need order laps gets min(lap.time) per car_id. when throw on order

linux - Kernel Modul and SSL -

at moment working on kernel module of ccn-lite ( http://www.ccn-lite.net/ ). need security functionality (sha1 , public/private key authentificaton). user-space use openssl library, cannot use library in kernel module. it hard pick functions out of openssl , add them kernel module, because of them have dependencies libc. is there any security function in linux kernel, use? edit: can compute hash function of data received on ethernet: struct scatterlist sg[1]; struct crypto_hash *tfm; struct hash_desc desc; tfm = crypto_alloc_hash("sha1", 0, crypto_alg_async); desc.tfm = tfm; desc.flags = 0; crypto_hash_init(&desc); sg_init_table(sg, array_size(sg)); sg_set_buf(&sg[0], input, length); crypto_hash_digest(&desc, sg, length, md); crypto_free_hash(tfm); and want verify signature field of data using function digsig_verify. verified = digsig_verify(keyring, sig, sig_len, md, md_len); as far can see, second parameter signature, third len of signatu

objective c - Singleton pattern with parameter -

in iphone application, i'm using subclass of afhttpclient access rest web service. want requests handled 1 instance of api client use singleton pattern. this works fine when service running on once url. can use constant value set url. now, in final version of application, each app talk service installed in corporate network. so getting service url remote configuration. singleton pattern still choice here? how supposed parameterise if url change during runtime of app ? cheers #import "fooapiclient.h" #import "afjsonrequestoperation.h" static nsstring * const kfooapibaseurlstring = @"http://192.168.0.1"; @implementation fooapiclient + (instancetype)sharedclient { static fooapiclient *_sharedclient = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ _sharedclient = [[self alloc] initwithbaseurl:[nsurl urlwithstring:kfooapibaseurlstring]]; }); return _sharedclient; } - (id)initwithbaseurl

floating point - Why do doubles work how they do -

i know may common question, have never found answer (and maybe has not knowing how search google correctly, if can point me reference, remove question). why doubles work how in terms of representing right side of decimal inverse power of 2, , left side of decimal power of 2? know allows large numbers represented, there other advantages? .net framework has decimal data structure available, seems more logical use becuase how represent numbers in human notation. really, question why doubles created way instead of creating decimal instead (which seems far less common). your confusion seems unfounded. right side of decimal point always represented in inverse power of base , left side always represented power of base. true base 10 , base 2 well. binary floating point numbers store exponent controls decimal point on mantissa. as why exist: binary floating point notation has 2 convenient properties: it relatively fast, because uses binary arithmetic it can represent e

matlab - Get index of current element of a 2-D matrix within arrayfun -

let m matrix: m = rand(1000, 2000); consider following code example: a = zeros(size(m)); row = 1:1000 col = 1:2000 a(row, col) = m(row,col)*(row + col); end end how compute matrix a without for loops? there arrayfun function, don't know how index of current element: a = arrayfun(@(x)(x*(index(1) + index(2))), m); %// how index??? perhaps there other solutions (and without loops)? you can simple follows matrix represent row+col , multiply m m = rand(1000, 2000); rowpluscol = bsxfun(@plus,(1:size(m,1)).',1:size(m,2)); = m.*rowpluscol; from experience bsxfun extremely powerful function , can save run time, , perfect example of that.

linux - merging contents from two files in one file using shell script -

file : 1 3 5 7 file b: 2 4 6 8 is possible use file , file b input in shell script , output file c contents follows: 1 2 3 4 5 6 7 8 use paste interleave lines in exact order they're found: paste -d '\n' filea fileb or use sort combine , sort files: sort filea fileb

r - Fill option for fread -

let's have txt file: "aa",3,3,3,3 "cc","ad",2,2,2,2,2 "zz",2 "aa",3,3,3,3 "cc","ad",2,2,2,2,2 with read.csv can: > read.csv("linktofile.txt", fill=t, header=f) v1 v2 v3 v4 v5 v6 v7 1 aa 3 3 3 3 na na 2 cc ad 2 2 2 2 2 3 zz 2 na na na na na 4 aa 3 3 3 3 na na 5 cc ad 2 2 2 2 2 however fread gives > library(data.table) > fread("linktofile.txt") v1 v2 v3 v4 v5 v6 v7 1: cc ad 2 2 2 2 2 can same result fread ? not currently; wasn't aware of read.csv 's fill feature. on plan add ability read dual -delimited files ( sep2 sep mentioned in ?fread ). variable length vectors read list column each cell vector. but, not padding na. could add the list please? way you'll notified when status changes. are there many irregular data formats out there? recall ever seeing regular files, incomplete lines considered error. u

c# - Customizing Metro App Touch Functionality -

i customize touch-based functionality of windows 8 metro app such in flip view, 1 can not swipe left right 1 finger 2 fingers while keeping zoom functionality (currently, zooming enabled, 2 fingers causes image shrink or grow in size rather go next or previous item). is, of code controlling touch behavior seems abstracted framework; there way can go accomplishing fine-tuning? i can't reproduce entire app in machine can advice go through gestures in windows 8. add event swipe gesture , if require(if id not zoomed before swiping) change selected index of flip view accordingly. gestures in windows store app note : in worst case if swipe gestures takes zoom, please debug , see if can recognize right left gesture or left right , change flip view selected index

html data- attributes in ember.js handlebars -

i trying this: {{input value=email type="text" data-type="email"}} in order use parsley.js validate inputs. (i know email can use type="email") example. but seeing data-type="email" not showing in generated html. is there way can add html data- attribute handlebars tag? there different approaches can it: approach 1 you can reopen ember.textfield , define additional attributebindings , like: ember.textfield.reopen({ attributebindings: ['data-type'] }); now work: {{input value=email type="text" data-type="email"}} working example. approach 2 define own custom input field extending ember's ember.textfield app.mytextfield = ember.textfield.extend({ attributebindings: ['data-type'] }); and use this: {{view app.mytextfield value=email type="text" data-type="email"}} working example. hope helps.

spring - StaleObjectStateException: Row was updated or deleted by another transaction? -

i following: def currentuser = springsecurityservice.currentuser currentuser.name = "test" currentuser.save(flush: true) // other code currentuser.gender = "male" currentuser.save(flush: true) // exception occurs this exception get: error events.patcheddefaultflusheventlistener - not synchronize database state session org.hibernate.staleobjectstateexception: row updated or deleted transaction (or unsaved-value mapping incorrect) how can prevent error? best solution that? i found different approaches: here can use discard() here can use merge() which 1 should use? you should use merge - update object match current state in database. if use discard reset object database has, discarding changes. else in hibernate session need manage yourself. more importantly code should written in service there database transaction, , should use save(flush:true) once @ end. def currentuser = springsecurityservice.currentuser currentus

Android resourse folders swXXXdp for 5 inch phones -

i want distinguish phones ~5 inch , higher displays 4 inch 480x800 in res/values folder how can differentiate ~5 inch displays? should use trick, should got instead of xxx? values-swxxxdp? especially trying differentiate galaxy s 3 , galaxy s 4 others. should consider? s3: dpi: 306 res: 1280x720 screen: 4.8" 720 / (306/160) = 720 / 1.9125 = 376.47 dp s4: dpi: 441 res: 1920x1080 screen: 5.0" 1080 / (441/160) = 1080 / 2.75625 = 391.8367 dp so there small difference between s3 , s4. if want distinguish layouts these devices, use sw376dp s3 , sw390dp s4 . make note other 5" phones different.

date comparison in python - how to know which semester date -

i somehow stuck in logical thinking. i going compare date 2 states: summer semester (beginns on 16.04 - ends on 14.10) winter semester (beginns on 15.10 - ends on 15.04) all including vacations how check semester month/day in? current_month = datetime.datetime.now().month current_year = datetime.datetime.now().year current_day = datetime.datetime.now().day if current_month>=10 , current_day>=15: #winter semester but somehow doing chaos. there python lib date comparison problem? you generate summer dates: current = datetime.date.today() summer = current.replace(month=4, day=16), current.replace(month=10, day=14) if summer[0] <= current <= summer[1]: # summer semester else: # winter semester this use datetime.date() object instead of datetime.datetime() , time portion irrelevant here. date.replace() calls make sure reuse current year. this assumes, of course, summer semester starts , ends on same dates each year. demo: >

java - JTable grid lines disappear unexpectedly -

Image
i have s (very s) scce illustrates problem: there jtable , jtree both contained in jpanel borderlayout. of grid lines in jtable show, not 1 @ left, , not 1 @ top. have tried experimenting borders, placing jtable on own dedicated jpanel, etc. i have gleaned experts bad idea call of setxxxsize methods, have not resorted setpreferredsize, example. in sscce can swap tree , table positions round uncommenting "east" line) how make these obscured/missing gridlines reappear? (nb idea table grow/shrink dynamically jtree, there same number of rows in table , tree... hence desire contain both components on same jpanel). sscce: import java.awt.*; import java.lang.reflect.invocationtargetexception; import javax.swing.*; import javax.swing.border.lineborder; public class tablegridprob { public static void main( string[] args ) throws interruptedexception, invocationtargetexception{ eventqueue.invokeandwait( new runnable(){ @override publ

c# - How to properly set the path for executing a child powershell script? -

resolved : solution below use following join-path: [system.reflection.assembly]::loadfrom((join-path (pwd) "myassembly.dll")) | out-null original question : i have powershell scripts , assembly file placed follows: d:\path1\script1.ps1 d:\path2\script2.ps1 d:\path2\myassembly.dll within d:\path1\script1.ps1 need call d:\path2\script2.ps1. then, script2.ps1 in turn load c# assemblies placed in d:\path2 folder. under impression if either set-location or push-location working directory set happens within script2.ps1. script1.ps1 looks this: $otherpath = "d:\path2" set-location -path $otherpath push-location -path $otherpath .\script2.ps1 script2.ps1 looks this: [system.reflection.assembly]::loadfrom("myassembly.dll") | out-null however, when i'm in d:\path1, execute script1.ps1 follows, , filenotfound exception: d:\path1>powershell .\script1.ps1 exception calling "loadfrom" "1" argument(s): "could no

html - Make text overflow to the left side with CSS -

Image
i have main titles have following css properties: text-align:right; padding-right:30px; border-right: 3px solid #c7342d; float:left; width:300px; font of titles large , there long words go on 300px in width. causes words overflow, overflow right padding & border area instead left. is there way force text overflow left? here several examples understand i'm after: (second image how should look) try adding following css rule title, direction: rtl; this make right-to-left , invert overflow direction.

java - Unable to change JLabel value -

Image
i'm new netbeans. unable run in eclipse. when try run error non static variable cannot referenced static context . please me solve. inetaddress ip; try { ip = inetaddress.getlocalhost(); string t1= ip.gethostname(); sysname.settext(t1); // here error //sysname.settext("hi"); // make error } catch (unknownhostexception ex) { logger.getlogger(mainframe.class.getname()).log(level.severe, null, ex); } from exception you've posted, seems code you've shown in static method, maybe main() , while variable sysname instance variable, possibly declared as private jlabel sysname; you cannot access instance field without instance, ie static context.

android - Launch default camera app (no return) -

i'd launch default camera, want act started launcher (i.e. resulting picture should stored camera app user's gallery, rather being returned app). if use intent cameraintent = new intent(android.provider.mediastore.action_image_capture); , camera app uses "ok? retry?"-ui , doesn't save picture. i'd rather not use "direct" com.android.camera intent, because lot of devices use custom camera apps. i've seen stock gallery3d-app uses alias implementing com.android.camera/.camera , i'm not sure every pre-loaded manufacturer camera app this. i've implemented this: intent = new intent(android.provider.mediastore.action_image_capture); try { packagemanager pm = mcontext.getpackagemanager(); final resolveinfo minfo = pm.resolveactivity(i, 0); intent intent = new intent(); intent.setcomponent(new componentname(minfo.activityinfo.packagename, minfo.activityinfo.name));

Is there a way to trigger a callback on a Rails model only after a commit has happened for a create? -

i calling "queue" method after_create callback trigger sidekiq process on model instance after created. however, first time sidekiq worker picks job, record hasn't been committed yet. i know there after_commit record, want object queued when created, not when updated. how can accomplish without hackery involving date-checking, etc.? you set flag in before_create callback before_create :set_new_flag after_commit :queue def set_new_flag @__new_flag = true end def queue if defined? @__new_flag #queue remove_instance_variable(:@__new_flag) end # puts self.previous_changes end or inspect #previous_changes in after_commit . nil in id key should new_records. here's example output of previous_changes {"name"=>[nil, "newest"], "id"=>[nil, "cbdjzqgxir45xqj9uxgrsr"], "version_id"=>[nil, "cbdnaogxir45xqj9uxgrsr"]}

entity framework - ASP.NET MVC, Layers, Models, Repositories etc -

Image
i have questions after reading article called layered application guidelines ( http://msdn.microsoft.com/en-us/library/ee658109.aspx ). for example, have asp.net mvc application. in application have entities (models), repositories, unitofwork , dbcontext. , views , controllers well. how split them layers according article above? as far understand, views , (maybe) controllers reside in presentation layer. entities (models) in business layer , repositories, unitofwork , dbcontext in data layer. am right or mistaken? i'm very-very unsure it. thanks in advance! views , controllers should reside in presentation layer. models should reside in presentation layer. models reflect view model used presentation only. entities should represent data , should not sent view. in presentation later, models should populated entities. correct in dbcontext , unitofwork should in data layer.

c# - MySQLBulkLoader not inserting any row in mysql db -

var bl = new mysqlbulkloader(mycon); bl.tablename = "tblspmaster"; bl.fieldterminator = ","; bl.lineterminator = "\r\n"; bl.filename = "e://31october//sp//sp_files_sample1//400k sp00 6-19 e.csv"; bl.numberoflinestoskip = 1; var inserted = bl.load(); i using code upload csv file in db not throwing exception , inserted show 0 . dotnetconnector mysql installed , reference added . finally have used code , working me string sql = @"load data infile 'e:/a1.csv' ignore table tblspmaster fields terminated '' enclosed '' lines terminated '\n' ignore 1 lines (sp)"; mysqlcommand cmd = new mysqlcommand(sql, mycon); cmd.commandtimeout = 5000000; cmd.executenonquery();

delphi - VirtualTreeView. How to modify child column width? -

Image
my friend working in delphi virtualtreeview , has next problem: has 2 columns data , childs every row in first column. possible not changing first column width set maximum child column width? so. circles nodes, rectangles text. (black rectangles of root nodes 2 column). how looks - child black reactangle. how have - red rectangle. thanks this called column spanning , yes, can done quite - set treeoptions -> autooptions -> toautospancolumns option true . way works if adjacent column empty caption of current 1 extended it. want work child columns have implement ongetcellisempty event , return isempty := true child nodes, ie like procedure tform1.vt_getcellisempty(sender: tbasevirtualtree; node: pvirtualnode; column: tcolumnindex; var isempty: boolean); begin isempty := (sender.getnodelevel(node) > 0); end;

c++ - boost matrix with relic -

i'm trying use boost matrix of fb_t, relic object represents element of finite field. here how fb_t defined doc: typedef uint64_t dig_t typedef align dig_t fb_t[fb_digs+padding(fb_bytes)/(fb_digit/8)] and here's code: #include <iostream> #include <boost/numeric/ublas/matrix.hpp> extern "c" { #include <relic.h> } #include "relic_test.h" using namespace std; typedef boost::numeric::ublas::matrix<fb_t> matrix; int main(void) { core_init(); fb_param_set_any(); fb_param_print(); matrix mat(2,2); core_clean(); return 0; } i got following error: compiling: main.cpp in file included /usr/include/boost/numeric/ublas/vector.hpp:19:0, /usr/include/boost/numeric/ublas/matrix.hpp:16, /home/foo/main.cpp:2: /usr/include/boost/numeric/ublas/storage.hpp: in instantiation of ‘boost::numeric::ublas::unbounded_array<t, alloc>::unbounded_array(boost::numeric::ublas::unbounde

c++ - vsinstr.exe instrumented large executable performance -

i use visual studio vsinstr.exe tool instrumenting unmanaged c++ executable (legacy app). large project , way how map our huge test automation content actual code, identify test cases affected when change made code base. i'm concerned performance of such instrumented executable, because need run whole test automation content coverage data (or update when code changed) , done each night. picture, test automation run takes maybe 10 hours (gui tests, no unit tests because of legacy architecture) does have real experience regarding performance of instrumented executables? i realize question getting long in tooth (getting old) answer intended other users stumble across question. from real world experience, instrumented binaries run slower, orders of magnitude. however, have instrumented managed binaries , op stated unmanaged c++ "your mileage may vary." my suggestion run subset of tests take between 2-3 minutes. run subset 3 times , average actual run ti

mingw - Can't include D2D1 -

i feel should work... #include <d2d1.h> int main () { return 0; }; ...but comes bunch of this... c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgi.h|286|error: '__in' has not been declared| c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgi.h|286|error: expected ',' or '...' before '&' token| c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgi.h|293|error: '__in' has not been declared| c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgi.h|293|error: expected ',' or '...' before '&' token| c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgi.h|299|error: '__in' has not been declared| c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgi.h|299|error: expected ',' or '...' before '&' token| c:\program files (x86)\microsoft directx sdk (june 2010)\include\dx

knockout.js - hiding the close button on a Jquery dialog that is bound to knockout view model -

i need hide jquery dialog close button (the 'x' on top right corner) on dialog bound knockout view model. here div knock out binding <div id="rundialog" data-bind="dialog: { autoopen: autoopendialog, modal: isdialogmodal, title: dialogtitle }, opendialog: dialogitem"> </div this utilizing knockout.bindings.js in past have been able control using open event , hide way open: function (event, ui) { $(".ui-dialog-titlebar-close", ui.dialog).hide(); }, i can add knockout dialog binding, pretty ugly have better way here? thanks! you should use next construction, desribed on jquery dialog api page in section hiding close button 1) add css rule .no-close .ui-dialog-titlebar-close { display: none; } 2) in knockout binding use dialogclass: 'no-close' <div id="rundialog" data-bind="dialog: { autoopen: autoopendialog, modal: isdialogmodal, title: dialogtitle, d

objective c - @property vs just declaring getter and setter -

is there difference in behaviour - either @ compile time or @ run time - between code... // myclass.h @interface myclass : nsobject @property (nonatomic) sometype myproperty; @end // myclass.m @implementation myclass @end ... , code? // myclass.h @interface myclass : nsobject -(sometype)myproperty; -(void)setmyproperty:(sometype)myproperty; @end // myclass.m @implementation myclass { sometype _myproperty; } -(sometype)myproperty { return _myproperty; } -(void)setmyproperty:(sometype)myproperty { _myproperty = myproperty; } @end obviously, former version more succinct , readable, there difference in behavior? synthesized getter , setter more sophisticated straightforward implementation here? declaration of property distinguishable introspection functions declaration of getter , setter? there other differences haven't thought of? short answer: no difference. however, property attributes ( copy or atomic ) may require different accessor me

c# - WPF topmost option makes fullscreen app to escape -

i used small window tooltip shows "now playing" info in application. sure set topmost = "true" in window declaration , when new song starts play tooltip.show() . problem when have fullscreen application in focus (game example), .show() call makes fullscreen window became non-fullscreen, windowed, border , top bar (as if press alt + enter) , looks loses focus also. restore fullscreen need click in window focus , press alt-enter manually. showactivated set "false" already. so, see 3 solutions: 1) somehow make topmost option not cause steal focus on .show() 2) use workaround make tooltip window "always on top" without topmost option (i don't need popup tooltip on fullscreen application since can (and be) drawed via d3d or opengl) 3) detect if system has fullscreen window in focus , don't try show tooltip. i have no clue how fix behavior of options, or maybe there more elegant? so... in case interested, here "r

css - Position, margin, right, float, div under div right: 0 -

how can see http://jsfiddle.net/73wst/ i want start under stop, don't know how style it. my html: <div class="main"> <div class="stop">stop</div> <div class="start">start</div> </div> my css: .start { float:right; right: 0; position: relative; top: 30px; } can me? thanks. clear: right; http://jsfiddle.net/73wst/1/ the other rules have nothing anything.

Send FormData and String Data Together Through JQuery AJAX -

i have below uploads image using jquery's ajax function var id = <?php echo $id; ?>; var img_data = new formdata($("form")[0]); $.ajax({ url: 'add.php', data: img_data, contenttype: false, processdata: false, type: 'post', success: function(data){ alert(data); } }); i'd include string formdata sent. tried following, no luck data: img_data {id: id}, what's correct syntax here? use append var img_data = new formdata($("form")[0]); img_data.append('id', id);

Compiling a single coffeescript file breaks the asset pipeline rails -

i getting non-descriptive errors coffeescript in rails project, compiled single file narrow down line number causing problem: coffee -c app/assets/javascripts/myfile.coffee now every time edit , save file, changes don't propagate browser. i tried deleting /tmp folder , public/assets folder well, did not me. when this: coffee -c app/assets/javascripts/myfile.coffee coffee produce javascript in: app/assets/javascripts/myfile.js presumably myfile.js generated hiding .coffee file or interfering usual .coffee .js compilation. try deleting stray myfile.js .

delphi - Jump to finally without exiting a function/procedure -

i have following situation: procedure test; begin repeat tryagain := false; try // code // code if , begin tryagain := true; exit; end; // cleanupcode end; until tryagain = false; end; how can jump section without calling exit automatically calls repeat footer also? use continue proceed next iteration. code in finally part of try..finally block designed executed, if force skip next iteration: procedure tform1.button1click(sender: tobject); begin repeat tryagain := false; try if somecondition begin tryagain := true; // proceed block , go repeat continue; end; // code here execute if somecondition // false, because calling continue skip // code in block executed end; until not tryagain; end; but same logic can write way: procedure tform1.button1click(sender: tobject); begin repeat tryagain := false; try if somecondition beg

Unable to access certain Google Drive folders using Zend GData libraries although folder is listed in My Drive -

i'm querying google drive , passing in folder name if want list folders/file contained in it. code works, can view content of folders, folders visible within google drive web ui, don't entries returned, there content. i'm using zend_gdata_docs , zend_gdata_docs_documentlistfeed doing heavy lifting, _entry array should contain folder contents empty when should contain array of zend_gdata_docs_documentlistentry objects. i'm passing folder appending folder name https://docs.google.com/feeds/documents/private/full/-/some-folder-name whats proving me google issue if rename folder causing issues , create new folder same name code works , see contents. all strange pointers before ditch google drive , move dropbox? you need pass folder id not name

sorting - (python) Implementing C insort in python -

so i'm using insort bisect insert strings sorted list. it's somehow faster if use built in one. **by faster mean, on average twice fast (1 millisecond vs 2 millisecond on 10,000 word list). run through unix cmd on bigger list 1 have below through: time script.py < wordlist.txt i'm thinking has c, don't understand how or why. want make mine fast, without using built in. here straight bisect source-code: def insort_left(a, x, lo=0, hi=none): """insert item x in list a, , keep sorted assuming sorted. if x in a, insert left of leftmost x. optional args lo (default 0) , hi (default len(a)) bound slice of searched. """ if lo < 0: raise valueerror('lo must non-negative') if hi none: hi = len(a) while lo < hi: mid = (lo+hi)//2 if a[mid] < x: lo = mid+1 else: hi = mid a.insert(lo, x) bisect source code this part think makes different: # overwrite above definitions fast c implementation try

excel vba - Locking a text box from manual input -

i have text box in excel worksheet displays value of variable in macro. dont want user able manually enter text textbox. have set " locked " property of text box true , can still edit text in text box manually. do? protect sheet , make sure edit objects checkbox cleared

bootstrapper - How to avoid uninstalling previously installed ExePackage (redistributables) while installing a WiX Bundle? -

i have bundle installs , uninstalls vc 2012 redist. working fine if there no vc 2012 redist installed previously. if there vc 2012 redist installed, while uninstalling bundle, uninstalls vc 2012 redist well. want must not uninstall vc 2012 redist if installed. trying use variable element persisted attribute set "yes". not sure how works. pointers appreciated. bundles can reference count contained packages. add provides element wixdependencyextension , bundles use same provides element correct reference count. unfortunately, vcredist doesn't document standard provides key there no real way correctly reference count package. thus, vcredist team expects mark permanent.

ios6 - core-plot Mixing CPTScatterPlotInterpolationCurved and CPTScatterPlotInterpolationLinear -

i need able draw sequential line segments have same y coordinate cptscatterplotinterpolationlinear , ones not cptscatterplotinterpolationcurved. cptscatterplotinterpolationcurved draws lines curved. doing adding multiple plots. public list<correctedgraphpoints> getcorrectdatapoints(list<pointf> datasource) { int lastindex = 0; bool shouldloop = true; cptscatterplotinterpolation interpolation = cptscatterplotinterpolation.curved; list<correctedgraphpoints> outerlist = new list<correctedgraphpoints> (); if (datasource [0].y == datasource [1].y) interpolation = cptscatterplotinterpolation.linear; while (lastindex+1 != datasource.count) { outerlist.add (new correctedgraphpoints (interpolation)); while (shouldloop) { outerlist[outerlist.count -1].add(datasource[lastindex]);

javascript: making a calendar navigation bar -

when click on function goes wrong. problem. struggle few month on this. click on button , exepect month number increase or decrease. , show me right result. <!doctype html> <html> <style> table { border-collapse:collapse; } table img { width:50px; height:50px; } td,table { border-color:blue; text-align:center; } td:hover { cursor:pointer; background-color:yellow; } </style> <head> </head> <body> <script> var date=new date(); var mn=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec']; y=date.getfullyear(); m=date.getmonth(); function preyear() { y -= 1; calendar(); } function premonth(){ m -= 1; calendar(); } function nextmonth(){ m += 1; calendar(); } function nextyear(){ y += 1; calendar(); } function today(){ y=date.getfullyear(); m=date.getmonth(); calendar(); } func

php - cakephp - getting the correct path in a javascript file -

i'm trying use $.post() jquery call in javascript file have in webroot/js folder. the javascript file gets called in number of places , i'm struggling figure out correct path use is. i'm using following @ moment $.post("../../spanners/deletespanner", function(data) { alert(data); }); but using ../../ won't work in parts of app. what can replace ../../ with? this depends on place of app on server , how spanners controller's deletespanner action access. suppose following: mywebsite.com/spanners/deletespanner ===> $.post("/spanners/deletespanner"... mywebsite.com/someapp/spanners/deletespanner ===> $.post("/someapp/spanners/deletespanner"... to prove concept you, checkout demo: http://jsbin.com/apejeqa/1 in-which src of jsbin logo website accessed page level starting path / <img src="/images/jsbin_static.png" alt="jsbin logo" />

javascript - Yeoman Angularjs How to Implement Directive -

i'm trying feet off ground yeoman + angular , going through tutorials, can't basic directives fire, when try them same in tutorials. could please lend insight i'm missing, i've been struggling past 2 days html template - ng-resize intended directive <body ng-app="mvmdapp"> .... <div ng-mousemove="onmouse($event)" ng-resize="" class="youtube-cover ng-scope"> <div class="youtube-unit"></div> </div> // controllers/youtube.js 'use strict'; angular.module('mvmdapp').controller('youtubectrl', function($scope) { console.log('hi');// fires return $scope.onmouse = function(e) {}// fires // directives/resize.js 'use strict'; angular.module('mvmdapp', []).directive('ngresize', function($window) { return function(scope) { return console.log('directive');// not fire }; }); the strange thing whenever call a

in PHP find if a value of an inner array exists, then if found, delete the array -

i have simple 2 dimensional array. i'm trying write function finds if value exists in 1 of inner arrays. not hard. problem need delete entire inner array once found. that's i'm having trouble with. seems impossible using foreach loops. anyway, here array. thanks! $booksincart = array (array ('bookid' => 344, 'quantity' => 1), array ('bookid' => 54, 'quantity' => 1), array ('bookid' => 172, 'quantity' => 2), array ('bookid' => 3, 'quantity' => 1) ); use foreach loop key , value. use key unset() sub-array... foreach ($booksincart $key => $sub) { if ($sub['bookid'] == 172) { unset($booksincart[$key]); } }

c++ - Opencv: Null pointer (NULL array pointer is passed) in cvGetMat -

i'm getting error when trying capture video webcam using opencv. code i'm using: #include "opencv2/opencv.hpp" using namespace cv; using namespace std; int main( int argc, const char** argv ) { cvcapture *capture = cvcapturefromcam(0); iplimage *frame; cvnamedwindow("test"); while ( 1) { frame = cvqueryframe(capture) ; cvshowimage("test", frame); int key = cvwaitkey(1); if ( key == 27 ) break; // esc key pressed } // memory deallocation cvreleasecapture(&capture); cvdestroywindow("test"); return 0; } the error occur @ cvshowimage("text", frame): opencv error: null pointer (null array pointer passed) in cvgetmat, file /opt/local/var/macports/build/_opt_mports_dports_graphics_opencv/opencv/work/opencv-2.4.6.1/modules/core/src/array.cpp, line 2382 libc++abi.dylib: terminate called throwing exception (lldb) what error , how ca

eclipse kepler "Cannot install remote marketplace locations" -

i have downloaded latest eclipse version, eclipse kepler. but when try access marketplace inside eclipse or try install adt plugin android, gives me creepy error driving me crazy: cannot open eclipse marketplace cannot install remote marketplace locations: connection failed caused problem internet connection. please check internet connection , retry. unable read repository @ http://marketplace.eclipse.org/catalogs/api/p. connection reset connection failed caused problem internet connection. please check internet connection , retry. connection reset i figured out that: avira anti-virus software blocking network requests eclipse. after deactivating "enable web protection" in anti-virus, stupid eclipse able update itself.

eclipse - Check Android API level in codes -

i made mistake of not taking consideration of api level of each method used in code. after coding 500 lines, have no idea highest android api level have used in code. obviously, hope not have check through every single line of method api level wondering there option in eclipse check highest api level method had used. set target sdk level minimum sdk, set project build target same api level, recompile , fix errors show up. note still have handle api behavior changes happened asynctask, start.

android - Want to convert a date from the format"dd-mmm-yyyy" to "yyyy-mm-dd". And here is my code -

i want convert date format"dd-mmm-yyyy" "yyyy-mm-dd". , here code. public void convertdate(){ gregoriancalendar todaysdate = (gregoriancalendar) month.clone(); // show error on here. simpledateformat df = new simpledateformat("dd-mmm-yyyy", locale.us); currentdatestring = df.format(todaysdate.gettime()); try{ date tdate3= df.parse(currentdatestring); tdate4=targetdateformat.format(tdate3); } catch (parseexception e) { log.e(getpackagename(), e.getmessage()); e.printstacktrace(); } but problem showing nullpointer exception . , not able understand mistake. please if can ? try : date cdate = new date(); dateformat inputformat = new simpledateformat("yyyy-mm-dd"); date date = dateformat.parse(cdate); hope you.

javascript - How to measure the compression with web audio api? -

i create html meter display reduction made compressor node. i used code not change metter compressor = context.createdynamicscompressor(); compressor.threshold = -50; compressor.ratio = 12; compressor.attack = 0.003; compressor.reduction.onchange = function () { var gainreduction = pluginslot1.reduction; document.getelementbyid("meter").value = gainreduction.value; }; this connected html < meter id="meter" min="0" max="100"> what need in order work? here's quick , dirty jsbin example: http://jsbin.com/ahocut/1/edit unless there's i'm missing in spec, reduction param doesn't fire events. need read on-demand. in example, that's happening requestanimationframe loop. the other thing you're missing need set params compressor.threshold.value , because compressor.threshold object. hope helps.

excel vba - when a certain word is found in a cell, insert a line -

i trying write macro when button clicked, information transfered 1 spreadsheet onto form (also excel sheet). can't seem 1 thing right: insert lines when reach bottom of form. @ bottom of form, in column a, says:additional. want insert line every time come in contact cell. please help! for example: = 1 lastline worksheet1.range("a" & i).value = worksheet2.range("a" & i) if worksheet1.range("a" & i).value contains "additional" 'please me write line insert line above cell 'please me write line end if next please help!!! in advance! let me know if question makes sense :) dim tmp, skip long skip = 0 = 1 lastline tmp = worksheet2.range("a" & i).value if lcase(tmp) "*additional*" skip = skip + 1 worksheet1.cells(i + skip, 1).value = tmp next

Android Fragment back stack causing wired issue -

i having fragment in single activity in following sequence. fragment 1 --> fragment 2 --> fragment 3 --> fragment 4 i using below code fragment transaction. mfragmenttransaction=mfragmentmanager.begintransaction(); mfragmenttransaction.replace(r.id.fragment_container, mfragment,fragmentname); mfragmenttransaction.addtobackstack(tag); mfragmenttransaction.commit(); what want when user on fragment 3 or 4 on press if user on fragment 4 fragment 4 --> fragment 3 --> fragment 1. if user on fragment 3 fragment 3 --> fragment 1. i using following code in onback press. if(mfragmentmanager.findfragmentbytag("fragment 3")!=null){ mfragmentmanager.popbackstack("fragment 2",fragmentmanager.pop_back_stack_inclusive); }else{ super.onbackpressed(); } but cause wired issue on on press follow. fragment 4 --> fragment 1 instead of fragment 4 --> fragment 3 --> fragment 1. fragment 3 --> f

ios - Changing a label in another view -

i have program multiple views, 1 of them has labels (labelview question), other has text fields(textview question). take info text fields, , put on label, think easiest way calling method labelview textview. i have tried couple things: i tried putting method in labelview changed label's values parameters. calling method in textview , passing data through parameters. i tried making delegate, using this question. unfortunately last step (add settingview.viewcontrollerdelegate=self viewdidload method) failed. settingview undeclared identifier. does know should do? edit: here have done, using xman's parent/child view idea. in textview.m: nsinteger curscore = [self.top1score.text integervalue]; nsinteger curphase = [self.top1phase.text integervalue]; self.top1score.text = [nsstring stringwithformat:@"%d", (curscore += [self.player1txt.text integervalue])]; if ([self.player1txt.text integervalue] < 50) { self.top1phase.text = [nsstring stringwith

shell - Alert when file content changes -

this question has answer here: monitor directory content change 2 answers i want write shell script checks logic files placed @ /var/www/html/ and, if user makes change in files, sends alert administrator informing them "user x has made change in f file." not have experience in writing shell scripts, , not know how start. highly appreciated. this answered in superuser: https://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes basically use inotifywait simple, using inotifywait: while inotifywait -e close_write myfile.py; ./myfile.py; done this has big limitation: if program replaces myfile.py different file, rather writing existing myfile, inotifywait die. editors work way. to overcome limitation, use inotifywait on directory: while true; change=$(inotifywait -e close_wri

autosys - file watcher job which is going to error with Error Code 143. Issue is sporadic in nature -

we need input autosys on file watcher job. there 1 file watcher job going error error code 143. file watcher job checks if file present on remote server or not. the same job runs fine non production instances. inproduction reason fails sporadically error code 143. error not depend on if file there or not there . the above error code 143 states issue pertain "the system cannot join or substitute drive or directory on same drive". can check same in exit code list further research on this..

javascript - Add <style> and <script> in Magento static block -

i have static block (identifier mega_menu ) it has code this: <ul class="dropdown-menu" role="menu"> <li data-submenu-id="submenu-patas"> <div id="submenu-patas" class="popover"> <h3 class="popover-title">patas</h3> <div class="popover-content"><img src="img/patas.png"></div> </div> </li> <li data-submenu-id="submenu-snub-nosed"> <div id="submenu-snub-nosed" class="popover"> <h3 class="popover-title">golden snub-nosed</h3> <div class="popover-content"><img src="img/snub-nosed.png"></div> </div> </li> </ul> in normal html file (from got code) there styles , it's references this: <link href="css/bootstrap.c

iphone - Find Angle between 2 polylines -

i drawing mkpolylines between 2 sets of coordinates on mkpolylineview in mkmapview. 1 line actual route travelled 1 point other, while other line shortest distance between 2 points. have drawn 2 sets of lines. need find angle direction in between 2 lines. despite efforts have not been able come helpful. needed. this how have drawn polylines. self.routeline = [mkpolyline polylinewithcoordinates:pointstouse count:[array count]]; self.straightline = [mkpolyline polylinewithcoordinates:straightlinepoints count:2]; [self.map addoverlay:self.routeline]; [self.map addoverlay:self.straightline]; - (mkoverlayview *)mapview:(mkmapview *)mapview viewforoverlay:(id <mkoverlay>)overlay { if(overlay == self.routeline){ // ylineview *polylineview = [[mkpolylineview alloc] initwithpolyline:self.polyline]; polylineview = [[mkpolylineview alloc] initwithpolyline:self.routeline]; polylineview.linewidth = 2; polylineview.strokecolor = [uicolor lightgraycolor]; polylineview.backgroundcolor

Can I ignore build folder from master branch? - Yeoman Deployments using Git Subtree -

yeoman's deployment page, describes process of committing build folder (aka "dist") repo, pushing folder git subtree following command. git subtree push --prefix dist origin gh-pages i've got working fine, , able deploy build code dist folder build subtree branch (gh-pages in example above). can .gitignore dist folder master? if so, git subtree push --prefix dist origin gh-pages keep working? if not, how might avoid committing built source master branch, while keeping in git subtree deploying? (need keep in branch because use capistrano deployments, which, sort of, relies on deploying entire branch server.) .gitignore files not remove existing files repository, , not prevent committing files ignored. if ignore files after committed, stay in repository untouched, though changes them ignored. if want commit changes ignored file (or file committed , ignored), can use git add -f forcibly add ignored changes. to answer question more directly,

css - javascript code for resizing the div -

this jsp code hidden div want move div form 1 tab tab according onclick event on tabs <div id="addprojectname" style="-moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; background-color: #ffffff; border-color: -moz-use-text-color #aaaaaa #aaaaaa; border-image: none; border-radius: 4px 4px 4px 4px; border-style: none solid solid; border-width: medium 2px 2px; box-shadow: 0 0 5px #aaaaaa; display:none; width: 328px;"> <form name="frm" action="linkbean.jsp" method="post"> <input type="hidden" id="sl_category" name="sl_no_cat" > <table style="padding: 5px 0px 0px 8px;"> <tr> <th colspan="2"> <a onclick= "hidewindows('addprojectname');" href="#"><img alt="aalpine services" src="