Posts

Showing posts from February, 2011

PHP invoke Scanner Hardware and scan documents and upload it to Server -

how invoke scanner php script , scan document , upload scanned document server ? php server side language , cannot interact client side hardware. can use web-based twain sdk scan documents in php app. check out article might help.

mongodb - Full text search form with multiple inputs -

i try create search form has 3 text inputs: item description; model name; ctg name. user can fill inputs , search through collection has next document structure: { "id" : 123, "description" : "ricoh aficio cl-4000 type 245 toner yellow", "pnbrs" : [ "888281", "k174/g", "k174g" ], "model" : [ { "id" : "1625", "name" : "ricoh aficio cl4000dn" }, ], "ctg" : [ { "id" : "1472", "name" : "ricoh type 245 toner" } ], "brand" : "ricoh" } also created text index: db.products.ensureindex({ description: "text", "model.name" : "text", "ctg.name" : "text" }); how organize relevant full text search 3 text inputs , have on top items maximum score...

c# - Using different proxy for each GeckoFx Instances -

i'm using geckfx18.0 , xulrunner18.01. since geckofx share cookie , user preferences others instance try create new profile directory make them have unique setting seems no use. here code. there problem code? string profiledir = port.tostring(); string directory = path.combine(environment.getfolderpath(environment.specialfolder.localapplicationdata), path.combine("geckofx", profiledir)); this.text = directory.tostring(); if (!directory.exists(directory)) directory.createdirectory(directory); gecko.xpcom.profiledirectory = directory; geckopreferences.user["network.proxy.type"] = 1; geckopreferences.user["network.proxy.socks"] = "127.0.0.1"; geckopreferences.user["network.proxy.socks_port"] = port; geckopreferences.user["network.proxy.socks_version"] = 5; geckopreferences.user["general.useragent.override"] = ua;

Magento export customers who are not unsubscribed -

is there way in magento admin panel export customers not unsubscribed i.e. required_customers = all_customers - unsubscribed_customers in way, get: new_customers(who have not subscribed) + subscribed_customers - unsubscribed_customers(who subscribed once unsubscribed) you can change code $collection = mage::getmodel('customer/customer')->getcollection(); $collection->getselect()->joinleft(array('ns'=>'newsletter_subscriber'), 'ns.customer_id=e.entity_id', array('substatus'=>'ns.subscriber_status') ); foreach($collection->getdata() $customer){ if($customer['substatus']!=1){ print_r($customer); } } you can modify if condition per requirement.

wso2 - how to extend function in jaggery -

i have made emm works, , start mysql. i trying add more features, cache. if want add cache capability, put data memcached, how add new function? i have found source code of scriptableobject, log, database, file. can change files , recompile them, cannot put emm make run. because can find source code of org.jaggeryjs.hostobjects.db_0.9.0.alpha4_wso2v1.jar. , emm needs rg.jaggeryjs.hostobjects.db_0.9.0.alpha4_wso2v3.jar. i have tried search svn wso2. still cannot find 0.9.0.alpha4.wso2v3 source code. has idea it?

JavaScript closure inside loops – simple practical example -

var funcs = []; (var = 0; < 3; i++) { // let's create 3 functions funcs[i] = function() { // , store them in funcs console.log("my value: " + i); // each should log value. }; } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } it outputs this: my value: 3 value: 3 value: 3 whereas i'd output: my value: 0 value: 1 value: 2 the same problem occurs when delay in running function caused using event listeners: var buttons = document.getelementsbytagname("button"); (var = 0; < buttons.length; i++) { // let's create 3 functions buttons[i].addeventlistener("click", function() { // event listeners console.log("my value: " + i); // each should log value. }); } <button>0</button><br> <button>1</button><br> <button>2</button>...

php - Codeception - How to address a field with non-unique name -

i want test list of records codeception. have form , have unique rows this <tr id="row1"> <td class="description"> <input name="description" type="text" value="some text"> </td> </tr> <tr id="row2"> <td class="description"> <input name="description" type="text" value="some more text"> </td> </tr> so name of field same while id of row not. when try $i->fillfield("#row1 input[name='description']", "some other text"); it fails with field name, label, css or xpath '#row1 input[name="description"]' not found on page. i believe answer around corner struggling find it. hints or ideas? thanx, m! you use css selectors td:nth-child(1) or td:nth-of-child(1) . also beware (irc) phpbrowser can use fillfield on fields contained inside form.

ruby on rails - NoMethodError, undefined method 'bid' -

ive been trying call helper method controller on rails object , continue error. here code. class auctionscontroller < applicationcontroller helper_method :bid def bid @auction = @auction.update_attribute(:current_price == :current_price + 1.00) end view <%= link_to("bid", @auction.bid(auction) )%> stack trace started "/auctions" 127.0.0.1 @ 2014-11-11 05:46:16 -0600 processing auctionscontroller#index html auction load (1.7ms) select "auctions".* "auctions" rendered auctions/index.html.erb within layouts/spacelab (199.7ms) completed 500 internal server error in 234ms actionview::template::error (undefined method `bid' nil:nilclass): 26: <h3, class="textcolor"><%= auction.description %></h3><br /> 27: <h3, class="textcolor"><%= auction.start_time.strftime("opens on %b %d on %i:%m %p") %></h3><br /> 28: <h...

r - Error in IF statement -

i trying construct if statement calculate statement if divisor greater 0 , return 0 if not. i'm have curly braces in right places r keeps giving me warning message saying the condition has length >1 , first element used. i understand means r evaluting first statement , ignoring else bit, know data there 0 entries variable in if condition here current code if (contributions$memcontamt > 0) { contributions$contamtratio <- contributions$empcontamt/contributions$memcontamt } else { contributions$contamtratio==0 } thanks in advance i suppose you're looking for transform(contributions, contamtratio = "[<-"(empcontamt / memcontamt, memcontamt <= 0, 0))

linux - Signal generated for closing the window? -

i'm using centos 6.3(final) version. question signal generated on pressing close button window? close button equivalent alt-f4? or whole understanding wrong , centos not use signal model it's graphical windows? if possible please specify source of answer since need document it. thanks assuming talking @ x11 level here signal looking wm_delete_window or destroyrequest / destroynotify event. this has nothing (again @ x11 level) signal(2) or signal(7) . though entirely possible in circumstances (hung processes or similar) signals used terminate terminal process. it shell/etc. running inside terminal going receive various signals terminate operation.

syntax - Can I use arguments within the function definition? -

i wonder if following syntax correct sass: @function foo($param) { @return $param; } @mixin bar($paramone, $paramtwo: foo($paramone)) { test: $paramtwo; } #test { @include bar(foobar); } with expected return: #test { test: foobar; } doesn't seems work (as $paramone looses it's value ) when using following phpsass compiler sass/scss. this correct syntax? or i'm missing something? it's similar how it's in _vertical_rhythm.scss : @mixin adjust-font-size-to($to-size, $lines: lines-for-font-size($to-size), $from-size: $base-font-size) { it seems kind of syntax valid cimmanon posted on sassmeister gist (thanks) using ruby version of parser. other parsers have problem ( phpsass in case) depending how implemented logic. in case of issues, make sure you're using right parser scss syntax, not sass syntax ( wiki , e.g. new sassparser(['syntax' => 'scss']) ). see: what's difference between scss , sass? not...

Java: how can an impossible NullPointerException still occur? -

i've received following bug report our software: java.lang.nullpointerexception @ java.util.arrays.equals(unknown source) @ our.app.ourmain(ourmain.java:13) this happens jre 1.7.0_45 on windows corresponding source code of arrays.equals is: public static boolean equals(byte[] a, byte[] a2) { if (a==a2) return true; if (a==null || a2==null) return false; int length = a.length; if (a2.length != length) return false; (int i=0; i<length; i++) if (a[i] != a2[i]) return false; return true; } calling code is: final byte[] b1 = ... // populate array final byte[] b2 = ... // populate array final boolean equal = arrays.equals(b1, b2); there no way nullpointerexception raised here. how can still happen? bug report can considered trustworthy. this not intended answer, since it'll long comment... one question hasn't been asked yet is: when did problem start appearing? after spe...

multithreading - Safely close an indefinitely running thread -

so first off, realize if code in loop use do while loop check variable set when want thread close, in case not possible (so seems): dword winapi recv thread (lpvoid random) { recv(clientsocket, recvbuffer, recvbuflen, 0); return 1; } in above, recv() blocking function. (please pardon me if formatting isn't correct. it's best can on phone.) how go terminating thread since never closes never loops? thanks, ~p amongst other solutions can a) set timeout socket , handle timeouts correctly checking return values and/or errors in appropriate loop: setsockopt(clientsocket,sol_socket,so_rcvtimeo,(char *)&timeout,sizeof(timeout)) b) close socket recv(..) returning blocked state error.

web - CSS inheritance the right way -

i trying follow this link inheritance in css work. accepted answer assume works way. don't want have div layer use multiple classes(unless correct way) job done. <div class="bannermain shadowbanner" > div class bannermain has shadowbanner properties </div> what wrong i doing here ? div uses banner main should have been on top , 1 uses shadow main should have been @ bottom since using bottom: 50px; there. div class shadowbanner should have had shadow because defined in shadowbanner class. edit what want have 1 css class has basic , feel apply div layers on page. in case bannermain such class have applied div id=main. each other layer have contained in css class 'bannermain', plus whatever else defined in own specific class. in example above have applied css shadowbanner div id=withshadow the end result "main" div showing without shadow , no background color , "withshadow" div shown having black background ,...

php - Clear Laravel's orderBy -

i have generic function gives me generic querysets, like: class model extends eloquent { public static function get_queryset(){ $queryset = self::where('foo','=','bar'); // tons of stuff query , then... return $queryset->orderby('somefield'); } } this function used everywhere project, in specific point need use queryset changing order by, this: public static function get_specific_field(){ return self::get_queryset()->select('singlefield')->orderby('singlefield'); } if run code, order append onto previous , generate invalid query, since "somefield" not on selected fields. i.e.: select singlefield table order somefield asc, singlefield asc how clear orderby can reuse querysets? i agree there should clearorderby() method added query builder. because registry of orderbys public property on illuminate\database\query\builder can clear today. trick getting access base query object:...

python - 'latest' django model is not latest? -

using django 1.6: getting model db using latest returns model created date on instance returned lacks microseconds, means it's not latest, has same date stamp, microseconds included , therefore later (boolean comparison of datetime.datetime objects confirms it). what's going on? mymodel(models.model): <lots of fields> created = models.datetimefield(auto_now_add=true) and being retrieved with: latest = cls.objects.latest('created') and: latest.created datetime.datetime(2014, 11, 11, 17, 8, 43) yet: model_i_last_created.created datetime.datetime(2014, 11, 11, 17, 8, 43, 849155) update: create 3 models using .create 1 returned latest or last first 1 created, not last.

ruby - List of servers concatenated with domain name into one variable -

i'm looking, if possible, list of servers file , concatenate server names along domain name. possible take list , put 1 variable? here got , trying make variable or variables: servers = yaml.load_file "/etc/servers/servers.yml" clients = servers["client_servers"] domain=`hostanme -d` clients.each |d| cservers = [ d, domain ].join('.') end not sure how .each , join domain name in 1 line. i believe you're trying add subdomains domain, correct? if have hostname example.com , , list of subdomains, can join them so: hostname = 'example.com' servers = ['www', 'staging', 'm'] full_hosts = servers.map{|server| [server, hostname].join(.)} #=> ['www.example.com', 'staging.example.com', 'm.example.com'] the map method takes list, processes each item, , gives new list results. i've written more here: http://rubycuts.com/enum-map

How to load/import a text file with strange format in matlab -

i have extract data text file weird format matlab cannot since there text , functions know not work in case. data arranged in different sets (more 200) of 2000 values each. here how formatted data in text file : the first lines of set those @legend string 0 "partition= 1 excit= 1 near/far= 1" #legend string 0 "lab energy = 737.0000" @s0 linestyle 1 # theta sigma it11 t20 t21 t22 kyy projectile 0.1000e-01 1.000 0.1000e-01 1.000 0.2000e-01 1.001 0.3000e-01 1.001 this goes on , on until 19.98 0.1659 19.99 0.1654 20.00 0.1649 end the end text denotes end of set. then, new set begins @legend string 1 "partition= 1 excit= 2 near/far= 1" #legend string 0 "lab energy = 737.0000" @s1 linestyle 2 # theta sigma it11 t20 t21 t22 kyy projectile 0.000 26.40 ...

c# - Multiple object sets per type -

i have been trying scaffold usercontroller , views users. @ first, receive errors when scaffolding controller saying: "multiple object sets per type not supported." (this had applicationuser , user) trying scaffold controller in areas/admin. then followed post @ stackoverflow saying rename applicationuser class user, resulted in lots of errors. changed of references applicationuser user, still got same error. changed applicationuser, tried scaffolding again, in controllers (instead of in areas/admin). seemed work, until ran application. gives me exact same error. using system.data.entity; using system.security.claims; using system.threading.tasks; using microsoft.aspnet.identity; using microsoft.aspnet.identity.entityframework; namespace impher.models { // can add profile data user adding more properties applicationuser class, please visit http://go.microsoft.com/fwlink/?linkid=317594 learn more. public class applicationuser : identityuser { publi...

xcode - any lldb debug information in console -

i don't know why, today, crashing information not showing in debug console. can see sigabrt information crash. when crashing, "lldb" appear in console no more information. i check run scheme debug. others nslog information put in project display well, haven't information lldb debug. i force crash i.e. code: nsmutablearray *lsttest = [[nsmutablearray alloc] init]; nsstring *data = [lsttest objectatindex:0]; this issue have of project reason think properties of xcode change , don't know it. thanks! the next day problem disappeared , returned work fine xcode, including debugger...

Unable to save the plots in Octave using print and saveas command -

i using octave 3.6.4 on window 7, not able save 9 plots generated using octave scripts. using below commands save plots. though sometime able save plots saved plots same similar last plot generated script. why? pathfig = [path, '.png']; print(h, '-dpng', pathfig,'-r100'); saveas(h, pathfig, 'jpg'); since seemingly saving last plot generate, safe variable h assigned last plot. you need specify each figure want print. example, handle first figure, do: h1 = figure(1); to handle second figure: h2 = figure(2); and separately use h1, h2, etc. in separate calls saveas or print. how have done in past.

ios - UILabels in Custom UITableViewCell not rendering on screen -

Image
hello , thank help. have custom uitableviewcell , controller of class written in swift. of init functions being called on creation of cell on inspection in debugger of lables , 1 image view have added content view have frame of 0. here file containing tableview: class searchesmainviewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { @iboutlet var contenttableview: uitableview? var tableviewdata = searchesmaintableviewdata() required init(coder adecoder: nscoder) { super.init(coder: adecoder) } internal override init(nibname nibnameornil: string?, bundle nibbundleornil: nsbundle?) { super.init(nibname: nibnameornil, bundle: nibbundleornil) } override func viewdidload(){ super.viewdidload() self.navigationitem.title = "search" var nib = uinib(nibname: "singlesearchtableviewcell", bundle: nil) contenttableview?.registernib(nib, forcellreuseidentifier: singlesearchtableviewcellcontroller.reuseid()) } func ...

function which produces new static pointer in c -

can create function produces new static pointer @ each call? struct a{ //something } void function(){ struct a* head; //i want every time call function(); // create new static pointer }

ios - How to move a sprite using swipe gesture? -

how can move sprite left swiping left, move sprite right swiping right , on? like if swipe left, sprite moves 20 points left..i using spritekit , swift. thank you! @jonogilmour i have resolved in way: let right = skaction.movebyx(64, y: 0, duration: 0.6) let left = skaction.movebyx(-64, y: 0, duration: 0.6) let = skaction.movebyx(0, y: 64, duration: 0.6) let down = skaction.movebyx(0, y: -64, duration: 0.6) func swipedright(sender:uiswipegesturerecognizer){ player.runaction(right) } func swipedleft(sender:uiswipegesturerecognizer){ player.runaction(left) } func swipedup(sender:uiswipegesturerecognizer){ player.runaction(up) } func swipeddown(sender:uiswipegesturerecognizer){ player.runaction(down) } override func didmovetoview(view: skview) { let swiperight:uiswipegesturerecognizer = uiswipegesturerecognizer(target: self, action: selector("swipedright:")) swiperig...

How is Git repository better than TFS when the entire development team is sitting in one location? -

one of reason why linus torvalds created git developers distributed across wide area (in case, entire world) can work on repository @ same time (concurrently). can explain me benefits of git on tfs when entire team sitting in 1 location (one office) accessing code repository server on lan? there number of reasons use dvcs (like git) on svcs (like tfvc or svn). first me speed. actions taken against local copy of repo git out performs server bases source control order of magnitude few users. second workflow. in svcs branching expensive operation both slow , heavy weight. not need additional disk space need merge beast too. in git branching local, cheap, , quick merge. nit uncommon coder create branch each feature or task want perform locally. should have @ git flow successful mechanism developing in git. http://nvie.com/posts/a-successful-git-branching-model/ there lots of other cool thing, favorites. have @ http://www.git-scm.com/about full set of core features. ...

Writing protocol buffer data in C++ and reading in Java over AMQP/JMS -

so i'm bit stumped on this. i've got amqp class implementation on c++ side serializes porotocol buffer object string: qpid::messaging::message qmesg; std::string msgstr; protomessage.serializetostring(&msgstr); qmesg.setcontent(msgstr); //proceed send message the message body set this, , content type binary. on java side, we're reading bytes in jmsbytesmessage object, trying parse data protocol buffer object: jmsbytesmessage msg; //assume in proper context protomessage.parsefrom(msg.getdata().array()); i've tried: byte[] bytearr = new byte[] msg.readbytes(bytearr); which gives same. when log byte data, see byte values (using array.tostring(byte[]), code above on java side throws invalidprotocolbufferexception: com.google.protobuf.invalidprotocolbufferexception: protocol message contained invalid tag (zero). i'd assume since it's byte data, it's anonymous character encoding. missing obvious? also, please refrain alternative im...

c# - Async methods on Sap .Net Connector 3 -

i'm using sap .net connector 3.0.0.42 in c# .net v4.5 applications. far, can use no problems this: var destination = rfcdestinationmanager.getdestination(destinationname); var repository = destination.repository; var function = repository.createfunction(functionname); function.invoke(destination); var resulttable = function.gettable(tablename); //this can time consuming sometimes, there calls time consuming , because io bound operations want make async , not blocking thread while waiting complete, sap .net connector doesn't expose async methods (as far know). i read producing async/await methods , task-based async pattern , use need low level async methods propagate up, right? instance, changing thread.sleep task.delay . but, if there no such methods? my first thought use task.run read it's cpu bound operations, , using it'll pick thread , block it, it's not async . also, if develop asp.net app take thread pool, isn't it? so, question if it p...

node.js - nodejs Eclipse debugger: how to specify arguments? -

Image
i need launch eclipse nodejs debugger specification of argument. launching nodejs application commmand line done follows: node myapp.js argumentvalue the value of argument accessible inside app using following: process.argv[1] i don't know how add argument value when launching application through eclipse debugger. i found solution modification of nodejs app debug configuration. in eclipse choose menu run>debug configurations choose application script under node application block, should see: now select arguments tab: insert value of argument , press apply.

Merging two arrays without changing key values by keeping array php -

i have tree arrays in php shown in code <?php //old array $oldarray = array(0 => 11, 1 => 18, 2 => 29, 3 => 35, 4 => 40); // held values $hold = array( 1 => 18, 3 => 35); // new random generated array $newvalues = array( 0 => 27, 1 => 31, 2 => 38); //i need keep keys (order, index) of $hold values newarraymergedpushed = array(0 => 27, 1 => 18, 2 => 31, 3 => 35, 4 => 38); ?> i need keep order of $hold array in same order,index in $oldarray. function can use in php following output obtained without changing key values? if i'm guessing want correctly, it's better operate directly on array want change rather creating range first , trying mix them in. hold indexes want keep in lookup table, loop on table , replace key=>values aren't held. $oldarray = array(0 => 11, 1 => 18, 2 => 29, 3 => 35, 4 => 40); $hold = array( 1 => true, 3 => true); for( $i = 0; $i < count($oldarray); $...

android webview CustomView onHideCustomView nullpointerexception -

hi i'm making android web view app have error. how can fix error?? please me. webview mywebview; private mywebchromeclient mwebchromeclient = null; private view mcustomview; private relativelayout mcontentview; private framelayout mcustomviewcontainer; private webchromeclient.customviewcallback mcustomviewcallback; framelayout.layoutparams layoutparameters = new framelayout.layoutparams(framelayout.layoutparams.match_parent, framelayout.layoutparams.match_parent); ... private class mywebchromeclient extends webchromeclient { public void onhidecustomview() { if (mcustomview == null) { return; } else { getwindow().setflags(windowmanager.layoutparams.flag_force_not_fullscreen,windowmanager.layoutparams.flag_force_not_fullscreen); // hide custom view. mcustomview.setvisibility(view.gone); // remove custom view container. mcustomviewcontainer.removeview(mcustomview); ...

javascript - Scroll or slide functionlity in ionic framework -

i have tried below scroll/slide not working. <ion-slide-box show-pager="false"> <ion-slide ng-repeat="at in assets" ng-init="updateslider()"> <div class="home-box">{{at.asset_name}}</div> </ion-slide> </ion-slide-box> in above code can display 1 div per 1 slide. want display divs(2-3) per width. scroll. tried ion-scroll also, not working. there javascript or angular directive use in case? or working code available in jsfiddle or codepen?

python 2.7 - TypeError: Invalid background RGBA argument -

i moved yesterday windows xp sp3 windows 7 ultimate.i had few python 2.7 files working test(my first game) witch build , compiled fine on windows xp. after installing windows 7,i did uninstall , install python 2.7 , pygame , set path python , works in win cmd.but now,the same files not compile on windows 7,giving me error:'typeerror: invalid background rgba argument'.this error showed in line of code: greetings = myriadprofont.render('hello:', 1, (0,0,255),none) this first time in game font renderer called.as said,it compiled fine in win xp now...i did google search , not find useful,just discussion , no answers(just sugestion value none not accepted background , should remove it,which couldn't because message box appeared saying '[errno13] permission denied 'c:/ste/classes.py' ).help! i made work without modifying in code. it's before installed windows 7 (when had windows xp sp3) believe installed pygame windows python 2.7.8 htt...

sql - Loading all columns of CSV into Oracle table in bulk -

i'm trying load columns csv oracle table. columns between 2 match. trying make query dynamic use load data csv matching table, therefore, want avoid naming columns names (the jobcounter column should replaced wildcard (if there's any). i'm not sure if right way. load data infile 'c:\users\theuser\documents\20121017.csv' append table srt_factor_20121017 fields terminated ',' optionally enclosed '"' ( jobcounter //* want replace asterisk include columns ) at moment, i'm getting following error when using oracle sql developer: error @ command line : 217 column : 5 error report - sql error: ora-00928: missing select keyword 00928. 00000 - "missing select keyword" *cause: *action: any ideas? the fact cannot load columns matching table via sql*loader. fields defintion must exact.

SurveyMonkey survey as in-page overlay/modal/lightbox -

i've searched surveymonkey website, both help... , developer..., general net , stackoverflow, , can't find examples of surveymonkey survey being displayed in in-page overlay (referred "lightbox" or modal). i think need use surveymonkey's embed option, opposed invitation or survey popups: http://help.surveymonkey.com/articles/en_us/kb/how-do-i-embed-a-survey-or-have-it-open-in-a-popup-window-on-my-site i'd overlay div appear, close, etc upon same triggers regular survey would/could, open if user has no previous surveymonkey cookie, close when completed or closed user, etc. i can hack through solution forcing survey custom overlay build, behaviors more tricky, having read surveymonkey cookie, suppose. or, perhaps check ids of surveymonkey content exists @ various stages pull off behaviors (but i'll have @ generated code throughout process know if option). in short, seems else has surely run issue before , solution has been created, @ least pa...

How shadowsocks-android installed share to other? -

a android phone installed shadowsocks app,then,how share other phone or computer?like fqrouter2 http proxy,it can use http proxy share others!so,in shadowsocks-android? ths y help! config local port lan users, default 1080. users in lan have set proxy seting ip:port. pc client support pac optional proxy, don't know, mobile client support.

hadoop - Insert overwrite partition in Hive table - Values getting duplicated -

i created hive table non-partition table , using select query inserted data partitioned hive table. refered site by following above link partition table contains duplicate values. below setps this sample employee dataset: link1 i tried following queries: link2 but after updating value in hive table, updating salary of steven employeeid 19 50000. insert overwrite table unm_parti_trail partition (department = 'a') select employeeid,firstname,designation, case when employeeid=19 50000 else salary end salary unm_parti_trail; the values getting duplicated. 7 nirmal tech 12000 7 nirmal tech 12000 b nirmal placed in department a duplicated department b . am doing wrong? please suggest. it seems forgot clause in last insert overwrite: insert table unm_parti_trail partition (department = 'a') select employeeid,firstname,designation, case when employeeid=19 50000 else salary end salary unm_parti_trail ...

How to restart java program if JVM crashes -

i working on low configuration machine , jvm crashes sometimes. the java application name application.jar, plays hd video local streaming servers. application running on embeded win7 touch computer, hanged in lounge. some time heap size exceeds , error out of memory the jvm shuts down. i want restart application.jar whenever jvm crashes. it possible. how? thanks. edit: wrapping try catch not work jvm crashed. have used -xms512m -xmx1024m while running jar file. crash frequency got lower still remains. if need auto restart can wrap application demonization tool daemon . has --respawn parameter.

java - Richfaces in netbeans with maven -

i trying implement richfaces javax.faces-war-archetype version 2.2 in netbeans 8.0.1 , glassfish 4.1. i have existing project richfaces implemented, if build works fine. however when create new project (the exact same type , version) gives following error: type exception report messageinternal server error descriptionthe server encountered internal error prevented fulfilling request. exception java.lang.illegalstateexception even when literally copy pom.xml , web.xml working project new project still gives error. the web.xml: <?xml version='1.0' encoding='utf-8'?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <display-name>test</display-name> <context-param> <description> te...

arrays - I am using PHP and I have a backend form where the user must enter a letter using -

i have backend form user must enter letter using centurion letters such arestu. have posted word on php life , have used is_numeric function make user user enters word , not aa number. i know want able convert word uppercase. need find length of word user has entered have done using strlen function. know have give each letter value such = 1, b = 2, c = 3 etc. i need check each letter in turn see letter user has used letters given. if user uses letter not in word letter not given value. want able display display each letter of word value. here example of want like if user enters word 'are' a= 1 r= 18 e= 5 total letter number 24 here code have far, code gets word user enters post, displays word , shows number of letters in word. <? php $word = $_post["word"]; $product = 1; strtoupper($word); print "$word <br> "; if (is_numeric($word)) { print "please enter word"; } $test = strlen($word); print "number ...

git - My commits are deploying changes only once after i clone the repo -

whenever push commit goes bitbucket not make changes on website. whenever delete repo in sourcetree , reclone it, makes changes when next commit. cant delete , re-clone every time in sourcetree please help. here log 2014-11-11 10:45:13-08:00 --- info: attempting deployment... 2014-11-11 10:45:13-08:00 --- info: changing working directory... 2014-11-11 10:45:14-08:00 --- info: reseting repository... head @ a665bed no message 2014-11-11 10:45:25-08:00 --- info: pulling in changes... head @ a665bed no message updating a665bed..94cd5b5 fast-forward img/bg_vip.jpg | bin 105494 -> 285014 bytes index.php | 2 +- vip/index.php | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) 2014-11-11 10:45:25-08:00 --- info: securing .git directory... 2014-11-11 10:45:25-08:00 --- info: updating wordpress database... 2014-11-11 10:45:25-08:00 --- info: deployment successful. 2014-11-11 22:11:24-08:00 --- info: attempting deployment... 2014-11-11 22:11:24-08:00 --- in...

ruby on rails - No route matches [GET] error bluehost -

Image
i know basic stuff i'm not sure why i'm getting type of error.it's driving me nuts.we moved our site bluehost site5 ,i did config setting there i'm getting no route matches [get] error. link : http://xxx.xx.xx.xx/~fuegotic when call link message shows app_config.yml development: &local site_name: site name site_url: http://xxx.xx.xx.xx/~fuegotic app_url: http://xxx.xx.xx.xx/~fuegotic/appfolder/app/assets/images/ js_url: http://xxx.xx.xx.xx/~fuegotic/appfolder/app/assets/javascripts/ css_url: http://xxx.xx.xx.xx/~fuegotic/appfolder/app/assets/stylesheets/ upload_url: http://xxx.xx.xx.xx/~fuegotic/appfolder/public/ folder: appfolder production: <<: *local staging: <<: *local test: <<: *local routes.rb has following line root :to => 'home#index' rails -v rails 3.2.13 ruby -v ruby 2.1.4p265(2014-10-27 version 48166)[x86_64-linux] rake routs has following route root / ...

mysql - Laravel database cache -

i'm working on ecommerce website, in each page of site, there's header contains shopping cart information, each time page header has shopping cart in loads, database gets hit. wonder if can use database cache technique reduce query times? if nothing's changed, not fetch data database unless new product(s) added shopping cart? sure can, sounds bad idea , disencourage because cache shared whole application , shopping cart information related single user. kind of user specific information better leverage cookies or session. anyway, here have. didn't provide code sample made generic. trick add cache key makes unique each user (such model primary key) , after adding/removing product to/from cart clear cache using previous cache key. // code current user shopping cart (the 1 shown in header) $cart = cart::where('user_id', $user_id = auth::user()->getkey())->remember(60*2, "cartofuser$user_id")->get(); // code adds product cart cart...

php - Image resizing without deformation -

i'm trying create thumbnail gd library, thumbnail distorted. want cut image starting center respecting new resolution , losing old proportion. what i've tried: $im = imagecreatefromjpeg($target_file); $n_width = 500; // fix width of thumb nail images $n_height = 500; // fix height of thumb nail imaage $width = imagesx($im); // original picture width stored $height = imagesy($im); // original picture height stored $newimage = imagecreatetruecolor($n_width, $n_height); imagecopyresampled($newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height); $thumb_target = $target_dir . $filename_without_ext . '-thumb.' . $params['file_ext']; imagejpeg($newimage, $thumb_target); chmod("$thumb_target", 0777); tried change imagecreatetruecolor imagecrop still not behavior want. please let me know if not clear enough. solved using imagemanipulator library. found solution in this answer . my final code: $im = new imagemanipulator($tar...

Add custom button in install4j -

is possible add custom button (say, retry one) on configurable form, have placed on bottom controls, next next , buttons? as of 6.x, not possible customize navigation bar or arbitrary screen buttons @ bottom of installer window. if write own custom screen api, can override hasdefaultbuttons() , provide navigation controls yourself. move next , previous screen, call context.getwizardcontext().pressnextbutton() or context.getwizardcontext().pressnextbutton() . cancel, call context.getwizardcontext()().presscancelbutton()

Why html constructed by jquery show different from the original html? -

i have html file, this: <!doctype html> <html> <head> <script src='jquery.js'></script> <style> .some_list li { display: inline-block; } </style> <script> $(function() { $('#wrapper').append("<ul class='some_list'><li>a</li><li>b</li></ul>") }); </script> </head> <body> <div id='wrapper'> <ul class='some_list'> <li>a</li> <li>b</li> </ul> </div> </body> the result this: a b ab the 2 ul take same css effect, show differently. why happened? display: inline-block; has small bug, can not let 2 tags .li without space otherwise join. put space between li tags: $(function() { $('#wrapper').append("<ul class='some_list'...

c - How to read an array and analyse the input -

i wondering there way read array , based upon letters entered something? like example: if roman numeral; mm entered there way see 2 m's entered , display value m? output be: 1000+1000. could tell me name of function, because assignment dont want doing me, dont know start from. example: char romannumerals[2] = {"mmmcmxcviii"}; char romannumerals[2] = {"mmmcmxcviii"}; is not right can hold 1 element(+1 \0 ). change to char romannumerals[] = "mmmcmxcviii"; the compiler choose correct size array when doing above initialization. then,you need variable add sum of each roman number. create int sum=0; and need loop length of array times want check each letter. int i,len=strlen(romannumerals); for(i = 0;i < len;i++) { //body of loop } string.h should included in order use strlen function returns length of string. now,check each letter inside body of for loop using if(romannumerals[i]=='m') sum=sum+1000;...

html - Last child not working as expected with p tag -

i have issue using :last-child class p tag, works fine other classed p tags, here's code: <div class="port-container"> <div class="header"><h1>portfolio</h1></div> <p class="header" ref="who">who i?</p> <p class="info" ref="who">...</p> <p class="header" ref="what">what do?</p> <p class="info" ref="what">...</p> <p class="header" ref="projects">current projects?</p> <p class="info" ref="projects">...</p> <p class="header" ref="conntact">contact me</p> <p class="info" ref="conntact">...</p> </div> <img class="bg-button pull-center" bg-toggle="false" src="./assets/icon-bg_white.png" title="toggle...

python - AUTH_USER_MODEL refers to model that has not been installed -

i getting error improperlyconfigured @ /admin/ auth_user_model refers model 'ledger.user' has not been installed i getting on production server. not when run things via localhost. first when making request. thought database must out of sync deleted tables , ran manage.py syncdb. now, seems have propogated , going admin throws error. i have never seen error before , can't figure out deal is. have defined auth_user_model in settings.py: ... installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'ledger', 'extension', 'plugin', 'social.apps.django_app.default', ) auth_user_model = 'ledger.user' ... models.py: ... class user(abstractuser): def __unicode__(self): return self.username balance = mo...

rest - Restlet use of Android intents -

i tried find answer question without success, please excuse me if trivial question.... i managed add restlet server existing android application. works well, serving get/put/post request needed. problem on selected post request have start android activity or send message activity. not find way it. android context not available within serverresource, cannot use intents, , messages. the best send intents (broadcast message), can use communication. any welcome! thanks

.htaccess - HTAccess 301 Redirect Issue with Coldfusion URLs -

our web team rebuilt coldfusion site , setting redirects. the first redirect of main inventory works fine when try redirect each make in second 1 redirects http://domain.com/inventory/pre-owned.php/make/carmake/ basically first redirect overriding second , replacing part of url. i think may issue file index.cfm being cutoff point. redirect 301 /folder/index.cfm http://domain.com/inventory/pre-owned.php redirect 301 /folder/index.cfm/make/carmake/ http://domain.com/inventory/pre-owned.php?sort=&make=make&model=&year= is there way give 1 redirect priority on or solve problem? thanks! edit: have sworn answer below worked yesterday, it's not. strange thing is, have 2 lines this: redirect 301 /new/index.cfm/page/testdrive/ http://domain.com/info/schedule-test-drive.php redirect 301 /new/index.cfm http://domain.com/inventory/new.php and these work perfectly. just rearrange rules : redirect 301 /folder/index.cfm/make/carmake/ /inventory/pre-...

rust - Trying to implement core::fmt::Show -

i trying implement core::fmt::show binary tree. implement code : impl<t: partialeq + partialord + show> show node<t> { fn fmt(&self, f: &mut formatter) -> result<(), &str> { match self.left { some(ref x) => {x.fmt(f);}, none => {} }; match self.value { some(ref x) => { write!(f, "{}", x.to_string().as_slice()); }, none => {} }; match self.right { some(ref x) => {x.fmt(f);}, none => {} }; ok(()) } } but compiler throw following error : compiling binary_tree v0.0.1 (file:///home/guillaume/projects/binary_tree) src/binary_tree.rs:60:2: 77:3 error: method fmt has incompatible type trait: expected enum core::fmt::formaterror, found &-ptr [e0053] src/binary_tree.rs:60 fn fmt(&self, f: &mut formatter) -> result<(), &str> ...

list - Issue overriding __get__ in Python -

i have class: from collections import userlist class itemlist(userlist): data = [] def __init__(self, contents): self.data = contents def __get__(self, index): result = list.__get__(self, index) if type(result) list: if len(result) > 1: return itemlist(result) else: return result it seems in case get isn't being called when index instance of itemlist class. i'm trying return new instance of itemclass if result of index returns more 1 item (a list). expect this: >>> il = itemlist(contents) >>> type(il[1:3]) <class 'itemlist'> but i'm getting this: >>> il = itemlist(contents) >>> type(il[1:3]) <class 'list'> what doing wrong? i think want more following: class itemlist(userlist): data = [] def __init__(self, contents): super().__init__() self.data = contents def __ge...

php - MySQLi Dynamic Prepared Statements -

i'm trying create dynamic function execute mysqli queries. here example of regular query: public function myfunc() { $name = "ryan"; $stmt = $this->db->prepare("select name, age, id users name = ?"); $stmt->bind_param( "s", $name ); $stmt->execute(); $stmt->bind_result( $name2, $age, $id ); while( $stmt->fetch() ) $users[] = array( 'name' => $name2, 'age' => $age, 'id' => $id ); $stmt->close(); return $users; } i trying along lines of: public function query( $myquery, $params, $types, $returns ) { $stmt = $this->db->prepare( $myquery ); $stmt->bind_param( $types, $params ); $stmt->execute(); $stmt->bind_result( $returns_array ); $i = 0; while( $stmt->fetch() ) { $users[] = array( $returns[$i] => $returns_array[$i++], .... ); } $stmt->close(); return $users; } where dynamically ...

python - calculating coverage of a scrapy webspider -

i writing web spiders scrap products form websites using scrapy framework in python. wondering what's best practices calculate coverage , missing items of written spiders. what i'm using right logging cases that's unable parse or raises exceptions. example that: when expect specific format price of product or address of place , find written regular expressions doesn't match scrapped strings. or when xpath selectors specific data returns nothing. sometimes when products listed in 1 page or multiple ones use curl , grep calculate number of products. wondering if there's better practices handle this. the common approach is, yes, use logging log error , exit callback returning nothing. example (product price required): loader = productloader(productitem(), response=response) loader.add_xpath('price', '//span[@class="price"]/text()') if not loader.get_output_value('price'): log.msg("error fetching pro...

Redis atomic transaction to search by intersectioning set and use returned data to update -

redis experts, want search idle data type resource , mark not idle, in 1 command (atomic). i using redis keep tab of active resources different type. how should approach problem of mine, need hash data querying field values, i've created own set , using sinter , update flag in use. reference how filtering in redis using set http://robots.thoughtbot.com/redis-set-intersection-using-sets-to-filter-data let's want find id of 1 idle resource type x , attribute a, query using intersect on type set , attribute a. using command sinter s:type:x s:attribute:a s:active:false . return id of resource #400, want use number hgetall , update active become true, ( hgetall s:resource:400 ). and need atomic. right i'm still trying in multi/exec. please advice if there easier way. use lua scripting. it's scripting language redis uses. can load script redis , execute script atomically. lookup eval, script load, , evalsha commands of redis , search "lua script ...

reporting services - Recieving Error Viewing Reports in Report Manager -

i receiving following error trying view report in report manager , reporting services: " your browser not support scripts or has been configured not allow scripts" have ensured scripting enabled , added site trusted sites , still not work. missing? using sql server 2008 r2. reports work fine in test windows application, not in browser. can see header , footer of report , toolbar, body empty. it's when select view source see error. here complete error when view source: <div> browser not support scripts or has been configured not allow scripts. <span id="ctl31_reportviewer"> <div id="ctl31" onclick="if ($get('ctl31_ctl04') != null &amp;&amp; $get('ctl31_ctl04').control != null) $get('ctl31_ctl04').control.hideactivedropdown();" onactivate="if ($get('ctl31_ctl04') != null &amp;&amp; $get('ctl31_ctl04').control != null) $get('ctl31_ctl04').control....