Konstantin Vlasenko

An engineer is someone who can make for a dollar what any fool could make for two. – Alan Kay

Cloud adds new statement to Manifesto for Agile Software Development

The cloud is not only a new way to more easily and cheaply get the computing power needed to do what companies and individuals are doing today…
This may be the most important benefit of the cloud—it enables companies of all sizes and in all sectors, as well as governments, non-profits, and individuals, to more quickly build new applications and services – http://goo.gl/uxQcT

Cloud is agility and efficiency of computing. Agile team should be in the cloud.

It means that you should do your job completely in the cloud whenever possible. Developing, Testing, Presenting, e.t.c.

BTW: Manifesto for Agile Software Development

node.js Allow access only for logged in users

The reference to isLoggedIn in the route is an connect route middleware. Control is passed to the middleware function before the route function is called. Use isLoggedIn to verify that we have a user token in the session before we send the client the requested route.
If we do not have a user token in the session, then we redirect the client to the ‘/login’ route. This effectively locks down our routes from unauthenticated access.

function isLoggedIn(req, res, next) {
    if(req.session['FedTokenCookie']){
      next();
    }else{
      res.writeHead(301, {"Location":'/login'});
      res.end();
    }
};
app.get('/mails', isLoggedIn, function(req, res, next){
  ...;
});
app.get('/docs', isLoggedIn, function(req, res, next){
  ...;
});

Getting IP address by using AWK

The AWK utility is a data extraction and reporting tool that uses a data-driven scripting language consisting of a set of actions to be taken against textual data (either in files or data streams) for the purpose of producing formatted reports.

ifconfig | awk '/inet addr:.* B/ {split($2,a,":"); print a[2] }'

Get Spot Price History by using aws-lib

We are going to get the pricing history for t1.micro instances by using aws-lib (Extensible Node.js library for the Amazon Web Services API):

var aws = require("aws-lib");
var ec2 = aws.createEC2Client(accessKeyId, secretAccessKey);
var iType = 't1.micro';
ec2.call('DescribeSpotPriceHistory', {'InstanceType.1':iType}, function(result) {
    console.log(result.spotPriceHistorySet.item); 
  } 
);

connect.bodyParser converts FORM data to JSON format

http://senchalabs.github.com/connect/middleware-bodyParser.html

Client:

Server:

Output:

login= {
  {
    name: Velaskec,
    password: Pa$$word
  }
}

PowerShell: Wait for SQL Server is ready for client connections

The useful PowerShell script waiting SQL server is ready.
I found that waiting for starting service

while((get-service MSSQL`$INSTANCENAME).Status -ne 'Running'){Sleep 3}

is not enough.
Better to check the event log entry EventID = 17126: SQL Server is now ready for client connections. This is an informational message; no user action is required.

$ew = new-object system.management.ManagementEventWatcher                                                         
$ew.query = "Select * From __InstanceCreationEvent Where TargetInstance ISA 'Win32_NTLogEvent'"                   
while(!(get-eventlog -logname 'Application' -Source 'MSSQL$INSTANCENAME' | ? {$_.EventId -eq 17126})){
	$ew.WaitForNextEvent()
}

PowerShell: Create CSV without Header

get-process | ConvertTo-CSV -NoTypeInformation | select -Skip 1

Программисты в первую очередь ответственны за демографию в России

Интересное интервью на fontanka.ru.

Вы же не призываете население России во имя размножения сломя голову селиться в деревнях?
- Нет, конечно. Речь идёт о принципиальной смене типа поселения и внешнего вида нашего жилья, его параметров. Если выделить достаточный материальный ресурс, полностью изменить стратегию расселения людей и тип жилищных поселений, то с использованием средств современных дистанционных коммуникаций, можно организовать вполне хорошо работающий класс домашних хозяев, мужчин и женщин, которые будут заняты не только выращиванием помидоров, но и высокими технологиями, в том числе. И это будет прорыв и в экономике, и в демографическом развитии.

Давно думал над проблемой того, что софтверные компании открывают в городах большие офисы для своих сотрудников. С различных концов города каждое утро сотни программистов пробиваются на работу, через пробки и метро, чтобы собраться в команду из 3 – 10 человек. Программистам не нужны крупные офисы в городе – мы не работаем (как правило) с клиентами (как например банковский служащий), которым надо приезжать к нам в офис. Так почему бы не организовать офисы за пределами КАД? А если пойти дальше?! То социально ориентированному софтверному работодателю с деньгами, было бы разумнее выкупать котеджи или танхаусы в котеджных поселках для своих сотрудников. И поселять программистов и их семьи в этих домах на условиях аренды, с возможностью, последующего выкупа, например после 10 лет работы. Там же организовывать мини-офисы. Красота;) Соответственно, если у вас достаточно воображения – то можно увидеть, что проблема демографии будет решена!
По идеи государство должно быть в этом заинтересовано. Соответственно надо работать в этом направлении…Иначе многие уедут туда, где люди уже поколениями живут по этой схеме (не только программисты).

Random Number in a batch file

The simple way to get a random number in a bacth file.

@echo off & setLocal EnableDelayedExpansion
echo !random!

You are smart but we don’t have a such position

Would you hire an actor without an audition? You wouldn’t last long as a director if you did. But this is exactly what almost all companies who hire software developers do today. Usually the process involves talking through an applicant’s experience with them. And that’s all. Imagine asking an aspiring actor if they enjoyed their role as Hamlet. Did you play him well? Good. You’re hired! Many famous software companies propose brainteasers for their applicants. Some top companies even give candidates an IQ test. The best of them run candidates through a simulated software problem on a whiteboard. This is a sorry state of affairs. I’m going to state (what should be) the obvious: the only way to hire good programmers reliably is to program with them. I run programmers though a one-hour, rapid-fire, pair programming interview – and that’s just the start. Having done it over a thousand times, I can score developers relative to each other on a 100-point scale. What do I look for? Mental quickness, ability to think abstractly, algorithmic facility, problem-solving ability. And most importantly, empathy. Because collaboration is the most important thing we do, and it doesn’t matter how smart you are if you can’t relate to how other people think.source

Follow

Get every new post delivered to your Inbox.