Why Open Source

Open Source is not a concept, it's thought process.

Keep Watching this Space

This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Keep Watching this Space

This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Blog for open Source lovers

We live in a World of Technology and that tecnoglogy is for All to explore and understand. Period. !!

Showing posts with label Development. Show all posts
Showing posts with label Development. Show all posts

Monday, February 20, 2017

Beginning Android Development - Must Not Undeclare Prefix

Usually when we start with some development activities, especially for new developers, there are many common errors which we face. They are usually not big issues but they become roadblock for new developers and hence de-motivates them to start development. 

However, if we see the brighter side, they help us in learning system better and troubleshooting them helps us in understanding tool quickly.

One of the most common error users face while starting with Android Application Development with Android Studio is: 

Error:(2) Error parsing XML: must not undeclare prefix


If you see on other websites and blogs, it has been suggested to add below line or make sure you have below lines:

xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"

However, there are chances that above lines are already there and if you look at the exception or error message closely, you will see that it talks about some prefix which is not declared, so try to look for undeclared prefix and remove it. For eg. it could be like:



xmlns:app2="" 
Try removing it and any other similar undeclared prefix and then compile it. You should be able to move ahead and the program should compile.

Cheers !!

Please leave your comments if more solutions are found and if this has been helpful.

Monday, November 28, 2016

Print All Prime Numbers between 1-500 Using Java

Prime numbers are those numbers which do not have any factor except themselves. So any number which can't be divided by any other number except itself is a Prime Number. So, how do we identify Prime Numbers ? There are many ways to do so but as usual we'll go with the simplest and the easiest one. We are going to print all the prime numbers between 1 to 500. So how do we do it. Below is the code.



This is how it works. 

We just need to check the reminder of  the n/2 ( where n is the number under test) by all the numbers before that and if they leave the remainder as 0 that means the number is not prime. 

For example if the number under test is 19, so dividing 19/2=9.5 and if we keep dividing 9.5 by all the numbers from 2 to 9, there is always a remainder and hence the number is Prime. 

So using the for loop we are doing this check for all the numbers from 1 to 500. So any number which leaves a remainder is prime and the one which doesn't is not a Prime. 

Try it yourself. Also try to find more easier methods is you feel are better and faster, do share them.

Cheers !!

Tuesday, November 22, 2016

How to find Even and Odd Number using Java

Although identifying a number as even or odd it's one of the easiest thing to do. However, just for the sake of knowledge and it's implementation with Java is our prime goal here and hence this post. The logic is simple. Any number which when divided by two leaves no remainder is considered as even and the number which leaves a remainder is odd. This is how we implement it using Java.


This Program is self explanatory and implemented in most easiest way. Please go through it and try implementing with your own logic also. We are using the Scanner java object to ask for user inputs continuously to check if the number is even or odd and until user enters 0 which will break the while loop and program exits.

Monday, November 7, 2016

How to Design Pyramid using Java

As as Beginner in Java Programming field, one try to be creative in playing with for Loops or If Else or While type of conditional statements. And this is where pattern printing programs comes handy. They help us in understanding loops and other java conditional statements in a better way. So more creative you are, more will be your programming skills and there is a good chance to quickly master them. Think of all the wild patterns you want to see and use your programming skills to design them with Java programming. 

One such pattern is Pyramid. It's easy and it really helps in understanding loops and it use on the basic java conditional (for loop) statement. This is what we are planning to print:

And this is how the code will be. Please note there are multiple and many better ways to print the pattern, and this is the basic one:


We have pasted the image of the code and not the exact code because we want you to write the code/program your-self rather then just copy paste. Programming is an art and you will be better at it only when you do it your-self. Still if you want the code to be delivered to your email then please leave your comments below or email at planetopensrc@gmail.com and we will send the code file to you. Also please try to print the pattern using your own code. As we said it earlier, there are many ways to do it better and quicker. So let's try Them.

Cheers !!