Posts

Showing posts from March, 2013

Importing an XML document into a Rails database? -

i've been reading through tutorial after tutorial, nothing seems working out me. goal take xml document elements , attributes , insert data in database. each element/attribute column in database, , each entry row. here made-up xml doc i've been working with: <?xml version="1.0"?> <library> <name><![cdata[favorite books]]></name> <book isbn="11342343"> <title>to kill mockingbird</title> <description><![cdata[description#1]]></description> <author>harper lee</author> </book> <book isbn="989894781234"> <title>catcher in rye</title> <description><![cdata[this extremely intense description.]]></description> <author>j. d. salinger</author> </book> <book isbn="123456789"> <title>murphy's gambit</title> <description><![cdata[daughter finds dad!]]></description> <auth...

sql - Trying to remove special characters in PHP -

i have form has text inputs. when add them db '\' character before each special character {', ", etc}. want remove '\' before entering text db far have been unable to. tried doing in php before execute query: $title_str = str_replace('\'','',$_post['main_title']); but did not work. thanks, sounds magic quotes still turned on. should disable them. safe thing do. http://www.php.net/manual/en/security.magicquotes.disabling.php also, sure use prepared queries (with pdo or similar) when inserting data in database avoid sql injection problems.

javascript - WebSockets, Comet, AJAX & Long Polling -

my understanding of comet server-side ajax request. understanding of long polling ("push") is server-side ajax request. understanding of websockets two-way ajax request. if of these wrong, please begin correcting me! assuming i'm more or less correct, true these ajax (javascript using xmlhttprequest object under hood)? if not ajax calls, how implement them in client (via javascript) , on server (using java)? in advance! your understanding of websockets incorrect. websockets new protocol , provides new api has nothing xmlhttprequest . this how create websocket var examplesocket = new websocket( "ws://www.example.com/socketserver", "protocolone" ); see https://developer.mozilla.org/en/websockets/

Slide-down animation in StackPanel - WPF (C#) -

Image
i trying create animation in stackpanel control when new children-windows added stackpanel, sliding down animation occurs. in vertical list-styled stackpanel. i use following code create new children-windows , insert them top of list: usercontrol1 item1= new usercontrol1(); item1.height = 0; item1.label1.content = "child window"; stackpanel1.children.insert(0, item1); slide-down animation in stackpanel - wpf (c#) - stack overflow stack overflow questions developer jobs documentation beta tags users current community help chat stack overflow meta stack overflow communities sign up or log in customize list. more stack exchange communities company blog tour start here quick overview of site center detailed answers questions might have meta discuss workings , policies of site learn more stack overflow company business learn more hiring developers or posting ads ...

javascript - Scrolling through "touchmove" is choppy -

i wanted "position:fixed" on mobile devices (i have android one) - , doesn't exist. faked creating 2 divs heights of summed height of screen (using js) , added touch listeners bottom div. events adjust scrolltop value. copy of old "touchscroll.js". the scrolling works successfully, added sling feel. however, entire scroll choppy compared when os scrolls view of window. i've read on random places, , somewhere here add -webkit-backface-visibility:hidden; , -webkit-transform:translate3d(0,0,0); css bits solve chop. tried on div itself, on body, backface part, transform etc... permutations... nothing helped. chop still existed, , tricks stopped keyboard appearing in input s i tried create internal div within scrolling one, , instead of adjusting scrolltop value move internal div making position:absolute , adjusting it's top . made no difference. is there solution beat chop? example here: http://mobile.phantasyrpg.com/so-example unfortunately ...

javascript - Tools and techniques for UX-centric Regression testing of a web application? -

the application i'm working on simple 3-tier web application (whatever simple means :) however, application ux/ui intensive i.e. user-interface forms crux of application. every structural change page or refactoring javascript/jquery/backbone code, need ensure ui behaving expected. for example, if div 's disappearing on deleting object, or if items being successful 'posted' , displayed in different div etc. i'm relatively new domain of ux/ui-based testing , not sure how attack problem. of it's quite manual overhead ensure looks , works right. have 'one layer below' tests send http messages , seems work fine return codes etc. ui focused testing lack. i've heard selenium, jasmine , few javascript frameworks not sure if serve needs. of solution see custom code javascript tests 'autorun' these tests browser , check if things happening way should (probably human 'staring' @ screen :) quite task , thought of asking community on suggesti...

Grails: how to display images in tag? -

possible duplicate: grails: displaying created image in gsp i'm trying display images database in <g:each> tag. my domain-class: class artists { byte[] image string artistname string bio static constraints = { image(nullable:true , maxsize:200000) artistname(nullable:true) bio(nullable:true, maxsize:2000) } } and artists.gsp : <g:each in="${dog.artists.list()}"> <g:img src="${it.image }" width="120" height="160"/> //doesn't work, should here??? <p>name: ${it.artistname}</p> //works <p>biography: ${it.bio}</p> //works </g:each> help please !!! you can render image inline way you're attempting using rendering plugin, , following gsp tag (this png check inline images in docs other content types): <rendering:inlinepng bytes="${it.image}"/>

c - need help compiling something! (: -

i'm helping developers of im test security , issues, , wanted example of tcp reset vulnerability reported on server. i'm having issues compiling it, can help? error log: http://pastie.org/4212921 c file: http://www.exploit-db.com/download/291 it's idea start first reported error. in cases, first reported error is: reset-tcp.c:51: error: ‘u_char’ undeclared (first use in function) u_char not standard c type; it's typedef unsigned char . your source file has following #include directives: #include <libnet.h> #include <stdio.h> <stdio.h> can't define u_char , must defined in <libnet.h> -- in whatever version of <libnet.h> source file depends on. that's non-standard header (it's not installed on system), best guess you're using different version of libnet 1 reset-tcp.c designed work with. i know doesn't solve problem, should give starting point. edit : i installed libnet1 , libnet1-dev , , libnet1-d...

android - How is Java able to pass out parameter from method -

i came across not comprehend , never realized done. i playing around block of code in android, , intrigued me this: public boolean ontouch(view v, motionevent event){ rect outrect = new rect(); _btn.gethitrect(outrect); // ... rest of code cut // outrect fields of rect object 'filled' in. } how android's java can directly modify rect object outrect passed method in order obtain rect of button widget. that surprised me, thought there no such thing ' pass reference ' in java, in java parlance, using ' call-by-reference ' rather, ' pass value ' or ' call-by-value '? yes, have read question asked before stumped, or android thing? can shed light on this? the outrect reference passed gethitrect method, modifies object referred outrect . references passed value. for detailed explanation of this, read article: http://javadude.com/articles/passbyvalue.htm

java - How recursion works in a code for computing Permutations of a number -

i have found code internet computer possible permutations given vector .. import java.util.vector; class permute { static int count = 0; public static void permute(vector unvisited, vector visited) { if ( unvisited.isempty() ) { system.out.println("permutation: "+visited); count++; } else { //system.out.println("trace: "+visited+" "+unvisited); int l = unvisited.size(); for(int = 0; i<l; i++) { string next = string.valueof(unvisited.remove(i)); visited.add(next); permute(unvisited,visited); unvisited.add(i,next); visited.remove(next); } } } public static void main(string[] args) { vector objects = new vector(); objects.add(1); objects.add(5); objects.add(8); permute(objects, new vector() ); system.out.println(count+" permutationen gefunden"); } } bu have small problem in understanding code , flow of instructions . misses when these 2 lines called unvisited.add(i,next); visited.remove(next); as see there recursion permute(..) function be...

capistrano - 'Unexpected end-of-file detected' when deploying Rails app to Dreamhost under Passenger -

This summary is not available. Please click here to view the post.