Posts

Showing posts from January, 2012

c# - SSH.NET getting entire output from a shellstream -

ive encountered quite strange phenomenon; when using client.runcommand() function, entire output switch, when using own implementation: sshclient cl = new sshclient(ip, username, password); cl.connect(); shell = cl.createshellstream("tail", 80, 24,800, 600, 1024); streamwriter wr = new streamwriter(shell); streamreader rd = new streamreader(shell); wr.autoflush = true; wr.writeline("show int status"); string rep = shell.expect("switch_wan#", new timespan(0,0,3)); messagebox.show(rep, "output"); i partial output, , prompt saying --more-- how can entire output switch? an example partial output: show int status port name status vlan duplex speed type fa0/1 team7 connected 97 a-full a-100 10/100basetx fa0/2 team7 connected 97 a-full a-100 10/100basetx fa0/3 team7 connected 97 a-full a-100 10/100basetx fa0/4 team7 connected 97 a-full a-100 10/100basetx fa0/5 ...

oracle - Effect of adding new columns to existing table -

in project there new requirement, in i've add 2 new columns existing table. how can analysis effect of adding 2 new columns table? please note: find dependencies using all_dependencies view , have used all_source find few more information. could please guide me right approach follow in project? edit1: question attracted negative points. improve according suggestion. adding column not impact view/triggers/procedures, if developers have used proper column names in them. if used select * your_table in of view/procedure/triggers, might in trouble. you on right path. check dba_source properly. table name schema1.table1 , search in all_source using where upper(text) '%table1%' also if there dblink in other databases database, might need take care of too.

linux - how can i find my public facing ip from python program not proxy -

i want find public ip adress python program. so far site http://www.whatismyip.com/ , http://whatismyip.org/ which gives ip without proxy rest give proxy. now .org site using image , first 1 writes ip across many span elements can't grab urllib. any other idea or site can ip i use http://httpbin.org/ : import requests ip = requests.get('http://httpbin.org/ip').json()['origin']

ruby on rails - Not all member routes get an id in the querystring -

some member routes specific names not added expected :id inside query string. these routes: resources :tests member :foo end end resources :contacts member :foo end end resource :tasks member :foo end end resource :fruits member :foo end end resource :cars member :foo end end resources :appointments member :foo end end produces this: foo_test /tests/:id/foo(.:format) tests#foo foo_contact /contacts/:id/foo(.:format) contacts#foo foo_tasks /tasks/foo(.:format) tasks#foo foo_fruits /fruits/foo(.:format) fruits#foo foo_cars /cars/foo(.:format) cars#foo foo_appointment /appointments/:id/foo(.:format) appointments#foo tasks, fruits , cars not have id. why that? your problem in resource (singular) vs r...

objective c - iOS whose view is not in the window hierarchy -

while moving passcode controller otp viewcontroller, iam getting following error in console: warning: attempt present < otpcontroller: 0x1e56e0a0 > on < passcodecontroller: 0x1ec3e000> view not in window hierarchy! this code i'm using change between views: uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; otpviewcontroller *lotpviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"otpviewcontroller"]; lotpviewcontroller.comingfromreg = true; [self presentviewcontroller:lotpviewcontroller animated:yes completion:nil]; i presenting passcode controller registrationviewcontroller: uistoryboard* storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; passcodeviewcontroller *passvc = [storyboard instantiateviewcontrollerwithidentifier:@"passcodeviewcontroller"]; [self presentviewcontroller:passvc animated:ye...

How can I block all IP's, but allow 1 server ip in .htaccess -

i'm trying deny requests sent website, allow 2 ip-addresses. i've learned should done .htaccess. basically there 3 modules: website server, form-handling server , own network ip. let's appoint following ip addresses servers: website server: 1.1.1.1 form-handling server: 2.2.2.2 own network: 3.3.3.3 the .htaccess placed in public_html directory of form-handling server (2.2.2.2). now, works: order deny,allow deny allow 3.3.3.3 the form-handling server accessible own browser, form post request sent website blocked. (which good, in case) but when edit .htaccess following, form post request still blocked: order deny,allow deny allow 1.1.1.1 allow 3.3.3.3 to make sure .htaccess functional tried: order deny,allow deny allow 1.1.1.1 now cannot reach form-handling server. proves .htaccess 'running'. (also, website server cannot access server tho..) how can achieve website server has access form-handling server (and preferab...

scala - how to create update slick multiple row? -

i have code !! code insert multiple row.. def insertdocsetting(data: list[modeldocumentsetting]) = documentsettingtable ++= data and update multiple row!! def updatedocsetting(data: seq[modeldocumentsetting])= { (a <- data){ documentsettingtable.filter(_.doc_proc_list_id === a.doc_proc_list_id).update(a) } } but ,i have problem result.. how create slick update multiple row you need map result of filter tuple before can update it. can check how in documentation . like: def updatedocsetting(data: seq[modeldocumentsetting])= { (a <- data){ documentsettingtable .filter(_.doc_proc_list_id === a.doc_proc_list_id) .map(doc => (doc.element1, doc.element2)) .update(("new element1", "new element2")) } }

r - Can we make prediction with nlxb from nlmrt package? -

i'm asking question because couldn't figure out why nlxb fitting function not work predict() function. i have been looking around solve far no luck:( i use dplyr group data , use do fit each group using nlxb nlmrt package. here attempt set.seed(12345) set =rep(rep(c("1","2","3","4"),each=21),times=1) time=rep(c(10,seq(100,900,100),seq(1000,10000,1000),20000),times=1) value <- replicate(1,c(replicate(4,sort(10^runif(21,-6,-3),decreasing=false)))) data_rep <- data.frame(time, value,set) > head(data_rep) # time value set #1 10 1.007882e-06 1 #2 100 1.269423e-06 1 #3 200 2.864973e-06 1 #4 300 3.155843e-06 1 #5 400 3.442633e-06 1 #6 500 9.446831e-06 1 * * * * library(dplyr) library(nlmrt) d_step <- 1 f <- 1e9 d <- 32 formula = value~ps*(1-exp(-2*f*time*exp(-d)))*1/(sqrt(2*pi*sigma))*exp(-(d-d...

c# - Insert value into non-identity key field : DB First -

ran small problem while working on ef 6 database first approach . when try insert value key field of table not set identity, receive following exception: cannot insert value null column 'emp_main_id',column not allow nulls. insert fails. statement has been terminated. i added following code in entity class avoid error [key] [databasegenerated(databasegeneratedoption.none)] public int emp_main_id { get; set; } but still not working. below script create db table create table [dbo].[employeesmain] ( [emp_main_id] int not null, [emp_main_first] nvarchar (40) not null, [emp_main_middle] nvarchar (40) null, [emp_main_last] nvarchar (40) not null, [emp_main_dob] date not null, [emp_main_gender] int default ((1)) not null, [emp_main_type] int default ((0)) not null, [emp_main_email] nvarchar (150) not null, [emp_main_passwo...

java - Searching google programatically without ajax -

apparently google retired ajax api have been using in java android, dug through new api page can't find seems work in java, or non-web language matter. this had previously: @override protected string doinbackground(string... query) { try { bufferedreader reader = new bufferedreader(new inputstreamreader(new url("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" + urlencoder.encode(query[0], "utf-8")).openstream())); stringbuilder sb = new stringbuilder(); string line = null; while ((line = reader.readline()) != null) { sb.append(line).append("\n"); } reader.close(); return sb.tostring(); } catch(exception e){e.printstacktrace(); return "failed anything"; } } simply put, string supplied, , appended ajax search. results, in json form, processed string builder , returned whole string. if attempt now, returns result: {"r...

c# - Change Error response in web API -

i'm using token based authentication in web api application. in login request, if user enter wrong credentials, return response error in format. in grantresourceownercredentials method if (user == null) { context.seterror("the email or password incorrect."); return; } which return response as { "error": "invalidlogin", "error_description": "the email or password incorrect." } and in application error response returned in format { "message": "some internal server error occurred." } so how can change error response of web api { "message": "the email or password incorrect." } edited : try this string jsonstring = "{\"message\": \"the email or password incorrect.\"}"; context.seterror(new string(' ',jsonstring.length-12)); context.response.statuscode = 400; context.response...

asp.net - I am trying to create a User , all is working , object is getting the data but obj.saveChanges() is not working -

following exception occuring while saving changes "an exception of type 'system.data.entity.validation.dbentityvalidationexception' occurred in entityframework.dll not handled in user code" this image of createuser action actually should see errors if drill array in visual studio during debug. can catch exception , write out errors logging store or console. here sample code check field has not been validated. try { // code... context.savechanges(); } catch (dbentityvalidationexception e) { foreach (var eve in e.entityvalidationerrors) { console.writeline("entity of type \"{0}\" in state \"{1}\" has following validation errors:", eve.entry.entity.gettype().name, eve.entry.state); foreach (var ve in eve.validationerrors) { console.writeline("- property: \"{0}\", error: \"{1}\"", ve.propertyname, ve.errorme...

trigger.io - Force Close forge.request.ajax -

i writing app allows file upload our server. give users option stop file upload once has started. since file being sent via forge.request.ajax, process runs in background if user leaves upload screen. is there native way of closing active forge.request.ajax connection?? my application allows users send file our server via forge.request - need able cancel request - have suggestions how go this?? currently, no: although "cancel" messages passed through js / native communication bridge, haven't got logic in native code abort partially-sent requests. i don't think there's in java.net.* support sort of interaction either...

google analytics - Best way to exclude traffic from homepage to app? -

i need set filter (or segment) excludes web app traffic. on our site have button on top right takes visitor portal.domain.com web app hosted. i need ga view shows me traffic in have not clicked button , gone on use web app. whats best way of setting up? thanks add filter exclude, campaign source , set domain. remove hits in view came url.

php - Uninitialized string offset: 0, why? -

<< error message >> severity: notice message: uninitialized string offset: 0 filename: controllers line number: 192 this error message encountered. , below controller , model files. // controller file $user = $this->user_model->getbymail(array('total_mail' => $mail_auth)); if($user = '') { $this->load->helper('url'); redirect('/'); } else if($this->encrypt->decode($user['password']) == $password_auth) // line 192 { if($user['verified'] == 'n') { $this->session->set_flashdata('message', 'wront inputs.'); $this->load->helper('url'); redirect('/'); } } else { $this->session->set_flashdata('message', 'wrong inputs'); $this->load->helper('url'); redirect('/'); } } ...

qt - Set an Icon in QMenu with Stylesheet? -

how can set icon qaction in qmenu through stylesheet? for example: qmenu* menu = new qmenu(); qaction* action1= new qaction(); qaction* action2= new qaction(); menu->addaction(action1); menu->addaction(action2); now want set different icon action1 , action2 qt stylesheet. is possible stylesheet? stylesheets apply widgets. qt style sheets powerful mechanism allows customize appearance of widgets , in addition possible subclassing qstyle. qaction not widget, can't add icon qaction via style sheets. however, have shot qactionwidget , example qlabel , if can tricky.

admob - Google DoubleClick missing ads for iOS -

i'm using google doubleclick retrieving banner ads. have dfp account registered ads work (tested using html page). when using code: self.bannerview.adunitid = @"/36564804/app_banner_320x60"; self.bannerview.rootviewcontroller = self; dfprequest* request = [dfprequest request]; [self.bannerview loadrequest:request]; i receive following error in debug console: <google> test ads on device, call: request.testdevices = @[ @"297188a8e20f1d7405897fdfbe5fe7a0" ]; after setting test device: request.testdevices = @[ @"297188a8e20f1d7405897fdfbe5fe7a0" ]; i receive dummy ads (like doubleclick google directs developers.google.com). how can display real ad on device ? kind regards, dan

java - How to get data fron beanclass in springMVC? -

how data beanclass in springmvc? trying got error. in spring mvc didnt data bean class this bean class public class emailbean { private long id; private string from; private string to; private string subject; private string content; private string status; //getter , setter } this email sender public class emailsender extends thread { private emailbean eb; public emailbean geteb() { return eb; } public void seteb(emailbean eb) { this.eb = eb; } public void run() { sendsingleemail(eb); } public static void sendsingleemail(emailbean eb) { system.out.println(eb.getto()); system.out.println(eb.getsubject()); system.out.println(eb.getcontent()); } } this main class public class testmail { public static ...

Docker config file location on windows to, e.g., enable insecure registry / docker options -

i want add insecure-registry testing purposed on windows (10) machine docker . unfortunately not able find information usual /etc/docker/default config file located on windows . is here able add docker options on windows ? cheers. (the error when trying pull insecure registry without adding options is: "failed tls handshake x.x.x.x cannot validate certificate x.x.x.x because doesn't contain ip sans" ) update1 i did find way looks promising: edit c:/users/username/.docker/machine/default/config.json add registry : "insecureregistry": ["x.x.x.x:port"] restart docker (?) docker-machine.exe restart default but error: "get https://x.x.x.x:port/v1/_ping : x509: cannot validate certificate x.x.x.x because doesn't contain ip sans" ( https://akrambenaissi.com/2015/11/17/addingediting-insecure-registry-to-docker-machine-afterwards/ ) update2 after restarting windows worked: i received "unauthorized: authenticat...

c++ - Unhandled enum class value in switch() - Exception or Assert? -

lvl enum class . switch(lvl) { case loglevel::trace: return "trace"; case loglevel::debug: return "debug"; case loglevel::info: return "info"; case loglevel::warning: return "warning"; case loglevel::error: return "error"; case loglevel::fatal: return "fatal"; default: assert(0 && "unhandled loglevel in leveltostr"); return "???"; // one? throw std::invalid_argument( "unhandled loglevel in leveltostr" ); // or one? } the consensus default should there, opinions in related question divided on should doing. crash whole thing? crash current thread? try handle exception gracefully? the sides present arguments in comments discussion isn't quite conclusive. could present comprehensive answer 1 should used, or in conditions? it depends on requirements of system. i argue it's better not use default: in case. if leave out, you...

Grails CSV Plugin - Concurrency -

i using plugin: grails csv plugin in application grails 2.5.3 . need implement concurrency functionality example: gpars , don't know how can it. now, configuration sequential processing. example of code fragment: thanks. implementing concurrency in case may not give of benefit. depends on bottleneck is. example, if bottleneck in reading csv file, there little advantage because file can read in sequential order. out of way, here's simplest example come with: import groovyx.gpars.gparspool def tokens = csvfileload.inputstream.tocsvreader(['separatorchar': ';', 'charset': 'utf-8', 'skiplines': 1]).readall() def failedsaves = gparspool.withpool { tokens.parallel .map { it[0].trim() } .filter { !department.findbyname(it) } .map { new department(name: it) } .map { customimportservice.saverecordcsvdepartment(it) } .map { ? 0 : 1 } .sum() } if(failedsaves > 0) transacti...

stanford nlp - How to add tags to a parsed tree that has no tag? -

for example, parsing tree stanford sentiment treebank "(2 (2 (2 near) (2 (2 the) (2 end))) (3 (3 (2 takes) (2 (2 on) (2 (2 a) (2 (2 whole) (2 (2 other) (2 meaning)))))) (2 .)))" , where number sentiment label of each node. i want add pos tagging information each node . such as: "(np (adjp (in near)) (dt the) (nn end)) " i have tried directly parse sentence, resulted tree different in sentiment treebank (may because of parsing version or parameters, have tried contact author there no response). how can obtain tagging information? i think code in edu.stanford.nlp.sentiment.buildbinarizeddataset should helpful. main() method steps through how these binary trees can created in java code. some key lines out in code: lexicalizedparser parser = lexicalizedparser.loadmodel(parsermodel); treebinarizer binarizer = treebinarizer.simpletreebinarizer(parser.gettlpparams().headfinder(), parser.treebanklanguagepack()); ... tree tree = parser.apply(tok...

c# - How to use OnSerializing and OnDeserializing attributes? -

i have tried implement auto encryption , decryption in xml, doesn't work, i.e. data not encrypted. reason? code shown below. i'm using xmlserializer class. thanks [serializable] public class user { public string _username; public string _password; public string[] _roles; [xmlignore] public string username { { return _username; } set { _username = value; } } [xmlignore] public string password { { return _password; } set { _password = value; } } [xmlignore] public string[] roles { { return _roles; } set { _roles = value; } } [ondeserializingattribute] internal void decryptpersonaldata(streamingcontext context) { _username = crypto.decrypt(_username); _password = crypto.decrypt(_password); (int = 0; < _roles.length; i++) { _roles[i] = crypto.decrypt(_roles[i]); } } [onserializingattribute]...

c# - Switching tabs in IE while doing automation -

i trying automate web page. on there link , clicking it opens in tab. stuck here. have tried redirect option didn't work. this web page code on trying automate: <td class=""> <a href="../tmi/viewcustomerdetails.jsp?mcid=30000248243" target="_new">30000248243</a> </td> and doing: public void theniclickatthemcid() { var mcid = webbrowser.current.link(find.bytext("30000248243")); if (!mcid.exists) { assert.fail("unable find mcid name"); mcid.click(); } } it open link not able move next tab. how can proceed further? this webbrowser class: using techtalk.specflow ; using watin.core; namespace webtest { class webbrowser { public static ie current { { if (!scenariocontext.current.containskey("browser")) scenariocontext.current["browser"] = new ie(); ret...

c# - Process mutex on function -

how can lock function such blocks other instances of program executing until it's finished? i think need system mutex of kind , waitone i'm not sure how put in robust way. i'm thinking like... public static void function() { bool ok; using (mutex mutex = new mutex(true, "set-ip instance", out ok)) { if(!ok) { mutex.waitone(); } ... } } the behavior looking can achieved code (simple version): using(mutex mutex = new mutex(false, "globalmutexid")) { mutex.waitone(); //do thing mutex.releasemutex(); } or if prefer more reusable approach: public class mutexfactory { private string _name; public mutexfactory(string name) { _name = name; } public singleusemutex lock() { return new singleusemutex(_name); } } public class singleusemutex : idisposable { private readonly mutex _mutex; inter...

java - Path of the folder inside the jar file -

Image
i have jar file langdetect.jar . has hierarchy shown in image there class languagedetection @ com/langdetect package. need access path of profiles.sm folder above class while executing jar file. thanks in advance. jars nothing else zip files , java provides support handling those. java 6 (and earlier) you can open jar file zipfile , iterate on entries of it. each entry has full path name inside file, there no such thing relative path names. though have take care, entries - although being absolute in zip file - not start '/', if need this, have add it. following snippet path of class file. classname has end .class , i.e. languagedetection.class string getpath(string jar, string classname) throws ioexception { final zipfile zf = new zipfile(jar); try { (zipentry ze : collections.list(zf.entries())) { final string path = ze.getname(); if (path.endswith(classname)) { final stringbuilder buf = new ...

colors - How can I change text colour in sublime text? -

Image
i want color source code want. example, if have code <script> var x = 1; function yu() { document.getelementbyid("e").innerhtml = "o"; } </script> i want color whole function ( lines 3,4,5), or color line or word. don't want sublime text color every word depending of type of words. if cant done in sublime text, know other source code editros or ide that? you can write custom syntax meets criteria , set default syntax filetypes wish affect. here basic syntax example affects files extension .myextension save following code @: packages/mysyntaxfiles/mycustomsyntax.sublime-syntax %yaml 1.2 --- name: mycustomsyntax file_extensions: [ myextension ] scope: source.myscopename contexts: main: - match: '\bfunction.*?{' push: function - match: '\b<.+?>\b' scope: entity.name.tag function: - meta_scope: entity.name.function - include: braces braces: - matc...

r - stargazer, xtable, etc.: outputting custom standard errors with stars, excluding control variables -

Image
the image below demonstrates trying output r latex. i'm willing use approach/package works. as can see in image, desired output has multiple models (the columns) , multiple regressions (the rows). i have 3 hurdles: first, how can output standard errors 2 different models below 1 point estimate? neither of ses seek present conventional ses; both modified cluster-robust ses calculated after run regression using custom coeftest() functions, , outputting coeftest object. second, how can present stars? have devised workaround in r output point estimate 2 se calculations below it, not stars automatically transferred xtable or stargazer does. third, output point estimate , standard errors treatment variable. can see @ bottom of table, in models (2) & (4) there control variables, not want display further information them. also, worth noting output not lm object, instead coeftest object, stargazer -compatible not xtable -compatible. take @ texreg , need m...

python - Tweepy: Handle RateLimit in show_friendship() -

i'm trying see several friendships between 2 twitter users, , i'm using show_friendship(twitter_id_1, twitter_id_2) method tweepy library inside loop. i wonder how can handle ratelimit or using cursor ( http://docs.tweepy.org/en/v3.5.0/cursor_tutorial.html ) method because after several loops raises ratelimiterror. this ratelimit handle of search friends (people i'm following) can't figure out how same show_friendship() def limit_handled(self, cursor): while true: try: yield cursor.next() except tweepy.ratelimiterror: time.sleep(15 * 60) friend in limit_handled(tweepy.cursor(api.friends).items()): #stuff

javascript - Print a div with CSS -

i've been searching alot print div css, didn't output want, don't know why. here's trigget show print popup: <button id="print" onclick="popup('front')">here</button> here's script: function popup(data) { var div = document.getelementbyid(data).innerhtml; var mywindow = window.open('', 'new div', 'height=400,width=600'); mywindow.document.write('<html><head><title></title>'); mywindow.document.write( "<link rel=\"stylesheet\" href=\"ficha-tecnica-media.css\" type=\"text/css\" media=\"print\"/>" ); mywindow.document.write('</head><body >'); mywindow.document.write(div); mywindow.document.write('</body></html>'); mywindow.print(); mywindow.close(); return true; } </script> and in ficha-tecnica-media.css : @...

django - GeoDjango Polygon Field ParseException -

Image
i using geodjango display form user can select area on map , name it. i have following model import django.contrib.gis.db.models models class area(models.model): name = models.charfield(max_length=25) area_target = models.polygonfield(default='polygon empty') and form from django.contrib.gis import forms class areaform(forms.form): name = forms.charfield(max_length=160) area_target = forms.polygonfield(srid=4326, required=false, widget=forms.osmwidget(attrs={'map_width': 600, 'map_height': 500})) the form displayed correctly , can select area using map widget, following error message when submit form: geos_error: parseexception: expected 'z', 'm', 'zm', 'empty' or '(' encountered : ')' geos_error: parseexception: expected 'z', 'm', 'zm', 'empty' or '(' encountered : ')' error creating geometry value 'srid=900913;polyg...

php - Laravel multi tanent hyn Package -

i creating new multi tenant system in laravel 5.2 , wants use hyn package i full filling requirements needed run hyn package when installing using composer require hyn/multi-tenant but getting errors like problem 1 - hyn/framework 0.6.1 requires laravel/framework ~5.1.0 -> no matching package found. - hyn/framework 0.6.0 requires laravel/framework ~5.1.0 -> no matching package found. - hyn/framework 0.5.0 requires laravel/framework ~5.1.0 -> no matching package found. - hyn/framework 0.4.1 requires laravel/framework ~5.1.0 -> no matching package found. - hyn/framework 0.4.0 requires laravel/framework ~5.1.0 -> no matching package found. - hyn/framework 0.3.0 requires laravel/framework ~5.1.0 -> no matching package found. current codebase of hyn supports laravel 5.1 lts. there's open issue on github issue. reference: https://github.com/hyn/multi-tenant/issues/47

Track App Store download source -

Image
is there way track app store download source ? per example, if post link on facebook page of app, can know how many person downloaded app link ? thanks answer. yes, can track downloads devices ios8+ , tvos2+ campaign links apple's app analytics: https://analytics.itunes.apple.com/ choose app, go "sources" , create new link link builder there. it this: pt= unique provider token; ct= campaign name

On changing of screen size stop youtube video -

i have design & develop page iframe youtube video below <iframe src="https://www.youtube.com/embed/watch-id-1?rel=0" class="hidden-xs"></iframe> <iframe src="https://www.youtube.com/embed/watch-id-2?rel=0" class="visible-xs"></iframe> my issue - when play first video in desktop , resize window mobile screen need stop first video playing.. it's because you're changing website going desktop mode mobile mode, of course it's going stop playing. @ least that's think meant, can't understand you're saying.

how to use images in the asp:gridview using asp.net? -

how use images in grid view using asp.net? actually want use images in place of text example in place of edit , delete want use images related text. possible use images please me please define template way <asp:templatefield headerstyle-width="40"> <itemtemplate> <asp:imagebutton id="buttondelete" runat="server" imageurl="~/imags/delete.png" onclick="buttondelete_click" tooltip="delete" commandargument='<%#bind("userid")%>'/> </itemtemplate> </asp:templatefield> code behind protected void buttondelete_click(object sender, eventargs e) { imagebutton button = sender imagebutton; deleteuserbyid(convert.toint32(button.commandargument)); }

html - How to multiple (a*b) two input text value and show it Dynamicly with text change in javascript? -

i want show money customer must pay , inputs : <input type="text" class="form-control" placeholder="cost " id="txt" name="credit"> <input type="text" class="form-control" placeholder="quantity" id="txt" name="limit"> when input text changing want show total cost (quantity*cost) in <p> tag dynamicly how can javascript? all of above generate errors if both boxes blank . try code , tested , running . <script> function calc() { var credit = document.getelementbyid("credit").value; var limit = document.getelementbyid("limit").value; if(credit == '' && limit != '') { document.getelementbyid("cost").innerhtml = parseint(limit); } else if(limit == '' && credit != '') { document.getelementbyid("cost").innerhtml = pars...

amazon web services - AWS Opsworks undeploy -

i in middle of settings nice deployment infrastructure company working for. developed on single app, have deploy multiple times having different urls assigned each app. deploying works quite well, no problems here. removing, or undeploying problem facing right now. if delete 1 app, using aws opsworks console, opsworks executing undeploy script. problem is, not getting information app deleted, information remaining apps. the background have delete nginx user, database , user , folder structure of app itself. tried every data_bags given aws: aws_opsworks_* : search("aws_opsworks_app").each |app| chef::log.info("undeploy: #{app}") end thanks in advance link.de

Sql server error using case -

i have here query wrote in visual studio using sql server 2010. extension mdf think i'm using sql server. here structure of table. occupantid int contacttypeid int contactdetail varchar(255) maincontacttype bit here sql. select contactdetail.*, contacttype, firstname + ' ' + lastname occupantname, case when maincontacttype = 1 'yes' else 'no' maincontacttype contactdetail inner join occupant on contactdetail.occupantid=occupant.occupantid inner join contacttype on contactdetail.contacttypeid=contacttype.contacttypeid i'm getting error incorrect syntax near keyword as the case -expression must end end : case when maincontacttype = 1 'yes' else 'no' end maincontacttype

sql - Rails/PostgreSQL: Adding character limit to text -

i want implement character limit data value on postgresql database ruby on rails application. database table looks this: create_table "applications", force: :cascade |t| t.string "name" t.string "gender" t.date "date_of_birth" t.string "gpa" t.text "essay" t.datetime "created_at", null: false t.datetime "updated_at", null: false end i want change "essay" allows 10000 characters. limited understanding of postgresql, text unlimited default whereas string 255 characters or less. thought implementing javascript conditional not let user hit submission button in client if text on 1,000 characters, of course tech savvy user change that. optimal way this? use rails model validations - validates_length_of . on rails end can add in application.rb file validates_length_of :essay, :maximum => 1000 this ensure max size not exceded. keep...

raspberry pi - Error installing opencv 2.4.3 on debian -

i beginner raspberry pi debian os. when install opencv-2.4.3 "sudo gedit /etc/ld.so.conf.d/opencv.conf" got error: "sudo: gedit:command not found" then trying install "gedit" failed error: "the following packages have unmet dependencies: gedit : depends: libpeas-1.0-0 (>= 1.1.0) not going installed depends: gir1.2-peas-1.0 not going installed e: unable correct problems, have held broken packages." how solve issue? just install aptitude resolve dependencies you. sudo apt-get install aptitude sudo aptitude install gedit moreover edit file can use vim or nano. regards

how to use MAX function in case statement under sum expression in oracle sql? -

select a.institution, a.acad_career, a.emplid, a.strm, nvl( sum( case when a.repeat_candidate in ('n', 'y') , a.crse_grade_off != 'f' max(grade_points) else (grade_points) end ), 0 ) gpa, nvl(sum(case when a.repeat_candidate = 'n' a.unt_taken end), 0) taken, a.acad_prog ps_stdnt_enrl a, ps_stdnt_clas_d_vw b a.emplid = b.emplid , a.class_nbr = b.class_nbr , a.strm = b.strm , a.acad_career = b.acad_career , a.stdnt_enrl_status = 'e' , a.emplid '06381313011%' group a.emplid, a.acad_career, a.institution, a.acad_prog, a.strm this query work fine without max function bt her...

php - Share a picture on facebook, not via URL -

i have website , share pictures facebook using button. i confused how share of picture works, have implemented share of picture via url http://m.facebook.com/sharer.php?u=[url]&title=[title] , requires picture hosted on server. wondering other options available? is possible share picture directly on facebook (like if user uploading on facebook itself)? have heard oauth don't understand if using 3rd party libraries or if part of facebook libraries? many thanks you need use /me/photos endpoint upload picture, there example code in docs: https://developers.facebook.com/docs/graph-api/reference/user/photos/ the user must authorized publish_actions in order make work. here´s more information authorization/login: https://developers.facebook.com/docs/facebook-login/ http://www.devils-heaven.com/facebook-javascript-sdk-login/

configuration - Hadoop conf to determine num map tasks -

i have job, hadoop jobs, seems have total of 2 map tasks when running can see in hadoop interface. however, means loading data java heap space error. i've tried setting many different conf properties in hadoop cluster make job split more tasks nothing seems have effect. i have tried setting mapreduce.input.fileinputformat.split.maxsize , mapred.max.split.size , dfs.block.size none seem have effect. i'm using 0.20.2-cdh3u6, , trying run job using cascading.jdbc - job failing on reading data database. think issue can resolved increasing number of splits can't work out how that! please help! going crazy! 2013-07-23 09:12:15,747 fatal org.apache.hadoop.mapred.child: error running child : java.lang.outofmemoryerror: java heap space @ com.mysql.jdbc.buffer.<init>(buffer.java:59) @ com.mysql.jdbc.mysqlio.nextrow(mysqlio.java:1477) @ com.mysql.jdbc.mysqlio.readsinglerowset(mysqlio.java:2936) @ com.mysql.jdbc.mysqlio.getresultset(...

skype4com - Javascript: send Skype text message -

according skype developer page: https://dev.skype.com/skype-uri/skype-uri-tutorial-webpages seems can initiate skype chat dialog web page. but want directly send text message web page javascript already-open skype chat dialog. possible? it not possible. such feature available desktop skype api , not exposed web browser.

javascript - How to hide drop-down menu in Bootstrap 3.3.4 dynamically using jQuery in document-ready function? -

i've following bootstrap html code : <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <ul class="nav navbar-nav"> <li class="projects" class="dropdown"><a class="dropdown-toggle projects" data-toggle="dropdown" href="#"><span class="projects">projects</span></a> <ul class="dropdown-menu"> <li><a href="/prj/pages/project/projectlist.html">list</a></li> <li><a href="/prj/pages/project/createnewproject.html">add new project</a></li> </ul> </li> </ul> </div> </div> </nav> now want hide drop-down menu using jquery code i.e. want hide drop-down menus list , add new project . i want ...

MediaWiki - Change Common.css without affecting Print.css -

is there way change mediawikis css skins without affecting printable-version-layout? to make more clear: mediawiki has own stylesheet it's "printable version"-page (print.css). don't want have changes stylesheet made in common.css appear on printable-version-page too. so, if change font-size "normal" wiki-pages, still want have original font-size on printable-version-pages. use following in css: @media print { .element-with-your-class { style } } the "@media print" ensures styles set within applied when page printed. see this link more information on media queries.

Cross platform Python code -

edit further other below info , helpful input issue caused using strftime %s generate unix timestamp (which system being queried requires). strftime %s not compatible windows platform therefore need use alternative method generate unix timestamp. jez has suggested time.time() have experimented i'm not doing right somewhere along way. need change section of code using strftime time(): if (args.startdate): from_time=str(int(args.startdate.strftime('%s')) * 1000) if (args.enddate): to_time=str(int(args.enddate.strftime('%s')) * 1000) any or steer appreciated. :) /edit i've been given python script appears run ok when deployed on apple laptop gives error message when run on windows machine. need talk 3rd party through executing file remotely , has windows machine need try , figure out why isn't working. i'm running 2.7 reference. section appears error being caused: if __name__ == "__main__": parser = argparse.a...

amazon s3 - How the upload by region in AWS stack works? -

i unable understand regions in aws stack. read somewhere in aws document uploading data(s3) 1 region not reflects automatically other region. need upload available regions reflects uploaded file world wide? used upload s3 using aws console in 1 region , not aware of region upload in aws. today changed in region in aws console url , found content same. if reflects automatically point of specifying region when uploading s3 or other aws service. i understand confusion it's not clear how work. how works imo: you can choose region optimize latency, minimize costs, or address regulatory requirements. objects stored in region never leave region unless explicitly transfer them region. more information regions, see accessing bucket in amazon simple storage service developer guide. therefore when create bucket being asked choose regions bucket has got regions specific address i.e.: s3-<region>.amazonaws.com if able see same content of bucket in different regio...

How to read/load a JSON file in Typescript -

i quite new typescript , trying read simple json file typescript. have googled , tried need simple code lines read local json file nummeric array variable. json file [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 16.4, 194.1, 95.6, 54.4]. if can me out on this, grateful regards gf standard javascript - var json = "[29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 16.4, 194.1, 95.6, 54.4]"; var arr = json.parse(json); (edit) just noticed "local file" bit - if mean @ compile time need prefix json (in file) variable name nothing else needs doing - quite literally simple window.json = ... works - there's no need quotes etc. if it's @ runtime needs loaded either via ajax, or - again - via prefixing variable name , adding file in <script type="text/javascript" src="file.json"></script> tag.

java - Constructor annotated with Jackson @JsonCreator not being called in POJO? -

i working web service stores pojos in mongodb. want make use of mongo's 'expireafterseconds' time live feature, clear out old documents in collection after period of time. initially had implementation sent date rest service using following json: { "testindex": "testindex", "name": "hello", "date": "2016-05-09t11:00:39.639z" } the above code created document in collection, , following annotation, deleted document after 10 seconds. @indexed (expireafterseconds=10) private date date; after implementing code, decided wanted generate date on java side, meaning json follows: { "testindex": "testindex", "name": "hello" } then have constructor in pojo using jsoncreator jackson @jsoncreator public ttltestvo (@jsonproperty("testindex") string testindex, @jsonproperty("name") string name) { this.testindex = testindex; this.create...

java - how to show query while using query annotations with MongoRepository with spring data -

i'm using mongorepository in spring boot access mongo: public interface mongoreadrepository extends mongorepository<user, string> { @query(value = "{$where: 'this.name == ?0'}", count = true) public long countname(string name); } and work, wonder know query accessing mongo how that? i try adding config @ properties below: logging.level.org.springframework.data.mongodb.core.mongotemplate=debug logging.level.org.springframework.data.mongodb.repository.query=debug and don't work. could help? i add line (below) in application.properties , works fine: logging.level.org.springframework.data.mongodb.core.mongotemplate=debug for query: @query("{$and: [{'$or' : [{ 'name': {$regex : ?0, $options: 'i'}}, {'description': {$regex : ?1, $options: 'i'}}]}, { 'deleted' : ?2 }]}") obtain log: 2016-09-27 10:53:26.245 debug 13604 --- [nio-9090-exec-3] o.s.data.mongodb.cor...

Spark sql is working, but it seems that without any cluster manager, it is possible? -

Image
i have hadoop cluster 4 nodes(1master, 3slaves). , create hive tables files stored in hdfs. configure mysql hive metastore , copy hive-site.xml file inside conf folder of spark. to install spark, download , extract spark in master node. , after copy hive-site.xml inside spark conf folder, start spark spark-shell command . needed install in slave nodes also? im asking because, im executing success spark sql queries below, if try acess cluster manager default page in localhost:8080, shows "unable connect". seems spark sql working fine, without cluster manager working, possible?? var hivecontext = new org.apache.spark.sql.hive.hivecontext(sc) query = hivecontext.sql("select * customers"); query.show() master:8080 first , have let spark knows hadoop configurations are, setting env variable hadoop_conf_dir in spark-env.sh file then, when starting spark-shell have tell spark use yarn master: spark-shell --master yarn-client for more informat...

javascript - Can HighChart support multiple graph types in a single drilldown? -

Image
from following fiddle can implement drilldown in highcharts : http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/drilldown/basic/ code: $(function () { // create chart $('#container').highcharts({ chart: { type: 'column' }, title: { text: 'basic drilldown' }, xaxis: { type: 'category' }, legend: { enabled: false }, plotoptions: { series: { borderwidth: 0, datalabels: { enabled: true } } }, series: [{ name: 'things', colorbypoint: true, data: [{ name: 'animals', y: 5, drilldown: 'animals' }, { name: 'fruits', y: 2, drilldown: 'fruits' }, { name: 'cars', y: 4, ...

html - Why the `clear:both` can not written into div.box3? -

i want margin-top:10px displayed on top of box3. here proper codes on firefox. <div class="clear"></div> written single line before div box3,and write div.clear{clear:both;} special part. div.box{ width:105px; height:200px; border:1px solid red; } div.box1{ float:left; width:50px; height:50px; border:1px solid red; } div.box2{ float:left; width:50px; height:50px; border:1px solid red; } div.clear{ clear:both; } div.box3{ width:100px; height:80px; border:1px solid red; margin-top:10px; } <body> <div class="box"> <div class="box1">box1</div> <div class="box2">box2</div> <div class="clear"></div> <div class="box3">box3<...

c++ - conversion from meter to pixels knowing the depth -

i have problem creation of regions of interests onto image plane. set of points in ground plane, project fixed size windows (for instance 1x2 meters) scaled respect depth. this, use function uses projection matrix 3d points of space 2d image coordinates. create roi projecting point1 << x3d-width/2,y3d,height,1; // respect laser ref frame point2 << x3d+width/2,y3d,optimalbottom,1; // respect laser ref frame which 2 extrema points of rectangle , can assume optimalbottom = 0.0 . problem if use projection, computed parameters of fisheye camera, lead windows not positioned onto rectified image (i need use rectified image). thought remapping (with opencv remap ) remap extrema coordinates lead distortion due fisheye effect on image. instance position of rectangles but, on lateral side of image width , height of such rectngles distorted. turned in mind remap original points generate rectangles , adding fixed values width , height directly expressed in pixels. the pro...

c# - Change format of contents in Windows DataGridView? -

Image
the qustion had posted how can this? question , didn't solve problem. question more specific of datagridview control. question either yes, can done or no, way flowlayoutpanel or tablelayoutpanel control . our windows form has regular datagridview . this: is possible change format of datagridview, similar asp.net data controls itemtemplate ? example, make contents of each cell of datagridview this: thanks.

user interface - Async iterative to update UI -

i have 1 problem. want update state of switch on main ui on base of receive server. know, android not allow internet connection on main thread. so used async. unfortunately, inside of async i'm not able modify ui. asynctask "while(true)" code inside. ask server , on base of reply update ui ever , ever. somebody can me? thanks in advance , sorry bad english! edit: i'm talking of android application. asynctask has methods intended work ui, example onpostexecute . asynctask should used operations take quite few seconds , may hang other asynctasks. do "while(true)" code inside is not option. chatting server may want use service . check more information processes , gotchas .

documentation - How to use jazzy with Objective C .m (implementation) files? -

i love jazzy, struggle objective c process. many classes documented in .m files not .h files. if put .m file names in umbrella header, jazzy blows up. besides copying comments .h files, there less manually intensive way of getting results?