Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Wednesday, March 1, 2017

ExtJs Local Storage Example

ExtJs Local Storage Example



Available link for download

Read more »

Tuesday, February 28, 2017

ExtJs 4 CheckBox Example

ExtJs 4 CheckBox Example



Available link for download

Read more »

Monday, February 27, 2017

ExtJs 4 button click example

ExtJs 4 button click example



Available link for download

Read more »

Sunday, February 26, 2017

Example uses of the Linux Command zip

Example uses of the Linux Command zip


The following examples illustrate typical uses of the command zip for packaging a set of files into an "archive" file, also called "zip file". The command uses the standard zip file format. The archive files can therefore be used to tranfer files and directories between commonly used operating systems. 

 zip archivefile1 doc1 doc2 doc3
This command creates a file "archivefile1.zip" which contains a copy of the files doc1, doc2, and doc3, located in the current directory. 

 zip archivefile1 *
This command creates a file "archivefile1.zip" which contains a copy of all files in the current directory in compressed form. However, files whose name starts with a "." are not included. The extension ".zip" is added by the program. 

 zip archivefile1 .* *
This version includes the files that start with a dot. But subdirectories are still not included. 

 zip -r archivefile1 .
This copies the current directory, including all subdirectories into the archive file. 

 zip -r archivefile2 papers
This copies the directory "papers", located in the current directory, into "archivefile2.zip". 

 zip -r archivefile3 /home/joe/papers
This copies the directory "/home/joe/papers" into "archivefile3.zip". Since in this case the absolute path is given, it doesnt matter what the current directory is, except that the zip file will be created there.
The command unzip extracts the files from the zip file.
 unzip archivefile1.zip
This writes the files extracted from "archivefile1.zip" to the current directory. 

Available link for download

Read more »

Sunday, February 12, 2017

ExtJs slideIn slideOut animation example

ExtJs slideIn slideOut animation example



Available link for download

Read more »

Saturday, February 11, 2017

ExtJs 4 Radio Button Example

ExtJs 4 Radio Button Example



Available link for download

Read more »

Friday, February 10, 2017

Example Using Grails Promises

Example Using Grails Promises


I was recently playing around with the Asynchronous Programming features in Grails using Promises, and wanted to share an example that went a little beyond a simple example. In case you are using an older version of Grails, the asynchronous features where added in Grails 2.3. While there are a lot of useful asynchronous features in Grails, for this article Ill only focus on using Promises. Promises are a common concept being introduced in many concurrency frameworks. They are similar to Javas java.util.concurrent.Future class, but like all things with Grails/Groovy, Grails has made them easier to use.

First, before showing you an example, go ahead and run grails console under an existing grails project. If you dont have one, install grails (see GVM) and run grails create-app. Using the grails console will allow you to quickly run these examples and experiment on your own.

Basic Example
import static grails.async.Promises.task
import static grails.async.Promises.waitAll

def task1 = task {
println "task1 - starting"
Thread.sleep(5000)
println "task1 - ending"
}

def task2 = task {
println "task2 - starting"
Thread.sleep(1000)
println "task2 - ending"
}

waitAll(task1, task2)
This would output:
task1 - starting
task2 - starting
task2 - ending
task1 - ending

More Complex Example
Lets say you wanted to list the states of 5 zip codes. Here is what that would look like if we did it synchronously:

["74172", "64840", "67202", "68508", "37201"].each { z ->
println "getting state for zip code: $z"
def response = new URL("http://zip.getziptastic.com/v2/US/$z").content.text
def json = grails.converters.JSON.parse(response)
println "zip code $z is in state $json.state"
}
And the output for that would look like:
getting state for zip code: 74172
zip code 74172 is in state Oklahoma
getting state for zip code: 64840
zip code 64840 is in state Missouri
getting state for zip code: 67202
zip code 67202 is in state Kansas
getting state for zip code: 68508
zip code 68508 is in state Nebraska
getting state for zip code: 37201
zip code 37201 is in state Tennessee

And here is what it would look like using Grails Promises to make it asynchronous:

import static grails.async.Promises.task
import static grails.async.Promises.waitAll

def tasks = ["74172", "64840", "67202", "68508", "37201"].collect { z ->
task {
println "getting state for zip code: $z"
def response = new URL("http://zip.getziptastic.com/v2/US/$z").content.text
def json = grails.converters.JSON.parse(response)
println "zip code $z is in state $json.state"
}
}

waitAll(tasks)

The asynchronous output would look like this:
getting state for zip code: 37201
getting state for zip code: 68508
getting state for zip code: 67202
getting state for zip code: 64840
getting state for zip code: 74172
zip code 74172 is in state Oklahoma
zip code 37201 is in state Tennessee
zip code 64840 is in state Missouri
zip code 68508 is in state Nebraska
zip code 67202 is in state Kansas

Each time you run the asynchronous version it will output a different order because the tasks are running asynchronously. The waitAll() method will block until all tasks complete.

Thanks to jeremydanderson for helping me figure out how best to use the collect method.

Available link for download

Read more »

Thursday, February 9, 2017

ExtJs Date manipulation Add and Subtract example

ExtJs Date manipulation Add and Subtract example



Available link for download

Read more »

Friday, January 27, 2017

ExtJs fadeIn fadeOut animation example

ExtJs fadeIn fadeOut animation example



Available link for download

Read more »

ExtJs 4 Toggle Button example

ExtJs 4 Toggle Button example



Available link for download

Read more »