Posts

jquery - Javascript Inheritance Best Strategy -

currently have built our own javascript framework building widgets, divs, panels , forms our complex web application. our widgets (aka. components) inherit super object called viewable defines view htmlelememnt . viewable = { getview: function() { if (!this.view) this.view = this.createview(); return this.view; } createview: function() { alert(‘you have not implemented createview. naughty boy!); } } then use object.create(viewable) create our own components, need implement createview defined in viewable. header = object.create(viewable); header.createview = function() { var div = document.createelement('div'); div.id = 'header'; } header.foobar = function() { } i move away type of inheritance, create-object-on-the-fly , add methods on depending on mood. i have looked @ other approach using $.extends jquery. can create object (or better ‘define function’? ‘defined class’?) function header() ...

java - File.createTempFile check if file exists? -

if use method, , chance there temporary file same name, file overwritten? i'm talking application generate many temporary files, long time. from javadoc on createtempfile ( here ) on line labeled 2 , neither method nor of variants return same abstract pathname again in current invocation of virtual machine. edit and returns section says an abstract pathname denoting newly-created empty file and, further states creates new empty file in specified directory, using given prefix , suffix strings generate name. if method returns guaranteed that: file denoted returned abstract pathname did not exist before method invoked

python - Concatenation of two columns into one rounds float -

i've got 2 dataframes want concat. both have same column , of different dtypes. 1 float, other string. want concat these columns while keeping granularity of float column. see below example: import pandas pd df1 = pd.dataframe.from_dict({'row1':124.028125},orient='index') df2 = pd.dataframe.from_dict({'row2':'hello'},orient='index') df_ = pd.concat([df1,df2]) the df_ variable displayed as df_ 0 row1 124.0281 row2 hello basically how can concat these while keeping 124.028125 value row1? thanks guys! data not lost, not displayed sake of clarity. if 1 access df_[0]['row1'] one gets 124.028125

sql server - Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException -

i'm trying connect java application sql server 2012, giving me error: exception in thread "awt-eventqueue-0" java.lang.classcastexception: com.microsoft.sqlserver.jdbc.sqlserverconnection cannot cast com.mysql.jdbc.connection can can me please? thank much. code of connection: import java.sql.connection; import java.sql.drivermanager; import java.sql.sqlexception; public class criaconexao { public static connection getconexao()throws sqlexception{ try{ class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver"); string dburl = "jdbc:sqlserver://brgdb:1433;database=db_sql;integratedsecurity=true"; connection conexao = drivermanager.getconnection(dburl); return conexao; }catch(exception e) { e.printstacktrace(); return null; } } } error: exception in thread "awt-eventqueue-0" java.lang.classcastexception: com.microsoft.sqlserver.jdbc.sqlserverco...

hbase custom filter not working -

i'm trying create custom filter on hbase 0.98.1 in standalone mode on ubuntu 14.04. i created class extending filterbase. put jar in hbase_home/lib. looking in logs, see jar in path. then have java client first makes columnprfixfilter, makes custom filter. columnprefixfilter works fine. filter, nothing happens. client freeze 10 minutes , close connexion. i don't see thing in log. could please give me hint on , check ? regards, edit: turns out protc vesrion conflict. generated java class form proto file protoc 2.4.0 , in filter using protobuf-java 2.5.0 aligned 2.5.0 , it's working fine.

Struggling with formatting an HTML newsletter -

Image
i've been trying compose newsletter institute out, don't have extensive experience in using html. told need use online template designing newsletter, based in everlytic (the mass-mail sending service), after formatting , sending preview myself, found table not display should. reason, after columns, few empty cells show not show in wysiwyg editor. know they're not reliable, still. i've poked around html, can't figure out seems wrong? suspect amount of columns table assigned use blame, uncertain. i've included html of newsletter until past point problem occurs. <html> <head> <title></title> </head> <body> <style type="text/css"><!-- .grey { color: #666; } --></style> <table border="0" cellpadding="0" cellspacing="0" class="grey" width="704"> <tbody> <tr> <td valign="top...

php - Replace in one step based on matched result -

i have string , want each yyyy-mm-dd hh:mm:ss date time string replaced unix timestamp. i have managed far identifying date time strings occur: $my_string = 'hello world 2014-12-25 10:00:00 , foo 2014-09-10 05:00:00, bar'; preg_match_all('((?:2|1)\\d{3}(?:-|\\/)(?:(?:0[1-9])|(?:1[0-2]))(?:-|\\/)(?:(?:0[1-9])|(?:[1-2][0-9])|(?:3[0-1]))(?:t|\\s)(?:(?:[0-1][0-9])|(?:2[0-3])):(?:[0-5][0-9]):(?:[0-5][0-9]))',$my_string,$my_matches, preg_offset_capture); print_r($my_matches); this outputs array of arrays containing value of date time string matched , location: array ( [0] => array ( [0] => array ( [0] => 2014-12-25 10:00:00 [1] => 12 ) [1] => array ( [0] => 2014-09-10 05:00:00 [1] => 40 ) ) ) from point going loop through arrays , replace based on str...