Monday, 21 September 2015

How to de-restrict a Ducati 659

Ducati released a LAMS approved Monster for the Australia-NZ market a few years back by making small adjustments to the existing Monster 696. But shorter piston strokes, a lower compression ratio and revised cam timing were insufficient to meet the 150kW per tonne requirement. A restrictor plate has been added to the throttle housing to prevent the 45mm diameter butterfly feeding both cylinders from opening fully. The plate physically blocks the throttle from moving more than 30-40% and while this does not prevent the rider from accessing most of the torque available, there is a significant power increase to be had if this stop is removed. Removing the plate is easy to do and easy to reverse, with no damage and no indication that it has been altered.

The plate, labelled ZDM-R32 and located on the right hand side of the throttle housing, is held in place by means of a long threaded bolt that passes all the way through the housing. This can be unbolted from the left side of the bike using an 8mm socket and ratchet extension.
Once the bolt has been undone you can move the plate to the side and this will immediately de-restrict the throttle. The locking bolt can be kept in place with a new lock nut. Of course, this will affect the fuelling set up of your Monster and you will need to talk to your Ducati mechanic about the best way to handle this.

NOTE that modifying the motorbike in this manner will negate your factory warranty (if your bike is less that 2 years old) and your bike will no longer be LAMS approved. It should only be done after you have passed your restricted examination and you are riding on a full licence. However, it is a simple process to reverse by putting the plate back in the original position.

Thursday, 12 December 2013

Data Loader Java Heap Space Error

Exporting or inserting attachments using Apex Data Loader via the command line will often fail with an 'out of memory' error due to a lack of java heap space. This can fixed by expanding the heap size in the process.bat file in the bin folder using the -Xms and -Xmx switches:

..\_jvm\bin\java.exe -cp ..\DataLoader.jar -Xms32m -Xmx128m -Dsalesforce.config.dir=%1 com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%

When not specified, the heap size defaults to 1MB but will increase to 16MB as needed. The above code increases the allotted memory to 32MB and allows for expansion to 128MB if needed.

See this article by Brett Spell for more on setting heap sizes. Thanks also to Anna478 and Demand Chain Sysytems.

Tuesday, 12 November 2013

How to query a stored procedure in SQL

If you have ever needed to query an existing stored procedure in an ad-hoc SQL query then probably the most common method is to create a temp table (or table variable), execute the sp, and insert the result set into the temp table (see stack overflow article here). But this involves manually specifying the columns, and if your result set has more than a few columns it can be tedious and off-putting.

Fortunately there is another solution that allows a direct query of a stored procedure's result set without having to build temp tables (thanks to Erland Sommarskog for the info).

OPENQUERY allows you to query a stored procedure in the same way you query a base table, similar to querying a query in MS Access, and even allows joins between different sps.

For example, if I have two stored procs on my local server, PaymentUpsert and MilestoneUpsert, I can run the following select statement using OPENQUERY:

SELECT p.Status__c
,m.Status__c
FROM OPENQUERY(LT010, 'EXEC StagingArea.dbo.PaymentUpsert') AS p
JOIN OPENQUERY(LT010, 'EXEC StagingArea.dbo.MilestoneUpsert') AS m
ON p.[Milestone__r:External_Id__c] = m.External_Id__c
WHERE p.Status__c = 'Completed';


If you get an error telling you that your server instance is not configured for data access then you can run the following query to allow access:

EXEC sp_serveroption 'LocalServerName', 'DATA ACCESS', TRUE;

Be aware that setting your local server data access to true may have security implications for you and your network. See data acess article on technet and also article on openquery.

Tuesday, 8 October 2013

Change Facebook profile picture without notifying everyone

If you want to change your profile picture on Facebook without announcing it to the world then you need to set the privacy on the chosen picture to "Only Me".


Selecting a private photo as your profile picture will not be announced as an activity and you can change as often as you like without annoying your friends with constant updates.

Note this does not work for cover photos which are always public by default.

Tuesday, 12 February 2013

Case sensitive VLOOKUP search in MS Excel

VLOOKUP is not case sensitive and when searching for 15 character Salesforce Ids, you must force Excel to match on exact case. The simplest way to return an exact case-sensitive match is by using an IF(EXACT... formula, but this will return #N/A if the first ID found is not an exact match.

The best way to enforce a case sensitive search in Excel is to use the INDEX / MATCH combo as follows.

Wednesday, 16 January 2013

Solar azimuth - how the sun moves across the sky

The solar azimuth angle is the angular measurement of the sun in a clockwise direction from north. When building a house it is important to think about the solar azimuth because it affects which sides of the house receive morning or afternoon sunlight at various times of the year. Most homes are built with north-facing windows to optimise the low winter sun elevation, but few homes are built with the summer azimuth angles in mind.

Friday, 23 November 2012

Reference external java beans with absolute path

I run a bunch of batch file exports from Salesforce calling Data Loader from the command line, with multiple process-conf.xml files defining various tasks. Originally I stored the SFDC credentials in each bean, then shifted the credentials to variables, still within the same xml file, using java.lang.String classes with constructor-arg properties:

Tuesday, 13 November 2012

Case sensitive text searches in SQL Server

Salesforce unique ids are only case insensitive when using the 18 character version with the three additional characters at the end which specify the case of all the previous characters. So when searching for and matching SFDC Ids in SQL Server using the 15 character ids, the result set will often include two or three matches where you were expecting only one.

Monday, 12 November 2012

Calculate total length of all cells in a row or column

In Excel the LEN function returns the length of any given cell, but it errors if asked to find the length of an array of cells. E.g. =LEN(A2:Q2) will not return the length of all cells in the given range. In order to find the length of an array of cells you need to enter the formula as an array formula.

Type the same formula into a cell  (=LEN(A2:Q2)) but before hitting [ENTER] hold down the [CTRL] and [SHIFT] keys simultaneously. Excel will bracket the formula in curly braces automatically, you do not need to type the braces in. The formula will look like this:

{=LEN(A2:Q2))} and the cell will display the total number of characters in the selected array of cells.

Big thanks to Guy Parrington for the heads up!

Monday, 5 March 2012

Notebook security - password protecting your hard drive

As a mobile worker for a government agency, I am constantly aware of the vulnerability of my notebook. The portability that I value so highly also makes it an easy target for thieves in places such as airports, cafes, and even serviced apartments and shared offices. Not only is the actual device more vulnerable than a desktop PC, the data stored on the hard drive needs to be secured as well.

Convert dates to Salesforce format in T-SQL

When preparing csv files for import through the data loader, it is best practice to format the datetime values in the full yyyy-mm-ddThh.mm.ss.sssZ format required by Salesforce.com. This prevents any complications with Data Loader or other migration tools which may have different settings depending on the environment or installed software (for example, dates can be scrambled if your data loader has 'Use European Date Format' checked, but your client's data loader does not.

CONVERT float to nvarchar

Attempting to compare company numbers (e.g. ABN) stored as datatype float to text strings is complicated by the fact that the default display for float numbers over 6 digits is scientific notation. To work around this you need firstly to convert the float to a bigint, then convert to nvarchar.

Wednesday, 29 February 2012

Spring bean variables with data loader command line

If you use Apex Data Loader from the command line, you will know that changing usernames, passwords, and environments is a bit painful if you have more than one bean in your process-conf.xml file. Adding variables should be easy but getting the syntax right without an IDE is not. I couldn't find much help on the web so a Java guru colleague came through with the following fix.

Sunday, 26 February 2012

Using Google Analytics in webs.com

The latest version of the Analytics tracking code offers an improved way to track website visitors with Google Analytics. It takes advantage of browser support for asynchronous JavaScript to enhance the speed in which the tracking code is loaded.

Saturday, 25 February 2012

Differences between views and temp tables

In a relational database like SQL Server, views provide a way of giving users a way to work with specific portions of a larger schema. Temporary tables are another means of providing end users with a subset or collation of data from base tables, and at first glance it seems that these are similar methods of achieving the same end. So it is important to understand what the difference is between a view and a temp table.

Thursday, 23 February 2012

T-SQL not equal to NULL

This is a well known problem addressed elsewhere, but I want to log it here anyway. When joining two tables and checking for records where a value in one does not equal a value in the other, T-SQL fails to find records where the reference table has recorded a NULL value. Presumably this is because a NULL value is unknown, so there is no way of knowing whether the two values are equal or not.

Wednesday, 15 February 2012

CONVERT CAST dates in T-SQL

Sometimes you need to compare dates as text rather than in date format, and this can be especially useful when comparing dates from different systems using different data types. But T-SQL makes it easy to format different dates using the CONVERT function.

Friday, 9 December 2011

How to filter a fuzzy lookup reference table in SSIS

SQL Server Integration Services uses  the fuzzy lookup data flow transformation component to find near matches between a data source and a reference table. The data source can be a SQL Server table, in which case you can define a SELECT query with a WHERE clause that only returns those records you need. But the reference table does not provide this sort of filtering.

Saturday, 3 December 2011

No drivers for Canon 20D and Windows7 x64

My previous OS was Vista and I couldn't connect my Canon 20D camera without going through Picasa 3. So when I upgraded to Windows7 I was pleased to see that Canon said no driver was required. However, they do not say that your communication settings must be changed before the OS will recognise your device.

Friday, 2 December 2011

Handling NULL values in SSIS fuzzy lookup

I'm using the SSIS Fuzzy Lookup data flow transformation in my current ETL package to find account name matches between source and target. So I compare the similarity of a number of fields using a conditional split transformation like:

(_Similarity > .70 || _Confidence > .70)
|| (_Similarity_CleanedCompanyName > .70 && _Similarity_CleanedABN > .70 && !ISNULL(CleanedABN))
|| (_Similarity_TradingNames__c > .70 && !ISNULL(TradingNames__c) && _Similarity_CleanedABN > .70 && !ISNULL(CleanedABN))

But SSIS gives a score of 1 to fields that are NULL in both the source and reference tables. E.g. if the phone number is null in the source table and the reference table phone number is also null then SSIS marks this as an exact match.