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
My Experiences with Maven in IntelliJ IDEA and NetBeans IDE
With IntelliJ IDEA supporting a fully-functional integration with Maven, you can automate your entire building process. The result is that you can create a new Maven project as well as easily handle multi-module projects. Netbeans IDE on the other hand, simplifies the development of mobile applications as well as web and desktop applications using Java and HTML5. So imagine my surprise when some weeks ago, I saw a colleague fighting IntelliJ's Maven support. A dependency was not detected by IntelliJ's Maven support and to fix it, he had to remove the dependency from the POM, save it, add it back to the POM and save it again. Hmmm... somehow not quite optimal. This was the reason for me to take a look at IntelliJ's Maven support and compare some points with the support provided by NetBeans. Let’s look first at how IntelliJ IDEA can support an integration with Maven that is fully functional. This will assist you in automating the whole build. It doesn’t matter whether you wish to create a totally new Maven project, synchronize with an existing open project or add Maven support to existing IntelliJ IDEA projects. You can also manage projects that are multi-module. Creating New Maven Projects These are the steps I’d follow to create a new Maven Project. If you’re starting from scratch and there’s no project open currently in IntelliJ IDEA, go to the Welcome screen and click on New Project. Alternatively, you can select File and then create a new project for the main menu. Once you’ve created your new project, you must name it and if you require it, change its location. You’ll want to create the Git repository, so select the new project for placement under version control. Just be aware that you can do this at any time later in the build. Don’t forget to tick the box. Your project requires a language selection, so do that as well as add any other languages you may want via plugins. You do this by clicking “App>general add”. Under "build system", select Maven followed by specifying the project’s SDK. Or, you can go with the default or JDK. While it is not necessary, it’s a good idea to have a file with a basic sample code, so tick the “add sample code” box. Don’t neglect to specify Maven’s coordinates, which are included in the pom.xml file. You’ll find these in the advanced settings where a new project package is identified in the Groupid box and the project name is specified via the Artifactid box contents. Maven naming conventions follow Jav’s package name rules. This is in the format of a reversed domain name that you control e.g. org.apache.maven. While the naming conventions are not enforced, you’ll have a hard time getting names that don’t follow the rules in the Maven central repository, especially if it is a single word used for group IDs. When you’ve finished your selections, then click “create”. Handling Maven Projects If you open a Maven project in IntelliJ, IntelliJ still generates a default project folder (".idea") and file (".iml"). This means IntelliJ must always ensure that data in the POM is kept in sync with its proprietary structures. However, IntelliJ only handles one direction. Changes in the POM are recognized and the project settings are in sync most times. But if you change something in the project settings, these changes are not reflected in the POM. So, as my colleague experienced, you have to do it twice. Also, IntelliJ lists the "target" folder and ".idea" project settings folder in the logical project view, which is not useful most of the time. In IntelliJIDEA, the Maven project pom.xml file has a compiler included as well as the target Java version. There’s also a Maven tool window and any dependencies that are required to start work. Just bear in mind that the version of Java that is specified in the pom.xml file will, in all likelihood, override the "JDK for importer" option’s specification version. You can find this in the Maven settings. Configure Maven Settings To make things easier, configure your Maven settings before opening new projects. Configuring IntelliJ IDEA to display the Maven settings prior to opening an existing project that is being opened for the first time in IntelliJ IDEA is done at the application level. Once set, they’ll appear for any new project that you open. On the Welcome screen, “All settings” under the customize option. You can also access it from the main menu by selecting “file”, then “new project setup” followed by “preferences for new projects.” In the “preferences” dialog under settings, choose “build”, then “execution”. Under deployment, select Maven as your option under “build tools.” Now go to the Maven settings dialog and make the selection “Show settings dialog for new Maven projects”. You can then click OK and your changes will be saved for all future projects. What this does is, each time you open new projects, the Maven settings dialog is displayed by IntelliJ IDEA and you can then specify the local Maven repository’s location as well as a user settings file. In contrast, NetBeans uses the POM for pretty much everything. The Maven POM file defines the project, as shown below. If you change something in the project settings, it is directly stored in the POM. Only in rare cases, e.g., if you redefine actions, does NetBeans need to create a specific file. NetBeans only shows important information in the Projects window, as shown above. However, if you do want to see the Maven "target" folder, you can easily switch to the Files tab: Building Maven Projects When you build a Maven project in IntelliJ, with the default IDE commands, Maven is not used for the build process. The same goes for tests. If you are using different profiles for local development and your continuous integration server, you have to use Intellij's Maven integration tab to build and test your project with Maven. This is really ugly because you cannot use all the shortcuts that make life easier. NetBeans uses Maven for all that. You can simply press F11 or use the default toolbar button or menu item to build your applications with Maven. This same action works whether you are using Maven, a plain NetBeans Ant build script, or Gradle. It’s always the same consistent procedure. You can even change the Maven command that is used to build the project via F11. You are completely free to configure what you need: Executing Maven Goals Running Maven goals in IntelliJ displays a dialog with just two text fields and you have to type all the Maven parameters by hand. Hey man, it could be so much easier. Running a custom goal in NetBeans gives you a fantastic dialog with lots of possibilities. You can choose the profile, add properties, and even save everything to run it again later. This saves a lot of work. Conclusion There are many smaller issues that show that NetBeans has a smoother Maven integration than offered by IntelliJ. My impression is that IntelliJ's Maven support is just an extension to its default project management system since It still needs the default IntelliJ project folders and files. Meanwhile, NetBeans provides a much deeper and more complete integration. One more thing. I’m not an IntelliJ user so please forgive me if there is a mistake in my observations. I'm also not trying to start a new IDE war. What I want to do by means of this article is to get readers to think out of the box. If you are familiar with your IDE, that is great. If you are productive with your IDE, that is great. But if you think an IDE needs to be expensive in order to be a good product, you are totally wrong and should definitely give NetBeans a try. Thorsten Marx is a product manager and developer at e-Spirit AG in Germany.
July 24, 2022
by Thorsten Marx
· 17,751 Views · 2 Likes
article thumbnail
Build an RSS Reader for Windows Phone 7
In this lesson, I will create a simple RSS(Really Simple Syndication) Reader for Windows Phone 7. I will use Linq-To-XML for reading an RSS feed. The user interface will contain a Textbox to enter an URL of an RSS Feed and a ListBox element to display results. Source code RSS Reader source code (.zip) Additional information What is RSS? (Wikipedia) 1. Creating a new project First of all, you need to create a new project. To do so open Visual Studio 2010 -> File -> New Project -> select Windows Phone Application there as it is shown in the picture below. eugenedotnet creating windows phone 7 project 2. Adding a new reference to solution Next, you need to add a reference to Microsoft.Xml.Linq library. You need to right-click on the References directory under your project and select Add Reference there. Under the .NET tab, you will find Microsoft.Xml.Linq, push OK. Check the screenshot below. eugenedotnet add Microsoft.Xml.Linq reference 3. Modifying header This step can be optional, but I have decided to add it to the lesson. In this step, we simply modify the TitleGrid element to specify the title of the application. 4. Modifying ContentGrid ContentGrid will contain all the required UI elements to operate with our application. Basically, there will be three of them: TextBox for user to enter an URL of a RSS Feed Button to trigger an event to read feed ListBox to display results using the Data Binding feature of Silverlight (e.g {Binding Title} ). ListBox will display a title and a link to each of the results. NB! Pay attention that click event is added to a button in XAML. Also, notice the new InputScope feature of Windows Phone 7 is applied to TextBox making it easier for users to enter URLs into the Textbox element by providing a URL-specific virtual keyboard (SIP) layout by default. 5. Creating a class for a single RSS Feed item Now we simply need to create a new container-class for holding RSS Feed data. public class RSSFeedItem { public string Title { get; set; } public Uri URL { get; set; } } 6. Implementing event functionality Next, we need to write a code for processing the “Read” button click event. It should create a new URI object and pass it to the ReadRss method to begin reading an RSS Feed. private void btnReadFeed_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(tbRSSFeedURL.Text)) { ReadRss(new Uri(tbRSSFeedURL.Text, UriKind.Absolute)); } } 7. Implementing application logic First of all make sure that MainPage.xaml class (codebehind) is using the following references. using System.Xml.Linq; // for reading RSS using Linq-To-XML using System.IO; // for Stream object Next, you need to implement a ReadRss method that takes URI (URL) as an input parameter. If the request is successful then the application will process the results of reading an RSS feed (but only 10 first according to. Take(10) line in code) and add them using ForEach to a listbox. ListBox will display results according to the Data Binding specified above. public void ReadRss(Uri rssUri) { WebClient wclient = new WebClient(); wclient.OpenReadCompleted += (sender, e) => { if (e.Error != null) return; Stream str = e.Result; XDocument xdoc = XDocument.Load(str); // take 10 first results List rssFeedItems = (from item in xdoc.Descendants("item") select new RSSFeedItem() { Title = item.Element("title").Value, URL = new Uri(item.Element("link").Value, UriKind.Absolute), }).Take(10).ToList(); // close str.Close(); // add results to listbox listboxRSSFeedItems.Items.Clear(); rssFeedItems.ForEach(item => listboxRSSFeedItems.Items.Add(item)); }; wclient.OpenReadAsync(rssUri); } The Origins of Windows Phone 7 Windows Phone 7 is the first iteration of a mobile client operating system that Microsoft released for worldwide distribution in October 2010. Over the years, there have been various iterations of Microsoft’s mobile operating system, culminating in Windows 10 Mobile. However, the operating system and Microsoft mobile phones never really took off and, despite features like the RSS feed functionality described above, January 2020 saw the end of life with the final cumulative update issued officially by Microsoft. Windows 10 Build 15251.603 was rolled out to the Lumia 950 and HP Elite x3 without much fanfare and lacking a detailed changelog. Clearly, the company was cutting its losses and moving on. For those with the Windows Mobile 10 OS, the final update included some security fixes as well as a few general improvements. None of which was much to write home about. Indications are that the security bugs that were fixed are related to the Windows Kernel, Input, and Composition as well as a few additional components. For those who were unlucky enough to own the Windows Phone, Microsoft confirmed in 2020 that they would no longer support the phone. If it’s still working, you can still use the phone, but apps such as WhatsApp may no longer function. Device Backups But all was not lost as you could still backup your device. Your settings and data were safe until March 2020, at which time Microsoft abandoned their customers and scrapped the ability to access backups too. They back-pedaled a bit by informing everyone that the photo uploads and a few other features would still be available for a further 12 months and that it really was a good idea to make other arrangements to retrieve and store any valuable or sentimental data, voice, and image files. Support for Office Apps It's not unexpected that Microsoft didn’t treat Office Mobile apps for Windows 10 as an urgent priority. The support for Office apps ended in January 2021 with a trickle of security updates coming through during the course of 2021. Microsoft’s Advice - Switch to Android or iOS For those customers still looking for alternatives, Samsung and Apple were obvious alternatives. These Android and iOS-supported devices were on Microsoft’s list of mobile platforms to receive updated apps. The expectation is that the customers who were let down in the past were likely to continue to support the company that failed them in the past. Time will tell whether this is the case or not. For those users who are still interested in RSS feeds, there are various options in both the Google Play Store and the Apple store. Although RSS feeds have largely been replaced by followers joining mailing lists of their favorite brand or blogger, there are still a few diehard holdouts who are comfortable receiving an aggregated service via RSS feeds.
July 24, 2022
by Jevgeni Tšaikin
· 19,881 Views · 1 Like
article thumbnail
Dependencies: It’s Not Just Your Code You Need to Secure
Developers must not only check our code for vulnerabilities but also our dependencies to make our applications more secure.
Updated July 24, 2022
by Nando Delgado
· 5,552 Views · 4 Likes
article thumbnail
5-minute Observable.FromAsyncPattern sample for Windows Phone 7
If you are looking to create code that models the observable.fromAsyncPattern, you can get started with some basic key types. You’ll need to be able to develop your own implementations from IObserver or IObservable. Here you can develop the sequences you want with the data that you want. Learn the basic elements of observable sequences, how to get values into them, and how to select the values you want from them. We can look to Windows Phone 7 as an example. As we have already noted, the Windows 7 mobile platform is galaxies ahead of Windows 6.5 and the market reports and brand love indicate a strong concurrence with that. Not many developers know that Windows Phone 7 SDK comes pre-bundled with Reactive Extensions (Rx) that dramatically simplify work with asynchronous calls. Despite Windows mobile sales falling four percent last year, this is worth a look. In this article, I am going to focus particularly on Observable.FromAsyncPattern that allows developers to combine two Begin/End calls. For example, when working on reading streams. Developers can do this, by working into a single asynchronous call. If you are familiar with basic function composition, this won't be too hard of a topic to understand. What is the Observable.FromAsyncPattern? When you want to code Observable.FromAsyncPatterns it can be easy to feel overwhelmed. You’re putting the cart before the horse if you think this way. Like every coding project, you need to take this one at the one sequence at a time rate. Microsoft’s coder describes his passion for the development process of this Windows experience as evangelism. It’s difficult not to get excited about it, but you need to take it one concept at a time. You simply need to understand Rx coding and the basics of getting started. Observable sequences are the key here. It’s all about what values you are selecting. You can use LINQ as well in order to understand your Rx coding. It’s about going back to the basics of functional programming. Each group of query operators will have its own function. These will form dependencies of sorts wherein other operators can glean from them or be constructed from them. Deconstruct the code yourself and you will see how it works. The deconstruction should show you some insight into the intricacies of the Rx staircase so to speak, with some queries and functional programming built-in as well. Additionally, you should be able to create custom fields and operators that meet your software’s needs. To develop the sequence you are looking for, the Subscribe method as an Rx extension would be my first recommendation. Use the arrays of IObservables to determine what the Rx sequence would be, and the Rx libraries would indicate that as well. To develop the sequence you are looking for, the Subscribe method as an Rx extension would be my first recommendation. Use the arrays of IObservables to determine what the Rx sequence would be, and the Rx libraries would indicate that as well. The FromASyncPattern is a means of making calls. This coding will wrap one asynchronous call to either start or end an asynchronous method of making calls, actual phone calls. This is an effective tool for Windows Phone 7. A wide range of operators can take many different values and parameters here. Understanding the ToAsync pattern will help with developing the FromAsyncPattern knowledge base but it isn’t necessary. You can use the Rx coding to develop your observable and assign the numbers to your generic functions. The coding for BeginInvoke and EndInvoke are ideal initial parameters. Not lots of developers know that Windows Phone 7 SDK comes pre-bundled with Reactive Extensions (Rx) that dramatically simplify work with asynchronous calls. In this article, I am going to focus particularly on Observable.FromAsyncPattern that allows developers combine two Begin/End calls (for example, when working on reading streams) into a single asynchronous call, and if you are familiar with basic function composition, this won't be too hard of a topic to understand. How Rx Theory Works For now, rather than talk about the theory behind FromAsyncPattern, let's take a look at a specific example - handling a web request. The standard way of doing this would be initializing a HttpWebRequest and asynchronously getting the response via BeginGetResponse (also passing a callback that will handle it). HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://bing.com"); request.Method = "GET"; request.BeginGetResponse(new AsyncCallback(GetResponse), request); So the callback can handle the response the way you want: void GetResponse(IAsyncResult res) { HttpWebRequest request = (HttpWebRequest)res.AsyncState; HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(res); Debug.WriteLine(response.ContentType); } Rx allows you to go around the whole async call in one line. So to say: var n = Observable.FromAsyncPattern(request.BeginGetResponse, request.EndGetResponse)(); If you analyze n, you will see that its type is defined as IObservable. In its core, IObservable might be a new interface to some of the developers that are currently reading this. So let's dive into some theory now. Working With Specified Enumerations Usually, when you work with specific enumerations, there is IEnumerable/IEnumerator that can help you navigate through a generic collection of returned objects. GetEnumerator (caled out of IEnumerable) will get the associated IEnumerator, that will go through each object in the collection (via MoveNext) setting the Current value to the selected object. A pretty simple concept that shows how data can be pulled from a collection. IObservable on the other side is the complete opposite of IEnumerable because it reverses the process - instead of data being retrieved by the program via IEnumerator, it is now pushed back to it by the environment via IObserver, with which the application interacts (talking about the concept of interface duality here). When you need to obtain the data that is being pushed as a result of the call (in this case, in n), you need to use Subscribe and pass a handling method: n.Subscribe(HandleResult); What's done behind the scene here is that an observer is actually created that will be handling the pushed data. It might be a bit confusing as to why the returned type is IDisposable and the answer is simple - so that it will be possible to un-subscribe and dispose the observer once there is no more need to receive pushed data. And then again, you can handle the result as you want: void HandleResult(WebResponse res) { Debug.WriteLine(res.ContentType); } Of course, this entire operation can be unified in one line: Observable.FromAsyncPattern(request.BeginGetResponse, request.EndGetResponse)().Subscribe(HandleResult); Using the Windows Phone 7 Example One thing to remember here is that on Windows Phone 7, the maximum number of passed parameters is 2 (Func) - in a regular application this extends to 29 overloads and 14 possible parameters. Working directly with System.Linq.Observable is currently not possible on the phone and will fail to compile, the issue being "Error 427 'FromAsyncPattern' is not supported by the language". On the device itself, many asynchronous tasks can be simplified by using FromAsyncPattern, since you can combine various asynchronous functions - even the least common ones since there are some overloads present that allow you to pass additional parameters that will be passed to the asynchronous functions. One important consideration to remember is that there should be the starting and end methods (to start the async processing and to end it accordingly). Create Your Sequence Creating the observable sequence is the key here, and Windows Phone 7 has shown us it can be done. It’s an interesting concept and we know Windows brand passion is still there. You want to start with the sequence and then use it for consumption. When you do this, you have the wiggle room to use operators and develop the appropriate queries.
July 24, 2022
by Denzel D.
· 22,746 Views · 1 Like
article thumbnail
What Happened to HornetQ, the JMS That Shattered Records?
HornetQ 2.0 broke records and defeated top-ranked messaging services in benchmark tests. Why wasn't it widely adopted? Software vendors make all kinds of claims about their products, but what developers care about is proof. When testing a new product, it's important to see how it stacks up against its competition. For years, researchers at UT Darmstadt have compared the performance of message-oriented middleware servers based on Java Messaging Service (JMS). In 2010, the SPECjms2007 benchmark record was smashed by HornetQ, an open-source enterprise messaging system from JBoss. At the time, SPECjms2007 was the industry-standard benchmark for JMS systems. While the benchmark has since been retired, it provided a framework for detailed performance analysis as well as workload and performance metrics for the products being analyzed. The framework considered all components that were a part of the application environment, including hardware, JMS server software, JVM software, database software if used for message persistence, and the system network. It used horizontal and vertical topologies as scalability networks. During the test, HornetQ 2.0 was directly compared to Apache ActiveMQ 5.3, another JMS system that was known for its speed at the time. To ensure consistency, both messaging systems were tested on an IBM x3850 system utilizing identical OS setups. Not only did HornetQ completely decimate the records set by ActiveMQ, but it managed to smash all SPECjms2007 benchmarks at the time. While HornetQ 2.0 didn't have the reputation of ActiveMQ, it had proven that it was faster than every other message broker on the scene. In fact, HornetQ 2.0's scores were a staggering 307% higher than any previous results published by SPECjms2007. Shortly after the tests, DZone interviewed Tim Fox, who was HornetQ's project lead. During the interview, he discussed the main factors that contributed to HornetQ's impressive performance. HornetQ utilized Netty, a low‑level Java NIO library written by the author of Apache MINA. The JMS system also had a secret weapon, which Fox explained: "This system is a very high‑performance journal, which is basically written in 99‑percent Java. But we also have a small layer of native code that's accessed by JNI. And what this does is, when you're running on Linux, it detects that you're running on Linux, and then it automatically enables a bit of native code, which allows us to pass into Linux asynchronous file IO. And basically, what this does is it allows us to get much faster persistence than would be possible in pure Java." Netty Architecture After HornetQ's record-smashing benchmark test, the messaging system released several updates. Later that year, HornetQ released its 2.1.0 update, which refined the original release. It was followed up by several more updates added new features, like Vert.x integration, and strove to improve upon the original JMS system. Competition is a vital aspect of innovation, and when HornetQ broke records, it brought plenty of new competitors to the scene. These competitors included RabbitMQ, a messaging broker written in Erlang, and SonicMQ, a message queuing system that's now known as Aurea Messenger. In spite of HornetQ's incredible speed, however, it failed to surpass its biggest competitor. Near the end of 2014, the codebase for HornetQ was donated to the Apache ActiveMQ community. Today, it exists as an Active MQ subproject called Artemis. At one point in time, HornetQ was faster than any other available enterprise messaging system. It offered a full enterprise feature set that could easily stand side-by-side against ActiveMQ and even offered some features that ActiveMQ was lacking. Since HornetQ was not built around JMS, it was also protocoled agnostic, which was another major advantage People that used HornetQ had plenty of praise for its features. Its management API made it easy to work with, and its NIO optimizations were appealing to many users. HornetQ also had detailed documentation, making it easy for users to learn what they needed to know. It’s clear that HornetQ 2.0 had many advantages, so why did it fail to find a wide audience? It's possible that the JMS struggled because ActiveMQ was already widely adopted at the time of its release. ActiveMQ fell short of Hornet 2.0 in those benchmark tests, but it still had a high adoption rate and name recognition. Even though HornetQ got plenty of attention when it broke benchmark records, future updates didn’t receive the same level of coverage. Because of this, many potential users may not have been aware of the new features that HornetQ added. Many people were drawn to ActiveMQ because of its reputation as a stable messaging system. Users were unwilling to take risks on a lesser-known system like HornetQ and continued to stick with ActiveMQ, which had already proven that it was reliable. Some people were unwilling to trust sensitive data to a system that they didn’t know much about. Beyond that, open-source JMS providers are highly reliant on the surrounding community. With an active community of users, it's easier to troubleshoot issues and find solutions to problems. Since ActiveMQ had more community interest than HornetQ, it eventually fell behind its competitor. Today, ActiveMQ serves as a speedy communication bridge that allows for messaging between two or more applications, even if they're written in a different programming language. It's still known for its speed, but it's also known for its reliability. The ActiveMQ message broker allows for communication between system components even when one of the components is down. ActiveMQ was able to correct the issues that lead to its defeat in those benchmark tests, adding new features and improved functionality. It can be integrated with the Apache Camel Framework, making it possible to read and write messages between the two systems. New features have been added with every iteration of ActiveMQ, which have helped to improve its speed and its flexibility. These features include STOMP and UDP support, mirrored queues, and broker clustering. It's used by many major companies, including SquareTrade, Cox Communications, and ClearScale. Even though HornetQ is no longer updated, it lives on in ActiveMQ, the JMS it defeated in its record-breaking benchmark test. You can see its influence in other JMS providers as well, like ActiveMQ's main competitor, Kafka. HornetQ may not be in use today, but that doesn't mean it should be forgotten. Modern developers can still learn from the way HornetQ enhanced Java with just a few lines of native code. Artemis, the ActiveMQ subproject that’s specifically based on HornetQ’s code, is intended to be a next-generation ActiveMQ broker. It currently serves as a successor to the ActiveMQ classic. According to Apache’s Artemis roadmap, it could eventually serve as the next significant version of ActiveMQ. Currently, Artemis offers protocol support for Stomp, OpenWire, MQTT, and more. It offers features like replicated message store and message scheduling. In the future, Apache intends to add additional features to enhance Artemis, such as pluggable dispatch policies and configurable IO exception handling. Even though HornetQ is no longer updated, it lives on in ActiveMQ, the JMS it defeated in its record-breaking benchmark test. HornetQ may not be in use today, but that doesn’t mean it should be forgotten. Artemis may eventually become the next-generation messaging broker that many people hoped HornetQ would some be.
July 24, 2022
by Mitch Pronschinske
· 34,248 Views · 2 Likes
article thumbnail
Real email accounts inside the Windows Phone emulator
You can now get email accounts with the Windows Phone Emulator. With this Mail app, you can have all your email accounts in one place. You don’t have to access your emails to different websites or apps. While you couldn't do this easily in the past, you can use the Windows Phone Emulate to do this. Windows Phone Emulator is a tool that comes with various features for development. For instance, documentation, emulator images, tools for Visual Studio, and obtaining a sample code. What is Microsoft Emulator? Microsoft Emulator is a desktop application that emulates a Windows 10 Mobile device. You have to use Microsoft Emulator in conjunction with Visual Studio, it will be a virtually great environment where a developer can debug and test universal windows apps. It can also be an Android emulator that allows your mobile to imitate Android OS features on your PC. You can install Android Apps on your computer or laptop and use them natively. The Microsoft Emulator is a valuable tool for both developers and Android users. This tool helps you to test applications to use various Windows mobile devices. You may use it to test your projects, especially the mobile device management strategy. Here is an example of a code snippet: PhoneCallTask task = new PhoneCallTask(); task.PhoneNumber = "000000000"; task.DisplayName = "User K. User"; task.Show(); Deployment process There is a deployment process that you should use to install the emulator. Although you need to ensure the capacity of your computer can allow you to do that. Windows recommends that you ensure that your computer runs on the Windows 10 Anniversary Update. For example, you may need to run a 64-bit professional edition of Windows. To start the process, you need to access this Microsoft website and download the emulator. Typically, it will have EmulatorSetup.exe. Launching the Windows 10 Mobile Emulator The easiest way to launch the emulator is to select the Microsoft Windows 10 Mobile Emulator. Once you choose it, it will take you to the next screen. But there are several things that you need to pay attention to. First and foremost, you'll notice different emulator configurations. If you look closely at the screen capture above, you will notice that options near the bottom of the window reference newer version numbers than the options closer to the top of the window. Ultimately, you would need to access the hub to develop. You can activate the application successfully; it will send you to the background. However, you couldn't care less about the number and the name. All you need is to be able to access the People Hub. Once the task is activated, and my application is sent to the background, you're faced with a fake call: The next step is to add a person to a call, so I am clicking on Add Call and that's all I needed. Now I am able to click on the People button and navigate to the People Hub (otherwise locked in the OS): Now a swipe to the left, and you’re able to see the What's New panorama slide. Here is where it gets interesting. Even if the user is prompted with a message to add a Twitter or Facebook account, there is no way those can be added with the locked version of the emulator. Initially, there is the Google option (for GMail): Any Google account will do here, and once you enter the correct credentials, you will be able to access the connected inbox from the emulator. So the next question - where exactly is Yahoo, since I mentioned it? It is hidden a bit deeper than this, and it is invoked directly from a system application. To be specific - from the built-in email client. Since Gmail is already configured, open the client and expand the application bar: Click on Add Email Account, and there you will see that now Yahoo appeared in the list of available providers. The reason Yahoo only appears here is because it is not integrated with the People hub and is only available to manage email. You can set it up the same way as you set up the Google account, as long as you have the proper credentials. Congratulations! Now you have real email accounts set up and synced in the emulator! Now, whenever I am using the EmailComposeTask: EmailComposeTask task = new EmailComposeTask(); task.To = "[email protected]"; task.Subject = "Hello!"; task.Body = "Hello there!"; task.Show(); I will be prompted to select one of the existing accounts: My Thoughts on My Windows Phone and Windows 10 A few days ago Microsoft finally announced that some of the old(er) Windows phones would soon get the new shiny OS. That left a few Windows phone owners a little disappointed. I remember that only a few months ago it was clear that all (or, at least, most) windows phone devices would be updated to Windows 10 and now it seems that they would, in fact, keep running windows 8.1. As the proud owner of one Lumia 925 – I feel a little cheated, but not surprised. I have used the insider builds of the latest and greatest for a few weeks, and while I enjoyed using the new OS it was not “production-ready” just yet. I remember that only a few months ago it was clear that all (or, at least, most) windows phone devices would be updated to Windows 10 and now it seems that they would, in fact, keep running windows 8.1. As the proud owner of one Lumia 925 – I feel a little cheated, but not surprised. I have used the insider builds of the latest and greatest for a few weeks, and while I enjoyed using the new OS it was not “production-ready” just yet. What Is a Simulator? A simulator is a piece of software that allows your computer to execute programs designed for a different operating system. Unlike Android devices, which can be easily imitated, they are primarily developed for iPhone and iPad devices. By sitting on top of the computer's operating system, iOS simulators imitate iOS and execute the relevant application within it. However, to use the iOS simulator, you must use Mac OS X because it requires Apple's native Cocoa API. This Cocoa API is required for the GUI, runtime, and various other tasks. Because of this posture, developers must either work on the MacBook or virtualize macOS on their existing systems. Simulators, in contrast to emulators, do not imitate hardware. As a result, while utilizing simulators for testing, certain capabilities such as cellular interrupts, battery utilization, and so on are not possible to study. When to Use Emulators On the other hand, emulators are extremely valuable for testing how software interacts with underlying hardware or a combination of hardware and software. Do you want to discover if a firmware update will cause issues with your software? An emulator can assist you in figuring this out. Alternatively, you could want to know how your program performs when run on multiple CPUs or with varying memory allocations. Emulators can also be useful in certain situations. When to Use Simulators Simulators are most commonly used in software testing scenarios when you want to make sure that an application works as intended when interacting with other apps or environments. You might wish to check whether an app can communicate data to other apps. A simulated environment will usually suffice because the underlying hardware configuration is unlikely to impact your application's data transfers significantly. Simulated testing environments are also useful to ensure that your application's interface shows correctly at various screen resolutions. Conclusion A simulator makes it quick and easy to build up a software environment for application testing without using real hardware. Emulators go one step farther by simulating both software and hardware combinations. When you need to test code quickly across a wide range of variants, both testing platforms are useful. However, neither is a complete replacement for real-device testing, which you should perform at essential periods, such as right before releasing software into production.
July 24, 2022
by Denzel D.
· 18,822 Views · 1 Like
article thumbnail
From Relational to Really Relational: The RDB2RDF Working Group
While a lot of databases have been created listing information in a table format, the web isn't set up in a tabular style. Neither is plenty of data in a variety of formats that the web uses. However, many databases are still using tables, because many web developers feel that tables handle plenty of data better than any other structure. Others feel that the data tables known as RDB should be converted to RDF, a format used to gather an even wider array of metadata across the worldwide web. The ability to convert to RDF will be extremely beneficial as technology advances to Artificial Intelligence AI and beyond. What is an RDB? RDB stands for a Relational Database. An RDB is a collective set of multiple data sets organized by tables, columns, or records. An RDB establishes a well-defined relationship between database tables. The tables communicate to share information that makes it possible to search for data, organize, and report. RDB is derived from the mathematical function concept of mapping data sets as developed by Edgar R. Codd. RDBs use Structured Query Language, SQL.SQL is a standard user application that provides an easy programming interface for database interaction. RDBs organize data with each table known as a relation which contains columns. Each table row, or record, contains a unique data instance defined for a corresponding column category. The data and record characteristics relate to at least one record to form functional dependencies. RDB performs "select", "project" and "join" database operations, where select is used for data retrieval, identifying data attributes, and combining relations. Those who prefer to use RDBs do so because of the advantages, including easy extensibility or scalability, new technology performance, and data security. What is RDF? RDF is primarily used to provide information or metadata for data available on the Internet. RDF provides the methodology for specifying, structuring, and transferring metadata, and provides the basic XML syntax for software applications to exchange or use that information. The URI/URL provides the location of that data. RDF stands for Resource Description Framework and is a standard for describing web resources and data interchange, developed and standardized by the World Wide Web Consortium, W3C with Xtensible Markup Language (XML) and Uniform Resource Identifier (URI) serving as its distribution standards. Typically, RDF provides basic information and attributes about an Internet-based object, such as the name of the author, Web page keywords, object creation or editing data, or the sitemap. While there are many conventional tools for dealing with data and more specifically for dealing with the relationships between data, RDF is the easiest, most expressive, and most powerful standard to date. The overall informational value is much greater because context or intent can be inferred. RDF presents small chunks of information in a form that infers meaning. This can include rules about how the data should be interpreted. Resource Description Framework, RDF, is the standard for encoding metadata and other structured information on the Semantic Web. Semanticization Data With all the semantic standards and database-centered HTML5 APIs and a W3C standard that calls for implementations, this is an exciting time for data on the web. It's time to embrace RDF with the capacity to start pulling relational data into the semantic web! The Purpose of RDBMS The software used to store, manage, query, and retrieve data stored in a relational database is called a Relational Database Management System, or RDBMS. The RDBMS provides an interface between users and applications with the database. It also provides administrative functions for managing data storage, performance, and access. Semanticization, or giving meaning to, all data can be done in two stages. First, construct a web of meanings, not documents -- as Sir Tim Berners-Lee has always wanted, and as the RDF, Resource Description Framework seeks to do. Second, fit all tabular data into the web whether legitimately or not. This second step is less exciting than the first because plenty of tabular data is not ideally tabular. In these cases, the second step is rather backward-looking. However, it is no less necessary than the first for two reasons: Converting everything RDBMS to RDF is not even close to worth it Much data ought not to be converted to RDF All of this data still needs to talk to the web, which means it needs to be translated into a webby structure, ideally RDF. The easiest way to translate without conversion is, of course, just plain mapping. But mapping two rather different structures to one another is no small undertaking or trivial task. That's why there's a whole W3C Working Group devoted to devising a mapping language and actual mapping of relational data to RDF. Sir Tim offers this insight into the RDF-RDBMS relation, cutting through questions that might otherwise be couched in domain-inappropriate terms (like 'is the RDF model an entity-relationship model'): Relational database systems manage RDF data, but in a specialized way. In a table, there are many records with the same set of properties. An individual cell (which corresponds to an RDF property) is not often thought of on its own. SQL queries can join tables and extract data from tables, and the result is generally a table. So, the practical use for which RDB software is used is typically optimized for doing operations with a small number of tables, some of which may have a large number of elements. Because relational databases are species of the genus described by RDF, the basic mapping model is as follows: a record is an RDF node; the field (column) name is RDF propertyType; and the record field (table cell) is a value. So far, so straightforward. Of course, the implementations usually wander pretty far from the original concept. That's why mapping actual RDBMS to RDF takes a bit of dirty work. RDB2RDF Enter RDB2RDF. The RDB2RDF WG is doing the dirty work. Back in 2005, when the Group was still an Incubator, they published a detailed survey of then-current approaches to mapping relational databases to RDF. This survey served as the starting point for typically extensive discussion and debate, which culminated in two Candidate Recommendations: The RDB to RDF mapping language: R2RML The Relational-to-RDF mapping itself Many techniques and tools have been proposed to enable the publication of relational data on the web in RDF. RDB-to-RDF methods are one of the keys to populating the web of data by unlocking the huge amount of data stored in relational databases. Since producing RDF data with sufficiently rich semantics is often important in order to make the data usable, interoperable and linkable, there are various strategies developed to enrich data semantics. Turning RDB to RDF has proven to be of value when dealing with SQL databases. It offers a straightforward and practical system for relational database conversion into RDF. RDB2RDF and the Future Moving forward beyond RDB-to-RDF methods, it will become necessary to find a compromise between the expressiveness of RDB to RDF mapping languages and the need for updating relational data using protocols of the semantic web. Creating, updating, and deleting RDF data should only be made possible in a secure, reliable, trustworthy, and scalable way.
July 24, 2022
by John Esposito
· 10,427 Views · 1 Like
article thumbnail
W3C News Roundup: Annotations and Disability Access
Some of the major announcements from the W3C over the past week on making the web more accessible and powerful as a publishing platform.
Updated July 24, 2022
by Matt Werner
· 3,590 Views · 2 Likes
article thumbnail
GitHub Announces Beta Testing of New Sponsorship Tool
Now you have even more ways to financially support your favorite open-source projects.
Updated July 24, 2022
by Sarah Sinning
· 4,862 Views · 5 Likes
article thumbnail
Using application settings in Windows Phone 7 apps
There are many settings that you can change within your smartphone to make it work better for you.
July 24, 2022
by Denzel D.
· 34,465 Views · 1 Like
article thumbnail
YAML and Its Usage in Kubernetes
If you've used Kubernetes before, chances are you have come into contact with YAML files. Find out more about what they do here.
Updated July 24, 2022
by Raghavendra Deshpande
· 6,141 Views · 3 Likes
article thumbnail
Kotlin Was Predicted to Overtake Java by December 2018. What Happened?
In 2018, the Realm Report predicted that Kotlin, a cross-platform programming language, would overtake Java by the end of the year. Was the forecast accurate?
Updated July 24, 2022
by Tom Smith DZone Core CORE
· 8,389 Views · 2 Likes
article thumbnail
How to run multiple instances of the Windows Phone 7 emulator
It’s not that difficult to run multiple instances of a Windows Phone 7 emulator, or any other mobile emulator for that matter, when you’re doing testing, development, or having some DIY fun! You can run multiple instances of the Windows Phone 7 emulator by generating unique GUIDs for each instance that you need to run. You’ll also need to pass a VMID in order to get these multiple instances working. You can also run multiple instances of later versions of Windows phones like Windows Mobile 10. Ever since there were just rumors that Microsoft was going to make its own phone, we’ve wanted to run multiple instances of the Windows Phone emulator. For example, to test different command-line options in separate instances. By default, you cannot customize this behavior in Visual Studio 2010, that by now is the standard way to access the emulator. However, there is still an option provided by Microsoft that is not mentioned too often. The first thing you want to do is to be familiar with basic command line operations like how to launch applications from the command line and how to send specific parameters when executing an application—or script, for that matter. If you are familiar with these concepts, then you are good to go. If not, you should brush up on your command line basics. You’re also going to want to know how to configure emulators for Windows phones and Windows Mobile. The last thing you need to know is where the emulator and the default development WP7 OS image are located. On my system, I can find them in the following folders. WP7 OS Image: C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Emulation\Images WP7 Emulator: C:\Program Files (x86)\Microsoft XDE\1.0 If you try running XDE.exe from the emulator folder right away, you will be prompted with this message: Not exactly what we're looking for, but nonetheless it is helpful. So the emulator by itself won't start - I need to specify an OS image to be loaded. And here is when the console comes into play. Open the system console by pressing the Win+R keys and then typing CMD and clicking OK. Once the console is open, first of all copy and paste the path to the emulator, and then after a space, copy and paste the path to the OS image. The complete path string should look like this: "C:\Program Files (x86)\Microsoft XDE\1.0\XDE.exe" "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Emulation\Images\WM70C1.en-US.bin" And once you run it... nothing happens. Besides the actual image, you need to pass a VMID - a GUID identificator that will be uniqued to the specified instance. NOTE: You can generate GUIDs quickly here. The VMID parameter is required to be unique for every given running instance. Otherwise, you will be getting an error message like this: Here is how you should pass the VMID to the emulator: "C:\Program Files (x86)\Microsoft XDE\1.0\XDE.exe" "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Emulation\Images\WM70C1.en-US.bin" /VMID {3e7d1f17-dbf6-4e74-b1ef-20206c5fe7b9} Curly braces are required. Once you run this command, the emulator should do a full OS boot (no, the main applications will still be locked) and will get in the "Ready" mode in around 30 seconds. As long as you change the GUID, you can run as many instances as your machine allows you to. What is the Future of Windows Mobile? There are currently more questions about the end of Windows Mobile than there are answers. Microsoft has recently announced that Windows mobile 10 will be the last version of the software to receive any official support. This means that we're going to start to see applications no longer receiving updates, bugs going on fixed, and the continuing depreciation of the Windows mobile 10 software. We've already begun to see the beginning of the end for Windows mobile. The Xbox app on Windows mobile 10 no longer fully updates with the latest achievements and is already starting to show signs that it needs an upgrade. Windows mobile never had a strong position in the Apple and Android-dominated mobile market oh, so it was only a matter of time before Windows decided to close the door on this project. Is Windows 7 Still Supported? What About Windows 10? Windows 7 has been out for nearly a decade which means that there are few devices running this version of the Windows mobile software. Most modern Windows mobile devices are running the latest Windows mobile 10. Windows Mobile 10 is still officially supported, but Windows has announced that they will not be continuing development for the software. How Long do Windows Phones Have Left? Is very difficult to say how long Windows phones have left. Well, there is some speculation that the summer of 2022 is going to be something of the official end of Windows mobile, support for this platform really depends on how long developers want to stick with it. There would be nothing stopping developers from continuing making and updating their software for Windows mobile devices, but this does raise some important questions for developers looking to work in the space. What Does This Mean for Developing for Windows Mobile? Whether you're developing Java applications or you're looking to learn more about Windows mobile, you're in for an uphill battle when it comes to Windows 10 for phones. Developers are going to be hard-pressed to continue updating the software that they have on Windows mobile devices. This largely comes down to the fact that Windows has officially abandoned this project. This means that they won't be able to receive sufficient support for resolutions for core bugs within the mobile OS that could be creating problems for their own applications. At the end of the day, we can probably expect mobile application developers to continue releasing updates in the near future. However, we're going to increasingly see these developers shifting their focus to Apple and Android as Windows devices become less and less popular.
July 24, 2022
by Denzel D.
· 17,448 Views · 1 Like
article thumbnail
Replace your Scripts with Gradle Tasks
I really like Maven, and I really like the declarative build style, but recently I finally came to understand why Gradle is better.
July 24, 2022
by Pavel Bernshtam
· 37,411 Views · 6 Likes
article thumbnail
Java 6 On Mac—Worst Release Ever (And What’s New!)
When Apple finally released Java 6 for Mac OS 10.5.2, the Java community was more than a little upset. Java 6 only supports 64 Bit on Mac No Cocoa Support What to Do About Java 6 on Mac Using Java on Mac in 2022 What’s Changed Since Java 6 Where is Java on Mac Headed? The history of Java releases on Mac has been more than a little problematic. New updates for Java always find their way to Mac a few years too late and they are often more limited than their Linux and Windows counterparts. Let’s see how Java 6 on Mac stacked up and take a look at the latest Java release for mac and see how it compares. Java 6 on Mac Only Supports 64 Bit This means that Java 6 doesn't run on 1-year-old MacBooks or all early adopters of the Intel switch. A huge amount of people can't run 64-bit. Java 6 on Mac requires much more specific technology than Java 6 did on any of its counterparts. We tend to have a lot of opinions about how to code differently with Java, but we can all agree that Java 6 didn’t really work for Mac. Another problem is that it only supports 64-bit applications, Bye-bye applets in Safari. These are huge setbacks for people who were looking forward to Java on Mac, but the problems didn’t stop here. No Cocoa Support Because of the lack of 64-bit libraries for cocoa, it is not possible to use cocoa with Java 6. Nearly every Java application on Macs uses cocoa to make it look better on Mac OS. Some even are 100% cocoa, like Cyberduck. Because of that, only a small percentage of Java applications can run on Java 6. Java 6 really needed more Mac-specific support in order to function like it did on Windows or Linux. In fact, you have a better chance of performance tuning Java on Linux than you did on a Mac. Apple Knows This Apple is well aware of these problems. The update doesn't make Java 6 the default VM. Apple's preferences dialog even warns you if you want to make it the default VM. Having Apple and Java clash like this only made things more difficult for people working with Java on a Mac. So, What To Do Now? Options were limited for working with Java 6 on Mac. What made Java 6 on Mac even worse was the lack of any good workarounds or alternatives. You either had to commit to a limited system or try something a little involved. These are your options. We only have three choices from here: Switch back to Windows / Linux for Java development Use SoyLatte and help them to create the native GUI pipeline Ask Apple to fix these issues In the long term, no. 2 would be the best. A Java implementation by a large community would have faster release times. We can't wait for Apple to fix these issues—we have to do it ourselves. Getting Java 6 to turn on Mac requires some pretty advanced Java tutorials. Now, let’s take a look at what’s changed since Java 6. Using Java on Mac in 2022 In terms of running Java on Mac, so much has changed since Java 6. In fact, it would be just a few years until the release of Java 7 things completely changed for working with Java and working on an Apple computer. We're going to take a look at some of these specific changes and just see how the landscape of using Java on a Mac has changed from Java 6 all the way to Java 17. Using Java has only gotten more developed as the years have gone by. After all, becoming a Java developer starts with getting Java running on your Mac! What’s Changed Since Java 6 on Mac If you were trying to use Java on Mac since Java 6, you were up against a lot of trouble. You'd have to either settle for a Java that didn't perform nearly as well as it did online up to your PC or go through a bunch of complicated workarounds and still be stuck without all the features. What's important to keep in mind is that Java is more important today than it's ever been. While you might hear some people saying that Java is on the way out, Java still has plenty of use and pops up everything from popular applications, to websites, and it is a highly preferred language for programmers the world over. Java Becomes Mac Native All the DIY fixes in the world couldn't get us ahead for making Java work on Mac. However, things would have quickly changed with the release of Java 7. Starting with Java 7, Java releases work with Apple technology as long as the systems are compatible. You can run compatible editions of Java with your Mac laptop or computer. It all depends on whether or not the specs of your Mac match up with the edition of Java you want to run. Here’s where to start to find some familiar limitations for using Java on a Mac. There are Still Limitations (Java, Intel, and Mac) Even though Java runs on Mac after Java 7, there are still some problems with trying to get Java to run on Apple's technology. If you’re looking for the best toolkits, tips, and tricks for Java, you’re going to need to get it running first! Despite all the advances that are made, you're still going to encounter a few problems with trying to get Java to run on a Mac. The first thing that we have to talk about is that Java is designed to work with the Intel processor versions of Mac. Now that Mac is coming out with their own processor chips, we're seeing compatibility issues with Java and plenty of other technology that people rely on. Apple's desire to keep everything proprietary and stay in a closed sandbox is definitely costing them when it comes to reliably working with some of today's most popular technology. There are also issues when it comes to which Mac operating system you're using. There's a good chance that your Java version might not be compatible with the Mac computer that you're working with depending on the operating system that that Mac runs. Where Things Are Headed for Java on Mac There is good news for the future though. As Apple’s processor technology becomes more popular, more software is going to become compatible. Java is likely to follow suit with Adobe and plenty of others working to find ways to work with Mac’s M1 processors.
July 24, 2022
by Bodo Tasche
· 33,970 Views · 1 Like
article thumbnail
Execute a HTTP POST Using PHP CURL
A customer recently brought to me a unique challenge. My customer wants information request form data to be collected in a database.
July 24, 2022
by David Walsh
· 108,216 Views · 2 Likes
article thumbnail
JPA 2.0: Why AccessType is Relevant
Introduction If you are using the Java Persistence API (JPA) 2.0, you may be wondering what the AccessType setting is for and how it can be used. This article will explain what the AccessType setting does and how it can be used to improve your JPA experience. The Java Persistence API program is a standard interface for accessing databases in Java applications. JPA 2.0, the latest version of JPA, introduces a new annotation called AccessType that allows you to specify how you want your entities to be accessed by the JPA provider. In this article, we'll take a look at why AccessType is relevant and how you can use it in your JPA applications. A Quick Look at Application It has long been debated whether field access is superior to property access for JPA entities. Most arguments that I've seen hinge on performance versus encapsulation. While these arguments may be interesting from a theoretical perspective, control over field access is in fact very useful in solving real-world problems. Field access allows code to distinguish between the JPA provider setting properties while loading an entity versus application code setting a property. This was very useful for a project that I'm involved with that has de-normalized data or other fields that are computed and persisted. Here's how it works: In the setter for various properties that affect the computation of a de-normalized property, the value of the de-normalized property is set to null. @AccessType(FIELD) is used for these properties. In the getter for the de-normalized property, if the value is null the de-normalized value is recomputed. In a @PrePersist method, the getter is called to ensure that the de-normalized value is properly persisted. Using this technique, maintaining de-normalized data becomes simple and robust. While this feature has been available within Hibernate since 3.0, I'm glad to see that JPA 2.0 (JSR 317) introduces a standard annotation to control this behavior. What is JPA 2.0? The Java Persistence API (JPA) is a specification for object-relational mapping in Java. It defines the way data is mapped to objects and vice versa. JPA 2.0 was released as part of Java EE 6 in 2009. JPA 2.0 was released in order to standardize the way that data is mapped to objects and vice versa. Additionally, JPA 2.0 introduced a new annotation called AccessType that allows you to specify how you want your entities to be accessed by the JPA provider. JPA 2.0 improves user experience by providing a standard annotation that allows developers to control how their entities are accessed. This annotation, AccessType, gives developers more flexibility and control over how their entities are accessed by the JPA provider. Additionally, JPA 2.0 standardizes the way that data is mapped to objects and vice versa, which improves the overall user experience. What are the key features of JPA 2.0? One of the key features of JPA 2.0 is the support for the AccessType annotation. This annotation can be used to specify how data is accessed and mapped to objects. There are two access types: - Field-level access: The data is accessed and mapped directly to fields in the object. - Property level access: The data is accessed and mapped indirectly through getter and setter methods. What is AccessType? The AccessType annotation specifies the access type for an entity. The access type can be either FIELD or PROPERTY. If you don't specify an access type, the default is FIELD. AccessType has the following attributes: - Value: This specifies the access type. It can be either FIELD or PROPERTY. - AccessType.FIELD: The data is accessed and mapped directly to fields in the object. - AccessType.PROPERTY: The data is accessed and mapped indirectly through getter and setter methods. The AccessType setting determines whether fields or properties of an entity are persisted. By default, all fields and properties of an entity are persisted. However, you can use the AccessType setting to specify which fields or properties should be persisted and which should not. This can be useful if you want to avoid persisting certain fields or properties that are not relevant to your application. What is the relevance of AccessType in JPA 2.0? The AccessType annotation is relevant in JPA 2.0 because it can be used to improve overall performance. By specifying the access type, the JPA provider can optimize how data is accessed and mapped to objects. In addition, the AccessType annotation can be used to reduce the amount of code that needs to be written. There are several reasons why AccessType is relevant in JPA 2.0: - It can be used to improve performance. - It can be used to reduce the amount of code that needs to be written. - It can be used to improve the maintainability of code. - It can be used to improve the readability of code. How to Use AccessType? To use the AccessType annotation, you first need to specify the access type for your entity. You can do this by using the @AccessType annotation on your entity class. For example, if you want to use property level access, you would specify the following: @AccessType(AccessType.PROPERTY) public class MyEntity {//...} Alternatively, you can specify the access type for an entity using the XML descriptor. For example, if you want to use field level access, you would specify the following in your persistence.xml file: MyEntity FIELD The AccessType annotation is used to specify the access type for an entity. The possible values for the AccessType enum are ACCESS, which represents class level access, and FIELD, which represents field level access. You can also use the XML descriptor to specify the access type. Class level access is the default access type, and it is used when no access type is specified. With class-level access, all persistent fields and properties of an entity are mapped to the database, regardless of whether they are annotated with the Column annotation. The only exception to this rule is when a field or property is annotated with the Transient annotation, in which case it is not mapped to the database. Field-level access is used when you want to specifically annotate which fields or properties of an entity are mapped to the database. With field-level access, only the fields or properties that are annotated with the Column annotation are mapped to the database. The other fields and properties of the entity are not mapped, and they will not be persisted in the database. Conclusion Overall, the AccessType annotation is a very useful addition to JPA 2.0. It can be used to improve performance, reduce the amount of code that needs to be written, and improve the maintainability and readability of code. If you're using JPA 2.0 in your applications, I encourage you to make use of this annotation. What do you think? Have you used the AccessType annotation in your JPA 2.0 applications? Share your thoughts and experiences in the comments below.
July 24, 2022
by David Green
· 33,993 Views · 2 Likes
article thumbnail
Escape Analysis in Java 6 Update 14 - Some Informal Benchmarks
Sun released update 14 of the Java 6 JDK and JRE. As well as the usual collection of bug fixes, this release includes some experimental new features designed to improve the performance of the JVM (see the release notes). One of these is Escape Analysis. What Is Escape Analysis? Escape analysis is a compiler optimization technique that analyzes an object's access path to determine whether or not it is escaped from its current scope. If an object is not escaped, then the compiler can allocate it on the stack rather than on the heap. This eliminates the need for memory allocation and garbage collection for the object, which can improve performance. Allocating on Heap Vs the Stack To understand the implications of allocating an object on the stack or heap, it is first necessary to understand how these two data structures work. The heap is a pool of memory that is managed by the JVM. When an object is created, it is allocated a space on the heap. The size of this space depends on the object's type and the fields it contains. The stack is a data structure that is used to store local variables and function call information. When a function is called, its parameters and local variables are stored on the stack. When the function returns, these variables are popped off the stack. Allocating an object on the heap requires two operations: The object is allocated a space on the heap. The object's reference (a pointer to its location on the heap) is stored on the stack. Allocating an object on the stack requires only one operation: The object is allocated a space on the stack. Because allocating an object on the heap requires an extra operation, it is generally slower than allocating on the stack. In addition, heap allocation requires the JVM to manage the memory used by the object. This includes finding a free block of memory of the appropriate size and dealing with fragmentation. Stack allocation does not require any memory management, as the stack is managed by the operating system. What Is a Compiler? A compiler is a program that converts code written in one language (usually called the source language) into another language (usually called the target language). The target language can be either machine code or another high-level programming language. In Java 6 Update 14, escape analysis was turned off by default but could be enabled by passing the -XX:+DoEscapeAnalysis flag to the java command. However, now Escape analysis is supported and enabled by default in Java SE 6u23 and later. What Is An Object? In Java, an object is a self-contained unit of functionality that can be created and used independently. A typical object consists of both data and behavior. Data is represented by fields (also called member variables or instance variables), and behavior is represented by methods. You can think of an object as a "thing" that can perform certain actions and contains certain information. For example, a car is an object that can be driven (behavior) and has a color (data). Why Is Escape Analysis Important Today? Escape analysis is important because it can improve performance by eliminating the need for memory allocation and garbage collection for certain objects. When we say "garbage collection", that refers to the process of reclaiming memory that is no longer being used by the program. In general, garbage collection can be a CPU-intensive operation, so eliminating it can improve performance. Any time you can avoid allocating memory and/or doing garbage collection, your program will run faster. What Are Some Examples of Objects That Can Benefit from Escape Analysis? Small objects that are created and used within a single method can often benefit from escape analysis. For example, consider the following code: public static void main(String[] args) { String s = "Hello, world!"; System.out.println(s); } In this code, the String object created on line 3 is not escaped. It is created within the main method and is used only within that method. As a result, the String object can be allocated on the stack rather than on the heap. This eliminates the need for memory allocation and garbage collection for that object. How Does Escape Analysis Work? To determine whether or not an object is escaped, the compiler uses a flow-sensitive, interprocedural analysis. This means that the compiler not only analyzes the code within a single method but also looks at how the object is used in other methods that are called from the current method. If an object is only used within the scope of a single method and is never passed as an argument to another method, then it is not escaped. For example, consider the following code: public class MyClass { public static void main(String[] args) { MyClass obj = new MyClass(); obj.method1(); } public void method1() { int x = 5; method2(x); } public void method2(int y) { int z = y * 2; } } In this code, the MyClass object is created in the main method and passed as an argument to the method1 method. The method1 method then creates a local variable x and passes it as an argument to the method2 method. The MyClass object is therefore escaped because it is used in another method (method2) that is called from the current method (method1). In contrast, the local variable x is not escaped, because it is only used within the scope of the method1 method. When Should I Use Escape Analysis? Escape analysis can be used to improve the performance of any Java application. It helps to reduce the memory footprint. It is most effective when objects are short-lived and are only used within a single method. To see what kind of impact escape analysis might have on my applications, I decided to try it on a couple of my more CPU-intensive Java programs. Escape analysis is turned off by default since it is still experimental. It is enabled using the following command-line option: -XX:+DoEscapeAnalysis Benchmark 1 The first program I tested is a statistical simulation. Basically, it generates millions of random numbers (using Uncommons Maths naturally) and does a few calculations. VM Switches: -server 95 seconds VM Switches: -server -XX:+DoEscapeAnalysis 73 seconds Performance improvement using Escape Analysis: 23% Benchmark 2 The second program I tested is an implementation of non-negative matrix factorisation. VM Switches: -server 22.6 seconds VM Switches: -server -XX:+DoEscapeAnalysis 20.8 seconds Performance improvement using Escape Analysis: 8% In both cases, escape analysis gave a noticeable performance improvement. I was quite surprised by how much of an improvement I saw in the first benchmark. I wasn't expecting to see anything like that. Escape analysis is an important tool in the JVM performance tuner's armory and it's good to see that it is being improved and refined in each new release of the JDK. Are There Other Ways To Reduce Memory Footprint in Java? Yes, there are other ways to reduce the memory footprint in Java. One way is to use object pooling. Object pooling is a technique for reusing objects that have already been created. Another way is to use a generational garbage collector. A generational garbage collector is designed to collect short-lived objects more efficiently than long-lived objects. Finally, you can use a compacting garbage collector. A compacting garbage collector moves objects around in memory so that there are fewer gaps between objects. This can help to reduce memory fragmentation. Conclusions These benchmarks are neither representative nor comprehensive. Nevertheless, for certain types of programs, the addition of escape analysis appears to be another significant step forward in JVM performance. In conclusion, although escape analysis is still experimental, it is definitely worth experimenting with in your own applications. If you are interested in learning more about escape analysis, I highly recommend reading about it further on Dzone.
July 24, 2022
by Dan Dyer
· 33,029 Views · 1 Like
article thumbnail
Optimize Your Links For Print Using CSS: Show The URL
When moving around from page to page in your trusty browser, you get the benefit of hovering over links and viewing the link's target URL in the status bar. When it comes to page printouts, however, this obviously isn't an option. Most website printouts simply show the link as text with an underline. What good is that? Links Should be Printable One of the key elements that many people forget about when they are creating a web page of any kind is the fact that they should be making the links that are inserted printable. You see, there are many people who will want to check out the information and research that you are providing them via the links inserted into your page. Unfortunately, they may not be able to look at those links as completely as they might want to if you are not making it easy and possible for them to print off the links. Making links printable is a matter of getting into the CSS code and looking to make sure that any URLs that you have inserted are truly printable for your audience. It is fully expected that you will take the time to do this for the people who have bothered to show up and read your materials. Truthfully, you owe them a sign of your appreciation for having come to see what you are creating in the first place. Internet Explorer Often Ignores the Code One thing to keep in mind when you begin to mess around with the CSS codes for your URLs is that it is entirely possible that Internet Explorer will ignore the codes that you put in there if you don't get them just right. Internet Explorer is set up in such a way that it will ignore certain lines of code and other materials that people insert into their websites if Internet Explorer feels that the code is not relevant. This is why you must be on top of everything to make sure Internet Explorer does force your code out when you know for a fact that the code that you are using is incredibly important to the usefulness of your website. To provide extra help to your content viewers, you may want to include a snippet of information that lets them know that Internet Explorer may cause some problems when they are trying to print off links in the article. A quick line or two that encourages them to use a different Internet portal such as Firefox or Google Chrome may prove beneficial to all of your readers. They need access to your information, but they may struggle to get it if they are only using Internet Explorer. Sadly, they may not even realize that this is a problem unless you point it out by making it clear that they need to switch browsers in order to print off the information that they require. Take some time to throw in a quick line about why users need to shift over to using a browser other than Internet Explorer to get the information that they require. If you do this, then they will be able to finally get the information you are providing without getting jammed up simply because of the browser they are using. One simple line and you can help fix so many of the problems that they are facing. Providing URLs for links in the print version of your page can be extremely helpful to the reader. Using a small snippet of CSS code, you can get printouts to display link URLs right next to the link text. The CSS Code a:link:after, a:visited:after { content:" [" attr(href) "] "; } The pitfall of this method of displaying links URLs for print is that Internet Explorer ignores this code. If showing link URLs is critical, I'd recommend using a javascript alternative. If not, add this snippet to your print stylesheet to make your page print-outs more informative. Click here for an example! JavaScript Alternatives Can Help There are situations in which JavaScript alternatives can help you get around the auto-blockers that Internet Explorer has put up on some of these codes. You may need to work around the traditional system in order to get the results that you need, but you should have a lot of success getting the code to look just the way you need it to if you use some alternative programs to achieve your results. Sometimes, you just have to think outside of the box like this to get around the barriers that sadly exist within the computing space. We can all hope for a day when there aren't so many layers of protectionism between ourselves and the things that we want to put up on the Internet. If we can just use some of the tools at our disposal as far as JavaScript alternatives and the like are concerned, then we may be able to make some progress in the right direction. It is a challenge to be sure, but there are a lot of ways that we might be able to build a better Internet and a better world in general. Does Printing Still Matter for Links? There are different schools of thought about how important the ability to print something off still is to people, but most land on the assumption that it is better to have printing abilities than to not have them. People sometimes want to print something off so they can view it on their own time and even hand the printed copy off to someone else that they know that they believe might benefit from it as well. Why would you want to deny them the ability to do this? The CSS code that is used on your links will be extremely important to the final ability of someone else to use it to print off what they see on the screen. This is why you should be extra careful to make sure the code is written just right. There are situations in which your viewers may delight in the information that you provide them, but they may not have Internet access everywhere that they go. If they need to pull up your information without access to the Internet, then it is necessary for them to print off the files that they need from you. Thus, you might want to spend some time getting your links into a form that allows them to be printable. Not everyone who visits your website will care about printing something off, but the people that do care about it will notice the steps you took to make this possible for them, and they will surely appreciate what you have done for them.
Updated July 24, 2022
by David Walsh
· 24,383 Views · 1 Like
article thumbnail
Calling JavaFX From Java?
Putting Together the Best of Both Worlds One of the things that people like so much about JavaFx is the fact that it has a suite of powerful tools used by designers and creators to get exactly the kind of look and feel that they desire from their creations. When used properly, JavaFX will change the way that you take care of your biggest technology challenges. That is why it is such a powerful product to use, and that is also why people around the world recommend it for the value that it can add to your work. A few of the features that are included are: WebView Java APIs High-Performance Media Engine Multitouch Support Canvas API These are just a few of the things that JavaFx has going for it. Truly, it is a powerful engine that people use to help make sure their media creations are something that people will stand up for and take note of. The truth is, no matter who you are or what your intentions are for the use of Java in your life, the JavaFX combined with Java itself is the way to go. while experimenting with javafx, remember that java is never far away. in this case, let's call out to : here we go, here's all that's needed, via the scripting api, which is included in the javafx sdk: package calc; import java.io.inputstreamreader; import javax.script.scriptengine; import javax.script.scriptenginemanager; import javax.script.scriptexception; public class calculatorlauncher { public static void main(string[] args) { try { scriptenginemanager manager = new scriptenginemanager(); scriptengine engine = manager.getenginebyextension("fx"); inputstreamreader reader = new inputstreamreader(calculatorlauncher.class.getresourceasstream("calculator.fx")); engine.eval(reader); } catch (scriptexception ex) { } } } and so, here's my whole application, calling jim weaver's calculator demo: What is even better would be to be able to embed that JavaFX stage (or a panel-like part thereof?) into a JFrame. then one would have the best of both worlds: the graphic "oomph" of JavaFX, together with the daily low-level grunt work of java. that, I believe (and hope), is the promise of JavaFX for java developers (and groovy developers), as opposed to designers and similar graphic artists, who seem to be the primary target of JavaFX. Day-to-Day Grind Work One thing that people absolutely love about Java itself is that it allows them to get the day-to-day grunt work done that they need to be done. They are able to see real progress on a daily basis simply by using Java to help propel their best efforts into the world. Yes, there are not as many bells and whistles with Java as there are with JavaFx and other tools, but that just means that there is more to combine with Java to get it to do all that you want it to do. Using JavaFX and Java together can help get more done. This is an innovative approach because it means that they are able to use the bells and whistles of JavaFx incorporated into the practicality of Java itself. Bringing those two things together is a great way for everyday people to achieve results in their work that they would not normally have believed was possible. We do need to recognize the fact that there are many great resources that Java can be used for, but it is also the case that JavaFx simply gives it the extra push that it needs to be a great computing program all around. We would be remiss if we didn’t combine the two things together for optimal use. Does JavaFX Makes Sense For Business Applications? There is still a lot of debate about how much sense it makes to use JavaFX for business applications. On the one hand, there are a lot of people who prefer this as their technology of choice. However, there are some others that say that it is too buggy and can’t handle all of the data that is required for a business operation to run smoothly. What people really like about JavaFx is the fact that it can be used on a “zero installation” basis. This means that it doesn’t need to dig deep into your databases and systems in order to function the way that it is supposed to. That is a pretty big deal because you may find it quite irritating to try to deal with systems that constantly request permissions from you to get deeper and deeper into sensitive data. JavaFX doesn’t do that. However, there is a trade-off. The fact that JavaFX doesn’t need to be as deep into your company’s systems also means that it doesn’t necessarily have the computing power that you may require to fun every operation that you need it to. That means that there could be unnecessary crashes and delays when you attempt to use this system as a standalone program. Does Combining It With Java Help? Some of the issues that are seen with JavaFx may be relieved by the fact that you can also use plain old Java to help make things run a little more smoothly. That’s right, you can combine the Java platform that you are already familiar with to let it latch on to the JavaFx system and generate results that way. You may see fewer system errors and hang-ups when you use this older piece of software to aid the JavaFx system. Regular Java does require more permissions to your data, but that may be a trade-off that you are willing to make if you understand that the upsides are potentially quite enormous for you. Think about your options carefully and then make a decision. Unless you are guarding particularly sensitive data at your company, it probably makes sense to go forward with the plan to get JavaFx and Java combined into the rotation of programs that you use. Innovation Is At Your Fingertips There is plenty of excitement and buzz about the possibilities that JavaFx can bring to the world of business. People are looking at it and starting to realize that there are many ways that it may be used as an innovation machine. They are particularly excited that there are more options than ever available to them and that they can see the ways in which this system may be used to generate outsized business opportunities both for the company that they work for as well as for themselves. If you haven’t had the chance to try the JavaFx system for yourself yet, you need to give it a shot. There are a lot of people who are already benefiting from what it has to offer, and you may fall behind if you don’t try it out as well. Look at what it can do when you get the chance, and then get one for yourself and begin the process of innovation. You won’t regret taking this opportunity to expand your horizons.
July 24, 2022
by Geertjan Wielenga
· 41,298 Views · 3 Likes
  • Previous
  • ...
  • 697
  • 698
  • 699
  • 700
  • 701
  • 702
  • 703
  • 704
  • 705
  • 706
  • ...
  • 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
×