Posts

Showing posts from August, 2012

android - Images not found in drawable-large nor drawable-small -

i have images in drawable-normal can load them via bitmap bm = bitmapfactory.decoderesource(mcontext.getresources(), resourceid, mbitmapfactoryoptions) when move images on drawable-large (and remove them drawable-normal ), images not loaded anymore. there no error, null bm . when move them drawable-hdpi or like, loaded again. does android handle -small, -normal , -large folders different other resource folders? described here , should load images -large folder. i guess found answer own question. reading aforementioned page more carefully, turns out, android searches drawable-*dpi folders automatically, other qualifiers looks in default folder if not find resource in more specific one. in other words, if not find resource in drawable-normal , looks in drawable , stops trying. it's drawable-*dpi folders android looks folders. guess i'll switch these. tanmay trying me.

c# - AOP: Custom Model Binder Attribute using Ninject -

in short: trying create custom model binder take in type of user , id, use service class retrieve typed object. if there better way this, please let me know. elabaration: i have ninject setup bindings within domainservice layer, 3 web ui's hooked domain service layer. each asp.net mvc app loads bindings kernal. //my custom model binder public class usermodelbinder : imodelbinder { private iauthenticationservice auth; public usermodelbinder(iauthenticationservice _auth, entityname type, string loggedonuserid) { this.auth = _auth; currentusertype = type; currentuserid = loggedonuserid; } public entityname currentusertype { get; private set; } private string currentuserid { get; set; } public object bindmodel(controllercontext controllercontext, modelbindingcontext bindingcontext) { object loggedonuser = null; if (current...

java - @ManyToMany with Hibernate and JPA -

i have 2 tables bound manytomany relationship. table 1 timeslot , has collection of documents created in time slot. table 2 documents , has collection of timeslots given document modified many times in different timeslots. in particular program each document find or create document row it. further find or create time slot represents epoch of action, create, update, delete. note: delete event performed on document, not on row represents it. in program there no deletes or removes performed against row of either table. however seeing many deletes against timeslot_document mapping table there inserts. my question this, why hibernate issuing deletes? appears related dirty update processing. why repeated deletes timeslot id=1? when had onetomany didn't see deletes model inaccurate (as might imagine). for every document determine date (hour accuracy only) action occured on, increment tally , add document collection. something else curious implement mvcc via @version anno...

Good and easy WCF EF4 or XML leaderboard to put into my MVC 3 web app for my WP7 games? Security? -

i realized basic attempt hackable. main issues deal when creating leaderboard? connection string need encrypted somehow ? else? hoping not complex.. anyone have references have used doing ? i understand problem now, based on comments above. may helpful rephrase original question. ok, can not prevent people getting credentials use call web service silverlight or jquery or other similar client side code. understand this, have think how silverlight works. silverlight code sent client. client can anyone, , not have control on except know understands silverlight code. so, here can accomplish: obfuscate code prevent people copying presentation logic: http://www.preemptive.com/products/dotfuscator/overview configure wcf endpoint use https talk clients. prevent people intercepting communication between these layers. put important code in wcf service. way, if decompiles , de-obfuscates silverlight code, don't lose critical code. this post explains same thin...

c# - How can I retrieve a List of entities from a many to many relationship? -

i'm trying retrieve list<student> database. basically, schema is: gradeparalelo ---- gradestudent ---- student where gradestudent table holds primary keys gradeparalelo , student. note: gradestudent table has column hold integer. not association table. here's i've tried far: colegiodbv2entities db = new colegiodbv2entities(); public list<student> findallstudentsfromgradeparalelo(int gradeparaleloid) { return (db.students .include("gradestudents") .include("gradestudents.gradeparalelo") .where<student>(s => s.studentid == gradeparaleloid)).tolist(); } but it's retrieving single student every gradeparalelo choose. understandably, because i'm comparing studentid gradeparaleloid. this not want. can suggest way retrieve collection? image want retrieve students in gradestudent table gradeparalelo id 6. basically this, in more elegant form: public list<student> find...

SQL Server performace optimization book -

i'm looking book sql server optimization , query tuning.i thought 'microsoft sql server 2000 performance optimization , tuning handbook ken england' or 'microsoft sql server 2000 performance tuning technical reference edward whalen' ,anyone have advise ? (if there , interesting book hear about) tx. inside microsoft sql server 2005: query tuning , optimization kalen delaney great book , many things in there still apply 2008.

fingerprint - How to recognize Finger and authenticate in iPhone -

how recognize user finger login authentication , capture finger image in iphone? the screen apple uses incapable of detecting fingerprint. detects changes in charge @ different points on screen, allowing detect touches, swipes, etc. can read more here @ howstuffworks .

jquery - How to upload pdf file by caputring first page of the file? -

i want know how upload pdf file caputring first page of pdf file?? using jquery. thank you. you have extract first page using server side technology , display image in page. browser can't open pdf without plugin don't expect jquery of here...

iphone - Update editing style of UITableViewCell depending on contents -

i creating table-based interface similar ipad contacts, in user can add list of rows tapping blank row @ bottom. table in editing mode, , non-blank rows should have standard delete editing icon left. user starts typing in last blank row, delete icon should added left (and new blank row added). does know how make uitableview update editing style on demand? works, except delete icon doesn't appear until user scrolls row out of view , view. here's editingstyleforrowatindexpath implementation: - (uitableviewcelleditingstyle)tableview:(uitableview *)tableview editingstyleforrowatindexpath:(nsindexpath *)indexpath { if (/* text field contains data */) { return uitableviewcelleditingstyledelete; } else { return uitableviewcelleditingstylenone; } } i fought same problem yesterday. have toggle table view's editing mode property. after that, refresh cell's editingstyle. here's code trick me: self.tableview.ed...

c++ - Dividing a vector into smaller vectors upon its properties -

i want write in c++, , although have idea , have tried write don't achieve how it. explanation imagine have vector<int> define eveytime run our program. name mainvector vector have random number of ints. , every int have property. for example, have vector following values: vector<int> mainvector {1, 3, 15, 33, 35, 42, 57, 69, 73} ; , have vector<int> describe properties of every element in mainvector upon position of element, called properties example: vector<int> properties {1, 1, 1, 2, 2, 2, 3, 3, 3} what want now, divide first vector in many smaller vectors different properties exist. example, in last case, have 3 new vectors: vector elements property 1: 1, 3, 15 ; vector elements property 2: 33, 35, 42 ; , vector elements property 3: 57, 69, 73 . the problem don't know how define this, cause first vector can different everytime execute our code. here attached code ideas: do { for(int t=0;t<mainvector.size();t++) // id tab...

GSM CMS Error 512 when sending SMS -

i'm programming app send sms through gsm modem serial port. i've been able send sms couple of days using messagingtoolkit library suddennly i'm not being able send sms anymore. according logs due network error. found out "standard" error i'm facing is: cms error: 512 user abort i found list of error codes here http://www.smssolutions.net/tutorials/gsm/gsmerrorcodes/ can't find further explanation on error. does that's familiar gsm knows what's error about? when i'm initializing modem error message starting configurations, might related 512 error: 2011.04.11-09.23.16: sending: at+cops=0,2 2011.04.11-09.23.17: error in command at+cops=0,2 : error thanks! have verified registered operator properly? can sending at+creg? regarding at+cops error message. seems aren't sending enough parameters. at+cops=<mode>,[<format>,<oper>[,<act>]] are trying manually select operator rather letting ...

php - Insert into MySQL when POST form to Paypal -

i've been struggling hours , can't wrap head around where/how call php function insert order details mysql upon user clicking buy button (doing @ point allows me track orders go paypal , abandoned). i thought put in <form action=> tag, (for example, <form action='addtomysql.php' method='post'> ) that's paypal url goes, yes? function must run server side, can't use js... so... how this? curl has been suggested, , i've seen recommended before, user still redirected paypal's payment page , returned site? can suggest relevant web tutorial? i'm new web programming details appreciated. function creates form sent paypal is: function create_paypal_checkout { return " <form action='".paypal_url."' method='post'> <input type='hidden' name = 'business' value='".paypal_id."' /> <input type='hidden' name = 'cmd' value='_ca...

c# - Stop WPF animation, storyboard begin in xaml but stopping it in codebehind? -

i created animation storyboard in xaml file. story board begins on button.click. stop animation trying stop storyboard on custom event in code behind. code not throwing exception when event got fired animation still goes continue. i think issue stop method. stop required same object begins animation stop it. here storyboard begin in wpf xaml , stopping in code behind. any solution, how xaml object in code behind or alternative solution this?? xaml code: <canvas.triggers> <eventtrigger routedevent="button.click" sourcename="scanbutton"> <eventtrigger.actions> <beginstoryboard > <storyboard name="movingserver" storyboard.targetname="imagemove" repeatbehavior="forever" > <doubleanimation storyboard.targetproperty="(canvas.left)" duration="0:0:2" from="30" to="3...

Thai language Locale Setting problem in the android -

i have problem of localization.i have content have both thai , english. when run in android2.1 thai language show boxes. have set thai language locale in activity below locale local=new locale("th","th"); locale.setdefault(locale); which working in android2.3 not working in android2.1. please let me know mistake is? how can resolve problem by akil thai not supported in 2.1 android 2.1 platform notes

android - Single Choice Lists and onClick events -

i have choice_mode_single list 3 rows. how place onclick event changes value of arbitrary variable, if row 1 clicked, say, value of x = 1, , when row 2 clicked, value of x = 2, etc.? public class list extends listactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setlistadapter(new arrayadapter<string>(this, android.r.layout.simple_list_item_single_choice, genres)); final listview listview = getlistview(); listview.setitemscanfocus(false); listview.setchoicemode(listview.choice_mode_single); } private static final string[] genres = new string[] {"barre", "buffumville","hodges"}; } its quite simple..rather extending listactivity extend activity , declare listview in xml file below: <listview android:id="@+id/list" android:layout_width="fi...

Java EE application deployment on Weblogic -

i looking deploy & configure java ee application on weblogic following configuration machine -1 ,mananged server -1 webbapplication i..e war deployment on managed server-1 2 issues machine -2 ,mananged server -2 ear deployment, jdbc, jms server(modules, resources, queue , queue connection factory targetted managed server -2) configuration on managed server-2 no issues managed server -2 deployment , configuration the 2 issues managed-server-1 setup isn’t working , having following issues when deploy war 1. <11-apr-2011 15:26:03 o'clock bst> <[active] executethread: '1' queue: 'weblogic.kernel.default (self-tuning)'> <> <> <> <1302531963725> weblogic.deployment.environmentexception: [j2ee:160200]error resolving ejb-ref 'gov.rpa.rita.rlr.soplot.request.jsf.mappackrequestcontroller/dataservicefacade' module 'mappackproduction-war.war' of application 'mappackproduction-war'. ejb-ref not hav...

objective c - Question regarding GPS/Location in iPhone -

currently i'm doing location app in iphone question is.... what service iphone using? according apple developer manual "the framework uses information obtained built-in cellular, wi-fi, or gps hardware triangulate location fix device." so either built-in cellular, wifi or gps hardware, how ensure uses gps hardware location? because app requires accurate location. to limit supported devices ones gps can use uirequireddevicecapabilities in app's plist. way (to knowledge) force device using precise location determination (in case gps) set desiredaccuracy , distancefilter of cllocationmanager accordingly.

servlet as welcome-file-list in tomcat 7 -

i trying have servlet (non-jsp) welcome-file in tomcat 7, , way can by having mapped "/" url-pattern, otherwise returns 404 not found if try access url i.e. http://url/webapp/ reading servlet 2.4 specs, allows servlet in welcome file list, why have map "/" url-pattern working? <servlet> <servlet-name>credentialservlet</servlet-name> <servlet-class>com.servlet.credentialservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>credentialservlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>credentialservlet</welcome-file> </welcome-file-list> i don't know url patterns tried, mapping servlet on /credentialservlet or /credentialservlet/* should work. <servlet> <servlet-name>credentialservlet</servlet-name> <servlet-class>com.servlet.credenti...

c# - What is the correct order for calling the process class with WaitForExit? -

i'm having bit of trouble de-ciphering msdn documentation. i want call process class. if process process class calls exits want code exit want "standardoutput" , "standarderror" written log file. if process process class calls hangs (and doesnt exit) want code timeout , close process after timeout 'time' still want "standardoutput" , "standarderror" written log file. so have code: using (process p = new process()) { p.startinfo.filename = exepatharg; p.startinfo.redirectstandardoutput = true; p.startinfo.redirectstandarderror = true; p.startinfo.arguments = argumentsarg; p.startinfo.useshellexecute = false; p.startinfo.createnowindow = true; try { p.start(); p.waitforexit(timetowaitforprocesstoexit); streamreader standardoutput = p.standardoutput; streamreader standarderror = p.standarderror; retdirects.add("standardoutput", standardoutput...

How to make an HTML <button> vertifically fill a Table Cell with CSS? -

how can make html <button> vertifically fill table cell css? i can use width:100% make button horizontally fill table cell css, height:100% doesn't anything. for example, please see: http://jsfiddle.net/ea5fq/ thanks! you'll need specify height in pixels in: height: 100px;

c# - Multiple textbox controls on session object possible? -

i'm looking redirect user static form can review user profile info before submitted, , i've been told session object way this, have not seen how/if possible use multiple controls (i have textboxes, dropdowns, radiobuttons, etc). possible, , if so, syntax like? store control value in session variable like.. session["textboxvalue"] = textboxes.text; session["textboxvalue"] = dropdowns.selecteditem.text; and access value when want it.. string textboxvalue = session["textboxvalue"]

c++ - Error when including <boost/shared_ptr.hpp> in iOS pre-compiled header file -

i'm developing ios app , using shared-pointer boost library. app little chunky, i've been trying lean up. think moving line: #include <boost/shared_ptr.hpp> from individual files pre-compiled header file save me space since heard every include of shared_ptr recompiles different version , it's unclear whether compiler removing duplicates. when move line pch file ton of compile-time errors, of are: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'boost' i've changed .pch file sourcecode.cpp.h file in info, hasn't helped. thoughts? edit: verified there in fact duplicate copies of compiled shared_ptr in binary! you have c or objc sources in project. in case: #if defined(__cplusplus) #include <boost/shared_ptr.hpp> #endif xcode (by default) creates prefix every language/dialect in project, , if doesn't, it's still manually #include d. unfortunately, moving ...

javascript - Shadowbox.js hides my select inputs -

i'm sure can't first person have problem, haven't had luck finding solution. i'm using shadowbox in simplest form; doing image popup link like click <a href="myimage.png" rel="shadowbox">here</a> view image. this works fine, has 1 odd side effect: when click link, of select inputs (i.e. drop-down boxes) of form on page disappear. little snooping firebug reveals css being modified give <select> tags property visibility: hidden . when image dismissed, inputs reappear. not surprisingly, happens consistently across browsers. since inputs reappear, leave things are. however, if (for example) image can't loaded, , script can't display it, inputs stay invisible. also, looks strange , it's driving me batty. :d other factors may or may not relevant: i have done little shadowbox in past , missing embarrassingly obvious. my page , form generated cakephp. the page uses jquery, , shadowbox using jquery adapter...

asp.net mvc 3 - MVC Razor Rendering controls dynamically -

this 1 way i've found render controls dynamically asp.net mvc 3 razor. giving me correct data, i'm curious if sees red flags method, or painfully more obvious way this. @using (html.beginform()) { foreach (var item in model) { <tr> <td> @item.app_name </td> <td> @item.setting_name </td> <td> @item.setting_description </td> <td> @if (item.data_type == "bit") { @html.checkbox("setting_value", item.setting_value == "1" ? true : false) } else { @html.textbox("setting_value", item.setting_value) } </td> <td> @item.setting_value </td> </tr> } } you use editor , display templates instead... check out link: http://b...

java - Receive text message using J2ME -

i trying make j2me application send , receive text messages. i'm done sending part of not able receive message.. below tried in order receive text message; try { messageconnection conn = (messageconnection) connector.open("sms://:50001"); conn.setmessagelistener(new messagelistener() { public void notifyincomingmessage(messageconnection conn) { try { message msg; msg = conn.receive(); if (msg instanceof textmessage) { textmessage tmsg = (textmessage) msg; stringitem.settext("msg: " + tmsg.getpayloadtext()); system.out.println(tmsg.getpayloadtext()); } // else if(msg instanceof binarymessage) { // ..... // } else { // ...... // } } catch (ioexce...

How can I avoid type checking a python object if its attributes aren't used? -

i've come across answers here type checking in general, type checking numbers , , type checking strings . people seem respond saying type checking should never performed in python (< 2.6) due duck typing. (limited) understanding of duck typing type determined use of object's attributes. do if i'm not using attributes? i have simple function determines constants based on argument, should number. raise exception defined by class outofboundserror(valueerror): """ specified value outside domain. """ with message telling them number gave me big. keep message specific. if argument string (like 'charlie' ), still considers argument greater specified number (and raises exception). should add dummy line code argument + 2 typeerror raised? note: don't know abcs don't think they're available me since latest python version have access 2.5 : (. a common duck-typish python solution problem (tr...

css - Make ui-icon appear on same line as other text within <li> -

i'm bad css, , i'm trying ui-icon on same line text in li. <ul> <li class="ui-state-default"> <span>hello</span> <span class="ui-icon ui-icon-close"></span> </li> </ul> normally text doesn't within li, think it's ui-icon css, couldn't find causing it. further question comment above, i've found in jquery-ui css, assuming that's you're using: /* states , images */ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } changing (or overriding) display: block using display: inline-block should allow icon appear on same line

tools for finding errors in my jquery -

is there sort of tool (online or dlable) use check jquery code syntax errors, unclosed {}, or other things might cause not work expected? you can try jslint

iphone - displaying and storing Arabic characters -

i have array stores it's elements text file. want store arabic characters inside file have problems: when try write word in text display opposite not correct : ex. شجرة want store word when paste in text file converted backward direction tree becomes eert. i don't know unicode converting display in label?? can 1 me storing in array , display in label??? thank you. the new release of mac os x 'lion' going provide support arabic language system wide. assume fix problem of editing arabic characters in xcode. there support arabic text-to-voice services, new arabic 'speaker' or sound called majed.

does asp.net mysql security still need other party library for Providers -

2 years ago using mysql security providers [membership,role] code-project article: http://www.codeproject.com/kb/database/mysqlmembershipprovider.aspx do still need or current mysql-connector provide that? saw called [mysql.web.dll] replacement or not! please en-light , guide me, thanks, you can use mysql providers. work great. no need other providers. advantage of custom provider maybe more flexibility. customized our own provider, cannot switch. not sure more wanna know?

algorithm - All Possible combinations in C -

i'm trying find efficient algorithm in c, provides me combinations of given charset. the algorithm should not recursive. @ last number of digits should flexible. example: char set[] = "a1"; -> a1 aa 1a 11 i've found perl solution, uses substr() . think wasn't fast performance-wise. for algorithms in c, i've found permutations... a article in german c++ forum claims, c++-stl solutions faster "raw" recursive algorithms. if set size fixed n simple - have n for loops, each 1 nested previous one. since can't , can't use recursion, have calculate total required number of iterations (seems it's n^m), use 1 single loop , use / , % calculate array index of each character should be. you'd better use longs well, because n^m gets big fast.

galleria jquery plugin slow with lots of images -

has extended galleria plugin handle lots of images (over 200)? large number of thumbnails makes initial load take long time. you need use separate thumbnail files , option preload .

Conversion Problem in VB.NET -

i trying value of someinventory.inventoryid says type cannot used expression mean? var inventoryid = _ directcast(_controller.someheader. _ someitems(e.item.datasetindex).someinventory, someitem).inventoryid

jquery - Remove imgs from container if container possess a div with a certain class -

i have divs imgs in them. however, few of these divs have span first element within div. span represents 'label' imgs within div. i have script going if hold alt , click on 'packet' div, it'll removed. however, not want remove packets have labels in them. ones, removing imgs within enough. i've been having trouble establishing logic. well, convey ability delete clicking , holding alt key, attempted have css property change colors cue. too, not work. $(".card_packet").click(function (e) { if (e.altkey) { $(this).live('hover', function(event) { if (event.type === 'mouseover') { $(this).css({ 'border-color': 'red' }); } else { $(this).css({ 'border-color':'black' }); } }); if ($(this).find('sect_header')) { //if...

node.js - Linking to a static file from within statics in Expressjs -

i've got weird issue can't seem figure out expressjs. i've specified public folder static files such js, css , images. i'm using app.use(express.static(__dirname + '/public')); specify folder. works except 1 case. inside public folder, i've got 3 folders called js , css , images . within 1 of css files, i'm doing background-image: url(/images/bg.png) no-repeat; url not resolving , image not showing on page. however, if img(src='/images/bg.png') within 1 of views, image shows. i'm assuming has fact i'm linking static file , node/express ignoring routes(?) within static files. how 1 go linking images in css files located inside static folder in express? your css urls relitive stylesheet url have looking path /css/images/bg.png want have url ../images/bg.png

A way to limit taxonomy exposed filter options in view with arguments in drupal -

i'm building product catalog particular section displayed views argument, taxonomy id of section. but need give user ability further narrow down search specifying producer choosing term in vocabulary in exposed filter. i'm trying limit selection terms nodes in chosen section exist. looks views_selective_filter , view_hacks that, looks out of box neither of them takes account view argument. there remedy or workaround? use firebug or devel_themer module find form id of form displaying terms, use hook_form_alter in custom module intercept, , modify form.

java - How to approximate an ellipse to fill a given rectangle, using bezier curves? -

i tried code below, draws approximation of circle if rectangle's width same height; doesn't draw great oval, "corners" pointed. suggestions? float width = rect.width(); float height = rect.height(); float centerx = rect.width() / 2; float centery = rect.height() / 2; float diameter = math.min(width, height); float length = (float) (0.5522847498 * diameter/2); path.moveto(0, centery); path.cubicto(0, centery - length, 0, centerx - length, 0, centerx, 0); path.cubicto(centerx + length, 0, width, centery - length, height, centery); path.cubicto(width, centery + length, centerx + length, height, centerx, height); path.cubicto(centerx - length, height, 0, centery + length, 0, centery); you should scale length according axis it's on, distance each arc endpoint adjacent control points (not fixed but) fixed fraction of axis you're moving parallel @ point.

html - -webkit-border-radius does not crop image properly -

i have 5 browsers rendering html coded pages: ie9, firefox 4.0 , newest versions of chrome, safari , opera. in ie9 , firefox 4.0 image being cropped in using border-radius: , -moz-border-radius: fails in opera, chrome , safari using -webkit-border-radius:. opera image not being cropped @ , safari , chrome image cropped border being cropped out well. .nontyp{ margin: 15px 15px 15px 15px; border:4px inset #c1c8dd; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; width:200px; height:200px; } if have 1 of 3 browsers mentioned utilize -webkit-border-radius: please view images example of have issue with: graphics page what put styling that's on <img> tag now, on parent <a> instead use container image. this, @ least me, makes more sense well. don't forget keep float: left on image rid of phantom bottom margin either.

facebook - Geolocation APIs: SimpleGeo vs CityGrid vs PublicEarth vs Twitter vs Foursquare vs Loopt vs Fwix. How to retrieve venue/location information? -

we need display meta information (e.g, address, name) on our site various venues bars, restaurants, , theaters. ideally, users type in name of venue, along zip code, , present closest matches. which apis have people used similar geolocation purposes? pros , cons of each? our basic research yielded few options (listed in title , below). we're curious hear how others have deployed these apis , ones in use. fwix api: http://developers.fwix.com/ zumigo does facebook plan on offering places api accomplish this? thanks! facebook places based on factual. can use factual's api pretty (and still free, think?) http://www.factual.com/topic/local you can use unauthenticated foursquare straight places database. data of uneven quality since it's crowdsourced, find good. it's free api limit, think paid tier negotiated. https://developer.foursquare.com/ i briefly looked @ google places didn't because of restrictions on how have display results...

multithreading - MbUnit Icarus self-destructs on this test -

i'm trying test multi-threaded io class using mbunit. goal have test fixture constructor execute 3 times, once each row on class. then, each instance, execute tests multiple times on parallell threads. however, icarus blows 'index out of range' on taskrunner. can't full stack, spawns message boxes fast. what doing wrong, or bug in mbunit/gallio? using system; using system.collections.generic; using system.text; using gallio.framework; using mbunit.framework; using mbunit.framework.contractverifiers; using system.io; namespace imageresizer.plugins.diskcache.tests { [testfixture] [row(0,50,false)] [row(0,50,true)] [row(8000,100,true)] public class customdiskcachetest { public customdiskcachetest(int subfolders, int totalfiles, bool hashmodifieddate) { char c = system.io.path.directoryseparatorchar; string folder = system.io.path.gettemppath().trimend(c) + c + system.io.path.getrandomfilename(); c...

ruby on rails - How to set the signup page as homepage -

i've installed devise in ror app. want root site ( http://site.com ) displays devise sign page. if user logged, redirect user dashboard. but, if user go http://site.com/dashboard , not logged, redirect home page, user can see sign up. how can this? thank you update: in routes.rb there is root :to => 'users#index' and in users_controller: def index if user_signed_in? render 'dashboard' else redirect_to new_user_registration_path end end it's correct? add following routes.rb authenticate :user root :to => "user_dashboard#show" end root :to => "devise/sessions#new" change "user_dashboard#show" controller#method dashboard. authenticate devise specific method routes file. source: http://rdoc.info/github/plataformatec/devise/master/actiondispatch/routing/mapper#authenticate-instance_method

c preprocessor - Why doesn't changing a macro (#define) in a header file require a new build? -

i'm new c , discovered interesting. changed value of simple macro #defined in header file #define mrb 1000 to #define mrb 100 and when ran make again, said there no changes ("nothing done 'all'"). how macros work such don't need part of build? this has lot more how make works how macros work. if doesn't require rebuild, have specified dependencies incorrectly. read on makedepend .

sql - Oracle and Left Outer Join -

i confused hibernate generated oracle sql. there 1 user in database, don't have badges, doing left outer join on everything. user should come everytime, regardless of them having badge. if remove these lines, pulls user. isn't left outer join suppose bring no matter what? and b4_.active=1 , b4_.status='a' , ub2_.visible=1 , bl3_.active=1 hibernate sql ran in sql developer select this_.id id0_11_, this_.biography biography0_11_, this_.datecreated datecrea3_0_11_, this_.email email0_11_, this_.enabled enabled0_11_, this_.firstname firstname0_11_, this_.hideconnectors hideconn7_0_11_, this_.hideemail hideemail0_11_, this_.hidename hidename0_11_, this_.lastname lastname0_11_, this_.password password0_11_, this_.salt salt0_11_, this_.title title0_11_, this_.username use...

cocoa touch - how are cookies retrieved from itms links stored? -

i have app using wireless distribution install our beta users. install/upgrade links use form: itms-services://?action=download-manifest&url= the apache server we're hosting app @ protected via cookie based authentication mechanism. our basic problem although our authentication mechanism issuing delete cookie in question, seems itms (or possibly safari) on device not respecting delete, because subsequent requests contain original cookie . weird. my question is, persisting cookies itms links opened safari? safari itself? or itms on device? i can't find documentation on appreciated. scottcher, you're right. access log, itms-services agent looks like: itunes-ipad-m/5.1.1+(2;+16gb;+dt:75) while safari agent is: mozilla/5.0+(ipad;+cpu+os+5_1_1+like+mac+os+x)+applewebkit/534.46+(khtml,+like+gecko)+version/5.1+mobile/9b206+safari/7534.48.3

java - Trying to get a window to paint on itself when it loads -

this turned out more difficult thought would. i'm doing learning , poking around draw function. want program launch window contains, say, rectangle. size of rectangle scaled on size of window (i.e. if window 1000px , rectangle set scale @ 90%, rectangle 900px). have math figured out on how center , determine it's size, through use of stubs, have found using object.getwidth() , height, etc, returning 0 every time, b0rking math sizing. after thinking while, i'm assuming because trying obtain width , height object still being constructed. own logic, long math after build parts of constructor, should fine, alas -- appear wrong. i tried creating separate classes creates frame , 1 makes drawing. drawing object accepts jframe part of constructor , attempts draw on it. instantiate each 1 separately, frame first, drawing object (sending frame object it), doesnt seem work either. any suggestions? edit: per andrew's suggestion. here panel object added window packag...

iphone - comparing two numbers, getting the different bits in them and filling up a 16bit register, objective-C -

this may bit confusing. have 2 numbers, say x = 56 = 00111000 y = 50 = 00110010 can see there total of 4 different bits between them. need take bits , fill part of 8 bit register. , in same way take 2 numbers ( there 4 bits different in them ) fill remaining part of 8 bit register. know how using objective-c ? i don't know objective-c, wrote in c , tested it. hope don't mind: unsigned int diffbits(unsigned int x, unsigned int y) { unsigned int xor_xy = x^y; unsigned int result = 0; unsigned int count = 0; while (xor_xy) { if ( xor_xy & 0x01) { result |= ((x & (1 << count)) >> count); result <<= 1; result |= ((y & (1 << count)) >> count); result <<= 1; } ++count; xor_xy >>= 1; } // undo last left shift of 'result' in while-loop. result >>= 1; return result; } the logic is: x ^ y (x xor y) - gives bit locations in numbers x ...

android - Saving Gestures as bitmap -

i want know whether can save gestures bitmap in android layout. had asked similar question before never got reply please help... thanks we can save gesture bitmap gestureoverlayview gestureview = (gestureoverlayview) findviewbyid(r.id.gestures); gestureview.setdrawingcacheenabled(true); bitmap bm = bitmap.createbitmap(gestureview.getdrawingcache()); file f = new file(environment.getexternalstoragedirectory() + file.separator + "signature.png"); f.createnewfile(); fileoutputstream os = new fileoutputstream(f); os = new fileoutputstream(f); //compress specified format (png), quality - ignored png, , out stream bm.compress(bitmap.compressformat.png, 100, os); os.close();

grails - Search records having comma seperated values that contains any element from the given list -

i have domain class schedule property 'days' holding comma separated values '2,5,6,8,9'. class schedule { string days ... } schedule schedule1 = new schedule(days :'2,5,6,8,9') schedule1.save() schedule schedule2 = new schedule(days :'1,5,9,13') schedule2.save() i need list of schedules having day given list [2,8,11]. output: [schedule1] how write criteria query or hql same. can prefix & suffix days comma ',2,5,6,8,9,' if helps. thanks, hope have reason such denormalization - otherwise better save list child table. otherwise, querying complicated. like: def days = [2,8,11] // note check empty days schedule.withcriteria { days.each { day -> or { like('username', "$day,%") // starts "$day" like('username', "%,$day,%") like('username', "%,$day") // ends "$day" } } }

bmp - How to generate an image using C code -

the function below serves html when called, void generatehtml (int socket) { char* message; // sends http response header message = "http/1.0 200 ok\r\n" "content-type: text/html\r\n" "\r\n"; printf ("about send=> %s\n", message); write (socket, message, strlen (message)); message = "<html><body><p>hello world.</p></body></html>\n"; printf ("about send=> %s\n", message); write (socket, message, strlen (message)); } my output on web browser simple hello world message. however, want change display bitmap image instead. let's use 1x1 red pixel our bmp. i've modified function far by: void generatehtml (int socket) { char* message; // sends http response header message = "http/1.0 200 ok\r\n" "content-type: image/bmp\r\n" "content-length: ???w...

c++ - HTML Forwarding -

so i've been playing around simple html forwarding c++. haven't accomplished , have questions on backbone. first: need use special libraries other socket libraries forward html data , connections? second: when client connects html server, tcp connection kept open? or closed once data sent? third: when forward data, client server, packet includes destination address. should technically able read address , connect server via port 80, keep open, , send , receive on newly opened port right? there have do? time constraints? if directly forward every single packet directly between client , server website should show correctly on client, correct? i prefer keep external libs minimum. if necessary can expand program include required libraries. so far i've gotten data , both parties, website not function. [platform] :: windows.primary && posix_compliant.secondary first: no not need other special libraries not using available extent reinventing whee...

python - Different behavior due to different "looping styles" -

i have simple problem. navigate line in fine, , delete after that. use suitable file.truncate() call. however, 2 snippets of code below behave differently. 1) with open(file, "a+b", 1) f: #navigate marker while true: line = f.readline() if marker in line: f.truncate() f.write(stuff) break 2) with open(file, "a+b", 1) f: #navigate marker line in f: if marker in line: f.truncate() f.write(stuff) break (1) behaves expected. in case of (2), file in truncated several lines after marker found. speculate there buffering going on, can see, explicitly define buffering behavior "line buffered" open() call. any thoughts? use more intuitive "for line in file" syntax... from python documentation , 5. built-in types / 5.9. file objects: in order make loop efficient way of looping on lines of file (a common operation), next() method uses hidden read-ahead buffer. b...

javascript - backbone.js / access view from model -

how can access view model in backbone.js. i love re-render view on model.change(). adding views model's attribute no-no. why need access view model on change? in view, bind: this.model.bind('change', this.modelchanged, this) // (event, function, context) and on, when model changes, view's modelchanged method called automatically. in version >0.9 , proper syntax in view. this.model.on('change', this.modelchanged, this) // (event, function, context)

flash - gotoAndPLay to another layer -

i have 3 layers in first layer have 2 buttons operate different anims in layers 2 , 3 locate in different frames. when im calling gotoandplay frame number or label in different layer nothing working. problem? not possible use gotoandplay in different layer?

java - Get Web Service Context Listner in JAX-WS? -

when web service in loaded first time need send message(it contains url access service) 1 of installed web applications. web application keeping track of alive web services. how can achieve this? may not right way it...but need simplistic approach. can access web service context listner? if right way go... my environment jax-ws 2.2, javaee1.6, glassfish 3.1. i should have thought before putting question probable answer. here answer may many people know it. i using @resource annotation on instance of webservicecontext in web service class.

jsf - Facelets: new location for "xmlns:h" and "xmlns:f"? -

i'm trying use xml name spaces here, <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:f="http://java.sun.com/jsf/core" > but since oracle've eaten java, http://java.sun.com/jsf/ * links broken (thank oracle). anybody knows new locations? or maven dependency solves (com.sun.facelets.jsf-facelets, javax.faces.jsf-api, javax.faces.jsf-impl don't)? it doesn't matter broken. these identifiers , no links (though links). if page doesn't work, it's rather problem of missing libraries. replacing "sun" "oracle" won't work either ;-)

c++ - Input from stream to enum type -

how input stream enum type? i can so unsigned int sex = 0; stream >> sex; student.m_bio.sex = static_cast<sex>(sex); otherwise? inline std::istream & operator>>(std::istream & str, sex & v) { unsigned int sex = 0; if (str >> sex) v = static_cast<sex>(sex); return str; } if want ensure value valid, can this: enum sex { male, female, sex_count }; inline std::istream & operator>>(std::istream & str, sex & v) { unsigned int sex = 0; if (!(str >> sex)) return str; if (sex >= sex_count) { str.setstate(str.rdstate() | std::ios::failbit); return str; } v = static_cast<sex>(sex); return str; }

ruby on rails - looping through images and displaying associated image details -

i have edit page (for car model) loops through list of images , display description associated each image in text field user can edit it. my problem each image, instead of displaying associated description, descriptions associated car (and not particular image) displayed each particular image. e.g, if have editing car details , car has 3 images, each having description. 3 descriptions displayed each image, resulting in 9 descriptions field in on edit page. <% @car.images.each | image | %> <div class="car_photos"> <%= image_tag(image.data.url(:thumb), :alt => '') %> <% f.fields_for :images |builder| %> <%= render "imageedit", :f => builder %> <% end %> </div> <% end unless @car.images.first.new_record? rescue nil %> _imageedit.html.erb: <% f.fields_for :descriptions |builder| %> <p>description:<%= builder.text_area :desc %></p> <% end %> any ...

c - AES Encryption- large files -

i doing aes encryption using evp interface of openssl in c language in 128/192/256 cbc modes. found nice example in stackoverflow have started programming. what know is: what default padding used while encryption? what happens if have large data. have code divide data blocks of 128 bits? or evp interface takes care of it? what should size of iv 128bit, 192bit , 256bit cbc modes(where key lengths 128, 192, 256 respectively , block size 128) thanks there no default padding encryption. there several padding schemes. evp there encrypt final method takes incomplete block , adds padding (default pkcs padding) , encrypts it. evp take care of it. size of iv vector when cbc mode used same size block size.

ruby on rails - Validating models against the parent model -

i have 2 models, 1 parent of other, , parent accepts_nested_attributes_for , validates_associated children. however, of validations have :if needs check 1 of properties of parent. i thinking this: validates_presence_of :blah, :if => proc.new{|thing| thing.parent.some_value.present?} however, 'parent' relationship doesn't appear setup @ time of validation (i assume children instantiated , validated first. therefore there way of doing i'm thinking of? possible? you can use before_update or before_create callbacks per need this.. def before_update self.errors.add("error message") if self.parent.some_value.present? return false if self.errors.count > 0 end def before_create self.errors.add("error message") if self.parent.some_value.present? return false if self.errors.count > 0 end

html5 canvas - Draw multiple circles filled with image content -

i trying draw circles on canvas filled portions image. imagine clicking on white canvas , user clicked reveal portion of photo. i have found ways draw 1 circle, can not succeed using draw multiples. if repeat action other coordinates drawing not happening. function start_drawing(){ ctx.beginpath(); ctx.fillstyle = "rgb(255,255,255)"; ctx.fillrect(0,0,canvas.width,canvas.height);//fill background. color default black ctx.arc(mouse.x,mouse.y,45,0,6.28,false);//draw circle ctx.arc(mouse.x+100,mouse.y+100,45,0,6.28,false); ctx.clip();//call clip method next render clipped in last path ctx.drawimage(img,0,0); ctx.closepath(); } any idea on how can achieved ? thank you. later edit (the entire exact code used) <!doctype html> <html> <head> <script> window.onload=function(){ var canvas = document.getelementbyid('mycanvas'); var ctx=canvas.getcontext('2d'); var mouse={x:0,y:0} //make obj...