Posts

c# - Get untitled notepad contents -

i looking solution in c# or in language following: 1) let have opened notepad , have write inside. file unsaved. 2) via program create save "foo.txt" notepad file , close it. in c# can process name or id can have process. how make process save , close? or maybe @ least data of notepad , can save via systemio. problem how process data of process , in particular example notepad text (remember text unsaved no way recover path). thanks lot. or maybe @ least data of notepad as others have said, it's not best approach far... ...but sure, can that. here's example retrieves contents of open notepad instances , spits them out in console: public partial class form1 : form { public form1() { initializecomponent(); } private const int wm_gettext = 0xd; private const int wm_gettextlength = 0xe; [system.runtime.interopservices.dllimport("user32.dll", setlasterror = true)] public static extern intptr f...

apache - Pageres does not work with php exec -

i installed npm module on digitalocean droplet https://github.com/sindresorhus/pageres it works right if access terminal directly. but, if access them php via exec() , loads, , loads, , loads...and mysql server shutting down (or apache?) , need sudo restart . then tried this: exec('pageres http://google.com 2>&1', $output, $returncode); $output = implode(php_eol, $output); echo $output . ' ' . $returncode; and loads long time, become message generated 82 screenshots 1 url , 82 resolutions . loads correct 82 images in projekt, have not entered other parameter pageres (for other resolutions). i have same problem on local xampp. if run whoami on website exec(), become www-data , if run on terminal, become safeuser . important? // edit: tried laravel 4 ssh , whoami returns safeuser , not work

java - Check if SVN checkout with SVNANT was successful or failed -

i not able use similar resultproperty="checkout.res" while checkout svnant, can used in "exec". below snippet of ant build file. <target name="svncheckout"> <svn username="${svn.username}" password="${svn.password}" failonerror="true" resultproperty="checkout.res" > <checkout url="${svn.base.url}/myproject" revision="head" destpath="../../../../stubswds" /> </svn> </target> getting error below : buildfile: /home/workspace/checkout/src/main/resources/buildandcheckout.xml svncheckout: build failed /home/workspace/checkout/src/main/resources/buildandcheckout.xml:113: svn doesn't support "resultproperty" attribute total time: 1 second you can use status task in svnant assign property name appropriate type. in case, going on scant information, i'd imagine line might be: <status path="foo" ...

html - Strange behavior of media query in CSS. Inheriting attribute values from other statement -

let's have @media , (min-width: 360px) { #navigation { background-color: #dddddd; display: block; position: fixed; top: 0px; } } @media , (min-width: 760px) { #navigation { background-color: #111111; display: none; position: fixed; bottom: 0px; } } this kind of css code (assume have div id="navigation" tag in body tag.). but if run code , change size of browser see difference, won't change size changes. css attributes in first media query statement applied style, except display attribute. how make other attributes behave supposed be? edit: here's codepen project: http://codepen.io/thatkoreanguy/pen/mjwpbw ok going assume main problem here when going 360px width div not sitting @ top of view port stuck @ bottom? when have media query still inherits previous styles if want negate have return them there default value bottom auto believe.

delimiter - SAS: Extract ID's separated by dashes from text string -

i have dataset has 1 concatenated text field. trying break 3 text columns in sas 9.4. obs var1 1 may12-kansas-abcd6194-xy7199-brule 2 jan32-ohio-bz5752-gary my output observation 1 should this: obs date state id 1 may12 kansas abcd6194-xy7199-brule here's have, works date , state. however, can't third part (id) ignore delimiter: data have; input var1 &$64.; cards; may12-kansas-abcd6194-xy7199-brule jan32-ohio-bz5752-gary ; run; data need; length id $16; set have; date = scan(var1,1,'-','o'); state = scan(var1,2,'-','o'); id = scan(var1,3,'-',''); run; another different approach multi-delimiter-containing word use call scan . tell position (and length, ignore) of nth word (and can forwards or backwards, gives ability search in middle of string). implemented particular case it's simple: data want; set have; length date $5 state $20 id $50 ; ...

python - Adding colorbar to a 3 variable colour graph -

Image
from post got how create graph, struggling add scale bar. printing item colors gives [ 0.53800422 0.67490159 0.99172189 1.] i'm guessing scaled color? my_array = range(20) my_array2 = my_array z = np.array(my_array) x = np.asarray(my_array) scaled_x = (x - x.min()) / x.ptp() scaled_z = (z - z.min()) / z.ptp() colors = plt.cm.coolwarm(scaled_z) graph = plt.scatter(my_array, my_array2, c = colors, cmap = colors ) cb = plt.colorbar(graph) cb.set_label('mean value') plt.show() i think you've gotten mixed on cmap argument supposed be. it's either colormap object (e.g. plt.cm.coolwarm ) or name of colormap (e.g. "coolwarm" ). you're trying pass in explicit colors. (the [ 0.53800422 0.67490159 0.99172189 1.] red, green, blue, , alpha values colormap yield 1 of specific data points.) instead of calculating explicit colors, pass in colormap object directly. for example, given example code above, re-write as: import numpy np...

JQuery select function not showing div -

i have jquery function (with of stackoverflow post) hides/shows divs depending on selected on select/dropdown. works fine. when edit record stored value of select field displayed in select/dropdown corresponding div remains hidden until change made on select field. code <script> $(document).ready(function () { $('.jshideshow').hide(); $('#id_selection_basis').change(function () { $('.jshideshow').hide(); $('#'+$(this).val()).show(); }) }); </script> i have tried various combinations of above code show div straight away on update view value have far been unsuccessful. any appreciated! please post corresponding html, i'm having trouble understanding exact issue broke down code doing might able figure out there. <script> $(document).ready(function () { $('.jshideshow').hide(); // 1 $('#id_selection_basis').change(func...