Posts

Showing posts from June, 2012

asp.net mvc - Set radio button checked item from ASP MVC 3 controller -

below group of radio buttons appear on view. able retrieve selected item via simple code string criteria = filter["criteria"]; however not know how retain selected item. once controller posts view default radio button selected. <form method="post"> @html.textbox("searchvalue", viewbag.currentfilter string, new { placeholder = "search" }) <input type="image" src="@url.content("~/content/images/filter.bmp")" alt="filter" style="padding-top: 0px;" /> <span class="error" style="clear: both;"> @viewbag.errormessage </span> <a href="#" style="padding-left: 30px;"></a> <br /> <br /> <input type="radio" name="criteria" id="bankname" value="bankname" checked="true"/...

c# - Serialport writeline textbox error -

i use virtual com ports testing program. want serial write com8 , serial read com9. when want write values textbox1, error: ioexception unhandled (the parameter incorrect) how rid of this? using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.io.ports; namespace flowerpod_user_interface { public partial class form1 : form { public form1() { initializecomponent(); // show list of valid com ports foreach (string s in system.io.ports.serialport.getportnames()) { combobox1.items.add(s); } } private void textbox1_textchanged(object sender, eventargs e) { } private void form1_load(object sender, eventargs e) { } private void button1_click(obje...

Opening a TCL gui within Java code -

i have tcl file uses tcl's bwidget package i've been using gui program. want able load gui separate java program. i've looked jacl , swank, don't seem want. i've tried following jacl it's unable evaluate file. while debugging, can see completes parsing tcl file, throws exception while parsing through bwidget package tcl files. here's java code: interp interp = new interp(); try { interp.evalfile("c:\\ctp\\tcl\\luxonctp32.tcl"); } catch (tclexception ex) { int code = ex.getcompletioncode(); system.err.println("command returned bad error code: " + code); } { interp.dispose(); } any ideas on how can accomplish want do? possible? tcl can not display gui. uses plugin called tk that. in c reference implementation of tcl tk well. tk has not been ported java, tcl has. you can not use jacl display tk widgets, tclblend that, because tclblend uses c reference implementation of tcl. means user needs working tc...

java - no variables in the documentation for class -

Image
i've got simple class import java.io.printstream; /** * calculate roots of polynom ax^2 + bx + c = 0 * @author xxxx aka xxx * @version 1.0 17.04.2013 */ public class lab1_1 { /** * quadratic coefficient */ private float a; /** * linear coefficient */ private float b; /** * free term */ private float c; /** * * constructor lab1_1 * * @param {@link lab1_1#a} * @param b {@link lab1_1#b} * @param c {@link lab1_1#c} */ public lab1_1(float a, float b, float c) { this.a = a; this.b = b; this.c = c; } /** * calculate roots of quadratic equation * * @return returns string representation of roots of polynom * @throws arithmeticexception in case of complex number result */ public string calculate() { float discriminant = b * b - 4 * * c; if (discriminant > 0) { double result1 = (-b + math.sqrt(discriminant)) / (2 * a); double result2 = (-b - math.sqrt(discriminant)) / (2 * a); return "x1 = " + result1 + ";" + ...

c# - Automated file upload with additional model -

Image
i have following mvc 4 action [acceptverbs(httpverbs.post)] public actionresult sendattachment(someviewmodel model, httppostedfilebase attachment) { // implementation goes here } now want upload file console app controller action using httpwebrequest api can't figure out how set both model , file data in post, matches controller. any hints on that? i made changes function ( upload files httpwebrequest (multipart/form-data) ) problem. worked me. try this: server side [httppost] public actionresult sendattachment(someviewmodel model, httppostedfilebase attachment) { return view(); } public class someviewmodel { public int id { get; set; } public string name { get; set; } } in console app : static void main(string[] args) { uploaddata( "http://dissertation.lan/home/sendattachment", new namevaluecollection() { {"attachment...

Facebook scores cant be deleted due to removed permission? -

again little question considering facebook scores. app-admin able set , delete scores users app-accesstoken, lets in case of cheating. tried around little , came notice, once user removes "publish_actions" permission, seems able block access me, app-admin. returns error considering missing permission when try post / delete score app-accesstoken. i must doing wrong here, right?! cheater not away simple or he?!?! cheating way top of leaderboard , removing "publish_actions" permission via app settings? xd

.htaccess - Disable access to addon domain through maindomain.com/addondomainfolder -

i want disable access folder of addon domain using .htaccess can't seem figure out. my folder structure this: root/maindomain (www.maindomain.com/maindomain) root/addondomain (www.addondomain.com) i want disable access addon domain through www.maindomain.com/addondomain url. how this? my htaccess file in root directory: rewriteengine on rewritecond %{http_host} ^(www\.)?swen\.me.uk$ [nc] rewriterule ^/?creepypastaindex http://www.creepypastaindex.com/ [l,r] rewriteengine on rewritecond %{http_host} ^(www\.)?swen.me.uk$ rewritecond %{request_uri} !^/swen/ rewriterule ^(.*)$ /swen/$1 this should do. have escape both dots. rewriteengine on rewritecond %{http_host} ^(www.)?swen\.me\.uk$ [nc] rewritecond %{request_uri} ^/creepypastaindex/(.*)$ rewriterule ^(.*)$ - [l,r=404] source

multithreading - Does Intel SFENCE have release semantics? -

it seems accepted definition of acquire , release semantics this: (quoted http://msdn.microsoft.com/en-us/library/windows/hardware/ff540496(v=vs.85).aspx ) an operation has acquire semantics if other processors see effect before subsequent operation's effect. operation has release semantics if other processors see every preceding operation's effect before effect of operation itself. i have briefly read existence of half memory barriers , supposedly come in flavor of acquire barriers , release barriers following same semantics described above. looking real example of hardware instructions came across sfence. , blog ( http://peeterjoot.wordpress.com/2009/12/04/intel-memory-ordering-fence-instructions-and-atomic-operations/ ) says form of release fence/barrier: intel provides bidirectional fence instruction mfence, acquire fence lfence, , release fence sfence. however reading definition of sfence, doesn't seem provide release semantics in doesn...

Establishing WebSocket connection with Java server and Javascript client -

i'm trying implement websockets javascript-based client , java-based server. think i've done correct steps, unknown reason, can't establish connection both. when server socket receives connection, handles form websocket-accept response, , sends client, connection in client socket instantly close, weird there's no handshake problem. does have idea might problem? here's server code implemented in java: package server; import java.io.ioexception; import java.net.serversocket; import java.net.socket; import java.util.arraylist; import java.util.list; import server.message.message; import server.message.speakmessage; public class server implements connectionlistener { private static final int port = 1509; private messagedispatcher dispatcher = new messagedispatcher(); private list<connectionmanager> clients = new arraylist<>(); public void listen() { try (serversocket server = new serversocket(port)) { syst...

javascript - Node.js server/client module confusion, EventEmitter woes -

i'm trying write library can used in node.js or on client-side. i'm running two issues: i can't seem export correctly. i'm using this doc . myclass = exports? , exports or @myclass = {} doesn't seem work, split files now. the library emits events; i'm hoping can clarify confusion on how more simply. follow me below :) node.js: library: {eventemitter} = require 'events' class myclass extends eventemitter emitsomething: (key, data) -> @emit key, data module.exports = myclass required: myclass = require 'myclass' myclass = new myclass() myclass.on 'someevent', (data) -> console.log data # bare not using `emit` directly. data = key: 'value' myclass.emitsomething 'someevent', data client-side eventemitter included. class myclass extends eventemitter emitsomething: (key, data) -> @trigger key, [ data ] # that's stupid. the library file inclu...

java - Is this the correct way to access the objects -

i'm trying list of objects jcombo box it suggested private jcombobox<object> levelcombobox; levelcombobox = new jcombobox<object>(loglevel); levelcombobox.setenabled(false); but i'm confused array list of objects or reference reference object class though? thanks jcombobox<object> jcombobox can filled object s. <object> part called generic , there tutorial here .

javascript function won't run onchange -

window.onload = init; function init(){ var allselect = document.getelementsbytagname("option"); (var = 0; < allselect.length; i++){ allselect[i].onchange = loadlink; } } function loadlink(){ alert("test"); } so i'm working on problem class , functions incredibly simple. replaced code needed simple alert because tracking break point point doesn't run loadlink() function. allselect populated , have onchange value specified code in {}. i have tried putting html element hand , still doesn't work. any ideas? i'm running locally on computer both ie , chrome if cares know. ahead of time. the onchange event belongs on select element, not option elements. so: window.onload = init; function init(){ var allselect = document.getelementsbytagname("select"); (var = 0; < allselect.length; i++){ allselect[i].onchange = loadlink; } } function loadlink(){ alert("test")...

sql server - sql - multiple layers of correlated subqueries -

i have table a, b , c i want return entries in table not exist in table b , of list not exist in table c. select * table_a not exists (select 1 table_b b a.id = b.id) this gives me first result of entries in not in b. want entries of result not in c. i tried flavours of: select * table_a not exists (select 1 table_b b a.id = b.id) , not exists (select 1 table_c c a.id = c.id) but isnt correct logic. if there way store results first query , select * result not existent in table c. i'm not sure how that. appreciate help. you have 2 where clauses in (the external part of) second query. not valid sql. if remove it, should work expected: select * table_a not exists (select 1 table_b b a.id = b.id) , not exists (select 1 table_c c -- removed a.id = c.id) ; tested in sql-fiddle (thnx @alexander)

Read from a file. C++ -

so when program starts, attempts read list of products file. if file not exist displays error , continue on. problem im having when displays error, doesnt continue on while loop ifstream input; input.open("data.txt"); if (input.fail()) { cout << "\n data file not found \n"; } listitemtype data; input >> data.productname; while(( !input.eof())) { input >> data.category; input >> data.productprice; addproduct(head, data); input >> data.productname; } input.close(); it's not identical functionality, it's better move towards like: if (std::ifstream input("data.txt")) { listitemtype data; while (input >> data.productname >> data.category >> data.productprice >> data.productname) addproduct(head, data); if (!input.eof()) std::cerr << "error parsing input file...

c# - server side click event doesn't fire on LinkButton when PostBackUrl property has been set to another page -

i put linkbutton control named "logout" on webpage vs 2010. when users press "logout" linkbutton , want system 2 things. first trigger server side click event things such clear session variables etc.. second redirect user page such logon.aspx so wrote following codes protected void page_load(object sender, eventargs e) { if (!this.ispostback) { linkbutton1.postbackurl = "logon.aspx"; } } protected void linkbutton1_click(object sender, eventargs e) { session.abandon(); .... .... } but when programs runs , user clicks linkbutton.the codes of linkbutton1_click never executed, because page has been redirect logon.aspx page , never linkbutton1_click() my question why linkbutton1 offers postbackurl property , server-side click event , seems don't cooperate ~ this because setting postbackurl saying when button clicked want post logon.aspx page rather posting itself. since posting logon.aspx never trigge...

google app engine - Can we do anything about a TransientError or does it indicate a server side issue? -

we see occasional (~100 per day) transienterror errors when adding tasks queue in appengine. there can handle these or code more defensively avoid them? an exampe of error receive shown below: file "/python27_runtime/python27_lib/versions/1/google/appengine/ext/deferred/deferred.py", line 268, in defer return task.add(queue, transactional=transactional) file "/python27_runtime/python27_lib/versions/1/google/appengine/api/taskqueue/taskqueue.py", line 1132, in add return self.add_async(queue_name, transactional).get_result() file "/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result return self.__get_result_hook(self) file "/python27_runtime/python27_lib/versions/1/google/appengine/api/taskqueue/taskqueue.py", line 1927, in resulthook raise _translateerror(e.application_error, e.error_detail) transienterror transienterror indicates server-side error ...

iphone - How to detect "would like to use your current location" choose action? -

as know cllocationmanager can used current location permission of alert: "myappname" use current location" | "don't allow" | "allow". how detect choose action after user choose "don't allow" or "allow"? appreciated! -(void)locationmanager:(cllocationmanager *)manager didchangeauthorizationstatus: (clauthorizationstatus)status { if (status == kclauthorizationstatusdenied) { // don't allow } else if (status == kclauthorizationstatusauthorized) { //allow } } implement cllocationmanagerdelegate , use delegate method

java - Implementing 2 Seekbars - Both Modify The Exact Same Text? -

i'm attempting implement 2nd seekbar odd reason they're both modifying same text when seekbars moved. i've looked source code , down , can't identify issue (i know i'm overlooking simple - can spot it?) java: private long rowid; private edittext nameet; private edittext capet; private edittext codeet; private timepicker timeet; private textview ssidtextview; private textview sbtv; private seekbar bar; private seekbar bar2; private seekbar bar; private seekbar bar2; private textview textprogress,textaction; private textview textprogress2,textaction2; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.add_country); bar = (seekbar)findviewbyid(r.id.seekbar1); bar.setonseekbarchangelistener(this); bar2 = (seekbar)findviewbyid(r.id.seekbar2); bar2.setonseekbarcha...

c# - some issue in this linq to xml query, while getting value of certain attribute in an element -

i have app.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appsettings> <add key="domain" value="localhost"/> <add key="hostname" value="hostpc"/> </appsettings> </configuration> i using linq xml query value of key named "domain". instance, when want value of key named "domain" should give me "localhost" : var domain = (from appnode in xmlelement.elements("add") appnode.attribute("key").value == "domain" select appnode.attribute("value")); but query missing can identify missing or how can made better, doesn't work @ moment. note: want use linq xml i used app.config file content is, write small console based application following code: class program { static void main(string[] args) { // create...

oop - PHP object scope -

can explain me concept of object scope in php? i'm new objects in php , reason ask because able create object within if statement, , access object outside scope of if statement. example: //only create object if condition met if ($conditiontrue){ $mybook = new book('php dummies','softcopy'); } $mybook.read(); i have though generate error didn't. some background question i trying figure out how determine constructor call depending on condition met. conceivable way introduce if statement doing that, thought impose issue of scope didn't , i'm wondering why.. in php, if doesn't have own scope. yes, if define inside if statement or inside block, available if defined outside (assuming, of course, code inside block or inside if statement gets run).for more php scope, read variable scope manual page.

Tic Tac Toe with recursion (Python) -

i can't figure out how tie these functions hard ai, in can never lose. i'm supposed using recursion in form or fasion , these function names , contracts pre-written, filled in actual definition. googling later, can't find relates. ideas fellas? """ state s2 *successor* of state s1 if s2 can the next state after s1 in legal game of tic tac toe. safe: state -> bool successor: state x state -> bool 1. if s over, s safe if 'x' not have 3 in row in s. 2. if o's move in s, s safe iff @ least 1 successor of s safe. 3. if x's move in s, s safe iff successors of s safe. *statelist* list of states. """ # safe: state-> bool # # state s *safe* if player 'o' can force win or tie s. def safe(s): if over(s): return not threeinrow('x',s) if turn(s)=='o': return somesafesuccessor(s) if turn(s)=='x': return allsafesuccessors(s) def threeinrow(p,s): if p == 'x': ...

jquery validation form doesnt work -

i have registration form field requirements in form written in php , i'm trying add validation plugin it, plugin doesn't work, i'm not getting errors. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"> </script> <script src="scripts/jquery.validate.js"></script> <script> $(function(){ $("#regform").validate({ rules: { brukernavn: { required: true, minlength:3, maxlength:10 }, passord: { required: true, minlength:3, maxlength:10 }, bekreft_pass: { required: true, minlength:3, maxlength:10 }, e_post: { required: true, email: true }, bekreft_epost { required: true, email: true }, messages: { } } }...

performance - Multitasking network operations android -

i want know best decision carrying out several network tasks simultaneously . scenario follows :- have several words on listview ( maximum 20 ). want search of these words simultaneously while displaying "loading" progress dialog on screen . , want operation complete fast possible . i thinking 2 things :- i. spawning several asynctasks every request . ii. using service . please , me make decision . you can use executor running multitple tasks. http://developer.android.com/reference/java/util/concurrent/executor.html . also check executorservice in below link http://developer.android.com/reference/java/util/concurrent/executorservice.html an alternative asynctask robospice. runs asynchronously.canhandle multiple spice requests. updates ui on ui thread. more details check below link https://github.com/octo-online/robospice edit: http://developer.android.com/reference/android/os/asynctask.html check order of execution topic quote above ...

iphone - Click a imageview popup a view showing the original image -

i have loaded several images table view. image has been resized, , want when user tap on imageview, pops view showing original image size, , when user click again anywhere, view disappears , tableview. code loads image this: - (uitableviewcell *)tableview:(uitableview *)atableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; searchcell *cell = (searchcell *)[atableview dequeuereusablecellwithidentifier:cellidentifier]; if (!cell) { cell = [[[nsbundle mainbundle] loadnibnamed:@"searchcell" owner:self options:nil] objectatindex:0]; } cell.selectionstyle = uitableviewcellselectionstylenone; cell.name.text = [[self.brands objectatindex:indexpath.row] objectforkey:@"name"]; __weak searchcell *weakcell = cell; [cell.leftimageview setimagewithurlrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:[nsstring stringwithformat:@"http://s-57130.gotocdn.com/%@...

php - Regular Expression first 2 characters either alphabetic or numeric but not combination of both -

i need regular expression in php validate string like: "ab345678" or "12345678". is, eight(8) letter string containing first 2 letters alphabetic or numeric, not combination of both, , remaining 6 letters numeric. tried own it's not working. here code: /^[0-9a-za-z]{2}[0-9]{6}$/ i'm new regex hence need here. thanks in advance. you can this ^([a-za-z]{2}|\d{2})\d{6}$

sorting - Human or Natural sort for digits in the middle of string? -

i know natural sorting (or human sorting?) quite on sorting sequence of strings digits. , recently, applied on generated (rendered) image sequences. result looks following: ooxx_1.jpg ooxx_2.jpg ... ooxx_11.jpg ... what if there suffix characters after digits? sorting result this: ooxx_1.jpg ooxx_1_depth.jpg ooxx_2.jpg ooxx_2_depth.jpg ... while looking following sorted result: ooxx_1.jpg ooxx_2.jpg ... ooxx_1_depth.jpg ooxx_2_depth.jpg ... any idea?

asp.net mvc - Jquery .append() & Html.Helper -

is there way put html.helper inside .append() function. success: function (html) { $("#resultaatsgebied").append(' <li>@html.textboxfor(item => model.rg1)<ul id="concretisering" class="sublist"><li>@html.textboxfor(item => model.rg1sub1)</li></ul>@html.actionlink("+", "index", null, new { id = "addconcretisering" })</li>'); } this works, string, not control edit: this works now, actionlink generated not. have same actionlink default in view, , there works. generated one, think not execute ajax call? if code in razor view, can put brackets razor code : success: function (html) { $("#resultaatsgebied").append(' <li>@(html.textboxfor(item => model.rg1))<ul id="concretisering" class="sublist"><li>@(html.textboxfor(item => model.rg1sub1))</li></ul>@(html.actionlink("+", "...

jquery - Marker not centering in iframe for google map -

i have bit strange requirement of open google map in iframe. have address use pass , convert google map. trouble size of iframe 200*200 marker not getting centered. , other problem marker infowindow gets poppedup after few seconds makes marker out of frame boundry.and marker moves centere. code this. $(document).ready(function(){ $("#map_address").each(function(){ var embed ='<iframe class="map_google" width="200" scrolling="no" height="200" frameborder="0" src="https:/maps.google.com/maps?&q=ahmedabad&output=embed" marginwidth="0" marginheight="0">'; $(this).html(embed); }); }); i want close marker info window , make marker cenetered. appreciated. this created use of http://jsbin.com/welcome/68407/edit add iwloc -parameter without value iframe-url: http://jsbin.com/emoyup/1/edit description of url-parameters: http://www.seomoz.org/ugc/eve...

c# - WCF trace log override old messages -

i limit number of log files wcf trace writing. in order so, used maxmessagestolog attribute. happen when gets limit, let 2000 messages? stop writing or override old messages? i override old message. how i'm doing it? best practice? thanks you can implement circular trace listener reach want. can set maximum file size trace log can get. after reaching old entries overridden. see sample , explanation on msdn

netbeans 7 - Apache Velocity Initialised error -

i have maven project built using netbeans 7.2 , runs on glassfish 3. thought try luck @ upgraded netbeans 7.2 7.3 yesterday transition has caused error apache velocity. if run in 7.2 works fine, if run in 7.3 following errors severe: there unspecified exception whilst sending email java.lang.runtimeexception: velocity not initialized! @ org.apache.velocity.runtime.runtimeinstance.requireinitialization(runtimeinstance.java:307) @ org.apache.velocity.runtime.runtimeinstance.parse(runtimeinstance.java:1196) @ org.apache.velocity.runtime.runtimeinstance.parse(runtimeinstance.java:1181) @ org.apache.velocity.runtime.runtimeinstance.evaluate(runtimeinstance.java:1297) @ org.apache.velocity.runtime.runtimeinstance.evaluate(runtimeinstance.java:1265) @ org.apache.velocity.app.velocity.evaluate(velocity.java:180) @ tv.tarka.dastraxweb.integration.email.velocity.combine(velocity.java:111) @ tv.tarka.dastraxweb.integration.email.emailconstructor.build(emailco...

c# - Get dynamic OrderBy in LINQ -

this question has answer here: dynamically sorting linq 9 answers i using datatables in quite few pages in asp.net mvc 3 site. use server side paging , want implement sorting based on column headers. datatables comes isortcol_0 int value of column clicked. i did not approach query end like: if(isortcol_0 == 0) { // query // oderby(x => x.carname) } then repeated each column (plus else clause on each order descending). have changed approach , pass column name server. i have come following: expression<func<vw_car, string>> sortexpression1 = null; expression<func<vw_car, int>> sortexpression2 = null; switch(columntosort) { case "invoiceno": sortexpression1 = x => x.carno; break; case "clientnumber": sortexpression1 = x => x.forename; break; case "clientname": sortexpress...

c# - Accessing structure array data of form1 in form2 -

here question. i've custom structure follows in form1. public struct messageinfo { public int messageposition; public string userid; public string putdatetime; public string id; public string messagelength; public string messagedata; } i've multiple structure data, i'm storing in array of structures below public messageinfo[] messages; and i'm storing multiple data of each structure in array. now, want access structure array, has data in form2. advise how do this? i tried below in form1, i'm unable access data in form2. public messageinfo[] getmessageinfo { { return messages;} } i following exception. cannot implicitly convert type 'form1.messageinfo[]' 'form2.messageinfo[]' thanks in advance. regards, vinay your exception telling have defined struct in both forms . need define struct messageinfo in one place , refer same both forms. ...

c++ - First CppUnit Test: undefined reference to CppUnit::SourceLine::SourceLine -

i trying use cppunit test first time. when try compile testing code get: testing.cpp:(.text+0xca): undefined reference `cppunit::sourceline::sourceline(std::basic_string, std::allocator > const&, int)' and many other error messages. i guess reason compiler not know unittest library is. here found person asking same question. try use recommendation answers of linked questions still not work. when try c++ -lunittest++ testing.cpp get: /usr/bin/ld: cannot find -lunittest++ collect2: ld gives 1 end-status in make files used others , work see: ldlibs := -lcppunit . tried c++ -lcppunit++ testing.cpp same error message -lunittest . does know how can find location of unittest library , pass information compiler? this how have managed compile code: g++ testing.cpp -lcppunit

multithreading - C# Close program/form with a Thread -

okay have c# form couple of classes. in 1 of these classes i'm running thread check if external program running. when external program isn't running want program close. i'm bit of novice me obvious answer use form.close(). not sure if possible access function subclass or different thread! so questions are: (how) possible close form different thread in other class? more important best practice? you can use control.invokerequired , control.begininvoke() in order call method on ui thread. for example (this method has inside form class itself): public void closeform() { if (this.invokerequired) { this.begininvoke(new action(this.close)); } else { this.close(); } } this safe call thread.

How to get the values from the Json using Jquery -

hi i'm new jquery , don't know how use json data. have json coming response. success function is success: function(resp) { var x = json.stringify(resp); alert(x); } alert having following json {"xyz":{"abc":[{"action":"fail","result":"xxx"},{"action":"pass","resut":"yyy"}]}} i want action value alone. how can value x variable , how can utilize value in html. in advance. when use json.stringify() turning string, want object access data. try this: success: function(resp) { alert(resp.xyz.abc[0].action); var x = resp.xyz.abc[0].action // use value in html later on } if returned string (i can't tell @ point), can turn object (as long valid json) using $.parsejson()

Scroll a image on a set path with javascript HTML5 and CSS3 -

i have background image, map, road. road not straight, has curves on it.i want similar attached link, said, on road not straight. tried existing scripts, jquery scroll path, based on background rotation around object want scroll, , don't need way. if can give me suggestions on how make happen, appreciate. thanks! maybe you http://forum.jquery.com/topic/new-plugin-jquery-crspline-animates-elements-smoothly-along-arbitrary-length-sequences-of-waypoints-in-2d there set positions , element follow

firefox addon - Failing to load overlay in xul application -

i have stand-alone xulrunner application, needs extension work properly. after install xpi file, jsconsole reporting me error "failed load overlay chrome://my-client/content/overlays/index.xul" . means chrome.manifest file recognized, path overlay not good. my chrome.manifest file in xpi content my-client file:chrome// overlay chrome://app/content/lib/conf.xul chrome://my-client/content/overlays/index.xul id of extension in install.rdf file same id in application.ini file of main application. have enabled extension manager [xre] enableextensionmanager=1 and have extension.js file in prefs. the weird part when symlink folder of my-client extension extension folder in main application works expect. occurs when install xpi through extension manager. i figured out. problem forgot put line of code in install.rdf file <em:unpack>true</em:unpack> documentation here: https://developer.mozilla.org/en/docs/install_manifests#unpack

javascript - cross domain access-control-allow-origin error -

i trying access web service getting cross domain access-control-allow-origin error $.getjson("https://beevou.net/oauth/token?grant_type=password&username="+user+ "&password="+pass+"&client_id=ntezzgu5mthlndq0ywm0&client_secret=45d1002085db5dca4dbdbc5f83731 d19662cb265", function(data) { console.log(json.stringify(data)); }); this url. cant change @ web service side. let me know solution rid of problem thanks in advance basically, if can't jsonp access or obtain server set necessary cors headers, possible solutions on server : issue request on server , serve result page set proxy on server let browser think comes same origin (this easiest solution, example mod_proxy if server apache based)

android - How to get onClickListener() event on custom actionbar -

Image
i'm developing application in have onclick() event on click of actionbar custom view. far i'm able achieve following layout. here code achieving this: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); getactionbar().setdisplayhomeasupenabled(true); getactionbar().sethomebuttonenabled(true); getactionbar().setcustomview(r.layout.custom_image_button); getactionbar().setdisplayoptions( actionbar.display_show_home | actionbar.display_show_custom); } @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case android.r.id.home: toast.maketext(getapplicationcontext(), "clicked on actionbar", toast.length_short).show(); default: return super.onoptionsitemselected(item); } } here custom_image_button layout: <?xml version="1.0" encoding...

node.js - Mongodb Find for Retrieving the Closest Larger / Closest Smaller Values from a List when there is No Exact Match? -

i have collection filed memory values (1,7,3.5,5) etc user query parameter memory contains 2, query result should (1,3.5) nearest matching value. for more information please check https://gist.github.com/anandof86/5433086

java - Grouplayout is a bit messed up -

Image
there problem in grouplayout of following code, kindly me figure out i have uploaded output file, not sure if problem alignment. kingly have , me figure out. package javaapplication1; import java.awt.borderlayout; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.net.inetaddress; import javax.swing.*; import javax.swing.grouplayout.alignment; import javax.swing.jcheckbox; import javax.swing.jcomponent; import javax.swing.jframe; public class progress extends jframe implements actionlistener { static jframe frame; public jlabel clientip; jtextfield ip; jlabel clientpassword; jtextfield pass; jlabel videoname; jtextfield vname; jlabel perccomplete; jtextfield percent; jlabel packetssent; jtextfield pacsent; jlabel connectiontype; jtextfield conntype; jlabel noofvideossent; jtextfield videosend; jbutton disconnect; jbutton refresh; jbutton o...