Instant Download of Premium Web Templates
JS And App | Java-ScriptGate.com

Archive for the ‘JS and App’ Category

JS and App

January 7, 2010

ECMAScript 5′s Date Extensions

One of the changes that ECMAScript 5 introduces is extensions to the Date class. Some of these are very useful — Date.now and Date.UTC as well as ISO-8601 format support. Michael J. Ryan has written support for these API changes in DateExtensions.js so you can get started using them now. redesign website Basariyorum is a leading web solution company catering to all your website design and development needs there by helping your business grow. Usage looks like this:
var epoch1 = new Date("1970-01-01T00:00:00.000Z");
var epoch2 = new Date(0);

if (epoch1.getTime() == epoch2.getTime())
    alert("Epochs match!");

alert(epoch1.toString()); //localized date instance of the JS epoch
alert(epoch2.toISOString()); // "1970-01-01T00:00:00.000Z"
alert(epoch1 instanceof Date); // true
alert(Date.UTC(1970,0,1,0,0,0,0)); // 0

More on ECMAScript

Other ECMAScript 5 extensions to the base library include: You can read a PDF of the spec here: ECMA-262.pdf Web Design - Web Design offers custom web design, website development, flash website, portal development, search engine optimization and website designing services. Business VPN - HughesNet Business Solutions provides business VPN, virtual private network, business internet with vpn, setting up vpn, satellite vpn for small and medium businesses, affordable and flexible, available anywhere. Website Submissions 0800 Numbers - Providers of a wide range of business numbers starting from 0845, 0800, 0844, 0870, 0300, 0330, regional and international numbers. Transport Software Transport software has details of consignment, lorry hire, unloading or delivery. Transportation & Logistics Software also related with retail software, manufacturing software, ERP software, retail management, POS retail software, retail business software, production planning control PPC, human resource and payroll, sales force automation, point of sale software company, point of sale software for small business, retail point of sale solutions. Best address management services - Are you looking to hire best address management services. Your search ends here. Hire Improvemydata.com and get Consumer Data Cleansing & Address Management Service. Call us at 0845 60 60 609 or visit Improvemydata.com now! Offshore Product development - Q3 Technologies is Offshore Product Development Company leading in Outsourced product development, Offshore Product Development India, Outsourced product development India, software development, Application Development and Enterprise Applications Development Services. cam chat - Flashcoms is a reliable developer of flash-based interactive software designed to provide live communication support for websites and web-based communities. SEO Tools Read SEO Tools Reviews & Compare SEO Softwares for IBP, Web CEO & SEO Elite. SEO Software Reviews are rated by professional SEO Expert on the basis of customer reviews. posicionamiento paginas web Aparece en los Primeros Resultados de los Buscadores a través del servicio de Posicionamiento SEO de Internet Advantage y aumenta la visibilidad de tu Web Web Design India E2 Solutions, India's leading web design company offering top quality website designing services at affordable prices. Hosting - Web Hosting Buzz provides Reseller Web Hosting, cheap shared website hosting, virtual private server (VPS), managed dedicated servers and hosting on reliable high performance reseller hosting server, virtual hosting solutions, semi-dedicated and business hosting accounts home.php Justhost reviews - Best reviews of justhost hosting plan. Link building company india - cheapest SEO Company in India offers free SEO consultation and Search Engine Optimization. Laser Printers -  Thenerds.net offers great pricing on all ink cartridge, ink toner, laser printers, gps navigation, portable gps, office furniture, notebooks, hard drives, laptops, networking, systems and  digital cameras. Custom Software Applications- Custom software development, consulting and data integration services. Should you buy or build a custom application? Contact us for FREE professional IT expert advise. Pink Laptops Professional Link Building Company - Link Building Company: Professional Link Building Company in India provides Professional Link Building Service. A Link Building Company with fully Professional Link Builders offering One Way, Reciprocal and Triangular Linking Services at affordable price link building services - Award winning SEO Link Building Services. Vertical Measures is top rated Internet marketing company helping businesses. get more website traffic via higher search engine rankings, link building, social media, local search, and search engine optimization. debt advice Scotland - Scotlands No.1 Trust Deed website. Compare Trust Deeds online and save thousands. Scottish based business. Government backed Trust Deeds. 90% debt Write off.

JS and App

January 6, 2010

Drawter

Drawter by Damian Wielgosik is a simple tool for drawing HTML interfaces and exporting the results. It uses jQuery and Damian’s own GUI code. You can draw HTML tags using The Tagname to draw option and the mouse. To switch between drawing and editing content and CSS, use the Draw Mode and Edit buttons. There are also menu items at the top of the page — click Code then Generate code to export your design. Drawter is a great example of what can be done with JavaScript, but it’s also potentially a useful tool. The author of Konigi was already blown away by it, and he’s something of a web prototyping tool enthusiast. online computer support Best Remote Computer Repair Services with Ask PC Experts on 1-888-518-9191 begin_of_the_skype_highlighting              1-888-518-9191      end_of_the_skype_highlighting. Online Computer Support Specialists & Remote PC Repair, We fix computer problems remotely and provide Online PC troubleshooting Help & Online Computer Tech Support Help to USA, UK, Canada, Australia and other English Speaking Countries. computer support Computer Support Specialists & Remote PC Repair in Australia. We fix computer problems remotely and provide Online PC troubleshooting Help & Online Computer Tech Support. ProStores Ecommerce Design, Customization & SEO/a> from IntuitSolutions, the Ecommerce experts.
Remote Pc Access flash game development Web Design Company Chennai - Visuals India - Web design and Development Company Chennai and SEO company. If you need our services then visit visualindia.com . When it comes to finding a reliable marketing partner the printing company http://www.originalimpressions.comperforms outstandingly as can be expected from a top tier supplier. Search Engine Optimization - India SEO company providing search engine optimization,manual directory submission,search engine submission, internet marketing,custom website designing, affordable websites,website maintenance, software development. Sharepoint Migration - Idera SharePoint migration suite is the most comprehensive solution available for SharePoint content migration. Domain Registration India - Indyadomains.com - Cheap and professional support services on Domain Registration and Web Hosting Chennai, India. IP Telephone Systems - We provide reliable IP telephone systems and we are the leading provider of pure IP telephony solutions worldwide. If you’re preparing for retirement in Ontario, OHIP may not be enough, since it does not cover some medications as well as extensive treatment. Consider individual health insurance Ontario options which will help you medical expenses you may encounter. Computer support - Computer support services can troubleshoot networking issues, software programs, computer fixing and maintenance. Computer support services also provides you with expert consultation on technical isssues. domain name search Real Time GPS Vehicle Tracking System - TrakPro is the leading real time vehicle tracking system providing company. We provide comprehensive vehicle tracking and telematics to transportation industry to keep you one step ahead from your competitors. Blue Delight Web Promotion Pvt. Ltd known as a SEO Services Company and leading for organic, affordable & ethical Search Engine Optimization. B2B Internet Marketing Company is known as bunch of various online services like web promotion, web designing, Search Engine Marketing services using some marketing strategies which include SEO, PPC and SEM for development of website. Professional SEO Services - Providing affordable organic SEO Services - SEO consultancy services and Directory Submission, Link Building, Article Submission and Search Engine Optimization. LTO media Web Page Scraping - web page scraping -Web page scraping is a computer software technique used to extract information from websites, available at visualwebripper.com. It is the unique technical parameters adopted by visual web ripper which can scrap anonymously on web. Indoor Wall Fountains

Free PDF EBooks Digital Magazines, ebooks and virtual catalogues: transform automatically your PDF files into a wobook for free

JS and App

January 5, 2010

JSpec

We recently posted a unit test roundup, so I noticed that JSpec has been updated to version 3. This version introduces several interesting updates (see the full change list):
  • Rhino’s jar is included so console tests can work without installing extra stuff
  • Added a jspec stats command
  • Subcommand hooks — checks for spec/commands/*_command.rb
  • Ruby server is now a Sinatra app
JSpec is now version 3.0 and currently has over 200 followers on GitHub, so it’s worth checking out.

Syntax Examples

JSpec tests can be written using a custom DSL or a grammar-less JavaScript syntax. When using the DSL in browser-based tests, be sure to use JSpec.exec() to run tests rather than including the code in script tags (more details are in the README). Tests written with the DSL look like this:
describe 'ShoppingCart'
  before_each
    cart = new ShoppingCart
  end

  describe 'addProducts'
    it 'should add several products'
      cart.addProduct('cookie')
      cart.addProduct('icecream')
      cart.should.have 2, 'products'
    end
  end

  describe 'checkout'
    it 'should throw an error when checking out with no products'
      -{ cart.clear().checkout() }.should.throw_error EmptyCart
    end
  end
end
JavaScript equivalent:
JSpec.describe('ShoppingCart', function(){
  before_each(function{
    cart = new ShoppingCart
  })

  describe('addProducts', function(){
    it ('should add several products', function(){
      cart.addProducts('cookie')
      cart.addProducts('icecream')
      expect(cart).to(have, 2, 'products')
    })
  })

  describe('checkout', function(){
    it ('should throw an error when checking out with no products', function(){
      expect(function(){ cart.clear().checkout() }).to(throw_error, EmptyCart)
    })
  })
})

Custom Matchers

Custom matchers can be defined using JSpec.addMatchers. It’s possible to control the error messages. It’s also possible to create sets of macros with similar names:
JSpec.addMatchers({
  'be disabled selected checked' : function(attr) {
    return 'jQuery(actual).attr("' + attr + '")'
  },

  'have type id title alt href src sel rev name target' : function(attr) {
    return function(actual, value) {
      return value ? jQuery(actual).attr(attr) ## value:
                     jQuery(actual).attr(attr)
    }
  }
})

Other Features

JSpec includes a command-line tool that can initialise project templates, as well as auto-testing when files are changed. It can also work with Growl in Mac OS X. It includes lots of familiar matchers and works well in a browser and console.

Installation

To try JSpec out, you can install it with RubyGemsgem install jspec and read the docs on github.com/visionmedia/jspec. The future telecommunication technology is video conference facilities or video conferencing solutions. This communication facility allows several locations to interact with people via audio and video simultaneously. Video conference software brings a cost effective video conferencing system which is held over ISDN. This is very good video picture quality and also much more reliable than the normal internet.
SPORTSBETTING.COM is the simplest and most popular destination for sports betting on the Internet. Our many years of experience guarantee you a superior betting service. Join today to take advantage of all our great offers.
MCITP upgradeEnroll to Intense School's highest rated MCITP Upgrade Boot Camp now. For more information, visit Intesneschool.com now! Digital Marketing Agency -Visit Xyone today, a UK Leading Digital Marketing Agency and see how we can help you within the Digital World. Online Scheduling - Online scheduling software by NetSimplicity. Timesheet Software - Timesheet software by iEmployee. vpslink-all about vpslink coupon. LiteSpeed Hosting Provider-LiteSpeed hosting with Ultra Website hosting .com. Increase the speed of your website with UltraWebsiteHosting.com’s LiteSpeed web services. Three times faster than Apache with the most competitive pricing. Live Support, price guarantee, 45-day money back guarantee… it’s tough to beat these guys!

JS and App

January 4, 2010

Benchmarks in JavaScript

Speeding up page load times is a good way to decrease bounce rates and increase customer satisfaction. And if you’re using JavaScript in your server-side architecture, speed will become increasingly important. So you might be tempted to write your own benchmarking code when puzzling over a tricky performance issue. Fortunately there are quite a few JavaScript benchmarking libraries out there.

Unit Tests

If you’re writing unit tests you should get some benchmark information. Most libraries automatically benchmark tests — unittest.js includes a benchmark method. You could use this outside of tests for some foresnic analysis.

JavaScript Benchmark

JavaScript Benchmark is a nice little library that features:
  • ASCII-friendly output that’s great for server-side JavaScript
  • A simple API
  • Test suite support
Each benchmark will be run once by default, or you can specify a value:
suite('Iteration', 50000, function() {
  array = [1,2,3,4,5,6,7,8,9];

  benchmark('for', function() {
    for (var i = 0; i < array.length; ++i);
  });

  benchmark('for cached', function() {
    for (var i = 0, len = array.length; i < len; ++i);
  });

  benchmark('for in', function() {
    for (var i in array);
  });
});
This library won’t work in a browser due to the use of the print() function, but all you need to do is supply your own. Something like this will do:
function print(message) {
  document.getElementById('log').innerHTML += message + "\n";
}
I’ve put a full example up here: benchmarks.html

BenchmarkBuddy

BenchmarkBuddy is inspired by the RunSingleBenchmark from the V8 source. Here’s one of the author’s examples:
alert(BenchmarkBuddy.run(Math.random));

Benchmark.js

Benchmark.js is based on Ruby’s benchmark library. It’s still a work in progress and isn’t currently console-friendly, but when it works it will look like this:
Benchmark.benchmark(function() {
  for (i = 0; i < 10000000; i++) { }
});

link building services 
web content management

watch winder automatic

JS and App

December 30, 2009

JavaScript Unit Testing

Our JavaScript Developer Survey results showed that a large percentage of readers don’t currently unit test their JavaScript. I’ve been unit testing my own JavaScript projects for a few years, which resulted in the creation of riotjs — for more on riotjs see my blog post: Riotjs: A JavaScript Unit Testing Framework

There are lots of JavaScript test frameworks. I’ve presented a summary below — there are both traditional unit testing libraries and behaviour-driven frameworks.

unittest.js

unittest.js by Thomas Fuchs has been used by many JavaScript developers since Scriptaculous became popular in 2006. It provides a test framework that is recognisable to Ruby developers, and the relationship between Rails and Scriptaculous further increased adoption in this group.

This library depends on Prototype and is usually run inside HTML templates rather than a JavaScript interpreter.

Tests look like this:

  new Test.Unit.Runner({
    testExample: function() { with(this) {
      var exampleVar = '1234';
      assertEqual('1234', exampleVar);
      assert(true);
    }}
    
  }, "testlog");

Fuchs uses with(this) to cut down unnecessary syntax — you don’t have to write tests this way though.

Setup and teardown methods are supported. Shoulda-style assertion names have also been added. This adds methods to the prototypes for common JavaScript objects, so it’s possible to write 'test'.shouldEqual('test').

unittest.js also includes a handy benchmark method, and the following assertions:

assertNotEqual(expected, actual) Inverse of assertEqual
assertNotVisible(element) Checks if an element has display: none
assertVisible(element) Inverse of above
assertInspect(expected, actual) Checks if expected is the same as actual.inspect()
assertEnumEqual(expected, actual) Ensured two enumerables are equal
assertIdentical(expected, actual) Comparison using ===
assertNotIdentical(expected, actual) Inverse of above
assertNull(obj) Is obj null?
assertNotNull(obj) Inverse of above
assertMatch(expected, actual) Performs a regex, where expected is the regex
assertType(expected, actual) Checks if actual.constructor == expected
assertNotOfType(expected, actual) Inverse of above
assertInstanceOf(expected, actual) Checks if actual is instanceof expected
assertNotInstanceOf(expected, actual) Inverse of above
assertRespondsTo(method, obj) Checks if obj has a method named method
assertReturnsTrue(method, obj) Ensured that the method named method called on obj returns true
assertReturnsFalse Inverse of above
assertRaise(exceptionName, method) Ensures calling method raises an exception named exceptionName
assertElementsMatch([elements], expression1, expression2, ...) Ensures the array of elements match the list of expressions
assertElementMatches(element, expression) A helper for the above assertion when supplying a single element

JsUnitTest

JsUnitTest is a port of unittest.js without the Prototype dependency.

JsUnit

Development for JsUnit started in 2001, and is based on JUnit. Like unittest.js, tests are designed to be run in a web browser. By using the build.xml Ant file, tests can be run against multiple browsers on a local machine, or on multiple remote machines.

JsUnit tests are grouped within a Test Page. Test pages contain your tests. If a Test Page has setUp or tearDown functions, they will be run before and after each test function. A function called setUpPage will be run once per Test Page.

Each test function is written prefixed with test:

function testExample() {
    assert(true);
}

The following assertions are available:

  • assert([comment], booleanValue)
  • assertTrue([comment], booleanValue)
  • assertFalse([comment], booleanValue)
  • assertEquals([comment], value1, value2)
  • assertNotEquals([comment], value1, value2)
  • assertNull([comment], value)
  • assertNotNull([comment], value)
  • assertUndefined([comment], value)
  • assertNotUndefined([comment], value)
  • assertNaN([comment], value)
  • assertNotNaN([comment], value)
  • fail(comment)

QUnit

QUnit is used by jQuery for its unit tests. To use QUnit, include qunit.js and qunit.css within a HTML file that can display the test results.

Tests look like this:

test("a basic test example", function() {
  ok(true, "this test is fine");
  var value = "hello";
  equals("hello", value, "We expect value to be hello");
});

The jQuery QUnit documentation has full examples.

jspec

jspec (by Yehuda Katz) is an RSpec inspired framework. Rather than traditional unit tests, jspec attempts to provide a behaviour-driven development approach.

This is best illustrated with an example:

jspec.describe("The browser environment", function() {
  it("should have Array.prototype.push", function() {
    Array.prototype.push.should("exist");
  });
 
  it("should have Function.prototype.apply", function() {
    Function.prototype.apply.should("exist");
  });
})

Tests are written with it() blocks and chained should() calls.

The GitHub repository is currently pretty spartan, with no documentation or README, but jspec is a good port for those of you who are familiar with RSpec or want a change from JUnit-style libraries.

JSpec

JSpec by visionmedia (who have cropped up frequently on DailyJS) is a much more fleshed out BDD library. The author has tried to keep it minimal, but it has a unique and friendly DSL. It’s possible to write “grammar-less” tests using plain JavaScript.

Jasmine

Jasmine builds on the ideas of the previous libraries to provide a BDD library that supports asynchronous tests — Ajax-friendly testing.