Friday, January 23, 2009

A simple basic and easy AJAX call for Javascript

Anyone looking to extend the use of their website or webpage will find that using AJAX calls will add a added dimension to the site. The use of AJAX allows you to call any external page and get the requested information and post it to your page without refreshing. It is rather simple. The following code can be transformed to do what you need but it gives the basic structure.

What you need is an event to fire.


<span onclick="AJAXCall('http://kcwaldo.blogspot.com/2008/10/simple-sql-select-statement.html','&Action=test','myspan')"> Click me</span>

<div id='myspan'>
Return information goes here.
</div>

Below is the script needed to run the event.


<script>

var hURL = '';
var hParamValues = '';
var hAc = '';
var hParamValuesa = '';

function handleHttpResponse()
{
if (http.readyState == 4)
{
if (http.responseText.indexOf('invalid') == -1)
{
document.getElementById(ActiveContainer).innerHTML = http.responseText;
isWorking = false;
//This is the queue.
if (hURL != '' && hParamValues != hParamValuesa){
AJAXCall(hURL,hParamValues,hAc);
hParamValuesa = hParamValues;
}
}
}
}
//url = url you are to get the data from
//paramvalues = are posted to the url. If you need querystring values then include //them in the URL.
//ac = the active container that the data returned will be pasted into. probably a //div or td or span

function AJAXCall(url,paramvalues,ac)
{

try
{
if (!isWorking && http)
{
if (ac == ''){return false;}
ActiveContainer = ac
document.getElementById(ActiveContainer).innerHTML = '';
http.open("Post", url, true);
http.onreadystatechange = handleHttpResponse;
isWorking = true;
http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
http.send(paramvalues);
}
else{
hParamValues = paramvalues;
hURL = url;
hAc = ac;
return false;
}
return true;
}
catch (e)
{
return false;
}
}

//This function creates a HTTP Object. It works in any browser, so far at least.
function getHTTPObject()
{
var xmlHttp;
try
{ // Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{ // Internet Explorer
//alert(e.description);
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
//alert(e.description);
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
//alert(e.description);
//alert("Your browser does not support AJAX!");
return false;
}
}
}
return xmlHttp;
}

var ActiveContainer = '';
var isWorking = false;
var http = getHTTPObject();

</script>

Something the function above will do is to Queue up a second call so that. This is so if you have a list of links that you are showing a picture for it will make the first and last call but very few in between. Without the queue you can get very clunky behavior.

Please leave me a comment if you find this useful or something wrong.

Saturday, January 3, 2009

ScrapbookShelves



Posted by Picasa

ScrapbookShelves




Posted by Picasa

Simple Homemade Scrapbook Paper Shelves for $50 Part 2

Putting it all together.

I predrilled the holes with counter sinks at both ends of the 41" board and also at 14" from both ends. Depending on how accurate you are the idea is to create the space for the 13" shelves. You should have a 12" space in the middle. I did not fill in the space in the middle I left it open for us to add ribbon spools and other scrapbooking things.

Match up the holes and predrill them on the 60" board. Next step is to screw the 48" boards with the grooves lined up and facing each other to the 41" board and then the 60" board.

Make sure all is tight and then paint it or paper it or do your scrapbooking thing to it. Move it to the room and using a 2" x 1" x 3' board secure it to teh wall. Basically screw the support board to the shelf then stand the shelf up agains the wall and make sure everything is plum then screw the support board into the studs. We were initially going to hang this thing on the wall but we turned it upside down and set it on the floor and secured it to the wall.




My wife has yet to decorate it but my part is done.

Simple Homemade Scrapbook Paper Shelves for $50

Well my wife wanted some scrapbooking shelves or holders for christmas this year and once we started looking we found that they cost anywhere from $25 for 5 shelves to thousands for a cabinet that was nice and all but, too damn much IMO. So I decided to build a simple shelving unit that had a nice shelf on the end and would create a good amount of storage under the unit.

The original idea was 3 columns with 24 shelves each. She had a lot of paper and thought 72 shelves would be nice. It was going to hang on the wall. Then I was going to box in a few shelves below for holding other supplies. All in all it was going to be 60" across by 48" high with 3 colums of 13" X 13" shelves. It was going to use spoon shelf holders for the paper shelves to sit on. That was the original idea.

So I went shopping and found the wood I needed, and the screws, but when I came across the spoon holders I was a little surprised to see they wanted $5 for a set of 48. It was going to cost about $30 for just the holders, about as much as the wood. So I returned home and found out the neighbor had a unit built by someone and they just routered the shelf grooves. Which was free! Bingo!

So I returned and purchased the wood.
2 - 12" X 8' X 1" pine boards $9 each
1 - 12" X 10' X 1" pine board $12 each
3 - 4' X 8' X .25" hardboard sheets $5 each (Thinnest I could find and they are plenty strong enough)
1 Box of wood screws 2.5" $4 (You only need about 20 screws so this may not be needed)

I cut the 8' boards in half and routered slots approx 3/8" deep every 2" using a 1/4" bit. This was tricky doing the routering without any guides to keep the cuts straght. I'll be honest my lines were a little cricked :) I still don't know if I would rather pay for and use the spoon holders. In the end even my most crooked line was not even visible once the shelves were in place. Anyway if you have a drill but no router then I would just drill the holes ands use the spoons or wood dowls. Your choice.

I cut the 10' board into a 60" piece and a 41" piece. Then I lightly sanded by hand all the cut boards and edges.

I then using a table saw but you can also easily use a circular saw, cut the hardboard into 13.35" x 12.5" almost squares. They are set to be 13" wide plus the room for the grooves to hold them. They are set for 12.5" deep. a 12" wide board is actually 11.5" deep so in order to nat have board sticking out so far I reduced them a little. I also have a .75" X 2" X 3' board behind the shelves to secure them to the wall which gave me a little room behind for the shelves to slide back a little farther.

Part 2 putting it all together -->

Friday, January 2, 2009

Initial Start Image


This is the setup prior to the beginning.

Monday, December 29, 2008

My Semi-new triple core home built computer

Finally I got my new computer up and running. It was my christmas present and it took me 2 days to get it built and loaded up. My specs:

MB and CPU were bought as a combo with a $30.00 Discount
So the initial cost was $689 + $15 shipping and $10 in tax. The items from newegg.com were tax free. I got a $30 discount on the motherboard and cpu combo. I got a $40 Mail in rebate and a $10 mail rebote on the monitor and power supply which I already sent in.

so $715 -80 = $635 Which I am mighty happy about. The thing screams. I got a lan party in a couple weeks which will test it out nicely but so far I have ran Battlefield 1942 maxed out and it didn't even think about giving me a problem.


I need to purchase Counter Strike Source and practice now.



Monday, December 22, 2008

Monkey Bizness Fun!

Wow! My sisters are visiting for a couple days and we decided to go to the Great Mall of the Great Plains tonight in Olathe just north of Gardner, Kansas. We planned on letting our kids play in the food court play area for a while. Well that got boring after 20 minutes and my wife and sisters wanted to shop more, so we decided to go to the Monkey Bizness, we hesitated a little because it cost $7.50 for each child for unlimited tome for the day. But we paid and went in. Wife and sisters took off shopping leaving me with my 3 children and my sisters 2 children. All together 3,3,4,5,7 ages.

Well, they took off and started playing, soon though the smaller kids were having troubles climbing on the blow up slides and obstacle courses. so I kick my shoes off and started helping them. Turns out all the equipment is very very sturdy, never once did I have an issue and I am #200. There were probably 20 kids running around the room we were in and we never had an issues with running over the other kids, just plenty of room. A huge 15' slide was probably the funnest of all. All the tumbles that everyone took and no one got more than a short cry when my son did a face plant. It just scared him a little but he was off and going again in seconds.

The place has 3 very large rooms that are basically identical. Only 1 way out so it is pretty easy to keep track of a kid trying to escape. Would be nice to be able to have a gate across but I know that has its own issues.

All in all I would highly recommed the place. It is well worth the $7.50. The parties are damned expensive though. We will be going back soon.

Monday, December 15, 2008

Homemade Loft Bed Playhouse Part 2

Check out Part 1

Next figure out where you want your door and windows and start cutting the pieces to length. As you can see you don't have to be perfect because you will be covering it with trim. Your sides will go about 1 foot higher than the tom of the platform so you need to put a 2x4 to extend the height. This acts as a side to keep the kids from rolling out.



A view of the inside. The boards will warp a little so we added a small 2x2 nside the long pard of the sidien to keep it straight.


As you put on the siding you will want to use 2 screws per board to hold them in place.



Now start adding the trim. On these you'll want to predrill the screw holes and counter sink them so that you can fill them in with wood putty to be painted over.





All the trim is on. Time for the roof and steps to finish.


Check out Part 1

Saturday, December 13, 2008

Simple Basic Pasta with a good flavor

Just created a great little pasta dish that was created from leftovers for lunch today. Turned out so good I decided to post it.

1/2 Bag noodles (Anykind should do) I used ziti
1 16oz jar of pasta sauce(Spaghetti or pizza) I used pizza
Half chunk of pepper cheese( Pepper jack or a Pepper cheddar) I used Pepper Cheddar

All this was left over or getting close to not being used in time. I melted the cheese into the pasta sauce, boiled the noodles and then mixed it together. Turned out really really good.

We will be creating it again.

Why not to buy a hp printer on clearance

Basically never even consider buying a HP printer from the open box clearence shelf. A week ago I bought a HP 5610v printer from the ioopen box clearence shelf for $30 down from $129. Great deal right?

Well it did not have a cord, so I thought I would use my other hp cord which looked like it would fit and if not surely I could pick on up for $10 or less.

It did not have instructions or drivers. Surely I could download them online.

It did not come with cartridges. No biggy, the black cartridge was only $21.

So I bought it and the HP 56 catridge. $51 altogether. So I get home and unplug my other hp printer and start to plug the new one in and it dod not fit. Looking closer there is a small slot that is on the wrong side. It also was a 15v vs 16v. So I get online and find out a new power adapter for this printer is $59 new plus shipping. That was not good. Finally after searching high and low I found a used adapter for $13 plus $ shipping on Ebay. $20 but better than nothing.

6 days later I finally get my adapter cord. So I plug it in and put int the cartridge, and it starts displaying an error. It apparently needs the other tri-color cartridge to work. I am a bit confused as to why I cannot just print with the black, so I installed the software the only thing so far that hasn't costed anything. Anyway, I thought maybe the software would let me disable the need for the second cartridge, no it was not a feature. So I had to get the second HP 22 cartridge which is a ripoff for the amount of ink available. $15.

So far I have spent $86 on a clearence open box printer that I could have gotten a newer model boxed comparable hp printer for $89. But I saved $3 and the printer is now working.

Never again!

Tuesday, December 9, 2008

Gardner Cub Scout Websites

Here are the links to the Gardner Kansas area cubscout websites.

Pack 3388
Covers Sunflower and Madison Elementary schools


Pack 3088
Covers Gardner and Moonlight Elementary schools


Pack 3888
Covers Nike Elementary


Please visit each website to find out more on how to join.

Monday, December 8, 2008

Simple Basic Chili Recipe

For anyone who wants to cook a chili batch starting with a simple recipe and then adding to it.
Think of it as a starter recipe.

2 cans 6oz tomato paste (Plus 2 6oz cans of water )
2 cans mexican/chili beans
1-2 lbs Meat. I use 1lb of ground turkey. But any meat is good.
2 tbsp chili powder - add more to taste

Cook the Meat. Put it in a 5+ Quart pot. Add everything to the pot. Bring to a boil, stirring occasionally.
Turn down to low and cover for 5 minutes. Serve.

That is a good simple recipe that makes 6+ servings. It will please everyone.

From that point you start adding your own. Start small don't add too much of 1 thing at a time. In ours we add 1 can or 1 small bag of corn. Pepper,sherry wine,garlic powder and onion powder.

At the table we add Cheddar cheese and sour cream.

Tuesday, December 2, 2008

Homemade Loft Bed Playhouse for $150

This summer our daughter wanted a playhouse. After a lot of thought we decided to go ahead and create it in her room so she could play in it in the winter also. So we started search for the best way to create it, but we could only find overly done and expensive solutions. So what follows is what we cam up with. It costed us about $150 dollars, we already has a mattress but they would only be another $50.

Off to home depot we went. We fould the 1"x6"x8' pine unfinished toungue and groove siding. They were about $6 apiece. We bought 11. We also needed the trim which we used regular ripped 1"x4"x8' trim. They were $4 each which we bought 9. A box of 2" screws about $5. White paint and pink paint and primer. about $25. 8 2"x4"x8' studs for the frame about $2 each. For the Roof we used 1 1"x6"x8' and some scrap wood for the shingles. The steps we used 1 of the 1"x4"x8' trim boards and 1 1"x6"x10' board for the risers about $4.



We removed her old bed. We have the paneling on the wall which we decided to leave. Later we would remove the carpet in her room and replace it with laminate and put purple carpet inside the playhouse.










Next step is to get your wife to paint the boards. First use primer then add the paint. The pine will soak up paint like no tommorrow.



While the primer and paint is drying time to build the frame. Pick the height you want the platform. I chose 48". Measure your mattress and build your platform. You'll need 6 pieces for the width and 2 pices for the length. Lay the 6 pieces evenly spaced and screw them together with the 2.5 or 3 inch screws. I use 2.5. Cut a piece of 3/8 inch sheathing to size and screw the down to the platform with 1.5 or 2 inch screws. I put screws in everything, you could use nails but I prefer screws because I feel they make for a tighter and stringer structure. Screw on your legs and then using a stud finder find the studs in the wall and screw the legs to them with 3.5 or 3inch screws. I also used 2 2.5" lag screws.




Part 2, now for the finish

Sunday, November 30, 2008

My Chinese Thai Noodle Recipe

16 oz of noodles (Spaghetti or whatever)
16 oz Frozen mixed vegetables
2 Eggs
1-2 lb Chicken or pork cut into strips or chunks
3 Tbsp Sugar
5 Tbsp Cooking oil
4 Tbsp Water
3 Tbsp Sherry Wine
.5-1 tsp Hot chili sauce
5 Tbsp Soy sauce
4 Tbsp Stir Fry Sauce
.5 tsp Ginger
.5 tsp Garlic Powder

Boil the noodles according to the directions. Drain and put back into pan.
Add 1 Tbsp of soy sauce
Add 2 Tbsp cooking oil
Add 16 oz Frozen Vegetables
Fry Meat till cooked
Stir in
3 Tbsp Oil
4 Tbsp Soy Sauce
4 Tbsp Stir Fry Sauce
.5 tsp Ginger
.5 tsp Garlic Powder
3 Tbsp Sugar
4 Tbsp Water
3 Tbsp Sherry Wine
.5-1 tsp Hot chili sauce

Cook for 6 minutes
Pour Meat and sauce over Noodles
Scramble the 2 Eggs in the meat pan
Pour into the Noodles
Mix and Continue on low heat until the Vegetables are soft about 10 minutes

Serve. Should make about 8 servings.