June 28, 2008

Sandy Neck






Sand neck is hands down my favorite beach on the cape. I can sum up why with two words, "sand bars". This is at low tide, high tide is never as fun, but that goes for every ocean beach. There is no other beach in my opinion on the cape that has better swimming conditions. You can walk a good hundred feet out and still be able to stand on the sand below. The waves are not big, but they are always fun to ride into shore by just floating. The one downside is that the water is always a bit colder, but that has never been a big deterrent.

If you are not swimming you can walk for miles and miles. While walking I have always found the best sea creatures at sandy neck, from big crabs to my favorite starfish. Near the shore there are areas of small rock that hide all sorts of creatures, which is one of the main reasons that I am so enamored with starfish. The sand is also really good for building, and it never fails that I end up helping my younger cousins build a huge dam to hold back the water flowing out from the sand bars with the tide.

The fun does not stop at night, you are allowed to drive out and build a bon fire on the further parts of the beach. Summer would not be complete with out smores on the beach.

If you spend some time on the cape during the summer you must check out sandy neck, you do not know what you are missing!

June 21, 2008

ASP Stock Ticker

Another little ASP script that I had to whip up was a stock ticker. I had searched around for a free javascript version, however they where either way to complicated and ad ridden to use, or they just did not work. So like most situation call for I just gave up on that idea and whipped up my own version.

It is very simple, it just pulls the CVS data on the stock from yahoo finance and prints out a table row, that way I can use single calls in a table row, and just make a new row and call for each different stock. Also I have an up and down arrow image, but you can make your own. This should be a good starter for people looking for a simple stock ticker. I am using an asp include to call the whole page for code simplification, but you can just drop the code in a page and it will work.


<%
function getQuote(name,location)
strURL = location
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.open "GET",strUrl, false
objXMLHTTP.send
ProcessUrl = objXMLHTTP.ResponseText
Set objXMLHTTP = Nothing
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")

dim quote
quote = Array()

' Split the string at the comma characters and add each field to a ListBox
quote = Split(ProcessUrl, ",")

if quote(4) >= 0 then
Response.Write "<td>" & name & "</td><td><img src='images/up.gif'></td><td><font color='green'>" & quote(1) & "</font></td><td><font color='green'>" & quote(4) & "</font></td>"
else
Response.Write "<td>" & name & "</td><td><img src='images/down.gif'></td><td><font color='red'>" & quote(1) & "</font></td><td><font color='red'>" & quote(4) & "</font></td>"
end if
end function
%>

<center>
<h3>Stock Ticker</h3>
<table width="190" border="0" cellspacing="1" cellpadding="1">
<tr>
<% getQuote "Dow", "http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI&f=sl1d1t1c1ohgv&e=.csv" %>
</tr>
<tr>
<% getQuote "Nasdaq", "http://download.finance.yahoo.com/d/quotes.csv?s=%5EIXIC&f=sl1d1t1c1ohgv&e=.csv" %>
</tr>
<tr>
<% getQuote "S&P 500", "http://download.finance.yahoo.com/d/quotes.csv?s=%5EGSPC&f=sl1d1t1c1ohgv&e=.csv" %>
</tr>
<tr>
<% getQuote "10Yr Bond(%)", "http://download.finance.yahoo.com/d/quotes.csv?s=%5ETNX&f=sl1d1t1c1ohgv&e=.csv" %>
</tr>
</table>
</center>

June 12, 2008

ASP Ad Generator

After playing with ASP for a while I figured out what I would need and started off programing with a internet browser open to w3schools asp page. My idea is grab a config file read it in and choose a random ad from it and display. At first I though of using ajax to pull the content, however I would rather avoid using ajax, because if javascript is not turned on then no ads will be displayed. Instead I like that fact that you can include asp pages and then call the function, this also allows you to specify a width, and maybe if needed I will add some other parameters later. So far works quite well, but still is in development.

ASP Generator


<%
'//////////////////////////////////////////////////////////////////////////
'Display ads when function is called
'//////////////////////////////////////////////////////////////////////////
function displayAd(width)
config = Array()
config = ReadConfigFile("///path to config file///")

' Count the elements in the array
dim count
for each arrValue in config
count = count+1
next

'Will give the correct ad count based off of interger division + 1
count = count \ 4 + 1

randomize()
adchoice = 4 * Int(count * Rnd)

Response.Write "<div class='" & config(adchoice+2) & "' style='background-color: " & config(adchoice+1) & "; width: " & width & "'>"
Response.Write "<p>" & config(adchoice) & "</p>"
Response.Write "</div>"
end function

'//////////////////////////////////////////////////////////////////////////
'Read from file and grab contents for ad display
'//////////////////////////////////////////////////////////////////////////
function ReadConfigFile(Filename)
const ForReading = 1, ForWriting = 2, ForAppending = 3
const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
strAllFile = Array()

' Create a filesystem object
dim FSO
set FSO = server.createObject("Scripting.FileSystemObject")

' Map the logical path to the physical system path
dim Filepath
Filepath = Server.MapPath(Filename)

if FSO.FileExists(Filepath) Then

set TextStream = FSO.OpenTextFile(Filepath, ForReading, false, TristateUseDefault)

' Read file in one hit
Counter = 0
do while not (TextStream.AtEndOfStream)
redim preserve strAllFile(Counter)
strAllFile(Counter) = TextStream.ReadLine
Counter = Counter + 1
loop
TextStream.Close
else
Response.Write "<h3><i> Config does not exist </i></h3>"
end if

set FSO = nothing
ReadConfigFile = strAllFile
end function
%>


Include & call

<!--#include file="adgenerator.asp"-->
<% displayAd(300) %>


Config file test

This is a ad in a rounded box...
#999999
adboxround'

This an ad in a box...
#235689
adboxsquare

June 10, 2008

50 Posts & ASP

Wow it has been over a half year since I started this blog!

For my internship I have been working an an updated site for Prescott Brokerages Services, and after getting the layout pretty much finished I I needed a very simple login page for agents, easy for me except for the fact that I can not use PHP, their web hosting company Webfodder uses Microsoft Server and only supports ASP. So just like last summer with learning PHP this time I am learning ASP. Luckily like most programing languages, it is close enough to PHP that I am having no problems picking it up. It may be just me but ASP reminds me of Fortran mixed with PHP.

It only took a few minutes to whip up a simple login script


<%
'// Check login if used, otherwise ignore
if request.form("pass")="password" then
'// Redirect to another page if correct
Response.Redirect "other_page.html"
end if
%>


This i pulling from a form on the home page, luckily it only need to be deterrent for legal reasons and not a full secure page, otherwise I would never hard code it.

June 8, 2008

Diving for Moorings


My grandparents have kept a few mooring on the lake they live next to for many years, and it is always an adventure getting them ready for the summer. Two years ago I had to dive and snake cable through 20 cinder blocks for the pontoon boat, and this year it was locating sunken mushroom anchors. Apparently they had sunk the moorings for the winter, but ice still developed too much and ripped the chains off, leaving the anchors sticking up some where on the bottom. I thought that they might have fallen over, but the mud ends up covering it rather well and securing it to the bottom.

As you can see from the picture my uncle and I went off from the beach and swam towards where they should be. The problem was we did not know exactly where they where, and swam around the area for about ten minutes till we found the first one, it was sticking up with a rope still floating off it. Still it was about 10 or so feet down and took a bit of looking to locate it. The second anchor was far worse, we had hopped that it was in a straight line, but some how ended up twenty feet off in the deeper water. I must say we where lucky to even find it, because we had to dive down about five feet just to see it, and took another ten or so minutes to actually find. Then even getting down to it took a full breath. I am used to diving five or eight feet but I usually avoid past ten because the pressure really starts to hurt my ears. Fifteen feet was really pushing it and that was just to get to the eye of the anchor! Still after several dives down we got it secured and ready to be pulled up later in the week.

It is funny, because I always end up doing something with the mornings every time I am down for the summer, yet my discomfort with diving in areas I can not see the bottom never goes away, what is worse is that at those depths even on a sunny day the water is too murky to see the bottom clearly. So I always have this vision of going down and meeting up with the huge snapper that lives in the lake (I have seen it it, is huge!), On the swim back near the shore we actually did end up swimming by a big snapper, so I guess my fears are not completely unfounded.

UPDATE: Upon pulling them from the bottom, they ended up not even the ones we where looking for. Oh well still cleaned up the lake!

June 6, 2008

Summers of Rappelz


Well it is summer again, and once again I have picked up playing Rappelz. It is a free to play MMORPG that I got slightly addicted to last summer. I have never got into the whole wow addiction, mostly because I am cheap and would never pay sums of my money just to play a game. Still I had wanted to check out what the big fuss was over it, luckily I ended up seeing an advertisement for Rappelz and on a whim decided to check out, I ended up liking it and continued to play it through most of the summer till I hit level 40, got bored and returned to school and now it has been a whole year.

(Yes the picture is a good screenshot I took of actual game play. What I like sitting near trees, haven't you noticed?)

Rappelz is fun, for the first 21 levels, after that it starts to slow, but having friends to play with helps starve off getting bored. I am not much for meeting people online, instead I had several of my friends from school also pick it up and play me me. Now my cousin wants to play, so I will start a new character and help him out, not that it hurts having a level 42 character as backup, a ton of items in storage, and over 3,000,000 in the bank. However I am sure I will probably quickly get bored again and start working on other projects.

If you too have been wanting to play a mmorpg, check out Reppelz, it is free and looks good so you can't beat that combo, and if you don't like it, hey you lost nothing but time in the process. The players are generally friendly, at least on the Tortus Server that I play on. You may even see me run by, keep an eye out for Efeion or my new cleric character Feiona and our Kampers Guild.

June 4, 2008

Rounded Corners


A big trend with web design right now is rounded corners on most rectangles. This is understandable, because when I am doing woodwork I smooth the edges, it just gives it a much more finished look, compared to rough or pointy edges. Not to mention in an artistic sense it both keeps the users eye path from moving around as much and helps the page as a whole blend. Corners tend to point in a direction or cause a UI element to stand out. Of course this is all contingent on how the page is designed.

Still I have done rounded corners for other sites with a brute force method, with separate positioning for both Firefox/Safari & IE7 because they rarely are the same. It looked good, but was annoying to implement, and that was only two corners, four would be much worse. Luckily there are now some options that make the job much easier. However there seems to be a big debate on what is the better method to use. One is raw css positioning like I had done, more work, but the benefit is low load times, just what the corner images need. The other way is with javascript I found Nifty Cube, a very simple and easy to use javascript engine that does all the work for you. The problem is that it loads after the page, and takes a small chuck of the users processing to run. This was not that big a lose so I was happy with the results.

Check it out if you need round corners, still not perfect, in the fact that it only does solid colors, however the only issue I have had is that it draws the corners across the top and bottom, so you need to pad divs by about 10px for it to work out.

June 3, 2008

Google Fight

1...2...3...Fight, oh I mean search!

While looking up something for work, I stumbled apon GoogleFight, which lets you pit two search terms against each other. It is a goofy little web app, but fun to try out, if you run out of ideas you can use the list of funny or recent fights. It can be a little disturbing watching the last 20 fights because as you constantly refresh you can see the terms that people are using, some of which can be just plain wrong...

Just goes to show you there is always more to find online.

June 2, 2008

CSS Layouts

Now that I have started my internship/summer job redoing the Prescott Brokerage Website I have remembered just how much a pain it is to start a new CSS layout from scratch, not that it is not fun to get the elements positioned properly, but but when you are working, it is not professionally to spend several hours getting a basic template built when there are plenty of resources online. Luckily there are sites like Free-CSS that have a huge number of free CSS layouts that make the job so much easier.

Now when I am taking about CSS layouts I am not taking about the already finished ones, those are finished CSS templates, I am talking about the blank ones that simply have the placement all set to go. You should be able to do your own designs! You guys know who I am referring to... ^_^