Posts

Showing posts from May, 2013

c# - Determine if window has close button (Or, why isn't GetTitleBarInfo working?) -

i'm trying determine if given window has close button using gettitlebarinfo function, recommended in this answer . when call function return value rgstate[5] - should indicate close button state - 0 , don't understand why. have idea i'm doing wrong here? alternatively, if 1 can suggest method information, helpful well. thanks! [dllimport("user32.dll", exactspelling = true, setlasterror = true)] internal static extern intptr getforegroundwindow(); [dllimport("user32.dll", setlasterror = true, charset = charset.auto)] [return: marshalas(unmanagedtype.bool)] internal static extern bool gettitlebarinfo(intptr hwnd, ref titlebarinfo pti); [structlayout(layoutkind.sequential)] internal struct titlebarinfo { public int cbsize; public rect rctitlebar; [marshalas(unmanagedtype.byvalarray, sizeconst = 6)] public int[] rgstate; } intptr handle = getforegroundwindow(); titlebarinfo titlebarinfo = new titlebarinfo(); titlebarinfo.cbsize = m...

c# - Home Index not loading when the application starts -

i working on asp.net mvc3 application. in views created folder named home , view named index. then created controller homecontroller. in controller added: public actionresult index() { return view(); } but when run application error: the resource cannot found. description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review following url , make sure spelled correctly. requested url: / if add address bar : /home/index view loads normally. how can make application automatically go home/index when loads? thanks help you need add route global.asax file points path. routes.maproute("default", "{controller}/{action}/{id}", new { controller = "home", action = "index", id = urlparameter.optional } );

lambda - Java 8 Pattern Matching? -

will java 8 support pattern matching scala , other functional programs do? i'm putting presentation of java 8's lambda features. can't find on particular functional-programming concept. i remember got me interested in functional programming quicksort implementation, compared imperative programming's implementation. i suppose not talking pattern matching in sense of applying regular expression on string, applied in haskell . instance using wildcards: head (x:_) = x tail (_:xs) = xs java 8 not support natively, lambda expression there are, however, ways so, computing factorial: public static int fact(int n) { return ((integer) new patternmatching( incaseof(0, _ -> 1), otherwise( _ -> n * fact(n - 1)) ).matchfor(n)); } how implement find more information in blog post: towards pattern matching in java .

connect forms through php and primary key -

i'm trying connect forms using 1 of inputs form of primary key. for example, ---first form primary key taken form1.php ---second form, page1 based on input form1 form2.php?page1=primary key ---third form, page1 based on input form2 form3.php?page2=primary key ---fourth form, page2 page1 form4.php?page3=primary key ---fourth form, page3 page2 and on, until last page. question how connect them? how retrieve primary , pass on form involved? far can pass primary key form2, when reaches form3, disappears. by way, after each form accomplished, proceeds process page. ---below code sample form <form id="form1" name="form1" method="post" action="eval_2.php"> <table width="100%" border="0" cellpadding="2" cellspacing="0"> <tr> <td width="70%"> <strong>1. quality of work </strong><b...

switch statement - javascript case not delivering proper value -

i setup case statement convert full state name short value html dropdown. (yes seems redundant, have multiple data sets coming in , must) here case statement var state_switch; //document.write(temp[1]); var state_case = temp[1]; //document.write("state ="); //document.write(state_case); switch (state_case) { case "alabama": state_switch="al"; break; case "alaska": state_switch="ak"; break; case "arizona": state_switch="az"; break; case "arkansas": state_switch="ak"; break; case "california": state_switch="ca"; break; case "colorado": state_switch="co"; break; case "connecticut": state_switch="ct"; break; case "delaware": state_switch="de"; break; case "district of columbia": state_switch="dc"; break; case "florida": state_switch="fl...

java - Get focus on a JTextField from another panel when a CardLayout changes -

hi need on swing application doing. have dialog 2 panels, first panel has cardlayout , second has flowlayout. first layout has buttons change card layout , buttonclick entered specific textfield on second panel. every time card layout changes, textfield on second panel loses focus. how focus of specific textfield of second panel? when clicking on button go anohter panel write code inside "actionperformed" of button actionperformed(actionlistenet al) { //code.. textfield.requestfocus();//what textfield u wnat } refer link setting focus text field

Azure Website missing msshrtmi when built on and deployed from TFS -

i'm trying deploy azure websites (preview) tfs (preview). build works , website deployed when code tries access azure roleenvironment website throws following exception: could not load file or assembly 'msshrtmi, version=1.7.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. system cannot find file specified. i've tried solutions proposed in following thread no luck. think has tfs. i have tested this: reinstalled azure sdk , tools removed platformtarget projectfiles wrote post-build event delete msshrtmi.dll targeted assemblies x64 (-> failed unit tests on tfs, seems x86, if allowing x64 in .testsettings) could not load file or assembly 'msshrtmi' or 1 of dependencies (azure table storage access) i've ran out of ideas on how troubleshoot issue? have suggestions? i've encountered similar issue in earlier versions of sdk when doing builds. solution wasn't entirely intuitive. if go thr...

gwt - Diffirence between hosted mode and development mode -

what diffirence between hosted mode , development mode in gwt? hosted mode old name development mode, they're same. there 2 modes, , they're named development mode , production mode development mode runs java whereas production mode compiles javascript. this means in development mode you're using true java.lang.string or java.util.arraylist instance, whereas in production mode it's emulated version that's being used. it lead different results (java's date quite not same javascript's one)

c# - Class variable availablility after event is fired -

i'm new event programming, , i'm misunderstanding i'm trying do. i have windows forms application subscribes events class. t //class provides event handler windows forms application. class foo { public string value{get; set;} // lots of other code public void oneventfired(object sender, eventargs e) { // attempt access variable value here. } } from windows form code i'm first setting variable value in class foo before triggering event execute code in oneventfired above. what i'm seeing when used in event handler variable value doesn't contain value set before event fired ( value null). i know can extend eventargs include variable data, i'm trying understand why i'm doing doesn't work. here's short example works. compare code work out what's wrong. using system; using system.windows.forms; class foo { public string value { get; set; } public void handleclick(object sender, eventargs...

android - Is it possible to monitor particular already known email account? -

if know email account, example abc.xyz@pqr.com , can monitor email attachment downloads of particular account. other requirements i want location of downloaded attachment can control downloaded things. control in sense encryption of downloaded file. is possible? is possible? if write own email client downloading of attachments, yes. or, if find email client offers api this, yes. speaking, though, not possible.

javascript - Is there a way to have a button in an email remotely send data? -

so have hidden form , 'i this' button insert emails send out. <form method="post" action="http://somewebsite.com/he_likes_it"> <input type="hidden" name="who_liked" value="helikedit@something.com" /> <input type="submit" value="i this" /> </form> i can insert button email fine. so, whenever email recipient clicks on button in email, post request form data sent server letting me know liked email. however, clicking on button opens link (new browser window/tab, etc.) directing users site. how prevent clicking of button opening link , send data in form server? i want button unobtrusive. don't want annoying email recipient having new tab open up. know possible javascript, however, i'm pretty sure email service provider escape javascript in emails should. for starters, forget javascript -- isn't going happen. no email client allow js through, risky. a...

android - "No XML content. Please add a root view or layout to your document." -

i trying follow tutorial : http://developer.android.com/training/basics/firstapp/building-ui.html new android developing , "activity_main.xml" file looks : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"> <edittext android:id="@+id/edit_message" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:hint="@string/edit_message" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" /> when click run error says "no xml content. please add root view or layout document." , noticed there ...

javascript - Able to get JSON data, but not showing up in Handlebars template -

i have following in page, ready to: <div id="result"></div> <script id="some-template" type="text/x-handlebars-template"> <table> <thead> <th>name</th> </thead> <tbody> {{#athletes}} <tr> <td>{{firstname}} {{lastname}}</td> </tr> {{/athletes}} </tbody> </table> </script> and following javascript firing below: var source = $("#some-template").html(); var template = handlebars.compile(source); var data = $.getjson("http://api.espn.com/v1/sports/baseball/mlb/athletes?apikey=axfy7dvwqzktu28srdjna8ta", function() { alert('load performed.'); }); $("#result").html(template(data)); i alert load performed , can see data in firebug, #result div not display data. if replace var data straight text below functions right: var data = { athletes:...

tfs - How to create rules between parent and child work items -

we trying impose couple of rules on our project , can tell if possible do? , if yes should start on this? one of example rule deliverable can’t closed non-closed children. this means in resolved state child item block closing deliverable. this should apply parent child link types only this apply deliverable parent , type of valid child there 2 ways can this. server-side: can add plugin tfs, changes workitems. example tfsaggregator . won't have solution specific problem, can show how change work items on server side. shouldn't big problem add case. problem solution is, changes workitem after has been saved. user still able close child, server re-open it. client-side: second solution custom control, can implemented in witd of work item. can invisible control, adds validation. can find examples here . downside of solution? have install custom control on every single client uses visual studio , may have develop specific version web-access.

System.exit() in android -

i know system.exit(0) should not used. have read plenty of tutorials stating why it's not recommended exiting applications , finish() better alternative ,but in rare case when dirty workaround used main question can harm android device or aspect of device if used? short answer: no. long answer: no, doesn't harm device or aspect of device. removes app memory , cleans used resources. if have files open, can become corrupted, filesystem won't. android should release , resources (gps, wifi, etc) have in use @ time, in undefined state. compare effects of system.exit() app-crash: wouldn't affect device either.

iphone - UIProgressView unprogressed color -

Image
i have uiprogressview want image. have set progress color not sure set unprogressed color (white color in image). here simple solution myself found on exploring properties uiprogressview : progressview.tracktintcolor = [uicolor whitecolor];

Keyboard stopped working on Intel x86 Android emulator after upgrading to ADT 20 -

i mean can't type laptop keyboard android emulator anymore. virtual , on-screen keyboards working fine. i had same problem after upgrading tools version 20. had edit avd add option follows: from eclipse, go avd mananger. select particular avd , click on edit go hardware section, click on new. select property name : keyboard support by default, added value of 'no'. click on value column , change 'yes'. click on edit avd again. this add property hw.keyboard=yes in config.ini file avd. , should work fine there.

c# - Changing a Polygon's Points -

solution dynamic margin on window drag so i'm trying polygon move window moved. have; private void resetpolygon(point point1, point point2, point point3) { speechpoly.points.clear(); observablecollection<point> mypointcollection = new observablecollection<point>(); mypointcollection.add(point3); mypointcollection.add(point2); mypointcollection.add(point1); foreach (point p in mypointcollection) { speechpoly.points.add(p); } } private void window_locationchanged(object sender, eventargs e) { if (this.isloaded) { point point1 = new point(newpoint3); point point2 = new point(newpoint2); point point3 = new point(newpoint1); resetpolygon(newpoint1, newpoint2, newpoint3); //write out values of both list , polygon screen! txtblock.text = newpoint1.x.tostring("n2") + ", " + newp...

c# - IE wants to download JSON result....MVC3 -

my mvc3 app uploads documents user our server. returning jsonresult display errors, if any: [httppost] public jsonresult savedocument(documentmodel model, httppostedfilebase postedfile) { //my wonderful code return json(new { success = true, message="ok" }); } heres how submit request: var issubmitting = false; var adddocumentoptions = { beforesubmit: beforeadddocumentsubmit, // pre-submit callback success: afterdocumentsubmit // post-submit callback }; $('#btncreatedocument').click(function (e) { e.preventdefault(); $('#diverror').html(''); if (!issubmitting) { $('#createdocform').submit(); } }); this javascript function runs when upload complete: function afterdocumentsubmit(responsetext, statustext, xhr, $form) { if (responsetext.success) { //no errors } else { $('#diverror').ht...

java - When is it appropriate to multi-thread? -

i think "get" basics of multi-threading java. if i'm not mistaken, take big job , figure out how going chunk multiple (concurrent) tasks. implement tasks either runnable s or callable s , submit them executorservice . (so, begin with, if mistaken on much, please start correcting me!!! ) second, have imagine code implement inside run() or call() has "parallelized" possible, using non-blocking algorithms, etc. , hard part (writing parallel code). correct? not correct? but real problem i'm still having java concurrency (and guess concurrency in general), , true subject of question, is: when appropriate multi-thread in first place? i saw example question on stack overflow poster proposed creating multiple threads reading , processing huge text file (the book moby dick ), , 1 answerer commented multi-threading purpose of reading disk terrible idea. reasoning because you'd have multiple threads introducing overhead of context-switching, on t...

Multiple expression if statement in Bash -

i recreate this if ( arg1 || arg2 || arg 3) {} and did got far, following error line 11: [.: command not found if [ $char == $';' -o $char == $'\\' -o $char == $'\'' ] ... i tried different ways none seem work some of ones tried for bash, can use [[ ]] form rather [ ] , allows && , || internally: if [[ foo || bar || baz ]] ; ... fi otherwise, can use usual boolean logic operators externally: [ foo ] || [ bar ] || [ baz ] ...or use operators specific test command ( though modern versions of posix specification describe xsi extension deprecated -- see application usage section ): [ foo -o bar -o baz ] ...which differently written form of following, deprecated: test foo -o bar -o baz

wpf - Excel doc contents to webservice -

Image
i have wpf staff creation window in can create basic information first name, last name etc creates staff in rest web service. example: client side: private void createstaffmember_click(object sender, routedeventargs e) { string uri = "http://localhost:8001/service/staff"; stringbuilder sb = new stringbuilder(); sb.append("<staff>"); sb.appendline("<firstname>" + this.textbox1.text + "</firstname>"); sb.appendline("<lastname>" + this.textbox2.text + "</lastname>"); sb.appendline("<password>" + this.passwordbox1.password + "</password>"); sb.appendline("</staff>"); string newstudent = sb.tostring(); byte[] arr = encoding.utf8.getbytes(newstudent); httpwebrequest req = (httpwebrequest)webrequest.create(uri); req.method = "post"; req....

security - How will a server become vulnerable with chmod 777? -

i read articles saying along lines of "chmod 777 bad!" i wondering: how become vulnerable when execute 'chmod 777' on file? what real world example of can reproduce? it allows filesystem content viewed and/or modified anyone : assuming attacker has general system access common on shared hosting platforms .. more "hardened" others start. here small incomplete list of possible attack vectors: "your safe code" overwritten "their malicious code" runs within same web-server context .. steal passwords/trojan, expose db, delete content, etc. is, someone else's code can run under your security context . content (e.g. "script source") can possibly viewed outside of web-server (or owner) context. have "secure" password connect db? well, not anymore... if content protected permissions (e.g. web-server couldn't access before), the web-server might able access/list sensitive information ... not...

objective c - Cocoa iOS Make a Rectangle into a Circle with Collisions -

so have uiview called fallingball collides nicely uiview called theblockview . using cgrectintersectsrect(theblockview.frame, fallingball.frame) detect collision. that's well, fallingball round, , top corners of theblockview rounded. this, used following code: //round top right-hand corner of theblockview uibezierpath *maskpath = [uibezierpath bezierpathwithroundedrect:theblockview.bounds byroundingcorners:uirectcornertopright cornerradii:cgsizemake(10.0, 10.0)]; cashapelayer *masklayer = [cashapelayer layer]; masklayer.frame = theblockview.bounds; masklayer.path = maskpath.cgpath; theblockview.layer.mask = masklayer; //round fallingball view [[fallingball layer] setcornerradius:30]; but, funnily enough, though nice , rounded, views still rectangles. question is: how can make cgrectintersectsrect treat them shapes like? there function works same uses view's alpha detect colli...

Oracle database connection in drupal 7 -

i want retrieve list of products external oracle database , show in drupal site catalog. problem that, how can make connection oracle db drupal 7 site. please suggestion on how perform operation highly welcome. thanks! connecting oracle database php easy: http://www.oracle.com/technetwork/topics/php/whatsnew/index.html so question want after connect. the simplest install php filter module, , insert php code node on site. a more flexible solution write little module of own run oracle queries , take appropriate action. there bit more learning required, provide more flexible solution in long run.

"The specified report server url could not be found" error while deploying to reporting server -

i want deploy report have created in sql server business intelligence development studio 2008 r2. have set targetserverurl http://mohammad-pc/reports . can access path through browser, want deploy report get: "the specified report server url not found" is there other setting missed? typically, in default installation, you'll have 2 url's: http://yourmachine/reportserver - for accessing web service , deploying reports http://yourmachine/reports - accessing browser-based management front-end depending on setup, first url may differ bit, example port number may different or suffix _sqlexpress may added. see last section of this documentation example urls. here's relevant quote on links may like: ...what report server url might resemble: - http://localhost/reportserver - http://localhost/reportserver_sqlexpress - http://sales01/reportserver - http://sales01:8080/reportserver - https://sales.adventure-works.co...

.net - Azure - Table Storage modeling -

is there reference how design table storage data? put in partition , in table? there principals follow(like er model in sql)? in general, need ensure content-searching efficient. data stored based on partition key , indexed on row key. if, say, have app id partition key , customer id row key, you'd have fast searching customer. however: imagine having search customer's last name (another property). you'd need table scan within app's partition. might need second table map customer's last name (as row key) customer id (a property). to see real-world guidance, take @ this msdn article .

html - CSS specific table -

i have html document have 2 different tables. 1 class alpha , 1 class beta. want assign css class beta only... td { border-style:solid; border-top:thick double #ff0000; } i can not figure out how assign beta. know how? live long , prosper. just apply .beta class selector entire table , change css code apply rule td decedents of .beta this: <table class="beta"> <tr> <td>...</td> <td>...</td> </tr> </table> .beta td { border-style:solid; border-top:thick double #ff0000; } if need apply rule multiple elements within .beta add additional selector this: .beta td, .beta th { border-style:solid; border-top:thick double #ff0000; } qapla'!

reporting services - Does SSRS have a cache -

i not trusting ssrs when renders. feel it's caching @ times , results not updated. there cache need worry force clear when i'm not sure? i noticed if run ssrs report right after changing proc, , run few minutes later different results. it's there delay when change proc when results in ssrs showing new data proc changes. it definitley has, think need configure caching explicitly (report manager, report properties, processing options). see caching reports section on msdn. there might other caching options used internally when exporting report, not case. maybe browser caching data well. try deleting browser cache , re-run report.

facebook - What is the correct setup for the auto-login of a returning, authenticated user with the Javascript SDK? -

hey fellow facebook developers, i've read dozens of related questions , tried every related example on developers.facebook.com can't 1 work: a user has visited website , authorized permissions request him via fb.login(callback, { scope: 'publish_actions,user_actions:news,user_interests' }); after calling fb.init({ appid: 'xxx', // app id status: true, // check login status cookie: true, xfbml: true // parse xfbml }); i can request access token valid time , use query kind of information user. without logging out anywhere (facebook or own website), if navigate page again (or hit reload), expect able use fb.getloginstatus(callback) and receive response of connected . in understanding, user should not have click anymore. what get, though, unknown . no matter in browser , no matter whether using real developer profile or facebook test user. i have subscribed events auth.authresponsechange , auth.statuschange fire, if ex...

calculating excess flow and overflowing in max flow algorithm -

Image
i reading push flow algorithms @ following link. http://community.topcoder.com/tc?module=static&d1=tutorials&d2=maxflowpushrelabel it mentioned excess flow - define excess flow e e(u) = f(v,u), net flow u. vertex u ∊ v-{s,t} overflowing / active if e(u) > 0. i looking example simple flow network how calculate e(u) ? thanks time , help. in diagram below there source node (s), sink node (t), , internal node (a). the numbers give flow (say in litres per second). there 3 litres per second entering a, 1 litre per second leaving a, excess flow 2. note in push-relabel algorithm, excess flow internal nodes cannot negative. in other words, not allowed have more flow leaving enters. the source node is allowed generate flow (it not count internal node note 1 not apply) during algorithm, excess flow reduced until @ end vertices have 0 excess flow you compute excess flow adding incoming flow, , subtracting outgoing flow. however, in practice, algorithm ...

actionscript 3 - Flash video in movieclip problems -

i have several video files playing on stage. i've converted them movieclips can scale , drag them clicking. problem cannot loop them. then tried make them swf playback object's after code wasn't working them. next step make them embedded video objects loop automatically , code working. after there appeared problem objects duplicating @ point. here's original code videos movieclips. var alldraggables:array = new array(); var mousehold = false; stage.addeventlistener(mouseevent.mouse_up, mup); function mup(mouseevent) { mousehold = false; } function draggableobject(mc) { var mouseonthisobject = false; alldraggables.push(mc); mc.addeventlistener(event.enter_frame, drag); mc.addeventlistener(mouseevent.mouse_down, mdown); function mdown(mouseevent) { mousehold = true; mouseonthisobject = true; } function drag(mouseevent) { if (mousehold == true && mouseonthisobject == true) { mc.addeventlistener(event.enter_frame, dragger); ...

javascript - Onchange ,Arrow key up,down works in FF & Chrome but not work in IE -

it jquery code <script type="text/javascript" charset="utf-8"> $(document).ready(function() { $("#tasks").hide(); $("select#categories").change(function(){ $("#tasks").show(); $.getjson("ajax.php?module=responsibles&action=list_tasks",{id: $(this).val()}, function(j){ if($("#categories").val()=="-0") { $("#tasks").hide(); } //if div hidden $("div#form_objectifs").hide(); var options = ''; (var = 0; < j.length; i++) { options += '<option value="' + j[i].op...

Can I safely require Perl's DBI instead of using it? -

i have large script has no database connection yet. need 1 tiny new feature. safe add naked block require dbi need or need import something? # lots of no-database code here... $obj; { require dbi; $dbh = dbi->connect('dsn'); $obj = modulethatneedsdbh->new(dbh => $dbh); } $obj->fancystuff(); # more no-database code... the block keep $dbh hidden rest of program of course. by default dbi module imports nothing calling package yes, in theory use require instead of use . but hoping gain this? in case use dbi equivalent begin { require dbi } , , if omit begin block imposing lengthy process of loading package during run time undesirable. note must handle failure connect database. my $dbh = dbi->connect('dsn', 'user', 'pass') or die $dbi::errstr; although dying may little extreme in case.

javascript - How to set the src attribute of a ngInclude element in the call back of a ajax request? -

the example @ nginclude shows how update src attribute of nginclude element. in similar way, trying assign template path variable in callback of ajax request. after assignment, doing $rootscope.$apply($scope.setmaintemplatepath) . injecting $rootscope function containing callback. but getting following error: error: 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [["fn: function (){var a=d.url();if(!n||a!=f.absurl())n++,c.$evalasync(function(){c.$broadcast(\"$locationchangestart\",f.absurl(),a).defaultprevented?f.$$parse(a):(d.url(f.absurl(),f.$$replace),f.$$replace=!1,h(a))});return n}; newval: 30; oldval: 29"],["fn: function (){var a=d.url();if(!n||a!=f.absurl())n++,c.$evalasync(function(){c.$broadcast(\"$locationchangestart\",f.absurl(),a).defaultprevented?f.$$parse(a):(d.url(f.absurl(),f.$$replace),f.$$replace=!1,h(a))});return n}; newval: 31; oldval: 30"],["fn: function (){var a=d.url();if(!n...

html - linking to root level then images folder -

i have file structure looks this: my site structre http://retailsitecommon.afstores.com/develop/freshmarket/screen%20shot%202012-07-02%20at%2012.12.00%20pm.png i trying use root-level links images because have footer needs used in subfolders of subfolders has images in it. instance, in styles.css file trying background: url('/images/logo.png') no-repeat;, image doesn't show up. if background: url('../images/logo.png') no-repeat;, image appears. doing wrong? i think need on server work like. try setting lamp on pc or mamp on mac.

android - disabled listitems in alertdialog does not show up as grayed out items -

this scenario. i have activity in have show dialog box (which listview wit 2 options optiona , optionb). listview used in single choice mode. option disabled(the user not allowed select option a) these code fragments private void createdialog() { boolean disableoptiona = false; ... alertdialog.builder builder = new alertdialog.builder(this); builder.settitle(getstring(r.string.codec_title)); listview modelist = new listview(this); final arrayadapter<charsequence> modeadapter = custommenuadapter.createfromresource(this, r.array.codec_decoder, android.r.layout.simple_list_item_single_choice, disableoptiona); modelist.setchoicemode(listview.choice_mode_single); modelist.setadapter(modeadapter); builder.setview(modelist); final dialog dialog = builder.create(); ... } the codec_decoder array contains 2 options optiona , optionb. code custommenuadapter follows. public class custommenuadapter extends arrayadapter<char...

ruby on rails 3 - Can "belongs_to" be defined more than once in Active_Record? -

i trying write database company in town. using devise authentication, , forem forums of site. decided have 1 class, "account" devise authentication, have many different access types site. the bulk of users customers, segregated routes (not rails routes, street routes). decided have them have own profile model. i want - profile linked account, , route. (routes named gmr_routes) is code proper way it? documentation i've found hasn't told me can't, want sure.... class profile < activerecord::base attr_accessible :first_name, :last_name, :phone_number, :street_address belongs_to :account belongs_to :gmr_route end account has has_one relationship profile, , gmr_route has has_many. is right? bryan yes, that's acceptable. need remember include foreign key id on model belongs_to. so in case describe, have account_id:integer , gmr_route_id:integer in migration, , include in attr_accessible call in model ...

batch file - Conditional execution (IF, ELSE) NOT WORKING -

i want write batch script statement where: findstr has check string , if found print out failed , end program if not found go check/look string , if found print out succeeded , close program, if not found print out error message again. ideas? here did: echo checking log file errors... findstr /c:"open failed" some_log.txt && (echo deployment failed. cscript //nologo success_mail.vbs pause) || findstr "rc (return code) = 0" && (echo deployment successful. cscript //nologo fail_mail.vbs pause) i don't know why not working. appreciated. here latest 1 looks like: echo checking log file errors... findstr /c:"open failed" some_log.txt some_log.txt && ( echo deployment failed. cscript //nologo fail_mail.vbs goto offshore ) || ( findstr /c:"rc (return code) = 0" some_log.txt && ( echo deployment successful. cscript //nologo success_mail.vbs goto off...

java - duplicate class definition error with derby / openjdk-6 -

im getting following exception when attempting connect derby server via openjpa: attempted duplicate class definition name: "sun/security/pkcs11/sunpkcs11" . looking through google results looks theres known problem java on mac, im using ubuntu, , openjdk-6. im not sure start solving this. ideas whats going wrong? java -version output: java version "1.6.0_24" openjdk runtime environment (icedtea6 1.11.1) (6b24-1.11.1-4ubuntu3) openjdk 64-bit server vm (build 20.0-b12, mixed mode) error stack trace (lengthy...) exception in thread "main" <openjpa-2.2.0-r422266:1244990 nonfatal general error> org.apache.openjpa.persistence.persistenceexception: there errors initializing configuration: java.lang.linkageerror: loader (instance of sun/misc/launcher$extclassloader): attempted duplicate class definition name: "sun/security/pkcs11/sunpkcs11" @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.definecla...

agile - How do you close an issue marked "Will Not Address" in Atlassian JIRA? -

how close issue that's marked "will not address" in jira? it seems can close other type of issue, once it's marked this, it's impossible close. i have version: atlassian jira (v5.0.6#733-sha1:f48fab7) it seems having custom workflow in jira not allow closing issues marked "will not address". need contact jira administrator solve that. you can if have jira administrator rights. https://confluence.atlassian.com/display/jira/configuring+workflow

jsf - Drawing an interactive ER Diagram for a web application -

how can draw eer diagram database? using jsf , want represent database schema having tables attributes , relationships between tables in order inform users database schema. also, want have clickable attributes on tables. of feasible? tried use datatables jsf , css hard because every time database not same, javascrpit/jquery cannot solve prob (e.g how draw relationships). found libraries http://www.jointjs.com/ (is javascript diagramming library). seems still there many restrictions e.g provide attributes arraylist or have clickable attributes. advice? thank you try using graphviz - can generate dot file of database schema programatically, clickable urls . can generate svg file, , render in browser. if like, can take @ open-source library can generate dot files database schema, such schemacrawler or schemaspy, part of way towards problem solution. sualeh fatehi, schemacrawler

node.js - Querying after populate in Mongoose -

i'm pretty new mongoose , mongodb in general i'm having difficult time figuring out if possible: item = new schema({ id: schema.objectid, datecreated: { type: date, default: date.now }, title: { type: string, default: 'no title' }, description: { type: string, default: 'no description' }, tags: [ { type: schema.objectid, ref: 'itemtag' }] }); itemtag = new schema({ id: schema.objectid, tagid: { type: schema.objectid, ref: 'tag' }, tagname: { type: string } }); var query = models.item.find({}); query .desc('datecreated') .populate('tags') .where('tags.tagname').in(['funny', 'politics']) .run(function(err, docs){ // docs empty }); is there better way this? edit apologies confusion. i'm trying items contain either funny tag or politics tag. edit document without clause: [{ _id: 4fe90264e5caa33f04000012, dislikes: 0, ...

java - Parsing an ISO 8601 string local date-time as if in UTC -

in java need make calendar object string in format: yyyy-mm-dd't'hh:mm:ss this string set gmt time. here's code: public static calendar datedecode(string datestring) throws parseexception { timezone t = timezone.gettimezone("gmt"); calendar cal = calendar.getinstance(t); date = new simpledateformat("yyyy-mm-dd't'hh:mm:ss"); date d = date.parse(datestring); cal.settime(d); return cal; } and then: calendar cal = calendar.getinstance(); try { cal = datedecode("2002-05-30t09:30:10"); } catch (parseexception e) { // todo auto-generated catch block e.printstacktrace(); } int month = cal.get(calendar.month)+1; and following output: timezone: gmt+00:00 date: 2002-5-30 time: 7:30:10 which can see wrong since time provided in gmt , not cet. think happens think time provided in cet (which current timezone) , therefore converts time cet gmt , therefore ...

android - Activate a specific dimens.xml at runtime -

i need choose specific dimens.xml @ runtime after app checks screen capabilities. don't want android choose me selecting automatically project folder (\values, \values-large, ...). i have manually due bad screen configuration (density , dimension) of low-cost china tablet. can that? have tried force configuration change? displaymetrics metrics = new displaymetrics(); metrics.densitydpi = displaymetrics.density_medium; metrics.setto(metrics); not sure if works though. it's bad idea ignore os thinks best.

mod rewrite - Mod_Rewrite to redirect `/about/` to `page.php?page=about` -

i'm creating website mod_rewrite. @ moment urls redirected page name .php on end. but /about/ , /photos/ should redirect page.php?page=about , page.php?page=photos . is there way this? current code: rewriteengine on rewritebase /new/ rewriterule ^about/$ /new/page.php?page=about [l] rewriterule ^([^/]*)/$ /new/$1.php [l] rewriterule ^blog/([^/]*)/$ /new/blog.php?page=$1 [l] rewriterule ^blog/post/([^/]*)/$ /post.php?post=$1 [l] rewriterule ^blog/category/([^/]*)/$ /category.php?category=$1 [l] is want? rewriterule ^blog(/?)$ /new/blog.php [l] rewriterule ^blog/([^/]*)(/?)$ /new/blog.php?page=$1 [l] rewriterule ^blog/post/([^/]*)(/?)$ /post.php?post=$1 [l] rewriterule ^blog/category/([^/]*)(/?)$ /category.php?category=$1 [l] rewriterule ^(?!blog)([^/]*)(/?)$ page.php?page=$1 [l]

c# - How to get values from a list<class> -

i have these classes, want use login, check if email , password same, redirect respective page. public class account { public account(){} public int accid { get; set; } public string emailaddress { get; set; } public string password { get; set; } public string name { get; set; } public string company { get; set; } public string position { get; set; } public string department { get; set; } public string mobileno { get; set; } public string officeno { get; set; } } public static sadatareader doselectquery(string sql) { saconnection myconnection = new saconnection(db_str); //open connection myconnection.open(); //create command object. sacommand mycommand = myconnection.createcommand(); //specify query. mycommand.commandtext = sql; //create datareader command sadatareader reader = mycommand.executereader(); return reader; } public static list...

objective c - Don't know how to encrypt database using SQLCipher -

i have included sqlcipher project explained in link: http://sqlcipher.net/ios-tutorial/ but not sure how encrypt database have read description above link not getting. doing if application opening first time copy database(i.e. without encryption) document directory. 1 more thing database blank when copying bundle document directory. have tried use sqlite3_key function after opening database nothing encrypted. didn't found how encrypt database when copying bundle document directory. planning use fmdb better reply according that. please guide me how or point direction if there tutorial it. suggest should standard approach that. instructions in sqlcipher api page [1] using sqlcipher_export(), under "example 1: encrypt plaintext database" [1] http://sqlcipher.net/sqlcipher-api/#sqlcipher_export