Author Archives: Carbonize

Change WiFi Identity/Hostname on Android

Android with attitudeJust a quick one about how to change the hostname of your Android device. By hostname I mean the name it identifies itself with when connecting to WiFi networks. The default name is usually something like android-dfac61527a005982 which is far from helpful. Stupid thing is iOS has let people set this since iOS 4.

Anyway on to the instructions. You will require Root access on your device and some way of opening and editing the build.prop file. I personally used ES File Explorer. Just remember to set system directory to RW. Now you need to go to the system directory of your phone. In ES this just means pressing the / at the top of the file list. Now open the system folder/directory  and scroll down to the build.prop file. Click on this and open it in a text editor and choose to edit it. Now add the following line to the end of the file

net.hostname=YOURDESIREDNAME

Save the file, reboot your phone and you’re done.

I got the instructions from a post by a user called portscan here.

If you prefer to use adb then you can find instructions here.

Beware of FTP Apps

FTPYesterday I received an email from my hosts saying they had received a report of email spam coming from my site. They said they had removed the offending script and suggested my site had been exploited. Like a good webmaster I logged in and checked my files. Nothing was amiss except a new directory with a random name like rbdfghydhf. I deleted the directory then started checking my server logs to see what requests had been made around the time the directory was created. I found nothing so began the process of deleting old files and scripts, which is something we should do regularly anyway.

So four hours later, after some Battlefield 4, I log back in to find a whole bunch of new directories had been made and again nothing in the logs to indicate how they were created. So I contacted my hosts and asked them to check the ownership of the directories and the files they contained. They eventually got back and told me they had been created via my FTP account from an an IP address in Poland, 77.114.120.185. Given my username and password are not simple things I scanned my computer to make sure it hadn’t been compromised. Two different anti virus programs and no malware found. Then I remembered that about a month or so ago I tested three FTP apps on my Android phone. One didn’t seem to work but the other two worked just fine after some messing with the settings. So by logical deduction I suspect this is how my account details got compromised. I checked the Play Store and only two of the three apps I tested are still listed which is another sign that this was the problem.

The moral of the story, if you need to FTP from your mobile device or anything else that requires your sites login details stick with trusted names or those that have a lot of reviews both good and bad. I was lucky but they could of done some serious damage.

Apologies

I must apologise to anyone who found themselves getting told they had been banned from my blog recently. I had installed a security mod and it logged 404s and banned anyone who triggered to many 404 errors. That’s fine on it’s own but it also changed the folder names so my uploaded images were no in a different place and any post with an image would result in your getting a 404 error.

Anyway all fixed now.

Animated Div Collapsing

A few years ago I was looking for a simple JavaScript to animate the hiding/showing of a div. I came across one that was perfect from harrymaugans.com but the site is currently undergoing a revamp so the original post is no longer there. Anyway the script was perfect but it had one issue, it required that the div’s height be already set and I was working with dynamically populated divs that I wouldn’t know the size of. My original solution was to loop through the divs I was going to hide and set their height to what their height currently was (if that makes sense) before hiding them with display: none;. Anyway I got sidetracked and I felt this solution was inadequate anyway so left it in my test folder. Jump to the present day. I started looking at it again and realised I can grab the original height of the div once it’s display had been changed back to block by the script and it’s height set to 1px ready for the sliding into view. The solution was simply to use scrollHeight which gets the height of a div including any hidden content such as when overflow is set to hidden.

I also added a new function, toggleSlide, which means instead of needing a link to call the slideDown and then one to call the slideUp you can just call toggleSlide and it will either slide it up or down depending on it’s current state.

And so I am offering my version of the script here since I think some people might be in the same boat as me and find my solution useful and also because the original source is no longer available.

Read more »

Use your website to help find missing children in EU

Do you run a website, blog or forum? Then you could help find children missing in Europe. Thanks to the NotFound project, you can make a difference. Install our application and a picture of a missing child automatically gets published on every ‘page not found’ of your website.

In the European Union alone, thousands of children are still missing. They run away from conflicts at home, are the victims of parental abductions, disappear after having travelled across the EU alone, or are abducted by criminals. But there is a way you can help, namely by installing the Notfound application. By doing this, automatically, a picture of a missing child will be posted on every 404 page of your website. This is how you can help Child Focus spread a maximum number of photos and help all missing children find their way home.

Discover the application on www.notfound.org.

Random Character Generation in PHP and JavaScript

I wrote this function in response to someone else’s attempt on a forum I was asked to join. It basically generates a string of random letters and numbers with the letters being in both upper and lower case. It is easy to edit it to only use upper or lower case letters or even add symbols as well. I initially wrote it in PHP and then rewrote it in JavaScript as well.

function randomString($strLen = 32)
{
  // Create our character arrays
  $chrs = array_merge(range('a', 'z'), range('A', 'Z'), range(0, 9));
 
  // Just to make the output even more random
  shuffle($chrs);
 
  // Create a holder for our string
  $randStr = '';
 
  // Now loop through the desired number of characters for our string
  for($i=0; $i< $strLen; $i++)
  {
    $randStr .= $chrs[mt_rand(0, (count($chrs) - 1))];
  }
  return $randStr;
}

Using it is simply a case of calling it and specifying how long to make the string otherwise it uses the default length of 32 characters.

echo randomString(12);

To also make it use symbols you just change the array_merge to
Read more »

Firefox 10 Aurora Add On Compatibility

So Firefox 8 has been released meaning Firefox 9 is now in beta and Firefox 10 is now on the Aurora channel. Trouble is, even if you are using compatibility reporter from the add ons site, most of your add ons will now be disabled. This is because compatibility reporter only supported up to Firefox 9. Anyway the fix is simple.

  1. Open a new tab
  2. Type about:config in the url bar and press enter
  3. Click the I’ll be careful, I promise! button
  4. Right click anywhere on the list that appears and select New then Boolean.
  5. For the preference name put extensions.checkCompatibility.10.0a and click OK
  6. Now select false and click OK
  7. Now do the same again but this time name it extensions.checkCompatibility.10.0
  8. Again set it to false.

Now close Firefox and when you restart all your extensions should be working again.

Sending email via SMTP using PHP

A couple of my users contacted me to say that their host had disabled sendmail and required any scripts they use to now use SMTP to send emails. This resulted in me quickly reading all I could about SMTP and the result is this slightly rough script I am sharing. It’s pretty self explanatory. Put your SMTP server details in the $mailCfg array. Next simply call the smtpMail function which uses the same variables as the standard PHP mail() function but with two additional variables. The additional variables are the email address we are sending from and $mailCfg. I could of put $mailCfg as a global but this way you can include the script in a different script and store the required information where ever you want. The from address is important as most SMTP servers will reject the message if it’s not included.

Just remember the code is far from perfect and was created to do a simple job.

It also has one nice extra function you might find useful… Read more »

Zuma Blitz on IE9

OK I’ve noticed a few people a searching for information about Zuma Blitz on IE9. I did notice this issue myself when I first tried IE9. The main problem is the hardware acceleration that comes turned on by default in IE9 which results in Zuma, and anything else Flash intensive, being really jerky and laggy unless you are on a pretty powerful computer. This is because both Flash and the web browser are using hardware acceleration and competing for your graphic cards processor. This also applies to Firefox 4. Anyway you can try to improve things by disabling the hardware acceleration in either the browser or in Flash.

To disable it in the browser go to Internet options by either clicking the gear cog on the right hand side of IE9s toolbar or go to your control panel. Once open click on the Advanced tab. The very first option is Use software rendering instead of GPU rendering* so tick that. You will then have to restart IE9. Hopefully Zuma Blitz will be a bit more tolerable now.

To disable it in Flash simply go to a web page that has Flash in it and right click on the flash. From the menu that appears select Settings… and then deselect the Enable hardware acceleration option.

So first try disabling one. If that doesn’t work re-enable the one you disabled and disable the other one. If it’s still jerky try disabling them both.

If all else fails you can always just uninstall IE9 and go back to IE8 or try one of the other browsers such as Firefox, Chrome or Opera.

Play MKV on Xbox 360

OK so I downloaded the first two episodes of Pioneer One which is a free to download mini series made for VoDo, which is a free video site. Unfortunately, like a lot of high definition (HD) video, it came in the MKV format which, unfortunately, the Xbox 360 does not support. Now the first thing you need to understand is that the video format is just a container. The actual video and audio inside the container can be exactly the same in a different container. Orange juice is still orange juice whether it’s in a glass or a cup. Anyway what we need to do is take the audio and video out of the MKV container and put it in to a container that the 360 can play such as mp4. I did a search for instructions on how to do this by searching for play MKV on Xbox 360 but the one I found required about 10 different programs. Admittedly the instructions on that page are from 2008. Mine is a lot simpler and requires just a single, portable, program called XMedia Recode. The site is in German but just click Download under where it says XMedia Recode Portable. Extract the contents of the zip file and run XMedia Recode.

Read more »

Post Popularity Graphing by Knowledge Ring