Gilles Quenot

3

votes
1

answer
7.6k

views

lxml error “IOError: Error reading file” when parsing facebook mobile in a python scraper script

I use a modified script from Logging into facebook with python post : #!/usr/bin/python2 -u # -*- coding: utf8 -*- facebook_email = '[email protected]' facebook_passwd = 'YOUR_PASSWORD' import cookielib, urllib2, urllib, time, sys from lxml import etree jar = cookielib.CookieJar() cookie = urllib...
Gilles Quenot
7

votes
1

answer
5.6k

views

How to add a key/value to a dict in an ansible playbook, conditional

Let's say I want to add InterestingVar dict key and the associated value when the variable test_var exists (passed with -e in command line), how can I do that ? # ansible-playbook ./add_to_dict_on_condition.yml -i 127.0.0.1, -e env=test -e test_var=123 - hosts: localhost gather_facts: no vars: - tag...
Gilles Quenot
2

votes
1

answer
5.2k

views

reverse engineer eclipse-PDT-php->UML [duplicate]

Possible Duplicate: PHP UML Generator Hi, I wonder if it's even possible to reverse engineering some PHP (PDT) code back to an UML class diagram ?
Gilles Quenot
6

votes
1

answer
3.8k

views

How to run a POST request programmatically in python with a GUI ? (spynner, webkit…)

I have a web site with flash forms that I need to scrape. Instead of filling the flash forms, I would like to POST some keys/values to the URL that doesn't support GET requests. I use spynner to interact with the site, and spynner can have a GUI, but my search on google, stackoverflow, spynner githu...
Gilles Quenot
2

votes
2

answer
2.1k

views

How to pass argument to a script in vim system() call?

I would like to pass current filename % as argument of the shell script in system() call : let rev=system('~/script %') How can I do that for real ?
Gilles Quenot
3

votes
1

answer
1.2k

views

How to run PyQt4 with flash web page?

I use this very simple python script Problem loading a specific website through Qt Webkit to display a web page. It works well, but it doesn't detect my installed libflashplayer.so on linux x86_64 (that displays http://www.adobe.com/go/getflash/ URL) . What can I do to be able to run flash web pages...
Gilles Quenot
1

votes
1

answer
1.2k

views

How to safely store passwords with greasemonkey?

I wrote a Greasemonkey script, it prompts users to store login and password to avoid the need of re-enter it again and again. I know localStorage.setItem(); to store a key and a value, but the password will be stored as clear text. So, what is the best practice to store a password? Is there any API...
Gilles Quenot
2

votes
1

answer
852

views

Dancer : how to share data and waiting response between 2 POST without blocking

I have a rest server written in perl dancer on a VM, this is the workflow : customers POST some json stuff in /post_wait route : the POST should waiting the business processing to return the result the request is processed by another VMs (communication is processed by POE + IKC) the report should be...
Gilles Quenot
1

votes
1

answer
840

views

Is it possible to simulate pressing 'Down' arrow?

I try to figure out how to send Down in puppeteer, I tried with the int code 40 or Down string, but none works. Is there a proper way ? Can't figure it out after reading ~/node_modules/puppeteer/lib/Input.js const elementHandle = await page.$('selector'); await elementHandle.type('something'); await...
Gilles Quenot
1

votes
2

answer
824

views

Can i enable USB tethering with SL4A?

I have had searched in API reference for a class/method to enable USB tethering, but found none. I wonder if it's still possible. For information, I use a rooted HTC Wildfire with Cyanogenmod 7 and Android 2.3.7. If it's not possible, I'm interested for a Java sample code to do it.
Gilles Quenot
1

votes
2

answer
785

views

How to parse HTML using XPath with Saxon-HE in command line?

I use saxon HE 9.6, and it's great for playing with XPath 3 while you are parsing well formed XML files. But I would like to know how to combine expath-http-client (or any other working solution) with Saxon to have the power to parse realLife©®™ (possibly broken) HTML. (Java is not my better ski...
Gilles Quenot
1

votes
1

answer
581

views

Iterate over all Xpath results

I have this code: #!/usr/bin/groovy import javax.xml.xpath.* import javax.xml.parsers.DocumentBuilderFactory def testxml = ''' .. .. foo bar base ''' def processXml( String xml, String xpathQuery ) { def xpath = XPathFactory.newInstance().newXPath() def builder = DocumentBuilderFactory.newInstan...
Gilles Quenot
1

votes
1

answer
540

views

How can I put a webkit PyQt window as wallpaper on my desktop programmatically?

I try to put google calendar in a webkit window as wallpaper. The python working script looks like : #!/usr/bin/python2 -u # -*- coding: iso8859-15 -*- display_UI = True email = '[email protected]' passwd = 'xxxxxxxx' useragent = 'Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1'...
Gilles Quenot
3

votes
3

answer
427

views

Newline delimited output for Saxon-HE 9.6 from command line

Is there any way to get newline delimited output on multiple matching nodes for Saxon-HE 9.6 ? I use this wrapper named saxon-lint : #!/bin/bash java -cp /path/to/saxon9he.jar net.sf.saxon.Query -s:'$2' -qs:'$1' !method=text Example : file.xml hairballs Dilly Nameless Katie COMMAND LINE : $ saxon-li...
Gilles Quenot
2

votes
1

answer
353

views

Colorize git branch name depending of the state using 'vcs_info'

I'm new to zsh (I'm a long time bash user) I have a custom prompt (made with different sources mixed) with a specific part for git.: I would like to have: - (master) in green if git status says 'clean' - (master) in red if git status says 'not clean' I don't know how can I do it, I'll very appreciat...
Gilles Quenot
1

votes
1

answer
325

views

How to set default namespace with net.sf.saxon.Query in Saxon-HE 9.6 in command line?

As seen in the thread How to parse HTML using XPath with Saxon-HE in command line?, I try to query HTML with Saxon and XPath. What I tried so far from within my Linux shell : java -classpath './tagsoup-1.2.jar:./saxon9he.jar' \ net.sf.saxon.Query \ -x:org.ccil.cowan.tagsoup.Parser \ -s:https://stack...
Gilles Quenot
1

votes
1

answer
210

views

How to remove a casperjs event listener

I have a listener defined like this : function loadFailed() { casper.echo('load failed catched'); } casper.on('load.failed', loadFailed); ... some code casper.removeListener('load.failed', loadFailed); //redefine loadFailed function function loadFailed(e) { flagLoadFailed = true; } b.casper.on('loa...
Gilles Quenot
1

votes
2

answer
191

views

Is is possible to include a source file in nodejs+puppeteer to add functions?

I know await page.evaluateOnNewDocument(fs.readFileSync('./helperFunctions.js', 'utf8')); to add functions to evaluate() context, that is very handy. But is anyone can provide any example to have the same on the main context ? By example, said I want to add a page.existsText() or existsText() func...
Gilles Quenot
1

votes
2

answer
185

views

Segfault using nativeClickAt() method in spynner module

I'm not sure how to use nativeClickAt() method to click at an arbitrar location. In the spynner class, the doc said : '''Click on an arbitrar location of the browser. @param where: where to click (QPoint) @param real: if not true coordinates are relative to the window instead of the screen @timeout...
Gilles Quenot
2

votes
1

answer
110

views

How to debug an Opsworks/Chef 11.10.4 cookbook locally on Linux (Debian9) using Centos Vagrant guest (Amazon Linux like)

I searched for this for 3 weeks but didn't find any real answer. The main goal is to save time to test dev Chef cookbooks locally before deploying on production on AWS. All I found is some hints using Ubuntu with Vagrant : Chef - How to run a cookbook locally http://pixelcog.com/blog/2015/simplify-o...
Gilles Quenot
1

votes
1

answer
74

views

xpath conditional select, 'tr' having numbers of 'td' > 2

While this seems correct xpath (?), it doesn't match in firefox49/firebug nor chrome dev tools 53.0.2785.116 //table[@id='foobar']/tbody/tr[count('td') > 2] I try to select all tr having a count() of td > 2
Gilles Quenot
1

votes
1

answer
0

views

Can we fetch HTTP return code of previous call?

I search doc and the web, but can't find how to get the HTTP code of a query. Anyone knows ? Example : const puppeteer = require('puppeteer'); const fs = require('fs'); const debug = true; var base_url = 'https://stackoverflow.com/'; (async () => { const browser = await puppeteer.launch({ headless:...
Gilles Quenot
1

votes
1

answer
0

views

How to set the application name in spynner/PyQt4?

I have had searched the web to find the way to put a name in the top of a PyQt4 application border. I saw setCaption() method ( like in http://nullege.com/codes/search/PyQt4.QtGui.QDialog.setCaption ) but I don't know how to use it and if it's the good method ( I have had tested browser.setCaptio...
Gilles Quenot