Friday, March 11, 2016

Making a cascading (dependent) Excel drop down list

Making a cascading (dependent) Excel drop down list





Today, we are going to investigate this feature in-depth and learn how to create cascading drop down lists that display choices depending on the value selected in a previous dropdown.

How to create a simple cascading dropdown in Excel

Making simple dependent drop-down lists in Excel is easy. All you need is a few named ranges and the INDIRECT formula. This method works with all versions of Excel 2007, 2010 and 2013.

1. Type the entries for the drop-down lists.

First off, type the entries you want to appear in the drop-down lists, each list in a separate column. For example, I'm creating a cascading dropdown of fruit exporters and column A of my source sheet (Fruit) includes the items of the first dropdown and 3 other columns list the items for the dependent dropdowns.



Sunday, January 17, 2016

Creating a SCRUD System Using jQuery, JSON and DataTables

Creating a SCRUD System Using jQuery, JSON and DataTables

http://www.sitepoint.com/creating-a-scrud-system-using-jquery-json-and-datatables/

Every non trivial software allows to manipulate data, generally stored in a database. The acronymSCRUD refers to the basic manipulation functions that the user needs to work with the available data: Search, Create, Read, Update and Delete.

In this article we'll create a web application which empowers the user to search a database and fully manage its content. The system is based on jQuery, JSON, and the popular DataTables and jQuery Validation plugins.

The interface of the SCRUD application

What We'll Use

In this section I'll briefly cover the libraries and plugins I'll employ in this tutorial.

jQuery and Ajax

jQuery is a free, open source and cross-platform JavaScript library which simplifies client-side HTML scripting. jQuery makes it easier to select the DOM elements and perform DOM manipulation operations, and handle events, such as mouse clicks and keyboard input. In my opinion, jQuery is the de facto standard for creating Ajax applications.

Ajax is a technique that allows you to execute HTTP requests asynchronously. This means that web applications can retrieve data from and send data to the web server without fully reloading the web page.

At SitePoint we've covered jQuery and Ajax multiple times. If you need a refresh on these topics, you can take a look at these articles:

This tutorial will show you how to create a SCRUD application which performs all the tasks without having to reload the web page even once.

JSON

For the transfer of data between the application and the web server we'll use the JSON format. The JSON data format is based on attribute-value pairs, which means that each attribute has both a value and a name to identify it.

DataTables and jQuery Validation Plugins

jQuery is very suitable to use in conjunction with plugins and it's designed to be easily extensible. In this tutorial we'll employ two plugins. The first one is called DataTables. It adds advanced interaction controls to ordinary HTML tables such as pagination, search functionality, and column sorting. The second isjQuery Validation which makes it easier to validate form elements.

Getting Started

For our example we'll create the following files in the same folder:

  • data.php: the PHP script that will perform the database tasks
  • index.html: the HTML file of our interface
  • layout.css: the CSS file containing the style of our web application
  • webapp.js: the JavaScript file, written using jQuery, which manages the front-end actions and events

You can download all the source code from my repository on GitHub. Apart from that, you'll need a functioning MySQL database.

The first task is to create a new HTML5 file called index.html consisting of:

  • An Add button
  • A mostly empty table (which will display the database data)
  • An add/edit form
  • A noscript message
  • A message container
  • A loading message container

In the head section of the HTML file we load jQuery version 1.11.2. This file is downloaded from a Google server. As stated here:

the Google Hosted Libraries service is a stable, reliable, high-speed and globally available content distribution network for many popular open-source JavaScript libraries.

DataTables provides a similar CDN. We load DataTables version 1.10.0 from their network and the jQuery Validation plugin version 1.13.1 from a CDN to get things started.

Monday, December 14, 2015

Script For Login, Logout and View Using PHP, MySQL and Bootstrap

Script For Login, Logout and View Using PHP, MySQL and Bootstrap

By Ehtesham Mehmood on Nov 25, 2014
This article shows how to make a login, logout and view script using PHP, MySQL and Twitter Bootstrap.

Wednesday, October 7, 2015

Excel Function for Amn2Word macro



Option Explicit
'Main Function
Function Amt2Word(ByVal MyNumber)
    Dim Dollars, Cents, Temp
    Dim DecimalPlace, Count
    ReDim Place(9) As String
    Place(2) = " Thousand "
    Place(3) = " Million "
    Place(4) = " Billion "
    Place(5) = " Trillion "
    ' String representation of amount.
    MyNumber = Trim(Str(MyNumber))
    ' Position of decimal place 0 if none.
    DecimalPlace = InStr(MyNumber, ".")
    ' Convert cents and set MyNumber to dollar amount.
    If DecimalPlace > 0 Then
        Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
                  "00", 2))
        MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If
    Count = 1
    Do While MyNumber <> ""
        Temp = GetHundreds(Right(MyNumber, 3))
        If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars
        If Len(MyNumber) > 3 Then
            MyNumber = Left(MyNumber, Len(MyNumber) - 3)
        Else
            MyNumber = ""
        End If
        Count = Count + 1
    Loop
    Select Case Dollars
        Case ""
            Dollars = "No Dollars"
        Case "One"
            Dollars = "One Dollar"
         Case Else
            Dollars = Dollars & " Dollars"
    End Select
    Select Case Cents
        Case ""
            Cents = " and No Cents"
        Case "One"
            Cents = " and One Cent"
              Case Else
            Cents = " and " & Cents & " Cents"
    End Select
    Amt2Word = Dollars & Cents
End Function
 
'Main Function
Function SpellNumber(ByVal MyNumber)
    Dim Dollars, Cents, Temp
    Dim DecimalPlace, Count
    ReDim Place(9) As String
    Place(2) = " Thousand "
    Place(3) = " Million "
    Place(4) = " Billion "
    Place(5) = " Trillion "
    ' String representation of amount.
    MyNumber = Trim(Str(MyNumber))
    ' Position of decimal place 0 if none.
    DecimalPlace = InStr(MyNumber, ".")
    ' Convert cents and set MyNumber to dollar amount.
    If DecimalPlace > 0 Then
        Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
                  "00", 2))
        MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If
    Count = 1
    Do While MyNumber <> ""
        Temp = GetHundreds(Right(MyNumber, 3))
        If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars
        If Len(MyNumber) > 3 Then
            MyNumber = Left(MyNumber, Len(MyNumber) - 3)
        Else
            MyNumber = ""
        End If
        Count = Count + 1
    Loop
    Select Case Dollars
        Case ""
            Dollars = "No Dollars"
        Case "One"
            Dollars = "One Dollar"
         Case Else
            Dollars = Dollars & " Dollars"
    End Select
    Select Case Cents
        Case ""
            Cents = " and No Cents"
        Case "One"
            Cents = " and One Cent"
              Case Else
            Cents = " and " & Cents & " Cents"
    End Select
    SpellNumber = Dollars & Cents
End Function
      
' Converts a number from 100-999 into text
Function GetHundreds(ByVal MyNumber)
    Dim Result As String
    If Val(MyNumber) = 0 Then Exit Function
    MyNumber = Right("000" & MyNumber, 3)
    ' Convert the hundreds place.
    If Mid(MyNumber, 1, 1) <> "0" Then
        Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
    End If
    ' Convert the tens and ones place.
    If Mid(MyNumber, 2, 1) <> "0" Then
        Result = Result & GetTens(Mid(MyNumber, 2))
    Else
        Result = Result & GetDigit(Mid(MyNumber, 3))
    End If
    GetHundreds = Result
End Function
      
' Converts a number from 10 to 99 into text.
Function GetTens(TensText)
    Dim Result As String
    Result = ""           ' Null out the temporary function value.
    If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19...
        Select Case Val(TensText)
            Case 10: Result = "Ten"
            Case 11: Result = "Eleven"
            Case 12: Result = "Twelve"
            Case 13: Result = "Thirteen"
            Case 14: Result = "Fourteen"
            Case 15: Result = "Fifteen"
            Case 16: Result = "Sixteen"
            Case 17: Result = "Seventeen"
            Case 18: Result = "Eighteen"
            Case 19: Result = "Nineteen"
            Case Else
        End Select
    Else                                 ' If value between 20-99...
        Select Case Val(Left(TensText, 1))
            Case 2: Result = "Twenty "
            Case 3: Result = "Thirty "
            Case 4: Result = "Forty "
            Case 5: Result = "Fifty "
            Case 6: Result = "Sixty "
            Case 7: Result = "Seventy "
            Case 8: Result = "Eighty "
            Case 9: Result = "Ninety "
            Case Else
        End Select
        Result = Result & GetDigit _
            (Right(TensText, 1))  ' Retrieve ones place.
    End If
    GetTens = Result
End Function
     
' Converts a number from 1 to 9 into text.
Function GetDigit(Digit)
    Select Case Val(Digit)
        Case 1: GetDigit = "One"
        Case 2: GetDigit = "Two"
        Case 3: GetDigit = "Three"
        Case 4: GetDigit = "Four"
        Case 5: GetDigit = "Five"
        Case 6: GetDigit = "Six"
        Case 7: GetDigit = "Seven"
        Case 8: GetDigit = "Eight"
        Case 9: GetDigit = "Nine"
        Case Else: GetDigit = ""
    End Select
End Function
    



Sunday, November 16, 2014

Fwd: Google Ropes in 300 Partners for Online Shopping Fest



Nov 15 2014 : The Economic Times (Mumbai)
Google Ropes in 300 Partners for Online Shopping Fest
Rasul Bailay
New Delhi


Three-day fest, beginning December10, likely to reach 100 m consumers; cos plan high-decibel ad campaign, both online & offline
Google has roped in 300 offline and online retailers and consumer companies for its Great Online Shopping Festival that is expected to reach 100 million consumers this year, riding on the frenzy of online shopping in recent weeks.

The Great Online Shopping Festival (GOSF), to be held from December 10 to 12, is expected to see participation of various consumer durable, FMCG and e-commerce firms in India.

The organisers will also run a twoweek run-up campaign by reserving each day for a single company to partner in a day-long offers and contests for consumers, said top executives of some ecommerce companies participating in the event.

Google and various e-commerce partners plan heavy-duty online advertising while consumer brands will do offline campaigns such as hoarding and other outdoor activities, said a senior executive of an e-commerce company. "On that days they are trying to get more exclusive launches. They are talking to companies like Samsung, Philips and Motorola to launch products during these days," the person said.

Nitin Bawankule, director for ecommerce at Google India, declined to comment.

In a season of mega online sales, Google's third edition of GOSF is expected to create a bigger hype than the last two years as it plans to line up products ranging from FMCG, consumer durables and fashion lifestyle segments to arts and collectibles, travel packages and even two-wheelers, according to sources quoted earlier.

This year, the organisers will also introduce digital walls in various cities where consumers can order through their smartphones by scanning the QR codes of the products, they said.

A top executive of an e-commerce firm said GOSF will also introduce a special segment called "299 corner" where branded products priced between ` . 1500 will . 600 and ` . 299. The products will be be sold at ` delivered free of charge and there will be cash-on-delivery option to woo first-time online consumers.

The person also said that in the 14 days between November 27 and December 9, a lucky winner everyday will get to shop for free among a host of select items.

Google started GOSF in 2012. Last year it got almost 16 million hits on all partner sites despite technical glitches in the first day, and almost 40% of the traffic came from tier 2 and tier 3 cities.