Lame Command Line MySQL Database Duplication

22
Jul/09
0

echo “create database new” | mysql -u root

mysqldump -u root old | mysql -u root new

Filed under: work

Access, Modify, and Change

29
Jun/09
0

What are Access, Modify, and Change as returned by the ’stat’ command?

What better way than to learn by example?  First, we start with no file:

rwill@rwill-laptop:~$ stat foo
stat: cannot stat `foo': No such file or directory
rwill@rwill-laptop:~$

Next we make our file:

rwill@rwill-laptop:~$ echo "Hello, World" > foo
rwill@rwill-laptop:~$ stat foo
 File: `foo'
 Size: 12            Blocks: 8          IO Block: 4096   regular file
Device: 802h/2050d    Inode: 246126      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/   rwill)   Gid: ( 1000/   rwill)
Access: 2009-06-29 16:25:21.000000000 -0500
Modify: 2009-06-29 16:25:06.000000000 -0500
Change: 2009-06-29 16:25:06.000000000 -0500
rwill@rwill-laptop:~$

We can now see that our file exists and as expected, Access, Modify, and Change are all the same.  Now, lets read something from the file:

rwill@rwill-laptop:~$ stat foo
 File: `foo'
 Size: 12            Blocks: 8          IO Block: 4096   regular file
Device: 802h/2050d    Inode: 246126      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/   rwill)   Gid: ( 1000/   rwill)
Access: 2009-06-29 16:25:21.000000000 -0500
Modify: 2009-06-29 16:25:06.000000000 -0500
Change: 2009-06-29 16:25:06.000000000 -0500
rwill@rwill-laptop:~$

We can now see that we Accessed the file (read from it) 15 seconds after it was created.  Now, let’s write to the file:

rwill@rwill-laptop:~$ echo "Hello Foo" >> foo
rwill@rwill-laptop:~$ stat foo
 File: `foo'
 Size: 22            Blocks: 8          IO Block: 4096   regular file
Device: 802h/2050d    Inode: 246126      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/   rwill)   Gid: ( 1000/   rwill)
Access: 2009-06-29 16:27:05.000000000 -0500
Modify: 2009-06-29 16:27:05.000000000 -0500
Change: 2009-06-29 16:27:05.000000000 -0500
rwill@rwill-laptop:~$

Oh no! Everything changed.  Of course it did.  By writing to the file, it was Accessed, Modified, and Changed.  But don’t “Modify” and “Change” mean the same thing?  Not exactly.  A Modification is always a Change, but a Change is not necessarily a Modification.  Changes that are not Modifications include renaming, changing the permissions, etc:

rwill@rwill-laptop:~$ chmod 644 foo
rwill@rwill-laptop:~$ stat foo
 File: `foo'
 Size: 22            Blocks: 8          IO Block: 4096   regular file
Device: 802h/2050d    Inode: 246126      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/   rwill)   Gid: ( 1000/   rwill)
Access: 2009-06-29 16:27:05.000000000 -0500
Modify: 2009-06-29 16:27:05.000000000 -0500
Change: 2009-06-29 16:28:26.000000000 -0500
rwill@rwill-laptop:~$ mv foo bar
rwill@rwill-laptop:~$ stat bar
 File: `bar'
 Size: 22            Blocks: 8          IO Block: 4096   regular file
Device: 802h/2050d    Inode: 246126      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/   rwill)   Gid: ( 1000/   rwill)
Access: 2009-06-29 16:29:29.000000000 -0500
Modify: 2009-06-29 16:27:05.000000000 -0500
Change: 2009-06-29 16:29:28.000000000 -0500
rwill@rwill-laptop:~$

How about a homework assignment?  What happens when you move a file?

rwill@rwill-laptop:~$ mkdir baz
rwill@rwill-laptop:~$ mv bar baz
rwill@rwill-laptop:~$ stat baz/bar
 File: `baz/bar'
 Size: 22            Blocks: 8          IO Block: 4096   regular file
Device: 802h/2050d    Inode: 246126      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/   rwill)   Gid: ( 1000/   rwill)
Access: 2009-06-29 16:29:29.000000000 -0500
Modify: 2009-06-29 16:27:05.000000000 -0500
Change: 2009-06-29 16:30:29.000000000 -0500
rwill@rwill-laptop:~$

That’s right.  A Change, but not a Modification.  It’s all so clear now, isn’t it?

Cheers –

Filed under: work

Golf: Reprise

24
Jun/09
0

I suck at golf. Given that, I can see it as something I would enjoy doing regularly. The game itself is pretty boring. I can see it being completely obnoxious if you really try to play by the rules. However, add in the occasional dropped ball and “fuck this putt”, and it becomes much more tolerable. All in all, it’s mostly a good time to hang out and talk with whoever you happen to be playing with. Final thought: walk; don’t ride.

Filed under: work

Golf

22
Jun/09
1

I’m trying to sort out work. I love my job. Due to everything going on recently, I owe them a whole crapload of time: somewhere on the order of 100 hours. I’ve been trying to figure out if they’re happy with my work or not. I always obsess about crap like this.

Anyway, my point: Today, D.J. invited me (and everyone else around) to play golf Wednesday morning before work. I’ve never held a golf club in my life. It should be interesting.

Last notch in my psychosis: I was in Atlanta on my anniversary, getting certified to do my job. One way or another, D.J. got wind of said happenstance. Today, he handed me a gift certificate for The Melting Pot and told me to take Heather out for an anniversary dinner on him. How cool is that? This is why I love my job.

Filed under: work