DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Latest Articles - DZone

article thumbnail
Microsoft Releases Pricing Info for Surface Tablets, Taking Pre-Orders
Earlier today, the Microsoft Store updated with pricing information and details about the new Microsoft Surface tablets running Windows RT. We haven't yet seen pricing information about the Surface Pro, but today's update shows us details about three versions of the Surface running Windows RT, which is the low-end version of the upcoming Windows 8 operating system. Options There will be three options for the Surface tablet with Windows RT: 32 GB without Touch Cover ($499.00) 32 GB with Touch Cover ($599.00) 64 GB with Touch Cover ($699.00) In case the Microsoft Store goes down again like it did earlier today, here's a screenshot from the page: First Official Microsoft Surface Advertisement Released Yesterday Yesterday (Oct. 15), Microsoft released the first official Surface advertisement. Called "The Movement," it features a lot of attractive people swapping Touch Covers, dancing, and throwing their Surface tablets like Frisbees to each other around fountains (something that we at DZone do not recommend--the dancing part, I mean). Touch Cover vs. Type Cover The Surface will feature two types of covers, the Type Cover and the Touch Cover. They are both keyboards but the main difference is how they work. The Touch Cover is capacitive (like a touch screen) and the Type Cover has moving keys like a regular keyboard. The Type Cover costs about $10 more according to today's news. The Touch Covers will come in five different colors: white, red, black, cyan, and magenta. All Surface tablets will come with a kickstand, seen above with the cyan Touch Cover. Pricing Controversy In September, just before pricing info about the upcoming ASUS Windows 8 Tablets was leaked, Steve Ballmer was interviewed by the Seattle Times, in which he hinted that the Surface RT could start as low as $399, which obviously did not turn out to be the case. Still, the cheapest Surface tablet is about $100 less expensive than the cheapest ASUS Windows 8 tablet, the ASUS Vivo Tab RT, which according to the leak in September will start at $599. This means that Microsoft's hardware is competing against its third-party licensees who have to pay a licensing fee to use Microsoft's Windows 8 on their own tablets. Release Date The first Surface tablets will begin shipping before Halloween, on October 26th. There will be a Microsoft-sponsored kick-off event the day before, and are now taking pre-orders. Microsoft has already ordered 3-5 million tablets which they expect to sell by the end of Q4. We will have to wait and see how they do.
May 23, 2023
by Allen Coin
· 8,425 Views · 1 Like
article thumbnail
Microsoft Information Leaker 'Exiting the Game', But Not Without Spilling More Beans
A reliable source of Microsoft-centric information leaks, MSnerd has announced he is exiting the arena. But before he goes, he's decided to answer any and all questions related to Microsoft and their place in the industry in a Q&A session on Reddit. Of particular interest are the topics of Silverlight and potential Windows Phone 'Apollo' upgrades for 1st and 2nd generation Windows Phone users. Silverlight Rumors have been swirling for some time now that Silverlight might be on its way out of the Microsoft product line. However, MSnerd says that Silverlight will continue to be utilized in three areas: XBox 360 apps Windows Phone 7.x apps Line of Business apps While a v6 of Silverlight is not currently on the books at Microsoft, moving forward, Silverlight should essentially be a hybrid of the capabilities of Silverlight 4 and 5. Certain Silverlight technologies will continue to be used more broadly. Silverlight smooth-streaming is being adopted across the industry to serve video to non-Microsoft platforms as well. PlayReady is also being implemented on 3rd-party platforms as it is currently the best alternative to the Apple-only FairPlay DRM system. Microsoft is evolving DeepZoom for use beyond Silverlight & the same is true for PivotViewer. Windows Phone As I previously wrote, there has been some debate as to whether or not Windows Phone 7 devices would be eligible for the Windows Phone 'Apollo' upgrade once it's released. However, MSnerd says that all current Windows Phones will receive some subset of 'Apollo'. The carriers are the primary obstacle in the US. I hear Microsoft is pushing hard for a Mango-like delivery schedule, as are Nokia & HTC. Some Apollo features will be exclusive to the 3rd-gen devices expected to be released this fall on the MSM8960 platform. And what about the future of Windows Phone, and the possible integration with Windows 8? MSnerd expects Windows Phone to become as good as iOS and Android, capability-wise, by the end of this year and moving forward. Integration with Bing, Office, Windows & Xbox will be the best Microsoft has ever done in that respect to date. In other words, nowhere near as good as how Apple does things. During the Reddit Q&A session, MSnerd revealed that he does not work for Microsoft, or any of their partners or contractors. So while he has been a reliable source of information leaks in the past, all of this should be taken with a grain of salt. Here's hoping another relentless information seeker picks up the torch, lest we all sit and wait for Microsoft's official releases.
May 23, 2023
by Chris Smith
· 5,190 Views · 3 Likes
article thumbnail
Microsoft Aims to Take Over IoT with Windows 10
Everybody's trying to get in on the big-money future of IoT, and now "everybody" includes Microsoft with Windows 10. Larry Dignan at ZDNet put together a look at Windows 10's role in IoT - as it's been described by Microsoft CEO Satya Nadella at the Gartner Symposium ITXpo, at least - which suggests that the new OS will be a central platform for IoT systems of all types. Specifically: Windows will be able to run on everything from sensors to wearables to whatever computing shift emerges. Or, as Patrick Thibodeau at ComputerWorld interpreted it: [Nadella] sees the company's upcoming operating system Windows 10 as integral in managing every aspect of the IoT, from the sensors, mechanical systems, to the applications and analytics that underlie it. Those are some pretty big promises, but as Nadella said, Windows 10 is "the first step in a new generation of Windows as opposed to just another release after Windows 8." After all, that would be Windows 9, right? Check out Dignan and Thibodeau's coverage of Nadella at the Gartner Symposium ITXpo for more details on Windows 10 in general. It looks like a promising future: Yo Ebola, I'ma let you finish but #Windows10 is gonna have the greatest virus of all time #WindowsTillIDie — Bill Gates (@BillKingGates) October 6, 2014
May 23, 2023
by Alec Noller
· 9,161 Views · 1 Like
article thumbnail
Easy Microdata in WordPress
HTML5 is making huge strides toward the semantic web -- and the semantic standards defined by the Google/Bing/Yahoo-backed schema.org are probably prudent standards to follow. But if we're talking prudence, practicality, and semantics, then we're probably talking CMS too -- not that coding isn't unremitting joy, of course, but there isn't really much point to coding semantics when you're using a CMS to manage content anyway. Drupal 7 already supports schema.org microdata, and I Lin Clark's excellent guide to managing microdata in Drupal. Which is great, unless you don't use Drupal -- and in fact there's a good chance you don't use Drupal, since WordPress, not Drupal, is the most popular CMS on the web. (Though not necessarily among developers, I'm guessing.) So for easy schema.org microdata management in WordPress, check out this new (free) plugin by Optimum7: The interface is really simple: pick an item, fill in the properties. Done. Currently the only item types supported are: Event Person Organization Review Place Product which is a lot less than the full set listed on schema.org. In the future you'll be able to add more..but those six are some of the biggest anyway. Read the full plugin announcement here, or download the zip file if you already know you want it.
May 23, 2023
by John Esposito
· 7,109 Views · 2 Likes
article thumbnail
Making A Good Thing Even Better: Google Open Source WindowBuilder and CodePro Profiler
Back in September, when Google announced they were to make the Instantiations tool suite free for all, I thought things couldn't get better than this for Java developers. Well I was wrong, today Google trumped that announcement with their latest plan to open source both WindowBuilder and CodePro Profiler. Google is donating the source and the IP for both of these former products to the open source community through the Eclipse Foundation, and creating two new Eclipse projects. All in all, this is a value of more than $5 million dollars worth of code and IP. For those unfamiliar with the products, WindowBuilder provides the best available Java GUI Designer available, integrated into Eclipse allowing you to build Swing, SWT, RCP and GWT interfaces. CodePro Profiler helps you to identify performance issues in your Java code. In answering why the projects have been donated, Google's answer is simple "because it’s the right thing to do. We received many emails after we made the former Instantiations products free, to make them open source and we think this is overall the most responsible thing we can do for the community. It's fantastic technology, and we see no reason to keep it inside Google. We can't wait to see what comes next. " The Eclipse Foundation’s Executive Director, Mike Milinkovich, states that, “this is clearly a significant new project announcement, and very good news for Java developers using Eclipse. It has been impressive to see the continued growth and popularity of WindowBuilder, as this product has always filled a much needed gap in the Eclipse offerings. We look forward to it appearing in an Eclipse release soon. We’re very pleased with Google’s generous support of Eclipse, and the Java developer community around the world.” Both WindowBuilder and CodePro Profiler will become Eclipse projects in the first half of 2011. Once each one is set up as a project and available for download from the Eclipse site, the products will be accessible to use as open source code under the the standard Eclipse license. Eric Clayberg will manage the WindowBuilder project at the Eclipse Foundation and has already rallied more than a dozen volunteer committers. OnPositive will manage the CodePro Profiler project. Maybe you've had a vision for some cool features to add to WindowBuilder: now is your chance to work alongside the WindowBuilder developers to make it even better. Commercial support will be available for both projects. Genuitec will be providing the support for WindowBuilder, and OnPositive will be offering support for CodePro Profile.
May 23, 2023
by James Sugrue
· 18,882 Views · 2 Likes
article thumbnail
The Magic Testing Challenge: Part 2
My last article raised an interesting discussion whether you should see tests more as documentation or more as specification. I agree that they can contribute to both of them, but I still think tests are just - tests... There were also complaints about my statement that testing often becomes tedious work which nobody likes. Also here I agree, that techniques like TDD can help you to structure your code and make sure you code exactly what is needed by writing the tests, but the result of the process will still be a class which needs to be tested somehow. So I have set up another small challenge to show how the visual approach featured by MagicTest helps to make testing a breeze. As you know, traditional assertion-based test frameworks like TestNG or JUnit force us to include the expected results in the test code. Where this may be more or less suitable for simple tests (like in the previous article), it quickly becomes cumbersome if the test handles complex objects or voluminous data. The Task We must test the method createEvenOddTable() (see appended ) with the following functionality: Create HTML table (elements table, tr, td) with specified number of data rows and columns. An additional row will be added to store header information (element th). An additional column will be added which contains the row number (element th) The rows will have attribute class set to "head", "even", or "odd" for easy styling. Both the specification (the 4 lines above) and the source code itself (25 lines) are short and simple to understand, so any experienced developer will write this method in a few minutes. So what's the problem with testing this method? We will see if we look at how MagicTest handles this case. The Magic Test The MagicTest for this method looks like this: public class HtmlTableTest { @Trace public void testCreateEvenOddTable() { HtmlTable.createEvenOddTable(4, 3); } @Formatter(outputType=OutputType.TEXT) public static String formatElement(Element elem) { XMLOutputter serializer = new XMLOutputter(); serializer.setFormat(Format.getPrettyFormat()); return serializer.outputString(elem); } } Some details: We use the @Trace annotation to automatically capture information about calls to the method under test. We rely on naming conventions, so the method HtmlTable.createEvenOddTable() is tested by HtmlTableTest.testCreateEvenOddTable(). Per default, MagicTest uses the toString() method to report the parameter and return values. As the Element's toString() method returns only its name, we have to define a custom @Formatter to get the full XML tree. If we run the test, we get the following report: If we look at the XML element tree in the report, we can see all the details which a complete test should cover: correct nesting of elements (table, tr, td), correct header line, correct line numbers, correct number of rows, correct number of cells for each row, correct class attribute for each row, etc. But even if you end up with a bunch of lengthy assert statements like assert("head".equals(((Element) elem.getChildren("tr").get(0)).getAttributeValue("class"))); which tests for the correct class attribute, this will not be enough: you should also test the absence of the class attribute for all cells except the first ones in each row. So yes, for a sound test you must actually verify the whole XML tree - and this is exactly the information which MagicTest shows you for confirmation. Let the Challenge Begin To run the test yourself, you will need to download the MagicTest Eclipse plug-in. Copy it into the Eclipse dropins folder and restart Eclipse. Then download the attached Eclipse project and import it into your workspace. Run the test class TagsTest by executing Run As / MagicTest. After the first run, the test report will show up and all test steps will be red. This is the MagicTest way of telling you that a step has failed. In our case, the steps just fail because MagicTest simply does not know anything about the expected result. So we carefully check the output and confirm its correctness by clicking on the save button. Now all steps are green - and the test is successful. You have now seen how efficiently this test can be realized using MagicTest - it even looked like fun. Does your test tool accept the challenge? How many minutes and lines does it take you to write the test? I'm looking forward to your contributions! Appendix: Listing HtmlTable /** * Create HTML table (elements table, tr, td) with specified number of data rows and columns. * An additional row will be added to store header information (element th). * An additional column will be added which contains the row number (element th) * The rows will have attribute class set to "head", "even", or "odd" for easy styling. * * @param rows number of rows * @param cols number of column * @return XML element containing the HTML table */ public static Element createEvenOddTable(int rows, int cols) { Element table = new Element("table"); for (int r=0; r 0) { td.setText(Integer.toString(r)); } } } return table; }
May 23, 2023
by Thomas Mauch
· 5,353 Views · 1 Like
article thumbnail
Live-updated Apple Announcement Coverage
Apple is expected to make a big announcement today, holding a special press event that has generated a lot of buzz in the past few weeks. Rumors abound about what Apple will announce, with popular speculation that two new iPhones will be revealed -- the iPhone 5S, the successor to the current-gen iPhone, and the cheaper iPhone 5C, an economical version of the iPhone meant to compete with Samsung in emerging markets. The event is being kept top-secret, with no word on whether Apple will make any announcements regarding its iPod, iPad, or Mac products. We will be tuned in to the event at 10 a.m. Pacific time today, and will be live-updating this article with news and announcements. Stay tuned! (All times are EDT.) Update 1:01 PM: Tim Cook takes the stage. Update 1:03 PM: Cook starts by talking about the iTunes festival. Update 1:10 PM: Cook announces that Apple will be "expanding its footprint," perhaps foreshadowing the 5C. Update 1:13 PM: Apple working to finish iOS 7. Will have a new control center, pull-down search bar, better multitasking capabilities, and Siri updated with the ability to ask her what people are tweeting and read the tweet back to you. Update 1:17 PM: More iOS 7 updates. Improvement to Camera app, which seems to draw inspiration from existing third-party apps. AirDrop will allow you to share photos with anyone on the same Wi-Fi connection as you. iTunes Radio, kind of like Pandora or Spotify. iOS 7 launches September 18th. Update 1:20 PM: Cook talks about iWork. Update 1:22 PM: Apple replacing iPhone 5 with two new designs. Update 1:25 PM: Phil Schiller takes the stage. iPhone 5C is official. 5C will have a backplate with volume and switches made from a single part, and will come in a variety of colors: (green, white, blue, red, yellow). Update 1:28 PM: Good news, developers! 5C will have Retina display and A6 chip. 5C will start at $99 for 16GB, twice that for 32GB. Update 1:35 PM: iPhone 5S official. Update 1:38 PM: 5S will come in three colors, black, silver and gold. More importantly, it will have a 64-bit A7 SoC. (The first 64-bit smartphone.) Time to gear up for 64-bit apps, developers! Update 1:40 PM: A7 will have twice as many transistors as A6. Graphics performance 56 times as fast as original iPhone. 5S will be a good platform to develop mobile games for, like Infinity Blade. Demo from Epic Games. Update 1:45 PM: Epic Games shows off Infinity Blade 3. Apple perhaps wants 5S to have a focus on mobile gaming. 5S will have OpenGL ES 3.0 support. Update 1:48 PM: 5S has a new processor called an M7, which is a co-processor for motion. Expect to be slinging your phone around like a Wiimote -- it's a very advanced pedometer, basically. Developers: Start thinking about apps that could take advantage of the M7. Update 1:52 PM: 5S will have a bigger, better camera lens, with autofocus supposedly comparable to a DSLR. Camera flash will be dual-LED, one cool and white, and another warm and amber. Apps involving the camera will be able to take advantage of this feature. Update 1:59 PM: 5S camera will have a 120 fps slow-motion feature, will incorporate a fingerprint-reading feature called TouchID. TouchID will read your fingerprint in very high detail and is built into the home button. Update 2:04 PM: Fingerprint info is encrypted and stored in A7 chip. It isn't uploaded to Apple's servers, or stored on iCloud, so you don't have to worry about the NSA having your fingerprints (at least from your phone). No word on if individual apps can have access to fingerprints. Update 2:17 PM: The show ended with a surprise guest appearance by Elvis Costello. That's all, folks!
May 23, 2023
by Allen Coin
· 8,888 Views · 1 Like
article thumbnail
[LIVESTREAM] Day 2 of Google I/O, Channel 3
Google I/O got off to a great start yesterday with some incredible insights on what Google has in store for its developers. Here's the live stream of Google I/O for Channel 3. Check out Channel 1 and 2, and get the full schedule here. All times are in PDT. 9AM: "Polymer and modern web APIs: In production at Google scale" 10AM: "Tech for a better world, faster: A discussion with Google.org's social innovators" 11AM: "Firebase: An overview" 1PM: "Improve your Android app's accessibility" 3PM: "Engineering for the Stratosphere - Presented by Women Techmakers"
May 23, 2023
by N A
· 4,383 Views · 2 Likes
article thumbnail
[LIVESTREAM] Day 2 of Google I/O, Channel 2
Google I/O got off to a great start yesterday with some incredible insights on what Google has in store for its developers. Here's the live stream of Google I/O for Channel 2. Check out Channel 1 and 3, and get the full schedule here. All times are in PDT. 9AM: "Smarter user acquisition with App Indexing, AdWords and Google Analytics" 10AM: "Project Tango - Mobile 3D tracking and perception" 11AM: "Designing for virtual reality" 1PM: "Developers connecting the world through Google Play" 2PM: "Android best practices for data transparency" 3PM: "Developing with Google on iOS"
May 23, 2023
by N A
· 4,119 Views · 2 Likes
article thumbnail
[LIVESTREAM] Day 2 of Google I/O, Channel 1
Google I/O got off to a great start yesterday with some incredible insights on what Google has in store for its developers. Here's the live stream of Google I/O for Channel 1. Check out Channel 2 and 3, and get the full schedule here. All times are in PDT. 9AM: "A little badass. Beautiful. Tech and human. Work and love. ATAP." 11AM: "Helping Moonshots Survive Contact with the Real World" 1PM: "Developing for the living room with Google" 2PM: "Android Wear: Your app and the always-on screen" 3PM: "Democratizing Education"
May 23, 2023
by N A
· 4,917 Views · 2 Likes
article thumbnail
Interviews from the ALM Forum: Like SETI@home, but For Your Builds
Check out John's interview with Dave West at the ALM Forum as well Remember SETI@home -- the screensaver that uses your idle CPU cycles to find an extraterrestrial needle in a radio-noise haystack? Well, now you can volunteer your CPU time for loads of other scientific projects. One of the coolest is folding@home -- coolest, I think, because Turing machines are great at double-helixes but not so great when degrees of freedom are determined by the interaction of huge, complicated molecules plus environmental chemistry -- like, say, folding proteins. So that's cool science stuff, saving lives, finding aliens, whatever. But everyday development needs lots of computing power too. What if you could use the same distributed system -- leveraging whatever idle CPU time is available on your local network -- for builds? Okay, of course that was a rhetorical question. Of course you can. Easily, it turns out. But how? At the last ALM Forum I spoke with Dori Exterman, CTO of Incredibuild, a tool that turns your local network into a distributed supercomputer for pretty much any compute-heavy dev tasks. We talked about how such a tool can help you -- but also about how it works, and the answers are pretty neat. This was one of the most exciting interviews I've conducted in a while. Dori is a really smart guy with a really powerful product. Check it out and let us know what you think.
May 23, 2023
by John Esposito
· 5,894 Views · 2 Likes
article thumbnail
Kinect SDK - resources for developers
The official Kinect SDK is here, so there shouldn’t be any problems with incompatible frameworks and libraries on Windows systems. That being said, there are already a couple of interesting resources that I would say are important for developers who just start Kinect development, and for those that were already working with it (e.g. with OpenNI or OpenKinect). Binaries/Toolkits/Samples Download the SDK Microsoft Speech SDK 5.1 Coding4Fun Kinect Toolkit Kinect for Windows SDK Quickstarts samples and slides KinectContrib (with Visual Studio 2010 Templates for Kinect SDK) Documentation Kinect SDK – Programming Guide Kinect SDK FAQ Kinect SDK Forums Skeletal Viewer Walkthrough—Rendering Data with the NUI API (C++ and C#) AudioCaptureRaw Walkthrough—Capturing the Raw Audio Stream (C++) MFAudioFilter Walkthrough—Capturing Audio Streams with a Media Foundation Audio Filter (C++) MicArrayEchoCancellation Walkthrough—Capturing Audio Streams with Acoustic Echo Cancellation and Beam Forming (C++) RecordAudio Walkthrough—Recording an Audio Stream and Monitoring Direction (C#) Speech Walkthrough—Recognizing Voice Commands (C#) Drawing joints in XNA Kinect SDK and F# – a standard library in a non-standard language Kinect Fundamentals #1: Installation & Setup Kinect Fundamentals #2: Basic programming Kinect Fundamentals #3: Getting distance-data from the Depth Sensor Intro to the Kinect SDK–Adding Speech Recognition Videos Installing and Using the Kinect Sensor Setting Up Your Development Environment Skeletal Tracking Fundamentals Camera Fundamentals Working with Depth Data Audio Fundamentals Projects Jellybean, the Kinect Drivable Lounge Chair Kinect Lightsaber Kinductor Kinect + WP7 Interop Kinect Paint Kinect Mouse Cursor NOTE: More resources/links will be added as those appear. If you have something to add, leave a link in the comments section below.
May 23, 2023
by Denzel D.
· 11,331 Views · 1 Like
article thumbnail
Keeping in Touch With EclipseCon 2009
There's only one weekend left until we get to EclipseCon 2009 - and I can't wait! You'll have already seen what talks I'm looking forward to. We'll have lots of coverage of the conference here at EclipseZone. Another really easy way to follow the conference is by using Twitter to follow EclipseCon people. All you need to do to find these people is head over to the EclipseCon Birds Nest. There's four different ways to partipate - as a standard follower, as a speaker, an exhibitor or an attendee. There's going to be a Twitter monitor in the lounge area for people to watch what people are saying about the conference. Twittervision - how cool is that?! Ian Skerrett is also planning a tweetup on Sunday night. Over the last few weeks I've become a Twitter addict myself - it's a great way to keep in touch with the latest goings on. (If you want to follow me, just go to my profile as dzonejames.) In other EclipseCon news, Sun Microsystems have become a Gold Sponsor for the conference. They will be showing their Eclipse support for JavaFX, GlassFish and Solaris. It's good to see Sun there. If you haven't registered yet, there's still time for advance registration, ending today. Make sure to use your DZone coupon to get 10% off, using the DZONE10 code. Otherwise you can register on site. So, if you want to stay in the loop for EclipseCon, become part of the Birds Nest , follow me around on Twitter and keep visiting EclipseZone.
May 23, 2023
by James Sugrue
· 6,456 Views · 1 Like
article thumbnail
JavaFX Gets Video Capabilities
Get ready for high quality video on the screens of your life. Sun has entered into a multi-year agreement with On2 Technologies, to provide immersive media and content on your JavaFX applications. "The JavaFX runtime environment is designed from the ground up to support high fidelity media, empowering content authors to deliver media-rich content and applications across all the screens of your life. On2 shares Sun's vision of driving video convergence across desktops and mobile devices and we look forward to working with On2 to deliver this capability as part of the JavaFX family of products," said Rich Green, executive vice president, Software at Sun. RIAs written in JavaFX will be able to use the On2 video codecs from Fall 2008, at the same time as the 1.0 release of JavaFX desktop (an early access release is expected in July). We'll need to wait until Spring 2009 for JavaFX Mobile and JavaFX TV. The same high resolution video will run across all of these platforms. There's no doubt that JavaFX is in the spotlight for JavaONE 2008, and Sun seems intent on putting weight behind the technology so that it can rival the more established RIA offerings for Adobe and Microsoft. A new javafx.com site has been launched during the conference with tutorials, demos from the keynotes, downloads and getting started guides. Previously I've commented that the hype around JavaFX was too little, too late. The TrueMotion video codecs are a welcome and necessary addition to JavaFX. Perhaps the emphasis on JavaFX is worth it - after all, RIAs are the buzzword of the moment. Is this a sign of good things to come for JavaFX?
May 23, 2023
by James Sugrue
· 15,752 Views · 2 Likes
article thumbnail
Java EE 6 Pet Catalog with GlassFish and MySQL
This Pet Catalog app explains a web application that uses JSF 2.0, Java EE 6, GlassFish and MySQL. I took this example GlassFish and MySQL, Part 2: Building a CRUD Web Application With Data Persistence and modified it to use some of the new features of JSF 2.0 and Java EE 6. Download the sample code Explanation of the usage of JSF 2.0 and Java EE 6 in a sample Store Catalog Application The image below shows the Catalog Listing page, which allows a user to page through a list of items in a store. JSF 2.0 Facelets XHTML instead of JSP For JSF 2.0, Facelets XHTML is the preferred way to declare JSF Web Pages. JSP is supported for backwards compatibility, but not all JSF 2.0 features will be available for views using JSP as their page declaration language. JSF 2.0 Facelets has some nice features like templating (similar in functionality to Tiles) and composite components, which I'm not going to discuss here but you can read about that in this article: http://www.ibm.com/developerworks/java/library/j-jsf2fu2/index.html and in this Tech Tip Composite UI Components in JSF 2.0. The Catalog application's resources JSF 2.0 standardizes how to define web resources. Resources are any artifacts that a component may need in order to be rendered properly -- images, CSS, or JavaScript files. With JSF 2.0 you put resources in a resources directory or a subdirectory. In your Facelets pages, you can access css files with the , javascript files with the , and images with the JSF tags. The list.xhtml uses the The Catalog application uses a resource bundle to contain the static text and error messages used by the Facelets pages. Putting messages in a resource bundle makes it easier to modify and internationalize your Application text. The messages are in a properties file in a java package directory. Title=Pet Catalog Next=Next Previous=Prev Name=Name The resource bundle is configured in the faces-config.xml File (you don't need any other configuration in the faces-config.xml for JSF 2.0, as explained later you no longer have to configure managed beans and navigation with XML). web.WebMessages msgs The List.xhtml facelets page uses a JSF dataTable component to display a list of catalog items in an html table. The dataTable component is useful when you want to show a set of results in a table. In a JavaServer Faces application, the UIData component (the superclass of dataTable) supports binding to a collection of data objects. It does the work of iterating over each record in the data source. The HTML dataTable renderer displays the data as an HTML table. In the list.xhtml web page the dataTable is defined as shown below: (Note: Red colors are for Java EE tags, annotations code, and Green is for my code or variables) The value attribute of a dataTable tag references the data to be included in the table. The var attribute specifies a name that is used by the components within the dataTable tag as an alias to the data referenced in the value attribute of dataTable. In the dataTable tag from the List.jsp page, the value attribute points to a list of catalog items. The var attribute points to a single item in that list. As the dataTable component iterates through the list, each reference to dataTableItem points to the current item in the list. JSF 2.0 Annotations instead of XML configuration The dataTable's value is bound to the items property of the catalog managed bean. With JSF 2.0 managed beans do not have to be configured in the faces-config.xml file, you annotate the managed beans instead as shown below: @ManagedBean @SessionScoped public class Catalog implements Serializable { By convention, the name of a managed bean is the same as the class name, with the first letter of the class name in lowercase. To specify a managed bean name you can use the name attribute of the ManagedBean annotation, like this: @ManagedBean(name = "Catalog"). This Catalog ManagedBean items property is defined as shown below: private List items = null; public List getItems() { if (items == null) { getPagingInfo(); items = getNextItems(pagingInfo.getBatchSize(), pagingInfo.getFirstItem()); } return items; } The getItems() method returns a List of item objects. The JSF dataTable, supports data binding to a collection of data objects. The dataTable object is modeled as a collection of row objects that can be accessed by a row index. The APIs provide mechanisms to position to a specified row index, and to retrieve an object that represents the data that corresponds to the current row index. The Item properties name, imagethumburl, and priceare displayed with the column component: The column tags represent columns of data in a dataTable component. While the dataTable component is iterating over the rows of data, it processes the UIColumn component associated with each column tag for each row in the table. The dataTable component iterates through the list of items (catalog.items) and displays the item (var="row") attribute value. Each time UIData iterates through the list of items, it renders one cell in each column. The dataTable and column tags use facet to represent parts of the table that are not repeated or updated. These include headers, footers, and captions. Java EE 6: JSF 2.0, EJB 3.1, and Java Persistence API (JPA) 2.0 The Catalog ManagedBean annotates the field private ItemFacade itemFacade; with @EJB , which causes an itemFacade EJB to be injected when the managed bean is instatiated. The Catalog getNextItems method calls the ItemFacade Stateless EJB which uses the Java Persistence API EntityManager Query object to return a list of items. @ManagedBean @SessionScoped public class Catalog implements Serializable { @EJB private ItemFacade itemFacade; public List getNextItems(int maxResults, int firstResult) { return itemFacade.findRange(maxResults, firstResult); } EJB 3.1 No-interface local client View With EJB 3.1, local EJBs do not have to a implement separate interface, that is, all public methods of the bean class are automatically exposed to the caller. Simplified Packaging With Java EE 6, EJBs can be directly packaged in a WAR file just like web components. The ItemFacade EJB uses the Java Persistence API EntityManager Query object to return a list of items. The ItemFacade EJB annotates the field private EntityManager em; with @PersistenceContext , which causes an entity manager to be injected when it is instatiated. @Stateless public class ItemFacade { @PersistenceContext(unitName = "catalogPU") private EntityManager em; public List findRange(int maxResults, int firstResult) { Query q = em.createQuery("select object(o) from Item as o"); q.setMaxResults(maxResults); q.setFirstResult(firstResult); return q.getResultList(); } The Java Persistence Query APIs are used to create and execute queries that can return a list of results. The JPA Query interface provides support for pagination via the setFirstResult() and setMaxResults() methods: q.setMaxResults(int maxResult) sets the maximum number of results to retrieve. q.setFirstResult(int startPosition) sets the position of the first result to retrieve. In the code below, we show the Item entity class which maps to the ITEM table that stores the item instances. This is a typical Java Persistence entity object. There are two requirements for an entity: annotating the class with an @Entity annotation. annotating the primary key identifier with @Id Because the fields name, description.... are basic mappings from the object fields to columns of the same name in the database table, they don't have to be annotated. The O/R relationships with Address and Product are also annotated. For more information on defining JPA entities see Pro EJB 3: Java Persistence API book. @Entity public class Item implements java.io.Serializable { @Id private Integer id; private String name; private String description; private String imageurl; private String imagethumburl; private BigDecimal price; @ManyToOne private Address address; @ManyToOne private Product product; public Item() { } public String getName() { return name; } public void setName(String name) { this.name = name; } ... } The Catalog ManagedBean pages through the list of Items by maintaining the PagingInfo.firstItem and PagingInfo.batchSize attributes and passing these as parameters to the getNextItems(firstItem, batchSize) method. The catalog's scope is defined with the annotation @SessionScoped, a JSF Managedbean with session scope will be stored in the session meaning that the bean's properties will stay alive for the life of the Http Session. A JSF commandButton is used to provide a button to click on to display the next page of items. The commandButton tag is used to submit an action event to the application. This commandButton action attribute references the catalog Managed bean next() method which calculates the next page's first row number and returns a logical outcome String, which causes the list.xhtml page to display the next page's list . The catalog next method is defined as shown below: public String next() { if (firstItem + batchSize < itemCount()) { firstItem += batchSize; } return "list"; } JSF 2.0 Simplified Navigation The JavaServer Faces 2.0 NavigationHandler convention adds .xhtml to the logical outcome of the action method (in this example list) and loads that file, in this case, it loads the list .xhtml page after this method returns. If the action doesn't begin with a forward slash (/), JSF assumes that it's a relative path. You can specify an absolute path by adding the slash like this "/items/list". A JSF commandLink is used to provide a link to click on to display a page with the item details. This commandLink action attribute references The catalog showDetail() method: With JSF 2.0 you can now specify parameters in method expressions. The dataTable row object associated with the selected link is passed as a parameter in the "#{catalog.showDetail(row)}" method expression. The Catalog showDetail() method gets the item data from the input parameter, and returns a string which causes the detail.xhtml page to display the item details : public String showDetail(Item item) { this.item = item; return "detail"; } The JavaServer Faces NavigationHandler adds .xhtml to the logical outcome of the action, detail and loads that file. In this case, the JavaServer Faces implementation loads the detail.xhtml page after this method returns. The detail.xhtml uses the outputText component to display the catalog ManagedBean's item properties: GlassFish v3 is a lightweight server OSGi-based; Embedded API; RESTful admin API; Lightweight and fast startup; iterative development cycle "edit-save-refresh browser": Incremental compile of all JSF 2.0 artifacts when you save. Auto-deploy of all web or Java EE 6 artifacts Session retention: maintain sessions across re-deployments Conclusion This concludes the sample application which demonstrates a pet catalog web application which uses Java EE 6, GlassFish v3 and MySQL. Running the Sample Application Download and install NetBeans IDE 6.8 M1 with GlassFish v3 b57 (Glassfish v3 preview is Java EE 6 Preview) , and MySQL Community Server . Follow these instructions to set up a jdbc-driver for MySQL. (Normally this is already setup with Glassfish, but I got an errror message with Glassfish v3 b57 that it was missing) Download the sample code. Unzip the catalog.zip file which you downloaded, this will create a catalog directory with the project code. Create the Pet Catalog database In order to run the sample code you first have to create the Pet Catalog database and fill in the Item table. Start NetBeans IDE Ensure that GlassFish is registered in the NetBeans IDE, as follows: Click the Services tab in the NetBeans IDE. Expand the Servers node. You should see GlassFish v2 in the list of servers. If not, register GlassFish v2 as follows: Right-click the Servers node and select Add Server. This opens an Add Server Instance wizard. Select GlassFish v2 in the server list of the wizard and click the Next button. Enter the location information for the server and click the Next button. Enter the admin name and password and click the Finish button. Start the MySQL or Java DB database as follows: Click the Services tab in the NetBeans IDE. Expand the databases node. You should see the Java DB database in the list of databases. If you have installed the MySQL server database, you should also see the MySQL database in the list of databases.. Note: Java DB comes bundled with Netbeans, you can download MySQL separately. Right-mouse click on the Java DB or MySQL server database and select Start. If you installed MySQL, set the properties of the MySQL server database as follows: Right-click on the MySQL server database and select Properties. This opens the MySQL Server Properties dialog box, as shown in Figure 8. Figure 8. MySQL Server Basic Properties In the Basic Properties tab, enter the server host name and port number. The IDE specifies localhost as the default server host name and 3306 as the default server port number. Enter the administrator user name, if not displayed, and the administrator password -- the default administrator password is blank. Click the Admin Properties tab. Enter an appropriate path in the Path/URL to admin tool field. You can find the path by browsing to the location of a MySQL Administration application such as the MySQL Admin Tool. Enter an appropriate path in the Path to start command. You can find the path by browsing to the location of the MySQL start command. To find the start command, look for mysqld in the bin folder of the MySQL installation directory. Enter an appropriate path in the Path to stop command field. You can find the path by browsing to the location of the MySQL stop command. This is usually the path to mysqladmin in the bin folder of the MySQL installation directory. If the command is mysqladmin, in the Arguments field, type -u root stop to grant root permissions for stopping the server. The Admin Properties tab should look similar to Figure 9. Figure 9. MySQL Server Administration Properties Click the OK button. Right-click on the MySQL server or Java DB database and select Start. Create the petcatalog database as follows: Right-mouse click on the Java DB or MySQL server database and select Create Database. This will open a create Database window. Enter the database name catalog for Java DB or petcatalog for MySQL. For Java DB enter userid password app app as shown below: Click O.K. to accept the displayed settings. Create the tables in the catalog database as follows: Underneath Databases you should see a database connection for the petcatalog database. For example MySQL: or Java DB: Right-mouse click on the petcatalog connection and select Connect. Right-mouse click on the petcatalog connection and select Execute Command. This will open up a SQL command window. Copy the contents of the catalog.sql file in the catalog directory and paste the contents into the SQL command window, as shown in below: Click the Run SQL icon (Ctrl+Shift+E) above the SQL command window. Note: It is ok to see this: "Error code -1, SQL state 42Y55: 'DROP TABLE' cannot be performed on 'ITEM' because it does not exist. Line 2, column 1" . This just means you are deleting a table that does not exist. If you need to delete and recreate the tables you will not see this message the second time. View the data in the Pet Catalog database Item table as follows: Underneath Databases you should see a database connection for the petcatalog database. For example MySQL: or Java DB: If the database connection is broken like in the following diagram: Right-mouse click on the petcatalog connection and select Connect. as shown below: if prompted for a password, for MySQL leave it blank, for JavaDB enter user app password app. Expand the Tables node below the petcatalog database in the Services window. You should see the item table under the Tables node. You can expand the item table node to see the table columns, indexes, and any foreign keys, as shown in below : Figure 12. An Expanded Table Node You can view the contents of a table or column by right-clicking the table or column and selecting View Data as shown below: Figure 13. Viewing the Contents of a Table Follow these instructions to Create a JDBC Connection pool and JDBC resource. Name the pool mysql_petcatalog_rootPool and the jndi resource jdbc/petcatalog. Note: you do not have to create a JDBC connection pool and resource if you use the Netbeans wizard to generate JPA entities from database tables as described in this article GlassFish and MySQL, Part 2: Building a CRUD Web Application With Data Persistence. Open the catalog/setup/sun-resources.xml file and verify that the property values it specifies match those of the petcatalog database and jdbc resources you created. Edit the property values as necessary. Running the Sample solution: If you want to run the sample solution, you have to create the catalog database tables first as described above. Open the catalog project as follows: In NetBeans IDE, click Open Project in the File menu. This opens the Open Project dialog. Navigate in the Open Project dialog to the catalog directory and click the Open Project button. In response, the IDE opens the catalog project. You can view the logical structure of the project in the Projects window (Ctrl-1). Run the catalog by right-clicking on the catalog project in the Projects window and selecting Run Project. The NetBeans IDE compiles the application, deploys it on Glassfish, and brings up the default page in your browser. (at http://localhost:8080/catalog/). For more information see the following resources: A Sampling of EJB 3.1 Java EE 6 Technologies JSF 2.0 Home page Project Mojarra SDN JavaServer Faces Page JSF 2 fu, Part 1: Streamline Web application development Composite UI Components in JSF 2.0 Creating Your First Java EE 6 Application Roger Kitain's Blog (co-spec lead for JSF 2.0) Ed Burns's Blog (co-spec lead for JSF 2.0) Cay Horstmann's Blog: JSF 2.0 specifying parameters in method expressions JavaServer Faces 2.0 Ref Card Jim Driscoll's Blog Top reasons why GlassFish v3 is a lightweight server Beginning Java™ EE 6 Platform with GlassFish™ 3: From Novice to Professional Book
May 23, 2023
by Carol McDonald
· 18,663 Views · 1 Like
article thumbnail
Java Developers, Don't Throw Out Your Mac Yet: Apple Will Contribute To OpenJDK
Finally, some very good news for the Java community. For those who were worried about the future of Java on OSX, don't worry: Apple have just announced that they will be working with Oracle on the OpenJDK project. Apple will contribute most of the key components, tools and technology required for Java SE 7 on Mac OS X. Following the announcement that Apple would not longer be maintaining further JDK updates on Mac OS X beyond the most recent update, this comes as very welcome news to Oracle: “We are excited to welcome Apple as a significant contributor in the growing OpenJDK community,” said Hasan Rizvi, Oracle’s senior vice president of Development. “The availability of Java on Mac OS X plays a key role in the cross-platform promise of the Java platform. The Java developer community can rest assured that the leading edge Java environment will continue to be available on Mac OS X in the future. Combined with last month’s announcement of IBM joining the OpenJDK, the project now has the backing of three of the biggest names in software.” And of course, Apple are happy to keep Java developers happy: “We’re delighted to be working with Oracle to insure that there continues to be a great version of Java on the Mac,” said Bertrand Serlet, Apple’s senior vice president of Software Engineering. “The best way for our users to always have the most up to date and secure version of Java will be to get it directly from Oracle.” Apple also confirmed that Java SE 6 will continue to be available from Apple for Mac OS X Snow Leopard® and the upcoming release of Mac OS X Lion. Java SE 7 and future versions of Java for Mac OS X will be available from Oracle. Henrick has already blogged about this, answering some of questions that are likely to be on developers minds: Q: When will JDK 7 be available for OSX? A: My expectation is that we will release on current supported platforms first, and that OSX support will follow later. The JDK 7 schedule can not easily accomodate large changes like the addition of a new platform. This is great news. Once again we're seeing Oracle listening to community comments, and it's good to see that recent pleas to Apple to contribute their work to the OpenJDK haven't fallen on deaf ears. Kudos to both companies for a continued committment to Java.
May 23, 2023
by James Sugrue
· 14,893 Views · 1 Like
article thumbnail
IoT's Security Nightmare: Unpatched Devices that Never Die
As the Internet of Things becomes a ubiquitous idea and a fact of life, what happens to all the aging and increasingly insecure Things? According to Wired's Robert Mcmillan, responding to a recent question on the security of IoT from Dan Geer, this may be a serious problem [1][2]. The solution, Mcmillan suggests, is to design these devices with an expiration date. In other words: they need to be programmed to die. The problem may not be too severe now, but the future of the Internet of Things will look different than it does now. Security will likely loosen, because software will be a part of everything, and it tends to be the case that things mass produced to that degree experience a bit of a drop in quality. That, Mcmillan argues, presents a problem: ...all code has bugs, and in the course of time, these bugs are going to be found and then exploited by a determined attacker. As we build more and more devices like thermostats and lightbulbs and smart trashcans that are expected to last much longer than a PC or a phone, maybe we need to design them to sign off at the point where they’re no longer supported with software patches. Otherwise, we’re in for a security nightmare. A similar argument came from Bruce Schneier's interview with Scott Berinato about how future bugs like Heartbleed could impact IoT [3]. Schneier's conclusion is that processes must be built into IoT devices and development to allow for regular patching and securing of embedded systems. How practical is that, though? Mcmillan points to some recent scenarios where these fears have already come true: the lack of support for Linksys routers infected with Moon Worm, for example. Long-term patching would solve these issues, but will the increasing number of organizations developing IoT products be forward-thinking enough to care? It's also not as if the problem will fade as the products become less popular, Mcmillan says: Researchers have studied the way that security vulnerabilities are discovered, and what they’ve found is that security bugs will keep cropping up, long after most software is released... in fact, they’ll only get worse. Open sourcing technology as it ages may also be a solution, Mcmillan says. However, even that is imperfect and requires a lot of cooperation from companies who may not be enthusiastic about such cooperation, as well as a base of developers interested enough in the technology to maintain it. So, creating devices with an expiration date may be one of the most practical solutions. Otherwise, what happens when IoT is everywhere? What happens when we stop taking care of the things that we build? [1] http://www.wired.com/2014/05/iot-death/ [2] http://geer.tinho.net/geer.secot.7v14.txt [3] https://dzone.com/articles/heartbleed-iot-how-much-worse
May 23, 2023
by Alec Noller
· 8,918 Views · 1 Like
article thumbnail
IoT & Dogs: How to Build a Sleep Tracker Using Tessel and Twilio
Sometimes you just have to track the sleep habits of the living things around you. For example, maybe your children wake up at mysterious and unexpected times. Otherwise, in the case of Ricky Robinett at Twilio, you might just be wondering how much your dog sleeps while you're away. One solution, as it turns out, is a sleep tracker built with Tessel and Twilio. Robinett has written a solid tutorial on how to build such a thing, and all it requires is a Twilio account (of course), along with a Tessel microcontroller and accelerometer module, a USB battery pack, and a somewhat cooperative dog. From there, Robinett walks you through everything you'll need to know: setting up Tessel and sending SMS, using Twilio libraries, interacting with the accelerometer, and so on. Then, once you're all set up, you're ready to take an action rarely described in technical circles: Deploy to Your Dog The end result (depending on your personal choices regarding dog-clothing) is something like this: (via Ricky Robinett at Twilio) It keeps you updated via text message on your dog's sleeping habits by generating an update after five minutes without movement. So, if your dog is just a particularly lazy creature who spends extended periods of time staring, stationary and wide-eyed, at a fixed point on the wall, it sounds like you might get some inaccurate numbers. In general, though, it's a cool idea: regular updates letting you know how long your dog has slept. So, as long as nobody hacks your dog and starts running Doom on it (as those pesky hackers are known to do these days), it looks like a fun project.
May 23, 2023
by Alec Noller
· 5,363 Views · 1 Like
article thumbnail
IoT DIY: A Round-Up of SDKs for IoT and Wearables
It's fairly clear that not everybody agrees on how to define the Internet of Things, but certain aspects are more generally agreed upon. For example, DIY computing (along the lines of Raspberry Pi) is opening up in a big way because of the growth of IoT, allowing developers to solve a lot of new problems in new spaces and think outside of the box a bit. To illustrate that point, Sunanda Jayanth at Contract IQ has assembled a round-up of SDKs for IoT and wearable devices. The list covers six SDKs, each with a brief description: Google’s Android Wear SDK Samsung’s Tizen SDK IBM + Libelium WunderBar by relayr Microsoft Windows on Devices u-blox + ARM Some of these SDKs - Windows on Devices, for example - are not available quite yet, but have been announced and are coming soon. Beyond the round-up, Jayanth warns of possible hurdles for IoT, despite the bright future: At the stage of growth that IoT is in right now, incumbents are in danger of stifling growth simply by accidentally introducing complexity. If your things and my things have to talk together, we need a common language. A rapid development and uptake of common platforms and standards that encourages seamless cooperation is what the industry is in dire need of. But the solution Jayanth suggests, is open source software. Industry-wide standards for architecture and APIs could help prevent these problems, and developers taking advantage of these new SDKs and growing a community - an open source community, ideally - around these new technologies could go a long way to keeping things orderly in the future. That, and making sure we don't end up with mountains of bug-ridden, unkillable IoT devices.
May 23, 2023
by Alec Noller
· 5,393 Views · 1 Like
article thumbnail
IoT is Coming to a Store Near You
If you're in a Best Buy sometime around November or December working your way through your Internet of Things shopping list, you might come across a new department: Connected Home. According to Best Buy's overview, it will include a lot of IoT products: We’re talking video monitoring (including security cameras and systems like Dropcam); smart thermostats (from Nest and Honeywell); smart lighting (check out Philips Hue); smart locks (with options from Kwikset); garage door accessories (like those from Chamberlain); motion, water, door and window sensors; smoke/CO2 detectors; automation/control hubs, light and appliance controls (including Belkin WeMo); and energy monitors. It's an interesting development - IoT is becoming fairly mainstream these days. Check it out: (via Best Buy) According to Stacey Higginbotham at Gigaom, Best Buy isn't the only one, either: Jim Frey (@smartlumens) sent me a picture of a Massachusetts Target featuring an end cap with Wink’s hub and various good, as well as what look like connected locks. Given the predictions for IoT's growth over the next few years, it's not surprising to see IoT being featured a little more explicitly in retail settings - I'm sure there's more to come.
May 23, 2023
by Alec Noller
· 5,138 Views · 1 Like
  • Previous
  • ...
  • 520
  • 521
  • 522
  • 523
  • 524
  • 525
  • 526
  • 527
  • 528
  • 529
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×