Posts

Showing posts from January, 2013

ember.js - Ember - Issue with class binding within helper -

we upgraded ember 1.11.1 , ember-validations 2.0.0-alpha.3. controller export default ember.controller.extend(embervalidations.mixin, { canvalidate: true, validationmodel: ember.computed.alias("model"), validations: { 'validationmodel.name': { presence: { 'if': 'canvalidate', message: 'please enter name'}, }, }, } template {{log "error value" errors.validationmodel.name}} {{input classbinding="errors.validationmodel.name:app_input_box_error:app_input_box" placeholder="document name" value=model.name}} with above template code in place, validations works expected , input's class swopped out depending on whether there validation error or not. however, when {{log}} line removed, class binding seems lost , input class no longer appropriately updated. advice on cause/fix please? note class bindings outside helpers e.g. in standard div continues work properly maybe try t...

ios - Why MKMapKit takes tons of memory -

i have made app in there functionality of map . whenever controller opens screen contains map memory usage directly hikes 180mb 45mb . i have used mkmap , set delegate . whats problem causing this? check memory usage in actual device. had same problem in simulator, device showed actual usage. think simulator bug.

php - update query not working and change fields to 0 -

i have form code. <form action="save_profile.php" method="post"> <table> <tr><td>first name:</td><td><input type="text" name="fname" value="<?php echo $fname;?>"></td></tr> <tr><td>last name:</td><td><input type="text" name="lname" value="<?php echo $lname;?>"></td></tr> <tr><td>mail id:</td><td><input type="text" name="mail" value="<?php echo $mail;?>"></td></tr> <tr><td>contact no:</td><td><input type="text" name="contact" value="<?php echo $contact;?>"></td></tr> <tr><td></td><td><input type="submit" name="submit" value=...

r - Data cleaning using subset with 2 conditions on same variable -

i newbie r, have @ dataset iteproduction_2014.2015 , want see datapoints between 4 , 39 days. use 2 separate lines create subset. can in 1 line? data.difference >3 , < 40? iteproduction_2014.2015 <- subset(iteproduction_2014.2015,date.difference>3) iteproduction_2014.2015 <- subset(iteproduction_2014.2015,date.difference<40) thanks in advance, dirk just little googling have solved problem, example read this logical operators, like this? iteproduction_2014.2015<-subset(iteproduction_2014.2015,date.difference>3 & date.difference<40)

jsp - Use of Struts in html select -

i have problem select , use of struts. if select , change page, when turn page, select has not right selection. why? <select id="select" name="polizza"> <option value="" <s:if test='polizza == ""' >selected="selected"</s:if> ></option> <option value="01" <s:if test='polizza == "01"'>selected="selected"</s:if> >figlio/figlia</option> <option value="02" <s:if test='polizza == "02"'>selected="selected"</s:if> >genitore</option> <option value="03" <s:if test='polizza == "03"'>selected="selected"</s:if> >coniuge/convivente</option> <option value="04" <s:if test='polizza == "04"'>selected="selected"</s:if> >nipote</option> <op...

visual studio - Code Analysis/FxCop CA1726:UsePreferredTerms showing Cancelled as Deprecated -

i'm in uk spell cance ll ed 2 l's. want use code analysis rule "ca1726:usepreferredterms" don't want flag "cancelled" violation. i have tried adding <codeanalysisculture>en-gb</codeanalysisculture> project file encourage code analysis use british spelling i have tried adding <recognized><word>cancelled</word></recognized> projects customdictionary.xml i'm not keen on adding suppression every time word cancelled used. i want solution can checked source control other developers work on don't want change local c:\program files (x86)\microsoft visual studio 12.0\team tools\static analysis tools\fxcop\customdictionary.xml i using visual studio 2013. is there way achieve this? as suspect know, there's no built in way achieve this. overriding built in custom dictionary has been raised before in various forms same conclusion, can't override/reset custom dictionary. it's low p...

android - google maps api v2 out of memory error -

i have huge memory problem in app. using google map api v2 clustermanager , custom markers. supply image via call markeroptions.icon(bitmapdescriptorfactory.frombitmap(bitmap)); each marker based on category. problem is: after several screen rotations app crashes because of oom error: 05-14 11:04:12.692 14020-30201/rokask.rideabike e/art﹕ throwing outofmemoryerror "failed allocate 4194316 byte allocation 1627608 free bytes , 1589kb until oom" 05-14 11:04:12.722 14020-30201/rokask.rideabike e/androidruntime﹕ fatal exception: glthread 19179 process: rokask.rideabike, pid: 14020 java.lang.outofmemoryerror: failed allocate 4194316 byte allocation 1627608 free bytes , 1589kb until oom @ dalvik.system.vmruntime.newnonmovablearray(native method) @ android.graphics.bitmap.nativecreate(native method) @ android.graphics.bitmap.createbitmap(bitmap.java:939) @ android.graphics.bitmap.createbitmap(bitmap.java:912) @ android.graphics.bitmap...

jquery - Bootstrap Dropdown - Onclick menu items, scorll to last submenu item -

i using bootstrap dropdowns. when click on main menu " has sub menu " list item, children of list has toggle. till here working fine... but how can do: if click on has sub menu <li> have see submenu items without scorll down... means, scorll should go end of last sub menu item... fiddle jquery $('ul.dropdown-menu').on('click', function(event){ event.stoppropagation(); }); $('ul.dropdown-menu').on('click', function(){ $('.submenu').toggle(); }); html <div class="btn-group" role="group" aria-label="..."> <div class="btn-group open" role="group"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">dropdown <span class="caret"></span> </button> <ul class="dropdown...

javascript - HTML page to PDF (angular js and d3 charts) -

i have html page may contains multiple tables , d3 charts, want export whole page pdf, there way using angularjs or javascript,jquery. help. try use jspdf ( http://mrrio.github.io/jspdf/ ). think can help.

Write date to SQL using VBA -

till today used function write dates access form sql server. today noticed now() function not working anymore. tried date() - still not working. getdate cannot use in vba. need have exact date minutes. suggestions? thank in advance! currentdb.execute ("update ci set d_date = now() id = " & id & ";"), dbseechanges concatenation of variables/constants in vba performed using ampersand operator. however, there few variations depending on data types. if field value supplied string need enclosed within, string literal (single or double quotes). dim myname string myname = "paul" strsql = "update tablename set textfieldname = '" & myname & "'" the above not safe, errors happen when using names single quotes in them. so, better way. dim myname string myname = "paul o'connor" strsql = "update tablename set textfieldname = " & chr(34) & myname & chr(34) for dates,...

javascript - How to render data of many models on single view on respective button click -

i using mvc5 , have created model tabledata.cs class contains code below: namespace webapplication2.models { public class tabledata1 { public string name { get; set; } public string location { get; set; } public string time { get; set; } } } my controller corresponding is: namespace webapplication2.controllers { public class homecontroller : controller { // get: home public actionresult tabledata1() { viewbag.nbcolumns = 2; list<tabledata1> tabledatamodel = new list<tabledata1>(); tabledatamodel.add(new tabledata1() { name = "shekha", location = "usa", time="12:00pm" }); return view(tabledatamodel.tolist()); } } } and view is: @model ienumerable<webapplication2.models.tabledata1> @{ viewbag.title...

python - Google App Engine Datastore delete entity by properties -

i made simple login page python , datastore . user model following. class user(db.model): name = db.stringproperty() password = db.stringproperty() question 1: lets know name , password of specific user. how can delete entity database has specified name , password properties? question 2: lets have user entity "john" name , "1234" password. given these 2 things, how can change name property "john" "marcus"? question 3: is possible achieve without using gqlquery ? these things explained in documentation . (which states should not using old db api, ndb one, never mind.) 1. user = user.all().filter('name =', name).filter('password =', password).get() if user: user.delete() 2. user = user.all().filter('name =', 'john').filter('password =', '1234').get() if user: user.name = 'marcus' user.put() there nothing requires gqlquery. gql interf...

java - Split String by comma separated , but not able to find generic solution -

string str = "\"{\"\"oman\"\"\",333,333,locationoman,1,null,3.33333e+15,0,null,-1,null,null,null,null,null,null,null,null,,null,null,null,1,null,50036,1.42771e+12,0,null,0,null,null,null,,null,null,null,null,2,0,1,3,0,1,t,f,f,0,volume,-1,302,50036,50036,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null,null,3,null,null,null,2,1,1,1,3,1,1,1,50036,0,1,0,omanprepaid,0,blrfts186_f861,ccc_user_257,a082000000000033,\"16,436,113,650\",,null}"; i have string this, output should like oman 333 333 locationoman 1 null 3.33333e+15 0 null -1 null null null null null null null null null null null null 1 null 50036 1.42771e+12 0 null 0 null null null null null null null null 2 0 1 3 0 1 t f f 0 volume -1 302 50036 50036 0 0 0 0 null null null null null null null null null null null null null 3 null null null 2 1 1 1 3 1 1 1 50036 0 1 0 omanp...

WPF TabControl and DataTemplates -

i've got set of viewmodels i'm binding itemssource property of tabcontrol. let's call viewmodels aviewmodel, bviewmodel, , cviewmodel. each 1 of needs have different itemtemplate (for header; because each need show different icon) , different contenttemplate (because have different interaction models). what i'd this: defined in resource.xaml files somewhere: <datatemplate x:key="itemtemplate" datatype="{x:type aviewmodel}"> ... </datatemplate> <datatemplate x:key="itemtemplate" datatype="{x:type bviewmodel}"> ... </datatemplate> <datatemplate x:key="itemtemplate" datatype="{x:type cviewmodel}"> ... </datatemplate> <datatemplate x:key="contenttemplate" datatype="{x:type aviewmodel}"> ... </datatemplate> <datatemplate x:key="contenttemplate" datatype="{x:type bviewmodel}"> ... </datat...

java - Is it possible to define a new listener inside a listener? -

i have swt application on eclipse.i want create statement "if x-button not clicked, stuff". btnprint.addselectionlistener(new selectionadapter() { public void widgetselected(selectionevent e) { //do stuff } }); i know can modify btnprint.addselectionlistener(new selectionadapter() { part btnprint.addselectionlistener(swt.close, new selectionadapter() { .but, since there different processes inside widgetselected method, cannot change that. clear, want able create if (x-button not clicked, stuff) inside widgetselected method without modifying addselectionlistener structure. possible add new listener inside listener different structure? or how can solve problem? edit: updated code follows: btnprint = new toolitem(customtoolbar, swt.none); btnprint.setimage(resourcemanager.getpluginimage( "com.meta.efatura.view", "icons/actions/print.jpg")); btnprint.settext(messages.get...

javascript - Remove displayed picture from background -

i'm using script upload picture. changes automatically when use script displays large picture in background of page. want remove picture shown in background of page. script <script type="text/javascript"> $(window).load(function(){ $('#i_file').change( function(event) { $("img").fadein("fast").attr('src',url.createobjecturl(event.target.files[0])); }); }); </script> and here button <input type="file" id="i_file" name="img" value="" /> i can't post picture here used prntscr anyway here's original post http://prntscr.com/750zg2 and here's what's happening after upload picture http://prntscr.com/7510vj

sql - WM_CONCAT duplicates removal -

i have table below. cola colb 12345 nhs,cde,bcd 12345 nhs,abc,def need display data in below format cola colb 12345 nhs,abc,bcd,cde,def i need generalized solution remove duplicate nhs, comes first, , put remaining words in alphabetical order. firstly, never use wm_concat since undocumented , no more available in latest version 12c. see why not use wm_concat function in oracle? , why wm_concat not work here? since on 11g, use listagg . the below query following things: split comma delimited string rows . apply string aggregation using listagg . case expression handle custom ordering. for example, sql> data as( 2 select 12345 cola, 'nhs,cde,bcd' colb dual union 3 select 12345 cola, 'nhs,abc,def' colb dual 4 ) 5 select cola, 6 listagg(colb, ',') within group( 7 order 8 case colb 9 when 'nhs' 10 1 11 else 2 12 end, c...

php - Multiple apps with composer -

there main application, let's call app. app has several dependencies (including open source projects , proprietary libraries). there multiple clients use own instance of app (on different domains manage). of these clients use adjusted version of app. implemented creating specific module (let's call sm) each client add instance of app (so don't change of code app). currently, i've implemented follows: develop app locally, use composer update dependencies ( composer update ), push app on central repo for each regular client, pull app central repo , install composer dependencies ( composer install ) for clients specific implementation, create new sm (specific module), has following composer.json file: ... "require": { "app": "x.x.x" } ... then apply same steps before sm ( composer update locally, push central repo, pull central repo, composer install ). everything fine, except 2 issues i'd overcome: comp...

amazon s3 - How can you include http://foo.local in CORS Access-Control-Allow-Origin? -

Image
i'm using * , apparently that's not enough. i'm trying upload file client browser. works when client's url localhost:3000 or foo.com . it's not working when url http://meteor.local . i've tried changing third line <allowedorigin>http://meteor.local</allowedorigin> , same error. the browser error: the error text misleading – error not due header sent s3. adding access rule cordova fixed it. (in meteor, add app.accessrule('http://meteor.local'); in mobile-config.js .)

serialization - Java - Invalid stream header -

i working on networking java , having issue converting object byte array, splitting array 2 parts, sending each on tcp stream, receiving it, reconstructing byte array, , reforming object. so far working. have except reconstruction of object. error when using objectinputstream: java.io.streamcorruptedexception: invalid stream header: 34323435 which common error see online. have tried fixing it. 1 of causes i've heard of stream not flushed after sending bytes, code flus steam before sending it. code send data is: public void sendtcp(objectoutputstream tcpout) { try { synchronized(tcpout) { tcpout.write(data); tcpout.flush(); } } catch (ioexception e) { e.printstacktrace(); } } and able read bytes on server side. problem comes when combining bytes together. once done use recreate object: bytearrayinputstream in = new bytearrayinputstream(data); objectinputstream = new objectinputstream(in); object object = is...

rest - org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl -

i tried building sample restful app using jersey 2.0/ hk2. initial commit (as seen @ https://github.com/venkatramachandran/restful-sample-tomcat/commit/6e5ee ) should have worked, given class injected annotated @service . did not. i created second commit ( https://github.com/venkatramachandran/restful-sample-tomcat/commit/2ca30f ) org.glassfish.jersey.server.resourceconfig instance registers instance of org.glassfish.hk2.utilities.binding.abstractbinder . binder binds @contract @service same class. my question is, binder absolutely necessary hk2 work? or did miss configuration in initial commit causing org.glassfish.hk2.api.unsatisfieddependencyexception ? yes, need perform sort of binding hk2 work standard @service this. prevent having bind services within jersey might want consider bridging external servicelocator in order supply service though, outlined in this question . and of course best practice @contracts interfaces, although not mandatory.

javascript - Filemaker - Adding a button to infoWindow in GoogleMaps API v3 via web viewer to change layout -

i have looked far , wide answer question stuck. want have map populate webviewer using google maps api v3. i have populated marker , on clicking marker, infowindow displayed. within infowindow, button used (hopefully) accomplish goal. at point, unable button @ all. have tried using responses questions similar 1 have had no luck. need know if can navigate through layouts directly web viewer , again. i.e. map display, populated markers of clients within 10 km radius. infowindow display client info such name address , other relevant info. can (mostly) however, need accomplish button or link within info window when clicked navigate layout within filemaker display clients record. can achieved? , if so, how this? i have included current version of code. <!doctype html> <html> <head> <style type="text/css"> html, body, #map-canvas { height: 100%; margin: 0; padding: 0;} </style> <script type="text/javascri...

javascript - SyntaxError: missing variable name? -

i have ejs code create temp vector. <% var temp=[]; (i = 0; < his.length; i++) { temp[i]= his[i].temp; };%> the variable "his" comming server inside script tag have this. var tempe = <%= temp; %> console.log(tempe); i got syntaxerror: missing variable name what can do? note: mozilla debugger shows tempe tempe= 76,74,24,29,69,59,44` you need output array array... var tempe = <%= temp; %> going browser tempe = 76,74,24,29,69,59,44 you're seeing in debugger. want is: tempe = [76,74,24,29,69,59,44]; which can doing this: var tempe = <%-json.stringify(temp)%>; or less neatly, this: var tempe = [<%= temp; %>];

android - How can stop calling of activity on second time by a service class? -

i create service start activity on button click.in first time activity start when closed activity or leave open activity start service automatically.pleas me ,i want start activity click on button not second time automatically service class use following code- service class public class myservise extends service { @override public ibinder onbind(intent arg0) { return null; } @override public int onstartcommand(intent intent, int flags, int startid) { // let continue running until stopped. toast.maketext(this, "service started", toast.length_long).show(); return start_sticky; } @override public void oncreate() { super.oncreate(); intent dialogintent = new intent(this, demo.class); dialogintent.addflags(intent.flag_activity_new_task); startactivity(dialogintent); } @override public void ondestroy() { super.ondestroy();...

ios - What approach to be used on application side in migrating web services to HTTPS from HTTP? -

i have app running on apple app store webservices http server want migrate webservices http server newly brought https server . best approach achieve without affecting older application users running application on http server ? p.s: after migrating new server, older server not work. edit: older server domain going expire , have amazon server on going move webservices. older , new server link different. thanks

python - Glitch with code? -

i have code. if run works fine if follow instructions. want dummyproof when enter make troops , fix mistake error after fixing mistake when functions restarts itself. please take , me fix it. import time warriors = 100 def deploy(): #calls fighters front lines amount = input('how many warriors send front lines? limit %i warriors. keep in mind enemy invaders have been spotted inside base. must keep 10 warriors in base @ times. ' %(warriors)) try: amount = int(amount) except valueerror: print('please use numbers.') time.sleep(1.5) deploy() if amount <= warriors: print (type(amount)) elif amount > warriors: print("you can't send many warriors. have %i warriors." %(warriors)) time.sleep(1.5) amount=0 deploy() else: print("you did wrong. try again.") time.sleep(1.5) deploy() fighters = deploy() warriors = warriors - fi...

How to solve this error in Xcode when testing your app on the Apple Watch -

Image
i've tested apple watch app on simulator , runs perfectly...however couldn't test app on actual apple watch device: i ran iphone app in xcode.... once completed install app on apple watch. then, apple watch app launch , stuck on launching screen "loading" spinner on apple watch device. the apple watch close , error appear in xcode: you need run iphone app scheme not watchapp or extension scheme, once installed ios application on device watch kit support. after installing iphone, need check watch, application automatically installed on watch. if still not able see application need visit application "apple watch" , scroll down see application , turn on apple watch support application.

jnienv - Return a big object array from JNI? -

according doc jint ensurelocalcapacity(jnienv *env, jint capacity); ensures @ least given number of local references can created in current thread. returns 0 on success; otherwise returns negative number , throws outofmemoryerror. before enters native method, vm automatically ensures @ least 16 local references can created. for backward compatibility, vm allocates local references beyond ensured capacity. (as debugging support, vm may give user warnings many local references being created. in jdk, programmer can supply -verbose:jni command line option turn on these messages.) vm calls fatalerror if no more local references can created beyond ensured capacity. it seems there limitation number of local reference can created. and have following code return big object array, leads lot of local reference creation. mean reach limitation easily? -- doc says 16 default. extern "c" jniexport jobjectarray jnicall java_messagequeueint...

web crawler - crawl coursera webpage using wget with authentication -

i trying crawl webpages in coursera, important review after course, such syllabus, homework, etc. i using wget, found login required. tried 2 post: 1 2 . none of them work. i found coursera webpages not end *.html or *.htm. there way pass through login , download webpages using wget in coursera? this python package, https://github.com/dgorissen/coursera-dl , may more applicable asking except doesn't use wget , uses, , requires, python instead. author notes using python 2.7 , pip package. advantage package can download related course in 1 run. do note need accept honor code coursera class, first time open class page, before script run correctly noted on main project page , in readme.md. project, unlike @ least 1 on github.com, actively maintained recent update within last 6 months. i strongly recommend check 1 of python packages as, in own testing on windows (unless find difference wget on platform), appears wget tool continues have issue coursera secure ce...

java - Attaching Source to VisualVM? -

Image
been using visualvm years, , it's bugged me there 1 error keep getting, i've never found solution - , sure improve debugging workflow tenfold. when double-click on class name inside call tree, error following: it's annoying. i'd love open editor file (to right line number bonus) editing / view code context. does know how configure visualvm can locate source? integration eclipse bonus points. fwiw: adding source path classpath not work, , unfortunately carton of milk has better documentation visualvm.

How do I access my Git tags on Heroku? -

i'm running python app on heroku using gunicorn. want display output of $ git describe versioning. seems none of git tags have been pushed heroku travis ci deployment. how i: (a) push git tags heroku travis or (b) fetch tags remote git repo on heroku for (a), have tried running $ git push --tags --force <...> on travis, travis' before_deploy clause doesn't have access heroku credentials. for (b), have tried running $ git fetch --tags --prune on heroku get: fatal: not git repository (or parent mount point /app)

Firefox mobile: Links getting activated by touching elsewhere -

i've got strange probleme here. if have line in head part <meta name="viewport" content="width=1200,initial-scale=2,minimum-scale=2"> touching lines not links in following example causes 1 of links activated: <ul> <li><a href="http://www.example.com">example</a></li> <li><a href="http://www.test.com">test</a></li> <li>text in between</li> <li>even more text in between</li> <li><a href="http://www.something.com">something</a></li> <li><a href="http://www.other.com">other</a></li> </ul> this seems happen line in head part. okay chrome , android browser. is there way solve this? edit: it gets worse if make line-height small, example way: li { font-family:arial; font-weight:bold; font-size:12px; line-height:12px;} now whether use meta element o...

javascript - Approach to flexibly access encapsulated data objects / how to analyse performance? -

today thought of highly flexible way access data-sets, encapsulated using closures. i'm still writing webgl stuff, resulting example related (coordinates / rotation state). nevertheless it's transferable other contexts. please have @ this: function randomobject(x, y, z){ var rotx = 0; var roty = 0; var rotz = 0; this.data = { "position" : { set: function(position){x = position[0]; y = position[1]; z = position[2];}, get: function(){return {"x": x, "y" : y, "z" : z};}, x: function(value){return value? (x = value) : x;}, y: function(value){return value? (y = value) : y;}, z: function(value){return value? (z = value) : z;}, readonly: true }, "rotation" : { set: function(rotation){x = rotation[0]; y = rotation[1]; z = rotation[2];}, get: function(){return {"x": rotx, "y...

r - create a list from duplicated data in columns in the same dataframe in RStudio -

i have several columns in same data frame lists location names, column headings differ slightly location 1 (adelaide, sydney, perth) location 2 (perth, darwin, adelaide) location 3 (brisbane, adelaide, melbourne) i want 1 location column combines 3 of these columns keeps unique location names. for example, final column list - location (adelaide, sydney, perth, darwin, brisbane, melbourne) if in dataframe thei gives reduced factor result, > unique(unlist(dat)) [1] adelaide sydney perth darwin brisbane melbourne levels: adelaide perth sydney darwin brisbane melbourne which if wanted dataframe simple enough: newdat <- data.frame(location1 = unique(unlist(dat)) ) > newdat location1 1 adelaide 2 sydney 3 perth 4 darwin 5 brisbane 6 melbourne and as.character turn character vector. test object: dat <- data.frame( location1 = c('adelaide', 'sydney', 'perth'), location2= c('perth...

mysql - How to use Xammp or apache with Unity -

i m not sql , database in general. i created login database login menu. use xammp ( apache , mysql) connect server through .php file. the thing is, when run project, cant connect database if apache not running (although mysql seems unrelevant). i wondering how make apache run automaticaly project or enable project connect databse without need connect apache? or missing essential? ps: have xammp folder(with xammp related stuff), login.php file inside not inside project folder

Google map ignoring marker size for retina icons -

i have google map driven advanced custom fields. have created icontype dictate icon used marker depending on custom field. my marker images 80px square want force them 40px square retina reasons. have tried lots of variations of code i've found via google etc nothing works , size gets ignored showing markers @ larger 80px. guess because have 2 icons depending on icontype? can me force size of these markers 40px square please... function add_marker( $marker, map ) { // var var latlng = new google.maps.latlng( $marker.attr('data-lat'), $marker.attr('data-lng')); var icontype = $marker.attr('data-icon'); var iconbase = '<?php echo get_template_directory_uri(); ?>/assets/'; var size = new google.maps.size(40, 40); if (icontype === 'costa') { iconname = 'costa@2x.png'; } else { iconname = 'starbucks@2x.png'; } // create marker var marker = new google.maps.marker({ position : latlng, map ...

C - Measure Function Time Execution -

i want measure elasped time insertion_sort function. but, result 0.0000000 second. can do? tried other time libraries.unfortunatelly, didn't... thanks. writed again. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> int main(void) { int number=1; if(number == 1) { struct timeval start, end; gettimeofday(&start, null); for(int i=0; i<5;i++) { insertion_sort( kelime, n ); } gettimeofday(&end, null); printf("elapsed time %.10f",(end.tv_sec * 1000000 + end.tv_usec)- (start.tv_sec * 1000000 + start.tv_usec)); } time has seconds granularity. whereas code microseconds or milliseconds @ worst. use gettimeofday instead has microsecond granularity. but note both time , gettimeofday gives wall time. if want cpu time clock can used.

c# - will a program deadlock if the error stream is not read from regularly? -

i wanted check error stream program right after starts make sure ran successfully. processstartinfo startinfo = new processstartinfo(); startinfo.redirectstandarderror = true; string errortext = process.standarderror.readtoend(); however, wondering have redirect process's standard error file. i think if nothing reading std error , program writes many errors stream, buffer fill up. don't know how processstartinfo.redirectstandarderror works, assume buffer won't automatically write file when full. in order avoid freezing program i'm reading from, should stderror redirected file instead? , read file string check errors @ startup?

javascript - Chart.js with JSON empty -

i'm having problems using readings json file fill in chart. found function here allows me pass api url , returns json data , works, decided loop through json array adding each reading in array , passing array chart function when load page chart empty, here code ` <!doctype html> <html lang="en"> <head> <script src="chart.js"></script> </head> <body> <canvas id="mychart" width="400" height="400"></canvas> <div id="result"></div> <script> var getjson = function(url) { return new promise(function(resolve, reject) { var xhr = new xmlhttprequest(); xhr.open('get', url, true); xhr.responsetype = 'json'; xhr.onload = function() { ...

html - Flexbox - align : center / justify : center with unknown height -

i trying split page 4 equal squares centered content. issue having centering content due .flex-item divs having viewport height, looking full flexbox solution, thank you. i have tried following resources: justify-content center align-items center .flex-container { display: -webkit-flex; -webkit-flex-flow: row wrap; flex-flow: row wrap; } .color_1 { background: tomato; } .color_2 { background: lightgreen; } .color_3 { background: powderblue; } .color_4 { background: steelblue; } .flex-item { -webkit-flex: 1 0 auto; flex: 1 0 auto; width: 50%; height: 50vh; } <div class="flex-container"> <div class="flex-item color_1"><div class="inner"><p>inner</p></div></div> <div class="flex-item color_2"><div class="inner"><p>inner</p></div></div> <div class="flex-item color_3"...

android - how to have variable row height in recyclerview -

i trying create recyclerview in nav drawer header showing profile information. have header height more other row elements. below header layout <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="200dp" android:background="@color/green" android:orientation="vertical" android:weightsum="1"> <linearlayout android:layout_width="match_parent" android:layout_height="56dp" android:orientation="vertical" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true"> <textview android:id="@+id/name" android:layout_width="wrap_content...

html - Margin: 0 auto; not working image -

Image
so have code, trying center image when screen size , below, isn't working. isn't changing position @ all. #navbar { margin: 0; padding: 0; height: 55px; width: 100%; background-color: #3399ff; } #navbar_logo { margin: 0 0 0 150px; padding: 0; float: left; } #navbar_links { margin: 0 0 0 250px; padding: 0; height: 55px; width: 430px; float: left; } #navbar_links { margin: 0 0 0 20px; padding: 0; float: left; } @media screen , (max-width: 730px){ #navbar { height: 110px; } #navbar_logo { display: block; margin: 0 auto; } #navbar_links { margin: 0 0 0 50px; width: 430; } } floating element push side if has auto margins. you need explicitly set float none .

c# - How can I call a Method of a Content from MasterPage in ASP.NET -

i want call method of content master page sending parameter manipulate 1 label. public partial class mastercategoria : system.web.ui.masterpage { protected void page_load(object sender, eventargs e) { } protected void btnsalada_click(object sender, imageclickeventargs e) { produtoscategoria x = new produtoscategoria(); x.changelabel("salada"); } } manipulating button on webform content public partial class produtoscategoria : system.web.ui.page { protected void page_load(object sender, eventargs e) { } public void changelabel(string name) { lbltexto.text = name; } but isn't working. how can work? thank guys, , sorry english. the object of type produtoscategoria created , can accessed master page via this.page . so change label of content page can in snippet below. also, added simple type check won't error if content page loaded protected void btnsalada_click(objec...

c++ - Compiler generating invalid object file -

i working on merging new trunk code feature branch on 1 of our large legacy projects. project written in c++ using c++builder 5.0. use twinecompile 3 speed our build times. after merge, following error when compiling: [ilink32 error] unresolved external '__fastcall tprinttickܩ ::add(int, int, int, bool, ttickettype, int, bool, bool, bool)' referenced c:\projects\product\v3.12.x\source\obj\processor.obj this error shows when doing release build compiler optimizations turned off (which how typically release our code). if re-enable compiler optimizations, or if debug build, error not appear. additionally, if disable twinecompile, problem disappears. running tdump on 'processor.obj' object file shows has reference external function tprinttickܩ ::add. function should tprintticketqueue::add. file processor.cpp contains following code in 1 of functions: printticketqueue.add(/*parameters here*/); for reference, file printticketqueue.h (which included ...

c++ - Omnet access method of another submodule error - no matching function for call to ‘check_and_cast(cModule*&)’ -

error: no matching function call ‘check_and_cast(cmodule*&)’ i trying use current position module "mobility" n class type massmobility. cmodule* parentmod = getparentmodule(); cmodule* mobilitymod = parentmod->getparentmodule()->getsubmodule("mobility"); ev<<"current module "<<mobilitymod->getfullname() <<endl; massmobility* mobility = check_and_cast<massmobility *>(mobilitymod); mobility->getcurrentposition(); i getting compile time error :- no matching function call ‘check_and_cast(cmodule*&)’ . still able functions mobility object shown in last line. can please suggest me how can correct it. well figure out problem. first thing needed add header file of mobility module in current sub module definitions. included- #include "massmobility.h" #include "stationarymobility.h" then in code did following modification:- cmodule* parentmod = getparentmodule(); cmodule* mob...

javascript - D3 is attempting to set attributes of SVG as NaN and I can't figure out why -

i'm trying make basic d3 charts, have little experience doing. here sample of json working (i have 100 objects, left out brevity): var data = [ { "orderid": 1, "shipcountry": "usa", "freight": 168.0, "version": 2 }, { "orderid": 2, "shipcountry": "usa", "freight": 336.0, "version": 2 }, { "orderid": 3, "shipcountry": "usa", "freight": 504.0, "version": 2 }] and here d3 code: var margin = { top: 10, bottom: 30, left: 30, right: 20 }; var width = 700 - margin.left - margin.right; var height = 400 - margin.top - margin.bottom; //svg chart margins var svg = d3.select('#chart-wrap...

java - Create OS X bundle (.app) in Netbeans with referenced folder -

Image
i'm developing java application using netbeans 8.0.2 , need create .app file mac os x. application needs 2 folder ("logs" , "res" run correctly, former contains txt log files, ladder containing sqlite db , images). netbeans provides functionality "package -> image only" 1) unfortunately doesn't work: double click on .app files open , close application without error messages. in fact, folders "logs" , "res" missing in .app file 2) expected, running jar raise io exception: davemac:java dave$ java -jar anamnesipazienti/dist/bundles/anamnesi\ pazienti.app/contents/java/anamnesipazienti.jar [el warning]: 2015-05-13 22:17:10.086--serversession(1569933050)--local exception stack: exception [eclipselink-7274] (eclipse persistence services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.validationexception exception description: exception thrown while trying create logging file [logs/persist...