En Mysql hay un montón de funciones que tienen que ver con el manejo de horas/fechas... pero en ms sql me ha costado bastante encontrar documentación que me ayude.
El enlace: http://www.michael-thomas.com/tech/mssql/survival_guide_functions.htm#Date_/_Time_Functions
viernes, 26 de marzo de 2010
martes, 23 de marzo de 2010
Olvidaré en 10 minutos cómo cambiar la resolución de la pantalla fácilmente
Al cambiar de tele, me encontré con el problema de que la resolución no tenía nada que ver en la pantalla de la nueva y como se veía después en la tele del cuarto. Para solucionarlo vi que lo mejor era poder cambiar la resolución fácilmente según se fuera a ver en un sitio o en otro.
Me encontré con recetas que hacían uso del run32dll.exe y el deskcp16.dll, pero no terminó de convencerme porque esta dll no venía de serie en el xp. La solución era una linea de comenado como esta:
RUNDLL.EXE DESKCP16.DLL,QUICKRES_RUNDLLENTRY 800x600x32
La mejor solución que encontré fue una aplicación gratuita y sencilla de línea de comando que lo hace perfectamente: qres (http://go.to/aksoftware/)
Ejemplos de uso:
qres.exe /x:640 Changes resolution to 640 x 480.
qres.exe /x 1280 /y 1024 Changes resolution to 1280 x 1024. (If your graphics card supports it)
qres.exe /c:8 Changes color resolution to 256 colors.
qres.exe /c:16 Changes color resolution to high color (16 bit).
qres.exe /c:24 Changes color resolution to true color (24 bit).**
qres.exe /r:0 Changes the refresh rate to Adapter Default.*
qres.exe /r:-1 Changes the refresh rate to Optimal.*
qres.exe /r:80 Changes the refresh rate to 80 Hz.
* Windows 95/98/Me only.
Con esto, dos accesos directos en el escritorio harán el resto
Me encontré con recetas que hacían uso del run32dll.exe y el deskcp16.dll, pero no terminó de convencerme porque esta dll no venía de serie en el xp. La solución era una linea de comenado como esta:
RUNDLL.EXE DESKCP16.DLL,QUICKRES_RUNDLLENTRY 800x600x32
La mejor solución que encontré fue una aplicación gratuita y sencilla de línea de comando que lo hace perfectamente: qres (http://go.to/aksoftware/)
Ejemplos de uso:
qres.exe /x:640 Changes resolution to 640 x 480.
qres.exe /x 1280 /y 1024 Changes resolution to 1280 x 1024. (If your graphics card supports it)
qres.exe /c:8 Changes color resolution to 256 colors.
qres.exe /c:16 Changes color resolution to high color (16 bit).
qres.exe /c:24 Changes color resolution to true color (24 bit).**
qres.exe /r:0 Changes the refresh rate to Adapter Default.*
qres.exe /r:-1 Changes the refresh rate to Optimal.*
qres.exe /r:80 Changes the refresh rate to 80 Hz.
* Windows 95/98/Me only.
Con esto, dos accesos directos en el escritorio harán el resto
viernes, 19 de marzo de 2010
Olvidaré en 10 minutos cómo hice un usb instalador de windows xp
El artículo qu seguí: http://www.jcmiras.net/surge/p96.htm
El artículo original que ellos referencian: http://www.eeeguides.com/2007/11/installing-windows-xp-from-usb-thumb.html
Copia de su artículo:
How to Install Windows xp using USB Flash Disk
Date
You will badly need this if your computer has no CD-ROM drive, especially for ASUS EEE-PC and Red fox Wizbook 800.
What you need:
- USB thumb drive with at least 1 GB of capacity. High speed is not necessary but preferred.
- usb_prep8 (download it here) and bootsect (download it here)
- a personal computer or laptop with Windows Xp or Vista installed and with CD-ROM. (so, you have now two computers – one with xp/vista installed and one with NO CD-ROM)
- A genuine copy of Windows XP or Vista.
Procedure (for copying XP to USB and configuring USB for installing XP)
1. extract usb_prep8 and bootsect.
2. In usb_prep8 folder. Double click usb_prep8.cmd. A command prompt will open.
3. Press any key to continue. A PeToUSB window will open;
4. Don’t change anything in the PeToUSB window, just click “Start”. Formatting of your USB will then start. It will only take a few seconds.
5. DO NOT close the two windows (PetoUSB and usb_prep8). Now open a new command prompt by typing “cmd” in the Start->Run box. In this NEW command prompt, go to the directory where bootsect.exe is saved. Now type “bootsect.exe /nt52 R:“. Change “R” with the letter drive directory of your USB drive. NOTE: When running the bootsect.exe command you cannot have any windows open displaying the content of your USB stick. If all went well you should see “Bootcode was successfully updated on all targeted volumes.” Now close this command prompt (Still, Do not close usb_prep8).
6. Now close PeToUSB window. You should see the usb_prep8 command like this;
7. Now you need to enter the correct information for numbers 1-3.
Press 1 and then enter. A folder browse window will open for you to browse to the location of you XP setup files (aka your cdrom drive with xp cd in it)
Press 2 and enter a letter NOT currently assigned to a drive on your PC, say T
Press 3 and enter the drive letter of your USB stick
Press 4 to start the process.
8. The script will ask you if its ok to format drive T:. This is just a temp drive the program creates to cache the windows installation files. Press Y then enter.
9. Once it’s done formatting, press enter to continue again, you will now see the program copying Windows XP files from your CD to the temp drive it created. This will take around 3-5 minutes. Once this is done press enter to continue again.
10. Next you will see a box pop up asking you to copy the files from temp drive to USB drive. Of course, click “Yes”. This will take around 15 minutes, depending on the speed of your USB. In my case, it took around 30 Minutes.
11. Once the program has completed copy files a popup window asking if you would like to USB drive to be preferred boot drive U: select YES on this window
12. You’re done with this part. Now select yes to unmount the virtual drive.
Procedure 2 (Installing XP into your PC without CD-ROM using USB thumb drive)
1. Insert your USB then start your PC, then go to BIOS set-up. Set USB as your primary boot device. For EEE PC, if it did not boot on the USB after doing this, there is an option in the BIOS where you can change the primary and secondary memory, set USB as the primary. When doing this, I also changed the OS installation from “finished” to “start” just to make sure that the installation will work.
2. On the startup menu you have two options, select option number for text mode setup.
3. From this point on, it is just like any other windows XP installation. When prompt, delete all the partition, including the one with labeled “BIOS” for EEE-PC. Recreate the primary partition on your EEE pc and format it using NTFS.
4. Once the text mode portion of setup is complete, the computer will reboot. This time, boot into the GUI mode.
5. Once the GUI portion of setup is complete you will again have to boot into GUI mode to complete the XP installation until you end up at your XP desktop. It is very important that you DO NOT REMOVE THE USB STICK before this point. Once you can see your start menu it is safe to remove the usb stick and reboot your pc to make sure everything worked.
That is all, I didn’t encounter a problem during my installation of XP for my Asus EEE-PC 4G. Just strictly follow the procedures discussed above.
All of these were derived from http://www.eeeguides.com/2007/11/installing-windows-xp-from-usb-thumb.html
El artículo original que ellos referencian: http://www.eeeguides.com/2007/11/installing-windows-xp-from-usb-thumb.html
Copia de su artículo:
How to Install Windows xp using USB Flash Disk
Date
You will badly need this if your computer has no CD-ROM drive, especially for ASUS EEE-PC and Red fox Wizbook 800.
What you need:
- USB thumb drive with at least 1 GB of capacity. High speed is not necessary but preferred.
- usb_prep8 (download it here) and bootsect (download it here)
- a personal computer or laptop with Windows Xp or Vista installed and with CD-ROM. (so, you have now two computers – one with xp/vista installed and one with NO CD-ROM)
- A genuine copy of Windows XP or Vista.
Procedure (for copying XP to USB and configuring USB for installing XP)
1. extract usb_prep8 and bootsect.
2. In usb_prep8 folder. Double click usb_prep8.cmd. A command prompt will open.
3. Press any key to continue. A PeToUSB window will open;
4. Don’t change anything in the PeToUSB window, just click “Start”. Formatting of your USB will then start. It will only take a few seconds.
5. DO NOT close the two windows (PetoUSB and usb_prep8). Now open a new command prompt by typing “cmd” in the Start->Run box. In this NEW command prompt, go to the directory where bootsect.exe is saved. Now type “bootsect.exe /nt52 R:“. Change “R” with the letter drive directory of your USB drive. NOTE: When running the bootsect.exe command you cannot have any windows open displaying the content of your USB stick. If all went well you should see “Bootcode was successfully updated on all targeted volumes.” Now close this command prompt (Still, Do not close usb_prep8).
6. Now close PeToUSB window. You should see the usb_prep8 command like this;
7. Now you need to enter the correct information for numbers 1-3.
Press 1 and then enter. A folder browse window will open for you to browse to the location of you XP setup files (aka your cdrom drive with xp cd in it)
Press 2 and enter a letter NOT currently assigned to a drive on your PC, say T
Press 3 and enter the drive letter of your USB stick
Press 4 to start the process.
8. The script will ask you if its ok to format drive T:. This is just a temp drive the program creates to cache the windows installation files. Press Y then enter.
9. Once it’s done formatting, press enter to continue again, you will now see the program copying Windows XP files from your CD to the temp drive it created. This will take around 3-5 minutes. Once this is done press enter to continue again.
10. Next you will see a box pop up asking you to copy the files from temp drive to USB drive. Of course, click “Yes”. This will take around 15 minutes, depending on the speed of your USB. In my case, it took around 30 Minutes.
11. Once the program has completed copy files a popup window asking if you would like to USB drive to be preferred boot drive U: select YES on this window
12. You’re done with this part. Now select yes to unmount the virtual drive.
Procedure 2 (Installing XP into your PC without CD-ROM using USB thumb drive)
1. Insert your USB then start your PC, then go to BIOS set-up. Set USB as your primary boot device. For EEE PC, if it did not boot on the USB after doing this, there is an option in the BIOS where you can change the primary and secondary memory, set USB as the primary. When doing this, I also changed the OS installation from “finished” to “start” just to make sure that the installation will work.
2. On the startup menu you have two options, select option number for text mode setup.
3. From this point on, it is just like any other windows XP installation. When prompt, delete all the partition, including the one with labeled “BIOS” for EEE-PC. Recreate the primary partition on your EEE pc and format it using NTFS.
4. Once the text mode portion of setup is complete, the computer will reboot. This time, boot into the GUI mode.
5. Once the GUI portion of setup is complete you will again have to boot into GUI mode to complete the XP installation until you end up at your XP desktop. It is very important that you DO NOT REMOVE THE USB STICK before this point. Once you can see your start menu it is safe to remove the usb stick and reboot your pc to make sure everything worked.
That is all, I didn’t encounter a problem during my installation of XP for my Asus EEE-PC 4G. Just strictly follow the procedures discussed above.
All of these were derived from http://www.eeeguides.com/2007/11/installing-windows-xp-from-usb-thumb.html
lunes, 8 de marzo de 2010
Olvidaré en 10 minutos cómo trabajar con Excel desde Python
Dos opciones:
- teniendo Excel instalado en la máquina, haciendo uso de win32com (http://www.chuidiang.com/chuwiki/index.php?title=Crear_un_Excel_desde_Python).
Básicamente:
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlApp.Workbooks.Add()
xlApp.ActiveSheet.Cells(1,1).Value = "Hola mundo"
xlApp.ActiveWorkbook.SaveAs("c:/prueba1.xls")
- sin necesidad de excel en la máquina, instalando las librerías xlrd (http://pypi.python.org/pypi/xlrd), xlwt (http://pypi.python.org/pypi/xlwt), xlutils (http://pypi.python.org/pypi/xlutils).
Documentación: http://python-excel.googlegroups.com/web/python-excel.pdf?gda=pFYdqkIAAABRiJTlwwehyMNAo-CHt3UFZXiYgQj2n31qbP2Oi98l4dXEtWX7y7b6ByPnawQ3OxpV4u3aa4iAIyYQIqbG9naPgh6o8ccLBvP6Chud5KMzIQ
Esto se ha usado para la generación de los XLS que se envían a Administración con el resumen de trasnmisiones mensuales (originalmente, ejecutándose en auxtecserver)
- teniendo Excel instalado en la máquina, haciendo uso de win32com (http://www.chuidiang.com/chuwiki/index.php?title=Crear_un_Excel_desde_Python).
Básicamente:
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlApp.Workbooks.Add()
xlApp.ActiveSheet.Cells(1,1).Value = "Hola mundo"
xlApp.ActiveWorkbook.SaveAs("c:/prueba1.xls")
- sin necesidad de excel en la máquina, instalando las librerías xlrd (http://pypi.python.org/pypi/xlrd), xlwt (http://pypi.python.org/pypi/xlwt), xlutils (http://pypi.python.org/pypi/xlutils).
Documentación: http://python-excel.googlegroups.com/web/python-excel.pdf?gda=pFYdqkIAAABRiJTlwwehyMNAo-CHt3UFZXiYgQj2n31qbP2Oi98l4dXEtWX7y7b6ByPnawQ3OxpV4u3aa4iAIyYQIqbG9naPgh6o8ccLBvP6Chud5KMzIQ
Esto se ha usado para la generación de los XLS que se envían a Administración con el resumen de trasnmisiones mensuales (originalmente, ejecutándose en auxtecserver)
Olvidaré en 10 minutos cómo conseguir las url de videos de la Sexta
Para pillar los enlaces de los videos de la Sexta (miSexta.tv).
Usar Firefox, con el Firebug instalado y activo
Cargar la página de la sexta
Navegar hasta el video que queremos
Observar los elementos que se van cargando en el Firebug: primero se cargará una publicidad, estar atentos cuando cargue lo siguiente, que será un enlace del tipo: http://lasexta.edgeboss.net/flash/lasexta/buenafuente/hd/bfn_05_03_10_01.mp4. Este enlace se corresponde con un XML que él procesa para hacer el streaming. El fichero en sí está en el mismo enlace, pero cambiando "/flash/" por "/download/", es decir en http://lasexta.edgeboss.net/download/lasexta/buenafuente/hd/bfn_05_03_10_01.mp4.
Más detalles: el nombre del fichero en sí tiene su explicación, aunque parece que cada programa tiene su peculiaridad: IDPROG_DIA_MES_AÑO_PARTE.mp4. Algunos IDPROG: bfn=buenafuente
Para el intermedio: http://lasexta.edgeboss.net/flash/lasexta/elintermedio/hd/int_04_03_10_01_04_03_10_01.mp4 (por alguna razón auí se repite dia_mes_año_parte)
Para salvados: http://lasexta.edgeboss.net/flash/lasexta/salvados/hd/ppd0000884006401_salvados_64_28_02_2010_01_h264.mp4 (no sé qué es el ppd... ni el 64, después es 28=DIA, 02=MES, 2010=AÑO, 01=parte.; el de otro día: http://lasexta.edgeboss.net/flash/lasexta/salvados/hd/ppd0000884006201_salvados_62_14_02_2010_01_h264.mp4 (...este no parece muy claro...)
Uno de los enlaces que me aclaró cosas: http://blog.tvalacarta.info/2010/03/04/como-descargar-videos-de-misexta-tv-la-sexta/
Usar Firefox, con el Firebug instalado y activo
Cargar la página de la sexta
Navegar hasta el video que queremos
Observar los elementos que se van cargando en el Firebug: primero se cargará una publicidad, estar atentos cuando cargue lo siguiente, que será un enlace del tipo: http://lasexta.edgeboss.net/flash/lasexta/buenafuente/hd/bfn_05_03_10_01.mp4. Este enlace se corresponde con un XML que él procesa para hacer el streaming. El fichero en sí está en el mismo enlace, pero cambiando "/flash/" por "/download/", es decir en http://lasexta.edgeboss.net/download/lasexta/buenafuente/hd/bfn_05_03_10_01.mp4.
Más detalles: el nombre del fichero en sí tiene su explicación, aunque parece que cada programa tiene su peculiaridad: IDPROG_DIA_MES_AÑO_PARTE.mp4. Algunos IDPROG: bfn=buenafuente
Para el intermedio: http://lasexta.edgeboss.net/flash/lasexta/elintermedio/hd/int_04_03_10_01_04_03_10_01.mp4 (por alguna razón auí se repite dia_mes_año_parte)
Para salvados: http://lasexta.edgeboss.net/flash/lasexta/salvados/hd/ppd0000884006401_salvados_64_28_02_2010_01_h264.mp4 (no sé qué es el ppd... ni el 64, después es 28=DIA, 02=MES, 2010=AÑO, 01=parte.; el de otro día: http://lasexta.edgeboss.net/flash/lasexta/salvados/hd/ppd0000884006201_salvados_62_14_02_2010_01_h264.mp4 (...este no parece muy claro...)
Uno de los enlaces que me aclaró cosas: http://blog.tvalacarta.info/2010/03/04/como-descargar-videos-de-misexta-tv-la-sexta/
Olvidaré en 10 minutos como reproducir flv/mp4 directamente desde una página mía
Necesitaba dos cosas:
- poder reproducir automáticamente mp4/flv en El Juego, para cuando no es de youtube
- para poder hacer páginas de "contenidos a la carta", apuntando a videos externos sin depender de las páginas de las teles, donde hay que ir navegando por un montón de enlaces hasta empezar a ver el video.
La clave: el JWPLAYER (gratuito):
Instrucciones de uso: http://www.longtailvideo.com/support/tutorials/Installation-Instructions
Para las opciones de uso, hay un wizard: http://www.longtailvideo.com/support/jw-player-setup-wizard
Explicaciones de todos los posibles parámetros (** MUY BUENA **): http://developer.longtailvideo.com/trac/wiki/Player5FlashVars
Otros enlaces más genéricos de donde acabé sacando las conclusiones:
- http://hubpages.com/hub/Embed-SWF-FLV-MP4-Flash-Video
- http://www.liverpoolway.co.uk/forum/tnf-techy-nerd-forum/64196-playing-embedding-mp4-videos-web-pages.html
- http://labnol.blogspot.com/2006/08/how-to-embed-flv-flash-videos-in-your.html
Ejemplo de aplicación: Crear una página que apuntará al último programa de Buenafuente. Crearemos una lista de reproducción con las 4 partes del programa y con las opciones haremos que se vayan ejecutando una tras otra, sin tener que ir dando al play cada vez (para esto es importante la opcion "so.addVariable('repeat','list');"
NOTA: se han suprimido los "<" y ">" que rodeaban a cada script porque daba error el blog
- poder reproducir automáticamente mp4/flv en El Juego, para cuando no es de youtube
- para poder hacer páginas de "contenidos a la carta", apuntando a videos externos sin depender de las páginas de las teles, donde hay que ir navegando por un montón de enlaces hasta empezar a ver el video.
La clave: el JWPLAYER (gratuito):
Instrucciones de uso: http://www.longtailvideo.com/support/tutorials/Installation-Instructions
Para las opciones de uso, hay un wizard: http://www.longtailvideo.com/support/jw-player-setup-wizard
Explicaciones de todos los posibles parámetros (** MUY BUENA **): http://developer.longtailvideo.com/trac/wiki/Player5FlashVars
Otros enlaces más genéricos de donde acabé sacando las conclusiones:
- http://hubpages.com/hub/Embed-SWF-FLV-MP4-Flash-Video
- http://www.liverpoolway.co.uk/forum/tnf-techy-nerd-forum/64196-playing-embedding-mp4-videos-web-pages.html
- http://labnol.blogspot.com/2006/08/how-to-embed-flv-flash-videos-in-your.html
Ejemplo de aplicación: Crear una página que apuntará al último programa de Buenafuente. Crearemos una lista de reproducción con las 4 partes del programa y con las opciones haremos que se vayan ejecutando una tras otra, sin tener que ir dando al play cada vez (para esto es importante la opcion "so.addVariable('repeat','list');"
NOTA: se han suprimido los "<" y ">" que rodeaban a cada script porque daba error el blog
script type='text/javascript' src='swfobject.js' /scriptThis text will be replacedscript type='text/javascript' var so = new SWFObject('player.swf','mpl','470','470','9');so.addParam('allowfullscreen','true');so.addParam('allowscriptaccess','always');so.addParam('wmode','opaque');so.addVariable('playlistfile','ayer.xml');so.addVariable('playlist','bottom');so.addVariable('repeat','list');so.write('mediaspace'); /script
Suscribirse a:
Entradas (Atom)