Posts

Showing posts from April, 2011

javascript - How to use ng-animate in angular 1.2? -

base angular 1.1.5 - http://plnkr.co/edit/eokt8o4mjw9swdydeg3s?p=preview - works upped angular 1.2.6 - http://plnkr.co/edit/wopgatfnvm1mkf5li99h?p=preview - fail i think did follow instructions docs - http://docs.angularjs.org/api/nganimate • first include angular-animate.js in html • load module in application adding dependent module it's quite late in timezone , miss obvious. guess - css file between 1.1.5 , 1.2.6 not compatible? cannot tell... anyway here code form upped plunker, included comments emphasise followed instructions docs: <!doctype html> <html ng-app="app"> <head> <meta charset="utf-8"> <title>top animation</title> <script>document.write('<base href="' + document.location + '" />');</script> <link rel="stylesheet" href="style.css"> <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3

c# - How to define a userdefined Type in Rehosted Wokrlfow Designer -

if type included in referenced assemblies of rehosted workflow designer, , ready selected, why workflow designer compiler error when define variable of type? , how define userdefined type in c# code or rehosted workflow make recognizable workflow designer.

html - How to display a gif fullscreen for a webpage background? -

i'm trying make gif fit whole screen, far small square on screen while rest white. however, want take space. any ideas? if it's background, use background-size: cover; demo background-image: url('source.gif'); background-size: cover;

Vector Operation in Matlab? -

can body me explain line 7 of code. line temp(min(temp,[],2) >=1 & max(temp,[],2)<=n,:) do in code? line 7 of code throwing me off n=10; h=-1; j=0; i=1:n j=1:n temp=[i-1,j;i+1,j;i,j-1;i,j+1]; ngh{i,j}=temp(min(temp,[],2) >=1 & max(temp,[],2)<=n,:); end end that line selecting rows of temp have values between 1 , n , , assigning submatrix ngh{i,j} . note that min(...,[],2) or max(...,[],2) gives minimum or maximum of each row; the logical comparison 1 or n , & operation result in logical index vector, used address desired rows of temp (and columns).

mongodb - Adding a node to a running replicaset on an existing shard -

mongodb shard needs know members of replicaset. member list discovery dynamic? mean if add node existing replicaset configured shard on config servers, shard automatically update or have manually update shard configuration new member added replica? in older versions of mongo, prior 2.0.3 of replica set members needed specified when adding shard. seems fair conclude when shard added , needs know 1 of members of replica set, activity between replica set members delegated replica set. probably optimal way sure fire test scenario on own machine. there nothing suggest there additional configuration sharding should required. and bit of update had nothing on having lunch :) spun load of instances mapped out in listed tutorial: http://docs.mongodb.org/manual/tutorial/add-shards-to-shard-cluster/ a few differences being use of sh.addshard in first member of replica set added only, rather members syntax shown in docs. once shards up. added 2 more replica set nodes firstse

jsf - <h:selectManyListbox><f:ajax listener render> doesn't work when using jQuery Multiple Select plugin -

i try integrate jquery plugin display multiple select dropdown checkboxes. code: <h:selectmanylistbox id="multiplecolor" value="#{searchbean.color}" size="1" immediate="true" class="multiplecolor" style="width:200px;"> <f:ajax render=":menuform :searchform:searchbutton" listener="#{menubean.focus(menubean.mysearch)}" /> <f:ajax listener="#{searchbean.count()}" /> <f:selectitems value="#{searchbean.colorlist}" var="color" itemvalue="#{color}" itemlabel="#{searchbean.getcolortext(color)}" /> </h:selectmanylistbox> with js code: <script type="text/javascript"> $(".multiplecolor").multipleselect({ width: 200, multiple: false, multiplewidth: 460 }); the dropdown working, listener , renderer don't. can me that?

Algorithm to combine multiple images into one -

i'm looking algorithm merge multiple images 1 image. type of solution i'm looking not skew aspect ratios , cause minimal overlap, lay images frame of given size. example, have 6 images of carpentry tools , want algorithm lay them out in 1 frame 300px 300px. images can scaled if aspect ratios maintained, , want images visible minimal overlap. no rotations either. the problem solving np hard bin packing can use heuristic algorithms achieve in reasonable time. suggest genetic algorithms case using fitness function proportional empty space , inversely proportional square error in sizes of images.

couchdb - Can I include npm (or similar) modules inside Couch views? -

i want run npm module part of map function. realise it's possible include commonjs-style modules strings within view document. including whole npm module in way along dependencies little impractical. there way include npm modules external files? not @ moment, no. have use commonjs method suggesting. warned might have compile module , dependencies 1 body of js effective, , not node behaviors found in couchdb since uses different engine. as dominic mentions, there has been lot of discussion on topic last year or so.

Heroku not deploying from a different branch -

i'm trying deploy heroku application using different branch master. when run: git push heroku <mybranch> nothing happens , application not deployed. does know what's going on? thanks. heroku apps use master branch (although can push branches want). if really want deploy branch, have push master branch on heroku remote: git push heroku mybranch:master

android - Java variables declaration -

Image
i little bit confused program flow of android activity, in java main method executes first while in android oncreate methods gets called first, variables defined @ class level? how declared/initialized when activity starts executing, saying oncreate gets called first. can initialize these variables in inner class , use values outside of inner class? actually oncreate() method called first say. activity flows this oncreate - > onstart -> onresume at point activity visible user similarly when activity ends onpause -> onstop -> ondestroy so answering question. variables in class level not dependent, on these methods. because scope whole activity ie; onstart ondestroy . can initialize them in oncreate so. if want change there values on moving next activity should in onresume . activity lifecycle follows you have freedom rest in java

How do you use setInitialMenuItem for Google Glass menus, and do you have example code? -

google glass online documentation mentions method minimal documentation: https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/view/menuutils should called onoptionsitemselected or oncreateoptionsmenu ? any example code appreciated. you should call method oncreateoptionsmenu or onprepareoptionsmenu in order set menu item visible when user asks menu displayed. if call onoptionsitemselected , late, since menu displayed , interacted with.

Azure diagnostics and Class onStop (on scale down) - How to prevent log loss? -

i initializing azure diagnostics inside onstart of web role, , have scheduled transfer logs every 5 minutes. when auto-scale shuts down 1 roles loosing logs since last transfer. can in onstop prevent happening? there way force log transfer , prevent onstop finishing until it's done? thanks! just have log transfer in onstop method. or alternatively, if that's done in thread, use flag , loop in onstop method sleep until flag set. savelogasync(); while(!saved) { thread.sleep(100); } there still max amount of time onstop method run before it's forced shut down. think it's 5 minutes.

grails - Annotate Controller method to make Hibernate session "read-only" -

i've got app method that, reason can't figure out, saving object load @ end of controller method, though specify shouldn't. def testmethod( long id ) { def target = sampledomain.read( id ); // use target in further query, don't change target @ // i've checked, , target.isdirty() false here target.discard() render( view: 'blah', model: [ /* model not contain target */ ] ) } for reason, if turn on logsql, can see target object being saved @ end of method, though use "read" , "discard". version field seems db field being changed in table. is there way annotate method make sure no "updates" performed during controller method's session? admit not being knowledgeable possible arguments @transactional annotation. i'm using grails v2.2.4. it seem easier imagined. need readonly argument transactional annotation: @transactional(readonly = true) def testmethod( long id ) { def ta

javascript - Declaring Namespaces -

consider: var myapp = myapp || {}; myapp.doalert = function(message) { alert(message); }; myapp.doalert("from myapp"); and (function(ns) { ns.doalert = function(message) { alert(message); }; })(window.myapp2 = window.myapp2 || {}); myapp2.doalert("from myapp2"); they both work, , far can tell, same. purpose being declare namespace. is there benefit 1 style on other? the latter wrapping method(s) in anonymous function, 2 reasons: shorter (abbreviated) reference same thing ( myapp vs ns ). it's wrapped in anonymous function keep further declarations out of global scope. usually see latter more avoid multiple modules defining common variable names (and overriding meaning). see what purpose of wrapping whole javascript files in anonymous functions “(function(){ … })()”?

ruby on rails - javascript Confirmation Dialog in capybara webkit driver -

so want test user deleting account using capybara , rspec: scenario "user wants delete account" click_link "account" click_link "delete account" expect(page).to have_text("you're account deleted.") end only problem js confirmation dialog appears when user clicks 'delete account'. confirm dialog did following: install capybara-webkit add capybara.javascript_driver = :webkit spec_helper.rb add :js => true scenario "user wants delete account" do . now nothing seems work addition of :js => true . getting error capybara::elementnotfound: unable find link "account" , before working fine, js: true interfere these capybara methods? config wrong? :js => true tells capybara use javascript driver spec; it's needed run pages have execute javascript part of functionality. in case, needed js confirmation dialog. but...there's couple of other things note: your link titled

r - I cannot connect postgresql schema.table with dplyr package -

im trying connect postgres dplyr functions my_db <- src_postgres(dbname = 'mdb1252', user = "diego", password = "pass") my_db src: postgres 9.2.5 [postgres@localhost:5432/mdb1252] tbls: alf, alturas, asociad, atenmed, base, bfa_boys_p_exp, bfa_boys_z_exp, bfa_girls_p_exp, bfa_girls_z_exp, bres, c21200012012, c212000392011, c212000532011, c21200062012, c212006222012, c212007352012, c212012112013, c212012242012, c212012452012, c2222012242012, calles, cap, cap0110, casos_tbc_tr09, casos_tbctr09, casosvadela, catpo, cbcvl, cie09, cie10, cie103d, cie103dantigua, cie10c, cie9a, cie9mc, clasiarc, coalc, coddepto, codedades, codest, codlocaerbio, codprov, coheb, cohec, cohep, cohiv, coho09_20110909_m, coign, combl, comet, comp, comport, conev, conymad, copri, corci3cod, corci910, cores, corin, cotab, cutoi, cutto, def0307,...... but when try connect tbl my_tbl <- tbl(my_db, 'def0307') error in postgresqlexecstatement(conn, sta

Oracle NVL wild card search -

i have search page null values use nvl null conditions. 1 fiels have wildcard search nvl possibel wildcard search eg nvl(null,%name%)? you can use nvl in case "subfunction" if want null-s results this: select your_table nvl(column_can_be_null, 'substring_you_search_for') '%substring_you_search_for%'

ruby on rails - Ransack - Unknown action -

i'm new ror , want use ransack on project. map_controller.rb: def index @q = tweet.order('id_tweet desc').search(params[:q]) @tweets = @q.result(distinct: true).page(params[:page]).per(5) end index.html.erb: <%= search_form_for @q |f| %> <%= f.text_field :text_cont, :value => 'filter...' %> <%= f.submit "src",:class => "btnsrc"%> <% end %> however, not work. searching "foo", link: http://0.0.0.0:3000/tweets?utf8=%e2%9c%93&q%5btext_cont%5d=foo&commit=src and this: routing error no route matches [get] "/tweets" try running rake routes more information on available routes. what's happening? can help? solved. route problem, imagined. match '/tweets' => 'map#index' this solved problem.

database - MySQL query - counting values in query -

here's example table (assuming i'm having 3 categories only): id user item category ---------------------------- 1 myuser item1 1 2 myuser item2 2 3 myuser item3 2 4 myuser item4 2 5 myuser item5 2 6 myuser item6 3 i'm trying query sums categories in order result: user cat_1 cat_2 cat_3 -------------------------------- myuser 1 4 1 what's best method? thanks edit: extended approach (sorry mistake) my table follows: id user item category total ------------------------------------ 1 myuser item1 1 2 2 myuser item2 2 6 3 myuser item3 3 4 how can query result: user cat_1 cat_2 cat_3 -------------------------------- myuser 2 6 4 if know sure there 3 categories can go with: select user, sum(if(category=1,1,0)) cat_1, sum(if(category=2,1,0)) cat_2, sum(if(category=3,1,0)) cat_3 table group user

Change the color of polyline in android google map v2 -

i have code found link https://developers.google.com/maps/documentation/android/shapes#customizing_appearances polyline line = map.addpolyline(new polylineoptions() .add(new latlng(-37.81319, 144.96298), new latlng(-31.95285, 115.85734)) .width(25) .color(color.blue) .geodesic(true)); my problem color in color.blue returns error saying name color not exist in current context. just define color in colors resources file , this: polylineoptions rectline = new polylineoptions().width(4).color(context.getresources().getcolor(r.color.cyan)); works great me.

osx mavericks - Getting error while running Nutch on OSX mavrics -

i run following command , error of class not found. tried run following $ bin/nutch crawl urls -dir crawl -depth 3 -topn 5 bin/nutch: line 106: [: many arguments error: not find or load main class course.web apache nutch command unable execute tried both approaches above link none of them worked. i using nutch 1.7 if using nutch 2.x .command /bin/nutch crawl deprecated. should use /bin/crawl instead.

php - Update INT/DECIMAL field with a null/no value -

i have lot of input box's. each input box linked int or decimal mysql field , displayed inside text box. the default value of each int/decimal null when user first opens page, nothing shown inside text box's. i have update query updates value of each input box respected mysql field. my problem is, each input box doesn't typed in, value of field switches null 0 . i having trouble figuring out way update un-touched input's null , not have untouched values go 0. can help? defining variables goes like: if(nullblank($_post['variable1']) == false) $variable1 = $_post['variable1']; else $variable = ""; i've tried: $variable = null; my update query looks this: mysql_query("update `table` set `variable1`= '" . $variable1 . "' = my nullblank() function function nullblank($data) { if(is_null($data)) $value = true; elseif(strlen($data) <= 0) $value = true; elseif($dat

celery - Pass a reference to a file rather than a file itself with Python -

i can't seem identify how create file in python , pass around reference file in order convert different image resolutions. i'm using celery generate these various image resolutions asynchronously , passing entire image consumes memory , causes out of memory errors. any suggestions on how should accomplish this? here's code illustration: file_object = open('/tmp/image.jpg', 'w+') api.fetch_remote_file() f: file_object.write(f.read()) file_object.seek(0) # pass file object through chain of functions generate new images chain = generate_images.s(file_object, "high") | generate_images.s(file_object, "medium") | delete_temp(file_object) chain() # celery task process images asynchronously queue @app.task def generate_images(file_object, quality): #convert image lower resolution , store image = convert(file_object.read()) return file_object, image you can pass absolute path of file cele

php - Mysql Getting last entry in Group By -

hey mysql query $userid="id of logged in user"; select id, max( post_time ) , message, user_name, receiver_id, sender_id chat receiver_id =$userid or sender_id =$userid group greatest( receiver_id, sender_id ) , least( receiver_id, sender_id ) order id desc limit 0 , 1000 it gives first message recorded between 2 user not last. want last message show in message inbox. use query show unique conversations in inbox different users of logged in user(or u can particular user) can check demo @ http://www.funnenjoy.com/home try this, select id, message, user_name, receiver_id, sender_id chat post_time = max(post_time) , (receiver_id =$userid or sender_id =$userid) group greatest( receiver_id, sender_id ) , least( receiver_id, sender_id ) order id desc limit 0 , 1000

Fetch very huge data from server and insert in sqlite - Android -

i working on project having millions of records in server, need fetch these data server via web services , insert sqlite database. problem is, in order fetch these details server taking time because data retriving server huge. also taking time insert sqlite database. anyone can give me possible workaround this. used asynctask class fetching data server the asynctask class encapsulates creation of background process , synchronization main thread. supports reporting progress of running tasks. more information go to: http://www.vogella.com/tutorials/androidbackgroundprocessing/article.html and database operations slow , in situation thousands of records have inserted, inserting each record consumes lot of time , affects performance of application. in such situations,batch insert saves overhead. significant amount of time can saved if batch inserts made in single transaction. sqlite provides 3 simple methods in sqlitedatabase class : begintransacti

Curl script to check IP Blacklist in an rbl via backend of Centos Server -

as working on script ask suggestion on how can check server ip in rbl check whether blacklisted. rbl/dnsbl can queried way of dns. so, curl might not best tool job - tool dns lookups, such nslookup or host might better. see http://blog.nitemayr.com/2007/05/how-to-test-an-ip-address-against-an-rbldnsbl-list/ writeup on how works.

Python to Plot Graphics and Output Vector XY Pairs -

i need draw vector graphics, new me. looking recommendations python modules can plot vector shapes , output them series of xy moves. shapes circles , lines , other simple shapes, have algorithmic modifiers thicken, wiggle, or "grunge up" lines. i saw few of plot libraries (mathgl, matplotlib, pyplot), seem create graphics. ultimately, want break down output series of xy instructions consisting of lot of little straight lines. (i using python output instructions digital-to-analog converter controlling xy movements of laser.) please forgive blundering of question. i'll update question able formulate better. edit: on other hand, maybe simple move handy maths maybe pymodule overkill. open suggestions cutting curves lines. edit2: in end, ended doing own calculations, using pyglet vector graphic output. i ended using pyglet vector graphic output, , doing own calculations drawing circles , lines of cubicspline code nyu. #!/usr/bin/env python # core m

html - Display the post data after error in django and html5 -

django form {% field in form.fields %} {{field}} </div> {% endfor %} if there error {{field.email}} output html post data value <input id="id_email" type="text" value="gffdg" /> i want use html 5 inputs don't know how post value if there error <input id="id_email" type="email" > edit.. i hoping not use widgets django forms , type html5 code in template (type="email" not type="text") <input id="id_email" type="email" >` but can't figure out how value after post errors. <input value="?????" /> if trying bound value of email field, following template code should work: <input id="id_email" type="email" value="{{ form.email.value }}"> if value not set, blank field.

php - mysql_select_db returns false -

there working website, today error: access denied user 'username'@'' database 'databasename' it doesn't show hostname. why? i sure mysql_pconnect works correctly, mysql_select_db doesnot. function connect() { $this->connectionid=mysql_pconnect($this->server.(!empty($this->post) ? ":".$this->post : ""), $this->username, $this->password); if ($this->connectionid === false) { exit("core module error: mysql error: ".mysql_error($this->connectionid)); } if (mysql_set_charset("utf8", $this->connectionid) !== true) { // windows bug detected: can't initaliaze charset cp1251, try force setup $this->query("set names 'utf8'", $this->connectionid); $this->query("set character set 'utf8'", $this->connectionid); $this->query("set @@collation_connection = utf8_general_ci", $t

compiler construction - How does the lexical analyzer identify whether given token is Identifier or Keyword? -

i have basic question on lexical analysis. lexical analyzer (which dfa accepts lexemes , produces token) can produce tokens can identifier([a-z]/[a-z]/[0-9] knowing digit not first char), keywords (if, else,..) , operators & delimiters. so if lexeme 'whil' comes. lexical error stating its not valid keyword or will accepted identifier (variable), lexical analyzer not consider whether syntax right or not ? does lexical analyzer use different dfa identifiers, keywords, operators ? then lexical error stating not valid keyword no. or accepted identifier(variable) yes, , there syntax error parser. as lexical analyzer not consider whether syntax right or not ? the lexical analyser doesn't know syntax. that's parser's job.

how to use matrix or function in svg? and understand 3d -

in http://www.w3.org/tr/css3-transforms/ there given matrix n function can used svg, no example, plz check section 14.2, want know how use them? in advance the question bit vague, point @ explanation here , here more svg i'm not sure if there full 3d transform support svg atm. example... fiddle <svg id="svg"> <rect id="rect1" x="10" y="10" width="50" height="50"/> <rect id="rect2" x="100" y="110" width="50" height="50"/> </svg> #rect1 { stroke: red; stroke-width: 5; fill: blue; transform: matrix( 1,2,3,4,5,6); -ms-transform: matrix( 1,2,3,4,5,6); -webkit-transform: matrix( 1,2,3,4,5,6); } #rect2 { fill:green; transform: rotatey(-75deg); -ms-transform: rotatey(-75deg); /* ie 9 */ -webkit-transform: rotatey(-75deg); /* safari , chrome */ } i'm not quite sure of browser supp

javascript - How do I download base64 document in IE9? -

ie9 not support download uri link. // not work in ie9 document.location.href = uri + base64(format(template, ctx)); //window.open(uri + base64(format(template, ctx))); fiddle here please me how download file in ie9. great! found best solution "data uri scheme , internet explorer 9 errors" below api support ie9, make document client-side. https://github.com/dcneiner/downloadify

java - CDATA section in SOAP Request XML -

i using jax-ws service. following part of request class. @xmlelement(name = "answers") protected string answers; now, in actual soap request, answers need sent in xml cdata. there separate stub class answers. hence, marshalling object of class xml. surrounding in cdata tags shown below: xmlstr = "<![cdata[" + xmlstr + "]]>"; hence, request xml should this: <s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:body> <!-- other tags --> <answers> <![cdata[ <tagone></tagone> <tagtwo></tagtwo> ]]> </answers> </s:body> </s:envelope> however, when request sent server, soaplogginghandler, looks this: <s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:body> <!-- other tags --> <answers> &lt;![cdata[ &lt;tago

iphone - How do I make a webpage load that little app slide in screen when viewed with an IOS device -

you can see dialymail.co.uk in image. it looks pulling information directly apple app store. i'm looking @ little pop-up / slide in box @ top of iphone screen can closed x so i'm assuming there smart apple code can add. http://i.stack.imgur.com/zefau.png after lot of searching found amswer. smart app banners https://developer.apple.com/library/ios/documentation/appleapplications/reference/safariwebcontent/promotingappswithappbanners/promotingappswithappbanners.html what want exactly.. can't understand.do need remove cross mark @ top left of screen behind icon image.

c# - Entity Model Relationship in Entity Framework -

Image
i have database , there 4 tables in named city, course, college, student. when create ado.net entity data model, not showing foreign key column relationships in database exist. my entity model screenshot: the student table have 4 keys in database: please show full entity model relationships

c# - Escape zero character in number format -

is there way escape 0 -character character in c#, when using integer's .tostring() -method? example code: (112233).tostring("zerohereaschar:_0_numberhere:0") as result string: zerohereaschar:_0_numberhere:112233 , but i'm getting: zerohereaschar:11223_numberhere:3 you can use backslash escape character : (112233).tostring("zerohereaschar:_\\0_numberhere:0"); or verbatim string literal: (112233).tostring(@"zerohereaschar:_\0_numberhere:0");

pentaho - How to create multiple repositories in Penatho -

i know how create different (multiple) repositories in pentaho enterprise version. below points add. 1. different repositories different users, 1 user cant access other users transformations , jobs. 2. 1 user cant access db connections of other users in different repositories. my main concern want logic here security reasons. 1 user cant access or update other users created transformation. is possible? please me on this. thanks in advance. this how repos set up. use database repos on postgresql users. create new repo, click green + button @ top right of repository connection dialog. to keep users out of each others sandboxes, create different schema each user , assign db permissions accordingly. note, schema has created before create repo. of course i'm db superuser can repos. when create connection repo, go advanced tab , specify user's schema in 'preferred schema name' box. note, connection not appear in list of connections stored in repo; it&#

oop - Object Oriented In Perl Script -

sub new { $class = shift; #off first element $self = { }; bless $self, $class; return $self; } could explain that? use of following 3 lines of code? my $self = { }; bless $self, $class; return $self; my $self = { }; creates anonymous hash reference , stores in the lexical variable $self. bless $self, $class; tells perl $self not reference object of class stored in $class. see bless in perldoc . bless $x, $y returns $x, , subroutine returns value of last executed statement unless explicetly told otherwise return statement, next line optional, readability. return $self; hands value in $self (our special object reference) calling function. see return in perldoc . edit: to clarify, if don't bless reference, won't able call methods on it. bless tell perl, "look, on, associate reference in $self class in $class, can use methods in class on reference."

c# - WPF scrolling like in touchable applications -

i'm trying find solution problem: want make stackpanel, scrolling behavior one, can find in windows store app's stackpanels. means: if left click mouse somewhere within stackpanel, can scroll , down moving mouse , down. don't have use scrollbar. now - in wpf - can't find similar solution that. tried examples in www, unfortunately none of tricks worked. got until now: <scrollviewer panningmode="both" verticalscrollbarvisibility="visible" > <stackpanel margin="10"> <label content="hello world" /> <label content="hello world " /> ... </stackpanel> </scrollviewer> but that's it. , (surprise) - not work :) in other wpf application have seen, possible.. somehow. could please me? thx far, codecannibal this surprisingly easy do, there's an example of such behavior on page . according a duplicate of question s

php - wordpress function that can be used as wordpress default lost password functionality -

Image
i creating web service using php of website built in wordpress cms. there wordpress plugin used named "theme login" registration-login. now want know there function of wordpress through can pass user email address , wordpress lost password functionality? for login/registration functionlity have included wp-load.php file in webservice.php file can use wordpress user login/register functions in web service. my code below: is there function lost password? please guide me this. thank in advance you should able send user_login containing username or email-adress via post to /wp-login.php?action=lostpassword .

bash - awk string inequality seemingly not working -

i have file want find lines column 3 , 4 differ. file looks like: chr1:109506687 [t/g] bot top chr1:109506690 [t/g] bot top ... the code use find these lines awk '$3 != $4 {print $0}' cardio-metabo_chip_11395247_a.txt | shuf -n 10 problem using command results rs3218791 [a/c] top top where column 3 , 4 same. when use conditional equality, namely == no output, tells me awk never considers 2 columns $3 , $4 equal, despite them being so. ps. using :set list in vim, file looks like: chr1:109506687^i[t/g]^ibot^itop$ chr1:109506690^i[t/g]^ibot^itop$ .... my awk version gnu awk 3.1.8, can't imagine having anything. should have been right in 1.0 what might wrong? though can't reproduce issue (see below), think you're evaluating values numerically rather strings (all nonempty strings —even "0" — numerically evaluate 1 ). try this: awk '$3 != $4 "" {print $0}' test that concatenate

convert a pgm image to jpg Matlab -

i'm trying convert image found here pgm image jpg can't. i've tried answer of question found here didn't work. so, if please advise. the problem in file-header: pf 640 480 9757 according wikidepida , this man page file should use p2 (for graymap) instead of pf (which seems invalid in cases): p2 640 480 9757 with little change (made in text editor) file opens fine.

java - No FileSystem for scheme: webhdfs -

i'm building client pushes data hdfs. because hdfs inside cluster behind firewall use httpfs proxy access it. client exits ioexception when try read/write hdfs. message no filesystem scheme: webhdfs . code simple string hdfsuri = "webhdfs://myhttpfshost:14000/"; configuration configuration = new configuration(); filesystem hdfs = filesystem.get(new uri(hdfsuri), configuration); it crashes in last line. i'm building maven 3.0.4 , added hadoop-client dependency 2.2.0 project. accessing via curl on command line works fine. any ideas why failing? similar this question on had add following code prior doing fs activities: configuration.set("fs.webhdfs.impl", org.apache.hadoop.hdfs.web.webhdfsfilesystem.class.getname()); i don't know why, there seems wrong maven build process... works.

ipad - In Shadowbox scrolling not working in any apple device -

i using shadowbox display content in pop-up window. when content longer screen size, scrolling appears in pcs , android device not appear on apple devices (iphone, ipad, ipod) can 1 me? i know it's bit of late reply have had same problem , though share solution in case helpful. i created scrollable div using css overflow-y: scroll; within shadowbox frame , enabled content scrollable on ipad.

Trigger all jQuery events bound to an element -

i have attached click handler div surrounds radio inputs. when div clicked sets checked state of radio, trigger events bound radio. there multiple modules bind it, , potentially binding on blur, change, click, dblclick, focus, hover etc. now use following code: $('.form-type-radio').click(function(){ $(this).find('input').attr('checked', 'checked').trigger('blur').trigger('change').trigger('click').trigger('dblclick').trigger('focus').trigger('hover'); }); but more succinct method - .trigger('all') perfect. is there way this? or to: demo jsfiddle $('.form-type-radio').click(function (e) { if(e.target != this) return; var input = $(this).find('input')[0], inputevents = $._data(input, 'events'); $.each(inputevents, function (k, o) { $(input).triggerhandler(k); }); }); if div contains more 1 input, use for

jQuery Call Button Click from other Button -

i want call button click another button . if click first button - second button should trigger. have following code. html: <input type="submit" name="savebutton" id="first" /> <a href="http://www.google.com/"> <input type="submit" name="savebutton" id="second" /> </a> jquery: $(function(){ $('#first').click(function() { $("#second").trigger('click'); // $('#second').click(); wont work either }); }); link fiddle: fiddle i cant figure out iam doing wrong - can 1 please explain me? it works don't have handler on second! click event got fired don't should happen... here code example , fiddle $(function(){ $('#first').click(function() { alert('button clicked'); $("#second").trigger('click'); }); $("#second").click(function() { alert('bu

Quartz vs Java EE 7 scheduler -

i'm java ee developer has used until frameworks quartz schedule tasks. can see java ee 7 features managedscheduledexecutorservice schedule single or repeating tasks. have never used in real projects new features wonder if there still advantages of using quartz (or others) when have portable way ? thanks! i believe in future projects, there's no need use third-party libraries. java ee 7 full of scheduling features. besides new managedscheduledexecutorservice , there's schedule annotation single , periodic repeating tasks , timeout annotation create timers programmatically. imo new managed scheduled service better suited single delayed tasks or create job chain delays betweens specific tasks. you can find more java ee timer service ( schedule , timeout ) java ee 6 or java ee 7 . on side note, if ever try clustering application, it's relatively easy setup schedule -like timers run globally, instead of once per node - plus.

tomcat unique context for each subdomain -

i developed j2ee webapp. this webapp contains several subdomains (ar.app.ma, en.app.ma, app.ma ...). i realized deployment, each subdomain has own context, therefore, own objects, different of other subdomains) this has consequence of unpleasant phenomenons. example, user logs on www.app.ma not automatically connected ar.app.ma). connection pool in session instantiated many times there subdomains configured. you know way modify config subdomain (or context of each of webapp) subdomains have same unique context? i found solution on tomcat official website. in tomcat, host names , web apps bound in many-to-many relationship. there 1 host entry each host. when multiple host names bound same web app, 1 can use tomcat's aliases facility. <host name="www.mycompany.com" ...> <alias>mycompany.com</alias> <alias>en.mycompany.com</alias> <alias>fr.mycompany.com</alias>

android - Getting File list from Adobe Media Server 5 -

i have started working on vod app android. using adobe media server 5 streaming solution. have been able figure out how configure server put files in correct location , things that. right problem want display list of available media files on ams in android application user can go ahead , select appropriate file playing back. do need create .m3u8 kind of manifest files available , access complete listing of files or there other way achieve looking for?

java - what does super.onSaveInstanceState() do inside an overridden onSaveInstanceState() -

i new android development. using overriden version of onsaveinstancestate() save own app data. noticed did not call super.onsaveinstancestate(savedinstancestate) inside function , code worked fine. @override public void onsaveinstancestate(bundle savedinstancestate) { // todo: // save state information collection of key-value pairs // 4 lines of code, 1 every count variable savedinstancestate.putint(create_key, mcreate); savedinstancestate.putint(resume_key, mresume); savedinstancestate.putint(restart_key, mrestart); savedinstancestate.putint(start_key, mstart); } i wondering if super.onsaveinstancestate(savedinstancestate) called implicitly ? also, purpose of calling super.onsaveinstancestate(savedinstancestate) inside overridden function. when call super.onsaveinstancestate() state of view s saved. if don't call super method code still work...until... ...until application put in backgroun

Error in php code( building wordpress theme from scratch book) -

Image
i following book building wordpress theme scratch.an options page created through method in wordpress admin panel .there error present due nothing appears inside it. firsly added functions.php of wordpress: <?php require_once('theme-options.php'); ?> secondly theme-options.php created contains this: <?php // create custom plugin settings menu add_action('admin_menu', 'director_create_menu'); function director_create_menu() { //create new submenu add_submenu_page( 'themes.php', 'director theme options', 'director options', 'administrator', __file__, 'wptuts_landing_settings_page'); //call register settings function add_action( 'admin_init', 'director_register_settings' ); } function director_register_settings() { //register our settings register_setting( 'director-settings-group', 'director_facebook' ); register_setting( 'director-settings-group&#

Microsoft sql server: Pivot rows together with concatenate? -

i have select query outputs follows: pid-------name------------------response 147------factory influenced-----fish paste 147------factory influenced-----contract packer 147------factory influenced-----cereals 147------factory influenced-----biscuits 154------factory influenced-----werda 154------factory influenced-----worcester 158------factory influenced-----moirs 158------factory influenced-----oats 158------factory influenced-----noogy 157------factory influenced-----safari nuts 158------factory influenced-----savoury foods what make 'factory influenced' column , 'response' fields. concatenate these values follows: pid-----factory influenced 147-----fish paste, contract packer, cereals, biscuits 154-----werda, worcester 158-----moirs, oats, noogy, safari nuts, savoury foods any highly appreciated. this process of concatenating multiple rows single column not pivot, pivot when convert rows of data columns. s

mysql - PHP : Dropdown not insert into table -

i have form form contains textfield , dropdown menu . problem , after fill in field , select option . data textfield inserted table on db . selected option not inserted db . checked code , can't find error.. please me out . . form : <tr> <td colspan="2"><strong>name</strong> <div id="div_nama"><input name="txt_nama" type="text" id="txt_nama" onchange="validate()" size="40" /> </div> </td> </tr> <tr> <td><strong>kod masco</strong> <div id="div_kod_masco"><select name="txt_kod_masco" id="txt_kod_masco"> <option>sila pilih</option> <?php $sql = " select * lstmasco order kod asc"; $res_kod = mysql_query($sql); while($row_kod = mysql_fetch_array($res_kod)){ ?> <

c# - Show Brackets in Asp.net -

when users login account show names , designations works when show designation shows mix means username+designation example johnmanager .here manager desgination , same happend in side want designations type in brackets. here code string desginname = convert.tostring(loginusers.spdesignname(txt_username.value, txt_pass.value)); session["userdesignationname"] = desginname; if (users == 1) { session["login2"] = txt_username.value; session["login3"] = txt_pass.value; session["userdesignationid"] = desginid; //session["departmentid"] = depid; ; session["userdesignationname"] = desginname; session["usertypeid"] = users; response.redirect("alldocuments.aspx"); } else if (users == 2) { session["login2"] = txt_username.value; session["login3"] = txt_pass.value; session["userdesignationid"] = desginid; session["u

c - Can I make __udivdi3 and __umoddi3 part of the calling function in gprof? -

my program produces profile: flat profile: each sample counts 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 29.79 0.14 0.14 227764 0.00 0.00 standardize_state 21.28 0.24 0.10 __udivdi3 14.89 0.31 0.07 __umoddi3 8.51 0.35 0.04 170971 0.00 0.00 make_negative_child 6.38 0.38 0.03 8266194 0.00 0.00 mypow ... my cursory googling tells me __udivdi3 , __umoddi3 generated / , % . , yes there alot of / , % in program. however it's kind of useless in profile, prefer calls listed part of calling function. is there way can this, or otherwise make gprof more applicable scenario.

sapui5 - openui5: How to get current JSON model element in RowRepeater -

i'm having trouble getting current json model element bound rowrepeater element. tables , lists, retrieve current index (or indices) , based on these values, point matching element in json model. however, rowrepeater element not have current index property. feel should able retrieve current element directly, opposed indirectly current index, there better, uniform way retrieve current element? sample code model : var mydata = { "data": [ { "key": "67b895bf-8d89-11e3-94a7-0000005341de", "name": "my 1st item" }, { "key": "7780de05-8d83-11e3-bec4-0000005341de", "name": "my 2nd item" } ] }; var omodel = new sap.ui.model.json.jsonmodel(); omodel.setdata(dummydata); sap.ui.getcore().setmodel(omodel); sample code rowrepeater (i want retrieve cu

python - Django allauth & facebook: Given URL is not allowed by the Application configuration -

i run example the missing django-allauth tutorial login facebook, have error when try install django-allauth scratch: given url not allowed application configuration in facebook, site url set http://127.0.0.1:8000/ , works example not app. can error come from? i don't understand "sites" field in django administration: home › socialaccount › social apps › appname. set example.com default, don't know set here, although works fine example.com example... just info, here example's main urls.py from django.conf.urls import patterns, include, url django.contrib import admin admin.autodiscover() urlpatterns = patterns( '', # prevent are-you-sure-you-want-to-logout step on logout (r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}), url(r'^', include('larb.urls')), url(r'^accounts/', include('allauth.urls')), url(r'^admin/'

linux - How to read directelly the last charachter in a string in bash? -

i have following string string="anyanyanay" how can read last charachter in string? use below script #!/bin/bash string="anyanyanay" echo ${string#${string%?}} output : y ${string%?} removes last character string. ${string#<character>} removes characters string starting. in case ${string%?} = anyanyana ${string#${string%?}} = ${string#anyanyana} = y

c - Arduino, max array size > 255? -

i'm using arduino-irremote code read in ac unit remote on arduino uno r3. there's unsigned int rawcodes[rawbuf] . when set rawbuf 255 works great. push 256 , uploads fine, there's no response. is memory limitation? according this , it's not. should able ~400 elements. also, because limit i'm hitting 255 makes me believe there's else going on. thanks, justin you shouldn't have limitation. you're playing high amounts of memory. sure have enough available memory so? looks you're talking runtime errors(of memory leak/segfault type) here. you can check total available memory or check this great article (and code) on how debug avr. also if you're using heavy static strings allocation, can reduce memory usage using progmem storage (and having impact on available size sketch).

html - dompdf not creating pdf correctly -

i'm using dompdf try , convert html pdf file. file created no problem when tried open file, corrupt. when opened file in notepad, see raw html. hadn't converted @ all, had put in file extension of pdf. here code: include_once '/files/dompdf/dompdf_config.inc.php'; $files = glob("/files/dompdf/include/*.php"); foreach($files $file) include_once($file); ob_start(); ?> <!doctype html> <html lang="en"> <head> <title> title </title> </head> <body> <div><p>hello world</p></div> </body> </html> <?php $html = ob_get_clean(); $dompdf = new dompdf(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("sample.pdf"); this grabs html written here , saves sample.pdf not proper pdf file. missing something? i fixed stripping slashes. updated: $html = ob_get_clean(); if ( get

django calls validate_unique twice - workaround? -

i understand validate_unique called when doing full_clean , in turn called when calling modelform.save() - means validate_unique won't automatically called when doing model_instance.save() eg. see answer: https://stackoverflow.com/a/14472335/996792 i do want call validate_unique when calling model_instance.save i've overridden model's save function follows: def save(self, *args, **kwargs): self.validate_unique() super(mymodel, self).save(*args, **kwargs) however, produces following quirk: when saving modelform (eg. in admin), validate_unique called twice! presumably once modelform.save() , once model.save() . is there anyway round inefficiency? i detest unnecessary cruft , sort of thing bothers me. this possible workaround: clean( method called when request comes modelform, set flag when method called: def clean( self ): self.clean_called = true #<---- flag. #other model checks overwrite save( order call valida

php - preg_match expression including white space -

so i'm trying parse sequence of numbers extracted external web page. preg_match('#([0-9]{3}\s[0-9]{3}\s[0-9]{3}){1}#', $element, $match); won't return result although echoing $element shows correct expression: 341 102 408 aaa bccc of course when try above regexp above string on online regexp testers got expected result... i'm thinking there may invisible caracter in place of white space can't find it. i'm getting crazy... edit: strangely remove every whitespace of input string except expression i'm trying extract: $element = preg_replace("/\s/", "", $element); try preg_match('#([0-9]{3}\s+[0-9]{3}\s+[0-9]{3}){1}#u', $element, $match); to make regex engine unicode-aware, , allow more 1 whitespace character between digits; perhaps have non-ascii whitespace in there. that said, can reduce to preg_match('#(?:[0-9]{3}\s+){2}[0-9]{3}#u', $element, $match); and find match result in $match[

php - get value from array inside object -

if var_dump( $poll->vote_form() ); class method returns array want array (size=3) 'id' => int 41 'name' => string 'sg' (length=2) 'options' => array (size=4) 116 => string 'dsg' (length=3) 117 => string 'dsg' (length=3) 118 => string 'dg' (length=2) 119 => string 'gd' (length=2) but when echo $poll->vote_form['name']; i error undefined property: poll::$vote_form hm seems problem? method of class poll public function vote_form() { ... $form = array('id' => $poll_id, 'name' => $poll_name, 'options' => $poll_options); return $form; } try this $data=$poll->vote_form(); echo $data['name'];

php - How to find latest last modified directory on ftp -

i developing application in php. there lots of file handling. want last modified folder on ftp. getting last modified file. want file last modified folder also. my code $ftp_server='xxxxxxx'; $ftp_user_name='xxxxxxxx'; $ftp_user_pass='xxxxxxxx'; $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); if ((!$conn_id) || (!$login_result)) { echo "ftp connection has failed!"; echo "attempted connect $ftp_server user $ftp_user_name"; exit; } else {} $folder= ftp_pwd ( $conn_id ); ftp_pasv($conn_id, true); $get_folder_namesss = ftp_nlist($conn_id, '.'); $folder_name = array() ; $local_file=''; $folder = '/abc/def/ghi/2014/02/'; $handle=''; $time=''; $handle1=''; $files = ftp_nlist($conn_id, $folder); if (!count($files)) { echo "folder empty&qu

c# - Accessing variable from string name -

i accessing variable der , can or set through local _der . the setvalues gets string name on parameter wanted change(and list local list should set to) the string comes "global" datastore name, change local (der->_der). now, how in setvalues , "convert" string name lparam , actual local parameter want set? hope u understand , can [subscribe] public storablelist<double> der{ get{return _der;} set{_der = value;} } public static string converttolocalparameter(string input) { if (string.isnullorempty(input)) { throw new argumentexception("argh"); } return "_" + char.tolower(input[0]) + input.substring(1); } public void setvalues(string listname, storablelist<double> values) { string lparam = converttolocalparameter(listname); } private storablelist<double> _der; if understand correct (and java), use reflection field field = myclass.class.getdeclaredfield(lparam); fiel

How do I select a particular dynamic div, using Selenium when I don't have a unique id or name? -

only content of div unique. so, in following dynamically generated html, "my article-1245" unique: <div class="col-md-4 article"> <h2> article-1245 <a href="delete/6" class="btn btn-xs btn-danger article-btn pull-right hide fade in">delete</a> <a href="edit/6" class="btn btn-xs btn-info article-btn pull-right hide fade in">edit</a> </h2> <p>o ephemeral text! here today, gone tomorrow. not terribly important, necessary</p> </div> how select edit/delete link of specific div, using selenium? asserttext/verifytext requires element locator, not have unique id/name (out of control). there many such div blocks, other content text, dynamically generated. any appreciated. if text 'my article' appears each time, may use following: //for delete driver.findelement(by.xpath("//h2[contains(text(),'my article-')]/a[

Move element forward in list (SML) -

is possible move element in list forward in sml, let's 2 steps, 3 in [1,2,3,4,5,6] ends [1,2,4,5,3,6] ? basically, need define helpful function returns exact position of element want change. in have this, assuming have 1 3 in list. if want move 3s forward, make curr (position) list: exception doesntexit fun look3 (li, curr) = if (hd(li) == 3) curr else look3 (tl(li), curr + 1) | look3 (nil, curr) = raise doesntexit now have exact position curr of 3 want move forward, need use combination of list.take() , list.drop() trivial have desired output. this method not limited element want change, neither list length, nor list type.

sql server - decrement a column from a table while decrement a column from another table -

i have 2 tables aprovizionari (which means supplies- of books) , facturi (which means invoices). tables have following structure: create table aprovizionari ( id_aprovizionare int identity(1,1) primary key, codcarte char(3) foreign key references carti(codcarte), codlibrarie char(3) foreign key references librarii(codlibrarie), dataaprovizionare date default getdate(), cantitate int default 1 -- ^^^^^^^ should decrement when cantitate facturi increment ) create table facturi ( codfactura char(3) primary key, codclient char(4) foreign key references clienti(codclient), codcarte char(3) foreign key references carti(codcarte), cantitate int default 1, -- ^^^^^^^ value here must decrement in aprovizionari.cantitate codlibrarie char(3) foreign key references librarii(codlibrarie), ) aprovizionari (supply) stores cantitate (quantity) of each book in stock. each record in facturi (invoices) stores purchase o

pdo - How to insert data into nested tables through PHP? -

i think related pdo. this patientinfo table patientid | name | age | email | address and remarks tables patientid | remarksid | date | description i'd insert data patientinfo , remarks table patientid of both tables synchronized. problem dont know how query this. gives me error. $query = "insert patientinfo (name, age, email, address) values (:name, :age, :email, :address);"; $query_params = array( ':name' => $_post['name'], ':age' => $_post['age'], ':email' => $_post['email'], ':address' => $_post['address'], ); $query = "insert remarks (patient_id, description) values (:patient_id, :remarks) remarks.patient_id = patientinfo.patient_id;"; $query_params = array(':remarks' => $_post['remarks']); try{ $stmt = $dbname->prepare($query); $res