Posts

Showing posts from January, 2013

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

what is .net framework -

i have been asked in interview .net framework.how can define layman the .net framework is : common language runtime – provides abstraction layer on operating system base class libraries – pre-built code common low-level programming tasks development frameworks , technologies – reusable, customizable solutions larger programming tasks

video - Open source converter which can convert mp4 to 3gp and 3gp to mp4 -

please provide me link of open source exe can call .net , convert mp4 3gp , 3gp mp4. thanks finally got answer: using ffmpeg can like: ffmpeg -y -i input.mp4 -r 20 -s 352x288 -b 400k -acodec libfaac -ac 1 -ar 8000 -ab 24k file.3gp

layout - Get dimensions after setLayoutParams in Android -

in android, after call view.setlayoutparams , how can find out dimensions (width & height) , position (x & y coordinates) of view? if query these properties after setlayoutparams return invalid values. according documentation, view.onsizechanged called after size of view changed. means have subclass widget dimensions want query, override onsizechanged , notify activity of change? haven't tried myself, long you've added view child , called invalidate() after you've set layoutparams, think should able determine width , height.

java - Hibernate query filter on collection -

i want execute following query: from item i.categoryitems.catalogid = :catid that yields in following exception: illegal attempt dereference collection googled, found hibernate forum post https://forum.hibernate.org/viewtopic.php?p=2349920 recommended me following: from item i, in (i.categoryitems) i.catalogid = :catid this kind of works, there's problem this: returns me object array item object , categoryitem object. i'm interested in single item object (list) my mapping of 'item': <hibernate-mapping package="be.xx.xx.xx.xx.domain" default-access="field"> <class name="item" table="item"> <id name="articleid" column="article_id" type="long"> <generator class="assigned" /> </id> ... ... <set name="categoryitems" table="category_item"> <key column="item_id" />

directory - MFC CFileDialog don't work correctly in Windows 2000 -

i develop visual studio 2008 (windows 7) , use cfiledialog(true, null, lastpath, null, szfilter); the important parameter third (lastpath) in specific directory! works fine windows 7 in windows 2000 dialog works if lastpath (lpctstr lpszfilename) empty (otherwise dialog doesn't open) any ideas!? thanks , greets leon22 ok, have found error: don't set initial directory lpszfilename! right usage: cfiledialog odlg(true, null, null, null, szfilter); odlg.m_ofn.lpstrinitialdir = lastpath.getbuffer(0); // set initial dir greets leon22

android - button style -

Image
normal button looks like: now, please let me know, how can make simple button same attached image button (i.e. button corner shape round , there no gap between 2 buttons) 9-patch work fine here, try avoid them since it's hard me them :( you can try having selector , using shape each state: the shape this: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#aaffffff"/> <corners android:bottomrightradius="7dp" android:bottomleftradius="7dp" android:topleftradius="7dp" android:toprightradius="7dp"/> </shape>

java - Can I use SQL's IN(...) statement for a namedQuery? -

how can use in @ namedquery? @namedqueries( { @namedquery(name = "getavailableproducts", query = new stringbuilder("").append("select p product p p.type= :type , (p.available in ('i want define changeable size of array or sometinhg that') or p.available = :available)")), } i mean can set 'type' parameter (i defined variable----> :type) , want define variables inside of in statement to. number of parameters not constant. want define array or :array[] , want set when call namedquery. @namedqueries( { @namedquery(name = "getavailableproducts", query = "from product p p.type= :type , (p.available in (:availablecollection) or p.available = :available)", } and in code hibernate: query.setparameterlist('availablecollection', yourcollection); edit in jpa write query.setparameter('availablecollection', yourcollection); and according this should work.

Cookies On Mobile Phone -

can use cookie or session object in mobile website control login php page? yes. mobile phones use web browsers support cookies (unless phone old), cookie based login shouldn't problem.

tfs - check in procedure in Visual Studio's Team System -

in team we're using visual studio's team system our source control. i'd add sort of check in procedure, i.e., compiling whole code before checking in, , if code not compile, not allow check in. i've googled issue used wrong keywords. i'd appreciate help. thanks team foundation server 2010 supports gated builds. means can shelve changes in tfs, , have build process check them in when build succeeds including changes.

android - java.lang.ClassCastException: org.ksoap2.serialization.SoapPrimitive? -

i calling web service android client application. after getting response when trying display getting classcastexception. following code: public void onclick(view v) { setcontentview(r.layout.report); soapobject request = new soapobject(namespace, method_name); epcdetails epcdetails=new epcdetails(); epcdetails.setepcid(input_val.gettext().tostring()); request.addproperty("id", id soapserializationenvelope sse=new soapserializationenvelope(soapenvelope.ver11); sse.setoutputsoapobject(request); sse.addmapping(namespace, productdetailsrequest.productdetailsrequest.getsimplename(), productdetailsrequest.productdetailsrequest); sse.implicittypes=true; sse.setaddadornments(false); androidhttptransport aht=new androidhttptransport(url); try { aht.call(soap_action, sse); soapobject response= (soapobject) sse.getresponse(); item_code.settext((charseque

ios - UINavigationController Drill Down with Table View -

i have uitableview lists contents of document directory. have zip files in that. if touch file in uitableview , corresponding zip file unzipped , extracted in temporary directory ( nstemporarydirectory() ). the problem how navigate contents extracted in tableview. if suppose, extracted zip file contains folders, should able view them in tableview. flow should drill-down. i able extract zip files, problem is, have navigate them in uitableview . this didselectrowatindexpath: part: nsstring *filepath = //filepath; if ([[nsfilemanager defaultmanager]fileexistsatpath:filepath]) { nslog(@"file exists @ path: %@",filepath); } else { nslog(@"file not exists @ path: %@", filepath); } nsstring *tmpdir =nstemporarydirectory(); ziparchive *zip = [[ziparchive alloc] init]; bool result = no; if ([zip unzipopenfile:filepath]) { //zip file there if ([zip unzipfileto:tmpdir overwrite:yes]) { /

ruby on rails 3 - RSpec and CanCan Controller Testing -

i'm using rspec , cancan in project. i'm testing permission logic in specs related ability class. controllers want make sure i'm doing authorization check. set controller macro, doesn't seem working correctly. so have 2 questions. one, strategy sufficient testing permission logic of controllers (or should testing controller authorization logic more)? two, see i'm doing wrong make not work? #plan_orders_controller.rb def approve plan_order = planorder.find(params[:id]) authorize! :update, plan_order current_user.approve_plan_order(plan_order) redirect_to plan_order_workout_plan_url(plan_order) end #controller_macros.rb def it_should_check_permissions(*actions) actions.each |action| "#{action} action should authorize user action" @plan_order = factory(:plan_order, :id=>1) ability = object.new ability.extend(cancan::ability) controller.stub!(:current_ability).and_return(ability) action, :

regex - Constructing a Regular Expression from a Finite Automata -

i'm trying construct regular expression finite automaton found self stuck one. regex use this: ? = 0 or 1 * = 0 or more += 1 or more | = or _ = empty string @ = empty set () = parentheses as understand strings must either "b*" end "a*" or end "a+bb+" have ((b*(a+(bb))*)*) doesn't take account string ending 'a'. as said, i'm 100% stuck , can't head around how supposed work this. image: http://img593.imageshack.us/img593/2563/28438387.jpg code: type of automaton fa states q1 q2 q3 q4 alphabet a b initial state q3 final states q3 q4 transitions q1 q2 q1 b q3 q2 q2 q2 b q2 q3 q4 q3 b q3 q4 q4 q4 b q1 any solutions or tips appreciated! it isn't possible q2 final state. remove , resulting dfa should easier convert. as understand strings must either "b*" end "a*" or end "a+bb+" have ((b*(a+(bb)) ) ) doesn't take account string

php - Verification e-mail not sent -

hey, have set piece of code below send verification e-mail subscriber. doesn't seem reach them(testing on own) i'm using http://localhost/ test site, don't know if that's problem. i'm receiving message verification e-mail has been sent should sent. here's code: if(mysql_query("insert users(username,password,email,fname,lname,hash) values('$username','$password','$email','$fname','$lname','$hash')")or die (mysql_error ())){ echo "welcome, have signed up. please check verification e-mail sent you."; $to = $email; $subject = 'signup | verification'; $message = ' signing up! account has been created, can login following credentials after have activated account pressing url below. ------------------------ username: '.$username.' password: '.$password.' ------------------------ please click link activate accou

perl - Eval within if statement -

how can dynamically pass eq or ne inside perl if statement? tried below not working: my $this="this"; $that="that"; $cond='ne'; if($this eval($cond) $that) { print "$cond\n"; } you don't need eval this. use dispatch table : sub test { %op = ( eq => sub { $_[0] eq $_[1] }, ne => sub { $_[0] ne $_[1] }, ); return $op{ $_[2] }->($_[0], $_[1]); } if (test($this, $that, $cond)){ print "$cond\n"; }

php - Sending data between sites -

what method send data site site b without passing new url parameter? for instance, on site submit apples red via form. how can send data site b without modifying site b's url structure? example http://siteb.com/?data=apples+are+red not sure if trackbacks or pingbacks use similar method. if you're trying submit form directly siteb, use method="get" , action="http://siteb.com" lets sending offset siteb use determine page number arcticles listing, form on sitea like: <form method="get" action="http://siteb.com"> <input type="text" name="offset" id="offset" value="0" /> <input type="submit" value="ok" /> </form>

java - Maintaining Session using HTTPClient on a Rails Application -

i have applet talks rails application. wish maintain user's session applet's communication recognized part of user's browsing session. use apache's httpclient send request rails application not recognize request part of users session. this code use build request, pass in session_id variable , http_cookie variable applet parameters: httpclient client = new httpclient(); cookie httpcookie = new cookie("localhost", "http_cookie", http_cookie, "/", null, false); cookie sessionid = new cookie("localhost", "session_id", session_id, "/", null, false); httpstate initialstate = new httpstate(); initialstate.addcookie(httpcookie); initialstate.addcookie(sessionid); client.setstate(initialstate); postmethod post = new postmethod("http://localhost:3001/vizs/add"); any suggestions great! slothishtype i solved following code:

javascript - Clearing a jQuery Form -

i have been doing research on way clear jquery form. i have couple of ideas want know if has better way. i know using reset, necessary set field particular value may not accomplished reset. (ie. if form starts pre-filled data , want clear it) i have read discussion here: resetting multi-stage form jquery but have idea post answer. please let me know think , if have better solution. more information: for example have address form. has couple of inputs, selects, radios, etc. along copy new button , clear button. default want have particular radio selected option 1. <div id = "addresslist"> <div class = "address"> <input type="radio"/> --obviously options here <button>copy new</button> </div> </div> the user selected option 2 , clicks copy new. on click of click of copy new: $("#addresslist").append($(this).closest("#address").html()); in second address secon radio button se

c++ - What are best practices for dealing with out of memory errors? -

i'm wondering, practices dealing out of memory errors. void sometask() { try { someobj obj = new someobj(); } catch( std::bad_alloc& ) { // should done here? } // ... more code ... } i feel silently returning wrong because program running in indeterminate state. so, should happen here, should leave program crash, or there better alternative? program runs service, can't pop error message. guess might possible log if there's enough memory left that. but, i'm wondering, think should in kind of situation? thanks. since it's service, write error system message log. in windows, can use windows event log api . unless you've specified otherwise in documentation, sysadmin expect see failure report. also, in c++ compilers, std::bad_alloc() has superseded null return value failed heap allocations. -paulh

html - I need to apply the css for a specific class and id -

i need apply css specific class and id of element this. <div class="contents" id="contents"> i tried #contents .contents { ... } but doesn't seem work. how apply css specific class , id ? added with #contents.contents {...} it works ok. #contents.contents { ... } … should work fine. problem somewhere in code haven't shared us. #contents .contents { ... } … means "an element member of class contents descendent of element id contents "

asp.net - Sign data in ASPX on client side -

in application, client must sign (using certificate) , send data server. doubt how should it? to sign on client side, should use activex right? problem firefox doesn't support it. signing on server side have 2 options: save private key on server , use when necessary (if data modified during transaction sign false data) send private key when necessary (may comprise key) despite using ssl, i'm not confortable of 2 options signing on server side... using activex may cause application more vulnerable, right? hope can me :) there's no single solution client-side signing in browsers, unfortunately. working on distributed signature components our secureblackbox product, , we've created java applet, activex control , flex script perform signing. however, variants have shortcomings. example, activex control can access windows certificate store. other module types user need load certificate pfx (pkcs#12) file. uploading , signing on server won't wor

php - checking database for necessary updates using dateDiff -

hey stackoverflowers. im having few problems code have written check database on refresh if record dates on database between specified $min , $max values. if not record updated. have done far. // check database necessary updates $update = mysql_query("select * rent"); while($row = mysql_fetch_array( $update )) { $datetime_lower = datetime::createfromformat('d/m/y', $min); $datetime_upper = datetime::createfromformat('d/m/y', $max); $datetime_compare = datetime::createfromformat('d/m/y g:i a', $row_update['pdate']); $diff_lower = $datetime_lower->diff($datetime_compare); $diff_upper = $datetime_upper->diff($datetime_compare); if ($datetime_lower < $datetime_compare && $datetime_upper > $datetime_compare) { // date between min , max, nothing } else { // date not between min , max, update cell colour $result = mysql_query("update rent set colour='f0f0f0

java - Create web service using Eclipse -

i trying create first webservice using eclipse javaee under axis2, following turorial eclipse tutorial learn how make it.i make webservice when want assure ws has been deployed through viewing through url, http status 400 occure. how can know error?? here make exactly: i make settings in preferences [ ant , axis2, tomcat , java ]. new -> new dynamic web page new ->java (i create class want convert ws) new ->web service (i want create bottom ws). type http://localhost:8080/axis2/services/listservices in url of browser this return http status 404 - /services/listservices can 1 tell me how can know error? or how can define it? edit: exception happen in console of eclipse : org.apache.axis2.transport.http.axisadminservlet java.lang.classnotfoundexception: org.apache.axis2.transport.http.axisadminservlet what should ,in configuration specify axis2 , eclipse shows axis2 runtime loaded after creating new work space , create webservice again, output app

syntax - Strange django admin error -

i've fired project clean on new machine , when entering admin got following error, indicates syntax error in forms.py ( believe admin's forms). seen before ? : environment: request method: request url: http://djtest.test.rte.ie/access/admin/ django version: 1.1.2 python version: 2.4.3 installed applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'tagging', 'rte_utils.filetransfers', 'rte_utils.syncr', 'rte_utils.twitter', 'rte_utils.youtube', 'rte_utils.flickr', 'rte_site', 'rte_site.static_pages', 'rte_site.artifact', 'rte_site.candid', 'rte_site.events', 'rte_site.playforward', 'rte_site.setspy', 'debug_toolbar'] installed middleware: ('django.middleware.cache.updatecachemiddleware', 'django.contrib.sessions.middlewar

Perl in Windows Vista 32bit? -

i want practice perl in windows vista 32bit, how can ? thanks. download active perl , enjoy http://www.activestate.com/activeperl

html - Images and List Items -

i'm looking way display image on webpage. image needs right of list item within unordered list. preferably, i'd within list item tags after text within list item. however, when place image within list item tags, bumps image down next line. know why happening and/or way fix it? thanks. in css set background-image image in question, background-position:right, , add width of image right padding. create illusion of image appearing right of list item.

How to call WCF Service that requires Headers from Silverlight -

wcf 3.5 sp1 services / called silverlight 4 in situation vendor has created wcf api, both svc services, custom proxy client. both aspects of api sit on top of core four-layer abstraction. first there 2 abstract messagecontract classes: wcfrequest , wcfresponse. the abstract wcfrequest type contains properties decorated messageheader attribute, , contain things such custom authentication identifier , timezone. then there second layer of onion each method divided 2 classes: getsomethingrequest , getsomethingresponse, both of inherit wcfrequest , wcfreponse, respectively. next comes implementation layer, wcfrequest , wcfresponse based types bubble , invoked custom wcfclient type, controls channelfactory construction, establishes binding, , importantly, sets identifier header in wcfrequest type based on set value in memory (like session key). lastly comes view ouside world, request poco types via id values. now, api written in such way if use vendor supplied proxy, thi

android - Neither constructor nor onFinishInflate called for custom view -

i have custom view (which extends glsurfaceview) i'm trying use in app. xml layout uses appears being loaded correctly (attributes set view applied), neither view's constructor nor onfinishinflate method being called class. should add i'm new android platform stupid mistake. here main.xml <?xml version="1.0" encoding="utf-8"?> #<!-- status bar --> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:background="@drawable/status_bkg"> #<!-- location label --> <textview android:text="location" android:textcolor="#ffffff" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" /> #<!-- date/time

delete all files in a folder with php -

possible duplicate: how delete folder contents using php hi, is possible delete children within parent directory , delete the parent directory in php? edited: when use scan dir why first 2 elements of array show '.', '..'?: > array ( [0] => . [1] => .. [2] => evga-nvidia-graphics-card4d0fe6868d2f8.jpg [3] => image4d0eaafb920a0.png [4] => image4d0eab086a106.png ) many thanks the first elements in array ( . , .. ) references directory ( . ) , parent directory ( .. ). every non-root directory in filesystem have both of them. ignored hand in kind of scripts. if use directoryiterator can tell if current element you're iterating on either . or .. isdot() function.

javascript - JQuery how to click div inside li to update another div -

i have ul appending li's 2 div's through javascript it, shown below c_list = $('.encounter_creatures_list > ul') db.transaction( function(transaction) { transaction.executesql( 'select * creatures;', [], function (transaction, result) { var creature_array = new array(); (i=0; < result.rows.length; i++){ var row = result.rows.item(i) li = $("li[key='" + row.id + "']") if(li.length > 0) { // $('#name', li).html(encounter.name) } else { creature_array.push(row) var counter = 0 li = $("<li key='"+ row.id + "' class='list_"+ row.id + "'>"+ row.name + "<div class='plus_"+ row.id + "'>+</div>

group by - Get line counts of INSERT's by tablename from mysqldump - awk, sed, grep -

bash master needed... to compare mysqldumps multiple dates, need sql group by, order functionality... on command line... using grep / sed / awk need insert statements, export line count per tablename. i'd love byte count per tablename too... a typical line looks this: insert `admin_rule` ... match insert, match tablename in ``, counting unique tablename how little awk snippet: begin { fs="`" } /^insert/ { count[$2]+=1; bytes[$2]+=length($0) } end { for(table in count) print table "," count[table] "," bytes[table]; } edit: test case here: $ cat test.sql insert `t1` values('a', 12, 'b'); insert `t2` values('test', 'whatever', 3.14); insert `t3` values(1, 2, 3, 4); insert `t2` values('yay', 'works', null); insert `t2` values(null, 'something' 2.71); insert `t3` values(5, 6, 7, 8); insert `t5` values('beta', 'gamma'); insert `t6` values('this', &#

design patterns - Business logic on stored procedure -

i working stored procedures in order access db data. trying put business logic in code , not in stored procedures. have case don't know how solve: i have table like: items(item_id, itemd_name, item_price) 700 items in it. now want display client items , names. since develop web, don't want load 700 items, using paging - 40 items @ time. (when writing "load" meen stored procedure returns datatable , code wrote converts each row item class - why don't want load 700 items, proccess many data don't need) so wrote stored procedure knows 40 items. now, need summarized items prices , add 16% tax. the problem can't use 40 items store procedure because need summarize price+tax of 700 items. the solution found use stored procedure return price+tax sum. basically using 2 different stored procedures, 2 different (albeit connected) business requirements, , ok in book. the first 1 is: display page of data given offset , page size. second 1

javascript - How can I dynamically resize my iframe, avoiding the browser security crossdomain restrictions? -

we have embeddable badge creates iframe. needs dynamic size; changes size based on data loaded 3rd party api or our database. it's not known height before loads. it's invoked tag loads script our server, creates iframe set specific src. on own machine, within iframe can do window.parent.document.getelementbyid('my_frame').style.height=new_calculated_height+'px'; but of course when it's embedded in page different iframe src, fails due crossdomain restrictions ('unsafe access attempt' error in ff, etc.). as we're loading script host page full access, kind of silly. basically, need variable, new height, iframe host page. could in reverse maybe? have function on host page ask iframe it's element's offsetheight? this can real pain in butt working cross browser. i suggest use easyxdm ( http://easyxdm.net/ ). it's javascript library uses postmessage transport on modern browsers , uses javascript ninja on old bro

c# - Why Is XDocument.Descendants().Count() > 0 for an Empty Document? -

here's method: var document = xdocument.parse(source); if (document.descendants().count() > 0) { // code shouldn't execute } else { // code should execute } this code breaks when in 'document' variable: <ipb></ipb> since doesn't have descendants, why entering if conditional? shouldn't try load anything, yet , breaks when finds nothing scrape. using breakpoints can confirm document variable has content posted above when breaks , enter if. have tried using: document.root.descendants().count() > 0; the root element sits below xdocument.

PHP char coding, #==0, 0==NULL, #!=NULL -

i need use special character stop/break signal program. trying out '#' '&' '@' , kept on receiving errors. after messing around, discovered characters including ones above had numeric value 0! did comparing values numerics, because @ first thought used ascii codes. wait minute, that's not right, because null equals 0! characters not equal null! so, kind of char coding php use? impossible compare chars numbers? thanks in advance! i'm assuming you're doing like: var_dump("#" == 0); // bool(true) when comparing numbers, strings cast numbers deal situations '123' == 123 . string '#' , or in fact pretty every non-numeric string, casts 0 . that's why there's === operator: var_dump("#" === 0); // bool(false) welcome weakly typed languages. http://www.php.net/manual/en/language.types.type-juggling.php

dll - Which is called first, DllMain() or global static object constructor? -

i writing dll defines global static object. in object's constructor doing initialization may or may not succeed. is possible signal success or failure of initialization process in dllmain() ? of 2 called first ? thank you. msdn's dllmain documentation says: if dll linked c run-time library (crt), entry point provided crt calls constructors , destructors global , static c++ objects. therefore, these restrictions dllmain apply constructors , destructors , code called them. since code within dllmain may use static objects, static objects must constructed before dllmain run dll_process_attach, , destroyed after run dll_process_detach. you can verify simple test exe , test dll. exe: int _tmain(int argc, _tchar* argv[]) { wprintf(l"main, loading library\n"); hmodule h = loadlibrary(l"test.dll"); if (h) { wprintf(l"main, freeing library\n"); freelibrary(h); } wprin

java - GXT/GWT html content reloads when switching tabs -

i working on gxt/gwt project. have 2 tabs in content set based on selections drop down menu. content in 1 tab embedded video (google video or youtube video) the problem when switching tabs, video reloads , starts beginning again. able switch tabs , have video continue play or pause when focus switches tab. any ideas, always, appreciated. cheers, ben i'm agree @mmohab. it's iframe's behavior , doesn't related flash. reload problem solve using gxt's htmlcontainer class , seturl() method instead of using tabitem or contentpanel 's seturl method. htmlcontainer wraps given html or url page body's div tag , not iframe: htmlcontainer html = new htmlcontainer("www.youtube.com"); yourtabitemobj.add(html);

asp.net - What's the official Microsoft way to track counts of dynamic controls to be reconstructed upon Postback? -

when creating dynamic controls based on data source of arbitrary , changing size, official way to track how many controls need rebuilt page's control collection after postback operation (i.e. on server side during asp.net page event lifecycle) point @ dynamic controls supposed rebuilt? arity stored retrieval , reconstruction usage? by "official" mean microsoft way of doing it. there exist hacks session storage, etc want know bonafide or @ least microsoft-recommended way. i've been unable find documentation page stating information. code samples work set of dynamic controls of known numbers. it's if doing otherwise tougher. update : i'm not inquiring user controls or static expression of declarative controls, instead dynamically injecting controls code-behind, whether mine, 3rd-party or built-in asp.net controls. this depends on problem @ hand, , type of controls you're recreating. simple text boxes or various different complex custom us

objective c - Call the official *Settings* app from my app on iPhone -

at 1 point in app, redirect user official settings app. if possible, want go straight network section within settings app. i think need settings app's url scheme , format construct request. doubt calling such official app forbidden. can can me? as noted in comments below, no longer possible in ios version 5.1 , after. if on ios 5.0, following applies: this possible in ios 5 using 'prefs:' url scheme. works web page or app. example urls: prefs:root=general prefs:root=general&path=network sample usage: [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"prefs:root=general"]] [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"prefs:root=general&path=network"]]

c# - wp7 and dependency property : onChanged and onRead? -

well want build wp7 control,so write , go well, problem can intercept on write(see onitemssourcepropertychanged)but not on read explain better: public static readonly dependencyproperty itemssourceproperty= dependencyproperty.register( "itemssource", typeof(observablecollection<objwithdesc>), typeof(horizontallistbox), new propertymetadata(onitemssourcepropertychanged) ); static void onitemssourcepropertychanged(dependencyobject obj,dependencypropertychangedeventargs e) { ((horizontallistbox) obj).onitemssourcepropertychanged(e); } onitemssourcepropertychanged called when use setvalue(dp,..) there isn't onitemssourcepropertyread ? called when use getvalue()? thanks you add onread action getter of backing field: public string itemssource { { // call onread functionality here! return (string)getvalue(itemssourcepro

dns - Consuming external webservices in domain driven design -

i want consume external third party web services in domain driven design project, not able understand in layer should access external web services. in domain services don't think , because domain services domain objects only. requirements that, have perform list of operation based on input external webservice , have perform task in domain service. confused. what do, introduce interface required service in terms of domain model in domain project. every time class in domain needs service, pass reference implementation of interface. then create "connector implementation" implements interface , connects webservice required use. when start application, provide domain classes implementation, instance using dependency injection framework. this connector has reference domain model , web service definition. domain model has no reference connector implementation or webservice - knows of interface defined in domain project. called inversion of control. this way, d

Getting jQuery ajax and asp.net webmethod xml response to work -

i have asp.net webmethod returns xmldocument object. can call method using jquery ajax, can't seem function succeed (server side webmethod gets called correct parameters client side method fails 'undefined parser error'). to reproduce, asp.net c#: [webmethod] public static xmldocument test(string name) { xmldocument result = new xmldocument(); xmlelement root = result.createelement("data"); result.appendchild(root); xmlelement element = result.createelement("anelement"); element.setattribute("name", name); root.appendchild(element); return result; } javascript: function callfordata(name) { $.ajax({ type: "post", url: "appname.aspx/test", data: "{'name': " + name+ "'}", contenttype: "application/json; charset=utf-8", datatype: "xml", success: function (response) { parsexml(response)

portable executable - how to delete temp files (clean up) generated by a java program? -

i working on portable java app generates files on fly on user's pc (windows xp). now, want delete temp files after java program's exit. obviously, java's file deletion mechanism can not trusted. if mark file deleted on exit (file.deleteonexit() ) , of times not deleted. use wrapper (java2exe) run executable. suggestions or solutions welcome ? thanks, deep i suspect reason deleteonexit failing because application still has files open when application exits. cause delete fail on windows due lingering file locks. the solution close streams temporary files before exit.

quilt patch with a new file -

i'm trying create new quilt patch 1 file added. unfortunately file seems ignored. i did quilt new some_patch , quilt add some_file . can see file in quilt files then, when refresh, back: nothing in patch some_patch after pop some_patch, added file not removed , nothing saved patch (patch file not created). what doing wrong here? you have add file quilt first, before writing it. quilt can track difference. if add after writing it, there no change after that.

android - SeekBar value gets Reset in preference automatically if I choose any other control in the preference -

i have added seekbar control preference java code. it's got added , shown in preference. added edittextpreference , checkbox preference. dragged seekbar value. after if select checkbox seekbar gets reset initial value ( meant selected seekbar value not staying ...it going back...). please guide me went wrong? what think may need implement onseekbarchanged , add onprogresschanged function code, have reset seekbar preference current value. since didn't include code, nor did specify, don't know if ever tried reset value. if didn't, makes sense seekbar set preference value. hope helps bit.

c# - Using a string argument to represent an object -

if have following code: textbox txtusername = new textbox(); void setenabled(string str, bool enable) { // use str find textbox object // str.enabled = enable; } is kinda thing possible? i want passing in 'username' , prepending 'txt'. for asp.net cotrols try control.findcontrol method and winforms use controls.find()

ruby on rails - API docs generation tool -

i have restful api written on rubyonrails(restfulie gem). best way generate api documentation project sources? rake doc:app turn rdoc formatted comments methods formatted html

regex - PHP using regular expression to parse query string -

how use preg_match query string url? http://www.example.com/imgres?imgurl=http://www.example.com/images/blue-diamond-rings.jpg how 'imgurl' using preg_matches above url? php has functions parsing urls , query strings, don't need use regular expression. $parts = parse_url("http://www.mysite.com/imgres?imgurl=http://www.mysite.com/images/blue-diamond-rings.jpg"); $query_string = $parts['query']; parse_str($query_string, $output); echo $output['imgurl'];

visual studio 2010 - Compile views at build time VS2010? -

possible duplicate: asp.net mvc - compiler errors in views i'm using asp.net mvc 2 visual studio 2010, , hate runtime errors. compile errors happen when browse page bad. is there way can have views compile when hit build? does enabling mvcbuildviews help? to enable mvcbuildviews make following change in project file <mvcbuildviews>true</mvcbuildviews>

.net - Session-in-view and TransactionScope -

we have asp.net webforms app using nhibernate. here specifics: we need distributed transactions because write database queue. because web app, use recomended session-in-view pattern. have httpmodule opens nhibernate session on beginrequest event , closes on endrequest. within flow of request, have several separate moments need transactional work. this, use transactionscope. so basically, happens (pseudocode): using(var session = sessionfactory.createsession()){ using(var tx1 = new transactionscope(){ //work work work tx1.complete(); } //other work using(var tx2 = new transactionscope(){ //work work work tx2.complete(); } } however situation see lot of crashes related connection database. researching gave 2 suggestions: use nhibernate transaction within transactionscope create session within transactionscope however, have 2 questions these suggestions: doesn't nhibernate automatically enlist transactionscope. why need create tran

dynamic - How to compute destination path for a file in InnoSetup dynamicaly? -

i need compute destination path file before copying. if path not exist won't copy file during installation. is possible? for example, can call computepath.exe store result variable? you not need call external program that. computation can done using pascal script, , can use fileordirexists() function determine if path exists. if not enough, can take different approach: extract file temporary directory , call computepathandcopy.exe passing temp file name parameter. exe compute path, check if exists , perform file copy.

datetime - PHP: report table with date gaps -

i have table in db contains summaries days. days may not have values. need display table results each column day user selected range. i've tried play timestamp (end_date - start_date / 86400 - how many days in report, use datediff(row_date, 'user_entered_start_date') , create array indexes), i've got whole bunch of workarounds summer time :( examples or ideas how make correct? p.s. need on php side, because db highly loaded. try datetime object: $reportdate=date_create($user_startdate); $interval=new dateinterval('p1d');//1 day interval $query="select s.start_date, s.end_date, s.info summary s s.start_date>='$user_startdate' , s.end_date<='$user_enddate'"; $r=mysqli_query($db,$query); while($row=$r->fetch_assoc()){ $rowdate=create_date($row['start_date']); while($reportdate < $rowdate) {//won't work if $rowdate timestamp! //output $reportdate , blank row $reportdate

c# - How to write path that requires username and password? -

i want perform file copying local hdd server - access server require insert username , password, @ manual when write server name: \neoserver window popup , after inserting username , password server's file appeared. perform copying use command: file.copy(source path, destination path) how can write server's path in way won't require user@pass??? you can use process.start call copy command line executable right credentials , parameters. for best control, use processstartinfo supply information needed: processstartinfo startinfo = new processstartinfo("copy"); startinfo.arguments = "source dest"; startinfo.username = myuser; startinfo.password = mypassword; process.start(startinfo);

zend framework - Need suggestings setting up Zend_Acl -

suppose have classes/models projects (has many lists) lists i want allow users collaborators of project able add lists. how do that. know should use zend_acl_assert pass resource. edit/delete pass list itself. add seems more should project. seems more correct if move listscontroller#addaction() projectscontroller#addlistaction() ? 1 possibility but if want listscontroller#addaction() how can setup acl? $acl->allow('user', 'list', 'add', new assertclass()); will pass 'list' resource. can somehow pass project object instead? not seem make sense tho can somehow pass project object instead? as long object implements zend_acl_resource_interface , has been registered in acl, can use want.

android - how to receive broadcastrecevier, when device's date automatically change? -

i using action_date_changed in broadcast receiver, , android.intent.action.date_changed in <receiver>...</receiver> in manifest file. got result, when user set device's date manually using application->date & time setting->set date. don't want it, want receive, when device change date automatically ie depending upon device's time.is possible? use alarmmanager , set recurring alarm goes off @ midnight.

sql server - Maintenance window and recovery for a large database -

one of our teams developing database large (~500gb) , grow there (i know 500 gigs may seem small many of you, 1 of larger databases in our shop). 1 of issues grappling backing , restoring database. basically, database have several "data" tables , 1 table used storing images / documents. need accomplish following: be able backup , restore data tables (sans images) our test server debugging , testing purposes. in event of catastrophic database failure, restore data tables of application , running asap. then, restore images table when possible. backup database within allotted nightly time window (a few hours). my questions are: is possible accomplish first 2 goals while still having images stored in same database? if so, use filegroups, filestream, or else? how other shops backup databases in reasonable time window while maintaining high availability? replicate second server , backup there? we have dealt similar issues. $2.5b solar manufacturing c

javascript - Raphael graphic not showing in IE8 -

right i'm having trouble getting simple raphael graphic show in extjs panel. afterrender: function(){ var size = math.min(this.getheight(), this.getwidth()); this.innerel = this.el.createchild({ cls : 'ext-ux-clock-inner' }); this.canvas = raphael(this.innerel.dom, size, size); var circle = this.canvas.text(50, 40, 'test').attr( { font : '14px helvetica, arial', stroke : "none", fill : '#fff' }); timelinewindowpanel.superclass.afterrender.apply(this,arguments); } the text shows fine in firefox , chrome, can't seem text display in ie8. i've tried using uncompressed version along minified version no luck. know why raphael doesn't work ie8 extjs? edit: if change ie8 compatibility mode shows raphael graphic i found work around ie8. seems ie8 attempts draw onto canvas before extjs window appears on

.net - Parallel.For in C# -

i trying convert following collatz conjecture algorithm from: public class collatzconjexture { public static int calculate(int startindex, int maxsequence) { int chainlength = 0; int key = 0; bool continutecalulating = true; int longestchain = 0; int64 remainder = 0; (int = startindex; <= maxsequence; i++) { chainlength = 1; remainder = i; continutecalulating = true; while (continutecalulating) { remainder = calculatecollatzconjecture(remainder); if (remainder == 1) continutecalulating = false; chainlength += 1; } if (chainlength > longestchain) { longestchain = chainlength; key = i; } }

c# - Infragistics Ultragrid valueList/UltraDropDown -

what event need handle allow users add "fruit" either valuelist or ultra dropdown. since kvp format exception dictionary<int,string> fruits = new dictionary<int,string>(); private void fruitinit() { //create fruit fruits.add(-1,"apple"); fruits.add(-2,"banana"); //create , add ultradropdown ultradropdown fruitultradropdown = new ultradropdown(); fruitultradropdown.datasource = fruits.tolist(); fruitultradropdown.displaymember = "value"; fruitultradropdown.valuemember = "key"; myultragrid.displaylayout.bands[0].columns["mycolumn"].valuelist = fruitultradropdown; } what event can handle when user types "grape" can add dictionary own key, , gets added dropdownlist. if type "grape in cell, format exception. regards _eric got response mike@infragistics, didn't kn

troubleshooting jquery/ajax json data retrieve -

i have following code uploaded tomcat server code suppose retrieve information other server, reason not happening there no reply other server following code error function alert"handshake didn't go through" $(document).ready( function() { var home_add='http://mywebsite.net:3300/gateway'; $('#handshake').click(function(){ alert(" sending json data"); $.ajax({ /* start ajax function send data */ url:home_add, type:'post', datatype:'json', contanttype:'text/json', async: false, error:function(){ alert("handshake didn't go through")}, /* call disconnect function */ data: { "supportedconnectiontypes": "long-polling", "channel": "/meta/handshake", "version": "1:0"

c# - Implement WPF in WinForms after GUI design is done -

is there freeware library out there let me add pretty wpf style graphics existing winforms gui project after-the-fact? know take coding, i'm asking best way (library or other) make winforms gui pretty after done. perhaps better convert wpf? see: migrate vb.net 2.0 winform 3.5 wpf this post describes tool written rob relyea looks through instantiation of win forms controls, initializecomponent(), , generates xaml should create equivalent gui. here's codeplex project similar - windows forms windows presentation foundation converter or might @ radcontrols winforms , telerik. idea leave in winforms, use win forms controls, have more of wpf , feel.

asp.net - The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>) -

i trying add panel child control of panel in codebehind of master page, it's simple as: panel1.controls.add(panel2) however when try that, error: the controls collection cannot modified because control contains code blocks (i.e. <% ... %>). there number of questions talk having <%= %> elements in head section, not have. have been far remove <% %> elements page, no avail, error still occurs. can suggest way work? * example answer b * === code error === <script type="text/javascript"> jquery(document).ready( function() { alert('hello!'); jquery("#<%=txtsampleid.clientid %>").focus(); } ); </script> === code without error === <asp:placeholder id="dontcare" runat="server"> <script type="text/javascript"> jquery(document).ready( function() { alert('hello!'); jqu

javascript - How can I delay a jQuery .blur function? -

i'm using code validate input field, don't want pull text field until half second after field loses focus. how can that? $(document).ready(function() { $("#group_id").blur(function() { $("#gmsgbox").removeclass().addclass('messagebox').text('checking...').fadein("slow"); $.post("group_availability.php",{ group_id:$(this).val() } ,function(data) { if(data=='invalid') { $("#gmsgbox").fadeto(200,0.1,function() { $(this).html('please enter valid group id').addclass('messageboxerror').fadeto(900,1); }); } else { $("#gmsgbox").fadeto(200,0.1,function() //start fading messagebox { $(this).html('group id available').addclass('messageboxok').fadeto

php array data in mysql -

i new mysql , php. need put array php data table: the array looks this: $memberdata key value apple 5 banana 8 salmon 3 candle 4 .......... , 100 more... my mysql table looks this: membertable id(int11)=pk memid(int11) stuff(varchar) value(int2) 1 23 apple 5 2 23 banana 8 3 23 salmon 3 4 23 candle 4 5 45 banana 1 6 45 apple 9 so each member; here member 23 , 45 can have same stuff other values, every member have 1 php array of data. (mysql id auto increment). my question: there possibility store array directly mysql table...? in book read make foreach loop , in loop open connection database... thought maybe time consuming: book example: $cxn = mysqli_c