Main

Work Archives

January 11, 2007

Slideshow for Photoblog

So I have been working on a nice little slideshow application that will be used for Photoblog. Its a little bit of html and editing some java code to make it work. I am looking to make this work a big better so it will be easily implemented into any webpage.

So first here are two examples of how you can use it

Showing most recent post
http://www.zcentric.com/examples/slideshow_front.html

Show a certain post by date
http://www.zcentric.com/examples/slideshow_date.html


You can see the different things you can change in the one javascript line for now.. This will probably change but for now it works

http://www.photoblog.com/slideshow/js/slideshow.js?user=mikezupan&type=large&timer=6&date=2006-12-3

now you can see some things

user : that will be your username
type : this is the size of the images you want to show.. the options can be large/medium/small
timer : this is the time in seconds you want it to cycle each picture. It will default to 3 so you can't put anything less.
date : this is optional but it needs to be in the yyyy-mm-dd format. If you leave it out it will show your most recent post.

February 1, 2007

Great Examples of mySQL Queries

So this is just a quick on to show a nice website I found about great example of queries in mySQL v5

http://www.artfulsoftware.com/queries.php

February 15, 2007

Get topleft position of a element in javascript

I am doing this as a first part of my series on how to make a Fotonotes system like Flickr uses but from scratch. Ok well almost from scratch.

The reason I want to redo this is mainly because Fotonotes imports the note data in an XML form inside the jpeg image. Now this is good for a site like Flickr that only shows one image but I want it to be able to handle 20 images on a page. So my idea was to put everything into a database and then just have the notes be hidden until a user hovers over a image. Then just use javascript to show those images. I am thinking this would be easier on the server since it doesn't have to reload the image each time to show the data. I could be wrong though :)

The first thing you want to do is is download dragresize. This pretty much creates the re-sizable boxes so you can select an area you want to add a note to.

I pretty much took the example that comes with it and I found this thread that had the perfect solution to find a x/y coordinate of a element on a page in javascript. Check out the second post for the function I am using. Right now it does just what I want.

The issue I am running into with this test is that firefox does not move the div to the upper left corner until you actually click on it. IE6 and opera seem to behave how I want. I will have to look into this issue and update.

Example of this in action!

The example has some bounding issues, but I just think that it is due to it being right at the top.

Also its a layout ripped from Photoblog since I need for this to work on that site :)

March 1, 2007

Bash Patch to log to mySQL

So at work we wanted to create a centralized syslog server. I had a great idea of why don't we log all user commands run on all servers into mysql. I knew about the bash-paranoia patch so that gave me the idea of using that as my basis for my mysql patch. This should apply to both 3.0 and 3.1 even with all the all the latest security patches included.

So first lets download the paranoia patch

wget http://e133.enemy.cx/xSH-paranoia/download/bash-paranoia.patch

Using that and compiling bash with ---enable-paranoia will allow you to log all user commands to syslog.

So now lets download my patch now

wget http://zcentric.com/bash-mysql.patch

Now if you want to apply it to bash 3.1 I will give a little howto on how to do that. All in 1 step

You want to create the following table in a mysql database


CREATE TABLE `logs` (
`rowid` mediumint(8) NOT NULL auto_increment
`host` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL default '',
`user` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL default '',
`as_user` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL default '',
`ip` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL default '',
`ut_line` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL default '',
`command` text character set utf8 collate utf8_unicode_ci NOT NULL,
`ts` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`rowid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


Now that mysql table is made lets install bash and patch it and all that good stuff

wget http://ftp.gnu.org/gnu/bash/bash-3.1.tar.gz
tar zxfv bash-3.1.tar.gz
cd bash-3.1
wget http://e133.enemy.cx/xSH-paranoia/download/bash-paranoia.patch
wget http://zcentric.com/bash-mysql.patch
patch -p0 < bash-paranoia.patch
patch -p1 < bash-mysql.patch
autoconf
./configure --enable-paranoia --prefix=/usr
make

Now the config file to let bash know where the mysql server is. Now if the mysql server is down bash shouldn't crash or anything.

So you have to create a file /etc/bash.conf and use the following lines.

SERVER=192.168.0.10
USER=username
PASS=password
DB=dbName

Now you should be able to like run /path/to/bash-3.1/bash and it should bring you to a new shell that is now the bash version with mysql. You should now be able to type commands it it will log to mysql!

You can then run make install if you wish to install

About Work

This page contains an archive of all entries posted to My Random Blog in the Work category. They are listed from oldest to newest.

Linux is the previous category.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33