Wednesday, December 30, 2009

iPhone contacts restore from iTunes backup

Well, I bought an iPhone. YEY!

I started to play with it (jailbreak off course…) and I did something wrong with the configuration for the tethering.

Next thing I know, I can’t connect to 3G nor to WiFi.

Some exploring brought me to the conclusion that restore is supposed to solve the issue. The problem is that when I choose to restore my phone with settings from backup – the problem came back.

I had to do a clean restore and to recreate everything!!! :(

I was ready to reinstall all my apps (both appstore and cydia), but I totally forgot about my contacts! (note to myself: iPhone is also a phone!)

Well, here comes the interesting part of this story. It took me some googling, but I managed to find a way to restore the contacts from the previous backups!

Here is how it is done:

Disclaimer: This is probably not the only way, and maybe even not the best one, but it worked for me. I take no responsibility if something happens (or doesn’t) with your iPhone, cat, wife or grandfather during the process.

1. Jailbreak your iPhone (Google to know how) and install Cydia
2. Install OpenSSH from Cydia on iPhone
3. Install WinSCP on your computer.
4. Download iPhoneBackupExtractor (Free version allows to extract only one file, but it was good enough for me…). No need to install, just execute the exe file.
5. Run the iPhoneBackupExtractor, choose the backup date:
image 
Click next.
Choose the following option:
   image 
Next.
Now you will have to choose the file to restore. There are two of them for the contacts. If you use the free version of the backupextractor you will need to follow the previous steps twice to get both of the files. The files you need are located under (surprisingly) “AddressBook” folder:
image 
As the file names imply, the first is the address book, the second is the images for the address book.
Store the files in some folder you will be able to find later…
6. Now let’s copy the file to the iPhone.
Connect with WinSCP to iPhone (here is how)
7. Browse to /var/mobile/Library/AddressBook
You should see there two files with suspiciously familiar names. Where did you see these names before?
8. Drag&Drop the files you just restored from backup to the above folder in winSCP program, and agree to replace the existing files.
9. You have your contacts back!!!

Wednesday, June 3, 2009

Set focus on control inside iFrame (jQuery)

//get the IFRAME element - note no hashes in the name, we're using browser functionality 
var iframeRef = document.getElementById("IFRAMEID"); 
//focus the IFRAME element 
$(iframeRef).focus(); 
//use JQuery to find the control in the IFRAME and set focus 
$(iframeRef).contents().find("#CONTROLID").focus();
 
Source

Saturday, May 23, 2009

My favorite Mozilla Ubiquity custom plug-ins

 

Imdb (with preview) - http://gist.github.com/59109

Mozilla Add-ons - http://projects.fligtar.com/ubiquity/add-on.php

Google

music is a command that use google hacks in order to find mp3 or ogg music.

video is a command that use google hacks in order to find video.

Note in Reader: Adds the current selection to your Google Reader Shared Items page and allows you to add a note to it

Google Image Search (preview, links, embedding) - http://www.jimmy2k.it/getimagescommand

jQuery

jquery: Searches the jQuery documentation.

Facebook

[script] with two commands:

  • 'facebook-status (your status)' - Updates your status, doesn't add "is"!
  • 'facebook-friend (your friend)' - Locate a friend. You have to type whole words, though (if searching for Amy Jones, you can't type Amy Jon; it must be one of: amy, jones, amy jones!)

Others

notepad - Opens Notepad on Windows

paint - Opens MS Paint on Windows

note - The purpose of this command is to quickly save the inputted text (can be selected text or your own text) to a file on your disk without having to launch a text editor.

 

All taken from here

Friday, March 27, 2009

pageLoad() – check if partial refresh

 

function pageLoad(sender, args) 
{
    if (args.get_isPartialLoad()) 
    {
        alert(”Ajax call”);
    } 
    else 
    {
        alert(”PostBack or initial load”);
    }
}

Friday, March 20, 2009

Code Formatting plug-in for Live Writer

This plug-in formats and highlights code and also does the following:

  • The ability to format the code 'live'
  • The ability to wrap lines
  • The ability to change the background color
  • The ability to just quickly paste what's in the clipboard as code
  • The ability to change the font, including the font name, size, weight, and style.
  • Dozens of languages, including PowerShell, MSIL, Pascal and XAML
  • NEW: The ability to use different formatting engines - in this release, ActiPro (Insert formatted code), and SyntaxHighlighter (Insert highlighted code)
  • NEW: The ability to output either formatted text (html) or images
  • NEW: Now works with the latest version of Windows Live Writer
  • NEW: The code editor now uses the superb ActiPro code editor.  ActiPro very kindly donated the license.

 

 

 

more info here

Monday, March 16, 2009

C#: Control over date formatting, replace ToShortDateString

 

I found that it is more flexible and readable for me to use the ToString formatting for dates

objDate.ToString("MM/dd/yyyy");

than to use this:

objDate.ToShortDateString()

Friday, February 6, 2009

How to manage ASP.NET validation from Javascript with jQuery

 

Just an example from the original article, but it is self explanatory

 
 
<asp:DropDownList ID="ddlMimeType" runat="server">
   <asp:ListItem Value="mp3">audio/mpeg</asp:ListItem>
   <asp:ListItem Value="wma">audio/wma</asp:ListItem>
   <asp:ListItem Value="other">Other</asp:ListItem>
</asp:DropDownList>
<asp:TextBox id="txbOtherMimetype" runat="server" />
<asp:RequiredFieldValidator id="valOtherMimetypeRequired" runat="server"
                   ControlToValidate="txbOtherMimetype" ForeColor="#990066"
                   ErrorMessage="You have to specify a custom mimetype." />
 

 

<script type="text/javascript">
$(document).ready(function()
{
  $("#<%= ddlMimeType.ClientID %>").change(function() 
  {
    toggleOtherMimeType(this);
  });
}
 
function toggleOtherMimeType(elem)
{
  if(elem!=undefined) 
  {
    if(elem.value=="other")
    {
      $("#<%= txbEnclosureOtherMimetype.ClientID %>").show();
      ValidatorEnable($("#<%= valEncOtherMimetypeRequired.ClientID %>")[0], true);
    }
    else
    {
      $("#<%= txbEnclosureOtherMimetype.ClientID %>").hide();
      ValidatorEnable($("#<%= valEncOtherMimetypeRequired.ClientID %>")[0], false);
    }
  }
}
</script>

 

Source

Tuesday, January 20, 2009

Converting Dates in SQL Server

 

image

SELECT 
   GETDATE() AS DefaultFormat,
   CONVERT(nvarchar(30), GETDATE(), 101) AS US,
   CONVERT(nvarchar(30), GETDATE(), 103) AS UK,
   CONVERT(nvarchar(30), GETDATE(), 111) AS Japan,
   CONVERT(nvarchar(30), GETDATE(), 104) AS German,
   CONVERT(nvarchar(30), GETDATE(), 112) AS ISO,
   CONVERT(nvarchar(30), GETDATE(), 109) AS Date_with_Milliseconds
 

image

Source

Friday, January 16, 2009

GridView Pager styling

Source

NY Mayor Michael Bloomberg talks about the conflict

Nettuts 960 CSS framework screencast



Source

JavaScript: Parent -> Frame function calls

For this example I have 2 html pages:

Page1.html and Page2.html

If Page2 is shown as iframe inside Page1 and has this function:

<script type="text/javascript">
        function showMessage(m) {
            document.getElementById("message").innerHTML = m;
        }
</script>

Than it can be called from Page1 like this:

<script type="text/javascript">
    window.onload = function() {
        window.frames[0].showMessage("Hello from Main Page in iFrame");
    };    
</script>

 

Source