Posts

Showing posts from May, 2011

c++ - Showing txt file details -

i have .txt file these contents: good bad hi i want next button cycle through these words, code word "good". when click next, doesn't show next word. here code qt 5.4 . void mainwindow::on_next_clicked() { ui->showen->clear(); ifstream sfile("e:\\en.txt"); getdata(sfile); sfile.close(); } void mainwindow::getdata(std::ifstream& myfile) { if(!myfile.eof()) { std::string str; getline(myfile, str); ui->showen->settext(qstring::fromstdstring(str)); } } every time method executed: void mainwindow::on_next_clicked() { ui->showen->clear(); ifstream sfile("e:\\en.txt"); getdata(sfile); sfile.close(); } the file opened anew , first bit read getdata. file closed. every time file opened, reading starts on beginning, why see same string every time. you want open file somewhere else (the window's constructor, perhaps?), read on each button c

java - 2-line list view not appearing -

Image
i'm trying create 2-line list view in activity i've come across 1 error don't know how fix. how can achieve appcompat way? want achieve in screenshot attached. error on line 52. public class wclineactivity extends actionbaractivity { private class sample { private charsequence title; private charsequence summary; private class<? extends activity> activityclass; public sample(int titleresid, int summaryresid, class<? extends activity> activityclass) { this.activityclass = activityclass; this.title = getresources().getstring(titleresid); this.summary = getresources().getstring(summaryresid); } @override public string tostring() { return title.tostring(); } public string getsummary(){ return summary.tostring(); } } private static sample[] msamples; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(sa

cakephp 3.0 - Avoid ORM to return Cake\I18n\Time instance -

i have following data on db date date time +--------------+------------+----------------+ | initial_date | final_date | expected_hours | +--------------+------------+----------------+ | 2015-04-20 | 2015-05-24 | 13:00:00 | | 2015-04-13 | 2015-05-17 | 13:00:00 | +--------------+------------+----------------+ but when call $this->set('weeks', $this->paginate($this->weeks)); it returns me cake\i18n\time instance on 3 columns, says here how can avoid instance? edit: the reason want because when have 44:00:00 on expected_hours fails with datetime::modify(): failed parse time string (44:00:00) @ position 0 (4): un expected character this accepts 24:00:00 or less... any ideas welcome in weekstable class add this: use cake\database\schema\table schema; ... protected function _initializeschema(schema $schema) { $schema->columntype('initial_date', 'string'); $schema->columnt

google apps script - ListBox will not populate with new API -

Image
for reason when run app runs except listbox not populate. tried change while looking thinking interator reason listbox not populate folders have in drive. appreciated, thanks! //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* template generator by: andre fecteau - klutch2013@gmail.com original code from: kiszal@gmail.com (found in template gallery searching "templates" first one. major from: serge insas on stack overflow (he did of work.) link 1: http://stackoverflow.com/questions/18147798/e-undefined-google-script-error link 2: http://stackoverflow.com/questions/18132837/have-a-listbox-populate-with-every-folder-in-mydrive how use: first: each column designated in template {column letter} example column {a} second: can change this, template must in folder called "templates." folder can anywhere in drive. third: click "generate documents here!" click "export row document&q

sql server - Measure network time in SQL query -

question raised out of curiosity while working on sql query on vpn connection. vpn slow hence query performing slow. don't have direct access database server, test queries need run them through vpn :( is there way eliminate time taken network lag due vpn , know actual time taken query? without making copy of database , bringing local system/network. you network performance totally dependent on infrastructure. for identifying execution time can use time statistics. run below query set on set statistics time on; now run query. if switch "messages" table of results see below. execution time. sql server execution times: cpu time = 0 ms, elapsed time = 0 ms.

How to read/validate files from web address folder in c# -

i have read files web address folder ...so have used below code ...i not getting list of files... string pathuser = "http:/mentpc.blob.core.windows.net/cents/201503"; string pathdownload = path.combine(pathuser, @"20150302110215315197/20150401100536436792"); webclient client = new webclient(); stream stream = client.openread(pathdownload); streamreader reader = new streamreader(stream); but getting exception saying ===>the remote server returned error: (404) not found. please me what error means, url not found. should pretty easy debug , check combined path in debugger. firstly don't think path.combine correct function use url's. path.combine used physical file paths. should using uri this. uri baseuri = new uri("http:/mentpc.blob.core.windows.net/cents/201503"); uri downloaduri = new uri(baseuri, "20150302110215315197/20150401100536436792"); also, looks trying access 2 files in same url. if case, need change

class - Puppet access parameters of module through other module -

i'm trying deal following situation: class profile:mq { include rabbitmq } class rabbitmq ( $user, $pass, $host ) { ...logic... } i use hiera auto lookup fill in parameters in rabbitmq through profile::mq class (eg profile::mq:rabbitmq::user: "value", not rabbitmq::user: "value") guess encapsulate rabbitmq not sure how in puppet. automated data binding: plan. it doesn't work way propose, however. hiera keys given class looks parameter values depend on class , parameter names. independent of locus of , declarations of class. cannot otherwise, because multiple declarations of same class may evaluated same target node, , -- because classes singletons -- declare same class (instance). you may able achieve you're after putting rabbitmq parameter values in profile-specific level of hiera hierarchy. doesn't feel quite right me, may serve enough purposes.

sorting - Sort the column in a CSV File in Java -

i have csv file reads this. city,job,salary delhi,doctors,500 delhi,lawyers,400 delhi,plumbers,100 london,doctors,800 london,lawyers,700 london,plumbers,300 tokyo,doctors,900 tokyo,lawyers,800 tokyo,plumbers,400 lawyers,doctors,300 lawyers,lawyers,400 lawyers,plumbers,500 hong kong,doctors,1800 hong kong,lawyers,1100 hong kong,plumbers,1000 moscow,doctors,300 moscow,lawyers,200 moscow,plumbers,100 berlin,doctors,800 berlin,plumbers,900 paris,doctors,900 paris,lawyers,800 paris,plumbers,500 paris,dog catchers,400` now, want sort column of salary , write txt file. i can access column, not able sort it. new csv reading part of java. can help! how should store each salary value variable. import java.io.*; public class main { public static void main(string args[]) throws filenotfoundexception { string csv="c:\\users\\dipayan\\desktop\\salaries.csv"; bufferedreader br= new bufferedreader(new filereader(csv)); string line="";

Reallocating/resizing Lua 5.1 userdata in C -

how resize lua 5.1 userdata object in c during runtime? i change size of numarray structure described in roberto ierusalimschy's book programming in lua, 2nd edition, pp. 260, lua 5.1 console. my numarray userdata can either store unsigned chars or lua_numbers. played around calling unmodified luam_realloc_ function defined in lmem.c, call c's realloc (via l_alloc) function returns null, not enough memory error message. would please me ? --- lapi.c ------------------------------------------------------------------------------------------------- lua_api void *agn_resizeud (lua_state *l, void *block, size_t osize, size_t nsize) { udata *u = (udata *)luam_realloc_(l, block, osize + sizeof(udata), nsize + sizeof(udata)); u->uv.len = nsize; if (u == null) lual_error(l, "error in " lua_qs ": failed allocate memory.", "api/agn_resizeud"); return u; } --- numarray.c ------------------------------------------------------------

Facebook returning empty array from /me/friends -

so use 2.3 api version trying access /me/friends list returns of friends using app. except, returns following: { "data": [ ], "summary": { "total_count": 889 } } i have tried using graph explorer js sdk right within browser no luck. i requesting user_friends permission , included default. , yes, have many friends have been using our app. debugged token online via facebook's debugger , concluded token indeed have permission. note: our app isn't listed in facebook app store. live , available public. can help? a user access token user_friends permission required view current person's friends. this return friends have used (via facebook login) app + making request. if friend of person declines user_friends permission, friend not show in friend list person. if user-a friends user-b in above request, response contain user object user-b. if not friends, return empty dataset. did check this ?

javascript - jQuery access object in loop -

Image
i trying basic loop on object getting json file: // in json file , loop on data need chart $.each(jsonresponse.data.escalationssubmittedbylocation.dataset, function() { tempdata.push(array(this.loc, parseint(this.total))) }) when debug , check data looping over, showing correct object: the issue inside loop , try refer object using this.loc or this.total cannot find it. in picture above, hovering on line 676 data object looping over. can see, object contains both total , loc. however, when @ line debugging, this referring values string or something. any idea why can't access values in object looping on when object exists? additional details: // when called, render charts based on json file created function dorender() { $.getjson(jsonfile, function(data) { jsonresponse = data; tempdata.length = 0; // in json file , loop on data need chart $.each(jsonresponse.data.e

python access functions in ipython notebook -

this question has answer here: execute ipython notebook in separate namespace 1 answer i have function stored in .py file, call my_methods. def print_text(mytext): print mytext i'm using ipython notebook development (local server), , my_methods file changing. i'd use runipy run other ipython notebooks via shell script reference functions within my_methods. example, 1 ipython notebook being launched shell script this: import my_methods mm mm.print_text("print me") how set import my_methods line can print_text function ipython notebook (.ipynb), instead of .py version? currently, i'd have download my_methods notebook .py file, causing version control issues (the .ipynb version of my_methods different downloaded .py version) thanks help! edit so after reading through blog post shown answer made slight modification find_noteb

osx - Mac Nginx. Can't change the default page -

i sadly can't nginx default page settings work. have deleted preinstalled html files in /var/www/, still gets load default one.. (also cleared browser cache) my current files: nginx.conf worker_processes 1; error_log /usr/local/etc/nginx/logs/error.log debug; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /usr/local/etc/nginx/logs/access.log main; sendfile on; keepalive_timeout 65; index index.html index.php; include /usr/local/etc/nginx/sites-enabled/*; } sites-available/default server { listen 80; server_name localhost; root /var/www/; access_log /usr/local/etc/nginx/lo

encryption - When compressing and encrypting, should I compress first, or encrypt first? -

if aes-encrypt file, , zlib-compress it, compression less efficient if first compressed , encrypted? in other words, should compress first or encrypt first, or matter? compress first. once encrypt file generate stream of random data, not compressible. compression process depends on finding compressible patterns in data.

C# XNA Space Invaders issue -

i'm making space invaders clone using c# in xna 4.0 , i've run couple of issues. first when shoot of invaders on right-hand side column of array top one, invader moves off-screen until next column reaches predetermined limit; entire array moves down. want still detect remaining invader. i'm pretty sure issue following section of code, i'm not sure problem is. (int rows = 4; rows > 0; rows--) // detects right-most invader (int cols = 10; cols > 0; cols--) { if (invaderarray[rows, cols] != null) { rightinvader = invaderarray[rows, cols]; break; } } the second issue if destroy 1 row of invaders 'nullreferenceexception unhandled' notification on piece of code: if (rightinvader.getxpos() > 800) // right edge limit { invaderdir = -1; (int rows = 0; rows < 5; rows++) (int cols = 0; cols < 11; cols++) {

mysql - AngularJS View-Model creation on Server or Client? -

i curious how others creating angularjs view-models using underlying relational database? team , having trouble deciding if should make object joins on server-side or client-side. for example, have couple models on server author , book , , bookcomment . in first example, there single endpoint author /api/author/:id , "packages" entire view-model on server. second example, each object has own restful api endpoint /api/authors/:id , api/books/:id , /api/bookcomments/:id . an author can have 1 or more book objects , book can have 1 or more bookcomment objects. now lets compare 2 scenarios: server-side join we let server join objects based off of foreign keys , end object like author { 'id':1, 'firstname':'john', 'lastname':'steinbeck', 'books':[{ 'id':123, 'title': 'grapes of

c# - What could cause .NET remoting to fail but only if message sent from code running in IIS? -

have app uses remoting on tcp channel send message web app (the client) central server. tcpclientchannel channel = new tcpclientchannel(); channelservices.registerchannel(channel, true); ipc message = (ipc)activator.getobject(typeof(ipc), remotingurl); // ipc class being 'remoted' message.somemethod(....); for part works fine on 1 particular set of web servers errors on .somemethod :- system.io.ioexception: unable read data transport connection: connection closed. @ system.net.security.negostate.processauthentication(lazyasyncresult lazyresult) @ system.net.security.negotiatestream.authenticateasclient(networkcredential credential, string targetname, protectionlevel requiredprotectionlevel, tokenimpersonationlevel allowedimpersonationlevel) @ system.runtime.remoting.channels.tcp.tcpclienttransportsink.createauthenticatedstream(stream netstream, string machineportandsid of course according ops there no differences between server works, , 1 doesn&#

c# - .NET Web Service works only on localhost -

i'm facing rather strange issue can't address. have written own web service using wcf using visual studio. then, created windows service project. @ least, installed installutil , worked fine. can access @ http://localhost:port/etc . now, expose on different ip address. changed app.config file putting this: <host> <baseaddresses> <add baseaddress="http://localhost:8733/example/" /> <add baseaddress="http://192.168.1.111:1111/example/" /> </baseaddresses> </host> i tried this: <host> <baseaddresses> <add baseaddress="http://192.168.1.111:1111/example/" /> </baseaddresses> </host> but none of them works. when start service error dialog shown me telling service has stopped. may me? update i changed account service installer networkservice , i'm getting error: error 5: access denied some hints?

javascript - Remove a:hover from linked images -

i'm desperate , can't find solution despite of searching www dozens of hours. for text links, have added following css code: a:hover img { border-bottom: none !important; } unfortunately adds thick black underline on linkable imgs somehow ruins of entire site. how remove border-bottom on linkable imgs when hovered using css? i've tried following codes without being able fix issue: a img, a:hover img { border-bottom: none !important; text-decoration: none !important; } so far nothing worked out! any regarding issue highly appreciated. know it's small detail – me means whole world. many in advance! for better understanding please have at: http://www.huberthasler.de/works the logo on left fold out menu affected well. best wishes m your problem that a:hover { border-bottom: 3px solid #000; } adds border a elements on hover css rules have in question remove border img elements descendent a / a:hover elements. since img elem

c# - Do you have to dispose the following SharePoint objects? -

i wanted make sure there's no memory leak in sharepoint need call dispose following sharepoint objects once i'm done? i'm thinking shouldn't have since i'm not creating new , using getcurrent(), sharepoint it's hard tell. microsoft.sharepoint.webcontrols.siteactions siteactions = siteactions.getcurrent(this.page); microsoft.sharepoint.webcontrols.pagestateactionbutton psab = pagestateactionbutton.getcurrent(this.page); microsoft.sharepoint.webcontrols.spribbon ribbon = microsoft.sharepoint.webcontrols.spribbon.getcurrent(this.page);

python - QComboBox mouse press event when combo box is initially pressed PyQt4 -

i'm trying schedule mouse press event qcombobox. wondering if there way schedule mouse press event on initial qcombobox click -- click brings list of items select. i've used currentindexchanged(int) signal call function once user selects 1 of items drop down menu, i'm trying refresh qcombobox list new entries once user clicks on it. (i have feeling approach may misguided, guess that's question.) i've tried making qcombobox subclass def mousepressevent(self, e) , doesn't seem anything. i've tried def mousepressevent(self, e) in qtgui.qwidget class holds qcomboclass object but, unsurprisingly, captures mouse presses qtgui.qwidget. your current approach is misguided. if working, fail whenever list opened via keyboard. the correct way override showpopup : class combobox(qtgui.qcombobox): def showpopup(self): self.insertitem(0, 'added') super(combobox, self).showpopup()

Send array to Struts2 action with jQuery AJAX call -

so far, i've been able send simple string struts2 action class, via ajax call. time need same, string array, , i've changed code this: 1. ajax call: var test = [1, 2, 3, 4, 5]; $.ajax({ method: "post", url: "createexperiment4.action", data: { test : test }, success: function() { window.location = "loadexperiments.action"; } }); 2. createexperiment4action.java: private string[] test; [...] public void settest(string[] test) { this.test = test; } however, data isn't arriving action calss. also, keep getting warning, of course must key problem: warning: parameter [test[]] didn't match acceptedpattern pattern! maybe kind of configuration issue? jquery.ajax's default serialization arrays appends [] after name (eg test[]=1&test[]=2 ), while frameworks php recognizes format, struts doesn't. in order prevent behaviour add traditional: true, confi

javascript - How to transfer a value/object bottom to top in reactjs -

reactjs makes simple data injection, can inject data via parent element throught this.props or this.state objects. transfer value bottom top, can specify ref attribute , use dom methods or edit it. what if want transfer object thus: var editor = react.createclass({ componentdidmount: function() { var editor = new codemirror(this.getdomnode()); this.editor = editor; }, render: function() { return ( <div classname="editor"></div> ); } }); var app = react.createclass({ render: function() { return ( <editor /> <button onclick={this._save}></button> ); }, _save: function() { // i'm confused how can `editor` object? } }); i did thought transfer through attribute like: data-editor , if there elegant or recommend way in reactjs handle such situations? thanks in advance. there multiple ways this. 1 assign ref element , expose method editor or value: var editor

windows - How to "pause" a batch script until a program is closed? -

i have seemingly trivial question can't figure out. writing batch script opens firefox specific url (which works) , more stuff (which works when executed in isolation). however, if put both commands in batch script, executed back-to-back. i need script wait until firefox closed , though. possible? here's have: echo step 1 start /wait "c:\program files (x86)\mozilla firefox\firefox.exe" http://www.google.com echo step 2 i want see "step two" after close firefox. i found thread seems similar . adding /wait doesn't seem help. , don't quite know how adapt accepted solution needs. any appreciated! edit: how adapted scripted in thread linked produces same results: echo step 1 start /wait "c:\program files (x86)\mozilla firefox\firefox.exe" http://www.google.com :loop pslist firefox >nul 2>&1 if errorlevel 1 ( goto continue ) else ( echo firefox still running sleep 5 goto loop ) :continue echo step 2 but stil

c# - How to call a .net method in AJAX on fileupload change? -

i'm trying upload file using ajax problem i'm rookie in .net , don't know if did right or not appreciate or suggestions. here html code: <asp:fileupload id="fileupload1" onchange="show()" runat="server" /> my method should called when users selects file this script found in msdn: <script type="text/javascript"> function show() { var file = document.getelementbyid("fileupload1"); alert("test") $.ajax({ type: "post", url: "sendsms.aspx/staticupdate", data: '{name:"test" }', contenttype: "application/json; charset=utf-8", datatype: "json", success: onsuccess, failure: function (response) { alert("test1"); } }); } function onsuccess(response) { alert("test2&quo

java - How to sum a cell and the surround cells within a matrix -

i want sum cells. mean, surrounding cells. add cell call upon , add value values around it. have far. import java.util.arrays; import static java.lang.system.*; public class matrixsummingrunner { public static void main(string args[]) { int[][] mat = { { 0, 1, 0, 0, 0, 1, 0 }, { 1, 8, 4, 3, 4, 5, 1 }, { 0, 2, 7, 8, 9, 8, 0 }, { 0, 6, 7, 6, 2, 5, 0 }, { 0, 6, 7, 8, 9, 5, 0 }, { 1, 5, 4, 3, 2, 3, 1 }, { 0, 1, 0, 0, 0, 1, 0 } }; out.println("sum of given values, @ {4,2} , values around it" + matrixsumming(mat, 4, 2)); out.println("sum of given values, @ {3,3} , values around it" + matrixsumming(mat, 3, 3)); out.println("sum of given values, @ {5,4} , values around it" + matrixsumming(mat, 5, 4)); out.println(tostring(mat)); } } that's runner, , thought work. import java.util.*; public class matrixsumm

vba - Can not copy from Excel and paste to a Form Edit restricted Word document unless restriction is turned off -

i copying excel cell contents bookmark on form edit restricted (2010) word document paste if protection turned off. the code have turn protection on again afterwards errors. correct code? is there way make copy , paste without turning off protection? second problem when text pasted bookmark font red (if manually entered on document in black). word default set black (i reset default measure). typing in new document in black, however, when word opens font icon shows red though checking default still shows black. can define font colour in vba override issue until is resolved or can suggest way fix word default? sub arzbericht_brandstetter() ' x - defined cell names - artbrandpath , artbranddoc ' excel word bookmark ' x - defined cell names - arzkrankenhaus text65 dim wb workbook dim ws worksheet set wb = activeworkbook set ws = activesheet dim wd object dim wddoc object dim brandstetterdoc object dim brands

angularjs - Inserting duplicate value in indexeddb -

when insert on database , inserting same data twice. table create var ooptions = { keypath: account.primarykey, autoincrement: true }; var ostore = dbhandle.createobjectstore(account.tablename, ooptions); var oixoptions = { unique: false }; account.fields.foreach(function(item) { ostore.createindex(item + "index", item, oixoptions); }); insert var defered = $q.defer(); try { var objectstore = config.database.transaction(tablename, "readwrite").objectstore(tablename); var result = objectstore.add(entity); result.onerror = function(e) { defered.reject("can't insert account"); throw e; } result.onsuccess = function(e) { defered.resolve(); } } catch (e) { defered.reject("can't insert account"); throw e; } return defered.promise; retrive var defered = $q.defer(); try { var req = $window.indexeddb.open(config.databasename, 1.0); req.onsuccess = fun

mysqli - PHP: Creating a new file / page on submit -

so, i'm little new php , wondering if please give me simple yet indepth answer on problem having.. lets take forum such example. when user creates new thread how site create new page (their thread)? usually, url end looking http://www.(sitename).com/forum/77375 <- post id assume. how make such thing? i have site requires users submit article , have made article information sent database. need make new page made unique url article on it. i using php mysqli - appreciated :) when see seo friendly url that, site isn't (or @ least shouldn't) making file post id. site doing url rewrite. take url such http://www.sitename.com/forum , regardless of comes after that, load same file (lets it's called forum.php . take rest of url, , change query string. so rewrite: http://www.sitename.com/forum/123456 to be: http://www.sitename.com/forum.php?thread_id=123456 which forum.php file can data query string , know pull forum posts thread id of 123456

module - Dart library import shortcuts -

in cases have import main file library in dart have do: import 'package:<package_name>/<package_name>.dart'; is there shorthand doing in dart? something like import 'package:<package_name>'; cause mentioning package name twice seems redundant. seems redundant there no way around. new "add import" quick fix makes non-issue imho. darteditor ctrl + 1 webstorm/intellij ctrl + enter you have wait until analyzing done , hint/warning (wiggled underline) shown.

javascript - Angular JS User Profile Grid -

i found example of here: http://www.bootply.com/fzlrwl73pd it looks example using randomuser api generate random user information , pictures. want create similar static information enter manually. have tried manually entering information array following: var myapp = angular.module('myapp', [{"user":{"gender":"female","name":{"title":"mrs","first":"taylor","last":"griffin"},"location":{"street":"2822 w 6th st","city":"everett","state":"oregon","zip":"80020"},"email":"taylor.griffin62@example.com","username":"yellowswan550","password":"twiggy","salt":"uv3zfgdw","md5":"ceb4dbcf76444647f32b059dc3fc1280","sha1":"23ae9f24c4fd1d09e12c95bd75029ea850db3fb6","sha256&q

bash - Usage of expect command within a heredoc -

for following tiny expect script function added bash profile: chai() { expect <<- eof spawn ssh myuser@myserver expect ': $' send 'mypassword\r' eof } we get: bash: /etc/profile: line 409: syntax error: unexpected end of file what wrong script? i expect heredoc terminator (eof) @ start of line e.g. chai() { expect <<- eof spawn ssh myuser@myserver expect ': $' send 'mypassword\r' eof } i see you're using <<- , linked doc: the - option mark here document limit string (<<-limitstring) suppresses leading tabs (but not spaces) in output. may useful in making script more readable. so should check script see if have tab preceding commands. eof subject same rules. cat <<-endofmessage line 1 of message. line 2 of message. line 3 of message. line 4 of message. last line of message. endofmessage # output of script flush left. # leadi

python - Saving plot from ipython notebook produces a cut image -

i plotting plot 2 ylabels using ipython notebook , image looks when visualized inside notebook. here how it: import matplotlib.pyplot plt fig, ax1 = plt.subplots() plt.title('title') plt.xlabel('x') plt.plot(x, y1, '-', color='blue', label='snr') ax1.set_ylabel('y1', color='blue') tl in ax1.get_yticklabels(): tl.set_color('blue') ax2 = ax1.twinx() plt.plot(x, y2, '--', color='red', label='ngal') ax2.set_ylabel('y2', color='red') tl in ax2.get_yticklabels(): tl.set_color('red') the problem when try save command plt.savefig('output.png', dpi=300) since output image cut on right side: don't see right ylabel if right numbers large. by default, matplotlib leaves little room x , y axis labels , tick labels, therefore need adjust figure include more padding. fortunately not easier do. before call savefig, can call call fig.tight_la

html - adding click-to-call to php echo statement -

im sure there simple explanation cant find answer anywhere. function called on header display phone number. im trying add click-to-call tracking when add it, breaks site. this current code: function themeblvd_header_contact() { $link_address = 'tel:3026560214'; echo "<div class='contact-number'>contact @ <a href='$link_address'>(302) 656-0214</a></div>"; } when add click-to-call when breaks: $link_address = 'tel:3026560214'; echo "<div class='contact-number'>contact @ <a onclick="ga('send', 'event', 'phone number', 'click call', '3026560214', 1);" href='$link_address'>(302) 656-0214</a></div>"; i see closing string in middle of , making new one, 2 quotes problem here. try escape string this. $link_address = 'tel:3026560214'; echo "<div class='contact-number'>contact

html - Show Hidden Submenu onclick - JQuery -

i great code jrulle: http://jsfiddle.net/jrulle/23kfnbx7/3/ can explain me how use complete parent-link instead of image open sub menu? , 1 sub menu shown same time? i tried realize that, got - sub menu shown clicking link but arrows not change. $('li.parent').on("click",function(){ $(this).children('a').siblings('ul.children').slidetoggle(); }); sorry misspelling something, big thank's , greetings germany. you need bind click event links well. so, please change $('li.parent').on("click", to $('.parent img, .parent a').on("click", here demo: https://jsfiddle.net/23kfnbx7/8/ $('.parent img, .parent a').on("click", function () { var img = $(this); if ($(this).next('img').length) { var img = $(this).next('img'); } if (img.hasclass('open')) { img.removeclass('ope

How do I reverse an array in JavaScript while preserving the original value of the original array? -

this question has answer here: javascript fastest way duplicate array - slice vs loop 14 answers i'm trying reverse order of array using .reverse() method in javascript, trying preserve original order of elements in original array. when save values variable, end transposing elements in original array creating new 1 same format. eloquent way perform task? var arrayone = [1,2,3,4,5]; var arraytwo = arrayone.reverse(); //arraytwo = [5, 4, 3, 2, 1] //arrayone = [5, 4, 3, 2, 1] var arraytwo = arrayone.slice().reverse(); slice clone array

python - Why does my variable not increment after one time? -

when user submits answer , wrong, def getresult() should make "mistake" variable goes 1 when user makes first error , mistake changes 0 1. after that, when user enter wrong answer, variable still ends "1" again. there way increment when user wrong? from tkinter import * import random root = tk() root.wm_title("hangman") canvas = canvas(root, height=400, width=800) canvas.pack() name = '' def titlescreen(): title = canvas.create_text(400, 100, font=("times new roman", 50), tags="title") canvas.itemconfig(title, text="hangman: game") startbutton = button(canvas, text="start game", width=10, command=startgame) canvas.create_window(400, 200, window = startbutton) creditsbutton = button(canvas, text="credits", width=10, command=displaycredits) canvas.create_window(400, 250, window = creditsbutton) def startgame(): def getname(nameentry): global name

html - Sending an email that opens Android app from email client -

i receive weekly pinterest newsletter. when click on image or available on google play logo inside, built-in popup comes on phone offering me open link chrome or pinterest. key here pinterest app. on laptop brings pinterest.com link. so working on our newsletter , decided this. did set google play link of our app in <a href /> section, opens google play instead of offering me option open app on phone. <a href="https://play.google.com/store/apps/details?id=com.app.app"><img src="http://www.website.com/mylogo.png" width="100" height="35"/></a> how can this? solution i answer question don't understand how works, me, unfortunately stackoverflow doesn't let me it. this did: manifest: <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.in

json - request addparameter array but return empty in response -

i use restsharp. i have list private list<string> _guyids; then [testmethod] public void guymetadataserviceshouldreturnexpected() { var client = new restclient("http://localhost/orionservices/guyservice.svc/"); var request = new restrequest("{facilityid}/guys/metadata/", method.post); request.addurlsegment("facilityid", "888"); request.addparameter("guyids", jsonconvert.serializeobject(_guyids.toarray()), parametertype.requestbody); var response = client.execute(request); dynamic data = jsonconvert.deserializeobject<dynamic>(response.content); in service, [operationcontract] [webinvoke(method = "post", bodystyle = webmessagebodystyle.wrappedresponse, requestformat = webmessageformat.json, responseformat = webmessageformat.json, uritemplate = "/{facilityid}/guys/metadata/")] public list<dynamic> generatemet

too many synonyms per synonym ring - Oracle Text -

i created own thesaurus arabic language , created relations between terms define synonyms, used code: ctx_thes.create_thesaurus ('mythesurus'); ctx_thes.create_relation ('mythesurus', 'لعب', 'syn', 'مرح'); it worked fine, created more 10000 synonyms. when used code: select ctx_thes.syn ('هم', 'plagthesurus') dual; it returned error message ora-20000: oracle text error: drg-11702: many synonyms per synonym ring ora-06512: @ "ctxsys.drue", line 160 ora-06512: @ "ctxsys.ctx_thes", line 708 ora-06512: @ line 1 i searched many, couldn't find results please? looks have exceeded limit. oracle docs https://docs.oracle.com/database/121/ccref/cthes.htm#ccref2157 create_relation creates relation between 2 phrases in thesaurus. synonym ring limited in length 4000 synonyms, depending on word length.

ios - Playing/Pausing sound in an iPhone app -

is there way stop audio playing here? play/stop kind of thing? -(ibaction)playsound:(id)sender{ audiotitle = [nsstring stringwithformat:@"audio %@", audiointeger]; cfbundleref mainbundle = cfbundlegetmainbundle(); cfurlref soundfileurlref; soundfileurlref = cfbundlecopyresourceurl(mainbundle, (cfstringref) audiotitle, cfstr ("mp3"), null); uint32 soundid; audioservicescreatesystemsoundid(soundfileurlref, &soundid); audioservicesplaysystemsound(soundid); } here simple play/pause/stop example using avaudioplayer class. create playing in viewdidload: var audiopath = nsbundle.mainbundle().pathforresource("bach1", oftype: "mp3") var error : nserror? = nil player = avaudioplayer(contentsofurl: nsurl(string: audiopath!), error: &error) inside play button: player.play() inside pause button: player.pause() inside stop button: player.stop() player.currenttime = 0;

R lattice bwplot: Fill boxplots with specific color depending on factor level -

Image
i have dataframe example: >mydata <- rbind(data.frame(col1 = rnorm(2*1000),col2 =rep(c("a", "c"), each=1000),col3=factor(rep(c("yy","nn"), 1000))),data.frame(col1 = rnorm(1000),col2 =rep(c("b")),col3=factor(rep(c("yy","yn"), 500)))) that looks like: >head(mydata) col1 col2 col3 1 -0.1213684 yy 2 0.1846364 nn 3 0.4028003 yy 4 1.4065677 nn 5 -0.8669333 yy 6 0.3295806 nn being col3 of factor type 3 levels: nn yy yn i want make boxplot using lattice bwplot , assign each level specific color: # nn: red=rgb(249/255, 21/255, 47/255) # yn: amber=rgb(255/255, 126/255, 0/255) # yy: green=rgb(39/255, 232/255, 51/255) using bwplot function: pl<-bwplot(mydata$col1~mydata$col3 | mydata$col2,data=mydata, ylab=expression(italic(r)),panel=function(...) {panel.bwplot(...,groups=mydata$col3, fill=c(red,amber,green))}) that results in following figure: clearly