• Oh noz!!! VBScript!!!

    Its been a while since I have thought about posting anything.  For the summer semester I am taking CPT-114 which is basically Visual Basic, but thus far its mostly been VBScript, a Microsoft proprietary javascript wannabe.  I finally got to a script which was complex enough to post.  Basically, its a program that generates a list of gifts for a wedding registry sorted by side of the wedding party, the original assignment also said to make an additional list of gifts that were repeated, but the instructor said we could omit the last part due to the complexity.   Well that sounded like a challenge to me, so this is what I spaghetti-coded.   (I hope it fits)

    <script language="vbScript" type="text/vbscript">
    option explicit
    dim name, faction, gift, bride_text_out, groom_text_out, groom_counter, bride_counter, flag, flag1, flag2
    dim gift_counter, gift_index_list, current_gift, length_check, one_cut, gift_pointer2, single_flag, record_count
    dim gift_list, name_list, eof_flag, gift_index_flag, gift_pointer, gift_name, gift_precount
    set gift_index_list = createobject("scripting.dictionary")
    set gift_list = createobject("scripting.dictionary")
    flag = "yes"
    Do while flag="yes"
    name = inputbox("Enter name:")
    faction = inputbox("Enter faction: (bride/groom)")
    gift = inputbox("Enter gift name:")
    record_count = record_count + 1
    if faction = "bride" then
    	 bride_counter = bride_counter + 1
    	 bride_text_out = bride_text_out  & bride_counter & ". " & name & ": " & gift & "<br>"
    	 groom_counter = groom_counter + 1
    	 groom_text_out = groom_text_out  & groom_counter & ". " &name & ": " &gift & "<br>"
    end if
    gift_counter = gift_counter + 1
    gift_index_list.add gift_counter, gift
    if gift_list.exists(gift) then
    	 		if left(gift_list.item(gift),1) = "1" then
    				 one_cut = len(gift_list.item(gift)) - 1
    				 name_list = "1" &name &"<br>"
    	 			 name_list = name_list + right(gift_list.item(gift), one_cut)
    					name_list = "1" &name &"<br>"
    	 				name_list = name_list + gift_list.item(gift)
    			end if
    			gift_list.add gift, name_list
    			name_list = name &"<br>"
    			gift_list.add gift, name_list
    end if
    flag = inputbox ("Would you like to add another gift? (yes/no)")
    document.write "Gifts on the bride side:" &"<br>"
    document.write bride_text_out
    document.write "<br>"
    document.write "Gifts on the groom side:" &"<br>"
    document.write groom_text_out
    document.write "<br>"
    gift_pointer = 0
    gift_pointer2 = 0
    gift_name = 0
    do while flag1 = 0
    gift_pointer2 = gift_pointer2 + 1
    gift_pointer = gift_pointer2
    gift_name = gift_index_list.item(gift_pointer)
    	do while record_count > gift_pointer
    	gift_pointer = gift_pointer + 1
    		if gift_index_list.item(gift_pointer) = gift_name then
    		end if
    		if gift_pointer2 >= record_count then
    		flag1 = 1
    		end if
    gift_pointer = 1
    do while record_count >= gift_pointer
    	 if gift_index_list.item(gift_pointer) <> "" and Left(gift_list.item(gift_index_list.item(gift_pointer)),1) = "1" then
    	 document.write "Multiple " &gift_index_list.item(gift_pointer) &" by:<br>"
    	 length_check = len(gift_list.item(gift_index_list.item(gift_pointer))) - 1
    	 document.write right(gift_list.item(gift_index_list.item(gift_pointer)),length_check)
    	 document.write "<br>"
    	 end if
    gift_pointer = gift_pointer + 1
    document.write ("<br>Spaghetti-coded by <a href='http://bradlavario.info'>Brad LaVario</a>")

    Okay it didn’t quite fit, but here is a link to it.

    note:  it will ONLY run in IE (Internet Explorer).


  • Bold and Italics fix

    Sometime last night I noticed my bold and italics were not working, so I had to find a fix for it.


    I found it here.


    I figured I would go ahead and post it, just because the more places you post a fix, the easier it is for someone to find it on Google.  (…and I get to use my codebox again, YAY!!!)


    Delete, or “comment out” the following code from your theme’s style.css:

    font-weight: inherit;
    font-style: inherit;
    font-size: 100%;
    font-family: inherit;

    *note: this code may appear on one very long line or in multiple lines like I have listed, either way comment them out or remove them.


    In other news, I figured out how to set the timezone in WordPress, so now all my posts will not be at weird times… err well, they will be at the correct weird times.

  • Codebox

    With my last post, I found a need for creating a box type in my blog to list code, be it CSS, HTML, JQuery, or what not.


    My first shot at this was downloading a plug-in for it, but it basically made multi-color code on white background and honestly, it worked okay, but it was not the look I wanted. Next I tried making a custom <pre> box, this worked well, black text on a cyan box background, but in the process of coding this, I remembered Soh Tanaka‘s tutorial section on his website.  His code boxes looked awesome, and though I would not be adding twenty-seven miles of JQuery code to make it scroll and do mouseover craziness, I wanted to try to get something that looked similar.


    So once again we dive into my theme’s style.css sheet, and add some stuff.


    This is the <pre> CSS section I added, and this is what it looks like when used:


    pre {
    	background: url(images/pre-back.jpg);
    	border: solid 2px #999999;
    	font-size: 12px;
    	line-height: 20px;
    	color: black;
    	margin: 10px;
    	padding: 10px;


    The graphic   in the background is simply a 40px by 40px square with cyan on top for 10px, white in the middle for 20px, and cyan once more on the bottom for 10px, it does not have to be more than 1px wide, but I made it 40px here so it could be better shown in the blog.  To use this after you change the CSS, all you have to do is click the HTML tab when editing a post and place your listing between <pre></pre> tags, and you are ready to go.


  • Themes

    Well after about 3-4 hours of looking and trying 5 different themes I have one I will run for a while.  I did not realize it would be so time consuming as I wanted a certain look, but I also wanted the functionality to work as a website (page links on top, blog stuff on the side)  took me a few tries.


    I settled on Carbonize theme from wordpress.org, I did have to make a minor style sheet hack as it was doing that annoying Firefox outline on graphic links that drives me crazy, I eventually just cut all link outlines with this:


    a {outline: none;}

    (added to my theme’s style.css file)


    I also had to re-make my metal&glass “W” graphic as the boxes in this theme are not a set color. It took me a while to figure out they had some sort of  transparent tile in the boxes, it looked one color but there were slight variations in random places that would never let a solid color .jpg match the box around it. I wound up changing it from a jpeg with a #080808 background color to a .png file with a transparent background, a .png will have a slightly higher load time, but at least, it matches.


    Thus far the WordPress code seems to load pretty quick, so I don’t think a few extra fat graphics will slow it down much.


  • Setting up WordPress!

    I am setting up WordPress today, as this will be my “sandbox” for all things WordPress, plus it gave me an excuse to make a new metal&glass graphic.