Friday, 6 July 2012

Restore a psw iTunes windows

Really, all you need to know here is, on the main iPhone screen in iTunes, hold ctrl+alt then click restore.

This gives you the chance to select the psw that you want to restore from.

Key things to remember to do before you restore:

All these are under the context menu you receive from right clicking your phone name in the devices tree in iTunes.

Transfer your purchases

Sync your phone

Backup your phone

Tuesday, 6 March 2012

Extract DMG Windows

Theres few programs that do this, some install spyware, other you have to pay for.. Here is how to do it for free, and without having to install anything.

Download the latest version of DMG2IMG from here:

http://vu1tur.eu.org/tools/

Extract the downloaded zip file.

To make it easier for people that do not know how to use the command line, drop the download DMG file in to the directory that you just extracted.

Now, open the console (start->run_cmd)

if the path where you extracted the DMG2IMG download was c:\users\yourname\downloads\dmg2img

then in the console, type cd c:\users\yourname\downloads\dmg2img

now type dmg2img yourdmgname.dmg anynameforoutput.img

preess enter, and you are done. now extract the img using 7zip, and you have your psw.

Thursday, 1 December 2011

C# Removing or deleting an element and its contents from xml using regex

I was performaing a code review the other day where i cam upon this code

doc = rover.data.ArtisteDataHelper.getCurrentEventShows(festivalId);
XmlNodeList list = null;
list = doc.DocumentElement.GetElementsByTagName("biography");
while (list.Count > 0) {
      list[0].ParentNode.RemoveChild(list[0]);
}

list = doc.DocumentElement.GetElementsByTagName("description");

while (list.Count > 0) {
     list[0].ParentNode.RemoveChild(list[0]);
}

this operation was being performed over a 7mb file, and took around 18 seconds to complete. So, I thought I would see how fast it can remove these nodes using regular expressions.

I came up with the following code. It was designed specifically to remove elements with cdata inside them, but you can write regex to do anything you want of course, the performance gains will still be the same.

string xmlstring = doc.InnerXml.ToString();
string xmlstringresult = Regex.Replace(xmlstring, @"<description><!\[CDATA\[((?:[^]]|\](?!\]>))*)\]\]></description>", "");
string xmlstringresult2 = Regex.Replace(xmlstringresult, @"<biography><!\[CDATA\[((?:[^]]|\](?!\]>))*)\]\]></biography>", "");
result = new XmlDocument();
result.LoadXml(xmlstringresult2);

Result:
WHILE LOOP: 18 seconds
REGEX: 0.41 seconds

Wednesday, 2 November 2011

Kindle Fire Cannot load volume misc

Hi,

I had a friend that bricked his kindle fire, so I installed CM7 on it today, while doing so I got this error

E: Cannot load volume \misc!

you might also see

md5 file not found

how do you fix this?

you dont, these errors are ok, just reboot the device after CM7 (update.zip) has installed,

even if you see the errors, when it reboots, it should load fine.

Hope that helped,

Paul

Wednesday, 12 October 2011

Ubuntu Unity desktop on vmware player



This will enable the 2d unity mode on ubuntu when using vmware player. 3d is not avaible yet.

add the repository:sudo add-apt-repository ppa:unity-2d-team/unity-2d-daily


update repository:sudo apt-get update


install unity 2d:sudo apt-get install unity-2d-default-settings


now, logout of ubuntu on your vm

click your login name on the ubuntu login screen

you should now be able to see that unity 2d as your operating system (in the bottom task bar, if it is not, then select it)

all done (see pic below)

one more note to say, you may want to install CompizConfig Settings manager as well to tweak your desktop post install. use the command below and then look for CompizConfig in applications.sudo apt-get install compizconfig-settings-manager


.