Tags
Abstract Android Apache apt-get Art bash C++ calendar CentOS circuit CSS electronics emulator Excel ffmpeg FTP HTC http ImageMagick images ip javascript jquery LED linux math memory mvc MySQL nodejs PHP phpize PHP RAD Sharpy plaintext PostgreSQL Python resize root rotate security socketio ubuntu ui Windows yumCategories
Meta
Monthly Archives: November 2009
Python MySQL Associative Array
By default, the MySQLdb module to access a MySQL database returns the data as an integer indexed array. Sometimes this is not desirable and an associative array is preferred, such as the mysql_fetch_assoc function in PHP. In addition, we will … Continue reading
Python emulate mouse click in Windows
The following bit of code, which requires the win32api, simulates a mouse click using Python under the Windows OS. import win32api, win32con def click(x,y): win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0) click(100, 100) # simulate mouse … Continue reading
Posted in Python, Windows
Leave a comment
Windows Batch FTP Routine
Here is some example code to connect to an FTP server and run the commands that follow. @echo on %windir%\system32\ftp.exe -n -s:”%~f0″ server.com goto done user myusername mypassword cd /home/directory/public_html ls -al quit :done pause The key to this working … Continue reading
Python Print Screen and Save Image in Windows
So you need to do a “Print Screen” and save the image in the clipboard huh? I had that exact need too. Let me save you a few hours of trouble and tell you that the win32clipboard does not yet … Continue reading
Python Abstract Snow Art using PyGame
# # Abstract Random Snow Art # Copyright 2009 Travis Crowder # travis.crowder@spechal.com # Published under the MIT License # import pygame, sys, random from pygame.color import THECOLORS pygame.init() screen = pygame.display.set_mode([640,480]) screen.fill([0,0,0]) for i in range(1, 2500): top = … Continue reading
Python Abstract Box Art using PyGame
# # Abstract Random Box Art # Copyright 2009 Travis Crowder # travis.crowder@spechal.com # Published under the MIT License # import pygame, sys, random from pygame.color import THECOLORS pygame.init() screen = pygame.display.set_mode([640,480]) screen.fill([0,0,0]) for i in range(1, 100): width = … Continue reading
C++ Read from a file using fstream
/** Read from a file (version 1) Copyright 2009 Travis Crowder travis.crowder@spechal.com Published under the MIT License */ #include <iostream> #include <fstream> #include <string> int main(int argc, char* argv[]){ // create the file handle, opening the file std::fstream myFile("text.txt", std::ios::in); … Continue reading
C++ Write to a file using fstream
/** Write to a file (version 1) Copyright 2009 Travis Crowder travis.crowder@spechal.com Published under the MIT License */ #include <iostream> #include <fstream> int main(int argc, char* argv[]){ // create the file handle, opening the file as well std::fstream myFile("text.txt", std::ios::out); … Continue reading
Posted in C++
Leave a comment
C++ Palindrome Checker
/** Palindrome Checker Copyright 2009 Travis Crowder Published under the MIT License */ #include <iostream> #include <algorithm> #include <string> bool isPalindrome(const std::string theWord); int main(int argc, char* argv[]){ std::string theWord; if(!argv[1]){ std::cout << "Enter the word to check: "; std::cin … Continue reading
PHP function to validate MySQL UUID or GUID
/** * Function to validate a generated GUID / UUID * @param string $guid GUID * @return bool */ function validGUID($guid){ return preg_match(‘#^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$#’, $guid); } Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers … Continue reading
