Posts

Modal Dialog Route in Angular

The other day I was working on a pet project in Angular. One of the things I wanted to achieve was to have a route which will show a popup. In simple words the case looks the following: the user is on a main page https://pet-project.com/ , then navigates to https://pet-project.com/create through a link etc. and gets a popup dialog on top of a main page. Showing one page on top of the other can be simply done through child routes (make sure your parent view has a router-outlet to show child components): import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { FeedComponent } from './feed/feed.component'; import { DialogComponent } from './dialog/dialog.component'; const routes: Routes = [ { path: '', component: FeedComponent, children: [ { path: 'create', component: DialogComponent }, ] } ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports

Mastering an IT Department

I've been managing IT projects and departments for a couple of years, and there is a number of patterns that pop up quite clearly. When the new engagement starts, it likely falls into one of two categories: greenfield or legacy. Greenfield is simple on its own - you will get a business idea, or vision, more or less refined. Maybe you will also inherit a team that is over the forming crisis and is ready to perform. The rest is simple - you follow the book, pick a process, plan and roll the ball. Legacy is a different story. You get some documents. You get some processes. You get some deliverables. And it all was managed if you're lucky. I never was. In a perfect world I can imagine a picture, when there was a manager, and they were managing a project successfully, but personal reasons kicked in and the y had to hand over. Possible? Of course. Probable? Nah. Most likely somebody decided to put a manager into a department because it became a mess. If you get a half

Higlight code on Blogger with highlight.js

While redesigning my blog a little, I've realized that having no code highlighting on a blog aboud code sounds silly. After looking around, I decided to attach this great highlight.js library to my blog engine. As there is a bunch of articles on how to do that, I'll bet on making mine short. There are 2 steps you need to do to enable code highlighting in your blog: 1. Add highlight.js assets to the bottom of your site's template, e.g.  blogger.com > Your Blog > Theme > Edit HTML : ... <!-- highlight.js --> <link href='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css' rel='stylesheet'/> <script src='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js'></script> <script>hljs.initHighlightingOnLoad();</script> </body> </html> (replace default.min.css with theme you prefer ) 2. Wrap your code into pre/code tag

CircleCI CLI on Windows

Yesterday I was setting up a continuous integration for my recent project https://github.com/veton/dotScript , and at two of the most popular tools supporting GitHub: Travis CI and CircleCI . Travis is the popular out there, but I really liked the idea behind CircleCI of running builds witin containers, and I jumped into an opportunity to play with contriners so.

Proxy ASP.NET HTTP Handler

From time to time you may need to have a simple proxy to overcome limitations introduced by your intranet security settings. As a solution, you can create a simple HTTP handler that will route all requests through the server, like: http://server/proxy.ashx?get=http://target.com/feed.xml To have this running, just create a file called get.ashx in your www root, make sure you assign an AppPool running .NET 4.0+, and you are good to go: <%@ WebHandler Language="C#" Class="ProxyHandler" %> using System; using System.IO; using System.Net; using System.Web; public class ProxyHandler : IHttpHandler {     public void ProcessRequest(HttpContext context)     {         string urlString = context.Server.UrlDecode(context.Request["url"]);         Uri url;         if (!Uri.TryCreate(urlString, UriKind.Absolute, out url))         {             context.Response.Write("URL query parameter can not be parsed");             return;         }         We

FancyBox onCleanup not working

Today faced a bug on my pet project where part of the form was not sent to server, thus breaking save record functionality. After an hour of investigation traced issue back to FancyBox not firing onCleanup where I bring inputs back from FancyBox to the form they belong: $.fancybox({     content: $("#RecordAttributes"),     onCleanup: function () {         $("#RecordAttributes").appendTo(SvgEditor.Form);         $("#RecordAttributes").hide();     } }); Tried to yield plugin some time before sending form, just in case it intends to call onCleanup asynchronously - nothing helped. Last resort was to jump to FancyBox sources to immediately realize that API canged and now the callback is called beforeClose. Adopting the change sorted an issue: $.fancybox({     content: $("#RecordAttributes"),     beforeClose: function () {         ...     } }); So now my users are happy and me earned some sleep. Cheers

Blocking access to IP using iptables on Android

Long time since I last posted anything here. The shift of topic would is another kind of surprise 😎 So moving to subject of this post. Today I got an application on my Android phone which was using IP geolocation to determine where I am and block some features based on the IP address. Lets refer it as NastyApp going forward. The most obvious solution would be to use proxy/VPN to mask my location, but that would require me to remember run VPN each time I need an application. So going the hard way from here... Step 1. Determine which IP needs to be blocked There is a couple of application in the market to track where application is going. After playing with those I found NoRoot Firewall to be a perfect fit: you just enable it and all the traffic becomes routed through virtual VPN and intercepted by application. At this point I allowed all the destination IPs for NastyApp and started disabling those 1 by one and checking application until it finally failed to track a IP locatio