AndresVargas
Hi!, my nickName is zodman, im a Computer science Engineering.
love the FLOSS and FreeSoftware. Python ninja and php coder.
On left my love Aisha and me.
Interest links
seen more
easygui a module for make easy dialogs with Tk
Reading the bucio blog at planetalinux talking about zenity that remember me the easygui module what think can be solve the same problems of zenity (or not alls ) without the gnome(gtk) deps.
python -m easygui
So with it you can make a small dirty tk gui's:
python -c "import easygui; easygui.boolbox('Are ok')"
python -c "import easygui; print easygui.ccbox('zodman continue')"
for Foresight users its packaged on fl:2-devel
sudo conary update easygui=@fl:2-devel
imageshack.us client with python powers
Im searching about the a cli what can i upload images to imageshack.us and not found on google....
So i write my own client.
#!/usr/bin/env python import urllib2 from poster.encode import multipart_encode from poster.streaminghttp import register_openers API_URL = 'http://www.imageshack.us/index.php' def yesno(x): if x: return 'yes' else: return 'no' def upload_file(filename, optsize=None, user_cookie=None, remove_bar=True, tags=None, public=True, ): register_openers() data = {'fileupload' :open(filename), 'xml':yesno(True) } datagen, headers = multipart_encode(data) # Some optional parameters if optsize: data['optsize'] = optsize if user_cookie: data['cookie'] = user_cookie if tags: data['tags'] = tags req = urllib2.Request(API_URL, datagen,headers) u = urllib2.urlopen(req) return u.read() if __name__ == "__main__": import sys print upload_file(sys.argv[1])
the result here:

This small app. needs module poster what make the encode multipart life easy. (on foresight its on fl:2-devel xD )
Yeah it need more hack .. hackimages github repo
Update a app with conary-lib
Yeah im add a method for a simple: conary update app<=repo@tag:label>
Reading the documentation and seen some code im understand some things....
- For conary update a package ( called installing a package) need to create a Job
- With this job its a empty for begining. You must attach some task like (Update)
- If job created the update must Apply for install it.
- for update a package needs be a ChangeSpec Format:
(troveName, (oldVersionSpec, oldFlavor), (newVersionSpec, newFlavor) - conary.conary.ConaryClient its the base of conary Structure on Conary API.
From command line:
[zodman@cosmogirl conary-lib]$ conary q iftop iftop was not found [zodman@cosmogirl conary-lib]$ sudo python conarypk.py Update Success of iftop=/zodyrepo.rpath.org@rpl:devel/0.17-3-1 [zodman@cosmogirl conary-lib]$ conary q iftop --labels iftop=zodyrepo.rpath.org@rpl:devel/0.17-3-1
the new method:
def update(self, name, installLabel= None): cli = self.cli #get a trove troves = self.request_query(name, installLabel) for trove in troves: trovespec = self.trove_to_spec( trove ) try: # create a Job job = cli.newUpdateJob() # Add Update task to Job cli.prepareUpdateJob(job, cmdline.parseChangeList(trovespec)) # Apply the Job cli.applyUpdateJob(job) # im rulz return "Update Success of %s" % trovespec except NoNewTrovesError: return "no new Troves Found by %s " % trovespec def trove_to_spec(self, trove ): return cmdline.toTroveSpec( trove[0], str(trove[1]), None)
Using conary-lib:
conary = ConaryPk() print conary.update("iftop","zodyrepo.rpath.org@rpl:devel")
conarylib using the conary public api
Doing the hacking of packagekit im reading the code from conaryBackend.py conaryFilter.py Cache.py
Im very lost following the code so im decide make more modular can i posible to do.
BTW im not found some code example or blogpost about how to use the conary public api. Im have to read the code from /usr/bin/conary file. And get some details of conary api.
Only the little help of mkj. I can do a equal of "conary q" and "conary rq"
So im decide to make a small module for basic task ( what can Improvement the packagekit) of conary api. Commands line equal with use the cli conary.
So get check the code:
http://github.com/zodman/conary-lib/
pyExcelerator making xls files with python
This week ended. Im use this lib its called funny pyExcelerator ( remember me terminator movie).
Its a python module for make files compatibles with MS excel Office.
Im try it and can open files with Office 2007, Mac Office and Openoffice. This solve my problems with endusers what a need a reports in excel.
here a example:
from pyExcelerator import * w = Workbook() ws = w.add_sheet('Hey, Dude') ws.write(0, 0, 1) ws.write(1, 0, 1.23) ws.write(2, 0, 12345678) ws.write(3, 0, 123456.78) ws.write(0, 1, -1) ws.write(1, 1, -1.23) ws.write(2, 1, -12345678) ws.write(3, 1, -123456.78) ws.write(0, 2, -17867868678687.0) ws.write(1, 2, -1.23e-5) ws.write(2, 2, -12345678.90780980) ws.write(3, 2, -123456.78) w.save('numbers.xls')
the better of that module its not have deps. so not need a openoffice core/lib for used it.
$ yolk -S name=pyExcelerator -M pyExcelerator
author: Roman V. Kiseliov
author_email: roman@kiseliov.ru
download_url: http://www.sourceforge.net/projects/pyexcelerator
platform: Platform-independent
version: 0.6.0a
Fabric a pythonic tool for deployment
Today im found a list of python-es this very Usefull tool for admin system.
Fabric its a tool for execute commands on remote servers. With it you can automate updates/softwares and others stuff. very Usefull.
example:
set( project = 'awesome-app', fab_hosts = ['n1.cluster.com', 'n2.cluster.com'], ) def deploy(): "Build the project and deploy it to a specified environment." local('mvn package') put('target/$(project).war', '$(project).war') put('install-script.sh', 'install-script.sh') sudo('install-script.sh')
django-meteora
Im working for a 1.5 month on a project on Cancun Quintana Roo.
This projects its make a POS ( point of Sale) for cocobongo the system its on web with backend intereface.
Well im use meteora for ajaxian actions. Meteora its a javascript widgets of mootools. the main developer is Jose Carlos Nieto
With can do a lot of things:
* Autocomplete
* Bubble
* Calendar
* Carousel
* Datagrid
* Dialog
* Editor
* Filebrowser
* Form Control
* Menu
* Notebook
* Picbox
* Popup
* Searchlist
* Selection
* Spinbutton
* Tablesort
* Toolbox
* Treeview
The main developer of meteora, its a php ninja coder so, exist some php-libs for meteora. Im do my project using meteora and make my own meteora lib ( with help of Ivan Zenteno on python.
Its a simple lib for call HttResponse and get some jsonrpc
For now only works on views.
Packagekit improvements and new Job
Well im give love to the conary backend on packagekit and i can solve some problems now install and remove packages works perfectly.
With the help of richard by email
i can solve problems:
pkcon search name <app> pkcon refresh pkcon resolve <app> pkcon install <app> pkcon remove <app>
next the update-system, and get-updates. more info http://wiki.foresightlinux.org/display/DEV/packagekit+devel+page
Well today a friend contact me to a person on Cancun Qroo (A great tourist Paradise) and gime a immediately Job sooo on thurday im travel to cancun for work about a 1.5 Month. For what more like development python. I will be a leader of 3 coders on a started project. i hope have time to development packagekit.
Very very usefull django tips
http://ericholscher.com/blog/2008/oct/5/django-tips/
OMG i love that tips.
My Favorite Relatives Import
liferea now will support pownce
Yesterday i send a patch for liferea, thats a feed reader for gnome. It have the posibility of send links of feed to digg.com reddit.com an other sites, I'm read the code and add support for pownce IT.
It will be added to liferea 1.4.19. Im rocks!
Thats the reason for i love FreeSoftware, if you like implement a feature send a patch ....... and it will be have the feature.
Django with twitter status
Im add a simple tag on django with my twitter last status. It's cached because twitter haves problems with alots of request...... so here the code
Create a templatetags on your model/ dir
# filename twitter.py from django.template import Library import urllib import simplejson register = Library() @register.simple_tag def twitter_status( username ): url = "http://twitter.com/statuses/user_timeline/%s.json?count=1" % username file = urllib.urlopen(url) json_responce = file.read() twit = simplejson.loads(json_responce) return "%s" % twit[0]["text"]
Add it to my index.html page on templates
{%load cache %} {% cache 18000 twitter %} {% load twitter %} <div class="twitter"> <img src="/static/images/twitter.gif"> @zodman: {% twitter_status "zodman" %} </div> {% endcache %}
Yeap my firts time of used cache on templates. That is very similar of the code of my friend blacknash, he Implement it on blog of h1pp1e
python break the switch paradigm
Today im want to implement a pownce notes on my blog like jacobian haves.
Im really not use a switch statement on python only put a if else nodes.
So i found how python break the paradigm of switch
def link(): print "link" def message( ): print "msg" def event( ): print "event" def file( ): print "juaz" functions = { "link": link(), "message":message(), "event":event(), "file": file() } dofunc = functions["event"] dofunc()
WTF ?? where is the
switch( var ){ case "event": break; default: break; }
jira irc bot
im working on jira irc bot. This bot is for work on foresight[,-devel} channel on freenode.
The objective is interactive with jira website without visit it.
The first step is maked. Make a page for suggest, wishlist and commands request.
My plans is build a python lib for interactive first with jira and then work on the bot. The bot can based on some excelents libs like irc-lib and a repository of python bots.
Now im doing a small script for do a shorts url. Im pick http://te.tl because is smaller than http://tinyurl.com and it not used alot. So it give us a very small url.
I haved code small cli for make url on te.tl
import urllib import re import sys def makeurl( url ): params = urllib.urlencode({'url':url,'title':''}) f = urllib.urlopen("http://te.tl/index.php",params) response = f.read() pattern = re.compile('<h1>.*</h1>') m = pattern.search(response) if m: html= m.group() else: return "Error: %s" %response return html.replace('<h1>','').replace('</h1>','') print makeurl(sys.argv[1])
@zodman: prox chingadazo facebook app para dar chingadazos a tus compaƱeros!
