Posts

Showing posts from 2014

What exactly is RESTful programming?

REST is the underlying architectural principle of the web. The amazing thing about the web is the fact that clients (browsers) and servers can interact in complex ways without the client knowing anything beforehand about the server and the resources it hosts. The key constraint is that the server and client must both agree on the media used, which in the case of the web is HTML.

How can I sync data between a webserver and an android app?

Syncing data between your webserver and an android app requires a couple of different components on your android device. Persistent Storage: This is how your phone actually stores the data it receives from the webserver. One possible method for accomplishing this is writing your own custom ContentProvider backed by a Sqlite database. A decent tutorial for a content provider can be found here: http://thinkandroid.wordpress.com/2010/01/13/writing-your-own-contentprovider/ContentProvider defines a consistent interface to interact with your stored data. It could also allow other applications to interact with your data if you wanted. Behind your ContentProvider could be a Sqlite database, a Cache, or any arbitrary storage mechanism. While I would certainly recommend using a ContentProvider with a Sqlite database you could use any java based storage mechanism you wanted. Data Interchange Format: This is the format you use to send the data between your webserver and your android app. The…

How to avoid Java Code in JSP Files?

The use of scriptlets (those <% %> things) in JSP is indeed highly discouraged since the birth of taglibs (like JSTL) and EL (Expression Language, those ${} things) over a decade ago. The major disadvantages of scriptlets are: Reusability: you can't reuse scriptlets.Replaceability: you can't make scriptlets abstract.OO-ability: you can't make use of inheritance/composition.Debuggability: if scriptlet throws an exception halfway, all you get is a blank page.Testability: scriptlets are not unit-testable.Maintainability: per saldo more time is needed to maintain mingled/cluttered/duplicated code logic.

Copy files and folders from Assets folder to memory card in android

Copy and paste the below methods in your Activity class code.
static String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); final static String TARGET_BASE_PATH = extStorageDirectory+"/My Demo Folder/"; private void copyFilesToSdCard() { copyFileOrDir(""); }

Top 5 java people you should know

Image
5. JBoss Founder Marc Fleury, who founded JBoss in 2001, an open-source Java application server, arguably the de facto standard for deploying Java-based Web applications. Later he sold the JBoss to RedHat, and joined RedHat to continue support on the JBoss development. On 9 February 2007, he decided to leave Red Hat to pursue other personal interests, such as teaching, research in biology, music and his family. Related Links Marc Fleury WikiMarc Fleury BlogJBoss Application ServerNews & Interviews Could Red Hat lose JBoss founder?JBoss founder Marc Fleury leaves Red Hat, now what?JBoss’s Marc Fleury on SOA, ESB and OSSResurrecting Marc Fleury 4. Struts Founder Craig Mcclanahan, creator of Struts, a popular open source MVC framework for building Java-based web applications, which is arguably that every Java developer know how to code Struts. With the huge success of Struts in early day, it’s widely implemented in every single of the old Java web application project. Related Links Craig M…

What is the most productive way to handle development-related failures?

Your project failed. Software development is highly prone to project failures, and depending on the severity, this is best handled by management. Many projects have failed and many more will fail, so take notes! Learn why your project failed so you don't make the same mistakes next time. You learn much more from your failures than from your successes. What you have spend coding days on was rejected by your team. Save your work (for later). There are two possibilities: (a) It sucks, and the fact multiple people responded the same way is indication of this (b) It's truly genius work, but far ahead of what people are used to or can understand. People generally do not like what they do not understand. Perhaps its better to show it when the time is right OR in a different place with a different "Culture" Nobody listen to your ideas in your company. Its probably a bad idea, OR the culture is not aligned with your thinking. Either move to a place that supports your culture or…

Websites for Advanced Level Java Developers

Image
1. Stackoverflow Stackoverflow.com is probably the most popular website in the programming world. There are millions of good questions and answers. Learning an API or a programming language often rely on code examples, stackoverflow has a lot of code segments. Another good thing about stackoverflow is that it is social. You can view questions under some certain tags, e.g. “java” and “regex”, then you can see what question is most frequently asked and most voted. This can serve as a good resource for learning, also a good resource to write popular topics of Java bloggers. URL: http://stackoverflow.com/

What should every programmer know about security?

Principles to keep in mind if you want your applications to be secure:Never trust any input!Validate input from all untrusted sources - use whitelists not blacklistsPlan for security from the start - it's not something you can bolt on at the endKeep it simple - complexity increases the likelihood of security holesKeep your attack surface to a minimumMake sure you fail securelyUse defence in depthAdhere to the principle of least privilegeUse threat modellingCompartmentalize - so your system is not all or nothingHiding secrets is hard - and secrets hidden in code won't stay secret for longDon't write your own cryptoUsing crypto doesn't mean you're secure (attackers will look for a weaker link)Be aware of buffer overflows and how to protect against them

50 Cheatsheets For Programmers And Developers

1. Asynchronous JavaScript And XML (AJAX): This is a group of interrelated web development techniques that are used to create asynchronous web applications on the client side.

5 things you didn't know about everyday Java tools

1. StAX When XML first appeared on most Java developers' radar, back around the turn of the millennium, there were two basic approaches to parsing XML files. The SAX parser is essentially a giant state machine of events fired back at the developer via a series of callback methods. The DOM parser pulls the entire XML document into memory and slices it up into a series of discrete objects, which are linked together to form a tree. The tree describes the entire XML Infoset representation of the document. Both parsers had their drawbacks: SAX was too low-level to use, but DOM was too expensive, particularly for large XML files — the whole tree got to be a pretty hefty heap hog.

5 things you didn't know about Java Database Connectivity

Many Java developers today know the Java Database Connectivity (JDBC) API by way of a data-access platform such as Hibernate or Spring. But JDBC is more than a background player in database connectivity. The more you know about it, the more efficient your RDBMS interactions will be. I'll demonstrate several of the newer features introduced between JDBC 2.0 and JDBC 4.0. Designed with modern software development challenges in mind, these features support application scalability and developer productivity — two of the common challenges facing Java developers today.

5 things you didn't know about multithreaded Java programming

While few Java™ developers can afford to ignore multithreaded programming and the Java platform libraries that support it, even fewer have time to study threads in depth. Instead, we learn about threads ad hoc, adding new tips and techniques to our toolboxes as we need them. It's possible to build and run decent applications this way, but you can do better. Understanding the threading idiosyncrasies of the Java compiler and the JVM will help you write more efficient, better performing Java code. I introduce some of the subtler aspects of multithreaded programming with synchronized methods, volatile variables, and atomic classes. My discussion focuses especially on how some of these constructs interact with the JVM and Java compiler, and how the different interactions could affect Java application performance.

Learn MYSQL in 40 mins

Image
This video tutorial cover: 

creating / destroying databases, creating / destroying tables, data types, NULL, DEFAULT, ENUM, AUTO_INCREMENT, primary keys, foreign keys, atomic data, normalized, DESCRIBE, INSERT, ALTER, SELECT, SHOW, RENAME, WHERE, logical operators, comparison operators, ORDER BY, GROUP BY, LIMIT, string operators, joins, LIKE, DISTINCT, math functions and more.

Learn Java in 30 Mins

Image
This video specifically cover the following topics: 
primitive data types, comments, class, import, Scanner, final, Strings, static, private, protected, public, constructors, math, hasNextLine, nextLine, getters, setters, method overloading, Random, casting, toString, conversion from Strings to primitives, converting from primitives to Strings, if, else, else if, print, println, printf, logical operators, comparison operators, ternary operator, switch, for, while, break, continue, do while, polymorphism, arrays, for each, multidimensional arrays and more.

Tutorial By: Derek Banas
Source : newthinktank

For Code used inn this tutorial  CLICK HERE!

5 things you didn't know about JARs

For most Java developers, JAR files and their specialized cousins, WARs and EARs, are simply the end result of a long Ant or Maven process. It's standard procedure to copy the JAR to the right place on the server (or, more rarely, the user's machine) and forget about it. Actually, JARs can do more than store source code, but you have to know what else is possible, and how to ask for it. The tips in this installment of the 5 things series will show you how to make the most of Java Archive files (and in some cases WARs and EARs, too), especially at deployment time. Because so many Java developers use Spring (and because the Spring framework presents some particular challenges to our traditional use of JARs), several of the tips specifically address JARs in Spring applications.

How does SSL/TLS work?

General SSL (and its successor, TLS) is a protocol that operates directly on top of TCP (although there are also implementations for datagram based protocols such as UDP). This way, protocols on higher layers (such as HTTP) can be left unchanged while still providing a secure connection. Underneath the SSL layer, HTTP is identical to HTTPS. When using SSL/TLS correctly, all an attacker can see on the cable is which IP and port you are connected to, roughly how much data you are sending, and what encryption and compression is used. He can also terminate the connection, but both sides will know that the connection has been interrupted by a third party. In typical use, the attacker will also be able to figure out which host name you're connecting to (but not the rest of the URL): although HTTPS itself does not expose the host name, your browser will usually need to make a DNS request first to find out what IP address to send the request to. High-level description of the protocol Aft…

Best video resources to learn programming languages

You can learn almost all programming languages online with all the free resources available. Here, I will list a few of the best websites or youtube channels which provide free tutorials on programming.

1. TheNewBoston.org
This website is probably the best I know for learning programming languages, especially for beginners. The explanations are clear and concise. All of them are videos, which means you can learn just by watching and listening, although it would be a good idea to practice too.
The tutorials on the site include, but not limited to
AJAX (33 Videos)C (15 Videos)C# (200 Videos),C++ GUI with Qt (14 Videos),iPhone Development (37 Videos)Java - Beginner (87 Videos)JavaScript (40 Videos)jQuery (200 Videos)PHP (200 Videos)Python (43 Videos)Ruby (32 Videos)Visual Basic (200 VHTML5 (53 Videos)MySQL Database (33 Videos)and a lot more. You can visit the website here http://thenewboston.org/

2.  ProgrammingKnowledge (youtube channel)  This is a youtube channel and there are many vid…

The main difference between Java and C++

C++ supports pointers whereas Java does not pointers. But when many programmers questioned how you can work without pointers, the promoters began saying "Restricted pointers.” So we can say java supports Restricted pointers. At compilation time Java Source code converts into byte code .The interpreter execute this byte code at run time and gives output. Java is interpreted for the most part and hence platform independent. C++ run and compile using compiler which converts source code into machine level languages so c++ is plate from dependents Java is platform independent language but c++ is dependent upon operating system machine etc. C++ source can be platform independent (and can work on a lot more, especially embedded, platforms), although the generated objects are generally platform dependent but there is clang for llvm which doesn't have this restriction. Java uses both a compiler and interpreter, while C++ only uses a compiler C++ supports operator overloading multiple…