Posts

Showing posts from September, 2014

SQL ERROR: Closed Connection in java -

connection closing automatically if i'm not closing in block. public string look( long id, string codename, connection conn ) throws sqlexception { try { stringbuffer sel = new stringbuffer().append(property); stmt = conn.preparecall( sel.tostring() ); /* filecode.java:194 */ stmt.setstring( 1, namec ); stmt.setlong( 2, valuei ); stmt.registeroutparameter( 3, oracle.jdbc.oracletypes.varchar ); stmt.execute(); return stmt.getstring( 3 ); } catch ( sqlexception e ) { if ( e.getmessage().touppercase().contains( "no data" ) ) { return "value not found"; } throw e; } catch ( exception e ) { e.printstacktrace(); } { system.out.println( " connnnnn closed ? : " + conn.isclosed

scheme equivalent to ruby debug 'p' statement -

i'm trying debug scheme code. helpful if print contents of variable or binding out. is there equivalent 'p' statement of ruby in scheme. in particular, i'm using racket. there's no p equivalent, it's easy roll own. #lang racket (define-syntax-rule (p e) (let ([ans e]) (printf "~a => ~a\n" (quote e) ans) ans)) (p (+ 1 2)) outputs (+ 1 2) => 3 3 as low-tech alternative, may interested in c-c c-l keyboard shortcut in racket .

titanium - Where is the Alloy Resources Folder -

Image
i'm using titanium alloy 3.0.2 ga (on mac) build cross-platform mobile app why doesn't resources folder show in titanium studio, though present in filesystem? i want store images displayed within application, , believe should store them somewhere inside resources folder. when @ project explorer within studio, don't see /resources folder. when tried add resources folder root, told there resources folder! finder confirms there resources folder. so, how resources folder show in studio project explorer? also- not show in app explorer view either. yeah had problem well, thankfully this documented in guides section. heres pertinent information: if resources folder hidden, in app explorer view, click view menu button (right triangle pointing down) , select customize views..., available customizations dialog appears. in filters tab, uncheck titanium resources folder checkbox, click ok button. resources folder should appear in app explorer v

jquery - Why am I not able to append an image only if certain classes exist? -

i trying use jquery append image tag div if 1 of 3 classes exists, doesn't seem working. either appends of elements or none @ all. here html code: <figure class="donut minus"> <div class="figure-value"></div> </figure> here jquery: if ($("figure.donut").hasclass("minus") || $("figure.donut").hasclass("plus") || $("figure.donut").hasclass("plus-minus")) { $(".figure-value").append('<img src="../images/schoolprofile/donut-plus-minus.png" />'); } instead of if try using filter: $("figure.donut") .filter(".plus, .minus, .plus-minus") .find(".figure-value") .append('<img src="../images/schoolprofile/donut-plus-minus.png" />'); this find of figures class of donut , plus, minus or plus-minus , find element class of figure-value inside them , append

Excel VBA script to copy columns into separate text files under separate directories -

i have worksheet contains 27 columns, first row columns headers a-z , num totaling 27 cols. each column has long list of restricted urls sorted letter of column, , last (27th) column urls start number. columns' length between 300-600 thousand cells. what after copy each column separate text file (*.file) under separate folders, ie column copied , saved c:/blacklist/a/a.file, , on, c:/blacklist/b/b.file way c:/blacklist/num/num.file. i have been searching solution , found following vba script, close after, at: http://www.ozgrid.com/forum/showthread.php?t=142181 option explicit public sub columns_2_textfile() const my_path = "c:\textfiles\" dim icol integer dim lrow long dim file_num long on error resume next if trim(dir(my_path, vbdirectory)) = "" mkdir my_path else kill my_path & "*.txt" end if on error goto 0 file_num = freefile activesheet icol = 2 256 open my_path & trim(.cells(2, icol).value)

Circular interpolation in Python -

i have 2 systems, each of has direction sensor (0-360 degrees), sensors can provide wildly different values depending on orientation of each system , linearity of each sensor. have mechanical reference can use generate table of each system pointing. yields table 3 columns: physical systema systemb -------- ------- ------- 000.0 005.7 182.3 005.0 009.8 178.4 ... ... ... from data shown, can see systema isn't far physical reference, systemb 180 degrees off, , goes in opposite direction (imagine mounted upside-down). i need able map , forth between 3 values: if systema reports @ 105.7, need tell user physical direction is, tell systemb point same location. same if systemb makes initial report. , user can request both systems point desired physical direction, systema , systemb need told point. linear interpolation isn't hard, i'm having trouble when data going in opposite directions, , modular/cyclical. is there pythonic way the

Authenticating Twitter on Rails app -

i'm using twitter gem along amniauth fetch user's tweets , display them on homepage. when try grab tweets command line i'm getting 'bad authentication data' error. gemfile: gem 'omniauth' gem 'omniauth-twitter' gem 'twitter' twitter.rb in config/initializers: twitter.configure |config| config.consumer_key = 'key' config.consumer_secret = 'secret' config.oauth_token = 'token' config.oauth_token_secret = 'secret' end omniauth.rb in config/initializers: require 'omniauth-twitter' config.omniauth :twitter, 'key', 'secret' i've double checked key , passwords, can't run. using spree. here's error: irb(main):001:0> require 'twitter' => true irb(main):002:0> twitter.user_timeline(213747670) twitter::error::badrequest: bad authentication data /usr/local/lib64/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter/response/raise_erro

Neo4j get_or_create unique REST batch API issue -

the following rest api batch fails: post http://localhost:7474/db/data/batch [{"method":"post","to":"index/node/name uniqueness=get_or_create","body":{"key":"name","value":"person1","properties":{"type":"person"}},"id":1}, {"method":"post","to":"index/node/name?uniqueness=get_or_create","body":{"key":"name","value":"person2","properties":{"type":"person"}},"id":2}, {"method":"post","to":"{1}/relationships","body":{"type":"knows","to":"{2}","data":{"since":"2012"}},"id":3}] with 500 internal server error. for reason not seem possible refer nodes in batch {1} , {2} when using uniqueness=get_or_c

sql - How do you explicitly show rows which have count(*) equal to 0 -

the query i'm running in db2 select yrb_customer.name, yrb_customer.city, case count(*) when 0 0 else count(*) end #uniclubs yrb_member, yrb_customer yrb_member.cid = yrb_customer.cid , yrb_member.club '%club%' group yrb_customer.name, yrb_customer.city order count(*) shows me people part of clubs has word 'club' in it, , shows how many such clubs part of ( #uniclubs ) along name , city. students not part of such club, still them show have 0 instead of them being hidden what's happening right now. cannot functionality count(*) . can shed light? can explain further if above not clear enough. you're going want left join : select yrb_customer.name, yrb_customer.city, count(yrb_member.club) clubcount yrb_customer left join yrb_member on yrb_member.cid = yrb_customer.cid , yrb_member.club '%club% group yrb_customer.name, yrb_customer.city order clubcount also, if tuple ( yrb_customer.name ,

Possible to stop redirect after submitting POST request to Facebook graph? -

quick background: i've created basic facebook app users can "like" post website outside of facebook. users authenticate, redirected access_token gathered js , inserted form via hidden field , passed post request. (not relevant, use js automatically submit 'like' after user redirected site facebook.) after http request sent (and successful), user redirected response page, rendering "true" printed on screen. there way stop redirect? i've set js swap out div content once form submitted, can't seem stop them being directed away. thanks in advance ideas. html excerpt <!-- *authentication section* --> <div id="submit_like"> <form> <a id="facebook-authentication" href="https://graph.facebook.com/oauth/authorize?type=user_agent&client_id=[my_app_id]&redirect_uri=[my_post-authorization_redirect_url]&scope=offline_access,publish_stream"> <div id=

c++ - How to go from linker error to line of code in the sources? -

the linker produces kind of output /var/tmp/ccitb4j2.o: in function `main': /var/tmp/ccitb4j2.o(.text+0x4): undefined reference `myfunction(void)' how can find out line of source code corresponding instruction @ .text+0x4 function invoked? first, other answer question wrong: on linux do file , line number linker: $ cat foo.cc extern int myfunction(void); int main() { return myfunction(); } $ g++ -g foo.cc /tmp/cc3twlhl.o: in function `main': /tmp/foo.cc:5: undefined reference `myfunction()' collect2: ld returned 1 exit status above output gcc (ubuntu/linaro 4.6.3-1ubuntu5) 4.6.3 , linker gnu ld (gnu binutils ubuntu) 2.22 , has been true older versions of gcc , ld well. the reason not getting file/line must that you didn't use -g flag, or you have really old ld , or you have configured ld without support debugging (i not sure possible). however, if ld refusing tell file , line, not lost. can compile source object, use objdump -

sql - how to apply if condition in Hibernate queries in grails -

i using springsourcetool grails project developement . had requirement execute query if condition in , first tried query in sql query browser , works fine when try access in grails , result set null . my sql query dummydata , select week , month , emp_name , sum(emp_salary),sum(if(emp_age=19,emp_bonus,0)) dummy_data order week; this query works fine now when try same in grails domain class execute query def mylist = dummydata.executequery("select week,month,empname,sum(empsalary),sum(if(empage=19,empbonus,0)) dummydata group week") generally don't want execute raw sql queries against hibernate database because orm stores things in tables in more complex way how might store data (so can map java objects). you're not selecting particular fields database, rather you're selecting objects. need store data in way can retrieved hibernate. i suggest use facilities in grails execute queries against hibernate database - particularly @ criteria build

linux - How do I run ssh-keygen so that it overwrites without prompting if a key cert exists? -

so have scenario remote call made target machine. it's possible more 1 call made generate ssh keys, in case script hang requests overwrite (y/n). is there proper way request non-interactive overwrite (or silently ignore) of keys if found? there doesn't seem --force or --overwrite option in man ssh-keygen that can find. there rationale having function way, or bug should report authors? any appreciated. you can work around thusly: echo -e 'y\n'|ssh-keygen -q -t rsa -n "" -f ~/.ssh/id_rsa it still output prompt, complete process , overwrite file.

x86 - Converting a hex character within Assembly -

i'm programming in assembly 8086. the current task i'm doing converting 4 hex digits decimal representation. i've tried following tutors method i'm confused @ section have multiply hex digit temporary value, i've been told make 0 every time temp valued multiplied it's going 0 right? the code have far below, appreciated! ; ------------------------------------ ; name : gethex ; function: converts word (4 hex digits) numerical value ; inputs : upto word hex values input console ; outputs : return within dx numerical conversion ; ------------------------------------ gethex: mov bx,0h ;temp value 0 mov cx,0h ;counter set 0 gethexloop: call getch push dx ; putch requires dl, need save current reg mov dl,al call putch pop dx ; restore dl reg mov bh,ah ;use bh temp storage ah corrupted cmp al,30h ; ascii 0 jl gethexloop ; if less 0 jump start not alphabetical char cmp al,39h ; ascii 9 jle nums ; if less or equal 9 number cmp al,46h jle case ; start conver

javascript - Page Scrolling jQuery Navigation -

i building website can viewed here: argit.bounde.co.uk i have done majority of content , trying work on navigation. have 3 navigation bars (only 1 ever visible) , need method work no matter showing. if resize browser make window narrower show second, , when scroll navigation appears third. i have got working fashion problem when click link jumps wants go momentarily, returns , scrolls meant to. because of "href="#target" have left in nav. have tried including "return false" if broswer doesnt support js navigation doesnt work @ all. the next problem want way make target "over". when click link scrolls selected 1 , nav updates link "over" passes them. want when user scrolling , down page, if click link want link "over" (and respective links other navigations) , not affected scroll checks override it. the solution using onclick navigation below, know there plug ins kind of thing want write myself can better understanding o

audio - How to play a sound in java from the millisecond X -

i have problem, wanna play sound (or music file) example second 10 12, possible make function soundobject.play(10000,12000); ? i'm testing sound classes can play, stop , loop thank you! i found answer, code used play 3-5 seconds import java.io.ioexception; import java.net.url; import javax.sound.sampled.audioinputstream; import javax.sound.sampled.audiosystem; import javax.sound.sampled.clip; import javax.sound.sampled.lineunavailableexception; import javax.sound.sampled.unsupportedaudiofileexception; public class soundcliptest{ public static void main(string[] args) throws unsupportedaudiofileexception, ioexception, lineunavailableexception { url myurl= classloader.getsystemresource("abesti.wav"); audioinputstream audio = audiosystem.getaudioinputstream(myurl); clip clip = audiosystem.getclip(); clip.open(audio); clip.setmicrosecondposition(3000000); clip.start(); try { thread.sleep(2000); //i

simple image slider in jquery -

i found code 'image slider' on site, i'm trying change suit needs. want able step through 3 or 4 image files, i'll settle two, until code sorted. could me fix code? have 2 images, img1_on.png , img2_on.png. <img id ="rotate_images" src="img1_on.png"/> $('rotate_images').on({ 'click': function() { var src = ($(this).attr('src') === 'img1_on.png') ? 'img2_on.png' : 'img1_on.png'; $(this).attr('src', src); } }); it worked when instead of $('rotate_images').on had $('img').on. what's happening - 'when click on image on page, if current image isn't img1_on.png, show img1_on.png...but want code apply specific div of images, not image. any appreciated. chris. change selector to: $('#rotate_images').. you forgot #

recursion - Recursive backtracking knights tour in c ++ -

so, in short i'm working on knight's tour program. if don't know is, knight gets put on chess board , have move every spot on board once. i'm using recursive function having trouble getting backtracking work. can 22 steps in 5x5 board program won't , try different path. i'm posting recursive part of code (sorry it's little long) insight extremely helpful. lot! `bool findpath ( int board[][boardsize + 4], int &currrow, int &currcol, int &currmove,int boardsize ) { int i, j; bool foundspot; board[currrow][currcol] = currmove; if ( currmove == boardsize * boardsize ) return true; ( = 0; < boardsize + 4; i++ ) { ( j = 0; j < boardsize + 4; j++ ) cout << setw (3) << board[i][j]; cout<<endl; } cout << endl; if ( board[currrow - 2][currcol - 1] == 0 ) { currmove += 1; board[currrow - 2][currcol - 1] = currmove; curr

javascript - Click trigger on anchor that is loaded by ajax -

i trying use ajax trigger on anchor dynamically generated ajax. this tried no success , no errors: $('.exceldl').live('click', function(e){ $.ajax({ url: 'exceldl.php', data: $('#myform').serialize(), type: 'post', success: function(data){ $('.xldl').html(data); attach = $('.xldl a').attr("href"); $('.xldl a').trigger('click'); } }); }); i believe because inserting new elements dom using ajax trigger not working, why tried using live . not sure how proceed , solve problem. i appreciate suggestions. many in advance! use "on" instead of "live" $(document).on('click','.exceldl',function(e){ $.ajax({ url: 'exceldl.php', data:

delphi - what causes this strange painting "corruption"? -

Image
our application largely single screen application. when entering mode, hide tribbon , replace tpanel has tspeedbutton components on it. (see below). ignore unevenness, button captions, etc. after go normal mode , come special mode, corrupted. suggestions what's happening? strangely, if move mouse on buttons, appearance of images changes. thank all. found way fix it. it's software general use if low quality video drivers vulnerable problem, needed change things. it not on vm; win7 computer. know of vmware issues because use vmware. redrawing didn't @david heffernan's comment gave me idea got me answer. idea paint panel bitmap & write bitmap file throughout process. procedure writetoolbarbitmapfile(stext:string); var bmp:tbitmap; begin bmp:=tbitmap.create; try bmp.width:=pnlimtoolbar.width; bmp.height:=pnlimtoolbar.height; pnlimtoolbar.paintto(bmp.canvas, 0, 0); bmp.savetofile('c:\tmp\

ruby - How to read checkbox in rails I get to many argument to send emails -

i trying create select list of users on submit form send email. such has welcome these people website. problem can't seem iterate through list of checkbox able send email each single email. here form <%= form_tag(invites_path) %> <% @contacts.each |c|%> <div> <%= label_tag 'accept', c[:email] %> <%= check_box_tag 'accept[]', c[:email], checked = true %> <% end %> <%= submit_tag "send invitations" %> <% end %> now invites_path controller is, c[:email] email of each users desired. here controller , having issues. # if there more 1 checkbox selected if not params[':accept'].nil? params[':accept'].split.each |u| invitesmailer.invite_confirm(current_customer, u).deliver end else # 1 checkbox selected invitesmailer.invite_confirm(current_customer,params[':accept']).deliver end why can't read it if select 1 checkbox or multiple following error wrong

regex - Regular Expression Search Replace all non leading tabs with single space Notepad++ -

regular expressions have never been strong suite, need here. have text file , want replace "embedded" tabs space , 1 space x occurrences of tabs, leave "leading" tabs alone. so line looks this: \t\t\tthis a\t\ttest see\thow things\t work. would come out looking this: \t\t\tthis test see how things work. so tabs left in file @ beginning of lines , there x number of tabs @ beginning of line. can me figure 1 out? i'm doing notepad++ search/replace use visual studio or other tool if work better. find what: (?<!\t)(?!^)\t+ the sequence of tabs \t+ must not preceded tab (?<!\t) , , must not start beginning of line (?!^) . replace with: <space> demo on regex101 (since notepad++ uses pcre, use t instead of tab clarity)

c++ - Perl modules with native libs: Possible to get XSLoader to use RTLD_GLOBAL on dlopen? -

the title gives short version; long of have c++ api wrapped c & exposed perl via xs. has worked fine number of years, have run use-case suspect may caused duplicate load of common library. the symptom have in-house perl wrapper around tibrv. and, we've wrapper around c++ api internally uses tibrv. when perl script uses both of these apis, second hangs on creating tib transport. individually, both work perl. i suspect, have nothing up, somehow has shared state , perl, default loading libraries rtld_local set, may causing issue (this pure hunch). have nothing with, know tib aware of surroundings, think possibility. my question: possible use dlopen flags, such rtld_global perl's xsloader ? i.e. can 1 change dlopen flags when native lib opened without rebuilding perl/xs? everything i've seen online far seems indicate need use dynaloader, require rebuild our lib (because of means in export our c++ symbols) in manner suitable use dynaloader (which not). i

Rails oink with Heroku -

this question has been asked before no answer seems work me. break problem down 3 components: 1) receive heroku r14 memory (memory quota exceeded) (i.e. site has been 2 days on heroku , got error twice period of 10-15 mn [i emotional count time precisely]). 2) installed oink gem advised heroku. 3) oink logs, messages effect in heroku logs , in webrick when work locally. however, unable access logging summary shows functions exceed memory threshold. the line returns result (but wrong one) : oink --threshold=0 logfile_for_oink but returns empty lines follows: ---- memory threshold ---- threshold: 0 mb -- summary -- worst requests: worst actions: aggregated totals: every other attempt - copying advice on stackoverflow - returns errors. i list different attempts have made (so no-one posts suggestion may have tried) after this. heroku run bundle exec oink --threshold=75 log/* this line returns following error: /app/vendor/bundle/ruby/1.9.1/gems/oink-0.10.1/lib

Clojure: documentation -

i working through tutorial: http://moxleystratton.com/clojure/clojure-tutorial-for-the-non-lisp-programmer and came across snippet: user=> (loop [i 0] (when (< 5) (println "i:" i) (recur (inc i)))) i: 0 i: 1 i: 2 i: 3 i: 4 nil works great on interpreter! ❯ lein repl nrepl server started on port 50974 repl-y 0.1.10 clojure 1.5.1 now looking documentation on recur is. it's not in here! http://clojure.github.io/clojure/api-index.html it took me while figure out it's "special form" , described in this page . is there compilation out there has single coherent index? try using built in documentation in repl: user=> (doc recur) ------------------------- recur (recur exprs*) special form evaluates exprs in order, then, in parallel, rebinds bindings of recursion point values of exprs. execution jumps recursion point, loop or fn method. please see http://clojure.org/special_forms#recur it works on functi

python - minimize rows with common values, add columns for additional values -

i have array, of following format: 564387.29 7371625.14 0.00 33030.00 -132.96 -1031.50 564387.29 7371625.14 0.00 1530.00 -133.85 -1039.27 564387.29 7371625.14 0.00 47970.00 -138.35 -1044.40 564387.32 7371625.14 0.00 47970.00 -166.41 -999.27 564387.32 7371625.14 0.00 33030.00 -241.74 -1889.71 564387.32 7371625.14 0.00 1530.00 -135.42 -857.31 564387.35 7371625.14 0.00 33030.00 -174.06 -990.66 564387.35 7371625.14 0.00 1530.00 -178.17 -927.11 564387.35 7371625.14 0.00 47970.00 -116.65 -1810.97 i make array pandas dataframe, , sort them based on columns 1, 2 , 4: 564387.29 7371625.14 0.00 1530.00 -133.85 -1039.27 564387.29 7371625.14 0.00 33030.00 -132.96 -1031.50 564387.29 7371625.14 0.00 47970.00 -138.35 -1044.40 564387.32 7371625.14 0.00 1530.00 -135.42 -857.31 564387.32 7371625.14 0.00 33030.00 -241.74 -1889.71 564387.32 7371625.14

c++ - Possible operations error, random single digit output -

Image
i have written program class asks positive number , based on number, calculations performed. had great stack folks last week asked professor re-write , simplify code. have done , math not coming out right. have run debugger dont see values being passed incorrect. also, numbers failing "if (number > 0)" test. could compile error though successful build message? thanks in advance! here code. #include <iostream> #include <string> #include <fstream> #include <iomanip> #include <stdexcept> #include <cstdlib> using namespace std; int main () { system ("color f0"); int number, countif = 0, countwhile = 0, countdo = -1, h = 0, = 0, x = 0, y = 0; char repeat = 'y'; { cout << "please enter positive integer or 0 quit: "; cin >> number; x = number, y = number; cin.ignore(); if (number < 0) cout << "error: int

php - Multiple Foreach loops for one array -

i have foreach loops array called $feedsmerged. have foreach loop near top of document , it's setting global variables array. i'd recall foreach loop, or run again on array , time build elements variables set above. top of document. foreach ($feedsmerged $posts) { $post_id = $post['post_id']; etc etc } then bottom of page foreach ($feedsmerged $posts) { echo '<div class="' . $post_id . '">stuff</div>'; } is possible do? reason using 2 foreach loops on same array i'd keep organized , i'll have content in between each foreach can't in foreach no problem @ all. can access array many times using supported method in script.

haskell - Deceptively not-as-simple-as-I-thought typing -

in process of writing interpreter in haskell separate, simple programming language - find myself butting head against wall learn typing in haskell. i have 2 custom data types data expr = var var | nume int | nile | conse expr expr | plus expr expr | minus expr expr | times expr expr | div expr expr | equal expr expr | less expr expr | greater expr expr | not expr | isnum expr | , expr expr | or expr expr | head expr | tail expr | call string deriving (show, read) data val = num int | nil | cons val val deriving (eq, show, read) and i'm starting write cases interpreting these options, function interpret_expr interpret_expr :: vars -> expr -> val interpret_expr vars@(vars b c d) (nume integer) = integer but complains couldn't match expected type 'val' actual type 'int' in expression 'integer'. change silly interpret_expr :: vars -> expr -> val inter

actionscript 3 - Scaling AVM1Movie for using with BitmapData in as3 -

Image
i have actionscript 2 swf wanting export png, fact loaded avm1movie in as3 proving quite troublesome. when load as2 swf in normal standalone flash player, can right click -> zoom in , scales since redrawing vector data @ size. when i'm trying make loader object (that contains loaded as2 swf) scale, whenever draw bitmapdata object, original size of swf blank space around it, rather having swf scale new dimensions. my code looks this: var thefile:file = file(event.target); var dis:displayobject = this.mloader.content; dis.width *=2; dis.height *=2; var bd:bitmapdata = new bitmapdata(dis.width, dis.height, true, 0x00000000); trace("display object height , width " + dis.width + " " + dis.height); bd.draw(dis); var stream:filestream = new filestream(); stream.open(thefile, filemode.write); stream.writebytes(pngencoder.encode(bd)); // needs as3corelib stream.close(); alert.show("saved " + thefile.nativepath ); but when open resulting png f

key value - How to get distict count on dynamodb on billion objects? -

what efficent way query dynamodb objects ? such objects have ten properties , want distinct count based on 3 properties . in case need counters it's better use atomiccounters ( http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/workingwithdditems.html ). in case, dynamodb doesn't support out of box keys composed out of 3 attributes, unless concatenate them, option create redundant table key concatenation of 3 attributes , each manage objects, update atomiccounter (add, delete, update - not needed actually). then query counter, avoiding scans. so, it's space complexity gain speed of retrieving data.

bash - How to config gerrit refs in Zsh? -

in team, use gerrit code review. as know, gerrit uses magical 'refs/for/*'. since not want type git push origin head:refs/for/* every time push remote, i tried change git repository's config below. git config remote.origin.push refs/heads/*:refs/for/* changing config works in bash, but fails in zsh error below. zsh: no matches found: refs/heads/*:refs/for/* i think using asterisk in zsh different bash, but cannot know problem is. how can solve problem? or impossible in zsh? thanks in advance. by default when bash fails glob puts whole pattern arguments unchanged. when zsh fails glob not run command @ find more convenient in cases. both shells can configured, zsh has @ least 3 other modes: bash, remove pattern arguments , remove pattern arguments unless there no patterns match. these behaviors achieved unsetting nomatch or setting csh_null_glob or null_glob respectively. i suggest keeping current behavior , using various esca

java - Wicket: Update Model on DropDownChoice Item Selection Event -

i need update model or object after select dropdownchoice item. bellow code i'm working: add(new listview[company]("listcompanies", listdata) { override protected def onbeforerender() { // // ... super.onbeforerender() } def populateitem(item: listitem[company]) = { var company = item.getmodelobject() //... val listclients: java.util.list[client] = clientcontroler.listclients item.add(new dropdownchoice("clientselection", listclients,new choicerenderer[client]("name"))) in listview properties of company object, after choose name property of dropdownchoice, model company updated client name selected. how can achieve this? thanks i think can override onselectionchanged. need override wantonselectionchangednotifications return true make work. this. dropdownchoice<client> dropdownchoice = new dropdownchoice("clientselection", listclients) { @ove

linux - General solution for bypassing file headers in shell commands -

Image
i make extensive use of piping multiple linux shell commands, example: grep blah file1 | sed 's/old/new/' | sort -k 1,1 > file3 my files have header line, , have preserve throughout pipeline. so, example, want grep, sed , sort line 2 , on, while keeping 1st line unchanged. i looking general solution given command(s) preserve header. write header file before pipe , cat after pipe ends. have started using zshell, wondering if might more streamlined solution. perhaps this: (arrows pipes in image) but not sure how work in zshell or if possible. 1 problem need follow first pipe split command on both pipes. any creative solutions? vaughn , devnull have directed towards solution. both contain typos though , have remarks add , advise use instead: { head -n 1 file1; tail -n +2 file1 | grep blah | sed 's/old/new/' | sort -k 1,1; } >file3 what take first line of file1 in 1 command (your header) , grep/sed/whatever magic in second command on

python 2.7 - django filtering date condition -

i posting 1st job(jobname=job1) on march10, should live (livedate=march15) , expire on march20. i posting 2nd job(jobname=job2) on april15, should live (livedate=april20) , expire on april25 i posting 3rd job(jobname=job3) on may20, should live (livedate=may25) , expire on may30. while filtering "jobname" , "livedate", have display jobs should have "livedate" greater or equal "today's date". how should write view? help me , in advance. //order livedate jobs = job.objects.filter(livedate__gte=datetime.date.today()).order_by('livedate') //or order livedate filter job jobs = job.objects.filter( jobname=job1, livedate__gte=datetime.date.today() ).order_by('livedate')

app store - Will fork() in iOS app likely be rejected by Apple's vetting process? -

i'm writing mechanism (in ios app) detect whether device jailbroken checking app sandbox's integrity doing fork(); . know if attempting call violate app store guidelines? you can't create new process in ios application on non jailbroken device (you error such "operation not permitted"), can create new thread using pthread library. edit : if you're trying detect whether device jailbroken, don't think violate store guidelines 'try' fork, it's more legal question technical question. i found nothing in app store guidelines forbid use of calling low-level api. logical, since jailbreak doesn't exist, forbid you're not able ? the closest things found : apps read or write data outside designated container area rejected apps download code in way or form rejected apps install or launch other executable code rejected

Jquery assign value to JSP variable -

i new jquery , using jquery populate values in drop down field. upon selection of value drop down, assigning value hidden field. onselect: function(index,row){ var val = row.value; alert('val '+val ); $("#hid").val(val ); } how can assign value jsp variable or if use request.getparameter("hid"); need submit form again value? edit 1 $(function(){ $('#comb').combogrid({ panelwidth:200, url: 'myservice', idfield:'id', textfield:'desc' columns: [[ {field:'id',title:'id',width:20}, {field:'desc',title:'desc',width:80} ]], onselect: function(index,row){ var val = row.value; alert('val '+val ); $("#hid").val(val ); } }); }); jsp java code runs on server side. javascript runs on browser. so cann

java - cannot append a message to a folder in javax.mail -

i managing save simple messages containing body, subject etc. however, unable save multipart messages. logged before , after appendmessages , noticed second log absent. interestingly, have no exceptions being fired @ all. have absolutely no idea going wrong here. here java code: store store = null; folder folder = null; string foldername = "sentbox"; try { session session = preparesession(mailprotocols.imap, kid); store = session.getstore("imap"); store.connect(myhost, user.getlogin(), user.getpassword()); folder = store.getfolder(foldername); if (folder == null || !folder.exists()) { folder.create(folder.holds_messages); } folder.open(folder.read_write); mimemessage mimemessage = new mimemessage(session); address[] = null; if(msg.getto() != null) { // msg instance of custom message class, nothing special there int msgsize = msg.getto().si

jprofiler - Calculate total memory usage of any object in Java -

this question has answer here: in java, best way determine size of object? 22 answers i'm using jprofiler. have objects of class x. class has many properties of type string, integer , other class types. want know how memory being consumed single object of class x. when use jprofile find memory usage, size of object of type x. i'm assuming, jprofiler not showing memory used member variables. example, string property of class x contributing total memory used string. i want figure out total memory usage of class x including memory used property objects. information on how achieve using jprofile or other tool/code? thanks in advance! this tool shows total memory used object http://www.eclipse.org/mat/ it not show memory uses itself, how memory remains active due references has.

c# - List<string> Out Of Memory Exception -

i want fill list below : list<string> list_lines = new list<string>(); (double num = double.parse(txtstart.text); num < 99999999; num++) { list_lines.add(num.tostring()); } but codes cause error @ 33,554,432 , error : out of memory exception want work list, replacement of or how can fix error? thanks in advance if can replace list ienumerable can use following approach static ienumerable<string> gen() { (double num = 0; num < 99999999; num++) { yield return num.tostring(); } } so not allocate memory, further processing have keep in mind cannot call gen().toarray() produce same issue. if need list there no way work.

windows 8 - Store data in cloud -

i new @ windows 8 app development. want create app stores data in skydrive this <person> <name>xyz</name> <geb>01.01.1992</geb> … </person> how can this? find version send value array index. how can save data xml or whole files xml or pictures in cloud? you can use azure mobile service store data in cloud tables. paid service , can use commercial purpose. here's posts might helpful you. announcing windows azure mobile services windows azure mobile services - channel 9 series windows azure mobile services - msdn documentation windows azure mobile services - msdn samples windows azure mobile services - official site

Delphi XE2, vcl styles recreating window handle -

after applying new style @ runtime mainform of application creates new window handle – there way stop or reassign handle getting tonne of following error: 'system error. code: 1400. invalid window handle' is there way manipulate process forces new handle assigned? i solved doing following: my main form created unseen 'helper' form never displayed, have visual components - throwing handle error when trying redraw these visual components, replaced relevant components objects instead (note did not write code originally). there no way avoid re-creating window handles. instead, override window's createwnd , destroywnd methods you're notified when window re-created. also, avoid keeping persistent references handles of windows might destroyed. instead, read handle property each time need it. won't have watch notifications. beware of reading handle different thread, though, since may cause window become associated wrong thread. wrap code

How to filter two DataTables in C#? -

how filter 2 tables in c#? table 1 contains full data , table 2 contains content of table one? what want (it's not clear question)? take table1, filter , pass result table2? then: dataview dv = table1.asdataview(); dv.rowfilter = fexpression; // example "myid = 3" datatable table2 = dv.totable(); // if want typed datatable, can (although there other ways): mytypeddatatable table2 = new mytypeddatatable(); datatable temptable = dv.totable(); table2.merge(temptable);

php - Get nr of items in an array -

i have array has format: array( info( date-today => '09/04/2013' ) clients( id => 1001, name => fred ) more_info( weather-today => "cloudy" ) ) but sometimes, receive data more clients: array( info( date-today => '08/04/2013' ) clients( 0( id => 1001, name => fred ), 1( id => 1045, name => fritz ) ) more_info( weather-today => "sunny" ) ) i want count how many cients got returned, because need access client-data differently if there 1 or more one. tried several "count()" options, such as: count(array['client']) but of course if there 1 client, doesn't return 1, returns 2 (since there 2 items of client-data in array). any tips? you have find out whether $array['clients'] has numeric indices: $size = count($array['clients']; if (count(array_filter(array_keys($array['

perl - Sum of multiple colums -

i have o/p file below , i'm looking bash , perl solution: aggregate total used avail capacity aggr0 100 59 41 41% aggr1 200 100 100 50% aggr2 300 150 150 50% aggr3 400 200 200 50% i calculate sum of individual column except col-1. final state should this: aggregate total used avail capacity aggr0 100 59 41 41% aggr1 200 100 100 50% aggr2 300 150 150 50% aggr3 400 200 200 50% ========================================================= 1000 509 460 50.9% (used % of aggr's) infile file data in perl -ape 'next if $.==1; $i (1..4) { $s[$i] += $f[$i]; } end { $s[4]=sprintf("%.2f%%",$s[2]/$s[1]*100); $"="\t";pri

asp.net - Not able to update the comment module on the mvc view using ajax call without refreshing the page -

this check & mate situation me... using mvc 3. trying make post , comment module on single view. below code view , controller. able post , comments on load once add new comment through ajax call saved correct table in db not understanding how update on view without refreshing page... //model public class postviewmodel { public bool? isactive { get; set; } public string postdescription { get; set; } ... public list<postcommentmodel> objpostcommentinfo { get; set; } } //post controller dbentities1 db = new dbentities1(); public actionresult index(int id) { int id = convert.toint32(id); postviewmodel objpostviewmodel = new postviewmodel(); list<postviewmodel> lstobjpostviewmodel = new list<postviewmodel>(); postcommentmodel objpostcommentmodel; list<postcommentmodel> lstobjpostcommentmodel = new list<postcommentmodel>(); var objpost = (from x in db.postinfoes

visual c++ - Get the value from inline assembly code -

i have inline assembly code this __asm { mov dword ptr [esp+4], 12345678h } i want value of @ [esp+4] in separate variable before 12345678h written there, can use further in c++ code. according this manual found in less 5 minutes, variable identifiers valid within __asm blocks. found relevant example clicking " accessing c or c++ data in __asm blocks " link under " what want know more about? " section of manual: a great convenience of inline assembly ability refer c or c++ variables name. __asm block can refer symbols, including variable names, in scope block appears. instance, if c variable var in scope, instruction __asm mov eax, var stores value of var in eax.

javascript - Google map api get direction API instead of returning route , it returns nearby place like bus stop etc -

we need track user's path. using google's map api --> input parameters start location & end location route . http://maps.google.com/maps/api/js?sensor=false but in document of google api https://developers.google.com/maps/documentation/javascript/directions#directionsresults as in document ---"end_location contains latlng of destination of leg. because directionsservice calculates directions between locations using nearest transportation option (usually road) @ start , end points, end_location may different provided destination of leg if, example, road not near destination." in api instead of returning route , returns nearby place bus stop etc.

mocking - How to mock local variables in java? -

this question has answer here: mocking methods of local scope objects mockito 5 answers in situation? class { public void f() { b b = new b(); c c = new c(); // use b , c, , how modify behaviour? } } how can fullfill idea powermock , easymock ? i don't want change compact code test reasons. you can this, see answer matt lachman. approach isn't recommended however. it's bit hacky. the best approach delegate creation of dependant objects factory pattern , inject factories a class: class bfactory { public b newinstance() { return new b(); } } class cfactory { public c newinstance() { return new c(); } } class { private final bfactory bfactory; private final cfactory cfactory; public a(final bfactory bfactory, final cfactory cfactory) { this.bfactory = bfactory;