Do you have a Tellermate TY cash counter?
Need to change the currency, or access other options from the supervisor menu, but don't have the password? If you call Tellermate, it will cost you $25 US for the password!
Here it is:
{Red} {Green} {$} {Green}
These buttons are located at the top of the machine.
Many times, especially during programming, I have to search hi and low for answers. I wish to publish my findings in the hopes that you can find the answers I have found quickly. I may speak of other things as well.
Monday, March 29, 2010
Wednesday, March 14, 2007
Amigo Flying
http://picasaweb.google.com/SilverPaladin1/Amigo/photo#5041815419943479634
A short clip of my wife's Goffins Cockatoo, Amigo, flying to my arm.
A short clip of my wife's Goffins Cockatoo, Amigo, flying to my arm.
Tuesday, October 17, 2006
Friday, June 16, 2006
My experience with Ruby on Rails
So, I have this grand project to do for a client. I have been wanting to take the Ruby on Rails plunge for a while now, cause I have been hearing all these wonderful things about it. How fast you can develop it, how easy it makes programming a web application, yada yada yada. I thought I would like to write (rant) about my experiences so far.
I have been reading reading reading. Tutorials, books, how-tos etc. So far, I still don't know what the hell is going on. I think a major part of my problem in getting the hang of things is that I am moving from and ASP/PHP/.NET experience to a pure OOP experience. I am having trouble grasping the terminology and concepts of Object Oriented Programming. I think about PHP, where everything is a function. You want to do something, you jump on the PHP.com site and search, bam, either there is a built in function or someone has written some function that does what you want. You dump it in your code, modify to taste and your on to the next problem to solve. Want some help? Jump on the PHP list and you get an answer in hours. I have asked a couple of questions in the Rails list and no reply after a whole day.
Documentation? Well, on Rails, that seems to suck too. I see all this great stuff about plug ins, modules, recipes, blah blah blah, and so I download them, run the commands as the author has instructed, and nothing is working. All I get is module not found, or error, or undefined object. Very frustrating, cause I don't know what is going on in Ruby (I don't know ruby, so very tough to know where to type to get what result). If you download the code, install the code, run the code, just as the author has instructed, shouldn't you get the result the author says you will? Been burning 2 weeks trying to get some simple stuff up. Ruby and Rails stuff is to a large extent self documenting. The idea is that you place comments and such in your code and run rdoc and you get documentation. I guess authors think that is enough, as you dont' get instructions, how-tos, FAQ's, user forums, and so on. Some authors have blogs and stuff, but then they close off commenting.
I must be doing something wrong, cause I have been at this for over 2 weeks and still I have no application. Client is going to be getting pissed soon!
Well, back at it. Going to see if I can get some actualy work done.
I have been reading reading reading. Tutorials, books, how-tos etc. So far, I still don't know what the hell is going on. I think a major part of my problem in getting the hang of things is that I am moving from and ASP/PHP/.NET experience to a pure OOP experience. I am having trouble grasping the terminology and concepts of Object Oriented Programming. I think about PHP, where everything is a function. You want to do something, you jump on the PHP.com site and search, bam, either there is a built in function or someone has written some function that does what you want. You dump it in your code, modify to taste and your on to the next problem to solve. Want some help? Jump on the PHP list and you get an answer in hours. I have asked a couple of questions in the Rails list and no reply after a whole day.
Documentation? Well, on Rails, that seems to suck too. I see all this great stuff about plug ins, modules, recipes, blah blah blah, and so I download them, run the commands as the author has instructed, and nothing is working. All I get is module not found, or error, or undefined object. Very frustrating, cause I don't know what is going on in Ruby (I don't know ruby, so very tough to know where to type to get what result). If you download the code, install the code, run the code, just as the author has instructed, shouldn't you get the result the author says you will? Been burning 2 weeks trying to get some simple stuff up. Ruby and Rails stuff is to a large extent self documenting. The idea is that you place comments and such in your code and run rdoc and you get documentation. I guess authors think that is enough, as you dont' get instructions, how-tos, FAQ's, user forums, and so on. Some authors have blogs and stuff, but then they close off commenting.
I must be doing something wrong, cause I have been at this for over 2 weeks and still I have no application. Client is going to be getting pissed soon!
Well, back at it. Going to see if I can get some actualy work done.
Wednesday, June 14, 2006
ASP.NET Atlas VS Ruby on Rails
I just viewed the video of a demonstration on how to create a simple to-do list in ASP.net and then Ajaxify it using the .net ajax plugin called Atlas.
You can view the video yourself here: http://download.microsoft.com/download/8/5/8/85803fdd-fe9a-4783-ab37-e0c565172ffd/asp_net_atlas.wmv
The interesting thing about this video is not that you can easily take an existing .net application and extend it to use Ajax like features, but how long it takes.. in this case the video is just over 18 minutes long. Now, the thing to remember, the person who is doing the programming is probably very experienced with his platform and tools, and is very organized and prepared for the demo. While viewing the video, I thought.. "I wonder how long it would take to create the same application in Rails?" View the video posted by Microsoft above, then view my video.
You can view the video yourself here: http://download.microsoft.com/download/8/5/8/85803fdd-fe9a-4783-ab37-e0c565172ffd/asp_net_atlas.wmv
The interesting thing about this video is not that you can easily take an existing .net application and extend it to use Ajax like features, but how long it takes.. in this case the video is just over 18 minutes long. Now, the thing to remember, the person who is doing the programming is probably very experienced with his platform and tools, and is very organized and prepared for the demo. While viewing the video, I thought.. "I wonder how long it would take to create the same application in Rails?" View the video posted by Microsoft above, then view my video.
Monday, November 07, 2005
451 Failure writing to local file. VSFTPD
Ok, this one has caught me before. I set up a user on my server, give them ftp access, and they log in. All is well, they can see the files, download files, but a strange thing happens when they try to upload files. In some cases they get the 451 error, in other cases a file is created which is zero length, then the error access denied is issued.
I finally traced the problem on my system to a disk quota setting being set up wrong. I turn off the quota for that user and all is well. :)
Fedora Core 3, VSFTPD, various ftp clients.
I finally traced the problem on my system to a disk quota setting being set up wrong. I turn off the quota for that user and all is well. :)
Fedora Core 3, VSFTPD, various ftp clients.
Tuesday, October 25, 2005
Native XLS File from Query
Most web programs which output a so-called XLS format don't really output XLS, they output CSV, which has it's limitation. This script creates REAL XLS spreadsheets from any database query.
Start Script:
// put your authentication stuff here. don't leave this one open to public yo!
// Put your db connect stuff here.
// i pass a query to this from a form.
$query = stripslashes($_POST['Sql']);
// what i want the filename to appear as when the user is prompted to save
// the file. Agian, posted from another page
$filename = stripslashes($_POST['Filename']);
$result = mysql_query($query) or die(mysql_error());;
$totalRowsResult = mysql_num_rows($result);
// Excel begin of file header
function xlsBOF() {
print(pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0));
return;
}
// Excel end of file footer
function xlsEOF() {
print(pack("ss", 0x0A, 0x00));
return;
}
// Function to write a Number (double) into Row, Col
function xlsWriteNumber($Row, $Col, $Value) {
print(pack("sssss", 0x203, 14, $Row, $Col, 0x0));
print(pack("d", $Value));
return;
}
// Function to write a label (text) into Row, Col
function xlsWriteLabel($Row, $Col, $Value) {
$L = strlen($Value);
print(pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L));
print($Value);
return;
}
// tell browser that a xls file is on it's way.
Header("Content-Type: application/vnd.ms-excel");
Header("Content-Disposition: attachment; filename=$filename");
// start the file
xlsBOF();
// generate first row with field names
$row = 0;
$col = 0;
$headersResult = mysql_fetch_assoc($result);
while(list($key,$val) = each($headersResult)){
xlsWriteLabel($row,$col,$key);
$col++;
}
$row ++;
// now spit out the data.
mysql_data_seek($result,0);
while ($rowsResult = mysql_fetch_assoc($result)){
// reset($rowsResult);
$col = 0;
while(list($key,$val) = each($rowsResult)){
if(is_numeric($val)){ // data in integer
xlsWriteNumber($row,$col,$val);
} else
if(is_string($val)){ // data is char
xlsWriteLabel($row,$col,$val);
}
$col++;
}
$row ++;
}
// end the file
xlsEOF();
End Script:
Start Script:
// put your authentication stuff here. don't leave this one open to public yo!
// Put your db connect stuff here.
// i pass a query to this from a form.
$query = stripslashes($_POST['Sql']);
// what i want the filename to appear as when the user is prompted to save
// the file. Agian, posted from another page
$filename = stripslashes($_POST['Filename']);
$result = mysql_query($query) or die(mysql_error());;
$totalRowsResult = mysql_num_rows($result);
// Excel begin of file header
function xlsBOF() {
print(pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0));
return;
}
// Excel end of file footer
function xlsEOF() {
print(pack("ss", 0x0A, 0x00));
return;
}
// Function to write a Number (double) into Row, Col
function xlsWriteNumber($Row, $Col, $Value) {
print(pack("sssss", 0x203, 14, $Row, $Col, 0x0));
print(pack("d", $Value));
return;
}
// Function to write a label (text) into Row, Col
function xlsWriteLabel($Row, $Col, $Value) {
$L = strlen($Value);
print(pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L));
print($Value);
return;
}
// tell browser that a xls file is on it's way.
Header("Content-Type: application/vnd.ms-excel");
Header("Content-Disposition: attachment; filename=$filename");
// start the file
xlsBOF();
// generate first row with field names
$row = 0;
$col = 0;
$headersResult = mysql_fetch_assoc($result);
while(list($key,$val) = each($headersResult)){
xlsWriteLabel($row,$col,$key);
$col++;
}
$row ++;
// now spit out the data.
mysql_data_seek($result,0);
while ($rowsResult = mysql_fetch_assoc($result)){
// reset($rowsResult);
$col = 0;
while(list($key,$val) = each($rowsResult)){
if(is_numeric($val)){ // data in integer
xlsWriteNumber($row,$col,$val);
} else
if(is_string($val)){ // data is char
xlsWriteLabel($row,$col,$val);
}
$col++;
}
$row ++;
}
// end the file
xlsEOF();
End Script:
Thursday, October 20, 2005
Thumbnails in ASP.NET C#
Ahh.. the fun of learning a new programming language! I come from a PHP background, have dabbled in ASP, and now, I am writing my first program in ASP.Net. One of the biggest challenges has been to create a good quality thumbnail from a very large source file. I have a client with thousands of large (20 mb and larger) files, and when I tried to use the examples I saw on the net to generate thumbnails, the results were very poor. Blocky pixelation, poor quality, it sucked. The teqnique worked on smaller source files, but not the big boys. So here goes my version which does a very good job of resizing images.
First of all, the asp.net web page which presents the thumbnail is a .ashx file. This special asp.net file is called a web handler. Basically, you call in the resources you need to accomplish a specific task, without loading up the page with all the stuff you need in an .aspx file. Think, aspx = general purpose, ashx = specific purpose.
I called my file, view_image.ashx. Below is the code:
< % @ WebHandler Language="C#" Class="ThumbnailHandler" % >
using System;
using System.IO;
using System.Web;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Configuration;
public class ThumbnailHandler : IHttpHandler {
public void ProcessRequest (HttpContext context){
int _width=0;
int _height=0;
// in my case, i wanted the source files outside the web space.
// I don't want users to access the images directly in the browser
string siteRoot = "D:/mywebpath/";
string imageDir = "db_images/_hi/";
// i pass the image id i want to view, this corrosponds to a file name
string imageID = context.Request["ImageID"] + "_hi.jpg";
// my _path is the full path to the file
string _path = siteRoot + imageDir + imageID;
// Create image from original file.
Image originalImage = Image.FromFile(_path);
// how wide do we want to scale to? passed in url
_width=Int32.Parse(context.Request["Width"]);
// calculate height and maintain aspect ratio
_height= originalImage.Height * _width / originalImage.Width;
// the new bitmap is going to be our resized image
// we send back out to the browser
Bitmap tmpImage = new Bitmap(_width,_height);
Graphics thumbNail = Graphics.FromImage(tmpImage);
// this is where we choose the method for resizing the image
// click here for more methods
thumbNail.InterpolationMode = InterpolationMode.HighQualityBicubic;
thumbNail.DrawImage(originalImage, 0, 0,_width, _height);
// what are we sending back? a jpeg!
context.Response.ContentType = "image/Jpeg";
tmpImage.Save (context.Response.OutputStream, ImageFormat.Jpeg);
// don't forget to close your original image!
originalImage.Dispose();
}
public bool DrawImageCallback() { return false; }
public bool IsReusable{
get { return true; }
}
}
I hope this example is useful to you. Other ways to extend this would be to write some code to put the generated image in the file system somewhere. you could also stamp on a watermark or add some text. The possibilities are limited by your imagination!
First of all, the asp.net web page which presents the thumbnail is a .ashx file. This special asp.net file is called a web handler. Basically, you call in the resources you need to accomplish a specific task, without loading up the page with all the stuff you need in an .aspx file. Think, aspx = general purpose, ashx = specific purpose.
I called my file, view_image.ashx. Below is the code:
< % @ WebHandler Language="C#" Class="ThumbnailHandler" % >
using System;
using System.IO;
using System.Web;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Configuration;
public class ThumbnailHandler : IHttpHandler {
public void ProcessRequest (HttpContext context){
int _width=0;
int _height=0;
// in my case, i wanted the source files outside the web space.
// I don't want users to access the images directly in the browser
string siteRoot = "D:/mywebpath/";
string imageDir = "db_images/_hi/";
// i pass the image id i want to view, this corrosponds to a file name
string imageID = context.Request["ImageID"] + "_hi.jpg";
// my _path is the full path to the file
string _path = siteRoot + imageDir + imageID;
// Create image from original file.
Image originalImage = Image.FromFile(_path);
// how wide do we want to scale to? passed in url
_width=Int32.Parse(context.Request["Width"]);
// calculate height and maintain aspect ratio
_height= originalImage.Height * _width / originalImage.Width;
// the new bitmap is going to be our resized image
// we send back out to the browser
Bitmap tmpImage = new Bitmap(_width,_height);
Graphics thumbNail = Graphics.FromImage(tmpImage);
// this is where we choose the method for resizing the image
// click here for more methods
thumbNail.InterpolationMode = InterpolationMode.HighQualityBicubic;
thumbNail.DrawImage(originalImage, 0, 0,_width, _height);
// what are we sending back? a jpeg!
context.Response.ContentType = "image/Jpeg";
tmpImage.Save (context.Response.OutputStream, ImageFormat.Jpeg);
// don't forget to close your original image!
originalImage.Dispose();
}
public bool DrawImageCallback() { return false; }
public bool IsReusable{
get { return true; }
}
}
I hope this example is useful to you. Other ways to extend this would be to write some code to put the generated image in the file system somewhere. you could also stamp on a watermark or add some text. The possibilities are limited by your imagination!
Wednesday, February 16, 2005
Currency format in Flash MX 2004 DataGrid Component
The datagrid component is great. Without any programming, you can load up some data, sort it, format it and display it in your flash movie. What if you want to format the data but the built in formatting options are not good enough? I have the answer. Using the Custom Formatter feature of the datagrid component inspector, you can specify a flash AS class file to do the formatting for you. Here is how it is done using the XML component, the DataSet component and the DataGrid component.
1: Download the following .zip file and unpack it. Currency_Example.zip
2: Open the file currency_example.fla in Flash MX 2004.
3: Test the file and take a note of how the column Price and Total looks with no formatting. Sucks right?

4: You need to import your custom class so flash can see it. You can do it two ways, using action script and the import method, or using the UI. We will use the UI method. Use the Create New Symbol menu option or press CTL+F8 key combo. Type Currency in the name, click on the Export for Action Script check-box, and in the AS 2.0 field, type Currency. Case is important.
5: Go back to the main stage and click on the DataSet icon. The dataset instance is called myDataSet.
6: Open the component inspector and click on the Schema tab.
7: Locate the Price schema item and then in the properties panel, look for the formatter property. It should be blank.
8: From the drop down list for the formatter property, select the Custom option. The property below that, formatter options will now change to {}.
9: Select the formatter options drop down, and a window will pop up. Type Currency in the window and close it.
10: Test your movie again and view the Price column. Nicely formatted Currency is displayed!

Good Luck. If you just want to see finished results, open the currency_example2.fla file and test it.
1: Download the following .zip file and unpack it. Currency_Example.zip
2: Open the file currency_example.fla in Flash MX 2004.
3: Test the file and take a note of how the column Price and Total looks with no formatting. Sucks right?
4: You need to import your custom class so flash can see it. You can do it two ways, using action script and the import method, or using the UI. We will use the UI method. Use the Create New Symbol menu option or press CTL+F8 key combo. Type Currency in the name, click on the Export for Action Script check-box, and in the AS 2.0 field, type Currency. Case is important.
5: Go back to the main stage and click on the DataSet icon. The dataset instance is called myDataSet.
6: Open the component inspector and click on the Schema tab.
7: Locate the Price schema item and then in the properties panel, look for the formatter property. It should be blank.
8: From the drop down list for the formatter property, select the Custom option. The property below that, formatter options will now change to {}.
9: Select the formatter options drop down, and a window will pop up. Type Currency in the window and close it.
10: Test your movie again and view the Price column. Nicely formatted Currency is displayed!
Good Luck. If you just want to see finished results, open the currency_example2.fla file and test it.
Monday, February 14, 2005
Welcome to my blog.
Greetings, fellow Internetters!
I hope to find some time to post my experiences with programming for the web. Many tasks in Flash an other languages are not well documented, and I have had to spend many hours researching solutions to what I believe are common programming problems. Hopefully, I can help you reduce your search time.
I hope to find some time to post my experiences with programming for the web. Many tasks in Flash an other languages are not well documented, and I have had to spend many hours researching solutions to what I believe are common programming problems. Hopefully, I can help you reduce your search time.
Subscribe to:
Posts (Atom)


