This weekend, I decided to undertake installing a new ceiling fan.  Our old one has been broken for a while, with the light working but the fan just produced a buzzing noise. Got a new one earlier this week, and figured I’d give it a shot after watching some youtube installation guides.

Looks easy enough.

Although it may be called a 5 minute fan, I figured it shouldn’t take more than an hour or two at most to complete the task considering I’ve never installed a ceiling fan before.

2013-08-17 12.07.37

Removing the old fan was fairly painless.  Took a shot of the wiring before removing everything:

2013-08-17 12.22.36

Unfortunately, when installing the new mount and using the new screws provided, they were too long, and one of them snapped as I was removing it after it was clear that it wasn’t going to go all the way in, leaving half of the screw inside the ceiling fan electrical box and no way to remove it.

It seems like removing a broken screw is a very difficult task, exacerbated by the fact that it’s a small screw and in the ceiling where access is a little restricted.

I’m wondering if it’ll be easier to just replace the ceiling fan box.  The one currently in place appears to be attached directly to the stud (which would explain why the longer screw supplied with the fan wouldn’t go all the way in; old screw didn’t go up to stud and no pilot hole).  It looks fairly easy to replace this type of box without cutting holes in the ceiling:

Think I’ll need to give this a shot tomorrow and see if that solves the problem.

For now, I’m without a ceiling fan or light.

2013-08-17 13.26.30

Annoyingly, I called a few handymen from Craigslist after hitting this problem, and only one bothered to return my call.  He agreed to come and do the work, but cancelled due to something about a blown tire right before the agreed time, and then ignored all further contact about availability and rescheduling.  For everything bad we keep hearing about the economy, it would be nice if small businesses treated potential customers with a little more respect.

I’ve been working on integrating an existing web application with Salesforce, and it was a little more work than I expected.  Some of this was down to unfamiliarity with the platform, which I’ve never used before today.  Here are some of the key steps involved and things to note:

1. The cheapest plan that offers API access is the enterprise plan.  At $125 /month /user, this seems a bit on the expensive side for small businesses, but I digress… In any case, if you’re using a different (cheaper) plan, then the API is a paid extra and not included as standard.

2. Creating a Salesforce developer account is free, and is the easiest way to start using the API.

3. Add your IP address to your account or your API access won’t work.  You can do this by logging in, and then doing the following: Click on Setup in the top right corner next to your name, expand the Security Controls section on the left hand side (in the “Administer” area), click on Network Access, then New. Enter your public IP address in the Start IP Address and End IP Address boxes. Click Save.

4. Next you need to get the URL to the WSDL file, which we’ll add to our project in Visual Studio to generate the web service proxy.  To get this, expand the Develop section on the left hand side (under the “Build” area). Then click on API. Right click on the Generate Enterprise WSDL link and copy it (it’ll be something like https://naXX.salesforce.com/soap/wsdl.jsp?type=*).

5. Once that’s done, create a new project in Visual Studio.  For this example, let’s use a C# Console Application.  I’m assuming use of VS2010+ here (the process of adding a web reference is slightly different but easier in prior versions).

6. First we’ll need to add a reference to our WSDL from Salesforce to generate the webservice proxy. Right click on References in the Solution Explorer and select Add Service Reference. Click Advanced (bottom left on dialog box). Then Add Web Reference.   Pase the URL from step 4 above into the URL box and click the green arrow.  You’ll probably be prompted to login to Salesforce. Once that’s done, you should see the WSDL or service method summaries in the window.  On the right hand side, under “Web Reference Name”, type salesforce and click Add Reference.

7. Your project now has a reference to Salesforce, and in the solution explorer, you should see a new node titled Web References with salesforce under it, which we just created.

8. Paste the code below into your main method.  Note, you will need to change the username and password placeholders below to your details (it appears Salesforce doesn’t offer an API key option).

private static void Main(string[] args)
{
    Console.WriteLine("First Name?");
    var firstName = Console.ReadLine();

    Console.WriteLine("Last Name?");
    var lastName = Console.ReadLine();

    var contact = new Contact();
    contact.FirstName = firstName;
    contact.LastName = lastName;
    contact.Email = string.Concat(firstName, ".", lastName, "@example.com");

    using (SforceService sfs = new SforceService())
    {
        var login = sfs.login("your.login@example.com", "your-password");

        if (login.passwordExpired)
        {
            Console.WriteLine("Salesforce password expired!");
        }
        else
        {
            sfs.Url = login.serverUrl;
            sfs.SessionHeaderValue = new SessionHeader();
            sfs.SessionHeaderValue.sessionId = login.sessionId;
            var userinfo = login.userInfo;

            Console.WriteLine("Logged in as {0}", userinfo.userFullName);

            var sr = sfs.create(new sObject[] { contact })[0];

            var result = sr.success;

            Console.WriteLine(result);
            Console.WriteLine(sr.id);

            if (!result)
            {
                Console.WriteLine(string.Join(", ", sr.errors.Select(x => x.message)));
            }

            Console.WriteLine(result ? "Created" : "Not Created");
        }
    }

    Console.ReadLine();
}

9. This code sample will prompt you to enter a first name and last name, and will create a new contact with these details.

10. To view the newly created contact, click on the “Contacts” tab in the Salesforce web interface. Choose “All Contacts” from the View dropdown and click Go. Your new contact created from the command line application should be in the list.

This is far from a definitive guide, but should hopefully help anyone new to Salesforce overcome some of the initial hurdles in getting started with the API using .NET.

Reading The Facebook Experiment has failed, the following really struck a chord:

At a quick glance, the entire list of posts on the first screen are irrelevant to me. If I scrolled down I can find 4 stories I actually care about, from a list of about 30. The most important page on Facebook has more than three-fourths of absolutely useless content.

I’ve been thinking about how little value I get from Facebook nowadays. The once useful social network used to be a great way to keep in touch with friends and family from back home, but increasingly, I find my news stream is filled with things like images that people are liking and other useless trivia that I couldn’t care less about.

Equally nagging is my general mistrust of Facebook as a company.  When the timeline changes kicked in, I removed my list of favorite movies, books, etc long ago, as I’m no longer comfortable with Facebook knowing so much about myself.

In any case, I’ve decided to go on a “Facebook Fast”. The app is being removed from my phone and all my devices, as well as my bookmarks.  More often than not, I find myself wandering over to Facebook when idling, and the lack of a bookmark should hopefully stop that.

It’s not like I’ll be missing much. I’m sick of seeing stupid pictures that need 1 million likes.

I’ve found the macro below for starting debugging a massive time-saver. Much easier than going through the ‘attach to process’ UI screens all the time.

The steps below can be used to add a button to a toolbar in VS for attaching to IIS/IISExpress.

Tools -> Macros -> Macros IDE

Right-click MyMacros -> Add -> Add Module

Name: DebuggingMacros

Paste the code below into the module.

Public Sub AttachToWebServer()
        Dim Processes As New System.Collections.Generic.List(Of String)
        Processes.Add("iisexpress.exe")
        Processes.Add("aspnet_wp.exe")
        Processes.Add("w3wp.exe")
        Dim Attached As Boolean = False
        For Each Proc In Processes
            If (AttachToProcess(Proc)) Then
                Attached = True
            End If
        Next
        If (Not Attached) Then
            System.Windows.Forms.MessageBox.Show("Can't find web server process")
        End If
    End Sub

Right-click toolbar -> customize -> commands tab -> Toolbar radio -> Build -> Add Command

Select Macros from the categories list, Macros.MyMacros.DebuggingMacros.AttachToWebServer from the list of commands on the right.

Rename the button to ‘Attach to IIS’ (or whatever you want).

To use, simply click on the button to attach the debugger to IIS/IISExpress.

Saving your login details in TortoiseGit is pretty easy.  Saves having to type in your username and password every time you do a pull or push.

1. Create a file called _netrc with the following contents:

machine github.com
login <login>
password <password>

2. Copy the file to C:\Users\<your-username> (or another location; this just happens to be where I’ve put it)

3. Go to command prompt, type setx home C:\Users\<your-username>

Note: if you’re using something earlier than Windows 7, the setx command may not work for you.  Use set instead and add the home environment variable to Windows using via the Advanced Settings under My Computer.

Took a few steps to get this working.

1. Download Java SDK

http://www.oracle.com/technetwork/java/javase/downloads/index.html
http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u3-download-1501626.html

2. Download Tomcat 7

http://tomcat.apache.org/download-70.cgi
http://apache.cs.utah.edu/tomcat/tomcat-7/v7.0.25/bin/apache-tomcat-7.0.25.exe

3. Download Solr 3.4.0

http://apache.mirrors.airband.net/lucene/Solr/
http://apache.mirrors.airband.net/lucene/Solr/3.4.0/apache-solr-3.4.0.zip

NOTE: Make sure you download 3.4.0 and not 3.5.0.

4. Install the Java SDK

5. Install Tomcat on Windows

6. Verify Tomcat works by trying to browse to http://localhost:8080/

Solr_step6

7. Right-click on Tomcat icon in system tray, select stop service

8. Unzip apache-solr-3.4.0.zip to C:\apache-solr-3.4.0

9. Copy C:\apache-solr-3.4.0\example\Solr to C:\Solr

10. Copy C:\apache-solr-3.4.0\dist\apache-solr-3.4.0.war to C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\solr.war

11. Right-click on the Tomcat icon in the system tray, choose configure, Java tab, Java options, add the following line at the end:

-DSolr.Solr.home=C:\Solr

Solr_step11

12. Start Tomcat by right-clicking on the system tray and selecting “Start Service”

13. Browse to http://localhost:8080/Solr/ … You should see “Welcome to Solr”.

14. Click on “Solr Admin”.  You should see the Solr admin interface.

Well, seeing as the only thing I seem to have been blogging about recently is the iPad, I thought I’d mention that I decided to sacrifice my jailbreak and upgrade to iOS5.  I’ve been using it for about a week now and it’s definitely been the right decision, with the device being much more responsive and crashing far less.  It’s a little sad losing sbsettings and multifl0w, but the increased reliability makes it worhwhile.

Not quite ready to upgrade my iPhone 4, even though it’s starting to feel like Windows and needs to be rebooted or resprung at least once a day.  The other benefit of course, is that with both devices running iOS5, I’ll get the full benefit of iCloud with apps, photos, etc syncing between devices.

Ipad_smallI’ve been holding off on upgrading the firmware on my iPad since I bought it, as I didn’t want to lose my jailbreak, or end up with a tethered jailbreak.  Although it doesn’t leave the house much, having to connect the device to a PC to reboot it sounds like too much hassle.

With the release of greenpois0n, I finally took the plunge and upgraded from 3.2 to 4.2.1.  It was actually less hassle than I expected, though largely because the iPad doesn’t have the same problems as the iPhone, where upgrading via Apple will also upgrade the baseband, which could possibly break any carrier unlock.

The whole process took a couple of hours, including downloading & installing the latest version of iTunes, upgrading the firmware from within iTunes, jailbreaking using the greenpois0n app, and then re-installing the jailbroken apps (sbsettings, multifl0w, infinidock, winterboard, aquarium hd, fake carrier)

I’m yet to do this on my iPhone, though I’m still contending whether I want to use the official Apple upgrade option and then use greenpois0n to jailbreak it, which will also upgrade the baseband and break the carrier unlock –  though I’m not using this anyway but losing it makes the phone harder to sell in future, or whether to restore a custom 4.2.1 IPSW, but go through all the aggravation of re-installing all of my apps manually.

Either way, it’s nice to finally have 4.2.1 on the iPad.  I’m a big fan of folders and organizing my apps into groups, so that’s the biggest obvious benefit for me.  I’m not using AirPlay (haven’t got an Apple TV), and AirPrint seems useful but only works with selected printers, though there seem to be some apps and hacks to work around that which needs further investigation.

Tags: ,

I’ve been trying to install .NET 3.5 SP1 on my Windows 7 machine, but had a strange problem where the running installer would just do nothing. Tried using both the bootstrapper and the full version, both with no luck. After some fiddling, the following steps seemed to fix the problem:

1. If installed already, uninstall the .NET framework via Control Panel – Turn Windows features on or off.

2. Reboot

3. Stop IIS – command prompt, iisreset /stop

4. Download .NET Framework 3.5 SP1

5. Run the installer

6. Reboot

The installer might display an error during step 4, but .NET Framework 3.5 SP1 should still be installed correctly.