Monday, December 27, 2010

Huge Rose

MashaAllah! This one has a 'Sarbat' fragrance too.





 

 

Tuesday, August 24, 2010

Android Web Gallery Example

I’ve been dabbling since last Friday with Android development. So far, I’ve already released one app on the marketplace because its pretty straight-forward to get something done on the Android platform.

My next challenge was to implement a picture gallery app and I found the following example:

http://www.androidpeople.com/android-gallery-imageview-example/

Also found an example of how to fetch images from the Web:

http://www.androidpeople.com/android-load-image-from-url-example/

So, all I needed to do was merge the two together…

main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ImageView android:id="@+id/ImageView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>

webGalleryExample.java
package za.co.mtn.webGalleryExample;

import java.io.InputStream;
import java.net.URL;

import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.AdapterView.OnItemClickListener;

public class GalleryExample extends Activity {
private String[] jamCamURLs = {
http://path.to.image1.jpg”,
http://path.to.image2.jpg”,
http://path.to.image3.jpg”,

};
Drawable[] drawablesFromUrl = new Drawable[3];
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
for (int i = 0; i < drawablesFromUrl.length; i++){
drawablesFromUrl[i] = LoadImageFromURL(jamCamURLs[i]);
}
final ImageView imgView = (ImageView)findViewById(R.id.ImageView01);
imgView.setImageDrawable(drawablesFromUrl[0]);
Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(new ImageAdapter(this));

g.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
imgView.setImageDrawable(drawablesFromUrl[position]);
}
});
}
private Drawable LoadImageFromURL(String url)
{
try
{
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
}catch (Exception e) {
System.out.println("Exc="+e);
return null;
}
}
/*public static boolean StoreByteImage(Context mContext, byte[] imageData,
int quality, String expName) {

File sdImageMainDirectory = new File("/sdcard/myImages");
FileOutputStream fileOutputStream = null;
String nameFile = null;
try {

BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 5;
Bitmap myImage = BitmapFactory.decodeByteArray(imageData, 0,
imageData.length,options);

fileOutputStream = new FileOutputStream(
sdImageMainDirectory.toString() +"/" + nameFile + ".jpg");
BufferedOutputStream bos = new BufferedOutputStream(
fileOutputStream);

myImage.compress(CompressFormat.JPEG, quality, bos);

bos.flush();
bos.close();

} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return true;
}*/

public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
private Context mContext;

public ImageAdapter(Context c) {
mContext = c;
TypedArray a = obtainStyledAttributes(R.styleable.JamCam);
mGalleryItemBackground = a.getResourceId(
R.styleable.JamCam_android_galleryItemBackground, 0);
a.recycle();
}

public int getCount() {
return jamCamURLs.length;
//return mImageIds.length;
}

public Object getItem(int position) {
return position;
}

public long getItemId(int position) {
return position;
}

public View getView(int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(mContext);

i.setImageDrawable(drawablesFromUrl[position]);
i.setLayoutParams(new Gallery.LayoutParams(70, 57));
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setBackgroundResource(mGalleryItemBackground);

return i;
}
}
}

And voila!


Monday, August 23, 2010

The Mountain

[caption id="" align="alignnone" width="422" caption="Dude, its the mountain. Like fully. Wicked."]uhhh, like where's mountain dude? [/caption]

Table Mountain Live Webcam

Tuesday, June 15, 2010

Howto: Vuvuzela filter using Linux (Ubuntu)

By now there are more than a few bog posts like this on how to filter out the resonant frequencies produced by the vuvuzela.

I wasn't too happy with any of them and thought I'd share what I came up with after some tinkering.

For the impatient:

To install required tools:
sudo apt-get install sox

To test:
play vuvuzela.wav vol 0.9 bandreject 116.56 3.4q bandreject 233.12 3.4q bandreject 466.24 3.4q bandreject 932.48 3.4q bandreject 1864 3.4q

The test file can be downloaded here.

My starting point for this was a post by Russell Beattie, where he describes his attempts at using SoX.

You can test both approaches (using an equalizer vs. using a band-reject filter), and I think the latter does a better job. I also used slighty more accurate frequencies as suggested here and added an additional lower resonant frequency at 116.56 because I could still here a faint toot.

Russell chose to use Octave to define the width around the central frequency that is removed (.1o), whereas I prefer using the Q-factor as did the original German Blog post on this subject (3.4q)

To use:
rec -d|play -d vol 0.9 bandreject 116.56 3.4q bandreject 233.12 3.4q bandreject 466.24 3.4q bandreject 932.48 3.4q bandreject 1864 3.4q

Assuming your default sound input source is the your line-in or tv-tuner.

Updated: I updated the fundamental and harmonics as per this site.

Updated again: The above update should have been better, theoretically, but it isn't.

Vuvuzela Frequencies

Fundamental: 232.4 Hz

Harmonic 1: 464.8

Harmonic 2: 697.2

Harmonic 3: 929.6

Harmonic 4: 1162

Harmonic 5: 1394.4

Harmonic 6: 1626.8

Harmonic 7: 1859.3

Friday, April 30, 2010

Thursday, April 15, 2010

South African poor Service levels extend to the Web too.

One of the reasons that I was most keen to adopt Online shopping was that I would not have to deal with the typically pathetic service levels that we South Africans have come to expect as the norm. Whether its the company tuck shop or the post-office, we all know the frustration experienced while staring at the totally unenthusiastic person behind the counter, as she avoids looking at you, clicks on her chewing gum, has a conversation with her co-workers and decides to have an impromptu tea break when you finally get to the front of the queue. Have you seen the look on the faces of foreigners when they 1st encounter our sales people?

Anyway, I’ve made a few purchases online from various providers including Amazon, eBay etc. and have had nothing but good experiences, until now…

If I had to choose which of the outlets in South Africa have the worst service and have the people with the worst attitude, there would be many contenders, but one clear winner: The South Africa Post Office. And, much to my dismay, I’ve discovered that they’ve tried so hard to be bad, that they’ve actually provided the same disservice via the Internet too!

Long story short, I ordered an item from the online store eXpansys South Africa. The item had an estimated shipping time of 7-10 days, which I confirmed telephonically (the agent confirmed that they had stock). 2 Weeks later and all I had was email confirmation of the order and payment, even after asking for information via their email based tracking system. 13 days later after, I received a Speed Services Courier (powered by non other than South African Post Office) tracking code. And then, nothing.

The tracking system on the Speed Services Courier website showed that the item was received and nothing else, till today, almost a month later.

After several calls to eXpansys and SAPO, I’ve discovered that the item was stolen and that an enquiry will have to be initiated by eXpansys.

So, that’s the last time I order anything from eXpansys or anyone that uses Speed Services Courier to deliver items. Even though the theft is probably SAPO’s issue, eXpansys could have handled it much better by actually replying to emails to their tracking system and informing me of what was going on. Naughty eXpansys, naughty.

Sunday, April 11, 2010

3d TV? I think not!

I watched "How to train your dragon" this weekend, in "3D".

But it wasn't really 3D... Awesome as it was, all that I really perceived was... depth.

Yep, my eyes were fed the necessary extra information required for it to work out the relative distances of objects in the movie.

Is that 3D? Or is that true 1D? The much talked about next generation of TVs will also be True 1D and no more I'm afraid.

I know I'm bein pedantic, but in all honesty, I just want to make sure that we get the terminology right up front. I will not be satisfied until we truly have 3D.

So what will True 3D be? The answer is actually visible in another True 1D movie: Avatar. The control desk showing the layout of the forest, used by the planners, now that is 3D.

True 3D for me, is the representation of an image on all spacial planes. One should be able to view a scene from at least 5 viewpoints, if the bottom up view is left out. The 3D tv of the future will not be mounted on the far wall. It will be mounted on the coffee table in the center instead. You will get a different view depending on which side of it you are.

Best part is that you will like not require special glasses to trick youe eyes into perceiving depth, because the depth will be a side effect of the fact that the image is projected in a 3 dimensional space.

So, Sony, Samsung, LG, if you're reading this, how about considering a change in name for your upcoming technology? It will give us something to look forward to after True 1D becomes the norm.

Thursday, April 01, 2010

BREAKING NEWS: Time Travel theories disproved in simple blog experiment.

It's official. We can all let go of those fantastic idea's of going back in time to fix mistakes of the past or passing back information such as lottery numbers and share prices.

Marty McFly has not visited unfortunately and if you've read my previous blog post you would have realised by now that all is lost in this field of theoretical physics.

Just in case any Time Travelling wannabe attempted to dupe me into believing that he/she was from the future, I left out one important part of my (ingenious) plan; A password: wormhole

The password is only mentioned in this post, which only a true Time Traveller would've had access to while reading the previous post, before today. You know what I mean.

So there, scientists, theoretical physicists, bored engineers and the like, you can cross off one waste of time theory and concentrate on something with more substance, like teleportation now.

Wednesday, March 31, 2010

Calling all time travellers.

It's time to end all debate on time travel. Here and now. With this blog post, I aim to settle the matter of time travel once and for all.

 
Dear Time Traveller.

I'm guessing that prior to having invented time travel, you 1st embarked on a literature survey. I'm also hoping that Google still exists, whenever you are and that this blog post is still archived somewhere. I'm also hoping that the millions of readers that read my blog have raised the Page Rank of this post significantly so that you would have found it during your literature survey.

If you are about to embark on some time travel adventure, I want you to please set your destination clock to a time that allows you the opportunity to convince me that it is possible. You will need to travel down to now (check post date and time), and to Johannesburg, South Africa, and come say hello. If you do, I will update this post, verifying that Time Travel is indeed possible.

If however you don't make it, Time Travel shall, in 24 hours time, be deemed impossible. Humanity will give up hope in the possibility and either you or your project will no longer exist as a result.

Your clock starts now.

Wednesday, February 17, 2010

FIFA World Cup 2010 stadium construction, time lapse video

Fifa World Cup 2010 Stadium Construction, Moses Mabhida Stadium, by MTN

My 1st video upload to Youtube..

Monday, February 08, 2010

Thursday, January 28, 2010

Tuesday, January 12, 2010

I want an Android handset so badly that...I'll write a blog post for it.

And here it is. The blog post I mentioned.

All of this so that I can win the OpenMoko handset from WebAddiCTs

Now all I need to do is provide a link:
http://www.webaddict.co.za/2010/01/04/win-a-google-android-phone-here/