So I'm new to using mechanize, and I'm trying to write a program in python 2.7 to log me into my campus wifi.
So I've written some code using mechanize that should log me in. The names of each field are accurate, as is the form name. However, whenever i run the program, nothing seems to happen. it doesn't submit the data, and the program stays running, so i have to force close it.
am i missing anything? i've been hunting over the web, and what i'm doing seems to be okay.
mechbrowse=mechanize.Browser()
mechbrowse.open(login_page)
mechbrowse.select_form(name='frmHTTPClientLogin')
mechbrowse.form['username'] = login_username
mechbrowse.form['password'] = login_password
mechbrowse.submit(name='btnSubmit')
do i need to write anything so that all this gets executed?
Related
Novice to Codemirror.
I have codemirror running on my server I have it set to Python mode. Can someone please suggest how I go about executing the code and showing the result on the page where I have written the python code
Thanks
Without knowing much about your setup, here's a general idea:
Use the getValue() method to get the code from your CodeMirror instance.
Assuming the code is a run-able Python script, you can either
(1) send the code to your back end with AJAX or a POST request and run it there. Or (2) you could run the Python script in the browser with a library like one discussed here.
If you ran it on the back end, you can send the result of running the code back as text or JSON with your preferred protocol. If you ran it on the browser, you should probably follow the guidelines for the specific library you used.
My question has to do with the libasound function named "snd_pcm_hw_params" in connection with code to play a sound file. I am new to ALSA programming. Using a coding example I found on the internet, I wrote a small program to play a 7 second .wav file to the default sound card. When I run this code several times in a row, occasionally (but not always) the requisite call to snd_pcm_hw_params to write the previously filled in snd_hw_params_t struct to the driver, I get back an error code of -2 (ENOENT). I have no idea what this means, nor how to handle nor prevent it. My code just emits an error message and bails. Usually, if I run it again, the code runs fine. Its fine for my use, but eventually, this code is supposed to be given to a non-programmer to use, and I'd like to either prevent the error, or resolve it internally without involving said non-programming user. I note hear that the user is supposed to be able to cause an early abort of the program by clicking a button, and when this happens, my code calls snd_pcm_drop, followed by snd_pcm_close. If the program runs to completion, and plays all 7 seconds of the wav file, then it finishes up by calling snd_pcm_drain, followed by snd_pcm_close. Any help or suggestions would be greatly appreciated. :)
In my Scala application, I am trying to tell my KSQL Server that it should execute the RUN SCRIPT <script> command, using the KsqlRestClient.makeKsqlRequest(String ksql) function. Every time I tried it, nothing happened, even though the response was successful, so I started debugging, where I saw that the response was a success but it also returned some kind of error that the property ksql.schema.file.content was empty.
Since I did not find any documentation as to what to fill this property with, I tried some things and eventually found out that if you fill this property with the contents of your .sql file, the run script command works.
Does anybody know if and with what ksql.schema.file.content should normally be filled and/or if the way I am using it is how your supposed to execute a script in KSQL from a Scala application. I already copy and pasted the text from the makeKsqlRequest into the KSQL CLI and everything worked fine, so there should be no error with that.
There is a Github issue tracking the fact that the RESTful API is not documented / supported yet, (as of March 2018).
It sounds like this is something you may want to add a +1 too.
I am trying to create a very simple (text based for now) email app for receiving emails. So far i have used this code :
http://www.javaer.org/j2ee/3-javamail/8-javamail-connecting-gmail-using-pop3-with-ssl
The problem is that i when i run this code i am able to get the new emails, only for once. For example if i have a new message in inbox the first time i will this code it will show it but then it wont. Also it seems that i cant see the body contents of the emails which is strange. I was told that it should be better to use imap protocol but i am not entirely sure how.
Specified example really starts once and scans folder and exits (and see answer on POP that removes mail). From description you need some loop that periodically checks catalog and extracts new mails. Look at some swing examples in your JDK how to write window-based program with event loop. You can start dedicated thread that once per minute checks POP server catalog
I have an AIR application that takes command-line arguments via onInvoke. All is good, but I cannot figure out how to print some status messages back to the user (to stdout / console, so to speak). Is it possible?
Even a default log file for traces would be fine, but I can't find any info about it anywhere. Do I need to create my own log file? Now that'd be silly.
Take a look at CommandProxy. It is a low level wrapper around your AIR application that lets you send command from AS3 back to the proxy for communicating with the underlying OS. You should be able to add a means of writing to the command line via such a method.
I don't think that is possible, but I'm not completely sure though.
There is a flashlog.txt file which you can configure so all trace() statements are logged to it. Check this post http://www.digitalflipbook.com/archives/2005/07/trace_from_the.php for more info on how to set it up. This is for logging from the browser, but I'm pretty sure it should also work from an air app.
Additionally, you could use SOS MAX from Powerflasher to log to an external console through an XML socket.
By default, trace() will output to stdout.
Your AIR application is one, big trace window if you want it to be.