Rodney's profileRodster on the WebPhotosBlogGuestbookMore Tools Help

Blog


    August 25

    Javascript Popups

    Someone asked me on how to do those cool pop-ups on webpages and that the pop-ups will not require any postbacks (site refreshing from the server).  Here’s how I do it and have used the same concept on our company’s website (www.lanesystems.com) as well as on our web application products.

    The simplest is to embed the following code in your website:

    window.open ("mypopuppage.aspx","title appears here","status=1,toolbar=1");

    For example, the code below will show a splash screen for your web application:

    <html>
    <head>
    <title>splash sscreen demo</title>
    </head>
    <script language="JavaScript1.2">
    function showMyPopup()
    {
    myPopup= window.open ("popupContent.aspx", "tadah!","location=1,status=1,scrollbars=1,width=400,height=200");
    myPopup.moveTo(0,0);
    }
    </script>
    <body onload="javascript: showMyPopup()">
    Cool popup demo
    </body>
    </html>

    If you do not want to use another page as your content to the popup window, you can use the document.write method to write the content on your pop-up window.  Here’s another example:

    <html>
    <head>
    <title>Another pop-up sample</title>
    </head><script language="JavaScript1.2">
    function hideMyPopup()
    {
       if(false == myPopup.closed)   {
        myPopup.close ();
       }
    }

    function showMyPopup()
    {
      myPopup = window.open("","Voila!","status=1,width=350,height=150");
      myPopup.document.write('<p>this appears in the popup</p>');  
    }
    </script>
    <body>

    <a href="javascript: showMyPopup()">Show My Window</a>
    <br /><a href="javascript: hideMyPopup()">Hide My Window</a>

    </body>
    </html>

    You can use the document.write to code forms so you can have pop-ups for asking information from the user.

    If you have noticed, there is a set of parameters you can use as the third parameter to open a window, the following are values you can use (the names are self explanatory :) try them out)  status, toolbar, location, menubar, directories, resizable, scrollbars, height, and width.

    Earth Wind and Fire

    We were lucky to handle the ticket validation (barcodes on the tickets) on the Earth Wind and Fire concert last Saturday (August 23) at the SM Davao parking area.  I’d like to share some of the photo’s I took during the show.  Enjoy! :)

    DSC_0103 DSC_0109 DSC_0199 DSC_0116 DSC_0185  DSC_0176 DSC_0220 DSC_0250 DSC_0259

    SMS in Windows Mobile

    One of the wonderful things in Windows Mobile application development is having access to the services on the Windows Mobile device itself.   SMS or text messaging is one of them.  You can intercept the messages or send messages.   This post shows how simple it is to use the services like creating and sending SMS messages.

    Comparing to other mobile platforms, using the Windows Mobile services is simpler: this means that you can be more productive by focusing more on the business logic of your mobile application than doing a lot of efforts in the plumbing of how SMS messages are sent. 

    Here’s a sample on how to send an SMS message using .NET Compact Framework on a Windows Mobile 6 device (code in VB.NET):

    Dim smsMessage As New Microsoft.WindowsMobile.PocketOutlook.SmsMessage(“09177001462”, “hello world!”)
    smsMessage.Send()

    Two lines of code and you have an SMS sending application!   Imagine how simple it is to create an enterprise messaging utility by querying a SQL Server database on the network or to an XML Web Service or WCF from the Windows Mobile device and get information like Purchase Orders that needs approval and the recipient gets informed immediately.

    Subnet Mask

    I recently got to interview a several applicants saying that they are either Cisco certified or they rate themselves higher than 5 (having 10 the highest) on being a system administrator or a network support personnel, but more than 95% of them couldn’t answer me on what a subnet mask is.   I’m not a system administrator nor a certified network engineer.  However, I thought this was basic to configuring TCP/IP based networks.  

    So what is a subnet mask?   A subnet mask is value for;

    1) determining the subnet or network address of the host
    2) a tool to determine the number of addresses and hosts in the same subnet
    3) to determine the broadcast address of the subnet or network address

    So how does the subnet mask achieve these values?

    1) To determine the subnet or network address of the host you are configuring, use the host address and the subnet mask as the operand of the “and” operator.  The result would be the subnet address or network address.    To recall, to mask means to use the binary “and” operator. Since it’s a “bi” operator, it requires two operands where the first operand is the host IP and the second operand is the subnet mask.   The “and” operator will return 1 if and only if both operands are 1 and returns zero if any of the operands are zero.

    For example:  a host with an address of 192.168.1.100 with a subnet mask of 255.255.255.0

    192.168.1.100 in binary is           11000000     10101000     00000001    01100100

    255.255.255.0 in binary is           11111111     11111111     11111111    00000000

    After doing an “and” the result is 11000000     10101000     00000001     00000000

    or in decimal it’s 192.168.1.0.    

    The basics of tcp/ip host communication is that the source will first determine if the target address belongs to the same subnet or network address. If it does then both hosts can communicate directly. If not, then it throws the data to the gateway address (the router) and routes the packet to the destination address.  Routing is another topic and I won’t cover in this post.   So in the example provided, the host 192.168.100 can communicate directly with any host as long as it belongs to the same subnet or network address or belonging to the 192.168.1.0 network.

    Here’s another example: a host with an address of 123.4.5.67 with a subnet mask of 255.255.255.248

    123.4.5.67 in binary is       01111011     00000100     00000101      01000011

    255.255.255.248 in binary  11111111     11111111     11111111      11111000

    The result of an “and” is     01111011     00000100     00000101      01000000

    or in decimal it’s 123.4.5.64

    In the example above, 123.4.5.67 can communicate directly with hosts within the 123.4.5.64 subnet or network address, else it throws data to the router or the gateway address that is also on the same subnet.

    2) To determine how many hosts are there in a subnet address is simple.   Simply count the number of zeros in a subnet mask in binary form and that number is used as an exponent to the number 2.  So in the second example above, the number of zeros in the subnet mask is 3 (the last octet is 11111000 and the number of zeros is three) so 2 to the power of 3 is 8 or there are eight IP addresses. So given the subnet 123.4.5.64, the addresses are 123.4.5.64 to 123.4.5.71.

    As an experiment, try to do an “and” for 123.4.5.72 and 255.255.255.248 and you’ll get another subnet address.  This means that 123.4.5.72 belongs to a different subnet address and requires a router in between 123.4.5.64 network to the 123.4.5.72 network.

    3) To determine the broadcast address of the subnet, get the last IP address of a subnet and you’ll get the broadcast address of a subnet.

    1> 123.4.5.64 = network address
    2> 123.4.5.65
    3> 123.4.5.66
    4> 123.4.5.67
    5> 123.4.5.68
    6> 123.4.5.69
    7> 123.4.5.70
    8> 123.4.5.71 = broadcast address

    To note, on a TCP/IP subnet there are two IP address that you cannot assign to a host; the network address and the broadcast address.  You can only use to assign to a host the addresses in between a network address and the broadcast address of a subnet. On the list above, only the 2nd to the 7th address are assignable to hosts (computers, servers, windows mobile, etc)

    So on the first example, the subnet address of 192.168.1.0 can only assign hosts with addresses of 192.168.1.1 to 192.168.1.254 (as 192.168.1.255 is the broadcast address).

    The fourth reason for a subnet mask is for determining how to partition a huge network (like the Internet) so only the number of required IP addresses are assigned to a subnet.   Planning a network is beyond the scope of this post (bug me if anyone is interested).

    Cheers!

    Oscar

    If you’ve been to Sentosa (Singapore), you’ll know who Oscar is (well, that is if you’ve taken time to see the Songs of the Sea but who wouldn’t!)

    DSC_0461 DSC_0465  DSC_0690

    DSC_0691DSC_0697 DSC_0694

    late posts

    I told myself to constantly update this blog and it took a while since my vacation.  Oh well.. here’s more updates.