Marco Islas Blog http://islascruz.org/html markuz@islascruz.org (Marco Antonio Islas Cruz) 2005-2008, Marco Antonio Islas Cruz Fri, 03 Jul 2009 15:42:16 -0500 JAWS 0.8.6 general gnome FLOSS Video <![CDATA[ Clever windows ]]>
Looks promising, but, to be honest, I don't like the way the appear, and the focus switch between windows is ugly. Anyway, it looks nice. ]]>
http://islascruz.org/html/index.php?Blog/SingleView/id/Clever-windows markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/Clever-windows Fri, 03 Jul 2009 15:42:16 -0500
general google Pictures <![CDATA[ How many searchs do you do in google in a day? ]]> June searchs on google ]]> http://islascruz.org/html/index.php?Blog/SingleView/id/How-many-searchs-do-you-do-in-google-in-a-day%3F markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/How-many-searchs-do-you-do-in-google-in-a-day%3F Fri, 03 Jul 2009 06:58:26 -0500 general christine <![CDATA[ Christine 0.4.0 screenshot ]]> christine 0.4 Christine with visualization enabled. ]]> http://islascruz.org/html/index.php?Blog/SingleView/id/Christine-0.4.0-screnshot markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/Christine-0.4.0-screnshot Mon, 29 Jun 2009 01:34:22 -0500 general stuff Python books FLOSS <![CDATA[ IronPython in Action ]]> The people who knows me, know that I'm a fan of the Python programming language, and many of the stuff I do in my work is done with this fabulous tool, I have made work for services, where Python behave very very well, and applications for the Desktop, most of them run on the Microsoft Windows operating system.

Why do I choose Python instead C, C++, Java or C#?, well, I have to say that I was a PHP user before Python, that was the programming language where I start, and I thought that PHP was perfect, because I felt that PHP was so simple, easy to use because I didn't have to compile anything!. Then I meet Python and everything change.

I choose Python because it is ridiculously simple, easy to use and it have almost everything you need by default, the data types are more than enought to work and do amazing stuff, it was by the time I meet it a fully functional programming language.

By that time, I was also trying to learn something about Mono and the C# programming language, its obvious that I left C# in favor of Python, Why? just because Python is easier than C# (IMHO). And by the time, a lot of FUD was arround the mono framework about patents and possible Microsoft attacks which still exists, but by that time Mono was something new and everyone put their eyes on it.

Now, that I have learned Python and know much more about it, I want to try another developing platform, as I already said, I write programs that runs on the Microsoft Windows OS, and I'm trying to learn something that help me to develop stuff there, but also let me work on it in Linux. The answer IronPython an implementation of the Python programming language under .NET (something similar to Jython but for .NET)

Recently I receive a copy of the IronPython in Action by Michael J. Foord and Christian Muirhead. The book itself is very interesting, first, you'll see an introduction to IronPython, Python itself and the CLR then start the teaching about the .NET framework and how to write your programs using the .NET objects and IronPython, which is the reason of the book to exists. This is where the book shines, it will teach you how the core development techniques that will help you to write your applications in the IronPython way, using classes with XML, and agile testing.

Then, and advanced look to the .Net Framwork, using the Microsoft Windows Presentation Foundation, system administration with IronPython and combine IronPython with ASP.NET concluding with the Silverlight plugin, allowing you to create appliciations like Flash does.

Finally, something really really important, how to extend your IronPython applications using C#/VB.NET. We know that even when the programming language is very very powerfull we need tu help us with another programming language, This may be because it is simpler or easy to do in another language or just because you have to do it like that. Python let you extend your applications writing python modules with C, IronPython could not be the exception and allows you to write extensions using the C# and VB.NET languages. And in the same way you could extend Python/IronPython, you could use it to extend another application by embedding the IronPython engine into your applications.

Yes, the book is about Windows programming, Windows programmers will benefit from the book by learning how to write their applications using IronPython. No matter if they are beginners or experienced users. I think that using IronPython will help them a lot if they use it instead the C, or C++, because it is quick, it is simple, easy to read and more, but also, programmers that use another OS will benefit from it, by using the Mono Framework.

If you are looking a good book to learn .NET check the IronPython in Action, it's a very complete book.

]]>
http://islascruz.org/html/index.php?Blog/SingleView/id/IronPython-in-Action markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/IronPython-in-Action Sat, 27 Jun 2009 00:32:33 -0500
general Humor movies linux FLOSS <![CDATA[ Why you should use Gentoo on your servers ]]>
Taken from blog, jurgen dot ca. ]]>
http://islascruz.org/html/index.php?Blog/SingleView/id/Why-you-should-use-Gentoo-on-your-servers markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/Why-you-should-use-Gentoo-on-your-servers Fri, 26 Jun 2009 22:37:11 -0500
general personal Pictures <![CDATA[ Almost 3 months ]]> Sofia Valentina ]]> http://islascruz.org/html/index.php?Blog/SingleView/id/Almost-3-months markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/Almost-3-months Mon, 15 Jun 2009 23:10:59 -0500 general Software_Development Python gtk FLOSS <![CDATA[ PyGtk: GtkDialog for configurations using pure treeviews ]]>
I have been working on this, this is a very early version of the configuration dialog I have already created, I promisse I will put fully working version here with source code :-) ]]>
http://islascruz.org/html/index.php?Blog/SingleView/id/PyGtk%3A-GtkDialog-for-configurations-using-pure-treeviews markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/PyGtk%3A-GtkDialog-for-configurations-using-pure-treeviews Wed, 10 Jun 2009 09:25:50 -0500
general stuff personal Pictures FLOSS ubuntu Flickr <![CDATA[ June desktop ]]> June Desktop ]]> http://islascruz.org/html/index.php?Blog/SingleView/id/June-desktop markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/June-desktop Sat, 06 Jun 2009 10:57:39 -0500 general Software_Development Video <![CDATA[ Head Tracking for Desktop VR Displays using the WiiRemote ]]> Project natal rocks, but this (at least for me) rocks even more..


If they get together that would be awesome! ]]>
http://islascruz.org/html/index.php?Blog/SingleView/id/Head-Tracking-for-Desktop-VR-Displays-using-the-WiiRemote markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/Head-Tracking-for-Desktop-VR-Displays-using-the-WiiRemote Wed, 03 Jun 2009 23:01:50 -0500
general Software_Development stuff Python FLOSS Video <![CDATA[ Sockets (and some other files) and PyGTK without threads. ]]> PyGTK and Threads motivated by the work I have been doing on ICT Consulting where I have a graphical application that need to have a web service where some other applications could connect and execute some of its public function.

My first aproach was Threads just because with them I could use an infinite loop reading the socket while in the main thread the gtk loop runs. This is nice if your application is going to ask/request something trough the socket and receive the answer at some point, then, when the answer is here, you could emit a signal and then move your gui to show the answer.

But, what if you need to receive the request and then, move your gui asking to the user for an answer or show something in the screen, or whatever, you could make use of what I just did in the PyGTK and Threads post, where you use gobject.idle_add to launche the function that will modify your gui, which is nice you don't care about the return value of the task.

Today, looking in trough the gobject reference I saw the gobject.io_add_watch function. This function will let you, as its name describes, watch for the I/O activity in a file descriptor. As sockets are treated like sockets, then you have the chance to use it here.

What about that?, well, if you have the chance to check the I/O of the socket file then you will know when data arrives and call the proper handler, and do it in the very same thread that the main loop. Then, you can move the GUI and return something if you have to.

In webservices this is useful because you can catch any error and inform the client that there is something wrong with the function it calls. The implementation is quite simple, let's do it with the code that we already use in the Threads post.

This is the server:

import SOAPpy
import gtk
import gobject
import time
 
def hello(name):
        dialog = gtk.Dialog("Hello dialog",
                        None,
                        gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,)
                        )
        label = gtk.Label('Hello %s'%name)
        dialog.vbox.pack_start(label)
        label.show()
        response = dialog.run()
        dialog.destroy()
        return response

def change_time(label):
        label.set_text(repr(time.time()))
        return True

def handle_request(source, condition, webservice):
        try:
                webservice.handle_request()
        except:
                pass
        return True
       
soapserver = SOAPpy.SOAPServer(('',8080))
soapserver.registerFunction(hello)
gobject.io_add_watch(soapserver.socket, gobject.IO_IN,
                     handle_request, soapserver)
win = gtk.Window()
win.connect('destroy', gtk.main_quit)
win.set_size_request(300,300)
label = gtk.Label('Main window')
gobject.timeout_add(100, change_time, label)
win.add(label)
win.show_all()
gtk.main()
 
And the client:

#!/usr/bin/env/python
import SOAPpy
import sys
server = SOAPpy.SOAPProxy("http://localhost:8080/")
prueba = sys.argv[1]
args = tuple(sys.argv[2:])
print args
func = getattr(server, prueba, False)
print func(*args)
 
Using it like this:

python soaptest.py hello markuz
gives as result the integer value for the response asociated to the button you just clicked.

Gtk webservices with no threads from Marco Antonio on Vimeo.


I hope this information is useful for you. For me, it saves my day! ]]>
http://islascruz.org/html/index.php?Blog/SingleView/id/Sockets-%28and-some-other-files%29-and-PyGTK-without-threads. markuz@islascruz.org (Marco Antonio Islas Cruz) http://islascruz.org/html/index.php?Blog/SingleView/id/Sockets-%28and-some-other-files%29-and-PyGTK-without-threads. Wed, 27 May 2009 00:58:06 -0500