Posts

Showing posts from June, 2012

Java: looking for the fastest way to check String for presence of Unicode chars in certain range -

i need implement crude language identification algorithm. in world, there 2 languages: english , not-english. have arraylist , need determine if each string in english or other language has unicode chars in range. want check each string against range using type of "presence" test. if passes test, string not english, otherwise it's english. want try 2 type of tests: test-any: if char in string falls within range, string passes test test-all: if chars in string fall within range, string passes test since array might long, need implement efficiently. fastest way of doing in java? thx update: checking non-english looking @ specific range of unicodes rather checking whether characters ascii, in part take care of "resume" problem mentioned below. trying figure out whether java provides classes/methods implement test-any or test-all (or similar test) efficiently possible. in other words, trying avoid reinventing wheel if wheel invented before me better ...

floating point - Converting float to hex results in more digits than expected in C#? -

i'm going convert c# floating point number 2 bytes, instance have number 12.4544 , should 0x4147, or 0x41474539, i've used bitconverter.doubletoint64, gives me weird, how can 0x4147? i'm creating modbus slave, , should send each float number 2 bytes thanks edit: oh dear oh dear, missed this, short answer: use bitconverter.getbytes , pass float, shown here. the long answer: bitconverter doesn't support single precision floats, double s. you'll have create c# "union", so: [structlayout(layoutkind.explicit)] class floater { [fieldoffset(0)] public float thefloat; [fieldoffset(0)] public int theint; } put float in thefloat , @ theint

Add Text or Label to a Silverlight Arc -

Image
hi possible text or label shape object in silverlight arc? created chart compose of multiple arcs, need set label on top of arc identify data is. you can use pathlistbox if want place text on arc. see text along curvature path circular or arc in silverlight alternatively, can position own textblock object. use polar rectangular conversion http://www.teacherschoice.com.au/maths_library/coordinates/polar_-_rectangular_conversion.htm for instance if center of circle 10,20 , radius 30 , angle want place textblock 45, double degreetoradian(double degree) { return math.pi / 180 * degree; } x = 30 * math.cos(degreetoradian(45)) + 10 y = 30 * math.sin(degreetoradian(45)) + 20

jquery animation fixed position -

bellow code contact form expands user clicks it $(document).bind('click', function() { $('div#contactable_inner').animate({"marginleft": "-=387px"}, "slow") }); for each click, element moves -387px. want move -387px 1st click. next clicks, should not animate. $(document).one('click', function() { $('div#contactable_inner').animate({"marginleft": "-=387px"}, "slow") }); .one() fires 1 time. read .one()

javascript - Jquery mouse events don't fire -

i have strange problem. example code works [here][1] quiet fine, have same code in aptana studio editor , when try in chrome or eclipse browser events don't fire. can't imagine what's problem, because it's same code ... html <!doctype html> <html> <head> <title>orderscreen</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script src="js/script.js" type="text/javascript"></script> </head> <body> <a href="">test</a> </body> </html> jquery $("a").mouseup(function() { cleartimeout(presstimer); // clear timeout return false; }).mousedown(function() { // set timeout presstimer = window.settimeout(function() { alert("hcbdhaf") }, 1000); return false; }).click(function() { alert...

c# - How do I return a string from WCF Workflow (WF4) when invoked by a Interface with ChannelFactory? -

if have workflow hosted (wf4 + wcf) , running in iis implementing following interface: [servicecontract] public interface imessageservice { [operationcontract] string sendmessage(string message); } (using recieveactivity , sendreply system.servicemodel.activities ) and invoke this: var channel = new channelfactory<imessageservice>().createchannel(<init params>); string answer = channel.sendmessage("testmessage"); then answer null. if consume workflow through wcftestclient can see there returned xml object. how can make workflow return string populate answer ? (i'd avoid "add servicereference , return lot of xml-approach") you need [return] attribute specify how find result. in sendreplytoreceive can choose between sending message or parameters . in experience, need choose parameters send one. assuming give return parameter name "result" need attribute on interface contract: [re...

javascript - Why is my ExtJS form not submitting? -

i'm using extjs pop window simple edit form, on pressing submit button, no xhr call made , this.form.el.dom undefined error reported in console. here's code: var mynamespace = new function(){ var editform, editwindow; this.init = function(){ ext.ajax.request({ url: '/server/action.php', success: function(result){ console.log('ajax working ok'); // } }); editform = new ext.form.formpanel({ width:450, autoheight: true, header : false, items: [{ name: 'color', fieldlabel: 'color', xtype: 'textfield', value: 'blue' }], buttons: [{ text:"submit", scope: this, // tried without this, handler: function(){ // editform.getform().g...

vb.net - Threading Exception: The number of WaitHandles must be less than or equal to 64 -

the title make easy find others having error. i'm new threading, giving me heck. i'm getting runtime error crashed cassini. code i'm maintaining developed website project in vs 2003 , converted vs 2008 website project. important info: the number of objects in manualevents array 128 in case. products array of strings need support .net 2.0 for each product string in products if not product.trim().toupper().endswith("obsolete") calls += 1 end if next dim results(calls - 1) downloadresults 'dim manualevents(calls - 1) threading.manualresetevent '128 objects in case. dim manualevents(0) threading.manualresetevent manualevents(0) = new threading.manualresetevent(false) 'note: don't think work because not seen here, ' code being used populate , cache long list of products, ' each own category, etc. misunderstanding something? 'initialize results structures 'spawn background workers calls = 0 each prod...

c# - Create Regex search instance for each item in a string -

using visual.web.developer.2010.express; n00b here, how make search instance each line of text in string1 ? want search string2 in it's entirety see if contains 1 line of text in string1's search instance every item in string2 . both string1 , string2 have lines of text separated '\n' . there obvious way this? suggested regex, how incorporate regex find , print out matches in string2 each item in string1 .. there more few instances in string2 relate single item in string1 . a few in string1 : part_numbers 1017foo 1121bar etc... a few in string2 : supercola 51661017fooaindo dasudama c 89891121barblo5w etc... probably going figure out later, want them formatted this, fyi 1017foo matched: supercola 51661017fooaindo +another 1 1017foo matched+ etc... in advance! looking pointers in right direction, on methods should using your requirements written don't require regular expressions didn't use them. should able incorporate the...

android - Getting an exception when trying to tile ground in corona Sdk -

i'm using following code: ground1.x = ground1.x - 10 ground2.x = ground2.x - 10 ground3.x = ground3.x - 10 ground4.x = ground4.x - 10 ground5.x = ground5.x - 10 ground6.x = ground6.x - 10 ground7.x = ground7.x - 10 ground8.x = ground8.x - 10 if(ground1.x < ( 0 - 75 ) ) ground1:removeself() ground1 = ground2 ground2 = ground3 ground3 = ground4 ground4 = ground5 ground6 = ground7 ground7 = ground8 local num = math.random ( 1, 4 ) ground8 = display.newimage( group, "normalground"..num..".png", ground7.x + ground7.contentwidth/2, display.contentheight - 52 ) to animate moving ground. i'm using 8 tiles, ground1-ground8. code inside animate function called on "enterframe". what i'm trying detect when "ground1" has moved off left edge. then, i'm reassigning tile ground2 ground1, ground 3 ground2, ...

html - How to vertical align text within a list containing superscript? -

i want align text within list of items containing superscript such main text equally spaced vertically: html: <ul> <li>shape: rectangle</li> <li>length: 5m</li> <li>breadth: 3m</li> <li>area: 15m<sup>2</sup></li> <li>color: blue</li> </ul> i have tried tinkering display , height , line-height , vertical-align properties in css. none seems work. can me please? thanks. the cause of problem superscripts tend make line spacing uneven . setting line-height sufficiently large value 1.3 may help. in general, best avoid using sup element , construct own superscript element, using span , style creates superscript using relative positioning (which not affect line spacing, unlike vertical alignment caused sup ). in specific case, there simpler , better approach: instead of <sup>2</sup> , use &sup2; , or enter directly superscript 2 character “²” (on windows, can usin...

java - Struts2 Datetime picker displayformat issue -

a issue facing struts2.0.14's date time picker tag the problem struts2 datetimepicker displayformat attribute must set format of tomcat server date time format else submitted values null. change date time setting in win 7: rightclick bottom right corner date. click on change date & time settings change calender settings change regional settings set format english(india) repro steps change regional settings mentioned above & restart tomcat server. now not use displayformat or use display format other "dd/mm/yyyy" in date time picker submit struts2 form date 21/12/2012 in action submitted date set null now change regional setting english(us) , not use displayformat , restart server. values in action set submitted through form. expected result whatever system date time format date must parsed accordingly , made available in action. envi: java 6, struts2.0.14, firefix 12, tomcat 6. any workarounds or fixes through proper...

SVN Repository went down and .svn folder missing from the working copy -

my svn repository(server down few hours) went down. when svn users update working copies, '.svn' folder , files/folders synced repository went missing! how fix issue? or issue automatically resolved when server up? thanks, pandiarajan k as svn designed assure 1 can work offline, there seem 3 main possibilities: you using custom-made scripts screwed (this not pure conjecture - i've seen questions asked here in end resolved this). you mistaken. someone sabotaged system on purpose or mistake (this is pure conjecture). update after seeing last comment: makes (3) more - inadvertently deleted contents on head . not huge problem can revert changes.

JDBC driver authenticating to Oracle RDBMS using OpenID authentication? -

i wondering following: a jdbc driver authenticating user remote oracle rdbms using openid authentication. in instance oracle rdbms not see user's password. is possible setup oracle rdbms openid relying party? if so, versions can setup way? is there jdbc driver can act user agent can handle http(s) redirections , such inherent in openid authentication? thanks. ha @ oracle identity federation.

Making a pointer const C++ -

i have 2 vectors of node pointers. vector<node*> tmp; vector<node*> nodes; and tmp = nodes; if delete nodes , tmp deleted. is there way make tmp not modified whenever nodes modified, making const? i'm running dijkstra's. algorithm deleted nodes vector in determining shortest path. means can shortest path source destination once. if have graph 0--->1--->2--->3 i.e cgraph g; g.dijkstras(0); g.printshortestrouteto(2); g.dijktras(2); g.printshortestrouteto(3); <-- source still 0 since nodes deleted therefore path 0 2 class node { public: node(int id) : id(id), previous(null), distancefromstart(int_max) { nodes.push_back(this); } public: int id; node* previous; int distancefromstart; }; vector<node*> nodes; void cgraph::dijkstras(int source) { nodes[source]->distancefromstart = 0; (int = 0; < (int)nodes.size();...

Through php how can I close an active ssh connection which is created by php ssh2_connect? -

i created ssh connection using following code. $connection = ssh2_connect($masterip, 22); // authenticating remote server connection credentials ssh2_auth_password($connection, $user, $password); // secure ftp connection create directory if not exist $sftp = ssh2_sftp($connection); after completing operations need close $connection, $sftp. how can safely close connections. can use unset() function? yes, unset should suffice. in php, when resources go out of scope or become unset, automatically closed (they should anyway, unless extension breaks standard php model). (well, garage collected , closed when references resource destroyed)

php - Javascript encodeURIComponent issue on redirection -

i've search box works jquery , php, when type in search box jquery prepares query , redirects location. preparing query part works redirection part has problem encoded query. page automatically decodes encoded query before redirection. if type "test1 test2 test3" in search box, encodes query test1%20test2%20test3 encodeuricomponent(). now page redirect result.php+query. problem here page goes result.php?q=test1 test2 test3 instead of result.php?q=test1%20test2%20test3. here codes if($("#searchbox").val() != "") { var mq1 = encodeuricomponent($("#searchbox").val()); var query = "q="+mq1; } alert(query); if(query!="") location = "result.php?"+query; alert result q=test1%20test2%20test3 goes result.php?q=test1 test2 test3 edit: if use encodeuricomponent function redirection codes works good. alert(query); if(query!="") location = "result.php?"+encodeuricompone...

formbuilder - Issue in passing an argument to a jquery function -

i'm using this jquery plugin build forms. in order allow modification of form, i'm trying load json specified form, previuosly saved on database. i have use <script> $(function(){ $('#my-form-builder').formbuilder({ 'save_url': 'jsp/save.jsp', 'load_url': 'jsp/load.jsp', 'usejson' : true }); $(function() { $("#my-form-builder ul").sortable({opacity: 0.6, cursor:'move'}); }); }); </script> but need have 'load_url' query string, e.g. 'jsp/load.jsp?id=11', id identifier of form in database. the formbuilder function should called when user clicks on 'modify form' link or when div loads. i tried use: <script> $('modify').click(function(){ var url = 'jsp/load.jsp?id='.$(this).id; ...

ios - Conflict between a tableView index and NSArray objectAtIndex -

i'm implementing tableview (class listeexercice), showing list of customized cells. these cells defined in class (class exercicetablecell). in class listeexercice, create nsarray follow in viewdidload method: table1 = [nsarray arraywithobjects:@"exo1", @"exo2", nil]; table2 = [nsarray arraywithobjects:@"10:00", @"10:00", nil]; then in same class, in order display cells in table - (nsinteger)numberofsectionsintableview:(uitableview *)tableview - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection(nsinteger)section - (nsarray *)sectionindextitlesfortableview:(uitableview *)tableview the problem got happens ins following method, code in order display right cell located : - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *exercicetableidentifier = @...

couchdb offset: I get no results -

i make ajax request couchdbwith post method, giving list of keys of docs want retrieve. everything seems work fine except fact 0 rows because offset set on last line. so means that: i'm communicating couchdb server (cloudant) the post method works it seems retrieve list giving offest of last element, i.e. empty list also, trying order results differently had no success. rilist var (from google chrome dev tools): keys: array[194] 0: "wire line diamond core drilling rig" 1: "vua - isotope geochemistry laboratory" 2: "volcanologic , seismological observatories" 3: "vesog" 4: "utrecht university - teclab, tectonic laboratory" 5: "utrecht university - experimental , analytical laboratories" ..... which same of var rilist=["wire line diamond core drilling rig", "vua - isotope geochemistry laboratory","volcanologic , seismological observatories","vesog","utrech...

code organization - How to structure a Cocoa project -

when write in python can structure source code several files , folders, creating modules. can import module, file can have several classes, , on. how structure project written in cocoa? can .m file implement multiple classes? there notion of "module"? "framework" for? possible create framework of mine? how "import" project? , happens @ compilation time, compiler embed frameworks 1 giant executable or living next executable, merely being copied bundle folder? it sounds should start apple resources your first mac app , what frameworks? to answer questions - .m can contain multiple class implementations; framework bundle of shared resources; framework library reuse; can create own frameworks; in typical mac application bundle frameworks copied application bundle . there bunch of resources concerning structure , design of cocoa applications - particularly cocoa love post.

java - maven: How to add resources which are generated after compilation phase -

i have maven project uses wsgen generate xsd files compiled java classes. problem want add generated xsd files jar resources. since resource phase running before "process-classes" phase can't add them. there way add additional resource after "process-classes" phase? i suggest define output directory xsd files target/classes (may supplemental sub folder packaged later during package phase jar. can achieved using maven-resources-plugin . <project> ... <build> <plugins> <plugin> <artifactid>maven-resources-plugin</artifactid> <version>3.0.2</version> <executions> <execution> <id>copy-resources</id> <phase>process-classes</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputdir...

xtk - X.file api does not exist -

the api link dead. not sure plan it, it's idea have file object holds loaded file images , colortables don't have loaded every time needed. the api back: http://api.goxtk.com/renderer3d.html the x.file object private. sotring datastreams not make sense since it's wasting memory. parsing time expensive task, loading not so there no gain.

xml - After TYPO3 TV upgrade 1.3.7 to 1.7.0, FCE content element fields not displaying in backend -

i've upgraded typo3's extension templavoilà 1.3.7 1.7.0, ok. in edit page module, fces field of etype "ce" (content element) won't display in backend anymore. i've remapped fce, checked datastructure nothing wrong. someone have idea please ? here's ce field's xml <field_fce_text type="array"> <tx_templavoila type="array"> <title>texte</title> <sample_data type="array"> <numindex index="0"></numindex> </sample_data> <etype>ce</etype> <preview>1</preview> <proc type="array"> <int>0</int> <hsc>0</hsc> <stdwrap></stdwrap> </proc> <oldstylecolumnnumber>0</oldstylecolumnnumber> <enabledragdrop>1</enabledragdrop> </tx_templavoi...

popup - Controlling parent window after link (JavaScript) -

i'm using form handling service after hitting submit links intermediate page before using settimeout() link original page. cover ugly intermediate page nicer. far i've tried having submit button load new window onclick, new window uses parent.write open div cover entire page , allow me write own html. problem prevents intermediate page loading @ all, , prevents forms being processed. my current workaround involves using settimeout() in child window load own page after intermediate page loaded. works, still see intermediate page first. please me! switched 000webhost , wrote own formhandler

Qt Creator with Visual C++ 11 -

i want use qt creator ms vc++ 11 says there no toolchain build qt. installed qt full sdk installer. now? isn't msvc++ 11 comes visual studio 11? if qt hasn't supported makespec file version afaik (correct me if wrong). following (rough) steps running qt creator msvc 2010 nmake/cl tool-chain.. download qt sdk 4.8.2 compiled using msvc-2010 toolchain site (second page). install ms vc++ 2010 free development tools (or full sdk), comprises of nmake/cl/cdb executables. restart pc initialize environment variable , all. start qt creator , notice msvc-2010 tool-chain has been identified qt creator (tools -> options dialog). if not manually add it. also confirm qt version 4.8.2 of msvc-2010 has been identified in qt versions tab. if not manually add giving path of qmake in bin of qt sdk folder. select msvc-2010 tool-chain automatically. here go, go projects , in build settings, select msvc-2010 tool-chain , compile. make sure win32-msvc2010 selected ...

php - Build a multidimensional array using recursive function -

Image
problem: i trying build recursive tree using function , data mysql. however, results not expected. php code: function buildtree($root, $next = array()) { // sanitize input $root = (int) $root; // query $query = "select cid, item, parent betyg_category status = '1' , parent = '{$root}'"; $result = mysql_query($query) or die ('database error (' . mysql_errno() . ') ' . mysql_error()); // loop results while ($row = mysql_fetch_assoc($result)) { $next[$row['cid']] = array ( 'cid' => $row['cid'], 'item' => $row['item'], 'parent' => $row['parent'], 'children' => buildtree($row['cid'], $next) ); } // free mysql result resource mysql_free_result($res...

c++ - How to combine template method pattern and multiple inheritance? -

can change code make work? possible combine template method pattern , multiple inheritance? seems convenient implement different algorithms in different classes. thank you. class tbase { public: virtual void do1() const = 0; virtual void do2() const = 0; void do() const { do1(); do2(); } }; class tfirstalgorithm { public: void do1() const {} }; class tsecondalgorithm { public: void do2() const {} }; class talgorithm : public tbase , public tfirstalgorithm , public tsecondalgorithm {}; fundamentally, problem tfirstalgorith::do1 isn't related tbase::do1 (and likewise tsecondalgorithm::do2 tbase::do2 . one possible way fix make them related: class tbase { public: virtual void do1() const = 0; virtual void do2() const = 0; void do() const { do1(); do2(); } }; class tfirstalgorithm : public virtual tbase { public: void do1() const { } }; class tsecondalgorithm : public vi...

c# - pausing and stopping threads -

i have following code working dirty. code fine except part added: pause , stop button. i'm new c# apreciated. private void pause_button_click(object sender, eventargs e) { start = false; pause = true; stop = false; guiupdate(); pauseevent.reset(); } private void stop_button_click(object sender, eventargs e) { if (pause == true) { pauseevent.set(); pause = false; this.start_button.click -= new system.eventhandler(this.resume_button_click); } start = false; stop = true; } private int activethreads = 0; private thread thread; private void dowork(object sender) { string line = null; ereader = new streamreader(my_list); { lock (ereader) { pauseevent.waitone(); line = ereader.readline(); } // //other commands processing & b...

mpeg2 ts - Windows Media Player cannot play MPEG-TS file created in Android. -

i tested stagefright record sample (frameworks/base/cmds/stagefright/record) create mpeg2 ts file. while can played on android default media player, cannot played in windows media player or mplayer. suggestions? note modified original record sample source create mpeg-ts file instead of mp4 file. which codec used create mpeg2 ts file. may difference in codec used problem.

android - Access Activity from ContentView -

how can access activity it's contentview? contentview custom layout implementation. i interpreting "custom layout implementation" having created custom subclass of view . any subclass of view can call getcontext() which, in normal cases, return activity hosts view .

linear algebra - Matlab: how to solve a binary system of equations? -

i'm trying solve system of equation following form: a5 + a6 + a7 + f5 + f6 + f7 = 11; b5 + b6 + b7 + e5 + e6 + e7 = 100; c5 + c6 + c7 + d5 + d6 + d7 = 100; a5 + b5 + c5 + d5 + e5 + f5 = 11; a6 + b6 + c6 + d6 + e6 + f6 = 100; a7 + b7 + c7 + d7 + e7 + f7 = 100; where variables , digits binaries. is there way in matlab? for example, substituting binary numbers there decimal values: a5 + a6 + a7 + f5 + f6 + f7 = 3; b5 + b6 + b7 + e5 + e6 + e7 = 4; c5 + c6 + c7 + d5 + d6 + d7 = 4; a5 + b5 + c5 + d5 + e5 + f5 = 3; a6 + b6 + c6 + d6 + e6 + f6 = 4; a7 + b7 + c7 + d7 + e7 + f7 = 4; and tell matlab somehow unknowns should integers , interval [0:1]? here x = b form: a = [1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1; 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0; 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0; 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0; 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0; 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1]; b = [3 4 4 3 4 4]; what next step? bintprog, if have optimization to...

Position of Keyboard Android at SoftInputMethod=AdjustPan -

Image
i'm having big troubles position of keyboard on 1 of applications : need set keyboard stay under specific textview , not focused one. here in image example of want achieve. i'm using windowsoftinputmethod=adjustpan. there way set position(or target) keyboard? in advance

asp.net mvc - Why can't save image to database in this way? -

i want save image , other information databse in asp.net mc3 project. i've saved image database before , worked. code in controller this: public actionresult savetodb() { if (request.files.count > 0 && request.files[0] != null) { httppostedfilebase file = request.files[0]; var path = path.combine(server.mappath("~/content/image"), file.filename); file.saveas(path); byte[] buffer = system.io.file.readallbytes(path); myad.adimage = buffer; storedb.addtoads(myad); storedb.savechanges(); } return view(); } } now changed table , want save other information more image database. code this: public actionresult savetodb(advertiseview model) { if (request.files.count > 0 && request.files[0] != null) { httppostedfilebase file = request.files[0]; var path = path.combine(server.mappath("~/co...

php - Get returned of controller action in my own abstact library (Zend Framework) -

hello trying retrieve values ​​returned controller action in own library abstract in 1 of methods of dispatch of zend framework, wonder if feat possible , if how it. my code follows: indexcontroller class indexcontroller extends my_controller { public function init() { /* initialize action controller here */ } public function indexaction() { // action body return 'hello world'; } } my_controller abstract class my_controller extends zend_controller_action { /** * initialize core_controller * @param zend_controller_request_abstract $request * @param zend_controller_response_abstract $response * @param array $invokeargs */ public function __construct(zend_controller_request_abstract $request, zend_controller_response_abstract $response, array $invokeargs = array()) { parent::__construct($request, $response, $invokeargs); $this->_helper->viewrenderer->setno...

c# - Microsoft Office Interop Word read header and footnote -

i want use microsoft office interop word assemblies read header , footers of word documents. i have 2 problems : first how access footnotes , headers? second how convert them string (i got "system.__comobject" when call tostring()) you should have document object doc composed of many sections, , footers/headers part of single sections. each section can have multiple headers/footers (they can instance different first page). access text of header/footer have range contained in header/footer, , access text property. if app word applicationclass, code should give 2 collections headers , footers of active document: list<string> headers = new list<string>(); list<string> footers = new list<string>(); foreach (section asection in app.activedocument.sections) { foreach (headerfooter aheader in asection.headers) headers.add(aheader.range.text); foreach (headerfooter afo...

java - Why do I get "Invalid or corrupt jarfile"? -

before error got exception in thread "main" java.lang.noclassdeffounderror: org/lwjgl/lwjglexception i added lib/lwjgl.jar , lib/lwjgl_util.jar manifest.mf , that's error in title. idea how fix this? used eclipse generate jar , manifest file. consider using jarsplice bundle lwjgl library files 1 comprehensive executable jar-file. here tutorial on how.

iphone - Check if UIImage property got assigned or not? -

i have uiimage property, , after shooting image iphone camera assigned image object property, otherwise not. how can check if property contains image after shooting or not? below code didn't help. @interface myviewcontroller : uiview<uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate> @property(nonatomic, retain) uiimage *imageshot; @end @implementation myviewcontroller @synthesize imageshot = _imageshot; - (id)init { self = [super init]; if (self) { _imageshot = [[uiimage alloc] init]; } } - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { self.imageshot = [info objectforkey:uiimagepickercontrollereditedimage]; } - (void)buttonclick { if (_imageshot) { } else { } } @end in init , should create shotedimage nil instead of alloc'ing new, empty image. that'll allow perform tests if (!shotedimage) (as nil == 0 ).

accessing controller variables in model CakePHP -

i have 2 variables in controller in cakephp accessed using $this->data['general']['q'] $this->data['general']['typesearch']. how refer these variables in model??? you didn't specify why need variables in model. because context important kind of questions, it's hard accurately answer 1 without it. well, try defining variables in model first: class mymodel extends appmodel { var $q; var $typesearch; } then, in controller try pass values of controller variables variables: $this->mymodel->q = $this->data['general']['q']; $this->mymodel->typesearch = $this->data['general']['typesearch']; regards, hiawatha

Parse remote JSON with ruby -

i have problem when try , parse remote json. require 'net/http' require 'json' url = "www.example.com" resp = net::http.get_response(uri.parse(url)) buffer = resp.body result = json.parse(buffer) details = result['detail'] details.each |detail| puts "latitude: #{detail['latitude']}" end the json returned it's this. {detail:{id:578155,latitude:69.83}} any suggestion please ? it's not valid json, use split , gsub methods parse it. string = string.split("}") string = string[0].gsub("[", "") string = string[0].gsub("]", "") string = string.split(",")

haskell - is mult_add a real function? What does it do? -

i have following question given me. write function form_number_back takes list of positive integers , forms decimal number using numbers in list in reverse order. for example form_number_back [1, 2, 3, 4] should return number 4321; form_number_back [ ] returns 0 use function foldr , mult_add below accomplish mult_add d s = d + 10*s note: foldr , foldr1 2 different functions. try use foldr1 instead of foldr in definition , see if same results empty list. explain results. i cannot find on mult_add . thought mabye function name wants form_number_back function name. means mult_add haskell function. can explain me mult_add does? written right? mult_add usermade function i'm supposed use own code? edit 2 i tried putting in function example type.. so.. form_number_back [1, 2, 3, 4] :: num b => b -> [b] -> b so function looks like form_number_back = foldr(mult_add) but returning type of form_number_back :: num b => [t] -...

php - Drop down menu in IE Against FF and Chrome -

i've noticed dropdown menu works in chrome, ff , opera in ie mess - but! works in 404 page. examples: http://www.raal.co.il/ , works in: http://www.raal.co.il/asd the weirdest thing this: i've copied 404 page's code blank page , put in home page - , still doesn't work!! address related how. the default document mode in ie http://www.raal.co.il/ quirks, , http://www.raal.co.il/asd ie9 standards. (press f12 developer tools.) if change manually ie9 standards, see menu works allright. this doctype related. checked source code, , found weird in doctype. first character looks wrong. unfortunately, cant copy , paste here somehow, you'll have check yourself. has hebrew language guess.. edit: in firebug net tab, found in front of doctype: 

How to run webdriver tests in Selenium Grid linux and firefox -

how run webdriver tests in selenium grid linux , firefox. after setting selenium grid , registering node hub when try run below code throws class not found error, thoughts. url server = new url("http://127.0.0.1:4444/wd/hub"); desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setbrowsername("firefox"); system.out.println("connecting " + server); remotewebdriver driver = new remotewebdriver(server, capabilities); driver.get("http://www.google.com"); driver.quit(); satish, check error in stack trace. says caused by: java.lang.classnotfoundexception: com.app.tests.remotetest this not selenium exception. class file remotetest not in classpath.you need set in classpath.

database - how to pass variable from controller to model in PHP MVC -

i have been trying pass variables model through controller function variable can used in corresponding query database.here code public function choosegroup() { $data['area']=$_get['area']; //variable view source;this loaded in function, have printed echo sure. $this->load->model('information_model',$data); $groupdata['rows']= $this->information_model->getgroupdetails(); // var_dump($groupdata); } model code: function getgroupdeatils() { $this->db->select('area'); //area suppose contain value $q = $this->db->get('group'); //group table name if ($q->num_rows() > 0) foreach ($q->result() $rows) { $data[] = $rows; } return $data; } the value $data['area'] some reason isnt being recognized information_model , query not processed.where did go wrong?:( please help! ...

c - How does software recognize an interrupt has occured? -

as know write embedded c programming, task management, memory management, isr, file system , all. know if task or process running , @ same time interrupt occurred , how sw or process or system comes know that, interrupt has occurred? , pauses current task execution , starts serving isr . suppose if write below code like; // dummy code void main() { for(;;) printf("\n forever"); } // dummy code isr understanding void isr() { printf("\n interrupt occurred"); } in above code if external interrupt(isr) occurs , how main() comes know interrupt occurred? start serving isr first? your query: understood answer. wanted know when interrupt occurs how current task execution gets stopped/paused , isr starts executing? well rashmi answer query read below, when microcontroller detects interrupt, stops exucution of program after executing current instruction. pushes pc(program counter) on stack , loads pc vector location of inerrup...

gtk - GTKSocket, widget, and glade -

i have following code: builder = gtk.builder() builder.add_from_file(glade_file) builder.get_object("windowmain").show() socket = gtk.socket() socket.add_id(long(openglwindowid)) builder.get_object('alignment1').add(socket) where alignment1 gtkalignment widget. when run this, get: fubar.py:64: gtkwarning: ia__gtk_socket_add_id: assertion `gtk_widget_anchored (socket)' failed socket.add_id(long(self.openglwindowid)) does know widget should use gtk.socket() when building glade file? have mis-understood vital? i think need add socket alignment before call add_id() method.

xml - I'm tring to access a web service from Android which has a layout similiar to the codes blocks below: -

for moment i'm tring ksoap2 use whatever standard method in industry. can access 'simple sample' (below) , write values such 'frank' log using ksoap2 no problem, complex sample (below) has me stumped. i've seen lots of samples showing call 'single level' xml none traverse down 2 or more levels complex sample. any help? ---simple sample --------------------------------------- <category xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org /2001/xmlschema-instance" xmlns="http://accumobilews.org/"> <categoryid>99</categoryid> <name>frank</name> <description>prison break</description> </category> <category> -------complex sample------------------------------------------ <supercategory xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://a...

javascript - How to load views and templates dynamically using backbonejs and requirejs -

i creating form builder application using backbonejs , know how load view dynamically have dropdown can choose type of element should added eg choose input field. have default values go every element in formstemplate , based on field chosen want load different html templates. define([ 'jquery', 'underscore', 'backbone', 'modal', // pull in collection module above 'collections/builder', 'text!templates/forms/builder.html', 'text!templates/forms/formstemplate.html', 'text!templates/forms/textbox.html', 'models/builder' ], function ($, _, backbone, popupmodal, attributescollection, buildertemplate, formstemplate, inputtemplate, attributesmodel) { var attributesbuilderview = backbone.view.extend({ el: $("#page"), initialize: function () { }, render: function () { this.loadtemplate(); }, loadtemplate: function () { ...

asp.net - Place border around multiple cells in a gridview -

so have gridview modify of cells, , treat cells 1 (if possible). so first changing of cells background color on rowdatabound: if (e.row.rowindex > 1 && e.row.rowindex < 7) { e.row.cells[1].backcolor = color.red; e.row.cells[2].backcolor = color.red; e.row.cells[3].backcolor = color.red; e.row.cells[4].backcolor = color.red; e.row.cells[5].backcolor = color.red; } this change 5x5 area of cells red. next put border around outside of 5x5 area. found borderstyle , bordercolor cell, there way me turn on border 1 side of cell can create border? thanks i'd advise use classes instead, don't hard-code this. easier maintain etc.

r - aligning patterns across panels with gridExtra and grid.pattern() -

Image
the gridextra package adds grob of class "pattern" lets 1 fill rectangles patterns. example, library(gridextra) grid.pattern(pattern = 1) creates box filled diagonal lines. want create stack of panels in each panel filled these diagonal lines. easy: library(lattice); library(gridextra) exampleplot <- xyplot( 1 ~ 1 | 1:2, panel = function () grid.pattern(pattern = 1), layout = c(1, 2), # remove distracting visual detail scales = list(x=list(draw=false), y=list(draw=false)), strip = false, xlab = '', ylab = '' ) print(exampleplot) the problem diagonal lines aren't aligned across panels. is, there visual "break" bottom of first panel meets top of second panel: @ point, lines don't line up. problem want fix. i can eliminate of visual break adding argument pattern.offset = c(.2005, 0) grid.pattern call, , making sure applies bottom panel. solution doesn't generalize. example, if change pattern (e.g., us...

Facebook Like and Logout -

i pretty new stackoverflow , coding i'll try best make question clear , simple possible: i'm looking create webpage have facebook button , logout button sign user out of facebook account...so user can facebook like, enter login info, logout. here script have far have refresh in order logout work , direct main page. many help: interactive link: http://jsfiddle.net/nrdnx/11/ code: <html> <head> <title>my great web page</title> </head> <body> <div id="fb-root"></div> <script> window.fbasyncinit = function() { fb.init({ appid : '271358172932770', // app id status : true, // check login status cookie : true, // enable cookies allow server access session xfbml : true // parse xfbml }); // additional initialization code here getstatus(); }; // load sdk asynchronously (function(d){ var js, id = 'facebook-jssdk...

android - Disable the gestures in PagerAdapter/ViewPager -

first of sorry bad english. i got working pageradapter 3 views . works fine. can switch through views normal gestures , buttonclicks. want disable gestures. possible switch through views buttonclicks , disable gestures? here pageradapter : public class mypageradapter extends pageradapter { public int getcount() { return 3; } public object instantiateitem(view collection, int position) { layoutinflater inflater = (layoutinflater) collection.getcontext() .getsystemservice(context.layout_inflater_service); int resid = 0; switch (position) { case 0: resid = r.layout.back; break; case 1: resid = r.layout.stock; break; case 2: resid = r.layout.menu; break; } view view = inflater.inflate(resid, null); ((viewpager) colle...

tsql - Update from subquery SQL Server 2008 -

Image
i have tblpatient county name , state name in table. have table both county name , state name , i'm trying normalize tblpatient, structure as can imagine, different states share county names. deal i'm using query select patientid, admissiondate, dischargedate, patientstate, patientcounty tblpatient patientstate='al' i'd update tblpatient.patientcounty equal tblstatecounties.countycode patientcounty , countyname same. i haven't had dummy's version of how use rollback yet, looks correct me, yet don't want committed possibly silly error. update tblpatient set tblpatient.patientcounty=tblstatecountes.countycode ( select patientid, admissiondate, dischargedate, patientstate, patientcounty tblpatient patientstate='al' ) t inner join on tblstatecounties.countyname=tblpatient.countyname the query wrote won't parse (you can check enough) because you're missing clause in sub query.you'd need join on t.tblpatient , ...

Java Search for a sub list from a list with many criteria -

i want make search method list of restaurants. user has gui form , complete fields wants. made method meetscriteria check if restaurant exist. works not in cases. public class restaurantlist { private arraylist<restaurant> _restaurants = new arraylist<restaurant>(); restaurantlist selrest; restaurantlist searchrestaurant(string name, string area, string phone, string category) { selrest = new restaurantlist(); (int i=0; i< _restaurants.size(); i++) { if(_restaurants.get(i).meetscriteria(name, area, phone, category)) { selrest.addrestaurant(_restaurants.get(i)); } } return this.selrest; } public class controller { //this list restaurants static restaurantlist restlist = new restaurantlist(); //this lis...