Thursday, December 11, 2008

Changes in web hosting

I have had the same web host for so many years I thought it might be good for me to research what the latest and greatest hosts are and what differences might be available. When doing this I thought that others might like to understand how I research web hosts.

When looking for managed hosting services you really should look for providers who have a good reputation, excellent value and knowledgeable staff.

I generally break down my research into a few categories. These categories allow you to rate each type of web host by each category and then decide which one best fits your needs.

The categories I use are below. You should rate from 1-5 how well the host performs in each area then decide if they are a good fit.

1. Hosting presence - what sort of data center does the provider have. What sort of bandwidth do they have available. Is their pipline small or large? Do they have a raised floor and fire prevention.

2. Features - What sort of features do they have. Do they have cpanel, plesk or other hosting interfaces? Do they allow you shell access, unlimited bandwidth and data pacakges, etc.

3. Stability - This is big key. There are a million fly by night places out there offering hosting. You should make sure that the people running the place are reviewing their practices and methods of running their web hosting. A good place to start is making sure they have SAS 70 compliance. What this means is basically they have someone independently audit them.

4. Knowledge in the industry - Feel free to ask them if they know the latest trend in security. Ask them what the toughest problem they solved recently was. It's important to have staff that can figure things out.

5. Value - Make sure you compare and weigh all the costs in your web hosting.

Remember, when you're looking for hosting it's not about price but a combination of many things. It only take a few days of downtime for someone to go surfing the web elsewhere!

Web Table Sorting (Without the headache)

Most web developers at one time or another are going to run across a medium sized table they want to sort. Sure, you can do this with PHP and send parameters clicking on each header but why? You can use a little jQuery plug in called table sorter to get everything you need without any significant overhead.



Christians website has some really great tutorials and sample code. If you're not using jQuery I suggest you give it a shot. I've been using it for some time and it allows you to work considerably faster. I've used this on a few projects now and ever user has been happy with the results.

Thursday, November 13, 2008

Google Chart API

It's no secret I'm a big fan of Google most developers are. I've been using the Google chart API a lot lately and thought it should get some exposure in my Blog. For those of you that follow my blog you really should be using this API. It's so darn simple and has no overhead because google takes the hit on processing!




You simply use a URL to get your chart so you're ultimately limited by the URL length and their encoding. While this wont be a full featured reporting system like Jasper or Pentaho putting quick graphs on a webpage or website is a piece of cake.


http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World





Is google's chart example and it's simple and elegant. You can use any type of code to generate your URL.


Google has a javascript code that can encode the URL with values to save space.


I wrote some PHP code (below) that you can use to encode the same type of array with PHP. This has the advantage of calling a function to encode it within your PHP page.


= 0){
			array_push($chartData, substr($simpleEncoding, round((strlen($simpleEncoding)-1)*$currentValue/$maxValue), 1));
		}else{
			array_push($chartData, '_');
		}
}
return join('', $chartData);
}
?>



You should use this sort of API an in any website where you dont want (or need) to have a full blown reporting engine. Stats and metrics can easily be charted with this. Additionally when you read the full API you'll see you can also change colors, control chart types and do all sorts of neat stuff with it.


These charts look great too. Since the cost is low (Free) and the use is simple this is a great way to splash up any webpage with some simple calls to a URL. Google allow you to do 250K of these requests a day which would be a lot for most websites. A little tip too this saves on your overall badwidth on your website too. 250K requests for a 4.8K chart image is about 1.2 gig in bandwidth. So google gives you that for free too. Unless you need some high customization there is no reason you shouldn't be using this everywhere.


Happy Charting!

Thursday, September 04, 2008

1PB Storage, $17,8800 Not bad eh?

So today while looking at the tiger direct deal for a $149 1TB SATA drive I wondered "just how long before someone has the 1PB (Petabyte) system. Well quick search into google and I found one. Check this article out.

What is interesting is that a 1GB Seagate drive in 1995 cost $849, today, a 1TB drive for end consumers (13 years later) is only $149 at Tiger Direct. So how long for the 1TB drive?

Doing the math you can get 1200 SATA drives, chain 'em together and get 1PB of storage. A bit pricey for me though.

Tuesday, September 02, 2008

Google Chrome Anyone?

Wow, what a great first impression. I downloaded Google Chrome today. Installed the beta and now have it currently set as my default browser. I tried the IE8 beta and instantly turned it back to IE7 Compatibility. With Chrome I've only submitted 2 sites now that haven't looked right. IE8 I didn't bother because everything looked funky.

Now being who I am I have to start digging into Chrome and under the hood. From a web developer standpoint I think Chrome will fair well so far. Out of the box websites look good. I dont see huge problems in compatibility. DOM seems to be sane and jQuery heavy pages work just fine.

I like the clean look however IMHO google has very minimalist applications. Why GoogleTalk is still lacking features like grouping is beyond me. This post is about Chrome though.

I have to say it is worth trying out. I enjoy using it and unlike the IE8 beta I dont feel like i'm being forced anything down my throat. Guess that's why Microsoft Developers leave for google all the time. Why don't I work for Google?

It's no surprise I'm a google fan and I like the fresh thinking with the browser. Seems fast, looks great and does the job. I'll blog about it later after I've kicked the tires some more. So far only good things to say...

Thursday, August 28, 2008

Fun IT Stuff

This tasty little nugget I received from a friend. There is some serious fun you can have with those pesky neighbors who hijack your wifi. I personaly use WEP on mine but you might find it entertaining just a fun joke to play on your friends.

Not your typical development stuff, but amusing at the very least.

Monday, June 02, 2008

Elegant Parsing Of Servlet Parameters

I love SOA. I use servlets to send back JSON data and I honestly believe it's the most elegant approach to asynchronous data over the web. Sure, AJAX and XML is great but JSON has some real flexibility when it comes to small size and larger payloads. I frequently use Java with a tomcat server to handle the data coming from the database. I get to use Hibernate and it makes life very easy.

Today's post is about parsing servlet parameters. If you use SOA enough you'll find youre coding new servlet parameters all the time and your head begins to swim with all the work involved in reading and validating parameters. This is where this tasty nugget comes into play. I developed this to read the parameters and place them into a hashmap. The nice part about this is that you read the parameter set one time and the hashmap handles all sorts of things for you.

First its easy to find stuff and check for missing parameters. You simply need to see if the key exists to know if you have a parameter. Next, there is no code overhead here in maintaining a list of the parameters you are checking and assigning them to variables, fields, etc. You simply reference the hash and convert when necessary. So you get cleaner code by having less of it. Try using this the next time you're coding a servlet and you'll find it makes your SOA go much faster.



Please remember to make a post here if you use anything. I like to see how people are using my code.

Tuesday, May 27, 2008

Gave up on Vista

Well, despite my post on how to get a box resonably running well with vista I finally gave up and installed XP on the laptop. Vista is such a memory pig that it just wasnt worth it. I havent been impressed with the roumors on the next version either. Microsoft better shape things up if they want to keep ahead in the desktop market. Just my $.02

Do it yourself SEO. Free, Cheap SEO, no strings.

If you have wanted to do free and cheap SEO then you should check out frugalseo.com. I put together a very quick eBook on how to prevent being scammed and just get it done with a reasonable amount of effort. Sure, there are many resources for free information on the web that outlines the same thing but I put this together as a guide for people who don't know much about it. With so many "SEO Experts" out there scamming people I wanted to put something together others could benefit from.

Wednesday, May 07, 2008

New Websites

I've created for my wife and now maintaining two new websites. Give a dog a toy which is a Premium dog toy of the month club and we also created Your Pets And More - Unique Pet Supplies. Both site focus on pet supplies, dog toys, small animal supplies and more. Excellent stuff so I suggest that all my readers visit it.

Monday, February 18, 2008

Vista Laptop and Development

I wanted to get a laptop which I could use for all my various tasks without spending a ton of money. I purchased an Acer 4720-4721 which is a 1.6 Dual Core Intel machine with a gig of ram.

I have a Dual Core desktop for my regular development work but I wanted to get something for some light code changes as well as doing the day to day personal stuff like Quicken.
Like everyone else I finally had to take the leap into Vista. I had tried the beta with my MSDN subscription, as well as Vista ultimate when I bought my new development workstation. I wasn't very impressed and it seemed to just be fat and bloated even on my 2.9 Dual Core workstation which went promptly back to XP. With the laptop though short of downloading all the drivers again I was going to have to get used to using Vista.

I finally have my Vista installation running as well as my XP one but it did take some effort. I'm sure I'm still losing some performance in Vista overall but it seems to run as expected now. In fact I was able to bump up my 3.1 Experience Rating to a 3.2 by just doing a few things.
First, Aero wears out really fast. I really don't need Flip 3d (who really does) and having transparent windows, light up buttons and everything else is just useless eye candy. For someone like myself who stares at code, UML diagrams, project requirements and emails all day it just wastes resources on the PC.

Turning off Aero gave an immediate improvement. I also am not pleased with the black theme. I
was able to download VistaGlazz and the Royale theme from the Internet. Google them, you'll end up with a nice bright look just like XP. In fact it seems so much happier than vista doom and gloom.

Next I did a few searches on the Internet for some Vista tweaks. The largest ones were really just turning off some items in the start up like the welcome center. That was easy enough to do with Spybot Search and Destroy. I think that is a must have on any PC.

While I was in there I turned off all the useless widgets that Acer installed on this thing. Start up tasks like launch managers, button key mappers, in all about 10 different things that really don't save me any time at all or are rarely used. Lean was the key to free up more memory for vista.
I also went into the services and turned off everything I didn't need. I don't use a modem for anything so the modem sound driver seemed like another useless thing running and taking up space.

Another trick I used on that Laptop was to install Trillian vs. MSN, Skype, GoogleTalk and Yahoo. Trillian allowed me to just load one messenger up vs. 4. Frankly all I do with those anyhow is talk to the wife, friends or colleagues in a IM window. So one footprint was better (and smaller).

Now, I also threw in a 1GB SD I had laying around into the 5 in 1 reader that came on the laptop. The ReadyBoost does seem to add some enhancement in speed. Somewhat noticeable but if you 10 little things you start to notice the difference. I also doubted the ready boost but monitored the cache hits in the Performance Monitor and with less than 1ms seek time on a flash drive there is some benefit to using it.

I also enabled the write caching on the laptop drive. I'll never run the battery to zero without knowing it so I'm willing to take the write cache hit should I be stupid enough to run out the battery.

Last but not least I took off the wallpaper background. This frees considerable bitmap memory since one color is just, well one color.

So let's recap what we did here to gain some big performance benefits.
1. Remove the start up items you don't need.
2. Remove the services you don't need
3. Turn off Aero
4. Reduce the number of Running apps.
5. Enable Write caching
6. Use ReadyBoost.

Seems like a lot of work just for some performance gains but my vista now boots in what is perceived as about half the time. I also can switch windows faster and my hard drive is not chugging away every second.

Tuesday, February 05, 2008

JDIC Just Works

While I do a lot of J2EE work which is web enabled I love to tinker with desktop applications. I'm working on a personal project and wanted to embed a web browser into a Java application. I know of course how to do this in .NET however I prefer the cross platform capabilities in Java.

This tasty nugget JDIC was just what I was looking for. While I was interested in only using the web browser to start there are more uses for this than that. With Linux closing in on Windows for the server market share applications that are OS independent are growing in popularity. JDIC I believe will help more developers write SE applications for any OS.

JDIC can be found at http://jdic.dev.java.net/

Tuesday, January 29, 2008

Multiple Line JSF Data Tables

Ok, so you need to create a multi row data table right? Now you want to do this with JSF and you see that you're up a creek without a paddle. This doesnt fit the norm for most "grid" layouts on the web. The standard JSF just doesnt allow for this with a datatable but you can use the panelgrid to get the results that you want. Here is how.



Why don't we break this down to see what we do here.

Line 1 is our standard data table layout using the backing bean reportListingReports.claimsToWork

There is nothing new here, standard call to a backing bean for the JSF information. We set the variable ctwb for use in the column.

Line 5 is where we introduce the column. As you can see here the matching tag for this is at line 25. We use one column so we continue to iterate through our row data.

Line 6 introduces our panel grid. We use this to construct the real table here. We continue to go down through the panelgrid and output the different elements using the ctwb variable.

Line 22 closes out the panelgrid.

Line 23 gives us a summary row underneath. I use this for outputting a status message on the previous row but you could introduce another panelgrid or whatever you like here.

So to summarize what we have here is 2 visible rows of data on the screen. Presentation goes something like this.
ROW1COL1     ROW1OL2    ROW1COL3
ROW2BUT BUT IS PART OF DATA ROW 1

ROW2COL1     ROW2OL2    ROW2COL3
ROW3BUT BUT IS PART OF DATA ROW 2


You should have the idea. This gives nice formatting for anyone that needs to output a text description on the row but doesnt have the space on the screen (or in the data table column.

Now, remember you'll need to use the column classes and style the table correctly or this may not look just right for you. It is easy enough to acomplish with some css code.

Code Syntax Highlighter/Formatter

Now this was a tasty nugget I had to dig hard for. Hopefully more developers will blog this one so it can end up in some search pages. The code formatter for java or many other languages allows you to embed it in blogger highlight your code. I like this one very much as it's all javascript and nothing complex. I'm switching over to use this one on the website.

Why aren't you using Damn Small Linux?

This has to be one of the best distros for a boot and go scenario. I have a few notes about this I'd like to pass along. Do you have some java software you'd like to demo or run but don't want to install it at the clients site? Want to send them a running copy? Here is a nice trick. You'll need both a linux box and an XP box.

First, get yourself a copy of MagicISO (Windows XP) for hacking the ISO image.

Next, download the Java Runtime for linux. Run the install and have it extract out to a standalone directory.

Use MagicISO and bust open the ISO from DSL (Damn Small Linux). Copy over the entire Java directory to the root of the CD.

Now, you can simply do the same with your Java software. DSL has some really nice boot options for the opt directory or the mydsl directory to load in options. You can point these at cdrom to enable specific settings. Once you have this done you can then go in and hack the isolinux.cfg located in the /boot/isolinux directory on the CD. You can hard code the options setup on the disk and remove the standard DSL prompts.

Overall I was able to get a very small CD footprint (150 Megs) roughly. It also beats remastering the entire DSL setup. While this is an option it saves a lot of time with this approach.

Sunday, January 06, 2008

EJB3, Glassfish, MySQL, Toplink Working Together Continued

Alright, here are my notes on all of this.

First, much of the documentation out there on the web I saw had plenty of JPA for J2SE examples. Nothing I found talked about the setup of the glassfish data pools and sources.

<jta-data-source>jdbc/MySQL</jta-data-source>


Shows the configuration for the persistence.xml you'll need to include. This should be part of the <persistence-unit> tag that you'll include as part of persistence.xml. EJB3 users should know how to set this up or can easily reference this.



That's about the only real configuration you'll need as part of your persistence.xml file for the Glassfish server to locate your connection.



The rest is in glassfish. Why the Apress EJB3 book does include this information is beyond me. It's like a whole chapter on setting up the data sources is needed.



In glassfish login and go to your connection pools for JDBC



From here you'll need to create a new connection pool. Configure the connection as a javax.sql.DataSource then use the Database Vendor MySQL. You'll also need to give it a name. Save your new connection pool, then go back into it to make the following modifications under "Additional Properties" tab.

Under the advanced properties tab, you'll need to create a 'user' property and give it the user name. This would be whatever the mysql login is. Since I was using my research server I simply used 'root'. I didn't have to specify a 'password' property, but I imagine you'll need to in an actual configuration on a live server.

From there you'll need to modify the URL properties (I noticed there were 2 different ones, so I modified both to match). This should be something like 'jdbc:mysql://localhost/XE' where XE is the database you're attempting to access.

Now go back into the JDBC settings and go to JDBC resources. This is where you want to give it a name which matches the jta tag above. create a new JDBC resource that points to the connection pool you just created.

I found it necessary to restart Glassfish here. Although not every change here requires a glassfish restart technically. In practice I couldn't get it to work without the restart.

That was it, once that is setup you should be able to have your client access the localhost for the proper database connection which is mysql and not derby.

Saturday, January 05, 2008

EJB3, Glassfish, MySQL, Toplink Working Together

Oh brother I cant tell you how much of a pain in the butt it was trying to get all these to work together. The JPA is really straightforward. No challenge there but the persistence.xml configuration and JDBC connections for MySQL are just no where to be found. Looking everywhere I couldn't find some really simple documentation on setting up MySQL to work with Glassfish and EJB3 with the JPA. I'm sure someone did find a link but it took some effort to find the right configuration.

Sure plenty of J2SE examples but when it came down to setting up the connection pooling and the jta-datasource I couldnt find a thing. Well bits and pieces and about 3 days later I have it running.

Tomorrow I'll be posting my notes on everything. Hopefully someone else can save some time in getting these to work together. I still haven't successfully replaced toplink with Hibernate at the EntityManger but for right now I'm happy having MySQL running vs. derby.

More on this soon.

Google Mapplets and Custom Writeable Pushpins

Well, I came up with some simple and yet incredible code for Google Maps or Google Mapplets. I think this is just brilliant but you may think otherwise.

Ever wanted to put something on those push pins other than a number or a custom graphic. Well low and behold I did this recently and it's pretty simple. If youre familiar with PHP you'll say to yourself why didnt I think of that.
So let's review what we have here. Lines 2-5 are basic sanity checking for a "rate" which is nothing more than a number.

CODE:

Line 6 is changing the response type for this PHP script to an image.

Line 7 loads up a base image to write text to.

Line 11 put's the text onto the pushpin.

Line 12 Returns the image

That's it folks. Now you have some very cool push pins for google maps. What do you put on them? Well that is up to you. I used "rate" data from banks. You could in theroy put names of things, locations, anything. One template image is used then from there you write the text you want onto the graphic.

This DOES support transparency by the way. I needed that myself. One thing though is that IE6 doesnt support PNG transparency the right way so if you do this you might want to use a GIF instead of a PNG.

If you find this useful please post something on this blog. I'd just like to see how this is being used.
Well this blog has been fairly inactive since I've started my new Job. New posts forthcoming.