MoonPoint Support Logo

 


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
November
Sun Mon Tue Wed Thu Fri Sat
     
18
19 20 21 22 23 24 25
26 27 28 29 30    
2017
Months
NovDec


Fri, Nov 17, 2017 9:25 pm

Removing all lines containing a string in vi

To remove all lines containing a particular string in vi or the Vim text editors, you can use the g command to globally search for the specified string and then, by putting a "d" at the end of the command line, specify that you want all lines containing the specified string deleted. E.g., If I wanted to remove all lines containing the string "dog", I could use the following command.

:g/dog/d

That command would also remove any lines containing "dogs", "dogged", etc. If I just wanted to remove lines containing "dog", I could use :g/dog /d.

You can, of course, specify the pattern on which you wish to search using regular expressions. E.g., if I wanted to remove any lines containing either "dog" or "hog", I could use the command below.

g/[dh]og/d

By putting the leters "d" and "h" within brackets, I indicate to vi that it should remove any line that has either a "d" or an "h" followed by "og".

[ More Info ]

[/software/editors/vi] permanent link

Mon, Nov 13, 2017 11:20 pm

Limit number of records displayed in SQL output

If you have a lot of records in a table in a MySQL, MariaDB, etc. database that are returned when you use the SQL SELECT command to query for matching records, the results may scroll by so that you can't see the initially returned rows. You can limit the number of rows displayed by appending LIMIT n at the end of the command where n is the number of records you want to see at a time. E.g., if I had 100 records in a table named Sales, but wanted to page through them 10 records at a time, I could use SELECT * FROM Sales LIMIT 10; or, if I just wanted to view one field/column in the table, e.g. "Description", I could use SELECT Description FROM Sales LIMIT 10;

[/software/database/sql] permanent link

Sun, Nov 12, 2017 7:46 pm

Manually synchronizing time on a Microsoft Windows system

I noticed the time on a Microsoft Windows 7 Professional system was ahead of the actual time by 22 minutes. The system was part of a Windows domain, but the domain controller (DC) was decommissioned. I checked the Network Time Protocol (NTP) settings from a command-line interface (CLI) by opening a command prompt window with administrator level access and using the Microsoft Windows w32tm command. to check the current configuration for querying time servers.

C:\>w32tm /query /peers
#Peers: 1

Peer:
State: Pending
Time Remaining: 1441.6885058s
Mode: 0 (reserved)
Stratum: 0 (unspecified)
PeerPoll Interval: 0 (unspecified)
HostPoll Interval: 0 (unspecified)

C:\>w32tm /query /status
Leap Indicator: 3(last minute has 61 seconds)
Stratum: 0 (unspecified)
Precision: -6 (15.625ms per tick)
Root Delay: 0.0000000s
Root Dispersion: 0.0000000s
ReferenceId: 0x00000000 (unspecified)
Last Successful Sync Time: unspecified
Source: Free-running System Clock
Poll Interval: 10 (1024s)


C:>

[ More Info ]

[/network/ntp] permanent link

Sat, Nov 11, 2017 10:31 pm

Configuring a VPN connection on Windows 7

To set up a Windows 7 system to use Internet Key Exchange version 2 (IKEv2) for establishing a virtual private network (VPN) connection, take the following steps:
  1. Click on the Windows Start button at the lower, left-hand corner of the screen, or tap the Windows key on the keyboard and select Control Panel.
  2. From the Control Panel, click on Network and Internet
  3. Click on Network and Sharing Center.
  4. Click on Set up a new connection or network.
  5. Click on Connect to a workplace at the "Choose a connection option" window.
  6. At the Connect to a Workplace window, click on Use my Internet connection (VPN).
  7. At the next window you will see "Type the Internet address to connect to". Type the fully qualified domain name (FQDN) or IP address for the VPN provider, e.g., example.com, in the Internet address field. The default destination name is "VPN Connection," but you can change it if you wish to reflect the particular VPN provider, e.g., "Ajax VPN Connection". Check the check box next to "Don't connect now; just set it up so I can connect later" and then click on the Next button. Note: if you don't have a VPN service already, Hide.me offers a free VPN service you can use for testing, though it has more limited features and geographical locations than the Hide.me paid service. 1x1 px
  8. At the next window, you can provide the user name and password for the VPN account. If you don't want to have to provide those each time you establish the VPN connection, check the check box next to "Remember this password" then click on Create.
  9. When you see "The connection is ready to use," click on the Close button rather than Connect now.
  10. Then back at the Network and Sharing Center window, you can click on Connect to a Network and select the VPN connection. Or you can click on Change adapter settings which will show you the available network connections. You will need to be already connected to the Internet via a wired or wireless connection to establish a connection to the VPN. You can then double-click on the VPN connection entry in the list. You should see "WAN Miniport (IKEv2)" on that entry. If you need to make any changes to the settings, you can right-click on the relevant VPN connection and choose Properties.
  11. A window will open with fields for the user name and password for the domain. If you chose to save those values previously, you can simply click on Connect at this point to establish the VPN connection.

[ More Info ]

[/os/windows/win7] permanent link

Fri, Nov 10, 2017 5:19 pm

Removing a site's cookies in Google Chrome 62

To remove cookies for a specific site in Google Chrome version 62, take the following steps:

  1. Put chrome://settings/siteData in the Chrome address bar where you normally place URLs which will show you a list of all the cookies stored on the system.
  2. In the "Search cookies" field, type the relevant domain name, e.g., mattel.com; you will then see only the cookies for that particular domain.
  3. Click on "REMOVE ALL SHOWN" to remove all of the cookies for the domain. You will then be warned "This will delete any data stored on your device for all the sites shown. Do you want to continue?" Click on the "CLEAR ALL" button to delete all of the cookies for the domain.

You can also go directly to the list of all the cookies associated with a particular domain by putting chrome://settings/cookies/detail?site= followed by the domain name in the address bar, e.g., chrome://settings/cookies/detail?site=mattel.com. You can then click on "REMOVE ALL" to delete all of the listed cookies for the domain.

Note: Tested with Google Chrome Version 62.0.3202.89 (Official Build) (32-bit) on a system running Microsoft Windows 7 Professional.

[ More Info ]

[/network/web/browser/chrome] permanent link

Sun, Oct 29, 2017 10:10 pm

Decoding base64-encoded text in a .eml file with Python

I received an email message from someone that contained an attachment that had a .eml filename extension. When I viewed that file, I found the usual email header fields, i.e., "from", "to", "cc", and "subject", but for the body of the message I saw the following:

Content-Type: multipart/alternative;
        boundary="_000_22D42B1E120C59488B6A96BA13E639711E185536NDMSMBX403ndcna_"
MIME-Version: 1.0

--_000_22D42B1E120C59488B6A96BA13E639711E185536NDMSMBX403ndcna_
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64

QXMgZmFyIGFzIG15IGxpbWl0ZWQgdW5kZXJzdGFuZGluZyBvZiB0aGUgbWFpbCBzZXJ2ZXJzIGdv
<text snipped>
YnNwOzwvbzpwPjwvc3Bhbj48L3A+DQo8L2Rpdj4NCjxwIGNsYXNzPSJNc29Ob3JtYWwiPjxvOnA+
Jm5ic3A7PC9vOnA+PC9wPg0KPC9kaXY+DQo8L2JvZHk+DQo8L2h0bWw+DQo=

--_000_22D42B1E120C59488B6A96BA13E639711E185536NDMSMBX403ndcna_--

I needed to decode the base64 encoded text. Fortunately, Python has a base64 module that can be used for that purpose. So I created the following Python script to decode the encoded portion of the .eml file. The script expects the name of the input file to be provided on the command line and will print an error message and terminate if the file name isn't provided. If the filename is provided, the script will read the file line by line looking for the "Content-Transfer-Encoding: base64" which indicates that after one following blank line the encoded text will commence. The output will be displayed on the screen but can be redirected to a file.

#!/usr/bin/python

import base64, sys

try:
   sys.argv[1]
except IndexError:
   print "Error - missing input file name! Usage", sys.argv[0], "infile"
   sys.exit(1)
else:
   fileName = sys.argv[1]

base64_marker = "Content-Transfer-Encoding: base64"
block_of_lines = ""

with open(fileName) as input_data:
    # Skips text before the beginning of the base64 encoded block:
    for line in input_data:
        if line.strip() == 'Content-Transfer-Encoding: base64':
            break
    for line in input_data:  # Skip blank line
            break
    # Reads text until the end of the block:
    for line in input_data:  # Append lines to block_of_lines
        block_of_lines = block_of_lines + line
    print base64.b64decode(block_of_lines)

[/languages/python] permanent link

Sat, Oct 28, 2017 10:45 pm

Checking operating system information with WMIC

You can use wmic os get commands on a Microsoft Windows system to view information related to the operating system via a command-line interface (CLI). E.g., to determine the version of the operating system you can issue the command Windows Management Instrumentation Command-line (WMIC) command wmic os get version.

C:\Users\Public>wmic os get version
Version
10.0.15063


C:\Users\Public>

Or if you know the system is running a particular version of the Windows operating system, e.g., Windows 10, but want to see just the build number for that version of Windows, you could issue the command wmic os get BuildNumber.

C:\Users\Public>wmic os get BuildNumber
BuildNumber
15063


C:\Users\Public>

[ More Info ]

[/os/windows/commands/wmic] permanent link

Wed, Oct 25, 2017 10:36 pm

Viewing the fonts used in a PDF document on a Mac OS X system

To view the list of documents contained in a PDF document with Adobe Acrobat Reader DC on a Mac OS X system, with the file open in Acrobat Reader DC, click on File then select Properties and then click on the Fonts tab.

Adobe Acrobat Reader DC fonts list

[ More Info ]

[/os/os-x] permanent link

Sun, Oct 22, 2017 11:09 pm

Text not printing, PowerShell cmdlets not working, etc.

A user reported that when she printed Microsoft Excel spreadsheets or QuickBooks invoices, no text would appear on the printouts. She had reported the same problem about a month ago. When I rebooted the system then, the problem went away, but this time rebooting didn't help. After I requested that she reboot the system, I was told the problem remained, so when I was able to get to the system to troubleshoot, I first checked to make sure the system had been rebooted rather than QuickBooks simply being restarted. It was then that I noticed a lot of other functionality was no longer available. E.g., when I tried to use the systeminfo command to find the last reboot time, I saw an error message instead of the time the system was last rebooted.

Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\Pam>systeminfo | find /i "Boot"
Loading Operating System Information ...ERROR: Invalid class

C:\Users\Pam>systeminfo
Loading Operating System Information ...ERROR: Invalid class

C:\Users\Pam>wmic os get lastbootuptime
os - Alias not found.

C:\Users\Pam>

[ More Info ]

[/os/windows/win10] permanent link

Sat, Oct 21, 2017 10:13 pm

Using PowerShell to determine the installed version of Windows

You can determine the version of Microsoft Windows installed on a system from a PowerShell prompt using [System.Environment]::OSVersion.Version or (Get-WmiObject -class Win32_OperatingSystem).Caption.

PS C:\Users\Public> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      15063  0


PS C:\Users\Public> (Get-WmiObject -class Win32_OperatingSystem).Caption
Microsoft Windows 10 Pro
PS C:\Users\Public> (Get-WmiObject -class Win32_OperatingSystem)


SystemDirectory : C:\WINDOWS\system32
Organization    : Microsoft
BuildNumber     : 15063
RegisteredUser  : Jeanne
SerialNumber    : 00330-80000-00000-AA775
Version         : 10.0.15063



PS C:\Users\Public>

[ More Info ]

[/os/windows/PowerShell] permanent link

Once You Know, You Newegg AliExpress by Alibaba.com

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo