Posts

Showing posts from September, 2010

jQuery: How to trigger "e" in function(e) { ... }? -

i have 1 master text field, , want when user types text field text fields class variant_price updated same text. i have done: $("#master_price").keypress(function (e) { $(".variant_price").val($(this).val()); }); however, on first keypress, seems fire off $(".variant_price").val($(this).val()); part before e happens, when type 123 variant_price text fields updated 23 without first keypress ( 1 ). how trigger e before line? there e.fire() ? according use case you've described, looking change event rather keypress (a field can modified pasting via mouse button, example). also, don't need event object ( e ) @ all. $("#master_price").change(function() { $(".variant_price").val($("#master_price").val()); }); if want instant reaction change, may bind same handler multiple events without storing function temporary, follows: $("#master_price").on("change keyup...

rmi - Run a simple Java program in the OpenShift cloud -

what easiest method run java program inside gear on openshift? i don't need complex framework or web server. need container can upload java files, compile , execute them in cloud. application have in mind simple, program gathers information , can connect via rmi , ask data. thanks. if don't need application server you'd better take @ diy cartridge. you'd have create code: rhc app-create yourapp diy-0.1 --from-code git://github.com/(...).git you use git hooks launch it. take @ hooks use @ wedding tables planner web , based in this template .

Is C# type system sound and decidable? -

i know java's type system unsound (it fails type check constructs semantically legal) , undecidable (it fails type check construct). for instance, if copy/paste following snippet in class , compile it, compiler crash stackoverflowexception (how apt). undecidability. static class listx<t> {} static class c<p> extends listx<listx<? super c<c<p>>>> {} listx<? super c<byte>> crash = new c<byte>(); java uses wildcards type bounds, form of use-site variance. c# on other hand, uses declaration site variance annotation (with in , out keywords). known declaration-site variance weaker use-site variance (use-site variance can express declaration-site variance can, , more -- on down side, it's more verbose). so question is: c# type system sound , decidable? if not, why? is c# type system sound , decidable? it depends on restrictions put on type system. of c# type system's designers have paper on subject...

xcode add a button to my storyboard navigation item? -

Image
this question has answer here: can't assign multiple buttons uinavigationitem when using storyboard ios 5 6 answers i have in storyboard: i add new button next 'community button' but when try add new button bar item, replaces button there. how this? and when try add 'button' not let me add bar button item - item: i don't know how using storyboard can done in code follows. in viewdidload method of completionvc following: create uibarbuttonitem community create uibarbuttonitem add add buttons navigationitem using: self.navigationitem.rightbarbuttonitems = [nsarray arraywithitems:community, add, nil];

How to prevent the Grails Asset-Pipeline to process .svn files? -

grails 2.4 using asset pipeline managing , processing static assets in grails applications instead of resources system. pretty new , there isn't doc on internet yet. how configure asset plugin doesn't uglify , bundle .svn (subversion) metadata files? i @ configuration section of documentation explains how setup excludes. suspect following inside config.groovy grails.assets.excludes = ['**/.svn/**']

class - complile time error on arraylist.add in android -

i have 1 arraylist; in can't able add items below code dnt know error made please solve problem private arraylist<question> question = new arraylist<question>(); question class getter , setter public class question { private string id; private string question; private string option1; private string option2; private string option3; private string option4; public question(string id, string question, string option1, string option2, string option3, string option4) { super(); this.id = id; this.question = question; this.option1 = option1; this.option2 = option2; this.option3 = option3; this.option4 = option4; } public string getid() { return id; } public void setid(string id) { this.id = id; } public string getquestion() { return question; } public void setquestion(string question) { this.question = question; } public string getoption1() { return option1; } public void setoption1(string option1) { ...

java - StringBuffer is not been printed correctly -

i trying read data inputstream, , put them stringbuffer print it. i put code in main method. my problem stringbuffer printed when debugging code, when run isnt been printed. my code: socket s = new socket(); string host = ""; printwriter s_out = null; bufferedreader s_in = null; inputstream in = null; s.connect(new inetsocketaddress(host, 23)); //writer socket s_out = new printwriter(s.getoutputstream(), true); //reader socket s_in = new bufferedreader(new inputstreamreader(s.getinputstream())); in = s.getinputstream(); if(s.isconnected() == true && s.isinputshutdown() == false && s.isoutputshutdown() == false){ stringbuffer sb = new stringbuffer(); boolean found = false; char ch; int numberofbytesthatcanberead = in.available(); for(int j = 0; j < numberofbytesthatcanberead; j++){ ch = (char) s_in.read(); //system.out.print(ch); sb.append(ch); } system.out.print(sb.tostring()); s_in.c...

java - How to specify a timezone for a joda DateTime object? -

i have function converts string joda time object , formats it. public static string getformatteddatetime(string somedate) { datetime newdate = datetime.parse(somedate, datetimeformat.forpattern("yy-mm-dd hh:mm:ss.sss")).minushours(7); string formatteddate = newdate.tostring("dd-mmm-yy hh:mm a"); return formatteddate; } the function takes string , returns formatted datetime fine, i'm having troubles assigning timezone it. string i'm passing in represents utc time database need convert pst/pdt. can't figure out way 1) assign new datetime object timezone , 2) convert object's timezone pst/pdt. right handling .minushours. not ideal. under no circumstances should use .minushours(7) wrong half year, , datetime object still think it's in utc. use .withzone(datetimezone.forid("america/los_angeles")); here list of time zones supported joda time corresponding ids i recommend refactoring constant generated for...

In Mongoose, what value do I pass in for object property to get the default value from the schema? -

in mongoosejs, i'm trying create new instance of model based on post data. in cases want field have default value defined on schema, when pass in null or undefined value of property, i'm not getting default in resulting mongo object (i default when don't pass in property @ all). var objschema = mongoose.schema({ foo: { type: number, default: 10 }, bar: { type: number, default: 10 }, baz: { type: number, default: 10 } }); var obj = db.model('obj', objschema) // note `baz` not passed in below var obj = new obj({ foo: null, bar: undefined }); obj.save(function(err, savedobj){ console.log(savedobj) // { foo: null, baz: 10 } }); i'd prefer not have write separate object instantiation code each potential permutation of properties might not have values, there can set foo , bar result in default value? seems should common case me, maybe i'm missing something? i think, should add setter schema b...

excel - Compare multiple columns and update data if matched -

using excel 2013 , need figure out how compare , update values. if able help, appreciate it! in column a, have new list of 6000+ user names. in column b, have new phone number associated each user account. in column d, have old list of 6000+ user names. in column e, have old phone number associated each user account. i need in figuring out how compare data in column , column d. if match, need have value in column e updated match value in column b. any appreciated try =iferror(if(match(d1,$a:$a, 0), index($a:$b, match(d1,$a:$a, 0), 2), e1), "") and put in f1, drag down. see if works you. once it's done, copy , paste special values e.

java - JMeter Getting Parameters From ResponseParameters To Generate New Request -

i want use jmeter test website uses servlet+struts+webspherecommerce technology. able generate request according previous response. i use view results tree after html request in order inspect response of previous call not see parameters (responseproperties) set in response. instead see piece of .js code, html code or images. how gather response properties? finally able use such properties create following request. jmeter provides beanshell scripting extension mechanism can add beanshell post processor child http request , refer response properties follows: string responsecode = prev.getresponsecode(); string responseheaders = prev.getresponseheaders(); string responsemessage = prev.getresponsemessage(); string responsedata = prev.getresponsedataasstring(); where prev shor-hand previous sampleresult if want use part of response in next request (this called "correlation") jmeter provides other post processors can extract data response , store jmeter ...

How can I export a wildcard SSL certificate from IIS to Heroku? -

guys! i have valid , running wildcard ssl certificate godaddy on iis server, , need install certificate on heroku (for subdomain). i'm still not sure if should export certificate iis (and how import on heroku) or regenerate csr , re-emit certificate. if go second option, iis certificate keep working? thanks in advance! felipe open certificate manager mmc snapin , load local computer's certificate store. once insde, find certificate , export along private key. take outputted file , import heroku. no need regenerate.

ios - Capture Screen on Camera -

helo everyone. want capture screenshot when camera appeared. scenario i'm adding overlay view camera. , when user adjusts camera , tapp capture button. want generate image on screen. i've tried screen shot using this code overlay capture not image. camera blank. i've seen this answer but captures image not overlay view you can take image received uiimagepickercontroller (the 1 received in didfinishpickingmediawithinfo method delegate) , merge overlay view : dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ uiimage *cameraimage = image captured camera; uiimage *overlayimage = overlay; uiimage *computedimage = nil; uigraphicsbeginimagecontextwithoptions(cameraimage.size, no, 0.0f); [cameraimage drawinrect:cgrectmake(0, 0, cameraimage.size.width, cameraimage.size.height)]; [overlayimage drawinrect:cgrectmake(0, 0, overlayimage.size.width, overlayimage.size.height)]; computedimage = uigraphicsg...

javascript - Private embedded shopify app -

i'm trying build embedded private app , i'm missing. instructed here , created app, got api key. simple page content: <head> <script src="https://cdn.shopify.com/s/assets/external/app.js"></script> <script type="text/javascript"> shopifyapp.init({ apikey: 'my-private-api-key', shoporigin: 'https://my-dev-shop.myshopify.com', debug: true }); </script> </head> <body> private app </body> and i'll visiting page redirect shop screen. the page you're looking can't found. try search instead. redirect url is https://my-dev-shop.myshopify.com/admin/apps/my-private-api-key/ what missing? it's first experience shopify @ all, maybe missing understanding how easdk works. tested localhost , domain ssl. thank tips. i pay more attention embedded apps , tell more experience , problems met before managed create , install private app. emb...

android - restore database file from dropbox to local memory -

i have implemented database backup on dropbox, restore db dropbox internal memory (data\data\\database), think forbidden write directly, possible read stream file on dropbox, , open local file, clear data inside , , flush stream file? if yes, have code example? i hope clear. code... private boolean downloaddropboxfile(string dbpath, file localfile) throws ioexception{ bufferedinputstream br = null; bufferedoutputstream bw = null; try { if (!localfile.exists()) { localfile.createnewfile(); //otherwise dropbox client fail silently } byte[] buffer = new byte[4096]; dropboxinputstream fd = mapi.getfilestream (dbpath, null); br = new bufferedinputstream(fd, buffer.length); bw = new bufferedoutputstream(new fileoutputstream(localfile)); int read; while (true) { read = br.read(buffer); if (read <= 0) { break; } bw.write(buffe...

c# - Regular expression MatchCollection returns 1 instead of expected 3 -

i have long string in c# it's formatted such \\server\value i've been using regular expression pattern of "(?<='\\\\).*(?=\\)" extract server string. there's use case multiple '\server\value' strings chained '\\servera\value1' + '\\serverb\value2' + '\\serverc\value3' i'm trying use matchcollection extract server name using pattern (?<=.\\\\).*(>=\\) the period in first grouping construct account ' character. expect result return 3 occurences returns 1. what's wrong pattern? string expression = "'\\\\servera\\value1' + '\\\\serverb\\value2' + '\\\\serverc\\value3'"; string pattern = @"(?<=\\\\).*(?=\\)"; matchcollection matches; matches = regex.matches(expression, pattern); if got, i're getting result servera\value1' + '\\serverb\value2' + '\\serverc and want these matches: servera serverb serverc ...

sass - LiveReload LoadError lib/compass/bin/compass -

haven't had trouble livereload until last week, when must've done messed path. whenever save sass file, following error: /usr/bin/ruby: no such file or directory -- /applications/livereload.app/contents/resources/sass.lrplugin/lib/compass/bin/compass (loaderror) indeed, lib directory doesn't exist. correct location compass in /applications/livereload.app/contents/resources/sass.lrplugin/gem/bin/compass how can redirect livereload there? or better question, might have done mess up? gem list shows up-to-date sass , compass, , don't think it's $path problem. i've been using grunt in meantime, livereload gui less of hassle. suggestions start bug helpful, i'm @ loss. i've had same problem. upgraded latest beta (v2.3.64) , seems work. http://feedback.livereload.com/knowledgebase/articles/67441-how-do-i-start-using-livereload-

How do I write a batch file that moves files to directories where part of the filename matches the folder destination? -

i have lots of files need go in specific folders. filenames have pattern them , folders need hold them. how can write batch file following rule? c:\s1_d1111_c1_p1.mpz needs move folder c:\snc1111 c:\s1_d2222_c1_p1.mpz needs move folder c:\snc2222 the filenames have 4 digits correspond folder. number after s , c 1, , p can have whole number after it. this windows server 2008 r2 standard thanks help! using powershell sample move files startin in jdk child folder jdk $files = get-childitem -file ($i=0; $i -lt $files.count; $i++) { $outfile = $files[$i].name if ($outfile.startswith("jdk")){ mkdir -path "jdk" -force move $files[$i].fullname "jdk" } } modify match condition , paste code in powershell window

mysql - BigQuery Table too large for JOIN & Resources exceeded during query execution -

Image
i've tried 2 different ways query, receive table large join first 1 , resources exceeded during query execution in second one... these queries: select count(distinct(s_pageview_id)) total impressions.tbl_impressions_201405 i_browser in (1) , fk_i_id_tbl_vertical in (1) , i_section in (1) , s_ads_list != '' , b_is_human = true , date(dt_date) = '2014-05-28' , s_pageview_id not in ( select s_pageview_id impressions.tbl_impressions_201405 i_section in (26,27,83,96) , i_browser in (1) , fk_i_id_tbl_vertical in (1) , date(dt_date) = '2014-05-28' , s_ads_list != '' , b_is_human = true ) 2nd query: select count(*) total impressions.tbl_impressions_201405 impressions_1 left outer join each impressions.tbl_impressions_201405 impressions_2 on impressions_1.s_pageview_id = impressions_2.s_pageview_id impressions_2.i_browser in (1) , impressions_2.fk_i_id_tbl_vertical in (1) , impressions_2.i_section in (1) , impressions_2.b_is_human ...

stack - Why do we have to reverse the string when converting from infix to prefix -

in first step of converting infix prefix can explain in simple terms why should reverse string? there alternative method convert? yes, absolutely right if have convert infix prefix have scan string right left. why not left right? if scan left right require future knowledge of operators in string. example 1 : infix : 2+3 prefix : +23 now, when convert left right should have knowledge of + yet appear in string. looks simple in particular example, consider example given below. example 2: infix : 2+3*4/5-6*7 prefix : -+2/*345*67 now, if scan left right when scan 0th index of string program should have knowledge of - going appear in 7th index of string hectic job. so safest way scan string right left.

c# - Preferred way to mock/stub a system resource like System.Threading.Mutex -

i have c# class uses mutex control access global shared resource. mutex not assigned unless shared resource created. i'm using partial mock of class isolate testing of methods grab mutex, work, , release (without ever creating shared resource or mutex instance). i'm curious know if there preferred way of mocking mutex. abstract real calls waitone , releasemutex methods on class , mock those. explicitly assign new mutex instance class' mutex member variable in test (assuming compromise , make setter accessible unit test). wrap mutex in class implements parallel interface mutex methods , inject class under test. are there better ways of mocking system resources system.threading.mutex? far i've opted abstract real calls methods on class , mock them. look microsoft fakes framework . has called shims work little differently stubs or mocks divert calls delegate. the framework create class called shimmutex. in test class write delegates redirect mutex...

grails - Testing a command object in a service class method that has the command object as part of the method signature -

i have grails service class i'm trying write spock test for. signature of method follows: def builderrorjsonarray(addressinfocommand addressinfocmd, paymentinfocommand paymentinfocmd, boolean trsrequest = false) when populate addressinfocommand , paymentinfocommand command object invalid data in test , call validate on it, it's not returning errors , i'm not sure why. guess it's way i'm mocking command objects in test (via mockforconstraintstests). here part of test populates paymentinfocommand: setup: service.messagesource = [getmessage: { errors, locale -> return "message" }] mockforconstraintstests(addressinfocommand) mockforconstraintstests(paymentinfocommand) paymentinfocommand paymentinfocommand = new paymentinfocommand() def payment = new payment() payment.paymenttype = "" payment.cardaccountnumber = "" payment.cardexpirationdate = "" payment.cardsecuritycode = "...

html - Why style a lists -

what point in styling ul? have following html structure <div id='container'> <div id='ui' class='quad'> <div class='quadnav'> <span class='quadtitle'>urgent , important</span> <i class="fa fa-plus fa-2x addbutton"></i> </div> <ul class='tasklist'> <li>test</li> <li>test2</li> </ul> </div> and following css styling list .tasklist{ } .tasklist li{ list-style-type:none; position:relative; top:2em; left:1.2em; } with .tasklist section empty li elements style want them to. if remove .tasklist section, li's no longer style. gives? supposed go styling of ul element vs li element, don't understand. edit may not have worded question, have following css <style> /* -------- general styling ---------*/ *{ margin:0; padding:0; } html,...

sql - Mysql, update query -

i have table this: table1 first_id second_id value 1 0 10 2 0 60 <- can bad value, need update 2 12 30 2 14 30 3 0 50 4 0 100 <- can bad value, need update 4 20 50 4 41 30 4 33 20 i need update rows have second_id = 0 , in table exists rows same first_id second_id != 0. need update rows sum of rows have same first_id , second_id != 0. for example: first_id = 3 , second_id = 0 => not update, 0 rows first_id = 3 , second_id != 0 first_id = 4 , second_id = 0 => update, sum(50,30,20) = rows same first_id , second_id != 0 how can in 1 update statement? i tried sth without effect (problem recursive query?). update table1 t1 set t1.value = ( select sum(t2.value) table1 t2 t2.second_id != 0 , t2.first_id = t1.first_id ) t1.second_id = 0 , ( sele...

javascript - How do I save the stage upon every KineticJS event? -

i understand kineticjs stage can saved json stage.tojson function. perform action time stage changes in way. example, want run tojson function if shape moved via draggable, shape's size changed, inner contents changed dynamically, shape added dynamically, etc. etc. etc. prefer not listen of possible events , run same code each. prefer capture events in 1 call. there me this? realize there performance hit. saving stage upon change being made business requirement. fortunately, functionality limited few users. thank you. how save stage upon every kineticjs event? answer: call stage.tojson when kineticjs event occurs. is there kineticjs event handler listens any-and-all events? answer: actually, there 1 draconian option. you ask listen every event kineticjs can generate because .on() method can accept multiple space-delimited event types. you left task of deciding whether stage.tojson based on eventtype plus design considerations. nodes can listen ...

javascript obtain value of select option without submitting form -

i'm trying value of input select option without submitting form (need keep available while displaying live results). need use value global variable inserted in array later on. because can't use submit, need find way update value if user changes option (ie using onchange). here's have (doesn't work): html <select id="color" > <option value="">select:</option> <option value="blue">blue</option> <option value="red">red</option> <option value="yellow">yellow</option> </select> javascript document.getelementbyid('color').onchange = function() { var colorinput = this.value; console.log(colorinput); }; updated okay, no using inline javascript, it. updated script above reflect of answers i'm getting - not addressing central problem. tracking input option value within script no problem; need value global variab...

c# - Drop down list - input string was not in correct format -

i have below metod: private void bindmodels(int makeid, int typeid) { try { dataset ds = (dataset)viewstate["ds_ddlsdata"]; enumerablerowcollection models; if (typeid != null) { models = dt_models in ds.tables[10].asenumerable() dt_models.field<int>("makeid") == makeid & dt_models.field<int>("typeid") == typeid select new { modelname = dt_models.field<string>("modelname"), modelid = dt_models.field<int>("modelid") }; } else { models = dt_models in ds.tables[10].asenumerable() dt_models.field<int>("makeid") == makeid select new { modelname = dt_models.field<...

matlab - Multiplication of two arrays with dimension=5 in a vectorize way -

i have 3 dimensional domain in matlab. each point in domain have defined 3 arrays of size (nx,ny,nz) @ each point of domain: a1; % size(a1) = [nx ny nz] a2; % size(a2) = [nx ny nz] a3; % size(a3) = [nx ny nz] for each element, trying construct array holds value of a1 , a2 , , a3 . following candidate having 1×3 vector @ each point? b = [a1(:) a2(:) a3(:)]; b = reshape(b, [size(a1) 1 3]); if 1×3 array named c , trying find c'*c @ each point. c = [a1(i,j,k) a2(i,j,k) a3(i,j,k)]; % size(c) = [1 3] d = c'*c; % size(d) = [3 3] my ultimate goal find array d size 3×3 points in domain in vectorize fashion? in fact, output consists of array d each point have size [nx ny nz 3 3] . me? basically concatenate a1 , a2 , a3 along 4th , 5th dimensions separately leaves singleton dimensions in 5th , 4th dimensions respectively, used bsxfun [ apply element-by-element binary operation 2 arrays singleton expansion enable ] expand 3x3 matrices along 4th-5th dimens...

Trying to insert a value containing a ';' in MySQL, how do I do that? -

i tryin insert mysql following code: <img src='http://romaniaz.net/forumz/styles/se_gamer_dark/imageset/logo.png' alt='' style='width: 100px; height: 100px; float: left; margin: 20px'> but wouldn't allow me since i'm using ; symbol. how can insert such values in mysql ? read delimiter it's confusing thing ever came across. edit: mysql_query("insert blog_posts (posttitle, postbody, postauthor, postdate, posttags, views) values ( '" . $title . "', '" . $blogpost . "', '" . $author . "', '" . $date . "', '" . $tags . "', '" . $views . "')"); and yes, i'm aware have switch mysql_* . so problem $blogpost contains images html style tag , automatically contains 1 or more semicolons... its not semi-colon causing issue, single-quotes in html. either escape th...

ios - UIManagedDocument file being automatically deleted with saveToURL:forSaveOperation:completionHandler: -

i'm using core data uimanageddocument inventory-keeping app. problem i'm having "savetourl:..." method deleting uimanageddocument file in documents directory when save using uidocumentsaveforoverwriting after adding item core data. happens @ first launch new build. created core data/uimanageddocument helper singleton use throughout app. here's how initialize uimanageddocument instance: @interface vdfcoredatahelper : nsobject @property (strong, nonatomic) nsmanagedobjectcontext *managedobjectcontext; @property (strong, nonatomic) uimanageddocument *manageddocument; @implementation vdfcoredatahelper - (void)createmanageddocument { nsurl *docsurl = [self getdocsurl]; if (![[nsfilemanager defaultmanager] fileexistsatpath:[docsurl path]]) { nslog(@"new doc made"); _manageddocument = [[uimanageddocument alloc] initwithfileurl:docsurl]; [self savemanageddocumentforcreation]; [self openmanageddocument]; } e...

php - why pagination repeats some data again in the next page? -

Image
i'm use pagination paginate data in page, data photos name (ex: 11abf76631b0c9daf2284825c3b6ade7.jpg) . problem showing photos in next pages. total data in database 30 elements, , here displays 40 elements. page 1 page2 controller: photos_album $this->load-> library('pagination'); $config['base_url'] = base_url()."admin/photos_album/display"; $config['total_rows'] = $this->photos_album_model->count_all(); $config['per_page'] = 20; $config['num_links'] = 5; $config['uri_segment'] = 4; $config['use_page_numbers'] = true; $config['full_tag_open'] = "<div id='pagination' class='clear'>"; $config['full_tag_close'] = "</div>"; $config['prev_link'] = "<span class='pe-7s-angle-right fontsize_20'></span>"; $config['prev_tag_open'] = "<div id='prev' class='float_right...

javascript - Filtering a List via a Sidebar -

there 2 lists of items. 1 blog posts, , 1 authors. var app = angular.module("blog", []); app.controller('postctrl', function($scope) { $scope.posts = <%= @posts.to_json.html_safe %>; $scope.authors = <%= @authors.to_json.html_safe %>; }); the information provided through database via rails. if don't know rails, assume have been given big chunk of json work with. now, list blog posts: <div id="blog-posts" ng-controller="postctrl"> <article class="post" ng-repeat="post in posts"> <h1> {{ post.title }} </h1> <small> {{ post.author }} on {{ post.created_at }} </small> <p> {{ post.body }} </p> </article> </div> and decide make aside within #blog-posts div (so within postsctrl) list authors: <aside> <h2> authors </h2> <ul> <li ng-repeat="author in authors"> {{ author.na...

Installing Ruby using rbenv on Ubuntu 14.04 virtualbox hangs -

i'm trying ruby on rails running on ubuntu 14.04. ubuntu installed on virtualbox. i'm following https://gorails.com/setup/ubuntu/14.04 when run command rbenv install 2.1.2 ruby keeps installing forever. waited more 1 hour. this how command-line looks: rbenv install 2.1.2downloading ruby-2.1.2.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/f22a6447811a81f3c808d1c2a5ce3b5f5f0955c68c9a749182feb425589e6635 installing ruby-2.1.2... any suggestion? i thought installation frozen in same point, takes long time complete (1 hour , still running). see installation progress add verbose modifier command: ~$rbenv install --verbose 2.1.2 note: followed deploy ruby on rails instructions ubuntu 14.04.

attask - Post an update to a project or task -

i want post update project or task. this, think right object type note, haven't been able successfully. i'm making request to: https://companyname.attask-ondemand.com/attask/api/note?notetext=testing&objid=projectid&method=post&sessionid&noteobjcode=proj but receive following error: {"error":{"class":"com.attask.common.invalidparameterexception","message":"invalid parameter: objcode value \"proj\"","title":null,"msgkey":"exception.attask","attributes":[""],"code":0}} am on right track or there else need do? thanks. joe try json encoding post data , see if gets different result. such as: https://companyname.attask-ondemand.com/attask/api/v4.0/note?updates= {notetext=testing&objid=projectid&noteobjcode=proj}&method=post&sessionid=xxxx fyi: v4.0 in url specifying attask's api version if not have i...

c - Original node changes when inserting nodes into binary tree -

i'm trying make binary tree using recursive insert function root node seems keep changing(if didn't, printf should give same output in code below). thoughts on how fix this? typedef struct tnode{ char name[30]; int value; struct tnode *left; struct tnode *right; } tnode; tnode *insert(tnode *node, char *name, int value){ if(node==null){ tnode *temp = malloc(sizeof(struct tnode)); sprintf(temp->name,"%s",name); temp->value = value; temp->left = null; temp->right = null; return temp; } else if(strcmp(name,node->name)<0) { node->left = insert(node->left, name, value); } else if(strcmp(name,node->name)>0) { node->right = insert(node->right, name, value); } else{ printf("something went wrong\n"); } } int main(){ tnode *root = null; root = insert(root,"geor...

c# - User validation with ClickOnce installer? -

i creating wpf windows desktop application. need validation, while installation of application, if validation fails need stop installation, else complete installation. can achieved in click once? i found article: http://msdn.microsoft.com/en-us/library/dd997001.aspx creating custom installer. requires create seperate application , use custom installer class install application. possible override default installer? no, way can clickonce using customer installer have found. i recommend doing kind of validation against authenticated user @ install time because 2 users use same machine, 1 allowed install , 1 not. user allowed install so, , user not run it. it's better authenticate users when app run mclaassen suggested.

When I convert a Java project to a .jar with BlueJ, the project doesn't work as it does straight from BlueJ -

i use "create jar file..." option , choose main class. when try execute program jar, joptionpane window show up, program end there , not show jframe. have tried putting jar inside project folder , running there, of objects not draw when start it. there doing wrong or fix problem? i had similar problem first .jar exported bluej. resolved executing jar via command line addition of -jar flag ( java -jar myprogram.jar ). -jar flag tells launcher it's dealing .jar archive, rather being invoked run class file. assuming java installed on machine can way, via 'run' dialog in windows. if you're not totally comfortable command line interfaces it'd easiest give 'absolute path' - on windows put .jar in c:\ , java -jar c:\yourthing.jar via 'run' dialog. take @ docs java launcher, they're pretty easy going: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html if want able double-click .jar, answer little more fiddly...

java - Unexpected ConcurrentModificationException -

not sure why i'm getting exception. issue onclose called prior closeallopensessions . onclose operates normally, removing specified element _opensessions . however, when closeallsessions called concurrentmodificationexception generated when attempt loop on _opensessions. the exception not occur when comment out remove statement. considering how both these operations protected same mutex, unsure why happening. missing? class b { protected void onclose(session session, list<websocketsessionstateful> opensessions) throws ioexception { iterator<websocketsessionstateful> opensessionselements = opensessions.iterator(); while(opensessionselements.hasnext()) { websocketsessionstateful opensession = opensessionselements.next(); if(session.equals(opensession.getsession())) { opensessionselements.remove(); // comment me out not throw exception return; ...

c# - What is the difference between IRandomAccessStream and RandomAccessStream? -

i have used following code save taken image: private async void button_click_2(object sender, routedeventargs e) { storagefile photo = await windows.storage.knownfolders.pictureslibrary.getfileasync("image.jpg"); bitmapimage bmp = new bitmapimage(); using (irandomaccessstream stream = await photo.openasync(fileaccessmode.read)) { bmp.setsource(stream); } img.source = bmp; } what use of irandomaccessstream , difference on replacing randomaccessstream ? it's confusing because have similar names. related not in way 1 assume. randomaccessstream static helper class. irandomaccessstream interface concreete random access streams implement, such filerandomaccessstream , inmemoryrandomaccessstream . this means not interchangeable. use randomaccessstream perform operations, namely copying data between 2 instances of other streams. photo.openasync return filerandomaccessstream unless need specific...

ruby on rails - How can I override automatically generated links in Atom feeds? -

my atom feed automatically generates link want removed. how can achieve that? code: atom_feed |feed| feed.title @client.name @documents.each |document| feed.entry document, published: document.created_at |entry| entry.title document.title entry.content document.message entry.link share_url(@client.client_code, document.id) entry.url share_url(@client.client_code, document.id) entry.author @client.name end end end generates feed: <entry> <id>tag:localhost,2005:document/2694</id> <published>2014-04-25t11:36:34+10:00</published> <updated>2014-05-01t09:27:16+10:00</updated> <link rel="alternate" type="text/html" href="http://localhost:3000/documents/2694"/> <title>april</title> <content>whatever.</content> <link>http://localhost:3000/user/2694</link> <url>http://localhost:3000/user/2694</url> ...

javascript - How do I filter an array based on a range of numbers? -

i have array filter function: function filter(arr, criteria) { return arr.filter(function(obj) { return object.keys(criteria).every(function(c) { return !(criteria[c]) || obj[c] == criteria[c]; }); }); } var arr = filter(arr, { dep: dv, arr: av, car: cv, epi: acv, dur: dv }); and have bunch of options user can choose in select. duration, here have: <select name="duration" id="duration"> <option selected disabled hidden value="">-</option> <option value="l1">less 1 hour</option> <option value="1to3">1 3 hours</option> <option value="3to6">3 6 hours</option> <option value="6to10">6 10 hours</option> <option value="m10">more 10 hours</option> </select> but filter based on exact criteria. want filter float numbers in arr between 1 , 3 or 6 , 10. want able run other f...

C# stop on error line within try catch -

this question has answer here: visual studio: how break on handled exceptions? 6 answers if run code below calls test1(), vs2012 break nicely @ line , show me what's going on. if comment out test1 , put in test2, try catch not stop on line, logs out console. how can vs2012 stop on error line, when surrounded try catch statement? private void button_click(object sender, routedeventargs e) { //test1(); // no try catch - stops on error line dividing zero. test2(); // try catch - writes out console. } private void makeerror() { int = -1; += 1; int j = 1 / i; console.writeline(j.tostring()); } void test1() { console.writeline("makeerror in test1"); makeerror(); } void test2() { console.writeline("makeerror in test2"); try { makeerror(); } catch (exception ex) { console.writeline(ex.message); } } ...

json - Using jsn_totext() and xbuf_empty() -

consider following simple program (run on gwan v4.3.14): xbuf_t buf; xbuf_init(&buf); xbuf_cat(&buf, "{\"num\":-1}"); // simple json string jsn_t *jrec = jsn_frtext(buf.ptr, "rec"); // parse jsn_t *jnum = jsn_byname(jrec, "num",1); // element jsn_updt(jnum, 2); // change value positive 2 xbuf_empty(&buf); // reuse buffer puts(jsn_totext(&buf, jrec, 0)); // lets take the expected output {"num":2} turned out {"num":-2} . somehow, jsn_totext() reused emptied xbuffer , overwrote location of '1' '2'. if jsn_update(jnum, 100) , output correct. is bug or did misunderstand functionality of xbuf_empty() ? i asking quesiton because using xbuf_reset() instead of xbuf_empty() makes code work expected. you have answered question: problem in code comes (mis)use of xbuf_empty() function. let's explain wh...

javascript - Google Chrome hardware acceleration making game run slow -

Image
so have been working on game in html5 canvas , noticed games lags , performs slower when hardware acceleration turned on in google chrome when turned off. can try here from doing profiling see problem lies in drawimage . more drawing 1 canvas onto another. lot of this. hardware acceleration on. hardware acceleration off. is there fundamental missing 1 canvas another? why difference profound? if remember correctly, in-dom canvases loaded gpu memory in chrome, , off-dom canvases may not be. each drawimage off-screen canvas on-screen canvas results in loading content of canvas onto gpu texture, followed copy of memory on-gpu onto on-screen canvas. cost of sending new texture through gpu can quite high. loading textures high-throughput, high-latency, on gpus. someone chrome team have chime in definitive answer, fits experience canvases in chrome.

php - How to convert Wordpress post_content into Laravel view? -

i've been using laravel application development have found wordpress great @ bootstrapping high quality views through multitude of amazing themes, widgets, , customization options. having laravel , wordpress work side-by-side has been simple setup excellent guide @ http://grossi.io/2014/working-with-laravel-4-and-wordpress-together/ the question how hook wp's html/css/js generation functions can bring content laravel view post_id. here's typical data want convert: post_content = <code>[fullwidth backgroundcolor="" backgroundimage="" backgroundrepeat="no-repeat"] </code> <h1 style="text-align: center; font-size: 30px !important;">test test<span style="color: #e9a825;"> #1 </span>testing testing</h1> <p style="text-align: center; margin-top: -10px; font-size: 17px !important;">with on [tooltip title="stack overflow awesome"]<strong>y...

Taking screenshot of android returning Null? -

i want take screenshot of screen of rooted device ( not of particular activity of whole screen ) code - try { process sh = runtime.getruntime().exec("su", null,null); outputstream os = sh.getoutputstream(); os.write(("/system/bin/screencap -p " + ""+mpath).getbytes("ascii")); os.flush(); os.close(); sh.waitfor(); } catch (exception e) { log.e("tag_err", "error: "+e); } where mpath= environment.getexternalstoragedirectory().tostring() + "/screenshots.png"; now trying display - try { bitmap bmap = bitmapfactory.decodefile(""+mpath); imageview image = (imageview)findviewbyid(r.id.imageview1); image.setimagebitmap(bmap); } catch(exception e) { log.e("tag_display_err","error : ...

php - imploding and adding characters to a string to generate a sql statement -

i received input textarea in format: value0 value1 value2 value3 now want explode array, , implode string that insert `table` (`valuefield`, `myfield`) values ('value0','assignedvalue'), ('value1','assignedvalue'), ('value2','assignedvalue'), ('value2','assignedvalue') where assignedvalue fixed. here did: $myarray = explode(php_eol, $_post['input']); foreach ($myarray $key => $value) { $myarray[$key] = trim(preg_replace('/\s\s+/', ' ', $value)); } $data = "('" . implode("','assignedvalue'),'", $myarray) . "'"; $sql = "insert `table` (`valuefield`, `myfield`) values $data"; echo $sql; as result, wrong: insert `table` (`valuefield`, `myfield`) values ('value0','assignedvalue'),'value1','assignedvalue'),'value2','assignedvalue'),'value3' also if there bet...

android - can't create multiple choice listview -

this code can't create multiple choice mode listview. data fetched jason , set in listview. want multiple selection choice mode on list view public class examview extends listactivity{ private progressdialog pdialog; intent activity; // url contacts json // json node names private static final string tag_usermst = "products"; private static final string tag_qid = "que_id"; private static final string tag_que = "question"; private static final string tag_qans = "ans"; jsonarray products = null; // hashmap listview arraylist<hashmap<string, string>> contactlist; protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.user_activity_lv); contactlist = new arraylist<hashmap<string, string>>(); listview lv = getlistview(); new getcontacts().execute(); } private class getcontacts extends asynctask<void, void, void>...

Django python - Module not found -

i newbie might have done stupid. running python 3.3 , django 1.6.2. when run local server via command line, error receive "p/1.1 404 1712" , error on browser "module not found" , exception location direct me urls.py line 22; document_root=settings.static_root) this part of urls.py: from django.conf.urls import patterns, include, url django.conf import settings django.conf.urls import static django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # examples: url(r'^$', 'signups.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), ) if settings.debug: urlpatterns += static(settings.static_url, document_root=settings.static_root) urlpatterns += static(settings.media_url, document_root=settings.media_root) this how settings.py looks: # stat...

f# - Using a Deedle Data frame -

i'm new f# , convert code below output deedle data frame or convert output array data frame. let getdatabitstamp() = async { let! csv = sprintf "http://api.bitcoincharts.com/v1/trades.csv?symbol=bitstampusd" |> fetch return [| row in csv.split([|'\n'|], stringsplitoptions.removeemptyentries) match row.split([|','|]) | [|d; p; v |]-> yield (d,p) | _ -> yield! [||] |] |> map.ofarray } |> async.runsynchronously you can construct deedle data frame directly csv file using frame.readcsv("csvpath")

IIS7 create website / application pool / web application pool ( i have the script ) but i want to build in security -

i'm creating ps script deploy website install & rad , alot of other things .. work want build in security .. lets if app pool not created don't create webapplication radservices , use app pool : radservices... i hope point. here script no controle working , fixed parameters since copy script server want launch action on. script install rad , add mgrrad local groups pastebin.com/5tcdzswu as can see there no security in script :( i want double check if folder install there when create website install. want double check if folder rad there when create website rad want double check if app pool radservices there when create webapp pool etc etc i tried things can't work.

What's different from jettyrunner and full jetty distribution -

what's different between jettyrunner , full jetty distribution? is jettyrunner lack of something? if so, can add jar (like jetty-websocket.jar) classpath instead of using full distribution folder? the jetty-runner artifact way start (most?) web applications directly commandline. works around of normal conventions related webapp classloaders, etc limited feature set @ point, haven't see groundswell of response needing features websocket support @ point haven't looked @ required that. the full jetty distribution increasing becoming solid path forward more operations focused lot well, nice new features home , base directories, allowing tiers of base directory configuration letting share common configurations or libraries across multiple distinct application bases, etc... if sounds greek, should make sense normal corporate operations type person :)

uinavigationbar - ios 6 navigation bar and status bar overlapped -

Image
the problem this: status bar intially hidden. have tab bar controller , has navigation controller in each of tabs. screen shot like: later clicked on button on navigation controller's view, reveal status bar, ends this: the navigation bar overlaps status bar. have perform actions tapping tab make navigation bar go down. i tried set status bar uistatusbarstyleblackopaque , worked fine. if press "home" button on iphone turn app bacground , switch active, problem occurs again if clicked on button. your status bar style uistatusbarstyleblacktranslucent . should set either uistatusbarstyledefault or uistatusbarstyleblackopaque desired effect. translucent status bars overlap full screen views, while opaque ones push views down.

FirefoxDriver Selenium does not work (Java) -

i want set firefoxdriver selenium in java. tried follows: firefoxprofile profile = new firefoxprofile(); profile.setpreference("network.proxy.http", "proxy"); profile.setpreference("network.proxy.http_port", "1234"); webdriver driver = new firefoxdriver(profile); driver.get("http://www.stackoverflow.com"); but gives me error: org.openqa.selenium.firefox.notconnectedexception: unable connect host 127.0.0.1 on port 7055 after 45000 ms. firefox console output: after google turned out common problem did not find solution! using selenium-server-standalone-2.41.0.jar , firefox 29.0 can please me?! try setting proxy details manually in firefox browser , see if able access