It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Recently I was at a conference and one company had a software product which had a GUI written in HTML 5.It was rendered to the user via their custom built browser and looked quite good. I never heard of such concept and I am wondering if this is a common practice? I can see some benefits being able to produce flexible and stunning UI designs. Are there any tools available in Python? I assume you just need a browser able to render static pages with HTML and CSS. Also what would be the disadvantages of such approach?
This is the closest I found https://github.com/html5lib
If you're going to send it in HTML5, I see no reason to build a browser though, there are already many browsers, that have more people working on them, you'd be hard pressed to beat something like Firefox or Chrome, unless you have a specific feature you want, and then a plugin might be better. Generally building a custom browser like that is only useful if you either only want to do one very limited thing (like streaming a movie) or you want to use a different format (something like sending your version of HTML in an XML doc and parsing that and rendering it).
I also personally don't think Python is what you want to do this with, simply for a lack of compatibility with pretty much everything else at the current moment (not that you couldn't make things work, but it's not like you're going to download a Chrome plugin, change 3 lines of code and load it into your browser). I did see an example web browser in the wxPython docs, you could start there, I don't know what it does and what it doesn't do though unfortunately.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
In the world of penetration testing with Python, it looks like
one has to generally hook into an API that's OS specific. This makes sense
to me because we're dealing with different architectures and kernels between
OSX, Linux, Windows. But I'm wondering if this isn't the case?
Beyond some of the limited functionality you get out of the OS module, my assumption is that hooking into the OS's API is general going to be specific to *POSIX flavor (maybe they have more in common) than in Windows for example.
In particular I'm thinking of Deviare on Windows. It deals with .DLL files. That's pretty much Windows.
The moment we hear DLL, the mind goes to windows land, .plist OS X and so on.
Hooking is a way to get your own code to execute when another system is running, whether that other system is an OS, a GUI, or whatever. A somewhat silly example in Python:
def Process(records, per_record_hook=None):
"adds all records to XYZ system"
XYZ = []
for record in records:
if per_record_hook:
per_record_hook(record)
XYZ.append(record)
def print_record(record):
"print a '.' for each record (primitive counter)"
print '.'
and then later:
Process(records_from_somewhere, per_record_hook=print_record)
http://en.wikipedia.org/wiki/Hooking
I'm going to assume you're referring to this ^ kind of hooking? I'm completely unfamiliar with the term, but it seems like you're looking for a library that allows interactions with the operating system?
If so, try something like PyWin32 (google it) or follow some of the techniques found here:
http://www.rohitab.com/discuss/topic/37018-api-hooking-in-python/
Again, it'd be more helpful if you could put it (the phrase hooking) into more...Python-esque terms, but I hope this helps?
In Python things like this is generally so trivial that it's hard to even provide examples. Hooks are generally callbacks, yes. Callbacks in python are simply done by passing functions around and calling them.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
first, English is not my native language, so, forgive me for any mistake.
I don't want to make a evasive question, so i will detail my scenario and make my point below:
I need to make a Web interface to take a information from a html's form field. Specifically a text file. Then, i need to give this file as a paramater to a Python Script that will run on my Linux server (the same who was the Web interface). I have the script running okay, have the Web interface ready, but i didn't get the point to make the web stuff works.
I'm stuck on the part of "make the wweb form talks with python script".
I tried some linux commands and some tips found on my research, but didn't work.
The goal of this thing, is to not send the Python code to end-user. So, the clients will "use" the code from a web interface and will not see the Python code responsable for make the hole stuff works.
Does anyone ever seen this kind of implementation?? Any help or information will be nice ! Tks a lot !
You should probably start with this page from the Python documentation - http://docs.python.org/howto/webservers.html. This may give you some ideas about how this works, and depending on what you need you may then continue reading about more detailed topics. Solution will depend on your plans for further development (will you extend the logic of this application? will you connect to the DB, etc.), security concerns, etc.
For only the case you define, it sounds like some simple solution will work for you, like having a simple CGI script ( http://docs.python.org/library/cgi.html), and you probably don't (yet) need anything powerful like Django or TurboGears.
For CGI to work, you will need to configure Apache web server, enable CGI for it, and then implement the CGI script utilizing your already implemented program.
You may check on the web how to do each of those steps. For example, right here, on stackoverflow: How do you set up Python scripts to work in Apache 2.0?
In your CGI script, you will need to implement some logic which will allow users to upload files to your server. You may check this page for that: http://code.activestate.com/recipes/273844-minimal-http-upload-cgi/
Finally, if with time you plan to further develop your application, you may want to look to something like Django or TurboGears. The more complex your application is - the better it is to use some web framework. You will probably spend more time studying those, but in the end you get much more power with them, and you get the code which is much more easier to maintain compared to CGI scripts. But, just as I said - it depends on your needs. (Although studying them is a good idea anyway ;) )
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am aware that Google allows transliteration from English to several languages (www.google.com/transliterate).
I have an English word-list. I would like to transliterate (not translate) every word to Bengali (a language Google supports) - to obtain output in the form of a Unicode word-list.
Is there a way to use the transliteration API in Python to do this?
This is the getting started documentation: http://code.google.com/apis/language/transliterate/v1/getting_started.html#transliterateLowLevel
If you only need to use it one time, it's probably easiest to use the example code to perform your transliteration in a browser.
If you can figure out the actual requests to make (shouldn't be hard, you can observe them in your browser's developer tools), you can re-implement that using the requests module (just get it with pip).
Try the unidecode module
The Google Transliteration API is a javascript API meant to be used by web pages. There isn't anything about direct usage from programming languages or RESTful web services interface. This means that in order to use it from python, you would need to reverse engineer the calls made to the server (Not sure this is allowed though).
Another solution would be to use a Selenium web driver. You would need to install a browser and the Selenium web driver. Then, you would be able to control the browser from python (write text fields, read the results).
Also, there's https://github.com/davisp/python-spidermonkey found in Best way to integrate Python and JavaScript?. At least a place to start looking.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am creating a school management system that handles file uploads and downloads from teachers and students. Furthermore, there will be a large amount of database writes and reads (e.g. which classes a student is taking, what the student's grades are etc.)
I want dynamic web pages updated with python using an AJAX model on the front end.
On the back end I want to use python for file handling, database reads to show user their content, database writes when a user updates his/her content on the web app and memcache.
The stack I am using is...
CentOS + Hadoop + Hypertable + Python
I am currently going through the Pyramid docs and after going past a few chapters, I don't see how pyramid helps me accomplish what I can do in PHP, and if it does do this, why so complicated?
Is pyramid the right tool, or should I be using web2py?
If pyramid is the best tool, where can I see some sample code of a complex application built in pyramid. I tend to understand best when reading other's code.
Django cannot be used due to inflexibility
I don't see how pyramid helps me accomplish what I can do in PHP, and if it does do this, why so complicated?
A web framework like Pyramid is not a web framework like PHP. They're different.
Complexity is a matter of "experience". If you're experienced with PHP, Python seems complex. If your experienced with RoR, PHP seems complex. Everything that's new seems complex.
Python has a dozen or so web frameworks of varying capabilities. None of them will look like PHP. Zero. They'll all be different (and appear complex).
Consequently, if you don't like one. Move on. There are a lot of choices. Keep trying different ones.
Ask specific questions. "I don't see how pyramid helps me accomplish what I can do in PHP" is too vague to discuss further. If there's a specific thing you want to know about, search for that specific question (it's probably already been asked). If you don't find anything, ask the specific question. Code samples help.
I highly recommend you use Django.
https://www.djangoproject.com/
Django is a great way to do a project like this, and the documentation is outstanding. There is a free book, called The Django Book, which you can read online.
http://www.djangobook.com/
This book is a few years out of date. I haven't been keeping up with Django but I am pretty sure that the book will still be useful. Use the book to learn the concepts, and use the actual Django documentation to look up specifics.
I've had some great luck with Django, its pretty well documented and has examples that do exactly what you seem to do
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I noticed that many people here use TextMate for coding on OS X. I've recently started using it, and although I like its minimalistic interface, it makes it harder to stumble upon cool features if you don't know what you're looking for.
So, what feature have you found most helpful for coding (mainly in Python)? Are there any third-party bundles I should know about, besides what's included?
Don't neglect the 'mate' command line tool. You can use it to pipe output into TextMate, so if you do the following...
diff file1.py file2.py | mate
...it will not only open in TextMate, but it is smart enough to know that you're looking at a diff and highlight lines on screen.
TextMate's SVN integration is great; it also seems to have bundles for some other version control systems as well.
Add GetBundle to browse the bundle repository. I found the jQuery bundle through it and it's very handy.
As others have mentioned, rolling your own bundle for frequently used snippets is very helpful. If you have some snippets that are specific to a project or framework, you might want to prefix all of them with a common letter to keep the namespace tidy.
Holding down option while dragging allows you to highlight a block of text. If you type while the highlight is active, your keystrokes appear on multiple lines.
Being able to write simple commands in any scripting language and bind them to a context-specific hotkey.
The Navigation menu commands Go to File (Command + T) and Go to Symbol (Command + Shift + T) are both extremely helpful.
Go to File, which works when you have a project open, lets you type any part of the file name to see only files that match what you've typed.
Go to Symbol has the same type-to-filter interface, but operates on what I'd call the basic block elements of your document. For example, if you're editing a class, Go to Symbol works on the method names, but in a CSS document, you'll be searching on your selectors. It's pretty awesome.
I mention some in a review on Boagworld, I find the snippets, project manager, columnar editing (hold down option while selecting stuff or push it after having selected stuff) and CSS scopes for syntax.
I like the integrated HTML/XML Tidy. Cmd-shift-H is your friend.
Also, nice integration with a variety of scp/sftp clients.
My favourite two features are auto-completion (bound to ⎋ [esc]), and column editing (bound to ⌥ [alt]) both of these things save me quite a lot of time, and are definitely 'robot ninjas'.
The book linked above is also a really useful into to the power of TextMate, although it doesn't specifically mention python.
Don't forget "Drag commands".
They give you the ability to drag, say, an image into a blog.html document and will then upload it to the proper folder and insert the markup for you.
Here is another example of how you can expand further on drag commands if you pair TM up with QuickSilver.
(Disclaimer: I wrote the blog post I linked to there. I still think it's cool though.)
It is worth noting here that there is a Windows alternative to TextMate called E Text Editor. It does pretty much everything TextMate does (apart from macros, but the author is working on this, I think), and even - shock, horror - does some things better, such as the superb bundles editor, the bundles manager, and the branching undo history. Update: and now there's Snippet Pipes.
So, not exactly a useful feature of TextMate as such, but very useful to know if you're a fan of TextMate and you have to use Windows for whatever reason.
The ease of snippet creation.
It's trivial to create new snippets that can accomplish a lot using replacements, tabbing order, and regex substitutions. Quickly assigning these to the tab key for specific languages makes me more productive. And makes me worry about code bloat. :-)
For me the best features are:
Projects - I know every IDE under
the sun has this but TextMate makes
this useful for all sorts of editing
and text processing tasks, and
moreover makes navigating around
these projects easy without ever
lifting your hands from the
keyboard. This is huge for Rails or
Grails projects or large programming
projects with many modules.
The excellent syntax highlighting
and 'snippets' for myriad languages
and tools
The excellent scripting language
support (Being able to evaluate
chunks of Ruby and the like with a
single key chord)
The built in Blogging bundle is
superb. I now use TextMate
exclusively for all my blog posts.
Columnar editing
The ability to use just about any
language or tool to extend TextMate,
Ruby, Perl, shell, name your poison.
An excellent mix of great Aqua GUI
support and excellent command line
support through the
mate and
commands, for
instance making it easy and pleasant
to use TextMate as your default
editor for your SCM.
Using snippets to expand into large, repetitive blocks of code and then using the tab key to move through and only edit the pieces I need to without having to use the mouse or arrow keys.
It's nice and lightweight and has all of the macros built-in for Ruby and let's you run Ruby code, or any other code for that matter just with a keystroke.
Check out ProjectPlus, it gives some useful options for the sidebar, it has SCM status badges for svn and git (though I find the git thing a bit buggy).
I like the fact that it can change the sidebar to an embedded panel on left or right (as opposed to the drawer that's default).
If, like me, you're borderline OCD when it comes to making code look neat, then Option+Cmd+] to line up all the assignments around the current line is awesome!
The mate command line tool is great, you can open an individual file or my favourite use of it is to open a directory of files as a project (e.g. mate .)
Checkout Zen Coding bundle . It gives you an awesome productivity boost to developing both HTML and CSS.