Posts

Showing posts from September, 2011

javascript - Checkbox ng-click fired twice -

i trying fill checkboxes dynamically , use selected items filter data. my html <div class="form-group" ng-repeat="category in categories"> <label class="checkbox" > <input type="checkbox" ng-model="selection.ids[category.code]" id="{{category.code}}" ng-click="toggleselection(category)" /> {{category.description}} </label> </div> <div class="form-group"> <button type="submit" ng-click="filtersubmit();" class="btn btn-default"> <span class="glyphicon glyphicon-search"></span> filter </button> </div> in controller using javascript, not unlike other examples i've seen. $scope.toggleselection = function (category) { var idx = $scope.selection.indexof(category); console.log('start '+ idx); // selected if (idx > -1) { $scope.se...

excel - Need to sum a column if 2 or 3 columns contain a specific text -

i've following data set , want add values reflect "abc" in cell. column1 column 2 column 3 column 4 column 5 abc cnn $150 abc nba better life n-h $40 lit mnm nice job abc $35 mn abc poor h-i $200 itl abc best ti $120 sql abc poor life n-t $40 lt nm great $800 abc bef the sum should return $150+$35+200+120+$400 = $905 because somewhere in cells has text "abc". tried using sumif(find) formula gives me value error. thoughts? short answer use array formula: =sumproduct(if(if(len(substitute(a:a,"abc",""))<len(a:a),1,0)+if(len(substitute(b:b,"abc",""))<len(b:b),1,0)+if(len(substitute(d:d,"abc",""))<len...

asp.net mvc - MvcPaging using Ajax -

i want use mvcpaging in partialview. have search page , need paginate results. far, first page results appears - when trying go page 2 in console 500 error , nothing happens. here 2 actions controller: public partialviewresult searchresults(string lat, string lng, double? dist) { if (request.isajaxrequest()) { string address = request["address"]; string latitude = lat; string longitude = lng; geocoordinate coord = new geocoordinate(double.parse(latitude, cultureinfo.invariantculture), double.parse(longitude, cultureinfo.invariantculture)); iqueryable<restaurants> near = (from r in _db.restaurants select r); results = new list<restaurants>(); foreach (restaurants restaurant in near) { double latbd = (double)restaurant.latitude; double lngdb = (double)restaurant.longitude; if (new geocoordinate(...

Javascript: Run a function defined outside this closure as if it were defined inside this closure -

i want have function accepts function b argument, , runs b defined within closure scope of a, i.e. has access local variables. for example, simplistically: var = function(b){ var localc = "hi"; b(); } var b = function(){ console.log(localc); } a(b); // log 'hi' the way have found use eval. ec6 give better options maybe? you can make context explicit , pass b : var = function(b){ var context = { localc: "hi" }; b(context); } var b = function(context){ console.log(context.localc); } a(b); // hi you can use this new , prototype : var = function() { this.localc = "hi"; } a.prototype.b = function(context){ console.log(this.localc); } var = new a(); a.b(); // hi or without prototype : var = function() { this.localc = "hi"; } var = new a(); a.b = function(context){ console.log(this.localc); }; a.b(); // hi you can use this bind : var = { localc: ...

excel - Any way to copy/paste formulas in a range of cells but keep absolute? -

i have matrix of data , each cell formula. cell formulas relative, when copy , paste below, formulas off. here's know works: change each cell's formula relative absolute copy text each formula, paste text below i don't want go , f4 each part of every formula dozens of cells. there way copy paste large batch tell excel keep exact formulas written? i bulk find , replace on original range, replacing "=" signs random text string guaranteed not occur anywhere within formulas, usual choice being "##". this converts formulas text strings, after can paste range before performing reverse find , replace, i.e. replacing "##" "=", coerces excel treating strings actual formulas once more. of course, if we're talking large amount of formulas, i.e. several thousand, operation can take while perform, since not excel required carry out find , replace on strings, calculate newly-created formulas. regards

php - Model autoloading not workin in CodeIgniter -

so i'm autoloading models this: $autoload['model'] = array('user_model','article_model','settings_model','authenticate_model'); and have next files: models/user_model.php: <?php class user_model extends ci_model { public function __construct() { parent::__construct(); } } ?> and next error appears: unable locate model have specified: user_model and if access file directly: you don't have permission access /application/models/user_model.php on server. so can causing problem? as @beatalex said, issue first letter of models being in lower case. reason when changing name before, , pushing git using command: git commit -a -m "broke everythink"; git push heroku master it wasn't changing name of file. i had delete files, push changes, , create them again , push them again, , it's working.

c# - Windows 8.1 App- Splash logo then a black screen? -

i submitted app last night windows store . ran, tested, , deployed fine on surface pro 3 developed on. trialed, purchased, , downloaded make sure deployment successful. good. however, when downloaded old asus laptop running windows 8.1 on account, opened splash , app screen went black. not have other devices test on other surface , asus, , i'm concerned issue might affect more devices. there way resolve issue asus laptop? cause behavior? set windows store app not machine-specific. you can download trial here see behavior (if happens @ all).

ruby on rails - Test Plan with ApacheBench(AB) testing tool -

i trying load testing here. backend in ruby(2.2) on rails(3). read many pages how work ab testing. here have tried: ab -n 100 -c 30 url result: apachebench, version 2.3 <$revision: 1554214 $> copyright 1996 adam twiss, zeus technology ltd, http://www.zeustech.net/ licensed apache software foundation, http://www.apache.org/ benchmarking 52.74.130.35 (be patient).....done server software: nginx/1.6.2 server hostname: 52.74.130.35 server port: 80 document path: url document length: 1372 bytes concurrency level: 3 time taken tests: 10.032 seconds complete requests: 100 failed requests: 0 total transferred: 181600 bytes html transferred: 137200 bytes requests per second: 9.97 [#/sec] (mean) time per request: 300.963 [ms] (mean) time per request: 100.321 [ms] (mean, across concurrent requests) transfer rate: 17.68 [kbytes/sec] received connection times (ms) m...

HTML and CSS twitter/Facebook feed -

Image
i've been asked client make feed on website. i have logos etc profided in photoshop document. would care help? it going inside <div class="col-lg-3"> the things need answering is, how go making feed (i'm guessing api don't know how add logos, don't know if api, rss feed? again i'm unaware how add logos.) and how add custom slider bar? this need like sam since slider used users input used same syntax other input tags do. type of tag though "range" <input type="range" /> the previous snippt should enough show slider, tag has more attributes can use. let’s set range of values (max , min). <input type="range" min="0" max="100" /> now users can choose number between 0 , 100. the slider has default value of 0 if give different value, when browser renders code, pin positioned @ value. next code position pin halfway between ends of bar. <input type=...

javascript - Typescript module, require external node_modules -

i need use simple node_module inside simple typescript file, seems compiler doesn't want it. here's simple ts file : import glob = require('glob'); console.log(glob); and i've got error : [13:51:11] compiling typescript files using tsc version 1.5.0 [13:51:12] [tsc] > f:/skeletonproject/boot/ts/boot.ts(4,23): error ts2307: cannot find external module 'glob'. [13:51:12] failed compile typescript: error: tsc command has exited code:2 events.js:72 throw er; // unhandled 'error' event ^ error: failed compile: tsc command has exited code:2 npm err! skeleton-typescript-name@0.0.1 start: `node compile && node ./boot/js/boot.js` npm err! exit status 8 npm err! npm err! failed @ skeleton-typescript-name@0.0.1 start script. however, when use simple declaration in same script, works : var x = 0; console.log(x); // prints 0 after typescript compilation what doing wrong in case ? edit: here's gulp file...

regex - Remove .html from URL and rewrite requests to index.html -

i'm not experienced .htaccess related stuff, looking help. i'm trying this: any request looks (example): /foo.html would rewrote to: /foo and request static file, i'd serve: /index.html does make sense? idea how this? example here's have far, though it's not correct far know: rewriterule %{request_filename} !-d rewriterule %{request_filename} -f rewritecond ^(.*)$ $1.html [nc,l] rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule ^(.*) /index.html [nc,l] check existence of .html file before adding uris: rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule ^ - [l] rewritecond %{request_filename}.html -f [nc] rewriterule ^(.*)$ $1.html [l] rewriterule . /index.html [l]

c# - Azure management API: How to change web app pricing tier? -

i'm automating creation of azure web apps using management sdk (i.e. https://github.com/azure/azure-sdk-for-net ) , it's not obvious how change web apps app service plan pricing tier using sdk. want change web apps i'm creating 'free' 'shared'. how can this? look @ webhostingplanoperations.updateasync() ( webhostingplanoperations.cs ). notice takes webhostingplanupdateparameters object parameter (located in models, here ). within that, can set: workersize (0, 1, or 2 small, medium or large) skuoptions (which takes skuoptions enum, in models, here ). skuoptions values: free = 0 shared = 1 basic = 2 standard = 3 premium = 4

silktest - Silk4Net & Silk Workbench integration -

is possible call scripts written in silk4net workbench? @ beginning of building automation framework using silktest, , want able express both our testers , developers. no, unfortunately isn't possible. can call .net scripts visual tests within workbench, can't call scripts between various silk test clients currently. update : reading question again, sounds want common code share between scripts written in workbench, , scripts written in silk4net. if goal, accomplish doing following: create new class library project in visual studio. should target .net 4. add reference silktest.ntf project (this assembly contains of automation classes used silk4net , .net scripts in workbench). put common code assembly. you can reference assembly both silk4net project , .net scripts in workbench.

foreach - How does the Java 'for each' loop work? -

consider: list<string> somelist = new arraylist<string>(); // add "monkey", "donkey", "skeleton key" somelist for (string item : somelist) { system.out.println(item); } what equivalent for loop without using for each syntax? for (iterator<string> = somelist.iterator(); i.hasnext();) { string item = i.next(); system.out.println(item); } note if need use i.remove(); in loop, or access actual iterator in way, cannot use for ( : ) idiom, since actual iterator merely inferred. as noted denis bueno, code works object implements iterable interface . also, if right-hand side of for (:) idiom array rather iterable object, internal code uses int index counter , checks against array.length instead. see java language specification .

openshift client tools - rhc setup - Unable to connect to the server -

i installing client tools on windows. i completed command -> gem install rhc next step --> rhc setup i using default server, getting below error: c:\>rhc setup --debug debug: using config file y:/.openshift/express.conf debug: running greeting_stage openshift client tools (rhc) setup wizard wizard upload ssh keys, set application namespace, , check other programs git installed. debug: running server_stage if have own openshift server, can specify now. hit enter use server openshift online: openshift.redhat.com. enter server hostname: |openshift.redhat.com| can add more servers later using 'rhc server'. debug: running login_stage debug: connecting https://openshift.redhat.com/broker/rest/api debug: client supports api versions 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7 debug: created new httpclient debug: request https://openshift.redhat.com/broker/rest/api unable connect server (getaddrinfo: no such host known. (https://openshift.redhat.com:443)). check have co...

reportlab - Embedding documents in PDF files -

we want store application specific metadata (a json object) within pdf documents create. we tried use canvas.setkeyword , pdffilereader.documentinfo["/keywords"] this works 100 kb file, hangs 1 mb file (documentinfo return needs long time > 1min) is there way embed file pdf document reportlab? there way read pypdf2? (this may or may not enough answer, don't yet have reputation able comment...) one possible reason long delay might encoding process string. if don't mind reading pdf in, adding data , writing out, might try pdfrw . (disclaimer: pdfrw author.) code like: pdfrw import pdfreader, pdfwriter trailer = pdfreader('source.pdf') trailer.info.keywords = my_json_string pdfwriter().write('dest.pdf', trailer) if isn't fast enough because of string encoding, store data in stream somewhere else in file (and compress it, if desired).

jquery - Add value of div attribute into INPUT -

struggling adding values of divs' attributes inputs: my html is: <div class="modal-body" client-name="test1"> <input class="gform_hidden"/> </div> <div class="modal-body" client-name="new name"> <input class="gform_hidden"/> </div> <div class="modal-body" client-name="test3"> <input class="gform_hidden"/> </div> and jquery code: $('.modal-body').each(function () { var cname = $(this).attr('client-name'); $('input.gform_hidden').val(cname); }); can 1 me individual value not last one. please see jsfiddle below: http://jsfiddle.net/9nph7eyc/ you need use current context this along find selector find input element in it: $('.modal-body').each(function () { $(this).find('input').val($(this).attr('client-name')); }); wor...

jquery - HTML5 Video background - IE error -

for using video background on webpage use code: position: fixed; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; background: url(images/bg/home.jpg) no-repeat; background-size: cover; it works in safari, chrome, firefox , opera, ie doen't support "object-fit: cover", doesn't fill screen totally, have tried many solutions web , here on stackoverflow, none of them works. - do? does ie support html5?.if not try latest version.

forms - Error 404--Not Found From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1 -

i have installed oracle forms 11g on system. while running forms or reports, browser shows following error: error 404--not found rfc 2068 hypertext transfer protocol -- http/1.1: 10.4.5 404 not found the server has not found matching request-uri. no indication given of whether condition temporary or permanent. if server not wish make information available client, status code 403 (forbidden) can used instead. 410 (gone) status code should used if server knows, through internally configurable mechanism, old resource permanently unavailable , has no forwarding address. how can resolve error? weblogic server running , able access admin console also.

How to avoid a problematic file in loop in R? -

i looping throgh lots of files code stops when encounters problem 1 file: files= paste("c:\\users\\data_ ", data1$column, "_", data1$row, ".txt", sep="") for(i in 1:length(files)){ wf <- read.table(files[i], sep=' ', header=true) wf=subset(wf, !is.na(scan)) here, instance, `wf` be: [1] date1 date2 scan <0 rows> (or 0-length row.names) stuf............... } so code here stop , through error: error in data.frame(date = resf$wddate, obs, mod = daf): arguments imply differing number of rows: 0, 1 i want loop ignore (problematic) file , not go further in loop goes read next file , on use try( ..code.. ) or trycatch( ..code.. ) statement. here best link know explaining it, section on exception handling further down. http://adv-r.had.co.nz/exceptions-debugging.html here simple loop using try ignores file read errors files <- c("f1","f2","f3") (i in 1:length(f...

sql - Compare rows and calculate column of same row -

if see 2 abc's calculate total 9*2 = 18 , second row 15*2 = 30 add fun1 fun2 fun3 9 abc wxy abc 15 def abc abc a series of case expressions should trick: select add * ((case fun1 when 'abc' 1 else 0 end) + (case fun2 when 'abc' 1 else 0 end) + (case fun3 when 'abc' 1 else 0 end)) total mytable

scala - Reading from InputStream as an Iterator[Byte] or Array[Byte] -

i representing data object iterator[byte] , created inputstream instance. the problem lies in byte signed integer -128 127, while read method in inputstream returns unsigned integer 0 255. in particular problematic since semantics -1 should denote end of input stream. what best way alleviate incompatibility between these 2 types? there elegant way of converting between 1 another? or should use int instead of bytes , though feels less elegant? def tobyteiterator(in: inputstream): iterator[byte] = { iterator.continually(in.read).takewhile(-1 !=).map { elem => convert // need convert unsigned int byte here } } def toinputstream(_it: iterator[byte]): inputstream = { new inputstream { val (it, _) = _it.duplicate override def read(): int = { if (it.hasnext) it.next() // need convert byte unsigned int else -1 } } } yes, can convert byte int , vice versa easily. first, int byte can converted tobyte : scala> 128.tobyte res0:...

Best practice for returning in PHP function/method -

i refactoring extensive codebase overtime. in long run going develop whole system in classes in mean time using opportunity refine php skills , improve of legacy code use across several hundred websites. i have read conflicting articles on time how best return data custom function, debate falls 2 categories, concerned best technical practice , concerned ease of reading , presentation. i interesting in opinions (with elaboration) on consider best practice when returning custom php function. i undecided of following better standard follow using basic theoretical function example; approach a. populating return variable , returning @ end of function: <?php function theoreticalfunction( $var ) { $return = ''; if( $something > $somethingelse ){ $return = true; }else{ $return = false; } return $return; } ?> approach b. returning @ each endpoint: <?php function theoreticalfunction( $var ) { if( $something > $som...

python - What's quota_info.datastores in the Dropbox API? -

i'm getting account information dropbox api. docs mention 3 values quota_info api returning 4: 'quota_info': {'quota': 2684354560, 'normal': 1657874, 'datastores': 0, 'shared': 162730881} what's datastores value for? should take account anything? it's deprecated datastore api, , value should zero. (it's kept in avoid breaking clients expect it.) can ignore it!

java - how I can copy the package source from database to my local machine using jdbc? -

i want copy packages's source in local machine using jdbc. select dbms_metadata.get_ddl('package_body','collectstats','myschema') dual; i have tried not getting it you can create custom table ddl each objects (packages, procedures, functions) following: drop table myobjects; create table myobjects (obj_name varchar2(128), sub_obj_name varchar2(128), obj_type varchar2(128), obj_ddl clob); set serveroutput on declare uobj_ddl clob; cnt number := 1; begin dt in (select object_name, subobject_name, object_type user_objects object_type in ('function','procedure','package')) loop --dbms_output.put_line(dt.object_name); uobj_ddl := dbms_metadata.get_ddl(upper(dt.object_type), upper(dt.object_name)); insert myobjects values (dt.object_name, dt.subobject_name, dt.object_type, uobj_ddl); if mod(cnt,100) = 0 commit; end if; cnt := cnt + 1; end loop; commit; end; / then can select on j...

java - ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call -

i want call procedure java code delete database. below java code , exception string procedurecall = "{call new_porting_prc.delete_album_metadata(?)}"; callablestatement cal = conn.preparecall(procedurecall); cal.setstring(1, catid); cal.registeroutparameter(2, oracle.jdbc.oracletypes.varchar); cal.execute(); exception is: error ["http-bio-8080"-exec-9] (content_005fdelete_jsp.java:45) - [15-05-15 14:16:01,912] - java.sql.sqlexception: ora-06550: line 1, column 7: pls-00306: wrong number or types of arguments in call 'delete_album_metadata' ora-06550: line 1, column 7: pl/sql: statement ignored can suggest going wrong? you passing 1 parameter new_porting_prc.delete_album_metadata procedure , it's expecting different number of parameters or you passing varchar expecting number, date etc

tk - Debugging C with Tcl -

i have project written in c , tcl , i'm trying debug it. main part written in c, , gui written in tcl. i'm new tcl. tried use lldb debug it, c program calls tk_main(tkargs, myargv, tcl_appinit); lldb not work @ all, if tcl commands written in c. how can debug it? when debugging c/c++ , scripting-language together, can't expect lldb know how source-level-debug both. knows c/c++ (or more precisely, dwarf-symbols). thus if expect c-code faulty when being invoked within script-language, need set breakpoint & operate program trigger call. when crashes appear, should use "bt"-command clue in stacktrace are, , investigate further using breakpoints.

scala - How to handle different cases of Failure from Try -

i want handle different cases of failure (returned try). example code main(args(0)) match { case success(result) => result.foreach(println) case failure(ex) => ex match { case filenotfoundexception => system.err.println(ex.getmessage) case statsexception => system.err.println(ex.getmessage) case _ => { ex.printstacktrace() } system.exit(1) } } if statsexception or filenotfoundexception print message, other exceptions print stack trace. however ex ever throwable, , case statsexception fruitless type test (a value of type throwable cannot statsexception.type according intellij) worse compile errors: java.io.filenotfoundexception not value what's best way handle different cases of failure in idiomatic way? i simplify own answer: main(args(0)) map (_ foreach println) recover { case ex@(_: filenotfoundexception | _: statsexception) => system.err.println(ex.getmessage) system.exit(1) ...

Matlab: using a string as condition for if statement -

cond = 'a==1'; a=1; if (cond) b=0; end hi! there way thing wrote above? in text variable need write condition (even complex one, using && , || too) , in if statement insert variable. tried example sadly didn't work. can solve it? edit: more information you! backtesting different trading strategies project. inside general m-file, make use of function each strategy need tests. each strategy gets in input data current situation , function evaluates behavior of trading strategy according data (and according margin requirements , other stuff independent strategy). thing different in each function, entry or exit rule. each strategy has sure entry , exit condition (for instance, "open long position when ... , ..." or "close short position when ... or ..."). in main m-file using cycle simulate time passing by, want implement further external cycle represents number of strategy tested. furthermore, each condition in if-statements written hand ,...

Loadrunner controller issue -

i'm trying performance testing on silverlight application. below transaction: login, launch/login silverlight application(no credentials required), enter transaction, silverlight exit, application logout. (i first need loginto web application access silverlight , silverlight doesn't require userid or pwd) i've recorded script in vugen , played it, working fine. when use controller 30 users having 5 iteration each, observed 2-5 silverlight launch/login getting failed (only silverlight have issue). here error messages: continuing after error -27794: failed connect server "xx.xxx.xx.xxx:80": [10060] connection timed out continuing after error -27725: step download timeout (999 seconds) has expired when downloading resource(s). set "step timeout caused resources warning" run-time setting yes/no have message warning/error, respectively [issued @ action.c(522)]c my question : why happening 1 or 2 login? example: userid 10 has 5 iteration, 4 o...

mysql - Xampp Access violation at address 005AA712 in module 'xampp-control.exe'. Read of address 00000042 -

hi i'm having trouble xampp control panel. notice everytime access module php application fetching around 8000 data database xampp keeps on prompting error. "exception eaccessviolation in module xampp-control.exe @ 001aa712. access violation @ address 005aa712 in module 'xampp-control.exe'.read of address 00000042." windows shuts down, fortunately leaving apache, mysql , php running. can please me? check pointers or arrays not out of bounds (this might case access violation) or pointer trying access memory not belonging it, or forgot allocate memory (oops). forgetting free memory problem. so freeing memory on pointer , trying use it. calling win32 api function bad parameters (!) calling win32 api function parameters older copy of msdn (the api's data types change on time, including winmain()) (!)

html not proberly scaled for ios device -

Image
i'm trying embed html page webview in ios app. whatever can't seem make scale properly. can see on current app text , image exceed width of screen, not wanted result. how come not scale properly, when i've set widths 100% , set scaletofitpage true? viewdidload webview.scrollview.delegate = self webview.scrollview.showshorizontalscrollindicator = false webview.scalespagetofit = true html code <!-- template.html --> <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <style type="text/css"> body{ font-family: 'pt sans'; margin-left:0; margin-right:0; margin-top: 0; width: 100%; } .text_div{ padding-left:10px; padding-right:100px; font-size:26px; width: 100%; word-wrap: break-word; -moz-box-sizing: borde...

ios - Best practice to have multiple tableviews in a single view controller -

Image
this question maybe asked in stackoverflow. but, did not clear idea scenario. i have viewcontroller (say, myviewcontroller). i have scrollview(say, myscrollview) , have n number of views (say myview1, myview2, ...) in it. those views can scrolled horizontally. refer below image more clarification. this image taken here . so, red area scroll view holds multiple views yellow color. scenario: i want call api's each view, when api calling , parsing data occurs, need show loading activity indicator in views. after successful parsing, need update corresponding view uitableview. questions: in case, number of views may vary 3 6. should maintain 6 separate uitableviews , uiactivityindicator's? i tried 3 pointers left, middle & right hold reference of tableview , activity indicator. problem is, before first 3 pages loading, if user goes fourth view, system collapse many conditions. suggestions needed. confused!! i think have use uipageviewcontro...

email - Magento cron.php appears to be running hundreds of times -

to test cron placed simple mail() call in head of cron.php. set cron run every 5 minutes , expecting receive 1 email every 5 minutes. received hundreds of emails when runs (300+). i'm running magento 1.9.1.0 , on previous versions never happened (just 1 email each time cron ran) cron setup through cpanel: */5 * * * * , i'm confident not running multiple times itself. (i have tested simple php file 1 mail call) anyone seen before? easiest fix remove mail call i'm worried cron.php being called , effect server.

android - Null pointer exception when location manager is called -

i trying use location manager in app when try use object of location manager null pointer exception thrown here snipet public class mainactivity extends activity { locationmanager locationmanager; float[] dist; double rest; long res ; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); string servicestring = mainactivity.this.location_service; locationmanager= (locationmanager)getsystemservice(servicestring); string provider = locationmanager.gps_provider; final location loc1=locationmanager.getlastknownlocation(provider); string l = double.tostring(loc1.getlatitude()); // log.d("message: ",l); string netprovider=locationmanager.network_provider; locationlistener = new locationlistener() { // double lat1 = loc1.getlatitude(); //double lon1=loc1.getlongitude(); @override public void onlocationchanged(location l...

javascript - Angular $http is sending OPTIONS instead of PUT/POST -

Image
i trying update/insert data in mysql database through php backend. i'm building front end angularjs , using $http service communicating rest api. my setup looks this: i'm setting header via $httpprovider: $httpprovider.defaults.withcredentials = true; $httpprovider.defaults.headers = {'content-type': 'application/json;charset=utf-8'}; and post-call looks this: return $http({ url: url, method: "post", data: campaign }); the dev console in chrome shows me this: when change post put, i'm sending options call instead put. , content-type switches content-type . my request payload send object: how set header properly? edit: the php backend sets headers: $e->getresponse() ->getheaders() ->addheaderline('access-control-allow-methods', 'get, post, put, delete, options'); $e->getresponse() ->getheaders() ...

web services - write web serice for android with C# -

i want write web service c# call android app in web service wrote helloworld() method calles , convertdatatabletojsonstring converted data json downloaded converting fonction internet , probleim convertdatatabletojsonstring function it's return me thing like "[{\"proid\":1,\"procname\":\"لبنیات\"},{\"proid\":2,\"procname\":\"لوازم بهداشتی\"},{\"proid\":3,\"procname\":\"لوازم آرایشی\"},{\"proid\":4,\"procname\":\"خشکبار\"},{\"proid\":5,\"procname\":\"نوشیدنی ها\"},{\"proid\":6,\"procname\":\"سبزیجات\"},{\"proid\":7,\"procname\":\"فرآورده های گوشتی\"}]" the json format return not recognizable android app dont need '/' befor , after items . body can me find fanction change data table json format use in android app , thank : ) [webmethod] [scr...

javascript - Delegate drag event to other element jQuery -

i have following html on page: <div class="group-one" > <p><span id="handle" draggable="true">::</span> click me</p> </div> <div class="group-two" draggable="true"> <p>i should dragged</p> </div> now want when #handle dragged, drag event should delegated div.group-two , element under move cursor should div.group-two either. have tried: $('#handle').mousedown(function(e){ $('.group-two').trigger(e); }); $('#handle').on('dragstart', function(e){ $('.group-two').trigger(e); }); $('.group-two').on('dragstart', function(e){ console.log('dragestart triggered on group-two'); }); $('.group-two').mousedown(function(e){ console.log("mousedown triggered on group-two"); }); here jsfiddle . the problem here although event delegated div.group-two element being dragg...

slickgrid - Datagrid without dependencies -

in 1 of projects have use datagrid uses pure js. came across few high performance grids on github. never had use them before so, came here advice 1 chose. found cool comparison http://jspreadsheets.com , i'm 50/50 first 2 options. used slickgrid or handsontable? in advance.

How do I run the same command multiple times using Perl? -

i have 2 commands need run back 16 times 2 sets of data. have labeled files used file#a1_100.gen (set 1) , file#a2_100.gen (set 2). 100 replaced multiples of 100 upto 1600 (100,200,...,1000,...,1600). example 1: first set command 1: perl myprogram1.pl file#a1.pos abc#a1.ref xyz#a1.ref file#a1_100.gen file#a1_100.out command 2: perl program2.pl file#a1_100.out file#a1_100.out.long example 2: first set command 1: perl myprogram1.pl file#a1.pos abc#a1.ref xyz#a1.ref file#a1_200.gen file#a1_200.out command 2: perl program2.pl file#a1_200.out file#a1_200.out.long these 2 commands repeated 16 times both set 1 , set 2. set 2 filename changes file#a2... i need command run on own changing filename 2 sets, running 16 times each set. any appreciated! thanks! this done shell script. perl, tmtowtdi — there's more 1 way it. for num in $(seq 1 16) perl myprogram1.pl file#a1.pos abc#a1.ref xyz#a1.ref file#a1_${num}00.gen file#a1_${num}00.out perl myprogram2...

java - How to get a File reference from within a JAR -

first of add have tried every proposed solution on issue still cant working. so problem... i have application parsing xml files. select xml file (source) , validate against xsd (this file inside jar cant access). running code within ide works fine: xsd = new file(getclass().getresourceasstream("xsds/2014/schema.xsd").getfile()); system.out.println(xsd.getabsolutepath()); //returns: c:\users\xxx\desktop\documents\netbeansprojects\javaxmlvalidator\build\classes\app\xsds\2014\schema.xsd but when build application jar file , run cant reference file. when run application within jar this: //returns: c:\users\xxx\desktop\documents\netbeansprojects\javaxmlvalidator\dist\file:c:\users\xxx\desktop\documents\netbeansprojects\javaxmlvalidator\dist\javaxmlvalidator.jar!\app\xsds\2014\schema.xsd the path looks ok (i think) cant correct reference file in code: source schemafile = new streamsource(xsd); schema schema = null; try { schema = factory.newschema(schemafil...

ios - Scrolling to Bottom of UITableView When Messages Load -

i'm trying figure out how scroll bottom of uitableview once messages database load it. i've tried using tableview.setcontentoffset(cgpointmake(0, cgfloat.max), animated: true) table goes having messages in nothing @ all. i've tried var ipath = nsindexpath(forrow: messagesarray.count - 1, insection: 0) tableview.scrolltorowatindexpath(ipath, atscrollposition: uitableviewscrollposition.bottom, animated: true) but exc_bad_access code = 1 . appreciated. edit: i'm putting code in viewdidappear() function right after parse finds data query.findobjectsinbackgroundwithblock(...), not sure if makes difference or not. here's query code: query.findobjectsinbackgroundwithblock { (object, error) -> void in if (error == nil) { var = 0; < object!.count; i++ { var messageobject = messages() messageobject.messageid = object![i]["messageid"] as...

Oracle Apex - Branch to another page on change of radio button -

i trying implement following: i have radio group defined on landing page of application. contains 6 different options. have page contains form items filled user. whenever user chooses particular option of radio group on landing page, should branch other page 1 specific item enabled among other items. if user chooses other option of radio group, should branch other page specific item disabled. can implement whole thing on single page failing in case of 2 pages!

raspberry pi - python class definition problrm -

this first python code trying connect database , defined class called database in python file called mysqlconnection.py but when run code error : traceback (most recent call last): file "mysqlconnection.py", line 3, in <module> class database: file "mysqlconnection.py", line 27, in database db = database() my code : import mysqldb class database: host = "localhost" user = "root" passwd = "root" db = "pitest" def __init__(self): self.connection = mysqldb.connect( host = self.host, user = self.user, passwd = self.passwd, db = self.db) def query(self, q): cursor = self.connection.cursor( mysqldb.cursors.dictcursor ) cursor.execute(q) ret...

How to Slow down For-loop in Jquery? -

i want perform 100 actions loop. working fast , want slow down process, need 1 second difference between each of process. following code on working. for(var i=1;i<=100;i++) { $("#span"+i).html("success"); } please on this. thank you. here's on way can using settimeout function success(i) { if (i > 100) return; $("#span" + i).html("success"); settimeout(function() { success(i+1); }, 1000); } success(1);

html - IE behaving completely different for Iframes -

Image
i have iframe target area display different website inside website. in mozilla , chrome can see desired output in internet explorer sidebar div located in different manner. here goes html code <div class="menu_sample top_mar"> <div class="col-sm-3 col-md-2 sidebar"> <ul class="nav nav-sidebar"> <li><span style="color:blue; font-weight:bold;">dashboards</span></li> {% dashboard in dashboards %} <li><a href="{{ dashboard.d_url }}">{{ dashboard.d_name }}</a></li> {% endfor %} </ul> </div> </div> <button class="pushed content" onclick="togglemenu()" style="margin-top:28%;height:4%;"><span id="menu-button"><span class="glyphicon glyphicon-chevron-left" id="glym...

java - Read json token (byte[]) as stream -

lets have json response like: { byteprop: [1, 3, 2, ... large byte content] } i fetch byteprop stream. have started jacksonstreamingapi , assumed should create parser like: jsonfactory jfactory = new jsonfactory(); jsonparser jparser = jfactory.createjsonparser( myjsonstream); bu problem don't see oppurtunity byteprop as stream, way property use sth (assume on right token) jparser.getbinaryvalue() which still fetch byteprop content memory , situation avoid. is there way read single json property stream ? something should work, improve see fit: bytearrayoutputstream os = new bytearrayoutputstream(); jsonfactory jfactory = new jsonfactory(); jsonparser jparser = jfactory.createjsonparser(new fileinputstream(new file("data/json.json"))); if (jparser.nexttoken() != jsontoken.start_object) { return; } while (jparser.nexttoken() != jsontoken.end_object) { string fieldname = jparser.getcurrentname(); jparser.nexttoken(); i...

How to update table with php and mysql -

hi have been trying update status of table can figure out why aint working, shows error messege status not update $uid = $_get["uid"]; $query=$db->query("update users set status = 0 uid = '$uid'"); if ($query){ echo "ok"; } else { echo "error."; } its not update into should be update users set status = 0 uid = '$uid'

Google Map Api - google map not showing properly after load second time -

Image
i opening google map in bootstrap modal. when click on link open google map modal, showing well, after close modal if open google map modal second time map not showing open first time check images understand problem please check first image,in pullen park(one park showing on map) showing bottom right corner when open google map modal again pullen park showing top left corner,so why pullen park not showing same first image. it due hiding issues. might want recenter map after google.maps.event.trigger(map, 'resize'); , or listen resize event following: google.maps.event.addlistener(map, 'resize', function() { console.log("resize triggered"); }); for more resize: https://developers.google.com/maps/documentation/javascript/reference for more event: https://developers.google.com/maps/documentation/javascript/events

Android Sending an email with html attachment -

my assetfiledescriptor.java class file:- public class assetsprovider extends contentprovider { file file; @override public assetfiledescriptor openassetfile(uri uri, string mode) throws filenotfoundexception { system.out.println("assetsgetter: open asset file"); assetmanager = getcontext().getassets(); string file_name = uri.getlastpathsegment(); if (file_name == null) throw new filenotfoundexception(); assetfiledescriptor afd = null; try { afd = am.openfd(file_name); } catch (ioexception e) { e.printstacktrace(); } return afd;//super.openassetfile(uri, mode); } @override public string gettype(uri p1) { // todo: implement method return null; } @override public int delete(uri p1, string p2, string[] p3) { // todo: implement method return 0; } @override public cursor query(uri p1, string[] p2, string p3, string[] p4, string p5) { // todo: implement method return null; } @override pu...

Javascript == operator between single value and array -

can please explain why below statements alert 'check passed' in javascript? code comparing string object against array, , expecting fail. var somearray = ['current']; if('current' == somearray){ alert('check passed'); }else{ alert('check failed'); } it alerts 'check passed'. when comparing == javascript tries coerce left , right values same types. in case tries coerce them both strings. when arrays coerced strings(its tostring function called) each element of array joined together. in case ["current"] becomes "current" so: "current" == somearray //becomes "current" == "current" with multiple elements ["current","values"] become "current,values" if not want happen use value , type compare operator === if("current" === somearray){ alert('check passed'); }else{ alert('check failed'); } dem...

tfs - How do I get "Solution Files" to the drops build folder using VSO Build or otherwise -

i'm using visual studio online , hosted build controller , have automated build working , putting output in drops folder in tfs online . i'm using team foundation version control , default template (defaulttemplate.11.1.xaml) i'm using msbuild arguments generate project specific output /p:generateprojectspecificoutputfolder=true my solution has number of projects , mvc web application. in solution i've added solution folder , placed powershell files in there. these powershell files end in drops folder after automated build. any suggestions on how can this? you should switch tfvcdefaulttemplate.12.xaml. can create powershell scoops bits need in drop , call post-test powershell activity. check out "gather items drops" on https://curah.microsoft.com/8047/run-scripts-in-your-team-foundation-build-process

functional programming - Haskell function that accepts function or value, then calls function or returns value -

how can write type declaration , function in haskell takes either function (that takes no arguments) or value. when given function calls function. when given value returns value. [edit] give more context, i'm curious how solve problem in haskell without bit twiddling: designing function f(f(n)) == -n sean i'm curious how solve problem in haskell without bit twiddling: designing function f(f(n)) == -n that's quite easy solve: when :: (a -> bool) -> (a -> a) -> -> when p f x = if p x f x else x f :: integer -> integer f = (+) <$> when negate <*> signum how derive this? consider: f (f n) = (-n) -- (0) - interview question f x = y -- (1) - assumption f y = (-x) -- (2) - (0) , (1), f (f x) = (-x) f (-x) = (-y) -- (3) - (0) , (2), f (f y) = (-y) f (-y) = x -- (4) - (0) , (3), f (f (-x)) = x now, if see left hand sides of these equations you'll notice there 4 cases: f x . f y . f (-x) . f...

java - How to convert underscore style query string into camel style property in a JavaBean in Spring MVC? -

for example, here's request: get: /search?product_category=1&user_name=obama i want define searchrequest accept query string, can use jsr 303 bean validation annotations validate parameters, below: public class searchrequest { @notempty(message="product category empty") private int productcategory; @notempty(message="user name empty") private int username; } so, there @jsonproperty in jackson convert underscore style camel style? you have 2 options; first. have searchrequest pojo annotated values validation have controller post method receive pojo request body json/xml format. public class searchrequest { @notempty(message="product category empty") private int productcategory; @notempty(message="user name empty") private int username; } public string search(@requestbody @valid searchrequest search) { ... } second. have validations in controller method signature eliminat...

json - Project subdocument elements when element name not known in Mongo -

i have json file imported mongo: { "people": { "employee1234": { "salary": 10000, "dept": "accounting" }, "employee1235": { "salary": 40000, "dept": "ceo" }, ... } } i want able find of unique salaries , departments of people. this tricky because people aren't in [] id field, rather elements eid. i'm trying equivalent of find({},{people.*.dept}) , can't * wildcard. how can query (given schema of existing documents) ? that quite impossible mongodb query current schema have dynamic keys. however, suggest change schema such keys become values , store them in embedded document. schema easy query: { "people": [ { "name": "employee1234", "salary": 10000, "dept": "accounting" ...

c++ - Latest Versions of libfreenect -

i have written software computer vision project, , want make sure using latest version of libfreenect libraries , headers. unfortunately, can't figure out more date. there several packages included ros, there libfreenect-dev package, used , referenced here . there have been other random versions can found under keyword "freenect". my team using ros package other things, use except ros package pain work , doesn't, default, offer support kinect accelerometer. want know can find latest versions ubuntu libfreenect can make better decision on use.

Wordpress Home/Front Page Display at top of Admin Pages List -

Image
i know example doesn't show lot of pages. but, on sites dozens of pages, have go next page, scroll, sort title, etc. find home page. there way have home/front page appear @ top of list. by default, wordpress pages list ordered menu order , alphabetically. knowing that, can set menu order each page home page @ 0 , else higher. if set else @ (for example) 1, pages come after home page , ordered alphabetically. or, can set custom menu order , pages ordered accordingly. in addition, plugins 1 ( https://wordpress.org/plugins/simple-page-ordering/ ) allow drag , drop reorder pages can pull below home page. (this plugin sets menu order of pages based on how drag , drop them.)