Posts

Showing posts from July, 2014

c++ - terminate called after throwing an instance of 'std::invalid_argument' what(): dataItem already in tree Abort (core dumped) -

i'm getting error terminate called after throwing instance of 'std::invalid_argument'what(): dataitem in tree abort (core dumped) i've tried , can't think of possibly fix i'm assuming im storing tree when stored have no idea, appreciated below code - use bintree , binnode : #include <iostream> #include <string> #include <ctype.h> #include <fstream> #include <stdlib.h> #include "bintree.h" #include "binnode.h" using namespace std; class mazepoint { private: int x; char pointtype; public: void setpointmaze(char ch, int i) { pointtype = ch; x = i; } bool operator == (const mazepoint &other) const { return(this->x == other.x); } bool operator < (const mazepoint &other) const { return(this->x < other.x); } }; class mazerow { private: bintree<mazepoint> points; int y; public: void setmazer...

struts2 - using same jsp page for create and edit struts 2 -

i want use same jsp page create , edit operations. there 2 challenges in inter-related: in jsp, want of fields have default value. here sample code better understanding public class nodeaction extends actionsupport{ string nodeid; public string createnode(){...}; public string addnode(){...}; public string editnode(){....}; public string updatenode(){....}; } this jsp content: <s:textfield name="nodeid" value="127.0.0.1> now same jsp needs used above functions. you cannot use "value" attribute of tag set default value because while editing, page show default value instead of actual value. there 2 ways of solving : set default values in action class itself. ( don't want java deal view) use "s:if" tags in jsp differentiate between create , edit. the second challenge when use same jsp edit action followed update action , create action followed add action. so when submitting page(there 1 submit b...

mongodb - Array of BigIntegers is saved as string in Spring + Mongo -

when try save object has array of biginteger, discovered spring data mongo saves values strings instead of objectids. the object stored in mongo array of objectids, when saving gets converted strings. i assumed problem fact array or list, , not biginteger directly. ideas? i found solution on own. appears biginteger[] should changed objectid[] without @onetomany annotation on it. the @onetomany annotation caused forced conversion string. a better solution use custom annotation @objectid, in same spirit @dbref, not included in spring data mongo, , don't have skill yet set up. if feels interested out, i'd more happy , select different best answer.

sql server - Scope Identity error in SSIS Task -

create table ssis_auditresults( auditid int identity(1,1), packagename varchar(35), executiontime datetime, filename_path varchar(100), recordcount integer, endtime datetime, packagestatus varchar(10) ) above table. using query below execute sql task insert ssis_auditresults(packagename,executiontime) select ? ,? select scope_identity() in parameter mapping packagename , executuion time. in result mapping creating new variable name identity_generator data type int 64,value 0 after executing package getting error below [execute sql task] error: error occurred while assigning value variable "identity_generator": "the type of value being assigned variable "user::identity_generator" differs current variable type. variables may not change type during execution. variable types strict, except variables of type object. i giving int showing me error. can me making mistake? data types in ssis not allowed change, unless it's object type...

jquery.ui.dialog open only once -

i have section i'm trying load page open dialog modal. works first time trigger load page , open modal on further try load page in div "without showing page itself". i used following code. $("#dialogdisplayecc").dialog({ autoopen: false, height: 500, width: 1090, modal: true, close: function () { $("#dialogdisplayecc").dialog("close"); } }); function showeccindialog(pid, pcar, pkmstart, pkmend) { url = "detail.do?mi=main" + "&pid=" + pid + "&pcar=" + pcar + "&pstart=" + pkmstart + "&pend=" + pkmend; $("#dialogdisplayecc").load(url); $("#dialogdisplayecc").dialog("open"); } <div id="dialogdisplayecc" style='overflow: auto;'></div> the function showeccindialog triggered onclick on div else where. , sends right parameters showeccindialog because works first time....

Do I need to specify parameter in Javascript closure -

<!doctype html> <html> <body> <p>changing local variable.</p> <p id="demo"></p> <script> var add = (function () { /* need put x in statement? "var add = (function(x) { " */ var counter = 0; return function (x) {return counter+=x} })() add(10); add(15); alert(typeof(add)); document.getelementbyid("demo").innerhtml = add(20); </script> </body> </html> i understand in example above, add assigned return value of self invoking function. the self-invoking function runs once. sets counter 0 (0), , returns function expression. my question why function isn't defined like: var add = (function(x) { .... }() because you're not passing in arguments: // receive arguments... // v var add = (function(x) { .... }() //^ //...

reporting services - Status of ssas cube database during cube processing -

i using ssas2008. have report based on particular cube. time when clients try execute report got missing information inside ssrs report. question during cube processing time, happend ssas database. can still query during cube processing or not? please answer. if report querying cube whilst processing data not available. if mean relational database being queried during cube processing query response may slow or time out ssas acquiring locks on data.

php - Not able to parse correctly a yaml file with symfony TreeNode -

i'm trying apparently simple. i want parse yaml structure: filters: filter: class: parentnamespace\myclassa filter: class: parentnamespace\myclassb params: customparam: 5 anotherparam: 1 so, want required filters node can have 1 or more filter node. each of must have 'class' node , have optional params array node. i'm trying treebuilder taking second filter, wonder if overriding first one. i tried , can't working. ->arraynode('filters') ->isrequired() ->children() ->arraynode('filter') ->children() ->scalarnode('class') ->isrequired() ->end() ->arraynode('params') ->defaultvalue(array()) ->prototype('variable')->end() ->end() ->end() ->end() ->end(...

c# - Format MySQL Date -

mysql table contains date format 23/11/2012 , want display '23/11' in label of visual studio, c#, how? void decorator() { string myconnection = "datasource= localhost;port=3306;username=root;password=root"; mysqlconnection myconn = new mysqlconnection(myconnection); mysqlcommand selectcommand = new mysqlcommand("select * bs.login type='id'", myconn); mysqldatareader myreader; myconn.open(); string = string.empty; myreader = selectcommand.executereader(); while (myreader.read()) = myreader.getstring(1); label1.text = a;// here want dd/mm format in table has dd/mm/yyyy format } convert datetime , , format it: a = datetime.parse(myreader.getstring(1)).tostring("dd/mm");

Creating a Namespace In Lua Across Files -

if want have several files in same namespace/table, need check if table has been defined? in otherwords table: testns = {} something like: if(nil == testns) testns = {} end i new lua if there alternative, let me know. the idiom is testns = testns or {}

awk - Compare two files and print Available and NotFound -Continuation: -

would compare second field f11.txt , first field f22.txt print match cases "available" , non match cases "notfound" if field $4 (file f11.txt) null, if field $4 (file f11.txt) not null print lines of f11.txt is. inputs: f11.txt a,10,zzz b,20,zzz,yyy c,50,zzz f22.txt 10,yyy 20,yyy 30,yyy 40,yyy have tried below command, sat help. awk -f "," 'nr==fnr{a[$1]=$0;next}{print $0 "," (a[$2]?"available":"notfound") }' f22.txt f11.txt got below output a,10,zzz,available b,20,zzz,yyy,available c,50,zzz,notfound where b,20,zzz,yyy match case don’t want override "available" $4 not null (empty) expected output: a,10,zzz,avilable b,20,zzz,yyy c,50,zzz,notfound i believe script below want begin { fs=ofs="," } nr==fnr { a[$1]=$0 next } !$4 { $4 = (a[$2] ? "available" : "notfound") } 1 updated script explicitely check empty fourth field (to a...

scikit learn - Understanding max_features parameter in RandomForestRegressor -

while constructing each tree in random forest using bootstrapped samples, each terminal node, select m variables @ random p variables find best split (p total number of features in data). questions (for randomforestregressor) are: 1) max_features correspond (m or p or else)? 2) m variables selected @ random max_features variables (what value of m)? 3) if max_features corresponds m, why want set equal p regression (the default)? randomness setting (i.e., how different bagging)? thanks. straight documentation : [ max_features ] size of random subsets of features consider when splitting node. so max_features call m . when max_features="auto" , m = p , no feature subset selection performed in trees, "random forest" bagged ensemble of ordinary regression trees. docs go on that empirical default values max_features=n_features regression problems, , max_features=sqrt(n_features) classification tasks by setting max_features differe...

matrix - the value of the object is null once I get out of the function (Java) -

import java.util.*; public class algorithm { public static class matrix{ private double[][] x; } public static scanner scan = new scanner(system.in); private static string str; public static void read_data(double[] radians, double[] l) { l[0] = 0.0; int i; (i = 0; < 9; i++) { str = scan.next(); //passem la primera columna str = scan.next(); //agafem el valor del desplaçament str = str.substring(0, str.length()-1); //traiem la coma l[i+1] = double.parsedouble(str); str = scan.next(); //passem la primera columna str = scan.next(); //agafem el valor del desplaçament if (i < 9) str = str.substring(0, str.length()-1); //traiem la coma radians[i] = math.toradians(double.parsedouble(str)); } radians[i] = 0.0; } public static void print_matrix(double[][] m) { (int k = 0; k < 4; k++) { system.out.print("\n"); (int j = 0; j < 4; j++) { ...

PHP md5_file hash is not the same as other online hash generators -

i uploading file using php uses md5_hash create md5 hash of file. when upload same file other online md5 hash generators return else. is there doing wrong? $md5 = md5_file($_files['inputname']['tmp_name']); var_dump($md5); string(32) "d41d8cd98f00b204e9800998ecf8427e" https://md5file.com/calculator says: md5 3be70563560066c0751a8e9427949bbf d41d8cd98f00b204e9800998ecf8427e md5-hash of empty string. means file filename $_files['inputname']['tmp_name'] points empty. so, there major problem upload somewhere... maybe server configuration error. it's impossible though, without further investigations.

java - Keeping two arrays, String[] and int[], parallel with merge sort -

i'm having trouble keeping 2 arrays in parallel within merge sorting algorithm. suppose have array defmergesort , intmergesort2. i lexicographically order string defmergesort, string[] defmergesort = {"echo", "alpha", "charlie", "beta", "alpha", "echo"}; array intmergesort2 represents element position in parallel defmergesort. (ex: defmergesort[0] = echo contingent intmergesort2[0] = 0, defmergesort[3] = beta contingent intmergesort2[3] = 3) intmergesort2 rearranged in parallel defmergesort, although not numerically sorted, int[] intmergesort2 = {0,1,2,3,4,5}; the end result should similar (not sure if parallel ordering intmergesort2[] in example correct duplicate strings in defmergesort[]): defmergesort[0] alpha = intmergesort2[1] 1 defmergesort[1] alpha = intmergesort2[4] 4 defmergesort[2] beta = intmergesort2[3] 3 defmergesort[3] charlie = intmergesort2[2] 2 defmergesort[4] echo = intmerge...

css - HTML indent table -

<table class="layout-table"> <tr> <td><strong>3. has person completed required training within past 3 years?</strong><br/><br/></td> </tr> <tr> <td><strong>a. copy of it</strong> <p:selectoneradio id="radio3" value="#{question3a}"> <f:selectitem itemlabel="yes" itemvalue="0" />&#160;&#160;&#160; <f:selectitem itemlabel="no" itemvalue="1" />&#160;&#160;&#160; <f:selectitem itemlabel="na" itemvalue="2" />&#160;&#160;&#160; </p:selectoneradio> <br/> <h:outputtext id="counter3" /> </td> </tr> </table> what trying table this 3. has person completed required training withi...

python - pandas - merging with missing values -

there appears quirk pandas merge function. considers nan values equal, , merge nan s other nan s: >>> foo = dataframe([ ['a',1,2], ['b',4,5], ['c',7,8], [np.nan,10,11] ], columns=['id','x','y']) >>> bar = dataframe([ ['a',3], ['c',9], [np.nan,12] ], columns=['id','z']) >>> pd.merge(foo, bar, how='left', on='id') out[428]: id x y z 0 1 2 3 1 b 4 5 nan 2 c 7 8 9 3 nan 10 11 12 [4 rows x 4 columns] this unlike rdb i've seen, missing values treated agnosticism , won't merged if equal. problematic datasets sparse data (every nan merged every other nan, resulting in huge dataframe!) is there way ignore missing values during merge without first slicing them out? you exclude values bar (and indeed foo if wanted) id null during merge. not sure it's you're after, tho...

mysql - Delphi XE6 on Windows 7 64bit, FireDAC cannot find libmysql.dll -

Image
i have little different question delphi xe5 firedac error: cannot load vendor library libmysql.dll or libmysqld.dll i'm evaluating delphi xe6 on windows 7 64bit, wish use firedac connect mysql database. i have downloaded libmysql.dll , install file in c:\windows\system32\ . after trying set tfdconnection.active true during designed time, got error dialog displayed below. so tried use tfdpyhsmysqldriverlink , have set tfdpyhsmysqllink.vendorlib c:\windows\system32\libmysql.dll , , set tfdconnection.drivername point tfdpyhsmysqllink.driverid instead, got error dialog displayed below. i have tried place libmysql.dll @ c:\windows\system32\bin error dialog still same displayed above. please guide me fix problem. with reading comment , comment there few facts fix problem. - delphi ide 32 bit application need libmysql.dll (32 bit version) instead of 64 bit version. - libmysql.dll version not depending on mysql server used misunderstood - c:\windows...

After ForceDirectories statement, Delphi exits the procedure -

i have simple procedure found problem, while debugging found delphi execute forcedirectories jump directly end of procedure without executing lines after it, why ?? var export_dir: string; grd_idx: integer; begin export_dir := 'c:\app1\export\'; sysutils.forcedirectories(export_dir); showmessage('this line executed jump end !!'); grd_idx := 0 pred(pagecontrol1.activepage.componentcount) begin if (pagecontrol1.activepage.components[grd_idx] tmycomp) exporttoexcel(export_dir+(pagecontrol1.activepage.components[grd_idx] tmycomp).name, (pagecontrol1.activepage.components[grd_idx] tmycomp), true, true, true, 'xlsx'); end; end; i use delphi xe5, 64bit project update: noticed placing break points on line after showmessage has x icon invalid break point instead of little red icon valid break point traced beginning of procedure , can confirm starting line begin for loop not executed. exporttoexcel built in procedure exporting data e...

SVN Update Unable to parse URL due to weird character -

i getting following message when perform svn update @ command line: svn: unable parse url '/svn/hvcp/!svn/bc/3678/trunk/media/mechanicârail_4.pdf' this happened: accidentally saved file had weird character (â) in name performed rename of file within svn on desktop using tortoisesvn , seemed succeed then tried svn update our dev server , keeps receiving above message. when blow away file on desktop , svn update on desktop using tortoisesvn works fine no message. it looks in path says /bc/3678/trunk 3678 revision number when file renamed. svn on centos release 6.3 software version 4.0.4-3784.127 subversion version 1.8.5-3784.127 any ideas on how fix this? thanks svn use utf8 encode. think filename ok. maybe client svn version lower handle filename correctly? i meet similar question when use svn client version 1.6 , svn server version 1.8. after upgrade svn client , ok.

c# - How to use managed variable as global in Visual C++? -

i'm writing mfc application in visual c++ , using 1 c# lib. dou combine unmanaged , managed classes , variables. need managed classes c# put , read to/from global scope accessible whole app. tried (simple example): app.h: class myclass1 { public: gcroot<namespace::something^> var; }; class myclass2 { public: static gcroot<namespace::something^> var; }; extern myclass1 *cl1; app.cpp myclass1 *cl1 = new myclass1(); when use "cl1->var", system.nullreferenceexception, myclass2 return error error lnk2020: unresolved token (0a0003be) "public: static struct gcroot ... error lnk2001: unresolved external symbol "public: static struct gcroot ... please me, how use "something^ var" in whole app? as other c++ static member, need define in addition declaring it. in app.cpp @ namespace scope, need: gcroot<namespace::something^> myclass2::var;

python - Urllib/JSON request from text file -

i trying send data text file server looking match sent data in order matched data returned me store in existing text file. if send list of names server within script, fine. want repeat request , insert text file names matched , returned. here text far: import json import urllib2 values = 'e:\names.txt' url = 'https://myurl.com/get?name=values&key=##########' response = json.load(urllib2.urlopen(url)) open('e:\data.txt', 'w') outfile: json.dump(response, outfile, sort_keys = true, indent = 4,ensure_ascii=false); this code send 1 line file showing nothing has matched. assuming looking @ values name instead of data in values text file. update trial 1: updated code per suggested below include urllib.urlencode suggestion. here updated code: import json import urllib import urllib2 file = 'e:\names.txt' url = 'https://myurl.com/get' values = {'name' : file, 'key' : '##########'} da...

Matlab: work with 2NxN matrix -

Image
i have matrix 2nxn. and want parametrs matrix. example it: how, can it? you may want break 12x6 matrix, 2 6x6 matrix; let's say: z , zb (last 1 z bar). odd rows z , evens zb . considering m combined matrices: z = m(1:2:end,:) zb = m(2:2:end,:) read colon( : ) operator , end see 1:2:end means. hope helps.

c - Detect audio peak using gstreamer plugin -

i'm developing plugin in c detects audio peaks using gstreamer-1.0. don't have knowledge audio programming , far, plugin can detect sound impulsion (if there no audio, nothing happens, if there sound, print energy). here sample code of (really simple) algorithm. gfloat energy_of_sample(guint8 array[], int num_elements, gfloat *p) { gfloat energy=0.f; for(int i=0 ; i<num_elements ; i++) { energy += array[i]*array[i]/4096; if (*p < (array[i]*array[i]/4096)) *p = array[i]*array[i]/4096; } return energy/num_elements; } static void audio_process(gstbpmdetect *filter, gstbuffer *music) { gstmapinfo info; gint threshold = 6; // gets information of buffer , put in "info" gst_buffer_map (music, &info, gst_map_read); // calculate average of buffer data gfloat energy = 0; gfloat peak = 0; energy = energy_of_sample(info.data, info.size, &peak); if (energy >= threshold )g_print("ener...

c++ - how to delete a Node in binary tree -

the program simple following step: find min value of binary tree; record min value in vector; delete node min value in tree; repeat 1-3 till tree empty. no error reported when run, function removenode keep printf("remove bug1!\n"); can not find logical mistake, not understand why happens. structure of function is: 'if min=key`,found it,call function removerootmatch else if min<root->key , 'left not null`,go left else print bug the tree defined following, language c++ typedef struct mynode* lpnode; typedef struct mynode node; struct mynode { double key; lpnode left; //left subtree lpnode right; //right subtree }; main part of program following: nmax initialed 0, sortedvector alloacted vector space large total nodes in tree, min initialed 99999. minvalue return min value of tree. comparedouble(a,b) return 1 if < b ,return 2 if > b ,return 3 if equal //remove root void removerootmatch(lpnode root) { ...

Why does calling chrome.cast.initialize break the connection to the Chromecast device? -

i trying build custom chromecast sender/receiver application, can't seem connect device custom sender or chrome once custom sender page loaded. the chromecast device appears functioning (i can cast tabs , youtube videos). however, when load custom sender, seems break chromes connection device. chromecast icon in chrome shows "no cast devices found". i have found if comment out chrome.cast.initialize , can see chromecast device again. there no errors reported in chrome debug console , i've commented out of code called event handlers related call , still have same problem. i've tried resetting chromecast device factory. i've tried few of network tweaks recommended in few other posts (though impression couldn't connect device @ all). this working yesterday, mysteriously stopped. seems point might have done, thing changed in receiver app , since can't start, don't think that. i got error before , solved closing re-openning chrome bro...

Open Source Continuous Integration tool for solo developer [Java] -

observed advantages of ci solo developers is continuous integration important solo developer? is there ci server suitable solo developers? they consume lot of ram , server-agent based. in thinking, need be: -lightweight (ram) -simple -compatible github could quote me? why don't use jenkins/hudson? excellent can configure sonar, codestyle, automatic build on every commit , many plugins. jenkins comes standalone jar file can use. yes, it's true consumes memory worth , isn't terrible memory consumer. by way, can find here interesting list: http://www.opensourcecontinuousintegration.com/ you can take , see 1 fits needs.

html5 - Navbar Menu Trouble shoot -

so wanted create fixed nav bar on top of page. instead of creating nav bar ordered list, used following approach: <header> <div class="nav"> <img src="images/logo_ab.png" alt="aurinbiotech logo"/> <a href="index.html">home</a> <a href="#">about</a> <a href="#">team</a> <a href="#">science</a> <a href="#">need</a> <a href="#">pipeline</a> <a href="#">contact</a> </div> </header> css: header .nav { margin-top:100px; width:100%; height:10%; text-align:center; padding-top:2%; margin:0 auto; position:fixed; top:0; } header .nav { font-size: 2em; padding-left: 15px; padding-right: ...

c# - ASP.NET how to send data with post method? -

the case i have 2 web forms, , codebehind. first webform formular enter string. want send string second formular using post method, , display it. the problem i getting error message, saying mac viewstate not validated : erreur du serveur dans l'application '/'. Échec de la validation mac viewstate. si cette application est hébergée par une batterie de serveurs ou un cluster, assurez-vous que la configuration spécifie le même validationkey et le même algorithme de validation. autogenerate ne peut pas être utilisée dans un cluster. what doing wrong ? webform1.aspx <%@ page language="c#" autoeventwireup="true" codebehind="webform1.aspx.cs" inherits="webapplication1.webform1" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> ...

c - Serializing POSIX threads using Mutex -

i trying make program creates 3 threads threa1 thread2 , thread3 thread1 prints thread1 5 times, thread2 prints thread2 5 times , thread3 prints thread3 5 times want use mutexes have output thread1 thread1 thread1 thread1 thread1 thread2 thread2 thread2 thread2 thread2 thread3 thread3 thread3 thread3 thread3 how can ? this solution : #include <stdio.h> #include <stdlib.h> #include <time.h> #include <assert.h> #include <pthread.h> #define max_print 5 #define max_thread 3 static pthread_mutex_t mthread[max_thread] = {pthread_mutex_initializer, pthread_mutex_initializer, pthread_mutex_initializer}; void * start_thread(void * arg) { int thnb = *((int*)arg); int = 0; pthread_mutex_lock(&mthread[thnb]); (i = 0; < max_print; i++) { fprintf(stdout, "thread%d\n", thnb); } pthread_mutex_unlock(&mthread[thnb]); return null; } int main() { pthread_t thread[max_thread]; int arg...

php - How to update random row in database? -

how update random row in database using rand() clause here trying right now, not working not sure whats wrong mysql_query("update `user` set `token` = '$session' not toke = '1' limit 1 rand()"); your query not valid. first of there typo in it, toke should token . where not should where token <> '1' . can indeed use rand() , on order by clause. query should this: mysql_query("update `user` set `token` = '$session' `token` <> '1' order rand() limit 1");

Weak Link My Own Objective-C Class -

is possible weak link own objective-c classes? i have seen can weak link function or variable… extern int myfunction() __attribute__((weak_import)); extern int myvariable __attribute__((weak_import)); i have this… if ([myuploadmanager class]) { self.uploadbutton.hidden = no; } … , able compile if uploadmanager.m not included in project. to weak link class e.g. myuploadmanager in own executable: to keep linker happy, add other linker flags in project: -wl,-u,_objc_class_$_myuploadmanager this allows class symbol undefined if not built executable. considered dynamic lookup instead, same dynamic library symbol. to keep runtime happy, add class header: __attribute__((weak_import)) @interface myuploadmanager when dynamic linker runs, substitutes nil class symbol rather crashing. now can run without either linker or runtime errors: if ([myuploadmanager class]) { self.uploadbutton.hidden = no; } note: of xcode 7, -u linker options conflicts bi...

python - django submit form on change -

hello trying submit form when selection option on choicefield class actionform(forms.form): """ holds options mailbox management """ choices = ['create new folder', 'delete', 'read', 'unread'] action = forms.choicefield(choices=choices, attrs={'onchange': 'actionform.submit();'}) but invallid syntax when try load form. pretty sure attrs={'onchange': 'actionform.submit();'}) problem, not sure how else it. you need set widget argument on field , pass attrs argument: action = forms.choicefield(choices=choices, widget=forms.select(attrs={'onchange': 'actionform.submit();'})) also, choices list should contain items containing 2 things inside: choices = [(0, 'create new folder'), (1, 'delete'), (2, 'read'), (3, 'unread')]

mdm - Cannot send mails with WSO2 EMM -

i'm not able send mails wso2 emm v1.0.1, no matter how configure mail settings. can managed tell me how this? thanks i'm having same problem, , using emm 1.1.0 , not able send emails. using emm/tenant/configuration web interface, i've configured settings use google apps email address , smtp.google.com email servers. i have follow wso2 emm getting started guide (smtp setup absent v.1.1.0), , i've web-researched this, , cannot find solution. can assist please? i receive error: [2014-08-16 14:47:18,895] error {jaggery.modules.user:js} - org.mozilla.javascript.wrappedexception: wrapped org.jaggeryjs.scriptengine.exceptions.scriptexception: javax.mail.messagingexception: not connect smtp host: smtp.gmail.com, port: 25; nested exception is: java.net.connectexception: connection timed out (/emm/modules/user.js#883) @ org.mozilla.javascript.context.throwasscriptruntimeex(context.java:1754) @ org.mozilla.javascript.memberbox.invoke(memberbox.j...

c# - Using statement doesn't seem to dispose my object -

i'm having trouble. have sqlcommand in using block. works fine. time however, code exits using block command not disposed. has me stumped. using (sqlcommand transfercommand = new sqlcommand(strheaderstoredprocedure, connection)) { transfercommand.commandtype = system.data.commandtype.storedprocedure; transfercommand.parameters.add("@invttransferid", sqldbtype.uniqueidentifier).value = invttransferid; sqldatareader transferreader = transfercommand.executereader(); while (transferreader.read()) { //do stuff, works fine } } using (sqlcommand transfercommand = new sqlcommand(strdetailsstoredprocedure, connection)) { transfercommand.commandtype = system.data.commandtype.storedprocedure; transfercommand.parameters.add("@invttransferid", sqldbtype.uniqueidentifier).value = invttransferid; sqldatareader transferreader = transfercommand.executereader(); <-- error happens here. } i'm trying reuse connect...

c++ - How to reference a form and change properties (height and width) from a function in Qt -

i'm starting qt trying migrate vb6. , i'm trying change size of window (ui form) function, before doing in action opens form this: void f::on_actioncte_triggered() { frm_abm_ctes *w = new frm_abm_ctes(uf->mdiarea); w->setattribute(qt::wa_deleteonclose); w->setwindowstate(qt::windowmaximized); w->shownormal(); int hi = (this->height()/3) - (w->height()/3); int wi = (this->width()/3) - (w->width()/3); w->setgeometry(wi,hi,w->width(),w->height()); } that works fine, idea if gonna lot of forms want call function changes geometry property of child form. like: function(parent,child) , use parent , child dynamic objects in function (as in visual basic or vs) so did this: void f::on_actioncte_triggered() { frm_abm_ctes *w = new frm_abm_ctes(uf->mdiarea); w->setattribute(qt::wa_deleteonclose); w->setwindowstate(qt::windowmaximized); w->shownormal(); forms(this,w) } where forms in ...

matlab - Convert rows of a matrix to vectors -

i have matrix lets say: a=[1 2 1; 5 6 7; 7 8 9] and want extract rows in following format: x_1=[1 2 1] x_2=[5 6 7] x_3=[7 8 9] i want know how can write x_1 , x_2 , x_3 . know how extract rows don't know how make x_1 , x_2 , x_3 . i want automatic , because real matrix has large size , don't want make x_1 x_2 .. x_100 hand. you can try following: m = size(a,1); i=1:m % set variable name varname = sprintf('x_%d',i); % create , assign variable in base workspace assignin('base',varname,a(i,:)); end the code iterates through every row of a , creates variable name (as per format) , assigns variable in matlab base workspace ('base') data being ith row of a . if doing function, rather using 'base' use 'caller' indicate variables should created in workspace of function.

javascript - How can I find when HTML5 audio actually starts playing (onplay event does not seem to work anywhere) -

i need catch exact moment when html5 audio starts producing sound. it turns out not simple seems. you might expect audio starts playing when onplay or onplaying event fired? no way. @ least in webkit family, seems no browser event fires @ point of time. in chrome, safari , firefox onplay , onplaying events faking behaviour firing oncanplay ! i've prepared simple test prove fact. demonstrates audio starts playing after reasonable time (over 100ms - 400ms) when events had been fired. you can notice ears , ears if @ console log. in log output currenttime every 15ms. seems reflect actual audio state correctly, , starts changing 10-40 polls after event has been fired. audio still freezed after play fired. test code looks this: var audioel = new audio('http://www.w3schools.com/tags/horse.ogg'); audioel.oncanplay = function () { console.log('oncanplay'); audioel.currenttime = 1; console.log('ready state is:...

javascript - How does proxyquire handle second level (indirect) requires of proxies modules? -

if have 3 modules names a , b , c module a requires b , b requires c : effect of call? var = proxyquire('a', {'c': mockedmodule}) would module b mock or real c module? i wrote test myself , not use proxy if it's not direct dependency.

c++ - Does dynamic_cast require virtual function? -

for example: class animal { virtual void dummy() {}; //line1 } class cat : public animal { } animal* = new cat(); if (cat* c = dynamic_cast<cat*> (a)) //line2 { //do something. } if remove line1 animal class (i.e. animal class not contain virtual members), line2 not work. yes does, per standard, dynamic_cast can downcast polymorphic types (i.e. type @ least 1 virtual function)

utf 8 - How to make mysql difference between between uppercase and lowercase -

i need in mysql difference between between uppercase , lowercase in query. because need in java program select user name. i tried this: database name utf8 table name user_table query: create table user_table (id int, name varchar(30)); insert user_table (1, "zdi0"), (2, "zdi0"); alter database utf8 character set utf8 collate utf8_unicode_ci; alter table user_table convert character set utf8 collate utf8_unicode_ci; select * name = "zdi0" ; result: 1 zdi0 2 zdi0 i need alter table not query thanks in advance the collation scheme utf8_unicode_ci case insensitive. if want use utf8 collation , support case sensitivity, you'll need use utf8_bin, utf8_bin binary collation scheme. should read on before decide use it. unfortunately far know utf8_bin case sensitive utf8 collation available in mysql.

ruby on rails - Some questions on Unobtrusive JavaScript -

i using ruby on rails , heard of “ unobtrusive javascript ” (ujs). after (but before) my previous question , ask myself: are there common-used patterns, rules, practices or techniques in order respond pragmatically javascript , html ajax requests? if there are, those? example, responses should returned? kind of data? there standard? practically speaking, how should controller respond_to (à la rails) depend on request format? is, how should application respond format.js , format.html or format.whatever in controllers when using rails framework? about previous matters, solution of rails community , / or of “general” public? use? ajax i don't know patterns, take "per feature" stance - you'll have different use cases different features. in part, can handle these using remote: true option ( which uses ajax handler in ujs ), allow either capture response .on("ajax:success" in asset js, or using .js.erb file in backend the bottom line...