Posts

bash - How do you programmatically add a bats test? -

i'd have bats test created every file in directory, i'm not sure best way done is. approach below creates single test when there many files in directory. #!/usr/bin/env bats in $(ls) @test "testing $i" { pwd } done to extract ls output not batter solution go wrong on filenames spaces. you can below shopt -s nullglob file in /dir/* //test command on $file done shopt -u nullglob you can using find command also find /some/directory -maxdepth 1 -type f -exec cmd option {} \;

clojure - 'get' replacement that throws exception on not found? -

i'd access values in maps , records, throwing exception when key isn't present. here's i've tried. there better strategy? this doesn't work because throw evaluated every time: (defn get-or-throw-1 [rec key] (get rec key (throw (exception. "no value.")))) maybe there's simple method using macro? well, isn't it; has same problem first definition, if evaluation of throw happens later: (defmacro get-or-throw-2 [rec key] `(get ~rec ~key (throw (exception. "no value.")))) this 1 works letting get return value (in theory) never generated other way: (defn get-or-throw-3 [rec key] (let [not-found-thing :i_would_never_name_some_thing_this_021138465079313 value (get rec key not-found-thing)] (if (= value not-found-thing) (throw (exception. "no value.")) value))) i don't having guess keywords or symbols never occur through other processes. (i use gensym generate special value of...

rdbms - what exactly the undo information lives in oracle? -

some docs says, there "undo tablespaces" implies should create tablespace undo imformation. some docs says, there "undo segment" implies undo information lives in normal tablespaces , use of it's segment. so, undo information lives , organized? earlier releases of oracle database used rollback segments store undo. oracle9i introduced automatic undo management, simplifies undo space management eliminating complexities associated rollback segment management. oracle recommends (oracle 9i , on words) use undo tablespace (automatic undo management) manage undo rather rollback segments. when creating undo tablespace, these automatically created: n undo segments (based on sessions parameter value) named _syssmun$ owned public (usable ops configuration) not manually manageable

c# - UPnP and Port Forwarding with Lidgren fails -

Image
i'm new networking , lidgren has made easier me begin adding multiplayer capability xna pc game. i've been testing across network setting laptop right next me , has been working great. problem sent copy of game friend in netherlands , cannot connect me. have set 1 person host , other people clients connect host. the host sets server follows: config = new netpeerconfiguration("game"); config.port = 14242; config.enableupnp = true; config.maximumconnections = 3; config.enablemessagetype(netincomingmessagetype.connectionapproval); server = new netserver(config); server.start(); server.upnp.forwardport(14242, "forlorn forest"); here's exception forwardport throws fails , gives "bad request": and 2 web exceptions thrown: it says connection being closed remote host , unable read data transport connection in exception details: any thoughts might going on here? upnp enabled on router. i've taken @ network traffic wireshark...

javascript - IE 10 not event not firing bind() or on() using JQuery -

$('body').unload(function () { }); $('body').on("beforeunload", function () { //if true means logged clicked else page close clicked if (istrue == 0) { btgui.webservices.connectiontoken.getlogoutclientusermethod(logoutclientusermethodsucess); } else { btgui.webservices.connectiontoken.pageclosedxmlmethod(hddclient, hddusername); } bind() or on() events not firing in ie 10,except ie working browsers fine. ie version work i'm using jquery 1.7.0 i'm tested $(window) not working. yes, event handler should bound $(window). beforeunload handler supposed return string displayed in confirmation box. seems me you're doing lot more that.

Linux vanilla kernel on QEMU and networking with eth0 -

i have downloaded , compiled vanilla linux kernel (3.7.1) used busybox ramdisk booted using qemu. qemu command line qemu-system-i386 -kernel bzimage -initrd ramdisk.img -append "root=/dev/ram rw console=ttys0 rdinit=/bin/ash" -nographic -net nic -net user everything goes well. however, can't use networking on vanilla kernel busybox. 'ifup eth0' tells me / # ifup eth0 ip: siocgifflags: no such device i googled internet can' clue... advice nice thank in advance. most there no driver (in example should e1000) loaded or device has name. in /sys/class/net/ should find listing of available net-devices. if there none (besides lo) driver not loaded. in qemu monitor type "info pci" , show pci-address of ethernet card. should this: ... bus 0, device 3, function 0: ethernet controller: pci device 8086:100e ... this device corresponds /sys/devices/pci0000:00/0000:00:03.0/. files "vendor" , "device" must c...

java - Getting exception in JDBC thin driver -

i try run query using java , below mentioned program import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.statement; import javax.naming.spi.dirstatefactory.result; public class oracleconn { public static void main(string[] args) { try { class.forname("oracle.jdbc.driver.oracledriver"); connection con = drivermanager.getconnection("jdbc:oracle:thin:@localhost:1521:yglobal","user","user"); statement stmt = con.createstatement(); resultset rs = stmt.executequery("select empid empmaster"); while(rs.next()) system.out.println(rs.getint(1)); con.close(); } catch (exception e) { e.printstacktrace(); }} } but when tried run program getting exception java.sql.sqlexception: ora-01756: quoted string not terminated @ oracle.jdbc.driver.databasee...

java - StringTokenizer.countTokens() returning erroneous value in for loop condition -

we have calculate numbers of "this" in given string having multiple "this" substrings. eg. "hello recruit , veteran , this" return 4. so using: stringtokenizer stringtokenizer1 = new stringtokenizer(input2); arraylist<string> arraylist1 = new arraylist<string>(); int count=0; int arrindex = stringtokenizer1.counttokens(); (int = 0; < stringtokenizer1.counttokens(); i++) { arraylist1.add(stringtokenizer1.nexttoken()); } (string string2 : arraylist1) { if (string2.equals(string)) { count++; } } output1 = count; system.out.println(output1); return 2. however, if int arrindex assigned value of stringtokenizer1.counttokens() , used in looping condition, it's giving correct result of 4. why?? note:using javase-1.6 the condition stringtokenizer1.counttokens() evaluated everytime reenter loop. per javadoc calculates n...

ios - GPUImage is slow the first blurs -

i'm using excellent gpuimage blur views ( https://github.com/bradlarson/gpuimage ) however, seems first couple of times blur views, it's slow. after few blurs, it's faster. why that, , there way preload gpuimage framework fast time? thanks gpuimageiosblurfilter *blurfilter = [gpuimageiosblurfilter new]; blurfilter.blurradiusinpixels = 1; blurfilter.saturation = 1.2; blurfilter.downsampling = 4.0f; blurredimage = [blurfilter imagebyfilteringimage:blurredimage]; there slight lag on first usage of given filter, because framework has compile shaders used filter. these shaders cached later reuse. blurs in particular exhibit this, since shaders generated each blur radius use (for performance reasons when reused in video, etc.). that said, make sure absolutely need work uiimages in above code. -imagebyfilteringimage: isn't fastest approach, since has take in uiimage, generate gpuimagepicture behind scenes, upload image texture, proce...

apache - RewriteRule Didn't Work for Me -

my navigation example.com/admin/?nav=home , want rewriterule show example.com/admin/ or example.com/admin/home or example.com/admin/new . i tried tutorials didn't work. answering. try this: rewriteengine on rewritebase / rewriterule ^admin/home$ admin/?nav=home this show admin/?nav=home /admin/home for dynamic urls try this: rewriteengine on rewriterule ^admin/([^/]*)$ /admin/?nav=$1 [l]

hadoop - java.io.IOException: org.apache.thrift.protocol.TProtocolException: Cannot write a TUnion with no set value -

i using thrift scheme store thrift bundles pail file in hadoop cluster. seems working correctly. thrift bundle being created without errors. although,i using kafka send bundle , while serializing,the serializer function converts bundle in byte array.i getting above mentioned error @ point. why kafka in bundle object converting in byte array. or there way can convert object byte array safely.if can please provide it.the error : java.io.ioexception: org.apache.thrift.protocol.tprotocolexception: cannot write tunion no set value! following writeobject function throwing error private void writeobject(java.io.objectoutputstream out) throws java.io.ioexception { try { write(new org.apache.thrift.protocol.tcompactprotocol( new org.apache.thrift.transport.tiostreamtransport(out))); } catch (org.apache.thrift.texception te) { throw new java.io.ioexception(te); } } the message quite clear: there somewhere union object no v...

vb.net - Could not load file or assembly DevExpress version 11.1 in asp.net(vb) -

i working on project build on 2.0 framework of .net using devexpress version 7 before controls of devexpress 7 doesn't supports modern browsers. installed , included devexpress version 11 assemblies. i copy/pasted assembly files of version 2011 bin folder of project. added reference in web.config file in web.config, have <add assembly="devexpress.data.v11.1, version=11.1.4.0, culture=neutral, publickeytoken=b88d1754d700e49a"/> <add assembly="devexpress.web.aspxeditors.v11.1, version=11.1.4.0, culture=neutral, publickeytoken=b88d1754d700e49a"/> <add assembly="devexpress.web.aspxgridview.v11.1, version=11.1.4.0, culture=neutral, publickeytoken=b88d1754d700e49a"/> <add assembly="devexpress.web.v11.1, version=11.1.4.0, culture=neutral, publickeytoken=b88d1754d700e49a"/></assemblies> in asp file have : <%@ register assembly="devexpress.web.v11.1, version=11.1.4.0, culture=neutral, publickeytoken=...

Creating app.tss in titanium -

how can create app.tss in titanium? i'm following link http://www.smashingmagazine.com/2014/03/10/4-ways-build-mobile-application-part4-appcelerator-titanium/ i think app.tss not alloy controller can't right click on app in project explorer , create alloy contoller. should right click , create new file , label app.tss. have negative effect on entire project? i think app.tss not alloy controller can't right click on app in project explorer , create alloy contoller. yes, right not alloy controller. files extension tss titanium style sheets. app.tss contains styles accessible globally , in folder called app/styles . should have in project default. if don't right click on folder styles -> new -> alloy style

oracle - need to insert data all together into temp table -

hi here sample code . i need insert data both procedures rather 1 after one..this code inserts data 1st first procedure , second row number 1st has ended inserting.please suggest way can insert data , not sequentially. create or replace package body procedure main_proc(param1 number,param2 number,v1 out number,v2 out number) v_resultset help.cursortype-->this defined in package spec v_name varchar2(10); v_code varchar2(40); begin v1:=param1; v2:=param2; proc1(v1,v_resultset); loop fetch v_resultset v_name; exit when v_resultset%notfound; dbms_output.put_line('error in proc1'); insert temp_table(name) values(v_name) ; end loop; proc2(v1,v2,v_resultset); loop fetch v_resultset v_code; exit when v_resultset%notfound; dbms_output.put_line('error in proc2'); insert temp_table(code) values(v_code) ; end loop; end main_proc; proc1(v_name varchar2,r_resultset out help.cursortype) begin open r_resultset select name emp dept_id=2; end; proc2(v_name varchar2,v_...

In Meteor, using an object (defined in one file) in another file without global scoping? -

i've got prices.js file shoppingcartcontents object defined in file. i'd access shoppingcartcontents object inside helpers.js file, using create global helper. i can setting shoppingcartcontents global, don't want that. there better way? according docs there's package scope , file scope . these 2 scopes don't seem granular enough me (there's package export feature i'm doing inside 1 package) things can scoped to: one , 1 file the entire package shouldn't there file export feature maybe? if you're working inside package, make variable global. way can access in files, package. if want global variable, have explicitly export it, there's no problem in using globals.

R: edit column values by using if condition -

i have data frame several columns. 1 of contains plotids aeg1, aeg2,..., aeg50, heg1, heg2,..., heg50, seg1, seg2,..., seg50. so, data frame has 150 rows. want change of these plotids, there aeg01, aeg02,... instead of aeg1, aeg2, ... so, want add "0" of column entries. tried using lapply, loop, writing function,... nothing did job. there error message: in if (nchar(as.character(dat_merge$ep_plotid)) == 4) paste(substr(dat_merge$ep_plotid, ... : condition has length > 1 , first element used so, last try: plotid_func <- function(x) { if(nchar(as.character(dat_merge$ep_plotid))==4) paste(substr(dat_merge$ep_plotid, 1, 3), "0", substr(dat_merge$ep_plotid, 4, 4), sep="") } dat_merge$plotid <- sapply(dat_merge$ep_plotid, plotid_func) therewith, wanted select column entries 4 digits. , selected entries, wanted add 0 . can me? dat_merge name of data frame , ep_plotid column want edit. in advance just extract "string" po...

php - Apache Webserver : What happens to requests already sent in loop after The connection has timed out -

i have written script create images in loop , loop size 10k. happens after period of time browser shows "the connection has timed out". can still see images being created in specific folder i.e apache still processing request. the point of concern happens http aapche server requests sent in loop after connection has timed out. i curious know apache queue system in detail. you may looking ignore_user_abort directive. there more timeouts in place. apache request timeout (the time apache lets user wait first data). may different max_execution_time in php. if ignore user abort enabled, both timers start. after time apache times out , sends reponse. script in background still runs until either finishes or max_execution_time reached. if disable ignore user abort, script stopped when apache sends timeout user.

php - Why this form in html is not submitting? -

i don't understand why, when open html file form fill gaps , click on submit button, happens. <form method="post" action="php file"> <label>name*</label> <input type="text" name="name" placeholder="your name"> <label>email*</label> <input type="text" name="email" placeholder="your email”> <label>category*</label> <select name="category"> <option value="1">first</option> <option value="2">second</option> </select> <label>phone*</label> <input type="text" name="phone" placeholder="your phone"> <label>website</label> <input type="text" name="web" placeholder="your website”> <label>message</label> <textarea name="message" placeholder="your message"></textarea...

c++ - Can't delete dynamic object created in WxApp from OnExit() -

i'm trying understand how wxwidgets (3.0.1) app should designed, i'm missing i'm trying doesn't work. at basic level, have wxapp, creates wxframe, gets displayed , works fine. decided add in logger object.... i made object member of wxapp: class inilogwx : public wxapp { public: virtual bool oninit( ); virtual int onexit( ); private: clogstore * cl_logstore; }; and initialised in wxapp::oninit() bool inilogwx::oninit( ) { mainframe * frame = new mainframe(_("log demo"), wxpoint(250, 250), wxsize(450, 340)); frame->show(true); settopwindow(frame); // create logger class clogstore * cl_logstore = new clogstore( ); return true; } when application closed (closing mainframe) wxapp::onexit() fires, , thought i'd able clean memory here int inilogwx::onexit( ) { delete cl_logstore; // unhandled exception here due invalid pointer return w...

java - CXF BusException No DestinationFactory for namespace http://cxf.apache.org/transports/http -

i'm trying stand [basic cxf rs example][1], own service impl simpler , methods return strings. when try run server exception i built clean project i'm starting fresh.. master pom http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <name>tests</name> <groupid>com.crush</groupid> <artifactid>tests</artifactid> <version>1.0</version> <packaging>pom</packaging> <properties> <cxf.version>2.7.11</cxf.version> <httpclient.version>3.1</httpclient.version> <rs-api.version>2.0</rs-api.version> <disclaimer/> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <slf4j.version>1.6.2</slf4j.version> <guava.version>13.0-rc2</guava.version> <jgroups.version>3.1.0.final</jgroups.version> <infinispan.version>5.1.4.cr1</in...