who needs social life when you have broadband?

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

Archive for May, 2007

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

14 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

wardriving weekend



warm up, originally uploaded by bigodines.

What a great weekend!

Yesterday Joomla! 1.5b2 was released. Today we've made the wardriving day. If you still don't know the authors of this blog, please take a look at the picture, there you have Christian (in red) configurating Kismet and me playing with my little tux (Aroldo).

We've invited two good friends (thiago aka tx and joão aka joão) to join us in our first wardriving over the town. It has been amazing to see how many unprotected networks (check more photos in the album) a small city like ours have (Passo Fundo / Brazil has about 180k habitants...)

unfortunately thiago's laptop doesn't have a serial port where we could plug in our GPS so we won't be able to plot any maps. This time the wardriving was just for fun (and we've had a LOT of fun :D) please check the pictures and leave your comments (most of the descriptions in Flickr are in portuguese. Sorry about that, but your comments are more than welcome anyway...)

BTW, thanks to the jUploadr Team that makes picture uploading to Flickr so easy and thanks to the Flickr team for this amazing app (1000s times better than picasa!).

That's all guys! See you on monday

PS: I'm glad Googlebots have finally found us!

No 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

Python implicit zipimport

Hello ! This is my first post on this blog, so I hope you enjoy =) This post is about an feature called zipimporter who easy helps you in distribution or organization of modules and packages.

Well, since 2.3 version of Python, there is a module called zipimporter, the main objective of this module is:

" This module adds the ability to import Python modules (*.py, *.py[co]) and packages from ZIP-format archives."

As you see, it's not Java which only have .jar (very slow) compression of packages.

So, we let's code and stop talking:

First, we create a simple module called test.py with this simple code (do not forget the indentation):

PYTHON:
  1. def func_test():
  2. "Simple function"
  3. print "Function test, pythowned !"

Later, we save that test.py and compress it inside pymod.zip, now we can use the .zip with compressed module, let's see:

PYTHON:
  1. # importing the zipimport
  2. import zipimport
  3.  
  4. # create the zipimporter object
  5. zip = zipimport.zipimporter("pymod.zip")
  6. # load the module
  7. mod = zip.load_module("test")
  8.  
  9. # and now, the magic:
  10. test.func_test()
  11.  
  12. "Function test, pythowned !"

There is another way which you can do that, and python will use the zipimport implicitly:

PYTHON:
  1. import sys
  2.  
  3. sys.path.insert(0, "pymod.zip")
  4.  
  5. import test
  6.  
  7. test.func_test()
  8.  
  9. "Function test, pythowned !"

Some python modules are really small and imperceptible, but can help you a lot in the distribution of a huge project.

- Christian S. Perone

No comments