2013-12-12

Top 3 ways to disable high contrast and accessibility features in Windows 7

BEFORE FOLLOWING THIS GUIDE, make sure your users don't actually need this feature. High-contrast mode is very useful for some people. If you disable it for them, they will be pissed (I noticed several visitors got mad at me for writing this tutorial).

Working as a system administrator (among other roles) in an international school, we've got a lot of computers to manage here and kids never miss a chance to mess up with them. The latest trend is to enable high-contrast mode, basically making the computer turn black and white along with a bunch of other fluorescent colors. I don't need to remind you how annoying this is and why a more permanent solution needs to be found for this problem. Tip: you can quickly enable or disable high contrast mode by pressing Left Alt+Left Shift+Print Screen.

In this article, I am providing three different ways to permanently disable high-contrast mode. All have their pros and their cons, feel free to try each of them and let me know how this goes. A brief summary:
1. Disabling accessibility settings via GPO
2. Permanently removing access to "Utilman.exe" (accessibility tools)
3. Deleting or disabling high-contrast theme files so that they can't be enabled at all

Before going for any of these solutions, I strongly recommend that you ensure that your students weren't actually using high-contrast mode for legitimate reasons. These accessibility settings exist for a reason; you don't want to disable them if they're actually useful to someone!

Fix 1: Disabing accessibility settings via GPO

The safest solution is to deploy proper settings via GPO (Group Policy Objects). This is actually a pretty long and complex process if you aren't a big fan of GPOs, so I'll link you to a detailed article by Pete Long:  Disable High Contrast with Group Policy and disable Accessibility Options with Group Policy. Let me elaborate a bit with what I think are the pros and cons of this solution.
Pros:

  • This is the proper way to do it and it will resist system updates
  • There's probably no way kids or anyone will be able to bypass this
  • Automated deployment provided you're on a Active Directory domain
Cons:
  • Requires your computers to be on an Active Directory domain managed via Windows Server 2008 (or above)
  • Relatively complex to achieve, thankfully the tutorial makes it easier
Note that the article also provides a registry fix that will disable accessibility settings, but remember that they're per-user settings, so if a new profile is created on the computer, it will have be able to access these settings again. If all of the above doesn't work out for you, take a look at the two solutions below. Much easier to achieve, but definitely not as clean.

Fix 2: Permanently removing access to "Utilman.exe"

Desperate times call for desperate measures! If you don't have a proper way to deploy GPOs, try this instead. First, let me explain: what is "Utilman.exe"? It is the application that is launched when you click the accessibility button on the logon screen:


Since there isn't a proper option to hide this button altogether from the logon screen, we're going to have to disable the "Utilman.exe" file. It is located in C:\Windows\system32. If you attempt to delete it, you'll notice that you don't have permissions to do so, and can't even change the file security settings. That's because the owner of the file is "TrustedInstaller", a system account. Here is how you should proceed:
  1. Right-click the file and select "Properties"
  2. In the "Security" tab, click "Advanced"
  3. In the "Owner" tab, click "Edit..."
  4. Select your user account as file owner, and then close all these windows
  5. Right-click the file again and select "Properties", go to "Security" and "Advanced" again
  6. Change file permissions to give yourself full control over the file
Once that is done, you can rename the file, delete it or do whatever you want with it. When someone clicks the accessibility button from the logon screen, nothing will happen at all (not even an error message). There are of course pros and cons, be aware of them before you attempt this.
Pros:
  • Easy to achieve
  • Relatively fool proof
Cons:
  • The file might come back if a system file scan and repair is launched, or through a system update
  • Might not go down too well with overly nervous anti-virus software
  • Due to file ownership and permissions, this can't really be deployed automatically on multiple computers (at least I wouldn't know how to)

Fix 3: deleting high-contrast themes from the computer

Finally, if none of the above solutions prove to be efficient for you, there's also the option to delete high-contrast theme files from the computer. The themes will no longer be available to be enabled with the key combination, or through the accessibility settings, or even via the Theme selection control panel applet.
The files are located in: C:\windows\resources\Ease of access themes. Similar to the Utilman fix, it requires you to take ownership of the files before you can do anything with them.
  1. Right-click the "Ease of access themes" folder and select "Properties"
  2. In the "Security" tab, click "Advanced"
  3. In the "Owner" tab, click "Edit..."
  4. Select your user account as file owner, make sure to tick the box "Replace owner on subcontainers and objects", and then close all these windows
  5. Right-click the folder again and select "Properties", go to "Security" and "Advanced" again
  6. Change file permissions to give yourself full control over the folder and its sub-elements
Once that is done, you can merely delete the high-contrast theme files. The themes won't be available anywhere after that. Here's what I think the pros and cons are.
Pros:
  • Easy to achieve
  • Relatively fool-proof
  • Doesn't disable all accessibility settings, some of the other settings might actually be useful (this could also be listed as a 'con' though)
  • The files will probably not come back through a system update or a file system scan
Cons:
  • Again, deployment issues; I don't think this can be deployed automatically via a script or anything
Personally I've opted for fix 2 and 3 during the preparation of the system image that will be deployed to all computers at the beginning of the year. But if needs be, I may also have to resort to fix 1 in the future.

2013-10-28

Easiest way to transfer application settings across computers: AppMigrate

UPDATE October 2014: this application has been discontinued.

[Old article:]
This article presents you with the top 3 ways to migrate or transfer applications settings across computers. This will come in handy in situations such as:

  • when you buy a new computer and need to transfer your settings from your old computer to your new computer
  • when you want to replicate or send application settings to a friend or someone else
  • when you want to back up your settings in order to ensure you won't lose something if your computer were to break down somehow
The solution I'm going to present you is fully automated, free, and it's even open source so it's completely devoid of all risks regarding data privacy. It's a simple tool called AppMigrate.

Quick tutorial

First, head over to the official website and download the latest AppMigrate installer. Install the program and open it via the newly created shortcut in your start/home menu. A window appears showing you the list of programs that were detected on your computer. Initially, the list only shows applications that AppMigrate is able to export settings from:



Note: if you uncheck the "Supported apps only" button, you will see all the apps from your system, even those that AppMigrate doesn't support. Anyhow: using your mouse and/or your keyboard, select the applications you want to export settings from. When you're done making your selection, click the "Export selected" button. Select a folder where the settings packages will be stored, then click OK.



Restoring settings

Now, you're left with one or more .appmigrate package files (they are actually zip files, renamed). You can transfer them to another computer and import them by following the instructions below:
  • Install AppMigrate on your new computer
  • Either double-click on each settings package you want to import in the system (AppMigrate will open and import the package)
  • Or first open AppMigrate, then click the "Import packages" to import multiple files
You will be presented with a progress dialog...


Once the operation is complete you will be seeing a confirmation message. That's all! You have successfully migrated your application settings across computers.

Supported applications

Because of the ways applications store their settings (that is, in a non-generic way) AppMigrate doesn't support all the apps in the world; however there are already over a hundred major apps in the catalog. Here is the whole list as of November 2013:

µTorrent, 7-Zip, abgx360gui, Ad-Aware Antivirus, Adobe Photoshop CS5, AIM 7, AIMP3, Astrill, Audacity, Auslogics DiskDefrag, BitComet, CCleaner, CDBurnerXP, Classic Shell, Content Manager Assistant, Corel PaintShop Pro X6, Debut Video Capture Software, Devcoin, Digsby, Dolphin, Dolphin, Dolphin, DOSBox, eMule, Enso, FastStone Image Viewer, FileZilla, FlashGet, foobar2000, FormatFactory, Foxit Reader, Fraps, GIMP 2.8, GOM Player, Google Chrome, Google Talk, GrabIt, Greenshot, Growl, HandBrake, Hex Workshop, Hulu Desktop, HxD, ImgBurn, InfraRecorder, Inkscape, Inno Script Studio, Inno Setup, IrfanView, iTunes, iTunes, Jitsi, KeePass Password Safe, KMPlayer, Launchy, Litecoin, LiveStream Procaster, MagicISO, Malwarebytes Anti-Malware, MediaMonkey, Microsoft Visual C# 2010 Express, mIRC, Mozilla Firefox, Mozilla Thunderbird, MP4Joiner, MPC-HC, MultiBit, Notepad++, NVDA, OpenOffice, Opera, Oracle VM VirtualBox, Paint.NET, PCSX2, PeaZip, Picasa, Pidgin, Plex Media Server, PowerISO, Project64, PuTTY, puush, QQ2013, Rainlendar2, Safari, Skype, Songbird 2, SpeedFan, Spotify, Start8, SumatraPDF, Tango, TeamSpeak 3, TeamViewer 8, TeraCopy, Torch, Trillian, USB Image Tool, VirtualDub, VLC Media Player, Winamp, WinDirStat, WinMerge, WinRAR, WinSCP, XnView, Yahoo! Messenger.

Users can contribute to the application database by submitting their entries here.

2013-09-25

Nginx error 413: Request entity too large Quick Fix

A quick article today about a common error people encounter with Nginx: the infamous 413 Request Entity Too Large HTTP error. I had the problem myself just yesterday on one of my newly configured servers, so I thought I'd make a blog post about it to make sure I don't forget this next time.

Error 413: what does it mean?


This error shows up when a visitor sends too much data in the HTTP request. This is normally caused by:
• an overy large file being uploaded by the visitor
• more generally too much POST data being sent by the client
The fix is as simple as setting a directive in your Nginx configuration, read on below.


How to fix it? client_max_body_size

To fix this, you need to increase the value of the client_max_body_size directive. This directive defines the maximum amount of data Nginx will accept in an HTTP request. By default this value is set to 1 megabyte, meaning if you attempt to upload a file larger than 1 megabyte you'll be getting an Error 413: Request entity too large page. You can insert this directive at three levels:

  • In the http block: this will set the directive value for all server and locations in your configurationn
  • In the server block: this will set the directive value for all locations of one particular server
  • In the location block: this will set the directive value for one specific location in a particular server
In this example I'm going to insert it in my http block and set it to 500 megabytes:
http {
    client_max_body_size 500M; # allows file uploads up to 500 megabytes
    [...]
}


Anything else I need to do?

After changing your server configuration, don't forget to reload Nginx for the configuration to apply. There are also some configuration settings you need to change if you are using PHP. If you aren't, just ignore the rest of this post. You'll need to open your php.ini configuration file and look for two values:

  • upload_max_filesizeMaximum allowed size for uploaded files (default: 2 megabytes). You need to increase this value if you expect files over 2 megabytes in size.
  • post_max_sizeMaximum size of POST data that PHP will accept (default: 8 megabytes). Files are sent via POST data, so you need to increase this value if you are expecting files over 8 megabytes.

After making the changes, don't forget to reload PHP-FPM as well so that the changes are applied correctly. That's all! You shouldn't be getting any more upload errors after that.

2013-09-06

Top 5 fixes for: Excel 2013 has stopped working - also works for Word, Powerpoint, Outlook...

Recently I've started encountering a particularly annoying problem with Office 2013. Every time I'd open Excel 2013 under Windows 8, it would crash instantly, leaving me a message: "Excel 2013 has stopped working". I looked around and found a few solutions, but nothing worked for me. Eventually, I managed to fix the problem all by myself. I'm going to describe the steps that I've tried here. Note that this post is also valid for messages such as:
  • Word 2013 has stopped working
  • Powerpoint 2013 has stopped working
  • Excel 2013 has stopped working
  • Outlook 2013 has stopped working
  • Office 2013 has stopped working (insert any other Office tool here).
  • Most of these solutions are also valid for Office 2007 and Office 2010 applications.

Solution 1: change the default printer

This solution fixed all my problems, so I'm going to describe it first. Also it's the simplest! Try this first before anything else, because the next solutions are a bit more complex. What we're doing here is just changing the default printer. 

Why does this fix our problem? Because when you open an Office document, such as an Excel spreadsheet or a Word document, the application attempts to communicate with the printer to figure out the margins supported by the default printer. If that communication fails, the application (ie. Excel) crashes. All you have to do is change the default printer. Below is a quick guide to do that.

First, close all open Office applications such as Excel, Outlook and whatnot. Then, go to the "Devices and Printers" window. If you don't know how to open that, just go to the Control Panel and you'll find the "Devices and Printers" applet.


Righ-click on "Microsoft XPS Document Writer", for example, and choose "Set as default printer". Now open Excel again and voila: the document opens fine, and the margins are correctly defined.

Solution 2: start in safe mode, disable add-ins

While the above solution worked for me, I've also experienced add-in problems in the past; some add-ins caused some of my Office applications to crash for no apparent reason. So if the above fix doesn't help you, try this one, it's likely that this will work for you.

What we're going to do here: start Excel (or Word, Powerpoint, Outlook) in Safe Mode so that it doesn't load any add-in potentially crashing the application. Then from the Safe Mode we'll disable add-ins one by one and see if this helped.

To start one of these applications in safe mode, first press the Windows+R key combination to get to the "Run..." window:
In the text box that appears, type one of those commands depending on the application you're trying to fix:
  • Excel.exe /safe
  • Winword.exe /safe
  • Outlook.exe /safe
  • Powerpoint.exe /safe
Next, go to the "File" menu (the colored menu bar at the top left of the application that says "File"). Then in the menu on the left, click "Options". In the options window, click "Add-Ins" at the bottom. You should see a window like this:

 At the bottom of this window, there is a "Manage: [_____]" option list. Select "COM Add-ins", and click the button "Go..." that's just on the right. You'll be seeing a list of add-ins:


Make sure all boxes are unchecked, and press "OK". Restart the application normally and see if this fixed it for you. If it did; it's likely that one of these add-ins is causing the problem. Simply repeat this process and re-enable add-ins one by one until you find the one that's causing the issue.

Solution 3: start the application as Administrator

I've read that this solution worked for a couple of people, so I'm reporting the information here; hopefully this will help. Apparently in some cases all you need to do is start Excel/Word/Powerpoint/Outlook as Administrator in order to get permissions to do something on the computer. If you're using Windows 7, right-click the application in the Start Menu and click "Run as administrator". See if this works for you. 

In Windows 8, open the Home screen, find the application you're trying to open; right-click it and select "Open as administrator" at the bottom.


Solution 4: repair Office 2013

In some cases, it may just happen that one of the files necessary to the well-functioning of your Office 2013 applications has been damaged, deleted or corrupted after a brutal shutdown for example. So it might be useful to attempt an automatic repair. There's actually an option for that, and here's how to access it.

First, open the Control Panel, then select "Programs and Features". Find "Microsoft Office 2013" in the list, and click the "Change" button at the top:


You will be presented with an option to automatically "Repair" the Office 2013 program files, which might actually help towards fixing your problem.


Solution 5: fully uninstall and reinstall Office 2013

In the most severe cases, the only solution you'll have is to fully uninstall Office 2013 from your computer, wiping it clean of all tracks the programs might have left on your Windows set-up. Rest assured you won't need to do this manually; Microsoft are offering a program for that: an Office 2013 uninstaller. So just open this page-- click here, scroll down until you see this button:


Click it to begin downloading the uninstall tool. Once the uninstall is complete, restart your computer, then proceed to reinstalling Office 2013.

Conclusion

Microsoft did it again: they've managed to make an application suite as unstable as Internet Explorer! And they aren't even providing proper solutions for it, or even fixing the problem at all. If your Office 2013 apps still crash after you've tried all of the above, then sue Microsoft... just kidding, maybe ask for a refund I suppose. Also: if you've heard of any other solution to fix this sort of problem, please post a comment here and I'll see about integrating it in my post.

2013-09-03

Access a DBISAM database with PHP via ODBC

Recently I've been needing to access a DBISAM database created by third-party application, in order to export some of its data. Initially, I didn't even know what format the database was; I'd just found a bunch of files with the following extensions: .dat, .idx, .blb, .ibk, .bbk, and more. After a quick Google search, I stumbled upon a few pages that led me to DBISAM from Elevate Software. It's a proprietary database format that doesn't require a server application, somewhat similar to SQLite.

Accessing the database from PHP was quite complex because I didn't have a proper reference or blog article to detail the process. That's exactly why I'm writing this: to give people directions on a subject that's hardly documented at all. In this tutorial, you'll learn how to access the database via PHP, execute a simple SQL query, and display the result.

ODBC driver and connection

I almost forgot: there's a catch-- even two, and here's why. In order for PHP to be able to communicate with this proprietary database system, you'll need to install an ODBC driver. First catch: as far as I know, the driver is only available for Windows. Second catch: while you'll be able to download the trial version free of charge, it'll cost you $250 to get the full unlocked driver. Right now I'm using the trial version, and I'll probably purchase the retail product when the trial is over.

As I said, we're going to have to use Windows to access our DBISAM database, and I'd highly recommend WAMP for your web server/PHP setup. Begin by registering at Elevate Software and download the trial version of the ODBC driver the install it. To make sure it installed correctly, go to the Windows start menu and look for the "ODBC data sources" program, open the 32-bit version preferably. In the window that appears, click on the "Add..." button and you should see a window like this:


This is a list of data source drivers, among which you should find "DBISAM 4 ODBC Driver". Now we're not going to do anything with this for the time being -- we're just checking that the driver installed correctly; so just click "Cancel" and close the ODBC data sources program.

Connecting to the database

In order to be able to connect to an ODBC data source, your PHP setup must have the ODBC extension enabled. If you are using WAMP as I recommended previously, it should already be there and enabled, as it comes built-in with the PHP distribution from WAMP. However if you're using any other form of PHP setup, you need to run the phpinfo() function and see if you find ODBC in the list of enabled extensions. Check the PHP.net documentation for more information on setting up the ODBC extension.

Now we've got that cleared up, we can actually write our first script that will connect to the DBISAM database. Remember: a DBISAM database has no server, you just need to indicate the path of the database files; the ODBC driver will do the rest (I/O operations).

The function that interests us here is odbc_connect(). It takes three parameters: the DSN (data source name), a login, and a password. Here's a tip: by default, the DBISAM login is "admin" and the password is blank (empty password). At least this worked for me. Now this leaves us to figure out the DSN.

Here is the DSN I am currently using: DRIVER={DBISAM 4 ODBC Driver};ConnectionType=Local;CatalogName=c:/wamp/www/odbc/data/;
There are three components:

  • The DRIVER: you must specify the exact name of the driver as it appears in the "ODBC data sources" program that I had you open above (see screenshot above). 
  • The ConnectionType: it's set to Local because we're reading files from our local computer, not remotely.
  • The CatalogName: simply specify the path of the folder that contain your database files. Use normal slashes instead of backslashes.

So, this is the full command that we'll use to establish the connection:
$db = odbc_connect("DRIVER={DBISAM 4 ODBC Driver};ConnectionType=Local;CatalogName=c:/wamp/www/odbc/data/;","admin","");
If you get a warning, something probably went wrong. Check the driver name, the database path, make sure you typed everything correctly. If no error or warning shows up, you're good, and $db will contain a resource identifier.

Executing a query and displaying its contents

If you've already used MySQL or other database providers before, this will be a piece of cake. The principles are similar: execute an SQL query, run a while loop fetching the results. Let's assume you have a "customers" table; in practice this means you should see these two files in your data folder: customers.dat and customers.idx (there may be more files though - blb, blk, etc.). Here's the full code sample that I wrote.

$db = odbc_connect("DRIVER={DBISAM 4 ODBC Driver};ConnectionType=Local;CatalogName=c:/wamp/www/odbc/data/;","admin","");
$res = odbc_exec($db,"SELECT * FROM customers");
echo odbc_num_rows($res)." rows found";
while($row = odbc_fetch_array($res)) {
    print_r($row);
}

This code sample loops through all the records of the customers table and displays them in the current page. That's it! Now all you have to do is work your brains and write the appropriate SQL queries. If you have any questions on the subject I'd be happy to answer them.

2013-06-16

Windows 8 on Macbook freezes due to Broadcom wifi driver: a solution?

I am writing this article in the hope that this will help someone else. I have a white 2009 Macbook (version 6,1 -- if you want to know what's yours, refer to this list http://support.apple.com/kb/ht1635) So here's the thing. I just installed Windows 8 on my macbook, via Boot camp. Unfortunately, even after installing the most recent available drivers (from Bootcamp 4, since Bootcamp 5 doesn't support my Macbook version), my computer freezes at random times.

After reading about a lot of similar problems on the web, this blog post seemed to best describe the issue I was personally encountering. Indeed: if I disable the Broadcom wifi adapter, the freezes no longer occur.  So yes, it seems the problem comes from the Broadcom wifi driver. It seems that I was able to solve the problem after looking at numerous solutions on the web. I followed all the instructions on this blog article but it did not solve the freezing problem. So I took additional steps.

Before reading my solution, you should know that I initially had the 32 bit version of Windows 8 professional. I quickly gave up because I found out that 32 bit versions aren't supported by newer bootcamps, as of v5 anyway. So I did a full reinstall of Windows 8 64 bit -- that wasn't easy, I had to resort to burning a DVD, which I hadn't done in a long time. Anyhow, after doing all that's described in the aforementionned blog article (which means you need to follow these steps too), I took the following actions:

1) I downloaded the Bootcamp 5 drivers from Apple.com. If you start the main install file, it won't run because this model isn't officially supported by Apple. Instead, go to the "Drivers" folder and install every driver one by one, including the Broadcom wifi driver (that's important). My system still froze after that step, just less often, but continue reading anyway. NOTE: this step won't work if you're under a 32-bit version of Windows, because all the drivers provided in this package are 64 bit only. This is what made me switch from 32 to 64 bit.

2) I went to driveridentifier.com, downloaded and ran the driver scan application. It told me which drivers were outdated and gave me links to download new ones (hint: driveridentifier.com charges you to download drivers, but you can get links to the drivers anyway, from the download URL just when you click "download". You just need to replace some encoded characters... you'll figure it out)

3) I updated all the outdated drivers listed to me by driveridentifier.com, EXCEPT for the broadcom wifi driver: I am still using the one from Bootcamp 5.0 (from step 1). But I did update the chipset driver, graphics, etc. Everything. The only part that wouldn't update, for some reason, is the bluetooth driver... but that didn't matter anyway.

4) Probably the most important part, at least what seems to have worked for me: I changed the laptop "Power plan" from "Balanced" to "High performance" (in the power options). I had read this advice on a thread in Apple forums, so I gave it a try. Bingo! Computer has been running for over 24 hours without a freeze.

All in all, I don't really know what fixed it but I suspect it could be a combination of things. I'm just reporting what I did in case someone else is reading this. I did NOT run the bcdedit /set disabledynamictick yes command -- it won't do any good to run this (google it for more info). Hope this will help someone...

2013-06-13

PHPDocFill: write beautiful PHP documentation easily

Have you ever needed to write PHP code so fast that you didn't have time to properly comment it? These situations tend to happen a lot when you are being pressured by your boss (I know what I'm talking about) to deliver projects under strict deadlines. Once the project is delivered, it is always a pain if you ever have to come back to the code and comment it. 

To make it easier and more enjoyable to comment your PHP code (afterwards I suppose), I've developed a simple tool called PHPDocFill that does the following:
- scans the current folder and subfolder to find all php files in your project
- analyzes your PHP files to find PHPDoc documentable elements
- easily insert or edit documentation blocks
- it even generates a simple HTML manual based on the documentation found in all the files

Full documentation, information, downloads and screenshots are available on its official site.
Official site: http://cnedelcu.net/phpdocfill/


2013-04-24

PHP: Querying Dell AssetService webservice to retrieve asset information

If you are reading this article because you stumbled upon my blog looking for information on a completely unrelated subject, you'll probably wonder what this is about. On the other hand, if you were specifically looking for information on how to query Dell's AssetService via PHP, this post will tell you exactly what to do!

Sept. 2015 update: this tutorial no longer works since Dell have updated their systems. If you manage to make it work please let us know what you did!

Dell is one of the top IT hardware supplier for professionals. The organization I currently work for has been working with Dell for over a decade: we have hundreds of Dell laptops, desktop PCs, screens, videoprojectors and whatnot. As it turns out, Dell makes use of a particular serial code that is assigned to each of the products they manufacture: it's called the "service tag".


The service tag can be found in at least three locations:
- on a label physically stuck on the item (see above picture, the back of a laptop)
- in the BIOS or menus
- on the cardboard box when you receive the item

If you know the service tag of an item, you can visit Dell's support page, enter the service tag, and you'll find all sorts of information and detail specific not only to the hardware model, but also to your particular item (warranty information etc.). Now, if you want to be allowed to retrieve such information programmatically, say, from a PHP script, you would use the very simple script below:



Let me explain what this code does.

  1. The first line ($DELL_URL...) sets the path of Dell's web service, AssetService
  2. The second line (new SoapClient...) creates a new SoapClient object specifying the WSDL URL and the option to use the SOA Protocol v1.2
  3. The third line ($tag...) specifies the service tag of the item you want to retrieve information about
  4. The last line ($response...) performs the actual request to the web service. You'll note that we're passing a dummy GUID, and the "applicationName" is arbitrarily set to "AssetService". I don't think it these two parameters make any difference.
Past this code, the item information is contained in the $response object. What can you do with this object? Let's begin with a var_dump / print_r:

This long piece of plain text details the structure of the response; you can use the following code to retrieve the information it contains:

You'll note that the $response->GetAssetInformationResult->Asset->Entitlements->EntitlementData array contains multiple elements: I am not sure that this corresponds to, but the first of these items always seems to match our warranty information.

Thank you for reading this post. If you have any more questions feel free to comment!

2013-03-15

Apple iMessage Client for Windows

I have been an iOS user for a while now and making use of iMessage since the day it was launched. It's quite convenient and most of my contacts use it too. Ever since the "Moutain Lion" version of Mac OS X, users are also able to send iMessages using their laptop or desktop computers, in addition to tablets, phones and iPods.

Now, if you're like me and own both an iPhone and a Windows-based PC, you probably wondered at some point: how do I send iMessages from my Windows computer? where do I find an Apple iMessage client for Windows?

At the time of writing this article (March 15th, 2013) there is no proper iMessage client for Windows. However, there seems to be some kind of workaround application that enables people to do so. But before you read any further you should know the limitations:
1) it works together with your iOS device, which means you need to have it with you -- kind of defeating the purpose
2) it requires your iOS device to be jailbroken -- which seemingly voids your warranty
3) it is a paid application that can be found on Cydia for $2.50

The application is called Remote Messages, find more information over at the official website. It installs on your iOS device and listens for connections. You then fire up your computer's web browser and connect to your device by entering its IP address. Since it's web based, it means it's potentially compatible with all operating systems, not just Windows but also Linux, Mac OS X and whatnot. I personally like the concept, but it's a shame it requires you to jailbreak your device. For this sole reason I won't be able to review the application for you. If you find of a review of this app please let me know and I'll link to it from this post.

Note: I am in no way affiliated to the author of this application, I just found out about it. I thought I'd make a blog post about it so that if anyone comes up with an alternative solution, they'd post it in the comments. If anyone knows of another solution, let me know and I will include it in this blog post.

2013-02-06

Top 3 ways to extract images from .docx/.doc Word documents

Lately I've been in a situation where I had an image embedded into a .docx Word document, and I absolutely needed to get the original image file in order to be able to retrieve the original best-quality picture. See the screenshot below? My document contains a picture, it shows up as a small thumbnail, but I need the original high-resolution picture. This tutorial shows the way, it works with Microsoft Word 2007 and above.

There are several ways to retrieve or extract images from a Word document. I am going to be listing the top 3 ways to do so in this article. Feel free to use whichever way you want, but expect different results. Here is the article index here:
  1. Renaming the .docx to .zip, opening the zip file and extracting the images (Best way!)
  2. Copying and pasting the image into a picture processing application (Alright)
  3. Saving the document as a web page and retreiving the generated images (Nice!)
Alternatively you could just use the Snipping Tool from Windows Vista/7, which allows you to save a portion of the screen into an image. Try it, it's pretty much self explanatory, but the final quality of the picture depends on how much you can fit on your screen.

Option #1: renaming the .docx to .zip

This is definitely the best way to retrieve your images. Microsoft Word's .docx documents are actually zip files! Before you ask: what if your document is a .doc, a .html, .odt or any other format? Well just open the document in Word and save it as .docx file, Word will convert it to a zip/docx file for you. So here is my file:
Note: if you do not see the .docx at the end of the file name, you *MUST* follow this tutorial for this to work (this will help you show file extensions in Windows Explorer).

I am going to rename the file to "products.zip" here, note as seen on the screenshot below, the icon changes to something different:

Now, double click your .zip file to open it with whatever program is associated with Zip files on your computer. In my case, Winrar does the job. If the document still opened with Word, you probably did not read carefully enough -- go back to the part where I say to follow this tutorial.
Open the "word" folder as seen in the above screenshot. You should be seeing a "media" folder:
Open it, and you'll now see all the images that appear in your document.
These are the original images that were inserted in the documents, regardless of the size in which they appear when viewing your document. You can extract them to your storage disk by selecting them and dragging&dropping them to the folder of your choice.

Option #2: copying and pasting the image

Another obvious option is to simply select the picture in Word, click Ctrl+C to copy the picture to the clipboard:
If you have and use a design/picture processing tool such as Photoshop, Paint shop pro or something, just open it and paste the picture by pressing Ctrl+V. I don't have anything like this, so I'll just open Paint:
Press Ctrl+V to paste the image into the current canvas in Paint. Unfortunately, the picture is copied in the same size as it appears in Word. If you want a bigger version, you'll have to resize the image in Word first, copy it again, and paste it again in Paint! This is obviously not the best way to go, but it can be easier and faster than the first option I described earlier.

Option #3: saving the document as a Web page

This last option is technically the easiest in my opinion. First, open your document in Word, then save it as a Web page:
When offered to select the format, make sure to choose the "Web page" format... do NOT select "Web page (filtered)", this option will export low-resolution images. The "Web page" option on the other hand exports the original images as well as thumbnails.
Once the file is saved as a Web page, you will find that two new icons appear in your folder:
There's the document itself, but also a folder that Word generated for you. Open the folder to reveal the images (both in original and thumbnail sizes):
You can now copy or save those files to other folders of your computer.

Conclusion

That's it! That wasn't so hard, was it? I still wonder why Microsoft didn't originally include this feature in the Word application itself. In my opinion, we should be able to just right-click an image and see a "Save image as..." option in the menu.

Now, why did I bother writing about this on what is seemingly a sysadmin's/developer's blog, you ask? Because I've been looking this up on the web and most of the answers I found were unsatisfying. It took me ages before I finally stumbled upon a blog article that revealed the docx/zip trick. When I don't (or hardly) find the answer to my questions, I usually whip up a quick article about what I was looking for, and hopefully it ends up helping people.

Search This Blog