Posts

Showing posts from April, 2015

VB6 multidimensional array weird statement -

VB6 multidimensional array weird statement - while reviewing old vb6 working code unusual statement. aryvalue = arypersons(8, i) where aryvalue , arypersons multidimensional array , declared as dim arypersons, aryvalue anyone having thought does? tried same in test application giving type mismatch (error 13) answer: bad understand vb code expecting info type language. @ arypersons(8, i) 2 dimension array getting stored , while fetching gives utilize 2d array info can assigned aryvalue 2d array. unusual me in 2d array @ position store kind of info 2d data. it seems arysteppersonoptions has array value: dim somearray(8, 8) string dim arysteppersonoptions, aryvalue dim long somearray(8, 8) = "hello" arysteppersonoptions = somearray = 8 aryvalue = arysteppersonoptions(8, i) msgbox aryvalue of course of study pseudo-hungarian ary prefix used seems more add together confusion otherwise. sadly far much code contains cargo-culted

how to alternatively resolve and reject jquery object -

how to alternatively resolve and reject jquery object - is possible resolve jquery deferred object , reject it, , resolve again, etc. , trigger $.when each time resolved ? i trying this, doesn't work : var bindhide = $.deferred(); var bindshow = $.deferred(); if ($('#userdata').is(':hidden')) { bindshow.resolve(); } else { bindhide.resolve(); } //show userdata $.when(bindshow).then(function() { bindshow.reject(); $('#miniweightlevel, #miniweightleveltextlayer').unbind('vclick').bind('vclick', function (e) { showuserdata(); $('#miniweightlevel, #miniweightleveltextlayer').unbind('vclick'); bindhide.resolve(); }); }); //hide userdata $.when(bindhide).then(function() { bindhide.reject(); $('#minifycross').unbind('vclick').bind('vclick', function (e) { hideus

javascript - Find element hasClass and modify the previous one -

javascript - Find element hasClass and modify the previous one - i have element, lastly one, has step-active class. now, want write method, looks element, has class, remove class , add together previous one. phone call method if button clicked. i have next piece of html code: <div class="col-lg-6 col-md-6 step-panel" style="padding-right: 0"> <div class="step container-fluid"> <p>4</p> </div> <div class="step"> <p>3</p> </div> <div class="step"> <p>2</p> </div> <div class="step step-active"> <p>1</p> </div> </div> this js: function indicatestep() { $('.step').find().hasclass('step-active'); $(this).removeclass('step-active'); $(this).prev().addclass('step-active'); } i can't w

Multiple htaccess rewrite urls -

Multiple htaccess rewrite urls - i've inquire help .htaccess next need correction in order parse few different urls rewrite rules, here script rewriteengine on rewriterule ^([^/.]+)/?$ /template_store/index.php?manufacturers_id=$1&/template_store/index.php?cpath=$1 [l] i've tried concatenating 2 urls within same rewrite rule still need correction here, please help, greetings url rewrite

javascript - How to continue playing sound when holding key? -

javascript - How to continue playing sound when holding key? - i have sound in javascript plays when press arrow key. have sound play when hold arrow key, pause when release key. this code now: var clicksound = new audio("img/hartslag.mp3"); document.body.onkeyup = function (e){ if(e.keycode == 38){ clicksound.play(); } } you need hear 2 different events. play on key downwards , pause on key up. var clicksound = new audio("img/hartslag.mp3"); var playing = false; document.body.onkeydown = function (e){ if(e.keycode == 38 && !playing){ clicksound.play(); playing=true; } } document.body.onkeyup = function (e){ if(e.keycode == 38){ clicksound.pause(); playing=false; } } code not tested! javascript onkeyup

CQRS client command management -

CQRS client command management - i'm building new project using cqrs, it's 3 tier application , it's expected clients state synchronized. server receive commands , callback events clients. currently, model has several sub model can added/removed/updated, each of has it's own command. events field specific i.e. updateitemcommand createsubitemcommand removesubitemcommand updatesubitemcommand ... itemfieldaupdatedevent subitemfieldaupdatedevent subitemfieldbupdatedevent ... so here's interrogation, client current state of model, user edit local model, click save button , bug. should i compare original state of model (updated received events) , edited state of model generate set of commands (on every received events it's required identify fields has been updated , notify user if edited field has changed), create commands user editing model doing , undoing edit (that hard manage), ... basically don't know strategy should apply generate commands

postgresql - Complex query for returning an email conversation list -

postgresql - Complex query for returning an email conversation list - i have complex query not working in sql fiddle. in app work for, sync users gmail our database. store emails in emails table , have replies table store references header lists parent replies email. so example, if have email this: id | subject | message_id --------------------------------------------------------------------------------------------- 1 | howzitgoin | 53856b1448c89_23fa9605badd015951@3a139e8c-0b81-42c2-8e59-133c262e96a9.mail there no records in replies table: now if import reply email this: id | subject | message_id --------------------------------------------------------------------------------------------- 2 | re: howzitgoin | caebv8ytu_a6ltp_uguq-qsvj3zojwuiwcjgzpsppez1pj3_i1a@mail.gmail.com we store next in replies table: email_id | message_id ------------------------------------------------------------------------------------------ 2

flex - Adobe Flash Builder and Serial Port/RS232 communication? -

flex - Adobe Flash Builder and Serial Port/RS232 communication? - could possible send info com4(emulator galaxytab in windows system) via rs232 , please help me on illustration code give thanks you. there's air native extension (ane) provides access serial port/rs232: https://code.google.com/p/as3-arduino-connector/ i utilize it, works! you can utilize ane air project distributed in native installers (.exe, .dmg etc). flash flex flash-builder

How to store or read a literal carriage return and newline from yaml in python -

How to store or read a literal carriage return and newline from yaml in python - i have been struggling problem day. couldn't seem find reply online either. have yaml document stores server config message/response server , 1 of parameters "message_terminator". can guess, server knows message terminator of messages sent clients. \r\n is default sent telnet, have set such. yaml document: global: server_port: 7040 bound_ip: 0.0.0.0 message_terminator: \r\n what want either read message_terminator value actual carriage homecoming , newline or convert string representation binary escape codes: homecoming , newline, not string representation "\r\n" for instance, if in python: print('\r\n') it prints carriage homecoming , newline, not characters. if read value yaml config in python with: print(config['global']['message_terminator']) it prints out characters: \r\n changing yaml documents , a

ruby - Codility Permuation Assigment -

ruby - Codility Permuation Assigment - i' m doing permutation task on codility.com. goal check if the array passed 1 element matching permutation in size. i.e. array size n should include values 1,2,3...n each once. managed logic right how ever score on complexity horrible 0(n**2) . how can improve this? def solution(a) homecoming 0 unless a.uniq == set = (1..a.size).to_a n in set homecoming 0 unless a.include? n end 1 end i'd inclined follows. have not dealt possibilities of a beingness empty or containing elements other fixnums. def solution(a) (a.uniq == && a.min == 1 && a.max == a.size) ? 1 : 0 end solution([1,2,3,4,5]) #=> 1 solution([1,2,5,3,4]) #=> 1 solution([1,2,3,5,6]) #=> 0 solution([1,2,5,4,2]) #=> 0 solution([1,2,2,4,5]) #=> 0 solution([1,2,5,4,6]) #=> 0 ruby algorithm big-o

Android action button pushed into overflow -

Android action button pushed into overflow - i'm next android developers guide. have menu i'm inflating in action bar: res/menu/main_activity_actions.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <!--search, should appear action button --> <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showasaction="always" /> <!-- settings, should in overflow --> <item android:id="@+id/action_settings" android:title="@string/action_settings" android:showasaction="never"/> </menu> i have corresponding icon in res/drawable, , inflating so: @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items act

java - read a File and split the numbers and string / character separately -

java - read a File and split the numbers and string / character separately - i want read file , split numbers , string / character separately in line , 1 please help out , how can in java program. eg ; 34 indian, 45 answer : numbers : 34, 45 string : indian please help me out this try next code..may help you public static void main(string... args) { seek { file file = new file("mytext.text"); filewriter fw = new filewriter(file); bufferedwriter bw = new bufferedwriter(fw); bw.write("i 34 indian, 45"); bw.close(); filereader fr = new filereader(file); bufferedreader br = new bufferedreader(fr); string s = br.readline(); string[] info = s.split("\\d"); string[] numdata = s.split("[^0-9]"); stringbuffer numericdata = new stringbuffer(); stringbuffer chardata = new stringbuffer(

asp.net mvc 5.1 - mvc5 N tier architecture -

asp.net mvc 5.1 - mvc5 N tier architecture - i developing mvc app next n tier structure: dataaccess repository models businesslogic in businesslogic folder have interface iclinicbusiness , class clinicbusiness interfaces iclinicbusiness. the clinicbusiness class follows: public void addclinic(clinic c) { var cr = new clinicrepository(); var clinc = new clinic(); if (c != null) { clinc.clinicname = c.clinicname; clinc.cliniclocation = c.cliniclocation; } cr.insertclinic(c); cr.save(); } } the clinicbusiness class implements method repository class library eg. insertclinic(); public clinicrepository() { } public clinicrepository(datacontext clinics) { this.clinic = clinics; } public ienumerable<clinic> getclinics() { homecoming clinic.clinics.tolist(); } public clinic getcli

android - Occasionally 'No implementation found for native .... ' error happens -

android - Occasionally 'No implementation found for native .... ' error happens - presumably, not case has disscussed here before. we using can functionalities implemented using jni. i found error yesterday. rarely, 'no implementation found native' error happens when seek load can library , run function in it. once reboot system, error gone , works again. the jni code written in c, not c++. any help appreciated!!!! error log : d/dalvikvm( 1514): no jni_onload found in /system/lib/libflexcan.so 0x41945b10, skipping init w/dalvikvm( 1514): no implementation found native lcommunication/flexcan/core/connection;.na_openport:(i)i e/exception( 1514): java.lang.unsatisfiedlinkerror: native method not found: communication.flexcan.core.connection.na_openport:(i)i e/exception( 1514): @ communication.flexcan.core.connection.na_openport(native method) e/exception( 1514): @ communication.flexcan.core.connection.access$0(connection.java:117) e/exception( 1514):

javascript - AngularJS - dynamically add a template and invoke corresponding controller -

javascript - AngularJS - dynamically add a template and invoke corresponding controller - i want append template when user presses button. want invoke corresponding controller. unfortunately dont have thought how to that. can help? you can append template , create new scope for. afterwards need compile in order invoke controller. so after have appended template: var new_scope = $scope.$new(); $compile( $tmpl ) ( new_scope ); that invokes controller javascript angularjs single-page-application

Matlab Parallel toolbox: Error with parfor -

Matlab Parallel toolbox: Error with parfor - i wrote code following .... index = 1; parfor mi=initmu:maxmu la1i=initla+1:(maxla-initla)/stepla+1 imaged=uint8(gausspoisondenoise(image, mu(mi), la1(la1i), la2(la1i))); p = psnr(imaged, image0); index=index+1; end end .... but matlab tells me "parfor loop cannot run due way variable index used". mean? need do? the parfor loop separates loop run different loop-iteration @ same time in arbitrary order. the problem variable "index" increment @ same time in different iteration , different values. for illustration while 1 matlab-worker computing iteration mu=2 , increasing index 3, computing iteration mu=10 , increasing index one. in case effective value of index? (index+3 or index+1?) you cannot utilize parfor when iteration in loop depends on result of other iteration. if need "index" count number of iteration, think can calculate operating on intmu, m

c - GSList of structs -

c - GSList of structs - i read this thread, helped me figure out dereferencing properly, went , created situation post's answer's author said avoid, haha. what i'm trying accomplish creation of basic file browser (per book i'm reading). code below supposed reading through directory contents , filling details i've chosen struct . struct appended data fellow member of gslist . list used populate row info gtktreeview , , forth. typedef struct { gchar *name, *size, *date_modified; }fileproperties; //... static void refresh_directory_listing(gtktreeview *treeview) { gtkliststore *store = gtk_list_store_new(num_columns, g_type_string, g_type_string, g_type_string); gslist *files = null; gtktreeiter iter; get_current_directory_contents(&files); for(gslist *current = files; current != null; current = g_slist_next(current)) { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, file_n

java - Why does the Microsoft JDBC driver ignore the failoverPartner host name -

java - Why does the Microsoft JDBC driver ignore the failoverPartner host name - the microsoft jdbc driver v4 seems ignore configured failoverpartner host name. connection string looks follows: jdbc:sqlserver://primary-host:1433;database=ms-sql-db;failoverpartner=secondary-host yet, when primary host offline driver unable connect secondary host: com.microsoft.sqlserver.jdbc.sqlserverexception: tcp/ip connection host foo4711, port 1433 has failed notice how host name in exception not match host name in connection string ('secondary-host' vs. 'foo4711'). 'foo4711' name of physical machine while 'secondary-host' name machine listed under in /etc/hosts . 'foo4711' cannot resolved ip in our setup. so, why driver not utilize host name given in connection string? java sql-server jdbc

terminal - How to clear screen in C without any system function or library? -

terminal - How to clear screen in C without any system function or library? - clear screen in c programming language without utilize of scheme function or library? #include<stdio.h> void main() { char name[11]="abhinay"; // ansi character print "name value" in colorful form. printf("%c[36m%s\n\n", (char) 27,name); printf("\n hellow world\n"); printf("[36m %s \n\n", name); } there no standard or portable way, depends on terminal emulator. you can ansi escape sequences, seems you're using. this wikipedia page indicates ed (erase display) right command, code 2, i.e. printf("%c2j", 27); . c terminal

objective c - iOS Keyboard Accessory View: barbuttonitem touch events not working normally -

objective c - iOS Keyboard Accessory View: barbuttonitem touch events not working normally - i have input accessory view attached keyboard. accessory view uitoolbar, includes 4 interactive uibarbuttonitems, noninteractive uibarbuttonitem consists of uilabel, , fixed , flexible spaces. specifically, array of items is: @[prevbutton, nextbutton, flexspace, labelitem, flexspace, camerabutton, fixedspace, morebutton] everything works you'd expect... except nextbutton. prevbutton , nextbutton items both initialized follows: uibarbuttonitem *nextbutton = [[uibarbuttonitem alloc] initwithimage: [uiimage imagenamed:@"rightarrow.png"] style:uibarbuttonitemstyleplain target:self action:@selector(activatenextfield)]; (only difference prevbutton uses different .png , calls different selector) but when accessory view comes up, nextbutton item acts strangely. receives taps on left , right edges, if tap dead-center, doesn't fire sele

php - Cant Output MySQL Table via Web Form -

php - Cant Output MySQL Table via Web Form - i totally new php , trying write simple web form keeps track of inventory , borrowed it. have lamp setup on ubuntu 13.10 w/php 5.5. had no problem writing script takes client info , writes mysql db stuck on getting script outputs it. looking @ examples , reading have far: <?php ini_set("display_errors","on"); $dsn='mysql:host=localhost;dbname=inventory_form'; $username="****"; $password="*****"; $database="inventory_form"; seek { $link=new pdo($dsn, $username,$password); echo 'connection established'; } grab (pdoexception $e) { $error_message=$e->getmessage(); echo "<h1>an error occurred: $error_message</h1>"; } $query="select * inventory"; $result=$link->query($query); /*/ $num=mysql_num_rows($result); echo "<b><center>database output</center></b>"; ?>

Spring Security bcrypt constructor -

Spring Security bcrypt constructor - i have question implementation of bcrypt in spring security.the class "org.springframework.security.crypto.bcrypt.bcryptpasswordencoder" in first constructor of bcrypt see "this(-1);" mean. far understand should refer field "strength" , default value should 10 set in org.springframework.security.crypto.bcrypt.bcrypt "private static final int gensalt_default_log2_rounds = 10;", -1 referring to, first constructor? public class bcryptpasswordencoder implements passwordencoder { private pattern bcrypt_pattern = pattern.compile("\\a\\$2a?\\$\\d\\d\\$[./0-9a-za-z]{53}"); private final log logger = logfactory.getlog(getclass()); private final int strength; private final securerandom random; public bcryptpasswordencoder() { this(-1); } since got far, why not @ where it's used in remainder of file? unless value greater zero, calls default jbcrypt gensal

How do I tell py.test to not prepend to sys.path? -

How do I tell py.test to not prepend to sys.path? - when running py.test, seems automatically prepend project's root directory (one above lastly __init__.py ) sys.path this causing issues me, looked through docs not find alternative this. does know way? thanks py.test

angularjs - Deferred object returns wrong result when loading data by $http -

angularjs - Deferred object returns wrong result when loading data by $http - i have mill loading json info files using $http , $q in angularjs. app.factory('dataloader', ['$http', '$q', function($http, $q){ var deferred = $q.defer(), info = {}; homecoming function (url){ info = $http.get(url) .success(function(response){ deferred.resolve(response); }) .error(function(){ deferred.reject('could not load template'); }); homecoming deferred.promise; } }]); problem: everywhere utilize mill load data, returns first usage result. example: loading file 1: dataloader('json-folder/file-one.json').then(function(data){ console.log('result1: ', data); }); loading file 2: dataloader('json-folder/file-two.json').then(function(data){

logging - Does reading / writing to the CloudCode log count against my account's API requests? -

logging - Does reading / writing to the CloudCode log count against my account's API requests? - when cloudcode function outputs log (via console.log , or built-in logging parse does,) count against api request quota? similarly, when i'm reading log command line tool or using logging api directly, count against api quota? no, console logs , looking @ logs not utilize api requests. source: work @ parse. logging parse.com

c# - Parent object goes out of scope when I have captured child property - when does it dispose the child property? -

c# - Parent object goes out of scope when I have captured child property - when does it dispose the child property? - i wasn't quite sure how word question, elaborate, i'm using aws sdk in asp.net web api 2 project , want homecoming response stream s3 object - stream delivered client , disposed. what i'm unsure references s3 abstracted away ifilestore object in order decouple myself aws dependency. within file store, retrieve s3response object contains responsestream property. if s3response object disposed, dispose underlying responsestream . ifilestore returns stream though, bundle , homecoming api streamcontent . given phone call filestore.getfile(...) , returns value of responsestream property , responsestream goes out of scope, have suspicion dispose potentially called on responsestream object parent during normal gc behaviour before http response completed. how can maintain s3 abstracted away , ensure response stream disposed of 1 time http

java - Pointcuts not intercepting appropriate points -

java - Pointcuts not intercepting appropriate points - eventserviceaspect.java public eventserviceaspect{ @pointcut(value="call(* com.xyz.serviceinput.callsetup(..))") public void anycallsetup(){} @after("anycallsetup() && @annotation(publisheventtoservice)") public void publishevent(joinpoint jp, publisheventtoservice publisheventtoservice){ log.warn("batman here!"); } } sampleclass.java public sampleclass{ @publisheventtoservice public void somefunc(){ serviceinput.callsetup("testing testing") } } the callsetup not beingness intercepted pointcut. thought what's wrong code? it's big configuration file...the relevant part is: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http:/

Using HiTech C Libraries with MPLAB MCC18 -

Using HiTech C Libraries with MPLAB MCC18 - has tried using hi-tech pic18 c libraries mplab mcc18 compiler , linker? we're little grouping has been handed legacy project written in mcc18. interested in employing more standard , extended printf/sprintf functions of hi-tech compiler. regulatory issues prevent switching hi-tech compiler. specifically trying replace weak mcc18 approach of treating rom , ram string info differently (putsusart , putrsusart) , standard printf doesn't care whether info rom or ram based. in addition, want printf/sprintf handle floating point without resorting writing our own ftoa() function. i've used hi-tech compiler in past, , stdio functions pleasure utilize unlike mcc18's functions. have both compilers, thinking of creating .lib using hitech compiler , linking mcc18 code base. any comments have tried or utilize appreciated. c mplab hi-tech-c

c# - Microsoft Surface (Windows 8) App to sync data with a DB behind a VPN server? -

c# - Microsoft Surface (Windows 8) App to sync data with a DB behind a VPN server? - i still learning microsoft surface (windows 8 or windows rt) programming, having issue need ideas how done. app supposed sync info db behind vpn tunnel. don't know how syncing implemented in case. how communication implemented? options implement thing? (xml request, vpn client, email client,..etc) ideas or references helpful. c# windows-mobile vpn

mocking - Autofixture Freeze array of interfaces for Command Pattern -

mocking - Autofixture Freeze array of interfaces for Command Pattern - i'm using autofixture autorhinomockcustomization. have constructor takes instances of icommand it's this public class myclass { public myclass(icommand[] mycommands) { } } this implement command pattern, i'll loop through instances , utilize ones meet criteria. can't figure out how freeze injected items. right looks like, move on, i'll have sort of work around autofixture , utilize create test info objects. if know how though, helpful. mocking autofixture command-pattern

python - pandas timeseries resampling ending a given day -

python - pandas timeseries resampling ending a given day - i guess many people working on timeseries have come through issue, , pandas doesn't seem provide straightforward solution (yet !) suppose have timeseries of daily info close prices. indexed date (day). today 19jun. lastly close 18jun. want resample , have ohlc, give frequency (let's m or 2m) buckets ending 18jun. m freq, lastly bucket 19may-18jun, previous 1 19apr-18may, , on... ts.resample('m', how='ohlc') will resampling, 'm' 'end_of_month' period result give total month 2014-05 , 2 weeks period 2014-06, lastly bar won't 'monthly bar'. that's not want on 2m frequency, given sample timeseries, test gives me lastly bucket labelled 2014-07-31 (and previous lastly labelled 2014-05-31), it's quite misleading since there's not info on jul... supposed lastly 2months bucket 1 time again 2 weeks one. the right datetimeindex easely created :

jquery - Adding timezone in datetime -

jquery - Adding timezone in datetime - following freemarker code, using parse dates , display in friendly dates, 1h ago, yesterday, lastly month etc. working fine, when compared output actual results, parsing results wrongly, i.e. time "2014-06-19t22:07:33+00:00" should show 11h ago, showing 2h ago, think issue 3rd line below in code, need pass timezone well, can please help me in how that, tried +zz:zz in end, didn't work. <#include "relativetime.ftl" /> <#assign time = "2014-06-19t22:07:33+00:00"> <#assign posttimeobject = time?datetime("yyyy-mm-dd't'hh:mm:ss") /> //i think need pass timezone, how? <#assign posttimestring = relativetime(posttimeobject) /> ${posttimestring} prints: 2h ago freemarker uses java's standard date formatter (http://docs.oracle.com/javase/7/docs/api/java/text/simpledateformat.html), pattern want "yyyy-mm-dd't'hh:mm:ssx" . (btw, approach o

ios - OpenCV : thresold value has no effect while converting image to black and white? -

ios - OpenCV : thresold value has no effect while converting image to black and white? - i'm trying convert image black , white, not absolutely black white, , utilize mask. + (uiimage *) getblackandwhiteimage:(uiimage *)image; { iplimage* im_rgb = [self createiplimagefromuiimage:image]; iplimage *im_gray = cvcreateimage(cvgetsize(im_rgb),ipl_depth_8u,1); cvcvtcolor(im_rgb,im_gray,cv_rgb2gray); iplimage* im_bw = cvcreateimage(cvgetsize(im_gray),ipl_depth_8u,1); cvthreshold(im_gray, im_bw, 127, 255, cv_thresh_binary | cv_thresh_otsu); // have alter 127 10 :255 has no effect homecoming [self uiimagefromiplimage:im_bw]; } how can proper black , whilte image ? don't pass cv_thresh_otsu cvthreshold() . if pass flag, provided threshold ignored , otsu's method used instead, automatically selects threshold. your invocation should this: cvthreshold(im_gray, im_bw, 127, 255, cv_thresh_binary); ios objective-c

node.js - Express error handling or domain? -

node.js - Express error handling or domain? - i building app in nodejs , express. can help me understand difference between next pieces of code: var app = express(); app.use(function(err, req, res, next){ console.error(err); res.render('home.ejs', {message:'something broke!'}); }); and var domain = require('domain'); var d = domain.create(); d.on('error', function(err) { console.error(err); res.render('home.ejs', {message:'something broke!'}); }); are 2 pieces of code alternative? if yes, 1 more reliable in order avoid app crashing on production? express wraps each function (req, res, next) {} in try/catch. catches many errors, not async errors. domains grab async errors. catching error , handling 2 different things. if next error (aka d.on('error', next); ) end in going express error middleware, in first example. so instead of thinking express vs domains, think try/catch vs domai

html - Google Chrome: Zero width table cells use up space -

html - Google Chrome: Zero width table cells use up space - i have table 3 <td /> . 2 of them have width attributes , styles of 0px . middle <td /> has no explicit width set. jsfiddle here <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tbody> <tr> <td width="0" height="10" bgcolor="" style="background-color:#00ffff;height:10px;width:0px;"></td> <td height="10" bgcolor="" style="background-color:#000;height:10px;"></td> <td width="0" height="10" bgcolor="" style="background-color:#ff00ff;height:10px;width:0px;"></td> </tr> </tbody> </table> i expect middle <td /> take entire space (and happens in firefox , ie) however, in google chrome, 3 <td /> ta

java - Best sorting and formatting algorithm for flat data to directed graph tree -

java - Best sorting and formatting algorithm for flat data to directed graph tree - given flat info this: 01001, butter, salted 01002, butter, whipped, salt 01145, butter, without salt 04601, butter, light, stick, salt 04602, butter, light, stick, without salt what's best approach convert this: butter (01001, 01002, 01145, 04601, 04602) -> salted (01001) -> whipped (01002) -> salt (01002) -> without salt (01145) -> lite (04601, 04602) -> stick (04601, 04602) -> salt (04601) -> without salt (04602) i thinking of recursive sorting first, realized there may lot of string comparisons efficient. java algorithm parsing graph tree-traversal

java - How to force the compiler to show warning messages? -

java - How to force the compiler to show warning messages? - writing next code... classpathxmlapplicationcontext applicationcontext = new classpathxmlapplicationcontext("mycontext.xml"); ...will forcefulness eclipse show warning resource leak: 'applicationcontext' never closed this because should phone call applicationcontext.close() how can myself ? how can instruct user should phone call specific method before or after using objects instantiated classes wrote ? unfortunately cannot in general. saw try-with-resources functionality of java 7. public class myclose implements autocloseable { @override public void close() { } } fine: try (myclass x = new myclass()) { ... } // automatic close fine too: myclass x = null;+ seek { x = new myclass(); ... } { x.close(); } warning: myclass x = new myclass(); ... it autocloseable leads ide attend missing close()/try . 1 of reasons clicking on w

SMS Facebook like count when reaching a threshold -

SMS Facebook like count when reaching a threshold - i looking way automatically send sms updates when facebook page reaching count. want know when https://www.facebook.com/foodler?ref=stream&fref=nf nearing 100,000 likes automatically via sms. possible? ok, have break downwards tasks. these 2 separate concerns. 1 track facebook page likes you can info using facebook's graph api json record. simple phone call (without requiring api key job) http://graph.facebook.com/foodler/ right now, "likes" key has value 97542 you can perchance run cron-job or scheduled task (depending on server type/configuration) run script (php/asp/.net, etc.) farther runs api phone call every "x" minutes (or hours or days, whatever wish) , parses "likes" returned. 1 time >= 100,000, can send sms using script. your script can calling sms gateway's api. 2 sending sms you need sms gateway (preferably simple api?) doing that. simple google

Treat directory as request for a PHP file -

Treat directory as request for a PHP file - this question related php how create request directory on server (that doesn't exist) become treated variable.. example: domain.com/username request domain.com/profile.php?user=username is possible? or how youtube/twitter/facebook it? jeff, called "friendly url" , done url rewrite. recommend reading documentation: http://httpd.apache.org/docs/current/mod/mod_rewrite.html. if not familiar regular expressions shoud read http://www.php.net/manual/en/reference.pcre.pattern.syntax.php if using apache web server create .htaccess file on directory next content accomplish this rewriteengine on rewriterule ^[a-za-z0-9_.-]+$ profile.php?user=$1 [l] php directory

if statement - issue with indexOf in simple card game javascript -

if statement - issue with indexOf in simple card game javascript - i'm trying create simple javascript card game having little issue can't seem figure out. next code supposed build deck of cards... issue commented in code below, have bit of script supposed randomly assign suits , values cards , force them deck array. indexof method in if statement supposed check if random card has been pushed playing deck prevent duplicate cards still seem getting duplicates. can point me in right direction on this: //selecting cards types deck. var cards = []; var numberedcards = [2, 3, 4, 5, 6, 7, 8, 9, 10]; var facecards = ["jack", "queen", "king", "ace"]; var suit = ["of hearts", "of diamonds", "of clubs", "of spades"]; while (!(cardoptions == "a" || cardoptions == "b" || cardoptions == "c")) { var cardoptions = prompt("what cards need? \ntype 'a', 

c++ - Provide vertex-mapping parameter to boost::graph::copy_graph -

c++ - Provide vertex-mapping parameter to boost::graph::copy_graph - the boost function boost::graph::copy_graph template <class vertexlistgraph, class mutablegraph> void copy_graph(const vertexlistgraph& g, mutablegraph& g_copy, const bgl_named_params<p, t, r>& params = defaults) lists in parameter description util/out: orig_to_copy(orig2copymap c) mapping vertices in re-create vertices in original. need mapping! (scroll bottom on http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/copy_graph.html) how can access/provide lastly parameter orig_to_copy? can give code example, ie finish code me? void dosomething(graph_t& g){ graph_t g_copy; copy_graph(g, g_copy, [...???...]); // here access orig2copymap } something this: typedef boost::graph_traits<graph_t>::vertex_descriptor vertex_t; typedef boost::property_map<graph_t, boost::vertex_index_t>::type index_map_t; //for simple adjacency_list<> ty

python - Pandas Groupby Name of Day -

python - Pandas Groupby Name of Day - i have dataset includes date time field called 'pub_date.' in [69]: dataset[['pub_date']].dtypes out[69]: pub_date datetime64[ns] dtype: object i'm trying grouping dataset name of day (e.g. mon, tue, ... , sat, sun) no avail. approach far has been create fields different ways might grouping data. i've been able year, month, day, etc., doing following: dataset['year'] = [t.year t in dataset.pub_date] dataset['month'] = [t.month t in dataset.pub_date] dataset['day'] = [t.day t in dataset.pub_date] the lastly thing need field 'day_name' can grouping , plot it, can't figure out way this. appreciate pointers might able provide. give thanks you! you can following: df['day_name'] = df['pub_date'].apply( lambda x: pd.to_datetime(x).strftime("%a")) this give field can grouping , plot. python pandas

c++ - Fundamental Data Types Program -

c++ - Fundamental Data Types Program - i wrote next code: #include <iostream> #include <iomanip> using namespace std; int main(){ char c; int i; short int j; long int k; float f; double d; long double e; cout << "the size of char is: " << sizeof c << endl; cout << "the size of int is: " << sizeof << endl; cout << "the size of short int is: " << sizeof j << endl; cout << "the size of long int is: " << sizeof k << endl; cout << "the size of float is: " << sizeof f << endl; cout << "the size of double is: " << sizeof d << endl; cout << "the size of long double is: " << sizeof e << endl; system("pause"); homecoming 0; } the purpose of programme print out size of fundamental info types, think

magento - Add coupon code to an existing order in admin panel -

magento - Add coupon code to an existing order in admin panel - i working on adding discount existing order not invoiced yet in magento admin panel. thought improve utilize coupon codes. trying adding coupon code existing order create discount on order. till have added coupon code input box order command panel. need connect field coupon controller , add together new function add together coupon code existing order. right thing create discount on existing order or there improve way that? there can guide me accomplish that? cheers magento

vba - How do I get an excel textbox to run a macro on a completed change -

vba - How do I get an excel textbox to run a macro on a completed change - i found link here, doesn't seem want to. i trying run macro when textbox updated, after user has completed and/or moved box. have tried few different methods, not clear when leaving focus on text box. i tried _exit, if click on textbox, ignores it. _change out, since typing first character runs it. won't work project; have 4 fields run macro when 4 have been 'selected'. if ran on change, wants run macro , display status every keystroke. here code trying run. need know action on textbox activate leave field. private sub signalname_textbox_exit(byval cancel msforms.returnboolean) dim mysigname string mysigname = me.signalname_textbox.value if mysigname <> "" selectedsigname = true else selectedsigname = false end if if selectedsigname , selectedcomp , selectedpinid , selectedfmi chum = checkforduplicates end if

javascript - Failed to execute 'createObjectStore' on 'IDBDatabase' -

javascript - Failed to execute 'createObjectStore' on 'IDBDatabase' - why have error ? my code: var idb = window.indexeddb || // utilize standard db api window.mozindexeddb || // or firefox's version of window.webkitindexeddb; // or chrome's version var idbtransaction = window.idbtransaction || window.webkitidbtransaction; var idbkeyrange = window.idbkeyrange || window.webkitidbkeyrange; var dbname='namedb'; var idbrequest=idb.open(dbname,'4.67' /*,dbdescription */); idbrequest.onsuccess=function (e) { debugger var db=e.target.result; if (!db.objectstorenames.contains('chat')){ co=db.createobjectstore('chat',{'id':100}); }; if (!db.objectstorenames.contains('iam')){ co1=db.createobjectstore('iam'); }; }; idbrequest.onerror = function (e) { debugger }; uncaught invalidstateerror: failed execute 'createobje

php - Illegal string offset error but value is there when array is dumped -

php - Illegal string offset error but value is there when array is dumped - can help me please? have method trying utilize values array. have... function createfdf ( $data ) { $data = $this->getfdfheader() . $this->getfdfcontent( $data ) . $this->getfdffooter( $data ); $filename = $data['filename'] . '.fdf'; if ( $fp = fopen( $filename, 'w' ) ) { fwrite( $fp, $data, strlen( $data ) ); homecoming fclose( $fp ); } } running illegal string offset, if die , dump $data['filename'] outputs looking for. what doing wrong? thanks i've seen i'm doing, i'm overwriting $data variable. i should sleep. php arrays

Titanium Adding custom template to a listview -

Titanium Adding custom template to a listview - i'm building application titanium studio , alloy. in 1 of windows, i'm trying dynamically add together listitem in listview pressing button (allowing user retrieve image or file). i need add together listitem particular structures : image supposed show datatype, label file name, , image delete listitem. here template : lignefichier.xml <alloy> <itemtemplate name="lignefichier" id="lignefichier"> <view class="item-container"> <imageview bindid="typedonnee" /> <label bindid="nomfichier" /> <imageview bindid="supprimer" /> </view> </itemtemplate> </alloy> and then, in controller of page : mycontroller.js var info = []; var tmp = { typedonnee : { image : '/images/image.png' }, n

android - sony ericsson xperia x10 not showing in eclipse -

android - sony ericsson xperia x10 not showing in eclipse - i want test android app on xperia x10 device not showing in device list. have downloaded right drivers when seek install them trough device manager says "windows unable install semc hsusb device". i have usb debugging activated. what should seek next? first of seek uninstall sony device drivers because drivers downloaded info transfer(backup , transfer files) not debugging. second if want test app on sony device need download usb debug drivers of sony x10 click link. after downloading debug drivers above link check debug mode checked , connect device . after connecting device need slight changes in android virtual device manager(avd). by default application execute on user defined emulator need set avd prompt every time execute application. in way select device on dialog box appears , application executed on device instead of emulator android eclipse driver sony-xperia

arrays - Simple CUDA kernel with Bizarre Result? -

arrays - Simple CUDA kernel with Bizarre Result? - i using cuda kernel object in matlab in order fill 2d array '55's. result strange. 2d array fills point shown below. after row 1025, array zeros. thought going wrong? as mentioned in comment above, mistakenly offsetting matrix rows. code below total working illustration proving point. #include<thrust\device_vector.h> __global__ void mykern(double* masterforces, int r_max, int iterations) { int threadsperblock = blockdim.x * blockdim.y; int blockid = blockidx.x + (blockidx.y * griddim.x); int threadid = threadidx.x + (threadidx.y * blockdim.x); int globalidx = (blockid * threadsperblock) + threadid; //for (int i=0; i<iterations; i++) masterforces[globalidx * r_max + i] = 55; (int i=0; i<iterations; i++) masterforces[globalidx * iterations + i] = 55; } void main() { int threadblocksize = 32; int gridsize = 32; int reps

How can I display this multidimensional array -

How can I display this multidimensional array - i have created multidimentional array called 'orders'. have no thought how can display visitor in readable way. how can display in table or something? how display it: <table> <tr> <td>cake</td> <td>ingredient1</td> <td>ingredient2</td> <td>ingredient3</td> <td>ingredient</td> </tr> <tr> <td>chocolate cookie</td> <td>5</td> </tr> <!-- , go on... --> </table> this array: array(5) { [0]=> array(2) { [0]=> string(4) "cake" [1]=> array(5) { [0]=> string(11) "ingredient1" [1]=> string(11) "ingredient2" [2]=> string(11) "ingredient3" [3]=> string(11) "ingredient4" [4]=> string(11) "ingredient5" } }

php - Dependency injection with custom Doctrine 2 hydrator -

php - Dependency injection with custom Doctrine 2 hydrator - i'm setting custom hydrator in doctrine 2 in symfony 2 project, needs requires service. documentation custom hydrators shows how provide hydrator class, there's no way inject dependencies. for example: $em->getconfiguration()->addcustomhydrationmode('customhydrator', 'myproject\hydrators\customhydrator'); i suspect doctrine initialising hydrators , such dependencies need passed through other doctrine classes first. is there way provide custom "hydration factory" or similar doctrine allow injection of additional dependencies? custom hydrators seem limited without capability. answer: denis v i got working follows. can't post actual code i've set dummy placeholders can see how fits together. src/acme/examplebundle/resources/config/services.yml services: doctrine.orm.entity_manager.abstract: class: acme\examplebundle\entity\doctrineent

html - Stop Javascript Function From Refreshing Page -

html - Stop Javascript Function From Refreshing Page - when run js function (on button click) reloads page , displays info function outputs. however, when run js code when page loads (no function or button) script runs fine. i have tried multiple things prepare issue such using button type="button" instead of input. tried have js function homecoming false. problem is, not have access js , can implement it, not alter it. js code without function: var placeholder = new sched({ pid: "something" }); placeholder.write(); when had button (with type="button"), removing placeholder.write() line stop page reloading, prevent js doing job. take html produced placeholder.write() , add together div. know how static data, cannot prevent page reloading , displaying nil placeholder.write() prints. if need more concise, allow me know. had problem trying figure out how phrase question... edit: wanted add together info overall project. i'

jquery - Prevent form submit if field value is false -

jquery - Prevent form submit if field value is false - i trying create code utilize jquery prevents users submitting form if value in text field different 50. form submit work great, having issues jquery code prevent submitting. my html code: <form name="vehicleregfrm" id="vehicleregfrm" action="" method="post"> <input name="samp" id="samp" type="text" /> <input name="sbtaddcarfrm" type="submit" value="continue" /> </form> here problematic jquery code: $('sbtaddcarfrm').on('click', function(event) { event.preventdefault ? event.preventdefault() : event.returnvalue = false; if ($('samp').val() != 50) { $('vehicleregfrm').submit(); } else { alert("your message"); } }); try this $("#vehicleregfrm").submit(function(){ if ($('#samp'

Downcast from AnyObject to UIImage[] - Swift -

Downcast from AnyObject to UIImage[] - Swift - i'm trying convert results of valueforkeypath array of uiimages. when trying met error undefined symbols architecture i386: "ttofc9tableview19tableviewcontrollers6photosgsqgsacso7uiimage", referenced from: __tfc9tableview29justpostedtableviewcontroller11fetchphotosfs0_ft_t_ in justpostedtableviewcontroller.o ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation) here's effort @ code in swift: propertylistresults nsdictionary, , parameter in valueforkeypath string var photos : anyobject = (propertylistresults anyobject).valueforkeypath(flickrfetcher.flickr_results_photos) self.photos = photos as? uiimage[] and working objective-c version of code is nsarray *photos = [propertylistresults valueforkeypath:flickr_results_photos]; self.photos = photos if run swift-demangle on "__ttofc9tableview19tableviewcontrollers6

html - How to force Save and restrict Open -

html - How to force Save and restrict Open - in html code, have link csv file. ones user click on it, default programme (ms excel) starts , give 2 options : open , save <a href="\\c:\xxx\test.csv">download data</a> i need restrict open option. want user able download his/her computer, not open version on drive. how can ? you can not stop user choosing open option, think getting wrong here - means pc download , open temp folder right away. not edit version of file. html

php - How do I import date and price thru phpMyAdmin to then sort correctly? -

php - How do I import date and price thru phpMyAdmin to then sort correctly? - i'm new mysql , learning lot quickly. main objective learning has been export info 1 source, import phpmyadmin. info first export delivered in next format; entry_date - mm/dd/yyyy cost - "123,456" i have thought set fields type; entry_date type: date cost type: mediumint(10) unsigned however, such, dates stored 00-00-0000 , cost stored first 3 digits (up until comma ','). if alter type to; entry_date type: char(10) cost type: varchar(10) unsigned now value stored properly, ability sort info defeated, both date , cost sort until first ' / ' , ' , ' (respectively). what's move here have db recognize date , cost proper sorting, respect format in receive exported info in first place? i'm not sure input format, want utilize float type cost , date type date. way sorted correctly. you should utilize proper

javascript - Why the pagination of footable is not working? -

javascript - Why the pagination of footable is not working? - i'm trying implement footable-2 in project, reason can't pagination working. i'm next this tutorial , here have far table code: <div id="maincontent"> <div id="alltrackersdiv" style="display: none;"> <label><b>active trackers</b></label> <table class="activetrackerstable" id="alltrackerstable" data-page-navigation=".pagination"> <thead> <tr> <th> id </th> <th> col 1 </th> <th> col 2 </th> <th> col 3 </th> </tr> </thead> <tbody data-bind="foreach: trackersobjarray"> <tr data-bind="click: test"> <td><span data-bind="text: tid&q

javascript - ruby on rails v2 prototype issues -

javascript - ruby on rails v2 prototype issues - am going background info first i have clash between dojo , prototype.js on client side, prepare rewrote client side hooks in plain javascript. but issue since prototype.js not beingness imported, ajax functions created render not work. there anyway rewrite them? or utilize jquery atleast. using ror v2.3.8 , updating out of question, messing dojo or dojo content. i thought seek send prototype.js tag response have no thought how, after reading lot of documentation told insert javascript tag where. also there anyway edit actioncontroller javascript jquery ruby-on-rails ruby

javascript - SAPUI5 get current context in detail view -

javascript - SAPUI5 get current context in detail view - i have sapui5 split-app master- , detail-view. when select item in side bar, pass context detail view, lets product 1 onselectproduct: function(evt){ sap.ui.getcore().geteventbus().publish("app", "refreshproductdetail", {context : evt.getsource( ).getbindingcontext()}); }, this triggers next function binds context: refresh: function(channelid, eventid, data){ if (data && data.context) { this.getview().setbindingcontext(data.context); } }, now when perform action save, want current info of product 1 in model. however, when utilize this.getview().getbindingcontext().getmodel() it returns model products. how know 1 beingness viewed user? you can utilize getpath() of bindingcontext see object displayed: this.getview().getbindingcontext().getpath(); you this: var bindingcontext = this.getview().getbindingcontext(); var path = bindingc

javascript - How to remove Data between Tags -

javascript - How to remove Data between Tags - i have big amount of data, , have task create mapping of same. create mapping want delete info between till in xml. below illustration want have. <subissue id = "1" sname = "heading"> <issues> <child name="symptom/ cause" value="how to"></child> </issues> <questions> <question> <![cdata[<font color='#333333' size='3' face='calibri'><b>bull</b></font> <font color='#15428b' size='2' face='calibri'>1data1</font> <font color='#333333' size='3' face='calibri'><b>rock</b></font> <font color='#15428b' size='2' face='calibri'>data2</font> </br>]]> </question>

c# - There was no endpoint listening at (url) that could accept the message -

c# - There was no endpoint listening at (url) that could accept the message - i'm building asp.net website - it's solution few projects, info base of operations , web service. worked fine, lastly time tried run project, got next error: there no endpoint listening @ http://localhost:[number]/booksws.svc take message. caused wrong address or soap action. see innerexception, if present, more details. the inner exception says: unable connect remote server this error sort of came out of blue, i'm not sure additional info should provide. have thought why happen? i suppose general reply help, info found error in web concerned wcf. go webconfig page of site, tag endpoint, , check port in address attribute, maybe there alter in port number c# asp.net soap

spring - Eclipse Error: Websockets are currently only supported in Tomcat -

spring - Eclipse Error: Websockets are currently only supported in Tomcat - i'm trying utilize tomcat in webapp , want utilize spring’s back upwards embedding tomcat servlet container http runtime, instead of deploying external instance in tutorial basing app off of: http://spring.io/guides/gs/messaging-stomp-websocket/ however, getting stack error: caused by: java.lang.illegalstateexception: websockets supported in tomcat (found class org.springframework.boot.context.embedded.jetty.jettyembeddedservletcontainerfactory). @ org.springframework.boot.autoconfigure.websocket.websocketautoconfiguration$1.customize(websocketautoconfiguration.java:74) @ org.springframework.boot.context.embedded.embeddedservletcontainercustomizerbeanpostprocessor.postprocessbeforeinitialization(embeddedservletcontainercustomizerbeanpostprocessor.java:67) @ org.springframework.boot.context.embedded.embeddedservletcontainercustomizerbeanpostprocessor.postprocessbeforeinitialization(embeddedser