Posts

Showing posts from May, 2015

ubuntu - Change php error reporting to hide warnings for specific site only -

imagine couple of sites-enabled available /etc/apache2/sites-available . (only debian-based distros work this.) is possible mute warning messages php scripts a specific site , without touching actual htdocs ? normally there couple of solutions achieve someting related: add error_reporting() directive e.g. error_reporting(e_error); scripts executed. set php_flags in .htaccess files so: php_flag display_errors off use ini_set inside scripts: ini_set('display_errors', 'off'); ini_set('display_startup_errors', 'off'); error_reporting(0); prepend @ functions throw warnings or errors. change php.ini say error_reporting = e_all ^ e_warning display_errors = 1 however, these mean touching htdocs or having change applied globally. imagine htdocs mounted read-only. how suppress warnings (or notices) sites only? i assuming debian/ubuntu has a2ensite specific configurations reason , hoping can alter those. there log_level direct...

Trouble reading from file using getline() c++ -

this code prints last line of file. expected print text, 1 line @ time, file. idea why doesn't work? string filename; cout << "file read: "; cin >> filename; ifstream afile; afile.open(filename.c_str()); string line; while(!afile.eof()) { getline(afile, line); cout << line; } afile.close(); trying way same thing: for (string line; getline(afile, line);) { cout << line; } maybe issue terminal? works... for (string line; getline(afile, line);) { cout << line << endl; } the problem last line printed. correct? i suggest add std::endl in while loop. can make issue more clear. output can confusing. you can check line-delimiting character in input file. '\n' default delimiter getline . if different character used, specify getline 's 3rd parameter.

django - how I can load a model to multipleChoiceField -

please y have been trying show table in form, have not been able do. please clone , create database , run project on github. code paste here. github: https://github.com/mattisbmx/django-multiplechoicefield model: from django.db import models multiselect.fields import manytomanyfield class choice(models.model): choice = models.charfield(max_length=15) def __unicode__(self): return self.choice class samplemodel(models.model): name = models.charfield(max_length=15) funciones = manytomanyfield(choice) passwd = models.textfield() def __unicode__(self): return unicode(self.pk) view: def index(request): data = {'form': forms.selectform()} return render_to_response("multiselect/index.html", data, context_instance=requestcontext(request form: class selectform(forms.form): data = (('1', 'one'), ('2', 'two'), ('3', 'three'), ('4...

jquery - Get value of a select element with ajax -

i'm trying value of select element, returning array() this html: <select name="data[attorney][empresa]" id="attorneyempresa"> <option value="">selecione</option> <option value="3">sotreq</option> </select> and jquery: $(document).ready(function() { $("#attorneyempresa").change(function(){ $.ajax({ type: 'post', data: $('#attorneyempresa').val() }); }); }); what's wrong? try this $(document).ready(function() { $("#attorneyempresa").change(function(){ $.ajax({ type: 'post', data: {keyname:$('#attorneyempresa option:selected').val()} }); }); }); demo

python - Flask user authentication -

i have application use flask , mongodb; host on rackspace. i need understand how flask authenticating works. have not found information on subject. there complete tutorial on how roll own solution? if not, hear thoughts on how approach a flask app. big ps: i thought it. need open real api. part of api used ajax on front end. how secure part of app? can explain api auth requests? i suggest using flask-login extension, makes session management easy add flask application, , provides nice documentation covers in details every aspect of extension.

Git: set master identical to develop -

i cannot master , develop branches identical. want master branch develop branch exists, somehow despite file name changes , deletion of directories in develop, filenames , directories still exist in master no matter merge, tells me date i'm stuck how master change without doing manually, sure error prone. what can here git reset master branch points @ same location develop branch. note loose on master not in develop. git checkout master git reset --hard <sha1 of develop> after that, master , develop both point same commit.

java - Postgres SQL in clause and setArray() -

i using java 1.7 , jdbc 4 , postgres. trying use preparedstatement array fill sql in clause. but, sql generated seems have "{" , "}" in it. here code: preparedstatement ptmt = connection.preparestatement("select * foo id in (?)"); string[] values = new string[3]; values[0] = "a"; values[1] = "b"; values[2] = "c"; ptmt.setarray(1, connection.createarrayof("text", values)); the resulting sql looks this: select * foo id in ('{"a","b","c"}') which, can't work. how should look: select * foo id in ("a","b","c") or select * foo id in ('a','b','c') what missing here? when database field of type array , can use preparedstatement.setarray() send array query. but, in case, it's not array, rather variable no of arguments, , can't that. i.e. preparedstatement ptmt = connection.preparesta...

excel - Custom validation using IF() and Len() -

i made custom phone format ###-###-#### phone # can entered 5555555555 => 555-555-5555 or 555-555-55555. i need non-vba solution i.e 1 can enter in data validation window checks cell length , validates if length 10 or 12. i have been trying long time can not trial , error or googling. my best guess (which not work) =if((len(e2:e32)=12,0),( len(e2:e32)=10,0)) thanks this not easy since excel not have built in pattern matching function - can use built in functions in validation checks. there solution though! fortunately can check validation based on state of dependent cell. that's approach we'll take here. 1) first job format telephone number text (my functions assume you've done this) excel doesn't trim leading zeros. in practice you'd format whole column way. let's assume cell a1 contain phone number. 2) validation formula ridiculously large if attempt put in 1 cell , difficult maintain. put validation stuff "off-spreadshe...

android fragments - Error inflating DrawerLayout -

public class homeactivity extends activity { private string[] drawer_options; private listview mdrawerlist; private drawerlayout mdrawerlayout; private actionbardrawertoggle mdrawertoggle; private charsequence mdrawertitle; private charsequence mtitle; @suppresslint("newapi") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); mtitle = mdrawertitle = gettitle(); drawer_options = getresources().getstringarray(r.array.drawer_array); mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); mdrawerlist = (listview) findviewbyid(r.id.left_drawer); // set custom shadow overlays main content when drawer opens mdrawerlayout.setdrawershadow(r.drawable.drawer_shadow, gravitycompat.start); // set drawer's list view items , click listener mdrawerlist.setadapter(new arrayadapter<string>(this, r.layout.drawer_list_item, drawer_op...

flex lexer - bison's reduction didn't work as expected -

i'm trying write epl parser,so i'm learning flex , bison.i try using following rules(sql): select { cout<<"select detected"<<endl;return select; } { cout<<"from detected"<<endl;return from;} [a-za-z][0-9a-za-z]* { cout<<"identifier detected"<<endl;yylval.c=yytext; return identifier; } '$' { return dol;} [ \t] { cout<<"space founded:"<<int(yytext[0])<<endl; } \n { return eol;} . {} and bison rules are: sel_stmt : {cout<<"void"<<endl;} | select identifier_expr identifier_expr { cout<<"select statement founded"<<endl; } ; identifier_expr : dol identifier { $$=$2; cout<<"ident_expr:"<<$$<<endl; } ; all tokens , non-terminals have type "char*" as input stdin "select $abc $ddd" reudction happend when lexer returned token from,in ...

javascript - Scale div to fill screen while maintaining aspect ratio -

here's jsfiddle of page i'm talking about: http://jsfiddle.net/nmuuu/ i need outer div (with class="page" ) expand or shrink fill user's screen. want aspect ratio of div (and obviously, children) stay same. i've tried plaing jquery plugins textfill , had no success. i've done thousand times image, time have div bunch of elements inside. can still done? edit : seems may not have emphasized this, want children of div increase in size well. should if div image has been scaled up; elements inside should maintain relationship 1 another, while expanding fill parent. should go looking this looking this (border added indicate screen edges). while pure css nice, i'm guessing it's going involve javascript. couple pointers appreciated. i don't think can done css currently, need able read width of elements, cannot done @ moment. since js ok now, using jquery : function zoomit() { $("#page1").css('zoom', $(windo...

c - how do I get a remote global link addr by it's local-link addr? -

i routing information protocol(rip) packet, , can link-local addr of source router packet. cannot set route link-local addr, need global link addr of source router. how should write code in c? thanks. made try, doesn't work. #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <stdio.h> #include <string.h> int main () { int sockfd; struct addrinfo hints, *servinfo, *p; int rv; char str[inet6_addrstrlen] = ""; char port[] = "521"; char addr[] ="fe80::a00:27ff:fe22:4d87"; struct sockaddr_in6 sa; memset(&hints, 0, sizeof hints); hints.ai_family = af_inet6; hints.ai_socktype = sock_dgram; //inet_pton(af_inet6, "fe80::a00:27ff:fe22:4d87", &(sa.sin6_addr)); //hints.ai_addr = (void *)&sa; hints.ai_flags = ai_numerichost; if ((rv = getaddrinfo(addr, null, &hints, &servinfo)) != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); return 0; } fo...

android - Load heavy UI in onPostExecute -

i'm trying load heavy ui in asynctask onpostexecute() method approximately takes 5 seconds show up. also, make runnable thread , post ui through runonuithread() still takes 5 seconds show up, idea how optimize code? first off- onpostexexute runs in ui thread. no need call runonuithread, slow down. my other big suggestion precalculate lot of stuff in doinbackground, rather doing in onpostexecute. won't decrease total time display, taking time. if need more speedup that, run in profiler debugger turned off , see whats taking time.

Crystal Report takes long time to load every time in VS2010 -

i working in window project in asp.net4.0. using visual studio 2010. have create invoice report in crystal report . problem takes1 minute load every time. have searched on google , unchecked option "save data in report". not effect report loading time. so please me. provide idea or solution of problem... hi have found solution problem: open crystal report in design mode goes properties of crystal report crystal report -> design -> page set -> check "no printer" property. and report take 2-3 seconds load every time on machine in client machine.

c# - how can i print a web page in asp.net -

i trying convert , download webpage pdf file, getting error download,my code here,i not have problem if remove image means no problem protected void btnpdf_click(object sender, eventargs e) { response.contenttype = "application/pdf"; response.addheader("content-disposition", "attachment;filename=userdetails.pdf"); response.cache.setcacheability(httpcacheability.nocache); stringwriter sw = new stringwriter(); htmltextwriter hw = new htmltextwriter(sw); this.page.rendercontrol(hw); stringreader sr = new stringreader(sw.tostring()); document pdfdoc = new document(pagesize.a4, 10f, 10f, 100f, 0.0f); htmlworker htmlparser = new htmlworker(pdfdoc); pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); htmlparser.parse(sr); pdfdoc.close(); response.write(pdfdoc); response.end(); } <img src="images/addo.png" /> <div style="width: 382px"> <b>...

python - Can a list and variables be returned from a function? -

i can this.. def funcone(): a,b = functwo() print a, b def functwo(): ..... ...... return x, y but can list returned functwo , displayed in funcone along 2 values? nothing seems work when return multiple values, doing building single tuple containing values, , returning it. can construct tuples in it, , list comes under anything: def funcone(): a, b, some_list = functwo() print a, b, some_list def functwo(): ... some_list = [...] return x, y, some_list if mean wish return values list, can returning list, unpacking works lists too: def funcone(): a, b, = functwo() print a, b def functwo(): ... some_list = [x, y] return some_list or if want extend returned values values list, need concatenate list of values wish return list of values: def funcone(): a, b, c, d = functwo() print a, b, c, d def functwo(): ... some_list = [z, w] return [x, y] + some_list

java - Prevent code from throwing XML exception -

in following piece of code : try{ .... } catch(exception e) { logger.error("exception caught in method: \n"); logger.error(e.getmessage()); string fault = "<fault><faultcode>" + e.getclass().getname() + "</faultcode><faultdescription>" + e.getmessage() + "</faultdescription></fault>"; return xmlobject.factory.parse(fault); } , there way convert "fault" string xml object using code wouldn't throw exception or require exception handling? basically, need return xml object in both success , fauilure scenarios, without method using throws clause. that's reason, we've removed specific exception cases, occur in main flow, parserconfiguration, ioexceptoin, xmlexception etc. catch , kept generic 1 , hard coded string gather required fault info , pass xml object. but, minimal coding, there chance of xmlexception occuring in parse...

c++ - Multiple files, same namespace -

i building library consists of many different classes , files related thinking putting them in same namespace idea; allows me use less risky generic/simple class names since name collision inside namespace not issue. is process of using same namespace many different files simple putting classes inside same-named namespace? classa.h, classb.h, classc.h, etc contain this: namespace whatever{ ...class definition } yes can surely move ahead idea. if use same namespace name in different files automatically clubbed one.

c# - extending bootstrap select -

i want use bootstrap framework along http://silviomoreto.github.io/bootstrap-select/ . doesnt work. below codes. please help. <%@ page language="c#" autoeventwireup="true" codebehind="webform1.aspx.cs" inherits="final_year_project_allocation_system.silviomoreto_bootstrap_select_d4ec9bd.webform1" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script> <link href="bootstrap-select.css" rel="stylesheet" type="text/css" /> <link href="bootstrap-select.css" rel="stylesheet" type="text/css" /> <script src...

Secure Java to MySQL database methods for sandbox applets -

i'm making java applet embedded in browser unsigned. i've allowed applet read mysql database dom xml parsing. how did using php data database , display php file xml file. there, parsed "xml" file. now need other way around. in other words, need data obtained java applet stored mysql database. i've spent lot of time researching on how of results has jdbc, apparently not secure java applets. thus i'd appreciate list of secure methods unsigned java applet able send data mysql database, , links tutorials greatest. (i'm having trouble finding non-jdbc tutorials) is there list of secure java mysql database methods sandboxed applets?

php - Have option display blank then on submit keep value selected -

is possible have first item in dropdown list blank , selected default when choosing item in dropdown list , hitting submit, having value stay there. here example <form action="" method="post" /> <select name="whatever" id="whatever"> <?php $selected = isset($_post["whatever"]) && $_post["whatever"] == 'whatever'; ?> <option value="" hidden="true" selected="selected"></option> <option value=1 onclick"selected='selected'">all</option> </select> <input type="submit" name="submit" value="update"/> </form> currently if hit submit change selected value blank. u may use <form action="" method="post" /> <select name="whatever" id="whatever"> <option value="">select value</option> <optio...

How to reference nested requires in app.yaml for App Engine PHP -

i have index.php require 'myfolder/folder/lib1.php'; so in app.yaml reference: - url: /myfolder/folder/lib1.php script: myfolder/folder/lib1.php but lib1.php require 'lib2.php'; @ same folder level /myfolder/folder/ . trows error 500 because can't find lib2.php . how can reference them both in app.yaml? your app.yaml file routing requests incoming urls initial script want use process request. you don't need add routings each , every *.php file want include 1 script another. for example, @ app.yaml example running wordpress. has urls clients access, not of php scripts used wordpress.

java - extracting from specific areas using pdfclown -

i trying highlight text in pdf 2 columns , problem while extractor extracts text row wise. queried text doesn't matched. thinking if there function in pdfclown can me extract first half of page i.e., first column , second 1 selecting areas. thanks. as talk text extraction pdf clown, assume using textextractor class of library. this class offers numerous attributes helping restrict parsing area: public void setareas(list<rectangle2d> value); public void setareatolerance(double value); public void setareamode(areamodeenum value); setareas allows set page areas extract text from, setareatolerance allows add tolerance these areas (essentially enlarging areas value in directions), , setareamode used control whether string must contained area ( containment ) or merely needs intersect area ( intersection ) included in scan results. how these attributes work, can witnessed in textextractor method public map<rectangle2d,list<itextstring>> f...

asp.net - jQuery ajax POST error for wcf sevice -

this cross-domain ajax request: $.ajax({ type: "post", datatype: "jsonp", contenttype: "application/jsonp", data: '{"username":"newuser","password":"pwd"}', crossdomain: true, async: false, url: "http://xxx.xx.xx.xx/myservice/sampleservice.svc/getdata", jsonpcallback: function (jsondata) { console.log(jsondata); alert('hi'); }, complete: function (request, textstatus) { alert(request.responsetext); alert(textstatus); }, error: function (request, textstatus, errorthrown) { alert(textstatus); } }); this wcf rest service's method: namespace sampleservicerestapi { [aspnetcompatibilityrequirements(requirementsmode = aspnetcompatibilityrequire...

winforms - Devexpress GridControl columns stop resize -

for gridview in winforms, devexpress: i need stop auto resize columns in gridcontrol. example: if have 3 columns: 100, 200, 150​ if resize first column 50 ​difference shared second , third columns. happens if increase width. must stop process. tools have in order make this. thanks. hope understood. ​ stop autocolumnwidth: gridview.optionsview.columnautowidth = false

r - add line segments showing the error between points of scatter plot and grid of surface3d -

i'm new r, , i'm having trouble adding line segments showing error between points of scatter plot , grid of surface3d. surface data x <- c(0.001,0.0025,0.0039,0.0061,0.0095,0.0147,0.023,0.0358,0.0558,0.087,0.1357,0.2115,0.3296,0.5138,0.801,0.9999) y <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1) z matrix 16 x 10 scatterplot data: x1 y1 z1 1 25000.030 0.001218202 0.1915856 2 5118.15450 0.061169029 0.4711610 3 17005.82875 0.007177435 0.3222662 4 5300.22698 0.029688212 0.2770485 ... (3000 rows) code used: # function interleave elements of 2 vectors interleave <- function(v1,v2)as.vector(rbind(v1,v2)) # plot graph library(rgl) plot3d(scatterplot$x1, scatterplot$y1, scatterplot$z1, xlab="x",ylab="y",zlab="z", type="s", col = "blue", size=0.25, lit=false) surface3d(x,y,z,alpha=0.4,front="lines",back="lines") i combined surface3d() , plot3d() i...

iphone - Xcode debugger displays string correctly but console does not -

when hover on nsstring in debugger, apostrophes , special characters show correctly, when print nsstring console letters , numbers print fine before special characters scrambled. i'm creating string array of chars [code]char utf[10]; string = [nsstring stringbyappendingformat:@"%c",utf[i]";[/code] if try create string via stringwithutf8string:&utf[i]; unrecognized selector sent instance [nscfconstantstring initwitjbytes.... special characters printed utf string.

java - RestEasy 2.3.5 Client Issue -

i new rest easy. i have added resteasy grails project. had crawler library working. getting below exception , not sure jars etc conflicting or root cause. using jdk 1.7 since getting on below line of code (while getting instance) thinking jar conflict issue resteasyproviderfactory.getinstance() | error caused by: java.lang.runtimeexception: unable instantiate messagebodywriter | error @ org.jboss.resteasy.spi.resteasyproviderfactory.registerprovider(resteasyproviderfactory.java:849) | error @ org.jboss.resteasy.plugins.providers.registerbuiltin.registerproviders(registerbuiltin.java:70) | error @ org.jboss.resteasy.plugins.providers.registerbuiltin.register(registerbuiltin.java:31) | error ... 13 more | error caused by: java.lang.classcastexception: com.sun.proxy.$proxy28 cannot cast javax.ws.rs.produces | error @ org.jboss.resteasy.spi.resteasyproviderfactory.addmessagebodywriter(resteasyproviderfactory.java:566) | error @ org.jboss.resteasy.spi....

sql - Getting the sum of a specific row -

i have maintenance table named ticket table , transaction table called workplan . ticket table contains tickedid , ticketname , startdate , estimated time of completion , total number of hours columns. and workplan table has workplanid , ticketid(foreignkey) , currentdate , ticket name , no of hours , , hours remained columns. for instance: i have ticket entry shown below. ticket id / ticket name / start date / estimated time of c. /total number of hours 1 /sample name / 05.21.2013 / 05.23.2013 / 21hours and next table represents workplan . workplanid / ticket id / currentdate / ticket name / no of hours / hours remained 1001 /1 / may.21.2013 /sample name /3 /18 ... workplan id autogenerated. if user manage his/her workplan. current date automatically derived. user input his/her no of hours. my question how can difference between total number of hours ticket table , hours remained...

java - Apple APNS - how many push should be sent from server in a second -

we have large number of users game , have written our own php server sending push tokens. when send push server server sends push devices , shows no error. on device, push not received. we tried send single device server same application certificate worked fine. when send devices push not recieved. there limit imposed apple on number of push in 1 second or there other suggestion can follow send push large number of devices in parallel? the limit applies if send multiple notifications same device http://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/dts40010376-ch1-tntag23 you wrote 1 notifications 1 device received, when try send devices nothing received. 2 notifications 2 devices? i suspect there's wrong php , handling more 1 device token. don't reinvent wheel. http://www.easyapns.com/ if using custom code can't replaced suggest reading easyapns php code , try figure out did wrong.

asp.net - jQuery $.ajax method displays error status -

the webservice looks using system;<br/> using system.collections.generic;<br/> using system.linq;<br/> using system.web;<br/> using system.web.services;<br/> [webservice(namespace = "http://tempuri.org/")]<br/> [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)]<br/> [system.web.script.services.scriptservice] <br/> public class map : system.web.services.webservice { [webmethod] public mapclass latitudelongitude() { mapclass mapobj = new mapclass(); return mapobj; } [webmethod] public string hellotoyou() { return "hello"; } } the class like: public class mapclass <br/> { string latitude; string longitude; public mapclass() { latitude = "51.508742"; longitude = "-0.120850"; } } and trying call webservice html5 page `</head>`<br/> `<body>`<br/> `<for...

android - Nested fragments disappear during transition animation -

here's scenario: activity contains fragment a , in turn uses getchildfragmentmanager() add fragments a1 , a2 in oncreate so: getchildfragmentmanager() .begintransaction() .replace(r.id.fragmentoneholder, new fragmenta1()) .replace(r.id.fragmenttwoholder, new fragmenta2()) .commit() so far, good, running expected. we run following transaction in activity: getsupportfragmentmanager() .begintransaction() .setcustomanimations(anim1, anim2, anim1, anim2) .replace(r.id.fragmentholder, new fragmentb()) .addtobackstack(null) .commit() during transition, enter animations fragment b runs correctly fragments a1 , a2 disappear entirely . when revert transaction button, initialize , display during popenter animation. in brief testing, got weirder - if set animations child fragments (see below), exit animation runs intermittently when add fragment b getchildfragmentmanager() .begintransaction() .setcustomanimations(enter, exit) .replace(r.id.frag...

Getting generic sizes for android development -

i'm building app support android sizes generic values small, normal, large , xlarge taking consideration 7 , 10 inch tablet. i'd know screen size not screen resolution. check out official dev doc . scroll down , you'll find graphic associating generalized screen sizes (categories) approximate dimension (in inches). just aware screen size categories "xlarge," example, aren't tied hard number "10 inches." instead, official documentation uses terms "an xlarge screen defined screen larger "large" screen, such tablet (or larger)..." you can find fuzzy definitions of screen size categories here

c# - Controlling a PictureBox from a class -

i have little project in c#, (windows forms application). have on form 77 pictureboxes (picturebox1, picturebox2, picturebox3, ...) , want control them new class (access.cs), declaring new 1 picturebox in class control pictures. because long if pass through each picturebox , add click method , copy + paste code , change picturebox number each time. i've set pictures public , tried following code: access.cs: using system.windows.forms; public class access { picturebox picbox = new picturebox(); public void pictureclicked() { picbox.image = properties.resources.apple; } } form1.cs: private void picturebox1_click(object sender, eventargs e) { access ac = new access(); ac.pictureclicked(); } but code didn't work!! i dont want try send object access class: private void picturebox1_click(object sender, eventargs e) { access ac = new access(); ac.pictureclicked(sender); } public void pictureclicked(object sender...

c# - Restarting a Thread after returning to a Window in wpf -

i'm building point , click game in wpf, when exit room changes windows @ moment, problem is, when return room exited movement thread won't resume. my question is, after hiding window , using .show() on window how restart thread ensure runs? you should try using thread.pause() , thread.resume() when show window.

Designing Android layouts -

i need develop app submit job details server.my layout have below: emp name : edit text entering name id: edit text work number: edit text attach pic: edit text browse button edit text browse (max 4 pictures) once picture attached, want appear next attach pic icon , delete button should appear. possible pic appear icon? let me know layout should chose achieve linear or relative ? 1 easier needs supported on mobile & tablet. if layout-hierarchy not complex linearlayout faster relativelayout . if think requirement may complex later(seems yours will) advisable use relativelayout .

css - html align column right -

Image
i have html code : <tr> <td> <a type="text" name="color" >@client.login</a> </td> <td> <a type="text" name="color" >@client.mail</a> </td> <td> <a type="text" name="color" >@client.password</a> </td> <td> <a type="text" name="color" >@client.name</a> </td> <td width=10px align="left"> @if (i == 0) { <input type="radio" name="color" checked > } else {<input type="radio" name="color" > } </td> </tr> my problem in radio button : far other elements. attribute align obsolete in html5 . the dimensions : so how...

How to convert c code to vb.net? -

how can convert following vb? mean? unsigned char *s = (unsigned char *)(void *)serialnum; from little know vb, i'm not sure there translation. it looks intent of code take integer value ( serialnum ) , use address of sequence of bytes ( s ). unsigned char *s declares s pointer unsigned char ; value stored in s address of single byte or first byte of sequence. (unsigned char *) , (void *) cast operations ; used convert type of expression different type. c's type rules such cannot assign integer value pointer variable directly; integer value must converted pointer type using cast operation. (void *) serialnum converts type of expression serialnum int (or whatever) void * , c's idea of "generic" pointer. (unsigned char *) converts result of previous expression pointer unsigned char . the (void *) cast operation redundant imo, , following should work well: unsigned char *s = (unsigned char *) serialnum; again, don't k...

ios - Generate referral link for each user -

i searching way achieve this. want dropbox, each user( say x ) can create own unique referral link , send them friends ( say y ). if y installs application want reward x points. there site can me in or other way this. don't know for. you can't iphone \ ipad app. there's no way knowing user installed app came from. it's possible in android using google analytics apple doesn't aprove such thing.

ruby on rails - ActiveAdmin and Devise - skip_confirmation! on create action -

i want call user.skip_confirmation while account created admin in admin panel. want user confirm account in further steps of registration process, not on create . idea have override create in controller: controller def create user = user.new user.skip_confirmation! user.confirmed_at = nil user.save! end end the problem is, have different attr_accessible s standard user , admin, , works, because activeadmin uses inheritedresources: attr_accessible :name, :surname attr_accessible :name, :surname, invitation_token, :as => :admin it doesn't work after changed create (it worked before). how can want , still able use :as => :admin feature? i @ answer , none solving issue @ hand. solve simplest way shown below. before_create |user| user.skip_confirmation! end

html - CSS two column layout Issue -

Image
i trying write 1 css 2 column layout. in code there 3 <div> tag. first <div> tag contains 2 other <div> tags. 1 navigation , 1 content. made these tags floating tags. there no problem these tags. problem is, parent <div> tag has 2px border, not render border around screen. css code: #wrap{ margin: 0 auto; width: 900px; border: 2px solid #ada095; } #nav{ background-color: #ded8b9; float: left; width: 20%; } #content{ background-color: #ede9db; float: right; width: 80%; } html code: <div id="wrap"> <div id="nav"> <h2>sonnet index</h2> <ul> <li><a href="#">sonnet #1</a></li> <li><a href="#">sonnet #6</a></li> <li><a href="#">sonnet #11</a></li> <li><a href="#">sonnet #15</a>...

php - How to solve a naming conflict when specifying a custom prefix using XPath? -

i'm running php 5.4.14, , i'm trying use xpath search inside xml document. can't know namespace prefix used each namespace, define own prefixes using registerxpathnamespace() . the problem if register new prefix xpath (e.g. c ) , document using it, xpath query won't use prefix original one. let me show sample code show behaviour: <?php $body = <<<eof <multistatus xmlns="dav:" xmlns:vc="urn:ietf:params:xml:ns:carddav" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:c1="http://calendarserver.org/ns/"> <response> <href>/caldav.php/jorge/contacts/</href> <propstat> <prop> <curre...

android - Applauze like listview -

i trying make custom listview in ios app applauze. i extended listview class , of ontouchevent tried detect movement of child rows , change heights on movement. topmost child has largest height compared other rows. public class custview extends listview{ private float mlasttouchy; private int mactivepointerid; private boolean up=false; private boolean down=false; private final camera mcamera = new camera(); private final matrix mmatrix = new matrix(); private context context; private paint mpaint; public custview(context context, attributeset attrs) { super(context, attrs); this.context = context; this.setchildrendrawingorderenabled(true); } public custview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); // todo auto-generated constructor stub } @override protected boolean drawchild(canvas canvas, view child, long drawingtime) { ...

jquery - clearinterval is not working for the following code -

what's wrong code, unable stop setinterval. error: changedhandler_bb undefined. ... var changedhandler_bb = setinterval(function() { $("#wc_room_container_bb").addclass('active_chat_block_blink_effect'); settimeout(function() { $("#wc_room_container_bb").removeclass('active_chat_block_blink_effect'); }, 500); }, 1000); ... $("#wc_block_bb").click(function(){ var newid = $("#latestlastid_bb").val(); $("#worldchat_last_id_bb").val(newid); clearinterval(changedhandler_bb); }); as per comment's above - defined changedhandler_bb inside function. need define in outer scope become accessible in functions try - var changedhandler_bb; function somefunction() { changedhandler_bb = setinterval(function () { $("#wc_room_container_bb").addclass('active_chat_block_blink_effect'); settimeout(function () { $(...

c# - how to changed the checkbox to string in gridview -

i've column in datatable value true or false when fetched database. shows check box when displayed in gridview. want show the "yes" if value true , "no" if value false. how can that?? datatable dt = dbaction.executequery(command,zzz.id); if (dt != null && dt.rows.count > 0) { // want change here gridtaghistory.datasource =dt; this.showdialog(); } you can modify select query (most recommended) or you can loop on datatable/gridview foreach (datarow rw in dt.rows) { string = rw["yourboolcolname"].tostring(); if(a=="true") { rw["yourboolcolname"]="yes"; } else {rw["yourboolcolname"]="no";} } foreach (gridviewrow row in gridview1.rows) { label mylabel = (label)row.findcontrol("mylabelname"); if(mylabel.text=="true") { myl...

sql - Copy rows and change 1 value? -

how copy entire rows within table , change 1 value? insert user ( user_id,account_id,user_type_cd,name,e_mail_addr, login_failure_cnt,admin_user,primary_user ) select * pnet_user account_id='1' but want change 1 2 on inserted entries. want change 1 3 on inserted entries. want change 1 .... on inserted entries. want change 1 1000 on inserted entries. it copy , write down 1000 times (only changing id ). i'm not sure understand you're asking. if want copy records account_id = 1 new rows , change account_id 2 (or whatever number), should work you: insert user (user_id,account_id,user_type_cd,name,e_mail_addr, login_failure_cnt,admin_user,primary_user) select user_id,2,user_type_cd,name,e_mail_addr, login_failure_cnt,admin_user,primary_user pnet_user account_id='1' basically, replace account_id value 2. if account_id varchar, use single quotes around instead.

java - Logger output to string -

i'm pretty new java , question noobish, can't figure out. i'm having logger logger = logger.getlogger(myclass.class.getname()); and want output of logger string. example when logger.info("some message"); logger.warning(" warning"); i want string somestring = "some message somewarning" i'm looking similar bytearrayoutputstream loggercontent = new bytearrayoutputstream(); system.setout(new printstream(loggercontent)); textview tv = (textview)findviewbyid(r.id.txt_1); tv.settext(loggercontent.tostring()); but i'm failing achieve it. possible , how? edit: want string used in activity show on screen. bytearrayoutputstream loggercontent = new bytearrayoutputstream(); printstream prstr = new printstream(loggercontent); streamhandler streamhandler = new streamhandler(prstr, new simpleformatter()); i tried before posted here , couldn't result. works, had .flush() streamhandler before trying loggercontent.to...

Overwriting/uploading an existing image via PHP every hour + changing directory correctly -

i need update graphic on ftp every hour. "every hour" part no problem, done via cronjob(?) i've troubles copying or uploading image in first place. maybe intinial thought how solve problem wrong? dunno... so here code example: <?php $ftp_server = "servername"; $ftp_user = "user"; $ftp_pass = "password"; // set connection or die $conn = ftp_connect($ftp_server) or die("couldn't connect $ftp_server"); // try login if (@ftp_login($conn, $ftp_user, $ftp_pass)) { echo "connected $ftp_user@$ftp_server\n"; } else { echo "couldn't connect $ftp_user\n"; } echo "current directory: ". ftp_pwd($conn) . "\n<br><br>"; $file = "example.jpg"; $newfile = "example.jpg"; if (!copy($file, $newfile)) { echo "failed copy $file...\n"; } ?> the result foll...

java - removing white spaces from string value -

i have link http://localhost:8080/reporting/pvsusageaction.do?form_action=inline_audit_view&days=7&projectstatus=scheduled&justificationid=5&justificationname= no technicians in area in struts based web application. the variable in url justificationname have spaces before vales shown. when value of justificationname using request.getparameter("justificationname") gives me value spaces given in url. want remove spaces. tried trim() tries str = str.replace(" ", ""); of them did not removed spaces. can 1 tell other way remove space. noted 1 more thing did right click on link , opened link new tab there noticed link looks like. http://localhost:8080/reporting/pvsusageaction.do?form_action=inline_audit_view&days=7&projectstatus=scheduled&justificationid=5&justificationname=%a0%a0%a0%a0%a0%a0%a0%a0no%20technicians%20in%20area notable point in address bar shows %a0 white spaces , show %20 space see link ...

grouping - Weighted percentages by group in Crystal Reports -

i'm stumped on following i'm trying display accurate weighted percentage in group footer using following formula seems work grand total only: ((sum(productioncost)-sum(actualcost)) / sum(productioncost)) * 100 is there way on each group footer section indicate formula work within current group @ least don't have tediously different formulas every possible group? the second parameter sum() function controls group level sum works over. see the documentation more info. you can create straight summary instead of formula. go "insert" → "summary" → select field want summarize , select sum function → @ bottom of window you'll see options group level place summary , check box display percentage of summary.

ios - How to make UITableViewDataSource ask for cell height before each cellForRowAtIndexPath call? -

i have many cells contains several resizable uitextviews. want make datasource call heightforrowatindexpath before every cellforrowatindexpath call, not when table reloading data. in case return fake heights on reloading, , not need redraw textviews time when updating (performance low when need redraw lets 1000 textviews), in time, when these textviews needed. use function : -(cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath in controller