Friday, September 28, 2007

Registering Your Site With Google


Once you have a site, it is important to get it registered with search engines. Here are some of the basic steps to follow for Google. Later, I will add other search engines.
Google

To register with Google, you need to have a Google account for webmasters. Go to http://google.com/webmasters/tools, and add your site. It is best if you use the "www." part of the domain.


Next you will be asked to verify that you are the owner of the site.


This can be done by adding a tag to your files or you can upload an empty file with a unique name. I use the file option:




Create a file using any text editor. With Notepad, for example, you can create an empty file. When you save it, use the save as feature put the name "googleXXXXXXXXX.html" with the quotes (this avoids adding ".txt" to the file name). FTP or otherwise transfer the file to your server. Once it is on the server, press the "Verify" button.


If you have multiple sites, this same file will be used for all of your sites. You will need to go through the process of adding, uploading and verifying each of your sites.

Labels: , ,

Saturday, September 22, 2007

Sudoku in C++

I've agreed to give a talk at the local South Carolina Code Camp in October. I decided I would talk about one of my passions, jQuery. jQuery is a library for JavaScript that support DOM (Document Object Model) and Ajax. It handles them both in a browser-independent fashion.

Of course, the most interesting thing to explain something is to give an example. My hope is to design a jQuery Sudoku puzzle program. I wrote a Sudoku (creation and user verification program) a year or so ago in C++. Alas, I used a console interface [yuk]. However, that was what we were doing in the class that I was teaching.

I would now like to port it over to work in JavaScript.

So, I am publishing my C++ solution for others and to keep me honest about my plans to create a Javascript version.

If you want the source code, let me know. You can find the source code on this blog.

The executable is located here: sudoku_cpp.exe.

Labels: , , ,

Monday, September 17, 2007

PHP Upload Tool

Using a public/shared server is a real hassle. I’ve found that my GoDaddy account is a pain to upload lots of files at once. It would not be so bad if all of the files were downloaded at once but ftp requires multiple communication on every file.

The obvious solution would be to create some kind of archive such as a .tgz (tar gzip) file which could be downloaded. However, without a shell to decompress things, what can you do? After a little research, I found phpzip, from PhpConcept, which does the entire archival process through a collection of JavaScript/PHP scripts which are supported by GoDaddy on their shared Linux servers.

1) The program was good enough. However, there were a couple of issues for me. The most serious flaw in the program that I found was security. Anyone who knows the address of the .php file could Unzip over something of yours. They also might be able to upload stuff that they shouldn’t. To fix that problem, I just added .htaccess to require a password.

My .htaccess file looked like:

AuthUserFile …/private/.htpasswd
AuthGroupFile /dev/null
AuthName
"Restricted Stuff"
AuthType "Basic"

require valid-user

My .htpassword was created on my Linux machine using htpasswd:
name:2mDQofxXPsyP6

2) My next concern was “is that really enough security?” I decided to modify the program to support an encrypted password. This required the modification of the main PHP file to ensure that on every access a matching password existed. To do this, we added a session variable to keep track of things. Thus, even if I messed up the .htaccess, there would still be another password. The only problem that I had was that I don’t speak French. While the code is commented in English, the code uses French to English translations for the User output. So, I had to make the translator understand my “French”.

3) The program did not support the file upload. I could just live with ftp’ing the .tgz or .zip file. However, I wanted to do it all from my browser. So, I added an upload capability.

4) My version of phpzip is here. It works for Firefox at the moment.

Labels: , ,

My first official blog.

I'm not one for writing, but I'm sure that as I go along I will want to remember things that I've done. Perhaps, some of them will help you, too.

So, today I will just say that I learned that Google's blog tool allows you to store your blog elsewhere. In my case, I am storing it at my hosting company: http://www.holycitywebsites.com. While I trust Google not to loose my data, I would rather it be stored with my stuff and use one of my websites: http://jackbriner.com.

So, to signup just go to your Google account and add Blogger to your account. Give your Blog a name, like "Jack's Jots." With the advanced options, you can then create the link for your Blog to be stored on your webserver using FTP or SFTP.

Cheers for today.

Labels: , ,