"this guide helps you to share your dsl/cable internet connection without a need of a wireless router using only a windows vista laptop that has a wifi adhoc capabilities
1st: go to control panel and hit on networking. click on manage connections and setup a new wifi adhoc network and for example we'll name it "wireless"
2nd: after your name the network profile its for you to have it secure or not.
3rd:save your network
4th: go to task scheduler and create a task name it as 'automatic adhoc'
5th: the program you need to run is called netsh.exe(you can find this at c:/windows/system32/)and add this following
command "wlan connect name=profilename" without the quotes ok. change the profilename into wireless
6th: do not start in windows startup but choose to start it in windows logon
7th: now you're good to go. everytime you turn on your laptop you can share it in you neighborhood" myownblogtech.blogspot.com
August 26, 2009
August 25, 2009
[cmd]Batch - Filename Parameter Extensions
"When a parameter is used to supply a filename then the following extended syntax can be applied:
we are using the variable %1 (but this works for any parameter)
%~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt
%~d1 - expands %1 to a Drive letter only - C:
%~p1 - expands %1 to a Path only - \utils\
%~n1 - expands %1 to a file Name, or if only a path is present - the last folder in that path
%~x1 - expands %1 to a file eXtension only - .txt
%~s1 - changes the meaning of f, n and x to reference the Short name (see note below)
%~1 - expand %1 removing any surrounding quotes (")
%~a1 - display the file attributes of %1
%~t1 - display the date/time of %1
%~z1 - display the file size of %1
%~$PATH:1 - search the PATH environment variable and expand %1 to the fully qualified name of the first match found.
The modifiers above can be combined:
%~dp1 - expands %1 to a drive letter and path only
%~nx2 - expands %2 to a file name and extension only" ss64.com
we are using the variable %1 (but this works for any parameter)
%~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt
%~d1 - expands %1 to a Drive letter only - C:
%~p1 - expands %1 to a Path only - \utils\
%~n1 - expands %1 to a file Name, or if only a path is present - the last folder in that path
%~x1 - expands %1 to a file eXtension only - .txt
%~s1 - changes the meaning of f, n and x to reference the Short name (see note below)
%~1 - expand %1 removing any surrounding quotes (")
%~a1 - display the file attributes of %1
%~t1 - display the date/time of %1
%~z1 - display the file size of %1
%~$PATH:1 - search the PATH environment variable and expand %1 to the fully qualified name of the first match found.
The modifiers above can be combined:
%~dp1 - expands %1 to a drive letter and path only
%~nx2 - expands %2 to a file name and extension only" ss64.com
August 17, 2009
[SOLVED]Eclipse and .svn Android AIDL Problem
Today after adding my android project to svn repository I got
syntax error entries /src/.svn line 1 Android AIDL Problem
After searching internet for solutions I installed subversion plug-in (did not helped) but this...
It is worked for me:
- Delete your project from eclipse (not from disk).
- "File"->"New.."->"Project"->"Android Project"
- in "New Adroid Project"-Dialog selected "create project from existing source" (find your project on HDD)->"Finish"
my .classpath-file
<?xml version="1.0" encoding="UTF-8"?><classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/></classpath>
August 11, 2009
Android ImageLoader - load images sequencially in the background
"A few days ago I started to learn android… and it’s been a fairly smooth transition from flash. Although I have to say, as flash developers we’re just spoiled. We take for granted all the background stuff flash does for us to make coding that much easier.
One of those things is Loading images. in flash we have the Loader class which makes loading images very easy.
var loader:Loader = new Loader();
loader.load(new URLRequest("myimage.jpg"));
In java/android it takes a few more lines
HttpURLConnection conn = (HttpURLConnection) new URL("myimage.jpg").openConnection();
conn.setDoInput(true);
conn.connect();
InputStream inStream = conn.getInputStream();
Bitmap bitmap = BitmapFactory.decodeStream(inStream);
inStream.close();
conn.disconnect();
The code above runs in the same thread so you’ll lock up your UI until the image has finish loading. Adding the Threading code adds quite a bit more code. So I decided to create an ImageLoader class to make my life just a little easier. Now I can load an image to an ImageView with one line of code.
ImageLoader.getInstance().load(myImageView, "myimage.jpg", true);
The last parameter tells the ImageLoader class to cache that the bitmap.
The ImageLoader class loads images sequentially so you don’t slow your mobile device down to a crawl. To cancel Loading simply call clearQueue() and to clear the cache call clearCache()
Here’s the class
package com.wumedia.net;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.widget.ImageView;
public class ImageLoader {
static private ImageLoader _instance;
static public ImageLoader getInstance() {
if (_instance == null) {
_instance = new ImageLoader();
}
return _instance;
}
private HashMap _urlToBitmap;
private Queue _queue;
private DownloadThread _thread;
private Bitmap _missing;
private boolean _busy;
/**
* Constructor
*/
private ImageLoader () {
_urlToBitmap = new HashMap();
_queue = new LinkedList();
_busy = false;
}
public Bitmap get(String url) {
return _urlToBitmap.get(url);
}
public void load(ImageView image, String url) {
load(image, url, false);
}
public void load(ImageView image, String url, boolean cache) {
if (_urlToBitmap.get(url) != null) {
if(image!=null) {
image.setImageBitmap(_urlToBitmap.get(url));
}
} else {
image.setImageBitmap(null);
queue(image, url, cache);
}
}
public void queue(ImageView image, String url, boolean cache) {
Iterator it = _queue.iterator();
if (image!=null) {
while (it.hasNext()) {
if (it.next().image.equals(image)) {
it.remove();
break;
}
}
} else if (url!=null) {
while (it.hasNext()) {
if (it.next().url.equals(url)) {
it.remove();
break;
}
}
}
_queue.add(new Group(image, url, null, cache));
loadNext();
}
public void clearQueue() {
_queue = new LinkedList();
}
public void clearCache() {
_urlToBitmap = new HashMap();
}
public void cancel() {
clearQueue();
if ( _thread != null ) {
_thread.disconnect();
_thread = null;
}
}
public void setMissingBitmap(Bitmap bitmap) {
_missing = bitmap;
}
private void loadNext() {
Iterator it = _queue.iterator();
if (!_busy && it.hasNext() ) {
_busy = true;
Group group = it.next();
it.remove();
// double check image availability
if (_urlToBitmap.get(group.url) != null) {
if (group.image!=null) {
group.image.setImageBitmap(_urlToBitmap.get(group.url));
}
_busy = false;
loadNext();
} else {
_thread = new DownloadThread(group);
_thread.start();
}
}
}
private void onLoad() {
if (_thread != null) {
Group group = _thread.group;
if (group.bitmap != null) {
if (group.cache) {
_urlToBitmap.put(group.url, group.bitmap);
}
if (group.image != null) {
group.image.setImageBitmap(group.bitmap);
}
} else if (_missing != null) {
if (group.image != null) {
group.image.setImageBitmap(_missing);
}
}
}
_thread = null;
_busy = false;
loadNext();
}
private class Group {
public Group(ImageView image, String url, Bitmap bitmap, boolean cache) {
this.image = image;
this.url = url;
this.bitmap = bitmap;
this.cache = cache;
}
public ImageView image;
public String url;
public Bitmap bitmap;
public boolean cache;
}
private class DownloadThread extends Thread {
final Handler threadHandler = new Handler();
final Runnable threadCallback = new Runnable() {
public void run() {
onLoad();
}
};
private HttpURLConnection _conn;
public Group group;
public DownloadThread(Group group) {
this.group = group;
}
@Override
public void run() {
InputStream inStream = null;
_conn = null;
try {
_conn = (HttpURLConnection) new URL(group.url).openConnection();
_conn.setDoInput(true);
_conn.connect();
inStream = _conn.getInputStream();
group.bitmap = BitmapFactory.decodeStream(inStream);
inStream.close();
_conn.disconnect();
inStream = null;
_conn = null;
} catch (Exception ex) {
// nothing
}
if (inStream != null) {
try {
inStream.close();
} catch (Exception ex) {}
}
disconnect();
inStream = null;
_conn = null;
threadHandler.post(threadCallback);
}
public void disconnect() {
if (_conn != null) {
_conn.disconnect();
}
}
}
}
" wu-media.com
One of those things is Loading images. in flash we have the Loader class which makes loading images very easy.
var loader:Loader = new Loader();
loader.load(new URLRequest("myimage.jpg"));
In java/android it takes a few more lines
HttpURLConnection conn = (HttpURLConnection) new URL("myimage.jpg").openConnection();
conn.setDoInput(true);
conn.connect();
InputStream inStream = conn.getInputStream();
Bitmap bitmap = BitmapFactory.decodeStream(inStream);
inStream.close();
conn.disconnect();
The code above runs in the same thread so you’ll lock up your UI until the image has finish loading. Adding the Threading code adds quite a bit more code. So I decided to create an ImageLoader class to make my life just a little easier. Now I can load an image to an ImageView with one line of code.
ImageLoader.getInstance().load(myImageView, "myimage.jpg", true);
The last parameter tells the ImageLoader class to cache that the bitmap.
The ImageLoader class loads images sequentially so you don’t slow your mobile device down to a crawl. To cancel Loading simply call clearQueue() and to clear the cache call clearCache()
Here’s the class
package com.wumedia.net;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.widget.ImageView;
public class ImageLoader {
static private ImageLoader _instance;
static public ImageLoader getInstance() {
if (_instance == null) {
_instance = new ImageLoader();
}
return _instance;
}
private HashMap _urlToBitmap;
private Queue _queue;
private DownloadThread _thread;
private Bitmap _missing;
private boolean _busy;
/**
* Constructor
*/
private ImageLoader () {
_urlToBitmap = new HashMap();
_queue = new LinkedList();
_busy = false;
}
public Bitmap get(String url) {
return _urlToBitmap.get(url);
}
public void load(ImageView image, String url) {
load(image, url, false);
}
public void load(ImageView image, String url, boolean cache) {
if (_urlToBitmap.get(url) != null) {
if(image!=null) {
image.setImageBitmap(_urlToBitmap.get(url));
}
} else {
image.setImageBitmap(null);
queue(image, url, cache);
}
}
public void queue(ImageView image, String url, boolean cache) {
Iterator it = _queue.iterator();
if (image!=null) {
while (it.hasNext()) {
if (it.next().image.equals(image)) {
it.remove();
break;
}
}
} else if (url!=null) {
while (it.hasNext()) {
if (it.next().url.equals(url)) {
it.remove();
break;
}
}
}
_queue.add(new Group(image, url, null, cache));
loadNext();
}
public void clearQueue() {
_queue = new LinkedList();
}
public void clearCache() {
_urlToBitmap = new HashMap();
}
public void cancel() {
clearQueue();
if ( _thread != null ) {
_thread.disconnect();
_thread = null;
}
}
public void setMissingBitmap(Bitmap bitmap) {
_missing = bitmap;
}
private void loadNext() {
Iterator it = _queue.iterator();
if (!_busy && it.hasNext() ) {
_busy = true;
Group group = it.next();
it.remove();
// double check image availability
if (_urlToBitmap.get(group.url) != null) {
if (group.image!=null) {
group.image.setImageBitmap(_urlToBitmap.get(group.url));
}
_busy = false;
loadNext();
} else {
_thread = new DownloadThread(group);
_thread.start();
}
}
}
private void onLoad() {
if (_thread != null) {
Group group = _thread.group;
if (group.bitmap != null) {
if (group.cache) {
_urlToBitmap.put(group.url, group.bitmap);
}
if (group.image != null) {
group.image.setImageBitmap(group.bitmap);
}
} else if (_missing != null) {
if (group.image != null) {
group.image.setImageBitmap(_missing);
}
}
}
_thread = null;
_busy = false;
loadNext();
}
private class Group {
public Group(ImageView image, String url, Bitmap bitmap, boolean cache) {
this.image = image;
this.url = url;
this.bitmap = bitmap;
this.cache = cache;
}
public ImageView image;
public String url;
public Bitmap bitmap;
public boolean cache;
}
private class DownloadThread extends Thread {
final Handler threadHandler = new Handler();
final Runnable threadCallback = new Runnable() {
public void run() {
onLoad();
}
};
private HttpURLConnection _conn;
public Group group;
public DownloadThread(Group group) {
this.group = group;
}
@Override
public void run() {
InputStream inStream = null;
_conn = null;
try {
_conn = (HttpURLConnection) new URL(group.url).openConnection();
_conn.setDoInput(true);
_conn.connect();
inStream = _conn.getInputStream();
group.bitmap = BitmapFactory.decodeStream(inStream);
inStream.close();
_conn.disconnect();
inStream = null;
_conn = null;
} catch (Exception ex) {
// nothing
}
if (inStream != null) {
try {
inStream.close();
} catch (Exception ex) {}
}
disconnect();
inStream = null;
_conn = null;
threadHandler.post(threadCallback);
}
public void disconnect() {
if (_conn != null) {
_conn.disconnect();
}
}
}
}
" wu-media.com
Subscribe to:
Posts (Atom)