Posts

Showing posts from May, 2015

Android WebView: Video Playing issues -

note: works fine on 4.1.2 (samsung galavy tab 2), not work on 4.1.1 i trying play video inside webview, long using url web source of video, works fine. <source src="http://0800200c9a66-content-preview.testvideo.com/video.mp4" type="video/mp4"> function playvideo() { var video = document.getelementbyid("video"); video.focus(); video.load(); //have load first, play video.play(); the problem comes when change source video on sd card like src="file:////storage/sdcard0/android/data/com.example.player/files/content_path/sample.mp4" type="video/mp4"> when give local file source, audio plays , video shows black screen. idea how fix this? p.s. video url in above code not real one, example of code. real url works fine. note: works fine on 4.1.2 (samsung galavy tab 2), not work on 4.1.1

java - At subclass Compilation Error: Unreachable catch block for CloneNotSupportedException -

in superclass , when override clone() method there no problem. public class superclass implements serializable, cloneable { public object clone() { try { return super.clone(); } catch (clonenotsupportedexception e) { return null; } } } when override clone() method in subclass doing same ( copy , paste clone() method super class) it's showing compilation error public class subclass extends superclass implements serializable, cloneable { public object clone() { try { return super.clone(); } catch (clonenotsupportedexception e) { return null; } } } compilation error in subclasss @ line containing catch : unreachable catch block clonenotsupportedexception. exception never thrown try statement body again, if remove method clone() superclass subclass wont show error. where gap of understanding? if superclass 's clone catches cloneno...

javascript - Angular2 - sum the values of a property in the Object sent from an observerable -

in service.component.j s return observable of array of student http call. student object has property called age, student.ts export class student { id: number; name: string; age:number; } service.componnet.js getstudents (): observable< student[]> in studentmanagement.component.ts observer observable above, want sum age of students. know can put sum() in source (which less preferred, need display other info of students in page, such id, name ,individual age well.) or calculate _studentlist. besides these two, other way? private _studentlist:student[]=[]; .subscribe( returnedstudents => { console.log(returnedstudents); this._studentlist = returnedstudents; }, erromsg => this._errormessage = erromsg ) you use map on observable return sum. getstudents().map(arr => arr.reduce((a, b) => + b.age, 0)); here reduce inner array sum of age property of students. ...

php - Amazon MWS ListOrders Misiing orders with different Currency/ Timezone -

i using listorders api orders amazon store https://sellercentral.amazon.co.uk i have set timezone europe/london but orders missing listorders api , these orders having different currency (euro) , perhaps placed different country (spain). all orders currency pound listed api. tried changing time zone europe/madrid, still these orders not listed. can cause? please help. thanks i added method amazon orders api class , returned me 100 orders , gave me nexttoken access next 100 or remaining orders. need set createdafter date , marketplaceid other not required fields. public function getorderlist() { $this->config['serviceurl'] = "https://mws-eu.amazonservices.com/orders/2013-09-01"; $this->serviceurl = "https://mws-eu.amazonservices.com/orders/2013-09-01"; $service = new marketplacewebserviceorders_client($this->aws_access_key, $this->aws_secret_access_key, $this->application_name, $this->appli...

html - tabindex="-1" on <ul> doesn't work -

i have mega dropdown menu bootstrap (code simplified) : <li class="dropdown mega-dropdown"> <a href="#">menu button</a> <ul tabindex="-1"> <li>1st link</li> <li>2nd link</li> <!-- many other links --> </ul> <!-- many other menu buttons --> </li> small fiddle here : https://jsfiddle.net/48m2ppzc/ i want simplify navigation tab key : at beginning element <ul> has max-height of 0px shoudn't able navigate inside tab key (because menu hidden). when click on "menu button" link, menu should show (i set max-height 500px ), , need change tabindex '0' (i can jquery that's not problem) the problem @ first point : tabindex="-1" doesn't work, can still navigate inside menu tab key. how can fix problem? use html5 tabindex should work on html elements, tried tabindex="0" . tabindex...

android - proximity Alert not fired -

this first question here , search answer not found. build simple app that current position , give alert if i'm stand on specific position, alert not fired, please help. here code : mainactivity: package com.lda.notyalert; public class mainactivity extends activity { proximityintentreceiver proximityintentreceiver; private static final string proximity_alert = "com.lda.notyalert.proximityintentreceiver"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); locationmanager locationmanager; string svcname = context.location_service; locationmanager = (locationmanager) getsystemservice(svcname); criteria criteria = new criteria(); criteria.setaccuracy(criteria.accuracy_fine); criteria.setpowerrequirement(criteria.power_low); criteria.setaltituderequired(false); criteria.setbearingrequi...

c# - How can I get type double array from List<string>? -

this question has answer here: how convert list of strings doubles? 5 answers var array1 = (from ir in pmec.interestrateset select new list<string> { ir.tenor.tostring() }).tolist(); var array2 = (from ir in pmec.interestrateset select new list<string> { ir.rate.tostring() }).tolist(); array1.addrange(array2); var array = array1.toarray(); for example, array1 has 6 numbers, array2 has 6 numbers, after combined, array has 12 numbers. then should in order array of type double? if tenor , rate double properties should not convert them string. list<double> tenorlist = pmec.interestrateset .select(irs => irs.tenor) .tolist(); list<double> ratelist = pmec.interestrateset .select(irs => irs.rate) .tolist(); list<double> tenorratelist = tenorlist.concat(ratelist).tolist(...

Convert a ushort[] array to a single ushort in C# -

having ushort array, ushort[] how can convert ushort array [44,55] single joined ushort 4455 ? array has 2 elements. ushort[] test = new ushort[2]; test[0] = 44; test[1] = 55; // here want convert ushort[] unique ushort value 4455 usortvalue = ? return usortvalue; i expecting .join function string does, it's not possible ushort . thanks in advance you can aggregate, predicate being "convert string, concatenate, , parse ushort", sooner or later ( sooner! ) you're going overflow. ushort[] test = new ushort[2]; test[0] = 44; test[1] = 55; var result = test.aggregate((p,c) => ushort.parse((p.tostring() + c.tostring()))); live example: http://rextester.com/vkv9570

How can I add a redirect to an article with Pelican? -

i have in header like title: whatever slug: whatever redirect: bla redirect: foo redirect: bar so pelican generates pages redirect bla , foo , bar whatever . possible? i saw called "alias". there plugin pelican-alias can installed pip install pelican-alias . pelican_alias has put plugins list in pelicanconf.py . aliases defined as alias: bla, foo, bar

jboss - Cannot create Openshift jbossas -7 -

hey guys experiencing weird problem. able in past create jboss application server 7 projects following this simple guide error while creating it. goes fine until point... activating deployment deploying jboss starting jbossas cartridge jbossas process failed start git post-receive result: failure activation status: failure activation failed following gears: 5730522a7628e18d0b000159 (error activating gear: client_error: failed execute: 'control start' /var/lib/openshift/5730522a7628e18d0b000159/jbossas ) deployment completed status: failure postreceive failed also have noticed when click link application throws 404 error , in search bar directs me blablabla-rhcloud.com/app whereas in past blablabla-rhcloud.com/ i wondering have changed structure of application not updated existing starting repository supposed use on github? controllers have no /app case. thanks lot hope clear :) if doing rapid create/delete/cre...

python - Click on a link having a href attribute within <li> -

i trying click on login link system throws nosuchelementexception. have tried xpaths unable click on login button , attaching code from selenium import webdriver selenium.webdriver.common.by import import time class createaccount: def signup(self): browser = webdriver.firefox() browser.get("http://www.scrumdo.com") time.sleep(5) browser.find_element_by_link_text("login").click() time.sleep(5) browser.find_element_by_xpath("//a[@href='/account/signup']").click() time.sleep(5) browser.find_element_by_xpath("//input[@name='username']").send_keys("rockyhandsome") browser.find_element_by_xpath("//input[@name='fullname']").send_keys("naqash zafar") browser.find_element_by_xpath("//input[@name='email']").send_keys("naqash.zafar@kualitatem.com") browser.find_element_by_xpath("//input[@name='password']")....

Populate column which a range of possible values in other columns: in R -

for example dataframe: df <- structure(list(region = structure(1:8, .label = c("a", "b", "c", "d", "e", "f", "g", "h"), class = "factor"), y.2012 = c(5.5, na, 4.7, 3.6, na, na, 4.6, na), y.2013 = c(5.7, na, na, 3.8, na, 6.2, na, na), y.2014 = c(na, 6.3, na, 4.1, 5.1, na, na, na )), .names = c("region", "y.2012", "y.2013", "y.2014"), class = "data.frame", row.names = c(na, -8l)) i want add column (called 'variable') populated recent year of data available. example, 2014 preferable, followed 2013, , 2012. if no data available, na can left. i want resulting dataframe like: region y.2012 y.2013 y.2014 variable 1 5.5 5.7 na 5.7 2 b na na 6.3 6.3 3 c 4.7 na na 4.7 4 d 3.6 3.8 4.1 4.1 5 e na na 5.1 5.1 6 f na 6.2...

c# - ScrollView's Child Not Resizing Properly With Window Resize WinRT -

scenario: working on store app in winrt/win8. i have scrollview , custom usercontrol child inside - part of 1 "main" usercontrol . when main usercontrol (with scrollview -> child usercontrol ) in initialized/navigated - app width not full-screen; usercontrol @ full width of scrollview - desired. images below: image 1 - main user control opens window fullscreen image 2 - main user control opens starts half-width (or width) the scrollview within grid , keeps full width of app window, when it's resized - desired. issue: issue i'm having when resize app window horizontally, child usercontrol not keep same width parent scrollview 's. this causes scrollview have horizontal scrollbars - not want. image 3 - window horizontal width resized i want keep width of child bound inside width of scrollview no horizontal scrollbars (as in image 2 ). markup similar (i have stripped down readability): <grid> <!-- row/colu...

What is the best way to get access to nested JSON in D? -

now using vibed json module, not know how access nested elements without iteration foreach. here json: { "hasmore": false, "result": [{ "ip": "127.0.0.1", "passedtests": "[firsttest8,firsttest8,firsttest8,firsttest8]", "guid": "" }], "code": 201, "extra": { "stats": { "writesignored": 0, "scannedindex": 0, "scannedfull": 1, "executiontime": 0, "filtered": 0, "writesexecuted": 0 }, "warnings": [] }, "error": false, "cached": false } i like: result.passedtests . here result array. i found perfect solution: json resultpassedtestsjson = visitorsinfo["result"][0]["passedtests"]; // "[firsttest8,first...

how to set password size constraint when using spring security core in grails? -

i can't set password size constraint, setting minimum size won't cause problem (since encrypted password long) maximum size causes application fail following stack (when try insert user (called personne in app) valid password in init/bootstrap): error org.springframework.boot.springapplication - application startup failed java.lang.nullpointerexception: null @ org.hibernate.engine.spi.batchfetchqueue.removebatchloadableentitykey(batchfetchqueue.java:163) @ org.hibernate.engine.internal.statefulpersistencecontext.addentity(statefulpersistencecontext.java:389) @ org.hibernate.engine.internal.statefulpersistencecontext.addentity(statefulpersistencecontext.java:462) @ org.hibernate.action.internal.abstractentityinsertaction.makeentitymanaged(abstractentityinsertaction.java:143) @ org.hibernate.engine.spi.actionqueue.addresolvedentityinsertaction(actionqueue.java:203) @ org.hibernate.engine.spi.actionqueue.addinsertaction(actionqueue.java:181) @ o...

php - Loop blog page in Wordpress -

i have problem wordpress page, don't know where's problem or how fix it. this. 5.9.111.70 - - [06/may/2016:18:12:29 +0200] "get /comunicados/?start=30page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/3/page/3/page/2/page/3/page/2/ http/1.0" 200 58416 "-" "mozilla/5.0 (compatible; mj12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)" 5.9.111.70 - - [06/may/2016:18:12:35 +0200] "get /comunicados/?start=30page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/3/page/3/page/2/page/3/page/3/ http/1.0" 200 58416 "-" "mozilla/5.0 (compatible; mj12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)" 5.9.111.70 - - [06/may/2016:18:12:46 +0200] "get /comunicados/?start=30page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/page/2/...

Node.js sending HTTP requests from specified port -

i send http requests using request module, want specify port make request, not port send to. possible, , if how? edit: wasn't explained properly, want have few instances of same program, talk each other (mostly not), i'm wondering there anyway listen , send requests port of choosing, each of them have unique port live on.

html - v4 bootstrap full height sidebar -

i using latest version of bootstrap , siderbar short , not full height. can view here: http://srv.sniperjum.com/sh1omi/bootstrap-dev/ css: http://srv.sniperjum.com/sh1omi/bootstrap-dev/css/style.css problem css or problem bootstrap? , how can fix it? css li.active{ background-color: #428bca; } li { padding-bottom: 5px; padding-top: 5px; } .sidebar{ background-color: #f5f5f5; padding-right: 20px; padding-top: 20px; } /* sidebar navigation */ .nav-sidebar { margin-right: -21px; /* 20px padding + 1px border */ margin-bottom: 20px; margin-left: -20px; } .nav-sidebar > li > { padding-right: 20px; padding-left: 20px; } .nav-sidebar > .active > a, .nav-sidebar > .active > a:hover, .nav-sidebar > .active > a:focus { color: #fff; background-color: #428bca; } button{ color: #fafafa } html <nav class="navbar navbar-dark navbar-full bg-inverse"> <button type="button" c...

javascript - Using AJAX/PHP/JS to report multiple status messages during a long process -

i understand using php isn't possible send messages dom using ajax entire script must execute before response becomes available. such, appears have 2 options: split long process several smaller ones , report after each write status updates file , have system read file process executes. are there big advantages or disadvantages either method? i haven't understood methods questioning, here (using jquery , php): in javascript, use window.settimeout(), call function uses ajax callback check url. url php script, checks if new message present or not. php script checks new message either in flat tile or in db, not sure use. script prints message, either in straight html markup, or simple text, or in json or xml format. on success, ajax call, outputs response selector on page, , calls again window.settimeout(). this part of html markup: <div id="systemmessage">here goes new message</div> this part of javascript: $(document).re...

html - Private wordpress post redirecting to 404 error - how to make it invisible? -

a post on website set private in visibility dropdown link article still appears on homepage , leads 404 error. how can hide link viewers not admin? if change status of post published draft, can still edit it, save , can preview see changes , won't appear on homepage.

expressionengine - Product to Retailers (one to many) in Expression Engine -

i have build website using popular expression engine cms. i have managed head around how channels , channel fields work. problem have when admin user adds new product them able select retailer , add unique url retailer product. is can achieved using expression engine cms. i had @ playa unsure if need this? many thanks!

python - Reading and writing data from same serial port using pyserial -

so i'm working on program simulate data terminal. program uses gui , required read data com port , write well. i've used pyserial library , read part of program correctly implemented. however, when attempt write using same port, exception raised library saying port not accessible. should possible read , write using same com port since it's full duplex, problem must lie in way i'm approaching it. can shed light how, can enable write part of program well. edit: here traceback of exception: traceback (most recent call last): file "c:\ankit\python_27\lib\threading.py", line 801, in __bootstrap_inner self.run() file "c:\ankit\serwatchcode\serialcomm.py", line 85, in run self.ser.open() ...

eloquent - Laravel returning only single column -

Image
in database have categories , sizes, have table match them called category_sizes looks like: i want array size_id category_id = 4 did: $catsizes = categorysize::where('category_id', 4)->value('size_id'); return($catsizes); but returns 1 result only. how can array size_ids can use later in where_in statement. i tried pluck gives 1 row. $catsizes = categorysize::where('category_id', 4)->pluck('size_id'); dd($catsizes); my categoysize model <?php namespace app; use illuminate\database\eloquent\model; class categorysize extends model { protected $table = 'category_sizes'; } try this: db::table('category_sizes')->where('category_id', 4)->get('size_id'); or: db::table('category_sizes')->select('size_id')->where('category_id', 4)->get();

xamarin.forms - Xamarin Forms Navigation Page bar with only text (no icon) -

how can disable xamarin icon in navigation page bar , set title? you can use remove icon. actionbar.seticon(android.resource.color.transparent); and set title can use code in c# this.title="mypage" or xaml put below attribute in contentpage node title="mypage"

Facing error while sending base64 string in HL7 message over HTTP from android client -

i working hl7 message in android client (api 17) , using hapi library generate , parse hl7 messages.the message working fine when transmitting small string values. have send image on http hl7 server , using mdm_t02 message of hl7 version 2.5. getting following error in server side when sending hl7 message image converted base64 string , inserted obx-5 field. jul 23, 2013 3:05:32 pm org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [com.tcs.hl7server.myserver] in context path [/myhl7server] threw exception java.lang.arrayindexoutofboundsexception @ java.lang.system.arraycopy(native method) @ org.apache.tomcat.util.buf.bytechunk.substract(bytechunk.java:441) @ org.apache.catalina.connector.inputbuffer.read(inputbuffer.java:315) @ org.apache.catalina.connector.coyoteinputstream.read(coyoteinputstream.java:200) @ ca.uhn.hl7v2.hoh.encoder.abstracthl7overhttpdecoder.readbytesnonchunked(abstracthl7overhttpdecoder.java:370) @ c...

Python key binding/capture -

i'd know simplest way bind keys in python for example, default python console window apears , waits, in psuedo -> if key "y" pressed: print ("yes") if key "n" pressed: print ("no") i achieve without use of modules not included python. pure python any , appreciated python 2.7 or 3.x windows 7 note: raw_input() requires user hit enter , therefore not keybinding from http://code.activestate.com/recipes/134892/ (although bit simplified): class _getch: """gets single character standard input. not echo screen.""" def __init__(self): self.impl = _getchunix() def __call__(self): return self.impl() class _getchunix: def __init__(self): import tty, sys def __call__(self): import sys, tty, termios fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) ...

python - Visually attach Scrollbar to Listbox: TkInter -

i having issue tkinter interface whereby cannot scrollbar visually attach listbox element - see image: problem interface here code creates , positions listbox & scrollbar: lblpd3 = ttk.label(mainframe,text='',font=("helvetica", 5)) lblpd3.grid(column=0, row=12, sticky=nw) scltrn = scrollbar(mainframe, orient=vertical) lbltrn = ttk.label(mainframe,text='select transformation',font=("helvetica", 11, "bold")) lbltrn.grid(column=0, row=13, sticky=nw) self.lsttrn = listbox(mainframe,selectmode=single,exportselection=0,width=62,height=4,yscrollcommand=scltrn.set,activestyle='none',selectbackground='#4a6984',selectborderwidth=3,highlightcolor='#4a6984',highlightthickness=1) scltrn.config(command=self.lsttrn.yview) scltrn.grid(column=0, row=14, sticky=(n,s,e)) item in self.coord: self.lsttrn.insert(end, item) self.ls...

How to find unique combination from join in sql server -

i have 2 tables t1 , t2 below, have 2 tables below, id d v a 1 d1 v1 -70 2 d1 v2 70 3 d1 v3 -70 4 d2 v1 120 id d v a 1 d1 v11 -70 2 d1 v12 70 3 d1 v13 -70 4 d2 v31 -120 id d v a 1 d1 v11 -70 2 d1 v12 70 3 d1 v13 -70 4 d2 v31 -120 i need find out unique combinations of records who's amounts results in zero. following expected result set. d v d1 v2 d1 v11 d1 v1 d1 v12 d2 v1 d2 v31 d v d1 v2 d1 v11 d1 v1 d1 v12 d2 v1 d2 v31 i have tried inner join on column d , amount using row_number() function not satisfy requirement. gives first unique combination. ,temp1 (select a.v v1 ,b.v v2,a.d d1 ,b.d d2,a.a actual ,b.a acrual t1 inner join t2 b on a.d =b.d a.actual +b.acrual = 0) select * tbl inner join (select v1,v2,d1,d2, actual,acrual, row_number() over(partition v1 order v1) r1 ,row_number() over(partition v2 order v2) r2 temp1)f on (a.v = f.v1 or a.v = f.v2) , ...

active directory - RESOLVED get-ADUser with parameters in a foreach loop from csv with powershell -

i try lookup ad powershell 3 , check if users (samaccountname) in csv existing , active in ad. hopping 1 error next 1 based on brackets , parenthesis not find correct way. tried different filters, tried pass them through variable end "a parameter cannot found matches parameter name -eq...". looks error @ get-aduser $adsearch not set therefore fails evaluate if($adsearch). the csv file sanitized (leading spaces etc.) , looks (only 1 column samaccountname): john.doe jane.doe doej2 foo.bar barf5 any tip highly appreciated. thanks! param ($inputfile='.\users.csv',$logfile='.\log.csv') $csv = import-csv $inputfile #"samaccountname,search result" | add-content $logfile foreach ($user in $csv){ echo $user; #$adsearch = get-aduser -filter 'samaccountname -eq "$($user)" -and enabled -eq $true' #$filter = "samaccountname -eq $($user) -and enabled -eq $($true)" #write-host "filter $filter" ...

playframework - Scala play Guice injection -

i'm using scala play 2.5 , have following error while trying inject object in 1 of controllers. i'm using default injection framework given play guice. provisionexception: unable provision, see following errors: 1) no implementation services.myservice bound. while locating services.myservice parameter 0 @ controllers.mycontroller.<init>(mycontroller.scala:12) while locating controllers.mycontroller parameter 3 @ router.routes.<init>(routes.scala:55) while locating router.routes while locating play.api.inject.routesprovider while locating play.api.routing.router parameter 0 @ play.api.http.javacompatiblehttprequesthandler.<init>(httprequesthandler.scala:200) while locating play.api.http.javacompatiblehttprequesthandler while locating play.api.http.httprequesthandler parameter 4 @ play.api.defaultapplication.<init>(application.scala:221) @ play.api.defaultapplication.class(application.scala:221) while locating ...

entity framework - EF support to join table by condition? -

i have 3 tables following: http://images.cnblogs.com/cnblogs_com/guozili/390921/o_ef.png can ef support following: class product int id {get;set;} string name {get;set;} list<picture> picture {get;set;} class picture ... [foreignkey("product.productid".....when type=1)] int modelid {get;set;} i hope work mapping attribute or such ".totable()...withmany(c=>..).map(....." ef did these ? this achieve (but not exactly) tph strategy, like public class picture { public int32 id {get; set;} public string url {get; set;} } public class productpicture : picture { public virtual product {get; set;} } public class companypicture : picture { public virtual company {get; set;} } and when building model protected override onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.entity<picture>() .map<productpicture>(e => e.requires("type").hasvalue(1)) .map<companypicture...

java - How do I test that a property of a model attribute is not null in using JUnit and MockMVC? -

in junit test below i'm validating model attribute present, has particular type, , particular attribute: @test public void mytest() throws exception { mockmvc.perform(get(my_url)) .andexpect(status().is2xxsuccessful()) .andexpect(view().name(my_view_name)) .andexpect(model().attribute("myform", instanceof(myform.class))) .andexpect(model().attribute("myform", hasproperty("myprop"))); } how test that property not null? i found solution. can use org.hamcrest.beans.haspropertywithvalue.hasproperty follows: hasproperty("myprop", notnullvalue()))

ios - How can I properly move the generated NSManagedObject subclasses into the project? -

Image
i generated nsmanagedobject subclasses , xcode adds them in weird position: the files in red frame (not hand-drawn) generated nsmanagedobject subclasses. can see, not in target "math toolbox", files in green frame. therefore, nsmanagedobject subclasses not being compiled when build app. so try drag them target, , result looks horrible: there 2 sets of these files! i thought files outside target can deleted. deleted files in target turned red , has become inaccessible! this mess! how can move files target , leave no files outside target? this 1 has harassed me! simple steps follow. create subclass way did, create 1 in red box. when create, ensure put them in new proper folder --> next, delete in red box, remove reference --> next, add back, before that, create new group, or select group want them --> and select files --> the final output -->

sql server - How to execute multiple commands using Python ssh connection? -

i want execute multiple commands on linux machine after ssh connection it. first command sql command gives sql prompt. second commands sql query i tried below code doesnt exit out of session. import paramiko nmsip = "ip" user="user" pwd = "pwd" ssh = paramiko.sshclient() ssh.load_system_host_keys() ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) ssh.connect(nmsip, 22, username=user, password=pwd) channel = ssh.invoke_shell() stdin = channel.makefile('wb') stdout = channel.makefile('rb') stdin.write(''' sqlplus select * *'); exit exit ''') print stdout.read() i have given 2 'exits' exit out of sql , linux session respectively. missing here? there better method achieve this?

php - Get value after particular character in string -

i have string follows $str = 'asdasdasd,sdfsdfsdf mynumber=1234, 2323 dfdfdf9898 sdfsdfdsf 234'; i'd return digits within mynumber=1234 . desired outcome $str = '1234'; i use following regex preg_replace('/\mynumber=\d+/', '', $y) replace when required, works perfectly, i'm not sure how use extract numbers after = sign mynumber=1234 ? you can use preg_match following regex: \bmynumber=(\d+) see regex demo the value available in group 1. (\d+) matches , captures 1+ digits group part of resulting array. demo : $re = '~\bmynumber=(\d+)~'; $str = "asdasdasd,sdfsdfsdf mynumber=1234, 2323 dfdfdf9898 sdfsdfdsf 234"; preg_match($re, $str, $m); echo $m[1];

generate pdf file from jasper report with servlet java code -

i have jasper report, put in same package servlets, need generate pdf file it, code doesn't work , doesn't gives error public void print(string numbac , httpservletrequest request, httpservletresponse response) { try { jasperdesign jasperdesign = jrxmlloader .load("fiche.jrxml"); string sql = "select * etudiant " + "inner join filiere on etudiant.code_f=filiere.code_f " + "inner join lieu_nais on etudiant.code_lieu=lieu_nais.code_lieu " + "inner join montant on etudiant.code_m=montant.code_m bac='" + numbac + "'"; jrdesignquery newquery = new jrdesignquery(); newquery.settext(sql); jasperdesign.setquery(newquery); jasperreport report = jaspercompilemanager .compilereport(jasperdesign); //jasperprint print = jasperfillmanager.fillreport(repo...

ios - Delete function doesn't works when animation begins ? -

i trying implement ,long press , delete functionality of apple, myself. i achieved but, there not figure out. when shaking animation starts delete button not take touches. how handle while shaking deleting view. here code; self.frame = cgrectmake(0, 0, 1024, 768); [self setbackgroundcolor:[[uicolor blackcolor] colorwithalphacomponent:0.8]]; circleview = [[uiview alloc] initwithframe:cgrectmake(50,55,90,90)]; circleview.layer.cornerradius = 45; circleview.backgroundcolor = [[uicolor whitecolor] colorwithalphacomponent:1]; circleview.layer.bordercolor = [[uicolor blackcolor] cgcolor]; circleview.layer.borderwidth = 4; uilabel* circleindex = [[uilabel alloc] init]; circleindex.frame = cgrectmake(30, 25, 40, 40); [circleindex setfont:[uifont fontwithname:@"arial-boldmt" size:40]]; [circleindex settext:@"a"]; [circleview addsubview:circleindex]; uiview *exitview = [[uiview alloc] initwithframe:...

android - One fragment with two types of display -

i need fragment shows in container , shows dialog. this sample code maybe help myfragment frag=new myfragment(); //sometimes fragmentmanager fragmentmanager = getsupportfragmentmanager(); fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); fragmenttransaction.add(r.id.container, frag, tag); //sometimes frag.show(getfragmentmanager(), null); you can use fragment extends dialogfragment either embedded view or dialog. please refer part of guide in documentation detailed explanation. have used approach , works perfectly. http://developer.android.com/reference/android/app/dialogfragment.html#dialogorembed

Cordova - jQuery Mobile - Unwanted CSS -

Image
i have custom page in app display wallpaper text. on page, there css. think, jquery. page looks this: that white shadow on text. should not there , dont know how rid of it. i see this: text-shadow: 0 1px 0 #f3f3f3; int jquery mobile css is possible not use jquery mobile css on 1 page? open css file of jquery mobile , every text-shadow, delete them. don't want overwrite every time work on app, got rid text-shadow.

Defining Data Structures/ Types In Haskell -

how possible define data structure in haskell, such there constraints/rules apply elements of structure, , able reflect in type. for example, if have type made of list of type, r = [x | x <- input, rule1, rule2, rule3]. in case, type of r list of elements of (type of x). saying this, loose rules. how possible retain information in type definition. to give more concreteness question, take sudoko case. grid of sudoko list of rows, in turn list of cells. know, there constraints on values, frequency. when 1 expresses types, these constraints don't show in definition of type of grid , row. or not possible? thanks. in example of sodoku, create data type has multiple constructors, each representing 'rule' or semantic property. i.e. data sodokutype = notvalidatedrow | invalidrow | validrow now in validation function return invalidrow detect validation of sodoku rules, , validrow detect successful row (or column or square etc). allows pattern match ...

java - Reflect annotations from android activity class -

i developing api used in android. want use reflection access annotations implemented in android activity class. need reflect api. there way it? i trying pass context api can activity class annotations are. the annotation called action , follows: @action( name = "test", description = "this test", inputs = {"no input"}, output = {"no output"}, controlurl = "/api/v1/" ) public void testaction (){ /* * implements here action! */ } the method used reflect it: private static void getaction() { if (d) log.d(tag, "getaction"); class classwithaction = appcontext.getclass(); annotation[] aannotations = classwithaction.getdeclaredannotations(); for(annotation : aannotations) log.d(tag, a.tostring()); } discovering classes annotated particular annotation in runtime requires, in general, classpath scanning. there no streamlined, official api doing it, thou...

google closure - Run javascript at plovr compile-time -

is possible run javascript @ compile time using plovr? (perhaps defining variable in config file). for example, function returns time script compiled, this: function compiledat(){ return #date.now(); // #date.now() processed @ compile-time } so after compilation, this: function compiledat(){ return 1374580397271; } a few months later, can update not possible using javascript , plovr. other options include: a script makes replace , runs plover a customer compiler pass in google closure

javascript - app_offline.htm doesn't return response to ajax request -

Image
i have created file app_offline.html, contents: { "serverunavailable":"true", "issuetype":"maintenance", "errormessage":"servers down maintanance, please try again later" } and posted server. from app want show message server downtime. when navigate server via google chrome see: okay, cool. but when ajax request app: $.ajax({ // bla bola bla }) .done(function (response, textstatus, jqxhr) { // bla bola bla }) .fail(function (xmlhttprequest, textstatus, errorthrown) { // here want display message }); the xmlhttprequest properties not defined. have tried all: response responsebody responsetype responsexml responsejson status statustext where can find response see in browser? or missing? this code actualy never enters fail function since request didn't fail. when request app_offline.html file give back { "serverunavailable":"true", "issuetype...

javascript - Typed array in QTScript -

i have javascript library reads , writes c++ style data in binary format from/to file. that, use typed arrays (float32array,arraybuffer...). i need port library qtscript. qtscript supposedly compliant ecma-262 defines typed array, can't manage make work. does have tried ?

backbone.js - Rendering Layout in the right time -

i have application several regions , 1 layout using backbone marionette, time time have problem of creating itemview refering el dom element yet rendered, work out rendering calls here , there doesnt feel right. gues question when render layout, should render explicitly, should show regions first , render layout or other way around, this relevant part of code, can see im calling explcitly render method on layout , im showing regions, not sure if right way things: allegrowidget.addinitializer(function (options) { // load templates , append them scripts inject_template("/js/ordering-widget/tpl/combined.html"); // create app layout using skeleton var applayout = backbone.marionette.layout.extend({ el: "#allegro-ordering-widget", template: "#template-skeleton", regions: { checkout: "#allegro-checkout...