BigDiver

Dive away, explore the net…

Using Perl to Import Products into Salesforce.com Opportunities

leave a comment »

Believe it or not I am in sales… Didn’t start out like that, but as some techies would say sold my soul the devil :-)
Anyway one task that I get to do too often these days is creating, and approving Salesforce.com opportunities from my customers. They usually send me an Excel file with their proposed purchase order, I need to upload it to Salesforce.com so I can get the discounts approved.

Adding every single part number by hand is tedious, boring work, especially at the end of the quarter when the pressure to “make the numbers” builds up and we have no time to waste. So I revived some of my old Perl memories and wrote a little script that imports all the products at once into an already created opportunity.

If this is useful to you just follow these steps:

  1. Create Salesforce.com opportunity, and save it
  2. Copy the last part of the URL (that is your opportunity ID).
    Example: https://na6.salesforce.com/0068000000K32EA the ID is 0068000000K32EA
  3. Run import-products with your product file, Salesforce.com credentials and opportunity ID

You are set!

The product file is just an Excel with 2 columns, the first being the SKU or part number, and the second the desired quantity. Save the file in CSV format (you can do this by selecting CSV as the save type in Excel). Now use this file to import your products.

Script usage:

import-products --csv=product.csv  --opportunity=OpportunityID
                    --user=UserName --pass=Password
                    [--delete]

        product-file.csv
            MUST be a Comma Separated file with two columns (SKU, Quantity).
            No header line.

        opportunityID
            MUST be an existant Salesforce Opportunity to which you want to add
            the products from the product.csv to.

        user, pass
            Salesforce.com user name and password.

        delete
            Delete all of the opportunity's products before adding any new ones.

 

Requirements:

  • Perl 5.8 or higher

CPAN modules

  • WWW::Salesforce::Simple
  • Getopt::Long;
  • Text::CSV_XS;
  • Scalar::Util

You can get the source code from here. Hope you can use it and that it saves you some time as well!

Written by bigdiver

December 24, 2009 at 4:06 am

CPAN Recursive dependency detected

leave a comment »

Today I got a “Recursive dependency detected” message on CPAN while installing Config::Genreal.


Recursive dependency detected:
Test::Harness
=> A/AN/ANDYA/Test-Harness-3.17.tar.gz
=> File::Spec
=> S/SM/SMUELLER/PathTools-3.31.tar.gz
=> Scalar::Util
=> G/GB/GBARR/Scalar-List-Utils-1.22.tar.gz
=> Test::More
=> M/MS/MSCHWERN/Test-Simple-0.94.tar.gz
=> Test::Harness.
Cannot continue.

I installed Test::Harness by hand and when returning to CPAN all was cleared.


cd /root/.cpan/build/Test-Harness-3.17
perl MakeFile.PL
make
make test
make install

Written by bigdiver

December 21, 2009 at 12:35 am

Posted in Perl

Tagged with , , ,

Gave up on Snow Leopard on the Mac Book Air

with 4 comments

After fighting with Snow Leopard for a couple of months on my Mac Book Air, and experiencing two serious data corruption problems, I have officially given up on Snow Leopard.

Here is the summary of my experience with Snow Leopard.

  1. Snow Leopard came out. I upgraded both my Macs (iMAC, and MacBook Air)
  2. iMac works with a few quirks, but after the first update from Apple things are stable and all seems to be working. A few applications needed to be updated, but no major issues.
  3. MacBook Air upgrade did not work initially as documented in a previous post.
  4. Got everything to work but it was so very slooooow…. NONE of the “faster” claims by Apple verified.
  5. MacBook crawling, it got so bad that I decided to do a clean install. So I formated my HDD and installed SL from scratch.
  6. Same thing, slow, slow, slow….
  7. Found some fixes as documented in another post. This did work, especially the Terminal fix.
  8. The MacBook Air was not hibernating or sleeping properly, was hanging constantly and finally I suffered data corruption when the laptop ran out of battery while stuck, and not going to sleep after I closed it and stowed it.
  9. Tried to recode HDD but all data recovery tools complained an said they could not recover the data.
  10. Second reinstallation, same thing happened after three weeks

Fed up, went back to Leopard, all is working to perfection…

Written by bigdiver

December 21, 2009 at 12:27 am

Restoring iCal Events or ToDos from Time Machine Backups

leave a comment »

The iCal application stores event information in the ~/Library/Calendars/<UUID>/Events

Where the “~” represents the user’s home directory and <UUID> the Calendar Identifier. All Calendar events and todo tasks are stored as individual .ics files. You can use the Priview in Finder to confirm the events you need to import.

Preview of Calendar Event

The preview window will also allow you to see the calendar to which the backed up event belonged to.

Once you find the ones you need just double click the file and it will be imported into your Calendar directly from the backup.

If you don’t know how to mount the backup disk check this other post.

Written by bigdiver

November 26, 2009 at 3:42 am

Posted in Apple

Tagged with , , ,

Mount a Time Machine Backup Disk

with one comment

Time Machine backup images can be mounted as regular disks using the hdiutil command.

All you need to do is

sudo hdiutil attach <time_machine_file.sparsebundle>

If your Time Machine backup file is on a network share you need to connect to the server and mount the share before you can run the hdiutil command.

It may take some time especially on slow networks or big image files.

Mounted image of Time Machine Backup disk

Written by bigdiver

November 26, 2009 at 3:18 am

Posted in Apple, Snow Leopard

Tagged with , ,

Snow Leopard too Slow Fix

with one comment

I did a fresh install of Snow Leopard on my first generation Mac Book Air and it is still toooooooo slow. Digging around I found a couple of solutions that really helped.

General slowness due to lack of memory (from Apple Forum)

sudo rm /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist

Then if the Terminal application takes for ever to show you a prompt, delete the logs like so:

sudo rm -f /private/var/log/asl/*

Thanks Webapper for the slow Terminal fix!

Written by bigdiver

November 25, 2009 at 6:24 am

Posted in Apple, Snow Leopard

Tagged with

Skype Error: Unable to mount database

leave a comment »

I started getting a lot of Skype database errors during login. I would type my password and during the login process I always got the “Unable to mount database” error on Skype for Mac version 2.8.0.722.

To solve it delete the Skype’s user directory doing

rm -fr ~/Library/Application\ Support/Skype/<username>

using the Terminal application, then login to Skype.

Please pay attention to the “~” at the beginning of the file path. This is not a mistake it actually represents your home directory.

Written by bigdiver

November 25, 2009 at 5:56 am

Fantastic Keyboard for the PS3

leave a comment »

The Wireless Keypad for the Sony PlayStation 3 turns your regular controller into a texting device with mouse input capabilities, while still maintaining full gameplay functionality. This Blue tooth device attaches to any DualShock 3 or SixAxis wireless controller and enables effortless Internet browsing, emailing and instant messaging on the PlayStation Network and PlayStation Home.
Bluetooth mini keyboard for the PS3

I love the mouse functionality where you can just move your finger over the keys to move the cursor on screen. a MUST have for Internet browsing and chat.

Written by bigdiver

November 25, 2009 at 3:02 am

Posted in PlayStation 3

Tagged with ,

Restoring Time Machine Backups on a Different Computer even Over SMB or AFP

with 2 comments

There are many situations that require you to restore backups to different computers, other than the one from where the data was originally backed up from. In the case of Apple’s Time Machine the restore procedure to different machines is not very intuitive. You have to use the “secret” option key…

There is a supported way to restore Time Machine backups of other computers using the “option-key” click on the Time Machine menu. If you want to use it just do the following:

  1. Connect the Time Machine disk to the Mac you want to restore the files to
  2. Set the “Show time machine status in the menu bar” In System Preferences -> Time Machine.
  3. Click the Time Machine icon in the menu bar and keeping the mouse button pressed, press the “Option” key.
  4. Select “Browse Other Time Machine Disks”
  5. Select the disk you want
  6. click Use Selected Disk

The Time Machine will open with the selected disk and you can use it to restore the files.

Time Machine with mounted disk

If, like me, you are using a non supported Time Machine configuration, where the backup disk is mounted using SMB or AFP (see this post on how to enable that) then the procedure above will not work directly. In my case I backup to my Buffalo TeraStation NAS, and the “Browse Other Time Machine Disks” window shows up empty, with no disk to select.

Empty Browse Other Time Machine Disks

In order for this to work you need to first mount the Time Machine disk by hand in using the command line.

  1. Mount the shared folder where your Time Machine backups are stored
  2. Open a Terminal window and cd to the Time Machine volume. in my case I called it backups
    sudo cd /Volumes/backups
  3. use hdiutil to mount the specific Time Machine .sparsebundle file
    sudo hdiutil attach <time_machine_file.sparsebundle>

Now you should be able to see the mounted volume in Finder, with all the backups listed as folders, and you can copy any files directly from it. Remember that mounting the disk may take some time due to the size of the disk and network connection speed, especially If you do this over a WiFi network.

Mounted image of Time Machine Backup disk

Another option is to repeat the supported Time Machine procedure  outlined in the beginning of this post. You should now see the mounted disk as a Time Machine disk. Select the the disk and click “Use Selected Disk” and Time Machine will open on the selected disk just like with a Time Machine supported back up disk.

Time Machine Browse Disk

Personally I like to copy them directly from the Finder but your preference may vary so I document both ways of achieving this goal. Hope this helps.

Written by bigdiver

November 24, 2009 at 7:42 pm

PS3 YLOD Follow Up and Activating the New PS3 Without Having the Old One

with one comment

I wrote about my experience with the PS3 YLOD on this post, after getting a fixed PS3 back from Sony I thought that would be the end of it, but apparently due to the DRM features Sony does not want you to share your downloaded content like games and videos.

So the PlayStation Store lets you buy, but not download content, especially videos, from the PS Network.

I rented a video last night and the transaction was processed. ie Sony got my money, but then it would not let me download the movie because there was another “Active” PS3 in my account.
According to Sony we need to deactivate the old PS3 before we can activate the new one. But my problem was that I no longer had the old PS3, it burned down and did not even boot up… So how can I deactivate it.

I called Sony, gave them all the information I had, service request number for the repair of the YLOD damaged box, serial number of the new one, and still it took me 40 minutes on the phone with them to clear out this mess.

After all was fixed on their end I now need to wait 2 days to see if the changes really happened and I can register my new PS3, and that my downloaded content is still going to be there…

Sony, if the PS3 is not active and cannot download content why do you let users buy the content in the first place?

So if you have a YLOD or other hardware problem and your PS3 needs to be repaired/replaced please keep all your receipts, serial numbers and service request numbers so you can prove that you are not trying to steal the couple of movies you bought or rent on the PlayStation Store.

This whole YLOD episode has been a nightmare.

Written by bigdiver

November 23, 2009 at 6:13 pm

Posted in PlayStation 3

Tagged with , ,