Learning to build an Interpreter

I found the following resources really helpful in learning how interpreter and compilers work. Even if you don’t want to undertake the task of building your own compiler, I think reading through these help you appreciate the complexities involved in programming.

How to Write a (Lisp) Interpreter (in Python)

Crafting Interpreters:
A handbook for making programming languages.

 

I also recommend trying out the following exercise in building your own version of Git:

https://inst.eecs.berkeley.edu/~cs61b/fa17/materials/proj/proj3/index.html

 

 

Nuget behind corporate proxy

If you working behind a corporate proxy, and want to connect to Nuget’s public facing repository, you might need to change nuget settings.

One of the ways of adding the proxy settings is to go to %appdata%/nuget   and add the following properties:

<configuration>
    <!-- stuff -->
    <config>  
      <add key="http_proxy" value="http://my.proxy.address:port" />
    </config>
    <!-- stuff -->
</configuration>

Some people might need to specify username and password as well:

<configuration>
    <!-- stuff -->
    <config>
        <add key="http_proxy" value="http://my.proxy.address:port" />
        <add key="http_proxy.user" value="mydomain\myUserName" />
        <add key="http_proxy.password" value="base64encodedHopefullyEncryptedPassword" />
    </config>
    <!-- stuff -->
</configuration>

Unix: Getting size of a directory

To find out the size of a directory in unix, you can use the following built-in command:

du -sh file_path

Explanation

du command estimates file_path space usage
The options -sh are :

-s, –summarize
display only a total for each argument

-h, –human-readable
print sizes in human readable format (e.g., 1K 234M 2G)

To check more than one directory and see the total, use du -sch:

-c, –total
produce a grand total

If you also would like to know which sub-folders spend how much disk space

du -h --max-depth=1 | sort -hr

Generating GUID in excel

Excel is a very useful tool when trying to manipulate data and seeing the results right away. Using the built-in functions, you can generate a GUID :

The following combination of functions generate a GUID:

=LOWER(CONCATENATE(DEC2HEX(RANDBETWEEN(0,4294967295),8),"-",DEC2HEX(RANDBETWEEN(0,42949),4),"-",DEC2HEX(RANDBETWEEN(0,42949),4),"-",DEC2HEX(RANDBETWEEN(0,42949),4),"-",DEC2HEX(RANDBETWEEN(0,4294967295),8),DEC2HEX(RANDBETWEEN(0,42949),4)))

Log levels in SLF4J, LOG4J and Java default logging

As a java developer, you are most likely using one of the following libraries to log messages:
SLF4J
LOG4J
or Default Java Logging

The following table depicts the log levels supported by each framework, ranked from highest to lowest.

SLF4JLOG4JJava Logging API
ERRORFATALSEVERE
WARNERRORWARNING
INFOWARNINFO
DEBUGINFOCONFIG
TRACEDEBUGFINE
TRACEFINER
FINEST

Formatting Column in Excel to show DateTime

Excel does not have a DateTime category by default for showing data. However, you can use the “Custom” option in format cell window to select the way you want to parse and show the data.

In order to format a column to show data in datetime format, select the column, From the HOME tab expand the Number Format dropdown (grouped under number) and click More Number Formats.

Then go to the Custom section (at the bottom of the list) and type your custom format as following:

dd-mm-yyyy hh:mm:ss.000

Your data will now be shown in DateTime format. For example 29-04-2014 10:05:42.187

Querying Active Directory Information

There are multiple ways of querying for a user’s information from Active Directory. If you are a fan of writing scripts, you can use PowerShell  [AdsiSearcher] type accelerator. However, if you are more of a visual GUI person, you can use DSQuery  tool that’s comes with Windows 7.

To run the tool, open CMD window, and type the following command:

"C:\Windows\System32\rundll32.exe" dsquery.dll,OpenQueryWindow

This will bring up a GUI where you can search active directory for users by their username, email or full names.

Creating Keyword shortcuts for long URLS

One of the ways of saving websites you visit often is by bookmarking them. This makes it easier for you to visit all your favorite websites without memorizing their web addresses. However, since there are so many useful websites out there, our bookmarks tend to be filled with things we found to be interesting, but don’t visit that often. This makes the bookmarking feature not that useful for storing the websites you visit daily.

If sites or pages on a site that you visit often have a very difficult to remember address (I.e http://corp.server-120423.domain.company.net/daily-reports-for-assets-allocation.html), you can create shortcuts so that instead of typing all of that, you can visit the same page by typing : asset-reports.

To do this, we leverage the ability to create custom search engine shortcuts in chrome:

  1. Right Click on Address Bar
  2. Click on “Edit Search Engines”
  3. Scroll to the “Other Search Engine” Section and click “Add”
  4. Give your shortcut a name, then the keyword you want to type (i.e asset-reports)
  5. Give the actual url that it should redirect to and click Add.
  6. Enjoy!

The following GIF shows the steps: