eclipse workspace is in use or cannot be created.
what worked for me.
rm ~/workspace/.metadata/.lock
If it wasn't this… it'd be something else
eclipse workspace is in use or cannot be created.
what worked for me.
rm ~/workspace/.metadata/.lock
– December 5, 2012
In terminal,
sudo a2enmod vhost_alias
If you get this you are in right track,
Enabling module vhost_alias. Run '/etc/init.d/apache2 restart' to activate new configuration!
Restart apache2 and go to sites-available dir
cd /etc/apache2/sites-available/
Now, we are in the apaches directory where all the defination files for the virtual hosts are. We want to copy the default template, named default
sudo cp default our-test-site
Lets edit the file
sudo gedit our-test-site
The file will be like:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
We need to add one line and edit two lines.
Add Servername our-test-site.local just above the DocumentRoot directive in line 4.
Edit /var/www to /path-to-the-test-site-WITHOUT-trailing-slash. It should be something like:
DocumentRoot /path-to-the-test-site-WITHOUT-trailing-slash
Edit path on line 9 /path-to-the-test-site-WITH-trailing-slash. It should be something like:
<Directory /path-to-the-test-site-WITH-trailing-slash/ >
Enable the virtual host file by,
sudo a2ensite our-test-site
The response would be:
Enabling site our-test-site.
Run '/etc/init.d/apache2 reload' to activate new configuration!
Now, lets tell the server our-test-site.local should be resolved to 127.0.0.1
sudo gedit /etc/hosts
Add 127.0.0.1 our-test-site.local.
127.0.0.1 localhost
127.0.0.1 our-test-site.local
127.0.1.1 ubuntu-vm
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
Restart apache2. hit our-test-site.local in browser. and its done.
Posted in Open Source.
– November 17, 2012
Though less may be the chances, dual booting with windows after installing ubuntu, might be an option. Lets do it. Backup MBR(Master Boot Record), first.
The MBR resides typically in the first sector of a hard disk or any other data storage device which holds the partition table. If you want to make some modifications to your boot loader, usually known as the GRUB boot loader under Ubuntu, then making a copy of your MBR will be highly recommended so that you can restore it in case of unexpected troubles, especially when doing dual booting.
I have a harddisk /dev/sda, lets assume and change according to your harddisk. Lets backup MBR. Run following command in terminal.
sudo dd if=/dev/sda of=boot.bin bs=512 count=1
A “boot.bin” file will be created in the current terminal location. Secure this file.
Install windows in another partition of the harddisk. After reboot, windows boots but linux doesn’t. Lets restore the MBR with the command in root directory.
sudo dd if=boot.bin of=/dev/sda bs=512 count=1
Lastly, use grub-customizer for the boot option.
Cheers.
Posted in linux, Microsoft, Open Source.
– September 22, 2012
1. Problem
When trying to run
$git remote add origin git@gitserver.com:me/project.git
The error often comes is: fatal: remote origin already exists
2. Reason
Remote origin already exists. Its already been added.
3. Solution
Remove the git origin previously added.
$git remote rm origin
Posted in linux, Open Source.
– September 22, 2012
error: unknown filesystem. grub rescue>
when you boot and you are stuck! Great. Lets fix it.
Use ls command to list all your partitions.
grub rescue> ls
(hd0) (hd0,msdos6) (hd0,msdos5) (hd0,msdos2) (hd0,msdos1)
ls (hd0,msdos6)/ lists directories. Others will give “error: unknown filesystem.” It is a linux partition.
Lets boot this partition.
set root=(hd0,6)
set prefix=(hd0,6)/boot/grub
insmod normal
normal
Posted in linux, Open Source.
– August 3, 2012
The java decompiler converts the java compiled code i.e .class into .java class. The open source java decompiler that works like a charm is JD-GUI.
Download from
http://java.decompiler.free.fr/?q=jdgui or
Posted in Java, Open Source.
– May 26, 2012
The AsyncTask class is a special class for Android development that encapsulates background processing and helps facilitate communication to the UI thread while managing the lifecycle of the background task within the context of the activity lifecycle .
AsyncTask is an abstract helper class for managing background operations that eventually post back to the UI thread. It creates a simpler interface for asynchronous operations than manually creating a Java Thread class. Instead of creating threads for background processing and using messages and message handlers for updating the UI, you can create a subclass of AsyncTask and implement the appropriate event methods.The onPreExecute() method runs on the UI thread before background processing begins.The doInBackground() method handles background processing, whereas publishProgress() informs the UI thread periodically about the background processing progress.When the background processing finishes, the onPostExecute() method runs on the UI thread to give a final update.
The following code demonstrates an example implementation of AsyncTask to perform the same functionality as the code for the Thread:
private class ImageLoader extends AsyncTask<URL, String, String> {
@Override
protected String doInBackground(
URL... params) {
// just one param
try {
URL text = params[0];
// ... parsing code {
publishProgress(
“imgCount = “ + curImageCount);
// ... end parsing code }
}
catch (Exception e ) {
Log.e(“Net”,
“Failed in parsing XML”, e);
return “Finished with failure.”;
}
return “Done...”;
}
protected void onCancelled() {
Log.e(“Net”, “Async task Cancelled”);
}
protected void onPostExecute(String result) {
mStatus.setText(result);
}
protected void onPreExecute() {
mStatus.setText(“About to load URL”);
}
protected void onProgressUpdate(
String... values) {
// just one value, please
mStatus.setText(values[0]);
}}
When launched with the AsyncTask.execute() method, doInBackground() runs in a background thread while the other methods run on the UI thread.There is no need to manage a Handler or post a Runnable object to it.This simplifies coding and debugging.
Posted in Android, Java, Open Source.
– May 20, 2012
For the network applications gathering the informations from network, it is useful to determine if a network connection is even available before trying to use a network resources. The ConnectivityManager class provides a number of methods to do this.The following code determines if the mobile (cellular) network is available and connected. In addition, it determines the same for the Wi-Fi network:
ConnectivityManager cm = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
boolean isWifiAvail = ni.isAvailable();
boolean isWifiConn = ni.isConnected();
ni = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
boolean isMobileAvail = ni.isAvailable();
boolean isMobileConn = ni.isConnected();
status.setText(“WiFi\nAvail = “+ isWifiAvail +
“\nConn = “ + isWifiConn +
“\nMobile\nAvail = “+ isMobileAvail +
“\nConn = “ + isMobileConn);
Figure shows the typical output for the emulator in which the mobile network is simulated but Wi-Fi isn’t available.
For your application to read the status of the network, it needs explicit permission.The
following statement is required to be in its AndroidManifest.xml file:
<uses-permission
android:name=”android.permission.ACCESS_NETWORK_STATE”/>
Posted in Android, Java, Open Source.
– May 20, 2012
Logging is a valuable resource for debugging and learning Android applications. Android logging features are in the Log class of the android.util package.
Some helpful methods in the android.util.Log class are shown.
Log.e() -> Log errors
Log.w() -> Log warnings
Log.i() -> Log informational messages
Log.d() -> Log Debug messages
Log.v() -> Log Verbose mesages
To add logging support to android application, edit the file Activity Class. First, you must add the appropriate import statement for the Log class:
import android.util.Log;
Next, within the Activity class, declare a constant string that you use to tag all logging messages from this class.You can use the LogCat utility within Eclipse to filter your logging messages to this debug tag:
private static final String DEBUG_TAG= “MyFirstAppLogging”;
Now, within the onCreate() method, you can log something informational:
Log.i(DEBUG_TAG, “Info about MyFirstAndroidApp”);
Now you’re ready to run your application. Save your work and debug it in the emulator.You notice that your logging messages appear in the LogCat listing, with the Tag field MyFirstAppLogging as shown below.
Tip:
You might want to create a LogCat filter for only messages tagged with your debug tag. To do this, click the green plus sign button in the LogCat pane of Eclipse. Name your filter Just MyFirstApp, and fill in the Log Tag with your tag MyFirstAppLogging. Now you have a second LogCat tab with only your logging information shown.
Posted in Android, Java, Open Source.
– May 20, 2012
This site contains the pretty good usages of the avd commands for create, update, delete and move -avd.
http://wrestlingmind.blogspot.com/2009/08/more-commands-on-avd-to-create-delete.html
The deleting the avd that I have to come across can be achieved by:
android/android-sdk-linux_x86/tools$ ./android delete avd -n avd2.2
here, avd2.2 is the name of my avd, I wish to delete.
Check avd manager, avd2.2 should be deleted.
– May 11, 2012