Sunday, November 12, 2017

Building a software product - what's one of the secret ingredients?

Recently I am thinking over what are the important ingredients when building a software product in order  to be a success. Investigating my previous experience at work and considering many open source projects, I've came to conclusion that one of the things, that is key in order to make a product people love is:

Dogfooding - Eating your own dog food is a slang term used to reference a scenario in which a company uses its own product to test and promote the product.

Several arguments supporting my claim:


  • Case study - when I evaluate a technology/product, one of the important things is who is using it and for what. No better validation but presenting to the world what you've built with the product or some exposure on how your organization is using the product internally.
  • Instant Feedback - when your company uses your product, internal teams are using it on a daily basis and give you instant and honest feedback. In most cases the feedback is for improvements and bugs.
  • UX testability - everyone wants to complete his work in the most efficient and seamless way, therefore things you don't note cause you're not using the product constantly, but developing it, are noticed easy by people who are trying to optimize their workflow.
  • Upgrades - for On Premise and even for SaaS solutions, upgrading the product may cause various problems to users. It would be hard to cover many real-world scenarios, without having some inside. 
  • Commitment - if you are using your product, it means you won't shut it down - tomorrow. This is more or less tentative, as services are being shutdown anyway. But still shows some good signs to me.

Are you dogfooding your product? If not, what's the reason?

Tuesday, August 1, 2017

Create HLSv3 videos in AWS from S3 via Lambda and ElasticTranscoder

Working on HTTP Live Streaming I've followed the AWS Mobile Blog article:

https://aws.amazon.com/blogs/mobile/streaming-videos-to-mobile-app-users-via-amazon-cloudfront-cdn/

where a nice serverless architecture is presented:

  1. Upload mp4 file to an s3 bucket
  2. A trigger watching the s3 bucket invokes a Lambda function
  3. Which invokes the Elastic Transcoder to turn the video from mp4 to HLS and saves to another s3 bucket for your usage
  4. Use in your website/mobile app via CloudFront

After I've went through all the steps I've ended up with HLSv4 videos in my Target S3 folder. They are working great in Safari or with the Chrome's Native HLS Playback extension. But, when I tried in:

  • VLC - I've got an error after loading the master-file *.m3u8. I've examined the VLC Messages console and got to the cause of the error, which       

            httplive error: #EXT-X-VERSION should be version 1, 2 or 3 iso 4


         The error means that the HLSv4 is not supported in VLC 2.x. It will be supported in VLC 3.x, which is not yet released.
          AVFoundationErrorDomain -11800 HLS


So I had to modify my Lambda function to produce HLSv3 instead of HLSv4. It's a little bit tweaking of the Presets used when encoding the video. As I've spent some time reading through the ElasticTranscoder SDK documentation and the Presets, I think it's worth sharing the lambda code for HLSv3 encoding to save some time:




Happy transcoding!

Tuesday, July 26, 2016

NativeScript + Angular 2: How to fix TNSLabel error

When using NativeScript + Angular 2, some strange errors may occur as Angular 2 is in RC and has many issues yet. Therefore some strange errors occur.

I've encountered such error while running my app in iOS emulator:


CONSOLE ERROR file:///app/tns_modules/zone.js/dist/zone-node.js:419:27: Unhandled Promise rejection: Can't find variable: TNSLabel ; Zone: angular ; Task: Promise.then ; Value: ReferenceError: Can't find variable: TNSLabel

The fix is rather easy - just remove and add the iOS platform.

tns platform remove ios
tns platform add ios

 Run your app again and you're all set!

How to: Setup genymotion/genyshell commands in zsh

After you install Genymotion on MacOS, it's installed in the Applications folder. Unfortunately, the PATH variable is not set automatically, therefore running:
genymotion
or
genyshell
in the Terminal will result in an error.

In order to fix this, so that every time you open the Terminal or restart your PC, you need to setup your profile to export and add the correct paths to the $PATH variable. Here are the steps for zsh users:

  1. Open the zsh profile for editing: sudo vi ~/.zshrc
  2. Add the following lines at the end of the file, so that the genymotion paths for App and Shell are both added tot he $PATH on startup. In previous/next versions, the paths to the Genymotion.app and Shell may have changed so you can verify these.

          export GENYMOTION_APP=/Applications/Genymotion.app/Contents/MacOS
          export GENYMOTION_SHELL=/Applications/Genymotion\ Shell.app/Contents/MacOS/

          export PATH=$PATH:$GENYMOTION_APP
          export PATH=$PATH:$GENYMOTION_SHELL

      3. You can now test your setup by running source ~/.zshrc which will execute in the current terminal your updated profile script
      4. You can see the PATH contents with echo $PATH or try running genymotion and genyshell from terminal.

Happy scripting!

Monday, June 1, 2015

Java for C# developers: Access Modifiers

Access Modifiers

(Java for C# developers)


What is an access modifier?

An access modifier is a keyword, which specifies the visibility and the access to a member (field, method, property) or a class. Therefore, it defines the rules by which your API/classes can be used and utilized - what can be changed, what should never change, what is internal and should not be exposed to anyone but the maintainer of the library, etc.

Why is it important?

When exposing your application to the world (i.e. - your colleagues, your clients) you must take care of protecting your classes and make them more robust. Here are some common cases, where taking a wrong decision can hurt you in the long term:

  • If a method is public everyone will start using it. This means, that it's harder for you to later hide this method. You cannot change what it's doing and you have to supported it happily ever after. (Note: there are ways to start deprecating methods, but it takes time and effort for everyone)
  • If a variable is public everyone has access to it and can easily modify it. This can change the behavior and correctness of your application.
  • If a variable is protected all inheriting classes will have access to it. This means, you have to keep it in the base class, but gives you the availability to provide special access to classes inheriting the base class.

Comparison

In C# libraries are organized in namespaces and DLLs, whereas in Java they are organized in packages. We can assume that libraries/namespaces and packages are similar and compare the access modifier in this context.

Access modifiers are slightly different on classes and class member levels, so we'll compare them separately.

Class

Access C# Java
default Defaults to internal - access limited to current assembly Defaults to package-private - access limited to the package
private Access limited only to containing class. Used for nested classes. Access limited only to containing class. Used for nested classes.
public No restriction on the access. No restriction on the access.

Member
Access C# Java
default Defaults to private - access limited to current class Visible across the package, cannot be access from inheriting classes.
private Access limited to only current class. Access limited to only current class.
public No restriction on the access. No restriction on the access.
protected Visible in current and inheriting classes. Visible in current and inheriting classes.
internal Access limited to the current assembly. No such keyword. Similar to no modifier - i.e. package-private.


As you can see, C# and Java modifiers are not so different. They are almost equivalent and the same concepts are applied in both languages. Most notable difference is that the default member access is private in C# and package-private in Java, so if you're used to not writing access modifiers, you'd better start explicitly adding them to prevent code problems and protect your variables.

Rule of thumb

Set the most specific and limited access possible - don't expose more from your classes than you need to.

The rule of thumb in access modifiers is shared amongst all OOP languages. Expose just as much as required and protect everything else. This can give you the freedom to change the underlying implementation, data structures and rename fields/methods which are not visible. Don't allow easy break-in your functionality.

References:

Friday, May 15, 2015

Everlive API Swagger

Swagger

Swagger is now the defacto standard for documenting REST APIs - it's widely used, known and adopted. In most cases, you add comments and meta information to your APIs in your own code, and swagger can generate an API reference for it. It's not a static one though, not only you can see the definitions, parameters and etc. but you can even give it a try, which is awesome.

Everlive

If you're using the Telerik Backend Services (a.k.a. Everlive) you may find this little project quite useful. By entering your API Key and Master Key it dynamically generates a Swagger API definition for your Content Types in Everlive. Therefore, you can easily test out stuff - add items, query items, check boundary cases like errors and etc - the best part is that you can do this without writing a single line of code.

Swagger + Everlive

The project generates dynamically a Swagger definition for an Application in the Telerik Backend Services. By providing your API and Master Keys the service extracts your Application's Metadata and generates a Swagger Definition with all your Content Types and Fields. The auto-generated content is then displayed in the nice Swagger UI. 








Give it a try and let me know what you think.

Tuesday, October 28, 2014

Open Source + Me

Hi guys,

it's been a while - but as you see I've kept my 'letter-style' of writing. Just kidding.

Recently I've came out of my "comfort" zone at work, therefore I've made a big shift from the Microsoft/.NET/C# to open source - Node/Angular/Mongo DB technologies. Adopting to this new for me world was quite challenging and knowledge rewarding. Although not feeling very confident, I wanted to start contributing somehow to the Open Source community. Therefore, I've decided to extract 2 very simple and generic projects from my personal stuff.

Minimalistic: Node JS + Angular JS + Require JS

For the past months, I've been working on a great project, involving the so-called MEAN (Mongo DB + Express JS + Angular JS + Node JS) stack. Bootstrapping the application in the beginning seemed like the hardest part and involved a steep learning curve. What I needed and wanted:

  • Web Application with Angular JS
  • With Require JS to wire up the external dependencies
  • With a minimalistic Node JS server
  • All this as simple as possible, without any overhead
  • Run in 2-3 commands from the command line

What I found out there were many seed projects, with HTML 5 boilerplates, styles, heavy Node JS server implementations and etc. So, I've setup a minimalistic seed project, which has all the points above covered - nothing more, nothing less.

The project is located at GitHub here: https://github.com/yyosifov/angular-require-seed and is truly minimalistic and simple. 

Yet, this is an Angular JS web app wired up with Require JS and served by Node. I'll definitely use it whenever I need to setup an Angular JS web app. What can be added - Grunt/Gulp make files, sample tests with Karma and a little heavier Angular JS app with a Service, Module and one more route.

Arduino: Temperature Measurer

Another minimalistic project - a sample Temperature Measurer class, implemented in Node JS. What it does is measure a Temperature retrieving the data from an Arduino device and emit event with the gathered data. It can be easily plugged in any home/office automation project, as long as you've already have the required hardware (Arduino + Temp sensor). The sample application + temperature measurer is again hosted on GitHub: https://github.com/yyosifov/temperature-measurer. As simple as it gets, I've been using this for a while and haven't noticed any side effects, yet.

Conclusion

The open source world reveals a whole new range of opportunities. It's awesome that you can learn and get inspired from the code of so many smart guys. Now I'll just have to find out how some Open Source have become viral and popular, whereas others have never been downloaded/forked...

In a bottom line, what came to my mind is the following wordplay:

Some things never change and some things always change (like technology and trends).