22 August 2015

Logitech Anywhere MX - unbalanced wheel fix

I really like inertial (or momentum) scrolling. Most of the time I use trackpads. OS X uses momentum scrolling by default. Unfortunately, sometimes I have to use 3 button mouse for 3D or graphic design. Besides that, there is coding on a Windows machine so scrolling is quite frequent. Being so used to the way of scrolling, it is hard to switch to just standard wheel in a standard mouse.
Logitech makes mice with a Hyper-Fast scrolling wheel. Works great but there is a fairly annoying glitch. The wheel may, after stopping, move slightly. So when you scroll to the right place in a document, you stop, lift your finger and the document scrolls a few more lines. You scroll back, lift the finger and the screen scrolls again.

So I decided to try and fix it. I used a spring to hold the wheel in place. With very little force it should not stop it from spinning. After straightening an old spring from some broken mechanism, I bent it in a way to fit around the wheel holder. I left one end of it touching the wheel’s ax lightly. Then put a drop of silicone grease and voila!

The wheel does not move anymore after stopping. The time it spins freely has reduced but the documents I work with are not that long to require a few seconds of continuous, high speed scrolling.

28 October 2014

Temporary fix for OneDrive (SkyDrive) invisible icon in OS X Yosemite dark mode [updated]

I’ve had enough of the problem. Just a minute ago the app was updated but still the icon is invisible in dark mode of the Yosemite. It was just a quik dive into the app content and replacing the icon. I’ve changed the original one by replacing the color (black to grey). That’s enough for me as I’m too lazy doing someone elses job. I’m not bothered by the other states of the app. All I need is to see the app is running. The file you’re after is StatusIcon_signedin.tiff. So there you go: 

Update: Skydrive application is updated and fixed the problem.

1 February 2014

Designspark PCB on two machines under Windows 8.1

I use DesignSpark PCB on my main machine for designing schematics and circuit boards. Recently I’ve set up a new, small PC for use just in my workshop. The setup is exactly the same as the main machine, the user, paths, environment and so on. My documents and projects reside inside the SkyDrive folder. As soon as the account was created the entire folder synced. Then I installed the DesignSpark PCB. I also wanted it to use the same paths as the copy on the main PC. For some reason it could not overwrite the existing files. I pressed “Ignore” as the files already existed so it shouldn’t be a problem. The program launched OK but it refused to open my project files presenting an unknown error.

I was just about to give up with the conclusion that DesignSpark doesn’t like such environments when I remebered something what might be the cause.
Integrated with Windows 8.1 Skydrive uses offline files to save space on mobie devices. A file exists on the drive but the content is in the cloud until you open it. Then it gets downloaded. You can also force the download by selecting “Make available offline” option from contextual menu. After performing this step all the problems were gone.

17 January 2014

MPLAB X not launching

While the MPLAB X works great on my home desktop with Windows 7, it won’t launch on my company’s laptop with the same system. The most probable reason is that my account is regulated by my company’s group policies. To fix the problem I’ve found the solution that worked for me. It is to make it to use specified user directory by adding the following parameter to its short-cut target:

“C:\Program Files (x86)\Microchip\MPLABX\mplab_ide\bin\mplab_ide.exe” –userdir C:\Users[your account name]\MPLAB

12 April 2012

SSIS Derived Column - US to SQL date

CSV is great but painful sometimes. In one of my SSIS work-flows I had to import data from a CSV file that used US date format without leading zeros:
It is not the most effective and best method but I used Derived Column component to replace the column. The [date filed] is imported as string [DT_STR]. Then I used the long formula to do some string operations.
First is to add leading zeros to month:
FINDSTRING([date field],“/”,1) < 3 ? “0”:“”
If the first slash is on third position then the month is greater than 9 - no need for zero. Otherwise the zero will be added to the string representing the month.
For adding the zero to day:
FINDSTRING([date field] ,“/”,2) - FINDSTRING([date field] ,“/”,1) < 3 ? “0” : “”
It’s just counting the characters between both slashes.
The rest is just repositioning the date parts. Since the date string is not of fixed length I had to use the FINDSTRING to determine where the date parts start and their length.
SUBSTRING function does the job of extracting the parts:
SUBSTRING([date field], where to start, how many chars)  
Year: SUBSTRING([date field], 5, 4)
But the year may start at 5, 6 or 7th position. That’s why it has to be replaced by the function:
FINDSTRING([date field] ,“/”,2)+1which is just finding the position of the second slash and adding 1. So now it becomes:
SUBSTRING([date field],  FINDSTRING([date field] ,“/”,2)+1 , 4)
Next is the month: SUBSTRING([date field], 1, 1)
But we don’t know if it’s just one or two characters. So we replace the second 1 with the formula:
FINDSTRING([date field],“/”,1) - 1which gives us the position prior to the first slash. We end up with the formula for month:
SUBSTRING([date field], 1,  FINDSTRING([date field],“/”,1) - 1 )
The day is most complex as it lies in the middle and has flexible length. So we need to find both, the start and the length:
SUBSTRING([date field], FINDSTRING([date field],“/”,1) + 1FINDSTRING([date field ],“/”,2) - (FINDSTRING([date field],“/”,1) + 1)
Finally it’s just adding the strings, slashes, leading zeros and casting the result as date (and adding check in case the value is null):
TRIM([date field]) == “” ? NULL(DT_DBDATE) : (DT_DBDATE)(SUBSTRING([date field],FINDSTRING([date field],“/”,2) + 1,4) + “/” + (FINDSTRING([date field],“/”,1) < 3 ? “0” : “”) + SUBSTRING([date field],1,FINDSTRING([date field],“/”,1) - 1) + “/” + (FINDSTRING([date field],“/”,2) - FINDSTRING([date field],“/”,1) < 3 ? “0” : “”) + SUBSTRING([date field],FINDSTRING([date field],“/”,1) + 1,FINDSTRING([date field],“/”,2) - (FINDSTRING([date field],“/”,1) + 1)))
Complex? Sure but it works!

Note from MSDN:
FINDSTRING works only with the DT_WSTR data type. character_expression and searchstring arguments that are string literals or data columns with the DT_STR data type are implicitly cast to the DT_WSTR data type before FINDSTRING performs its operation. Other data types must be explicitly cast to the DT_WSTR data type