Posts

Showing posts from August, 2011

c# - How to binding List<image> to xaml? -

how can bind images 300x300 width , height of images[1] xaml? public class trackspotify { public class externalurls { public string spotify { get; set; } } public class image { public int height { get; set; } public string url { get; set; } public int width { get; set; } } public class item { public string album_type { get; set; } public list<string> available_markets { get; set; } public externalurls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public list<image> images { get; set; } public string name { get; set; } public string type { get; set; } public string uri { get; set; } } public class albums { public string href { get; set; } public list<item> items { get; set; } public int limit { get; set; } publ

R - “ missing value where TRUE/FALSE needed ” -

i'm trying execute following code in r library(nloptr) m = 0.00060981 m2 = 0.000109362 m4 = 5.21538e-08 m6 = 4.25e-11 f=function(x){ y = matrix(na, ncol = 1, nrow = 4) mu = x[1] s2=x[2] s2u = x[3] lambda= x[4] y[1] = (mu-(s2/2))-m y[2] = (s2+(lambda*s2u))-m2 y[3] = ((3*(s2^2) + 6*(lambda^2)*(s2u^2)+3*(s2u^2)*(lambda) + 6*(lambda)*(s2u)*s2))-m4 y[4] = (15*(s2^3) +45*(s2^2)*s2u + 45*(lambda^2)*(s2u^2)*s2 +45*(lambda)*(s2u^2)*s2 +15*(lambda^3)*(s2u^3)+45*(lambda^2)*(s2u^3)+15*lambda*(s2u^3))-m6 return(y) } g = function(x){ return(norm(f(x),'f')) } initiale=c( 0.00197,0.022,0.0036,0.8999) hin = function(x){ h=rep(na,1) h[2]>0 h[3]>0 h[1]<h[2] h } ans=auglag(par=initiale,fn=g,hin=hin) but i'm getting error : error in if (sig > 1e+05) control.optim$reltol <- 1e-10 : missing value true/false needed why getting error, , how fix code? i suspect error message result of h function hin = function(x){ h=rep(

Playing multiple video using libvlc and Qt -

i have created sample application in qt have display camera stream in 2x2 grid. using libvlc play stream , able display video well. facing few issues vlc creating separate window render video. not displayed on area provided qt application. here code void playerview::createplayer() { const char *const vlc_args[] = { "--avcodec-hw=any", "--plugin-path=c:\qtsdk\vlc-2.2.1\plugins" }; vlcinstance = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); const char* url = "rtsp://<camera ip>/cam0_0"; /* create new libvlc media descriptor */ media = libvlc_media_new_location(vlcinstance, url); // create media player playing environement vlcmp = libvlc_media_player_new(vlcinstance); libvlc_media_player_set_hwnd(vlcmp, (void*)videodisplay->winid()); libvlc_media_player_set_media(vlcmp, media); libvlc_media_player_p

Controlling various loops in the same video with javascript -

i have composition keyboard events control position of video playback. position 1 , 4 video portion reproduced in loop until there keyboard event. here javascript using: function(__number position, __boolean reset) main(__number inputnumber[8], __number duration) { var result = new object(); var slice = duration / 8; if (inputnumber[0] > 0) { result.position = slice * 1 - slice + 1; result.reset = true; } else if (inputnumber[1] > 0) { result.position = slice * 2 - slice; result.reset = true; } else if (inputnumber[2] > 0) { result.position = slice * 3 - slice; result.reset = true; } else if (inputnumber[3] > 0) { result.position = slice * 4 - slice; result.reset = true; } else if (inputnumber[4] > 0) { result.position = slice * 5 - slice; result.reset = true; } }

ios - Cordova SocialSharing Plugin - Facebook Callback Error -

i've been using socialsharing plugin in cordova app many months , it's been working great, , rely on fb sharing's callback functionality track if people shared post. however, discovered callback stopped working correctly on ios 8.1. when click on "cancel" in fb dialog popup, plugin calls success function , returns "true" parameter. call success callback, pass in "false" parameter, i'd able determine if "cancel" or "post" button user clicked on. i have tried updating latest version of plugin, still fails on iphone 6 running ios 8.1. if test on ipad running ios 7, cancel button works fine. can please advise on how resolve it? below socialsharing plugin official page: https://github.com/eddyverbruggen/socialsharing-phonegap-plugin thank you. this issue has been solved of today, when facebook updated app. resolve problem, user needs update facebook app. further details available @ facebook bug rep

Octave: How to load grayscale images in double format? -

i using imread function in octave load image: image = imread ("data/images/image1.jpg")(:); this apparently loading image matrix of integers values 0-255. i want load matrix of doubles values 0.0-1.0. can convert this. doubleimage = double(image) / 255.0; however, converting pretty slow, lot of images. there way load image directly matrix of doubles? no, there no way directly read doubles. doesn't make sense anyway, because image integer in file, integers have read first. if conversion type done, makes sense done separated. or maybe, use file format stores images in double floating point precision. however, there better way doing convert double. pkg load image; img = imread ("image1.jpg"); img = im2double (img); using im2double won't make faster (the operation performs same yours) save if in future image read uint16 , , if image of class double. also, don't see how conversion double slow. fast operation.

postgresql - How to get info about position element in the table? -

i have query: select * mytable order 'date' and result: date | item_id | user_id | some_data ------------------------------------------ 2015-01-01 | 1 | 1 | null 2015-01-01 | 1 | 1 | null 2015-01-02 | 1 | 1 | null 2015-01-03 | 1 | 1 | null 2015-01-03 | 1 | 2 | null 2015-01-04 | 1 | 1 | null 2015-01-05 | 1 | 2 | null and want position of first row user_id = 2. in example 5. how it? select pos_overall ( select user_id, row_number() on (order "date") pos_overall, row_number() on (partition user_id order "date") user_pos mytable ) t user_id = 2 , user_pos = 1

ios - Remove Parentheses From NSMutableArray -

i having trouble removing parentheses nsmutablearray . filling objects retrieved parse pfquery . works trying bring objects array label inside uitableviewcell . in label showing: ( name ) name thing want show cannot remove these brackets. trying: nsmutablearray *flattenarray = [[nsmutablearray alloc] init]; for(nsstring *str in [namearray objectatindex:indexpath.row]) { [flattenarray addobject:str]; } nsstring *string = [flattenarray componentsjoinedbystring:@""]; and setting label's text string created @ bottom. filling array with: namearray = [[nsmutablearray alloc] init]; pfquery *finddata = [pfquery querywithclassname:[nsstring stringwithformat:@"employee_%@", [[pfuser currentuser] username]]]; [finddata setlimit:1000]; [finddata findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { if (error == nil) { (pfobject *object in objects) { pfobject *name = object[@&q

multipleselection - I want to make multiple selection using a href -

Image
hi want make multiple selection href. please me how it. thanks help. if ask below mentioned answer: <select onchange="location.href=this.value;"> <option value="http://some_url/1.jpg">1.jpg</option> <option value="http://otherurl/2.jpg">2.jpg</option> </select>

linux - Strange behaviour of indirection operator > in bash -

i trying dump output command line time.txt file needed script. (time echo "hi") > time.txt what observed output of time command going terminal. real 0m0.000s user 0m0.000s sys 0m0.000s and output of echo command redirected time.txt $ cat time.txt $ hi why ? i'm having hard time understand this. how can redirect output of time command file ? i'm using ubuntu14.04 in case matters. in is there way redirect time output file in linux there 1 answer redirects time.txt . but in case want time.txt contain output of time command, not output of echo . not sure why post got reopened . as seen in is there way redirect time output file in linux , need use: { time echo "hi" ; } 2> time.txt

apache spark - k mean clustering for mixed categorical and numeric value -

any please i want provide simple framework identifying , cleaning duplicates data in context big data . pretreatment must performed in real time (streaming). we reperesent our data base file.csv , file contains patient (medical) records without duplication . we want clusterig file.csv 4 clusters using incremental parallel k mean clustering mixed categorical , numeric value, each cluster contain similars records. every time (data stream) structured data comes (record), must compare representatives of clusters (m1, m2, m3, m4)............. if data not represent duplicate data , save in file.csv , if represents duplicate data not saved in file.csv. 1)so what's effiscient tool in case hadoop or spark ! 2) how can impliment clustering mixed categorical , numeric value mlib(spark) or mahout (hadoop). 3) mean incremental clustering , same of streaming clustering! as noted dozen of times here on so/cv: k-means computes means unless can define least-squares mean

java - JPA enity has three times this same relation -

i have 2 simple models: public class wallet{ @id @generatedvalue(strategy = generationtype.auto) @column(name = "wallet_id") private long walletid; @column(name = "owner_label") private string ownerlabel; @column(name = "user_id") private long userid; } and public class transfer{ @id @generatedvalue(strategy = generationtype.auto) @column(name = "transfer_id") private long transferid; @notnull @column(name = "amount") private bigdecimal amount = bigdecimal.zero; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "owner_wallet_id") private wallet ownerwallet; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "from_wallet_id") private wallet fromwallet; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "to_wallet_id") private wallet towallet; } the problem when want transfer relations

How to deal with authenticated state in a SproutCore application -

in (now sort of deleted) question peter kniestedt wondering , how set timer check authentication of user. his question part of larger question (which title of question). because think important question answered, created new question way gather important information in 1 spot. this typical case use of statechart, , more concurrent states. if didn't know already, sproutcore contains useful library called sc.statechart, way of dealing application state in way more controllable through use of boolean properties, acts responder controller. in case you'd want statechart in root has 2 concurrent states: 1 deal states around authentication, , 1 deal rest of application. myapp.statechart = sc.statechart.create({ rootstate: sc.state.design({ substatesareconcurrent: true, auth: sc.state.design({ initialsubstate: 'checkauth', checkauth: sc.state.design({ }), login: sc.state.design({ }), authenticating: sc.state.de

CoreOS Fleet, link redundant Docker container -

i have small service split 3 docker containers. 1 backend, 1 frontend , small logging part. want start them using coreos , fleet. i want try , start 3 redundant backend containers, frontend can switch between them, if 1 of them fails. how link them? if use one, it's easy, give name, e.g. 'back' , link this docker run --name front --link back:back --link graphite:graphite -p 8080:8080 blurio/hystrixfront is possible link multiple ones? the method dependent on type of backend service running. if backend service http there few proxy / load balancers choose from. nginx haproxy the general idea behind these frontend service need introduced single entry point nginx or haproxy presents. tricky part this, or cloud service, need able introduce backend services, or remove them, , have them available proxy service. there writeups nginx , haproxy this. here one: haproxy tutorial the real problem here isn't automatic. there may techniques automatica

django - 'None type' object has no attribute 'year' -

i'm trying year datetime form i'm getting error when run project code 'none type' object has no attribute 'year' i've tried both import datetime , from datetime import datetime no success. although in function placed before 1 in same file views.py wrote same code (of year getting...) , works well! ps: when run code on ipdb shell works correctly! code: from datetime import datetime def my_function(request): data = tablea.find() dt = datetime.now() y = dt.year m = dt.month d = dt.day in data: if i['ma_date'].year == y: ma_liste.append([i["ma_date"]) return render(request, ma_page.html, ma_liste) and erreor **attributeerror @ /ma_page/ 'nonetype' object has no attribute 'year'** this has nothing datetime . data item has no year attribute. you haven't shown code or structure object, it's it's multidimensional array, in case use: i['ma_date'

python - How to represent networkx graphs with edge weight using nxpd like outptut -

Image
recently asked question how represent graphs ipython . answer looking for, today i'm looking way show edge valuation on final picture. the edge valuation added : import networkx nx nxpd import draw # if library same or same # output of nxpd , answer question, that's # not issue import random g = nx.graph() g.add_nodes_from([1,2]) g.add_edge(1, 2, weight=random.randint(1, 10)) draw(g, show='ipynb') and result here. i read help of nxpd.draw (didn't see web documentation), didn't find anything. there way print edge value ? edit : also, if there's way give formating function, good. example : def edge_formater(graph, edge): return "my edge %s" % graph.get_edge_value(edge[0], edge[1], "weight") edit2 : if there's library nxpd doing same output, it's not issue edit3 : has work nx.{graph|digraph|multigraph|multidigraph} if @ source nxpd.draw (function

javascript - Add class to another page attribute using URL id - Jquery -

i have attached id url. ex: when click link 1 , has #tab-2 id , takes me landing page. in landing page have find element has #tab-2 id have add class .active . i tried no luck. please 1 correct code. thanks js fiddle link html <div class="menu"> <ul> <li><a href="http://jsfiddle.net/gscyoa0j/1/#tab-2">link 1</a></li> <li><a href="http://jsfiddle.net/gscyoa0j/1/#tab-44">link 2</a></li> <li><a href="http://jsfiddle.net/gscyoa0j/1/#tab-74">link 3</a></li> </ul> </div> landing page <div class="tab"> <ul> <li><a id="tab-2" class="active" >link 1 content</a></li> <li><a id="tab-44" >link 2 content</a></li> <li><a id="tab-74" >link 3 content</a></l

c# - Default decimal separator on IIS -

i'm facing rather weird issue. have asp.net website allows users deposit money fake account. have validation on input amounts , has min value of 0.00 . however, when load page , check "min value" 0,00 - when check happens on backend min value 0,00 (note separator) , breaks/is invalid. i set vs use correct culture in config, have set my decimal default use full stop separator system side (in region/locale settings) , iis .net globalization set use correct culture . however, whenever load page defaults 0,00 instead of 0.00. there anywhere else need change it? when friend hosts same site on pc min value 0.00 - we've checked , our number formats , culture stuff seems same. there might missing? your windows/.net framework non-english installation? did use line in web.config example english: <configuration> <system.web> <globalization uiculture="en" culture="en-us" /> ... see: how to: set

c# - I need Linq to sql queries with join and count -

i need count how many singles of 1 matchmaker in tbluserregistration table. use following code,in code if codition filtering grid record. please replay me fastly. private iqueryable chanims { { entitiesmodelmx dbcontext = new entitiesmodelmx(); //var query = p in dbcontext.tblshadchanims // p.confirmed == true || p.status != null // orderby p.shadchanimid descending // select p; var query = p in dbcontext.tblshadchanims join u in dbcontext.tbluserregistrations on p.shadchanimid equals u.shadchanid usercount orderby p.shadchanimid descending select new { p, singles = usercount.where(usr => usr.shadchanid !=0).count() }; if (txtfirstnamefilter.text.trim().length > 0) { query =

android - Getting error: Execution failed for task : myApp:compileDebugNdk' -

hi trying run app created cocos2d-x 2.5 android studio keep getting error when running project: :myapp:compiledebugndk agpbi: {"kind":"error","text":"*** android ndk: aborting... . stop.","sourcepath":"/mypath/ndk/android-ndk-r10d/build/core/add-application.mk","position":{"startline":199},"original":""} failed execution failed task ':myapp:compiledebugndk'. building works ok. have android studio 1.1.0 , mac os x yosemite 10.10. do guys have idea wrong? i have seen similar error being discussed here execution failed task ':app:compiledebugndk' when trying compile android studio project ndk source code but solution doesn't work me (created empty .c file in jni folder). looks happens on windows , use mac. i solved adding build.gradle file: sourcesets.main { jni.srcdirs = [] }

visual studio 2012 - SSRS - Value does not fall within the expected range -

Image
i have created report in visual studio, deployed using ssdt remote desktop our ssrs service running. has deployed without errors , can see data source , report on remote desktop. however when go test connection on data source following error: 'value not fall within expected range' i using ole db connection stumped why issue. have looked through previous questions , see majority of questions revolve around share point i'm not using. any appreciated. kind regards

sql server - Columnstore vs. Hekaton Performance -

which technique faster data bulk upload empty db table? which technique faster data inserts / updates non-empty db table? which technique faster when reading data non-empty db table? that such broad question. performance profile of 2 storage engines has nothing in common. use hekaton oltp workloads. use columnstore indexes analytical queries. fact query of columnstore index must scan in total disqualifies oltp-style queries. fact hekaton has extremely limited query plan shapes disqualifies olap applications. so have no choice because applications not overlap.

How to add negative values to JavaFx Area Chart? -

Image
i'd draw difference (area) chart, this: how d3.js difference chart example work json data? chart centered around horizontal (y=0) axis. javafx's area chart seems know how fill area below line!? example "adding negative value" (fig 33-7) seems i'm looking (march series) but not work/render shown! instead of: it renders: thanks, igor

html - Missing/Unusual font making the text overlap -

i have code generated font "helveticaneuelt pro 25 ultlt", not sure font resulting text gets overlapped: <div style=" position:absolute; top:36pt; left:64.8pt; border:0pt solid black; width:507.8pt;height:125pt;"> <div align="left" style="line-height:0pt; "> <span style="white-space:pre-wrap; font:normal 34pt helveticaneuelt pro 25 ultlt; color:rgb(102,102,102);">my </span> <span style="white-space:pre-wrap; font:normal 34pt helveticaneuelt pro 25 ultlt; color:rgb(102,102,102);">name</span> <span style="white-space:pre-wrap; font:normal 34pt helveticaneuelt pro 25 ultlt; color:rgb(102,102,102);"> is</span> </div> <div align="left" style="line-height:0pt; "> <span style="white-space:pre-wrap; font:normal 30pt helveticaneuelt pro 25 ultlt; color:rgb(77,217,255);">david </span> <span style=

javascript - Fade Multipie Texts with Buttons Click -

i want make text box or area in website, , have 9 buttons in page don't want redirect other pages , open in same page , in same text box or area create. so, if click on button 1, open text 1 , picture(s) fades in animation, , when click on button 2, text 1 box fades out , text 2 picture(s) fades in , etc. how can this? i have tried codes $('.one').hide(); $('.two').hide(); $('.three').hide(); $('.btn1').click(function () { $('.one').fadein(); }); $('.btn2').click(function () { $('.one').fadeout(); $('.two').fadein(); }); $('.btn3').click(function () { $('.two').fadeout(); $('.three').fadein(); }); fiddle but when click buttons , buttons position not fixed , move text animation. is there ways same other codes? $('.one').hide(); $('.two').hide(); $('.three').hide(); $('.btnall').hide(); $('.btn1').click(functi

php - Get One Page Checkout Payment Custom Form Input value -

Image
i have class my_mymodule_block_server_form extends mage_payment_block_form { protected function _construct() { parent::_construct(); $this->settemplate('mymodule/form/myinputform.phtml'); } } app/design/frontend/base/default/template/mymodule/form/myinputform.phtml page following code in it <dt> <input type="radio" class="radio" title="<?php echo $this->getmymoduletitle(); ?>" name="payment[method]" value="somestrangevalue" id="p_method_mymodule" autocomplete="off"> <input type="radio" class="radio" title="<?php echo $this->getmymoduletitle(); ?>" name="payment[method]" value="somestrangevalue2" id="p_method_mymodule" autocomplete="off"> i can see 2 inputs on checkout page. want value of radio input in controller (where post data payment gateway).

samsung mobile - How do I uninstall an administrator app? -

basically, trying install pandora 1 apk mod , downloaded app called "phonebooster". since then, 10 seconds after open google play store, app pops up! also, when i'm watching youtube video, or on youtube, ad video pops up! last thing when i'm on website, redirect me popup add bit it's same 1 everytime! think has "phone booster apk" app. administrative app when go settings -> security -> device administrators , try uncheck something, brings security page , nothing. really need help! you need follow path i.e.; move settings->security->device administrator & de-select app want unistall. then, open applications , force stop app , uninstall it. works me, hope works you.

junit4 - How to write test case for the given code using powermockito -

i want know if have code - public class { static string b = "hello"; public static string a() { string b = b(); string d = d(b); string e = e(d, b); return e; } public static string b() { return b; } public static void c(string c) { b = c; } public static string d(string d) { return d; } public static string e(string e1, string e2) { return e1 + e2; } } than how write test cases using power mockito since methods static , method void too. the first thing got need write test case method since using other methods others cover in it. can me , tell me how can test .

hadoop - Why to use multiple column families in HBase? -

why use multiple column families in hbase , advantages of these tuples? already documented in official hbase guide, take @ statements in bold: on number of column families hbase not above 2 or 3 column families keep number of column families in schema low. currently, flushing , compactions done on per region basis if 1 column family carrying bulk of data bringing on flushes, adjacent families flushed though amount of data carry small. when many column families flushing , compaction interaction can make bunch of needless i/o loading (to addressed changing flushing , compaction work on per column family basis). more information on compactions, see compaction. try make 1 column family if can in schemas. introduce second , third column family in case data access column scoped; i.e. query 1 column family or other not both @ 1 time. 33.1. cardinality of columnfamilies where multiple columnfamilies exist in single table, aware of cardinality (i.e., number of rows). if colum

swashbuckle - Swagger: support for optional routes -

i have route optional parameter: [route("{categoryid?}")] public httpresponsemessage get(int? categoryid=null) however, when don't provide value categoryid call includes {categoryid?} in request itself... http://myhost/api/%7bcategoryid%7d swagger has no support optional path parameters. if wish document way, you'd have create 2 separate paths - 1 without path parameter , 1 with.

java - NoClassDefFoundError in servler logs -

i'm using classes12.jar connection pooling in our application. there screen which, on clicking, redirects error page. when checked server logs got exception shown below. error coming our db connection manager (paytfdbbase.java). this class contains getconnection() returns connection object , calls getconndetails() parameters read. these 2 methods listed below. it used occur once in blue moon , when comes infra team restarts server , issue gone. but has been occurring more frequently. i've checked classes12.jar inside web-inf\lib folder. all other upload screens work going through same connection manager working correctly java.lang.noclassdeffounderror: oracle/jdbc/pool/oracleconnectioncacheimpl @ com.arch.paytfdbbase.getconndetails(paytfdbbase.java:787) @ com.arch.paytfdbbase.getconnection(paytfdbbase.java:180) @ com.reports.client.payliquiduploadjavabean.getrecords(payliquiduploadjavabean.java:72) @ jsp_servlet._c

java - simpleDateFormatter not working on websphere -

i working on java 1.7 on ubuntu. code , functionality working fine. when deployed on websphere java.text.simpledateformatter not working... , displaying parse error.my websphere enviornment has linux , java 1.4.2. if knows issue, please me. here code public static string formatdate(string commingdate){ string formateddate = "00-00-00"; try { simpledateformat sdf = new simpledateformat("dd-mm-yyyy"); date date = sdf.parse(commingdate); formateddate = sdf.format(date); } catch (parseexception e) { log.error(e); } return formateddate; } the simpledataformat(string) constructor uses default system locale. it's possible websphere server has different default locale causes different behavior. try specify locale explicitly: simpledateformat sdf = new simpledateformat("dd-mm-yyyy", locale.english); see this answer similar problem.

Converting String to Date Format in Python -

i have following date need convert: wed, 09 jul 2014 12:22:17 +0000 this stored string. wrote code convert date format want (the string above passed argument covertdate function): def convertdate(dictvalue): date_string = dictvalue format_string = '%a, %d %b %y %h:%m:%s %z' date_object = datetime.datetime.strptime(date_string, format_string) date_correct_form = date_object.strftime("%y-%m-%d") print(type(date_correct_form)) print(date_correct_form) return date_correct_form the output follows: <class 'str'> 2014-10-30 i format want, still isn't recognized date. how can make so? you returning date_correct_form , result of strftime : return string representing date , controlled explicit format string. (emphasis mine) if want datetime object, return date_object . if need both, can return both: return date_correct_form, date_object you can call so: date_string, date_obj = convertdate

knockout.js - $component incorrect within foreach binding inside a KO component -

js fiddle showing issue: http://jsfiddle.net/davetropeano/58vm9r6g/7/ i have custom component renders observable array. list elements readonly , trying support letting user delete element. here's template: <template id="kv-list"> <input type="text" placeholder="key" data-bind="textinput: k"> <input type="text" placeholder="value" data-bind="textinput: v"> <button data-bind="click: add">add</button><br> <table> <thead> <tr> <th data-bind="text: keyheading"></th> <th data-bind="text: valueheading"></th> <th></th> </tr> </thead> <tbody data-bind="foreach: items"> <tr> <td data-bind="text: k"></td> <td data-bind="text: v">

debugging - how to attach a running node.js process and debug WITHOUT a GUI? -

by sending sigusr1 can start internal debugger on port 5858, , can use node-inspect debug running process via gui in browser. however if host server have no gui, , kind of port(5858) firewalled due security policy. how can debug in local console? using gdb in c/c++? i tried telnet 5858 locally seems talk in http debugging operations. there existing tool help? node.js (up @ least version 7.x.x) has built-in cli/text client debugger. access it, start program debug argument; example: node debug server.js . for details on how navigate debugger, refer documentation . the documentation includes explanation of how attach running pid ( node debug -p <pid> ) or how attach process via port 5858 asking ( node debug localhost:5858 ). as of writing, node.js version 8.0.0 has not been released yet. however, possible cli debugger replaced in version. (just putting here people find answer in future. if node.js version 8.0.0 or later has changed 7.x.x such answer no longer

java - How to display the data from mySQL in listview in android? -

i can insert data database face problem cannot retrieve data database , display in listview in android. here coding part retrieve data. hope can solve this, thank you. package com.example.iuum; private progressdialog pdialog; private static final string read_comments_url = "http://10.19.229.212/webservice/comments.php"; private static final string tag_success = "success"; private static final string tag_title = "title"; private static final string tag_posts = "posts"; private static final string tag_post_id = "post_id"; private static final string tag_username = "username"; private static final string tag_message = "message"; private jsonarray mcomments = null; private arraylist<hashmap<string, string>> mcommentlist; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_forum1a); } @override protected vo

javascript - How to combine ion-refresher and ion-infinite-scroll? -

i have far , working horrible, everytime go bottom of page, reloads , throw me top <ion-content> <ion-refresher on-refresh="dorefresh()"> </ion-refresher> <div ng-repeat="post in posts"> <a ng-href="#/tabs/news/{{post.site_id}}/{{post.id}}"> <h2 ng-bind-html="post.title"></h2> <p>{{:: post.date | date}}</p> </a> </div> <ion-infinite-scroll on-infinite="loadmore()" distance="1%"> </ion-infinite-scroll> </ion-content> and controller .controller('newsctrl', function($scope, $ionicloading, $stateparams, freshlypressed) { $scope.posts = []; $scope.loadmore = function() { $scope.posts = freshlypressed.getblogs($scope); $scope.$broadcast('scroll.infinitescrollcomplete'); }, $scope.dorefres

scala - What's wrong with the expression `new ListBuffer.empty[Int]` -

i found works well: val buf = scala.collection.mutable.listbuffer.empty[int] but, doesn't work: import scala.collection.mutable.listbuffer val buf = new listbuffer.empty[int] the compiler complains: error:(2, 32) type empty not member of object scala.collection.mutable.listbuffer lazy val buf = new listbuffer.empty[int] ^ does have ideas this? listbuffer.empty isn't constructor, it's function returns empty listbuffer. there's no need new keyword.

ios - How to use a variable in other class that is defined in AppDelegate -

i have variable var window: uiwindow? in appdelegate.swift file inside class appdelegate want use in other class xyz.swift file inside class xyz explained in here get current view controller app delegate (modal possible) getting error @ first line appreciated. here code xyz.swift func currentview() -> uiview { let navigationcontroller = window?.rootviewcontroller as? uinavigationcontroller // use of unresolved identifier 'window' if let activecontroller = navigationcontroller!.visibleviewcontroller { if activecontroller.iskindofclass( myviewcontroller ) { println("i have found controller!") } } } even if use let navigationcontroller = appdelegate.window?.rootviewcontroller as? uinavigationcontroller error 'appdelegate.type' not have member named 'window' you may have follows: var appdelegate = uiapplication.sharedapplication().delegate appdelegate let navigationcontroller =

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. there variety of reasons script appears not sending emails. it's difficult diagnose these things unless there obvious syntax error. without 1 need

c# - windows authentication working from local to server, but not server to server -

i have 2 sites, a , b . a consumes api b exposes, , b requires windows authentication. both sites live in domain d . the api consumed via httpclient , , when site a run locally, under domain account (which in domain p ), access granted. in case, httpclient instantiated so: using(var client = new httpclient(new httpclienthandler { usedefaultcredentials: true })) when a deployed testing server, above results in 401 unauthorized response. application pool on testing server running under service account in domain d . when explicitly using service account this: var credential = new networkcredential("service-account", "password", "d"); var cache = new credentialcache { { new uri(apiserveruri), "ntlm", credential } }; var handler = new httpclienthandler { credentials = cache }; using(var client = new httpclient(handler)) ... and again running site a locally, access still granted. access granted when accessing api d

c# - Update Dictionary object in redis cache using StackExchange.Redis client -

i using azure redis cache , stackexchange.redis client access it. trying figure out best way update dictionary values in redis. public async task<t> fetchandcacheasync<t>(string key, func<task<t>> retrievedata, timespan absoluteexpiry) { t value; var output = await _cache.stringgetasync(key); if (output.hasvalue) { value = _serializer.deserialize<t>(output); } else { value = await retrievedata(); await _cache.stringsetasync(key, _serializer.serialize(value), absoluteexpiry); } return value; } _cache in above code snippet of type stackexchange.redis.idatabase. on initialization store dictionary object as fetchandcacheasync("diagnostics", () => new dictionary()); i have function called update datetime given key in dictionary object. question: basic knowledge

sql server - LIKE statement with Table variable -

i want select statement using values have in table variable. declare @emailids table (usrmst_id int) declare @actionids table (tskmst_id int) insert @emailids (usrmst_id) select usrmst_id usrmst usrmst_domain = 'email' insert @actionids (tskmst_id) select tm.tskmst_id tskmst tm inner join tskmail tml on tml.tskmail_id = tm.tskmst_id tskmail_to_int '%' + (select cast(usrmst_id char(5)) @emailids) + '%' select * @actionids this failing because select cast(usrmst_id char(5)) @emailids has multiple results. want each value in @emailids table generate return @actionids table. you can try using inner join instead: insert @actionids (tskmst_id) select tm.tskmst_id tskmst tm inner join tskmail tml on tml.tskmail_id = tm.tskmst_id inner join @emailids e on tskmail_to_int '%' + cast(e.usrmst_id varchar(5)) + '%' you should cast varchar inst

Django Rest Framework ModelSerialzer field doesn't respect required=False -

using django rest framework 3.1.1, have following serializer: class commentserializer(contentserializer): created_by = userserializer(required=false) content = serializers.primarykeyrelatedfield(queryset=content.objects.all(), required=false) class meta: model = comment while content field respects required=false parameter, created_by not, in result, gives me list of "this field required" validation errors inside userserializer: {"created_by":{"username":["this field required."],"user_permissions":["this field required."],"password":["this field required."],"groups":["this field required."],"profile_picture":["this field required."]}} according documentation section "dealing nested objects" demonstrates usage serializer. what have tried: my previous question , tried adding get_validation_exclusions did not believe

Assembly: Error when attempting to increment at array index -

here's small snippet of assembly code (tasm) try increment value @ current index of array. idea "freq" array store number (dword size) represents how many times ascii character seen in file. keep code short, "b" stores current byte being read. declared in data segment freq dd 256 dup (0) b db ? ___________ assume b contains current byte mov bl, b sub bh, bh add bx, bx inc freq[bx] i receive error @ compilation time @ line containing "inc freq[bx]": error argument operation or instruction has illegal size. any insight appreciated. there no inc can increment dword in 16 bit mode. have synthesize add/adc, such as: add freq[bx], 1 adc freq[bx + 2], 0 you might need add size override, such word ptr or change array definition freq dw 512 dup (0) . also note have scale index 4, not 2.

ruby on rails - Image not downloading - carrierwave -

rails 3.2.18 ruby 2.1.5 i using carrierwave upload/download images. running situation can upload document, when try download it, following error message: the requested content cannot loaded. please try again later when looked through log file, saw file supposed have been sent. log entry is: sent file /home/app/uploads/documents/test_document.jpg (0.1ms) completed 200 ok in 67.0ms (activerecord: 57.2ms) i checked , /home/app/uploads/documents/test_document.jpg there , according log file, sent. ideas why i'm getting error message?

javascript - displaying image onclick working fine, but how do I hide it on click again -

so have html , javascript code pops image on click of button, , working fine. when image pops up.. cannot close wherever click in page. there javascript function allow un-display on click again here code <script type="text/javascript"> function openimage(){ document.getelementbyid('loadingimage').style.visibility="visible"; } </script> #button { -webkit-border-radius: 28; -moz-border-radius: 28; border-radius: 28px; font-family: arial; color: #ffffff; font-size: 20px; background: transparent; border: solid #ffffff 2px; text-decoration: none; } <button id="button" onclick="openimage();">get started</button> <img id="loadingimage" src="png/module.png" style="visibility:hidden"/> function openimage(){ if ( document.getelementbyid('loadingimage').style.visibility == "visible" ) { document.getel

ios - UIView scroll view scrolls out of way -

is there way can (probably using uiscrollview) scroll uiscrollview down see 55px (or whatever value want) @ bottom. example have uiscrollview in background scrolls horizontally (contains bgs). can scroll horizontally in change bg. on top of have uiscrollview (vertically scrolling) content. if user scrolls scroll down actual uiscrollview down bottom of screen (it keep top 55px visible) , remains there little tab, allowing user access bg scroller change bg. can (using tab) scroll , uiscrollview goes full screen , can scroll content uiscrollview again. for example google maps app on android, if go place, "tab" of view @ bottom , can drag , scroll in it, , drag down. stays there @ bottom , can drag @ time, gives access view behind (the map in case)

ruby - Download file from S3 to Rails 4 app -

i have aws vm runs daily task , generates several files. want rails app download these files , place them in folder within app. there gem or method in ruby can this? i know how in bash s3cmd , guess create script them way, looking more native rails way. i using data in these files app, don't want users able download them. the aws-sdk v2 gem provides simple interface downloading objects amazon s3. require 'aws-sdk' s3 = aws::s3::resource.new( region: 'us-east-1', access_key_id: '...', secret_access_key: '...' ) s3.bucket('bucket-name').object('key').get(response_target: '/path/to/file')

regex - Javascript replace all characters that are not a-z OR apostrophe -

i have around interwebs have yet find solid answer. seems pretty straight forward. let want replace characters in string not a-z , not , apostrophe. example: with string "jeni's splendid ice cream" replace characters not a-z or apostrophe. have tried far is: var term = "jeni's splendid ice cream" term.tolowercase().replace(/[^a-z]|[^\']/g, ''); but didn't seem work.... correct everyone? need sanity check, lol or statements ( | ) belong inside group, in case unnecessary. regex should trick: /[^a-z']/g working example: var term = "jeni's splendid ice cream" alert(term.tolowercase().replace(/[^a-z']/g, ''));

How to Run a "Dot 1" File in Linux Terminal -

i need run file in terminal (linux). http://manpages.ubuntu.com/manpages/trusty/man1/ncbi-seg.1.html it comes ".1" file. ideas? something (it is, after all, man-page): nroff -man ncbi-seg.1 |less better, if program installed (not ".1" file): man ncbi-seg (section "1" default). a comment notes (at least on linux), man program accepts actual pathname, e.g., man ./ncbi-seg.1 and referring followup, made script, qm in june 1995: #!/bin/sh tbl $* | nroff -man |less since then, (not all) versions of man have incorporated fix automatically run tbl .

yii2 - How to properly use Yii modules? -

in yii php framework, 1 has ability create modules. per yii's official documentation here definition of module : a module self-contained software unit consists of models, views, controllers , other supporting components. in many aspects, module similar application. main difference module cannot deployed alone , must reside inside of application. users can access controllers in module normal application controllers. let's have huge aplication , have create front-end , backend. in case, better create frontend module , , backend module , use them, or better implment frontend 1 yii application, , backend second yii application. i'm asking because if @ yii's 2 advance template , there 3 different applications ( common, backend, frontend ), not implemented 3 different modules, , question why? is app going slower when use modules , pros , cons of using modules? yii2 advance template has 3 different applications frontend, backend , console (