Blue Computer is Happening, and why you Shouldn’t Care

Blue Computer is just my wish to have a simpler time when HTML was back in the days of version 3 and 4.01. It will be hand crafted (read hand coded) random goodness.

Were ErvinKosch.info is mainly technical goodness, Blue Computer is just randomness. Heck its using URL cloaking with the dreaded frames. Because of the frame cloaking I doubt Google or Bing will ever crawl it. But weirder things have happened.

Check it out at http://bluecomputer.twilightparadox.com/

Cloaking URL courtesy of https://freedns.afraid.org/

VisualBasic.NET is getting quietly retired, sorta of

A few weeks ago Microsoft announced they will stop new development on VisualBasic.NET:

Microsoft Plots the End of Visual Basic
Source: Thurrott

Microsoft said this week that it will support Visual Basic on .NET 5.0 but will no longer add new features or evolve the language.

“Starting with .NET 5, Visual Basic will support Class Library, Console, Windows Forms, WPF, Worker Service, [and] ASP.NET Core Web API … to provide a good path forward for the existing VB customer who want [sic] to migrate their applications to .NET Core,” the .NET team wrote in a post to the Microsoft DevBlogs. “Going forward, we do not plan to evolve Visual Basic as a language … The future of Visual Basic … will focus on stability, the application types listed above, and compatibility between the .NET Core and .NET Framework versions of Visual Basic.”

VisualBasic.NET will only have basic support in the newer open source .NET Core platform that Microsoft is moving too,

Surviving the Coronavirus: Get Offline While Staying In Touch

I’m sure you’ve heard of the Coronavirus (a.k.a. COVID-19).  You may not be sick but its effecting your life.  You can’t go out to dinner.  You can’t go see a movie.  You have to work from home online.  Your kids are at home playing MMO games and talking on Instagram.

What does most of this have common?  They use the Internet.  BTW: thanks for stopping by. Did you know that they Internet is a finite resource?

Everyone in your neighborhood are probable using the same cable company for their Internet.  So right now more and more people that are staying are pulling from same online pipe to watch Netflix and Disney+.  Things are going to keep slowing down as this tragedy keeps going into July or August. So how do you stay in touch when you have trouble streaming?

Glad you asked.  Here are a few suggestions:

Dig out the Old Radio

Most radios can pick up 20-40 FM stations and 40-100 AM stations in my area.  FM usually sound great and a lot of variety.  I’ve picked up AM stations over 200 miles away.  Plus if you lose power you can keep in contact with what is going on around.

Buy a TV Antenna

Did you don’t need cable or a Smart TV to watch TV?  You can pick up a flat TV Antenna for around $15-20 from Walmart. With those you can pick about 20 channels in most areas.  Locally I get a science fiction, weather, and crime channel along with the usual classic channels.  After you screw in the antenna TV you’ll have go into the TV’s settings and search for new channels.

10-4 Good Buddy

CB, or Citizen Band radio, is a method of two-way communication that can let you talk easily for miles and miles.  At least 5 miles in most places. You don’t need a special license to use CB. A basic setup from Walmart costs about $35. With the cheap CB’s  you get 40 channels to find someone to chat with.

Nice CB sold online or at a truck stop have something called Single Side Band (SSB). That gives you at least another 80 channels that go farther the the standard channels and sound better.

Mobile CB’s (ones you use in your car or truck) are cheaper then base stations (one that sit on a desk) but mobiles don’t get as far and require accessory plug.  What we use to call cigarette plugs. Most people are nice. But since anyone can use CB’s there are jerks out there. Of course it’s not much different then being on the Internet.

BTW: NEVER USE A CB WITHOUT AN ANTENNA.  That’s the fastest way to may your new CB into a brick.

The Walkie and the Talkie

You can pick up a pair of walkie talkies for $10 to $100.  The $10 – $15 walkie talkies can be found at your local Dollar General.  They sometimes will go further then the $100 ones.  Unless you buy recharable batteries you will be using a lot of batteries.  Also the cheap walkie takies work on only 1 channel.

FRS and GRMS walkie talkies give you great sound quality and 24 channels.  They sometimes don’t have the best range or a rechargeable batteries.  You get what you pay for.  If you buy a GRMS license you can get a lot more power and at least quadruple your range.

You can buy another kind of radio: MURS.  You wonder what kind of radios the servers at McDonalds and Arby’s use to take your order?  Its usually using a MURS radio.  The radio has a great range and great sound clarity. License free ones start around $20. The high powered that requires a licence are about $100 for a single radio but can get 25 miles easily.

BTW: NEVER USE A MURS RADIO WITHOUT AN ANTENNA.  That’s also the fastest way to make your new MURS radio into a brick.

No link are affiliate link.  I just did look ups and I copy and pasted them.

Remove Namespaces from XML Document

Below is how to remove the name spae references from an XML document. I found this useful because when I use NewtonSoft’s JSON Converter namespaces often cause issues.

using System.Xml;
using System.Xml.Linq;

void test(){
    string xml = File.ReadAllText(@"D:\TestXML\test.xml");
    string cleanXML = RemoveAllNamespaces(xml);
}

//Implemented based on interface, not part of algorithm
public static string RemoveAllNamespaces(string xmlDocument)
{
    XElement xmlDocumentWithoutNs = RemoveAllNamespaces(XElement.Parse(xmlDocument));
    return xmlDocumentWithoutNs.ToString();
}

//Core recursion function
private static XElement RemoveAllNamespaces(XElement xmlDocument)
{
    if (!xmlDocument.HasElements)
    {
        XElement xElement = new XElement(xmlDocument.Name.LocalName);
        xElement.Value = xmlDocument.Value;

        foreach (XAttribute attribute in xmlDocument.Attributes())
            xElement.Add(attribute);

        return xElement;
    }
    return new XElement(xmlDocument.Name.LocalName, xmlDocument.Elements().Select(el => RemoveAllNamespaces(el)));
}

PowerShell 6 Logical Operators

Straight from Microsoft

SHORT DESCRIPTION

Describes the operators that connect statements in PowerShell.

LONG DESCRIPTION

The PowerShell logical operators connect expressions and statements, allowing you to use a single expression to test for multiple conditions.

For example, the following statement uses the and operator and the or operator to connect three conditional statements. The statement is true only when the value of $a is greater than the value of $b, and either $a or $b is less than 20.

($a -gt $b) -and (($a -lt 20) -or ($b -lt 20))

PowerShell supports the following logical operators.

OperatorDescriptionExample
-andLogical AND. TRUE when both(1 -eq 1) -and (1 -eq 2)
statements are TRUE.False
-orLogical OR. TRUE when either(1 -eq 1) -or (1 -eq 2)
statement is TRUE.True
-xorLogical EXCLUSIVE OR. TRUE when(1 -eq 1) -xor (2 -eq 2)
only one statement is TRUEFalse
-notLogical not. Negates the statement-not (1 -eq 1)
that follows.False
!Same as -not!(1 -eq 1)
False

Note:

The previous examples also use the equal to comparison operator -eq. For more information, see about_Comparison_Operators. The examples also use the Boolean values of integers. The integer 0 has a value of FALSE. All other integers have a value of TRUE.

The syntax of the logical operators is as follows:Copy

<statement> {-AND | -OR | -XOR} <statement>
{! | -NOT} <statement>

Statements that use the logical operators return Boolean (TRUE or FALSE) values.

The PowerShell logical operators evaluate only the statements required to determine the truth value of the statement. If the left operand in a statement that contains the and operator is FALSE, the right operand is not evaluated. If the left operand in a statement that contains the or statement is TRUE, the right operand is not evaluated. As a result, you can use these statements in the same way that you would use the If statement.

Remote Logoff Windows User

I ran into an issue were my RDP session go corrupted on a test server. I couldn’t logoff. I found this page that tells you how to force a logoff through PowerShell.

# Username to logoff
$userName = 'administrator'
# Get the session id from the server.  In this case the Server ID is 'DC'
$sessionId = ((quser /server:DC | Where-Object { $_ -match $userName }) -split ' +')[2]
# Display the session
$sessionId
# Logoff the Session ID from server DC
logoff $sessionId /server:DC

If you think hard about this you could put this into a script. Just don’t call it ‘logoff.ps1’ since that is a reserved keyword in PowerShell.

Calling a Stored Procedure from OBDC

This topic came up and I found this Oracle documents about using ODBC. Here is an excerpt:

XIV. Calling a Stored Procedure Via ODBC

[See also the Stored Procedures from Microsoft  Visual Basic section of this paper.]

The following is an example of the Visual Basic syntax for calling a stored procedure via ODBC:

db.ExecuteSQL(“{CALL procedurename(param1,param2,param3)}”)

NOTE: This assumes input parameters only and that you have assembled this such that each of the parameters is embedded into the string as a literal. Also note that this syntax DOES NOT work with packaged procedures, for those you must use the alternative begin …end; syntax

In the above example dB is assumed to be a valid database object. If you are using a tool such as MSQuery just use the {CALL …} (ODBC Procedure Call Escape) syntax without the double quotes. You must include the () even when you don’t have any parameters. Out parameters are supported at the ODBC Level 2 conformance (Oracle7 ODBC Version 2.x). The Oracle Level 1 drivers (Version 1.x) will not support this, you must be using a Level 2 or better driver. The 7.3 Oracle driver does not support returning dynasets. This functionality is first implemented in the 8.0.5.x version of the driver. An alternative to the call syntax is shown below:

db.ExecuteSQL(“BEGIN procedurename(param1,param2,param3); END;”, SQLPASSTHROUGH)

This alternative does require the use of the SQLPASSTHROUGH parameter, but will also allow for calling packaged procedures (i.e. packagename.procedurename()).

To return a result set with a stored procedure, refer to the following Microsoft knowledge base articles:

  • Q147938 (RDO)
  • Q126992 (DAO)

The Microsoft provided Oracle ODBC supports this functionality through the use of PL/SQL table types. The Oracle provided drivers do not support this functionality prior to version 8.0.5.x (where it is implemented in PL/SQL by returning a REF CURSOR).

For simple output parameters from a stored procedure you could use the following SQL:

{call procname(?,?)} The above would be passed to SQLExecute() and then have called SQLBindCol() or SQLBindParameter() for the output bind variables (the variables referred to by the ‘?’) you defined in your program. [Note: the Begin; … End; syntax would also work just as well here.] If you are using the Oracle 8.0.x ODBC driver and receiving an ORA-6502 and/or ORA-6512 errors, you must upgrade the driver to version 8.0.3.0.1 or later and update your MDAC to the latest version.

Have someone else make you password for you

For me I’m always trying to think of a good password without mashing my keyboard. Here are a couple of sites I use:

  • [Strong] Secure Password Generator – Favorite – I put ‘strong’ in brackets because if you search for it Google shows it as ‘Strong Secure Password Generator ‘
  • Norton Password Generate – The antivirus/antimalware company has their own generator. It pretty good and configurable. It’s not my favorite because most of the is cover for advertisement for their other production.
  • LastPass Password Generator – Tons of configuration and really ‘pretty’
  • DashLine – Another pretty with nifty slider. This site was made more for mobile use. So the toll elements may look huge on a conventional monitor.

Find All Columns and Tables in Oracle

Source:
https://www.thepolyglotdeveloper.com/2015/01/find-tables-oracle-database-column-name/

Depending on your access you will use one of the following queries:

-- Standard Users
select table_name from all_tab_columns where column_name = 'PICK_COLUMN';
-- DBA Users
select table_name from dba_tab_columns where column_name = 'PICK_COLUMN';
-- Just want to see what table looks like
describe namespace.tableName

If you want some database tool here are ones I like. I usually go for the ‘kitchen sink’ toolsets:

Updated 5/15 – Add looking for column in a known table

SELECT * 
FROM all_tab_columns 
WHERE table_name = 'MyTableName'
ORDER BY COLUMN_ID;

Month Names (Stupidly Useful)

Often times I want the stupidest things in an array or table. Today’s item is month’s name.

Month Names in a Table to Copy and Paste to a Spreadsheet

Month Name 3 Letter Name Zero Based Index One Based Index
January Jan 0 1
February Feb 1 2
March Mar 2 3
April Apr 3 4
May May 4 5
June Jun 5 6
July Jul 6 7
August Aug 7 8
September Sep 8 9
October Oct 9 10
November Nov 10 11
December Dec 11 12

String in Various Arrays

// Javascript - Zero based array
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

// Javascript - One based array
var monthNames = ["Shift 1", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

// C# - Zero based array
string [] monthNames = new string [] {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

// C# - One based array
string [] monthNames = new string [] {
"Shift 1", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

Why have a one based array?
Most people will enter months starting at ‘1’ not zero. Most date object return January as a 1. Use which work best for you.