Entries Tagged 'Uncategorized' ↓

7 steps of executing “the idea”

someone to

  1. come up with the idea
  2. will trash it and notice it’s good
  3. that will code the prove of concept
  4. that will take the code and make it clean and beautiful
  5. make the interface beautiful
  6. make the interface functional
  7. will organize everyone so we actually ship something

Now in my findings giving a puntiation of 1-3 I’m like this

  1. 1
  2. 3
  3. 1
  4. 3
  5. 0
  6. 2
  7. 2

how about you?
which kind of explains why most stuff is just sitting either on my head or my laptop. and will also explain why I have some many unfinish stuff.
so if your the oposite of me please lets work together :)

I

http://one.revver.com/revver/watch/87870

show_stock buttons in pygtk

So I’m learning pygtk to write a small program inspired by my last post.

and I wrote this to see if I really undestand how the tookit worked.

I’m reading http://www.pygtk.org/pygtk2tutorial/index.html which seems to be the official tutorial and it’s written very well and/or gtk is a very handy tool.

I personally like a lot the way they do the table layout it’s much more simplier then it’s java cousing. Since you can actually make a mind map on how big each component is based on it’s numbers instead of having to add them up and see if they collide.

The funniest part of all is that I wrote this in about 30min this morning before going to work and I have spend 15 more minutes making it “presentable”, after that I spend almost 2-3 hours figuring out how to post the damn thing to wordpress, but that is the topic of my next post. for now enjoy the code.

Bonus points if you tell me why lines 48-49 screw up the layout.

[python]

#!/usr/bin/env python

import pygtk
pygtk.require(’2.0′)
import gtk

#this will generate the list of all the stock options
stock_options = [option for option in dir(gtk) if option.startswith(”STOCK”)]

class Stock_Buttons:

def createButton(self,stock_option):

#ugly but this is a test.
button = gtk.Button(stock=eval(”gtk.”+stock_option))
button.connect(”clicked”, self.clicked,stock_option)
button.show()
return button

def clicked(self,widget,data=None):

print “gtk.Button(stock=gtk.%s))” % data

def __init__(self):

#setting some defaults.
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title(”Sample stock buttons”)
self.window.set_border_width(10)#this will handle both gui events (click the X) and system events like
#the kill command.
self.window.connect(”destroy”, lambda wid: gtk.main_quit())
self.window.connect(”delete_event”,lambda a1,a2:gtk.main_quit())

#small trick to get the the size if the grid
#93 boxes fit into a 10×10 grid
#45 boxes fit into a 5×5 grid and so on.
import math
length = math.ceil(math.sqrt(len(stock_options)))

#pasing floats to gtk is deprecated so to avoid that we make sure it’s an int
length = int(length)
print len(stock_options)
#we set false so gtk will strink the buttons.
table = gtk.Table(length,length,False)
#set one widget on each 1×1 slot until we run out of widgets
for index,option in enumerate(stock_options):
i=index / length
j=index % length
#~ why this shows a weird layout?
#~ i=index % length
#~ j=index / length
table.attach(self.createButton(option),i,i+1,j,j+1)

self.window.add(table)
table.show()
self.window.show()

def main():

gtk.main()
return 0

if __name__ == “__main__”:

Stock_Buttons()
main()

[/python]

I’ll post a screenshot but the upload thing doesn’t wants to work unless I give 777 to the dir so no way, same goes with the raw code, ones I’ll figure out how to do it I’ll update this.

Linux wallpaper changer

First of all let me say I’m not a fan of wallpapers I’m more a “black background guy”.

But I have been hearing a friend complain about needing a program with this simple spec.

“take in a dir, randomly look for a wallpaper there and set it.”

I’m impress that gnome doesn’t has this so simple functionality same with fluxbox (although you can use feh, but I have yet to learn how). On the other hand KDE seems to have one that’s very nice it even has wallpapers on each desktop but it’s KDE.
Then they are lots of programs with a huge ammount of “functionality” like gradients and solid backgrounds and a bunch of stuff and yet they forgot something so simple as a random chooser.

Anyway I was about to fire up my editor and code something but i decided to google around and I found many:

all the relevant ones are in this thread, ironically they are all implementations of the same program in different languages.

The one that is a bit more complex is the C code which implements it’s own counter, the shell one, perl and python are just something that reads all files in dir and randomly gets one after that they all call gconftool-2 with the correct options to set the wallpaper; after that they all say set a cron job.

The one written in C goes hardcode loading a gconf instance and setting the property there ( /desktop/gnome/background/picture_filename if someone is interested.) after that it created a mainloop and sleeps for X seconds, oh did I forget it needs to be compile and depends on 2 external libraries? good luck ubuntu users getting that build.
Anyway I could say which one I think it’s the best but as I said I don’t have any wallpapers to try them….

If only a friend of mine will lend me his huge list of wallpapers, which I’ll love to have but he refuses until I stop caling it “your huge pile of crap”
side note, check out this “true story” about openbox wallpapers why executable code is not a good idea :)

Come on click it it’s just one paragraph.

it’s “official” google is the new microsoft, if you can’t bet them buy them….

people said youtube was going to die or someone will buy it. I still think both can happen unless google works it out.

I believe one of this will happen

  1. google will split their products into formal and informal online videos moving all the formal to googlevideo and leaving all the informal on youtube. by formal I mean either paid or tv or the big video blogs, maybe the directors from youtube. but they will stay as 2 diferent products.
  2. The same as the above but to the point that ones you know it your hopping to one or the other page.
  3. google will kill one of them and merge the ideas into the other. and here is big point for google if they kill youtube they will become microsoft if they kill googlevideo they will stay google (read: doing what noone will think to be a good idea and doing it, like buying youtube =o)

ohhh I almost forgot, congrats to youtube founders and employees!

SO I finally got this going…

I finally desided to get my blog up, well it has been up for 3month now but I started to customize it today.