This is how I installed skype on my Kubuntu 13.10 system –
- Open bash/Konsole
- Run: sudo add-apt-repository “deb http://archive.canonical.com/ $(lsb_release -sc) partner”
- Run: sudo apt-get update
- Run: sudo apt-get install skype
This is how I installed skype on my Kubuntu 13.10 system –
Problem: The URLs including development/local ones are forwarded to Yahoo Search page by a Conduit plugin via their search.conduit portal (as seen from status bar message)
Reason: Spyware by Conduit (Anything that changes the settings of your computer without explicitly asking you, and sends out information from your computer without letting you know – is a spyware/malware indeed)
Fix: Available here : “http://www.techsupportall.com/how-to-remove-conduit-search/” (Download and run Adware-Removal-Tool-v3.8.exe from there. Verified working.)
Problem: When running mvn jetty:run to launch jetty, Appfuse throws error “java.util.zip.ZipException: invalid distance too far back”
Reason: One of the jars in maven repository is corrupted.
Fix: (Kind of nuke all, but works)
OR,
All done and dusted, when you are ready to upload your application to the Android Market for the world to use it, you’ll have to follow a few steps below.
You’re done!! Your application is up and running on the Market!!
Creating an Android Application that users can both use and appreciate is not an easy task. However, obviously some online resources can make your life easier. I present below 6 websites that are a “must know” for all Android Developers.
I do hope these help you create better, faster,smarter and visually appealing applications!!
While developing Android Applications, one inevitably comes across the Values folder. It is located in <workspace>-><application name>->res. It holds some very important and interesting resources which I am going to tell you about in this post.
As you are now familiar with most of the Android Development techniques, you will often require to change and modify the values folder. Keep experimenting!!
If you’ve used an Android device, Swipe Detection is not new to you. Unlocking the phone, receiving calls etc. all make use of a Swipe Detector mechanism. Technically speaking, a Swipe is known as a Motion Event in Android.
In this post I will show you how to create a Swipe Detection mechanism and use it for various purposes. Start up an activity and follow along. Here I will give you the Source Code first and then go on to explain it later.
[java]
package com.nero.myfirstapp;
import android.view.MotionEvent;
import android.view.View;
public class SwipeDetector implements View.OnTouchListener{
public static enum Action {
LR, // Left to right
RL, // Right to left
TB, // Top to bottom
BT, // Bottom to top
None // Action not found
}
private static final int HORIZONTAL_MIN_DISTANCE = 80; // The minimum distance for horizontal swipe
private static final int VERTICAL_MIN_DISTANCE = 30; // The minimum distance for vertical swipe
private float downX, downY, upX, upY; // Coordinates
private Action mSwipeDetected = Action.None; // Last action
public boolean swipeDetected() {
return mSwipeDetected != Action.None;
}
public Action getAction() {
return mSwipeDetected;
}
/**
* Swipe detection
*/@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
{
downX = event.getX();
downY = event.getY();
mSwipeDetected = Action.None;
return false; // allow other events like Click to be processed
}
case MotionEvent.ACTION_MOVE:
{
upX = event.getX();
upY = event.getY();
float deltaX = downX – upX;
float deltaY = downY – upY;
// horizontal swipe detection
if (Math.abs(deltaX) > HORIZONTAL_MIN_DISTANCE) {
// left or right
if (deltaX < 0) {
mSwipeDetected = Action.LR;
return true;
}
if (deltaX > 0) {
mSwipeDetected = Action.RL;
return true;
}
} else
// vertical swipe detection
if (Math.abs(deltaY) > VERTICAL_MIN_DISTANCE) {
// top or down
if (deltaY < 0) {
mSwipeDetected = Action.TB;
return false;
}
if (deltaY > 0) {
mSwipeDetected = Action.BT;
return false;
}
}
return true;
}
}
return false;
}
}
[/java]
Understanding the Code
Using Swipe Detector
The Swipe Detector can be used in any module you like. Below is a code snippet that can be used with modifications as necessary.
[java]
if(swipeDetector.swipeDetected()){
if(swipeDetector.getAction() == SwipeDetector.Action.LR){
Toast.makeText(getApplicationContext(), "Left to Right", Toast.LENGTH_SHORT).show();
}
if(swipeDetector.getAction() == SwipeDetector.Action.RL){
Toast.makeText(getApplicationContext(), "Right to Left", Toast.LENGTH_SHORT).show();
}
[/java]
In the first part, I showed you how to use a basic Sliding Drawer in Android. In this post I’ll show you how to make your Sliding Drawers fancier by changing the handle image when the Sliding Drawers is open and when it is closed. The complete source code is at the bottom.
Now, when you run it on the emulator or an actual device, you can see the handle images changing based on whether the Sliding Drawer is open or close.
COMPLETE SOURCE CODE
activity_main.xml
The task is to construct a simple server which just passes a string to the client.
Client/server describes the relationship between two computer programs in which one program, the client, makes a service request from another program, the server, which fulfills the request. Although the client/server idea can be used by programs within a single computer, it is a more important idea in a network.
A server runs on a specific computer and has a socket that is bound to a specific port number. The server just waits, listening to the socket for a client to make a connection request.
InputStream and OutputStream are used to transfer of data between server and client.
java.net includes Socket and ServerSocket classes.
java.io includes DataOutputStream and DataInputStream classes.
[java]
import java.io.*;
import java.net.*;
public class server {
public static void main(String[] args) {
try{
ServerSocket s=new ServerSocket(1254); //same port number
Socket s1=s.accept(); //accepts the connection
OutputStream stout=s1.getOutputStream();
DataOutputStream dos=new DataOutputStream(stout);
dos.writeUTF("HELLO WORLD");
dos.close();
s1.close();
}
catch(Exception e)
{System.out.println(""+e);}
}
}
[/java]
[java]
import java.io.*;
import java.net.*;
public class client {
public static void main(String[] args) {
try{
Socket s= new Socket("localhost",1254);//localhost or any other IP
InputStream sin=s.getInputStream();
DataInputStream din=new DataInputStream(sin);
String str=new String(din.readUTF());
System.out.println(""+str);
din.close();
sin.close();
s.close();
}
catch(Exception e)
{System.out.println(""+e);}
}
}
[/java]
Note-
To check the programs,simultaneously run both the programs.
Given a set of numbers,our task is to find the number of subsets that sum to a particular value.
Example-
Set of numbers- {1,3,2,5,4,9}
Sum=9
Subsets that sum to 9-
{1,3,5}
{5,4}
{9}
{3,2,4}
Thus,number of subsets that sum to 9 = 4.
Algorithm-
The idea is to find the number of possible sums with the current number.And its true that,there is exactly one way to bring sum to 0. At the beginning,we have only one number. We start from our target and subtract that number.If it is possible to get a sum of that number,then add it to the array element corresponding to the current number.
Code-
[cpp]
//N is the number of elements,
//sum is the given value,
//numbers[] contains the elements
int GetmNumberOfSubsets()
{
int dp[1000];
dp[0] = 1;
int currentSum =0;
for (int i = 0; i < N; i++)
{
currentSum += numbers[i];
for (int j = std::min(sum, currentSum); j >= numbers[i]; j–)
dp[j] += dp[j – numbers[i]];
}
return dp[sum];
}
[/cpp]
Note-
This algorithm works only for positive numbers.