Posts

Showing posts from April, 2010

api - How to get response values to our activity class without using database in android? -

i have made 1 login api in using parsing getting 3 values,i want values in activity without stroing database??please see code , give me idea..! loginapi package com.epe.yehki.backend; import java.util.arraylist; import org.com.loopj.android.http.jsonhttpresponsehandler; import org.com.loopj.android.http.requestparams; import org.json.jsonarray; import org.json.jsonobject; import android.content.context; import android.util.log; import android.widget.toast; import com.epe.yehki.util.const; import com.epe.yehki.util.pref; import com.epe.yehki.util.utils; import com.example.yehki.r; public class loginapi { public context context; public responselistener responselistener; public string password; public string email; string cust_id; string cust_name; string cust_email; public loginapi(context context, responselistener responselistener, string email, string password) { this.context = context; this.responselistener = responselisten...

Python: How to find the a unique element pattern from 2 arrays? -

i have 2 numpy arrays, a , b : a = ([1, 2, 3, 2, 3, 1, 2, 1, 3]) b = ([2, 3, 1, 2]) where b unique pattern within a . i need output elements of a , aren't present in b . output = ([1, 2, 3, 1, 3]) easiest use python's builtins, i.e. string type: a = "123231213" b = "2312" result = a.replace(b, "") to efficiently convert numpy.array str , use these functions: x = numpy.frombuffer("3452353", dtype="|i1") x array([51, 52, 53, 50, 51, 53, 51], dtype=int8) x.tostring() "3452353" (*) mixes ascii codes ( 1 != "1" ), substring search work fine. data type should better fit in 1 char, or may false match. to sum up, quick hack looks this: a = numpy.array([1, 2, 3, 2, 3, 1, 2, 1, 3]) b = numpy.array([2, 3, 1, 2]) numpy.fromstring(a.tostring().replace(b.tostring(), ""), dtype=a.dtype) array([1, 2, 3, 1, 3]) # note, here dtype int, i'm relying on fact that: # "1 match...

c# - Adding a default string if list empty -

i'm writing out aggregated list of statuses. works fine except situation there none. @ moment, null rendered , position empty. item.stuff.where(e => condition(e)) .select(f => f.status) .aggregate(string.empty, (a, b) => + b) now, i'd populate table element " --- " in case list filtered down empty 1 condition can't decide on method. what smooth way approach it? i've tried atrocity below looks, well..., atrociously , doesn't render right, neither. see actual source code line (preceded false or true ) instead of values. item.stuff.where(e => condition(e)).count() < 1 ? "---" : item.stuff.where(e => condition(e)) .select(f => f.status) .aggregate(string.empty, (a, b) => + b) you this. if status list reasonably small (otherwise 1 should use stringbuilder anyway , not string concatenation). item.stuff.where(e => condition(e)) .select(f => f.status) .aggregate("---...

How to customize the popup time of iOS permission dialog for push notifications -

i know there no possibility permission dialog can customized or disabled long application push enabled. wonder if popup time can postponed. i have seen candy crush saga so. the permission dialog not appear until reach level when customize dialog popup , ask if receive notifications candy crush saga , if press ok, comes ios standard permission dialog push notifications. when call registerforremotenotificationtypes: first time dialog shown. so, don't call until need it. also, consider asking user / informing user gain accepting , asking if they're interested. if are, use user defaults record , check before calling registerforremotenotificationtypes: in app delegate (for each startup). if user happy set flag in user defaults , call registerforremotenotificationtypes: first time.

javascript - window.opener not set after a gui.Window.open() -

i'm building app node-webkit , experiencing trouble opening new window. basically happens in app : open splash.html ( splash screen ) open main application ( main.html) gui.window.open() hide on 'loaded' event, close first window ( splash.html ) , show main.html in app can compose email creates new window ( composer.html ) user click compose button -> open composer gui.window.open() the compose window rely on main window it's logic, main window accessed window.opener this works fine using regular browser, when bundle inside node-webkit, window.opener undefined. because ( ~10% ) opener set in compose window. tried figure out wrong googling on subject didn't helped me. the things tried : setting window opener current window after opening => fail going down first opened window ( 1 defined in package.json ) call open() => fail if has hints on how solve this, appreciated. i'll happy give more details if required. [edit] h...

Facebook: Shared Page's Image Title Position -

i wonder there way choose og:title text position in facebook post when web page being shared? want og:title text placed @ center of shared og:image instead of default left bottom corner. here example: https://www.dropbox.com/s/ijs9lc93hng5zds/og-exmaple-2.png

php - Parse error: syntax error, unexpected T_IF -

i have become stuck problem week or now, , can't seem wrap head around it. put hands , admit not greatest php any highly appreciated.. trying achieve drop down menu has 3 categorys 'all', 'fencing' , 'driveways'. when selected want specific images displayed according category, , when 'all' selected display every image in table.. have mysql table set 'image' 3 columns; 'id', 'img' , 'category'. edit : warning: mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given in /home1/wlarter/public_html/portfolio.php on line 80 while($row = mysqli_fetch_array($result)) <form action="portfolio.php" method="post"> <select onload="displayproject(this.value);" onchange="displayproject(this.value);"> <option value='none'>all</option> <option value='1'>fencing</option> <option value='2'>driveway<...

javascript - Synchronise multiple scroll div with inertia effect -

i have multiple div scroll @ same time. had css property have inertia effect on div (for safari on ipad) -webkit-overflow-scrolling: touch; . works on desktop web browser. have effect want change when launch webpage on ipad. the problem on ipad : when use inertia effect, div synchronize when inertia effect finished. have same effect desktop web browser, is, synchronized effect of inertia , not @ end. you know, if there solution? to complete explanation, created : jsfiddle as know, css scrolling inertia on mobile devices cannot handled javascript. element scroll event fired when scroll hand , when animation finished. during animation no events fired. have emulate inertia javascript sync divs (and not idea).

Android NFC writeNdefMessage throws IOException Tag is not ndef -

i'm developing nfc environment consisting of tag (as3953 chip + microcontroller) , smartphone (samsung galaxy fame runnung android 4.1.2). while reading ndef message works i'm stuck on writing message tag. copied of code http://tapintonfc.blogspot.de/2012/07/the-above-footage-from-our-nfc-workshop.html , modified accept iso14443a tag type 4 searching tag techlist isodep, nfca , ndef in supportedtechs(). since of them listed app continues writetag(): public writeresponse writetag(ndefmessage message, tag tag) { try { ndef ndef = ndef.get(tag); if (ndef != null) { log.d(tag, "writetag: tag type: "+ndef.gettype()); ndef.connect(); log.d(tag, "writetag: connected!"); if (!ndef.iswritable()) { return new writeresponse(0, "tag read-only"); } if (ndef.getmaxsize() < message.tobytearray().length) { return new writeresponse(0, "size error"); } ...

c# - Visual Studio 2013 Web Deploy Package Issue -

i've been using web deploy package publish site i'm working on our test server reason started including .sln file , doesn't seem compiling solution anymore. i've checked configuration , using release build when deploy of .cs , .designer.cs included. i'm deploying second site using same setting , deploying ok. has else experienced this? i've cleaned , rebuilt solution , i've deleted publish profile , created new 1 nothing has helped. any pointers appreciated. i've sorted now. turns out in project properties > package/publish web tab had items deploy drop down set "all files in project". changed "only files needed run application" , worked expected.

how to replot saved figures in Matlab -

i have matlab script in saved multiples figures, read them again matlab, tried function hgload , imread didn't help. idea done ? update fig = hgload('frame.fig'); plot(fig); you have use: hgload frame.fig

json - Unable to get the value of JSONObject in android -

i unable value of "wpcf-video" , "wpcf-icon" "custom_fields" object json url. want value if each "wpcf" inside custom fields , string can "putextra" value of , getintent in next activity. please help. im beginner in android , helpful if straight forward solution, im doing thesis in university. thank understanding.. json url: "status": "ok", "count": 3, "count_total": 3, "pages": 1, "posts": [ { "id": 85, "title": "lesson 3 commarts", "content": "<p>lesson 3 commarts content here<\/p>\n", "excerpt": "<p>lesson 3 commarts content here<\/p>\n", "custom_fields": { "wpcf-video": [ "" ], "wpcf-pdf": [ "" ], "wpcf-icon": [ "http:\/\/loaapp.abundantli...

java - Gwt flex table getRowCount() method not returning current value -

i using gwt flextable , have 1 issue: deleting row after when try add new row giving rowcount value including removed row because of while iterating last row giving indexoutofboundsexception . for( count=0; count < table.getrowcount(); count++ ) { } giving exception [fatal] uncaught exception: [java] java.lang.indexoutofboundsexception: [java] column index: 0, column size: 0 please have @ demo on gwt showcase - flextable . here code add/remove row directly show case. use these method perform these operation. check row count first before doing operation. /** * add row flex table. */ private void addrow(flextable flextable) { int numrows = flextable.getrowcount(); flextable.setwidget(numrows, 0, widget1)); flextable.setwidget(numrows, 1, widget2)); flextable.getflexcellformatter().setrowspan(0, 1, numrows + 1); } /** * remove row flex table. */ private void removerow(flextable flextable) { int numrows = flextable.getrowcoun...

xml - xpath combined with local-name and arrays -

i have , selects in xml 'documentnature' //*[local-name()='documentnature'] this returning 2 rows because have 2 xmls , return first 1 kind (but not work): //*[local-name()='documentnature'][0] how should ? thanks unlike many other programming languages, in xpath positions in node list starting 1 . use this: //*[local-name()='documentnature'][1] if want select first element having local-name.

javascript - Meteor Session.get and Regex -

is there possibility (in meteor) session keys , match them regex? session.set( /(?:^|\w)word-(\w+)(?!\w)/g , false ) i want set them false. know first word in key name, , same. session not designed work regexp . on other hand can use client-side collections storing information of type. so var mysession = new meteor.collection(null); // null important! mysession.update({key: {$regexp: /* regexp */}}, {$set: {value: false}}); remember collection reactive data-source session , behave identically session in terms of templates rendering. difference data mysession erased after hot code push. can fixed using reload or amplify package quite different story.

vba - How to create a trigger (or type of) in ms access 2003? -

i have purchased application, has vb , ms access 2003 used.application insert or update ms access on button click.i want create trigger or stored procedure or event on table insert new row table if primary table updated or inserted. that feature (which access calls "event-driven data macros") added access 2010 .accdb file format. not available in earlier .mdb file format used access 2003.

c - How to reverse a string without using in-built and temporary variables -

this question has answer here: segmentation fault occurring when modifying string using pointers? 7 answers is possible write function can reverse string without using buffer string? [duplicate] 2 answers reverse operations out temporary variable , in-built functions string reverse. you can using xor logic this: char* rev(char* str) { int end = strlen(str) - 1; int start = 0; while (start < end) { str[start] ^= str[end]; str[end] ^= str[start]; str[start] ^= str[end]; ++start; --end; } return str; }

jsp - Currency conversion in online shopping website -

in online shopping website have. how can change currency , forth different currency rates based on user's selection preference or choice? for example: suppose have user uk items price must converted in pound (£) when displayed. if user want see item price in rupee , if user india need automatically changed rupee, anybody can explain? i think first need setup localizations. should detect when user logins or press country , change price rate. accordingly have following once change of user noticed. you need have way keep excange rate dollar , pound , ruppee in database or sort of way.(flags need turned on @ stage) when localization activated recompute price based on flag let if usa flag on. math , return items user , same other countries want . itemprice * exchagerate = the actual price of country rate alloha .

html - Bootstrap 3 Container Fill Left and Right space -

i trying create centered container using bootstraps container class, , left , right of have 2 separate divs fill remainder of white space. i tried alot things, busy trying create using columns now. no luck. only thing is, container needs have max width of 960px here's jsfiddle and code far: html: <div> <div class="col-md-1 pull-left" style="background: #000099;">left</div> <div class="container" style="background: #002500">contain</div> <div class="col-md-1 pull-right" style="background: #005580">right</div> </div> any appreciated. since bootstrap grid has 12 colums, more this.. <div> <div class="col-md-1" style="background: #000099;">left</div> <div class="col-md-10" style="background: #002500">contain</div> <div class="col-md-1" style=...

ios - Can't use Barcode scanner in Cordova (plugin is installed). -

i'm having problem cordova app when trying use barcode scanner plugin. the plugin seems installed correctly, since when type in cordova plugin ls response: [ 'com.phonegap.plugins.barcodescanner', 'org.apache.cordova.console' ] however tried multiple ways of triggering scanner none worked. copied barcodescanner.js www folder , in index.html if read it's not necessary anymore. suggested way in read-me file is: cordova.plugins.barcodescanner.scan() which didn't work out. tried numerous other things none of them worked. i'm hoping here encountered same issue , found solution. i'm testing ios app version. add config.xml <feature name="barcodescanner"> <param name="android-package" value="com.phonegap.plugins.barcodescanner.barcodescanner" /> </feature> and while using plugin function clickscan() { cordova.plugins.barcodescanner.scan( function (result) { al...

vb6 - Arabic word search tool -

i want make search tool find specific word in arabic language can find word example: ذهب الولد إلى المدرسة من البيت و منهم الى البيت if try find word "من", code not finds word "من", finds part of word " منهم". don't want program that. want find word " من" , every word , make whole case word. to make things more clear (using english example), if search word 'to' in following sentence, want whole words found, , not words contain word 'to' such 'toward' become part of result. sentence: want go towards bus. searches can frustrating. add space @ front of search string , @ end , search searchstring. so... "i want go towards bus." becomes " want go towards bus. ". search " ". problem method punctuation can cause problem. example, if wanted search "bus", use: " want go towards bus. " , search " bus ". not found because there punctuation ...

android - Loader for SQLite database, no ContentProvider -

is not possible use interface loadermanager.loadercallbacks without use contentprovider? (in easy way..) thank you there number of well-received solutions here on so (you may want review answers , references ease of use). there interesting article walk through approach seems directly related request - android custom loader load data directly sqlite database . interesting footnote found on this sample indicates: 1 don't need worry registering listener loader unless plan on using without loadermanager. loadermanager act "listener" , forward results loader delivers loadercallbacks#onloadfinished method. ↩ however, suggest try merging database calls found in sample within existing master detail activity automatically created android studio. default dummycontent can replaced custom class representing actual content in database. @ point using proper activity , list fragment frameworks manage sqlite database calls.

dns - how to get IP address of sub domain -

i'm trying ip address host "api.tripadvisor.com" keep changing . wanted know how possible ? also how internet domain start "api" . thought "www" . appreciate quick response . thanks , raj api subdomain tripadvisor.com, example play.onlinegame.com. believe can have many servers 1 website , each time check ip address you're checking ips of different servers. done reduce bandwidth on tripadvisor.com. if can tell need ip addresses further.if wanted of ips of tripadvisor suggest whois website multiple times check of ip addresses associated website

c# - Call CodeBehind Method from JavaScript with parameter -

i'm trying call code behind method javascript code. works fine, not sure how can pass javascript parameter method. if put value between parenthesis, related codebehind context rather script context. solution pass parameter? javascript: var arg = this.id <% setselection(arg); %> c#: [webmethod] public void setselection(string productid) { session["selection"] = productid } i error of course: cs0103: name 'arg' not exist in current context your setselection(arg) call not calling code behind javascript. getting called on server side, before html response output browser, way before javascript executes. arg treated c# variable. if want make call javascript, need use ajax. see this example .

php - "Invalid argument" on posted array foreach loop -

yo, have simple foreach loop: foreach ($_post['carid'] $carid) { $query = "delete cars carindex = ".$carid.""; echo $query; } but i'm getting error: warning: invalid argument supplied foreach() in k:\xampp\htdocs\cars\deletecar.php on line 8 line 8 being: foreach ($_post['carid'] $carid) the array "($_post['carid']" created multiple checkboxes on page , posted using submit button form. the form is: <form name="input" action="delete.php" method="post"> <input type="submit" value="submit"> <while loop> <input type="checkbox" name="carid[]" value="'.$row['carindex'].'"> <end loop> </form> the actual check box within loop based on mysql query. the array made here sent page displays selected database records using foreach loop create statment query. exact...

javascript - fitBounds in PrimeFaces gmap component -

is there way call fitbounds method in google map object created primefaces gmap component ? tried code below, javascript error: typeerror: primefacesmap.fitbounds not function . appears fitbounds overriden boolean property primefaces framework. <h:head> <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"/> <script type="text/javascript"> //<![cdata[ function initprimefacescomponent(){ var primefacesmap = gmtls.getmap(); var bounds = new google.maps.latlngbounds(); var points = [ new google.maps.latlng(41.3, 2), new google.maps.latlng(41.309, 2) ]; // extend bounds each point (var = 0; < points.length; i++) { bounds.extend(points[i]); new google.maps.marker({position: points[i], map: primefacesmap}); } // apply fitbounds primefacesmap.fitbounds(bounds); } //]]> </script> </h:head> <h:body onload="i...

IsPost property in asp.net -

i'm trying use ispost porperty in asp.net code, don't understand object property belonged? i'm trying use webpagerenderingbase.ispost but exception raised. i found link says, when overridden in derived class, returns value indicates whether http data transfer method used client request web page post. returns true if http verb "post"; otherwise, false.

image - WindowsPhone 8 and AngularJs - ng-src not working? -

im trying run (phonegap / angular) app on windows phone emulator. works fine images not displayed. figured out ng-src troublemaker. when im using src instead of ng-src local images in same folder - works fine. here examples: dispalyed: <img ng-click="mediaplay()" ng-hide=showbutton() src="img/go.png" style="float: right"> not displayed: <img ng-src="img/{{poi.poiimage}}" style="display: block; margin: 0 auto"> my app works perfect on android , ios. any ideas how fix this? edit* ok getting weird o0... i've putted "img/{{poi.poiimage}}" in p tag , gives me path: img/poi-12-galgentor-01.png so tried src: <img src="img/12-galgentor-01.png" style="display: block; margin: 0 auto"> and ng-src: <img ng-src="img/12-galgentor-01.png" style="display: block; margin: 0 auto"> both worked me! but this... <img ng-src="img/{{poi.p...

windows - How can Word 2013 be automated from a C# Interop/COM program using Task Scheduler with a user logged on and the desktop locked? -

i have inherited c# program used automate creation of daily report on windows xp pro sp3 using pdfcreator 1.2.3, mapinfo professional 11, word 2003, , excel 2003. win xp machine in active directory domain , c# program ran domain user (with administrative permissions) user logged in , desktop locked. word 2003 automated open template, create document template, , save document--all from/on network share. excel 2003 used open spreadsheet table linked odbc datasource , refresh table, pulling new data spreadsheet. mapinfo used generate map images odbc datasource. pdfcreator used take spreadsheet, word document, , images , put them daily report. as xp has reached end-of-life have moved program win 8.1 ee virtual machine (in same domain) , have installed office 365 products (word 2013 , excel 2013) along pdfcreator 1.7.1 , mapinfo professional 12 use in automating creation of daily report. program works when run manually on new vm, fails when run same user scheduled task. schedu...

jquery - Generate pages with javascript -

i'm working in company creating web app, , moving legacy yii php controllers more dynamic style. instead of generate html php, app it's moving ask data java private api , receive json generate html elements javascript, there still elements generated in php code. my question is: viable use server code (php, ruby, java...) generate data in json , create via javascript once it's received? (maybe body, head tags :p) pros? cons? if it's not bad idea, there tips? frameworks (like dust.js, backbone...) advices? why should continue idea or why away it? edit: example: a php generated page (from yii framework using mvc said - not mixing backend , frontend) basic information page header, side menu, footer, , content without functionality. once page received, js takes control , adds functionality, right? the other point is: same page php not rendering <html><body></body></html> (just basic stuff, maybe more including js files, headers.....

How to unset Minimize and Maximize Option in Grocery Crud (CodeIgniter) -

how disable/unset minimize , maximize option added default in grocery crud table i guess happens in flexgrid theme (the default theme of grocery). to achieve change default theme of grocery in order use twitter bootstrap or datatables theme. use function called set_theme that. here code sample of how this: //this controller method function offices_management() { $crud = new grocery_crud(); $crud->set_theme('twitter-bootstrap'); //change theme here $crud->set_table('offices'); $crud->set_subject('office'); $crud->required_fields('city'); $crud->columns('city','country','phone','addressline1','postalcode'); $output = $crud->render(); $this->_example_output($output); } if need / want use default theme, have following steps: 1 - open file ../assets/grocery_crud/themes/flexigrid/views/list_template.php using editor (for example notepad++ o...

android - Create firbase instance programatically -

i new firebase excited learning more, have tried simple chat , works great. building simple product review mobile app on android, want find out possible create firebase automatically code in java? want create different group chats give user ability create group chat mobile phone. you should use single firebase, each group chat child of it. using firebase's lists functionality, firebase can automatically generate id each group chat. then, in each chat, can have list of messages corresponds contents of chat.

java - Adding debug=browser query parameter has no effect -

i'm debugging struts 2 application , trying debugging interceptor work. in struts.xml added line , restartet tomcat: <constant name="struts.devmode" value="true" /> next added ?debug=browser url. unfortunately has no effect. page show before, no debug information visible. what's missing? you missing dojo plugin . more detailed information debugging can see via following link. "the browser mode adds interactive page display objects value stack (it requires dojo plugin)"

backbone.js - Close Marionette nested regions -

if close region, has nested region - close both or every region should closed separately? every child of region being closed closed properly. there's no need separately. see: https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.layout.md#closing-a-layout

parsing - Dealing with overloaded symbols in ambiguous grammars in ANTLR4 -

i trying write parser dialect of answer set programming (asp) which, in terms of grammar, looks prolog extensions. 1 extension, instance expansion , meaning fact(1..3). instance expanded in fact(1). fact(2). fact(3). . notice language understands int , float numbers , uses . terminator. in cases parser fails distinguish between integers, floats, extensions , separators because reckon language ambiguous. in cases, have explicitly separate tokens white spaces. prolog or asp parser, however, correctly deals such productions. read antlr4 can disambiguate problematic productions autonomously, needs don't know how do! ;-) read here , here , apparently did not me. could please tell me overcome ambiguity? please notice cannot change language because quite standard. in order simplify experts' work, created minimal working example follows. grammar test; program: statement* ; statement: // dot statement terminator range dot | intnum dot | floatnum dot ; in...

C++ inline closure analogue -

a function executes block of code twice: cnt = 0 , cnt = 1. use following implementation: int func { int v1, v2, ... , vn; #define cnt 0 // block of code: operations v1, ... , vn #undef cnt #define cnt 1 // same block of code #undef cnt } this code quite ugly. using inline function lead uglier piece of code: i'd need pass variables involved function reference. i'd create kind of closure. i cannot use struct nested { __forceinline void block(const int cnt) { // block of code }; }; because v1, ... , vn shouldn't made static performance reasons. i tried using lambda function visual c++ 2013 fails inline inlining set "any suitable (/ob2)" (even pgo) , hurts performance. any suggestions? you this: struct func_impl { int v1, v2, ..., vn; int res; template <int cnt> void blockofcode() { ... } }; int func() { func_impl f; f.blockofcode<0>(); f.blockofcode...

SQL alter table works in MySQL but not in Oracle -

i have created table users create table users ( id int, name varchar(40) ); now want default value name this query works in mysql not in oracle database 11g xe alter table users alter name set default 'user'; can explain why ? the syntax adding default existing column different in oracle, viz: alter table users modify (name default 'user'); sqlfiddle here

asp.net - web host claims angular is not supported? -

i published asp.net project winhost.com works except angular. assumed linking problem or incorrect path. jquery working fine. error when try load page is: uncaught error: [$injector:modulerr] http://errors.angularjs.org/1.2.15/$injector/modulerr?p0=texasiceapp&p1=err…js.org%2f1.2.15%2f%24injector%2funpr%3fp0%3dn%0a%20%20%20%20at%20error%20(...<omitted>...0) angular?v=6jqv6bprzjtlcnp9nkz6zugfhwmvvjtnrzazrqgn2mi1:1 when run on localhost works fine. when emailed there support staff there response: hello, i'm sorry don't support angularjs in our hosting environment. please let me know if have further questions, moises winhost support department how not supported? isnt javascript?? has else had problem? app.js 'use strict'; var app = angular.module('texasiceapp', [ 'ngcookies', 'ngresource', 'ngsanitize', 'ngroute', 'ui.bootstrap', 'ngekathuwa' ]) bundleconfig public cl...

groovy,Jsoup, get status code -

i hope can me have been searching didn't find working. i connecting number of urls list , works fine started getting 404 error on hence want catch error program doesn't terminate , keeps going through list urls. this error got org.jsoup.httpstatusexception: http error fetching url. status=404, url=http:nameofthesite i using jsoup.connect , error caused in line of code document doc= jsoup.connect(countryurl[i2]).timeout(10*1000) .useragent("mozilla/5.0 (windows nt 6.0) applewebkit/536.5 (khtml, gecko) chrome/19.0.1084.46 safari/536.5") .get(); how can change code can status code. i've tried connection.response (something found on site solution sort of problem) getting casting error connection.response response= jsoup.connect(countryurl[i2]).timeout(10*1000) .useragent("mozilla/5.0 (windows nt 6.0) applewebkit/536.5 (khtml, gecko) chrome/19.0.1084.46 safari/536.5") ...

asp.net - Mvc add id and css class in MVC Html.BeginForm() -

i new mvc. how can add id , css class in mvc html.beginform(). this html form. <form id="frmid" class="frmstyle"> ... </form> i tried got error. @html.beginform("actionname", "controllername", new {id="frmid", class = "frmstyle"}) we add part of htmlattributes. @html.beginform("actionname", "controllername", formmethod.post, new {id="frmid", @class = "frmstyle"})

Python logging messages appears in stdout when script is launched -

i'm setting logging feature in test script, when run messages appearing on console(stdout), log file written ok, how can avoid behaviour? want messages in log file. thanks. import logging import logging.handlers log_file = "/var/log/mylog.log" logger = logging.getlogger('mylog') logger.setlevel(logging.debug) formatter = logging.formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') file_handler = logging.handlers.rotatingfilehandler(log_file, maxbytes=10*1024*1024, backupcount=5) file_handler.setformatter(formatter) file_handler.setlevel(logging.debug) logger.addhandler(file_handler) console_handler = logging.streamhandler() console_handler.setformatter(formatter) console_handler.setlevel(logging.debug) logger.addhandler(console_handler) .... as @alecxe said, should change console_handler code to: console_handler = logging.streamhandler() console_handler.setformatter(formatter) console_handler.setlevel(logging.error) logger....

BizTalk Wcf_Custom - SQL Deadlock Issue -

i have db sp updateclientid below. takes client id parameter. i'm calling updateclientid sp 50 times in 1 second, wcf custom adapter. i'm seeing sql deadlock issue. in scenario, have call updateclientid sp 50 times in 1 second. how resolve sql deadlock issue? create procedure [dbo].[updateclientid] @clientid varchar(50) = null begin set nocount on; update cleintdetails set status = 'y' clientid = @clientid end do have to call stored procedure 50 time in 1 second or case happen call 50 times per second? some options: set ordered delivery on send port. serialize requests. several orders of magnitude slower. optimize statement lock hints, rowlock example.

chrome devtool extension access files in the workspace -

how chrome devtool extension access files in workspace? are there api? i want , set files' content. take @ chrome.devtools.inspectedwindow.getresources , may fit bill.

swing - JTable: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0 >= 0 -

i have problem when called function. created jtable , want show data arraylist. please, me solve it! private void loaddata() { string[] columns = new string [] { "ho", "tenlot", "ten", "ma", "ngsinh", "dia chi", "phai","luong", "manvql", "phong" }; defaulttablemodel model = new defaulttablemodel(null , columns); arraylist<clsnhanvien> ds = new arraylist<clsnhanvien>(); ds = nhanviendao.nhanviendao.laydanhsachnhanvien(); (int = 0; <ds.size(); i++) { string ho = ds.get(i).gethonv(); string tenlot = ds.get(i).gettenlot(); string ten = ds.get(i).gettennv(); string ma = ds.get(i).getmanv(); date ns = ds.get(i).getngaysinh(); string dchi = ds.get(i).getdiachi(); string phai = ds.get(i).getphai(); float luong = ds.get(i).getluo...

python - Filter() on DictReader -

i'm new python , try comprehend how can use filter function on csv.dictreader filter rows csv file. filter() can used on "iterable" , far understand dictreader fits definition . however when try f = open('file1.csv', 'r') dialect = csv.sniffer().sniff(f.read(1024)) f.seek(0) reader = csv.dictreader(f, none, none, none, dialect) filteredreader = filter(none, reader) #none replaced function in filteredreader: print(i) i typeerror: normcase() argument must str or bytes, not 'dictreader' . please note, don't want filter on filepointer ( e.g. here ), on parsed csv rows. have idea how that? yes, dictreader() can used iterable, , can used filter() fine. the filter() function passed each row (a dictionary) in turn , if function returns true row passed on: >>> io import stringio >>> import csv >>> demo = stringio('''\ ... foo,bar,baz ... 42,88,131 ... 17,19,23 ... '...

javascript - flot how to know the x axis points in dynamic data -

i using flot jquery library draw charts. when chart has specific number of columns, can set x values points. but have dynmic data. how can know points of x axis please? for example, the x axis of first point 1325876000000 x axis of second point 1328194400000 third 1330360000000 fourth 1332838400000 but lets have 9 columns. how can know x axis them please? i printing chart in way var holder = $('#vertical-chart'); if (holder.length) { $.plot(holder, data, chartoptions); } the input data this label: "label1" data: [[1325876000000,0],[1325876000000,0],[1325876000000,0],[1325876000000,30]] but don't know how many points in array. 11 or 2 edit this chartoption chartoptions = { xaxis: { min: (new date(2011, 11, 15)).gettime(), max: (new date(2012, 04, 18)).gettime(), mode: "time", ticksize: [2, "month"], monthnames: [...

asp.net web api - Passing an array of complex type to a Web API method -

i'm getting started complex types in web api. created simple class default formatter should have no problem working with: public class gridcolumnargs { public gridcolumnargs() { } public int fieldid { get; set; } public bool visible { get; set; } } and set web api method takes gridcolumnargs: public void putgridlevel(int gridlevelid, gridcolumnargs columnargs) { // breakpoint set here } and in javascript, made simple testing method: var columnargs = { fieldid: 1, visible: true }; myhelperlibrary.put({ url: 'api/grid?gridlevelid=123', obj: columnargs, done: function () { alert('ok!') }, fail: function () { alert('no good!') } }); works perfectly. hits breakpoint, properties set on javascript object literal there, great. however need pass in collection of these gridcolumnargs objects. if change web api method thusly: public void putgridlevel(int gridlevelid, gridcolumnargs[] columnargs) { // breakpoint s...

Grails Spring Security plugin: Getting 302 for Ajax Request for timedout Session -

we using spring security plugin version 1.2.7.3 grails 2.2.1. in config.groovy do: grails.plugins.springsecurity.auth.ajaxloginformurl = "/mylogin/authajax" thinking that, when there ajax request, spring security invoke authajax () in mylogincontroller if user's httpsession has timed out. as per doc, ensure header x-requested-with value xmlhttprequest in ajax request plugin knows ajax request. my expectation authajax() invoked , can make return 401, ui knows needs pop login screen. however, instead, of authajax() getting invoked, 302 returned ui location field set http://localhost:8080/myapplication/mycontroller/authajax this means i'll have put in hackey on ui. check 302 , check location field , make user re-login. prefer have 401 returned. any ideas doing wrong? thanks million

robolectric - Is it possible for test using JMockit to be run with RobolecticTestRunner? -

under normal circumstances, using jmockit requires jmockit jars declared before junit jar when running unit tests. i encountering following stackoverflowerror when using jmockit mocks in tests run robolectictestrunner. java.lang.stackoverflowerror: null @ java.lang.threadlocal.getmap(threadlocal.java:213) @ java.lang.threadlocal.get(threadlocal.java:144) @ mockit.internal.mockups.mockstate.update(mockstate.java:54) @ mockit.internal.mockups.mockstates.updatemockstate(mockstates.java:93) @ mockit.internal.state.testrun.updatemockstate(testrun.java:160) @ org.junit.runners.model.frameworkmethod.validatepublicvoidnoarg(frameworkmethod.java) @ mockit.integration.junit4.internal.mockframeworkmethod.validatepublicvoidnoarg(mockframeworkmethod.java:46) @ sun.reflect.generatedmethodaccessor12.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java...

jquery - What is standard practice for truncating text for narrow screen widths? -

a simple example: let's in footer of website @ 1024px, along other links, have "terms & conditions" link. using media queries, @ max-width: 320px want shorten link read "terms". approach 2 ways: jquery approach html <p class='terms'>terms &amp; conditions</p> jquery // use match media or similar determine breakpoint use function: $('.terms').text('terms'); css approach html <p class='terms'>terms <span>&amp; conditions</span></p> css @media screen , (max-width: 320px) { .terms span { display: none; } } is there standard practice this? seem me css method efficient. if not use jquery anywhere else on website, should go css solution. if use jquery, however, both approaches equally effective - users not notice difference.

javascript - console error for jquery function? -

i looking @ jquery function on page , reason im getting error, "uncaught typeerror: undefined not function". here jquery not know error? jquery: <script type="text/javascript"> $(document).ready(function(){ $('body').on('click', '.like', function(){ if($(this).attr('title')=='like'){ $.post('/like.php',{imid:$(this).attr('id'),action:'like'}); $(this).removeclass('like').addclass('unlike').attr('title', 'unlike'); } }) .on('click', '.unlike', function(){ if($(this).attr('title')=='unlike'){ $.post('/like.php',{imid:$(this).attr('id'),action:'unlike'}); $(this).removeclass('unlike').addclass('like').attr('title', 'like'); } }); }); </script>

Connect PHP ( Mac OS ) to MsSQL Server 2008 RC2 connection string format -

i able connect mssql (remote pc) following command via terminal: tdsver=8.0 tsql -h 192.168.1.10 -p 1433 -u derrick -p friday i need know how translate successful string php/pdo connection string, ive tried: $connect = new \pdo("dblib:host=192.168.1.10:1433", "derrick", "friday"); as as: $connect = new \pdo("dblib:host=mssqlserver", "derrick", "friday"); where "mssqlserver" in config file is: [mssqlserver] host = 192.168.1.10 port = 1433 tds version = 8.0 the error im getting php is: sqlstate[01002] adaptive server connection failed (severity 9) the tds log shows following: > log.c:194:starting log file freetds 0.92.405 on 2014-04-14 > 18:25:21 debug flags 0x4fff. net.c:204:connecting 192.168.1.10 > port 1433 (tds version 5.0) net.c:270:tds_open_socket: connect(2) > returned "operation in progress" net.c:310:tds_open_socket() > succeeded util...