Posts

Showing posts from June, 2012

api - what is the opengl current vertex? -

this found in opengl documentation: void glgetvertexattribfv(gluint index, glenum pname, glfloat *params); gl_current_vertex_attrib params returns 4 values represent current value generic vertex attribute specified index. generic vertex attribute 0 unique in has no current state, error generated if index 0. initial value other generic vertex attributes (0,0,0,1). glgetvertexattribdv , glgetvertexattribfv return current attribute values 4 single-precision floating-point values; glgetvertexattribiv reads them floating-point values , converts them 4 integer values; glgetvertexattribiiv , glgetvertexattribiuiv read , return them signed or unsigned integer values, respectively; glgetvertexattribldv reads , returns them 4 double-precision floating-point values. but problem is, have no idea current vertex is. how set current vertex...

asp.net mvc 3 - Avoid layout page refresh on click of a link -

i writing web application in mvc3 consists of master page (header / menus) not change. when click on linkit causes refresh og whole page correct redraws whole screen , becomes annoying because on every post , whole screen flickers. is there way not refresh layout page? thanks in advance replies. put want refresh in 1 view , make action point this,just that: //layout head... <div id='maincontent'> @html.action("content","somecontrol") </div> //layout foot... and use post new content , replace it: //in refresh event $.post("/somecontrol/content",function(data){ $("#maincontent").html(data); })

How in increase the performance while creating an object of a class in c# -

i know silly question ask, want know difference in below given statements: abc object= new abc(); object.age=obj1.age; object.place=obj1.place; object.street=obj1.street; object.number=obj1.number; object.pobox=obj1.pobox; and abc object= new abc() { age=obj1.age, place=obj1.place, street=obj1.street, number=obj1.number, pobox=obj1.pobox }; will above written code in increasing performance? want know if there way can increase performance while creating object of class , assigning values class object? no. these statements compiled same il there no performance improvement. the first one: il_0031: newobj instance void testapplication.abc::.ctor() il_0036: stloc.1 il_0037: ldloc.1 il_0038: ldc.i4.1 il_0039: callvirt instance void testapplication.abc::set_age(int32) il_003e: nop il_003f: ldloc.1 il_0040: ldc.i4.1 il_0041: callvirt instance void testapplication.abc::set_place(int32) il_0046: nop il_0047: ldloc.1 il_0048: ldc.i4.1 il_0049: callvirt...

asp.net mvc 4 - editorfor picks string template instead of double -

i'm having issues view model in project contains number of doubles in them ie. public class myviewmodel { public double left { get; set; } public double right { get; set; } public double top { get; set; } public double bottom { get; set; } } in view have @html.editorformodel if there no other custom templates in project renders correctly , textbox double on in it. as put string template in view/shared/editortemplate , put inside of whatever in template gets rendered instead of double template. i have thought though have overriden string template order selecting templates remain same, , double template choosen before string template existed. the string template consisted of (no @model ) <h2>string</h2> am missing here, why string template choosen here? i've determined can put double template in views shared folder , render instead seems shouldn't have that. edit: as per darin's answer created own double editortemp...

java - android intent-filter <data> is not working correctly -

i trying have application intercept on specific url in browser. following code in manifest: <activity android:name="com.myactivity.rootactivity"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="http" /> <data android:host="subdomian.maindomain.com" /> </intent-filter> </activity> it working fine @ moment, when open link http://subdomain...

unity3d - Import existing animation file to unity web player model -

i'm trying import existing .anim file existing unity model. know how in unity, , build html file, i'm wondering there method using unityscript or javascript? mean using javascript load .anim file model in unity web player, if there solution, thanks! resource.load allows that. var mdl : gameobject = resources.load("animations/"+ animationfolder+"/" + aname); if (!mdl) { debug.logerror("missing animation asset: animations/" + animationfolder+"/"+aname + " not found."); } else { var aclip = mdl.animation.clip; charanimation.addclip(aclip, aname); debug.log(charanimation[aname].name + " loaded resource file " + animationfolder + "/" + aname + ". length check: " + charanimation[aname].length); }

vb.net - Sharing usercontrols and classes under solution -

i have vb.net solution few projects. have several common user controls , classes used in projects. include classes "as link". if copy controls 1 form (linked) controls not copied while generic .net controls copied well. is there place under "solution" can put such code common project included? you might create project (something [xxx].dependencies or [xxx].controls or [xxx].utils) , rest of projects refer it. this make common controls/utility classes separated main project: easier writing test cases, more reusable future projects.

html - How to make a List items to select -

i have box in have displayed list of cities, want make selectable user can select multiple cities.thanks in advance my code is: '<div class="box" style="display: inline-block;margin-left: -330px;"> <ul multiple="multiple" style="list-style-type: none;"> <li>mumbai</li> <li>bangalore</li> <li>hyderabad</li> <li>chennai </li> </ul>' you want use form item rather list if want them selectable; so: <div class="box" style="display: inline-block;margin-left: -330px;"> <select multiple="multiple"> <option value="0">mumbai</option> <option value="1">bangalore</option> <option value="2">hyderabad</option> <option value="3">chennai</option> </select> hth;

sqlite - How to write IN type query in android(pre-populated database) -

i have query in have multiple in statements . query select tcf.car_make,tcf.car_model,tcf.car_ver,prices,rear_parking_sensors,airbags,engine_immobilizer,power_windows,integrated_in_dash_music_system,steering_adjustment car_feature tcf join car_spec tcs tcf._id=tcs._id , tcs.prices between '0' , '80,00,00,000' , tcs.fuel_type in ("petrol","diesel","null","null") , tcf.car_make in ("null","null","null","null","null","null","null","force motors","ford","hindustan motors","honda","null","null","lamborghini","land rover","null","null","null","null","null","null","null","null","null","null","null","null","null","null","null") m...

ruby on rails - How to disable Premailer for individual emails -

we have couple of instances don't want premailer process emails in our rails project. is possible turn off premailer individual triggers? have tried following without success: mail :to => user.email, :subject => subject, :premailer => false

java - Freezing in cursor moveToFirst() -

Image
api 10, android 2.3.3 i have code cursor c = mydatabase.rawquery("select * linhas l exists"+ "(select * linhas_ruas_ida l1, linhas_ruas_ida l2,ruas r1,ruas r2 l1.id_linha = l2.id_linha , l1.id_rua = r1._id , l2.id_rua = r2._id , r1.nome = '"+rua1+"' , r2.nome = \""+rua2+"\" , l.codigo = l1.id_linha , l1.posicao <= l2.posicao)"+ "or exists (select * linhas_ruas_volta l1, linhas_ruas_volta l2,ruas r1,ruas r2 l1.id_linha = l2.id_linha , l1.id_rua = r1._id , l2.id_rua = r2._id , r1.nome = \""+rua1+"\" , r2.nome = \""+rua2+"\" , l.codigo = l1.id_linha , l1.posicao <= l2.posicao)"+ "or exists (select * linhas_ruas_ida l1, linhas_ruas_volta l2,ruas r1,ruas r2 l1.id_linha = l2.id_linha , l1.id_rua = r1._id , l2.id_rua = r2._id , r1.nome = \""+rua1+"\" , r2.nome = \""+rua2+"\" , l.c...

c# - Error in finding dynamic created control -

i uploading images using fileupload control , after loading file when click upload button file saved in folder in server, before saving database need add image description along image.. dont know getting error. able save file in folder when save database 1 dynamic added control wil found , give object reference not set instance of object though there more 1 controls in particular div. before going code tell controls adding after upload file.. adding 1 image control , textbox each of image files uploaded.. when upload 1 file go foreach loop once again after 1st time.. code might explain more. so .aspx code: <form id="contentplaceholder1" runat="server"> <div class="transbox" id="mainbk" runat="server" style="position:absolute; top:0px; left:0px; width: 100%; height: 100%;" > <asp:fileupload runat="server" id="uploadimages" style="background-color:white; position:absolu...

Click event not generating on google maps here https://developers.google.com/maps/documentation/javascript/examples/event-simple -

i going through google maps api v3 , found out click event not working here https://developers.google.com/maps/documentation/javascript/examples/event-simple . known issue? you can try zoom out, after click marker for: google.maps.event.addlistener(marker, 'click', function() { map.setzoom(8); map.setcenter(marker.getposition()); });

android - How to add caption while upload video on Facebook using the 3.0 version of the SDK. -

i'm using 3.0 version of sdk upload video on facebook android there's helper method uploads videos doc link :- https://developers.facebook.com/docs/reference/android/current/request#newuploadvideorequest(session,%20file,%20callback) problem didn't add caption of video. how add caption video ??? see videos doc: https://developers.facebook.com/docs/reference/api/user/#videos you can set "title" , "description" parameters, this: request request = request.newuploadvideorequest(...); bundle params = request.getparameters(); params.putstring("title", "your title here"); request.setparameters(params); request.executeasync();

c# - checking database rights on certain user -

i given connection database owned company. user gave me has restricted privilidges, meaining can make select queries on views. i got little problem here since other company not being cooperative. change users password without telling me, or change names of views. since there more 40 views want make automatic system checks if alright. my question kind of checks can make on views , database? trying connection open , making select * queries each view enough? btw database sqlserver 2008 r2 , use c#. here function checking required views exists: bool isallviewsexists() { string databasename= "your_db_name"; string[] viewsindb = getallviewsnamesindb(); (int = 0; < viewsindb.length; ++i) { using (sqlcommand cmd = createsqlcommand(string.format("select id sysobjects id = object_id('{0}.dbo.{1}') , (type = 'v')", databasename,viewsindb [i]))) { using (datatable objects = executedatat...

mysql - SQL query for displaying records on Highcharts graph -

i working on achieve dynamic highcharts graph – basic column , need in making sql in mysql. need results last 12 months (irrespective of data month (it can 0 – 12 months records should fetched)) current month showing how many members (4 types of users) have registered on site particular month. there 4 types of users: agents individuals builders real estate companies for months column should retrieve last 12 months current month - aug, sept, oct, nov, dec, jan, feb, mar, apr, may, jun, jul. i have tried following query: select case when u.`usertypeid`=1 count(`usertypeid`) else 0 end agent, case when u.`usertypeid`=2 count(`usertypeid`) else 0 end individuals, case when u.`usertypeid`=3 count(`usertypeid`) else 0 end builders, case when u.`usertypeid`=4 count(`usertypeid`) else 0 end real_estate_companies, u.`userregistreddate` 'timestamp' `dp_users` u left join `dp_user_types` ut on u.`usertypeid` = ut.`type_id` u.`userregistreddate` < now( ) , u.`userreg...

javascript - How to make the Background behind Alert Box clickable? -

i have application make divs clickable using code : $("html").click(function(){ alert("click"); return false; }); this 1 work divs. well, when alert popup, background behind alert box cannot clicked. how can turn clickable too? ps: right click on background dont work too. not sure how you're asking (if it's possible). maybe else can shed light on that. but solution dialog widget jquery ui. can create pop-ups, modal or non-modal (meaning background faded out or not). http://jqueryui.com/dialog/ have demos there, it's simple created div text , calling... $("#the_div_id").dialog(); other config parameters can found api: http://api.jqueryui.com/dialog/

Display Custom Post template name in wordpress -

i need display custom post template name. want load different css each custom post template. need custom post template name cant find anyhow. here structure of directory. index.php single.php header.php footer.php fullpage-post.php // custom template two-column-right-menu-post.php two-column-left-menu-post.php now in header want link this if($custom_template->name == 'two-column-right-menu-post'){ ?> <link href = 'style.php'> <?php }else{ ?> <link href = 'style1.php'> <?php } how can achieve this. googled around , not find solution. you should take @ get_page_template . a side not including css wrong. should not use <link> include styles should use wp_enqueue_style , allows stuff caching , minify. same goes javascript has wp_enqueue_script a tutorial it: http://halfelf.org/2012/jquery-why-u-no-enqueued/

How to use an associative array value for calculation in PHP? -

i performing calculation using user input , associative arrays. below php code $class = $_post['class']; $size = $_post['size']; $gasket = $_post['gasket']; $connection = $_post['connection']; $flange150 = array( array( flangesize => 0.5, /* inches */ flangeclass => 150, flangethick => 0.38, /* inches */ boltdia => 0.5, /* inches */ totalbolt => 4 ), array( flangesize => 0.75, /* inches */ flangeclass => 150, flangethick => 0.44, /* inches */ boltdia => 0.5, /* inches */ totalbolt => 4 ), ); the user input size stored in variable $size , using variable need select array has same value user input (flangesize in array). array must take value of flangethick calculation. dont know how perform this. please me in regard. use foreach this $flang...

php - Codeigniter paypal_lib IPN not working -

i trying capture when user made payment in paypal(sandbox). ipn answer seems not getting response it. tried put in log , db there no data entering. know ipn listener dunno why isnt working.. clarification , thoughts this? i using codeigniter paypal_lib here script: first declared fields $this->paypal_lib->add_field('cmd','_cart'); $this->paypal_lib->add_field('upload','1'); $this->paypal_lib->add_field('business', $business_email); $this->paypal_lib->add_field('return', site_url('invoice/payment_success/'.$invoice_id.'/'.$album_id)); $this->paypal_lib->add_field('cancel_return', site_url('invoice/payment_cancel/'.$invoice_id)); $this->paypal_lib->add_field('notify_url', site_url('invoice/payment_validate/'.$invoice_id)); // <-- ipn url $this->paypal_lib->add_field('custom', $invoice_id); // <-- verify return here ipn , che...

Read Text File and Update it by C# -

i want read text file changing. but first problem file size large , hangs first time , every second of text file (txt) changing. is not first time last 50 lines of file called? program not stopped and easier read , added changing ... watch files interested in. static class program { static long position = 0; /// <summary> /// main entry point application. /// </summary> [stathread] static void main() { filesystemwatcher watcher = new filesystemwatcher(); watcher.path = system.environment.currentdirectory; watcher.notifyfilter = notifyfilters.lastwrite; watcher.filter = "data.txt"; // or *.txt .txt files. watcher.changed += new filesystemeventhandler(onchanged); watcher.enableraisingevents = true; application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new form1()); } public static void ...

rdp - Cannot start "explorer.exe" on remote server -

Image
i working on 1 of our production servers. there many windows on ssms , bids open @ moment , executing sql queries , monitoring job's status on server. of sudden,the taskbar disappered. how server's rdp window looks now:- believe looks of explorer.exe has been closed. hence i'm trying restart explorer.exe on remote server. in attempts fix this, followed approach given here https://serverfault.com/questions/381730/how-to-restart-explorer-exe-remotely . tried approaches specified in link.but no avail. feel similar problem facing. posting question here since dont have enough reputation on serverfault post images. i need server window how used be(with start menu , stuff. can please me on debacle? need able call run prompt or task manager somehow can restart explorer.exe. close connection, , re-connect. @ programs check "start following program on connection" , enter "explorer.exe". fixed me. here go full tutorial . edit: use ctrl + ...

javascript - How to get value of a string for a db.transaction -

Image
i'm stuck on problem should not problem ... code: transaction db.transaction(function(tx) { tx.executesql(insertstatementelement, [values], donothing, onerror); }); example values: ["000096", "the gold medal collection", "harry chapin", "elektra", "140", "aad", "rock", "aa8", "32", "2", "7.78", "22.48"] var insertstatementelement = "insert or ignore menu" + counter + " (cdnumber, title, artist, label, playingtime, recordingtype, musictype, binlocation, numberoftracks, onhand, cost, retail) values (?,?,?,?,?,?,?,?,?,?,?,?)" i got error number of '?' in sql statement not match. edit : if change on code... var insertstatementelement = "insert or ignore menu" + ebenecounter + " (cdnumber) values (?)" db.transaction(function(tx) { tx.executesql(insertstatementelement, [v...

python - how to limit records set in SQL WHERE clause -

i've got software can provide sql queries db. there limitation, can change where clause... ex.: [python] x = gp.searchcursor('database_name','fields want view','where_clause') i've got table ~250k records , want first 50-70 (number doesnt matter) of records. question how can create query (actually clause) return mi records? just clarify, on bottom of application there oracle , ms sql server (depends of called database) maybe can trick using subquery in where where yourid in (select top 50 yourid yourtable youractualconditions) this work sql server, oracle syntax different: where yourid in (select yourid yourtable youractualconditions , rownum<=50) edit in oracle wouldn't need subquery: youractualconditions , rownum<=50 should enough

ios - Move CGRect with UITouch -

so code uses cifacefeature face detection , draws cgrect around face. trying enable user move rect around minor adjustments made using uitouch. far i'm unable so. found how can move cgrect uitouches? hasn't helped. i've tried making cgrect subview of uiview , implementing using code mentioned here uiview drag (image , text) isn't working. any appreciated thanks. i have sample project in https://github.com/slysid/ios/tree/master/faceview i think, might give idea bharath

javascript - How to allow the user to click on a droppable div such that the other div's dropping functionality should be disabled after clicking a droppable div -

i new jquery. presently working on project of shopping cart there 3 types of items(item1,item2,item3) , 3 bags(bag1,bag2,bag3) , 1 shopping cart such bag1 accepts item1,item2,item3 , bag2 accepts item2,item3 , bag3 accepts item3 on drop have developed far. now want add additional functionality such user should first select(click) 1 of bag(example bag1) , try dropping items bag1 such other 2 bags dropping functionality should disable(other bags should not accept item if acceptable bag) , reverse if user selects other bag. please try it.i need help. http://jsfiddle.net/vwu37/15/ html <div class="bag1" ><p>bag1</p></div> <div class="bag2" > <p>bag2</p></div> <div class="bag3" ><p>bag3</p></div> <div class="item1"><p>item1_1</p></div> <div class="item1"><p>item2_1</p></div> <div class="item1">...

c - copying content of one file to other using system calls -

here trying copy content of 1 file other(unix) using open read , write system calls reason code running infnite time... , not getting error if me out!! #include<unistd.h> #include<stdio.h> #include<sys/types.h> #include<fcntl.h> #include<stdlib.h> #include<string.h> int main(int args,char *ar[]) { char *source=ar[1]; char *dest="def.txt"; char *buf=(char *)malloc(sizeof(char)*120); int fd1,fd2; fd1=open(source,o_creat,0744); fd2=open(dest,o_creat,0744); while(read(fd1,buf,120)!=-1) { printf("%s",buf); //printf("processing\n"); write(fd2,buf,120); } printf("process done"); close(fd1); close(fd2); } thanx in advance... there quite few issues in code. the first , obvious is, never check errors ( malloc , open , close ). in case wondering: yes, need check close . then open calls not correct, because not specify file access mode. quoting man 2 open : the argument flags must include 1 of fo...

linux - openssl erro after machine restart decryption failed or bad record mac -

using openssl 0.9.8 in c++ application . things working fine , following errors encountered. no change in code, certificate or in peer application done. error:1408f119:ssl routines:ssl3_get_record:decryption failed or bad record mac:s3_pkt.c:426: error:1408f10b:ssl routines:ssl3_get_record:wrong version number:s3_pkt.c:288: error:1408f096:ssl routines:ssl3_get_record:encrypted length long:s3_pkt.c:346: m/c details:linux awtah.dispatchserver1 3.6.11-1.fc16.i686 #1 smp mon dec 17 21:36:23 utc 2012 i686 i686 i386 gnu/linux these error random. though application uses it’s own opnesssl 0.9.8 , m/c have 1.0.0j-fips. -bash-4.2# openssl version -a openssl 1.0.0j-fips 10 may 2012 built on: tue may 15 18:44:01 utc 2012 platform: linux-elf options: bn(64,32) md2(int) rc4(8x,mmx) des(ptr,risc1,16,long) blowfish(idx) compiler: gcc -fpic -dopenssl_pic -dzlib -dopenssl_threads -d_reentrant -ddso_dlfcn -dhave_dlfcn_h -dkrb5_mit -dl_endian -dtermio -wall -o2 -g -pipe -wall -wp,-d_fortify_...

wolfram mathematica - Creating inequalities out of a auto-generated set of variables -

Image
in mathematica's nminimise function have set up: nminimize[{1/rij, x1^2 + y1^2 <= 25, x2^2 + y2^2 <= 25, x3^2 + y3^2 <= 25, x4^2 + y4^2 <= 25, x5^2 + y5^2 <= 25, x6^2 + y6^2 <= 25, x7^2 + y7^2 <= 25, x8^2 + y8^2 <= 25, x9^2 + y9^2 <= 25, x10^2 + y10^2 <= 25}, join[take[xi, number], take[yi, number]]] where xi , yi represent list of generated variables, x1,x2,x3,x4 , on x100. rather set lots of constraints x1^2 + y1^2 <= 25, x2^2 + y2^2 <= 25 , on above id set 1 constraint class of variables, akin x#^2+y#^2<=25 problem can generalised large n. ive tried inputting list of inequalities however, mathematica not seem accept input. thanks. try working indexd variables x[ 1],y[ 1],x[2],y[2]...x[n],y[n] , can , nminimize[ join[{1/rij},table[x[i]^2+y[i]^2<25,{i,number}]] , flatten[table[{x[i],y[i]]},{i,number}] ]] (..untested..) update: tested.. n = 15; pts = table[randomreal[{-5, 5}, 2], {n}]; s...

jsp - Get Action class result (return) String in JQuery ajax success -

in jsp page, have form , divs <form id="persondetail" name="persondetail" action="persondetail"> <!-- input fields --> </form> <div id="sucess"></div> <div id="error"></div> <div id="edit"></div> <div id="input"></div> i using ajax call submit form. in action class have following code actionclas if(condition1) { //processing statements return "success"; } else if(condition2) { //processing statements return "error"; } else if(condition3) { //processing statements return "input"; } else if(condition4) { //processing statements return "edit"; } ajax call $(document).on('click', ".savebutton", function(){ var formid='persondetail'; var form = $("#"+formid); form.submit(function () { var urlaction=form.attr('acti...

perform background task on different thread in iOS -

how preform operation in background on different thread, if executed on main thread blocking ui of app. 1 have idea how it? even if prints nslog in background fine. want run following thing in no matter if user presses home button. in viewcontroller did : - (ibaction)btnstartclicked:(uibutton *)sender { [nsthread detachnewthreadselector:@selector(startbgtask) totarget:self withobject:nil]; } -(void)startbgtask{ [[[uiapplication sharedapplication] delegate] performselector:@selector(startthread)]; } and in appdelegate.m have method -(void) startthread { @autoreleasepool { (int = 0; < 100; i++) { dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ nslog(@"current progress %d", i); }); [nsthread sleepfortimeinterval:1]; } } } it prints integer 1 100 on interval of 1 second. add these properties .h file @property (nonatomic, strong) nstimer *updatetimer; @p...

php switch menu undefined variable -

this question has answer here: reference - error mean in php? 29 answers the following code has been moved new server , throwing error: notice: undefined variable: menu in * on line 128 notice: undefined variable: menu in * on line 160 notice: undefined variable: menu in * on line 170 here code: <a href="index.php?menu=profile">profile</a> <a href="index.php?menu=regisztracio">regisztráció</a> <a href="index.php?menu=kapcsolat">kapcsolat</a> <?php switch($menu) { case "profile": { echo("profil"); } case "regisztracio": { echo("regisztráció"); } case "kapcsolat": { echo("kapcsolat"); } default: { echo("home page"); } } ?> i didn't ...

java - JTable with axis -

Image
i'm fiddling around jtable, , want make table has letters a-p row names, , number 1-24 column names (it doesn't matter data type are). not matter if these row , column names inside table or external axis (whatever simpler). my current attempt name string[] row , column names, , string[][] actual content. can't find out how merge valid format creating jtable. current code (that not work) following: // create table string[] columnnames = {"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" }; string[] rownames = {"a", "b", "c", "d...

android - Why do I get white space on top and on the bottom of my ImageView in my RelativeLayout? -

i using relativelayout overlay images. on screen sizes far have tested (from 2.7 10.1 inch) white space on top of image. in ide see relativelayout causing space on top , on bottom of image. why that? have set height attributes wrap_content , added adjustviewbounds attribute. note: should know image lot bigger in size, meaning there sort of scaling. thanks tips! here code: <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#ffffff" android:orientation="vertical" > <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="vertical" android:focusable="true" andro...

Textbox Telephone Number Format asp.net mvc -

@html.textbox("mytextbox", "value", new {style = "width:250px"}) i have textbox. want enter phone numbers. format +1 ( _) - ___ total 10 numbers (3+3+4) how can in html.textbox in asp.net mvc? there no way masked html.textbox, can use jquery ( link ) or can use dataannotation displayformat this

c# - Memory issue in mono touch application -

we have mono touch application contains lots of uiimage , uiview objects. when install application (ipa) file in ipad (version1) start working, if continue working 10 20 minutes continuously crashed due low memory. we tried intruments profile track heap allocations showing memory keep on increasing each screen navigation. disposed allocated objects in viewdiddisappear , though memory not getting decreased. try manually force garbage collector collect garbage through gc.collect() , not working. is bug in mono touch? or missed memory management techniques? please me fix low memory warning issue.. thanks when working uiimage , uiimageview should wrap code using statements or dispose images manually if don't need them anymore. reason managed version of uiimage consists of 4 bytes, pointer memory region holds image data. image unmanaged. means there no pressure on gc because sees managed world. if cannot because need hold image data in memory, yo...

php - functions gets the value true even when there is no value -

i traing send mail php , wrote this: <?php function title() { if(isset($_get['title'])) { return true; } else { echo "please write title!"; return false; } } function mess() { if(isset($_get['mess'])) { return true; } else { echo "please write messege!"; return false; } } if(mess() && title()) { mail("guycohen801@gmail.com", $_get['title'], $_get['mess']); echo "the mail has bees send!"; } ?> <form action="ftp_mail.php" method="get"> title: <input type="text" name="title" /> messege: <input type="text" name="mess" /> <input type="submit" value="send" /> </form> but when doesn't writing on $_get['mess'] , $_get['title'] functions mess() , title() gets value true. please help!! use this if((isset($_get['mess']...

c# - LINQ sort a flat list based on childorder -

i trying figure out way sort elements linq , c#, kinda failing so. for problem let assume have following table ---temptable id (int) parentid (int) name (varchar) sortorder (int) the id , parentid related each other , give me self hierachical data structure. root elements have null in id field. sortorder portion of whole table , based on parentid, elements share same parentid have 1, 2, 3 in it. lets further assume following data: id = 1 parentid = null name = test 1 sortorder = 1 id = 2 parentid = 1 name = test 2 sortorder = 1 id = 3 parentid = 1 name = test 3 sortorder = 2 id = 4 parentid = 2 name = test 4 sortorder = 1 my desired flat list should have following order: test 1 //root element sort order 1 = top test 2 //child element of root sort order 1 test 4 //child element of test 2 sort order 1 test 3 //child element of root sort order 2 also object without getting portion of information threw usage of select new ... this 1 of failed tries: from x in ent...

performance - SQL: selecting unique values based on conditions -

i have table containing 5 columns. first column contains id, 2 columns contain parameters ids values 0 or 1, third column contains parameter need output, last column contains date. same id can appear in several rows different parameters: id parameter1 parameter2 parameter3 date 001 0 1 01.01.2010 001 0 1 b 02.01.2010 001 1 0 c 01.01.2010 001 1 1 d 01.01.2010 002 0 1 01.01.2010 for each unique id want return value in parameter3 , decision row return value based on values in parameter1 , parameter2 , date: if there row both parameters being 0 , want value in row. if there no such row, want value row parameter1 0 , parameter2 1 , if there no such row, want row parameter1 1 , parameter2 0 . final...

JQuery, Javascript button -

sorry vague title, couldn't think of how title question. i've made html/css table wherein placed edit button each row. pressing button transform text field text-input field there allowing user edit data inside; @ same time edit button transforms save button. after editing , user press save button , text-input field revert text field , save button edit button. it's not entirely working this problem, after editing data inside, upon pressing save button, data inside deleted , replaced with: <input type= , outside text-input field is: " /> , save button remains is, "save" button , not "edit" button here's script: $(document).ready(function () { // listen email edit button click $("button#edit").on('click', function () { // email inline edit button var email = $(this).parent().siblings('td.email').html(); alert(email); // change button edit save $(this).attr(...

javascript - jQuery - using JS events like "dragover" -

i've got javascript function eventlistener `dragover. it looks this: document.getelementbyid("someid").addeventlistener("dragover", function(){ //do logic }, false); the thing - someid dynamic element - gets removed , added on page. after it's removed , added in, eventlistener no longer pickup dragover event. way know of how deal situation use jquery's .on() my problem: can't find dragover event under jquery api... exist? if not how can use in jquery? you can define customer drag event as, (function(jquery) { //defining drag event. jquery.fn.drag = function() { eventtype = arguments[0] || 'dragstart'; onevent = typeof arguments[1] == 'function' ? arguments[1] : function() { }; eventoption = arguments[2] || false; $(document).on('mouseover', $(this).selector, function() { if ($(this).hasclass(eventtype)) { return; ...

GWT -- Retain search text value in html text box after filtering in cell table -

i created custom header cell table in gwt. consists of filter text box , below column name. able filter column data. not able retain search text after filtering cell table. text box becoming empty after filtering. have used html text box in header. please me retain search text value after filtering cell table. have added code below onbrowserevent... @override public void onbrowserevent(context context, element elem, nativeevent event) { super.onbrowserevent(context, elem, event); int eventtype = event.getkeycode(); if (eventtype == keycodes.key_enter) { inputelement inputelement = getinputelement(elem); setvalue(inputelement.getvalue()); if(filterhandler != null){ filterhandler.onfilter(getvalue()); } inputelement.setattribute("value", inputelement.getvalue()); //event.preventdefault(); } } protected inputelement getinputelement(element parent) { element elem = parent.getelem...

sql - How to join a view on an array_agg column in Postgresql? -

i'm searching syntax join view array_agg column. view: create view sampleview select groupid, array_agg(akey) keyarray sampletable group groupid; now want this: select s.groupid, a.somedata sampleview s join anothertable on a.akey in s.keyarray; error message: error: syntax error @ or near "s" line 3: join anothertable on a.akey in s.keyarray; either syntax wrong (most likely) or not possible. don't believe not possible if asking alternative option. expected output pseudo query above (with testing code): groupid | somedata ---------+---------- 1 | foo 1 | bar 2 | monkey (3 rows) testing code: create table sampletable (groupid int not null, akey int not null); create table anothertable (akey int not null, somedata varchar(20)); create view sampleview select groupid, array_agg(akey) keyarray sampletable group groupid; insert sampletable values(1,20),(1,22),(2,33); insert anothertable values(20, 'foo'),(22,'ba...

java - How to add double elements to RList? -

i tried call r rserve using java code. wanted use rexpgenericvector store , pass array r: rlist r = new rlist(); r.add(new double(1.0)); rexpgenericvector v = new rexpgenericvector(r); // make new local connection on default port (6311) rconnection c = new rconnection(); // assign data variable x c.assign("x",v); system.out.println("printing out v:"+v); however, error message shows @ c.assign("x",v); : java.lang.classcastexception: java.lang.double cannot cast org.rosuda.rengine.rexp @ org.rosuda.rengine.rlist.at(rlist.java:103) @ org.rosuda.rengine.rserve.protocol.rexpfactory.getbinarylength(rexpfactory.java:489) @ org.rosuda.rengine.rserve.rconnection.assign(rconnection.java:272) @ com.xypress.test.main(test.java:29) how can add double or string or other type of data rlist? thanks in advance. i ran in same trap! try class rexpdouble, instead of double. for example: double doublevalue = 1.0; r.add(new rexpdouble(doublevalue)); ...

c++ - Using mpz_t as key for std::map -

i trying build map mpz_t keys uint values. don't know why mpz_t keys can somehow not looked in map. mpz_t leftsidevalues[1 << 20]; int main() { std::map<mpz_t, uint> leftside; (uint = 0; < 1 << 20; i++) { mpz_init(leftsidevalues[i]); // compute stuff here... // save computed value our map leftside[leftsidevalues[i]] = i; // lookup see whether our value can found std::cout << leftside.at(leftsidevalues[i]) << " -- " << << std::endl; } return 0; } the expected output lot of lines looking "0 -- 0", "1 -- 1" etc. not happen. instead: terminate called after throwing instance of 'std::out_of_range' what(): map::at is there other step need take make mpz_t usable in map? it seems map cannot compare 2 mpz_t instances. according the c++ reference maps implemented binary search trees. therefore if elements...

php - How to create a common function in codeigniter for checking if session exist? -

i creating application in users have login access various modules. need check if user session exist before providing access each module. now checking session in each function / module / controller avoid unauthorized access. if($this->session->userdata('userid')!=''){ something; } is there better way this? can have common function similar sessionexist(); such can called module / controller / function common whole project? if should write common function such can called anywhere. you want helper function, here is: if ( ! function_exists('sessionexist')) { function sessionexist(){ $ci =& get_instance(); return (bool) $ci->session->userdata('userid'); } } save file in application/helpers/ , include application/config/autoload.php file: $autoload['helper'] = array('my_helper_file');