Entries from November 2006 ↓

CreativeCommons campain

this one is about what CC is

http://media.revver.com/qt/89072.mov

and this other one is about the differences between C and CC

http://media.revver.com/qt/90062.mov

I find it a nice initiative by them
http://creativecommons.org/

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

trac’s Spamfilter gets a very nice upgrade

We just hate spammers…
And I love to see people are doing things to get over them and with all the trac’s out there

I love to see initiatives likes this but we also have to remenber that something a bad setup will help them.

Anyway thanks for this great pluging.

PS: I’ll spare you that Turbogears is not included in the list just because you miss the link to django to point to rails site :p

UPDATE: ok I was supposed to test the Trackbacks but for some reason it didn’t appear on his site so. the code I’m refering too is http://www.cmlenz.net/blog/2006/11/managing_trac_s.html

Testing igsyntax plugin

ok so I have started looking into a way to post code so I first try this which seems to be the most acceptable.
I try it at the stock buttons post and it looks great (not really just ok) although it still ate all the whitespace, and no it also screws up this

[c]

#include

int main ()
{

printf(”why is it so hard?? it’s just ignore this…”);

return 0;

}

[/c]

and this too
[java]

//file Bla.java

public class Bla

{

public static void main (String args[])

{

System.out.println(”I hate to hit the indent button instead of tab”);

}
}

[/java]

very annoying indeed I’m going to try this other approach maybe having them both active could be a final solution.

and yes it totally ruins my layout

wordpress sucks for code

I’m amazed at all the problems I had with trying to post a simple code in wordpress, wasn’t this made by programmers? didn’t they sit down and said hey lets make it good for people who posts code!

  • To start with your supposed to write a block (please note I had to use entities for that to work),
  • or pop up the raw html thingy.
  • or install a pluging

now that plugings page for “syntax highlighter” at least half the links are broken and from the rest half seem to be from wordpress 1.5.

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.