Oct 132011
 

Recently I’ve had to pull out sites and subnets from AD in order to match an IP Address against the subnet that I pulled out to determine whether a workstation is in that site.
I ran into some issues trying to do it in JScript because for some strange reason, the Description attribute for all the subnets is an array, so I had to convert it from a VB array to a Javascript array.

Now, onto the code I used –

First up, is setting up the ADO Connection.

var objRootDSE = GetObject("LDAP://RootDSE");
var strDomain = objRootDSE.Get("configurationNamingContext");
var objConnection = new ActiveXObject("ADODB.Connection");
objConnection.Provider="ADsDSOObject";
objConnection.Open("ADs Provider");
var objCommand = new ActiveXObject("ADODB.Command");
objCommand.ActiveConnection = objConnection;

All that does is setup the connection to AD and open up the connection using the ADs Provider.

Next up, is to run the query which will return all the Subnets within AD.

var Dom = "LDAP://CN=subnets,CN=Sites,"+strDomain;
objCommand.CommandText = "select cn,Name,Location,Description from '"+Dom+"'";
objSiteRecordSet = objCommand.Execute();

This will return a recordset with all subnets and their descriptions and locations.

After that, a simple case of enumerating the recordset to get what we need out of it.
In this example, I have returned just Name and Description, which means that in the earlier query, I needn’t have query all 4 attributes.

while(!(objSiteRecordSet.EoF)) {
var Desc = '';
var IPRange = objSiteRecordSet.Fields('Name').Value;
var Desc = objSiteRecordSet.Fields('Description').Value;
if(Desc == null) {
Desc = IPRange;
} else {
Desc = VBArray(Desc).toArray();
}
var result = [IPRange,Desc];
arrSites.push(result);
objSiteRecordSet.MoveNext;
}

In that code, the results are pushed into the arrSites array to be used elsewhere or to be returned depending on what you’re doing with the data.

Share
Oct 082011
 

As I recently posted, I also changed my boot screen on my HTC Desire, this is the second screen that comes up when you turn on the phone and is normally animated.

With the Telstra HTC Desire, the normal methods of putting a “bootanimation.zip” file into /system/media never worked for me, even after I rooted the phone.
I found out that the Telstra HTC Desire has a file in /system/customize/CID called default.xml which contains a set of lines starting with and ending with which sets the boot up animation on the Telstra HTC Desire.
Removing those lines from the default.xml file will allow you to put the “Bootanimation.zip” file into /system/media and the android_audio.mp3 file into the same location.
Once the files have been placed there, you will now get the new bootanimation instead of the Telstra boot animation.

Share
Oct 082011
 

I recently got the Android Modding bug, and wanted to change my Telstra HTC Desire’s splash screen.

This is the first screen that comes up when you turn on the phone, which is then followed by the boot animation, which I have also changed.
To do this, you will need to S-OFF your phone first, which will void your warranty.
Windows users will also need the Android SDK to get the fastboot tool that is used to flash the new bootscreen to the phone.
Linux users will either have to compile it from source or find it online as it’s not included in the SDK for some strange reason.

I used this Revolutionary to get S-OFF on my phone.
** I AM NOT RESPONSIBLE FOR ANYTHING THAT HAPPENS TO YOUR PHONE IF THIS IS ATTEMPTED **

With that out of the way, onto the fun bits.
Once the phone is S-OFFed, you will need to find or create a suitably sized BMP file to use as the splash screen.
For a Desire, this should be 480×800.
Once you have the image ready, use This tool – nbimg to convert the BMP file into one that is usable by the phone as a splash screen.

Once the image is converted, you will need to boot the phone into fastboot mode.
This involves powering it off, then holding down the volume down button while you power it back on.
While it’s powering on, plug the usb cable into the computer.

Once the phone is in the boot menu, which has a white background and little android robots on skate boards, you will need to select the top selection which should say “HBOOT” and press power. This should make it turn red and say “FASTBOOT” now.

Once it’s in fastboot mode, run this command from where the converted image and nbimg resides –
fastboot flash splash1 splash1.img
You will need to replace “splash1.img” with the filename of your splash screen.
It should output something like

sending 'splash1' (750 KB)... OKAY [ 0.125s]
writing 'splash1'... OKAY [ 0.218s]
finished. total time: 0.343s

Which means that you now have a new splash screen.
Select reboot in the menu and you should now see your new splash screen.

Share
Oct 082011
 

A few months ago, I had a post detailing how to setup a streaming webcam server.


Advertisement

How to make your Android device work like your business Desktop? Try a vdi in the cloud from one of the best Daas provider – www.Apps4Rent.com to store/stream and share your gigs.


Recently, I found an Android app that let me view it on my mobile phone as well which let me use the camera as a baby cam.
The app is called “Tinycam Monitor” and comes in a free and a paid version.
You can use the free version to do stream the webcam but if you like it, please get the paid version to support the developer :).

So, step 1 is to first get the application onto your phone.
This can be done from the market just like any other application.

Step 2 is to configure the app to view the webcam stream.
Once you open the application, in the main menu touch “Manage cameras”

Remove any default cams that may be there, then hit menu and press on “Add camera”
You will see a new camera come up in the list, touch on the pencil to edit the camera.
In the camera options, go down to “Advanced Settings” and edit the parameter
Edit JPEG image address needs to be set to your webcam stream that you setup in the previous post.
For Example : http://10.0.0.1/webcam.mjpeg

Once that is entered, hit back, and press “Camera Status” to ensure that you can connect to the camera.
Once that is succesful, you can now view your webcam stream on your Android phone via the app.


Advertisement

How to make your Android device work like your business Desktop? Try a vdi in the cloud from one of the best Daas provider – www.Apps4Rent.com to store/stream and share your gigs.


Share