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 Languages Topics

article thumbnail
AlertDialog and DialogFragment Example in Xamarin Android
Dialog is like any other window that pops up in front of current window, used to show some short message, taking user input or to ask user decisions.
July 14, 2015
by Nilanchala Panigrahy
· 33,056 Views
article thumbnail
Using Camel Routes In Java EE Components
You can start using Apache Camel routes in Java EE components by integrating Camel with the WildFly App Server, using the WildFly-Camel Subsystem.
July 14, 2015
by Markus Eisele
· 10,878 Views · 1 Like
article thumbnail
JAX-RS and HTTP ‘OPTIONS’
The JAX-RS specification defines sensible defaults for the HTTP OPTIONS command. I actually stumbled upon this by chance!
July 13, 2015
by Abhishek Gupta DZone Core CORE
· 7,410 Views · 2 Likes
article thumbnail
Design Patterns in Automated Testing
Learn how to make your test automation framework better through Page Objects, Facades, and Singletons.
July 13, 2015
by Anton Angelov
· 81,144 Views · 7 Likes
article thumbnail
Mapping Complex JSON Structures With JDK8 Nashorn
Wondering how you can map a complex JSON structure to another JSON structure using Java? Read this awesome tutorial on mapping complex JSON structures.
July 8, 2015
by Jethro Bakker
· 13,064 Views
article thumbnail
Java 8: Master Permutations
Using Permutations, you can try all combinations of an input set.
July 7, 2015
by Per-Åke Minborg
· 39,879 Views · 11 Likes
article thumbnail
Optional Parameters in Java 8 Lambda Expressions
Yeah, they don't really exist, but we can use polymorphism, method overloading and default methods instead to make it a bit more convenient to use our APIs. As an example, here's an event bus implementation where I can register event handlers with an optional header parameter. Bus bus = new Bus(); bus.register(event -> System.out.println("I gots an event")); bus.register((event,header) -> System.out.println("I gots an event w/ header")); Here are the dirty details on how you can do this (and - when dispatching - events, use default methods to avoid type coercion.
July 7, 2015
by Jochen Bedersdorfer
· 7,640 Views · 1 Like
article thumbnail
Standalone Java application with Jersey and Jetty
I’ve built a small example of running a standalone Java application that both serves static HTML, JavaScript, CSS content, and also publishes a REST web service.
July 7, 2015
by Alan Hohn
· 40,036 Views · 3 Likes
article thumbnail
Casting in Java 8 (and Beyond?)
Casting an instance to a type reeks of bad design. Still, there are situations where there is no other choice. The ability to do this has always been part of Java.
July 6, 2015
by Nicolai Parlog
· 22,446 Views
article thumbnail
60 Most Commonly Used R Packages in R Programming Language
A comprehensive list of 60 most commonly used R packages for data science and analytics.
July 6, 2015
by Ajitesh Kumar
· 10,489 Views · 2 Likes
article thumbnail
More Compact Mockito with Java 8 and Lambda Expressions
Mockito-Java8 is a set of Mockito add-ons leveraging Java 8 and lambda expressions to make mocking with Mockito even more compact. At the beginning of 2015 I gave my flash talk Java 8 brings power to testing! at GeeCON TDD 2015 and DevConf.cz 2015. In my speech using 4 examples I showed how Java 8 – namely lambda expressions – can simplify testing tools and testing in general. One of those tools was Mokcito. To not let my PoC code die on slides and to make it simply available for others I have released a small project with two, useful in specified case, Java 8 add-ons for Mockito. Quick introduction As a prerequisite, let's assume we have the following data structure: @Immutable class ShipSearchCriteria { int minimumRange; int numberOfPhasers; } and a class we want to stub/mock: public class TacticalStation { public int findNumberOfShipsInRangeByCriteria( ShipSearchCriteria searchCriteria) { ... } } The library provides two add-ons: Lambda matcher - allows to define matcher logic within a lambda expression. given(ts.findNumberOfShipsInRangeByCriteria( argLambda(sc -> sc.getMinimumRange() > 1000))).willReturn(4); Argument Captor - Java 8 edition - allows to use `ArgumentCaptor` in a one line (here with AssertJ): verify(ts).findNumberOfShipsInRangeByCriteria( assertArg(sc -> assertThat(sc.getMinimumRange()).isLessThan(2000))); Lambda matcher With a help of the static method argLambda a lambda matcher instance is created which can be used to define matcher logic within a lambda expression (here for stubbing). It could be especially useful when working with complex classes pass as an argument. @Test public void shouldAllowToUseLambdaInStubbing() { //given given(ts.findNumberOfShipsInRangeByCriteria( argLambda(sc -> sc.getMinimumRange() > 1000))).willReturn(4); //expect assertThat(ts.findNumberOfShipsInRangeByCriteria( new ShipSearchCriteria(1500, 2))).isEqualTo(4); //expect assertThat(ts.findNumberOfShipsInRangeByCriteria( new ShipSearchCriteria(700, 2))).isEqualTo(0); } In comparison the same logic implemented with a custom Answer in Java 7: @Test public void stubbingWithCustomAsnwerShouldBeLonger() { //old way //given given(ts.findNumberOfShipsInRangeByCriteria(any())).willAnswer(new Answer() { @Override public Integer answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); ShipSearchCriteria criteria = (ShipSearchCriteria) args[0]; if (criteria.getMinimumRange() > 1000) { return 4; } else { return 0; } } }); //expect assertThat(ts.findNumberOfShipsInRangeByCriteria( new ShipSearchCriteria(1500, 2))).isEqualTo(4); //expect assertThat(ts.findNumberOfShipsInRangeByCriteria( new ShipSearchCriteria(700, 2))).isEqualTo(0); } Even Java 8 and less readable constructions don't help too much: @Test public void stubbingWithCustomAsnwerShouldBeLongerEvenAsLambda() { //old way //given given(ts.findNumberOfShipsInRangeByCriteria(any())).willAnswer(invocation -> { ShipSearchCriteria criteria = (ShipSearchCriteria) invocation.getArguments()[0]; return criteria.getMinimumRange() > 1000 ? 4 : 0; }); //expect assertThat(ts.findNumberOfShipsInRangeByCriteria( new ShipSearchCriteria(1500, 2))).isEqualTo(4); //expect assertThat(ts.findNumberOfShipsInRangeByCriteria( new ShipSearchCriteria(700, 2))).isEqualTo(0); } Argument Captor - Java 8 edition A static method assertArg creates an argument matcher which implementation internally uses ArgumentMatcher with an assertion provided in a lambda expression. The example below uses AssertJ to provide meaningful error message, but any assertions (like native from TestNG or JUnit) could be used (if really needed). This allows to have inlined ArgumentCaptor: @Test public void shouldAllowToUseAssertionInLambda() { //when ts.findNumberOfShipsInRangeByCriteria(searchCriteria); //then verify(ts).findNumberOfShipsInRangeByCriteria( assertArg(sc -> assertThat(sc.getMinimumRange()).isLessThan(2000))); } In comparison to 3 lines in the classic way: @Test public void shouldAllowToUseArgumentCaptorInClassicWay() { //old way //when ts.findNumberOfShipsInRangeByCriteria(searchCriteria); //then ArgumentCaptor captor = ArgumentCaptor.forClass(ShipSearchCriteria.class); verify(ts).findNumberOfShipsInRangeByCriteria(captor.capture()); assertThat(captor.getValue().getMinimumRange()).isLessThan(2000); } Summary The presented add-ons were created as PoC for my conference speech, but should be fully functional and potentially useful in the specific cases. To use it in your project it is enough to use Mockito 1.10.x or 2.0.x-beta, add `mockito-java8` as a dependency and of course compile your project with Java 8+. More details are available on the project webpage: https://github.com/szpak/mockito-java8
July 6, 2015
by Marcin Zajączkowski
· 33,759 Views · 2 Likes
article thumbnail
Worthless features of Java - You really know
When you first learn to develop you see overly broad statements about different features to be bad, for design, performance, clarity, maintainability, it feels like a hack, or they just don't like it. In this post, I look at some of the feature people like to hate and why I think that used correctly, they should be a force for good. Features are not as yes/no, good/bad as many like to believe. Checked Exceptions I am often surprised at the degree that developers don't like to think about error handling. New developers don't even like to read error messages. It's hard work, and they complain the application crashed, "it's not working". They have no idea why the exception was thrown when often the error message and stack dump tell them exactly what went wrong if they could only see the clues. When I write out stack traces for tracing purposes, many just see the log shaped like a crash when there was no error. Reading error messages is a skill and at first it can be overwhelming. Similarly, handling exceptions in a useful manner is too often avoided. I have no idea what to do with this exception, I would rather either log the exception and pretend it didn't happen or just blow up and let the operations people or to the GUI user, who have the least ability to deal the error. Many experienced developers hate checked exceptions as a result. However, the more I hear this, the more I am glad Java has checked exception as I am convinced they really will find it too easy ignore the exceptions and just let the application die if they are not annoyed by them. Checked exceptions can be overused of course. The question should be when throwing a checked exception; do I want to annoy the developer calling the code by forcing them to think a little bit about error handling? If the answer is yes, throw a checked exception. Was Thread.currentThread().stop(e) unsafe? The method Thread.stop(Throwable) was unsafe when it could cause another thread to trigger an exception in a random section of code. This could be a checked exception in a portion of code which didn't expect it, or throw an exception which is caught in some portions of the thread but not others leaving you with no idea what it would do. However, the main reason it was unsafe is that it could leave atomic operations in as synchronized of locked section of code in an inconsistent state corrupting the memory in subtle and untestable ways. To add to the confusion, the stack trace of the Throwable didn't match the stack trace of the thread where the exception was actually thrown. But what about Thread.currentThread().stop(e)? This triggers the current thread to throw an exception on the current line. This is no worse than just using throw exception you are performing an operation the compiler can't check. These are only two worthless features but if you want to read full and detail then check Geek On Java - Hub for Android and Java
July 3, 2015
by Das Nic
· 933 Views
article thumbnail
Finding Dependency in Stored Procedure
Introduction Here in this article we are trying to discuss about the finding reference object within stored procedure and also finding the calling procedure references. Hope you like it and it will be informative. What We Want Developers are writing several stored procedure almost every day. Sometimes developers need to know about the information such as what object is used within the stored procedure or from where (SP) the specified stored procedure call. This is the vital information for the developer before working on a particular stored procedure. Here we are representing a pictorial diagram to understand the nature of implementation. Now we have to answer some question 1. What are the DB Object used in Stored Procedure1 and there type. 2. In case of Store Procedure3 which procedure calls the Store Procedure3 So we are not going to read the Stored Procedure to find the answer. Suppose the each procedure have more than 3000 line. How We Solve the Answer To solve the answer first we take the example and create an example scenario to understand it. -- Base Table CREATE TABLE T1 (EMPID INT, EMPNAME VARCHAR(50)); GO CREATE TABLE T2 (EMPID INT, EMPNAME VARCHAR(50)); GO --1 CREATE PROCEDURE [dbo].[Procedure1] AS BEGIN SELECT * FROM T1; SELECT * FROM T2; EXEC [dbo].[Procedure3]; END GO --2 CREATE PROCEDURE [dbo].[Procedure2] AS BEGIN EXEC [dbo].[Procedure3]; END GO --3 CREATE PROCEDURE [dbo].[Procedure3] AS BEGIN SELECT * FROM T1; END GO Now we are going to solve the question What are the DB Object used in Stored Procedure1 and there type. sp_depends Procedure1 In case of Store Procedure3 which procedure calls the Store Procedure3 SELECT OBJECT_NAME(id) AS [Calling SP] FROM syscomments WHERE [text] LIKE '%Procedure3%' GROUP BY OBJECT_NAME(id); Hope you like it.
July 3, 2015
by Joydeep Das
· 12,205 Views
article thumbnail
Escolhendo a Melhor Hospedagem de Sites
Nessa postagem vamos dar uma breve explicação de forma simples e fácil do que é o que faz um servidor de hospedagem. Hospedagem de sites nada mais é do que o disco virtual que fica online 24 horas por dia que o hospeda os arquivos do seu site, e é justamente por isso que quando você digita o domínio do site a qualquer hora do dia e da noite seu site está sempre no ar. Mas um servidor de hospedagem é muito mais do que um simples disco de armazenamento online que mantém seu site no ar. Poucas pessoas sabem, mas o uso de e-mails está vinculado ao seu serviço de hospedagem, dizemos isso por que as pessoas nunca vinculam a hospedagem com os serviços de e-mail. Enfim, saibam que sempre que contratar uma hospedagem o serviço de envio e recebimento de e-mails também está incluso no pacote. Como escolher uma excelente hospedagem de sites? Bom agora que temos noção do que é uma hospedagem de sites vamos falar sobre quais fatores devemos levar em consideração antes de contratarmos uma empresa que nos preste serviço. Começamos dizendo que preço não é tudo. Muitas pessoas acham que quanto mais cara e de melhor marca a hospedagem de sites é mais seguros estão. Isso é um erro muito comum cometido por diversos usuários novos na internet. Antes de contratar pesquise no Google os seguintes quesitos: Preço, estabilidade do servidor e velocidade e tempo de resposta. Já citamos o primeiro item, que é o preço. Um preço médio de uma boa hospedagem varia entre R$ 10,00 e R$ 30,00, mas como dissemos essa é nossa ultima preocupação, pois o mais importante são os outros fatores envolvidos na qualidade. Estabilidade do Servidor A estabilidade de um servidor de hospedagem esta diretamente ligada à quantidade de banda larga disponibilizada para o servidor que você está hospedado, isso sem contar que se junto ao seu site tiver muitos outros sites hospedados no mesmo servidor com certeza ocorreram quedas frequentes e seu site ficará fora do ar. Por isso colocamos a quantidade de sites que estarão junto ao seu como um de nossos quesitos. Contrate sempre uma hospedagem com no mínimo 100 Giga bytes de tráfego de transferência, se possível com tráfego ilimitado, mas com no mínimo 100 GB você já fica tranquilo com a estabilidade do serviço. Velocidade e Tempo de Resposta Esse é o segundo quesito mais importante em diversos aspectos. O primeiro deles é, se o tempo de carregamento de um site for lento com certeza o usuário vai procurar outro site que ofereça os mesmos serviços que o seu, então sempre consulte o tempo de resposta junto a empresa de hospedagem de sites. O tempo médio de resposta de servidores é um tempo menor que 2 segundos. Outro fator que influencia na velocidade é a localidade do servidor. Se sua empresa está no Brasil tente comprar um serviço de hospedagem onde você saiba onde está localizado o servidor. Não vá me comprar uma hospedagem na China, pois com certeza você terá problemas. A melhor opção é comprar um servidor no Brasil, onde com certeza o tempo de resposta será menor. Mas existem muitos servidores localizados nos Estados Unidos que podemos confiar fielmente. Outro aspecto importante na velocidade é que, se você planeja vender seu negócio pela busca orgânica do Google e seu tempo de resposta for maior do que 2 segundos tenha ciência que você irá perder muito posicionamento nos resultados de busca. Hoje me dia além de termos um site bem assessorado em SEO precisamos também contar um serviço que hospedagem que não nos deixe na mão. Como ultimo fator preste atenção em quantos sites estão hospedados juntos no servidor compartilhado, pois muitos sites ainda fazem muito SPAM e esses spams prejudicam a estabilidade e velocidade do servidor. Sempre ligue para a hospedagem e pergunte se no seu servidor compartilhado eles têm sites suspeitos, se tiver escolha outra empresa de hospedagem. Se tiver um dinheiro sobrando e quiser ter tranquilidade contrate uma hospedagem dedicada, onde o servidor é só seu, mas isso se seu site for daqueles que não pode ficar fora do ar de jeito nenhum, pois em muitas vezes alguns ajustes na taxa de transferência resolvem o problema.
July 2, 2015
by Raphael Acheti
· 746 Views
article thumbnail
Mapping complex JSON structures with JDK8 Nashorn
How can you map a complex JSON structure to another JSON structure in Java? I think there are a few possible solutions in Java. The first solution is to use a serialization framework like Jackson, GSON or smart-json. The mapping is a piece of awkward Java code with a lot of if-else conditions. The result is hard to test and hard to maintain. Schematic it looks like this: JSON -> Java objects -> Mapping -> Java objects -> JSON An second approach is to use a templating framwork (like Freemarker or Velocity) in combination with a serialization framwork. The logic of the mapping has moved to the template. Schematic it looks like this: JSON -> Java objects -> Apply template -> JSON One of the issues with this approach is that the template must enforce that the result is a valid JSON structure. I have tried this approach and it is really hard to produce a valid JSON structure in all use cases. You could also map your JSON to XML and create the mapping with an XSL transformations. Schematic it looks like this: JSON -> XML -> XSL transformation -> XML -> JSON But the ideal schema looks like this: JSON -> Mapping -> JSON With JDK 8 and the Nashorn Javascript engine this becomes possible! This implementation provides JSON.parse() and JSON.stringify() by default. Example Javascript: function convert(val) { var json = JSON.stringify(val); var g = JSON.parse(json); var d = { chunkId: g.chunk.id, timestamp: g.chunk.timestamp }; return JSON.stringify(d); } Java code: private ScriptEngineManager engineManager; private ScriptEngine engine; public MyConverter() { ClassPathResource resource = new ClassPathResource("/converter.js"); InputStreamReader reader = new InputStreamReader(resource.getInputStream()); engineManager = new ScriptEngineManager(); engine = engineManager.getEngineByName("nashorn"); engine.eval(reader); } public String convert(String val){ return (String) engine.eval("convert(" + source + ")"); } I think this is -at this moment- the best approach, Java 9 will ship with native JSON support. Perhaps it will become more easier in the future. More info can be found on my blog.
July 2, 2015
by Jethro Bakker
· 1,481 Views
article thumbnail
Are crowds wise or mad?
Wharton’s Ethan Mollick is undoubtedly one of my favorite thinkers, and I’ve written about a number of his papers previously, whether it’s on the role of middle managers in innovation, or how successful crowdfunding has been at picking winners (compared to traditional venture capital). This apparent wisdom of crowds is something he has returned to for his latest paper, which looks at how successful crowds are versus experts in the funding of art. The study measures the artistic judgment of the crowd versus a team of experts to see how closely they’re matched. The art in question was a collection of 120 theatrical ventures listed on Kickstarter. There have been a number of studies down the years that highlight how effective the ‘uneducated masses’ tend to be when compared to an educated elite, and this one was no exception. “On average, we find a remarkable degree of convergence between the realized funding decisions by crowds and the evaluation of those same projects by experts,” Mollick says. “Projects that were funded by the crowds received consistently higher scores from experts … and were much more likely to have received funding from the experts.” How important crowdfunding is for arts funding The study was inspired by the finding that more money is raised for artistic ventures via Kickstarter than via the National Endowment for the Arts, which is the primary way the US government gives money to the arts. That obviously represents a sizable shift in how money is raised, so the authors were keen to explore what that meant. Were these new patrons ensuring the same quality of art? Does a greater range of art get funded? The authors recruited a team of well established experts from the art world and asked them to judge the projects funded on Kickstarter. The aim was to see if they would have funded those projects via more official channels. Interestingly there was indeed a broad level of consensus between the experts and the crowd. The experts agreed with many of the projects that got funded, and where disagreement existed, it was usually that the experts would not have funded a particular project. So, in reality, the crowd were ensuring a wider and more diverse range of projects received funding. What’s more, the crowd also seemed a good judge of potential success, with a strong track record of picking ‘winners’ in terms of commercial or artistic success. The study provides further insight into the potential for crowds to perform as well, if not better than, supposed experts. Certainly food for thought. Original post
July 2, 2015
by Adi Gaskell
· 976 Views · 1 Like
article thumbnail
Using Liquibase Without a Database Connection
There are many, many different processes and requirements companies have for managing their database schemas. Some allow the application to directly manage them on startup, some require SQL scripts be executed by hand. Some have schemas that can differ across customers, some have only one database to deal with. For people who prefer to execute SQL themselves, Liquibase has always supported an “updateSQL” mode which does not update the database but instead outputs what would be run. This allows developers and DBAs to know exactly what will be ran and even make modifications as needed before actually executing the script. Before version 3.2, however, Liquibase required an active database connection for updateSQL. It used that connection to determine the SQL dialect to use and to query the DATABASECHANGELOG table to learn what changeSets have already been executed. Controlling updateSql SQL Syntax With version 3.2, Liquibase added a new “offline” mode. Instead of specifying a jdbc url such as “jdbc:mysql://localhost/lbcat” you can use “offline:mysql” or “offline:postgresql” which lets Liquibase know what dialect to use. For finer dialect control, you can specify parameters like “offline:mysql?version=3.4&caseSensitive=false Available dialect parameters: version: Standard X.Y.Z version of the database productName: String description of the database, like the JDBC driver would return catalog: String containing the name of the default top-level container ('database' in some databases 'schema' in others) caseSensitive: Boolean value specifying if the database is case sensitive or not Tracking History With CSV These parameters let Liquibase know what SQL to generate for each changeSet, but without an active database connection you cannot rely on the DATABASECHANGELOG table to track what changeSets have already been ran. Instead, offline mode uses a CSV file which mimics the structure of the DATABASECHANGELOG table. By default, Liquibase will use a file called “databasechangelog.csv” in the working directory, but it can be specified with a “changeLogFile” parameter such as “offline:mssql?changeLogFile=path/to/file.csv” It is up to you to ensure that the contents of the csv file match what is in the database. Running updateSQL automatically appends to the CSV file under the assumption that you will apply the SQL to the database. Since the csv file matches a particular database, it isn’t something you normally would store or share under version control because every database can (and probably will) be in a different state. If you do store the files in a central location, you will probably want to at least have a separate file for each database. By default, the SQL generated by updateSql in offline mode will still contain the standard DATABASECHANGELOG insert statements, so each database that you apply the SQL to will still have a correct DATABASECHANGELOG table. This means that you can switch between a direct-connection update and offline updateSQL as needed. It also means that you can also extract the current contents of the DATABASECHANGELOG table to a CSV file and use that as the file passed to the offline connection to ensure you have the right contents in the file. If you do not want the DATABASECHANGELOG table SQL included in updateSQL output, there is an “outputLiquibaseSql” parameter which can be passed in your offline url. Possible outputLiquibaseSql values: "none" will output no DATABASECHANGELOG statements "data_only" will output only INSERT INTO DATABASECHANGELOG statements "all" will output CREATE TABLE DATABASECHANGELOG if the csv file does not exist as well as INSERT statements (default value) Offline Snapshots The new 3.4.0 release of Liquibase expands offline support with a new “snapshot” parameter which can be passed to the offline url pointing to a saved database structure. Liquibase will use the snapshot anywhere it would have normally needed to read the current database state. This allows you to use preconditions and perform diff and diffChangeLog operations without an active connection and even between snapshots of the same database from different points in time. To create a snapshot of your live databases, use the “—snapshotFormat=json” parameter on the “snapshot” command. Command line example: $ liquibase --url=jdbc:mysql://localhost/lbcat snapshot --snapshotFormat=json > snapshot.json or $ liquibase --url=jdbc:mysql://localhost/lbcat –outputFile=path/to/output.json snapshot --snapshotFormat=json NOTE: currently only “json” is supported as a snapshotFormat. You can then use that file with your offline url and any snapshot operations will use it as the database state. liquibase –url=jdbc:mysql://localhost/lbcat –referenceUrl=offline:mysql?snapshot=path/to/snapshot.json diff will compare the stored snapshot with the current database state liquibase –url=offline:mysql?snapshot=path/to/snapshot.json diff –referenceUrl=offline:mysql?snapshot=path/to/older-snapshot.json diff will compare two snapshots liquibase –url=offline:mysql?snapshot=path/to/snapshot.json generateChangeLog will generate a changelog based on what is in the snapshot liquibase –url=jdbc:mysql://localhost/lbcat –referenceUrl=offline:mysql?snapshot=path/to/snapshot.json diffChangeLog will generate a changelog based on what is new in the real database compared to what is in the snapshot.
July 2, 2015
by Nathan Voxland
· 10,862 Views
article thumbnail
Turning a Static HTML Site into a WordPress Theme: Why, How & More
With the release of version 4.1 “Dinah”, WordPress now powers over 60 million websites across the web and is being used by many well-known sites like Forbes, TechCrunch, GigaOM and CNN. Due to the rapid growth in popularity of WordPress in recent years, more and more people are now in favor of moving their static HTML sites to WordPress. Running your site on WordPress platform proves to be beneficial for you in many ways, out of which “easy content management” is the one. In this blog post, firstly I’ll make you familiar with reasons that inspire people to adopt WordPress. After that, I’ll take you through the process of converting an HTML site to WordPress. Later, I’ll be telling you what things you should do after migration. Let’s start! Why to go from Static HTML to WordPress? Below are some solid reasons why people move to WordPress: #Easy to Use: First and foremost reason, WordPress is extremely user-friendly. Anyone having adequate knowledge of computer and internet can setup and manage a WordPress site without any hassle. Regardless of who you are, a professional developer or a non-techie, you can get up and running with WordPress in just five minutes. Strictly speaking, everything from software installation to code modification to content publication is a breeze in WordPress. #SEO Friendly: WordPress is built to embrace search engine spiders and crawlers and therefore, it attracts a huge amount of organic traffic to your site. Having a clean code structure and packed with several search optimization tools, such as permalinks, blogroll and pingback, WordPress ensures your site would get higher rankings in search engine results. In addition, it allows you to take advantage of third party plug-ins for better SEO of your site. #Scalable and Flexible: As WordPress is an extremely customizable and highly expandable CMS, you’ll be able to give your site any look and functionality that you desire. It allows you to choose from a wide range of themes so that you could create any website of your taste. Also, there are a myriad of plug-ins available to let you enhance WordPress’ core functionality. Thus, the possibilities of what can be done with WordPress are endless. #Cost and Time Effective: As WordPress is open-source software, it’ll not affect your bank account unlike traditional websites do. Most of the WordPress themes and plug-ins are available to use for free. Means, you don’t need to spend a lot of time and money on a developer to have minor changes in the design and functionality of your site. With WordPress, you can do them by yourself. #Strong Community Support: WordPress is backed by a large and always growing community. So if you need any help regarding your website, there will always be someone there to assist you. There is no need to call a developer every time you want some editing in the code and content of your site. Just post your problems there and get them resolved by experts for free in minutes. #Trouble-free Upgrades: Websites built with WordPress take less time to upgrade as compared to static ones. In WordPress, using an FTP program such as FileZilla, you can take your website to a whole new level with a few mouse clicks. Unlike classic HTML websites, there is no need to mess with complex firewall settings or any other software. #Multi-User Capability: Being a multi-user capable platform, WordPress lets you control who can do what within your site. You as a site owner can assign a specific role to each of your users, allowing them to perform a set of tasks. For example, you can set up your editor with a user account where he is allowed only to add and edit content to your site. Try this with a static HTML site!! #Safe and Secure: Since its launch, WordPress has been updated more than 25 times. What do these all updates mean? Obviously, security! WordPress team is continuously working hard to make WordPress world’s most secure and reliable CMS. That’s the reason a site built with WordPress is secure enough to deal with any kind of malicious intent. How to Migrate from Static HTML Site to WordPress? If you’re ready to switch to WordPress, below are four steps following which you can move your existing HTML website to WordPress platform efficiently and effectively. #Analyze Your Existing HTML Site: This is the first and foremost step that you should follow before you’re going to convert your static HTML site to a WordPress theme. Check your site for irrelevant or outdated content and if found, clean it up. Examine the existing navigation system and think how it can be improved. Also, don’t forget to dig into hidden elements such as contact page, registration forms and email subscription etc. Doing your HTML site analysis would help you decide what content, features and functionalities should be migrated to WordPress. Consequently, you would have a clear idea about what plug-ins you need to install for getting the same functionality on WordPress platform. Remember, migration is the perfect time to assess whether the content of your site is worthy or not. #Get to Know WordPress: Once you have analyzed your static HTML site, the next step is to familiarize yourself with WordPress. This can be done by installing WordPress on a local computer or with your web hosting provider. WordPress installation is a quite easy process and therefore, I don’t think you would face any kind of trouble. Most web hosts offer one-click quick install and in case you do get stuck, please contact your web host. After finishing the installation, understand how WordPress works and try to find out which plug-ins would prove to be extremely helpful after migration process. Additionally, using “Settings” menu in the WordPress Dashboard, choose your permalink structure and disallow search engines to index your site during migration. #Do a Thorough Backup of Your HTML Site: Even if you have taken back-up of your old static site many times, you must not skip this step. I strongly recommend you to “take a complete backup of your static site once more” in order to avoid any risk of data loss while migrating. Remember, backups take very little effort and time but still are absurdly ignored. Hence as a precaution, have a tested backup saved in multiple locations (such as DVD, hard drive or hosting backup server) so that you could restore your site in case something goes wrong. As well, I suggest you not to tinker with your site in live mode even if you feel whatever you're doing is right. #Migrate to WordPress from Static HTML: Let’s come to Migration, the most juicy and vital part of the entire HTML to WordPress conversion process. May be conversion seems a bit tedious to you but actually it’s not like that. It indeed depends on your proficiency level in WordPress, HTML, PHP, CSS and JavaScript. If you have a passing familiarity with all of them, you can do conversion by yourself. Otherwise, you may need to get a professional HTML to WordPress conversion service for the same. Assuming you have sufficient coding knowledge and your site is small, the best option possible in front of you is to divide your existing HTML code into four sections (header, footer, sidebar and content) and then copy the content of each section into its respective PHP file. In case your site is large, you can take advantage of an HTML to WordPress plug-in, like HTML Import 2, to give your conversion process a boost. What to do after the migration? Once the conversion is completed, you need to do a few things to give your WordPress site the final touch. They are mentioned below: Install Necessary Plug-ins: To supercharge your brand new WordPress site with same functionalities as HTML site, install plug-ins that you found handy. Check and Fix Broken Links: Check your website for broken links (404 errors) and if found, fix them as soon as possible. You can make use of Google Webmaster Tools for this task. Set-up a Custom 404 Error Page: Add a custom 404 error page to take your visitors to important sections of your WordPress site, in case they try to access any URL that doesn't exist. Redirect Links: To inform search engines that your website’s content has been moved to a new web address, set up 301 redirects. For this purpose, you can use Simple 301 Redirect or Redirection plug-in. Enable Search Engine Indexing: Go to “Settings --> Reading” in your WordPress dashboard and check “Allow search engines to index this site” to get your site indexed by search engines. Generate and Submit XML Sitemap: To ensure your site would be included in search engine results as fast as possible, create an XML sitemap using plug-in like Google XML Sitemaps or XML Sitemaps and submit it to Google.
July 2, 2015
by Ajeet Yadav
· 10,035 Views
article thumbnail
JavaOne 2015 Java EE Track Committee: Johan Vos
This is the third in a series of interviews for you to meet some of the committee members for the JavaOne 2015 Java EE track. The committee plays the most important part in determining the content for JavaOne. These good folks really deserve recognition as most of them devote many hours of their time helping move JavaOne forward, often as volunteers. If JavaOne matters to you, these are folks you should know about. This interview is with Johan Vos. If you are having trouble seeing the embedded video below it is available here. Johan is a Java Champion, author, speaker, blogger, member of the BeJUG steering group, member of the Devoxx steering group and a JCP member. He is a fan of Java EE, GlassFish and JavaFX. He founded LodgON, a company offering Java based solutions for social networking software. In the interview he shares his experience and expectations for the Java EE track this year. On this note, I would like to make sure you know that the JavaOne content catalog is now already live with a few preliminary fairly obvious selections we were able to make. None of the sessions accepted at this stage are from Oracle speakers on our track. The folks that we selected early for acceptance include David Blevins, Jonathan Gallimore, Mohammed Taman, Rafael Benevides and Antoine Sabot-Durand. They will be talking about Java EE Connectors (JCA), Java EE 7 real world adoption, CDI and DeltaSpike. I would encourage you to check out all the early selections in the catalog. We are working to finalize the full catalog shortly. I hope to see you at JavaOne. Do stay tuned for more interviews with committee members and some key speakers on our track.
July 1, 2015
by Reza Rahman
· 1,206 Views
article thumbnail
What is Automorphic number in Java ?
In mathematics an automorphic number (sometimes referred to as a circular number) is a number whose square "ends" in the same digits as the number itself. For example, 52 = 25, 62 = 36, 762 = 5776, and 8906252 = 793212890625, so 5, 6, 76 and 890625 are all automorphic numbers. And the logic behind : int n=56; int d=1; int i; for(i=n;i>0;i=i/10) { d=d*10; } if((n*n)%d==n) { System.out.println(n+"\t"+"is Automorphic Number"); } else { System.out.println(n+"\t"+"is not Automorphic Number"); } } You can check full article from Geek On Java - Hub for Java and Android
July 1, 2015
by Das Nic
· 8,674 Views
  • Previous
  • ...
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • ...
  • 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
×