Tag Archives: web

Internet Explorer 10 Comes to Windows 7

IE10 1990s Video Ad

Windows 7 was a poor stepchild for a while when it came to Microsoft’s latest Web browser, Internet Explorer 10. The new browser was available with Windows 8 at that new operating system’s launch, and later became available as an optional preview update for users of IE9 under Windows 7. That is no longer the case, with today’s official launch of IE10 for Windows 7.

Internet Explorer 10 brings far greater support for HTML5 Web standards, faster performance, and leading privacy protection for Web surfers.

Of course it’s understandable that Microsoft’s browser team would be focused on the company’s newest OS, but it wasn’t likely they’d keep the Windows 7 user base of more than 700 million waiting for too long. On Friday, PCMag spoke with Microsoft’s Ryan Gavin, general manager for Windows Internet Explorer, and Rob Mauceri, group program manager, for some insight into the strategy behind the IE10 launch. Mauceri noted that Windows 7 is still a modern OS, no doubt referring to its support for DirectX 11, which is required for the browser’s graphics hardware acceleration speed-ups.

Speaking of speed, Gavin told me that "the performance improvement from IE9 to IE10 is substantial, in fact, IE10 is about 20 percent faster for real world sites than its predecessor." He had already noted that in real-world Web speed studies, IE9 was already the leader (for more, see By the Numbers: the Fastest Browser). "We feel really great about that progress, and our leadership in hardware acceleration is really only accelerating."

In HTML5 support the percentage improvement from IE9 to IE10 is even more impressive: the newer browser adds 60 percent more HTML5 capabilities. "Developers can take advantage of these capabilities and build increasingly rich websites," said Gavin, "but just as importantly, [there's a] confidence level that they have knowing that they can write it once and it’s really going to work across all modern browsers."

Indeed, according to the (not quite authoritative but nevertheless informative) HTML5Test.com site, out of a possible 500, IE10′s score jumps to 320 from IE9′ 138, which was still a far better showing than IE8′s 42. For comparison, Maxthon leads this test with 464 points, followed by Chrome’s 448, Opera with 419, and Firefox with 393.

The final point Gavin wanted to make concerned privacy: Along with Maxthon, IE10 is the only browser to have Do Not Track enabled by default (much to the chagrin of the Web advertising industry). Microsoft’s browser will also include a very powerful privacy feature introduced in IE9—Tracking Protection. This feature blocks interaction with sites on tracking protection lists to which users can subscribe. In a similar move, it recently came to light that Firefox, starting with version 22, would block third-party tracking cookies by default. The Internet Explorer and Firefox moves are based on expressed user desire, while Google has too much self-interest as the largest purveyor of Web ads to include similar features in Chrome.

One thing IE9 users who are upgrading to version 10 won’t notice is a new interface: they will be greeted by the same, trim browser interface, with only the smallest of tweaks. Mauceri told us that the browser now includes integrated spell-checking and auto-correct. You can also close multiple tabs in rapid succession by repeatedly clicking the mouse on each tab’s X.

To promote the browser, Microsoft will launch a new ad campaign called "Explore Touch," which will use the talents of composer/singer Blake Lewis. As the title suggests, the commercials will highlight touch capabilities in IE10 when used with a touch tablet or touch-capable monitor. A new demo site, www.exploretouch.ie, is also being launched to demonstrate touch input, with interactive versions of the commerical’s music. IE10 was one of the first browsers to support HTML5 Touch Events. A behind-the-scenes video shows how the commercial was made in Lewis’s words.

Though IE has lost ground in recent years to upstarts like Firefox and Chrome, browser watchers may be surprised to learn that from Dec. 2012 to Jan. 2013, IE’s piece of the usage pie has actually risen while Chrome’s has slipped some, according to Web-monitoring site NetMarketShare. According to the site, Internet Explorer sat at 55.14 percent at the end of January, with Firefox at 19.94 percent, Chrome at 17.48 percent, and Safari at 5.24 percent.

Source: http://www.pcmag.com/article2/0,2817,2415871,00.asp

Did you like this? Share it:

IBM Dives Head First Into Mobile

IBM moves into mobile

IBM last week unveiled an expansive new strategy to deliver mobile business solutions under MobileFirst, its new brand of software and services for delivering apps on smartphones and tablets. With MobileFirst, IBM seeks to bring together all of the elements required by an enterprise to successfully roll-out mobile solutions, including development, deployment, device management, and security tools. And, IBM being IBM, it also includes a healthy dose of professional services, but no apparent IBM i hooks at this time.

MobileFirst is an umbrella brand that brings together many pieces of software that already existed in IBM’s portfolio, but it introduces some new software as well. There are literally dozens of products parked under the new MobileFirst banner, including products from familiar IBM brands like WebSphere, Rational, Domino, Tivoli, and Cognos. Recent IBM acquisitions, like Q1 Labs (security), Emptoris (expense and expenditure management), and Tealeaf (customer experience management) also play a part.

IBM breaks MobileFirst products down into four main categories, including MobileFirst Platform, MobileFirst Security, MobileFirst Management, and MobileFirst Analytics. Within these four, there are no less than 28 individually named products and services sitting under Big Blue’s new mobile umbrella. Simplicity has never been IBM’s strong suit, and apparently it’s not going to start now.

The key product under the new MobileFirst Platform is Mobile Foundation, a pre-existing suite that previously combined three tools but now appears to sport only two: Worklight, an HTML 5 mobile application development and runtime environment that includes a Java-based server component and an Eclipse-based studio; and WebSphere Cast Iron, an integration framework for connecting on-premise and cloud applications and systems.

Worklight, you will remember, is on the short list of IBM apps that several prominent IBM i experts, including Roxanne Reynolds-Lair, the Power Systems champion and CIO of the Fashion Institute of Design and Merchandising, want running and supported on IBM i. The work done by Reynolds-Lair and another Power Systems champion, Steve Pitcher, were instrumental in getting other new IBM offerings supported on the platform, including Notes Traveler and IBM Connections, both of which IBM has committed to supporting on IBM i.

And lo! What do we have here but an IBM announcement letter on February 19 for Worklight version 5.0.6. Could it, would it, include a statement of direction in support of IBM i? As diligent readers scroll down, they read:

"IBM intends to provide additional platform support for the IBM Worklight product offerings in response to customer feedback and market demand…IBM anticipates extending support to IBM System z hardware and the IBM z/OS operating system in the future." Actually, IBM committed to supporting z/OS with Worklight back in September, so this isn’t news. What is disheartening is that Worklight apps can be served up from z/OS, Windows, AIX, Solaris, Linux, and Mac OS–every "major" business OS but IBM i (and HP-UX).

Worklight isn’t the only component of MobileFirst Foundation. IBM CLM [collaborative lifecycle management] suite, which in turn is composed of Rational Requirements Composer, Team Concert, and Quality Manager, is also a part of MobileFirst Foundation. Others include Rational Test Workbench; Web Experience Solutions; Lotus Domino Designer; and WebSphere MQ.

MobileFirst Management is based largely on IBM Endpoint Manager for Mobile Devices, which previously was called just Endpoint Manager when it was part of the Mobile Foundation. Endpoint Manager is a Windows/SQL Server-based app that enables businesses to adopt "bring your own device" (BYOD) strategies, and supports all popular mobile platforms, including iOS, Android, Blackberry, Windows Mobile, Windows Phone, and Symbian. MobileFirst Management also includes Tivoli Netcool/OMNIbus, WebSphere Datapower, and Emptoris Rivermine Telecom Expense Management.

MobileFirst Security includes a new release of Security AppScan that has been gussied up to spot potential vulnerabilities in iOS apps; it previously supported Android. The Security Access Manager for Cloud and Mobile component delivers single sign on (SSO) capability for mobile apps–definitively a nice thing to have in enterprise environments. Integration with the security information and event management (SIEM) product QRadar is also part of MobileFirst Security, turning tablets and smartphones into listening posts to detect the activities of hackers and cybercriminals, while Mobile Connect establishes a virtual private network (VPN) connection between a mobile device and a server.

On the analytics front, IBM has crammed several apps into MobileFirst Analytics boat, including: Tealeaf CX Mobile, for detecting potential problems in the mobile user’s experience; Mobile Commerce, for mobile e-commerce; and Cognos Mobile, for accessing Cognos reports, dashboards, and metrics from mobile devices.

Bringing all these tools to bear on customers’ mobile strategies may be difficult, but never fear: IBM Global Services is here! MobileFirst has a wide array of services components, including: mobile application development; integration with back-office systems; infrastructure and planning; network integration; running mobile apps from the cloud; and embedding unified communications and collaboration (UCC) capabilities into mobile apps.

IBM also unveiled a new partnership with AT&T to integrate Worklight apps with AT&T’s cloud APIs. There’s also a new program called "Ready for IBM MobileFirst" to get ISVs going with the new brand, and new initiatives with colleges, too. IBM financing also got into the MobileFirst act.

It is almost as if every department in IBM gets to play a part in MobileFirst, which is undoubtedly what led IBM to call MobileFirst the first "true end-to-end mobile solution" that businesses can use to "transform their entire business model." Considering that most of the tools already existed in IBM’s portfolio, that claim is a stretch. (It is even more of a stretch unless IBM has done the hard work to integrate the tools, not only from a functional aspect, but from a licensing aspect, too). Every organization will have specific needs as it relates to mobile, so there will never be a one-size-fits-all solution, despite whatever messaging IBM’s marketing committees agree on.

With so many components in MobileFirst, it is likely that any given organization will find something that addresses at least some their mobile needs. And customers can even look outside of the MobileFirst family, to tools such as Rational Application Developer and Rational Business Developer, which gained Dojo X Mobile support in 2011, but which missed the first departure of the MobileFirst train.

It is clear that MobileFirst represents the product branding that IBM is using for its smartphone and tablet computing solutions, and it will undoubtedly evolve in the future. Now all that IBM needs to do is support IBM i with Worklight–the foundational element of MobileFirst–and it will have piqued the attention of 150,000 of its best customers.

Source: http://www.itjungle.com/tfh/tfh022513-story05.html

Did you like this? Share it:

W3C designates Chinese uni as ‘host’ center

W3C china

The World Wide Web Consortium (W3C) announced today it has designated China’s Beihang University as a "host" institution, as it hopes to increase opportunities for collaboration with local developers, Internet companies, and research institutes to shape the Web’s future.

In a statement issued Monday, the W3C said Beihang University will join the US’ Massachusetts Institute of Technology (MIT), the European Research Consortium for Informatics and Mathematics (ERCIM), and Japan’s Keio University as the organization’s four official host centers. Beihang University’s School of Computer Science & Engineering department had been a W3C office since April 27, 2006.

It is also the first time in 15 years that the W3C has appointed a new host institution, noted Ian Jacobs, head of communications for W3C.

In a phone interview with ZDNet, Jacobs explained the difference in status between "host" and "office," saying that while Beihang University had previously been a "friend of W3C" in that it hosted events and brought together collaborators, it did not set the direction for the Consortium and house staff member. In other words, the latest announcement means the Chinese institution is "now W3C," he said.

"A host is the heart of our organization, and it is a different level of engagement," the executive said, adding the W3C has set a goal of having seven to 10 employees in China by the end of 2013.

Tapping local innovations

Jacobs also pointed out the Consortium will have a stronger base to engage the Chinese Internet companies, developers, and research institutes to have them contribute to shaping how the Internet will develop in the future. 

He said Beihang University has organized many Web developer events since 2006, such as training, meetings, and conferences, and it will continue to be a facilitator for such platforms. Already in place this year is a conference on HTML 5 and mobile development to be held in Beijing in July for approximately 1,000 people, and a "Test the Web Forward" event in Shanghai in the middle of this year, he stated.

Asked if the Chinese developer community has particular strengths the W3C can tap on, the executive said recent participation from members "hint at particular interests." The community has proved adept at creating new browsers and innovating on them, which has led to more distinct browser products in the market than a decade ago, he said.

Mobile and software testing are two other "hot" areas among Chinese developers and are focus areas for Beihang University’s events, he added.

Jeff Jaffe, CEO of W3C, also pointed out in the statement that Chinese companies have excelled in instant messaging, online games, smartphones, search, and creating a flourishing browser ecosystem.  

"In the past two years, W3C has benefited from greater Chinese participation, and we look forward to that trend accelerating through the efforts of local industry and Beihang University. Global participation in W3C enables our community to identify global needs for the Web and drive solutions," Jaffe stated.

In terms of attracting more Chinese companies to become W3C members, Jacobs said there are no concrete goals set by the Consortium for the year.

He did note, though, that participation among local companies is "modest but growing." Companies such as Huawei Technologies, Baidu, Tencent, and China Unicom have employees contributing to W3C’s various community groups, and, with a local host institution in place, the contributions should rise accordingly, he added.

Source: http://www.zdnet.com/cn/w3c-designates-chinese-uni-as-host-center-7000010056/

Did you like this? Share it:

HTML5 vs. Apps: Here’s Why The Debate Matters, And Who Will Win

HTML5 is a new technology that allows developers to build rich web-based apps that run on any device via a standard web browser.

Many think it will save the web, rendering native platform-dependent apps obsolete.

So, which will win? Native apps or HTML5?

A recent report from BI Intelligence explains why we think HTML5 will win out, and what an HTML future will look like for consumers, developers, and brands.

Here’s why the Apps-vs-HTML5 debate matters:

+ Distribution: Native apps are distributed through app stores and markets controlled by the owners of the platforms. HTML5 is distributed through the rules of the open web: the link economy.

+ Monetization: Native apps come with one-click purchase options built into mobile platforms. HTML5 apps will tend to be monetized more through advertising, because payments will be less user-friendly.

+ Platform power and network effects: Developers have to conform with Apple’s rules. Apple’s market share, meanwhile, creates network effects and lock-in. If and when developers can build excellent iPhone and iPad functionality on the web using HTML5, developers can cut Apple out of the loop. This will reduce the network effects of Apple’s platform.

+ Functionality: Right now, native apps can do a lot more than HTML5 apps. HTML5 apps will get better, but not as fast as some HTML5 advocates think.

In full, the special report analyzes:

+ What HTML5 is, giving an overview of how it is a technology done by committee.

+ Why the HTML5-vs-Apps debate matters, breaking down its impact on distribution, monetization, platform power and network effects, and functionality.

+ The pluses and minuses of HTML5 vs. native apps, comparing each by cost, user experience, features, distribution, and monetization.

+ How and when HTML5 will take over, laying out how it has all the hallmarks of a disruptive technology.

+ The success of an HTML5 pioneer, The Financial Times.

+ What an HTML5 future will look like, with the promise of richer and more interactive experiences.

Source: http://www.businessinsider.com/html5-vs-apps-heres-why-the-debate-matters-and-who-will-win-2012-12

Did you like this? Share it:

Static analysis technology for web application security

Coverity has extended static analysis to deeply understand both source code and modern web application architecture, providing greater accuracy and remediation guidance to help developers find and fix security defects that can lead to the most commonly exploited vulnerabilities including SQL injection and cross-site scripting.

Designed from the ground up to analyze web applications from the developer’s point of view, Coverity’s new technology addresses the complexity of modern web applications and enables developer adoption of static application security testing in a way that the shallow, incomplete analysis of first-generation tools failed to achieve.

Coverity’s innovations in static analysis technology are the first to:

  • Augment static source code analysis with a framework analyzer that minimizes inaccuracies when data passes through application frameworks, thereby minimizing false positives.
  • Incorporate a white box fuzzer inside static analysis to automatically validate that data sanitization routines perform sufficient sanitization of untrusted data and are used in the right context.
  • Provide precise, defect-specific remediation guidance to ensure developers understand how to fix security defects correctly and efficiently.

“Getting developers to fix security defects requires much more than just integrating static analysis into an IDE. Developers need evidence that the defects identified are real, and they need to understand how to fix those defects in their code,” said Andy Chou, Coverity co-founder and CTO.

“First-generation static analysis tools are not effective in helping developers because they don’t credibly provide them with this information. We are making it easy for developers by taking the guesswork out of finding and fixing security defects,” Chou added.

Source:http://www.net-security.org/secworld.php?id=13083

Did you like this? Share it:

10 Free Website Speed Test Tools

Website Speed Test Tools

Page Speed Insights

PageSpeed Insights analyzes the content of a web page, then generates suggestions to make that page faster. Reducing page load times can reduce bounce rates and increase conversion rates.

website-speed-testing-1

Website Speed Check

The website speedtester shows the duration of a given website. This value can be used for showing how long a website take to load and if it is better to optimize the website.

website-speed-testing-2

Neustar Web Performance

Test your website performance with this free cutting edge tool. This tool accesses your website from different location and generates a website performance analysis report.

website-speed-testing-3

PingDom

The Full Page Test tool to help you analyze the load speed of your websites and learn how to make them faster. It examines all parts of a web page, shows performance overview and you can also share the results with your friends.

website-speed-testing-4

Load Impact

Load test your website online. We offer load testing and reporting as an online service to e-commerce & B2B sites all over the world.

website-speed-testing-5

Which Loads Faster

Pages compete head-to-head in your browser to see who’s fastest!

website-speed-testing-6

Octagate Site Timer

Web Monitor allows you to monitor how long it takes for a user to download one or more of your web site pages.

website-speed-testing-7

Show Slow

Show Slow is an open source tool that helps monitor various website performance metrics over time. It captures the results of YSlow, Page Speed, WebPageTest and dynaTrace AJAX Edition rankings and graphs them, to help you understand how various changes to your site affect its performance.

website-speed-testing-8

Web Pagetest

Run a free website speed test from multiple locations around the globe using real browsers (IE and Chrome) and at real consumer connection speeds.

website-speed-testing-9

GTmetrix

GTmetrix uses Google Page Speed and Yahoo! YSlow to grade your site’s performance and provides actionable recommendations to fix these issues.

website-speed-testing-10

Source:

http://www.flashuser.net/resources/website-speed-test-tools.html

Did you like this? Share it:

JavaScript founder dismisses Google Native Client

Questioning Google’s Native Client development efforts, JavaScript founder Brendan Eich argued on Wednesday that JavaScript is sufficient for the needs Google is trying to fill.

Speaking at the O’Reilly Fluent Conference in San Francisco, Eich dismissed Google’s technology and also promoted the upcoming upgrade to the official JavaScript specification, ECMAScript 6. With Native Client, Google is offering an open source technology to run portable native code securely in a browser.

But Eich doubted whether Native Client would get support from browser vendors Apple, Microsoft, or Mozilla, and he touted JavaScript as sufficient.

JavaScript is accessible and offers benefits like memory safety, said Eich, who is CTO at Mozilla. "Java can sandbox, too. We don’t need Native Client," Eich said. He also cited the Low Level JavaScript project, which offers a C-like type system with manual memory management and memory safety, as negating the need for Native Client. Low Level JavaScript compiles to JavaScript.

ECMAScript 6, meanwhile, is intended to be better for applications, libraries, and code generators, according to Eich. "ECMAScript 6 is under way," and parts of it are already showing up in the Chrome browser and Mozilla’s Spider Monkey JavaScript engine, he said. "We don’t want to change the language too much. I’m sensitive to people who think we’re going to change it into Java or something. We’re not doing that."

Specific improvements eyed for version 6 include string interpolation, the use of default values instead of undefined values, indexing of objects via another object, and elimination of the arguments object. For libraries, better modularity as well as proxies, for meta-programming, are anticipated. Eich also touted code generator capabilities, saying, "I think we’re finally ready for it." Developers of JavaScript, he said, also want to make it a better compiler target language.

Also under consideration for inclusion in JavaScript at some point is parallel JavaScript, for data and task parallelism; this is still a research project, Eich said, noting that JavaScript is now 17 years old. "The cool thing is people are using it in ways I couldn’t foresee," he said.

A JavaScript developer in attendance lauded a planned "let" keyword due in the JavaScript standard. Let, said Steven Olson, software architect for the Church of Latter Day Saints, enables developers to declare a global variable that stays in a namespace and cannot be copied. "The benefit is you don’t have the confusion between global and local namespace in your program."

Also at the conference, 4D announced Beta 2 of Wakanda, which is intended to be a turnkey JavaScript development platform featuring an IDE, client framework, NoSQL database, and server capabilities. A production release of Wakanda is due in June, with prices starting at $35 for a single developer using the vendor-supported commercial edition. A free, community edition also will be available. "[Wakanda] allows the developer to really create applications for the Web and mobile applications really fast," without having to deal with integrating different software development components, Michel Gerin, chief marketing officer at 4D. "It’s all working together really nicely."

Source:http://www.infoworld.com/d/application-development/javascript-founder-dismisses-google-native-client-194467

Did you like this? Share it:

Software Testing and Software Quality Assurance are NOT the same

Many people and organizations usually get confused whether Software Testing and Software Quality Assurance are same or different concepts in the testing domain it’s important to know that these two fields are closely related, but they are different concepts.

Software Quality Assurance (QA):

Software Quality Assurance is a set of activities designed, planned in a systematic way to evaluate quality of the process which is used to produce a quality product.

Why Software Quality Assurance?

This is done in order to ensure that the development or maintenance process is adequate to ensure a system will meet its objectives. Also, making sure that procedures and agreed-upon standards are followed properly.

Goal:

To provide a pledge that the product is meeting all the quality expectations of the customer.

When a product is developed Quality Assurance deals with how tester can prevent errors from occurring. A major responsibility of Software QA Engineer is to build and implement methods and also the standards, to improvise the development methods. There are certain set of activities associated with QA like measuring the quality of the process which can be used to the product development, a process improvement and flaw prevention. It also consists of auditing and reporting procedures. 

Software Testing:

Software Testing is a planned process of executing a system in order to find defects and i.e., used to identify the completeness, correctness, security and quality of a software. It also includes the system or application’s operation under the controlled conditions and evaluating the results.

Why Software Testing?

This is done in order to provide a demonstration that the software is doing what it is intended to do as well as the software is not doing what it is not intended to do.

Goal:

To find or locate the defects and making sure that they get fixed and also to ensure that the functional requirements and metrics are met.

These are some of the major differences between the two concepts and sometimes there could be an overlap of responsibilities between software tester and quality assurance engineer. Based on the need, sometimes software tester might have to do certain quality assurance related works and some QA-ers perform testing of a product.

Source:

http://qa.siliconindia.com/news/Software-Testing-and-Software-Quality-Assurance-are-NOT-the-same-nid-116670.html

Did you like this? Share it:

Use Memcached for Java enterprise performance, Part 2: Database-driven web apps

However you slice it traditional caching requires performance trade-offs that some enterprise applications cannot afford. Find out for yourself why Memcached is a go-to solution for Java developers whose applications need serious scale. After first setting up spymemcached as your open source Java client for Memcached, you’ll use it in two powerful application scenarios: first configuring Memcached as second-level cache for Hibernate (via hibernate-memcached), and then using it to cache the HTML generated for each web page.

We concluded the first half of this tutorial with a look at using Telnet and the Memcached protocol to store and retrieve cache entries in a Memcached server. Accessing Memcached via Telnet is especially useful for debugging, but if you want to use Memcached in a Java enterprise application you’ll need to use a Memcached Java client.

We’ll use spymemcached, a very popular Memcached Java client, for the introductory purposes of this tutorial. Listing 1 shows spymemcached’s main class, MemcachedClient.

Listing 1. MemcachedClient
public static void main(String[] args) throws Exception{
    if(args.length < 2){
        System.out.println("Please specify command line options");
        return;
    }
    MemcachedClient memcachedClient = new MemcachedClient(AddrUtil.getAddresses("127.0.0.1:11211"));
    if(commandName.equals("get")){
        String keyName= args[1];
        System.out.println("Key Name " +keyName);
        System.out.println("Value of key " +memcachedClient.get(keyName));
    }else if(commandName.equals("set")){
        String keyName =args[1];
        String value=args[2];
        System.out.println("Key Name " +keyName + " value=" + value);
        Future<Boolean> result= memcachedClient.set(keyName, 0, value);
        System.out.println("Result of set " + result.get());
    }else if(commandName.equals("add")){
        String keyName =args[1];
        String value=args[2];
        System.out.println("Key Name " +keyName + " value=" + value);
        Future<Boolean> result= memcachedClient.add(keyName, 0, value);
        System.out.println("Result of add " + result.get());
    }else if(commandName.equals("replace")){
        String keyName =args[1];
        String value=args[2];
        System.out.println("Key Name " +keyName + " value=" + value);
        Future<Boolean> result= memcachedClient.replace(keyName, 0, value);
        System.out.println("Result of replace " + result.get());
    }else if(commandName.equals("delete")){
        String keyName =args[1];
        System.out.println("Key Name " +keyName );
        Future<Boolean> result= memcachedClient.delete(keyName);
        System.out.println("Result of delete " + result.get());
    }else{
        System.out.println("Command not found");
    }
    memcachedClient.shutdown();

}

In Listing 1, we first create a MemcachedClient object with hostname:portname as its argument. Once we have the object we can start calling its methods to set and get cache entries. Note that MemcachedClient has equivalent methods for every method supported by the Memcached protocol:

  • MemcachedClient.set() is used to store a Java object into the Memcached server. In Listing 1, we stored an instance of a Contact object with the string contactId-1. The second parameter of this set method is time-in-seconds.
  • MemcachedClient.get() is used to get the value of the key from a Memcached server. In Listing 1 the value of the key is an object of Contact.java, so the client will first retrieve the value and then deserialize it and return the object. The get() method returns null if the value is not found or is expired.
  • MemcachedClient.add() is used to add an object to the cache only if it does not already exist. In Listing 1 the contactId-1 key exists in the cache already, so it won’t be added.
  • MemcachedClient.replace() replaces an object with the value for the given key (if there is already such a value). In Listing 1, contactId-1 is already in the cache, so its value would be replaced.
  • MemcachedClient.delete() deletes a given key from the cache. In Listing 1, the call is used to delete the contactId-1 key.
MemcachedClient.set()

You can use MemcachedClient.set() to store a simple string or a complex object. When you store a complex object, MemcachedClient will first serialize the object and then store it. As a result, every object that you store in Memcached must be serializable, and the key must also be a string. In Listing 1, the set() method returns an object of Future<Boolean>. When we call the set method, it is executed asynchronously, so the control moves to the next line without waiting for a response from the Memcached server. If you needed to know the result of the set operation, then you would call setResult.get() on the Future object instance.

Spying under the hood: spymemcached

Before we move on to the web application exercise, let’s look under the hood to see how spymemcached works. Figure 1 is a sequence diagram showing what happens in spymemcached when a client issues a get().

Figure 1. get() under the hood (click to enlarge)

Spymemcached is an asynchronous, single-threaded Memcached client. When you call any caching-related method on spymemcached’s MemcachedClient, it will be handled asynchronously. The client call method handles writing the details of the operation that should be performed into a queue and returning the control back to the client making the call. The actual interaction with the Memcached server, meanwhile, is handled by a separate thread that runs in the background.

Notice that the sequence diagram in Figure 1 has two different threads. The first thread shows the method sequence for what happens when a client makes a get() call. The second thread displays a method sequence for the daemon thread that communicates with the Memcached server. Both threads are worth a closer look.

Sequence of events in a client thread

When you call MemcachedClient‘s get() method it takes the arguments and forwards control to the asyncGet() method on the object of Memcached class. The asyncGet() method then forwards control to either AsciiOperationFactory or BinaryOperationFactory, depending on the Memcached protocol your client uses to communicate with the server. AsciiOperationFactory is the default value.

The AsciiOperationFactory constructs an object of the command-specific operation object. In this case, since the client issued a get command, it creates an object of GetOperationImpl and returns it. The MemcachedClient.asyncGet() method then takes care of attaching a callback function to the operation. This function will be called when MemcachedClient gets data back from the server and returns a java.util.concurrent.Future object. The client uses the java.util.concurrent.Future to retrieve the data returned from server.

Once MemcachedClient has the object of GetOperationImpl, it first tries to validate the key by ensuring that the length of the key is less than 250 characters and does not contain any special characters. Once the key is validated, the next task is to figure out which server the request should go to. For that MemcachedClient passes control to an instance of the NodeLocator class with the key. The NodeLocator class calls the HashAlgorithm.hash(key) method to get the hashCode for the key. By default, NodeLocator will call the hashCode() method on the key, which is a String object. Once it has the hashCode it will divide that by the number of servers; for example, if the hashCode were 10 and the number of servers three, then the remainder would be one. So the cache entry would be located in Server 1. The MemcachedNode object representing Server 1 would be selected. The MemcachedConnection object would then add the get operation to the queue of Server 1 and return control to the client code.

Sequence of events in daemon threads

If you take a look at the MemcachedClient source code, you will notice that it implements the java.lang.Thread interface. When you create a new instance of the MemcachedClient it kicks off a new thread by calling a start() method on the current object, at which point the JVM will call a MemcachedClient run() method from the newly created thread.

Inside the run() method, MemcachedClient checks the value of the running flag. If it is true, MemcachedClient calls the handleIO() method of the MemcachedConnection object. handleIo() looks at the current job queue to get a list of pending tasks and tries to optimize them. For example, if more than one get() request is pending then this method will combine them into one call. The handleIO() method uses the java.nio methods to communicate with the server. When you call the MemcachedClient shutdown() method, it changes the value of the running flag to false, which results in stopping the run() method and the background daemon thread. It also closes the connection with the Memcached server.

Using Memcached in an enterprise web application

This section introduces you to integrating Memcached into an enterprise architecture. Using the Contact web application introduced in Listing 1, we’ll add, remove, update, and view records in a CONTACT table. Next I’ll show you how to use Memcached to alleviate database load by configuring it as second-level cache for Hibernate. Finally, I’ll explain how to use Memcached to store custom Java objects and cache the HTML generated for each web page.

Start by downloading ManageContact-NoCaching.zip. The ManageContact application contains a ContactServlet that looks at incoming requests and decides what database interaction is required to execute each one. It then forwards control to ContactDAO in order to execute the required database interaction. ContactDAO uses Hibernate to execute select, insert, and update functions on the Contact table. When control is returned to ContactServlet, it forwards control to the appropriate JSP in order to generate markup on the web page. The ManageContact application has a Maven script that takes care of downloading all of the necessary dependencies; you can execute a mvn install command to download these dependencies and then run the application in an embedded Glassfish server. Once the server is started you should be able to access the application at http://localhost:8080/ManageContact/contact.

Enter hibernate-memcached

Most web applications spend a good chunk of their time interacting with databases. Caching data can help you speed up that interaction, as well reduce load on your database. Hibernate provides a nice interface for caching that allows you to use your own caching framework. You instruct Hibernate on which caching framework to use by specifying the name of a class that implements org.hibernate.cache.CacheProvider with the property hibernate.cache.provider_class. From there, you have two options: you can either create your own class that implements the org.hibernate.cache.CacheProvider interface and stores the cache entries in the Memcached server, or you can use the hibernate-memcached framework, which is an open source framework based on the spymemcached client. hibernate-memcached supports entity and query caching.

Configure hibernate-memcached as a caching framework

By default caching is disabled in hibernate-memcached, so our first step is to enable Hibernate’s second-level cache. We’ll also need to configure Memcached as a caching implementation for Hibernate. We can handle both of these requirements in the Hibernate configuration file (hibernate.cfg.xml), which is used to configure application-level settings for Hibernate:

Listing 2. Hibernate config
<property name="cache.provider_class">com.googlecode.hibernate.Memcached.MemcachedCacheProvider</property>
 <property name="hibernate.Memcached.servers">localhost:11211</property>
 <property name="hibernate.Memcached.cacheTimeSeconds">300</property>
 <property name="hibernate.Memcached.connectionFactory">BinaryConnectionFactory</property>

Now let’s take a closer look at each of the properties set. You can enable the second-level cache by setting a value of cache.provider_class to com.googlecode.hibernate.Memcached.MemcachedCacheProvider. The properties that start with "hibernate.Memcached" are specific to the Memcached provider:

  • cache.provider_class: The value of this property defines which class should be used as a cache implementation. In this case we set it to com.googlecode.hibernate.Memcached.MemcacheddCacheProvider, which is provided by the hibernate-memcached framework and uses Memcached as a caching framework.
  • hibernate.Memcached.server: The properties starting with hibernate.Memcached are used by the hibernate-memcached framework. The value of hibernate.Memcached.server should be a space-delimited list of Memcached instances in host:port format. This Memcached server is running on my localhost at port 11211, so I set the value to localhost:11211, which is the default value.
  • hibernate.Memcached.cacheTimeSeconds: The value of this property defines the default number of seconds that each item should be cached. I want the CONTACT record to be cached for 300 second.
  • hibernate.Memcached.connectionFactory: This is the "simple" name of the spyMemcached ConnectionFactory class. It must be one of DefaultConnectionFactory, KetamaConnectionFactory, or BinaryConnectionFactory. The BinaryConnectionFactory performs much better by using a binary protocol
More configuration properties

See "Adding hibernate-memcached to your application" on the hibernate-memcached wiki for a list of all the configuration properties supported by hibernate-memcached.

Develop a caching strategy

Once you have enabled caching your next step is to choose which data you want to cache and what caching strategy you will use. In my case, I want to cache the data from my CONTACT table. Since that will be regularly updated, I set my cache strategy to read-write by adding a cache element in the Contact.hbm.xml, like this:

Listing 3. Configure the caching strategy
<hibernate-mapping package="com.javaworld.Memcached">
    <class name="Contact" table="CONTACT"  >
    <cache usage="read-write"/>
        <id name="contactId" column="CONTACTID">
            <generator class="increment"/>
        </id>
        <property name="firstName" column="FIRSTNAME"/>
        <property name="lastName" column="LASTNAME"/>
        <property name="email" column="EMAIl"/>
    </class>
</hibernate-mapping>

After you’ve updated your own Contact.hbm.xml file (which you can download with the article source), start the Memcached server by executing a Memcached -vv command. This will start Memcached in verbose mode so that it prints every client interaction on the console. Next, execute mvn clean install to start the application. Go to http://localhost:8080/ManageContact/contact and add couple of records. When you click on the record to go to the details, you should notice that no SQL query is executed; instead those records are coming back from the cache. On the Memcached server console, you should see an interaction similar to what is shown in Figure 2.

Figure 2. A view from the Memcached console (click to enlarge)

Using Memcached for server responses

So far you’ve seen how to reduce the load on your database by using Memcached as a second-level cache in Hibernate. Not all application scenarios are quite so simple, however. For instance, how should you handle web pages that process and display data from a web service? You’ll find your application using CPU-intensive logic to build markup for every response, which probably would be better off cached. If you cache the generated markup then the next request for that markup will return from the cache instead of going to a servlet.

The first step is to build a simple Servlet filter to intercept the request. Start by copying the CachingResponseWrapper.java and CachingResponseWriter.java into a com.javaworld.Memcached.filter package. Together these two classes will collect the responses generated by ContactServlet into a String.

Next, create a CacheFilter.java in the com.javaworld.Memcached.filter package and change its doFilter() method so that it looks like this:

Listing 4. CacheFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        log.debug("Inside CachingFilter.doFilter() " );
        try {
            HttpServletRequest httpServletRequest = (HttpServletRequest)request;
            HttpServletResponse httpServletResponse = (HttpServletResponse)response;
            ObjectPool<MemcachedClient> MemcachedClientPool = MemcachedHelper.getMemcachedConnectionPool();
            MemcachedClient  MemcachedClient = MemcachedClientPool.borrowObject();
            StringBuffer cacheKeyBuffer = new StringBuffer();
            cacheKeyBuffer.append(httpServletRequest.getContextPath());
            cacheKeyBuffer.append(httpServletRequest.getServletPath());
            if(httpServletRequest.getQueryString() != null){
                cacheKeyBuffer.append("?");
                cacheKeyBuffer.append(httpServletRequest.getQueryString());
            }
            
            String cacheKey = httpServletResponse.encodeURL(cacheKeyBuffer.toString());
            System.out.println ("Get Path Info  " + cacheKey);
            String cachedResponse =(String) MemcachedClient.get(cacheKey);
            
            if( cachedResponse == null){
                System.out.println("Response is not cached forwarding control to servlet");
                CachingResponseWrapper cachingResponseWrapper =new CachingResponseWrapper((HttpServletResponse)response);
                chain.doFilter(request, cachingResponseWrapper);
                CachingResponseWriter collectResponseWriter = (CachingResponseWriter)cachingResponseWrapper.getWriter();
                String collectedResponseStr = collectResponseWriter.getCollectedResponse();//.replaceAll("\n", "") ;
                System.out.println( "Set value in the Memcached for key " + httpServletResponse.encodeURL(collectedResponseStr));
                
                System.out.println("Result of set" + MemcachedClient.set(cacheKey, 0, collectedResponseStr).get());
                //MemcachedClient.flush().get();
            }else{
                System.out.println("Returning cached response ");
                response.setContentType("text/html");
                response.getWriter().println(cachedResponse);
            }
            //MemcachedClient.flush().get();
            MemcachedClientPool.returnObject(MemcachedClient);
        } catch (NoSuchElementException e) {
            e.printStackTrace();
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

Note that in the doFilter() method you’re first building the URL that the client used to access the ContactServlet; this URL is used as a key for caching. Once the URL is built, you’ll execute MemcachedClient.get(cacheKey) to check if the response for the given URL is already cached. If it is, then return it; if it isn’t, then wrap the response object into a CachingResponseWriter and pass control to a servlet that will generate the necessary markup. After the control returns from the servlet, call a collectResponseWriter.getCollectedResponse() method. This method will return the response generated by the servlet as a String. Take that response and save it in your cache with its URL as the key. The next time this query is used, the response will come from your cache and not from the servlet.

source:

http://www.javaworld.com/javaworld/jw-05-2012/120515-memcached-for-java-enterprise-performance-2.html?page=1

Did you like this? Share it:

Make Your Own Wi-Fi Hotspot – Testing Development Websites on Mobiles and Tablets

Often you need to test a website on an tablet device such as an iPad using a local development machine’s web server. For whatever reason the available Wi-Fi when developing your site may be on another subnet or network entirely to you development machine (such as in an office environment). Situations like these call for a bit of creative thinking and a different approach, so if this is a problem you face here’s my take on a possible solution.

My workplace has pretty strict networking arrangements in place as we work with Banks and government agencies. This is all well and good until you need to develop something for a mobile device and there’s no way to connect a smart phone or tablet to your development machine over the network/Wi-Fi. For the guys on our team this is caused by the network subnet that is served over our office Wi-Fi being placed in a DMZ without network access (we don’t want  our Reddit surfing clients in reception having access to our super secret stuff).

 imageObviously this causes my team and I a few productivity roadblocks.

Working with mobile and tablet websites carry there own set of problems and there is a range of tools available to solve many of these. Some involve device centric visual elements such as CSS (Adobe Shadow) and user agent detection (user agent switcher). Coming from a server side development angle I’ve also blogged before on how to sniff mobile device traffic for debugging web service traffic on mobile devices. However none of these solutions help solve the largest problem in productivity when it comes to locally developing and testing sites from a developers machine – and if you happen to work in a restricted environment like me and my team then the pain from this problem is a lot stronger.

With this in mind, speeding up your productivity in this areas leads to big gains. If you can avoid having to deploy your development site over and over just to test something small, then you’ve smashed it out of the park.

Don’t have Wi-Fi? Now you do!

The problem when boiled down is that you need to give the mobile device you are testing on wireless network access to your development machine’s web server. For people developing ASP.net websites this usually means IIS.

Now a lot of laptops and desktops these days come bundled with a wireless card as standard (this should give you an idea where I’m going with this), but up until Windows 7, Microsoft’s networking stack hasn’t really had the flexibility to do black magic with wireless cards in the ways that our Linux and OSX cousins have been able to. With the release of Windows 7 this changed – and with this a light bulb went off in the head of one of the developers now working for Connectify.

Connectifyimage

Connectify is a piece of software that enables a Windows PC with a Wi-Fi device to act as a wireless access point. This enables users to share an internet connection between multiple computing devices without the need for a separate physical access point or router.

This has a whole range of benefits (maybe you are in a hotel using their internet and want your phone or tablet to get access?) but what I’ll focus on here is using Connectify to test locally while developing websites.

It is extremely easy to setup, so lets take a look.

What you’ll need
  • A Windows 7 PC (assuming this is a given if you’ve read this far).
  • A Wi-Fi Card.
  • IIS Installed.
  • Your Visual Studio project setup to use IIS for testing.
  • Logged in as a user that has local admin rights.
Setting it up

I will use the Empty ASP.Net MVC Project template for this walkthrough simply for familiarities sake; this should work with any site you can run locally. Even ones hosted on another web server like *shock, horror* Apache or NGINX.

image

Firstly as housekeeping, you’ll need to setup a local IIS website that:

  • Accepts incoming requests on TCP Port 80.
  • Serves on all IP addresses (once Connectify is setup, you can get it to simply work on Connectify’s interface/IP Address).
  • Points at your website’s root directory (For ASP.net web sites this means the root of your website project.)

If you don’t want to install full blown IIS, you can get away with IIS Express instead.

First, download Connectify from here.

Run the installer.

When done you’ll be greeted by this screen, simply click continue.

image

You’ll then be asked whether you want to use the “Lite” or “Pro” version of Connectify. Select Lite as this is all we’ll need.

image

This will leave you with the panel on the right of the screen asking you to setup your HotSpot.

Enter a HotSpot name (the Lite version requires that the name starts with “Connectify-“), password (must be 8 characters or over), and then select the internet connection you would like to share.

Even if you don’t work in an environment where security is considered “critical”, make sure that you set a REALLY strong password. After all, you are setting up an additional way for people to get onto your network so this is a pretty big deal in an office environment. Check out Troy Hunt’s great post on passwords for easy ways to manage these.

For me, I am already on Wi-Fi as I’m writing this post on my laptop, but you may want to select a different connection to share – the interface you share doesn’t matter too much as you’ll only be accessing your local IIS installation; as long as you don’t have firewall rules setup on the interface you’ve selected stopping port 80 access you should be fine.

Then hit the “Start HotSpot” button.

image

Now on your mobile device, connect to your newly configured Wireless Access Point by changing the settings on your device’s Wi-Fi connection.

image

image

Now on your host machine, open a command prompt window and type “ipconfig” to pull up the list of interfaces on your machine. You should notice that you now have an additional Wi-Fi adapter – this is the virtual one created by Connectify to serve your devices. Take note of the IP Address listed, as this will be the address your site is hosted on.

image

Now enter this address in your device’s browser proceeded by “http://”. This is the IP address of your new virtual Wi-Fi adapter (mine was http://192.168.96.1).

image

If you have trouble getting this working (your device maybe sits there waiting for the page to load forever), then Windows Firewall or similar may be blocking the request. You can add IIS to the Allowed List by going to “Settings > System and Security > Windows Firewall > Allowed Programs” and ticking the box to allow IIS (World Wide Web Services (HTTP).

image

Special Note

When you have finished testing your local website, it is important to click the Stop Hotspot button in Connectify to turn off your newly created Wi-Fi access point. This will ensure that no evil doers can run any dictionary or rainbow table attacks on your machine while you aren’t expecting it (probably while you are at home over the weekend or overnight).

Summary

There are now a number of tools available to assist with testing sites on mobiles and tablets, but few tackle the problem at its source as well as this does: speeding up the rinse repeat of a developer test-deploy-modify cycle. Hopefully I’ve shown you a way to drastically reduce the time spent on this when working locally on your developer machine.

What tools do you use to help speed up mobile website development? I’d love to hear in the comments below.

Source:

http://www.diaryofaninja.com/blog/2012/04/15/make-your-own-wifi–testing-development-websites-on-mobiles-and-tablets

Did you like this? Share it: