Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Sunday, July 26, 2009

Conversion halted...

Well, the Perl-to-PHP conversion has been put on hold (although I haven't stopped reading about PHP). I now have to write two web pages to allow management of tickets that are generated. Also, they want to know the status of a request that was made, regardless if a ticket was created or not.

I have to add a couple of index columns to the TicketData table to track the requestor by their employee number, name, alias, etc. This means that I have to modify all scripts and web pages that generate tickets, about 10 or so.

I need to get this to work this week before the end of the month.

Wish me luck!

Friday, July 24, 2009

Update...

The "Special Project" is running well now. It has processed over 75 tickets the first week. Not bad. It is on track as to what we told them, 300 tickets per month.

I'm still "learning" PHP. I abandoned the text book that I was reading -- got tired of correcting the mistakes in the text and examples. If I had written it, I would be ashamed of all the errors. :-\

In PHP, there are two methods of connecting to MySQL. One called "mysql_connect()" and "mysqli()". The author kept flopping back and forth between the two, mixing them up to the point that the examples could not have worked. I could understand a little if the text was wrong, but for the examples to be wrong, it just tells me that they didn't even try to run them in the first place. Simplest thing.

And it pissed me off that the author would use PHP code without explaining what it was or why it was being used. She just throws it in there and ignores the fact that it is there. This tells me that she finally got around to running the example, fixed it and didn't bother to add text to explain the fix.

I'm now reading "PHP and MySQL for Dummies". For the most part, I've found that these types of books are not bad if you are trying to learn a programming language. I had this book all along. I should have started with this in the first place. Well, I'll be sure and post a comment here on it.

Wednesday, June 24, 2009

Learning on the Fly...

Well, the test server has not completely been rebuilt, so I have to move on. On the production server, I attempted to install the needed Perl modules and ran into several snags. Some of them won't compile.

So, I need to back up a bit. I hate having to learn a language on the fly, but it won't be the first time. The procedure that I have is written in Perl, and so I need to write it in PHP.

If you don't know what PHP is, it is a scripting language to generate dynamic web pages, with its interpreter written in C++. It originally stood for Personal Home Page, but has moved away from that. A lot of the syntax is similar to C++, so it should not be too hard, right?

So, I'm looking for the right "...Dummies" book to give me what I need -- PHP and SOAP messages over SSL. If you know of any, please comment. Anyway, I'll most likely have to pick and choose from the Internet, like always. :-/

For example, I've written some JavaScript code to allow tab key input into a text field for forms, taken from here and there on the 'net. Found one code, that didn't work correctly, but I took that and ran with it (I don't remember who I got it from, so if it was you, sorry and let me know). Fixed it and it works great! The tab character is inserted into the text at the current cursor position.

The only problem is, the code that I have only works in IE. Since that is the accepted browser where I work, there is no immediate need to go further, but I would like more.

Here is the code:

<script language="JavaScript">
<!--
function storeCaret(textEl) {
if (textEl.createTextRange)
textEl.caretPos = document.selection.createRange().duplicate();
}
function insertAtCaret(textEl, text) {
if (textEl.createTextRange && textEl.caretPos) {
var caretPos = textEl.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
}
else
textEl.value = text;
}
function onKeyDown(textE2) {
var e = window.event;
storeCaret(textE2);
if (e.keyCode == 9) { // tab
insertAtCaret(textE2, "\t")
e.returnValue = false;
}
return true;
}
// -->
</script>



And all you have to do to get it to work is use the onKeydown="onKeyDown(this);" event handler on the text area you want to use it in.

If you know how to make this work in Netscape, let me know and I promise I will give you credit!!

PS. If you would like me to make the code available online, I'll figure something out (just tried to cut-n-paste and that sucked).

PPS. The limited control over text spacing here sux!