Database PHP

Export picture from mysql database to file

[amazonify]032152599X:left[/amazonify]
As our data getting mobile and copying picture is annoying for me I decide to save the picture in the database (mysql).

Another challenge came when other division need the data exported in a directory with same dimension (135 x 180 pixel).

Structure for table ‘student_pic’  :

CREATE TABLE `student_pic` (
  `image_id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(50) NOT NULL default ”,
  `image_type` varchar(50) NOT NULL default ”,
  `image` longblob NOT NULL,
  `image_size` bigint(20) NOT NULL default ’0′,
  `image_name` varchar(255) NOT NULL default ”,
  `image_date` datetime NOT NULL default ’0000-00-00 00:00:00′,
  UNIQUE KEY `image_id` (`image_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3385 ;

Yes, I use mysql 5 ( 5.0.45)

read more »

Database

Get table diff with sqlyog

As the job area getting bigger and bigger, new tables created and others table get normalize. It’s often to see adding field or remove some field from table.

Development phase also take some place and different computer.  Need more time to get ‘whats new‘ in table structure.

An illustration for example :

Working to make database for book application. Location for developing are in the office and house. This example will show how to get table diff for table at home versus office table.

Database test1 (at office) already have table named ‘book‘.

Structure of this table contains :

id (Int 11), auto increment

book_name (varchar 100)

book_author (varchar 100)

  Get table diff with sqlyog

I dump this structure for my computer at home. At home I made database test2.

read more »

Software

Free SnagIt from TechSmith : go get one for yourself now!

Just got another news from TechSmith, beside giving away Camtasia for free, they also give SnagIt for free too.

For novice user, process from download to installation process follow these steps :

1. Download SnagIt version 7.8.5 by clicking here

2. Get your licence key by click here

3. Install SnagIt by clicking downloaded file.

read more »

Software

Disposable email : hated by spammer, loved by everyone

I feel ugly when my friend ask me which disposable email provider I use often.

For step by step guide for using this service you may refer to this post.

Using temporer email address to fight spam

Looking to uncle google for help, I get definition from wikipedia and list of disposable email providers, here the lists :

  • Mailinator, give widget too.
  • MyTrashMail, you the boss. signup option also available.
  • GuerillaMail, my fav at first sight, they  lets you generate a temporary email which expires in a time of 15 minutes
  • SpamHole , 2 hours email address.
  • SpamBox , you set the lifespan of your mail adress.
  • SpamFree24, 24 hours ready to serve.
  • 10MinuteMail , the name say it, only 10 minutes.
  • MailExpire, give option for choose between 12 hours or 3 months expiry email address. If your provider seem strict with email icon smile Disposable email : hated by spammer, loved by everyone
  • TemporaryInbox
  • MailEater, eat your mail icon smile Disposable email : hated by spammer, loved by everyone
  • Jetable, forward option to real email available
  • KasMail, choose around 25 @ address
  • SpamMotel, you can use it with your outlook or other desktop email client.
  • GreenSloth, 1 week lifespan.
  • AnonInbox, simple as the name.
  • DontReg is one bigger, better, faster and safer temporary email inbox solution
  • TempoMail
  • TempEmail, fast and secure.
  • PookMail, if you like email in multi language.
  • mintemail, 4 hours email address.
  • Bugmenot, bypass compulsory registration.
  • TempInbox, available in many language.
  • SpamGourmet, free disposable email addresses, strong spam blocker, short learning curve, need registration.
  • dodgeit
  • nobulk, offers anonymous email accounts.
  • spamavert, autocreated address.
  • 2Prong, easy disposable email.
  • spaml
  • emailmiser, create address you want.
  • spamify, 15 minutes address lifespan.
  • Cosmorph, Free Disposable Email Address, Create it, use it, abandon it, repeat as necessary. 2 GB space per adress.

Last Update : December 2 2007.

Have other provider, let me know and I’ll update the lists.

Cool service icon smile Disposable email : hated by spammer, loved by everyone

Next time my friend ask me I already have the answer icon wink Disposable email : hated by spammer, loved by everyone

Continue to read this article, very nice.

Software

Free Camtasia 3 from Techsmith

Just find the news icon smile Free Camtasia 3 from Techsmith

Techsmith, give camtasia studio for free.

Hers’s steps to get free version :

  1. Download free version by click this link.
  2. Get your key for legitimate, click here. make sure you enter good email address. Licence key will sent to your email address.
  3. Install the software.

Installing free version is easy, see these screenshots for overview :

1. Doule click installer to start installing.

read more »

Virtualization

VirtualBox : 101 way

As new player in virtualization field VirtualBox already reach version 1.5.2 .

What VirtualBox have done so far?

Is it good as vmware or Virtual PC?

Dunno, by seeing its implementation You can judge icon smile VirtualBox : 101 way

Googling and forum searching, I found :

  1. Create and Manage Virtual Machines Using VirtualBox, VirtualBox is a general-purpose full virtualizer for x86 hardware. Targeted at server, desktop and embedded use, it is now the only professional-quality virtualization solution that is also Open Source Software.
  2. Installing VirtualBox On Ubuntu, this tutorial shows how you can install InnoTek’s VirtualBox on a Ubuntu desktop. With VirtualBox you can create and run guest operating systems ("virtual machines") such as Linux and Windows under a host operating system.
  3. How to install Ubuntu Studio in Windows using VirtualBox – a complete walkthrough, This tutorial will take you every single step of the way through installing Ubuntu Studio using VirtualBox for Windows. In other words, even your parents should be able to follow along.
  4. VirtualBox On FC6 / CentOS 4 / OpenSuSE 10.2,  
  5. Minimal VirtualBox VRDP Setup – a quick guide, VRDP lets you run a headless server and access the VMs via RDP.
  6. Set up a DOS VM with CDROM & network card & browser. Play DOS in VM.
  7. CloneVDI Tool, a small GUI programm to help cloning the installed VDIs. 
  8. Making VirtualBox public, forward port for public. 
  9. NATing with VirtaulBox and NetworkManager,

Do you build your server with virtualbox, email server  or perhaps dns server?

Share with us.

Linux Unix Web Server

Learning .htaccess : 101 way

My friend got suprised when he see login page on phpmyadmin. It’s not usual form for login as he used to login for.

Well, another postfixadmin admin page also show login page. He ask  me to list all tutorial around .htaccess to show for his learning study.

Like I did in Cisco Lab Topology, Cisco Resources or Ipfw Resources , I think I search google too for existing tutorial, Learning On Demand rules icon smile Learning .htaccess : 101 way

Here’s what I found so far :

  1. .htaccess Tips and Tricks  part I creating this hidden file in the root folder (or any sub folder) of your website, it is possible to set/unset almost all the server directives that can be set in the apache main configuration file. And these changes will take effect only for the root folder in which you created the file and its sub folders. Thus .htaccess file plays an important role in providing fine-grained control to an individual managing a website without giving blanket control of the web server.
  2. .htaccess Tips and Tricks  part II, the arcane mysteries of URL rewriting.
  3. Hotlink test for image, find out if your .htaccess protect your images.
  4. Setting Up .htaccess, htaccess can be used in co-ordination with the Apache web server to password protect certain files and directories on your web server.
  5. .htaccess file generator, create .htaccess file online.
  6. How to Configure Your Website Using Htaccess in Linux with Apache, .htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.
  7. HOWTO php.ini overrides with .htaccess,
    in smaller environments where there are only a few developers and a single product there is seldom a need for different values of a php.ini setting. however, depending on how esoteric some of the developers in your group are, or how many projects you have going simultaneously, or how many devs you have working on the same box or you have production and development running on the same box or whatever; you may at some point find a need to have different values for certain php.ini settings for different environments hosted on a single server. the good news is, if youre running apache, php has integrated support for this need.
    .htaccess overrides are especially attractive in shared hosting environments where there is a high likelihood different clients will want different settings for php.ini directives.
  8.  .htaccess Based Authentication On Subdirectories.

 

last update :  November 22 2007

Blog

* Status Line : a few wp plugin to make your blog more interactive

Have you ever think to show a message for your wordpress blog  with firefox popup blocker style but don’t know how to do that easily ?

Well, look no further since a few wordpress plugin for that purpose already created by a few talented man icon smile * Status Line : a few wp plugin to make your blog more interactive

  1. CA-StatusLine, developed by Cosa Aranda. He made this plugin to give his blog visitor fresh announcement or some urgent news. Go visit this link to download his plugin. You may change the message by edit plugin file manually.
  2. Limosin Creative Status Line, developed by Ardy Hidayat. Based on CA-StatusLine with a few enhancements :
  • Status Line follow the page, if you scroll down the page you still see the message.
  • You may change the message from Option section in wp-admin. Very neat.

Which one do you choose?

Depend on your preference icon smile * Status Line : a few wp plugin to make your blog more interactive

P.S : Click here to download Limosin Creative Status Line.

I wish I have more time to extend my rthanks plugin for change the message and option via wp-admin too icon smile * Status Line : a few wp plugin to make your blog more interactive

Back to server.

Unix

101 FreeBSD Ipfw resources

"Which firewall do you like most in FreeBSD?", my friend ask me.

Hmmm….

Not sure, at first time I use ipfw and already put some collection of useful link, in my bookmark icon smile 101 FreeBSD Ipfw resources

Since pfsense use pf and freebsd itself include pf in native make me think to recall the link into of ipfw for this blog icon wink 101 FreeBSD Ipfw resources

  1. Ipfw FreeBSD handbook. More than enough, start from configuring, command, rule sets, examples.
  2. Firewall setup, howto secure and share a internet connection on FreeBSD with a stateful ipfw firewall rules, network address translation (NAT) daemon (natd) with a traffic shaping using dummynet to divide the bandwidth evenly betwain all clients.
  3. Invisible Bridging Firewalls Using ipfw and FreeBSD 4.x, this document is NOT an ipfw tutorial – it is simply a step by step guide to the installation of an invisible bridging
    firewall on the FreeBSD 4.x operating system.  Also included are methods to use this firewall in a non-invisible setting and
    some sample ipfw rules.
  4. FreeBSD Firewall Explained, howto setup a ipfw stateful firewall on FreeBSD with a simple ruleset and explain certain details, including natd interaction.
  5. Setting up a FreeBSD Wireless Access Point, this article describes how to set up an open wireless access point on FreeBSD 4.9 including the creation of a "captive portal" and bandwidth limiting using IPFIREWALL.
  6.  FreeBSD snort IDS installation, the steps for installing an IDS sensor on FreeBSD 5.4. This document contains the small differences between
    FreeBSD 5.4 and FreeBSD 6.0
  7. Walled Garden: FreeBSD + natd + ipfw + squid , overview of the steps it takes to create a Walled Garden using FreeBSD, natd, ipfw and squid.
  8. Mini tutorial: FreeBSD ipfw bandwidth rate limiting,
  9. Armoring FreeBSD, ipfw section.
  10. Asterisk firewall rules, This is an example on how to configure a FreeBSD IPFW firewall for Asterisk.
  11. WIPFW, WIPFW is a MS Windows operable version of IPFW for FreeBSD OS. You can use the same functionality and configure it as only you work with IPFW. IPFW is a packet filtering and accounting system which resides in the kernelmode, and has a user-land control utility, ipfw. Together, they allow you to define and query the rules used by the kernel in its routing decisions. There are two related parts to ipfw. The firewall section performs packet filtering. There is also an IP accounting section which tracks usage of the router, based on rules similar to those used in the firewall section. This allows the administrator to monitor how much traffic the router is getting from a certain machine, or how much WWW traffic it is forwarding, for example.
  12. FreeBSD Dummynet, especially as a transparent bridge network impairment
  13. Ipfw-Advanced-Supplement-HOWTO
  14. Some Basic IPFW Rules to get you Started, This should cover basic IPFW rules. It will be enough to get your server running. #Only log 1000 lines, this is incase of DDoS so your machine is not
  15. Implementing Pushback: Router-Based Defense Against DDoS Attacks …
  16. ipfw Rules, a set of ipfw rules to customize for your own Macs or FreeBSD systems
  17. Help Build The Best IPFW Firewall Rules Sets Ever
  18. IPFW Configuration Help, The following is a ‘short list’ of the things that need to be accomplished to get ipfw running on your computer 
  19. Router with ipfw, Configure a router with FreeBSD.
  20. Firewall Builder, Object-oriented GUI and set of compilers for various firewall platforms. Currently implemented compilers for iptables, ipfilter, OpenBSD pf, ipfw, Cisco PIX firewall and routers access lists.
  21. A bare bones home firewall, this is a bare bones, protect-this-machine-only firewall and will work fine if you have no network behind your FreeBSD machine and no special needs.
  22. A fancy home firewall, If you’ve got a home network or are running any sort of network server that you want open to the internet.

I’ll add more link, maybe you can share your fav

Updated : November 22 2007

Unix

zombie and defunct

tp# top
last pid: 23639;  load averages:  0.00,  0.00,  0.00
                             up 13+06:57:13  13:53:54
65 processes:  1 running, 63 sleeping, 1 zombie
CPU states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Mem: 181M Active, 1535M Inact, 199M Wired, 79M Cache, 112M Buf, 4008K Free
Swap: 4096M Total, 88K Used, 4096M Free

wow, 1 zombie

first time I see this ‘zombie’

further work to see that zombie

ftp# ps -aux | grep Z
USER      PID %CPU %MEM   VSZ   RSS  TT  STAT STARTED      TIME COMMAND
root    24487  0.0  0.0     0     0  ??  Z     2:00PM   0:00.00 <defunct>

<defunct>

what was thta?

from here :

http://www.cts.wustl.edu/~allen/kill-defunct-process.html

Defunct processes are processes that have become corrupted in such a
way the no long can communicate (not really the right word, like
signal each other) with their parent or child process. So kill the
parent or child and 99% of the time (around here at least) the defunct
process will go away! No parent or child, your out of luck, or look
for a stuck automount.

Hmm….

Unix

Problem with cvsup12, use other server

When doing updating ports every 3 days I see this in this morning :

ftp# cvsup -g -L2 ports-supfile
Parsing supfile "ports-supfile"
Connecting to cvsup12.FreeBSD.org
Connected to cvsup12.FreeBSD.org
Server software version: SNAP_16_1h
Negotiating file attribute support
Exchanging collection information
Establishing multiplexed-mode data connection
Running
Updating collection ports-all/cvs
Server warning: Cannot open "/cvs/cvsupd/prefixes/FreeBSD.cvs/ports/Tools/portbuild/2.2/bindist/README,v": No such file or directory
Server warning: Cannot open "/cvs/cvsupd/prefixes/FreeBSD.cvs/ports/Tools/portbuild/2.2/bindist/delete,v": No such file or directory
Server warning: Cannot open "/cvs/cvsupd/prefixes/FreeBSD.cvs/ports/Tools/portbuild/2.2/bindist/dirlist,v": No such file or directory
Server warning: Cannot open "/cvs/cvsupd/prefixes/FreeBSD.cvs/ports/Tools/portbuild/2.2/bindist/files/usr/bin/uname,v": No such file or directory
……………………

Wow, after see my ports-supfile nothing changed :

*default host=cvsup12.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=.
*default delete use-rel-suffix

*default compress

ports-all

 

Hmmm….

Ok, try another server

ftp# cvsup -g -L2 ports-supfile -h cvsup10.freebsd.org
Parsing supfile "ports-supfile"
Connecting to cvsup10.freebsd.org
Connected to cvsup10.freebsd.org
Server software version: SNAP_16_1h
Negotiating file attribute support
Exchanging collection information
Establishing multiplexed-mode data connection
Running
Updating collection ports-all/cvs
 Checkout ports/audio/xmms2/files/patch-src_clients_lib_python_xmmsapi.pyx
 Edit ports/databases/mysql-query-browser/Makefile
  Add delta 1.10 2007.11.12.23.43.33 pav
 Edit ports/databases/oracle8-client/Makefile
  Add delta 1.4 2007.11.13.20.25.46 fjoe
 Edit ports/databases/oracle8-client/distinfo
  Add delta 1.3 2007.11.13.20.25.46 fjoe
 Edit ports/databases/py-tada/Makefile
  Add delta 1.5 2007.11.14.22.53.57 pav
…………………….

Fiuh, it seem problem occur in cvsup12.freebsd.org

I hope it will fix immediately