Archive for the ‘Programming’ Category

Sleep Visual Basic

May 12, 2008 - 5:44 pm No Comments

Si alguna vez necesitan esta util funcion…

  1. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  2. Sleep 1500

Contar Lineas con php

April 29, 2008 - 9:26 pm No Comments
  1. $lineas=file(‘nombre_del_archivo’);
  2. foreach ($lineas as $linea_num => $linea) {
  3. // $linea string de la linea
  4. // $linea_num integer del numero de linea
  5. }

Puedes hacer lo que necesites dentro del foreach, facil y sencillo

Perl-Tube

April 28, 2008 - 8:22 pm No Comments
  1. #!/usr/bin/perl -w
  2. use WWW::Mechanize;
  3. $_ = shift @ARGV;
  4. s[http://|www\.|youtube\.com/|watch\?|v=|][]g;
  5. my $mech = WWW::Mechanize->new(); #creates a new object
  6. ($t = $mech->get("http://www.youtube.com/v/$_")->request->uri) =~ s/.*&t=(.+)/$1/; #code to give the right url for the video
  7. $mech->get("http://www.youtube.com/get_video?video_id=$_&t=$t", ":content_file" => "$_.flv" ); # code for download the video