miércoles 25 de enero de 2012

Guia sobre WII

Launchers conocidos:
  • SoftChip Backup Loader: es un .dol que se baja por ahi y se corre con el HomeBrew Channel. Puedes seleccionar que IOS utilizar para correr un juego.
    Hemos utilizado el "multicios" para instalar "37 with ios 37 IOS 232" y seleccionar la IOS 232 desde el SoftChip.
    Tengo configuradas las opciones de fix 002, la de force WII region.
  • NeoGamma: utiliza la IOS249 que en realidad es el cIOS38 (rev 14)? metido como 249. (ver Instalar Cargador de Backup Respaldo en cualquier Wii). La release 6 (r6) permite activar el error 002 fix, error muy común, mejor tenerlo activado. La versión 7 la encontré como canal (WAD) pero no tiene el 002 fix.
  • Backup Launcher Channel - Backup Launcher 0.3 Gamma: lo tengo como un canal que lanza directamente los juegos, usa la misma CIOS que el NeoGamma (son muy parecidos).
  • DVDx: permite reproducir DVDs (originales, copias), avis, mp3, etc

Utilidades varias:

  • AnyTitle Deleter: sirve para explorar la wii y ver (y desinstalar) las IOS instaladas. Entre otras cosas. (Dicen que es muy peligrosa)?
  • Trucha Bug Restorer: se utiliza para meter el trucha bug en una IOS. The TBR is to get IOS with the trucha bug on all Wiis with system menu up to 4.1. Usually the error codes
    -1017 and -2011 indicate that the trucha bug is required and missing.
    Puntualmente lo hice en la 36 (lo mete en la IOS 249 para que lo use el NeoGamma)?. Los pasos fueron mas o menos así (video):
    1. Usar el IOS 36 para downgradear el IOS 15
    2. Usar el IOS 15 (recién downgradeado) para parchear el IOS 36
    3. Usar el IOS 36 para restorear el IOS15After you've followed the Steps you will be able installing cIOS by using IOS36.

  • Extraer WADs de los juegos:1. Extract them from game discs directly on your Wii using wufe: http://wiibrew.org/wiki/WUFE
    2. Download them at your PC with the NUS Downloader: http://wiibrew.org/wiki/NUS_Downloader
    3. Extract them from .iso files from backups you created yourself with Trucha Signer or WiiScrubber

Conceptos aprendidos:
  • Jugar juegos backups: Para poder jugar juegos copiados es necesario utilizar uno de los launchers mencionados arriba, y estos a la vez utilizan una determinada IOS modificada (cIOS?) para funcionar. Creo que suelen ser: IOS36, IOS37 modificadas. Instaladas como si mismas, o instaladas en otroa ubicación.
  • Qué son las actualizaciones: a menudo los juegos que ponemos, piden update por el canal disco. Esto significa que pisarán o agregarán alguna IOS que tenemos o nos falta. Por eso la importancia de no actualizar con juegos de otra norma que no sea la de la WII.
    Se pueden extraer los WAD para instalarlos a mano si se quisiera como ocurre con el GH5 donde pide un update que lo que instala es la IOS 56. Yo la extraje del juego y la instalé con el WADManager.
  • HomeBrew Channel: Es una aplicación creada por el Team Twiizers que nos permite cargar aplicaciones homebrew en una Wii. Una vez instalado el Homebrew Channel, aparecerá un canal en nuestras consolas desde el cual podremos cargar todo tipo de homebrew almacenado en una tarjeta SD (o via TCP/USB Gecko usando Wiiload)?. Básicamente hay que meter los .dol o .elf en una carpeta dentro de la carpeta apps que está en el raíz de la SD y aparecerá en el listado del HB al entrar al canal.
  • BootMII: es un loader que inicia con la wii (instalandola como boot2) o se instala como IOS. En ambos casos permite hacer backup completo de la WII (nand??+memoria+??) ocupa cerca de 512MB en la SD. Entonces, si se tiene como boot2, podemos volver al backup si brickeamos la WII. Tutorial.
  • Para que sirve cada IOS:
    IOS 38: es la que carga los juegos originales?
    IOS 222: se instala con el cIOS38_rev 17 installer, y lo que se pone en esa ubicación es la IOS38 mezclada con la 37
    IOS 202:
    IOS 249: es la que usa el NeoGamma, se instala con el cIOS38_rev 17 installer, y lo que se pone en esa ubicación es la IOS38 mezclada con la 60

Instalar Cargador de Backup Respaldo en cualquier Wii

  1. Instalar "HomeBrew Channel" mediante el "BannerBomb" (Descargar) Utilizando el "HackMii Installer" (Descargar, Tutorial)
  2. Instalar el ultimo cIOS de Waninkoko (14 es el Actual?) (Descargar cIOS38). Si no puedes instalar el cIOS tendrás que seguir Este Tutorial que indica como hacerlo usando el Trucha Bug Restorer.
  3. Ir al hilo del famoso Loader NeoGamma
  4. Descargar la ultima versión desde su hilo
  5. Ejecutarlo desde el HomeBrew
La ultima vez, en consola virgen 4.2U usé este post, que reultó mas claro que este, de todas formas, la WII tenía lectora D3-2 por lo que no lee juegos copiados.

Casos particulares para juegos que no funcionan

  • Para jugar al guitar hero 5:
    1. Launchear el "multicios"( es un .dol que se baja por ahi y se corre con el HomeBrew Channel )
    2. Desde el "multicios" instalar "37 with ios 37 IOS 232". Usar las flechas para seleccionar qué IOS with qué IOS en qué IOS.
    3. Luego usar el SoftChip Backup Loader (es un .dol que se baja por ahi y se corre con el HomeBrew Channel). Yo tengo la verión SoftChipR99 (versión release 99). Al ejecutar el SoftChip y seleccionar el IOS 232.
  • El rock band beatles:
    Corre con el NeoGamma sin problemas

sp_generate_inserts para sql server 2008

http://vyaskn.tripod.com/code/generate_inserts_2005.txt

stored procedure que crea inserts para una tabla X


Usage:
Example 1: To generate INSERT statements for table 'titles':
EXEC sp_generate_inserts 'titles'
Example 2: To ommit the column list in the INSERT statement: (Column list is included by default)
NOTE: If you have too many columns, you are advised to ommit column list, as shown below, to avoid erroneous results
EXEC sp_generate_inserts 'titles', @Include_Column_List = 0
Example 3: To generate INSERT statements for 'titlesCopy' table from 'titles' table:
EXEC sp_generate_inserts 'titles', 'titlesCopy'
Example 4: To generate INSERT statements for 'titles' table for only those titles which contain the word 'Computer' in them:
EXEC sp_generate_inserts 'titles', @From = "from titles where title like '%Computer%'"
Example 5: To specify that you want to include TIMESTAMP column's data as well in the INSERT statement:
NOTE: By default TIMESTAMP column's data is not scripted
EXEC sp_generate_inserts 'titles', @Include_Timestamp = 1
Example 6: To print the debug information:
EXEC sp_generate_inserts 'titles', @debug_mode = 1
Example 7: If you are not the owner of the table, use @owner parameter to specify the owner name:
NOTE: To use this option, you must have SELECT permissions on that table
EXEC sp_generate_inserts Nickstable, @owner = 'Nick'
Example 8: To generate INSERT statements for the rest of the columns excluding images:
NOTE: When using this otion, DO NOT set @include_column_list parameter to 0
EXEC sp_generate_inserts imgtable, @ommit_images = 1
Example 9: To generate INSERT statements for the rest of the columns excluding IDENTITY column:
EXEC sp_generate_inserts mytable, @ommit_identity = 1
Example 10: To generate INSERT statements for the top 10 rows in the table:
EXEC sp_generate_inserts mytable, @top = 10
Example 11: To generate INSERT statements only with the columns you want:
EXEC sp_generate_inserts titles, @cols_to_include = "'title','title_id','au_id'"
Example 12: To generate INSERT statements by ommitting some columns:
EXEC sp_generate_inserts titles, @cols_to_exclude = "'title','title_id','au_id'"
Example 13: To avoid checking the foreign key constraints while loading data with INSERT statements:
NOTE: The @disable_constraints option will disable foreign key constraints, by assuming that the source data is valid and referentially sound
EXEC sp_generate_inserts titles, @disable_constraints = 1
Example 14: To avoid scripting data from computed columns:
EXEC sp_generate_inserts MyTable, @ommit_computed_cols = 1

martes 24 de enero de 2012

BASH: Run tasks in the background

Run tasks in the background

bash lets you runone or more tasks in the background, and selectively suspend or resume any ofthe current tasks (or "jobs"). To run a task in the background, addan ampersand (&) to the end of its command line. Here's an example:
bash> tail -f /var/log/messages &
[1] 614
Eachtask back-grounded in this manner in assigned a job ID, which is printed to theconsole. A task can be brought back to the foreground with the command fgjobnumber, where jobnumber is the job IDof the task you wish to bring to the foreground. Here's an example:
bash> fg 1Alist of active jobs can be obtained at any time by typing jobs at the bash prompt.

miércoles 11 de enero de 2012

instalar git en centos

Instalando Git en Centos 5

Para comprobar si se tiene instalado Git, ejecutar:

git --version

Si no está instalado, puede instalarlo usando yum. Pero, en Centos 5, normalmente no está disponible un repositorio que contenga el paquete git.

Para comprobarlo, como usuario root, en la consola de comandos, ejecute:

yum install git

Obtendrá un mensaje que le dirá que el paquete git no está presente.

Puede agregar el repositorio EPEL (Extra Packages for Enterprise Linux), creando el archivo /etc/yum.repos.d/epel.repo:

/etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

Si se procediera a la instalación ahora, la instalación no se completaría porque yum solicitaría /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL.

Para prevenir eso, descargue ese archivo antes:

cd /etc/pki/rpm-gpg
wget http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL

Luego, ejecute:

yum install git git-daemon

Al final, debería aparecer una indicación de que el proceso se completó con éxito.

Para comprobar si se tiene instalado Git, ejecutar:

git --version

martes 10 de enero de 2012

backupear TODO el servidor MySQL


Para hacer el backup:
mysqldump --all-databases -p > mysql-dump.sql

Para restorear:
mysql < archivo.sql -p -u root

lunes 9 de enero de 2012

Localizing PHP web sites using gettext

Contenido de
http://mel.melaxis.com/devblog/2005/08/06/localizing-php-web-sites-using-gettext/


Developing multi language web sites using PHP is actually very easy. A common approach is having an include file for every supported language which contains an array that maps string ids to localized text (for example "WelcomeText" => "Welcome to our homepage." would be included using something like ). However there are several problems with this approach. First of all, when the application is updated and additional strings are added, there is no way to determine which new strings were added and if they are present in every language (unless you write a script for it). What happens if a newly added string is not yet translated into a specific language?

Using gettext with PHP

A widely used framework for internationalization is gettext. It can be used with a variety of programming languages, including PHP. There are basically two ways to use gettext in your PHP applications. You can use the native gettext PHP extension or you can use a library implemented in PHP that does not need any extension, such as php-gettext. I will use the native PHP extension, but once you have read the post you should be able to use the php-gettext-library, too (have a look at the included example).

Using gettext in your application

Using gettext to get translated strings couldn't be easier. Just call gettext("Text to be translated") and you get a localized version of "Text to be translated" if available, or "Text to be translated" otherwise. If you're lazy, you can use _() instead of gettext().
Let's try this out. Create a new PHP file (we'll call it test.php), and insert the following code:

echo _("Hello World!");
?>
When you open that page in your browser, you will see "Hello World!".

Localizing your application

Now that you have created a first version of your script, you may want to create localized versions for different languages. In order to do that, you either need the gettext utilities (windows version) or the graphical editor poEdit, which we will be using. So install and launch poEdit. Create a new catalog (File -> new catalog). Choose the language you want to translate the application to. I'm going to use German, GERMANY and iso-8859-1 for both character sets. The last option (plural forms) is an advanced feature of gettext which I'm going to explain later, so for now, just leave it blank. On the paths tab, set the base path to the directory containing your test.php file, and add "." as a path. On the keywords tab you can add names of additional functions that call gettext. You may want to use this if you're using php-gettext. Now click OK to open the save dialog. Now create a sub folder called "locale" in your script directory. Create a subdirectory inside locale for every language you support. We'll create one for "de_DE" (the first part is the language, the second part is the country). Inside that folder create another one called "LC_MESSAGES". You should now have a directory structure like locale/de_DE/LC_MESSAGES/. Save the file inside that directory as "messages.po". poEdit will now automatically scan all source files inside the path you specified earlier and extract all strings that are passed to gettext() or _() (or any other methods you may have added in the keywords tab). Click OK. Now that's cool! poEdit just extracted all strings you want to be localized.
In the upper half of the poEdit window, you have a list of strings (the original string on the left and your translation on the right). Select the first string in the list. In the lower left hand corner, you have 2 text boxes. The first one contains the original string, and the second one is still empty. Type your translation into that box. I'll enter "Hallo Welt!". If you had more entries in your file, you could navigate between them by pressing ctrl-up and ctrl-down. Save the file. poEdit automatically created "messages.mo" in the same directory as "messages.po". This is the compiled version that will later be used by PHP.

Initializing the gettext library

Let's see if our script can now display the localized string. The first thing you have to do is telling the gettext library which locale you want to use and where the language files are stored. Let's create a new file called "localization.php" that will handle all the gettext initialization. Copy the following code into localization.php (Note: this code is for the php gettext extension, php libraries such as php-gettext may require different initialization):

$locale = "de_DE";
if (isSet($_GET["locale"])) $locale = $_GET["locale"];
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
textdomain("messages");
?>
In the first line, we set the default locale to "de_DE". The second line allows you to override this by appending ?locale=... to the URL. You should replace this by real code to select the locale (perhaps by looking at the Accept-Language header), but it works for our tutorial. The next two lines actually set the current locale to that value and the bindtextdomain call creates a text domain which will use our messages.mo file in the locale directory. The textdomain function selects that domain as the default domain.
Include that file in your test.php by adding a require_once("localization.php"); line to the top of the file. Now reload test.php in your browser and it should now say "Hallo Welt!". Now try test.php?locale=en_US and it should say "Hello World!". You have just created a multi language PHP script!

Updating your application

Let's add another string to the script. I'll add echo _("Welcome to my test page");. When you reload the page with the German locale, you will see that Hello World is localized, while the second string is not. Let's change that. In poEdit (reopen the .po file if you have closed it), click the update button (that's the one with the wheel). A new dialog should show one new string. Click OK, translate it (in German it would be "Willkommen auf meiner Testseite") and save the file. Reload test.php in your browser. Nothing has changed? When using the PHP gettext extension, .mo files are cached by the gettext library. The only way I have found to clear the cache is to restart the web server. Once you have done that, both strings should be translated.

Using plurals

One last thing I want to discuss is gettext's plural support. This may seem a bit complicated at first, but is actually very powerful. Sometimes you need a string that supports plural forms. A typical example would be "0 comments", "1 comment", "2 comments", "3 comments"... In English you can just add an 's' if the number n != 1. However, in other languages it's not that easy. gettext supports all these cases. In your scripts you use something like this:

$n = 3;
printf(ngettext("%d comment", "%d comments", $n), $n);
?>
If you have never used (s)printf before, have a look at it's documentation. The interesting part is of course the ngettext call. ngettext takes three arguments. The first one is the singular string, the second one the plural string and the last one is the number. While that was quite easy, localizing these strings is a bit harder. Add the two lines to your test.php script.
Before you update your language file in poEdit, open the catalog options window (catalog -> options). Now let's fill in that last field. For our German locale, set the plural forms field to "nplurals=2; plural=(n != 1);". Essentially this specifies that there are two plural forms and the plural form is determined by the expression (n != 1). This evaluates to 0 if n == 1 and 1 if n != 1. For more information about this field, including samples for various languages, please see the gettext documentation. Now, let's press the update button again and select the new string. You will notice that the lower left hand corner of the window has changed. It now displays the original singular and plural forms and the translation box has been replaced by two (depends on the number of plural forms the language has). Enter "%d Kommentar" in the first tab and "%d Kommentare" in the second tab. Save the file, reload the web server if needed and your page should show the correct translation (you may want to change the value of $n to see the effect of the ngettext function).

Improving localization in your scripts

This concludes my introduction to localizing PHP web sites using gettext. Here are a few ideas to improve localization in your applications:
  • During development, you may want to use a php library instead of the PHP gettext extension because they do not require you to restart the web server every time you modify the language files. You can create a wrapper function (e.g. __()) that calls either the library function or the extension, depending on which is available or selected). You can add the name of the wrapper function as a keyword in poEdit, so that it is recognized.
  • You may want to select a default locale according to the browser's Accept-Language header, so that the user does not have to select his language first.

jueves 29 de diciembre de 2011

Agregar un APP tab en una fanpage

Crear la app en 
https://developers.facebook.com


Completar el "Page Tab Name" y el "Page Tab URL" en el panel llamado "Select how your app integrates with Facebook"

Adding an App to a Page

Facebook Page administrators can add your app directly to their Page by navigating to the following URL: https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL, where YOUR_APP_ID and YOUR_URL can be found in your app settings.


VER: https://developers.facebook.com/docs/appsonfacebook/pagetabs/




Un dato clave para evitar los scrolls en el tab
http://www.hyperarts.com/blog/facebook-iframe-apps-getting-rid-of-scrollbars/