Posts

Showing posts from June, 2014

ghci - Compiling Haskell code in Cygwin, and some other bugs in Haskell Platform on Windows -

ghci - Compiling Haskell code in Cygwin, and some other bugs in Haskell Platform on Windows - i trying compile simple hello world programme in haskell, haskell platform 2011.2.0.1. if load code in winghci, , utilize gui compile, .exe created. can run .exe cygwin. but if seek compile code in cygwin (using ghc --make ), linker fails. again, if compile windows cmd prompt, compile+linker works fine. are there other environment variables need import cygwin, create compile+linker work in it? have set next dirs in cygwin path: 2011.2.0.1/lib/extralibs/bin , 2011.2.0.1/bin (these 2 valid haskell related entries see in windows environment variables). i noticed couple of invalid items in windows environment variables (this looks bug in haskell installation): (system var) c/programfiles/haskell/bin - dir not exist because have installed haskell in d disk. (user var) userxxx/applicationdata/cabal/bin - dir not exist. i tried file bug study in haskellplatform, dont have p...

model view controller - Is this MVC in javascript? -

model view controller - Is this MVC in javascript? - despite have been using mvc in php many times, found out quite different in javascript. i'm reading mvc in javascript on web, many of them have different implementation. came simple mvc, think not correct. acceptable or wrong? var appview = view.extend({ init: function() { // hear model changes this.listen("counterchanged", $.proxy( this.updatecounter, )); // assign click event; phone call controller method this.container.find("#increase").click( this.callback( this.controller, "increase" )); this.container.find("#decrease").click( this.callback( this.controller, "decrease" )); }, updatecounter: function( evtdata ) { this.container.find("#counter").html( evtdata.newvalue ); } }); var appcontroller = controller.extend({ increase: function() { this.model.update("c...

php function returns false -

php function returns false - the next php function returns n-th weekday of month, e.g. 3rd quarta-feira in jan 2012 in form 18-1-2012: <?php function giventhday($month, $year, $no, $day) { $counter = 0; for($i=1;$i<=31;$i++) { //schleife für 31 tage if(!checkdate($month, $i, $year)) { //wenn datum nicht existiert (bspw. 30. februar) zu nächstem schleifendurchlauf springen continue; } else { if(date('l', strtotime($i.'-'.$month.'-'.$year))==$day) { //wenn generiertes datum gleicher wochentag wie gesuchter tag $day $counter++; //dann $counter um eins erhöhen if($counter==$no) { //falls $counter==$no, falls bspw. dritter ($no==$counter==3) mittwoch gefunden, datum zurückgeben homecoming $i.'-'.$month.'-'.$year; } } } } homecoming false; //existiert nicht, bspw. fünfter ...

streaming - Ruby TweetStream Locations Feature not working -

streaming - Ruby TweetStream Locations Feature not working - i'm accessing ruby tweetstream fine in regards "filter" method; however, whenever seek limit of streaming content bounding box (which know works), ignores code or doesn't run @ all. here's of code: tweetstream.configure |config| config.username = 'username' config.password = 'password' config.auth_method = :basic end tweetstream::client.new.filter({:locations => '-80.29,32.57,-79.56,33.09', :track => ["bob loblaw"]}) |tweet| p tweet.inspect end i've tried "locations" method: tweetstream::client.new.filter({:track => ["bob loblaw"]}).locations('-80.29,32.57,-79.56,33.09') |tweet| p tweet.inspect end i've tried locations(['-80.29,32.57,-79.56,33.09']) , locations(['-80.29,32.57','-79.56,33.09']). anybody got ideas? tweetstream::client.new.locations(-80.29,32....

JavaScript Anonymous Method -

JavaScript Anonymous Method - hi building little simple js framework university. having issues doing jquery. currently can phone call methods $.method() struggling on how $().method() have looked @ source , can't seem work out how achieved it. every time seek adapt mine theirs not work. so best way accomplish this. function $() { homecoming object.create(proto); } $.method = function method() { ... }; proto.method = function method() { ... }; $.method(); $().method(); so have function properties methods , function returns object has methods. also pro tip, $ poor variable name, utilize more meaningful. javascript

jprofiler - How to stop "Thread History" (in "Thread Views") after JVM exits? -

jprofiler - How to stop "Thread History" (in "Thread Views") after JVM exits? - the thread history in thread views continues running, if jvm exits , kept live jprofiler (using keep vm alive). behaviour see lot of useful info time when jvm running , growing amount of useless info after (all threads waiting, in case). i tried using trigger jvm exit stop recording action, not stop thread history. the trigger works, verified using print message action. thanks jprofiler has maintain track of threads, thread history has no recording options. if growing time line in keep-alive state bothering you, recommend save snapshot. in snapshot, static. jprofiler

api - Can Magento pull in USPS "Paid Online" rates rather than "Post Office" rates? -

api - Can Magento pull in USPS "Paid Online" rates rather than "Post Office" rates? - we have usps rates displaying correctly in magento 1.5. however, have noticed rates appearing "paid @ post office" rates, opposed "paid online" rates. it nice know if there way alter magento pulls in "paid online" rates cheaper customer. the module needs adjusted passes online instead of in tag. api magento usps

Export from MySQL with relations to JSON (for CouchDB) with PHP -

Export from MySQL with relations to JSON (for CouchDB) with PHP - i’m working on master thesis 1 of goals run tests , experiments against couchdb database , tune performance. to need test data. i’ve created piece of php code generate simple relational info mysql database. tables are: customer product brand color checkout i’ve made relations between illustration product , colorid , brandid , in checkout table i’ve relation customerid , productid. i want export exclusively info construction , info relations json format couchdb. i’ve json string should contain each client attributes , purchase parameters product, , on. i’m thinking like: { "customer": { "customerid" : "1", "firstname" : "somefirstname", "lastname" : "somelastname", "email" : "my@mail.com", "country" : "usa", "datecreated" : ...

JSP tag which is retrieved as String is not executed -

JSP tag which is retrieved as String is not executed - i have java class responsible rendering html elements , have predefined tags created them. public class startdatefield { private static startdatefield object; private startdatefield(){} public static startdatefield getinstance(){ if(object == null){ object = new startdatefield(); } homecoming object; } public string render(){ string field = "<field:text name='first_name' size='65' maxlen='63' style='field' />"; homecoming field; } } then tried phone call render method within jsp tag (which has import above class) <td colspan="2"> <%=startdatefield.getinstance(subpagebean).render()%> </td> but displays nothing. when go view source shows returned text instead of executing tag. how caused , how can solve it? <%= someexpression() %> means: evaluate java look someexpression() , , write result...

c# - How can I combine 2 images using a 3rd alpha mask image -

c# - How can I combine 2 images using a 3rd alpha mask image - i have 2 images, foreground , background. want combine 2 using alpha mask image such black = utilize background pixel, white = utilize foreground pixel , gray alpha blended mix of 2. the foreground , background images fixed, while mask image created on fly , moved required create animation. is there performant way using standard library? can utilize lockbits , loop i'd faster, if such thing exists. i take @ great article on codeproject shows creating , using alpha masks in c#. http://www.codeproject.com/articles/38494/bitmap-alpha-layer-editor there many other graphics examples on code project if browse around. this 1 illustration too: http://www.codeproject.com/articles/18035/quick-n-dirty-alpha-mask-generator hope helps c# image mono

c++ - SDL Small Screen -

c++ - SDL Small Screen - when run code trying start programming tetris clone prints screen little rectangle (<30*30) , other part of screen black (it should green) i know shouldn't give code don't know where's error #include <string> #include <vector> #include "sdl/sdl.h" using namespace std; const unsigned short screen_width = 640; const unsigned short screen_height = 480; const unsigned short screen_bpp = 32; const unsigned char block_length = 20; enum color { bluish = 0, cyan, white, red, yellow, magenta, greenish }; struct point { int x, y; }; struct block { public: point l; color c; }; vector<block> blocks; sdl_surface *screen = null; void apply_surface(sdl_surface *source, sdl_surface *target, int x, int y, sdl_rect *clip = null); bool init(); bool clean_up(); void show_blocks (); int main(int argc, char** argv) { init(); sdl_fillrect(screen, null, ...

svn: warning: Error handling external definitions for -

svn: warning: Error handling external definitions for - i'm having extrange error defining external repo svn. repository create externals definition enterprise repository needs authentications (svn+ssh). works on machine, have same username both in machine , in svn. when seek reproduce checkout machine different user name, checkout works fine until arrives external repo. @ moment, instead sync external svn username, seek sync external machine's username. i set external in way: svn propset svn:externals 'dd1 svn+ssh://subversion.example.int/var/subversion/dd1/trunk' . svn commit i cannot define external , username because has own user/password any ideas? thanks. solved. the problem combination between svn + ssh. ssh gives user name svn. can forcefulness username writing svn+ssh://username@svn.server.com/trunk external fetch against default username (because different svn authentication process). the solution write config file (~/.ssh/conf...

ruby - File contains data in an unknown format (Runtime Error) -

ruby - File contains data in an unknown format (Runtime Error) - i'm trying build , run ruby code team fellow member wrote class project. this error i'm getting: ps c:\users\bryan\team6\planetdefense> ruby main.rb c:/ruby192/lib/ruby/gems/1.9.1/gems/gosu-0.7.41-x86-mingw32/lib/gosu/patches.rb:36:in 'initialize': file contains info in unknown format. (runtimeerror) c:/ruby192/lib/ruby/gems/1.9.1/gems/gosu-0.7.41-x86-mingw32/lib/gosu/patches.rb:36:in `initialize' c:/users/bryan/team6/planetdefense/classes/playstate.rb:9:in `new' c:/users/bryan/team6/planetdefense/classes/playstate.rb:9:in `initialize' c:/ruby192/lib/ruby/gems/1.9.1/gems/chingu-0.8.1/lib/chingu/game_state_manager.rb:300:in `new' c:/ruby192/lib/ruby/gems/1.9.1/gems/chingu-0.8.1/lib/chingu/game_state_manager.rb:300:in `game_state_instance' c:/ruby192/lib/ruby/gems/1.9.1/gems/chingu-0.8.1/lib/chingu/game_state_manager.rb:148:in `push_game_state' ...

java - Android - not accessible to landroid/app/instrumentation when extending application class -

java - Android - not accessible to landroid/app/instrumentation when extending application class - im trying larn android ive run hang can't quite figure out. i'm trying work global variables. have extended application class. have added think right manifest (the name of class fortune crunch): <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.marctremblay.test.fortunecrunch" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" /> <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" android:name=".fortunecrunch"> <activity android:name=".fortunecrunchactivity" android:label="@string/app_name...

Z3 Model Incorrect -

Z3 Model Incorrect - i hacking away @ problem of finding hamiltonian cycle in undirected graph. recent experiment produced should have been impossible model. here input: ;number of vertices = 4 ;5 edges: ;e1 = 0 1 ;e2 = 1 2 ;e3 = 2 3 ;e4 = 3 0 ;e5 = 1 3 (declare-const v0 bool) (declare-const v1 bool) (declare-const v2 bool) (declare-const v3 bool) (declare-const e1 bool) (declare-const e2 bool) (declare-const e3 bool) (declare-const e4 bool) (declare-const e5 bool) (assert (xor (and e2 e3 e4 e5) (and e1 e3 e4 e5) (and e1 e2 e4 e5) (and e1 e2 e3 e5) (and e1 e2 e3 e4))) (assert (and v0 v1 v2 v3)) ;(assert (=> (and e2 e3 e4 e5) (and v0 v1 v2 v3))) ;(assert (=> (and e1 e3 e4 e5) (and v0 v1 v2 v3))) ;(assert (=> (and e1 e2 e4 e5) (and v0 v1 v2 v3))) ;(assert (=> (and e1 e2 e3 e5) (and v0 v1 v2 v3))) ;(assert (=> (and e1 e2 e3 e4) (and v0 v1 v2 v3))) (assert (=> e1 (or e2 e4 e5))) (assert (=> e2 (or e1 e3 e5))) (assert (=> e3 (or e2 e4 e5))) (assert (=...

maven - Can't Eclipse update my pom.xml dependencies automagically (e.g. like bundlor does with MANIFEST.MF)? -

maven - Can't Eclipse update my pom.xml dependencies automagically (e.g. like bundlor does with MANIFEST.MF)? - in eclipse, isn't possible allow tool automagically add together dependencies pom.xml file? when developing osgi bundles, bundlor can dependencies add together code, , add together them manifest.mf file (while inspecting bundles in osgi container) + update classpath. cant plugin same , add together maven dependencies pom (while inspecting local, or remote, repository)? seems straightforward feature haven't seen implemented anywhere. thanks! eclipse maven bundle dependency-management pom.xml

How to do stereoscopic 3D with OpenGL on GTX 560 and later? -

How to do stereoscopic 3D with OpenGL on GTX 560 and later? - i using open source haptics , 3d graphics library chai3d running on windows 7. have rewritten library stereoscopic 3d nvidia nvision. using opengl glut, , using glutinitdisplaymode(glut_rgb | glut_depth | glut_double | glut_stereo) initialize display mode. works great on quadro cards, on gtx 560m , gtx 580 cards says pixel format unsupported. know monitors capable of displaying 3d, , know cards capable of rendering it. have tried adjusting resolution of screen , else can think of, nil seems work. have read in various places stereoscopic 3d opengl works in fullscreen mode. so, possible reason error can think of starting in windowed mode. how forcefulness application start in fullscreen mode 3d enabled? can provide code illustration of quad buffer stereoscopic 3d using opengl works on later gtx model cards? what experience has no technical reasons, product policy of nvidia. quadbuffer stereo considered p...

php - File upload not working in IE -

php - File upload not working in IE - i tested simple php file upload script. works in browsers except ie :( ie prints "filetype not supported" defined within code: if (isset($_post['add'])) { $order = $_post['display_order']; $img = $http_post_files['imagefile']['name']; $url = $_post['url']; // connect db mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "unable select database"); $types = array('image/jpeg', 'image/gif', 'image/png', 'image/tiff', 'image/bmp', 'image/pjpeg'); $target_path = "media/"; $target_path = $target_path . basename( $_files['imagefile']['name']); if (in_array($_files['imagefile']['type'], $types)) { if(move_uploaded_file($_files['imagefile']['tmp_name'], $target_path)) { mysql_query( "insert slider_lux...

iphone - dismissViewControllerAnimated is called but ViewController is not dismissed -

iphone - dismissViewControllerAnimated is called but ViewController is not dismissed - i having problems dismissviewcontrolleranimated method not closing downwards view. what happening in app here is: cell in itemviewcontroller selected. view pushed itemdetailviewcontroller and details sent through delegate user selects 'done' , event sent via delegate closed in itemviewcontroller all of works except view not dismissed, there no errors. can see wrong? - (void)itemdetailviewcontrollerdidfinish:(itemdetailviewcontroller *)controller { nslog(@"controller: %@", controller); // returns - controller: <itemdetailviewcontroller: 0x6b68b60> [self dismissviewcontrolleranimated:yes completion:nil]; } what if phone call [controller.navigationcontroller popviewcontrolleranimated:yes] instead? for matter, if phone call [controller dismissviewcontrolleranimated:yes completion:nil] instead of calling on self? iphone objective-...

javascript - jQuery simple collision error, -

javascript - jQuery simple collision error, - im making collision checking scheme jquery doesn't seem work. there 2 buttons. can move 1 button right key. 1 time buttons collide 1 of buttons should alter font colour. right now, button alter colour if not touching other button. seek out, if have problems understanding me. thanks, <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>my website</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $(document).keydown(function(event) { if ( event.which == 39){ $('.button0 input').animate({'left': '+='+math.cos(0*math.pi/180...

c# - The results of ports scanning seem to be incorrect while using AsyncCallback -

c# - The results of ports scanning seem to be incorrect while using AsyncCallback - i'm trying port scan given ip address range of 20 ports. know port 80 open , other closed. code showing ports open. i'm trying utilize asynchronous tcpclient accomplish port scan. what wrong here? have missed something? private void btnstart_click(object sender, eventargs e) { (int port = 80; port < 100; port++) { scanport(port); } } private void scanport(int port) { using (tcpclient client = new tcpclient()) { client.beginconnect(ipaddress.parse("74.125.226.84"), port, new asynccallback(callback), client); } } private void callback(iasyncresult result) { using (tcpclient client = (tcpclient)result.asyncstate) { seek { this.invoke((methodinvoker)delegate { txtdisplay.text += "open" + environment.newline; }); } grab { ...

visual studio 2010 - Watin. Browser unexplainably closes after opening -

visual studio 2010 - Watin. Browser unexplainably closes after opening - below code... using (var browser = new ie(url)) { element element = browser.element(find.byname("txtfirstname")); } i'm getting error message in debugger when inspect element object: function evaluation disabled because previous function evaluation timed out. must go on execution reenable function evaluation. i've reinstalled vs2010 , didn't prepare problem. any ideas? since have 2 lines, "previous function evaluation" timing out net explorer. reinstall net explorer, , ensure running right permissions. suspect computer shared. need administrator privileges run kind of code. hope reinstalling net explorer helps. luck! allow me know how on. visual-studio-2010 debugging internet-explorer watin

python - Django Callback on Facebook Credits -

python - Django Callback on Facebook Credits - i utilize facebook credits django application. in facebook credits documentation, there sample callback page in php (https://developers.facebook.com/blog/post/489/). however, develop callback in django application. created view callback, have no thought facebook sends me , how should parse it. i suppose kind of post http request parameters should parse, how? thank input. they send signed request need parse. i'd suggest reading rest of facebook documentation if you're confused means. this guy has done php python conversion you: http://sunilarora.org/parsing-signedrequest-parameter-in-python-bas once you've parsed sent you, in php script. then, send json them. @ end of view: def fb_credits_callback(request): # parse parse function # handle request homecoming httpresponse(json.dumps(data)) python django facebook-graph-api callback facebook-credits

events - Inactive Controls on ViewController despite working referencing outlets -

events - Inactive Controls on ViewController despite working referencing outlets - i wondering if else has seen this. include screen shot unilluminating, showing referencing outlets , event handlers hooked should be, same thing working before made changes. had simple uiview text , single command edited have more controls, , after building none of them worked. iboutlet variables worked, able set text , command states on viewwillload, command inactive. enabled, allowing user interaction, tried setting enabled properties in code. dead. finally created new view, copied , pasted subviews it, hooked event handlers , referencing outlets, , worked right away. does have insights share on this? tried cleaning project, rebooting machine, whole gamut. ok, "the nib must have been corrupt," why? thanks insights. events uiview uiviewcontroller controls iboutlet

c# - What is the proper way to impement Form Authentication along side Facebook/Other authentication in ASP.NET MVC -

c# - What is the proper way to impement Form Authentication along side Facebook/Other authentication in ASP.NET MVC - i building application in asp.net mvc 3 in have implemented forms authentication. i give user alternative sign-up/log-in facebook account(and perchance other social accounts in future.) i using c# facebook sdk i have implemented facebook login workflow. question is, how handle mixing both forms , facebook auth? can't seem find sufficient examples of how accomplish this. in regards facebook implementation, requesting permission user non-expiring auth token store in database. for have this create custom class (currentidentity) implements iidentity. override .tostring() class, , have sort of serialized state of object. had utilize "|" seperator. string stored in encrypted cookie. create session cookie public static httpcookie authcookie(currentidentity identity) { //create authticket, store in cookie , redirect user formsaut...

javascript - setInterval Spotify apps -

javascript - setInterval Spotify apps - i'm having problem using setinterval/clearinterval. i've tried this: int = setinterval(somefunction(), 1000); phone call somefunction() once, instead of 1 time every second? so tried this: int = setinterval("somefunction()", 1000); , works in way, because gives me error uncaught referenceerror: somefunction not defined every second? why? d: setinterval takes 2 arguments: function, , time in milliseconds time between calls. your first illustration wrong because doesn't give function argument, executes function , passes result first argument. alter setinterval(somefunction, 1000) , it'll work. javascript api spotify

webkit - Getting a C GObject pointer from a Python gobject -

webkit - Getting a C GObject pointer from a Python gobject - i'm working pywebkitgtk, codegen'd binding- there ton of gobject subclasses. binding isn't complete, , utilize ctypes bunch of stuff in addition. but need utilize object i've got- in python- argument ctypes library call. clearly, won't work, , passing memory address of python object isn't winner, either. how can memory reference gobject backing python object? here's illustration of doesn't work, might give thought i'm talking about. >>> import ctypes >>> libwebkit = ctypes.cdll('libwebkit-1.0.so') >>> import webkit >>> webview = webkit.webview() >>> libwebkit.webkit_web_view_get_zoom_level(webview) #yes, know binding exposes argumenterror: argument 1: <type 'exceptions.typeerror'>: don't know how convert parameter 1 again, illustration illustrate point- want memory refs gobjects utilize ctypes. ...

Adding an XSL build step to an Android project in Eclipse -

Adding an XSL build step to an Android project in Eclipse - i'm quite new eclipse. i have simple android (java) project beingness built in eclipse, using adt plugin. i have resource xml file (call target.xml ) wish generate using xsl ( transform.xsl ) xml file ( source.xml ). i've installed eclipse xsl tools. i've set run configuration, , can build target.xml file by, example, right-clicking on transform.xml file in bundle explorer, , choosing run->run configurations, choosing configuration under "xsl" section of configurations list , hitting "run". what want happen automatically when build/run/package android project. so, when nail "play" build , run android app on attached device, eclipse should know if source.xml or transform.xsl have changed, should first (or @ to the lowest degree before app packaging step) transform source.xml using transform.xsl , , thereby build res/xml/target.xml . is there simple, elegant...

android - Google Map Dynamically add pin and move? -

android - Google Map Dynamically add pin and move? - i want dynamically mark force pin points on more 1 place on google maps. able drag place touched. how can that? maybe utilize sample project android google-maps

postgresql - Rails: what is the best way to model this has_and_belongs_to_many association -

postgresql - Rails: what is the best way to model this has_and_belongs_to_many association - let's have 2 models event , person . many people attend event , person can attend many events too. class event < activerecord::base has_and_belongs_to_many :people end class person < activerecord::base has_and_belongs_to_many :events end create_table "events_people", :id => false, :force => true |t| t.integer "event_id" t.integer "person_id" end the problem event presented 1 or many speakers . particular event , should have people attend event , 1 or many speakers are, of course, people too. how do ? give thanks you. try this: class event < activerecord::base has_and_belongs_to_many :people has_and_belongs_to_many :speakers, :class_name => "person" end and have events_speakers bring together table match event_id , person_id (which point ids in people table). ruby-on-rails postg...

jquery - Uploadify stops working in IE after a couple of uploads -

jquery - Uploadify stops working in IE after a couple of uploads - i have uploadify instance sends file server in ajaxy way. it's working fine in chrome, in ie randomly stop working after first or sec or 3rd upload. when stop working onselect function fire, nil else happens. how go debugging problem? thanks lot a first step utilize internet explorer console see if error shown (f12 on ie9). after checking that, might want place console logger (very easy, lots of tutorial that), have feedbacks when goes wrong. you can utilize callbacks of uploadify have more precise informations. hope help. jquery internet-explorer-8 internet-explorer-9 uploadify

java - How best to implement link relations for HATEOAS in XML? -

java - How best to implement link relations for HATEOAS in XML? - we have java server web application core of scheme contains complex domain model designed according principles of domain driven design. part, these domain objects have been affectly little applications other concerns. we looking set rest web services api in front end of scheme , struggling how best implement hateoas links come within our own new media type. example, lets have domain class foo has id , name properties jax-b annotations: @xmltype(name = "foo") public class fooimpl implements foo { private string name; private string id; ...snip.... @xmlid @xmlattribute @override public string getid() { homecoming id; } @xmlelement @override public string getname() { homecoming name; } @override public void setname(final string name) { this.name = name; } } but xml want homecoming looks this: <foo id="123" href...

android - Finalizing a Cursor that has not been deactivated or closed -

android - Finalizing a Cursor that has not been deactivated or closed - okay, new android developping, or developping , getting error. trying everytime user select spinner item programme creates list. have databasehelper class using getting results of list. problem is never create list, , gives error. databasehelper methods activity uses; public int[] searchbyletter(string letter) { // todo auto-generated method stub int[] results = new int[100]; int count = 0; string[] columns = new string[] { key_mineralid }; cursor c = minerals.query(database_table, columns, key_letter + "= '" + letter + "'", null, null, null, null); if (c.movetofirst()) { results[count] = c.getint(c.getcolumnindex(key_mineralid)); } while (c.movetonext()) { count++; results[count] = c.getint(c.getcolumnindex(key_mineralid)); } c.close(); homecoming results; } public string getname(int _id) { ...

how i can get parts of web pages by php -

how i can get parts of web pages by php - i want create news site gets content other news sites, open rss feed , feach url , open html dom of page text of news think have utilize domdocument class of php? <?php $doc = new domdocument(); $doc->loadhtml("<html><body>test<br></body></html>"); echo $doc->savehtml(); ?> http://www.php.net/manual/en/class.domdocument.php rss feeds xml. links here utilize simplexml. load page can utilize curl or httprequest. to analyse returned code utilize domdocument, too! alternatively utilize simplehtmldom. php

javascript - How do you ensure you don't create model twice using history in backbone.js? -

javascript - How do you ensure you don't create model twice using history in backbone.js? - in router have routes: { "create/:type": "create", // #create/modeltype "diagram/:id": "diagram", // #diagram/193 "": "list" // }, then have create route create: function(type) { console.log("diagram create " + type.touppercase()); var newdiagram = new diagram({ type: type.touppercase() }); newdiagram.save({}, { success: function(model, response) { console.log("save diagram success"); window.vnb.routers.workspace.navigate("diagram/" + model.get("id"), true); }, error: function(model, response) { console.log("error"); console.log(model); console.log(response); } ...

Java - Trigonometry Hell -

Java - Trigonometry Hell - i have task of beingness able programme class in java calculate bearing north point. objects known 2 positions, both have bearing north , distance 0. illustration - position 1 - 30 degrees , 10m, position 2 - 190 degrees , 50m. how calculate bearing if wanted travel position 1 position 2 instance or position 2 1? can calculate distance between 2 positions using cosine rule, have no thought how create class accuratly calculate bearing in different scenarios? any help or advise appreciated. from http://en.wikipedia.org/wiki/law_of_cosines#applications: ...once have 3 side lengths, give 3rd angle of triangle. (the haversine formula navigation on sphere... think we're worried vectors on plane.) java trigonometry

gwt-maven-plugin and hibernate -

gwt-maven-plugin and hibernate - i'm having bit of weird issue here, basically, im using hibernate gwt, maven , gwt maven plugin. however, hibernate fails during initialization next message: [error] initial sessionfactory creation failed.org.hibernate.hibernateexception: not instantiate querytranslatorfactory: org.hibernate.hql.internal.ast.astquerytranslatorfactory googling around shows me apparently related hibernate.jar beingness on classpath twice. i don't exclusively understand how gwt plugin configures classpath. tried setting hibernate-core scope->provided , makes not include in /lib directory of package, but, still passes puts in classpath when running jetty? this output mvn gwt:run -x c:\program files\java\jdk1.6.0_27\jre\bin\java -xmx512m -classpath c:\develop\git-repositories\promocms\promocms\src\man\java; c:\develop\git-repositories\promocms\promocms\src\main\resources; c:\develop\git-repositories\promocms\promocms\target\promocms-1.0-snap...

UIscrollView swipe gesture + UIButton finger down effect on iOS -

UIscrollView swipe gesture + UIButton finger down effect on iOS - i'm trying come uiscrollview in paging mode, each page shows image of product and, besides beingness able swipe between pages, i'd product image switch "down" version of when specific product/page tapped. so far tried following: 1 - adding uibuttons pages of scrollview: obviously, way can have images switch "selected" version on finger down, buttons, taking whole page, prevent scrollview detecting swipe gesture. 2 - adding uiviews instead of buttons, , uitapgesturerecognizer: way can tap image select product , recognizer lets gesture pass on scrollview, allowing swiping too. problem approach can't switch images "selected" versions when user touches them, since tap recognizer reports uigesturerecognizerstateended. any ideas how both button up/down , scrollview swipe behaviors? scrap (well not everything, gist). no gesture recognizers no nothing. had problem ...

xml - javascript + e4x: how to test if an element is empty? -

xml - javascript + e4x: how to test if an element is empty? - is there way test whether xml element empty using e4x? e.g. if have element <foo /> , want homecoming true, if have element has attributes, kid elements, or text, want homecoming false. i slogged through ecma-357 v2 spec on e4x; methods xml nodes listed in section 13.4.4, , there no useful isxxx() or hasxxx() methods test; simplest way seems following: function isemptynode(node){ homecoming node.children().length() == 0 && node.attributes().length() == 0; } javascript xml e4x

datetime - java: compare time/date and get the correct format of time difference -

datetime - java: compare time/date and get the correct format of time difference - i have these 2 times 2011-9-5 0:00 2011-9-5 15:50 when there time difference date d1=df.parse(interviewlist.get(28).gettime()); date d2=df.parse(interviewlist.get(29).gettime()); long d1ms=d1.gettime(); long d2ms=d2.gettime(); diff = math.abs((d1ms-d2ms)/60000); it gives me right difference difference coming 950 how can in proper format 15:50 ( diff of above two) thanks it gives right difference, 950 min = 15 hr , 50 min you can accomplish by int hr = totalminutes / 60; int min = totalminutes - (hour * 60); and then string dispstring = hr + ":" + minute; java datetime

android - What to advise graphics designer designing layout and images to be suitable for multiple screens? -

android - What to advise graphics designer designing layout and images to be suitable for multiple screens? - i've read android developers guidance on supporting multiple screens here... http://developer.android.com/guide/practices/screens_support.html ... , understand developer's perspective easiest way cater screens have 3 sets of drawables , layouts (ldpi, mdpi, hdpi) , utilize relative positioning in layout files , specify heights, widths etc in density independent pixels. i'm going have graphics designer design screens , individual buttons, images etc who'll designing high density screens (240dpi) , scaling graphics downwards 1.5 medium density screens (160dpi) , 2 low density screens (120dpi). best way go about? , what, if anything, can advise him/her height , width of screen design for? please read this article 1 of best article regarding this. google suggests using 3:4:6:8 scaling ratio ldpi:mdpi:hdpi:xhdpi accordingly, please scale images...

c++ - transfer loop into C++03 for_each -

c++ - transfer loop into C++03 for_each - possible duplicate: using bind1st method takes argument reference i have next traditional c++03 loop (using auto stack overflow space efficiency only): for (auto = some_vector.begin(); != some_vector.end(); ++it) { foobar.method(*it); } in c++11, managed rewrite next for_each invocation works well: std::for_each(some_vector.begin(), some_vector.end(), std::bind(&foobar::method, std::ref(foobar), _1)); (of course of study utilize lambda in c++11, that's not point.) unfortunately, std::bind not part of c++03, tried simulating std::bind1st , std::mem_fun_ref : std::for_each(some_vector.begin(), some_vector.end(), std::bind1st(std::mem_fun_ref(&foobar::method), std::ref(foobar))); but triggered c2535 error in visual studio ("member function defined or declared"): // within class binder1st in header xfunctional result_type operator()(const argument_t...

Can I add HTML5 elements to existing HTML documents? -

Can I add HTML5 elements to existing HTML documents? - so have existing html page has field lastly 4 digits of credit card: <input value="" name="last4ofcc" maxlength="4" id="last4ofcc1"> works great, feature request came in create numeric field , not allow non-numeric characters. at first thought of plugging in javascript, thought, why not utilize html5 element. changed following: <input type="number" value="" name="last4ofcc" max="4" id="last4ofcc1"> but not still allow non-numeric characters, max attribute doesn't work either! i'm testing on firefox 8, not sure problem is. does know i've done wrong here? you need include proper doctype @ top of page in add-on changing input types. <!doctype html> however, it's not going think it's going to. setting input type="number" pretty much spinners on side , tell for...

objective c - Seeing where ARC is inserting retain and releases -

objective c - Seeing where ARC is inserting retain and releases - is there compiler alternative (or other way) see arc inserting retain , releases? out of curiosity. can see them in disassembly code, that's hard wade through sometimes. no. if compiler provide this, you'd absolutely overwhelmed number of retains/releases, since of them taken out during optimization stage. compiler can't that, because arc isn't pre-processing stage. it's part of compilation. you're not going able besides looking @ assembly. objective-c automatic-ref-counting

slider - jQuery FeatureList plugin -

slider - jQuery FeatureList plugin - i'm using featurelist jquery plugin jqueryglobe , i've run kind of problem. since jqueryglobe closed can't inquire them support. here files used: http://www.mediafire.com/?q7cn6y4tkdd75jd how can create link within content of programming tab show content of next tab applications, or create work on other links outside content? jquery slider

r - Getting Sweave code chunks to stay inside page margins? -

r - Getting Sweave code chunks to stay inside page margins? - sometimes create r code chunk (in sweave) longer margins of page. there way forcefulness "go next line" 1 time happens? here simple illustration of happening: \documentclass[a4paper]{article} \usepackage{sweave} \defineverbatimenvironment{sinput}{verbatim} {xleftmargin=2em, frame=single} \defineverbatimenvironment{soutput}{verbatim}{xleftmargin=2em, frame=single} \title{sweave boxes} \begin{document} \maketitle <<echo=false>>= options(width=60) @ here illustration of code chunk followed output chunk, both enclosed in boxes. <<>>= print(rnorm(99)) @ <<>>= print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") @ \end{document} this hard , extreme case, because not have spaces amo...

asp.net mvc 3 - How to give names for dynamically generated radiobuttonfor -

asp.net mvc 3 - How to give names for dynamically generated radiobuttonfor - i generating radiobuttonfor dynamically. code runs as, @{int questioncount = 0; } @{foreach (sectiondetail sectiondetail in section.sectiondetails) { <table> <tr> <td> @html.label(sectiondetail.title) </td> @{count = 0; } @foreach (sectionscore sectionscore in model.individualsections) { <td class="colsupplier"> @html.radiobuttonfor(model => model.individualsections[count].sectionscores[questioncount].score.pass, true)pass @html.radiobuttonfor(model => model.individualsections[count].sectionscores[questioncount].score.pass, false)fail </td> count++; } </tr> </table> questioncount++; } here...

c# - Better method of handling/reading these files (HCFA medical claim form) -

c# - Better method of handling/reading these files (HCFA medical claim form) - i'm looking suggestions on improve approaches handling scenario reading file in c#; specific scenario people wouldn't familiar unless involved in health care, i'm going give quick explanation first. i work health plan, , receive claims doctors in several ways (edi, paper, etc.). paper form standard medical claims "hcfa" or "cms 1500" form. of our contracted doctors utilize software allows claims generated , saved in hcfa "layout", in text file (so, think of beingness paper form, without background/boxes/etc). i've attached image of dummy claim file shows like. the claim info extracted text files , converted xml. whole process works ok, i'd create improve , easier maintain. there 1 major challenge applies scenario: each doctor's office may submit these text files in different layouts. meaning, doc might have patient's name on line 10, s...

.net - Is it possible to manually enter step-through mode in visual studio without a breakpoint? -

.net - Is it possible to manually enter step-through mode in visual studio without a breakpoint? - i apologize if duplicate post, couldn't find reply in other thread. i aware step application starting debugger f10 or f11. aware set breakpoint on gui events. - not want. i able press button somewhere in vs, , have kick "step-into" mode next piece of user code gets triggered stepped through. want don't have set breakpoints on in code. save me lot of time able application in state, manually turn on step-into mode, , trigger code run want step through. any ideas? edit: here's step step since didn't explain well. there 2 suggestions utilize break all, still occurs before i'm trying do. my goal: launch application manipulate application without breakpoints/step-through manually turn on step-through trigger code (click button, hover on something, alter focus, etc.) be in step through mode @ code triggered action. as can see - break command...

recursion - Creating own substing functions recursively in Ocaml -

recursion - Creating own substing functions recursively in Ocaml - how can write substring function in ocaml without using assignments lists , iterations, recursions? can utilize string.length. i tried far let substring s s2 start stop= if(start < stop) substring s s2 (start+1) stop else s2;; but wrong, problem how can pass string beingness built gradually recursive calls? this feels homework problem intended teach think think recursion. me easier think recursion part if decide on basic operations you're going use. can't utilize assignments, lists, or iterations, okay. need extract parts of input string somehow, can't utilize built-in substring function this, defeat purpose of exercise. other operation can think of 1 extracts single character string: # "abcd".[2];; - : char = 'c' you need way add together character string, giving longer string. you're not allowed utilize assignment this. seems me you...

jquery - Use method in ResourceBundle Javascript object for internationalization -

jquery - Use method in ResourceBundle Javascript object for internationalization - i have next resourcebundle javascript object. var resourcebundle = { en : { "msg1" : "message 1", "msg2" : "message 2" } } as see, english. can create brance for, say, french(fr). no problem 'message 1' , 'message 2' have resourcebundle['en'][key]. can if want message created using paramaters. can utilize methods, if so, how. what mean this, want add together msg3 as; "msg3" : "welcome "+username; not exact way, workaround try next : resourcebundle['fr'] = []; // create new resourcebundle['fr']['msg1'] = "test"; // add together value alert(resourcebundle['fr']['msg1']); // test or using @david's reply base of operations : function createmessage(key, value, locale) { if (resourcebundle[locale] == undefi...

c - Coverting an unknown length string to lower case issues -

c - Coverting an unknown length string to lower case issues - so i'm not c i'm designing glut application reads in file not case sensitive. create easier want convert strings lower case. made function makelower modifying variable passed in reference. i have while loop in method makelower seems through part of first iteration of while loop , exe crashes. tips great, thanks! output: c:\users\mark\documents\visual studio 2010\projects\project 1\debug>"project 1.e xe" ez.txt line #draw diamond ring character # then error "project 1.exe has stopped working" code: void makelower(char *input[]){ int = 0; printf("line %s\n", *input); while(input[i] != "\0"){ printf("character %c\n", *input[i]); if(*input[i] >= 'a' && *input[i] <= 'z'){ *input[i] = tolower(*input[i]); } i++; } } int main(int argc, char *argv[]) { fi...

SharePoint 2007-2010 Filter views problems with AND & OR -

SharePoint 2007-2010 Filter views problems with AND & OR - heres problem : whenever seek create view of list different conditions (more 4) i'm not sure if dont here conditions, on calendar view calendar has custom column named "state of approbation" can have values : "done", "cancelled", "approved", "in approbation". have custom column want filter : "upcoming date" "yes/no" type. heres want show : i dont want show events done. i dont want show canceled events more 14 days. i dont want show upcoming date events since date not confirmed. i thought of next : upcoming date = no and state of approbation != done and state of approbation = canceled and modified >= [today]-14 which not working. have been looking workaround , tought of 1 : upcoming date = no and state of approbation != done or state of approbation = canceled and modified >= [today]-14 and ...

c# - How to set default values for the properties of a derived control? -

c# - How to set default values for the properties of a derived control? - i derived toolstripcombobox in order create 1 encapsulates percentage picking dropdown. goal have of validation , string parsing in derived control. parent receives event when percentage chosen has changed, , can access public integer getting , setting percentage. the problem have in designer file parent command place derived command on, keeps adding total set of strings using combobox.items.addrange method. in constructor derived command have following: foreach (int in percentages) { combobox.items.add(string.format("{0}%", i)); } over time these values accumulate in designer file many, many times over. don't know how create items property hidden since it's not virtual. want suppress flooding of designer file. example of designer file: this.zoom_cbo.items.addrange(new object[] { "10%", "25%", "50%", "75%", "100%",...

To trail every div in a dom using jQuery -

To trail every div in a dom using jQuery - i have trail divs in dom height less 100px. utilize each function. didnt work. code tried.. jquery('div').each(function(){ if(jquery(this).height()< 40){ jquery(this).remove(); } the html divs looks this: <div class="foo"></div> <div class="foo"></div> <div class="foo"></div> <div class="foo"></div> <div class="goo"></div> <div class="loo"></div> <div class="goo"></div> <div class="loo"></div> and css each class causes different heights. use this jquery('div').each(function(){ if(jquery(this).height()< 40){ jquery(this).remove(); } }); you have add together in end }) , capitalize q in jquery demo: http://jsfiddle.net/sotiris/xnhun/ jquery

iOS Web Service: Move connection call from AppDelegate -

iOS Web Service: Move connection call from AppDelegate - so i've been working on fetching info web service , using in app (e.g displaying bunch of names in uitableview)... the guide have been next setting up, set nsurlconnection in appdelegate, had xmlparser , object storing fetched data... now, want move connection set-up out , phone call appdelegate , class of it's own... i'm bit unsure approach... i'm thinking along line of: child (object storing data) childparser (nsxmlparser) someviewcontroller (receives update notification parser , uses data) childmsg (set connection , soap message here) okay, before appdelegate set connection , soap message in didfinishlaunchingwithoptions... , in connectiondidfinishloading initialized childparser... in viewcontroller initiliazed parser with: appdelegate = (appdelegate *)[[uiapplication sharedapplication] delegate]; and access kid info objects... okay, i'm thinking should not setting connecti...

How do I include jQuery file in CodeIgniter? -

How do I include jQuery file in CodeIgniter? - i utilize jquery within codeingiter project. dont know how include js file. i have below in view <script src='<?php echo base_url().apppath ?>js/jquery.js'></script> <script src='<?php echo base_url().apppath ?>js/my-js.js'></script> firstly, create folder set in. utilize template scheme this one. this lets add together js files either globally in main template, or controller/function basis using syntax $this->template->add_js('assets/js/jquery.js'); jquery codeigniter

ios - Simple string concatenation in Objective C -

ios - Simple string concatenation in Objective C - i have nsstring named 'you' value "this string!". i want concat "123" in 'you', how can it? i using code , giving error. you=[you stringbyappendingstring:@"123"]; this code here working me nsstring *s = @"avant"; s = [s stringbyappendingstring:@" - après"]; nslog(@"%@", s); 2012-01-13 11:48:59.442 tabbar[604:207] avant - après so guess you bad pointer not nil , not nsstring think have. have seek nslog on value before call? objective-c ios nsstring string-concatenation

python - regexp and txt file -

python - regexp and txt file - i have txt file , regexp , seems regexp working have excess symbols in tail reg = re.findall(r"source rpm: [ \t\n\r]*(.*?) \s", stdout, re.dotall|re.multiline|re.ignorecase) and in output have liblqr-0.4.1-5.src.rpm size gwenhywfar-4.1.0-2.src.rpm size texlive-20110705-1.src.rpm size mandriva-theme-1.4.9-9.2.src.rpm size or ['liblqr-0.4.1-5.src.rpm\nsize'] ['gwenhywfar-4.1.0-2.src.rpm\nsize'] ['texlive-20110705-1.src.rpm\nsize'] ['mandriva-theme-1.4.9-9.2.src.rpm\nsize'] what "nsize"? you're doing ungreedy search . ('any character'), including new lines, until space met. new line isn't explicitly space (' ') character, why removing regex create work. r"source rpm: [ \t\n\r]*(.*?)\s" ^ removed ' ' python regex

java - What is the better way, keeping adapter as an inner class of activity or outside? -

java - What is the better way, keeping adapter as an inner class of activity or outside? - i want check improve , faster way programme of using adapter listview. out or in activity class? this more of java question android. inner classes more making code readable , not impact performance as long utilize static inner classes. static inner classes pulled out compiler , compiled separate classes (class$innerclass). so if using inner classes helpful in terms of code organization, can safely go ahead , utilize them. though i'd recommend using static inner classes. edit static inner classes suffice in context, of adapter wouldn't need access of variables of activity. java android android-activity adapter listactivity

html - Displaying images inline with PHP & CSS -

html - Displaying images inline with PHP & CSS - i echoing images out on page using php images , info go downwards page so: 1 2 3 i need them inline, there anyway this? here have: <?php echo ' <div class="auction_box" style="height:150px"> <form name="myform" action="http://hffhfghfhf.net/testing.php" method="post"> <p> </p> <p> </p> <p> </p> <img src="http://hfhfghfgh.net/'.$battle_get['pic'].'" height="96px" width="96px"/><br/> name:<br/>' .$v->pokemon. '<br/> level:' .$v->level. '<br/> exp:' .$v->exp. '<br/> </form> </div>'; } } ?> apply float: left; .auction_box class, think? ...