Easily switch between the Experience Editor and normal mode in Sitecore

Thursday, February 25, 2016 Labels:
When working on a Sitecore website, quite often, I need to go back and forth between the normal website and the Experience Editor. I tried having two bookmarks for each page or module, but that grew tiresome very quickly - especially since I don't want to have a bookmark for every page on the website.

So, I got in the habit of including `sc_mode=normal` in what bookmarks I do have. And, then I simply change that to `sc_mode=edit` in the address bar when needed and vice-versa. But, that has grown old also.

So, today I created a simple bookmarklet that edits the current page's `sc_mode` on the query string.

Change to edit mode.

Drag [this link] to your bookmarks bar.

Here is the code:

    javascript:(function(){
        var q={},i,a=window.location.search.substr(1).split("&");
        for(i in a){
            q[a[i].split("=")[0]]=a[i].split("=")[1];
        }
        q['sc_mode']='edit';
        a=[];
        for(i in q){
            a[a.length]=i+'='+q[i];
        }
        window.location.search='?'+a.join('&');
    }());

One line:

    javascript:(function(){var q={},i,a=window.location.search.substr(1).split("&");for(i in a){q[a[i].split("=")[0]]=a[i].split("=")[1];}q['sc_mode']='edit';a=[];for(i in q){a[a.length]=i+'='+q[i];}window.location.search='?'+a.join('&');}());

Change to normal mode.

Drag [this link] to your bookmarks bar.

Here is the code:

    javascript:(function(){
        var q={},i,a=window.location.search.substr(1).split("&");
        for(i in a){
            q[a[i].split("=")[0]]=a[i].split("=")[1];
        }
        q['sc_mode']='normal';
        a=[];
        for(i in q){
            a[a.length]=i+'='+urlEncode(q[i]);
        }
        window.location.search='?'+a.join('&');
    }());

One line:

    javascript:(function(){var q={},i,a=window.location.search.substr(1).split("&");for(i in a){q[a[i].split("=")[0]]=a[i].split("=")[1];}q['sc_mode']='normal';a=[];for(i in q){a[a.length]=i+'='+q[i];}window.location.search='?'+a.join('&');}());

Alternate between edit and normal modes with one bookmarklet.

Drag [this link] to your bookmarks bar.

Here is the code:

    javascript:(function(){
        var q={},i,a=window.location.search.substr(1).split("&");
        for(i in a){
            q[a[i].split("=")[0]]=a[i].split("=")[1];
        }
        if(q['sc_mode']!=='edit'){
            q['sc_mode']='edit';
        }else{
            q['sc_mode']='normal';
        }
        a=[];
        for(i in q){
            a[a.length]=i+'='+urlEncode(q[i]);
        }
        window.location.search='?'+a.join('&');
    }());

One line:










Changing your Skype avatar on Windows 10

Wednesday, December 16, 2015
So, I ran Skype on Windows 10 today. And, for some reason it is showing a really old avatar, from about eight years ago. I want to change it.

Sadly, I can't find a way to change my Skype avatar using the Skype application on Windows 10. The only way I've found to change it is to use the Skype for Web website, which is currently in beta.

  1. Log into http://web.skype.com/.
  2. Click on your avatar at the top left.
  3. Click on the avatar picture at the center of the screen.

All done.


As far as Skype itself...? Uh.. I'll stick with Pidgin, thanks.

Los Cucos is my favorite place to eat!

Thursday, September 25, 2014 Labels:

I absolutely love Los Cucos Mexican Cafe in Sandy! I just bought a (basically) 50% off deal for them from Living Social.. You get $25 to spend on dinner for only $12! Woot!

Click here to get you own!

(http://www.livingsocial.com/deals/1262714-25-to-spend-at-dinner-or-20-to-spend-at-lunch?ref=mobile-link-share-post-purchase&rpi=174483234&rui=190948119)

What is the Windows 8.1 DVD Label?

Monday, December 30, 2013

I am trying to find the DVD I burned to install Windows 8.1. I have several. After screwing around with the various DVD’s, trying to figure out which one is the latest.. Google was no help. Bing was no help. The Duck didn’t know..

So, here is a post so that the next time I need the original DVD, I can know that the the

Windows 8.1 DVD label is: IR1_CPRA_X64FREV_EN-US_DVS

This also may be helpful, too: EULAID:WinBlue_R8_1_ED_PS_V_en-us. It is mentioned during the install process.

#region’s in Visual Studio

Tuesday, December 10, 2013 Labels:

I really don’t mind regions, when used correctly (ie: sparsely). The rest of the time, however, I want to rip them all out of any code I look at. I used to use some cool macros to automatically expand all regions, but since Microsoft killed macros in Visual Studio 2013..

So, for Visual Studio 2013, I settled on automatically expanding regions when a file is opened. That way people can organize their code all they want and I don’t have to deal with it.. 8^)

The extension is called 'I Hate #Regions'.

Sadly, it will only install on Visual Studio 2010 and 2012. So, open up the .vsix file into your favorite archive tool and add edit the extension.vsixmanifest file. Insert the following snippet at the end of the Vsix/Identifier/SupportedProducts section.

   <VisualStudio Version="12.0">
     <Edition>Ultimate</Edition>
     <Edition>Premium</Edition>
     <Edition>Pro</Edition>
   </VisualStudio>

That’s it. You can download the I Hate #Regions extension from the Visual Studio Gallery.

editlinks.vbs (week #25)

Wednesday, June 19, 2013 Labels: ,
This utility modifies specified shortcut (.lnk) file's paths, including the target, directory, icon, and sometimes description.

There is no usage information provided by the script itself, so here it is:

USAGE:
  editlinks.vbs [/s] [--path C:\path] "replace" "with" ["replace" "with"] ...

This will update all paths:
  • Target — the application linked to
  • Start in — the starting directory
  • Icon — the location of the icon
It will also empty the description property/field if it matches (exactly) the Target.

Here is an example:

    $ editlinks.vbs --path "C:\new-bin" "C:\old-bin" "C:\new-bin"

This will change all shortcuts that point to 'C:\old-bin' to point instead to 'C:\new-bin'.

NOTE: When retrieving the TargetPath from a shortcut, it will (sometimes?) expand any environment variables already in it. This will cause the number of changed files to seem quite large (and never go down).

Check out the source code at GitHub!

attr.exe (week #24)

Tuesday, June 11, 2013 Labels: ,
A simple utility to view and modify file attributes.. There are three main benefits of this utility over Windows' built-in attrib.exe.
  • The order in which you alter the attributes does not matter. For instance, you don't have to explicitly remove -r before -s, etc.
  • You can combine attributes as in: `attr -rsh file`.
  • You can modify multiple files via the same command-line as in: `attr -sa file1 file2 +hs file3`.
Here are the details:

USAGE: attr.exe [options] [file] [file..n] [options file..n] ...

  no-arguments    Displays attributes for all files (and
                  directories) in the current directory.

  file            Specifies a file (or file wildcard) for attr 
                  to process.

OPTIONS:

    +     Sets an attribute.
    -     Clears an attribute.

    r     Read-only file attribute.
    a     Archive file attribute.
    s     System file attribute.
    h     Hidden file attribute.

  /p --pause      Pause when finished.
  /r --recursive  Processes matching files in the current 
                  directory and all sub-directories. (also /s)
  /d              Processes directories as well.
                  (sorry this isn't implemented yet!)

     --showpath   Output each file's full path and name.
                  Default is file name only (without the path).
EXAMPLES:

  $ attr -h -s desktop.ini
    Removes the hidden and system attributes from desktop.ini.

  $ attr -hs +a desktop.ini
    Removes the hidden and system attributes from
    and adds the archive attribute to desktop.ini.

  $ attr -r +hs -a desktop.ini +hs folder.jpg
    Removes the readonly and archive attributes from and adds the
    hidden and system attributes to desktop.ini.
    Removes the archive attribute and adds the hidden and system
    attributes to folder.jpg.

  $ attr /s -h -s desktop.ini
    Removes the hidden and system attributes from desktop.ini in
    the current and all sub-directories.

Check out the source code at GitHub!
Older Posts