Posts

Showing posts from February, 2014

c# - Copying an Excel File as a Template and Working With It -

i using c# , winforms visual studio 2008. is there way programatically grab excel file has been pre-formatted, add things specific cells , rows, , save under different name? what code this, or barring that, resource useful? try reading :) c# , excel hope you.

python - Writing to file limitation on line length -

i've been trying write lines file based on specific file names same directory, search of file names in log file(given input), , modified date of files. output limiting me under 80 characters per line. def getfiles(flag, file): if (flag == true): file_version = open(file) if file_version: s = mmap.mmap(file_version.fileno(), 0, access=mmap.access_read) file_version.close() file = open('allmodules.txt', 'wb') i, values in dict.items(): # search keys in version file if (flag == true): index = s.find(bytes(i)) if index > 0: s.seek(index + len(i) + 1) m = s.readline() line_new = '{:>0} {:>12} {:>12}'.format(i, m, values) file.write(line_new) s.seek(0) else: file.write(i +'\n...

javascript - Hide content not containing select box value -

i have page filter shown content country, using select box. page shows content, when country selected, doesn't match value hidden adding css class. this relevant code far: jsfiddle html: <select name="filter" id="filter"> <option value="" disabled selected></option> <option value="france">france</option> <option value="germany">germany</option> <option value="uk">uk</option> </select> <div class="media"> <p>blah blah blah france blah blah</p> </div> <div class="media"> <p>blah blah blah germany blah blah</p> </div> <div class="media"> <p>blah blah blah germany blah blah</p> </div> <div class="media"> <p>blah blah blah uk blah blah</p> </div> css: .hidden { display: none; vis...

database - how to Set variable in INFORMIX DB according to IF else condtion for a dynamic SQL -

create procedure table_info (parin char(12), parin2 char(12), parin3 char(20),parin4 char(2)) returning char(12) paramenter1,char(23) parameter2,char(2) parameter3,char(12) parameter4,char(1) parameter5,integer parameter6 ; define paramenter1 char(12); define parameter2 char(22); define parameter3 char(2); define parameter4 char(12); define parameter5 char(1); define parameter6 integer; define cust_qry char(1024); let cust_qry = "select pt.paramenter1,pt.parameter2,pt.parameter3,pt.parameter4,pt.parameter5,pt.parameter6 x pt, outer x ps pt.set_no = ps.set_no , pt.paramenter1 = '" || parin || "' "; if parin2 = '' let cust_qry = cust_qry ; else let cust_qry = cust_qry || "and pt.parameter4 = '"|| parin2 || "' " ; end if; if parin3 != '' let cust_qry = cust_qry ||"and pt.trd_blk_ref = '"|| parin3 ||"' " ; end if; if ( parin4 != '0') let cust_qry ...

vb.net - oledbCnn not connecting to Access Database -

i'm trying connect database. when simple select * works, moment add clause no longer works , says cannot connect. column name correct, , i'm sure there last name of lee in database. why work during simple select , not when there clause? private sub button1_click(sender object, e eventargs) handles button1.click dim connetionstring string dim oledbcnn oledbconnection dim oledbadapter oledbdataadapter dim ds new dataset dim sql string dim integer connetionstring = "provider=microsoft.jet.oledb.4.0;data source=s:\reporting database.mdb;" sql = "select * [extract1] [extract1].[pi first name] = lee" oledbcnn = new oledbconnection(connetionstring) try oledbcnn.open() oledbadapter = new oledbdataadapter(sql, oledbcnn) oledbadapter.fill(ds) datagridview1.datasource = ds.tables(0) oledbadapter.dispose() oledbcnn.close() catch ex exception msgbox("can not op...

php - Laravel message system wuery all tables -

i'm creating message system in laravel4 , i'm confused how retrive data mysql in way. for noy have 3 tables in db: conversations: id int a_i primary subject varchar 128 created_at datetime updated_at datetime conversations_messages: id int a_i primary conversation_id int user_id int message text created_at datetime updated_at datetime conversations_members: conversation_id int user_id int last_view int deleted int created_at datetime updated_at datetime in models: conversation.php <?php class conversation extends eloquent { protected $table = 'conversations'; public function messages(){ return $this->hasmany('conversationmessage', 'conversation_id'); } public function members(){ return $this->hasmany('conv...

json - Salesforce callout using PHP -

apologies, since may not know terminologies salesforce api. started programming connector interact salesforce , stuck. i have requirement, each time new entry added leads section, have retrieve couple of fields (firstname , product code) , pass different software makes use of php. <?php require "conf/config_cleverbridge_connector.inc.php"; require "include/lc_connector.inc.php"; // start of main program // read basic parameters if ($lc_username === "") { $lc_username = readparam("user"); } if ($lc_password === "") { $lc_password = readparam("password"); } $orderid = ""; $customerid = substr(readparam("purchase_id"), 0, 10); $comment = readparam("email")."-".readparam("purchase_id"); // create product array $products = array(); $itemid = readparam("internal_product_id"); $quantity = 1; if (!once_per_purchased_quantity) ...

ruby - rails 3: hash attribute in a override to_xml model method -

i wrote override to_xml model method , right im trying hash attribute transformed set if symbol => values pair had no success. the result of intersected_categories method hash like: {:"1"=>["broken board", false], :"2"=>["sticking", false], :"3"=>["bottom tier missing", false], :"4"=>["bad i/l", false], :"5"=>["delamination", false], :"7"=>["sheet level - smile", false], :"8"=>["sheet level - frown", false], :"9"=>["missing ss", false]} the to_xml method def to_xml (options={}) xml = options[:builder] ||= builder::xmlmarkup.new(:indent => options[:indent]) xml.instruct! unless options[:skip_instruct] xml.wip @wip, :number => self.number, :start_time => self.wip_start_time, :end_time => self.wip_end_time, :line => self.system.name, :shift => self.shift, :...

android - Want just the filename to show in array and not the whole path -

i need file name of files in app folder coming whole path/storage/emulated/0/appfolder/file1.pdf. how cani have file.pdf show instead of whole path. please advise arraylist<file> files = new arraylist<file>(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); file file[] = environment.getexternalstoragepublicdirectory("/appfolder").listfiles(); recursivefilefind(file); setlistadapter(new arrayadapter<file>(viewinspection.this, android.r.layout.simple_list_item_1, files)); toast.maketext(this, "" + files.size(), toast.length_long).show(); } public void recursivefilefind(file[] file1) { int = 0; string filepath = ""; if (file1 != null) { while (i != file1.length) { filepath = file1[i].getabsolutepath(); files.add(file1[i]); if (file1[i].isdirectory()) { file file[] = file1[i].listfi...

erlang - Making an HTTP GET request from ejabberd mod_register -

i have setup ejabberd server. when user registers need make request server notify of user registration. url is: http://localhost:2555/registration?reg=true&id=xyz how make request within mod_register module in ejabberd config file? mod_register follows: {mod_register, [ {welcome_message, {"welcome!", "welcome jabber server."}}, {access, register} //get request ]} i guess looking solution involving programming in erlang. you can patch ejabberd's mod_register directly @ point registration successful. see example send_registration_notifications/2 . quick , dirty, not work accross ejabberd upgrades. you can configure ejabberd's mod_register send registration notifications option registration_watchers bot, , design such xmpp bot access url whenever receives these notifications. use exmpp starting point. provide tutorial write bot. to access url erlang, easiest use b...

c++ - Random frame of Video AR Drone is empty and then can't get a new image with OpenCV -

i'm doing simple program print ar.drone video during flight on computer. it works during few seconds , then, randomly, program abort because frame empty. decided test it, now, when frame empty, following frames empty too. here simple code : int main(void) { cv::videocapture cap; cv::mat image; if (!cap.open("tcp://192.168.1.1:5555")) { printf("ar.drone error connect\n"); return -1; } takeoff(); while (42) { cap >> image; if (!image.empty()) { cv::imshow("ar.drone", image); std::cout << "ok" << std::endl; } else std::cout << "error" << std::endl; cv::waitkey(1); } return 0; } my output : >ok >ok >[...] >ok >err >err >err but should : >ok >ok >[...] >ok >err // okay got error ? ... >ok // ... give new frame :) >ok why fail ...

php - Sort JSON object by string datetime -

i have json object containing many objects. 1 of values time. problem is string @ moment. how can convert date , sort objects date , place new array? the object $json_string = 'http://95.85.11.40/wordpress/?page_id=20'; $jsondata = file_get_contents($json_string); $obj = json_decode($jsondata, true); this example of value key time: april 20, 2014 10:13

database - Programmatically determine required series of JOIN statements in SQL -

in standard database theory on referential integrity , inclusion dependencies, it's alluded there pspace algorithm taking known list of e.g. foreign key , primary key relationships plus candidate relationship , determining if candidate relationship logically implied known list. non-deterministic version of algorithm given in algorithm 9.1.6 of this book [pdf] , not explicit deterministic version (and i'm guessing idea isn't somehow manually use savitch's theorem find algorithm). a related question how programmatically ask database system question this: given result set query 1 , result set query 2, there known-in-advance chain of primary / foreign key dependencies allow me join 2 result sets (possibly requring additional columns come derived chain of key relationships). i'm thinking in context of postgres, mssql, or mysql, how ask database information programmatically. i can query sp_help , sp_fkeys stored procedures, it's unclear how can provide s...

64 Bit Install of Enthought Canopy on 64 Bit machine issue -

i have 64 bit machine 64 bit windows on 1 side , 64 bit ubuntu 14 on other. going through exercises , notice when run following command: import sys sys.maxint i don’t max int 64 bit machine , install 32 bit max int. i’m bit confused , not know start. maybe because using student license? works fine on ubuntu side. the value of sys.maxint depends on underlying c library. seeing expected behavior on windows. see python sys.maxint, sys.maxunicode on linux , windows https://mail.python.org/pipermail/python-list/2008-december/504337.html the question one, reasonably marked duplicate sufficient "reputation". please search before asking questions. enjoy python!

c# - Is it possible to set custom (de)serializers for open generic types in ServiceStack.Text? -

i have type this: class foo<t> { public string text { get; set; } public t nested { get; set; } public static string tojson(foo<t> foo) { [...] } } tojson serializes foo<bar> instance json in way impossible achieve tweaking jsconfig . also, tojson relies on servicestack.text serialize nested , can instance of foo<baz> . unfortunately, way jsconfig implemented implies there jsconfig<t> set of static variables foo<bar> , other foo<baz> . also, afaik, servicestack.text offers no way configure json serialization open generic types (i.e.: jsconfig.add(typeof(foo<>), config) ). tried solve issue creating static constructor foo<t> : static foo() { jsconfig<foo<t>>.rawserializefn = tojson; } this doesn't work time. depends on order static constructors invoked runtime. apparently, servicestack.text caches serializers functions , doing before static constructor called depending on order operations...

Add a menu to a java swing application -

Image
i'm working on java swing application, , want menu that: i created first menu (on top) using jmenubar , jmenuitems, don't know how create second one. thanks in advance you try making jtoolbar , add buttons it.

Python: Change the label of a matplotlib button on click -

how change label of matplotlib button on clicking it? if have matplotlib button label "before", want click , change label "after". how do this? feel should know can't find on online or in documentation. assuming example http://matplotlib.org/1.3.1/examples/widgets/buttons.html bprev.label="a new label!" #actually doesnt work... i figured out next no knowledge of buttons looking @ docs (really glancing @ them) http://matplotlib.org/1.3.1/api/widgets_api.html#button a little more experimentation led me bprive.label.set_text("a new label") # works

iterator - java: implementing binary search tree and overriding iterable -

i want able use each loop end in infinite loop. i'm not using recursion , debugger not giving me hints. if is, i'm not getting it. here's tester: student stud1 = new student("nic", "aichael", "1234", 75, 90); student stud2 = new student("nic", "bichael", "1234", 75, 90); student stud3 = new student("nic", "cichael", "1234", 75, 90); student stud4 = new student("nic", "dichael", "1234", 75, 90); avlpersontree tree = new avlpersontree(); tree.add(stud1); tree.add(stud2); tree.add(stud3); tree.add(stud4); for(node node: tree){ node.tostring(); } here avlpersontree class: public class avlpersontree implements iterable<node>{ private node root; private int size; public avlpersontree(){ super(); root = null; } public void add(person newperson){ node newnode = new node(newpers...

In Pelican, how to create a page dedicated to hosting all the blog articles? -

in pelican, default, blog articles listed on index.html file. what want instead use static page home page , put blog articles on dedicated "blog" page. how can done? while there several possible methods achieving desired goals, start following changes settings file: siteurl = '/blog' output_path = 'output/blog' page_url = '../{slug}.html' page_save_as = '../{slug}.html' display_pages_on_menu = false display_categories_on_menu = false menuitems = [('home', '/'), ('blog', '/blog/')] put blog posts in content/ usual, , create home page following headers , save content/pages/home.md : title: home url: ../ save_as: ../index.html home page. caveats: dynamic navigation menu generation has been turned off since doesn't work configuration. highlighting currently-active menu item — feature out-of-the-box — not present in configuration and, if desired, must implemented separately in theme. ...

get value from database using java -

this code doesnt work , please helpp , want read value database , have 1 condition . private void jcombobox1actionperformed(java.awt.event.actionevent evt) { string url = "jdbc:mysql://localhost:3306/joebdd"; string driver = "com.mysql.jdbc.driver"; string user = "root"; string pass = "12345"; string value=(jcombobox1.getselecteditem().tostring()); try { class.forname(driver).newinstance(); connection con = (connection)drivermanager.getconnection(url,user,pass); string sql1 = "select price produit productname='"+value+"'"; preparedstatement pst = con.preparestatement(sql1); resultset rs = (resultset) pst.executequery(sql1); jtextfield3.settext(rs.getstring(1)); } catch( classnotfoundexception | instantiationexception | illegalaccessexception | sqlexception e){ joptionpane.showmessagedialog(null, e); }} check resultset has value or not, rs.next() . string ...

html - Change text color when hover over background image in same div -

in div tag have background image , below there text link well. background image , text link wrapped in same <a> tag. now trying change color of text link both when mouse on background image or text link. what achieved far change text color when hover on text cannot when hover on image. any ideas should apply hover property? tried hundreds of variations , still cannot it. here test demo: http://jsfiddle.net/bradg/65uhg/ and code, bit long sorry that. edit updated css code , removed unrelated problem lines css: .make_cat_img_thumbnail { display: inline-block; max-width: 100%; height: auto; padding: 4px; line-height: 1.428571429; background-color: #fff; border: 1px solid #ddd; border-radius: 7px; -webkit-transition: .2s ease-in-out; transition: .2s ease-in-out; text-decoration:none; } .text-center { text-align: center; } .text-muted { color: #999; } .text-muted:hover { color: orange; } .c-cover-image { wi...

apache - Htaccess rewrite one file to another one - coexistence with general rewrite -

in htaccess file have: # 1) redirect non-www www rewritecond %{http_host} !^www.mydomain.com$ [nc] rewriterule ^(.*)$ http://www.mydomain.com/$1 [l,r=301] # 2) redirect files in root equivalent files in subfolder # @ same time changing htm extension html rewritecond %{request_uri} !^/new/ rewriterule ^(.*)\.htm$ /new/$1.html [l] rewritecond %{request_uri} !^/new/ rewriterule ^(.*)$ /new/$1 [l] now need add rewrite condition specific file. requests of type: http://www.mydomain.com/downloads/myfile1.zip and need rewrite to: http://www.mydomain.com/new/downloads/myfile2.zip can tell me rule add? you can insert new rule zip file handling , add exception zip file in subsequent rules: rewritecond %{http_host} !^www\.mydomain\.com$ [nc] rewriterule ^(.*)$ http://www.mydomain.com/$1 [l,r=301] rewriterule ^downloads/myfile1\.zip$ /new/downloads/myfile2.zip [l,nc,r=301] # 2) redirect files in root equivalent files in subfolder # @ same time changing htm exte...

git - revert commits and merges not appearing in HEAD "history" -

after did revert commit followed merge, contributor made several (3) commits , wanted inspect them using git diff head^^^ head showed chunks sure updated previous commits. using git show came conclusion revert commit , content of merge not taken account when using either of head[^...][~...] shortcuts. here relevant outputs: $git log -7 3 hours ago 6bcab3e omglolol jun <--this branch master head 4 hours ago 0682cd5 otherfucking editeur de map jun 4 hours ago 83b61da motherfucking editeur de map jun 5 hours ago caf26e1 merge branch 'welcome' nath@home 5 hours ago 5ddbbd0 revert "back menu" nath@home 5 hours ago 2cb664c user can go fkin everywhere nath@home <--made on branch welcome 6 hours ago 06221f9 menu jun $git show head^^ 4 hours ago 83b61da motherfucking editeur de map jun <diff follows...> $git show head^^^ 6 hours ago 06221f9 menu jun <diff follows...> $git --version git version 1.8.1.2 <--packaged linux mint 15 as seems,...

Qt annot get metadata from audio file while loading it -

i have problem getting metadata file while loading disk. can play etc. can’t metadata while loading it. here loading function: btw. “ui->playlistview” element qtablewidget. void mainwindow::on_actionopen_triggered() { qfiledialog *filedialog = new qfiledialog(this); qstringlist selectedfiles; selectedfiles.clear(); selectedfiles = filedialog->getopenfilenames(this, "select songs", qdir::homepath(), "mp3 files (*.mp3)"); if(!selectedfiles.empty()){ playlist->clear(); ui->playlistview->clear(); ui->playlistview->setcolumncount(3); ui->playlistview->sethorizontalheaderitem(0, new qtablewidgetitem("title")); ui->playlistview->sethorizontalheaderitem(1, new qtablewidgetitem("artist")); ui->playlistview->sethorizontalheaderitem(2, new qtablewidgetitem("album")); ui->playlistview->setrowcount(selectedfiles.count...

hibernate - Can JPA cache query every time we execute SELECT statement? -

for example, have following query(the implementation of jpa hibernate): return em.createquery("select m.username member m", string.class) .getresultlist(); i know jpa interpret query sql first time execute it, if second time? jpa interpret again? time consuming. if change these queries namedquery , there noticeable performance improvement? yes, query plan cached. this flow: em.createquery(..) org.hibernate.internal.sessionimpl.createquery(string querystring) org.hibernate.internal.abstractsessionimpl.createquery(string querystring) org.hibernate.internal.sessionfactoryimpl.getqueryplancache().gethqlqueryplan( query, .. ); so query cached in session factory, once query translated going shared among future sessions.

java - Choose elements based on odds without going through entire list to compute the probability -

let's we're given array of number of objects, each 1 having weight representing ratio of being chosen other elements. so, instance, if have 1 object of weight 10, 1 of weight 30, , 1 of weight 35, ratio 10:30:35. probability of first object being chosen should 10/75 = 13.3%, probability of second being chosen should 30/75 = 40%, , probability of third being chosen should 35/75 = 46.6% now, let's have function that's given array , has return randomly-chosen object based on weight. brute force way go on each object loop , add weight total, go on loop again , see whether each object should chosen according random probability function: int totalweight = 0; for(object o: array) { totalweight += o.weight; } //now have total weight for(object o in array) { /* randomprob(double x) function returns true x percent of time */ if(randomprob(o.weight / totalweight)) { return o; } } but let's we're dealing thousands of inputs, iterating on each 1 twice...

ibm midrange - How to handle TYPE(*PNAME) in command source definition -

how make type(*pname) parameter be: required have default value have initial length of 10 how handle increases in length of prompted field, the length of prompted field of type *pname can increased "&". rpgle needs command processing program (cpp) example, command source definition: parm kwd(pcml) type(*pname) len(10) min(0) dft(*mydft) spcval((*mydft)) prompt('pcml input path') use min option make parameter required. use dft , spcval options specify default , special values. use len option specify maximum length. use inlpmtlen option specify initial length. the command processing program must defined accept maximum length. cmd parm kwd(pcml) type(*pname) len(512) dft(*mydft) spcval((*mydft)) min(1) inlpmtlen(10) prompt('pcml input path') rpg c *entry plist c parm pcml 512 for more information see par...

javascript - Trouble submitting my form (with jQuery validation) to the same page with $_POST -

i have form uses jquery system verify input. default way works, if there no errors, submit. pretty bad javascript, question is: how go making submit same page , put inputs in $_post variable, can execute php code handle data, while having jquery validation working? what i've noticed: the type submit button must set type="button" validator work having type set button, makes <form> not submittable php snippet validate input (see if posted $_post variable): if(isset($_post)){ $username = $_post['username']; $email = $_post['email']; $password = $_post['password']; echo $username."<br>".$email."<br>".$password; } the script form: <form action="" method="post"> <table border=0 id="form" style="padding:10px;"> <tr> <td> username </td> <td align=left> ...

java - Groovy - Main method placement -

here code: class cat {} class dog { static void main(string[] args) {} } when compiled groovy says not have main method. when rid of cat class: class dog { static void main(string[] args) {} } its valid. thought, long had main method in any class code valid, wrong. can explain why can not have more 1 class when main method resides in 1 of classes? you can have more 1 class, class defined first has have main method implementation. when run script, script executed in run() method. in case have class defined, name of class used name of script. in case there more 1 public class, runnable implementation has part of first defined class. below should work: class dog { static void main(string[] args) { println "hello" } } class cat {} you can clear picture when inspect ast in groovy console.

php - Reading from MySQL database won't work -

$query = mysql_query("select hour, team1, team2, goalsteam1, goalsteam2, competition `matches` `date`='". $daterow['date'] ."'"); while($row = mysql_fetch_array($query)){ $hour = substr($row['hour'],0,5); $teamemblem = mysql_query("select emblem `teams` `team`='".$row['team1']."'"); $teamemblemrow = mysql_fetch_assoc($teamemblem); echo ' <tr class="teamtable"> <td style="width:60px; font-size:11px;">'.$hour.'</td> <td style="width:145px; font-size:11px;"><img width=24px height=24px src='.$teamemblemrow['teamemblem'].'/></td> <td style="width:15px; font-size:11px;">'.$row['goalsteam1'].'</td> <td style="width:15px; font-size:11px;">'.$row['goalsteam2'].'</td> ...

powershell - how do I create a new azure management cache? -

now microsoft has dropped gui support on management portal, requiring me install , setup , use windows azure powershell create new managed cache service. not ton of powershell experience. cannot figure out how create new azure managed cache. have tips? i did following: executed in powershell: add-azureaccount connected login azure account executed in powershell: new-azuremanagedcache -name test -location "south central" and error is: new-azuremanagedcache : value cannot null. parameter name: managementcertificate @ line:1 char:1 + new-azuremanagedcache -name test-location "south central" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : closeerror: (:) [new-azuremanagedcache], argumentnullexception + fullyqualifiederrorid : microsoft.azure.commands.managedcache.newazuremanagedcache what should fix issue , new basic cache 128mb created? i figured out - needed get-azurepublishsett...

solrj - Is there a way to query Solr for a document with the most recent time field? -

if solr documents has <field name="timestamp" type="solr.triedatefield" indexed="true" stored="true" required="true" multivalued="false"/> how can query recent document? only way i've discovered far sort descending date , limit rows 1 has limitations when want recent version of documents id 1,2,3,4 something similar get records highest/smallest <whatever> per group i seem have gotten results im looking using solr group query group=true&group.field=groupid&group.sort=timestamp desc

r - Explanation for sprintf("%03d", 7) functionality? -

i trying write functions in r aim read multiple .csv files. named 001.csv, 002.csv, ... 332.csv. with paste managed construct names 1.csv, 2.csv , on, i'm having difficulty adding leading zeroes. there's hint construction sprintf("%03d", 7) required, have no idea why , how works. so can explain following statement can does? sprintf comes c , formatting rules taken well. see ?sprintf in r or this or this reference learn subject in detail. here i'll briefly outline what's magic behind it. "%03d" formatting string, specifies how 7 printed. d stands decimal integer (not double !), says there no floating point or that, regular integer. 3 shows how many digits printed number have. more precisely, number take at least 3 digits: 7 __7 (with spaces instead of underscores), 1000 remain 1000 , there no way write number 3 digits. 0 before 3 shows leading spaces should replaced zeroes. try experimenting sprintf("%+3d...

javascript - AngularJS & D3 : Angular directive for D3 load multiple times -

i wrote angular directive d3 forced-directed graph. code here. use $log.log("xx"); debug code. realized reasone directive load multiple times. mg-controller, 1 directive bond with, have 2 factories , these 2 factories called whenever controller initialized. using $log.log("xx"); realized when pay loaded, d3 directive @ least load 6 times, twice each factory , twice after. way "got around" using d3.select("svg") .remove(); page won't have duplicates svgs. highly affects performance. beside, added costumed filter in same page under same controller, , noticed whenever filter runs, d3 directive reload. filter has not thing d3 directive, except under same controller.(i don't think controller reload when filter runs.) i believe issue in link: function part. seems messy 2 things: 1) generates data feed d3 2)do d3 , generates graph. template:'<div>{{fdg()}}<div>', link: function ( $scope, $element,attr...

windows - run the same exe with different argument simultaneous in c++ -

does have idea open same exe file different arguments @ same time in c++. in past, open multiple commend line in windows run exe simultaneously, however, seems not best way solve it. hence try implement in c++ automatically run multiple processing @ same time. have tried this , still can not work.... problem: e.g. run 1. a.exe -dir d: -num 1000 2. a.exe -dir d: -num 1500 3. a.exe -dir d: -num 2500 @ same time in c++. (answered op in edits. see question no answers, issue solved in comments (or extended in chat) ) the ops solution is: sol: std::ostringstream trainsamplescmd[2]; trainsamplescmd[0] << "a.exe -data cascade/1 -vec vec/test.vec -bg neg.txt -numpos 1000 -numneg 1000 -w 30 -h 14"; trainsamplescmd[1] << "a.exe -data cascade/2 -vec vec/test.vec -bg neg.txt -numpos 1500 -numneg 1000 -w 30 -h 14"; for(int = 0; < 2; i++) { startupinfo si; ...

javascript - using selected value from dropdown list -

i have html form dropdown list populated php. want user able select option dropdown list , click on "proceed" button open new page based on selected value. <form name="selectpatient" method="post"> <div align="centre"> <select name="patient_dropdown"> <?php include "connection.php"; $sql = mysql_query("select name patient_info"); while ($row = mysql_fetch_array($sql)) { echo "<option value=".$row['name'].">".$row['name']."</option>"; } ?> </select> </div> <br> <br> <input type="submit" name="submit" value="proceed"/> </form> <?php if(isset($_post['submit'])) { header(...

php - Identify & delete Blank sheets -

i using phpexcel generate xls files. doing right is.... create sheets z loop through members in site , first character of firstname using first character decide sheet index , activate sheet. then append users name , add related analytic data in it. now want remove sheets not have data. how find sheets blank? you'll have loop through cells in each sheet testing each in turn, because phpexcel doesn't provide built-in method test if sheet blank but why not create sheets when need create sheet, lot more efficient creating set of sheets @ start of script, , (at end) deleting haven't used 1. loop through members in site , first character of firstname 2. using first character, test if sheet need exists - create if necessary 3. append users name , add related analytic data in it. if members looped in alphabetic order, don't need reorder sheets when you've finished

java - Null pointer exception in One To Many Mapping example -

employee class : public class employee { private int employee_id; private int faculty_no; private int enrolment_no; private string firstname; private string lastname; private date birth_date; private string cellphone; private department dep; //getters , setters } department class : public class department { private long department_id; private string department_name; private string department_location; private string department_rank; set<employee> employee_list; // getters , setters } impl class : public class onetomanyimpl { public static void main(string[] args) { sessionfactory sessionfactory = hibernateutility.getsessionfactory(); session session = sessionfactory.opensession(); session.begintransaction(); department department = new department(); department.setdepartment_name("mechanical dept."); department.setdepartment_rank("a class"); department.setdepartment_location("unive...

php - Complex Regex scenario -

i have scenario have multiple items similar titles , need simplify titles each have identical manifest title. here possible variations: quarter final football vs. loyola #2 -- 46:00 quarter final football vs. loyola #1 -- 32:00 little shop act ii -- 39:30 -- 5/22/91 little shop act -- 56:15 -- 5/22/91 b-ball -- 3/14/86 -- vs. king -- first half -- 43:15 b-ball -- 3/14/86 -- vs. king -- second half -- 48:15 oak park 9/26/70 part 1 oak park 9/26/70 part 2 vs. yale (1958) first period vs. yale (1958) second period the matching result ideally "vs. yale (1958)" bottom two. tried bottom string regex pattern, feeling bit lost how handle these variations programatically. ([.,a-za-z0-9\s\(\)]*)\b([#]|period|period)\b thanks direction or help. edited: output each variation- quarter final football vs. loyola quarter final football vs. loyola little shop little shop b-ball -- 3/14/86 -- vs. king b-ball -- 3/14/86 -- vs. king oak park 9/26/7...

Lua socket error on connection -

i'm trying make http get, using lua socket: local client = socket.connect('warm-harbor-2019.herokuapp.com',80) if client client:send("get /get_tweets http/1.0\r\n\r\n") s, status, partial = client:receive(1024) end end i expect s tweet, since i'm making returns one. i'm getting: http/1.1 404 object not found here runnable version of code example (that exhibit problem described): local socket = require "socket" local client = socket.connect('warm-harbor-2019.herokuapp.com',80) if client client:send("get /get_tweets http/1.0\r\n\r\n") local s, status, partial = client:receive(1024) print(s) end if read error page returned, can see title heroku | no such app . the reason heroku router works when host header provided. easiest way use actual http module of luasocket instead of tcp directly: local http = require "socket.http" local s, status, headers = http.request(...

xcode - Chinese characters garbled -

i wrote servlet download database records include chinese characters. download file in csv format. servlet response content type set "text/csv; charset=utf-8". when open csv in excel, chinese chars unreadable. but, if open same file using xcode editor, show fine. i not able find setting char encoding in either application. what can difference between excel , xcode editor? it may limitation of excel's handling of csv files. can try tab separated format txt extension: nsdictionary *dictionary = @{@"(nǐ hǎo) - inf" : @"你好", @"(hǎojǐu bújiàn)" : @"好久不見 [好久不见]"}; nsstring *documentspath = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes)[0]; nsstring *path = [documentspath stringbyappendingpathcomponent:@"test.txt"]; nsmutablestring *string = [nsmutablestring string]; (nsstring *key in dictionary) { [string appendstring:key]; [...

redirect - Constrain Wikipedia Search API to generate only NS:0 pages -

i calling wikipedia api java using following search query generate redirected pages: https://en.wikipedia.org//w/api.php?format=json&action=query&generator=allpages&gapfilterredir=redirects&prop=links&continue=&gapfrom=d where final 'd' example continue-from. i interested in iterating on items in namespace:0. in fact, if don't, continue return value includes category pages, break next query iteration. thank in advance. the parameter need allpages api is …&gapnamespace=0&… but notice when omit it, 0 default anyway.

html - Pass variables from one file to another in PHP -

i have site in there many users, , there's section editing them. let's call section page 'a.php'. when clicking on page 'a', see list of users registered in site in form of table. then, there's input space entering username want edit, html form method (post), verifies information , if username doesn't exist, error page. but if does, new page opened, let's call 1 page 'b.php' , see full info, more input spaces in case want change of user values. there's option saving changes (page 'c.php') , option deleting user (page 'd.php). the problem have right that, since in page 'a.php' send info via form method="post" , later received in page 'b.php', don't know how re send pages 'c.php' , 'd.php', since these pages don't receive data form method="post". tried using include function doesn't work, can me please? here's how i'm sending info page 'a' ...

asp.net - 401 (Unauthorized) WebResource.axd -

i have website secured windows authentication , role provider, site has public section allows access anyone. <location path="public"> <system.web> <authorization> <allow users="*" /> <allow users="?" /> </authorization> </system.web> </location> the public page data entry page devexpress controls required field validation etc. the page trying access webresource.axd , failing error: failed load resource: server responded status of 401 (unauthorized) how can grant access webresource.axd public pages while maintaining permissions on rest of site? try thing this. <location path="path axd file"> <system.web> <authorization> <allow users="?" /> </authorization> </system.web> </location>

In Hosted Enterprise Chef server -5NODES FREE -

in hosted enterprise chef server , have 5 nodes free . dont understand meant 5nodes free. if 5 nodes free means mentioning nodes registered in chef server through workstation ah?? can explain hosted enterprise chef server free node? thanks in advance, indu a node physical, virtual, or cloud machine configured maintained chef-client. five of such nodes (usually servers) of yours can used chef enterprise free. this explained more in detail in documentation

How do you utilize proxy support with the python aiohttp framework -

does os.environ['http_proxy'] still work? , how utilize proxy per request? http proxy support has added aiohttp in recent 0.7.3 release. doesn't use os.environ['http_proxy'] , never do. to specify proxy request can use code this: connector = aiohttp.proxyconnector(proxies={'http': 'http://proxyaddr:8118'}) response = yield aiohttp.request('get', 'http://python.org/', connector=connector) https proxies not supported yet, sorry. perhaps add feature soon: need https proxies our business tasks.

autoit - randomize text replacement with stringreplace function -

so in need of replacing string text autoit using stringreplace need randomize output. an example of need is stringreplace($string, "and", {also|as well}) my ultimate goal randomly replace text following options based on word "and" or well i wrote long time ago. it convert this my name {john|peter|mark}! {regards|cheers|get lost}! to this my name john! cheers! it works line breaks also. func spintaxtotxt($textwithspintax) dim $msgmsg dim $lines $lines = stringsplit($textwithspintax, @lf) $z = 1 $lines[0] if $z > 1 $msgmsg &= @lf $d = stringsplit($lines[$z], "{}") $i = 1 $d[0] $msgsplit = stringsplit($d[$i], "|") if @error $msgmsg &= $msgsplit[1] continueloop endif $msgmsg &= $msgsplit[random(1, $msgsplit[0], 1)] next next return $msgmsg endfunc ;==...

javascript - On a target page with multiple id's, script is acting only on the first one -

i'm filling in text box using greasemonkey. it's working, page has more 1 <input> same id, , gm filling in first one. the page's html (repeated 3 times): <input type="text" id="se" value="" class="form"> gm code: document.getelementbyid("se").value = "na"; how can set 2nd or 3rd <input> too? yeah, pages malformed html right pain. fortunately, queryselectorall() works 1 hope on such pages. (alas, libraries, jquery, don't handle malformed pages well.) in case, following code should work you: var badinputs = document.queryselectorall ("#se"); (var j = badinputs.length - 1; j >= 0; --j) { var tinput = badinputs[j]; tinput.value = "na"; } can see code in action @ jsfiddle .

css - CSS3 bi-directional Flipper -

i'm looking css converter ltr rtl supports new css3 transforms for example: pre { width: 33em; border: solid red; -webkit-transform: translate(100px) rotate(20deg); -webkit-transform-origin: 60% 100%; -o-transform:translate(100px) rotate(20deg); -o-transform-origin:60% 100%; transform: translate(100px) rotate(20deg); transform-origin: 60% 100%; } this example represents ltr css, want tool give me rtl version of provided css i believe rtlcss looking for, output produced example input: pre { width: 33em; border: solid red; -webkit-transform: translate(-100px) rotate(-20deg); -webkit-transform-origin: 40% 100%; -o-transform:translate(-100px) rotate(-20deg); -o-transform-origin:40% 100%; transform: translate(-100px) rotate(-20deg); transform-origin: 40% 100%; } jsfiddle: ltr version jsfiddle: rtl version direct links: github: https://github.com/mohammadyounes/rtlcss npm: https://ww...

c# - How to prevent Graphical stutter when scrolling a large zoomed out picture -

i have large tiff picture (5.9 mb , 13k x 16k reolution) user loads scrollable panel can zoom in/out of, scroll , mark points, regions etc on. for scrollable double buffered panel using modification of bob powell's awesome zoompicbox panel displays part of picture in view. the stutter occurs when scrolling image when zoomed out (even if interpolationmode set low) is there can done (preferably without hardware acceleration)? the paint event of panel : protected override void onpaint(system.windows.forms.painteventargs e) { if (_image == null) { base.onpaintbackground(e); return; } //scale system.drawing.drawing2d.matrix scalemat = new system.drawing.drawing2d.matrix(_zoom, 0, 0, _zoom, 0, 0); //move position of scrollbas scalemat.translate(this.autoscrollposition.x / (_zoom), this.autoscrollposition.y / (_zoom)); e.graphics.transform = scalemat; e.graphics.interpola...