24
Jul

Android Code to check if the network connection is available.

While developing an app in android which needs network connectivity, it is required to check if the server is available (visible) .. For that, just follow these simple steps which is given below and you are done :-   Step 1: Create a class AppStatus in your project(you can give any other name also). Then please paste the given below lines into your code Java import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; public class AppStatus { private static AppStatus instance = new AppStatus(); ConnectivityManager connectivityManager; NetworkInfo wifiInfo, mobileInfo; private boolean registered = false; private boolean update = false; private String auth_key; private String device_key; static Context context; boolean connected = false; public static AppStatus getInstance(Context ctx) { context = ctx; return instance; } public Boolean... Read More »

1 Comment
17
Jul

How to download something in the background of an Android application

  This code fetches content from the web without blocking the UI (runs in the background in a Thread). Once finished, it posts a Handler that is picked up by the UI as soon as possible.   import java.io.BufferedInputStream; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import org.apache.http.util.ByteArrayBuffer;   public class Iconic extends Activity { private String html = “”; private Handler mHandler;   public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mHandler = new Handler(); checkUpdate.start(); }   private Thread checkUpdate = new Thread() { public void run() { try { URL updateURL = new URL(“http://iconic.4feets.com/update”); URLConnection conn = updateURL.openConnection(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(50);   int current... Read More »

Leave a comment
11
Jul

Android Installation on Windows 7 in just seven easy steps!!!!

To install Android on Windows 7, just follow the given steps :   1.Set up environments   a. Install JRE (Java Runtime Environment)”Used to run java programs” b. Install JDK (Java Development Kit)”Used to make java programs” link-http://www.oracle.com/technetwork/java/javase/downloads/index.html   2. Download Android SDK for Windows Link-http://dl.google.com/android/android-sdk_r08-windows.zip   3. Extract the ZIP archive in one folder.   4. Run “SDK Setup.exe” (or the equivalent for your system)   If you receive an error message stating “Failed to fetch url…” then you will have to force the Setup program to use http instead of https. Follow the steps- i.Close the “Refresh Sources” window   ii.Cancel the “Choose Packages to Install” window   iii.Select “Settings” from the left side of the “Android SDK and AVD Manager” window   iv.Check the box labeled “Force https://… sources to be fetched using http://…”   v.Click... Read More »

Leave a comment
03
Jul

How to send an SMS from an Android application + get a response if the sms was delivered or not

How to send an SMS from my android application? It’s easy to send SMS Messages using the SmsManager. You can easily get the SMS status as well , by using PendingIntent with it. Just copy the given code into an Android project and call the sendSMS function, and pass the mobile number(mobileNumber) on which you want to send the SMS with text(messageBody) . /—————————Code starts from here—————————–/ Java private void sendSMS(String mobileNumber, String messageBody) { //phoneNumber="5556"; String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); //---when the SMS has been sent--- registerReceiver(new BroadcastReceiver(){ @Override public... Read More »

Leave a comment
27
Jun

Tips to delete, remote and local branch from github

Deleting a remote as well as a local branch from github is pretty simple. To delete a remote branch -: Step 1: Just go into your project directory from console/gitbash console (if you are using windows)              and enter in console :~/git branch -r  You see a list of the remote branches . Step 2: If you want to delete the branch name “dev” from github             then enter in the console  :~/git push origin :dev           ( Where origin is your remote name and dev is the name of the branch)           The above command will delete the dev branch on the origin remote To delete a local branch -: Step 1: First, make sure you are not on the same branch (eg. dev) which you are going to              delete from the local repo also. Just move from that branch to another branch using              :~/git checkout branch_name Step 2: Then enter in the console:              :~/git branch -d dev            ... Read More »

Leave a comment
22
Jun

Cleaning your github files and folders (even remote ones)

To clean unused or orphan files and folders from a github account is really easy! But very often, people just delete the files/folder from the project manually, using the shift+delete command and then follow: git add . git commit -m “whatever” git push origin branch_name. But this doesnt delete the files/folder from git index (or from git repo). Every time you do git status you see lots of deleted files and they are not committed in the console. To delete files from git index(or from git repo) as well, just follow the given steps :- Step 1:   :~/git -rm file_name   =>This will remove files from the working tree (local) and from the index (from git repo)                                                    or to remove the folder              :~/git -rm -r folder_name   =>This will remove the folder from the working tree (local) and             from the index (from git repo). ‘-r’ allows recursive removal... Read More »

Leave a comment
15
Jun

The HuMONGOus DB

Meet the new database in town, one of the fastest growing members of the web world, MongoDB is the database that is taking the known world by storm. Fairly young of its species, this shiney non-relational Database has already started to be rapidly adopted by big guys like Barclays, Foursquare, MTV Networks, The New York Times, bit.ly and most importantly- Aadhaar! It doesn’t really need an introduction here, since we have Google, the Sanctum sanctorum for us geeks. Here, the question we have is not ‘what is MongoDB?’. But a better question will be ‘Why MongoDB?’. The discussions could just go on about this, and we want to be the ones to give the launchpad for those dicussions in India! Saturday, the 16th of June is going to be the special day for hosting the first Meetup of MongoDB Pune Users, Hackers and Enthusiasts here at the Webonise Lab office from 11:00am to 2:00pm. At tomorrow’s meetup we take a look into how we believe this Document based database will change the way... Read More »

Leave a comment
15
Jun

How to make the loading screen work in QT Symbian app using Qt Creator

Want to know how to make the loading screen work? Follow the steps below: 1.Create 3 files in the project as named below.. loading.ui In loading.ui just add a label or any gif file.. This ui would be very stylish. The things you add here depends on you. loading.h  In loading .h , add the given code snippet and delete all the previous data:   #ifndefLOADING_H #defineLOADING_H #include<QDialog> namespaceUi{   classLoading; } classLoading:publicQDialog {   Q_OBJECT public:   explicitLoading(QWidget*parent=0);   ~Loading(); private:   Ui::Loading*ui; privateslots: }; #endif//LOADING_H   loading.cpp Now add the cpp file with the given code snippet and delete all the previous data :   #include“loading.h” #include“ui_loading.h” Loading::Loading(QWidget*parent):   QDialog(parent),   ui(newUi::Loading) {   ui->setupUi(this);   raise(); } Loading::~Loading() { ... Read More »

Leave a comment
29
Mar

Rails migrations in non-Rails (and non Ruby) projects

Ruby On Rails Migrations are a convenient way for you to alter your database in a structured and organized manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run them. You’d also have to keep track of which changes need to be run against the production machines next time you deploy. Active Record tracks which migrations have already been run so all you have to do is update your source and run rake db:migrate. Active Record will work out which migrations should be run. It will also update yourdb/schema.rb file to match the structure of your database. Migrations also allow you to describe these transformations using Ruby. The great thing about this is that (like most of Active Record’s functionality) it is database independent: you don’t need to worry about the precise syntax ofCREATE TABLE any more than you worry about variations on SELECT * (you can drop down to raw SQL for database specific... Read More »

Leave a comment
29
Mar

Going Mobile?- A strategic Insight – Part-1

Mobile apps that were an unknown entity just 2 years back, have become a must have add-on to anything and everything online. Eventually, and that to in the very near future mobile devices will take over the personal computer space. From desktops, to laptops to smartphones and tabs, its all about evolution and survival of the sleekest. “Growth of any organization depends not on the solutions for today, but on having solutions for the future.” So, if you still think that you need a proven business model before jumping into this ecosystem then its better you stay ashore. From what I can see, all you need is to find your entry point with the shortest possible path.. asap There is enough data floating over the internet to help you get successfully confused about your mobile strategy. So let me put it in context. Do you need to go mobile? In the race to stay on top of the latest trends, its easy to sway in the mobile direction these days. Be it a brand, a startup, or your own awesome idea.... Read More »

Leave a comment