Posts

Showing posts from May, 2015

java - How can I define a variable within an object with another variable -

the title might little confusing want know how can change ' b ' part in mainsave.b define within object. here code far public void getitem(int a, string b) { mainsave.b = a; } the values being sent piece of code in class called story. want them stored in object of class savefile 'mainsave' is if (command_string.equals("1")) { try {thread.sleep(1500);} catch (interruptedexception e) {} system.out.println("you search shed thouroughly , find axe not else..."); int item = 1; string axe = "axe"; getitem(item,axe); try {thread.sleep(1500);} catch (interruptedexception e) {} area1(); } the error when trying compile first part "cannot find symbol - variable b" simply cannot since java statically typed language. variables names must realize @ compile time. i don't suggest possible reflection coding.

c++ - compile error for boost::date_time::days_until_weekday -

i'm toying around boost::date_time . while doing so, came upon days_until_weekday ( documentation link ) function appears highly useful me. unfortunately, compile time error following snippet date f(date d){ return next_weekday(d, boost::date_time::weekdays::friday); } reading > in file included > /usr/include/boost/date_time/gregorian/gregorian_types.hpp:25:0, > /usr/include/boost/date_time/posix_time/posix_time_config.hpp:18, > /usr/include/boost/date_time/posix_time/posix_time_system.hpp:13, > /usr/include/boost/date_time/posix_time/ptime.hpp:12, > /usr/include/boost/date_time/posix_time/posix_time.hpp:15, > prog.cpp:3: /usr/include/boost/date_time/date_generators.hpp: in instantiation of > 'typename date_type::duration_type > boost::date_time::days_until_weekday(const date_type&, const > weekday_type&) [with date_type = boost::gregorian:...

Salesforce Apex: test that callout hasn't been made -

i want write unit test checks callout hasn't been made trigger. know how test if callout made correctly - implementing httpcalloutmock: global class myhttpcalloutmock implements httpcalloutmock { global httpresponse respond(httprequest req) { //test httprequest here } } but if no http request made, respond() method won't called. approach doesn't test if request made @ all. need this: httprequest.assertnorequestshavebeenmade(); how do that? so figured out. turns out salesforce has methods test.starttest() , test.stoptest() make asynchronous callouts synchronous: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_tools_start_stop_test.htm after making callouts synchronous it's easier test them.

Python Check txt variable loop -

i need function check in name.txt variable if variable changed print 1 , again if variable 2 times change again print 1. possible in python? http://pastebin.com/qa0ed3nm fr = open("plik.txt",'r') first_length = len(str(fr.read())) while true: text = str(fr.read()) if(len(text)!=first_length): fr.close() fw = open("plik.txt","w") fw.write(text) fw.close() print("done") break; may function can help: def checkchange(filename, oldcontent): fsrc = open(filename, 'r') actualcontent = fsrc.read() fsrc.close() if actualcontent != oldcontent: print(1) return actualcontent

C# Looping through Dictionary and summing values for Keys -

i have dictionary<string, decimal?> , , able sum decimals distinct string. have below inputs in dictionary, "1", 20.00 "1", 35.00 "2", 10.00 "3", 15.00 "3", 30.00 i following output new dictionary "1", 55.00 "2", 10.00 "3", 45.00 i'm guessing foreach(var item in dictionary) { newdictionary.add(not sure go here, maybe sort of linq query distinct , sum?); } the keys in dictionary can't repeated, 2 first entries won't fit in dictionary. i think may have list of objects can loop, can use dictionary store total each "key" something like dictionary<string, double> totals = new dictionary<string, double>(); list<tuple<string, double>> entries = new list<tuple<string, double>>() { new tuple<string, double>("1",20.00), new tuple<string, double>("1",35.00), ...

node.js - How do I replace a string in a PDF file using NodeJS? -

i have template pdf file, , want replace marker strings generate new pdf files , save them. what's best/simplest way this? don't need add graphics or fancy, simple text replacement, don't want complicated. thanks! edit: found hummusjs , i'll see if can make progress , post here. i found question searching, think deserves answer. found answer brightide here: https://github.com/galkahana/hummusjs/issues/71#issuecomment-275956347 basically, there powerful hummus package uses library written in c++ (crossplatform of course). think answer given in github comment can functionalized this: var hummus = require('hummus'); function replacetext(sourcefile, targetfile, pagenumber, findtext, replacetext) { var writer = hummus.createwritertomodify(sourcefile, { modifiedfilepath: targetfile }); var modifier = new hummus.pdfpagemodifier(writer, pagenumber); var sourceparser = writer.createpdfcopyingcontextformodi...

Calling dll in python 3 with LPSTR -

i have .dll named my.dll , 4 functions, called in python 3.5 using: mydll = ctypes.cdll.loadlibrary(path:\to\my.dll) my problem calling function has lpstr : #include "stdafx.h" #include "newheader.h" double _stdcall pain_function(double arg1, double arg2, lpstr arg_string_with_spaces) the other 3 calls my.dll work fine. below code tried pain_function : import ctypes ctypes import wintypes # load dll mydll = ctypes.windll(path:\to\my.dll) # call function pain_function = mydll.pain_function # typecast arguments pain_function.argtypes = [ctypes.c_double, ctypes.c_double, wintypes.lpstr] # typecast return pain_function.restype = ctypes.c_double pain_return = pain_function(arg1, arg2, some_string) pain_return returns nonsensical number. tried variations, along lines of: some_string = ctypes.create_string_buffer(b' ' * 200) i have looked here among other places: python-ctypes-prototype-with-lpcstr-out-parameter using ...

c# - How can I debug an intermittent unhandled exception "Must disconnect specified child from current parent Visual"? -

i'm getting intermittent unhandledexception must disconnect specified child current parent visual before attaching new parent visual stacktrace references system.* , ms.* calls. looks datepicker left-mouse clicked, , trying toggle pop-up (i'm guessing calendar widget). there lots of datepicker s in application. don't know 1 caused exception. how can debug this? unhandledexception: must disconnect specified child current parent visual before attaching new parent visual. @ system.windows.media.visual.addvisualchild(visual child) @ system.windows.documents.nonlogicaladornerdecorator.set_child(uielement value) @ system.windows.controls.primitives.popup.createwindow(boolean asynccall) @ system.windows.controls.primitives.popup.onisopenchanged(dependencyobject d, dependencypropertychangedeventargs e) @ system.windows.dependencyobject.onpropertychanged(dependencypropertychangedeventargs e) @ system.windows.frameworkelement.onpropertychanged(depen...

.htaccess - Disable rewrite to https for subdomains -

i use rewrite https of calls of .htaccess file. i want avoid http://foo.myhost.com gets rewritten https://www.myhost.com it should stay http://foo.myhost.com <-note, not https <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{https} off rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301] </ifmodule> add negated condition avoid matching subdomain: rewriteengine on rewritecond %{http_host} !^www\. [nc,or] rewritecond %{https} off rewritecond %{http_host} !^(?!www\.)[^.]+\.myhost\.com$ [nc] rewriterule ^ https://www.myhost.com%{request_uri} [l,r=301]

xml - EWS SOAP Requests failing -

i using perl , soap::lite make soap calls ms exchange web services. have figured out authenticating , using oauth token make calls. trying call getinboxrules documented here . basically call needs this. <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:header> <t:requestserverversion version="exchange2010_sp1" /> </soap:header> <soap:body> <m:getinboxrules> <m:mailboxsmtpaddress>user1@contoso.com</m:mailboxsmtpaddress> </m:getinboxrules> </soap:body> </soap:envelope> my first attempt used following code: my $client = soap::lite-...

Preserve history between sessions of terminal usage (Mac osx) -

i followed different guide: https://apple.stackexchange.com/questions/50649/how-to-make-bash-terminal-app-remember-history-of-previous-sessions and called 3 commands: sudo -iu root cd ~(myusername) chown (myusername) .bash_history but upon every start of terminal following output: last login: thu apr 21 15:39:19 on ttys000 -bash: username: no such file or directory and still unable retrieve recent commands in history using up-arrow key. know shouldn't have executed commands didn't know meaning of. can point me in right direction put terminal place , preserve history upon closing terminal? what exact commands typed? mean, presumably did substitute name (myusername) didn't you? , command cd ~(myusername) makes no sense me. on own, cd ~ will take home directory. okay. basic troubleshooting (put answers here). load terminal , type (note there's no need use sudo of this): cd ~ # changes home directory ls -la .bash_history # checks per...

Package existing Titanium Module for Appcelerator Studio -

i trying import this stripe module project can't seem figure out how it. there no distribution file import project. can't seem find guide on how create one. read in readme file just drop distribution files library/application support/titanium folder, using appcelerator studio. can this? thanks hello leonardo, copy , paste dist folder in rootproject/modules/android , rootproject/modules/iphone dist android (unzip) dist iphone (unzip) appcelerator documentation: how using module i check process , works

OptaPlanner benchmark: use in-memory input solution instead of inputSolutionFile -

i'm trying set optaplanner benchmark run. loading problembenchmarks file proving problematic, lot of classes not serializable. take lot of work function. is there way run benchmark using same unsolved solution use when start normal planner run, constructed existing java code? trivial start benchmark if work somehow. i find partial solution in optaplanner benchmarking without xml inputsolutionfile . i able make work, coding implementation of solutionfileio , using static variable pass along unsolved solution has been created. this works in limited capacity. is there way set unsolved solution directly on plannerbenchmarkfactory or plannerbenchmark, don't have use static variable? yes, create text file, example input1.txt empty or contains 1 line identifier. implement solutionfileio public class machinereassignmentfileio implements solutionfileio<machinereassignment> { public static final string file_extension = "txt"; @overrid...

excel - Return on Textbox1 value based upon two criterias in combobox and label -

hope u're well. need expert after trying lot without sucess, please. i have price list in sheet1 3 columns: medical procedure type value of procedure in userform, need return in textbox1 value of procedure based on criteria selected in combobox1 (with values can found in medical procedure column in sheet1) , caption in label1 (wich alrealdy populated value can encounter in type column in sheet1). i tried found here in stackoverflow user b hart (thanks, b hart!), wasn't able change return in textbox numerical value (this vba insert found value in listbox instead). issue criteria below in 2 combobox. need 2 criterias in combobox , in label. private sub getcondstrandvalue() dim irow long dim strvalue string strvalue = vbnullstring if me.combobox1.value = vbnullstring or me.combobox2.value = vbnullstring exit sub planilha1 irow = 2 .range("a65536").end(xlup).row if strcomp(.cells(irow, 1).value, me.combobox1.value, 1) = 0 , _ strcomp...

Java - Creating a Grid of Buttons Using a 2d Array -

this question has answer here: how set action listener 3 buttons 3 answers as part of exercise, design program displays 9x9 grid of jbuttons. when click on button, button change in way, displays 'o', when click on it, displays 'x', or maybe changes colors, etc., while other buttons remain unchanged. however, not sure how this. have created 2d array of jbuttons, , placed each on in 9x9 gridlayout panel. set actionlistener each one. problem is, not know how change color or text of 1 button. here short version of program displaying relevant parts. private jbutton[][] t = new jbutton[9][9]; //declared earlier in program, right after class declaration. public void buildtile() { panelc.setlayout(new gridlayout(9, 9)); for(int r = 0; r < 9; r++) { for(int c = 0; c < 9; c++) { t[r][c] = new jbutton("o...

python - Django NodeNotFoundError during syncdb -

hi have developed project in local machine when have transferred production server, getting following error: python manage.py syncdb traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute_from_command_line utility.execute() file "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 346, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 394, in run_from_argv self.execute(*args, **cmd_options) file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 445, in execute output = self.handle(*args, **options) file "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 25, in handle...

C# Form is unresponsive when scanning for files -

i made program scans trough user selected folder, search mp3 files , wav files calculate total size of these files when doing program unresponsive labels not update or half , window can't dragged. how fix problem?? link download program : link link virus total : link edit : here code checks file size's : public string testfilesize(string dir) { if (mfile_option_subfolder_checkbox.checked == true) { double totalfilesize = 0; if (mfile_option_mp3_checkbox.checked == true) { string[] files = system.io.directory.getfiles(dir, "*.mp3", searchoption.alldirectories); foreach (string filename in files) { fileinfo fi = new fileinfo(filename); double filesize = fi.length; totalfilesize += filesize; } } if (mfile_option_wav_checkbox.checked == true) ...

bash - Passing glob results through to a function discarding all but first file -

i have following function f() { find . -name "$1"} handy shortcut finding file name. if execute find . -name "*.gradle" in terminal get: ./.gradle ./app/build.gradle ./build.gradle ./dependencies.gradle ./settings.gradle ./wearable/build.gradle if execute f *.gradle in terminal get: ./app/build.gradle ./build.gradle ./wearable/build.gradle the first result correct 1 , wanted one. why getting though 'wrong' result when using function though content same? did inject $1 parameter wrongly? f *.gradle expands glob, replacing *.gradle list of files in current directory, may run following: $ f one.gradle two.gradle # $1 $2 which runs: find . -name one.gradle ...passing first file ( $1 ), , ignoring others. if want pass glob through find: f '*.gradle'

javascript - Why does JS String differ from JSON String? -

i'm using this lib display emojis. i want data json, reason lib cannot convert string json. when create own string same data, e.g. '\ud83d\ude18' displays without problem. emojis.posts[0].content == '\ud83d\ude18' returned false so question is, difference between 'normal' string , json string? json {    "title": "l\\u2764 you\\ud83d\\ude18" } ... var emojis = json.parse(jsonstring); console.log(emojis.title); returns 'l\u2764 you\ud83d\ude18' creating json in js var emojis = json.parse('{"title": "l\\u2764 you\\ud83d\\ude18"}'); console.log(emojis.title); returns 'l❤ you😘' found answer: https://stackoverflow.com/a/7885499/6216557 this unicode, escaped string. first string escaped, encoded unicode

c# - How to write a method that prints out a list of days an entree will be served based on user input? -

i know may lots of down votes this, i'm little alright in c# , still have while go. id appreciate if me. application contained in class called dailymenu . class has these fields: public class dailymenu { private string day = ""; private int date = 0; public string entree { get; private set; } private double price; private double calories; static int initaldate = 1; static string[] daysofweek = { "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" }; static string[] entrees = {"beef tenderloin fresco", "madagascar filet mignon", "filet mignon", " lobster ravioli", "asian infused braised beef", "new age chicken cordon bleu", "short ribs", " beef wellington", "fajitas", "bacon cheeseburger", " beef burgandy", "spagehetti...

javascript - How do I create radiating lines using Canvas? -

Image
i trying create gauge using canvas or svg. think going use canvas, unless people think lot easier make svg. question is, using canvas , no images, how go about, or, possible, create dashed lines around outside of gauge. thanks canvas choice if guage changing. canvas @ redrawing quickly. svg not quick @ redrawing, it’s if user interactivity required. this canvas function draw radiant lines between inner , outer circle: function radiantline(centerx,centery,innerradius,outerradius,degrees,linewidth,color){ var radians=degrees*math.pi/180; var innerx = centerx + innerradius * math.cos(radians); var innery = centery + innerradius * math.sin(radians); var outerx = centerx + outerradius * math.cos(radians); var outery = centery + outerradius * math.sin(radians); ctx.beginpath(); ctx.moveto(innerx,innery); ctx.lineto(outerx,outery); ctx.strokestyle=color; ctx.linewidth=linewidth; ctx.stroke(); } your gauge has values 0...

html - How to avoid displaying "&quot;" instead of quote marks? -

i have pc running windows 7. surfing web, see plenty of normal quotation marks (", ') around. occasionally, i'll see written out html entity this: &quot; . see on well-designed, big budget websites designers should know they're doing, ign or cnn. i'm curious why i'm seeing this, , if there's wrong browser or computer. real question this: there way prevent special characters appearing html entities when other people, older systems, view my website? generally speaking, kind of code cause problem arise, , how can prevented? probably web developer literally typed &quot; , html editor made &amp;quot; . may check page source.

c++ - how to know if a binary contains debugging symbols or not without file, objdump or gdb? -

i need know whether binary has debugging symbols in or not. production system , doesnt have commands file or objdump or gdb . can provide more info when needed. os: debian the easy solution, if don't know if binary has symbols or not , there no tools on actual machine have binary on, use scp (secure remote copy) copy file machine has tools. as other comment says, using strings command, prints finds "looks string" (a long enough sequence of "printable" characters), it's not quite reliable, never know debug symbols like, , can false positives code containing symbols macros etc.

Create Distinct ID by Group in Excel without sorting -

i have excel column cannot sorted , need create unique id group, similar below: +--------+------+ | name | id | +--------+------+ | jim | 1 | | sarah | 1 | | tim | 1 | | jim | 2 | | rachel | 1 | | sarah | 2 | | jim | 3 | | sarah | 3 | | rachel | 2 | | tim | 2 | +--------+------+ you can simple countif() , getting little creative cell references: =countif($a$1:$a1, a2) + 1 put in b2 (assuming list headers starts in a1 ) , copy down. countif() here counting number of times name in adjacent cell has appears in of cells above it. copy down, range grow include cells between a1 , next row up.

javascript - Don't submit unless all data is entered -

i have function registration page if data required isn't entered user alerts user fill in. form still submits information though not sure i'm doing wrong. want not submit until data submitted , correct. function checkdetails() { if (document.form1.txtname.value == "") {alert("please fiill in forename."); } if (document.form1.txtsurname.value == "") {alert("please fill in surname."); } if (document.form1.txtusername == "") {alert("please create username."); } if (document.form1.dobday.selectedindex == 0) {alert("please select day born."); } if (document.form1.dobmonth.selectedindex == 0) { alert("please select month born"); } if (document.form1.dobyear.selectedindex == 0) {alert("please fill in year born."); } if (document.form1.txtemail.value == "") {alert("please enter e-mail address....

php - convert std object class to comma seperated string -

i have std class object twitter , take ids array values , put them in php variable $ids $ids = (15761916,30144785,382747195,19399719) . i imagine using loop , using phps implode i'm not sure how go it. stdclass object ( [ids] => array ( [0] => 15761916 [1] => 30144785 [2] => 382747195 [3] => 19399719 ) [next_cursor] => 0 [next_cursor_str] => 0 [previous_cursor] => 0 [previous_cursor_str] => 0 ) $ids = "(" . implode(",", $object->ids) . ")";

javascript - PDFObject: How to reload container with a different copy of the same file? -

i have button generates pdf, reloads pdf in browser replacing container it's in itself, different link. reason, new pdf doesn't show up, old 1 there still no matter how many times refreshed. i'm not using iframe or object/embed method, i'm using http://pdfobject.com/ my html pdfobject container: <div id="pdfcontainer"> <div id="pdfsample"></div> </div> my javascript initiate src upon window load: <script type="text/javascript"> $(function () { pdfobject.embed("myinitialpdf.pdf", "#pdfsample"); }) </script> my ajax call pdf-creation/container-refresh: $('#genpdf').click(function () { $.ajax({ url: "mergepdf.php", data: str, cache: false, success: function (result) { $("#pdfobject").attr("src", "newpdf.pdf"); var container = document.getelementby...

java - Spring Hibernate JSP - Foreign key is null when trying to save a record -

i have 2 tables - food , lvl. on every lvl can stored lot of food. lvl class @sequencegenerator(name = "lvl_seq", sequencename = "lvl_seq") @entity @table(name = "lvl") public class lvl { @id @generatedvalue(generator = "lvl_seq") @column(name = "lvl_id") private int lvl_id; @column(name = "dimension") private string dimension; @column(name = "title") private string title; @onetomany(cascade = cascadetype.all, fetch = fetchtype.lazy, mappedby = "lvl_id") private list<food> foodlist; //getset public int getlvl_id() { return lvl_id; } public void setlvl_id(int lvl_id) { this.lvl_id = lvl_id; } public string getdimension() { return dimension; } public void setdimension(string dimension) { this.dimension = dimension; } public string gettitle() { return title; } public void settitle(string title) { this.title = title; } public ...

c++ - bool and sizeof conditional template -

i'm testing struct i'm trying use template conditions, i'm having strange compiler errors. here code: #include <type_traits> #include <string> template<typename t1, typename t2, bool same_size = (sizeof(t1)==sizeof(t2))> struct same_size { typedef typename std::false_type value; }; template<typename t1, typename t2> struct same_size<t1, t2, true> { typedef typename std::true_type value; }; int main() { if(same_size<char,unsigned char>::value) { printf("yes"); } system("pause"); } i'm compiling in visual studio 2015. these compiler errors get: 1> main.cpp 1>c:\users\luis\documents\visual studio 2015\projects\stringtype\stringtype\main.cpp(18): error c2059: syntax error: ')' 1>c:\users\luis\documents\visual studio 2015\projects\stringtype\stringtype\main.cpp(19): error c2143: syntax error: missing ';' before '{' can shed light going o...

How to delete the largest node in Binary search Tree -

i trying delete largest node in binary search tree, thougth these code below should able reason not. please! public void remove() { node current = root; while(true){ node parent = current; current = current.getrighchild(); if (current == null){ parent.setrighchild(null); return; } } } public void remove() { root = deletemax(root); } private node deletemax(node x ) { if (x.getrighchild() == null) { return x.getleftchild(); } x.setrighchild(deletemax(x.getrighchild())); return x; }

html - Javascript: Using forms vs NOT using forms for data submission -

nowadays doesn't seem matter whether use forms or not submitting data. personally, seem end getting values necessary inputs, manually, using javascript, upon submission of form (or button intended trigger function grabs input data off page). are there major differences between using forms submit data directly on grabbing needed elements off page , using ajax send data? edit: appreciate explanations if you're going downvote. haven't seen question asked before on stackoverflow plus standards change pretty nowadays , new developers might wonder point of using form on manually grabbing inputs. using forms recommended due following: forms provide backwards compatibility devices don't @ css or use javascript. with forms can use tools parsley.js grab wbole form, validate , send off part of ajax without bothering validating every single field in script. other developers expect see form because that's how html meant be, omitting one, introduce unusua...

linux - Probing running python process for information -

i've created python (and c, "controlling" part python) program carrying out bayesian inversion using markov chain monte carlo methods. unfortunately, mcmc can take several days run. part of research in reducing time, can reduce much. i'm running on headless centos 7 machine using nohup since maintaining connection , receiving prints several days not practical. however, able check in on program see how many iterations it's done, how many proposals have been accepted, whether it's out of burn-in, etc. is there can use interact python process info? i recommend saws (scientific application web server). creates thread in process handle http request. variables of interest returned client in json format . for variables managed python runtime, write them (json) file on harddisk (or shared memory) , use simplehttpserver serve it. saws web interface on client side can still used long follow json format of saws.

PHP variable declaration shorthand (similar to JavaScript) -

in javascript, can this: var somevar = { propertytwo : false, propertythree : "hello!" } var test = somevar.propertyone || somevar.propertytwo || somevar.propertythree alert(test); //displays "hello!" is there similar functionality in php this? haven't been able find online. i tried this, php treats comparison , echo's 1 ( true ) $somevar = array( 'propertytwo' => false, 'propertythree' => "hello!" ); $test = $somevar['propertyone'] || $somevar['propertytwo'] || $somevar['propertythree']; echo $test; //displays '1' not big deal if there isn't, figured of bells , whistles provided in php 5.x, there kind of shorthand assigning first true value in list of values single variable that. i suppose write function. edit : as suspected, php doesn't have same quirk. quick function wrote function assign_list($list){ foreach($list $v) if(isset($v) ...

gpgpu - How to use theano within screen session? -

i use theano on remote server first ssh (i don't have root on system). works fine, however, if start screen , error when trying import theano. behavior when not using screen : >>> import theano using gpu device 0: geforce gtx titan x (cnmem disabled, cudnn 4007) behavior when using screen : >>> import theano error (theano.sandbox.cuda): failed compile cuda_ndarray.cu: libcublas.so.7.5: cannot open shared object file: no such file or directory traceback (most recent call last): file "<stdin>", line 1, in <module> file "/home/2012/enewel3/.local/lib/python2.7/site-packages/theano/__init__.py", line 103, in <module> import theano.sandbox.cuda file "/home/2012/enewel3/.local/lib/python2.7/site-packages/theano/sandbox/cuda/__init__.py", line 697, in <module> use(device=config.device, force=config.force_device, test_driver=false) file "/home/2012/enewel3/.local/lib/python2.7/site-pac...

I am writing GPS location data to an SD card in an Arduino project. It fails -

so writing gps data (latitude , longitude) sd card in arduino project. want write header kml file (which storing gps data). have 2 datafile.println commands (as shown below). can comment out 1 of lines , other line correctly written sd card. if have both lines datafile false (i assuming null?) , neither line below write sd card. doing wrong? file datafile = sd.open(gps_file, file_write); if (datafile) { if (total == 0) { //write header datafile.println("<\?xml version=\"1.0\" encoding=\"utf-8\"\?>"); //this line (by itself) write correctly datafile.println("<kml xmlns=\"http://www.opengis.net/kml/2.2\">"); //this line (by itself) write correctly } you can see project code @ link: my project code try this: file datafile = sd.open("log.txt", file_write); if (datafile) { datafile.println(str); datafile.close(); serial.println(str); } i dont see close fi...

shell - How to add a new line to a file and match the indentation from prev line -

i have: globalweather: name: 'globalweather:1.0.0' i tried: sed -i '' "s/^\( *\)name: '$api_name'$/&\n\1\$ref: $1/" $2 but i'm getting: globalweather: name: 'globalweather:1.0.0'n $ref: globalweather_1.0.0.yaml i want: globalweather: $ref: globalweather_1.0.0.yaml can me on i'm missing? you can capture indention , use substitution insert it: sed 's/^\( *\)something$/&\n\1something else/' breakdown: s/ ^ # start of string \( *\) # capture 0 or more spaces $ # end of string / & # full matched string \1 # captured spaces else / but there might more elegant solution a fter command.

javascript - data-bind click event does not work on chrome for svg under div -

i working knockout.js , code - <div data-bind = "event:{click: clickhandler}"> <svg ...> <polygon ... > </polygon> </svg> </div> clicking on svg not work on chrome, have click outside svg on div, work on chroms. reason, click event isn't fired in chrome, works fine in ie 11 , edge browsers. any ideas appreciated. the problem div containing above div, needed pointer-events : none property <div style ="pointer-events: none"> <div data-bind = "event:{click: clickhandler}"> <svg ...> <polygon ... > </polygon> </svg> </div> <div>

redactor.js - Redactor - got to custom URL on submit -

i have page multiple forms, hidden based on link active. 1 of these forms using redactor , want send user page redactor form open on submit. default page refreshes on submit , shows default form page. couldn't find in docs. if knows how accomplish please let me know. thanks to solve need use window.location.hash can send hash variable url when click on link form. the urlhash works follows: var urlhashval = window.location.hash.substr(1); //get hash value , store var $('form').hide(); //hide forms default $('form#' + urlhashval).show(); //show form id matches hash value what enable send link someone, http://ucanstayatthe.ym.ca#myform , open page form#myform on display. now have enable urlhash work within page well. on page show/hide forms based on links. need write formid url link. add fromid href eg. "#myform". when click link display #myform @ end of windowurl. this solves of problems because when page refreshes on redactor submi...

jquery - Ajax post request doesn't work in wp theme directory -

this example of ajax post request. work when placed outside of wordpress active theme directory. when there , norefresh.php uploaded there doesn't work no matter exact patch norefresh.php use (site/themefolder/norefresh.php or server patch or local patch norefresh.php or /norefresh.php). doesn't work @ all. is there wordpress prevents execution.what should do? $.ajax({ type: "post", url: "norefresh.php", data: reqdata, cache: false, success: function(html) { //document.getelementbyid('mytextarea').value = html; alert(html); } }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> you can allow access using htaccess specific file, pain clients / if move sites etc? better hook function either plugin or theme. don't need worry relative uris. (some minor differences in js other virtually same) add_action( 'wp_ajax_custom_hook', 'custom_f...

python - Why can I perform an HTTP get request to the same flask app once but not two or more times? -

the following python snippet simple flask app debugging on , 2 workers. takes sequence of ports routes , performs http request using urllib2 first port given in path, , passes along rest of ports argument. for instance if application serving on port 4000, then curl localhost:4000/4001 will issue http request localhost:4001 path / for whatever reason, can 1 hop if have multiple flasks running. port=4000 python flasky.py port=4001 python flasky.py port=4002 python flasky.py if curl localhost:4000/ , hi . if curl localhost:4000/4000 or curl localhost:4000/4001 , fine well. however, can't have 3 "hops" or i'll urlerror: <urlopen error [errno 111] connection refused> , if ports involved different. curl localhost:4000/4001/4002 fails, instance from flask import flask import os import urllib2 import validators app = flask(__name__) def make_url(host, port, path): "make , validate url, hardcoded http protocol" assert isinstanc...