Converting ASP Classic to PHP5

I posted a while ago that I added a page with ASP Classic to show your current IP. This worked because the site was being hosted in IIS with ASP.NET, ASP Classic, and PHP all enabled but I have now moved to a PHP only host and wanted to quickly get the IP lookup working again (I use it quite often).

I can potter around with PHP and would be able to figure it out but I did a quick search to find a converter and discovered this great online tool which did the work for me!

Here’s the original code.

<%@Language="VBScript"%>
<%
If Request.QueryString("debug") = "1" Then
  Response.Write("<pre>")
  For Each x in Request.ServerVariables
    Response.Write(X & " = " & Request.ServerVariables(X) & vbCrLf)
  Next
  Response.Write("</pre>")
Else
  If Len(Request.ServerVariables("HTTP_X_FORWARDED_FOR")) = 0 Then
    Response.Write Request.ServerVariables("REMOTE_ADDR")
  Else
    Response.Write Request.ServerVariables("HTTP_X_FORWARDED_FOR")
  End If
End If
%>

 

Here’s the converted result.

<? 
if ($_GET["debug"] == "1") {
  echo "<pre>";
  foreach ($_SERVER as $x) {
    echo $X." = ".$_SERVER[$X]."\r\n";
  }
  echo "</pre>";
}
else {
  if (strlen($_SERVER["HTTP_X_FORWARDED_FOR"]) == 0) {
    echo $_SERVER["REMOTE_ADDR"];
  }
  else {
    echo $_SERVER["HTTP_X_FORWARDED_FOR"];
  }
}
?>

 

It works exactly the same as before but this time it’s PHP. You can try it with the same link: What is my IP?

Review of Udemy Online Learning

At the start of 2018 Udemy ran a promotion where courses could be purchased for up to 95% off their original price so, naturally, I had to take advantage of this and picked up an The Complete Android N Developer Course by Rob Percival.

There are hundreds of courses available and I picked this one because I’ve been interested in making mobile applications for a long time but always found the YouTube videos clunky and disjointed to watch. Based on the high quality content provided by Rob in his Android course I picked up a few others on other topics and found that the overall quality of instructors on Udemy appears to be very high. They, or at least the ones I’ve found, take the time to enunciate clearly and speak at an appropriate pace even if English is not their native language which makes their topic much easier to follow and a pleasure to watch.

I will likely make a future post documenting a basic timer app being developed from start to finish or if I feel confident enough maybe even a simple game good enough for the Play store!

Teclast Master T10

I purchased this new tablet through GearBest which is an online retailer specialising in products from China. As you might expect, some things get lost in translation but on the whole this seems to have been a good purchase.

The price changes day by day and I managed to pick it up for £152 with about a 3 week wait. In fact I’m writing this review on the tablet right now.

 

 

 

The device itself is a good size, the screen is bright, it’s mostly responsive to touch, and is lightweight. There were some minor problems though:

  • There was no launcher installed. This meant there was no button to list all apps despite Launch3 apparently being installed. I managed to install it from the play store which seems to be fine.
  • Netflix says it isn’t compatible with this device and so cannot be installed from the Play store.
  • Ingress won’t load because it can’t find the location.
  • Apps will minimise if you double tap the fingerprint scanner which is in an awkward place to avoid.
  • It does not come already rooted.
  • There is one Chinese only app and it cannot be uninstalled. It is some sort of app hiding app from what I can read using Google Translate live translation from my phone’s camera.

Summary

It seems to be a decent device so far and is much easier to read articles and code on than my phone.

Christmas Shopping vs the High Street Business

I’ve almost finished buying gifts for everyone and I suddenly realised I hadn’t entered an actual shop. This year Amazon have almost completely fulfilled the festive shopping which can clearly put a big dent in high street sales. So why is this?

Ads on sites

Many websites have pop-up ads to entice you with special offers and instant discounts but these cover the content and instantly put me off. To make things worse, it seems that once a site has decided to have intrusive ads they go all out and include automatically playing video, newsletter signups, or even the dreaded auto-play audio.

These techniques not only send visitors scrambling for the back button but put them off from ever coming back. Not forgetting the mobile user who may be paying extra data charges simply for the privilege of having unwanted advertisements displayed.

Online shopping

Convenience is the most obvious reason that Christmas, or any, shopping is done online. It is now possible to ask someone what they would like for their birthday or the holidays and quickly order it so you don’t forget, all while pretending to have a casual conversation so they you can keep the gift a surprise.

The likes of Amazon use employ the use of shopping lists but, more than that, they track which products you have viewed and provide related suggestions. This is almost like an automatic, seemingly endless, shopping list of items that most likely will interest you.

Weather, Items, Location

Who really wants to be wandering around in the cold trying to carry gifts for the whole family? It’s just not possible to do in a single trip. What happens if you get out to your car and drop something breakable? How much time do you really want to spend travelling to a crowded place to choose from a limited selection and then fight your way back home through traffic? Physical shops lose out to the comfort of online shopping but always win in one important way: You can pick up and look at the potential gift.

Being able to touch, play with, sometimes open, or try on different items can help ensure you get the perfect present for that special someone so there are no disappointments on the day. In most shops you can usually find an assistant who will be willing to help and try to answer any questions you have about the product. The staff may not be able to beat the wider Internet on technical questions but that’s why you have a smartphone.

Conclusion?

Physical shops are unlikely to ever disappear but I think many would benefit from greater integration with the likes of Amazon, PayPal, or other services that can let them establish an online presence. The bigger names in the street have already done so but spare a thought for the small shops and maybe, if you can, take a visit and see what specialities they’re hiding in their offline world.

SQ10 Mini DV Camera from GearBest

It’s a nice little camera seemingly perfect to attach to your clothes while biking or whatever you want to record (though not waterproof). But the instructions are not in English!

Here’s some things I’ve found while trying to decipher the broken translation:

Getting Files / Using Webcam

Attaching the camera via the USB cable to your PC while the camera is OFF will let you manage the contents of the MicroSD card. Turning the camera ON will let you use it as a webcam. Transfer seemed to be quite slow over the USB cable reaching a maximum of 5.8MB/s.

Setting the Time

To set the time you need to create a file called TIMEREST.txt in the root of the drive with the new time then unplug from the PC and turn the camera on. The file must have the contents of the timestamp it should use like this:

20171118100800 Y

This is the year, month, day, hour, minute, second, SPACE, Y to show the timestamp or N to hide it. After doing this, Windows will tell you the drive needs to be repaired. This is fine and you can let Windows sort it out. It seems to be caused by the camera failing to delete the TIMEREST.txt file.

Recording Audio & Video at 720p

Hold the power button for two seconds and release. The solid-blue internal light will be visible from the hole where the SD card is. Press and release the power button once and that blue light will flash 3 times then go off. The device is now recording 5 minute long movies onto the card at 30fps in 1280×720 resolution with 512kbps audio at 32kHz.

Recording Audio & Video at 1080p

Hold the power button for two seconds and release. The solid-blue internal light will be visible from the hole where the SD card is. Press and release the mode button once. The blue and red lights will now be visible from the SD card slot. Press and release the power button once more to activate recording, the lights will flash three times then go off. The device is now recording 5 minute long movies onto the card at 30fps in 1920×1080 resolution with 512kbps audio at 32kHz.

Enable/Disable Night Vision

Hold the power button for two seconds and release. The solid-blue internal light will be visible from the whole where the SD card is. Now hold the power button down for two seconds and the red light will flash twice to indicate the infra red lamp is now switched on. Hold the power button down again for two seconds to turn off the lamp, the red light will flash twice to indicate success.

After turning the infra red lamp on for night vision you can then proceed to begin recording as explained above (either press the power button once to record 720p or press mode then power for 1080p).

Stop a Recording & Turn Off Camera

Press and release the power button once while recording. The lights will come on solidly. This means it’s stopped and you can then turn off the device by holding the power button down for 9 seconds.

AirFree F40 Silent Air Purifier

Having long suffered with hayfever I finally purchased an air purifier and have had good results. The AirFree F40 is wall mounted and completely silent. Totally silent, zero decibels, no sound at all. It’s not “very quiet” there is literally no sound produced by the device at all!

It is designed to be permanently switched on and works by using a heating element and natural convection to make air flow through the device. The heated chamber allegedly reaches 200 Centigrade and incinerates any floating particles thus breaking them down into their constituent elements (Carbon, etc…).

I thought this might increase the amount of dust but have so far found no problems with it. The external device does get very warm to the touch but it is cool enough to keep my hand on it so should not cause any problems with the wall or any nearby furniture.

My night time symptoms seem to have been eased by using a purifier and I’m finding it easier to get to sleep now. I definitely recommend trying one if you have hayfever and can keep the room sealed except for entering/leaving.

OpenKeychain and Your E-Mail Identity

A friend introduced me to the OpenKeychain app and explained just how easy it is too set up a key to encrypt and verify your messages.

First, install OpenKeychain from the Google Play store.

Go to Manage My Keys from the options button at the top right of the application.

Now choose Create My Key.

Follow the wizard through to the next few pages which ask for your email address, to specify a password for your key, and finally to actually create and upload it to the public key servers.

Be aware: Your email address will be available for everyone in the world to see if you synchronize with the Internet.

Now that you have your key you can share the public part with your contacts so they can email you securely!

I’m using K9 Mail to use my key with my email which is easy to setup, you simply go into your account settings then cryptography and tap “OpenPGP App” to select OpenKeychain.

Make sure to back up your key to your PC/cloud storage and never share the private key or your passwords!

Monzo Saves the Day!

I had an odd experience at a coffee stall where the barista charged my card then told me it failed and did it again. Both times I had to input my pin but he only gave me the receipt of the final transaction and kept the supposed failed one for himself.

This is dodgey behavior so I checked the Monzo app while I stood next to the cart drinking my coffee and sure enough he had double charged.

Less than 5 minutes later showing him & his manager the app I had my refund! All was handled very politely and swiftly and I believe it was an honest mistake but this proves to me the values of using my Monzo card and app.

If I had used a different card I’d never have known the problem had happened and been down £10!

Disney World Orlando Florida

If you find yourself in Florida and can get to Disney I recommend the Tower of Terror!

It’s a vertical thrill ride preceded by a short & spooky tour of the hotel’s history. Be sure to catch the start wars march too.

BE ADVISED!! Alcohol is very expensive in Disney. A double JD and Coke was almost $13 including tax. Walmart has regular prices so you can relax with your favourite booze by the pool back at the hotel 😝

American food in Disney is good and the burgers are far better than anything I’ve had in the UK. One thing to note is that US meals and snacks tend to be much sweeter than you might be used to, Starbucks frappucinos had much more sugar/sweetener and there are some oddly delicious combinations of food like the Sweet & Spicy Chicken Waffel available in the Magic Kingdom.

Tasty, tasty, syrupy waffle sandwhich thing!

The roller coasters are more bumpy and longer lasting than most in the UK which means they’re a lot better, even the water rapids ride has a sudden drop and you absolutely will get wet!

Many of the rides are very dark inside, sometimes so dark you can’t see anything at all while you’re being thrown about. This might be fun for some but I like to see the lighting effects going on and all the artwork/models around the rides.

The Dinosaur ride simulates a time traveling visit to the past when dinosaurs rolled the Earth. It is a tribute trip through time with great special effects and some surprising dinosaurs leaving it if the dark at you.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑