Posts

Showing posts from June, 2014

javascript - Draw to canvas only after Google Web Font is loaded -

i using .filltext() on canvas, text of want in google web font (oswald, in case). when page loads, text drawn canvas before font has loaded, once font loads text on canvas doesn't update, because has been drawn bitmap. how can delay text drawing until after web font has loaded? rectangle drawn canvas still draw on $(document).ready() . i should delay .filltext() instead of overwriting default font, since design-oriented application, , fout reflects negatively on aesthetics. here's example of how use typekit's webfontloader allow fonts time load before using them: // load google font == monoton webfontconfig = { google:{ families: ['monoton'] }, active: function(){start();}, }; (function(){ var wf = document.createelement("script"); wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.10/webfont.js'; wf.async = 'true'; document.head.appendchild(wf); })(); var canvas=document.getele

node.js - npm install untar error -

i've installed node.js , git hub. i've modified environment variable too. when go folder package.jason file present , type following command npm install i'm getting untar error. here detailed error pkottawa@pkottawa-lap /c/program files (x86)/nodejs/node_modules $ cd npm/ pkottawa@pkottawa-lap /c/program files (x86)/nodejs/node_modules/npm $ npm install npm err! tar.unpack untar error c:\users\pkottawa\appdata\roaming\npm- cache\nock\0.59.1\package.tgz npm err! tar.unpack untar error c:\users\pkottawa\appdata\roaming\npm-cache\requ ire-inject\1.1.1\package.tgz npm err! tar.unpack untar error c:\users\pkottawa\appdata\roaming\npm-cache\mark ed\0.3.3\package.tgz npm err! tar.unpack untar error c:\users\pkottawa\appdata\roaming\npm-cache\npm- registry-couchapp\2.6.7\package.tgz npm err! tar.unpack untar error c:\users\pkottawa\appdata\roaming\npm-cache\npm- registry-mock\1.0.0\package.tgz npm err! tar.unpack untar error c:\users\pkottawa\appdata\roamin

android - EditText overflowing into button -

Image
i have edittext , button in fragment activity. i'm facing 2 issues. 1) cannot put button , below edittext . here, screenshot : 2) whenever paste lengthy text in edittext , button overlapping text. please @ screenshot. here xml : <framelayout> <edittext android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/edittext" android:text="@string/url" android:hint="@string/hint" android:layout_margintop="200dp" android:layout_gravity="center_horizontal|top" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/track" android:id="@+id/button" android:layout_gravity="center"

visual c++ - Local binary pattern in C++ -

i have problem code:private: private: system::void lbptoolstripmenuitem_click(system::object^ sender, system::eventargs^ e) { int ** yp; bitmap ^ bmppicturelbp = gcnew bitmap(w, h); int vn[2][8] = { { 0, 1, 1, 1, 0, -1, -1, -1 }, { 1, 1, 0, -1, -1, -1, 0, 1 } }; yp = new int*[w]; (int = 0; < w; i++) { yp[i] = new int[h]; (int j = 0; j < h; j++) { (int k = 0; k < 8; k++) (int l = 0; k < 8; k++) yp[i][j] = y[i + vn[1][k]][j +vn[2][l]]; bmppicturelbp->setpixel(i, j, color::fromargb(yp[i][j], yp[i][j], yp[i][j])); } } is can me? firtly dont appear errors, after debugging tell me " indication order memory corrupt", , in autos window appear red: + yp[i] 0x0669afb0 int*. i see sev

c# - .Net WebRequest Timeout versus TCP Timeout -

question how configure tcp timeout single webrequest? context according docs, webrequest.timeout : the length of time, in milliseconds, until request times out, or value timeout.infinite indicate request not time out. default value defined descendant class. requesting web resource non-existent endpoint (iis without service bindings on requested port) fails different , constant timeout of 21 seconds . according serverfault answer appears connect tcp timeout. sample code public static async task<string> webrequesttostring(string requesturi, int timeoutmilliseconds) { var request = webrequest.create(requesturi) httpwebrequest; request.keepalive = false; request.timeout = timeoutmilliseconds; request.readwritetimeout = timeoutmilliseconds; using (var response = await request.getresponseasync() httpwebresponse) { // response stream using (var reader = new streamreader(response.getresponsestream()))

javascript - Add properties in object with the help of a for loop and arrays -

i trying add properties object come array. code using: var data = {}; var arr_years = [2013, 2014, 2015]; var arr_quarters2013 = ['q2', 'q3', 'q4']; var arr_quarters2014 = ['q1', 'q2', 'q3', 'q4']; var arr_quarters2015 = ['q1', 'q2', 'q3', 'q4']; function createyearobjects() { (var in arr_years) { data[arr_years[i]] = ''; } } i trying add quarters each year array right property in object. in 2013 have q2, q3 , q4. first try. thought keeping simple trick: function fillyearobjectswithquarters() { (var prop in data) { data[prop] = arr_quarters[prop]; } } since did not work out, tried put string ideas ended in node giving me string 'arr_quarters2013' - 'arr_quarters2015' not want, want reference array name! function fillyearobjectswithquarters() { (var prop in data) { var temp = prop.tostring(); var tempstring = &

rest - Is it possible to parse all tweets of user? -

for example, want parse tweets of microsoft . twitter has api - get statuses/user_timeline . how can see, method can return 3,200 of user’s recent tweets. so, can parse tweets of screen_name ? you might bit better get search/tweets , adding query q=@microsoft . however, have problems well: you'll tweets mentioning @microsoft, not ones @ user_timeline . have filter afterwards although there not limit in theory, 1 of 3200 of get statuses/user_timeline , wont able all tweets user. definition, twitter api not provide kind of service. if want all tweets you'll need use service topsy (not free) you'll have use pagination since every query get search/tweets gives maximum of 100 tweets, , if need more 450*100 tweets (remember you'll mixture of tweets pointed out in 1. above), you'll have handle twitter rate limits , launch queries in windows of 15 minutes sorry there not simpler answer question... hope helps anyway. (edit: 450*100 assuming

python - scipy's interpn for interpolate high N data -

i try interpolate data using scipy.interpolate.interpn . might not right function, please advise me if it's not. need interpolate on 3 variables each have 2 values (8 in total) down single point. here working example n=2 (i think). from scipy.interpolate import interpn import numpy np points = np.zeros((2, 2)) points[0, 1] = 1 points[1, 1] = 1 values = np.array(([ 5.222, 6.916], [6.499, 4.102])) xi = np.array((0.108, 0.88)) print(interpn(points, values, xi)) # gives: 6.462 but when try use higher dimension, breaks. have feeling because how arrays constructed. p2 = np.zeros((2, 2, 2)) p2[0,0,1] = 1 p2[0,1,1] = 1 p2[1,0,1] = 1 p2[1,1,1] = 1 v2 = np.array([[[5.222,4.852], [6.916,4.377]], [[6.499,6.076], [4.102,5.729]]]) x2 = np.array((0.108, 0.88, 1)) print(interpn(p2, v2, x2)) this gives me following error message: /usr/local/lib/python2.7/dist-packages/scipy/interpolate/interpolate.pyc in interpn(points, values, xi, me

c# - Loading page in Windows Phone 8.1 with async method -

i want display loding circle bar, while page in windows phone loading. latency due async method, donwloads json file , concert list of objects. problem, if async method in class ? also, how can result of aysnc method in class/page ? write code in separate class public class result { public string message {get;set} } public class utility { public async task<result> getjson() { //do here return result; } } then call this: loadingindicator.visibility = visibility.visible; await utility.getjson() loadingindicator.visibility = visibility.collapsed; and add page xaml: <grid> <!-- other ui elements --> <stackpanel x:name="loadingindicator" verticalalignment="center" horizontalalignment="center" visibility="collapsed"> <textblock text="loading..."/> <progressring isactive="true" verticalalignment="center"/> </

html - Vertical middle alignment -

#page-header { display: table; font-size: 26px; margin-bottom: 30px; } #page-header div { display: table-cell; vertical-align: middle; } .fonthelvetica { font-family: "trebuchet ms",helvetica,sans-serif; } <div id="page-header"> <div class="fonthelvetica">social<span class="fontlightmaroon">network</span></div> <div><input type="submit" value="upload" name="upload"></div> </div> i want align button in middle text "socialnetwork". font size may change, accordingly button should align in middle. using above code. the problem <input> doesn't receive the inherit font size/line height correctly, , it's depending on browser , os. can set large font on "socialnetwork" only, i.e. #page-header {font-size: 26px;} /*remove this*/ .fonthelvetica {font-size:26px;} /*add

c - How can I track system call in win32 API program with debugger(VS 2013)? -

well, wrote code file i/o win32 api. (i'm using visual studio 2013) it gets 2 file name(one source, 1 destination) , duplicate 1 another. i used createfile, readfile, writefile. it's functionally simple. it's not problem. but.. i wanna see system call in these function being called in debugger. how can this? with call stack? disassembler? so want able debug not own code api itself. there different ways that. at simplest level, use debugger vs2013. won't able trace kernel code, user level code in api. of course use non debug version of windows no symbol table see low-level machine code (*). if want go deeper, have use debugging tools windows . want debug system calls, advice use windows driver kit, windows symbols, , if go down kernel mode windows remote debugging client windows (all tools available windows dev center ). all tools integrate nicely in visualstudio, prepared hard low level work :-) (*) can use microsof symbol server access

angularjs - Detect a change to a paticular element of a model in angular JS -

i want if users edit membership number or role pushes save particular row gets post requested api, http://plnkr.co/edit/plm45ulwl2zklfdpskpl?p=preview <tr ng-repeat="user in users" id="{{ user.userid}}"> .. <td>{{ user.name}}</td> <td>{{ user.email}}</td> <td ng-click="editmemno = !editmemno" ng-show="editmemno"> {{ user.role}} </td> .. <button> save</button> .. </tr> angular.module("userlist", []).controller("usersctrl", function($scope) { var original = [{ "userid": "1", "memno": "1", "name": "asdf", "username": "max", "email": "max@gmail.com", "role": "10", "mobile": "079951334" }, .. }]; $scope.users = angular.copy(original); $scope.origi

html - Can't read JSON file from internet with javascript -

for project ned able users facebook id. have done quite bit of searching cannot find works me. here have right now, looks me should work white screen says document cannot found on server. great! , before ask, yes new javascript, have done little reading on , jumping it. <script> var user = document.getelementbyid("username").value; var script = $.getjson("http://graph.facebook.com/' + user", function(data) { var id = data.id[i]; document.getelementbyid("usernameid").value=id; }); </script> <form action="script" id="form1"> <input id="username" name="username" type="text" placeholder="username" /> <input name="submit" type="submit" value="submit form" /></form> <input id="usernameid" name="usernameid" type="text" />

php - Post Back with javascript -

i have order list on "page1", used javascript write orders html div (when user clicked add button, item added list). posted values next page "page2" if user clicks confirm button. need show same list when user backed page2 page1 instance add item. problem i'm using javascript generate order list, can not post back. impossible find solution javascript or have change code generate order list client side php? you save data in $_cookie\$_session before sending them page 2... you serialize form serialize()

python - IOError: Error reading file: failed to load HTTP resource, LXML error in Pythonanywhere -

i having problem using lxml python 2.7. tried installing lxml version 3.4.0 , 3.4.2 got same error no idea why tho. here python code: @app.route("/getinformation", methods=['get']) def domain(): urllist = [] urllist.append("http://gbgfotboll.se/serier/?scr=table&ftid=57109") urllist.append("http://gbgfotboll.se/serier/?scr=table&ftid=57108") date = '2015-04-18' # use in real mode: currentdate = (time.strftime("%y-%m-%d")) homescore = "0" awayscore = "0" hometeam = "" awayteam = "" time_xpath = xpath("td[1]/span/span//text()[2]") team_xpath = xpath("td[2]/a/text()") league_xpath = xpath("//*[@id='content-primary']/h1//text()") url in urllist: test = 0 #remove rows_xpath = xpath("//*[@id='content-primary']/table/tbody/tr[td[1]/span/span//text(

c# - How can I use SqlDataSource properly with parameters? -

here code i'm using (with oracle developer tools): <asp:sqldatasource id="firstnamesql" runat="server" connectionstring="<%$ connectionstrings:userqueries %>" providername="<%$ connectionstrings:userqueries.providername %>" selectcommand="select &quot;firstname&quot; &quot;users&quot; (&quot;username&quot; = '%?')"> <selectparameters> <asp:controlparameter controlid="usernamelabel" name="firstname" propertyname="text" type="string" /> </selectparameters> </asp:sqldatasource> what i'm trying make query parameter label's text. doesn't return anything. maybe data retrieving method wrong, here: dataview dv4 = (dataview)firstnamesql.select(datasourceselectarguments.empty); foreach (datarow r in dv4.table.rows) { firstnamelabel.text = (string)r[0];

ssl - ruby was-sdk v2 : Seahorse::Client::NetworkingError Exception: SSL_connect -

i downloaded ca-bundle.crt https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt , installed on os x yosemite (10.10 w ruby 2.2.1) local computer @ /usr/local/etc/openssl/certs/ca-bundle.crt, was-sdk v2 not anymore shipped ssl ca bundle however, executing : @s3 = aws::s3::client.new(credentials: aws.config[:credentials] ) puts @s3.list_buckets() i error *** seahorse::client::networkingerror exception: ssl_connect returned=1 errno=0 state=sslv3 read server certificate b: certificate verify failed i tried wo success add ca-bundle.cert path aws.config aws.config[:ssl_ca_bundle] = '/usr/local/etc/openssl/certs/ca-bundle.crt' i tried disable ssl peer verification (for test purpose only) aws.config[:ssl_verify_peer] = false but in both tests it's still failing .. i read issues posted topic, none related final v2 version ... 'definitive' solution issue ? feedback it's os x / homebrew issue ... install open

c# - adding css and id selector to input box (razor helper) -

inside razor view have textbox rendered razor helper @html.editorfor(model => model.caption, new { htmlattributes = new { @class = "form-control" } }) i want add css id class form-control class tried @html.editorfor(model => model.caption, new { htmlattributes = new { @class = "form-control", @id="myid" } }) but doesnt work. by default have id , caption . if want change it, acccording this answer have change editorfor textboxfor . this, need remove new { htmlattributes because textboxfor expects htmlattributes , editorfor expects additionviewdata . @html.textboxfor(model => model.caption, new { @class = "form-control", @id="myid" } ) i want mention code, is, changed id when tested. @html.editorfor(model => model.caption, new { htmlattributes = new { @class = "form-control", @id="myid" } })

scala - Intellij code style to align single-line comments -

Image
right intellij's autoformat changes this: val reducefn = (left: u, right: u) => { left ++ right // comment 1 .myfunca( _._1 ) // comment 2 .myfuncabc { // comment 3 g => { // comment 4 g.myfun ._2 .myfunbbb( 0 )( _ + _ ) } } }: u // comment 5 to this: val reducefn = (left: u, right: u) => { left ++ right // comment 1 .myfunca( _._1 ) // comment 2 .myfuncabc { // comment 3 g => { // comment 4 g.myfun ._2 .myfunbbb( 0 )( _ + _ ) } } }: u // comment 5 is there way can tell intellij produce, or,

vb.net - Get Current Cell Value in EditingControlShowing -

what i'm trying is, if type "red" cell, cell's backcolor changes red , if type "blue" cell, cell's backcolor changes blue. problem i'm getting is, if type "blue", "blu" recorded mystring, textchanged event records cell value before change, cell's backcolor never changes color result. hoping might have idea on how current cell value after textchange. current code below (this example). ideas or appreciated, thanks. private sub datagridview1_currentcelldirtystatechanged(sender object, e eventargs) handles datagridview1.currentcelldirtystatechanged me.datagridview1.commitedit(datagridviewdataerrorcontexts.commit) end sub dim editingcontrol datagridviewtextboxeditingcontrol private sub datagridview1_editingcontrolshowing(sender object, e datagridvieweditingcontrolshowingeventargs) handles datagridview1.editingcontrolshowing editingcontrol = e.control addhandler editingcontrol.textchanged, addressof editingc

php - Symfony tree builder process array -

i want generate url in application config params. have folllowing config i'm processing: link: route_name: article route_params: {id: 1} and configuration: ->arraynode('link') ->beforenormalization() ->ifstring() ->then(function ($v) { return [ 'direct' => $v]; }) ->end() ->children() ->scalarnode('route_name')->end() ->arraynode('route_params')->end() ->scalarnode('direct')->end() ->end() ->end() i'm generating url by: $this->router->generate($this->config['link']['route_name'], $this->config['link']['route_params']); i don't know how process array route_params . amount , names of params different in each routes, can't do: ->arraynode('route_params') ->scalarnode('id')->end() ->end() i'm getting error now

r - getting mean of variables based on names -

i have vector hu <-rnorm(20) names names(hu) <- c(1:5,1:5,6:10,3:7) how group them can take means based on names? try tapply(hu, names(hu), fun=mean) if need in order 1:10, convert names(hu) 'character' 'numeric' tapply(hu, as.numeric(names(hu)), fun=mean) or unique(ave(hu, names(hu)))

How do I suppress the console window when debugging python code in Python Tools for Visual Studio (PTVS)? -

Image
in ptvs default behavior program print python console window , visual studio debug output window. realizing won't able accept user input, how suppress python console window? this more difficult figure out expected, usual, simple once know. the quick answer. in solution explorer, right click on project , select properties. on general tab check box next windows application. then save , close properties window. done! other details discussion of issue posted in 2012 on ptvs codeplex site. python shell appears in addition output window of ide the typical way hide python console window set windows application property (in project properties window), run pythonw.exe instead of python.exe. option if don't provide input while program running - output window in vs not console , not support typing program. also, option per-project, you'll have set each project. (it seems not working in our latest builds, we'll fix asap...) the o

imagemap - CSS scalability image map -

i have problem bothers me couple days: how can make central part of puzzle image works link when resize browser windows (pc view, tablet view, mobile view...)? need link breed image work link. <style type="text/css"> .header-images { display: table; } .row { display: table-row; } .img-01 { display: table-cell; border: none; } .img-02 { display: table-cell; border: none; } .img-03 { display: table-cell; border: none; } .img-04 { display: table-cell; border: none; } .header-images img { width: 100%; height: auto; } </style> <div class="header-images"> <div class="row"> <div class="img-01"> <a href="home/zuechter"><img src="http://s27.postimg.org/rloi8ejr7/01_en.png" alt=""></a> </div> <div class="img-02"> <a href="/home/hundesport

C++ : Using void to create variables -

i learning c++ on own internet. wondering if can create variable of void type. if , how can you? these variables used for? this not work: void b; cout<<b; error: size of b unknown or zero thanks :) "i wondering if can create variable of void type." no, compiler told you. if , how can you?" see above. "also these variables used for?" it won't useful, because void explicitly designates no type . "so wat void pointer used for?" as comment: it's used store address of object of type. unless don't know exact original type, it's pretty useless well.

php - Internal Server Error 500 upon activation of a WordPress plugin -

my wp installation generates internal error 500 every time activate buddypress plugin. this actual error: [sat mar 28 19:12:28.102868 2015] [fastcgi:error] [pid 10447] (104)connection reset peer: [client 192.168.1.1:55431] fastcgi: comm server "/var/www/clients/client1/web4/cgi-bin/php5-fcgi-*-80-site.eu" aborted: read failed, referer: http://site.eu/wp-admin/update.php?action=install-plugin&plugin=buddypress&_wpnonce=54e15a2310 [sat mar 28 19:12:28.103055 2015] [fastcgi:error] [pid 10447] [client 192.168.1.1:55431] fastcgi: incomplete headers (0 bytes) received server "/var/www/clients/client1/web4/cgi-bin/php5-fcgi-*-80-site.eu", referer: http://site.eu/wp-admin/update.php?action=install-plugin&plugin=buddypress&_wpnonce=54e15a2310 ` how should solve that? p.s. strange thing before, when server running ubuntu 12, had no troubles activating , using buddypress. possessed me , decided upgrade os 14.04 , result site became inacc

replace - Vim substitute with ascending numbers inside a pattern -

i have pattern this: word0word word0word word0word and need number ocurrences of pattern this: word1word word2word word3word i found can this: :let @a=1 | %s/word0/\='word'.(@a+setreg('a',@a+1))/g but omits rest of pattern (the second "word", need include identify pattern). there way include rest of pattern? tried: :let @a=1 | %s/word0word/\='word'.(@a+setreg('a',@a+1))'word'/g but returns error. thought combining \zs , \ze , i'm not sure how approach that. in second pattern you're missing . (to indicate concatenation). work : :let @a=1 | %s/word0word/\='word'.(@a+setreg('a',@a+1)).'word'/g " 1 --^ note if want use capture groups in subreplace expression you'll need use submatch(x) instead of \x (replace x number of match, starting @ 1 ) : :let @a=1 | %s/\vword0(\w+)/\='word'.(@a+setreg('a',@a+1)).s

python - Tweepy error after turned to .exe -

so finished writing tkinter program in python, works no errors when turned .exe getting error : file "tweepy\binder.pyc", line 239, in _call file "tweepy\binder.pyc", line 189, in execute tweepy.error.tweeperror: failed send request: [errno 2] no such file or directory everything works fine in .py , no errors occure , can't find solutions on internet please. can please me haven't found answers !! ok solved own problem it's solution managed find out myself , might not best works going explain step step else has same problem does'nt have go through i've been through : go tweepy folder , find binder.py open , in find : try: resp = self.session.request(self.method, full_url, data=self.post_data, timeout=self.api.timeout, auth=auth, proxies=self.api.proxy,

android - How to save XML of absolute layout pragmatically? -

i have built application enable user design his/her business card. have used absolute layout purpose of card designing. problem how enable user edit his/her card after saving card. have save xml of absolute layout edit card? or other method. please me out. in advance. first of all, should not use absolutelayout . from documentation : this class deprecated in api level 3. not sure needs, better choice relativelayout or framelayout . if want save result layout, might need store relevant information views in tree , rebuild once needed. so example, if have textview in card user added, save text, color, margins, etc textview. when needed, create new textview , restore data.

android - Is there a way to cast youtube videos inside my application? -

i'm using "themoviedb" api information movies, , possible retrieve video information movie, this: videos: { results: [ { id: "533ec6a5c3a3685448005327", iso_639_1: "en", key: "ac7khviavqc", name: "first trailer", site: "youtube", size: 720, type: "trailer" } ] } as can see, possible build youtube video url key provided in json. when building mediainfo object, can pass video url, this: mediainfo.builder(movie_url) .setstreamtype(mediainfo.stream_type_buffered) .setcontenttype("video/mp4") .setmetadata(moviemetadata) .build(); however, if movie_url youtube url, can't cast content. is possible cast youtube videos app? if yes, how can it? thanks! there no apis in cast sdk accomplish that. people have had different degrees of luck using embedded youtube iframe approach, not perfect solution various reasons; example

.htaccess - RewriteCond file exists -

such simple problem htaccess , have never got along. serve file if exists. if uri / , if index.html exists serve index.html otherwise serve app.php here .htaccess: # disable directory processing, apache 2.4 directoryindex disabled xxx rewriteengine on # serve existing files rewritecond %{request_filename} -f rewriterule .? - [l] # / serve index.html if exists rewritecond %{request_uri} ^/$ rewritecond index.html -f rewriterule .? index.html [l] # otherwise use front controller rewriterule .? app.php [l] it works if comment out rewritecond index.html -f line long index.html in fact exists. want check index.php need file exists check. , if nothing else i'd understand why posted lines not work. this should work: # disable directory processing, apache 2.4 directoryindex disabled xxx rewriteengine on # serve existing files rewritecond %{request_filename} -f rewriterule ^ - [l] # / serve index.html if exists rewritecond %{document_root}/index\.ht

d3.js - d3 zoom not centering on mouse position with radial tree -

i'm trying apply standard d3 drag/zoom functionality radial tree layout. the problem if define zoomhandler this... svg.attr("transform","translate("+d3.event.translate+")scale("+d3.event.scale+")"); ...then zoom follows mouse whole radial tree starts in wrong place on first zoom (i.e. (0,0) coordinate). whereas if define zoomhandler this... svg.attr("transform", "translate(" + (w/2 + d3.event.translate[0]) + "," + (h/2 + d3.event.translate[1]) + ")scale(" + d3.event.scale + ")" ); ...then tree behaves correctly zoom doesn't follow mouse (in fact in order zoom in/out on tree without moving mouse need positioned in 0,0 coordinate @ top-left of screen) i appreciate topic that's been discussed before (i think notably here: using d3, can semantic zoom applied radial tree? ), i'm still unclear how around problem hugely appreciate input who's resolved problem o

python - split by newline wildcard backslash -

split \n wildcard / . have following text: wiring /(cid:3)(cid:9)waÉ™rÅ‹/ noun 1. network of wires wisdom tooth /(cid:3)(cid:9)wzdÉ™m tu(cid:11)θ/ noun 1 of 4 teeth in of jaw witch hazel /(cid:3)(cid:9)wtʃ (cid:4)hez(É™)l/ noun lotion made bark of tree i want split words defined, want split \n./ , when use txt.split('\n./') or txt.split('\\n./') it returns txt str.split() different re.split() . . simple dot in str.split() , not wildcard. s = "i dogs" print(s.split('.')) # prints ['i dogs'] to extract "words" like: 'wiring', 'wisdom tooth', 'witch hazel' can use regular expressions : l = re.findall(r'(.+?)\s*/.*?\n', s) findall() returns list matches. . matches non newline character, + matches 1 or more of those. () capturing group (the part of match "stored"). * means 0 or more of previous. \s whitespace character.

objective c - iOS - How to avoid memory leak when saving and loading images to display in UITableView? -

so more of conceptual architecture question. i'm making messaging app in ios. devices can send image messages. saving custom message objects (which include images) disk using nscoder protocol. want remove messages memory when don't need them (i.e. when user logs out , disappears users list view). appropriately encoding user's messages disk, , loading them when user re-appears. however, on messaging view (a dynamic uitableview each cell displays message content), image content of messages cached within uiimageview subview. so, creating duplicates of images when load messages disk. every time user logs out , in (i.e. disappearing , reappearing), associated messages saved , loaded disk (recreated objects), , memory usage creeps upward once go private message view , scroll way in order display messages. ultimately, want clean cache of message images can free memory when user no longer around. have reason saving messages locally; question is: best design saving messa

Clear canvas JavaScript -

i'm trying clear canvas. tried closing path, didn't change anything. also, not sure if ctxbg.close(); on right place. thank you. function drawgrid () { drawgrid(); ctxbg.clearrect(0, 0, canvas.width, canvas.height); function drawgrid () { (var = 75; <= canvaswidth-25; i+= 25) { ctxbg.beginpath(); ctxbg.moveto(-25 + i,55); ctxbg.lineto(-25 + i, canvasheight - 55); ctxbg.stroke(); } (var = 25; <= canvasheight -75; i+= 25) { ctxbg.beginpath(); ctxbg.moveto(55,25 + i); ctxbg.lineto(canvaswidth-55, 25 + i); ctxbg.stroke(); }ctxbg.close(); } you have 2 definitions of drawgrid() function: function drawgrid () { ... function drawgrid () { you can have one. next, there no close() method on context, closepath() . however, not useful here. closepath not "end" path, connects first , last point in path path shape closed. this not usef

perl - Win32::GUI update tray icon does not work -

the tray icon not change. cause? i'm using latest strawberry perl v5.20.2 x86, win32::gui v1.11, windows 7 x64. use strict; use warnings; use win32::gui; $main = win32::gui::window->new( -name => 'main', -text => 'perl', -width => 200, -height => 200 ); $icon = new win32::gui::icon('1-0.ico'); $ni = $main->addnotifyicon( -name => "ni", -icon => $icon ); $icon2 = new win32::gui::icon('0-0.ico'); win32::gui::dialog(); while(1) { $ni->change( -icon => $icon ); sleep(5); $ni->change( -icon => $icon2 ); sleep(5); } win32::gui::dialog(); must put after while loop in order work. :(

javascript - angular-google-maps not updating markers -

i using library angular-google-maps not appear updating markers when push or remove markers markers array demonstrated in plnker below. console shows new marker has been added while not reflected on map. http://plnkr.co/edit/si5tanvbu8fro14oc4ny?p=preview $scope.addplace = function() { $scope.places.push({ id: 3, latitude: 42, longitude: -79 }); console.log($scope.places); }; you need set modelsbyref false in ui-gmap-markers directives <ui-gmap-markers models="places" coords="'self'" modelsbyref="false"> </ui-gmap-markers>

css3 - CSS height is different in different browser -

the height of blue bar in safari , chrome matches in firefox smaller. make them equal. have been trying fix last 3 hours. guys can me. thank you. you use css hack firefox: @-moz-document url-prefix() { header { height:50px; /* or whatever fits best there */ } } this should interpreted firefox, while opera, chrome , safari use default header {...} definition

r - Can transparency be used with PostScript/EPS? -

i trying save r plot eps file have problem following component of plot - gray transparent polygon (transparent black = gray effect): polygon(x.polygon, y.polygon.6, col="#00000022", border=na) this line of code works fine when saving plot pdf not eps. looks eps not support transparency? other choice have? here code full plot: postscript(file="figure.eps", width=5.5, height=5.5, onefile=f, horizontal=f) ts(t(data.frame(initial_timepoint, second_timepoint, third_timepoint, final_timepoint)))->obj obj[,-c(3,7)]->obj1 plot(obj1, plot.type="single", lwd=0.6, xaxs="i",yaxs="i",xlab="",ylab="lv ejection fraction (%)",xaxt='n',yaxt='n',ylim=c(0,70),col="black") axis(1, at=c(1,2,3,4), labels=c("1","2","3","4"),cex.axis=1) axis(2, at=seq(0,70,10), labels=c("0%","10%","20%","30%","40%","50%

php - UP dating the count from a user making a section from a drop down menu -

hi have mysql database called colordb , table in database called colorchoic 3 rows call id, color , value. color row has 8 colors stored in yellow, blue, green, red, black, orange, brown, white. have php select populate select form pulling colors database. know if there anyway of getting user select color add 1 value row. instance if 6 users select favorite color database might table below. the table/database before 6 users select inputs (colors). **color value** orange 0 red 0 blue 0 black 0 yellow 0 green 0 white 0 brown 0 the table/batabase after 6 users select input (colors) **color value** orange 0 red 2 blue 1 black 1 yellow 1 green 1 white 0 brown 0 this php code <?php // create db connection $con = mysqli_connect ("localhost", "user", "password", "colorbd"); // check connection if ($con === false

c++ - Knowing debug details with Qt Creator -

i have bug in qt c++ program , information gives me debugger is: invalid parameter passed c runtime function. i need detect exact location of bug because program big. there anyway redirect errors , debugging details file or something?

Assembly Language in Dos Debug -

Image
how see value of al register. (ax=ah+al) have changed value of ax register. ax 0000 :100 -r ax=0100 bx=0000 cx=0000 dx=0000 sp=ffee bp=0000 si=0000 di=0000 ds=0b38 es=0b38 ss=0b38 cs=0b38 ip=0100 nv ei pl nz na po nc 0b38:0100 b80100 mov ax,0001 it ax modulo 256. in hexadecimal output, 2 leftmost digits (00) in case, why hexadecimal output practical in assembly.

sass - SCSS Susy Configuration Settings -

i trying replicate bootstrap equivalent grid project. love idea having trouble config. using codekit, on latest version. i want grid use following: box-sizing: border-box; 15px gutter each side of grid item no un-need margin (unless @include push(); used). 12 column grid default these current settings: $susy: ( container: 1170px, columns: 12, gutter: .25, global-box-sizing: border-box, output: isolate ); at moment when want create 5 column grid: .members{ &--li{ @include span(1 of 5); } } i expected this: .members--li{ width: 20%; float: left; } but got this: .members--li{ width: 16.6666666667%; float: left; margin-right: 4.1666666667%; } i not sure margin right comes from, due addition never 5 column grid, expected 20% width. aware default 12 columns above have set 1 of 5. ah that's bit tricky. in same situation , wrote mixins generate bootstrap grid su

matlab - How to plot a 3d graph of 2d fft transformations with a changing parameter -

Image
i want make 3d plot of 2d plots of function y y dft of function z having axis k(x) w0(y) , amplitude(y)(z), k dft variable in frequency domain , w0 changing parameter between 0 , 4*pi/45. n=(0:255); x1 = exp(n.*(w1*1j)); x2 = 0.8.*exp(n*((w2-w0)).*1j); z =hamming(256)*(x1+x2); y = fft(abs(z)) if i'm interpreting question properly, wish have this: the x axis dft number, y axis parameter changes time-domain signal , z magnitude of fft each signal. what need define 2d grid of points x number of fft points have... in case, that'll 256 points, , y axis defines varying w0 term 0 4*pi/45 . structure grid such each row defines 1 dft result. for this, use ndgrid that, , following way: max_dft_number = 256; num_w = 10; [w0,n] = ndgrid(linspace(0,4*pi/45,num_w), 0:max_dft_number-1); max_dft_number determines how many dft numbers want compute. in case, 256. can vary according how many dft numbers want. num_w gives how many w0 points want between

Editing two scheduled tasks with powershell in one script -

i use 2 commands in powershell edit 2 scheduled tasks schtasks.exe /tn task1 /sd 2015-01-01 /ed 2015-02-02 /rp mypassword schtasks.exe /tn task2 /sd 2015-04-04 /ed 2015-05-05 /rp mypassword i know if can use 1 line command edit both tasks. thank helping. it's harder make 1 liner when multiple pieces of information need changed. lets try pass array of hash tables invoke-expression @( @{name = "task1";startdate = "2015-01-01";enddate = "2015-02-02"}, @{name = "task2";startdate = "2015-04-04";enddate = "2015-05-05"} ) | foreach-object{ invoke-expression ("schtasks.exe /tn {0} /sd {1} /ed {2} /rp mypassword" -f $_.name, $_.startdate, $_.enddate) } if had csv file columns name , startdate , enddate pipe right foreach have there. don't need declare array statically in code. most powershell code can written in 1 line. depends how horrible expect next person.

How to check if Cell In Datagridview has a value and continue VB.Net -

hi code trying first: find if value in column 0 "code" second: if found check if column 1 "status" has value of "in" if true msgbox appears message "ticket used" if value nothing change value in this code: private sub changefound() dim findtxt string = txt_find.text try if datagridview2.rows.count > 0 integer = 0 datagridview2.rows.count - 1 ' j integer = 0 datagridview2.columns.count - 1 'not using because want in code column. dim cellchange string = datagridview2.rows(i).cells("code").value.tostring if cellchange.contains(findtxt) = true if datagridview2.rows(i).cells("status").value = "in" 'this line 366 msgbox("tickets used") exit sub else datagridview2

r - The meaning of predict(rpart.model) -

given that: data(iris) fit <- rpart(species~., iris) predict(fit) does give cross-validated prediction of training data? i did not find confirmation cv prediction in rpart documentation. 10x using predict(fit) predicted class probabilities (for classification trees; means regression trees) on training data set. tree used prediction shown by fit ## n= 150 ## ## node), split, n, loss, yval, (yprob) ## * denotes terminal node ## ## 1) root 150 100 setosa (0.33333333 0.33333333 0.33333333) ## 2) petal.length< 2.45 50 0 setosa (1.00000000 0.00000000 0.00000000) * ## 3) petal.length>=2.45 100 50 versicolor (0.00000000 0.50000000 0.50000000) ## 6) petal.width< 1.75 54 5 versicolor (0.00000000 0.90740741 0.09259259) * ## 7) petal.width>=1.75 46 1 virginica (0.00000000 0.02173913 0.97826087) * during fitting of tree cross-validation carried out, e.g., at fit$cptable ## cp nsplit rel error xerror xstd ## 1 0.

c# - EF code first create database on start up with sqlclient provider -

i'm trying create database on startup code: class datacontext : dbcontext { public dbset<student> students { get; set; } public datacontext() : base("database") { database.initialize(true); } } ///////// try { var db = new datacontext(); db.students.add(new student()); db.savechanges(); } catch (exception ex) { } //app.config <configuration> <configsections> <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <connectionstrings> <add name="database" connectionstring="server=(localdb)\v11.0;integrated security=true;

android - Authentication required for Google Play published app -

i have just published pretty simple application in google play, built using phonegap build (adobe's cloud service). the app being listed in google play says "this app incompatible of devices". if try install it, pops error saying "authentication required. need sign google account" , nothing happens. i tried installing in multiple devices, each different google account. app not yet available download or there configuration problem on end? here link app https://play.google.com/store/apps/details?id=com.smartcode.willitrain i had same problem , how fix simple go apps description , update added 1 word clicked update , hour later worked perfectly

java - Apache Spark executor uses more than one core despite of spark.executor.cores=1 -

when start apache spark 1.2.1 application on centos 6.5, receive more 100% load executors in accordance 'top' output , load average significant more amount of cores. as result have high load on garbage collector. have tried limit cores per executor spark.executor.cores=1 . have tried spark.cores . no effect. hardware 2 x intel(r) xeon(r) cpu e5-2620 v2 @ 2.10ghz, 6 physical cores each 12 cpu cores per node. deployment model yarn client. similar ubuntu 14.04 setup 4 physical cores (intel i5) has no issue, 1 core per executor. any idea how fix this? application submission performed code needed properties set through system.setproperty , spark configuration , context created. done same way, possible difference spark configuration properties set per-cluster there nothing special. under ubuntu 4 cores i5 leads proper load no more 1 core used each executor. under centos 6.5 2x6 cores e5 see more 1 core used per executor. more, tried apply 4 cores i5 configuration