Monday, July 20, 2015

32-bit or 64-bit CPU

How to Determine Whether Computer is Using a 32-bit or 64-bit Processor

To find out if your computer is using a 32-bit or 64-bit Intel processor look up the model specifications at http://ark.intel.com/

If it is a 64-bit processor the following should be seen in the table  "Intel® 64: yes".

One can also run CPU-Z to find out. Under the CPU menu Instructions field you should see EM64T listed.


AMD  64-bit processors will show AMD64.

In Windows, once can also get a description of the processor by typing into a command prompt the following: wmic cpu get description

The instructions here are on how to find out if you are using a 32-bit or 64-bit CPU not how to find out if you are using a 32-bit or 64-bit version Windows operating system.  Some of the instructions found on other sites although claiming to address the former seem to be answering the latter question and not the former.

Wednesday, May 27, 2015

Working with HTMLCollections in JavaScript and jQuery

To manipulate HTMLCollections successfully, one must be able to correctly identify and select the kind of object that one is working with. Depending on the command used on an HTMLCollection a DOM element or jQuery object may be returned.  The kind of commands that can be used on such returned elements or objects depends on the nature of that element or object. jQuery methods can only be used on jQuery objects not DOM elements.

Select and Create HTMLCollection

For example to select and create an HTMLCollection from all paragraph elements in an HTML document:

JavaScript 

document.getElementsByTagName("p")

jQuery

$('p')

Access HTMLCollection and Get Item as DOM Element

To return the first element (in the above case paragraph) in an HTMLCollection as a DOM element use one of the following:

JavaScript

document.getElementsByTagName("p")[0]
document.getElementsByTagName("p").item(0) 

jQuery

$('p')[0]
$('p').get(0)

Note the above jQuery commands return the first element as a DOM element.  DOM elements cannot be modified with jQuery methods. For jQuery methods to work they need to operate on jQuery objects. So something such as $('p')[0].text() will not return the expected result.  Use $('p')[0].textContent instead.

Retrieve Item from HTMLCollections as jQuery Object

To return the first element as a jQuery object use one of the following:

$('p').eq(0)
$('p:eq(0)')
 
Since it returns a jQuery object the command $('p').eq(0).text() should work.

Resources

Thursday, May 21, 2015

Pangrams for Faster Typing

Typing Test Pangrams

 A pangram is a phrase or sentence that contains all 26 letters of the alphabet. 

"The quick brown fox jumps over the lazy dog" is probably the best known pangram.  It is commonly used as an example in typing lessons to get one used to touch typing. But there are other pangrams one could also practice typing out. Using a variety of pangrams may efficiently help increase muscle memory with varied letter combinations and patterns. Therefore typing pangrams is an effective way to improve touch typing speed.

Here are a few pangrams to use for typing practice:

Five jumping wizards hex bolty quick.
Pack my box with five dozen liquor jugs.
The jay, pig, fox, zebra and my wolves quack!
A wizard’s job is to vex chumps quickly in fog.  
Amazingly few discotheques provide jukeboxes. 
Watch “Jeopardy!”, Alex Trebek’s fun TV quiz game.
While making deep excavations we found quaint bronze jewelry.
A quart jar of oil mixed with zinc oxide makes a very bright paint.
The job requires extra pluck and zeal from every young wage earner.
The jukebox music puzzled a gentle visitor from a quaint valley town.
The public was amazed to view the quickness and dexterity of the juggler.

Pangram Typing Tips

Make sure you are in a comfortable position.

First learn them one at a time getting comfortable typing each one out over and over on its own then start adding and alternating the ones you have mastered in combination.

Practice typing for accuracy first then start typing with a view to accelerating speed.

Learn to tap the keys lightly and string common letter combinations together. 

Practice typing drills with these pangrams for a week or two and see your touch typing speed improve! 

Tuesday, May 19, 2015

Non-Breaking Space Keyboard Shortcut

Non-Breaking Space HotKey

To insert a non-breaking space also called a hard space or fixed space:

In Microsoft Office or LibreOffice type

CTRL + SHIFT + SPACE

In Windows and Notepad

Hold ALT then type 0160

In HTML use

  or  


Sunday, May 10, 2015

Customize Sublime Text 3 Context Menu in Windows 7

Edit Context Menu in Sublime Text 3

To change the right-click context menu in Sublime Text 3 and add extra commands one will need to create Context.sublime-menu file with the following general format similar to JSON:

 [
    { "caption": "-", "id": "separator" },
    { "command": "new", "caption": "New" },
    { "command": "open", "caption": "Open" },
    { "caption": "-" }
]


Example: Add the Use Selection for Find and Use Selection for Replace to the Right-click Context Menu



To determine the commands associated with the Use Selection for Find and Use Selection for Replace instructions, first find the hotkeys for the Use Selection for Find and Use Selection for Replace instructions. In the top menubar under Find one sees the hotkeys for Use Selection for Find (Ctrl+E) and Use Selection for Replace (Ctrl+Shift+E).

Open the Default(Windows).sublime-keymap file (Preferences - Key Bindings - Default) and search for Ctrl+E and Ctrl+Shift+E to find  associated commands.

One will find that the commands associated with Ctrl+E (Use Selection for Find) and Ctrl+Shift+E (Use Selection for Replace) are "slurp_find_string" and "slurp_replace_string".

Once the commands are known create a file called Context.sublime-menu in Sublime Text 3's Data\Packages\User directory containing the following:

[
    { "caption": "-" },
    { "command": "slurp_find_string", "caption": "Use Selection for Find" },
    { "command": "slurp_replace_string", "caption": "Use Selection for Replace" },
    { "caption": "-", "id": "end" }
]

Save the file.  Opening the right-click context menu should now show the options Use Selection for Find and Use Selection for Replace

Install SublimeLinter in Sublime Text 3 in Windows 7

SublimeLinter is a framework plugin for Sublime Text that allows for the use of various linters to find errors in code.  This is why SublimeLinter is a very handy plugin to install despite a somewhat convoluted installation process.

To use recent versions of SublimeLinter one will need to install SublimeLinter and the SublimeLinter interface add-ons for the specific linters you wish to use, preferably through Package Control, and also install or have on hand the linters themselves.

For example to check HTML in Sublime Text one may wish to install HTML Tidy.  To do so download through Package Control or through their website and install/extract the following:

1. SublimeLinter
2. SublimeLinter-HTML-Tidy
3. HTML Tidy

Adding Linter Path to SublimeLinter in Sublime Text 3 in Windows 7

To make sure SublimeLinter can access HTML Tidy, the location path to tidy.exe needs to be added to the SublimeLinter.sublime-settings file. In Sublime Text right-click on the screen to bring up the right-click context menu and then select SublimeLinter - Open User Settings to open the SublimeLinter.sublime-settings file. Find the portion that looks like the following:

        "paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },

If using Windows, insert the location of the HTML Tidy folder.  For example if tidy.exe and its accompanying files were extracted and then moved to a folder called HTML Tidy in C:\Program Files one would change alter the above to look like

        "paths": {
            "linux": [],
            "osx": [],
            "windows": [
                 "C:\\Program Files\\HTML Tidy"
            ]
        },

Notice the double backslashes.  The extra slashes are used for coding escape.  Save the file then exit Sublime Text. Restart. SublimeLinter should be working.  Try it out by right-clicking to bring up the right-click context menu access to SublimeLinter. Verify it is working by typing out some incomplete code and running SublimeLinter.  It should display the mistakes.

Links:

Notepad++ Sublime Text Differences

Notepad++ vs. Sublime Text

Notepad ++ and Sublime Text are two popular text editors for coding. Both are feature-rich text editor programs .  While not all features are available in both some of the features missing in one and found in the other in the default installed setup can be activated via preferences or added on with plugins but the implementation may differ in quality. After a short time evaluating these programs here is an overview of how they compare. 

Notepad++ Pros
  • Free
  • Folding based on tags
  • Matching tag highlighting
  • Replaces inside multiple files without opening them
  • Close More command
Notepad++ Cons
  • Multiple line find and replace inside multiple files cannot be done without adding \r\n per line manually
  • Single line text area entry for find and replace
Sublime Text Pros
  • Find and replace multiple lines in multiple files 
  • Multiple selections with find feature 
  • Works similarly on different operating systems
  • Find and replace in multiple files preview 
  • Intuitive auto-complete
Sublime Text Cons
  • Opens all files during replace in multiple files operation 

Discussion

The differences between Notepad++ and Sublime Text are smaller than I anticipated but those small differences can be significant in terms of efficiency.

In general Sublime Text comes across as more polished.  Its find and replace feature is more powerful.  Notepad++'s find and replace is frustratingly close to being good enough as an alternative but falls short and that short gap in features and ease of use creates a chasm in terms of productivity.

The ability to use multiple cursors is touted as an advantage for Sublime Text but Notepad++ also has a less developed but serviceable version of the feature although it is not activated by default.

The third-party validation tools can be a little complicated to setup for Sublime Text but when running are easier to work with than Notepad++'s.

Thursday, April 23, 2015

Open File Location in New Window in Windows Explorer in Windows 7

Open File Location in New Window

In Windows 7's Windows Explorer, do the following to open the folder containing a file in a new window:

1. Right-click on the file to bring up a context menu
2. Scroll down to "Open file location"
3. Hold down Ctrl and then left-click "Open file location"

Notice the above procedure is different from simply simultaneously pressing Ctrl and clicking on the file.

This can be especially helpful when after performing an extensive search one wants to evaluate a search result but don't want to keep reloading the search after evaluating each file.

Friday, April 17, 2015

Calculate Effective Interest Rate on Credit Card Loans

Calculating the interest rate on a credit card loan can be confusing because of the different interest rate terminologies and definitions.

APR

Let's take for example a loan of 10000 paid back over a one-year period with 1000 in interest added on so that at the end one ends up paying a total of 11000.

One way to compute the interest rate is to take that 1000 added on and divide by the loan amount so

1000/10000 = 10%

This interest calculation is commonly referred to as Annual Percentage Rate or APR. It is a simple calculation and, if you were to get the 10000 and then payback the loan at the end of the year as a lump sum of 11000, largely sufficient.  But for most amortized loans with a more involved payback schedule APR has the significant drawbacks of underestimating the true cost of the loan by not accounting for compounding and the time value of money.

IRR

In these cases a better computation of the cost is probably the internal rate of return or IRR.  IRR does not tend to get mentioned though perhaps because it is usually from the perspective of an investor or creditor. IRR is commonly defined as the rate at which the sum of the net present values of cash flows equals zero.  Computing IRR is better left to a financial calculator or computer since the manual computation often involves trial and error.  The accuracy of the computation is also reliant on the quality of the estimate for the discount rate applied to the net present value calculations.

Monthly Date Increase in Calc

To increase the date by a month in a series in LibreOffice's Calc spreadsheet program there are different options depending on the particular date that is to be increased.

To increment most dates  (e.g. January 12, 2000; February 12, 2000; March 12, 2000; etc.)
  1. Input the first date in the series in a cell, for example cell A1
  2. In the cell underneath it (i.e. cell B1) input the following formula referencing the cell above: =DATE(YEAR(A1),MONTH(A1)+1,DAY(A1))
  3. Click on the cell with the formula and then drag the bottom left corner handle down to fill the column with monthly incremented dates
To increase dates at the end of the month (e.g.  January 31, 2000; February 29, 2000; March 31, 2000) a little more finesse is required. Follow the above procedure but change the formula to the following:

=DATE(YEAR(A1),MONTH(A1)+2,0)

To better understanding what is going on:
 =DATE(YEAR(A1),MONTH(A1),0) ends up referring to the last day of the previous month
 =DATE(YEAR(A1),MONTH(A1)+1,0) ends up referring to the last day of the current month
 =DATE(YEAR(A1),MONTH(A1)+2,0) ends up referring to the last day of the next month



Insert Multiple Rows in Calc or Excel

Inserting Rows in Calc or Excel Spreadsheet

To insert multiple blank rows in LibreOffice's spreadsheet program Calc, immediately underneath the point where you wish to insert the rows use shift-click to select the number of rows you wish to insert, whether they have content or not, and then right-click on the numbered column on the far left and select Insert Rows Above.

To insert even more rows, using the repeat/redo keyboard shortcut Ctrl+Y may be helpful.