who needs social life when you have broadband?

Inventas vitam iuvat excoluisse per artes / Let us improve life through science and art.

Archive for the 'Programming' Category

New job!

Hello!

This week I started in a new company as a web developer (still working with PHP and mainly with Joomla!, which is not bad but not that challenging…). Christian has also switched jobs and now he is a Java developer (at least he has left Delphi behind, which is good news). I would like to tell you that our distributed hash cracking system (aka Bifröst) is in “sleep” mode until we find some time to re-activate it.

I’ve presented a technical session at the Joomla!Day Brazil which occurred in São Paulo on the 11th. My plane got a 22 hours delay which were not funny at all. The event was great but unfortunately I had missed half of it :/ It is always nice to speak about new geeky features to an excited audience…

My new job is allowing me to create some really cool stuff with JQuery, Ajax and Flash. And I have plenty of time to keep this blog up to date.

I don’t remember if i’ve mentioned this before, but I’m also trying to add Bluetooth capability to the great JGroups. DIdn’t have much success so far. As many of you are new visitors, I was wondering if anyone knows how to do multicast with Bluetooth :D (someone told me I’ll need a PAN Profile enabled device, but for now I just would like to test it on simulators). I’ve been trying to find answers and help in the Java community but didn’t get many insights. I don’t care to implement it on my on I just would like to know if it hasn’t been implement by someone before.

anyway.. if you have any suggestion/sample/idea to share, please get in touch.

-bigo

1 comment

Javascript 1.7 (or Pythonscript ?)

Hello! This topic will explain some of the new features of JavaScript 1.7 which are
embedded in Firefox 2.0 Beta1+ versions and probably in IE (I'm not sure).
The most interesting point in the new features is the "apparently" correlation
with the Python same features, which I will cite.
Well, let's prepare to use our new features. First of all, we need to declare some
special string in the script type attribute like that:

HTML:
  1. <script type="application/javascript;version=1.7"></script>

With this tag, we enable the v.1.7 features on our scripts.
This is needed because some new reserved keywords of 1.7 version may
interfere in the old code, the words are: "yield", "let", etc...
Let's begin.

Generators
Generator are like interactive functions with state variables.

JAVASCRIPT:
  1. /* The function */
  2. function gen()
  3. {
  4.     var i = 0;
  5.     while(true)
  6.     {
  7.         yield i;
  8.         i++;
  9.    }
  10. }
  11.  
  12. /* The "g" var isn't a simple function,
  13. is a instance of an generator */
  14. var g = gen()
  15.  
  16. /* This for loop show 3 alerts with
  17. respective values: 0, 1, 2 */
  18. for (var i=0; i&lt;3; i++)
  19. {
  20.     alert(g.next())
  21. }
  22.  
  23. g.close();

This is a powerful new feature of JavaScript 1.7, and have the same
syntax of Python Generators as you see here.

I will post about other new features in next posts, cause now I'm busy
with the Distributed Rainbow Tables project.

Farewell,
Christian S. Perone

No comments

Flash and Joomla! integration (part II )

Hello,

due to popular demand :D, I'm posting a different example to ilustrate how easy is to export Joomla! content to a XML format and then use it inside your flash movies (as you learned in the first part of this "article"). Today I'm gonna show a quick-and-dirty way to export your frontpage items.

Before we start:
- Make sure you've read the first part (link is above) of the article otherwise you won't understand nothing that is posted here.
- You don't need to change anything in the XmlGenerator class. This script will just USE it.
- I'm sorry I'm not posting the .fla, I've gotta write my final project for college and didn't have enough time to code the actionscripts (any volunteer?)

Ok, here's a small script I've wrote to export frontpage items and then generate the xml.

PHP:
  1. <?php
  2. /**
  3. * Joomla! FrontPage - XML-Generator
  4. * @author Matheus Mendes aka bigodines - http://www.joomla.com.br
  5. * @date May, 2007
  6. * @license GNU GPL v2.0
  7. *
  8. */
  9.  
  10. define('_VALID_MOS', 1);
  11. // joomla stuff :P
  12. include_once("../configuration.php");
  13. include_once("../includes/database.php");
  14. // XmlGenerator
  15. include_once("clsXmlGen.php");
  16.  
  17. $source = array();
  18. /* database object */
  19. $database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
  20.  
  21. $database->setQuery("SELECT content_id id FROM #__content_frontpage");
  22. $front_items = $database->loadObjectList();
  23.  
  24. foreach($front_items as $item) {
  25.     $database->setQuery("SELECT id, title, introtext, created FROM #__content WHERE id = {$item->id}");
  26.     $content = null;
  27.     $database->loadObject($content);
  28.     // filling the array
  29.     $source[$content->id]['title'] = $content->title;
  30.     $source[$content->id]['introtext'] = $content->introtext;
  31.     $source[$content->id]['created'] = strftime("%d/%m/%Y",strtotime($content->created));
  32.     $source[$content->id]['link'] = $mosConfig_live_site . 'index.php?option=com_content&amp;task=view&amp;id='.$content->id.'&amp;Itemid=2';
  33. }
  34. // array is ready. Next step: call the XmlGenerator to do its thing
  35. $xml = new XmlGenerator("latestNews", $source );
  36. echo $xml->createXml();
  37.  
  38. ?>

I hope it works :)

cheers,
bigo

13 comments

Orkut scrap flooding

Orkut is a plague! I have some "friends" that keep spamming my scrapbook promoting parties and other social events every single day!!! And the worst is that most of them don't even talk to me when we are in the same place. Now it's time for revange :)

I've made this small snip to flood their scrapbooks so they can have a taste of how I feel when I login and see lots of useless messages.

Open your orkut account (preferable a fake one, so when they feel ofended they won't report your original user ;) ), visit your "friend"'s orkut, go to the scrapbook page. Now, insert this in the address bar:

JavaScript:
  1. javascript:var i=0;function lambaFlood(){if(i>= 20) return; var a='uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu'; for(z=1;z<=i;z++) a = a+"u"; i=i+1;document.getElementById('scrapText').value="Fuck "+""+a+"";submitForm(document.forms[1], 'submit', '');}; void(setInterval(lambaFlood,500));

Of course this is just a use case. Use your imagination and create your own version.

I guess now we'll finally have more visitors :-)

good luck,
-bigo

1 comment

Flash and Joomla integration

One of the most requested things in the content management world is to make dynamic content to be displayed inside a flash movie. Flash has a feature that allows it to display content from a xml file, in this article I'm gonna explain how to display Joomla! content in your flash pages. With a little imagination you can change this "how-to" and make it work with other CMSes like Drupal, Xoops, or even your own CMS :-)

You can check a integration example accessing: http://www.mmoraes.com

Before we start:
- This is a script I wrote a while ago, it is probably not the best (or even the right) way to do this integration, but it works.
- You can use, change, set fire... do whatever you want with these classes but please keep my name and URL in the credits.
- Suggestions are always welcome :)

ok, let's roll
Read more

15 comments

distributed rainbow tables project

Hello! It has been a long time without blogging anything new here so this is a quick update on what's going on.

- We are planning a revolutionary distributed rainbow table generator. I know there are a few projects regarding this but none will be like ours (I still cannot provide much more info about how we are going to do this but it's gonna rock. Trust me hehe). It's going to be coded in Java because I plan to use it at college.... sorry python fans. BTW: We are still looking for a nice name for this project so if you have any suggestions, feel free to submit :-)

- My analytics account has been upgraded to the new beta. It became pretty cool to watch the statistics now and it looks much nicer (although it has small css errors in firefox2 and linux).
- Please guys, don't change Joomla's license! What happened to the "because open source matters"? It looks like it doesn't matter that much anymore :(

Cheers for all Gremio supporters!

3 comments

Party time!

Joomla! 1.5 Beta 2 - Red Barchetta Joomla! 1.5 beta 2 is out!! after almost 6 months of waiting we can finally test the new litle baby!

Don't forget to report bugs and learn the new stuff. I'll see you in RC1 my friend.

BTW: I got owned in my test :-) simply forgot to answer two questions. o_O DAMN!

No comments

dear diary (1)

This is a quick update. I just would like to make sure everyone is fallowing the discussions over the Joomla! Forums, especially this one regarding non-GPL extensions and Joomla!. There are some interesting points of view and most of the posts are very polite, so it tends to be a really good thread to fallow.

Another thing: Me and Christian were chatting earlier and we decided to create some funny things using DistrIT. I cannot provide much information about it right now but stay tunned and you'll see.

Ok. that's all folks. Gotta study for my test later today.

bye
-bigo

No comments

PSP mod_python abort/quit/exit statement

psp.py patch: patch_psp_py.diff

Hello, there is an native handler to use PSP on Mod_python, unfortunately there is no abort statement which you can use like that:

PYTHON:
  1. req.write("one")
  2. abort/cancel/quit/exit statement
  3. # the string "two" cannot appear, cause the abort
  4. # statement causes PSP flow stop
  5. req.write("two")

So, I have made a temporary patch to add this feature in mod_python, the patch simples adds a fake exception out of the running scope and a function called "abort" (exposed to running scope of PSP), so you can apply the patch and use the feature:

PYTHON:
  1. req.write("one")
  2. abort()
  3. # the string "two" will not appear, the abort() function
  4. #(enabled after patch apply) will stop the flow of program
  5. req.write("two")

The patch is for the windows version of mod_python, but you can easy look at the diff and apply to any other version of mod_python, any suggestion or help you can contact me.

In some other post I will talk about PSP with more explanations.

psp.py patch: patch_psp_py.diff

- Christian S. Perone

1 comment

the 6-lines p2p system.

I was surfing the internet looking for some inspiration to develop my undergrad project (and no, I wasn't looking for porn!) and found this AMAZING p2p system written by Dr. Pascal Felber, he called it uP2P (micro peer-to-peer). Here is the code:

CODE:
  1. #!/bin/sh
  2. # uP2P.sh 0.0.1, 436 characters (excluding comments)
  3. [ $3 ]&&export W=$1 H="$2 $3" K=`mktemp`;Z=/dev/null;e(){ echo "$*";};n(){
  4. nc $* 2>$Z;};x(){ nc -lp ${H#* } -e $1 &>$Z <$Z&};f(){ cat $K|while read h;do
  5. e $W $1 "$2"|n $h;done };case $# in 4)e $W s "$4"|n $H|while read h p f; do
  6. e $W g "$f"|n $h $p>"$f";done;;5)e $H>$K;e $W d $H|n $4 $5>>$K;x $0;;0)x $0
  7. read w c r;[ $W = $w ]&&case $c in s)f l "$r";;g)cat "$r";;a)e $r>>$K;;d)cat $K
  8. f a "$r";;l)ls|grep "$r"|sed "s/^/$H /";;esac;;esac

ok, it is a mess... (somehow, reminds me the worpress source-code hehehehehe) but that's because it hasn't any comment lines. There is a long version available as well which explains how it works (you will see that everything is made using standard Unix tools and the whole communication is made using netcat ("nc").

usage is pretty simple though:
To start a server, change to the directory that you would like to share and start the script as follows:

uP2P.sh password local-ip local-port remote-ip remote-port

where 'password' is the network's password; 'local-ip' and 'local-port' are the IP address and port used by the server for listening to remote requests; 'remote-ip' and 'remote-port' are the IP address and port of some other peer in the network. The first server can be started with any remote address (even its own address) since connections to non-existing endpoints will fail silently. All 5 parameters must be specified.

To start a client, change to the directory that you would like to download files to and start the script as follows:

uP2P.sh password remote-ip remote-port pattern

where 'password' is the network's password; 'remote-ip' and 'remote-port' are the IP address and port of some server peer in the network; 'pattern' is a filter that specifies the files to download using the 'grep' regular expression syntax. Note that, because of message forwarding, redundant escape characters must be used; for instance, "\." (dot) must be specified as "\\\\.".

To end the script, kill all instances of 'nc'.

Example:
Start 4 servers on 4 hosts (or in different directories on the same host):

uP2P.sh abc 192.168.1.100 9000 192.168.1.100 9000
uP2P.sh abc 192.168.1.101 9000 192.168.1.100 9000
uP2P.sh abc 192.168.1.102 9000 192.168.1.101 9000
uP2P.sh abc 192.168.1.103 9000 192.168.1.101 9000

Download all files containing 'pdf' in their name (here using third server as entry point to the network):

uP2P.sh abc 192.168.1.102 9000 "pdf"

Amazing huh? Use it to impress your teacher (please keep the credits for Dr. Felber). And remember: this is justa PoC. There are many limitations (and possibilities!).

-bigo

No comments

« Previous PageNext Page »