How to control your iPhone remotely?

Remote control of your iPhone might be very useful for testing iPhone friendly web sites. You can use emulators for this purpose. Blackboud iPhone Browser Simulator is not bad, but still this is not a real iPhone browser.

First of all you iPhone needs to be jailbroken. Then you need to install VNC Server for iPhone. Just search for Veency in Cydia, it is free.

On you desktop you need VNC Viewer. There are bunch of them, but I use UltraVNC since it is free. Then you can connect to your iPhone over Wi-Fi, but you can do it thru USB too.

For USB connection you need to install python interpreter and usbmuxd. From usbmuxd we need only python client part. Run connect.bat, which has following line inside:

c:\python26\python.exe tcprelay.py 5900

And then you can connect to your iPhone using 127.0.0.1 address.

iPhone remote view

Friday, July 09, 2010 | Add Comment

How to fix ViewStateException Invalid ViewState?

Usually you don't see Invalid ViewState exception unless you implement some kind of ASP.NET error logger in Global.asax.

Error usually states something like this:

Exception: System.Web.HttpException: The state information is invalid for this page and might be corrupted. ---> System.Web.UI.ViewStateException: Invalid viewstate.

Those errors are usually generated by some automatic submission form engines. Comments and contact forms are mostly effected by this exception. End user never sees those errors, so invalid viewstate errors don't have any value for your error logger. Let's bypass them:

if (ex is HttpException && ex.InnerException is ViewStateException)
{
    _app.Response.Redirect(_app.Request.Url.AbsoluteUri)                
    return
}
Wednesday, June 23, 2010 | Comments (1) | Add Comment

XRefresh alternative solution

I am using two monitors for a web development for the past 4 years. Usually I have website that I am working on a left monitor and my Visual Studio on a right monitor. Usually I do change in Visual Studio then press Shift-F6 (in case of code change) or just Ctrl-S (to save). After that I grab a mouse, move cursor to browser on left monitor click and then F5 for refresh. If you do a little CSS tricks it is to much repetitive movements.

Dual Monitor Web Development

About two years ago I discovered XRefresh. I mentioned it in my ASP.NET development tips article. First I was really excited. It is excellent tool for html and CSS markup tweaking. But if you do a lot of code changes and need to recompile your project more often then markup tweaking then it might not be a best tool for you. XRefresh watches files. If file changes then it refreshes browser. Now imagine if you compile big project and compilation takes 15 sec. XRefresh would notice dll change and would try to refresh browser. However compilation is not done yet and some dll-s are locked. So, XRefresh most likely not going to work for Shift-F6 scenario (recompilation of project).

So, I found XRefresh alternative solution. I wrote a Visual Studio macros. You can hook up to OnBuildDone event. Then find Firefox process. Move focus to Firefox window and send F5 keystroke to it. Macros below still needs some polishing, but you can get an idea:

Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, _ 
 ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone
    Dim projects As Object() = DTE.ActiveSolutionProjects
    If projects.Length > 0 Then
        If CType(projects(0), Project).ExtenderNames.Length Then
            If CType(projects(0), Project).ExtenderNames(0) = "WebApplication" Then
                Dim proc As System.Diagnostics.Process() = _
                          System.Diagnostics.Process.GetProcessesByName("firefox")
                For i As Integer = 0 To proc.Length - 1
                    If proc(i).MainWindowHandle <> 0 Then
                        SetForegroundWindow(New HandleRef(Nothing, proc(i).MainWindowHandle))
                        System.Windows.Forms.SendKeys.SendWait("{F5}")
                    End If
                Next
            End If
        End If
    End If
End Sub

 

I am open for discussions and any suggestions.

kick it on DotNetKicks.com

Monday, May 31, 2010 | Comments (1) | Add Comment

Categories

Recent Tweets

Valid XHTML 1.0 Transitional