Probable bug in saml2aws workign with AWS CLI on Windows – The config profile (saml) could not be found

I’m working with the saml2aws since a while, and it was working pretty fine. However today I had a topic, which took me few hours to resolve.
At a certain time point I’ve got the error message: “The config profile (saml) could not be found”
Then I’ve called the configure and deleted the credentials file, then recreated, just removed the default profile an so on, no results.
In one of the verbose logs using the AWS CLI and the saml2aws I’ve seen the path started with N:\….., then I’ve found the file on (N:\.aws\credentials – which was my %HOMEDRIVE%%HOMEPATH%), where the file was created. This one I could then copy to the right place, what I’m doing since, when my token session expires.

Advertisements
Posted in Technical Interest | Tagged , , , | Leave a comment

Debugging Python Airflow DAG in Docker Container with Visual Studio

I need to work little more cross-platform lately, so I have a lot of things to blog on.

I actually managed to debug into an Airflow DAG written in python with Visual Studio running in a Docker container under Windows. I’ve used the ptvsd python package for it.

The most problems were caused by the line endings like :
– standard_init_linux.go:185: exec user process caused “no such file or directory”
Where the resolution is quite simple (described here and here), just save the files used by docker with Unix line endings (notepad++ > Edit -> EOL Conversion).

For the whole scenario, I’ve been using the puckel docker container and just added the ptvsd among the pip installed python packages. I didn’t manage to attach the requirements.txt as a volume – as described in its doc – under windows, so I’ve forked the repo and changed the Dockerfile.

Of course the changing of the attachment URL (in VS 2017) is also not really working 100 percent (as also described here), so port and protocol is to be added here as well: tcp://secret@localhost:5678/ where the refresh button is not working, so only pressing enter in the textbox after entering URL is usable.

Even though, that this is an obvious problem and the resolution is really simple, it took me a lot of time to figure out, what is happening there. Some types of changes broke the container, some others not :) Until the time I’ve realized, that the changes in multiple lines were the problem – omg.

 

 

Posted in Technical Interest | Tagged , , , , , , | Leave a comment

TFS 2017 (on premises) Get Latest Problem

There is a new feature in the Team Foundation Server 2017 (on prem.). You can use variables in the repository mappings. There is however a bug related to the “Get Sources” step.
If there is at least one not dynamically mapped repository, then the latest version gets calculated based on that. It usually results in not having the latest version for the dynamically mapped repository paths. The following trick solves this problem:

Just add an $(emtpy.path) variable usage into the “static” mappings to ensure the latest version for the build.

I see it in fact as a bug in TFS.

Posted in Technical Interest | Tagged , , , , | Leave a comment

Useful when starting with a Raspberry PI with NodeJS

Every time I get a new Raspi and I want to use NodeJS on it I need to do the same things earlier or later for that purpose I create a list here. The references can be found at the end.

# Update the PI's OS and its packages 
sudo apt-get update && sudo apt-get dist-upgrade  
sudo rpi-update  

# Start something on startup
sudo nano /etc/rc.local

# Set up remote desktop
sudo apt-get install xrdp

# Set up the right resolution (to be put to the HDMI mode uncomment section)
sudo nano /boot/config.txt 
hdmi_group=1 
hdmi_mode=16

# Install Node.js on PI
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
# Test it with (restart Terminal if needed)
node -v
# If the nodejs-legacy conflicts
sudo apt-get remove nodejs nodejs-legacy
# After it you may need to do the followings
sudo apt-get update
sudo apt-get install node-gyp
# Edit the /usr/include/nodejs/deps/v8/include/v8.h file as described here https://github.com/fivdi/onoff/wiki/Node.js-v0.10.29-and-native-addons-on-the-Raspberry-Pi

# In case of necessity
sudo npm install onoff
# In case of necessity
sudo npm install -g node-gyp
# In case of necessity
sudo npm install node-dht-sensor

References

http://www.linuxx.eu/2014/07/mmal-mmalvccomponentenable-failed-to.html
https://coderwall.com/p/ezb3aw/node-garagepi-the-garage-door-opener-using-node-js
https://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-remote-desktop-raspberry-pi/
https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=130217

Further useful links for reading
https://weblogs.asp.net/bleroy/getting-your-raspberry-pi-to-output-the-right-resolution

Auto Running Programs-Command Line

Posted in Technical Interest | Tagged , | Leave a comment

The best and most important page of the Git Book

Long time passed by since I’ve been writing a blog post. The reason for that was not only , that I really didn’t have so many things to blog about, but also ‘cos I’ve switched to a new company. The first article is now also not a big thing, it is about a useful link to read when learning Git branching.

Have fun on reading it :)

Posted in Technical Interest | Leave a comment

SQL Server Profiler Replay function

Recently I wanted to see how a server behaves running some SQL Statements parallel against a database on it. I wanted to simulate a real user session, so I decided to record a scenario locally, and run that against the server. I planed it using the Replay function of the SQL Server Profiler. For recording a “Replayable” session few settings are to be made, which differ from the Standard (default) template:

  • When starting a new trace go to the Events Selection Tab
  • Check the Show all eventscheckbox and add the following events:
    • Cursors group
      • CursorExecute
      • CursorOpen
      • CursorPrepare
    • Stored Procedures group
      • RPC Output Parameter
      • RPC: Starting
    • TSQL group
      • Exec Prepared SQL
      • Prepare SQL
  • Uncheck the Show all events
  • Check the Show all columns
  • For every event checkthefollowingcheckboxes in the grid
    • DatabaseID
    • DatabaseName

There you go. You can start then replay sessions :)

Posted in Technical Interest | Tagged , , , , | Leave a comment

Browser (javascript) timezone to .NET timezone (DST problem) with fallback

Yet another timezone post. Did I mention that I don’t like timezones? I don’t understand why the browser cannot only give us a timezone identifier according to a standard, like IANA.

Anyway I identified a problem related to Daylight Saving Time (DST). I needed to create an Excel file (and some PDFs) on the server side as a response to a button click. I thought immediately on the problem, that I need to send the timezone offset minutes from the browser, so that I can present correct times for the person using the app. We store date values in UTC generally in our database.

“Luckily” I started with this task on a day which was in winter time and I finished the task on a day which was already in summer time. I created a report on Friday and on Monday and saw that the corrected time was different. Oh yeah, this means, that the time has to be adopted to “local time” not according to the current timezone offset, but according to the timezone offset at the time of the “local time” according to the browser’s timezone. The solution is easy – I thought – I just need to send the timezone information to the server instead of the offset. It turned out not to be so easy.

First I wanted to get a better understanding about the topic, so I started here: http://encosia.com/how-i-handle-json-dates-returned-by-aspnet-ajax/. I’ve found everywhere pretty ugly solutions for it, like this. I just couldn’t believe, that there is no better way.  

Then I’ve found a solution for the topic with the moment.js. It was pretty hard to figure out, how to create the moment-timezone-data.js file, till I’ve found it pressing the Data button on their site (http://momentjs.com/timezone/data/), and clicking together a “Browser” variant, and copied it into the above named js file. The problem was, that the solution didn’t work for the specific time zone I needed (in Australia). Sad, but this lead to the situation, that I’ve understood the problem really.

My solution was in the end the following:

  1. As a main solution
    1. Use HTML5 Geolocation API (navigator.geolocation) to get longitude and latitude information, described e.g.: over here.
    2. The longitude and latitude information can then be combined to determine the timezone as described here.
  2. As a fallback if the user doesn’t share his/her geolocation
    1. Added the javascript library jsTimezoneDetect (https://bitbucket.org/pellepim/jstimezonedetect)
    2. Sent the IANA timezone name calculated to the server
    3. Used the Noda Time library (available on NuGet: NodaTime) to convert it to windows time zone identifier as described here: http://stackoverflow.com/questions/17348807/how-to-translate-between-windows-and-iana-time-zones.

A much more precise way is to use the new HTML5 Geolocation API, however the user cannot be forced to allow us. The jsTimezoneDetect is quite OK as a fallback solution. It worked for me for the timezones I certainly needed.

I also know that Noda Time is a bit of an overkill, as one could also just use the the Unicode CLDR for the IANA to Windows identifier resolution, but I was now just too lazy :)

The longitude and latitude information can also be combined with the data gotten from online services as described here. I didn’t like this way at all, therefor applied the solution above.

Posted in Technical Interest | Tagged , , , , , , , , , , | Leave a comment