geeky

Ubuntu 11.10 avec KVM sur dedibox

1

La plupart des hebergeurs interdisent d’utiliser le mode bridge pour hoster des VMs sur un serveur. Les hebergeurs veulent limiter le nombre d’adresses mac sur leur reseaux car les tables macs des switchs sont limitees en taille (sur un catalyst 6500, 128,000 macs par example). Si les machines hebergees utilisent un mode bridge, le nombre de mac peut rapidement exploser… nb_mac = nb_machines * nb_vms… Pour se proteger, les hebergeurs utilisent port-security, et le switch automatiquement bloque le port si il detecte du traffic en provenance de plusieurs Mac.
Conclusion, il faut faire attention…

(more…)

Convert a week number to a date in perl

1

Today I had to hack a quick script to convert a week number to a date in perl. To my surprise, the answer was not straightforward and I had to test and try a little bit before to get something working.

So here it is:

#!/usr/bin/perl
use strict;
use Time::ParseDate;
use Time::Local;
 
sub convert_week_to_date
{
    my ($year, $week) = @_;
 
    my $ref = timelocal(0, 0, 0, 1, 0, $year);
    my ($s, $m, $h, $dom, $m, $y, $wd, $yd, $i) =
        localtime($ref);
 
    my $time = parsedate("+".$week." weeks",
                         NOW => $ref);
 
    my ($s, $m, $h, $dom, $m, $y, $wd, $yd, $i) =
        localtime($time);
    $wd -= 1;
    my $time = parsedate("-".$wd." days",
                         NOW => $time);
    my ($s, $m, $h, $dom, $m, $y, $wd, $yd, $i) =
        localtime($time);
    return (sprintf("%04d/%02d/%02d",
            $y + 1900, $m + 1, $dom - $wd + 1));
}
 
print convert_week_to_date(2009, 1)."\\n";
print convert_week_to_date(2009, 52)."\\n";
print convert_week_to_date(2010, 1)."\\n";
print convert_week_to_date(2010, 22)."\\n";
print convert_week_to_date(2010, 23)."\\n";
print convert_week_to_date(2010, 24)."\\n";
 

Download this code: convert_week_to_date.pl

Hopefully it will help someone one day.

Closing the gap

0

I got to find about Eric Sink’s blog today… Better late than never :)

He is writing about a lot of interesting topics related to software engineering.

My favorite column from his blog:

future of data center?

0

That’s what you do when you are a powerful geek with a lot of money :)

End of spam?

0

As a consequence, there is a big drop in the spam traffic in the world

Even on happycoders.org, we saw a difference in the daily average of spam received:

  • before: Received 149MB 26945 3841
  • after:Received 109MB 10351 1563

More details:

Modern warfare

0

21st century is here… it’s now computer warfare!

Georgia Under Online Assault | Danger Room from Wired.com

San Francisco’s computer network locked down

1

Here is an incredible subject for a movie… unfortunately it’s not fiction it’s reality…

Hungarian notation

1

I recently came to cross the name “Hungarian Notation”. I found it quite funny as I know this method for long time but I didn’t even know it has a name… If you are a geek check this:

Hungarian notation – Wikipedia, the free encyclopedia

And if you have really too much time, and you don’t know what to do, check this document:

http://www.coding-guidelines.com/cbook/sent792.pdf

Demonstrate a unix command usage from powerpoint

1


ssh demo

Here is the reason why I tried to demo a website from powerpoint… I needed to demonstrate how to use a new Unix application, but I wanted to do that from my powerpoint presentation. After some time spent on google, I didn’t find any way to integrate a ‘unix terminal’ component in a power point slide.

So my solution was to use the embedded browser and use Ajaxterm to connect to a remote linux host… This works… but there is a limitation as it’s not possible to use PageUp, PageDown to go up and down in your terminal… In order to fix that, you can start ‘screen’ on your unix host, and then you can navigate in your terminal using Ctrl+b, Ctrl+f.

I believe that there is a cleaner to connect to a unix host from powerpoint… but I didn’t find it. If you know other solution… please share :)

Some links to finish, I didn’t try anyterm but it looks cool too…

How to demo/browse a website using powerpoint?

1

Problem: You are giving a powerpoint presentation, and during this presentation you need to show/browse a website. The solution that most of the persons will chose will be to hit “alt+tab” to switch the focus to their browser… Yes that does the trick… But you may want to show the website from your powerpoint to keep your audience captivated. I personally think that people has a tendency to get distracted when you switch away from your fullscreen powerpoint.
Chose the right component

My solution is to integrate a “Microsoft Web browser” component on your slide, so you can use it to browse a website. Start by adding the component as shown in this screen shot.



Editition of the slide

Then you can put several buttons on your slide to control your embedded browser. It should look like on this screenshot.


Finally you will have to add some Visual Basic code to your button’s callbacks. Something like:

Private Sub FontDecrease_Click()
    Dim Z As Variant
    WebBrowser1.ExecWB OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, Null, Z
 
    If Z > 0 Then
        Z = Z - 1
    Else
        Z = 0
    End If
    WebBrowser1.ExecWB OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, Z, Null
End Sub
 
Private Sub FontIncrease_Click()
    Dim Z As Variant
    WebBrowser1.ExecWB OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, Null, Z
 
    If Z < 4 Then
        Z = Z + 1
    Else
        Z = 4
    End If
    WebBrowser1.ExecWB OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, Z, Null
End Sub
 
Private Sub StartDemo_Click()
    WebBrowser1.Navigate ("http://samuel.happycoders.org/")
End Sub
 

Download this code: test-www-ppt.pas


And here is the result:
Result

Download the example

In the next post I will explain why I wanted to do that… I have a really geeky reason :)

Go to Top