Saturday, March 7, 2015

Moving Dropbox From The Roaming Profile

When roaming profiles get big, they take a long time to load.

Dropbox stores its configuration files in the roaming profile. Some of the files are large.

After installing Dropbox, I noticed that the data files were stored on a network drive and the config files were in my roaming profile. I did not like either of these locations, but Dropbox installation does not allow them to be changed.

After installation, I was able to open the advanced Dropbox preferences and move the data file to a local drive. I tried several tricks to get Dropbox to move the config files to the local drive, but nothing worked.

I thought about symbolic links in Linux. I am using Windows 7, which has a mklink command.

I stopped Dropbox, moved the config folder to the local drive and created a link from the AppData\Roaming\Dropbox to the config file on the local drive.

I created a script that tests if the local folder exists and then creates the link. I created an admin task that starts the script on log on.

if not exist c:\local_data goto nolocal
mklink /j c:\Users\xxxxxx\AppData\Roaming\Dropbox c:\local_data\DropboxFromRoaming
:nolocal

Dropbox is now stored on my local drive, not in my roaming profile.

Update: When I logged off, the Dropbox folder was stored to my roaming profile. On the next login, the link could not be created, since the folder existed. It is necessary to ignore Dropbox in the roaming profile:   https://support.microsoft.com/en-us/kb/188692

I had tried the Group Policy, but it was ignored. I modified the registry and was able to leave Dropbox out of my profile.

Conclusion: It is not necessary to mess with links, just use the registry to keep Dropbox out of the roaming profile.



Monday, December 29, 2014

Working with web application with version control

I have a web application to put into version control.

I decided not to add my NetBeans project to version control.

I created a folder that contained all the files for the web application.

I created a new NetBeans project from existing sources. I pointed all source files to the version controlled sources. The sources are not in the NetBeans project folder.

From Window->Favorites I selected the version controlled folder. From Team->Subversion, I imported the version controlled folder.

It seems that NetBeans is smart about what should go into version control. I probable could have avoided this altogether!

Monday, December 22, 2014

Sharing a repository with SVN and GIT

It is always difficult to get something to work when you don't understand the software. I had this problem with Git. I was using it, but did not understand it. Then I read the first four chapters of the Git book.

I wanted to import a repository that was built in Git into Svn. The project was originally a Svn project, but new developers ported it to Git. I wanted to be able to modify it from either Git or Svn. I knew that I would not be able to create a seamless integration with the first Svn version, but I would be happy with a new one that could work with both from now on.

I found an excellent reference on Stack Overflow. Of course, it did not work with my repository. After many hours, I got it to work.

From Stack Overflow:

1. cd /path/to/git/localrepo
2. svn mkdir --parents protocol:///path/to/repo/PROJECT/trunk -m "Importing git repo"
3. git svn init protocol:///path/to/repo/PROJECT -s
4. git svn fetch
5. git rebase trunk
5.1.  git status
5.2.  git add (conflicted-files)
5.3.  git rebase --continue
5.4.  (repeat 5.1.)
6. git svn dcommit

When I reached the git rebase trunk line, I was faced with so many conflicts, it was impossible to continue. I still do not understand why the replay of the previous commits was causing so many (add/add) conflicts.

I then tried another sequence from later in the post:

git svn fetch
git rev-list --parents master | grep '^.\{40\}$'
git rev-parse svn/trunk
echo   >> .git/info/grafts
git filter-branch -- ^svn/trunk --all
rm .git/info/grafts

More voodoo. In this sequence, I was introduced to rev-list, rev-parse and filter-branch. I am still a little vague on how these work. I was able to get this to work, and was introduced to a nice GUI for a git repository, gitk.

The next statement was git svn rebase. Again, too many (add/add) conflicts.

I then learned that git rebase has the -s for defining a strategy. With the recursive strategy, it is possible to set an option for always accepting the new revision into the current one.

git rebase -s recursive -Xtheirs svn/trunk

This worked, but then I received an error about a commit that did not have a message. Apparently, some commits were added without messages and this was preventing the rebase.

I found another stack overflow post that explained how to add messages for commits that are missing messages. The technique I picked only works for single line messages:

git filter-branch -f --msg-filter '
read msg
if [ -n "$msg" ] ; then
    echo "$msg"
else
    echo "The commit message was empty"
fi' 

I then aborted the rebase and reran it. I received a bad format error. Filter-branch rehashes all the data, so I had to restart the sequence again, starting with git svn fetch.

Once that was done, I was able to complete the sequence:

git rebase -s recursive -Xtheirs svn/trunk
git svn dcommit

It worked. I can now do as the post suggested:

You can now sync from svn to git, using the following commands:

git svn fetch
git rebase trunk
 
And to sync from git to svn, use:

git svn dcommit

Saturday, May 17, 2014

Output of cal on Linux contains underscore and backspace

I just ran across some strange behavior in the output of the cal command on Linux.

I am running a perl script on Linux. The script retrieves the output of the Linux cal command with

`cal $month $year`

where $month and $year are set in the script.

I have been running this script for years and have not had a problem before.

The output of the calendar for

cal 5 2014

contains some control characters. For day 18, the output of the day is _1_8, where is the backspace key (hex 08). As you can guess, this runs havoc with my script that is formatting the calendar.

I had to filter the output of the command, replacing occurrences of _

s/_\x08//g

After filtering the output, the script ran as expected.

I ran a test script on all calendars from 1800 to 3000. Only May 2014 has the error.

Friday, May 16, 2014

Moving a Firefox extension from Addon-builder to local SDK

A couple of years ago, I developed a Firefox addon using the Addon Builder. The Addon Builder is no longer available. I am developing on a Mac.

I followed the steps at https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Installation to create a new addon using the locally installed SDK.

Open a terminal window and initialize the SDK. Change to the install directory for the SDK and issue the command source bin/activate.

Create a new directory for the root of the extension. Change to the directory and issue cfx init. The name of the extension is the name of the root folder.

Next, I downloaded my old extension from the builder dashboard. (Update: I can no longer find the builder dashboard, so I accessed my profile from the addons listing for me: https://addons.mozilla.org/en-us/firefox/user/username/, replacing username with my user name. Then, instead of clicking Add To Firefox, select Save As from the context menu of the button.) I copied my lib/main.js file and the files in the data folder into the extension I just created with the SDK. I do not know if I could have just edited the unzipped XPI file that I downloaded.

Change to the root directory for the extension. Test the extension with cfx test. A browser window will open and close. No interaction is possible.

Run the application with cfx run. A browser window opens with the extension enabled. Interaction is available. Close the window to end the run.

Create the XPI file for the extension with cfx xpi.

After modifying the extension, are tried to upload it to the builder site. I received the warning that the identifiers did not match.

I modified the id property in the package.json file in the root of the extension. I grabbed the id from the install.rdf from the expanded XPI file for the old extension. The id from the old extension had @jetpack at the end. I removed @jetpack to get the id for the package.json file. I recreated the XPI file and was able to add it as a new version for my extension.

Monday, March 24, 2014

Conduit Search Virus

3/24/14

I have been downloading a lot of files. Somewhere along the way, I picked up the Conduit search virus.

I ran Windows defender: it did not find it.

I ran AVG: it did not find it.

I downloaded AdwCleaner and ran it. It found it and removed it.

11/20/16

Another virus. If I double clicked on a folder, a search started and never finished. I could not open an admin window, I could not run regsvr /i shell32.dll.

Kaspersky did not find it.

AdwCleaner found it and cleaned it.

Insert Key on iMac

I have an iMac with the small, aluminum keyboard. I do not have an insert key. I do not have a help key.

fn+enter simulates the insert key when I use bootcamp and Windows 7.

More Blogs

Followers