Posts

Showing posts with the label java

Getting PID in Java/Scala (cross-platform)

The Scala/Java environment has a certain lack of features regarding process management - it's in a very good shape, but sometimes we need more. It's totally understable considering that the underlaying system is the JVM (in most cases), however once in a while we have to leave the sandbox. That was the case I've faced, and it got me to the problem how to get the ID of the process I started in JVM for various operating systems.

Simple HTTP/HTTPS server on Scala/Akka

Let me present a simple Scala script to serve local files over HTTP or HTTPS. I've used Scala/Akka to get the good performance and to play around with the programming language I really like. Toolchain We need Scala, SBT (Scala interactive build tool), Conscript  (a distribution mechanism for Scala apps) and Scalas (the script runner for Scala). Conscript is needed only to install Scalas here, so you may want to install the runner manually (see the Scalas link above) if you don't want to install Conscript. For Mac OS X we're going to use Homebrew to install Scala and SBT:  $ brew install scala sbt Next step is Conscript (please follow the installation instructions on the official site):  $ wget https://dl.bintray.com/foundweekends/maven-releases/org/foundweekends/conscript/conscript_2.11/0.5.1/conscript_2.11-0.5.1-proguard.jar  $ java -jar conscript_2.11-0.5.1-proguard.jar Next step is installing Scalas (please follow the  installat...

glSatellite Demo

Image
During my research for 3D graphics application development I've noticed that a lot of tutorials and advices on the Internet are obsolete, imcomplete or even incorrect. That's why I've decided to create an open source technological demo of OpenGL for Android platform. That's just a demo, so it doesn't have any particular useful purpose, but shows the methods and algorithms to accomplish certain tasks. For now the application reads public NORAD satellite database and shows the satellite positions and altitude related to Earth in the form of beams (the height of the beam represents the relative altitude). The 3D features present:  - OpenGL ES 2;  - rotating, multi-touch zooming and moving the globe;  - stars on a fixed background;  - each satellite is represented by a beam with a unique color;  - identifying the corresponding satellite if a beam has been tapped (based on color picking method). Additionally to 3D features presented the application is: ...

split function behavior differences

A little note from my debugging experience. Split function works differently and I would say unexpectedly for empty string in different programming languages, and it can cause difficult to find bugs (especially if you use a lot of languages simultaneously). I've created a table with the popular programming languages: Language Split without parameters Split with parameter Python ''.split()=[] ''.split(',')=[''] Ruby ''.split()=[] ''.split(',')=[] JavaScript ''.split()=[''] ''.split(',')=[''] PHP N/A explode(',', '')=array(0=>'') Java N/A "".split(",")={""} C# "".Split()={""} "".Split(',')={""} As you can see sometimes it returns empty array, but sometimes an array with the one empty element. So please be careful with the split operation :)

Facebook and PHP

There is a common mistake about "If everybody use it, so I also have to use it - millions of people can't be wrong". Apparently, they can, and huge codebase, support and knowledge mean nothing, otherwise we would still use Fortran, Cobol, Basic and other almost died monsters. Also there is an another common mistake about "If big corporation use it, I also have to use it". It's very doubtful, almost always decision are made in hurry and/or by wrong people and/or without serious consideration. And after some period of time, it's difficult to nullify previous decision because it would require huge efforts. Good example - Facebook. Let me quote the presentation  HipHop for PHP Tech Tasting : PHP is problematic for Facebook: High CPU usage High memory usage Reuse of PHP logic in other systems Extensions are hard to write for most PHP developers But huge codebase, strange affection towards PHP (in what universe "loose typing and universal ar...

Seven Ws (composing brief software requirements)

Quis, quid, quando, ubi, cur, quem ad modum, quibus adminiculis. (Who, what, when, where, why, in what way, by what means) Hermagoras of Temnos Quotation above is created by Hermagoras for defining seven "circumstances" as a way of the formulating or analyzing rhetorical questions. But it is useful for many other areas, like for composing brief software requirements. Sometimes it's essential for us to analyze the perspective project as fast as possible, without creating tremendous SRS, but merely ask few questions and begin to work. Especially, it relates to Agile Development, and can be easily used as a reference point for starting a project. Let us interpret these questions to ones of the sample meanings: Who will use that project? What kind of software does the project represent? When should the project be delivered to the end users? Where is the project intended to be used? Why would the project be successful? In what way is the project supposed to w...

Thunderbird Grammar Checker add-on

Image
Official Thunderbird Grammar Checker add-on: https://addons.mozilla.org/thunderbird/addon/14781 Back-end functionality is based on LanguageTool functionality (in particular, the add-on uses its webserver). Though it can work without any further customization, it is strongly recommended to setup a local LT server (see below), and change the add-on preferences to use your server. By default, the add-on uses the local server and falls back to public LT server (that can't handle the high load and can't guarantee the privacy). The grammar checking is available via Tools menu, the context menu and the corresponding toolbar button. Language and server settings can be changed using the add-on preferences: Supported languages : English (en), Dutch (nl), French (fr), German (de), Italian (it), Polish (pl), Romanian (ro), Russian (ru), Slovak (sk), Slovenian (sl), Spanish (es), Swedish (sv), Ukrainian (uk), Asturian (ast), Belarusian (be), Breton (br), Catalan (ca), Chines...