Posts

How to filter only printable characters in a file on Bash (linux) or Python? -

i want make file including non-printable characters include printable characters. think problem related acscii control action , not find solution , not understand meaning of .[16d (ascii control action character??) in following file. hexdump of input file: 00000000: 4845 4c4c 4f20 5448 4953 2049 5320 5448 hello th 00000010: 4520 5445 5354 1b5b 3136 4420 2020 2020 e test.[16d 00000020: 2020 2020 2020 2020 2020 201b 5b31 3644 .[16d 00000030: 2020 when cat ed file on bash , got: "hello ". think because default cat interprets ascii control action, 2 .[16d s. why 2 .[16d strings make cat file print "hello"?, and... how can make file include printable characters, i.e., "hello "? the hexdump shows dot in .[16d escape character, \x1b . esc[ n d ansi escape code delete n characters. esc[16d tells terminal delete 16 characters, explains cat output. there various ways remove ansi escape codes file, either using bash comm...

php - Magento Soap api product custom option list not getting all options -

Image
i have installed mageworks advanced custom option extension in magento. i trying fetch product custom option using soap api v2 i able following details title sku sort_order price and required following details description qty i using following snippet $proxy = new soapclient('http://magentohost/api/v2_soap/?wsdl'); $sessionid = $proxy->login('apiuser', 'apikey'); $result = $proxy->catalogproductcustomoptionlist($sessionid, '1'); var_dump($result); try $result = $proxy->catalogproductcustomoptioninfo($sessionid, '1');

python - How can I upload whole folder instead of one by one file in rackspace -

right using threading slow. looking upload folder api. def run(self): """starts uploading thread.""" try: file_name in self.files["thumbs"]: self.transfer_rackspace(file_name, self.container_thumbs) except exception: pass try: file_name in self.files["tiles"]: self.transfer_rackspace(file_name, self.container_tiles) except exception: pass try: file_name in self.files["cube"]: self.transfer_rackspace(file_name, self.container_photo) except exception: pass try: file_name in self.files["image"]: self.transfer_rackspace(file_name, self.container_photo) except exception: pass pyrax.settings.set('identity_type', 'rackspace') pyrax.set_credentials(config.app_config[...

Python dictionary key is not identified -

i have method following, @staticmethod def get_repo(tenant_id): """ :param int tenant_id: :return: gitrepository object :rtype: gitrepository """ agentgithandler.log.info(agentgithandler.__git_repositories) agentgithandler.log.info("tenant id %s" %tenant_id) key,value in agentgithandler.__git_repositories.iteritems(): if tenant_id == key: agentgithandler.log.info("key matching") agentgithandler.log.info(agentgithandler.__git_repositories[key]) agentgithandler.log.info("key %s : value %s ", key,value) if tenant_id in agentgithandler.__git_repositories: return agentgithandler.__git_repositories[tenant_id] agentgithandler.log.info("false condition") return none i trying call above function following, git_repo = agentgithandler.get_repo(tenant_id) git_repo.scheduled_update_task.terminate() tena...

javascript - Get id attribute from a node in nodelist -

i have got nodelist using document.getelementsbyclassname method in javascript. check if first node has children , if not return document.getelementbyid nodes id. unsure of how id node list. var columns = document.getelementsbyclassname('.col-md-4.column'); if (countchildren(columns[0].childnodes) == 0) { return document.getelementbyid(columns[0].) //not sure goes here } if have dom node, has id property, can't use getelementbyid property var columns = document.queryselectorall('.col-md-4.column'); if ( countchildren(columns[0].childnodes) == 0 ) { return columns[0].id; } note getelementsbyclassname takes classes without period, better support might use queryselectorall

c# - Reusing same session from asp.net aspx page to ashx handler -

i trying call ashx handler asp.net page , retrieve xml data handler. var url = "http://localhost/settings/myhandler.ashx?errors=false"; var request = (httpwebrequest)webrequest.create(url); request.method = "get"; using (var response = (httpwebresponse)request.getresponse()) { using (var stm = response.getresponsestream()) { using (var sr = new streamreader(stm)) { var data= sr.readtoend(); } } } now, due nature of asp.net creating new session each webrequest, not able reuse same session asp.net page ashx handler. both files same project. how can reuse same session asp.net ashx handler.? please note: have marked handler implement irequiresessionstate, has session. issue aspx page , ashx handler have 2 different sessions.. everytime when invoke handler creates new session. instead have reuse same session of...

linux - Java BeautyEye look and feel empty JMenuBar items -

Image
i using beautyeye , feel in java desktop program found out jmenubar shows empy jmenuitems shown in screenshot below. as can see area of menu there same colour jframe contentpane , no menu text visible. a sample program test (download beautyeye library here ) is: import java.awt.*; import javax.swing.*; import org.jb2011.lnf.beautyeye.beautyeyelnfhelper; public class javamenubarexample implements runnable { private jframe frame; private jmenubar menubar; private jmenu filemenu; private jmenuitem openmenuitem; public static void main(string[] args) { try { beautyeyelnfhelper.frameborderstyle = beautyeyelnfhelper.frameborderstyle.oslookandfeeldecorated; org.jb2011.lnf.beautyeye.beautyeyelnfhelper.launchbeautyeyelnf(); uimanager.put("rootpane.setupbuttonvisible", boolean.false); } catch (exception ex) { ex.printstacktrace(); } // proper way show jframe (invo...