Alynnlee: Daniel


Home Account Search
Extreme Programming - Custom Form Control
Did some extreme programming.  It was pretty awesome. 

Me and Charlie started making a custom form control that will suck in all the form values and enter it into the Database and/or send out an email.

Much more complicated than it looks.
Javascript Rollover Change Subnavigation InnerHTML

// JavaScript Document

silverdivid = "secnav";

function rolloverit(which) {

silverdiv = document.getElementById(silverdivid);

if (which == "products") {

silverdiv.innerHTML="<ul><li><a target='_self' title='SL-700 Series' href='#'>SL-700 Series</a></li><li><a target='_self' title='SL-500 Series' href='#'>SL-500 Series</a></li><li><a target='_self' title='SL-300 Series' href='#'>SL-300 Series</a></li><li style='padding: 0px;'><a target='_self' title='Accessories' href='#'>Accessories</a></li></ul>";

}

else if (which == "wheretoshop") {

silverdiv.innerHTML="<ul><li><a target='_self' title='US Retail Locator' href='#'>US Retail Locator</a></li><li><a target='_self' title='Internet Retailers' href='#'>Internet Retailers</a></li><li><a target='_self' title='International Retailers' href='#'>International Retailers</a></li></ul>";

}

else if (which == "aboutus") {

silverdiv.innerHTML="<ul><li><a target='_self' title='History' href='#'>History</a></li><li><a target='_self' title='Job Opportunities' href='#'>Job Opportunities</a></li><li><a target='_self' title='Our Other Companies' href='#'>Our Other Companies</a></li><li><a target='_self' title='In the News' href='#'>In the News</a></li></ul>";

}

else if (which == "technology") {

silverdiv.innerHTML="<ul><li><a target='_self' title='MOI Story' href='#'>MOI Story</a></li><li><a target='_self' title='Weighting & Features' href='#'>Weighting & Features</a></li></ul>";

}

else if (which == "customerservice") {

silverdiv.innerHTML="<ul><li><a target='_self' title='Product Registration' href='#'>Product Registration</a></li><li><a target='_self' title='Track Your Order' href='#'>Track Your Order</a></li><li><a target='_self' title='FAQ's' href='#'>FAQ's</a></li></ul>";

}

setCurrentPage();

}


menuItems=["portfolio.aspx", "services.html", "aboutus.html", "contact.aspx", "portfoliostatic.html"];

App_Code with different Source file types
It urks me how Visual Studio goes crazy when you have both a .CS and .VB in the same webroot's App_Code folder.

I think that if you buy into the whole .Net framework, then it should be able to switch between different code layers painlessly.

I guess we can all look forward to VS2008.

-Daniel
Python: Wunderground Todays Weather to Email SMS to Phone
logo.gif
I could see somebody setting this as a cron task to send every morning so when you wake up, you get the current weather as a text message. 

I am about to set it up. 

Enjoy
------------------------------------------------------------

import urllib2
import time
ZIP = "20190"
ACCOUNT = ""  # put your gmail email account name here
PASSWORD = ""  # put your gmail email account password here
to_addrs = "daxxxxxs@gmail.com, 8045555555@vtext.com"
subject = "Wunderground Email"

try:
    f = urllib2.urlopen('http://www.wund.com/cgi-bin/findweather/getForecast?query='+ZIP)
    page = f.read()
    i = page.find('<div id="main">')
    page2 = page[i:]
    i = page2.find("<span>")+6
    page = page2[i:]
    i = page.find("</span>")
    temperature = page[:i]

    i = page.find("<h4>")+4
    page = page[i:]
    i = page.find("</h4>")
    current = page[:i]

    i = page.find("<span>")+6
    page = page[i:]
    i = page.find("</span>")
    wind = page[:i]
   

    i = page.find("<span>")+6
        page = page[i:]
        i = page.find("</span>")
        dewpoint = page[:i]
       

    i = page.find("<b>")+3
        page = page[i:]
        i = page.find("</b>")
        pressure = page[:i]
   

        i = page.find('<div class="b">')+15
        page = page[i:]
        i = page.find("</div>")
        humidity = page[:i]
       
   
        i = page.find("<span>")+6
        page = page[i:]
        i = page.find("</span>")
        visibility = page[:i]
       

    page = page[9:]
   
        i = page.find("</span>")+8
        page = page[i:]
        i = page.find("</h5")
        updated = page[:i]
       
   
    i = page.find('<div id="forecast">')
    page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
    i=page.find('</span>')
    d1n = page[:i]
       
    i = page.find('<div>')+4
    page = page[i:]
    i = page.find('<div>')+5
    page = page[i:]
    i = page.find('</div>')
    d1 = page[:i]
   
    page = page[i:]
    i = page.find('<span>')+6
    page = page[i:]
    i = page.find('</span>')
        d1h = page[:i]
        
    page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
        i = page.find('</span>')
        d1l = page[:i]
           
    i = page.find('<td')
    page = page[i:]

#===================
        i = page.find('<span>')+6
        page = page[i:]
        i=page.find('</span>')
        d2n = page[:i]
       
        i = page.find('<div>')+4
        page = page[i:]
        i = page.find('<div>')+5
        page = page[i:]
        i = page.find('</div>')
        d2 = page[:i]
       
        page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
        i = page.find('</span>')
        d2h = page[:i]
       
        page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
        i = page.find('</span>')
        d2l = page[:i]
       
        i = page.find('<td')
        page = page[i:]

#===================
        i = page.find('<span>')+6
        page = page[i:]
        i=page.find('</span>')
        d3n = page[:i]
       
        i = page.find('<div>')+4
        page = page[i:]
        i = page.find('<div>')+5
        page = page[i:]
        i = page.find('</div>')
        d3 = page[:i]
       
        page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
        i = page.find('</span>')
        d3h = page[:i]
       
        page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
        i = page.find('</span>')
        d3l = page[:i]
       
        i = page.find('<td')
        page = page[i:]

#===================
        i = page.find('<span>')+6
        page = page[i:]
        i=page.find('</span>')
        d4n = page[:i]
       
        i = page.find('<div>')+4
        page = page[i:]
        i = page.find('<div>')+5
        page = page[i:]
        i = page.find('</div>')
        d4 = page[:i]
       
        page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
        i = page.find('</span>')
        d4h = page[:i]
       
        page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
        i = page.find('</span>')
        d4l = page[:i]
       
        i = page.find('<td')
        page = page[i:]

#===================
        i = page.find('<span>')+6
        page = page[i:]
        i=page.find('</span>')
        d5n = page[:i]
       
        i = page.find('<div>')+4
        page = page[i:]
        i = page.find('<div>')+5
        page = page[i:]
        i = page.find('</div>')
        d5 = page[:i]
       
        page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
        i = page.find('</span>')
        d5h = page[:i]
       
        page = page[i:]
        i = page.find('<span>')+6
        page = page[i:]
        i = page.find('</span>')
        d5l = page[:i]
       
        i = page.find('<td')
        page = page[i:]


except URLError, e:
    print e.code
    print e.read()

#print "Temp:" + temperature
#print "Current" + current
#print "Wind: " + wind
##print "Dew: "+ dewpoint
#print "Pressure:" + pressure
#print "Humid:" + humidity
#print "Visib:" + visibility
#print "Updated: " + updated

#print d1n + "-" + d1 + ":" + d1h + "/" + d1l
#print d2n + "-" + d2 + ":" + d2h + "/" + d2l
#print d3n + "-" + d3 + ":" + d3h + "/" + d3l
#print d4n + "-" + d4 + ":" + d4h + "/" + d4l
#print d5n + "-" + d5 + ":" + d5h + "/" + d5l

#temperature, current, wind, dewpoint, pressure, humidity, visibility
#    updated, dXn, dX, dXh, hXl (x=1-5, h=high, l=low, n=name)

subject += updated
msg = "Now:"+current+"-"+temperature
msg += "\r\nHum:"+humidity
msg += "\r\n"+d1n + "-" + d1 + ":" + d1h + "/" + d1l
msg += "\r\n"+d2n + "-" + d2 + ":" + d2h + "/" + d2l
msg += "\r\nUpdated:"+updated




import smtplib
HOST = "smtp.gmail.com"
PORT = 587

try:
    server = smtplib.SMTP(HOST,PORT)
    #server.set_debuglevel(1)    # you don't need this
    server.ehlo()
    server.starttls()
    server.ehlo()
    server.login(ACCOUNT, PASSWORD)
    headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (ACCOUNT, to_addrs, subject)
    server.sendmail(ACCOUNT, to_addrs, headers + msg)
    server.quit()
except:
    time.sleep(1)