Posts

Showing posts from August, 2015

jQuery to check if css custom checkbox has been checked -

i had build custom checkbox using following css: input[type="checkbox"] { display:none; } input[type="checkbox"] + label span { display:inline-block; width:19px; height:19px; margin:-1px 4px 0 0; vertical-align:middle; background:url("../image/checkbox.png") 0 -20px no-repeat; cursor:pointer; } input[type="checkbox"]:checked + label span { background:url("../image/checkbox.png") 0 -1px no-repeat; } however having problem in checking if checkbox checked or not following function: var radio_check = $('#one input[type="checkbox"]'); function add_color(element, color){ element.css('background-color', color); } function checkemailformat(){ if(emailreg.test(emailaddressval)) { add_color(email, red); } else { return true; } } function check_radio_checkb(){ ...

java - Unable to use hidden field value in JSP -

i have hidden field value want send action, sends null . <s:hidden property="systemid" name="systemid" id="systemid" value="1"/> i calling action this <s:url id="papa" value="alertpup?et_id=%{id}&et_busid=%{systemid}"></s:url> <s:a href="%{papa}"><s:property value="id" /></s:a> but et_busid field in bean null . instead of hidden try <s:set name="systemid" value="1"/> <s:url id="papa" value="alertpup?et_id=%{id}&et_busid=%{#systemid}"/>

doctrine - Double listing not working in Symfony 1.4 embedded form -

i'm struggling simple form working in symfony 1.4 backend module. the idea create embedded form (one many relation, inschrijvingen -> danser). each embedded form has 1 many many relation. (lessen) forms displays correctly doesn't save lessen_list. (many many relation) the danserform i'm embedding work on own. doesn't work when embedding inschrijvingenform. i tried following tutorial. didn't work me: http://inluck.net/blog/many-to-many-relations-in-embedded-form-in-symfony-1_4 my schema.yml inschrijving: actas: timestampable: ~ columns: voornaam: { type: string(100), notnull: true, minlength: 2 } achternaam: { type: string(100), notnull: true, minlength: 2 } straat: { type: string(100), notnull: true, minlength: 2 } nr: { type: string(5) } postcode: { type: int(9), notnull: true, minlength: 4 } gemeente: { type: string(100), notnull: true, minlength: 2 } land: { type: string(2), notnull: true, default: 'be...

c# - Windows Phone 7 Development Delay on Buttons -

i have created button in c# windows phone 7 development. contains animation , when clicked want animation shown, , button navigate next page. using thread.sleep(4000) crashes application , wondering how go this. is there way delay navigate code? private void batnballbtn_click(object sender, routedeventargs e) { navigationservice.navigate(new uri("/picturegame.xaml", urikind.relative)); } presumably animation storyboard . can navigate within storyboard's completed event. mystoryboard.completed += (s, e) => { mystoryboard.stop(); navigationservice.navigate(new uri("/picturegame.xaml", urikind.relative)); }; this way don't need predict how long animation take, making code more reusable, , don't have worry dealing multiple threads manually.

php - Why does select into fail when I specify a second column name when creating an event in mySql? -

when creating event, why undeclared variable: votetype when add second column select sql? not possible specify second column in sql statement? what's right way this? begin declare c varchar(2); declare velm int(10); declare vtype tinyint(1); select distinct(country) c votes; select votedelm velm, votetype vtype votes country = c; end that's because into syntax in second case expecting variable array destination. it's seeing velm, votetype array of variables, since votetype hasn't been declared 1 (because it's 1 of columns), exception. try way instead: select <columns> <variables> ... in case: select votedelm, votetype velm, vtype votes country = c; there examples in mysql reference into .

php - Facebook Graph Api: How do I retrieve a large image from a groups feed? -

when querying feed groups id can retrieve information fields picture , full_picture. after parsing data using json , php output of full_picture image small. here data im retrieving this use show data full_picture , picture if (isset($data->full_picture)) echo "<img src=\"$data->full_picture?\" /><br><br>"; if (isset($data->picture)) echo "<img src=\"$data->picture\" /><br><br>"; here output https://fbexternal-a.akamaihd.net/safe_image.php?d=aqbvmhfsrd2l-8ru&url=https%3a%2f%2ffbcdn-photos-e-a.akamaihd.net%2fhphotos-ak-ash3%2f935434_10151639263649134_680895879_s.jpg https://fbcdn-photos-e-a.akamaihd.net/hphotos-ak-ash3/935434_10151639263649134_680895879_s.jpg however have noticed if can end url in browser manually _s.jpg _n.jpg, displays full size. there must way output full size graph? have tried using facebook documentation , can find this not work trying :/ use s...

How to separate specific elements in string java -

example of want do: if pass in "abc|xyz" first argument , "|" second argument method returns list("abc","xyz") public list<string> splitit(string string, string delimiter){ //create , init arraylist. list<string> list = new arraylist<string>(); //create , init newstring. string newstring=""; //add string arraylist 'list'. list.add(string); //loops through string. for(int i=0;i<string.length();i++){ //stores each character string in newstring. newstring += string.charat(i); } newstring.replace(delimiter, ""); //remove string arraylist 'list'. list.remove(string); //add newstring arraylist 'list'. list.add(newstring); return list; } try using split method: return arrays.aslist(string.split("\\|"...

mysql - Retrieve the Data in Tree structure in php -

currently working on creating apis in symfony2.2 framework. i have retrieve bunch of questions , answers database. q1 / \ a1 a2 / \ q2 q3 / | \ / | | \ a3 a4 a5 a6 a7 a8 a9 / | q4 q2 ... my db structure follows: question: (questionid,questiontext) answeroption: (id,questionid,option,nextquestionid) here in above diagram there 1 root question has 2 choices a1 , a2. on select of a1 user must redirected q2 , on , forth. note : user may not answer questions. now need find best way to: 1: retrieve data database. 2: format questions in json file. ok. first take key database a1, , a2 stored, retrive data different table based upon selection,just match id's (selected a1 , a2) , retrive datas...

PHP: curl and stream forwarding -

curl has lots of options make easier use-case request data server. script similar proxy , far requesting data server , once result data complete, it's send client @ once. user visits http://te.st/proxy.php?get=xyz proxy.php downloads xyz external-server when download completed 100%, output data now wonder whether 2 , 3 can done in parallel (with php5-curl), "proxy stream" forwards data on fly without waiting last line. if file size 20mb in average, makes significant difference. is there option in curl? take @ http://www.php.net/manual/en/function.curl-setopt.php#26239 something (not tested): function myprogressfunc($ch, $str){ echo $str; return strlen($str); } curl_setopt($ch, curlopt_writefunction, "myprogressfunc"); read parallelcurl curlopt_writefunction

How to Send Request to all facebook friends in facebook 3.0 android -

i have send app request friends here using code send request 1 friend it's working fine want send request multiple/all friends private void sendrequestdialog() { bundle params = new bundle(); params.putstring("to", "1782990807"); params.putstring("message", "learn how make android apps social"); webdialog requestsdialog = (new webdialog.requestsdialogbuilder( logout.this, session.getactivesession(), params)) .setoncompletelistener(new oncompletelistener() { @override public void oncomplete(bundle values, facebookexception error) { if (error != null) { if (error instanceof facebookoperationcanceledexception) { toast.maketext( logout.this.getapplicationcontext(), "request cancelled...

windows phone 7 - How to use multitouch behaviour from multitouch.codeplex.com -

i want pinch zoom in images in windows phone 7.1 app. here steps have followed - downloaded latest binaries. added system.windows.interactivity.dll , multitouch.behaviors.silverlight.wp71.dll project wp71/release folder. added reference in xaml: xmlns:mt="clr-namespace:multitouch.behaviors.silverlight4;assembly=multitouch.behaviors.silverlight.wp71" xmlns:i="clr-namespace:system.windows.interactivity;assembly=system.windows.interactivity" here code: <image source="pic.jpg"> <i:interaction.behaviors> <mt:multitouchbehavior istranslateenabled="true" isrotateenabled="false" /> </i:interaction.behaviors> </image> i'm getting error on running app: the type 'multitouchbehavior' not found.

c# - adding and quering the database in visual studio 2012 -

i have added database data source c# project in visual studio. now, query database. need manually set connection string database? public void setsql() { string connstr = "provider=microsoft.ace.oledb.12.0;data source=c:\\users\\jasper\\desktop\\autoreg\\autoreg.accdb;"; oledbconnection myconn = new oledbconnection(connstr); myconn.open(); dataset ds = new dataset(); //query ask string query = "select * student"; using (oledbcommand command = new oledbcommand(query, myconn)) { using (oledbdataadapter adapter = new oledbdataadapter(command)) { adapter.fill(ds); datagridview1.datasource = ds; myconn.close(); } } } do need go through of process every time when need query database? if you're manually setting db connection literally 1 query, there isn't easier way it. suggest code cleaned little, though. written in example, myconn remain open if ...

javascript - Add timestamp to named column in Google Spreadsheet onEdit script -

i'm trying figure out how retrieve index of column specific name in google spreadsheet script. i'm working on custom google script automatically adds timestamps spreadsheet when edited. current version adds timestamp last column of active cell's row. i want create new version of script adds timestamp specially designated column using specific column name. example, want create column in spreadsheet named "last updated," , want script detect index of column , automatically add timestamps instead of last column in row. this work better me, because place timestamp column wherever wanted , not have worry script overriding important accident. my current script looks this: function onedit(event) { var timezone = "gmt-4"; var timestamp_format = "yyyy-mm-dd hh:mm:ss"; var sheet = event.source.getactivesheet(); // note: actrng = cell being updated var actrng = event.source.getactiverange(); var index = actrng.getrowindex(); ...

c++ - Saving a specific Camera View in OpenGL as Image -

i have 3d scene object , save view of object different 1 of current screen at. thought i'd have (pseudo code): pushmatrix() loadidentity() translateandrotate() gluperspective() setviewport() drawscene() savescreenshot() popmatrix() but picture of current view of camera, not 1 specified. did forget something? edit: because of answer below, tried following code: void scenephotograph(glubyte* target, float *translation, float rotationaroundy) { glmatrixmode(gl_projection); gluperspective(54.0f, (glfloat)openglcontrol1->width / (glfloat)openglcontrol1->height, 1.0f, 3000.0f); glviewport(0,0,openglcontrol1->width, openglcontrol1->height); glmatrixmode(gl_modelview); glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glloadidentity(); gltranslatef(translation[0],translation[1],translation[2]); glrotatef(rotationaroundy, 0,1,0); openglcontrol1_ondrawgl(null,system::eventargs::empty); openglcontrol1->refresh(); glre...

input - How do I hide a parent if div does not contain content? -

i have script matches user input filter , hide parents divs containing content. i want use same script hide parent not contain inputed content. i tried using :not no luck there... can't find ":notcontains" what's correct syntax this? this have... html- <div id='filter_a'> <span class='tags'>john john s john johns</span> </div> <div id='filter_a'> <span class='tags'>bob bob bobi bobi</span> </div> <div id='filter_a'> <span class='tags'>julie b julie julieb</span> </div> script- $("#b_submit").click(function() { var filter_text = $('input:text').val(); $('.tags:contains('+filter_text+')').parent().fadeout('slow'); ex: if user inputs "john", parents of bob , julie fadeout. in sense, i'm looking proper version of: $('.tags:doesnotcontain('+filter_tex...

embedded - Performance Differences between evaluation boards -

Image
our company proud owner of stm32f4 evaluation board ( cortex m4f) , received evaluation board (arm7tdmi board). before starting migration arm7 evaluation board, want know if hardware strong enough us,so wont waste anytime discover later. our project utilize many dsp algorithms (that takes advantage of fpu) , heavy usage of sdio , , around 1 megabyte of memory . so , thinking following tests on both evaluation boards ,and see performance differences between them : math : addition , subtraction,division,multiplication , abs , sqrtf . run loop ( , floating numbers used). sdio : read/write 2 kilobyte buffer in loop memory : read/write external , internal ram in loop. in opinion , results give indication performance differences ,and expect "real" project ? thanks michael i advise against new design based on arm7 - legacy arm architecture. should check the vendor's part status , planned obsolescence part intend design in. no vendor releasing new de...

ios - UITableView Row Height Based on Cell contents -

i have looked @ several questions asking adjust row height based on cell content. in case, have 10 labels in 1 cell , each label has fixed width. labels must wrap text if not fit label width. row height depends on 10 label's text content. means have calculate height of every label given text , take maximum height amongst labels row height. have rows. looks me insufficient solution. there better solution? thanks, jignesh the uitableview requires implement heightforrowatindexpath in order have custom height table cell. because uitableview calculates total height of table each time data reloaded. cache row-height calculations if data static. in case recommend creating data model class represents 10 label's worth of text , provide helper function on data model class can call in heightforrowatindexpath . helper function encapsulate row height calculations perhaps this: let's have data model class represents data in rows: @interface mydatamodelclass : ns...

Rounding a BigDecimal in Java doesn't return the expected number -

i have property called m_fobst contains following number: 1.5776 . here i'm trying round it: this.m_fobst.setscale(2, bigdecimal.round_half_even) however, number 1.60 when should getting 1.58 . can explain why? bigdecimal immutable - make sure using value returned setscale() method. bigdecimal bd = new bigdecimal("1.5776"); bd = bd.setscale(2, bigdecimal.round_half_even); in case, bd 1.58

apache poi - XLSX removing sheets OutOfMemory Exception -

i trying load xlsx file using poi library has 5 sheets. size of file 5 mb. total records in sheets around 30,000. once file loaded need delete 1 or more sheets on fly based on sheet neame input. here snippet. public void generatereportworkbook(string[] requestedreports) throws exception { // read file string dailyticketreport = reportconstants.report_path + reportconstants.file_name + reportconstants.xlsx_file_extn; fileinputstream fis = null; xssfworkbook book = null; try { fis = new fileinputstream(dailyticketreport); book = new xssfworkbook(fis); (int = book.getnumberofsheets() - 1; >= 0; i--) { xssfsheet tmpsheet = book.getsheetat(i); if (!arrayutils.contains(requestedreports, tmpsheet.getsheetname())) { book.removesheetat(i); } } } catch (exception e) { logger.error("error occured while removing sheets workbook"...

Is it possible to edit .Config file using a batch script -

here part of .config file have: <cs.components> <clear/> <cs.component name="security"/> <cs.configitems> <cs.configitem name="sql.server.name" value="some_name" type="string" description=""/> <cs.configitem name="sql.server.database" value="db_name" type="string" description=""/> <cs.configitem name="sql.user" value="user_name" type="string" description=""/> <cs.configitem name="sql.pass" value="pass" type="string" description=""/> </cs.components> so want edit file corresponding names* *some_name = server 1; db_name=a real database on server 1 , on... appreciate! the batch file below preliminary version of program achieve want. names of input , output ...

faster redis lookup for collection of keys -

i'm looking faster way lookup collection of keys in redis. that's need do: hget "user:001:coins" "2013-05-01" it looks stored coins user on specific day. now want lookup stored coins date range of month: hget "user:001:coins" "2013-05-01" hget "user:001:coins" "2013-05-02" .... thats getting slow becasue have 120 different users on 2 months. there faster/better way ? one idea had add key holds calculated coins amount month, , recalculate key if there change. hget "user:001:coins" "2013-05" but mean additional programming logic, avoid. restructuring data not bad idea if require additional work. fetching once faster fetching n times. if can group operations together, why not use hmget ? hmget "user:001:coins" "2013-05-01" "2013-05-02" ...

is there a nice cypher desktop client for neo4j -

i'm trying out lot of cypher queries on neo4j database , have found web based console bit clumsy. the neo4j console more useful ,but not sure how point @ own database/dataset. is there nice desktop client or tool run cypher queries on manage neo4j database, akin sql management studio? i'd avoid using web admin if possible. when start neo4j server spins wed-based admin tool allows submit adhoc queries via tool , see results. go server's url in web browser. there decent visualization tool called neoclipse . it's got small bugs , bit of learning curve it's pretty decent.

Servicestack ORMLite Query Multiple -

i wondering if ormlite had querymultiple solution dapper. my use case in getting paged results. return new { posts = conn.select<post>(q => q.where(p => p.tag == "chris").limit(20, 10)) totalposts = conn.count<post>(q.where(p => p.tag == "chris")) }; i have few other cases i'm calculating other stats in addition main query, , i'm keen avoid multiple roundtrips. (probably unrelated, i'm using postgresql) you can this: var boththings = db.exec(cmd => { cmd.commandtext = @" select * tablea select * tableb"; var both = new bothaandb(); using (var reader = cmd.executereader()) { both.a = reader.converttolist<a>(); reader.nextresult(); both.b = reader.converttolist<b>(); } return both; }); it might possible wrap in extension method, nothing clever coming mind.

javascript - Regular expression on textarea -

i'm having bit of trouble validating form have, can check letters, numbers , full stop ("period") in single text input, can't life of me work @ on textarea field. in validation have this: var usernamecheck = /^[a-za-z0-9.]{5,1000}$/; the validation i've tried doesn't work on textarea ($itswusers) is: if(!document.all.itswusers.value.match(usernamecheck)) { alert ("please write usernames in correct format (with full stop between first , last name)."); return false; } however, following on 'input type="text"' works fine on same form if(!document.all.sfusersname1.value.match(usernamecheck)) { alert("usernames can contain letters, numbers , full stops (no spaces)."); return false; } i need validate usernames, 1 name per line e.g. john.smith peter.jones1 these both ok follo...

html - how to fit screen full height (using CSS)? -

Image
this question has answer here: 100% min height css layout 13 answers sorry extreme-ignorance in html-css. developed standard rails application using twitter bootstrap framework. shown in snippet below (application.html.erb), have pages organized usual header container footer now every page fit height of screen (reaching 100% of screen height in case content shorter, in case of attached scrrenshot). indeed, see in scrrenshot, have grey area in lower part of screen, instead page fill entire screen... i presume it's css configuration, tryied css setting without success. suggestion ? thanks! giorgio <!doctype html> <html> <head> <title>esami anatomia</title> <%= render 'layouts/responsive' %> <%= stylesheet_link_tag "application", media: "all" %> <%= javascript...

remote login to Amazon using curl / php -

i've made myself test project log in amazon using curl , php, after hours of going in circles, think have admit defeat. wondering if tell me i've gone wrong code below? besides that, downloaded amazon cookies , placed them in same directory php in file called 'cookie.txt' $username =""; // needs changed $password = ""; // needs changed $url = ""; // sign in url $cookie = "cookie.txt"; $postdata = "email=".$username."&password=".$password; $ch = curl_init(); curl_setopt ($ch, curlopt_url, $url); curl_setopt ($ch, curlopt_ssl_verifypeer, false); curl_setopt ($ch, curlopt_useragent, "mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.8.1.6) gecko/20070725 firefox/2.0.0.6"); curl_setopt ($ch, curlopt_timeout, 60); curl_setopt ($ch, curlopt_followlocation, 0); curl_setopt ($ch, curlopt_returntransfer, 1); curl_setopt ($ch, curlopt_cookiefile, $cookie); curl_...

backbone form : how to render form using a custom template -

since backbone form extends backbone view, guess using custom template sould done same way. first : insert template script type="text/html" element in header <head> [ ... ] <script type="text/html" id="mytemplate"> <h1>this template view</h1> </script> </head> then set view's template attribute using id of template var myview= new backbone.view.extend({ template: '#mytemplate', [...] }); for backbone form, template doesn't work : <head> [...] <script type="text/javascript" src="scripts/jquery.js"></script> <script type="text/javascript" src="scripts/underscore.js"></script> <script type="text/javascript" src="scripts/backbone.js"></script> <script type="text/javascript" src="scripts/backbone-forms.js"></script...

How to check if a file is executable in Lua? -

how can check in lua if string path executable file? seems neither standard library nor, surprisingly, luafilesystem provides way this. luafilesystem has lfs.attributes() function returns table. that, rather perversely, has key named "mode" contains string describing "type" of node (file, directory, socket, etc). although it's not listed in manual at: http://keplerproject.github.io/luafilesystem/manual.html ... seems canonical reference module ... there 'permissions' key in table. think parse "x" characters. i discovered with: #!lua local lfs = require 'lfs' attr = lfs.attributes('./some_file') name, value in pairs(attr) print (name,value) end

jquery - Cant remove parent element of an element -

my structure is: <p> <span> <input type="text" class="key" value="21"> </span> <span> <input type="text" class="value" value="55"> </span> <span> <a href="#" class="updateaction" data-setting-id="1">update</a> <a href="#" class="deleteaction" data-setting-id="1">delete</a> </span> </p> i try remove parent element whenever delete link clicked: $(this).parent().parent().hide(); $(this).closest('p').hide(); close input tags , call preventdefault , work. http://jsfiddle.net/p3tew/ $(document).on("click", ".deleteaction", function (e) { e.preventdefault(); $(this).closest('p').hide(); });

python - concision in a for loop without list comprehension -

please don't laugh. i'm trying write simple script replace hostname , ip of base vm. have working version of this, i'm trying make more readable , concise. i'm getting syntax error when trying code below. trying make these list comprehensions, since file types, won't work. in advance. try: old_network = open("/etc/sysconfig/network", "r+") new_network = open("/tmp/network", "w+") replacement = "hostname=" + str(sys.argv[1]) + "\n" shutil.copyfile('/etc/sysconfig/network', '/etc/sysconfig/network.setup_bak') line in old_network: new_network.write(line) if not re.match(("hostname"), line) line in old_network: new_network.write(replacement) if re.match(("hostname"), line) os.rename("/tmp/network","/etc/sysconfig/network") print 'hostname set to', str(sys.argv[1]) except ioerror, e: print "error %s" % e ...

java - Alternative to built-in XmlPullParser with good encoding support -

i'm porting project written blackberry (java) android. project contains xml parsing classes written against org.xmlpull.v1.xmlpullparser interface. actual parser instance injected in classes outside. this app parses xml files encoded in iso-8859-15 (aka latin 9). can't use utf-8, unfortunately need stick encoding. the old blackberry project used kxml2 pull parser. in android trying use built-in parser can obtained this: xmlpullparser parser = xml.newpullparser(); and configure char encoding: parser.setinput(<input stream>, "iso-8859-15"); the problem parser not support char encoding. exception thrown: org.xmlpull.v1.xmlpullparserexception: error parsing document. (position:line -1, column -1) caused by: org.apache.harmony.xml.expatparser$parseexception: @ line 1, column 0: unknown encoding. and it's odd because know android supports encoding. proof line runs no exceptions: string test = new string("hi".getbytes(), "is...

javascript - Get HTML String for jQuery and/or DOM object -

i think i've read through complete jquery api documentation , looked @ jquery objects , simple dom elements in debugger check methods have @ runtime, life of me, can't find way html string represents contents of jquery object or dom node. missing something? jquery objects have method html() , dom elements have property innerhtml both give inner html of object. if have html this: <body> <div> <p>hello world!</p> </div> </body> and use jquery doing var $div = $body.find("div") , call $div.html() returned string "<p>hello world!</p>" . i'm looking way make return "<div><p>hello world!</p></div>" (i don't care whitespace). what doing wrong? can't difficult html representation of these objects, can it? try dom property .outerhtml

ios - Taking a front camera shot from a backgrounded app -

i'm trying capture front camera shot when app in background. capturestillimageasynchronouslyfromconnection:completionhandler: works fine when app in foreground, fails when app in background. can do? this not allowed in ios. check apple guidelines ios app programming guide . section "declaring app’s supported background tasks". you can see section using camera not supported in background state. special tasks supported in background include: audio processing/playing location services voip newstand-content external-accessory bluetooth.

internet explorer 8 - is null or not an object in IE8/7 by using javascript -

the javascript this: <script type="text/javascript"> var links = document.getelementbyid("practice_nav_var_color"); var = links.getelementsbytagname("a"); var thislocationhref = window.location.href; for(var i=0;i<a.length;i++){ var templink = a[i]; if(thislocationhref === templink.href) { templink.style.backgroundcolor="#7387a2"; } else { templink.style.backgroundcolor="#8d8679"; } } in ie8, error message says "links" null or not object. first guess ie doesn't document.getelementbyid... i have searched online, seems has conditional statements previous div, not sure mean. any welcome. thank time! try this var links = document.getelementbyid("practice_nav_var_color"); if(links) { var = links.getelementsbytagname("a"); var thislocationhref = window.location.href; for(var i=0;i<a.length;i++){ var templink =...

php - Controlling the functions of foreign site -

i have hosted simple webpage on laptop. page, sends request page [global www.* domain]; page x in-turn invokes webpage; page-y , final result shown on screen page-y. now, since coding/source of page-y hosted on site, don't have control on it. is there method can invoke functions , prevent functions of page y? you cannot affect server-side code http request. if able access other site, set url parameter such www.example.com/page-y.php?f=1 , still controlled remote site.

plot - plotting symfun and a self created function on same graph matlab -

i trying plot 2 function in matlab, first 1 of kinf symfun: p = symfun(0, [m]); p(m) = p(m)+ck(k-3)*exp(m*(k-3)*complex(0, 2*pi/25)); here ck symfun , k variable pre-defined. i want plot in same graph function created using function mode: function [x1] = xt_otot_q3( t)... i cant make xt_otot_q3 function symfun because involves if statements. - tried create 2 vectors sampling 2 functions , plotting them plot function reason 'p' function vectors gets preatty grotesque giving me wierd output... - tried plotting them both using ezplot function reason sampled vector got form xt_otot_q3 shows straight line @ 0. any ideas how should plot them together? plot xt_otot_q3 function must create vector if try plot directly using ezplot gives me following eror: >> ezplot(xt_otot_q3, [-10 10]) error using xt_otot_q3 (line 2) not enough input arguments. thanks in advance. if understanding properly, have 2 functions p, , xt_otot_q3. want plot them together. ...

rest - Neo4j HTTP error -

so, thought configured correctly following installation , setup instructions in neo4j documentation, rest api not working. http:7474/localhost works , detects nodes, curl http://localhost:7474/db/data/node/0<html> gets <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> <title>error 404 not found</title> </head> <body><h2>http error 404</h2> <p>problem accessing /db/data/node/0. reason: <pre> not found</pre></p><hr /><i><small>powered jetty://</small></i><br/> <br/> <br/> <br/> <br/> <br/> <br/...

javascript window.setTimeout executes twice in a particual case -

i have problem using settimeout. have been using lots of times , works way expect to. when put code in seperate function works in case has weird behaviour. here code: routepatternpoint.prototype.showonmap = function(map) { var = this; google.maps.event.addlistener(this.marker, "click", function(event) { window.settimeout(function(){ if(routepatternpoint.markerdoubleclickfix === false) { dosomething(); } routepatternpoint.markerdoubleclickfix = false; },350); }); google.maps.event.addlistener(this.marker, "dblclick", function(event) { routepatternpoint.markerdoubleclickfix = true; }); } the problem google maps api v3 has bug when single , double click events implemented - both of them gets executed. so solution slow down single click event , see if double click event executed. if double click event executed interrupt single click event. unfortunatelly code not working...

knockout.js - Update KnockoutJS bound textbox with jQuery val() -

so i'm using knockoutjs ko mapping plugin in single page app , works great... except... there option referring site send values in query string prepopulate couple textboxes. have js function parses query string , uses jquery val() populate ko bound textbox value. however, value never gets set. here pseudo-code on i'm trying... var jobtitle = "ninja"; $("#jobtitle").val(jobtitle); // doesn't work $("#jobtitle").val(jobtitle).change(); // doesn't work $("#hiddenjobtitle").val(jobtitle); // works markup <input id="jobtitle" type="text" data-bind="value: jobtitle" /> <input id="hiddenjobtitle" type="hidden" data-bind="value: jobtitle" /> an interesting note: use same code set value of ko bound hidden field , works fine. the reason not work $("#jobtitle").val(jobtitle) because jobtitle knockout databind function. if inspect...

Create Zoomable image object on Windows Phone 8 -

i working on image-related application windows phone 8. after doing required image processing, display output in "image" toolbox item, seems work me. coding here done in c# + xaml. now want improve ui , make output image zoomable (using pinch zoom). know how create such ui element can zoomed. i understand might common requirement many app developers. have been unable find reference same. download windows phone toolkit , use gestureservice.gesturelistener xaml: ... xmlns:tk="clr-namespace:microsoft.phone.controls;assembly=microsoft.phone.controls.toolkit" ... <image source="myimage.jpg" rendertransformorigin="0.5, 0.5" cachemode="bitmapcache"> <image.rendertransform> <compositetransform x:name="transform" /> </image.rendertransform> <tk:gestureservice.gesturelistener> <tk:gesturelistener pinchstarted="onpinchstarted" pinchdelta="o...

c# - Task.Factory.StartNew not starting? -

i trying go out gateway, data return on ui thread . continuewith runs, gateway never does?? ilogonresult result; task.factory .startnew(() => { result = gateway.authenticate(a, b); }) .continuewith(task => { taskscheduler.fromcurrentsynchronizationcontext(); dosomeui(result); } ); have go @ this, seems wishing execute gateway.authenticate method , return result type method updates ui. task.factory .startnew(() => { return gateway.authenticate(a, b); }) .continuewith((t) => { if (t.exception == null) { dosomeui(t.result); }else{ //handle exception message } } );

javascript - define the area clickable to move a div -

okay wondering how make can move div using child tag eg image. http://jsfiddle.net/code_cookies/5e75n/ $(".drag").draggable({ containment: "#draggable"}); in example made can move box clicking on @ point , wondering if restrict have click image move parent div? thanks in advance sure, add handle: "img" jsfiddle example $(".drag").draggable({ containment: "#draggable", handle: "img" }); see: http://api.jqueryui.com/draggable/#option-handle

c++ - OpenGL vector graphics rendering performance on mobile devices -

it advised not use vector graphics in mobile games, or pre-rasterize them - performance. why that? though opengl @ least @ drawing lines / triangles rendering images on screen... rasterizing them caches them images less overhead takes place vs calculating every coordinate vector , drawing (more draw cycles , more cpu usage). drawing vector that, drawing arcs point point on every single call vs displaying image @ coordinate cached image file.

c# - Displaying an image in a ListView from a Access database -

i using listviews in order display data access table in visual studio. i have image saved in database ole object. when run website in visual studio instead of seeing image output is system.byte[] my question how image display instead of text? connection working other data being shown. <asp:listview id="listview1" runat="server" datasourceid="accessdatasource1" groupitemcount="3" onselectedindexchanged="listview1_selectedindexchanged"> <alternatingitemtemplate> <td runat="server" style="background-color:#fff8dc;"> reqplate: <asp:label id="reqplatelabel" runat="server" text='<%# eval("reqplate") %>' /> <br />carname: <asp:label id="carnamelabel" runat="server" text='<%# eval("carname") %>' /> ...

python - Render form errors with the label rather than field name -

i list form errors using {{ form.errors }} in template. produces list of form fields , nested lists of errors each field. however, literal name of field used. generated html error in particular field might this. <ul class="errorlist"> <li> target_date_mdcy <ul class="errorlist"> <li>this field required.</li> </ul> </li> </ul> i use errorlist feature, it's nice , easy. however, want use label ("target date", say) rather field name. actually, can't think of case in want field name displaying user of webpage. there way use rendered error list field label? i don't see simple way this. the errors attribute of form returns errordict , class defined in django.forms.utils - it's subclass of dict knows produce ul rendering of unicode representation. keys field names, , that's important maintain other behavior. provides no easy ...

Paypal rest api and Apps Script -

i'm trying use rest api of paypal. how can translate curl request token using urlfetchapp of apps script? request sample curl https://api.sandbox.paypal.com/v1/oauth2/token \ -h "accept: application/json" \ -h "accept-language: en_us" \ -u "eoj2s-z6oon_le_ks1d75wsz6y0sfdvsy9183ivxfyzp:eclusmeuk8e9ihi7zdvlf5cz6y0sfdvsy9183ivxfyzp" \ -d "grant_type=client_credentials" thank in advance function trypaypal() { var tokenendpoint = "https://api.sandbox.paypal.com/v1/oauth2/token"; var head = { 'authorization':"basic "+ utilities.base64encode("eoj2s-z6oon_le_ks1d75wsz6y0sfdvsy9183ivxfyzp:eclusmeuk8e9ihi7zdvlf5cz6y0sfdvsy9183ivxfyzp"), 'accept': 'application/json', 'content-type': 'application/x-www-form-urlencoded' } var postpayload = { "grant_type" : "client_credentials" } var params ...

gradle - Getting File permissions error when exploding the cucumber-jvm.jar -

i trying create executable jar functional tests exploding dependency jars, using gradle task of type jar. cucumber-1.1.3 1 of dependencies. using gradle 1.1 jvm 1.6 (company standards) i following error : org.gradle.api.gradleexception: not expand zip '/dev/shm/263985/transformer/caches/artifacts-14/filestore/info.cukes/cucumber-java/1.1.3/jar/4b389fbe494942b319518d27ae38571f477967f6/cucumber-java-1.1.3.jar'. @ org.gradle.api.internal.file.archive.zipfiletree.visit(zipfiletree.java:97) @ org.gradle.api.internal.file.collections.filetreeadapter.visit(filetreeadapter.java:96) @ org.gradle.api.internal.file.abstractfiletree$filteredfiletree.visit(abstractfiletree.java:136) @ org.gradle.api.internal.file.abstractfiletree.getfiles(abstractfiletree.java:37) @ org.gradle.api.internal.file.compositefilecollection.getfiles(compositefilecollection.java:39) @ org.gradle.api.internal.file.abstractfilecollection.iterator(abstractfilecollectio...