Posts

Showing posts from 2015

Changing system time on Virtual Box Virtual machines

Once upon a time I needed to change the system time of the virtual machine to test its behavior at specific date/time. To do that, you can use the following commands: VBoxManage setextradata "YOURVIRTUALMACHIENNAME" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1 VBoxManage modifyvm "YOURVIRTUALMACHIENNAME" --biossystemtimeoffset -36288000000 This script above returns the time 420 days in the past. Note to myself: Change this post to add also other useful commands, including the one to switch existing virtual hard disk properties (static to dynamic, its size, etc)

Javascript - Take care of Regular Expressions

These text here is my summary of things I learned while reading the eloquentJS book. In order to understand the issues mentioned in a book better, I have created a different examples. Take care when using Regular expressions in Javascript. 1) lastIndex is not refreshed, when using global regular expressions for multiple exec calls.

SymbolHound

It often happens to me that I have a part of a code which I dont understand, neither know how to search for it. These cases are those when you look for some operator shortcuts in programming codes. For example, (+) sign in PL/SQL. How to find this? Through answers of good old StackOverflow community, I came up to symbolhound . Perfect search engine for exactly those cases!

Dynamically assign fileref to external file

Sometimes, you might want to assign fileref to external file which path you get to know during some complex data manipulations. In that case, filename statement is difficult to use as filepath you need to know in advance. Along with FILENAME statement, SAS offers also FILENAME function, which you can use within the DATA step. SAS Base SAS Data Integration Studio Let's assume that you already have SAS dataset created that contains path to csv file. Then you need to: add "User Written Code" transformation (under "Data->User Written Code"), connect SAS dataset (that contains path to csv file) to "User Written Code transformation". Go to "User Written Code" properties, tab "Code" (keep "Code generation mode: User Written Body"), and in the code body write the following text right above %rcSet(&syserr... (it is sometimes hard to see, but automatically generated code has a greyish background, and

Redirect libref to WORK library in SAS

Imagine you have a SAS Enterprise Guide Project, where you have been using a libref (let's name it "SAVE") very often. However, now you want to switch it in specific occassion turn to WORK library so that it does not require a specific folder for SAS datasets to be saved. Also, you would still like to have the LIBNAME statement for SAVE libref, so that you can switch easily from WORK libref to specific path. so, the following two solutions you can use: LIBNAME save %sysfunc(quote(%sysfunc(pathname(work)))) ; the second way to do it is the following: %let workLocation=%sysfunc(getoption(work)); libname SAVE "&workLocation.";

Read multiple external files into single dataset in SAS

Reading multiple external files in SAS. For further manipulation, it looks good if these data could all be gathered in the same dataset, from which then usual data manipulation queries could be performed on. Now, if you would like to conditionally to read multiple files that have different structure, you can conditionally change the input statement. Let's say that file has the different structure if its name ends with "d" character:

Error: Invalid business key defined

In SAS DI Studio, when you try to add the column as Business Key which is already selected as a Detect Changes, you will get the error: Error: Invalid business key defined In order to resolve that, you need to remove whatever business keys you want to define from " Detect Changes " tab, it error is gone.

Java Expert RE-Learning Javascript Part 2 - Operators

What do you thing, what does javascript do with the following ? "5" + 1 - result? "51" 5 + "1" - result? "51" "5" - 1 - result? 4 "5" == 5 - result? true null == undefined - result? true How did you do? I was bad at it, especially to realize that "5" + 1 and 5 + "1" would make the same result. Javascript tries always to do conversion whenever the types of operands dont match. Javascript is pretty easy-going language. It allows you to do many things, giving you a bit of additional freedom. BUT you have to be VERY careful, as you can imagine that in some cases, above mentioned freedom might cost you a lot of bugs :) So, summary of rules in Javascript about operators: If you give Javascript different types to operate with, it will start doing type conversion. The way it would do it is based on set of (often confusing) rules. It would check first the operator, and then try to convert opera

Java Expert RE-Learning Javascript Part 1 - Intro

You know the time when you come across so many different programming languages, it happens that you come cross programming language you never really learn from scratch, but just "learn by doing". It has been like that all the way until I had "awakening" call, a job interview, where I got javascript questions which I did not know at all. The biggest issue was its similarity to Java/C programming languages, where many things I rather "assumed" it is the same, without ever really checking it out. After sobering up, I decided to RE-learn Javascript, and started reading book "Eloquent Javascript"  . after reading now already a quarter of a book, I am positively surprised how nice it was written. I strongly suggest to anyone, either a core beginner in programming (no pre-knowledge whatsoever is required to read it), or even a veteran programmer. This book has also very challenging exercises in the end which solutions (can be found on above link)
Today I listened a really nice clean-code google talk about bad practice of using IFs, and how much polymorphism helps out there. It is amazing to see how nicer code becomes, and how easy it is for a programmers to go into routine of making if/switch statements for no reason. All methods mentioned there are not new at all, but having it here shown reminds you on what and how should you think when programming.