Posts

autohotkey - (AHK) Creating variable hotkeys that gets the key names from a 2 char file name of a script -

i'm trying make our employees use dont have alter script define hotkeys. may work hotkeys can defined single character, that's fine, there many combinations can made them, , can easy remember. script @ 2 character ahk files (or 6 if must include extension) in working directory. , variables search defined regex first hotkey, ^. , second .(?=.) once match found, launch matched file. has been done before? seems simple can't seem find on it. edit: elliot brought attention: http://autohotkey.com/board/topic/60630-easy-editmanage-hotkeyshotstrings-plugin-ahk-l/ it's neat script manager, , useful, it's not i'm looking for. i dont not want additional interface. want able change hotkeys using filename. based on answer of forvin . added execution of corresponding ahk script. #persistent settimer, findnewhotkeys, 2000 findnewhotkeys: loop, %a_scriptdir%\* { regexmatch(a_loopfilename, "^(.)(.).ahk$", hk) if (hk) ...

c# - How to merge two datarow cells into one? -

Image
i trying merge 2 datarow cells one. here initializing code: datatable dt = new datatable(); datacolumn dc; datarow dr; dc = new datacolumn(); dc.datatype = system.type.gettype("system.string"); dc.columnname = "col1"; dt.columns.add(dc); dc = new datacolumn(); dc.datatype = system.type.gettype("system.string"); dc.columnname = "col2"; dt.columns.add(dc); dc = new datacolumn(); dc.datatype = system.type.gettype("system.string"); dc.columnname = "col3"; dt.columns.add(dc); dc = new datacolumn(); dc.datatype = system.type.gettype("system.string"); dc.columnname = "col4"; dt.columns.add(dc); dc = new datacolumn(); dc.datatype = system.type.gettype("system.string"); dc.columnname = "col5"; dt.columns.add(dc); this code have each column in excel: dr = dt.newrow(); dr["col1"] = ""; dr["col2"] = "quarter 1"; dr["col3"] = "...

python - Save log files in the user home directory -

i have logging.conf [1] file configure logging in python application. ... [handler_file_log_handler] class=logging.handlers.timedrotatingfilehandler level=info formatter=simple args=('/var/log/myapp/myapp.log',) as can see, i'm storing log file in /var/log/myapp directory. what store in user (the user manages application) home directory (/home/myuser/.myapp/log). so, question is: what should configure in logging.conf in order able save log file of python application in user home directory? [1] - https://docs.python.org/2.6/library/logging.html#configuring-logging the user's home directory can found (on os) using: os.path.expanduser("~")

javascript - Angular Select Dropdown with an option to let the user add a custom option -

i have html select dropdown in form asks user pick question out of pre-selected security questions. (such "what's favorite city", "what's color of car" etc.) how can add option list such "write own" , when user selects it, new input box shown user write his/her own question. one strategy can think of create input element ng-show hide/show based on value of select. there better way it? your best bet write custom directive simulate select box (likely using styled radio buttons), add option in there input. i've done similar several projects , thought isn't particularly difficult, there lot consider (including accessibility , keyboard controls). or can find 1 of many open-source directives online. while might not you're looking ui-select might option.

python - How to get utf-8 from forms in Bottle? -

i trying use bottle.py input information users in web page. everything works fine except when have latin characters (accents mostly). have try using utf-8 , latin-1 coding on first 2 lines of code, won't work. #!/usr/bin/env python # -*- coding: utf-8 -*- import bottle @bottle.post('/newpost') def post_newpost(): subject = bottle.request.forms.get("subject") body = bottle.request.forms.get("body") tags = bottle.request.forms.get("tags") and html code page is: <html> <head> <meta charset="utf-8" /> <title>new posts</title> </head> <body> <form action="/newpost" method="post"> <h2>post title</h2> <input type="text" name="subject" size="120" value="{{subject}}" ><br> <h2>post<h2> <textarea name="body" cols="120" rows="20">{{body}}</...

multithreading - python socketserver: how to shutdown server with open client connection? -

i have been looking time solution terminate socketserver.streamrequesthandler spawned separate thread class threadingmixin when main tread terminates. problem socketserver thread, although being daemonic, not terminate long there open client connection, when calling shutdown() method @ program shutdown. therefore, main tread did not terminate. none of suggestions in how stop basehttpserver.serve_forever() in basehttprequesthandler subclass? or similar posts worked me. i have found solution: class threadingmixin has property daemonic_threads, default true: class threadingmixin: """mix-in class handle each request in new thread.""" # decides how threads act upon termination of # main process daemon_threads = false in subclass, which, of course, overrides method handle(), defines override in init daemon_threads = true now client requests daemonic , when main thread terminates, terminate. nice ! helps similar problem.

hadoop - ERROR 2245: Cannot get schema from loadFunc org.apache.hive.hcatalog.pig.HCatLoader -

i try load files partitioned hive table. lkr_bu = load 'basename.tablename' using org.apache.hive.hcatalog.pig.hcatloader(); after running following error: 2016-07-04 15:01:58,743 [uber-subtaskrunner] error org.apache.pig.tools.grunt.grunt - error 2245: cannot schema loadfunc org.apache.hive.hcatalog.pig.hcatloader for information, have required libraries , hcatalog {loader, storer} works oozie launcher. someone encountered kind of problem ? there many steps need follow make hcatalog work in pig. overall, assume have configured paths (hcatalog) , have included required jars in classpath. if not, please follow post :- http://www.thecloudavenue.com/2013/11/installingandconfiguringhcatalogandintegratingwithpig.html#comment-form or, can follow below post :- https://acadgild.com/blog/loading-and-storing-hive-data-into-pig/ after have followed steps above, need start following services :- hiveserver2 --> hive --service hiveserver2 hive metas...