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
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

The Latest Popular Topics

article thumbnail
Tomorrow’s Cloud Today: Unpacking the Future of Cloud Computing
This article takes a journey into the future of cloud computing, discussing emerging trends such as autonomous and distributed cloud-generative AI tools.
May 23, 2023
by Navveen Balani
· 7,948 Views · 3 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,656 Views · 2 Likes
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,371 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,488 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,417 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,626 Views · 1 Like
article thumbnail
AI Professions of the Future
With the advent of AI in the future, this article seeks to explore two necessary new professions that will appear in adaptation.
May 22, 2023
by Rustam Akhmetov
· 1,569 Views · 1 Like
article thumbnail
How To Create React JS Form Using Hooks and PrimeReact/Primefaces UI Components
PrimeReact components can be easily used/integrated with React Hook Form. In this example, a register panel is simulated using React Hook Form.
May 22, 2023
by abhishek saini
· 2,597 Views · 1 Like
article thumbnail
Building a Java Payment App With Marqeta
Using Java and Marqeta, we’ll build out a fully functioning card payment system your users can use for payments anywhere that a debit or credit card is accepted.
May 22, 2023
by Michael Bogan DZone Core CORE
· 2,248 Views · 2 Likes
article thumbnail
What I Learned From Crawling 100+ Websites
Over the last five weeks, I have crawled and debugged 100+ random websites. The websites were given to us by clients and leads. Here are my findings.
May 22, 2023
by Thomas Hansen DZone Core CORE
· 1,569 Views · 3 Likes
article thumbnail
Hibernate Get vs. Load
In this article, the reader will learn about the difference between the get method and the load method in hibernate using get() and load().
May 22, 2023
by Jay Ponnam
· 3,532 Views · 1 Like
article thumbnail
AI Avatars: Meet the Future of Interactions
Learn what an AI avatar is, its inherent features, and how these AI-powered assistants can streamline business processes.
May 22, 2023
by Tetiana Markova
· 1,538 Views · 3 Likes
article thumbnail
You’ve Got Mail… and It’s a SPAM!
This article briefs about the impact of spam and how it can be addressed with emerging machine-learning technology based on our journey in this domain.
May 22, 2023
by Ramesh Manickavel DZone Core CORE
· 3,874 Views · 1 Like
article thumbnail
Multi-Stream Joins With SQL
Learn how to combine two or more streams of data together in real-time with a streaming database, run SQL queries and create a materialized view.
May 22, 2023
by Bobur Umurzokov
· 2,198 Views · 2 Likes
article thumbnail
Avoiding Pitfalls With Java Optional: Common Mistakes and How To Fix Them [Video]
Learn how to avoid traps with Java Optional and how to use it efficiently by taking the best of this API to make a readable code.
May 22, 2023
by Otavio Santana DZone Core CORE
· 9,813 Views · 11 Likes
article thumbnail
Transforming Translation: The Power of Context in NLP
Natural Language Processing (NLP) and Machine Translation have emerged as indispensable tools in our increasingly interconnected world.
May 22, 2023
by Yifei Wang DZone Core CORE
· 6,045 Views · 5 Likes
article thumbnail
An Overview of Kubernetes Security Projects at KubeCon Europe 2023
Kubernetes security is more important than ever and should be top-of-mind for most teams. Walk through the latest in k8s security solutions from KubeCon 2023.
May 22, 2023
by John Vester DZone Core CORE
· 48,748 Views · 4 Likes
article thumbnail
Introduction to Machine Learning: Everything You Need to Know
This presentation from Hilary Mason at devs love bacon in April, titled "Everything You Need to know about Machine Learning in 30 Minutes or Less," is an introduction to machine learning for those who have no prior experience with it. Take a look if you're interested in a quick, fun overview to help you get started: Hilary Mason - Machine Learning for Hackers from BACON: things developers love on Vimeo. Then, if you want to get a bit deeper, check out this intro to machine learning in R, or to get a lot deeper, our Machine Learning Refcard.
May 22, 2023
by Alec Noller
· 12,245 Views · 2 Likes
article thumbnail
Google Becomes A Java Developer's Best Friend: Instantiations Developer Tools Relaunched For Free
Back in August when Google acquired Instantiations, the speculation was that Google would possibly provide Instantiations GWT Designer as a free tool for all to use. Today, Google has made my day, because not only is GWT Designer relaunched as a free tool, but so are their three other core products. This is a huge day for Java developers, particularly those focussed on the desktop, as these tools are among the best of breed: as commercial tools they were worth the cost as they boosted productivity, but as free tools they are now an indispensible part of your software development workflow. The importance of this announcement can not be overstated. Firstly, Java developers now have a production quality UI builder for fast prototyping of their desktop application using either Swing, SWT or RCP, as well as GWT and XWT. I've used WindowBuilder in the past, and it's a great way to get started quickly. The code generated is very usable. There has been no convincing free solution available for this range of UI frameworks in the past: today that all changes. High quality static analysis of code is important for Java developers. Before you walk into a code review, it's always worth taking a scan over your code. Typically developers skip this, or else they use a free static analysis tool (e.g. FindBugs). Working CodePro AnalytiX into your development process, or just your nightly build, will help you identify bugs, and possible security issues, with your codebase earlier. Finally, automated UI testing is one of the most difficult areas to get right. While there are free solutions available, the commercial products have always seemed one step better. WindowTesterPro will allow you to automated tests for your Swing, SWT or RCP applications. It includes record and playback functionality to get you started with an automation test suite quickly. Here's a quick overview of the tools, now relaunched as Google products GWT Designer Powerful Eclipse-based development tools that enable Java developers to quickly create Ajax user interfaces using Google Web Toolkit (GWT) CodePro AnalytiX Comprehensive automated software code quality and security analysis tools to improve software quality, reliability, and maintainability WindowBuilder Pro Java graphical user interface designer for Swing, SWT, GWT, RCP, and XWT UI frameworks WindowTester Pro Test GUI interactions within Java client rich applications for the SWT and Swing UI frameworks Google plans to unify the products into the Google Plugin for Eclipse. You can download any of the tools from the GWT download page. Check out Google's announcement to find out more.
May 22, 2023
by James Sugrue
· 32,855 Views · 1 Like
article thumbnail
How JavaScript Timers Work
At a fundamental level it's important to understand how JavaScript timers work. Oftentimes they behave unintuitively because of the single thread which they are in. Let's start by examining the three functions that we have access to with which to construct and manipulate timers. var id = setTimeout(fn, delay); - Initiates a single timer which will call the specified function after the delay. The function returns a unique ID with which the timer can be canceled at a later time. var id = setInterval(fn, delay); - Similar to setTimeout but continually calls the function (with a delay every time) until it is canceled. clearInterval(id); - Accepts a timer ID (returned by either of the aforementioned functions) and stops the timer callback from occurring. In order to understand how the timers work internally there's one important concept that needs to be explored: timer delay is not guaranteed. Since all JavaScript in a browser executes on a single thread, asynchronous events (such as mouse clicks and timers) are only run when there's been an opening in the execution. This is best demonstrated with a diagram, like in the following: There are Plenty of Reasons Why JavaScript Timers Matter You may become frustrated if you just look at JavaScript timers as something that doesn’t serve any real purpose for you. It is easy to get yourself into that mentality, but it is also not entirely productive or accurate to think of them in this way. The truth is that JavaScript timers are extremely effective, and they help control various processes that need to be controlled. You may want to set up timers to go off when someone clicks their mouse or when a certain amount of time has passed. Whatever the case may be, you need those timers to help you take care of what is happening. JavaScript timers have already proven themselves to be incredibly useful for many people, and they can be for you as well. Since JavaScript can only ever execute one piece of code at a time (due to its single-threaded nature) each of these blocks of code is "blocking" the progress of other asynchronous events. This means that when an asynchronous event occurs (like a mouse click, a timer firing, or an XMLHttpRequest completing) it gets queued up to be executed later (how this queueing actually occurs surely varies from browser to browser, so consider this to be a simplification). To start with, within the first block of JavaScript, two timers are initiated: a 10ms setTimeout and a 10ms setInterval. Due to where and when the timer was started it actually fires before we actually complete the first block of code. Note, however, that it does not execute immediately (it is incapable of doing that, because of the threading). Instead, that delayed function is queued in order to be executed at the next available moment. Additionally, within this first JavaScript block, we see a mouse click occur. The JavaScript callbacks associated with this asynchronous event (we never know when a user may perform an action, thus it's considered to be asynchronous) are unable to be executed immediately thus, like the initial timer, it is queued to be executed later. After the initial block of JavaScript finishes executing the browser immediately asks the question: What is waiting to be executed? In this case, both a mouse click handler and a timer callback are waiting. The browser then picks one (the mouse click callback) and executes it immediately. The timer will wait until the next possible time, in order to execute. Note that while the mouse click handler is executing the first interval callback executes. As with the timer, its handler is queued for later execution. However, note that when the interval is fired again (when the timer handler is executing) this time that handler execution is dropped. If you were to queue up all interval callbacks when a large block of code is executing the result would be a bunch of intervals executing with no delay between them, upon completion. Instead, browsers tend to simply wait until no more interval handlers are queued (for the interval in question) before queuing more. We can, in fact, see that this is the case when a third interval callback fires while the interval, itself, is executing. This shows us an important fact: Intervals don't care about what is currently executing, they will queue indiscriminately, even if it means that the time between callbacks will be sacrificed. Finally, after the second interval callback is finished executing, we can see that there's nothing left for the JavaScript engine to execute. This means that the browser now waits for a new asynchronous event to occur. We get this at the 50ms mark when the interval fires again. This time, however, there is nothing blocking its execution, so it fires immediately. Let's take a look at an example to better illustrate the differences between setTimeout and setInterval. setTimeout(function(){ /* Some long block of code... */ setTimeout(arguments.callee, 10); }, 10); setInterval(function(){ /* Some long block of code... */ }, 10); These two pieces of code may appear to be functionally equivalent, at first glance, but they are not. Notably, the setTimeout code will always have at least a 10ms delay after the previous callback execution (it may end up being more, but never less) whereas the setInterval will attempt to execute a callback every 10ms regardless of when the last callback was executed. There's a lot that we've learned here, let's recap: JavaScript engines only have a single thread, forcing asynchronous events to queue waiting for execution. setTimeout and setInterval are fundamentally different in how they execute asynchronous code. If a timer is blocked from immediately executing it will be delayed until the next possible point of execution (which will be longer than the desired delay). Intervals may execute back-to-back with no delay if they take long enough to execute (longer than the specified delay). All of this is incredibly important knowledge to build off of. Knowing how a JavaScript engine works, especially with the large number of asynchronous events that typically occur, makes for a great foundation when building an advanced piece of application code. This is an excerpt from my work-in-progress book: Secrets of the JavaScript Ninja. To be released Fall 2008. Previous excerpt: Partial Function Application in JavaScript
May 22, 2023
by John Resig
· 20,814 Views · 1 Like
  • Previous
  • ...
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • ...
  • 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
×