Posts

Showing posts from February, 2014

c# - Class with property that can be one of two different types -

i'm developing telegram bot in c# have difficulty implementing message type. according api documentation , chat field can either of type user or of type groupchat . how implement in c#? so far come following code using newtonsoft.json : public class update { .... [jsonproperty("chat")] public user chat { get; set; } [jsonproperty("chat")] public groupchat group_chat { get; set; } .... } but doesn't work webapi 2 controller method since deserialize message using frombody attribute: public async task<httpresponsemessage> post(string token, [frombody] update update) (type update has field message of type message ) is there better way implement message type? since supposed handle seemingly 2 different objects in 1 field don't think can use strongly-typed objects can use dynamic type chat field such as public class telegram { public int message_id { get; set; } public dynamic chat { get; set; } } the

javascript - Change glyphicon icon color inside a datetimepicker dropdown widget -

i'm using gem bootsrap datetimepicker. , used following html code incorporate it: <div id="custom-dates" style=" clear:both;"> <div class="container"> <div class="row"> <div class='col-md-3 col-xs-3'> <div class="form-group"> <b>from:</b> <div class='input-group date' id='datetimepicker6'> <input type='text' class="form-control" style="margin: 0px !important;" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> <div class='col-md-3 col-xs-3'> <div class="form-group"> <b>to:</b> <div class='input-group date' id='datetimepicker7'>

sql server - Is it possible to execute a SQL dbo automatically? -

sorry if sound ignorant i'm new sql. i'm using sql server 2008. have dbo object displays list of items, , when hit "execute" list refreshes current data. my question this: there way set execute automatically every minute or while table display open? plan on sharing out view of database people can see how far along db before attempting query it. hopefully makes sense. tried google'ing seems rather vague topic or i'm confused understand of these sites saying. @ appreciated. clarification: "dbo object" meant table (i think?). example it's named dbo.bridge, , when right click click "edit top 200 rows" see data, , click red exclamation mark @ top of sql server 2008 "execute", causes table update if you're in sql server management studio or visual studio sql server explorer won't able it. can set delays execute, however: while (1 = 1) begin set nocount on; select * [test_p] waitfor delay '

Access to Docker Container Port -

im running boot2docker. have container running ive opened port 8000 for. i.e docker@boot2docker:/home/djangoapp/testtools$ docker ps -a container id image command created status ports names 4c52d46227f2 felix001/djangoapp:1.0 "/bin/bash" 22 hours ago 22 hours 127.0.0.1:8000->8000/tcp ecstatic_noyce however if try access port rst, docker@boot2docker:/home/djangoapp/testtools$ curl http://127.0.0.1:8000 curl: (56) recv failure: connection reset peer any ideas ? you need use ip address of boot2docker vm. 192.168.59.103 .

Get total count of records with a mysql join and 2 tables -

i have 2 tables trying join not sure how make time efficient. tasks table: nid | created_by | claimed_by | urgent 1 | 11 | 22 | 1 2 | 22 | 33 | 1 3 | 33 | 11 | 1 1 | 11 | 43 | 0 1 | 11 | 44 | 1 employee table: userid | name 11 | employeea 22 | employeeb 33 | employeec result trying get: userid | created_count | claimed_count | urgent_count 11 | 3 | 1 | 3 22 | 1 | 1 | 2 33 | 1 | 1 | 2 created_account column show total # of tasks created user. claimed_count column show total # of tasks claimed user. urgent_count column show total # of urgent tasks (created or claimed) user. thanks in advance! i start breaking pieces , putting them together. can created_count , claimed_count using simple aggregation this: select created_by, count(*) creat

python - Unorderable types in "if" predicate -

def determinelettergrade(): global lettergrade, testavg; if (testavg <= str(100)) , (testavg >= str(90)): lettergrade = "a"; else: if (testavg <= 89.99) , (testavg >= 87): lettergrade = "b+"; else: if (testavg <= 86.99) , (testavg >= 80): lettergrade = "b"; else: if (testavg <= 79.99) , (testavg >= 77): lettergrade = "c+"; else: if (testavg <= 76.99) , (testavg >= 70): lettergrade = "c"; else: if (testavg <= 69.99) , (testavg >= 67): lettergrade = "d+"; else: if (testavg <= 66.99) , (testavg >= 60): lettergrade = "d";

javascript - Purposely render Adobe files unusable after a specific date -

i'm looking options me render couple of adobe files ( .indd , .pdf ) will send someone unusable after predetermined date. unusable, mean along lines of corrupt or expired - not allow user view neither text or images files. please let me know if need more information this. far, i've came across powershell , cron jobs, both on head, , unfortunately, time not on side @ moment. i appreciate taking time read this. kind regards. p. i'm relatively sure cannot done in general: pdf file can opened other pdf reader applications. these tools (unlike adobe creative cloud apps) typically not check if time of computer correct. receiver set clock of computer in time (relatively easy operation) , open file non-adobe tool... edit: being said answer on answers.acrobatusers.com suggests using javascript (see code on referred page) or tool called livecycle rights management server able restrict access document when receiver uses standard arcobat tools.

javascript - Why is this angular keypress event bound to $document firing twice? -

i have angular directive binds keypress events on $document , broadcasts them rootscope. the problem fires twice every single keypress. why happening? have removed rootscope broadcast piece still seeing double events being picked up .directive('keypressevents', function ($document, $rootscope) { return { restrict: 'a', link: function () { console.log('linking keypress listener document.'); $document.bind('keypress', function (e) { console.log('keypress detectected on $document. broadcasting $rootscope'); $rootscope.$broadcast('keypress', e, string.fromcharcode(e.which)); }); } } }) i use in view such: <div class="row toppad60 leftpad70" keypress-events ng-cloak> other stuff... </div> edit have attempted unbind listen still seeing events fired twice on first pageload(meaning directive should not have lo

c# - Video brush orientation in Windows Phone Silverlight 8.1 -

i trying set video brush (viewfinderbrush) rectangle(viewfinderrectangle) fill property. using following composite transform, preview of video can viewed looks mirror reflection. (for eg. if try move finger left right, shows right left). added xaml code, has rectangle. viewfinderbrush.relativetransform = new compositetransform() { centerx = 0.5, centery = 0.5, rotation = 270, scalex = -1 }; viewfinderrectangle.fill = viewfinderbrush; xaml code <rectangle x:name="viewfinderrectangle" width="640" height="480" horizontalalignment="left" /> please let me know, overcome issue.

Is it possible to select the logged in email account in MFMailcomposeViewController swift? -

Image
my question may mere foolishness. mfmailcomposeviewcontroller automatically selects logged in email account in device sender e-mail. want know whether possible select email account (if there multiple accounts logged in (yahoo, google, icloud etc.))? using simple mailcomposer, , there no complex codes. in advance when use mfmailcomposeviewcontroller automatically sets email account. don't worry, won't select wrong account. if tap gives choice

html - Creating a drop down menu with Jquery (Show / Hide item) -

trying have section of text appear when click something. trying jquery, having issues. new jquery appreciated. in advance. html code: (i want 'vvvvvvvvvvvv' item click show else) <div class="row" align="center"> <div class="col-sm-4" align="center"> <span> <h6 class="payment-item-title">visa ending in 5555</h6> </span> </div> <div class="col-sm-4" align="center"> <span> <h6 class="payment-item-title">12/2017</h6> </span> </div> <div class="col-sm-4" align="center"> <span id="v-btn"> <h6> <b>vvvvvvvvvvvv</b> </h6> </span> </div> </div> html code ( want appear click): <div align="cen

performance - GCC C vector extension: How to check if result of ANY element-wise comparison is true, and which? -

i new gcc's c vector extensions. according manual, result of comparing 1 vector in form (test = vec1 > vec2;) "test" contains 0 in each element false , -1 in each element true. but how check if of element comparisons true? and, further, how tell first element comparison true? for example, with: vec1 = {1,1,3,1}; vec2 = {1,2,2,2}; test = vec1 > vec2; i want determine if "test" contains truth (non-zero elements). in case want "test" reduce true, because there exists element vec1 greater vec2 , hence element in test containing -1. additionally, or alternatively, want discover element fails test. in case, number 2. said way, want test first non-zero element. int hasanytruth = ...; // should non-zero. "bool" works since c99 int whichtrue = ...; // should contain 2, because test[2] == -1 i imagine use simd reduction-addition command (?) sum in vector number , compare sum 0, don't know how (or if there faster way). guessi

ruby on rails - redirecting logged in users to index if they try to access /login -

so i'm after simple solution can't seem work out. new rails, trying learn , basics down. when users aren't logged in , try , access various pages, redirected /login. want stop them form being able view /signin page if logged in. how can achieve this? update application_controller def current_user @current_user ||= user.find_by_auth_token!(cookies[:auth_token]) if cookies[:auth_token] end sessions_controller class sessionscontroller < applicationcontroller layout "empty" def create user = user.find_by_user_name(params[:user_name]) if user && user.authenticate(params[:password]) if params[:remember_me] cookies.permanent[:auth_token] = user.auth_token else cookies[:auth_token] = user.auth_token end flash[:success] = "you logged in" redirect_to '/' else flash[:error] = "invalid username or password" redirect_to '/login' end end def destroy cookies.delete(:auth_tok

Communication between Cordova iOS app and Apple watch -

we have cordova app , working on supporting apple watch. understand can't run cordova apps directly on apple watch, since there no webkit on apple watch. apps on apple watch seems mirror ever pushed mobile .i.e, of processing expected happen on mobile. hoping reuse of local database layer, server communications , business logic created in cordova app. believe need establish communication between mobile app , watch app. believe mobile app needs active if need call javascript functions available in mobile app. there way call javascript functions apple watch when mobile app in background or inactive. yes can reuse phone app , build watch ui javascript. using plugin: http://plugins.telerik.com/cordova/plugin/applewatch and if phone app closed or in background watch app has no problems fetching data it.

jquery - JAVASCRIPT drag-and-drop from browser to desktop using TOUCH events? -

i'm working on website, supposed allow user drag , drop div containing html canvas offscreen. div made draggable jquery's .draggable() function, this: div_to_drag.draggable({ //some .draggable() properties }) note: jquery .draggable api can found here: http://api.jqueryui.com/draggable/ when user begins dragging div containing canvas off screen, convert canavs image, , save image desktop when user drops. instead of using mouse, user drags div offscreen using touch screen. touch capabilities enabled magictouch.js. here's code handles when user begins dragging: div_to_drag[0].addeventlistener('touchstart', function (event) { // if 2 fingers inside div, user dragging div if (event.targettouches.length == 2) { //convert canvas inside div image //get datatransfer property of event , attach image } }, false); note: magictouch.js follows w3c standards, defined here: https://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html

java - No Mapping Found in HTTP Request with URI [springcodes/functions.jsp] -

before asking new question, have been reading reference , more possibly duplicate questions: no mapping found http request i have wasted hours hair-pulling work. here sample code: dispatcher-servlet <context:component-scan base-package="springcodes.controller" /> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix"> <value>/web-inf/views/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> web.xml <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/</url-patt

How can we change text of Android M permission request dialogue screen? -

if(checkselfpermission(manifest.permission.camera)!=packagemanager.permission_granted) { // permission has not been granted , must requested. if (shouldshowrequestpermissionrationale(manifest.permission.camera)) { toast.maketext(this, "camera access required display camera preview.",toast.length_short).show(); // want change prompt message here instead of giving toast message message explanatory why permission needed } }

java - Persisting association in batches with Hibernate -

i have message entity , recipient entity, former has unidirectional manytomany relationship latter, such (with boilerplate code removed): @entity public class message { @manytomany(fetch = fetchtype.lazy, cascade = cascadetype.persist) @jointable(name = "message_recipient", joincolumns = @joincolumn(name = "message_id"), inversejoincolumns = @joincolumn(name = "recipient_id")) private set<recipient> recipients; } now persist message database, want associate message many recipients, potentially many thousands. therefore want avoid keeping set of thousands of objects in memory, instead persist association in batches, such x recipients in memory @ time. idea following pseudo-ish code. message message = new message(); set<recipient> recipients = first 500 recipients while (recipients != null) { message.setrecipients(recipients); messagerepository.saveandflush(message); if (there more recipients save) {

php - Append Incremental Number to Class in While Loop -

i have standard while loop. want append incremental number class within while loop. while loop is: while($row = mysqli_fetch_array($newnominee)) { print "<tr><td><input type='search' class='namesearch" name='votenominee[]' placeholder='search user' value='$nomname' /></td></tr>"; } so when while loop runs through want class namesearch append: namesearch_1 namesearch_2 namesearch_3 , on.. i've tried adding i=0; before while loop , then: class="namesearch_'+ +'" and i++ after while loop isn't doing trick. any ideas? have on quotes around values $i = 0; while($row = mysqli_fetch_array($newnominee)) { echo "<tr><td><input type='search' class='namesearch_$i' name='votenominee[]' placeholder='search user' value='$nomname' /></td></tr>"; $i++; }

How to return fields in correct order for an ElasticSearch query -

i'm performing multimatch search against elasticsearch index, , want source object fields in same order stored in. however, when response elasticsearch query, fields in alphabetical order (which not particularly useful i'm doing). i'm confident used behave desired way in previous version of es, since upgraded returning fields in alphabetical order. edit: note if perform standard match_all search, fields in original order. wonder if has multimatch query? edit 2: ok, ran again , returned fields in random order (not alphabetical). maybe bug in elasticsearch? you cannot guarantee order in returned. source document plain old json object , by definition : an object unordered set of name/value pairs.

git - ssh agent forwarding not working on ec2 -

i'm trying use ssh agent forwarding on local machine dont have use private key on remote server git clone git@bitbucket.org:username/bucketname.git i have following setup on machine: $cat ~/.ssh/config host bitbucket.org identityfile ~/.ssh/id_rsa host 172.28.128.3 forwardagent yes and have added public key bitbucket site when run ssh -t git@bitbucket.org shows logged in <username>. can use git or hg connect bitbucket. shell access disabled. means ssh protocol working right , can clone repo. but when run on remote machine/host ( mentioned in .ssh/config file ip 172.28.128.3) buntu@remotemachine$ ssh -vt git@bitbucket.org openssh_6.6.1, openssl 1.0.1f 6 jan 2014 debug1: reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: applying options * debug1: connecting bitbucket.org [131.103.20.168] port 22. debug1: connection established. debug1: identity file /home/ubuntu/.ssh/id_rsa type 1 debug1: identity file

JavaScript regex returns -1 when > 0 is expected -

okay have following string: aktiv landbruger / regler al with string attempt run following regex: /regler al/i however once run string.search('/regler al/i') it returns -1 however when attempt on https://regex101.com/ it returns 0 should. so why javascript returning -1 remove single quotes around regex "aktiv landbruger / regler al".search(/regler al/i)

multithreading - Goroutine I/O scheduling -

golangs goroutines present interface of blocking i/o goroutine (-programmer). behind scenes runtime naturally uses kind of non-blocking i/o prevent os suspending os-thread, runtime can run goroutine on top of os thread while i/o performed. when runtime consider i/o performed can reschedule goroutine? to make clear, assuming have net.tcpconn call write on, when can expect goroutine rescheduled? conn, err := net.dial("tcp", serveraddr) conn.write(buffer) timestamp = time.now() that when can expect timestamp taken? when buffer has been copied golang runtime? when buffer has been copied runtime , os's kernel space? when buffer has been copied runtime, kernel space , additionally nic's send buffer? when buffer has been sent on network/from nic? when buffer has been acknowledged recieve ends tcp stack? you can have in file https://github.com/golang/go/blob/master/src/net/fd_unix.go (write function). basically, depends whether socket buffer

PHP file() to foreach array and into img -

i have been trying convert images results list produced file() file_get_contents , have got far cant seem getting where: here's got: <?php $data = file('http://cadenanoticias.com.mx/galerias/notas/22925/'); foreach((array)$data $whoisline){ echo '<img src="http://cadenanoticias.com.mx/galerias/notas/22925/'.$whoisline.'">'; } ?> so far can see ending double quotes , closing bracket , that's it. any idea on how achieve this? with little of php simple html dom parser following. <?php require "simple_html_dom.php"; // create dom url or file $html = file_get_html("http://cadenanoticias.com.mx/galerias/notas/22925/"); // find images foreach($html->find("a") $element) { if (substr(strrchr($element->href,'.'),1) == "jpg") { echo '<img src="http://cadenanoticias.com.mx/galerias/notas/22925/'. $element->href .'">'

xcode - Identify Selected State Swift UI Tests -

i want figure out segment selected on segmented control in xcode's new ui testing in swift. i can segmentedcontrol xcuielement, , 'buttons' associated it, i'm not sure how test selected property. sorry in advance if obvious have missed. xcuielement has selected property can examine: xctasserttrue(app.segmentedcontrols.buttons.elementboundbyindex(0).selected)

internet explorer - How to change how IE / Chrome opens a file in-browser? -

so here's story. @ company, can access previous pay statements online via payroll website. when go @ statement, open statement in-browser via pdf viewer. when working properly, ask if want blank out data or not (which... why want to? point @ statement). now, worked fine when checking out in adobe reader; you'd click "yes, show data" , displays fine, can printed, etc. company decided instead of getting acrobat editing pdf files, better (cheaper) option cheap/free alternative called "nuance" or other. 2 users installed program, , browsers open pdfs in-browser nuance instead of adobe reader. problem, because nuance doesn't show option of hiding or showing data reader did; rather, chooses "no" option, results in blank template pdf coming up. now, whole problem solved if browsers use reader open pdf files in-browser... it's not problem if download pdf, site doesn't seem allow download pdf files. we've tried think of, short of unins

Javascript code not working in LINUX Weblogic, works fine in UNIX box -

i have unique issue java script code works in unix(weblogic 10.3.2) not working after migrating linux (weblogic 12.2) the code changes when check code using view source function checkall(field) { alert(field.rowkeyvar); (var = 0; < field.length; i++){ field[i].checked = true ; } } changes function checkall(field) { alert(field.rowkeyvar); (i = 0; &lt; field.length; i++){ field[i].checked = true ; } } the error when click on button invoke javascript function : syntaxerror: missing ) after for-loop control any pointers on help. it’s not clear process in place convert/migrate code, appears it’s converted < &lt; . for-loop has third semicolon before reaching closing paren. error makes sense, , need fix migration process not html-escape code.

How to intercept the webview response in android -

i have html form in webview, when tap button on it, send request server , server responds accordingly. want intercept server response in android. you have use webviewclient & override methods": webview.loadurl(url); webview.setwebviewclient(new webviewclient(){ @override public void onpagefinished(webview view, string url) { // write code here } //some more methods });

xilinx - Error [Common 17-165] when creating IP core -

i'm trying create ip core in vivado 2015.2 , followed this guide . when trying edit ip in "create , package ip" screen, i'm getting following error. ipx::edit_ip_in_project -upgrade true -name edit_tiger_writeback_v1_0 -directory {c:/users/username/desktop/ip_repo} {c:/users/username/desktop/ip_repo/tiger_writeback_1.0/component.xml} error: [common 17-165] many positional options when parsing '-force', please type 'create_project -help' usage info. error: [ipptcl 7-562] cannot create project 'edit_tiger_writeback_v1_0'. error: [common 17-39] 'ipx::edit_ip_in_project' failed due earlier errors. what mean , how can fix it? i had same errors , problem space character path, moved entire project new 1 without spaces , worked.

Hbase - copy one row from one table to another in diff env - Java -

i created hbaseconfiguration both environments . get g = new get(bytes.tobyte("rowkey")); result r = envatable.get(g); put p = new put(bytes.tobyte("samerowkey")); p.add("need way add result"); envbtable.put(p); solutions found: iterate result, add each keyvalue p . is there anyother way this? since using get, result should contain 1 row. put, need row key, , list of col family, qualifier, value. string rowid = new string(result.getrow()); put put = new put(bytes.tobytes(rowid)); for(cell cell : result.rawcells()) { put.add(cellutil.clonefamily(cell), cellutil.clonequalifier(cell), cellutil.clonequalifier(cell)); } envbtable.put(put); cellutil way extract cell details. hope know every cell has detail rowkey, family, qualifier, timestamp , value. can row key each cell, logical entire row. hope helps. and long have envbtable set up, server same suppose, given have permission user. if using shell, approach might diffe

arrays - Matching words in a list against a stringarray in java -

i need find , replace list of words given user. application reads line line in html file , want verify if there word list , replace blank space. have until think have modify hole code in order want. private static void printfile(file source) throws ioexception { string s; filereader fr = new filereader(source); @suppresswarnings("resource") bufferedreader br = new bufferedreader(fr); @suppresswarnings("resource") printwriter pw = new printwriter("results.txt"); while ((s=br.readline())!=null) { pw.println(s.replaceall("&#160;", "") //words replaced. .replaceall("<br>", "") .replaceall("&amp;", "") .replaceall("</p>", "") .replaceall("</body>","") .replaceall("</html>", "")

ruby - Best in place gem not updating values - rails 4 -

so have installed best in place gem in rails 4 environment , initialised correctly. (i can click on name field , box becomes editable). i've code in admin_namespaced user controller class admin::userscontroller < admin::basecontroller def index @users = user.all # @columns = user.column_names end def show @user = user.find(params[:id]) end def update @user = user.find params[:id] respond_to |format| if @user.update_attributes(user_params) format.html { redirect_to(user, :notice => 'user updated.') } format.json { respond_with_bip(@user) } else format.html { render :action => "index" } format.json { respond_with_bip(@user) } end end end private def user_params params.require(:user).permit(:name,:email,:password,:password_confirmation) end end and want use in conjuction rails datatables gem setup, inline-edit corresponding fields. this html

capl - Error: system event handler not allowed in test module -

when run script following error, compiling file 'zts_zero_to_sixty_analysis.can' error 1176 @ (54,1): system event handler not allowed in test module or test units. error 1176 @ (290,1): system event handler not allowed in test module or test units. these line right @ "on start" , "stopmeasurement". however, when program node in cannalyser , include these scripts , compile them in canalyzer , not give me error. so ignore these errors appearing in capl compiler since not impede running of scripts, still know why capl compiler throws these errors. why these errors thrown? it important understand in test environment, can not use system event handler. tests made organize , make modular version of capl script ensure test environment managed. so in short : simulation node : event-based, used sandbox test nodes. test node : modular, has beginning , end within measurement.

jquery - Ajax table wont filter searches with Datatable pluggin -

i have ajax call create html data , call .datatable html table. when trying make have multiple filters (each column) search function doesn't seem work , when type in returns nothing. below code $.ajax({ type: "get", url: "wcf/wicsreports.svc/userusagereport?unit=" + unittype + "&startdate=01/09/2014&enddate=01/01/2015&tradingparty=" + tradingpartyval($("#ctl00_contentplaceholder1_csusagelviuser_ddltradingparties")), contenttype: "application/json", // content type sent server success: function (result) { $('.divlviuserreportdata').html(result.userusagereportresult); $('.loading').hide(); // setup - add text input each footer cell $('#lvidetails tfoot th').each(function () { var title = $('#lvidetails thead th').eq($(this).index()).text(); $(this).html('<input type=

objective c - Consuming services in iOS 9.0 -

i have implemented following code consuming servives in ios. nsstring *urlstr=[nsstring stringwithformat:@“someurl”]; nsstring *jsonstr=[nsstring stringwithformat:@“{\”someparameter\”:\”%@\”}”]; nsdata *postdata = [jsonstr datausingencoding:nsutf8stringencoding allowlossyconversion:yes]; nsstring *postlength = [nsstring stringwithformat:@"%lu", (unsigned long)[postdata length]]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request seturl:[nsurl urlwithstring:urlstr]]; [request sethttpmethod:@"post"]; [request setvalue:postlength forhttpheaderfield:@"content-length"]; [request setvalue:@"application/json;charset=utf-8" forhttpheaderfield:@"content-type"]; [request sethttpbody:postdata]; nsurlresponse *response; nsdata *postreply = [nsurlconnection sendsynchronousrequest:request returningresponse:&response error:nil]; nsstring *thereply = [[nsstring alloc] initwithbytes:[postreply bytes] length:[postrepl

Android Login with php getting error after successful json parsing -

hi getting error if login correct user name , password.but json response correct showing user not found.where need change code. in advance. getting success json data if login correct user name , password else failure response getting every time showing user not found error. login extends activity { button b; edittext et,pass; textview tv; @suppresswarnings("deprecation") httppost httppost; stringbuffer buffer; @suppresswarnings("deprecation") httpresponse response; @suppresswarnings("deprecation") httpclient httpclient; @suppresswarnings("deprecation") list<namevaluepair> namevaluepairs; progressdialog dialog = null; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.login); b = (button)findviewbyid(r.id.button

c# - CEF with ChromiumFX "failed to establish GPU channel" error when run in VS debugger -

i running winforms app using standard chromiumfx , chromiumwebbrowser components. cef version 3.2171.2069_windows32, , chromiumfx 3.2171.1979.9, referenced dlls. i have 1 form has chromiumwebbrowser control. app start-up code same here . when download source , run it, test application runs ok in vs debugger. using more recent cef , fx version. in app when run in debugger shows empty form , cef log contains entry: [0724/004741:error:gpu_process_transport_factory.cc(437)] failed establish gpu channel. when run compiled exe outside of vs, runs fine. can't figure out problem be. tried running without sandbox, tried running in debug , in release. so, reproduce, download chromiumfx , cef version 3.2171.2069 (from here . create winforms project, reference chromiumfx , chromiumwebbrowser. add 1 form containing webbrowser, update program.cs match 1 shown earlier. , copy cef files paths defined in program.cs. after off-list discussion op problem found: you hav

ssh - Running scp command from java application without api -

i running script send files 1 server using scp .i want use plain ssh no libraries. cmd.exe scp location/ user@v40054a.vstage.co:/path below code p = runtime.getruntime().exec(command); int = p.waitfor(); system.out.println(" start 1 "+a); string line = ""; string outp = ""; bufferedreader b1 = new bufferedreader(new inputstreamreader(p.getinputstream())); bufferedwriter w1 = new bufferedwriter(new outputstreamwriter(p.getoutputstream())); w1.write("password"); it seems program waits input password . can not figure out way give input process . how can . goal give input process application . out using keys or library . can done ?

linq - C# Filter List to remove any double object -

have searched ant tested many examples in forum can't working method. i using linq bulk insert list of entity classes (remotereadings). due unique constraints need filter out items inserted. uniqiuness composed of 2 columns meterid , datetime in remotereadings table. // approx 5000 records (i need in batches of 2000 due // constraint in l2s,but can after working) list<remotereading> lst = createlistfromcsv(); // option 1: // not work comparing memory list db list. need use contains() method. // trying accomplish infollowing examples. list<remotereading> mylst = (from ri in db.remotereadings l in lst l.meterid = ri.meterid && l.date = r.date select ri).tolist(); //// // option2: // list db in memory lst list<remotereading> mylst = (from ri in db.remotereadings

php - mysqli query returns 0 results despite information in MySQL database -

Image
i in process of making login screen once session has been set person can access various pages on site. it seems, however, when send username , password compared have in mysql database results come empty. mysql table: id, username, password, email, group 1, bunbun, hashedpassword, example@email.com, admin php code: <?php include_once("functions/con-open.php"); if (isset($_post['username'])) { $name = $_post['username']; //$password = password_hash($_post['password'], password_bcrypt); $password = $_post['password']; $name = mysql_real_escape_string($name); $password = mysql_real_escape_string($password); } function login($name, $password) { $conn = new mysqli(host,user,password,database); if ($conn->connect_errno) { printf("connect failed: %s\n", $conn->connect_error); exit(); } if ($result = $conn->query("select * persons username='$na

google app engine - Problems with Master/Slave and HRD -

after migration master/slave hrd (high replication datastore) using xxx , xxx-hrd both applications have status running. webpage not available. how can webpage back, , running. is there possibility go situation before migration? at time before clicking "finish migration" can click "pause migration" , click "revert migration" revert migration. please see docs on migrating hrd datastore . if you've finished migration won't able revert migration. may have run issue regarding differences between master/slave datastore , hrd datastore. possibility have run issue migration. encourage @ logs each application find out going wrong. many things cannot migrated serialized datastore , blobstore keys. please see docs on potential migration issues details.

c# - Masterpage method returns null when firing a button event in a derived page -

Image
basically on master page have method returns "campaign" params of unique id , user id. works fine until click button in derived page. the problem when click button in derived page method in master page returns "null". when debugging see correct params. edit// method returns null: var campaign = campaignrepository.getcampaignbyid(convertedcampaignid, user.userid); master page code: protected void page_load(object sender, eventargs e) { string securitytoken = ""; if (httpcontext.current.request.cookies["securitytoken"] != null) { securitytoken = httpcontext.current.request.cookies["securitytoken"].value.tostring(); } var user = user.getloggedinuser(securitytoken); if (user != null) { var convertedcampaignid = request.querystring["cid"];

java - How to open activity from widget like this: if app is not open, open main activity too but if app is open, just open on top of the current activity? -

basically want user able hit , reach main activity @ point. here 2 senarios: if app open, widget launch app , start activity on top of it. if app not open, want main activity present in stack. is possible? think senario 2 code right: intent mainactivityintent = new intent(context, mainactivity.class); mainactivityintent.setflags(intent.flag_activity_new_task | intent.flag_activity_clear_task); //this starts app fresh (i.e. clears current activities) intent addcruisesintent = new intent(context, secondactivity.class); addcruisesintent.setflags(intent.flag_activity_new_task ); //this starts app fresh (i.e. clears current activities) intent[] intents={mainactivityintent,addcruisesintent}; intent[] intents={addcruisesintent}; pendingintent pendingintent = pendingintent.getactivities(context, 0, intents, 0); i wondering if there flag or combination of flags can achieve want.

html - Force base size of images via css possible -

i grabbing images xml feed 320*240 .. sadly, images 320*239 or 320*238. when use these images responsive layout, messes layout. image below wrong scaled image still fine, images besides wrong scaled image pushed 2 rows down. is there way can force base size of images desired 1 avoid problem? had tried work min-height avoid problem, images bit scaled / down when resolution changed. working these values not option. images not saved on server, hotlinked, need kind of way tell browser ignore real image size , accepps size tell him somehow size want 'think' image has. any idea how accomplish that? kindly, sascha

php - Is it possible to check if npm is installed in the system using composer? -

i writing composer file. in file checking whether imagick , mysql installed or not. want make sure whether npm installed in system or not. possible? in advance. you can use exec run npm -v , check exit code. exec('npm -v', $foo, $exitcode); if ($exitcode === 0) { echo 'npm installed!'; }

datetime - python - convert date input to date output without time -

input is: 2011-01-01 output is: 2011-01-01 00:00:00 how output be: 2011-01-01 ?? # packages import datetime def obtaindate(): global d isvalid=false while not isvalid: userindate = raw_input("type date yyyy-mm-dd: ") try: # strptime throws exception if input doesn't match pattern d = datetime.datetime.strptime(userindate, '%y-%m-%d') isvalid=true except: print "invalid input. please try again.\n" return d print obtaindate() actually not same reference. i'm asking date not time. just format parsed object desired formatting. d = datetime.datetime.strftime(datetime.datetime.strptime(userindate, '%y-%m-%d'), '%y-%m-%d')   >>> d '2015-05-09' ...actually, if don't want change formatting @ all, this: try: # strptime throws exception if input doesn't match pattern datetime.datetime.strptime(userindate, '

android - Spoon deleted all the files in the Documents directory -

i using spoon run automated tests on android devices. have made shell script @ point runs tests through spoon on connected devices. configured saves output in /users/myusername/documents/ run_id unix timestamp. my problem that, (4 times until now, in 6 months) deletes files , folders found in documents directory. don't know why it's frustrating have other things saved in there, shouldn't deleted means. don't know change behaviour hope guys can give me advice. this error output got when tried delete (managed catch it): 2015-08-05 13:54:27 [sr.runtests] executing instrumentation suite on 7 device(s). exception in thread "main" java.lang.runtimeexception: unable clean output directory: /users/myusername/documents @ com.squareup.spoon.spoonrunner.runtests(spoonrunner.java:132) @ com.squareup.spoon.spoonrunner.run(spoonrunner.java:113) @ com.squareup.spoon.spoonrunner.main(spoonrunner.java:530) caused by: java.io.ioexception: unable delete fi

c++ - codelite clang separate options -

Image
i did follow suggestions on the documentation enable clang code completion , seems on recent version there no option add search paths , compiler flags separately, tried adding compiler flags on search path window, not showing evidence caught new paths: any idea i'm doing wrong? you don't need set paths separately clang code completion work. need re-build (i.e. clean follow build) project once. if done properly, should see in codelite's build log lines similar to: codelite-cc g++ ... (or codelite-cc clang++... ) codelite-cc utility collect search paths (and macros , other flags) passed compiler , pass them codelite, pass libclang getting proper code completion code.

bash - Find out which package I have to install on a Linux system -

i made bash script install software package on linux system. there 4 packages can use install software: x86.deb x86.rpm x86_64.deb x86_64.rpm i know when install package on linux server manually, find out "automatically" (in bash script) 1 have install. is there command find out? know there way find out architecture (32-bit or 64-bit) via "arch" command, not know how find out package need. uname -m or arch gives architecture ( x86_64 or similar). you can figure out whether system based on rpm or deb (e. g. ubuntu deb-based) asking both variants package installed /bin/ls : dpkg -s /bin/ls will print coreutils: /bin/ls on deb-based system. rpm -q -f /bin/ls will print coreutils-5.97-23.el5_6.4 on rpm-based system (with different version numbers). on "wrong" system each of these give error message instead. if dpkg -s /bin/ls >/dev/null 2>&1 case "$(arch)" in x86_64) sudo dpkg -i

actionscript 3 - easeljs Movieclip vs Sprite -

i new easel js. when convert flash/as3 project html5canvas project using adobe flash cc, animations , movieclips become easeljs movieclip. in easeljs can use sprite show animation. using movieclip easy since flash generate it. my question whether there benefit of using easeljs sprite instead of easeljs movieclip in terms of performance? sprite , movieclip totally different in easeljs. in flash, movieclips extend sprites, have similar functionality. in easeljs, sprite displays frames of spritesheet , , movieclip content container , understands concepts of frames , including timelines , frame actions. movieclips used flash cc output, although can make them manually. ideally, flash export sprites , spritesheets when makes sense - because of nature of flash timeline animations, incredibly difficult determine when , how export sprites/spritesheets vs movieclips. strictly speaking on performance, sprites should better performing because use single (or few) bitmap(s) f

java - Converting JavaFX to Android using gradlew -

i new javafx, , trying convert android apk using javafxmobile plugin. while converting android using gradlew, getting error execution failed task ':dex' . system has jdk 1.8u40 installed , gradle configured it. tried using dalvik sdk, still not converting. here complete error: c:\users\vss\documents\netbeansprojects\andytest>gradlew android :compilejava up-to-date :compileretrolambdamain up-to-date :processresources up-to-date :classes up-to-date :compileandroidjava up-to-date :compileretrolambdaandroid skipped :compiletestjava up-to-date :compileretrolambdatest skipped :compileretrolambda up-to-date :mergeclassesintojar :validatemanifest :collectmultidexcomponents :shrinkmultidexcomponents :createmaindexlist :dex [ant:java] java result: 1 :dex failed failure: build failed exception. what went wrong: execution failed task ':dex'. org.gradle.api.gradleexception (no error message) tried: run --stacktrace option stack trace. run --info or --de