Showing posts with label hackers. Show all posts
Showing posts with label hackers. Show all posts

How to embed Adsense ads inside a Blogger.com post

Monday, September 03, 2007

One of the most annoying things of a Blogger.com blog was how difficult was to add AdSense ads in your blog. Currently this is not an issue anymore because you can add automatically AdSense ads in your page thanks to the Blogger dashboard. But if you read blogs you will realize that some blogs embed Google AdSense ads inside the post. Most tutorials on how to monetize your blog recommends it. But it's not possible in Blogger. Why? Because the content of every post is wrapped by a DIV element with the style 'clear:both;'. And it's not possible to modify it in the template, it's created by the Blogger.com's render engine.
So here goes the steps I have followed to embed AdSense ads inside a Blogger.com post:

  • Edit your template
  • Find this tag: <div class="post-body">, inside you will find this tag <$BlogItemBody$>.
  • Insert your Google AdSense code wrapped by a floating layer between both tags. You can change to style="float:left" if you want to align at the left hand side:
<div style="float: right;">
<script type="text/javascript"><!--
google_ad_client = "XXXXXXX";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text";
google_ad_channel = "XXXXXXX";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//-->
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>


  • Now you have to find the DIV tag that contains the id to the 'sidebar'. Normally it's after all the comments stuff. Insert BEFORE this DIV tag the following javascript code:
<!-- START: Remove the stupid clear: both; added by blogger render engine -->
<script type="text/javascript">
var nodes = document.getElementsByTagName('DIV');
var size = nodes.length;
for (var i = 0; (i<size); i++) {
if (nodes[i].style.clear=='both') {
nodes[i].style.clear='';
}
}
</script>
<!-- END: Remove the stupid clear: both; added by blogger render engine -->

And that's all folks. Test it before publishing. I have tested it in FireFox and Internet Explorer in Windows. If you can test it in Safari or Opera, please send me some feedback.

Comments, improvements and problems will be welcomed!

Update 1: A colleague sent me a CSS hack. You can find it here.
Update 2: To restrict the effect of the script to the posts avoiding the sidebars and other effects, this version modified of the script only affects the post bodies.

<script type="text/javascript">
var nodes = document.getElementsByTagName('DIV');
var size = nodes.length;
for (var i = 0; (i<size); i++) {
if (nodes[i].style.clear=='both') {
if(nodes[i].parentNode.className=='post-body') {
nodes[i].style.clear='';
}
}
}
</script>

Birthmarking: How to detect and prove GPL violations in Java propietary code

Sunday, August 26, 2007

I have just read the news in Slashdot (Yes, I still read Slashdot) and I found this very interesting article about a new technique to detect GPL violations in proprietary obfuscated code. The technique is called Birthmarking and basically it 'observes short sequences of method calls received by individual objects from the Java Platform Standard API, which is part of the Java Runtime Environment. By aggregating sets of short call sequences the otherwise overwhelming volume of trace data becomes manageable.'

In other words, every piece of java code (and a library is not an exception) moves at bytecode level the information coming and going from the stack following a pattern. So, they identify and classify the patterns of some key objects of a specific GPL piece of code and then they check how the proprietary code uses the stack. If it matches... gotcha!

But I will tell you something... I have seen this concept implemented 15 years ago!!! Not for Java, obviously. Where? At the Faculty of Computer Science of the Polytechnic University of Madrid. There was two terms called Computers Architecture and Computers Fundamentals. We had practices to learn how to code in assembler and microcode. It seems that students copied practices from each other, but students where so smart that they just copied piece of code of other students, or renamed the variables (or labels, it was low level programing). But the core functionality was copied intact. So, the department in charge developed a program called 'El Corrector'. This program checked the input and outputs of each practice automatically (just like today we do with automatic unit testing) and they checked how the program move data to and from the stack. All the practices were compared each other (the patterns were the other students). If they detected similarities in the behaviour of the applications with the stack, they examined the source code and then visually tried to identify a possible copy.
A friend of mine was a bit desperate with the practice, so he asked another friend to have a look to his practice 'to get some inspiration'. He gave him his source code, and he copied parts of it. Both of them were caught by 'El Corrector', and both of them had to repeat the term.

So the ideas behind this paper are not so new, but they are applying it for a real world problem.

Skype outage has cost more than $11000 per second to eBay

Friday, August 17, 2007

I have not been able to use Skype for more than 24 hours, just like the rest of the world. It seems that the problem is serious. It has been reported that it's an issue with a new version of the application. But it's not so clear. Such a long outage must come from (and I'm speculating):

1) A failure in the data migration from the early version of the application and a bad (or nonexistent) rollback process.
2) Massive failure in the storage and problems with the recovery process (I have seen this problem a lot of times).
3) Skype has been hijacked by malicious hackers. I don't believe it.


Whatever it is, it's costing eBay one billion dollars. That's more than $11000 per second. Let's see if they can fix the problem before the markets open.

Update 17/08/2006 13:16 GMT+2: It seems that an exploit that causes a denial of service was published by an anonymous user in SecurityLab.ru.

The difference between an Excellent Programmer and a Natural Born Programmer

Thursday, July 12, 2007

Reading this blog about what he thinks a Natural Born Programmer is came to my mind a discussion about what is an excellent programmer and a natural born programmer.
The example given (detect if a number is odd or even) should be enough to differentiate between a natural born programmers and the rest.
But he is wrong.
This is the kind of solutions that people trained in Maths, Engineering or Physics can give, because they are smart people. And that's what a development manager should expect from a person with high level education.
A natural born programmer can or cannot provide this solution, but he will provide ONE or SEVERAL valid. But he/she will deliver it quick and working if thinks it's a challenge. But this kind of challenge does not motivate to a natural born programmer. The natural born programmer development is compulsive; once you give him/her a challenging target, he does not stop until he/she get it done. If you compare the productivity of the natural born programmer with other 'races' of programmers, you will find high peaks of productivity when he/she deals with something he/she likes. And deep valleys of productivity when he/she deals with repetitive tasks. Other programmers productivity does not vary so much.
What's the reason for this behaviour? Natural born programmers are like artists, they only motivate with their new creature. If you never ask an artist to paint the walls of your garage, don't ask a natural born programmer to fix stupid bugs or implement silly requirements. Ask him/her to create something he/she can feel proud of. Other programmers are professionals, they will do what you ask them to do if the tasks does not collide with their professionalism (if you ask them to serve the coffee in the morning, probably they won't do...).
Natural born programmers are rara avis, and they rarely fit in big Corporations, like other programmers do. The best place for them is small companies, start ups and not very long freelance-like contracts.
Natural born programmers have a gift: they can CREATE software faster and better than the rest of the humans. But normally they have some lacks when dealing with other colleagues, customers or just the rest of the world. A Human Resources VP of a very important Telco told me that normally brilliant technicians are Cyclothymic (seems to be a very well known pattern) but it's not clear if it's something to do with his/her nature or his/her environment.
I have known dozens (more than a hundred for sure) of programmers, but I have only known 2 or 3 natural born developers. And I wonder myself if I would contract them again...

The killer app of FON will be access to P2P networks

Sunday, January 14, 2007

I have been tracking FON for two years, and I'm a 'fonero' since last summer. Recently I read about the 'FON Liberator' project, and it seems that finally the mystery of FON is over. If you analyze seriously the business model of this company and you have some basic knowledge about wireless networks, you easily find that something does not match. The original FON business model (and I say original, because now it has changed) was 'share your bandwidth and you will have access to the enormous WiFi network of FON'. Once the network is deployed, then the company can bill non-Fon users to use the network. Mr. Varsavsky is really a smart guy, isn't it?

But this business model has serious technical restrictions:
1) The coverage of a standard WiFi hotspot is about 100m. So even in metropolitan areas, you need a FON member in every block!
2) Why people is going to share their network? People does not use WiFi hotspots every where, only really geek people and executives (and they use 3G connection because they can afford it).

FON trusted in WiMax to fix the first technical restriction: coverage. But WiMax is far from being available as the wireless connectivity for the masses, and may be the WiMax assumptions regarding coverage and deployment that I read in documents they published in FON web site about 18 months ago are not going to be implemented before 2009 or 2010.

So they need a short path to continue with the massive deployment of 802.11b/g hotspots: they need to motivate users to share their bandwidth. How?

80% of the Internet traffic in Europe comes from P2P networks. It means that a lot of people have a computer up and running 24 hours a day seven days a week sharing files with 'colleagues' all around the world. Whether this practice is legal or not it's not my business. It means that people have their personal computer stressed running this P2P software (Emule, Bittorrent, Azureus, MLDonkey...). What IF you have a specific device that can manage your shares in your P2P networks? You just plug in your 500Gb external USB 2.0 disk drive and voila! No more disturbing noise from fans, no more fear of fire, no more broken computers because of abnormal stress! FON will sell this device below their manufacturing price for 70€. The trade off? You will have to share your bandwidth with the FON community, of course. I guess this solution can be the killer app for the success of FON.

But is this something new? No, not at all. Basically, FON is going to sell a SBC (System Board Computer) router with a WiFi card and enough RAM memory to run a Linux (may be an embedded version of Debian) and some Flash for the OS and bootstrap. 64Megs of RAM and 64Megs Flash should be enough. And there are some commercial devices that have been modified to run something closer to the Fon Liberator. Here goes a list:

You can find some cool stuff on how to flash custom built Linux distributions on these devices in http://www.nslu2-linux.org/ and http://www.linkstationwiki.net.

In my spare time (if you run a company and you have a one year old baby that's really short) I have built my own FON Liberator with the following hardware:
  • A Soekris net4521 board, purchased to the European distributor.
  • A Gigabyte GN-WIAG01, a cheap Atheros miniPCI card.
  • A Conceptronic CSP480C2 PCMCIA 2 Ports USB 2.0 card.
  • A Kingtson 512Mb Compact Flash.
  • An external USB 80GB hard disk.
The total cost of this hardware is about 240€ (excluding the hard disk). Obviously, the FON Liberator will be cheaper!

I decided to use the Voyage Linux distribution because it's perfect for small systems, and it has a version for Soekris boards. It's based on Debian Etch, so it's very close to the official release. I have added the following software:
I have also tried to install MLDonkey, an implementation of the Donkey protocol for Linux and it works. I just installed it for the purpose of study, later on I switched it off. This software is much better than any other P2P software on Linux, because it implements half a dozen P2P networks (bittorrent, overnet, kademlia and others).

I must admit that it works smoothly, but I have two problems:
1) I had to create a SWAP partition in the external drive to run ushare, samba and mldonkey.
2) Sometimes, when transferring files at maximum speed the system crashes. I don't know what the problem is, but seems to be a problem of the Conceptronic card.

And here goes a photo of the system...



And my Nokia 770 running Canola playing content as a UPnP client...



Once I have fixed the problem with the crash, I will buy a DLink DSM-320,



to play all my media files on my TV screen.

Cool, isn't it?

Don't contract hackers to change your university grade average

Friday, December 29, 2006

This is the best story I have read in years. This poor asshole was the communications director for U.S. Rep. Denny Rehberg, R-Mont tried to hire hackers to raise his recorded grade point average[1].

Sounds like something that only could happen in a sit-com, not in real life.