Posts

Showing posts from February, 2015

ruby on rails - using eval to convert string into hash -

i have string this a="{\"company\"=>\"khkhkh\", \"email\"=>\"hjkh@hkkj.kjh\",\"address\"=>\"yiyiyu\", \"date\"=>mon, 28 apr 2014 13:14:10 bst +01:00}" but have made mistake when generating string. is, appended date without converting string. if try hash using eval(a) . throws error, acceptable. syntaxerror: (eval):1: syntax error, unexpected tconstant, expecting => .... is there way hash back, since iam in situation cant regenerate string. any highly appreciable. thanks. for immediate predicament: a.gsub(/\"date\"\s*=>(.*?)(\}|,\s*\")/, '"date"=>"\1"\2') this should work if date not last entry of hash. for next time around: really not idea serialize data manually turning them code eval later. in cases best bet generate json , parse later. using proper json serializer/generator make sure data syntactically corre

How to show the outputs folder in Android Studio? -

Image
is there way show outputs folder in android studio? following folder structure in windows explorer: the following corresponding part in android studio: i particularly interested in mapping folder under outputs because use frequently. want open files in folder within android studio.

php - Default configuration of SRIORestUploadBundle coupled with KnpGaufretteBundle doesn't work -

i'd use symfony2 bundle sriorestuploadbundle handle upload of file through api after setting basic configuration, still following error: servicenotfoundexception in checkexceptiononinvalidreferencebehaviorpass.php line 58: service "srio_rest_upload.storage.default" has dependency on non-existent service "gaufrette.uploads_filesyste". it typo, missing "m" after gaufrette.uploads_filesyste

c++ - Cmake:build YASM source files -

i using cmake 3.4.1 generate , build visual studio 2013 64bit c++ solution.one of project contains .asm files compile in visualstudio yasm assembler lib.how configure cmake use yasm files?i haven't found documentation example of how set up. have following example: cmake_minimum_required(version 3.0) project(yasmcmake) find_program(yasm_exe names yasm) add_custom_command(output hello.o command ${yasm_exe} args -f elf64 -o hello.o ${cmake_current_source_dir}/hello.asm) set(cmake_include_current_dir on) add_library(hello hello.o) set_target_properties(hello properties linker_language cxx) of course need specify flags yasm depending on platform.

bash - Sourcing a bashfile before running a command -

suppose have following file demo.env : export value="abcd" how can make works mafile rule? bash -c "source demo.env; echo $${value}" apparently 1 way is: bash -c "source demo.env; echo \${value}" and in makefile rule: echo: bash -c "source demo.env; echo \$${value}"

How to generate xml and format it from object in c#? -

here trying format xml list , not getting proper format. here code: protected void generatexml(string url, list<string> listitems) //generatexml { xnamespace nsxhtml = "http://www.w3.org/1999/xhtml"; xnamespace nssitemap = "http://www.sitemaps.org/schemas/sitemap/0.9"; xnamespace nsimage = "http://www.google.com/schemas/sitemap-image/1.1"; var sitemap = new xdocument(new xdeclaration("1.0", "utf-8", "")); var urlset = new xelement( nssitemap + "urlset", new xattribute("xmlns", nssitemap), new xattribute(xnamespace.xmlns + "image", nsxhtml), urlnode in listitems select new xelement( nssitemap + "url", new xelement(nssitemap + "loc", url), new xelement(nssitemap + "image", n

service worker - How to measure the number of people disabling push notifications from my progressive web app? -

i'm using new web push api service workers in progressive web app worried users disabling push notification permission after enabling it. what best way detect users disabling notification permission (i.e. add instrumentation/analytics) can track this? i believe you're looking covered in permissions api , includes change event. event fired both initial user decision , again if user later changes mind. at basic, do: if ('permissions' in navigator) { navigator.permissions.query({name:'notifications'}).then(function(notificationperm) { // notificationperm.state 1 of 'granted', 'denied', or 'prompt'. // @ point can compare notificationperm.state // cached value, , listen changes while page open via // onchange handler. notificationperm.onchange = function() { // permissions have changed while page open. // based on current notificationperm.state value. }; }); } there few resources

Printing pdf files using java -

i want print document using java however, program successful printer not printing anything. why that? solutions this? if printer not pdf supported, there way print pdf file or docx files? package useprintingserviceinjava; import java.io.bufferedinputstream; import java.io.fileinputstream; import java.io.inputstream; import javax.print.doc; import javax.print.docflavor; import javax.print.docprintjob; import javax.print.printservice; import javax.print.printservicelookup; import javax.print.simpledoc; import javax.print.event.printjobadapter; import javax.print.event.printjobevent; public class useprintingserviceinjava { private static boolean jobrunning = true; public static void main(string[] args) throws exception { inputstream is; = new bufferedinputstream(new fileinputstream("paper_sensor.pdf")); docflavor flavor = docflavor.input_stream.pdf; printservice service = printservicelookup.lookupdefaultprintservice(); docprintjob printjob = serv

Selenium Web Driver (Java) . How to click waypoint inside the map which is canvas in html5 page -

Image
selenium web driver (java). how click waypoint inside map canvas in html5 page currently, facing challenging problem drag , drop on map canvas in html5 page. the source code of waypoint on map below: <div id-"tool-tip" class="tool-tip-target" sytle="left 25.2597px;top:-13.085.px"> how can locate web element on canvas map , click since later need drop destination on 1 of waypoint on map. the selenium web driver using 2.48.2 , programming language java. here solution try neither of them works. driver.findelement(by.cssselector("div#tool-tip.tool-tip-target")).click(); webelement = driver.findelement(by.cssselector("div[id='tool-tip'][class='tool-tip-target'][style='left:292.769px; top: 72.815px;']")) as of knowledge can't directly identify elements designed under canvas in dom. hence can't provide locator of element perform click action. the 1 way of automating scenar

c# - Check whether key/value pair exists in hashtable collection -

i have hastable hashtable hash = new hashtable(); hash.add("a", "1"); hash.add("b","2"); hash.add("c","3"); hash.add("c","4" now need check key = "c" , value= "3" combination exits in hashtable or not. hash.containskey value function cheks weather key exists or not , containsvalue function checks weather value exists or not. if tried if( hash.contains("c") && hash.containsvalue("3")) { // code heree } than return true both "c,3" , "c,4" combinathion. i need check key/value pair combination how can check ? if(hash.containskey("c") && hash["c"] == "3") { }

Show notification only on phone (not on Android Wear) -

is there way prevent notification shown on android wear device? know it's possible using setongoing(true) don't want notification ongoing. you should call setlocalonly(true) on notificationcompat.builder . from documentation set whether or not notification should not bridge other devices. you can read more here

PHP upload text file encoding check and manipulation -

i have standard file upload user supposed upload text file. "text file" not egual "text file". same file can have different encodings: utf8, utf7, utf16, utf32, ascii, , ansi to more clear noticed encodings not able show characters, encoding can show. tree questions: witch encoding 1 "the compete", can convert encoding without loosing content check if file text file , not binary check if content of text file base64 encoded or not? if uploaded encoding not "the compete" , change encoding "on fly" "the compete" encoding (see question 1) i not want troll here sending whole code, lets admit have form , action="upload.php", comes part need check above. $target_dir = "uploads/"; $target_file = $target_dir . basename($_files["filetoupload"]["name"]); [...] // ist check after upload if(isset($_post["submit"])) { // check 1 : encoding has been uploaded ? //

hook - Custom Page in cPanel -

it possible add coustom page cpanle ? example: cpanel url : https://127.0.0.1:2083 // cpanel default login page , wanna create custom page like: https://127.0.0.1:2083/mycustompage or if not how can hook default login page ? yes, can create custom cpanel login page have edit cpanel theme. please check following cpanel documentation. https://documentation.cpanel.net/display/ckb/how+to+create+custom-branded+login+pages

Java expected null, throws exception -

i've been trying find solution problem 2 hours, haven't found useful. i have method gets issuedata mantisapi use later in code. catches exceptions thrown: try { issuedata issue = mantisapi.getissue(issueid, user); task = preparemantistask(issue); } catch (exception e) { system.out.println(e.getmessage()); } return task; the problem when issuedata expect null because might empty field. when returns, exception caught in try/catch block. tried ignore using following code: public string getprojectnotnull(mantistask mantistask) { if (mantistask == null){ return null; } try{ string project = mantisapicache.getproject(mantistask.getproject()).getname(); return project; } catch(nullpointerexception npe){ log.info("taskservice.getprojectnotnull() throws controled null"); return "-"; } but looks stupid when have 20 or more records check. there other way ignore nulls? thank time.

Using VBScript to control an MMC object -

alright, so, i'm working on script execute commands in mmc snapin, , i'm not experienced doing kind of scripting, i've made lot of progress...the problem having, if create new object every time script runs, massively delay overall script while snapin , in loads(which can take long 5 minutes). if load snapin content once , take control of needed, , create new object if there's not 1 open already, i'll save massive amount of time when run script 100 times in day. the problem is, i'm not entirely how achieve this. thought, after research, getobject, when dim objmmc set objmmc = getobject("", "mmc20.application") it seems create new mmc window no snapins loaded, rather existing 1 snapins loaded want. any advice? totally off base here, using wrong command, or there simple change can make fix this? edit: there weird workaround way achieve this, storing object temporary file can @ least reuse through single session. i'm in weird

objective c - EXC_BAD_ACCESS in NSWindowController -

ok, situation bit complicated nature of issue should pretty simple more familiar me me cocoa memory management. a few details : - main app, i'm loading "loadable" bundle (which consists of nswindowcontroller ) - both projects (the main app , "plugin") arc-enabled in plugin code, have custom initialization method : - (id)initwithapi:(id)api { pluginwindowcontroller* newpluginwindowcontroller = [super initwithwindownibname:@"pluginwindow"]; if (newpluginwindowcontroller) { [newpluginwindowcontroller setapi:api]; } return newpluginwindowcontroller; } this how api declared : @property (unsafe_unretained) id api; now, here's catch : i'm initializing using initwithapi: , api being set. when i'm testing api 's value in - (void)windowdidload: still shows fine. however : when trying same thing within method (actually ibaction triggered button click in plugin's window)... trying [self ap

RethinkDB listen for changes on filter query? -

i'm not sure if understand changefeeds correct... need filter data based on current date this: r.table("messages") .filter( r.row("start").lt(r.now().toiso8601()) .and(r.row("end").gt(r.now().toiso8601())) ) .changes() .run(conn, (err, cursor) => { if (err) { throw err; } cursor.each(function (err, row) { if (err) { throw err; } // stuff here }); }); }); is possible this? or .changes() work if field of row updated? it's possible , syntax right. however, note in case miss it. r.now() evaluated first time ever run query, not current time when changes happens. r.now() calculated 1 time in same query , return value re-use on sub sequent calls: https://www.rethinkdb.com/api/javascript/now/ changefeeds works both of insert , updating. if insert/updated document match condition of filter , return in cursor. if it's insert, old_val null , if it's updat

Can I assign scripts to inserted images within cells or hyperlinks in Google Sheets? -

i'm curious if there's way “assign script” image inserted cell using =image(“url”) method google sheets? if not, there way “assign script” hyperlink? what i’d create table of contents tab inside google sheet has many other tabs. on table of contents, i’d love have inserted images act buttons navigate these different tabs. can “assign script” images have been inserted through menu toolbar (e.g., insert > image or insert > drawing). however, it’s extremely clunky have realign images if new row inserted table of contents. i use hyperlinks navigate each tab, don’t how opens new window every time click on hyperlink. , don’t how requires 2 clicks of hyperlink (one click hyperlink, , click web address pops up) arrive @ desired tab. so guess, there option exists insert image inside cell, can assigned script? this functionality helpful. thanks time! i've been searching , haven't found way insert link image placed =image () option. i've resorted t

java - How to create a POJO with list? -

this structure want create pojo using list only. { "firstobj": { "1": 1684.63, "2": 1684.63, "3": 1684.63, "4": 1684.63, "5": 1684.63 }, "secondobj": { "1": 5695.64, "2": 1684.63, "3": 1684.63, "4": 1684.63, "5": 1684.63 }, "thirdobj": { "1": 1684.63, "2": 1684.63, "3": 1684.63, "4": 1684.63, "5": 1684.63, "6": 1684.63, "7": 1684.63, "8": 1684.63, "9": 1684.63, "10": 1684.63 }, "fourthobj": { "1": 1684.63, "2": 1684.63, "3": 1684.63, "4": 1684.63, "5": 1684.63, &q

c++ - Next higher number with one zero bit -

today i've run problem, couldn't solve after period of time. need help i have number n. problem find next higher number ( > n ) 1 0 bit in binary. example: number 1 can represented in binary 1. next higher number 1 0 bit 2 - binary 10 a few other examples: n = 2 (10) , next higher number 1 0 bit 5 (101) n = 5 (101) , next higher number 6 (110) n = 7 (111) , next higher number 11 (1011) list of 200 number: 1 1 2 10 - 1 3 11 4 100 5 101 - 1 6 110 - 1 7 111 8 1000 9 1001 10 1010 11 1011 - 1 12 1100 13 1101 - 1 14 1110 - 1 15 1111 16 10000 17 10001 18 10010 19 10011 20 10100 21 10101 22 10110 23 10111 - 1 24 11000 25 11001 26 11010 27 11011 - 1 28 11100 29 11101 - 1 30 11110 - 1 31 11111 32 100000 33 100001 34 100010 35 100011 36 100100 37 100101 38 100110 39 100111 40 101000 41 101001 42 101010 43 101011 44 101100 45 101101 46 101110 47 101111 - 1 48 110000 49 110001 50 110010 51 110011 52 110100 53 110101 54 110110 55 110111 - 1 56 111000 57 111001 58 111010 5

asp.net core mvc - Dependencies in MVC 6 application of multilayered solution -

i developing solution includes data layer, business layer , ui layer (mvc 6 application). mvc application works interfaces of business layer. doesn't know services (implementation of business layer) , data layer. has reference project contains business layer interfaces. i have issue connected dependencies. according opinion, must add dependencies (including repositories , services) startup.cs file, mvc 6 application mustn't have references repositories or services. how can add dependencies without adding references? the mvc6 application must reference service , repository implementations, either directly or indirectly. thing should not construct instances of these implementations controller components. so in other words, okay in startup.cs: public void configureservices(iservicecollection services) { services.addinstance<iserviceorrepo, serviceorrepoimpl>(); } it not okay in controller: private readonly iserviceorrepo _serviceorrepo; pu

Android 'make' error: error: too few arguments to function 'belle_sip_multipart_body_handler_new' -

when executing sudo make on android project (linphone) experiencing error stating: jni/..//submodules/linphone/build/android/../../coreapi/chat.c: in function 'linphone_chat_message_process_response_from_post_file': jni/..//submodules/linphone/build/android/../../coreapi/chat.c:269:4: error: few arguments function 'belle_sip_multipart_body_handler_new' bh=belle_sip_multipart_body_handler_new(linphone_chat_message_file_transfer_on_progress, msg, first_part_bh); in file included jni/..//submodules/linphone/build/android/../../coreapi/../../belle-sip/include/belle-sip/belle-sip.h:44:0, jni/..//submodules/linphone/build/android/../../coreapi/../include/sal/sal.h:35, jni/..//submodules/linphone/build/android/../../coreapi/private.h:35, jni/..//submodules/linphone/build/android/../../coreapi/chat.c:26: make[1]: *** [obj/local/armeabi-v7a/objs/linphone/chat.o] error 1 make: *** [generate-libs] error 2 anyon

javascript - AJAX Bootstrap Modal Not Showing -

i'm trying show following modal, body database driven. data isnt appearing in bootstrap modal. i've been looking @ far long , cant see issue! modal <div class="modal fade" id="eventdetailsmodal" tabindex="-1" role="dialog" aria-labelledby="membermodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">close</span></button> <h4 class="modal-title" id="membermodallabel">event details</h4> </div> <div class="dash"> </div> </div> <

visual studio - Making .NET References Configuration dependant -

i have several configurations app make debug/release builds , 32 bit , 64 bit builds. 32 , 64 bit builds need reference different dlls (namely build x86 , build x64) references seem global project , don't depend on configuration. have exchange references when switch 32 bit 64 bit build (and vice versa). appropriate way achieve different references different configurations? this can done little bit of manual manipulation of project files. first need right click on project, , click unload project . right click on again , select edit [project name] . when loaded in editor see various entries refences: <itemgroup> <reference include="system.xml" /> <reference include="windowsbase"> <requiredtargetframework>3.0</requiredtargetframework> </reference> <reference include="presentationcore"> <requiredtargetframework>3.0</requiredtargetframework> </ref

c++ - wxWidgets drawing Panel -

i'm doing application wxwidgets , need draw few images on different panels. in application there 1 main frame, contains panel, contains buttons , text box. want create drawing panels on panel. create simple test class based on wxwidgets examples draw stuff. #include "minibitmap.h" minibitmap::minibitmap(wxpanel *parent, int x, int y, int width, int height, char *bits) : wxpanel(parent, x, y, width, height) { img = wxbitmap(100,100, wxbitmap_screen_depth); } minibitmap::minibitmap(wxpanel *parent, wxwindowid id, const wxpoint& pos, const wxsize& size) : wxpanel(parent, id, pos, size) { } void minibitmap::paintevent(wxpaintevent & evt) { // depending on system may need @ double-buffered dcs wxpaintdc dc(this); render(dc); } void minibitmap::paintnow() { // depending on system may need @ double-buffered dcs wxclientdc dc(this); render(dc); } void minibitmap::render(wxdc& dc) { // dc.drawbitmap( img, 0, 0,

java - Spring Boot Embedded Tomcat Thread Pool Creation Overhead -

Image
i wondering if has information on performance overhead of adding more threads tomcat thread pool? we have been seeing issues app of ours , points issue tomcat adding more threads thread pool.is true? adding more threads thread pool cause slowdown in response time? we running java rest api using spring boot , embedded tomcat. if our problems indeed caused tomcat adding more threads pool, there way set minimum in spring? according thread minsparethreads not exist anymore. https://github.com/spring-projects/spring-boot/issues/3753 if there isn't way increase number of minimum threads spring embedded tomcat, other tools use thread pools? edit: have attached thread profile. profile not of time in question later. we able add both edges of configuration: wilkinsona commented apr 19, 2016 -> maxthreads has been configurable. minsparethreads can configured (see 34eb369) add configuration option maxsparethreads - (old bug, fixed)

emacs24 - Repository creation in emacs git -

how can create repository in emacs git, there emacs command? just installed git.el in site-lisp directory can't find info anywhere. already managed use ready git repository, couldn't create 1 within emacs. thanks! how can create repository in emacs git, there emacs command? it doesn't git.el supports this. it focused around git-status command , prompts root directory , complains when give 1 isn't initialized. however, emacs' built-in vc mode vc-create-repo command: create empty repository in current directory. make sure (require 'vc) somewhere, cd target directory (or visit file in it), m-x vc-create-repo ret . vc mode supports many version control backends, when prompted, type git (tab-completion available here). finally, there excellent git mode called magit supports creating repositories. if given directory isn't repository, magit-status command ask if want create one. magit available via melpa .

javascript - Can I use the HTTP range header to load partial files "on purpose"? -

i'm playing around http range header ( specs ). from understand can set byte ranges of files ala 0-199/2000 200-499/2000 500-799/2000 etc question: want access ranges of file, possible specify these ranges , work "incomplete" data received? i'm playing around filtering large log file, i'm curious if work. thanks inputs! you right link posted in comment best approche. question sounded interesting tried out. did it, here snippet(for other may come looking) var xmlhttp=new xmlhttprequest(); xmlhttp.open("get","data.dat",false); xmlhttp.setrequestheader("range", "bytes=100-200"); xmlhttp.send(); console.info(xmlhttp); //--> returns partial content // tested on win7 chrome 46+

java - android app crahses and data still gets entered into the databases -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i in process of developing registration app using android studios, once users try register application says error in registration , logcat not give error, when debugging app, still no errors. please can , tell me going wrong code correct working couple of months ago, since have returned holiday says "error occurred in registration". user data gets entered database not allow user move onto next activity says "error occurred in registration". please can or advise? logcat 01-07 15:14:42.933 2161-4203/com.oakland e/json parser: error parsing data org.json.jsonexception: value 2016-01-07 of type java.lang.string cannot converted jsonobject 01-07 15:14:42.938 2161-2161/com.oakland e/androidruntime: fatal exception: main

javascript - Angular-locker Safari Private Browsing -

we're using third party wrapper around local/session storage called angular-locker . we need able support safari private browsing in our project if storage isn't supported, browser throws js exception , our angular app doesn't initialize. i've noticed use of remy's polyfill plug , play script? how supposed use in project? currently fallback $cookies using locker.issupported() don't understand point of function if can't call or check it? solved problem similar gist . the solution override of decorator functions using $cachefactory , if driver not able intialized. switched using $cachefactory $cookies instead.

c# - ASP.NET vNext site fails to run under IIS -

Image
i have reasonably standard website i've build under asp.net 5 rc1-update1. deploy iis (tried both 8 , 7.5) , attempting hit never gets past waiting localhost stage. turned on logging setting stdoutlogenabled="true" in httpplatform element of web.config file , saw following error: error: unable load application or execute command 'microsoft.aspnet.hosting'. available commands: web, ef. system.io.filenotfoundexception: system cannot find file specified. (exception hresult: 0x80070002) @ system.reflection.runtimeassembly.nloadfile(string path, evidence evidence) @ system.reflection.assembly.loadfile(string path) @ microsoft.dnx.runtime.loader.loadcontext.loadfile(string assemblypath) @ microsoft.dnx.runtime.loader.packageassemblyloader.load(assemblyname assemblyname, iassemblyloadcontext loadcontext) @ microsoft.dnx.runtime.loader.packageassemblyloader.load(assemblyname assemblyname) @ microsoft.dnx.host.loadercontainer.load(assemblyname

javascript - Why is this sidebar data not going to ajax and why is slider value showing ui not defined? -

i have sidebar contains input. want data ajax. logging these inputs. however, not getting anything. here did: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $("#find_match").click(function() { alert("clicked"); }); </script> <aside> <br><br> select gender <select name="gender" id="gender"> <option value="">select</option> <option value="male">male</option> <option value="female">female</option> </select> <hr> educational qualification : <select class="form-control" name="eduqualification" id="eduqualification" class="required"> <option value="">select</option> <op

xml - xsd:dateTime with specific precision -

an xsd work has element like: <xsd:element name="tdlordertimestamp" type="xsd:datetime" minoccurs="0"/> but i'm being told system requires 3 decimal points of precision on seconds. allowed xsd:datetime , not required it. we requiring: <tdlordertimestamp>2015-05-12t18:58:02+00:00</tdlordertimestamp> we should requiring: <tdlordertimestamp>2015-05-12t18:58:02.123+00:00</tdlordertimestamp> what's simplest way specify requirement in xsd? ideally, i'd stick close xsd:datetime , iso8601's other idioms , idiosyncrasies possible. a simple solution defining new simple type extends xsd:datetime , adds pattern restriction indicating value must contain dot followed 3 digits. example: <xsd:simpletype name="datetimewithprecision"> <xsd:restriction base="xsd:datetime"> <xsd:pattern value=".*\.\d{3}.*"/> </xsd:restriction> <

android - Add new list into listView -

there has listview , add button in activity a . listview data retrieved mysql . [![ http://i.stack.imgur.com/wvmsk.png][1]][1] when list clicked, pass data activity b , if add button clicked, go activity b user add data. use mclickedposition differentiate whether list clicked or button clicked. activity a listview listviewupdate; listadapter adapter; button add; string id, id; public static final int project_request_code = 1; public static final int camera_request_code = 2; int mclickedposition; string receiveproject, receivedescription, receivetimein, receivetimeout; integer receiveprogress; arraylist<detailsbean> results = new arraylist<detailsbean>(); string myjson; jsonarray details = null; arraylist<hashmap<string, string>> editdetails; listviewupdate.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(ad

optimization - Can I expect this value to be cached by a JavaScript engine? -

inside function have lines var deal_date = new date(deal.created), cur_date = new date(), num_days_passed = math.floor((cur_date - deal_date) / (1000*60*60*24)); and i'm wondering whether, since it's in function, value of computation 1000*60*60*24 cached javascript engine. because otherwise have rid of magic number defining constant window.seconds_per_day = 1000*60*60*24; and on time gets laborious create code, when 1000*60*60*24 in fact more descriptive reading code (unless they're idiot).

c++ - Unable to associate an ncurses form with a window -

i trying associate ncurses form window. here complete code of trial: #include <form.h> #include <vector> #include <string> int main() { initscr(); cbreak(); noecho(); keypad(stdscr, true); form *myform; std::vector<field *> fields; fields.push_back(new_field(1, 10, 0, 0, 0, 0)); set_field_back(fields[0], a_underline); fields.push_back(nullptr); myform = new_form(fields.data()); window *mypad = newpad(5, 20); set_form_win(myform, mypad); // no effect? post_form(myform); prefresh(mypad, 0, 0, 10, 10, 20, 20); // no effect... getch(); unpost_form(myform); free_form(myform); free_field(fields[0]); endwin(); return 0; } as comments indicate, calling set_form_win not seem have effect. form displayed in top left corner regardless of arguments supply prefresh . similar code worked menus fine, not work form. missing? as additional detail, form gets magically displayed wi

windows - Access Shell32.dll string table from a command line -

i'm making simple win32 batch perform tasks. 1 of them add "open prompt here" in every directory. reading around learned can use shell32.dll string table use string regedit, example batch test. echo adding <need string here> folders reg add hkcr\directory\shell\open.msdos /ve /f /d "@%systemroot%\system32\shell32.dll,-22022" reg add hkcr\directory\shell\open.msdos\command /ve /f /d "cmd.exe /k \"pushd \"%%1\"\"" my question is: how can extract string shell32.dll user can see output (spanish): adding símbolo del sistema folders

ruby on rails - how to leave the field filled with fields_for? -

i have problem : when customer enters shipping , billing informations in form, fields of address model lose information if page reloaded. works other fields, email, included directly in order model. how leave fields filled after reloading ? here's new.html.erb file : <%= form_for @order |f| %> <ul> <% @order.errors.each_with_index |msg, i| %> <li><%= msg[1] %></li> <% end %> </ul> <%= f.text_field :email, placeholder: "email" %> <%= f.fields_for :shipping_address_attributes |sa| %> <%= sa.text_field :first_name, placeholder: "firstname" %> <%= sa.text_field :last_name, placeholder: "name", autocomplete: true %> <%= sa.text_field :address1, placeholder: "address", autocomplete: true %> #etc. <% end %> <p><%= f.submit 'next step' %></p> <% end %> my models : class order < activerecord::b

angularjs - How can I run the unit tests for ngCordova? -

i’ve contributed ngcordova ​ , create pull request. how can run existing tests? if can run i’ll update mocks & tests plugin changes too. i’ve tried gulp karma , gulp karma-watch these throw, uncaught referenceerror: angular not defined . cloned copy of ng-cordova, not integrated project. answer george stocker: git clone https://github.com/driftyco/ng-cordova.git cd ng-cordova npm install bower install (this missing piece me) gulp karma thanks george!

Why is OpenGL designed in a way that the actual functions have to be loaded manually at runtime? -

i had read through loading opengl functions , wondered why opengl designed way, instead of easy way , providing dynamic library , according headers? providing dynamic library , according headers? then have misunderstanding of how "dynamic library" works. let's take windows example. on windows, if had "a dynamic library , according headers", still unable load dll , use it. use of __declspec(dllimport) declarations in header insufficient . need 1 more thing: import library. .lib job of loading function pointers when load dll. in short, it's syntactic sugar: nice have, not essential. lot opengl loading library. on linux, things bit different. files more self contained; store equivalent of import library within them. there, in theory "a dynamic library , according headers". even so, it's still sugar; can dynamically load them , fetch function pointers manually if wish. all of sugar theoretically used opengl. let'