Posts

c++ - Assigning values to enum -

while doing review of older code, notice following 2 strange constructions using enum (two different files/classes/namespaces, putting them here): enum firstenum { a_choice ,another_choice=1 ,yet_some_other_choice }; enum secondenum { first_choice ,second_choice ,third_choice ,default_choice=second_choice }; i think both constructions wrong. the first 1 assigns value 1 of choices, not others, meaning things might go wrong if new choices added. in second case, end 2 enumeration elements having same underlying value. is there reason why c++ standard allows both constructions? (using visual studio 2010) the first 1 assigns value 1 of choices, not others, meaning things might go wrong if new choices added. i don't know mean "go wrong". it's well-defined if don't specify value enumerator, value 1 more previous (or zero, if it's first). in second case, end 2 enumeration elements having same unde...

mocking - How to unit test Pop3 Client based on OpenPop.Net -

i know if there's fake (mock) mail server let feed our emails (as text or file) , receive them using our application uses openpop.net. our problem there mails (received various mail servers) have attachments when receive them using our application says don't have attachments.i able test our mail client changing email header. baby pop3 server looks may suitable needs. description website: in past have done several projects related e-mail (pop3/smtp/imap4). 1 of problems (at least in company) there never test servers available. that's why decided create simple pop3 server, doesn’t take many resources , supports of standard pop3 commands. in configuration description can used microsoft's smtp server (which included windows), using smtp server's mail drop folder input folder pop3 server. this means can email smtp server test emails pop3 server, in theory copy test emails directly folder.

eclipse - Exporting dynamic java web application to PDF? -

i completing application using zk framework runs under tomcat 7.0. custom calculator provides end users total costs of items based on input amount. could please recommend me best solution export contents pdf? possible? user need store values in pdf format on machine. speaking need export contents on screen pdf format , download onto users machine. thank you have nice day zk provide integration jasper report ,so here can use jasper report integration zk. question here how can there plenty of way . here can check create_a_report_with_zk_using_ireport_and_jasperreports integrate-zk-with-jasper-report integrate-dyanmic-jasper-reprot-with-zk note:- example done zk ee.

listview to open new page loading xml into new listview with links to sub page in jquery mobile -

i total noob jquery , asking in best way code list displays collection of buttons point lists created xml , lead display page when clicked. the idea come onto page, pick area of interest (listview), loads xml , displays areas list of content (listview). click on list item , takes content page text, video etc displayed. have 20 feeds have deal with. i can 1 xml feed work have had hard time understanding how deal multiple xml feeds , how call them , display them. examples helpful , appreciated. here have <!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> <link rel="stylesheet" href="js/jquery.mobile-1.1.0.min.css" /> <script src="js/jquery-1.8.0.min.js"></script> <script src="js/jquery.mobile-1.1.0.min.js"></script> <script src=...

java - Libgdx Box2D Velocity is just not fast enough -

i have rectangle move fast ever reason faster velocity use still seems slow. doing wrong? have dropped circle above onto surface , tough play gravity comes down ballon... some declarations float velocity = 10000000f; static final float box_step=1/60f; static final int box_velocity_iterations=6; static final int box_position_iterations=2; gravity, tried , seem suck world = new world(new vector2(0, -50), true); the ground object moving onto //ground bodydef groundbodydef =new bodydef(); groundbodydef.position.set(new vector2(0, camera.viewportheight * .08f)); body groundbody = world.createbody(groundbodydef); polygonshape groundbox = new polygonshape(); groundbox.setasbox((camera.viewportwidth) * 2, camera.viewportheight * .08f); groundbody.createfixture(groundbox, 0.0f); and here objects: //ball bodydef = new bodydef(); bodydef.type = bodytype.dynamicbody; bodydef.position.set(new vector2(camera.viewp...

Hibernate Criteria join query one to many -

i have cat class , owner class. cat has 1 owner owner can have many cats. want query "get owners has cat blue eyes". class cat{ owner owner; //referenced owner.id string eyecolor; } class owner{ list<cat> catlist; } i tried codes don't know do. criteria criteria = getcurrentsession().createcriteria(cat.getclass(), "cat"); criteria.createalias("cat.owner", "owner"); criteria.add(restrictions.eq("cat.eyecolor", "blue"); criteria can select projections, or root entity. not joined entity. queries impossible express criteria (which 1 more reason use hql, in addition better readability , conciseness). all not lost here, though, because association bidirectional. need equivalent of hql query select distinct owner owner owner join owner.cats cat cat.eyecolor = 'blue' which is criteria c = session.createcriteria(owner.class, "owner"); c.createalias("owner.cats", ...

iphone web app - iOS External Accessory Framework from web app -

i'm being called upon build web app interfaces iphone accessory. see native apps use externalaccessory.framework access accessory, far i'm seeing no indication framework in way exposed web apps. possible (and if so, entry point), or need build native? what you're going have use native app layer of communication between ios accessory , web server. in other words you're going have intercept of responses web server , translate accessory via native objective-c. if write native app viewcontroller uiwebviewcontroller , either have web server bake in command payloads in response messages or gruelingly parse html embedded commands can pull off. company uses 3rd party accessory in manner , while it's not pretty works. mean "not pretty" in sense commands static per app build , underlying handling of accessory. luck! quick edit: depending on how re-usable want make interfacing accessory create framework commands baked in. way when need alter or expa...