Posts

Showing posts from January, 2010

visual c++ - Simple time tracker in C++ -

this question has answer here: c++ calculating time intervals 5 answers im new c++ , wondering how go implementing simple timer keeps track of how time has passed while program running. eg how know when 300 seconds has passed? #include <time.h> clock_t t1,t2; t1 = clock(); //your code here t2 = clock(); //time taken running code segment double time_dif = (double)(t2 - t1)/clocks_per_sec; actually t1-t2 gives number of total clock cycles during execution, divide clocks_per_sec actual time

mysql - Php mysqli database connection fail? -

goodday, i strange error. this code: <?php $con=mysqli_connect("localhost","root","","testdatabase"); class database{ public function select($tablename){ $result = mysqli_query($con,"select * ".$tablename); } } $database = new database(); ?> the error message $con undefined variable. define $con on line number 2? when var_dump con says null. what doing wrong? if want access $con var in method or function, have globalize inside code : public function select($tablename){ global $con; $result = mysqli_query($con,"select * ".$tablename); } but shouldn't that, globals evil ! this how code should : <?php class database{ protected $con; public function __construct($host, $user, $password, $dbname){ $this->con = mysqli_connect($host, $user, $password, $dbname); } public function select($tablename){ $result

glsl - How does a fragment shader work with sample1D and sample2D in a single texture unit? -

i working opengl client code uses default texture unit gl_texture0. never creates texture it's referring default texture name 0. drawing commands issued, if new texture needed, created on fly - either gl_texture_1d or gl_texture_2d. my understanding both 1d , 2d textures refer same unit = 0. depending on texture being used - 1d or 2d - pass uniform flag shader knows how work on texture. i define sampler1d , sampler2d in fragment shader. assign unit 0 both - @ least, that's understanding of should do. in fragment shader use code uniform sampler1d texture1; uniform sampler2d texture2; uniform int texflagf; void main() { if(texflagf == 1) { gl_fragcolor = texture1d(texture1, gl_texcoord[0].s); } else if(texflagf == 2) { gl_fragcolor = texture2d(texture2, gl_texcoord[0].st); } else { gl_fragcolor = gl_color; } } where texflagf takes values 0, 1, , 2, depending on whether i'm drawing without textures, 1d texture, or 2d texture. n

PHP Hello world.I am newbie -

this question has answer here: “hello, world” in php displays nothing 6 answers here code <html> <head> <title>php test</title> </head> <body> <?php echo '<p>hello world</p>'; ?> </body> </html> why browser don't show "hello world",but trying save file(helloworld.php)? sorry stupid question. php pages run on php webserver. can't give textfile .php extension , double-click it. make sure you have webserver (e.g. apache httpd) installed. you have php installed. make sure php file in webroot (e.g. htdocs) you go page via url hits server (e.g. http://localhost/page.php )

logic - how do I find if any bit of x equals 1 in C -

using bit-wise , logical operations, how can detect if bit of x equals 1 in c? no loops, if/else, ==, or != someone proposed (x & ~0) && 1, i've been looking @ hours , still don't know how (x & ~0) && 1 can detect if bit of x equals 1 !!x it. this convert values 1, except 0 stays 0. , compilers can optimize intelligently.

SQL return a value at a specific date in time -

i'm trying find value @ date. my data looks like date value 2013-11-02 5 2013-10-10 8 2013-09-14 6 2013-08-15 4 how can determine value on 2013-09-30? obviously answer 6 can't figure out sql code. thanks you can order by , limiting number of rows. in sql server syntax (and sybase , access): select top 1 t.* table t date <= '2013-09-30' order date desc; in mysql (and postgres): select t.* table t date <= '2013-09-30' order date desc limit 1; in oracle: select t.* (select t.* table t date <= '2013-09-30' order date desc ) t rownum = 1 edit: and, sql standard way (should work in database): select t.* table t date = (select max(date) table t2 date <= '2013-09-30' );

android - File sharing using Intent.ACTION_SEND gives access denied on BBM -

Image
i trying share audio file saved application. file added media store apps can access it. intent mediascannerintent = new intent(intent.action_media_scanner_scan_file); uri filecontenturi = uri.fromfile(finalfile); mediascannerintent.setdata(filecontenturi); this.sendbroadcast(mediascannerintent); i use intent.action_send share files other apps: public void sharerecording(view view) { intent = new intent(intent.action_send); i.setflags(intent.flag_grant_read_uri_permission); i.settype("audio/mp3"); i.putextra(intent.extra_stream, uri.parse("file:///" + recording.getfilepath())); try { startactivity(intent.createchooser(i, "share " + recording.getname())); } catch (android.content.activitynotfoundexception ex) { toast.maketext(this, "there no app installed share audio file.", toast.length_short).show(); } } all working apps gmail, yahoo mail, whatsapp, ... except bbm, gives access d

http - Is absence of If-Match or If-Not-Match header shall be treated as unconditional request? -

http 1.1 spec has clear definition of server behavior if 1 of them present. in case, have 2 clients, 1 old , 1 new. old client ignores etag in response, , sends put request without etag; new client uses if-match + etag in put request. understanding server shall take put request without if-match unconditional request , proceed. however, consequence of without etag, old client might put request based on old data. have question in titie, "is absence of if-match or if-not-match header shall treated unconditional request?" well. request unconditional when doesn't have conditions attached it. base set of conditional request header fields defines in http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p4-conditional-25.html , extension specs such webdav add more. whether server accepts unconditional request story, see http://greenbytes.de/tech/webdav/rfc6585.html#status-428 .

php - How to select value from JSON array -

i trying select variable array (at least think it's stored array): $data = json_encode($response); file_put_contents('file.txt', $data); gives "status":200,"response":{ "api_id":"0f42d6be-8ed2-11e3-822e-22135", "bill_duration":36, "call_duration":36, "total_rate":"0.00300"} } how can select call_duration value (in php)? i've tried $response['call_duration'] , thought should work returns nothing? $response['call_duration'] correct, think need: $response['response']['call_duration'] looking @ output after converting json, think original array, $response , looks (in php array format) $response = array( 'status'=>200, 'response'=>array( 'api_id'=>'0f....etc', 'bill_duration'=>36, ... etc ) ); so, need go level deep array call_duration .

perl - HTTP::Request->parse does not work as expected -

i'm trying parse http request string http::request->parse method, get / http/1.1 host: www.google.com referer: www.google.com cookies: a=b (there's "\r\n" @ end of it, can't append without breaking syntax highlighter ..) the above string works when send nc www.google.com 80 < request now try parse , send throught lwp: use warnings; use strict; use file::slurp qw/read_file/; use http::request; use lwp::useragent; $ua = lwp::useragent->new; $request = http::request->parse (read_file ('/run/shm/request')); print dumper ($request); $r = $ua->request ($request); if ($r->is_success) { print $r->decoded_content; } else { print $r->status_line; } and get: $var1 = bless( { '_headers' => bless( {}, 'http::headers' ), '_content' => '', '_protocol' => 'http/1.1', '_method' => 'ge

c++03 - How Do I Return a Templated Class in c++? -

i'm looking combine pointer data , type: data_pointer.h class datapointer { public: datapointer(t *data) : data_(data) { } inline double data() { return double(*data_); } private: t *data_; }; in there, data_ pointer data can of different type, user wants returned double. keep type , data , switch on type when returning in data() function, seems harder needs be. the following example super contrived, think gets point across: main.cpp #include "data_pointer.h" enum type { kshort, kint, kfloat, kdouble }; datapointer d() { type t; // char * returned, pointer other type indicated // type parameter (void * standard way of doing this)-- // straight c library char *value = getvaluefromexternalsource(&type); switch (type) { case kshort: return datapointer<short>(reinterpret_cast<short *>(value)); case kint: return datapointer<int>(reinterpret_cast<int *>(value)); case kfloat: return datapointer

java - Libgdx ( Input) Keypress seems to skip something -

hello once again oh mighty people of internet! have decided go libgdx creating simple memory game become better @ java. have solved, , tested lot of things myself, have come across problem just. can't. figure. out. i have created complete cluster of if statements create menu has buttons can selected arrow keys (i couldn't figure out how make them clickable buttons :p) , seems work fine except skips 1 of buttons high scores button. post levelselection screen class, since that's 1 i'm sure problem in. the levelselection screen class: package com.me.mygdxgame; import com.badlogic.gdx.gdx; import com.badlogic.gdx.input; import com.badlogic.gdx.screen; import com.badlogic.gdx.graphics.gl10; import com.badlogic.gdx.graphics.texture; import com.badlogic.gdx.graphics.g2d.bitmapfont; import com.badlogic.gdx.graphics.g2d.spritebatch; public class levelselection implements screen { private spritebatch spritebatch; private texture playb;

python - Algorithm Approaches to NP Multiple Constraint Knapsack P -

i've been delving python , programming in general first time on past few weeks. posted question multiple constraint knapsack problem little while ago , figured out how write brute force solution. i found several other similar questions ( knapsack constraint python , 01 knapsack specialization ) none addressed problem. figured post preposed solution , open criticism , review. but there little issue. issue around 100 trillion possible combinations, think np complete (am using term correctly?). wondering if had recommendations how make algorithm more efficient or comments on code in general. , tolerance of ignorance appreciated. thanks again ehc from itertools import combinations import csv import codecs #opens , formats data csv doc out=open("/users/edwardcarter/documents/pp/bb_test_data.csv","rt") data=csv.reader(out) data=[[row[0],row[1],eval(row[2]),eval(row[3])] row in data] out.close() #sort players position c=[] pf=[] pg=[] sf=[] sg=[]

xml - MOXy ignores XmlElement(required=true) -

i have following pojos: @xmlrootelement(name = "root") @xmlaccessortype(xmlaccesstype.field) public class datalist<t> { @xmlelementwrapper(name="resulttablesection") @xmlanyelement(lax = true) public list<t> elements; } @xmlrootelement(name = "resulttable") @xmlaccessortype(xmlaccesstype.field) public class event { @xmlelement(name = "tsseventid", required = true) public integer id; ... } when in response xml tsseventid tag missing datalist in event.id field null regardless of set required=true. nothing fails. expected behavior ? how can enable validation ? unmarshall code: jaxbcontext.newinstance(datalist.class, hall.class).createunmarshaller().unmarshal(xmldocument); dependency: <dependency> <groupid>org.eclipse.persistence</groupid> <artifactid>org.eclipse.persistence.moxy</artifactid> <version>2.5.1</version> </dependency>

arrays - PHP split string into tokens and tags -

i have string needs separated (with php) 2 arrays: tokens , tags. let's string: radioed/jj to/to earth/nn and/cc the/dt control/nn room/nn here/rb ./pun need 2 arrays, so: $_tokens = array("radioed","to","earth","and","the","control","room","here","."); $_tags = array("jj","to","nn","cc","dt","nn","nn","rb","pun"); this means since each phrase in format: token/tag need possible. plus, have token/tag combinations might unsafe directly place string (i.e. "/puq , quotation mark " token , puq tag), need able escape these somehow. can please suggest efficient , fast method of doing this? thanks! $sets = explode(' ', $string); foreach ($sets $set) { list($_tokens[], $_tags[]) = explode('/', $set); } see here in action: http://codepad.viper-7.com/a3zga0

How can I remove the text using jQuery or javascript -

Image
this question has answer here: clear text of div , keep child nodes using jquery [duplicate] 4 answers i can't think syntax remove text highlighted in yellow. picpanel div gets cleared when try access main panel var parent = document.getelementbyid('ct100...'); parent.removechild(parent.firstchild); here's fiddle: http://jsfiddle.net/9b36k/ if want make sure you're removing text node if it's there (and not accidentally removing else when it's not there) use this: var parent = document.getelementbyid('ct100...'); var child = parent.firstchild; child.nodetype == 3 && parent.removechild(child);

which pygame is needed for python 2.7.6? -

which version of pygame should install python 2.7.6? have tried lot of versions none of them work! necessary install pygame in specific location? i think can run: pip install pygame or easy_install pygame and automatically pick best version.

How to remove all duplicates of ints in an array java -

i needed create method remove occurrences of integers in array. when integers removed, whole list needs shifted down empty spaces filled next integers. currently, method removes 1 occurrence of given integer. public void removeall(int val) { (int n = 0; n < list.length; n++) { //goes through each integer if (list[n] == val) { //checks if value user enters (int j = n; j < list.length - 1; j++) { list[j] = list[j + 1]; } list[elements - 1] = 0; //elements amount of elements in array elements--; } } } you close: i recommend not using list.length rather elements throughout. otherwise, algorithm break when val = 0 , list contains 0 . public void removeall(int val){ for(int n = 0; n <elements;n++){ // < -- change list.length elements if(list[n] == val){ (int j = n; j<elements-1;j++){ // < -- change list.length elements l

php - How to access my modules in Zend Framework 1.12 -

new zend!! i have created zend projects 2 modules, 1.defaule , 2.test structure application + |__ modules | _default controllers indexcontroller.php errorcontroller.php models views | _test controllers indexcontroller.php models views application.ini [production] phpsettings.display_startup_errors = 1 phpsettings.display_errors = 1 includepaths.library = application_path "/../library" bootstrap.path = application_path "/bootstrap.php" bootstrap.class = "bootstrap" appnamespace = "application" resources.frontcontroller.controllerdirectory = application_path "/controllers" resources.frontcontroller.params.displayexceptions = 0 resources.frontcontroll

css - Apply style to xml attribute value -

i trying applying style below xml code label attribute <navitem description="" id="client1" label="my information" sequencenumber="3" ></navitem> here xsl code <h3 title="{@description}"> <a href="#"> <img src="{$imgsrc}" /> <xsl:value-of select="@label"/> </a> with above xslt code getting value label output don't no how apply css label. kindly me thanks & regards mahadevan you need wrap value in html element, e.g. <span class="label"><xsl:value-of select="@label"/></span> then can add suitable link element (referring external css stylesheet), or style element in head part, using normal css, e.g. <style> .label { font-size: 80%; font-family: calibri, sans-serif } </style> as less structured approach, suitable in simplest cases, alternative use css style sh

caching - Do TYPO3 have a user configuration cache? -

Image
i have been watching strange issue making me think typo3 has sort of user configuration cache , don't know how clean it. the website has users , groups of users. there extensions manage records on tables. some of fields of extensions of type "group" reference files. the strange thing old users in same group don't see upload button in fields, when create new users in same group see button. there no difference between configuration of old , new users. what might happening? more info: they users , problem in web->list view. no special modules , no disabled_controls in tca fields. it interesting if duplicate old user, duplicated 1 not able see buttons, either. images this how old users see fields: and, how new users see field: i expect, there options in tsuser config or in user settings set. have in tsconfig of users , usergroups: setup.default.edit_docmoduleupload = 0 setup.override.edit_docmoduleupload = 0 perhaps set in

How to solve non-linear mathematical equation in matlab? -

i've 2 equations as: x = c1 - y; y = c2*c3*x / (1+c3*x); where c1 , c2 , c3 constants. how solve these equations in matlab? please help. since i'm in mood morning: x = c1 - y; y = c2*c3*x / (1+c3*x); now, pen , paper: y = c1 - x c1 - x = c2*c3*x / (1 + c3*x) (c1 - x) * (1 + c3*x) = (c2 * c3 * x) (c1 - x) * (1 + c3*x) - c2*c3*x = 0 you should able use fzero or roots solve yourself.

eclipse - Postgres Sql Connection in Ofbiz web application -

i developing first web app in ofbiz framework psql database. added postgresql-8.1-404.jdbc2.jar jdbc driver jar /framework/entity/lib/jdbc folder , made necessary corrections entityengine.xml file , trying access table in database following groovy code. @grabconfig(systemclassloader = true) import groovy.sql.sql class.forname("org.postgresql.driver"); def dburl = "jdbc:postgresql://127.0.0.1:5432/dbname" def dbuser = "postgres" def dbpassword = "root" def dbdriver = "org.postgresql.driver" def sql = sql.newinstance(dburl, dbuser, dbpassword, dbdriver) // groovier... sql.eachrow('select * tablename') { println it.party_id } but throws following exception [java] exception: java.sql.sqlexception [java] message: no suitable driver found jdbc:postgresql://127.0.0.1:5432/dbname help resolve problem...thank you.

javascript - ckeditor image by jquery display -

hi guys trying insert fileurl display image in ckeditor how edit codes that? razor cshtml </script> @html.textareafor(model => model.questioncontent, new { @id = "ckecontent" }) <script type="text/javascript"> ckeditor.replace( "ckecontent" ) </script> my codes able display url, want display image help?? $(function() { $("#browser").click(function() { var ckfinder = new ckfinder(); ckfinder.selectactionfunction = function ( fileurl ) { $( '#imagediv' ).html(''); var img = new image(); $( img ).attr( 'src', '' + fileurl ).appendto( $( '#imagediv' ) ).fadein(); $( img ).attr( 'width', '' + fileurl ) $( img ).attr( 'height', '' + fileurl ) ckeditor.instances.ckecontent.inserthtml( fileurl ); </scr

Connect windows phone 8 with visual studio 2013 -

i have device has been registered developer account pc. im trying connect debug in pc,but not connecting , showing phone developer locked.what solution ,anyone? if register device 1 pc account,the device should connected in other pc visual studio right? if register device 1 pc account,the device should connected in other pc visual studio right? yes! should connected other pc well. check in developer account, whether device added account. if exists there, means device no longer developer locked. , should able connect pc in visual studio.

java - To check time value in JSpinnerand set date in JDateChooser accordingly -

i have 2 jdatechooser (named firstdate , lastdate) , jspinner (named starttime , endtime) in gui. the scenario is, 1.if open gui current time , set in endtime , currenttime-1 in starttime(the code below), calendar cal = calendar.getinstance(); cal.add(calendar.hour, -1); date onehourback = cal.gettime(); string timestamp = new simpledateformat("hh:mm:ss").format(onehourback); date date = new simpledateformat("hh:mm:ss").parse(timestamp); starttime.setvalue(date); 2.for both jdatechooser set current date. 3.if current time 00:44:36 (hh:mm:ss), in starttime( jspinner ) have set 23:44:36, have set firstdate( jdatechooser ) value previous day date instead of current date. for trying following way, calendar currenttime = calendar.getinstance(); date curhr = currenttime.gettime(); string curtime = new simpledateformat("hh").format(curhr); int timecheck = integer.parseint(curtime); if(timecheck > 00 && timecheck < 01){ //code se

events - Adding more than 2 metrics to a Google Analytics -

Image
is possible track more 2 metrics in timeline on google analytics? specifically track 2 events , compare against visits; however, whenever try timeline widget can compare visits against 1 event. if understand correctly: go behavior -> events. select checkboxes in front of events want examine. @ head of data table click "plot rows". display values selected events in graph. go dropdown box right above graph , select "visits". add data visits graph. i attached sample image can see if after. relevant bits marked red-ish.

visual c++ - wxString Printf function issues in linux -

i trying print data in wxstring using printf function crashing in run time in linux not in windows here code: wxstring str1,str2; str1 = "elements"; str2.printf( _u("%s"),str1); this working in windows not in linux , if change below working in linux also str2.printf( _u("%s"),str1.c_str()); why not taking str1 argument. note:this sentence using throughout workspace there common way in linux instead of changing in places the "fix" upgrade wxwidgets 3.0 wxstring::printf() , other similar functions (pseudo) variadic templates , work correctly objects , not raw pointers. in wxwidgets 2.8 variadic functions and, according language rules, can't work objects , no, there no way around this.

c# - How to pass an object using Post Method with help WebRequest class -

how pass object using post using webrequest ? my code: public void createapplication(applicationdata applicationdata, string token, string applicationurl, string xframeurl) { uri uri = new uri(applicationurl); httpwebrequest request = (httpwebrequest)webrequest.create(applicationurl); request.accept = "application/json"; request.referer = xframeurl; request.host = uri.host; request.headers.add("origin", uri.scheme + "://" + uri.host); request.headers.add("authorization", token); request.headers.add("x-requested-with", "xmlhttprequest"); object data = new { culture = applicationdata.culture, endpointid = convert.tostring(applicationdata.endpointid), useragent = applicationdata.applicationname }; request.method = "post"; javascriptserializer jss = new javascriptserializer(); streamwriter writer = new streamwriter(request.getrequeststream()); string content

How to Resolve the CkEditor CurlyBraces? -

i new ckeditor. in project have issue related curly braces. my problem when enter code curly braces in source window below; code view : <h1>normal code curly braces</h1> {normal code} <h1>hard code curly braces</h1> &#123;hard code&#125; when click again source ("wysiwyg" editor view) getting follows; editor view : normal code curly braces {normal code} hard code curly braces {hard code} when click again source; code view : <h1>normal code curly braces</h1> <p>{normal code}</p> <h1>hard code curly braces</h1> <p>{hard code}</p> but want if write curly brackets should display curly brackets if write code should display code in code view. not convert curly brackets code - wrote initially. in file have configure related code required output not getting. please me if 1 expertize in ckeditor. thanks in advance.

scala - Unresolved dependencies for np 0.2.0 with SBT 0.13? -

scala 2.10.2 , sbt 0.13 i'm trying use np plugin , added following lines ../0.13/np.sbt : seq(npsettings:_*) (npkeys.defaults in (compile, npkeys.np)) ~= { _.copy(org="me.lessis", version="0.1.0-snapshot") } and <home-directory>/.sbt/plugins.sbt addsbtplugin("me.lessis" % "np" % "0.2.0") resolvers += resolver.url("sbt-plugin-releases",url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(resolver.ivystylepatterns) when execute sbt run getting : [info] updating {file:/home/projects/hellosbt/}default-310e5b... [info] resolving me.lessis#np;0.2.0 ... [warn] module not found: me.lessis#np;0.2.0 [warn] ==== local: tried [warn] /home/.ivy2/local/me.lessis/np/scala_2.10/sbt_0.12/0.2.0/ivys/ivy.xml [warn] ==== sbt-plugin-releases: tried [warn] http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/me.lessis/np/scala_2.10/sbt_0.12/0.2.0/ivys/ivy.xml [warn]

Maven dependecy mangement artiafctId with ${project.artiafctId} -

in parent child : <project> ... <dependencies> <dependency> <groupid>${parent.groupid}</groupid> <artifactid>${parent.artifactid}-war</artifactid> <type>war</type> </dependency> </dependencies> ... </project> in parent : <project> ... <dependencymanagement> <dependencies> <dependency> <groupid>${project.groupid}</groupid> <artifactid>myproject-war</artifactid> <version>${project.version}</version> <type>war</type> </dependency> </dependencies> </dependencymanagement> ... </project> just wondering why using (in parent) <artifactid>myproject-war</artifactid> is working , using <artifactid>${project.artifactid}-war</artifactid> is not working [0] 'dependencies.dependenc

Does Cassini DevServer support Integrated Pipeline mode? -

this did not manage find internet. we have web application uses signalr requires owin needs iis integrated pipeline mode. when running our web application on cassini dev server following error: [platformnotsupportedexception: operation requires iis integrated pipeline mode.] system.web.httpresponse.get_headers() +214 microsoft.owin.host.systemweb.callheaders.aspnetresponseheaders..ctor(httpresponsebase response) +37 microsoft.owin.host.systemweb.owincallcontext.createenvironment() +492 microsoft.owin.host.systemweb.integratedpipeline.integratedpipelinecontext.getinitialenvironment(httpapplication application) +263 microsoft.owin.host.systemweb.integratedpipeline.integratedpipelinecontext.prepareinitialcontext(httpapplication application) +19 microsoft.owin.host.systemweb.integratedpipeline.integratedpipelinecontextstage.beginevent(object sender, eventargs e, asynccallback cb, object extradata) +462 system.web.asynceventexecutionstep.system.web.httpapplicati

java - Cplex Incorrect Variable Values -

i define variables in cplex model (in java ). these variables bounded [0,1] . as: model.numvar(0, 1, ilonumvartype.float, "x(" + i+ ")"); but in final solution, these variables values out of bounds. ( such -1.7, 1.3 ,...). pleas me.

javascript - How to overcome the JQuery MultiSelect Performance Issue when there are many items? -

i'm using jquery multiselect jquery ui: http://www.erichynds.com/blog/jquery-ui-multiselect-widget it has great features searching items, option list , checkbox list, etc but it doesn't perform when number of items above 700 , has css issues ie 8.0. where can find multiselectable , searchable drop downlist can perform in large numbers? googled couldn't find meets these criteria. i'd avoid building new such control myself if possible. you might better off styling own css only. shouldn't use js if don't have to. here's jsfiddle.com http://jsfiddle.net/snlacks/4wrs2/2/ edit: made little prettier: http://jsfiddle.net/snlacks/4wrs2/4/ if have more questions, please ask. <div class="multiselect"> <ul> <li><label><input type="checkbox" name="1"/><div>test 1</div></li> ... </ul> </div> the key points on css here. .multisele

javascript - html2canavas error in mvc 4 project -

so here im trying do: have page user sees representation of card after user clicks save card following function called , data should return controller in order me save card image. use html2canvas , here code: <div class="row download-card"> <div class="span12"> <h2>congratulations!</h2> <h3>you may download mycard</h3> <div id="card" class="card center"> <ul> <li style="float: left;position: absolute;display: block;padding-top: 200px; padding-left: 200px;text-align: left;font-family:arial;color:white;font-size:x-large;">@name @lastname<span style="padding-left:90px;font-size:x-large; color:#ffffff;font-family:arial;">@cardno</span></li> <li style="float: left;position: absolute;display: block;padding-top: 230px; padding-left: 200px;text-align: left;color:white;">member since: @yearregistere

retreival of x-axis value on a google chart getselection -

i use column chart. when clicking @ 1 of rows in diagram listener trigger event: google.visualization.events.addlistener(chart, 'select', renderlist); i able retrieve number 2456 , not 6. number 6 value of first column. have 2 columns in table. can please me this? i've been struggling quite time. this instantiation of chart: <script type="text/javascript"> $("select").change(function () { drawchart(); }); function drawchart() { var inputdata = { rooms: $("#rooms").val(), area: $("#areas").val(), apartmenttype: $("#apartmenttype").val(), queue: $("#queue").val(), year: $("#years").val() } $.ajax({ url: '@url.action("allocatedapartments", "statistics")', datatype: 'json', data: inputdata, type: 

c - Cannot compile x86 in GCC crunchbang -

i cannot seem use gcc compile c x86. using crunchbang. simple c test file: #include <stdio.h> int main(){ printf("test x86"); } when compiled with: gcc -o 64 test.c i no errors or output whatsoever. however, when compiled with: gcc -o 64 -m32 test.c greeted with: in file included /usr/include/features.h:356:0, /usr/include/stdio.h:28, test.c:1: /usr/include/x86_64-linux-gnu/sys/cdefs.h:359:27: fatal error: bits/wordsize.h: no such file or directory compilation terminated. now, browsing files, seems if in wrong folder because. i'm not sure here. contents of /usr/include/features.h:586 # include <x86_64-linux-gnu/sys/cdefs.h> which gives error on line 359. line shown here: #include <bits/wordsize.h> the file located here: /usr/include/x86_64-linux-gnu/bits/wordsize.h gcc should support or run multilib eliminate error.

Update database file by downloading file from server(url)-android -

how save database file download server in /data/data/com.package.name/databases/file.db path(update current database deleting , replacing new database--not update app). i had downloaded file , saved in /data/data/com.package.name/files .but not save given path (permission problem) firstly shows correct size try pull file out see database empty , try run app further closes giving error table can not found , file size decreases containing android_metadata table only. i had downloaded file , saved in sdcard show error while reading file ---contains path separator since don't want access database sdcard. have split database file 1mb each (3mb 1 file 3 files). android not allow access root path . wont allow save databse there. can save database sd card , access . or if dont want save sd card create database , populate records server.

copy - Copying ALL tables from one user to another Oracle11g -

i have user name user1 password user1 want create user 2 identified user 2 , copy tables data user 1 user 2. can copy tables @ once, or need copy table table new user? how can that? you can use datapump. first of all, create directory object maps directory in file system: create or replace directory dir_temp 'c:\temp'; then export schema (associated user1) in dump file: c:\app\...\dbhome_1\bin\expdp.exe system/pwd schemas=user_1 directory=dir_temp dumpfile=file.dmp logfile=file_exp.log and re-import dump file: c:\app\...\dbhome_1\bin\impdp.exe system/pwd remap_schema=user_1:user_2 directory=dir_temp dumpfile=file.dmp logfile=file_imp.log

c - I'm trying to add numbers into a linked list in ascending order. what can I fix so it'll work? Here's my code: -

this code supposed put numbers linked list in ascending order. 1 function of program takes keyboard input(int x) user of program. node* insert(node *head, int x) { node *newptr; node *preptr; node *currentptr; newptr = malloc(sizeof(node)); if(newptr != null){ newptr->value = x; newptr->next = null; preptr = null; currentptr = head; while(currentptr != null && x > currentptr->value){ preptr = currentptr; currentptr = currentptr->next; } if(preptr == null){ newptr->next = head; head = newptr; } else{ preptr->next = newptr; newptr->next = currentptr; } } } int main(void)//calling input function in main { node *head = null; int x=0; while(x!=-1){

sql - Filtering table using sum value from another table -

working postgresql, trying filter data table using data one. example: table 1: id|app|area_app 1| | 4.7 2| | 4.7 3| | 4.7 table 2: id|spart|area_spart 1| 1a | 1.2 1| 1b | 1.8 2| 2a | 2.1 2| 2b | 2.3 3| 3a | 0.6 i filter second table selecting rows (with same id of first table) sum of area_spart equal area_app of first table; in example resulting table should be: id|spart|area_spart 1| 1b | 1.8 2| 2b | 2.3 3| 3a | 0.6 total area_spart = area_app = 4.7 thanks all! use inner join if getting duplicate record table use query select table1.id,table2.spart,sum(table2.area_spart) area_spart table1 inner join table2 on (table1.id = table2.id) group table1.id if getting id based record use one select table1.id,table2.spart,sum(table2.area_spart) area_spart table1 inner join table2 on (table1.id = table2.id) table1.id = 'your_id' if record not based on id , want 1 record try 1 limit

android - HAX is not working and emulator runs in emulation mode -

when run project android application, this: [2014-02-06 10:25:36 - emulator] hax not working , emulator runs in emulation mode [2014-02-06 10:25:53 - helloabsolutebeginner] new emulator found: emulator-5554 [2014-02-06 10:25:53 - helloabsolutebeginner] waiting home ('android.process.acore') launched... how fix error hax not working , emulator runs in emulation mode, when have amd athlon(tm) processor. hardware accelerated emulation available on processors support virtualization technology. that, processor must need comply either of following: intel virtualization technology (vt, vt-x, vmx) extensions amd virtualization (amd-v, svm) extensions (only supported linux) there might possibility feature disabled in bios. verify if athlon processor support instruction-set, check bios settings , (in case of amd processor) run emulator in linux environment. for more info, read this .

c++ - Generated IDL from java-Interface with rmic generates an Error -

i working in project, write java rmi-iiop server , da corba-c++ client. generate idl our java-interface rmic -idl. think wrong in our interface, because when compile generated idl, got following error: ./wishlistinterface.idl:33: java/io/filenotfoundex.idl: no such file or directory ./wishlistinterface.idl:102: java/util/arraylist.idl: no such file or directory ./wishlistinterface.idl:103: java/io/file.idl: no such file or directory ./wishlistinterface.idl:80: scoped name '::java::io::filenotfoundex' not defined and our interface: import java.io.file; import java.io.filenotfoundexception; import java.rmi.remoteexception; import java.util.arraylist; public interface wishlistinterface extends java.rmi.remote { public int securelogin(string username, long checksum) throws remoteexception; public arraylist<wish> getunreceivedwishes(string username)throws remoteexception; public void createwishlist(string wishlisttitle) throws remoteexception; public file

php - Doctrine ORM with $_GET Variables and security? -

i use scripts have sort fields. nothing special wondering. have code: $data = $this->getdoctrine()->getrepository('mybundle:data')->findby(array("id" => $id), array($_get["sort"] => $_get["direction"])); if give field in "sort" non-existent there error. exploited sql injection? if so, best way avoid that? since $_get["sort"] used pass in field sort on fill in whatever want sort on... don't think harm can done because doctrine filter out bad things still don't recommend this. try cleaning @ least $_get["sort"] , $_get["direction"] fields.

knockout.js - How to add and remove extender on runtime? -

i using extender validation in text-box accept numeric value. had referred same example shown in this link, in case have drop-down beside text-box, particular selected text of drop-down should apply binding(with extender) otherwise should apply normal binding. for few options of dropdown, textbox should apply numeric check others should not. i want change these 2 binding on drop-down change on run-time - self.textinput = ko.observable(); self.textinputnumeric = ko.observable().extend({ numeric: 0 }); check question here, on bottom there couple of edits actual code may you move validation observable computed

java - StackOverflow error in TextWatcher watcher in EditText -

i'm converting amount text edittext double format , im trying remove "," in edittext execute proper format computations. what's wrong code , having stack overflow? // gets 2 edittext controls' editable values string cleanbasictax; if(txtbasictax.gettext().tostring().contains(",")){ cleanbasictax=txtbasictax.gettext().tostring().replace(",", ""); } else{ cleanbasictax=txtbasictax.gettext().tostring(); } string cleantxtsurcharge; if(txtsurcharge.gettext().tostring().contains(",")){ cleantxtsurcharge=txtsurcharge.gettext().tostring().replace(",", ""); } else{ cleantxtsurcharge=txtsurcharge.gettext().tostring(); } string cleaninterest; if(txtinterest.gettext().tostring().contains(",")){ cleaninterest=txtinterest.gettext().tostring().replace(",", ""); } else{ cleaninterest=txtinterest.gettext().tostring(); } string cleancompromise=txtcompromise

html - Navbar menu items with bars beneath them on hover/click -

Image
i trying make html navbar using bootstrap looks similar twitter's current nav bar, selected tab has line beneath in , line appears beneath menu items when hover on them. have tried looking @ examples of this, have not discovered how this. not sure whether best use nav pills <ul class="nav nav-pills"> <li class="active"><a href="#">home</a></li> <li><a href="#">profile</a></li> <li><a href="#">messages</a></li> </ul> or nav bar any or guidance appreciated since question little unclear, i'll assuming haven't tried (based on post), starting point. nav { background-color: white; border-bottom: 5px solid blue; /* define light blue border link */ } nav a.active { border-bottom: 5px solid white; /* simulate increase in white color */ } nav a:hover { border-bottom-color: green; /* change border-color green

Linq multi level grouping -

i trying implement multi level grouping in linq in sql that. select varid, variable, ut , (case when resultat >= 0 sum(resultat) else 0) positive, (case when resultat < 0 sum(resultat) else 0) negatif (select varid, variable, ut , valeur, sum( resultat ) indicrow group varid, variable, ut , valeur) group varid, variable, ut i have created in linq can't find way group on result of group by var chartline = indicrow in indic_dt.asenumerable() //where seltradeid.contains(indicrow.field<int>("tradenum")) group indicrow new { gpvariable = indicrow.field<string>("variable"), gput = indicrow.field<string>("ut"), gpvarid = indicrow.field<int>("varid"), gpvalue = ind

git - File keeps coming back -

we have set our .gitignore file ignore all files ending in *.sdf as full path file, e.g. /myproject/database/mydatabase.sdf / being project's root (top-level directory checked git) ignore 1 file but file keeps coming checked in various members of team. any ideas how really exclude .sdf file good? we can't quite grasp why keeps popping in modified files everybody.. if pop in modified files means have committed file past. before adding .gitignore rule. am right? you have remove via git rm , commit change.

design - Responsibility of an android fragment with buttons -

suppose have activity , fragment provides controls, buttons might trigger action. how think should design ? 1. can put code take relevant actions in fragment itself. 2. can define callback , make parent activity implement it, , whenever button pressed let parent activity know through callback. the trouble 2 parent activity might grow out large one. trouble 1 not feel right taking actions form within fragments. any regarding these 2 methods or other way in can go tacking invited.

c++ - Windows XP memory management without pagefile - what are the consequences wrt. to heap fragmentation? -

i've been looking rather elusive bug see in application on windows xp embedded system. we've narrowed bug down pointer should pointing block of memory, instead pointing null. since memory allocated call malloc(..) going unchecked, instinct says malloc failed , returned null (though looking other possibilities right too, such race conditions may inadvertently alter pointer). native c++ application. crash little more convoluted track down cause, because had post-mortem crash dumps , failure manifested in third-party library don't have source for, on different thread. fun times :) my questions focused on memory exhaustion possibility. of importance xp embedded system running on had its' pagefile disabled. so, have 3 questions; it'd great if clarify these me: primarily, implications of having no paging file? mean when heap grows, new memory needs found , allocated operating system, if free blocks aren't used immediately? i've seen anecdotal m

javascript - Navigator.plugins does not display all plugins -

i working on detection of adblock plugin on web browser , noticed navigator.plugins returns array of pluginarray object list of plugins installed. java applet plug-in shockwave flash picasa quicktime plug-in but unexpectedly not return plugins, plugins such " user agent switcher " , " adblock " not listed (contrary stated in https://developer.mozilla.org/en-us/docs/web/api/navigatorplugins.plugins ). why not display plugins (am missing something) or how display plugins? you can try check how extensions modifying page. example user agent switcher chrome: if (window.new_nav && window.old_navigator && window.new_nav.useragent === navigator.useragent) { console.log('user changed navigator.useragent, real one:', window.old_navigator.useragent); } to detect adblock can question -> stackoverflow.com

web applications - An idea which would reduce small calculations.How to implement it? -

Image
if wrong question pose on site please let me know.i can't find better site. i'll grateful if can suggest few sites/forums,to post question. i have idea & see in action. i in 2nd year of graduation. our semester marks on our college website. have around 7 subjects , 7 rows on results page. cropped 4 rows in pic below. the thing total of subjects & percentage aren't displayed on page .we need open calculator on our pc , manually type in marks add them , our grand total , calculate percentage. my idea reduce trouble in tedious task. so, thought of making student total marks & percentage in single click without such manual entry work. i'd design plugin or app (i'm not sure how address problem). my question found ways of doing this: 1)scanning source code of page & find marks. 2)by plugin or app. (i'm not sure how it!) i window popup on page single click & display total marks & percentage. how can solved?? plug

Serializing/de-serializing with different classes using Msgpack (Java API) -

i'm experimenting msgpack de-serialize object graph using msgpack hitting problems. at moment have simple hierachy consisting of 2 classes: basemessage , personnew . basemessage has single long field id getters , setters. personnew has string fields name , email , inherits basemessage . originally personold class had id field , serialized/de-serialized fine. when tring de-serialize personold (which had id ) personnew class (which inherits id basemessage ) i'm being hit error: org.msgpack.messagetypeexception: unexpected raw value all fields i'm using private. below sample code: personold personold = new personold(); personold.setname("person"); personold.setemail("person@email.com"); messagepack msgpack = new messagepack(); msgpack.register(personnew.class); msgpack.register(personold.class); // serialize using old person class byte[] personbytes = msgpack.write(personold); bytearrayinputs

php - Count json objects in array -

struggling count of objects in array spit out number in json. can help? try { $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception); $stmt = $conn->prepare('select * date_blocks user_id = :user_id'); $stmt->execute(array('user_id' => $user_id)); while($row = $stmt->fetch()) { $starttime = strtotime($row['start_date']); $endtime = strtotime($row['end_date']); ($i = $starttime; $i <= $endtime; $i = $i + 86400) { $getdate = date('y-m-d h:i:s', $i); $return[]=array('date'=>$getdate, 'id'=>$row['id']); } } } catch(pdoexception $e) { echo 'error: ' . $e->getmessage(); } header('content-type: application/json'); echo json_encode($return); getting number of elements in json format @ end of script: header('content-type: application/json'); echo jso

html - Random padding/margin at top of webpage only on Firefox -

Image
can figure out? take @ mean here: https://www.wellchild.org.uk/ compare between other browser & firefox screenshot: have tested on windows & mac in ie, chrome, safari, opera & firefox.. , on firefox im getting problem! ive tried inspecting page dev tools available in firefox , cant figure out try 1 of following: 1) remove float: left; .mainhead nav ul li (style.css ... line 78) should fix problem cross-browsers. may have define left/right margin. 2)add following code style.css target firefox browser: @-moz-document url-prefix() { .mainhead nav ul li{ float:none; } } let me know works you...

OpenERP 7 - In invoice form , amount_tax is not updated on save/print -

i'm using invoicing feature in openeerp v7. on invoice form view, in edition mode, when add invoice line article, can't manage amount_tax field updated unless if click on update link next it. when both save or print invoice, tax amount not updated. is normal behavior ? if normal, how change ? cheers

java - ServerSocket.accept() throwing SocketTimeoutException with null message -

i trying instance of socket serversocket object. but, prints sockettimeoutexception = null there code: try { // listen new connections log.d("shairport", "service >> in try "); try { servsock = new serversocket(port); } catch (ioexception e) { log.d("shairport", "service >> in try # io exception = " +e.getmessage()); servsock = new serversocket(); }catch(exception e) { log.d("shairport", "service >> in try # e xception = " +e.getmessage()); } // dns emitter (bonjour) byte[] hwaddr = gethardwareadress(); emitter = new bonjouremitter(name, getstringhardwareadress(hwaddr), port); //setting timeout servsock.setsotimeout(10000); log.d("shairport", "service >> stopthread = " +stopthread); while (!stopthread) { try { //********** throwing exception ***************//