Category: Uncategorized

  • Java Tip #10: The instanceof-operator is null-safe

    Another quick-shot Java Tip. Keeping it simple because I don’t have much time currently. It’s one of the lesser-known facts of the instanceof-operator and I’ve seen it’s applicability in some sources but YMMV.


    ##Advice Use the Java operator instanceof for implicit null-checks. Sometimes there is the need to check for both (eg. in equals()-methods), non-null and a certain class. Instead of checking for each condition seperately one can use just the instanceof operator, which handles a null-pointer in the same manner as a non-matching class.

    ##Code-Example

    Before

    ...
    if (field != null) {
        if (field instanceof SomeClass) {
            ...
        }
    }
    ...

    After

    ...
    if (field instanceof SomeClass) {
        ...
    }
    ...

    ##Benefit Small readability gain.

    ##Remarks This seems to be one of the lesser known facts about Java there can be a small confusion with other participants on the same code who interpret this to an aparently missing null-check. But this comes as no danger when the other person just re-adds the null-check, there should be no bad effect on the logic. Maybe just spread this knowledge to your participants somehow 😉

  • More mysterious Skype chat commands

    Today I’ve been curious if there were any more hidden chat commands besides the currently well known IRC-like Skype chat commands. So I decided to inspect the executable once more (I did it already once with only little success) and surprisingly I almost instantly found something completely new to me.

    A quick search on the internet also turned up nothing comparable and quick try&error also revieled not much information for most of them so the following table mainly consists of questionmarks. I tried to come up with a description where the commands reveiled a bit, but since I found absolutely no additional information for those all the meaning is just guesswork from me.

    Of course I’ll update this posting every time I find out something new or somebody gives me hints on this.

    Update 2012-11-18 – Added infos on /fork from commenters, added bunch of new commands found in recent Skype 6 version

    table.skype { border-width: 1px; border-spacing: 1px; border-style: solid ; border-color: gray; border-collapse: collapse; } table.skype th { border-width: 1px; padding: 1px; border-style: inset; border-color: gray; } table.skype td { border-width: 1px; padding: 1px; border-style: inset; border-color: gray; }
    Command Description
    /dbghelp Outputs a list of (debug?) commands but without description.
    /showmembers Lists all members of the chat with their currently assigned role.
    /showstatus Prints some infos about the current conversation. Conversation convoi id, Consumption horizon, History date and Message count.
    /showactivemembers ?
    /showname Displays the name of the original conversation. Required when querying the Skype database file.
    /showchatforms ?
    /showpendingmessages ?
    /info Displays the current and maximum number of chat participants.
    /fm ?
    /verify Shows some text about missing messages on my computer. Maybe checks the message-database for validity.
    /showaccsel ?
    /showaccfocus ?
    /accselect ?
    /debug ?
    /debugmsg ?
    /golive [token] (since Skype4?) Opens a management window in a group conversation which allows to handle conference calls. The sense of the (optional) token is not yet clear to me but seems to give you a link which you can share to others and allow them to join the conference.
    /fork [skypename/s] (since Skype5?) Duplicates the current group chat leaving out the contacts which are added to this command.
    /fork [skypename/s] (since Skype5?) Duplicates the current group chat leaving out the contacts which are added to this command.
    /setupkey [key] [value] ? Sets the “key” to a certain “value” or unsets it if no value given. Purpose currently unknown.
    /setupkey! [key] ? Deletes the “key”. Purpose currently unknown.
    /showplaces Displays a list of the currently online Skype instances using this Skype name (and have Skype version >=6 or recent mobile versions).
    /remotelogout Logs out all other currently online Skype instances which are using this Skype name (and have Skype version >=6 or recent mobile versions).
    /rsql ? sends this into the chat but does NOT show help like any other random /-command…
    /set listeners [value] ? probably another list of skype-ids which are only listeners/spectators in this chat. Changes also the output of /showmembers, but real effect still untested.
    /get listeners Shows the list of listeners set with previous command.
    /ignore ?

    Random/Unsorted additional findings

    • The name of a chat (/showname) is composed of the initial creator of the group-conversation (who gets the role CREATOR and is indicated with ‘#’ in the chat-name) and a hash.
      • If the group-chat evolved from a chat with another person, this person is also part of the name (with the role ADMIN and the ‘$’ sign as indicator in the chat-name).
    • Consumption horizon (/showstatus) seems to be the time when the last message was received from any chat-member.
    • Message count (/showstatus) is the number of messages displayed in the current window.
  • The university is dead, long live the university

    Yep, it’s done. As said last month, I’ve finished my bachelors exam two weeks ago. Unexpected for me was, that I finished this whole degree with good success.

    But there wasn’t much time to relax because last week my next step in education happened, the start of the Masters Degree Programme for Advanced Security Engineering. I mainly chose this degree because in my opinion it is the final part which finishes my education in IT which is already going on for many years.

    This degree will cover the timespan of the upcoming two years and I hope that I will learn even more new stuff about IT, engineering and even some management topics than I have learned during the course for my bachelors degree. The topics of this and last week were already very promising and interesting and the first exercises have been assigned.

    Looking forward for new stuff 🙂

  • Java Tip #9: Use CollectionUtils for evaluation and manipulation of Collections

    After quite some time this is another instance of the [Java Tips][1]. It’s an addition to the [Apache Commons][2] related [framework tips][3] which are guiding into the direction that as a developer you should take advantage of existing and proven frameworks and know their features to leverage your development efficiency. This time complexity of the given example is a bit higher than in the previous tips.


    ##Advice Use [Apache CollectionUtils][4] for evaluation and manipulation of Collections.

    ##Code-Example A short spoiler for the following code: This is a routine which checks a given set of categories against a set of category-permissions for a user. The result is a set of categories, which the user is allowed to access.

    Before

    ...
    public boolean hasPermissionsToAccessCategory(String category) {
        return (this.permissions != null && this.permissions.contains(category));
    }
    ...
    
    ...
    public Set
    getCategoriesAllowedToViewBySearchFilter() { Set result = null; if ((this.filter != null && this.filter.getCategory() != null) && (!this.filter.getCategory().isEmpty())) { result = new HashSet (); for (String category : this.filter.getCategory()) { if (this.hasPermissionsToAccessCategory(category)) { result.add(category.toString()); } } if(result.size() == 0) { result = null; } } else { result = this.getAllCategories(); } return result; } …. After … public Set getCategoriesAllowedToViewBySearchFilter() { Set result = null; if (this.filter != null && this.permissions != null && CollectionUtils.isNotEmpty(this.filter.getCategory())) { // get only categories, which are both in permissions and filter categories result = new HashSet (CollectionUtils.intersection(this.permissions, this.filter.getCategory())); // if no results, return null if(result.isEmpty()) { result = null; } } else { result = this.getAllCategories(); } return result; } … ##Benefit Huge readability gain and a safety gain. The code and intention is much clearer here and also has a smaller footprint. The maintainability has been raised because for a developer not familiar with the routine it needs a bit of brainpower to find out what the initial code really does. The removal of the additional method and usage of *CollectionUtils.intersection()* makes it much easier to understand, how the two sets are compared to each other to retrieve the correct results. ##Remarks None if you are initially writing similar logic. If you’re refactoring a method which seems to be better off with framework-provided functionality be careful and think over it a second time. Re-evaluate the code until you’re really sure because it’s easy to overlook a small detail which changes the results for a certain special case. [1]: http://kosi2801.freepgs.com/cgi-bin/mt-search.cgi?blog_id=8&tag=Java%20Tips&limit=20 [2]: http://commons.apache.org “Apache Commons” [3]: http://kosi2801.freepgs.com/cgi-bin/mt-search.cgi?blog_id=8&tag=Java%20Frameworks&limit=20 [4]: http://commons.apache.org/collections/apidocs/org/apache/commons/collections/CollectionUtils.html “CollectionUtils (Commons Collections)”
  • Home stretch of my bachelors degree

    Yes, it’s the final stretch of my current university education. On October 1st I’ll have to pass the last and final presentation and exam of my bachelors thesises. This means in the upcoming few days I have to prepare two presentations and also have solid knowledge of my bachelors thesises topics. Furthermore I have to prepare for the third part of the exam in (again) another area of expertise.

    At work I had also the chance to take over responsibility for the project I’m currently working on in the team while the project lead was on vacation two weeks ago. I’ve had some difficulties but I think I could manage them although I still have to gather some feedback on my performance during that time. What I already know is that I have to get a bit more organized during the activities of communicating with the customer, performing tasks myself, distributing tasks to others and keeping track of all new information and agreements during that time.

    Last week I also have been to Germany and receive a training on a new hardware part which is introduced in a customers infrastructure and which we’re integrating with our services. The time in Germany was quite ok but because of preparations for the university I had only few chances to have a look around in the city.

  • Back to life

    Whew, what a month. The absence of new postings was mainly caused by the fact, that I’ve been extremely busy on several fronts at once. Most importantly I’ve been busy writing my second Bachelors Thesis which had to be handed in until last night.

    Granted, I started quite late working on the thesis, but the fact that there has been a several weeks long internet-outage at my place excuses a bit, that after I finally started I couldn’t progress as planned. Furthermore at work there have been several big changes for me.

    I changed the team, shifted my focus to a different project and, as I’m one of the most experienced persons in that area, have been working a lot to meet the tight schedules and keep the team together and focussed on meeting all deadlines. Furthermore, for these changes I also had to move my workplace which took also some time to finish up completely. I was able to take some days off by short notice but progress was not as wished in this time.

    Well, the main part of the stress is now over and I hope that I can cope well with the remaining stuff. Which is preparing for the bachelor exam on October 1st. For that, some presentations need to be created and practiced and also the preparation and learning for three areas of expertise has to happen until then so that I’m able to pass.

    But at least I can breathe a bit better now. For now at least…

  • Trying CyanogenMod 6 (RC2) on my HTC Magic

    Yes, it’s been a month now since my last entry. I’ve prepared some more but never came around finishing them because there has been some stuff going on which kept me off the blog until now. Maybe (or not) on that later, this posting is about my experiences with installing and using CyanogenMod 6 RC2 on my HTC Magic.

    I tried to keep off custom hacking on my phone for as long as possible but since HTC and my provider won’t be offering an update to the current version 1.6 of Android for this phone anymore, I’ve been looking forward to try out the custom ROM "CyanogenMod" for quite some time now. I’ve just been waiting for it to include the FroYo-Changes into its content because especially the Just-in-Time compiler was something which I hoped to give my phone a new boost. And now as the second release-candidate of CM6 was out I began to read the instructions how to get the whole stuff done.

    It turned out that it’s not really that hard to flash a custom ROM onto the HTC Magic. But it’s essential to make a backup of the currently installed operating system to be able to restore it if something goes wrong or the new ROM doesn’t meet the expectations.

    For the flashing itself, I just followed the update instructions on the CyanogenMod Wiki to prepare the phone with the recovery image and to perform the initial backup. After that I just followed the instructions to install CM on the phone, using the latest Cyanogen and Google-Apps images. This was all done in a matter of minutes and after that I was running FroYo.

    The very initial impressions were very exciting, a lean and very fast system with a load of options and settings to tweak. Then I began installing all my previously used applications one after another. This took a while because I had forgotten to check all applications for possibilities to back up their data and settings and so I had to flash back the original image and back to CM6 several times. But I didn’t bother because it shouldn’t be necessary anymore after I’m finished with that.

    As time went by and more and more applications were installed I began more often to experience forced-closes where windows and applications just shut down immediately after I’ve started them. A quick connection with the adb logcat command revealed, that my phone was running extremely low on memory and that was the cause for the shutdown of many applications. Quite a turn-down. Even more so since there were many applications and services in the background, which I didn’t want or never used anyway.

    The solution to this memory issue was to insert a larger Class6 Micro-SD-card (set me back by 20EUR), reformat it using the corresponding option from the recovery-bootloader and re-writing it with the previously backed up data. After that I used Stevo’s scripts according to the instructions for setting up swap on CM5 and enabled system swapping to the SD card.

    This gave me another enormous speed boost and no closed applications anymore. Nice! 🙂 I could continue setting up my phone and restoring the settings.

    Later on I also applied the CM6 settings suggested by Vermithrax in a custom userinit.sh script (leaning on these instructions) which added a little more performance.

    In conclusion, I think I’ll keep this setup with CyanogenMod 6, although I’ll have to re-flash it at least once more if CM6 final is released. Most of the time it’s still snappy and faster to use than the original 1.6-image even if there are a ton of new features and larger applications and multithreading etc. But sometimes it still slows down to a crawl, I wasn’t able to track it down to a specific cause so far. I guess it’s somewhere rooted in the memory-settings. Have to play around with that a bit or even try to remove some of the pre-installed (and un-installable) applications like this strange "Amazon MP3" tool, which always crawls around in memory.

    Yay!

    Update 2010-08-18 The last weekend I updated to RC3. Went without a hitch, I just had to re-setup the modifications for ‘bootswap20’ with Stevo’s scripts again and remove the Amazon MP3 tool once more. Just have to get used to the new icons and bootup logo…

  • Google, Facebook and Privacy

    This is a late post on the never-ending discussion about the data privacy inside large companies, especially such data-centric ones like Google and Facebook (see later in the post). In this posting I’m referring mostly to Google and Facebook but be aware that similar discussions and many related topics are not at all limited to these companies and I just take the most known ones as an example. I’m writing this because it gets more frequently in the recent weeks that I’m involved in talks and discussions about privacy issues on different internet services, so here I try to write down my own position. I’m trying to back most of my comments with references here (be sure to check them out if you want to understand my point of view) but of course I’m already biased so take this as my completely personal opinion as of the end of 2010!

    Why I have trust in Google

    Google had to take a heavy hit when it publicly announced that it had found out that there was payload data from unencrypted WLANs stored during their StreetView programme and recently because people sent email and passwords over unencrypted WLAN.

    For me, contrary to aparently most other opinions, this causes Google to rise in my trust because I’m very sure that any other company which had a similar incident would do everything to prevent public knowledge of this. Not so Google. They proactively stepped forward, disclosed the data acquisition accident and invited public authorities to come in to review and check the collected data before they are deleting it without further processing.

    The company must have known very well that these actions would impact its image but this didn’t stop it from further cooperation in almost any aspect of this incident. For example an evaluation of official british privacy groups found no evidence of personal data in the StreetView logs although this was again stated as a disappointment (german) by other data protection groups later on. Google also let an external company review the whole process of the data acuisition and processing for the StreetView programme which came to the conclusion that the whole process did at no point analyze or process recorded data from connections in the WLAN. It really did only enough processing of the WLAN headers to be able to locate the WLAN, which was the whole point of this programme.

    Collecting WLAN data and positions is common practice and many companies have specialized in the area of geolocation via WLAN IDs (eg. SkyHook and even Apple itself), yet only Google is ranked high in the news for data breach while almost nobody criticises these other companies or thinks of real attackers who are surfing the streets and scanning unencrypted WLANs for importand data. For software developers and engineers it’s almost clear that the data breach of Google was really just an oversight (german) during the software development and I certainly salute Google to bite the bullet for a whole industry branch. It even takes complaints from its competitors who think that during this public criticism on Google is the right time to take the chance and join beating the rival.

    In my opinion Google was (and still is) one of the most respectable companies if the topic is about data security. There were of course other minor accidents with data privacy but almost every time they reacted fast and closed the holes or changed the processes within a very short timespan. As of my knowledge there has only been one incident where an internal maintenance employee who, because of its maintenance activities had access to users’ data, abused his rights and accessed users’ data without their consent or internal maintenance reasons. Google did react on this but I think it could have done faster and with a more clear statement.

    As a final hint, if someone is really interested what data Google collects for each person hop over to the Google Privacy Center and read the small and (in my opinion) quite clear (compared to any other) privacy statement. There you also have the possibility to access the Google Privacy Dashboard where you can yiew and manage almost all the data stored with your account, change the Google ads preferences or even opt-out of it and disable the statistics collection by Google Analytics. It even maintains a publicly availale list of requests from governments to Google for removing content or providing user information.

    Why I have no trust in Facebook

    Try to find such features on sites like Facebook. In fact Facebook already has a quite impressive list of similar privacy issues, ranging from simple data collection features for crawlers (which is still available to this date) to collecting data of users without accounts on Facebook (german). Although Facebook has often said to tighten up their privacy settings and make it easy for users to adjust them it’s still a very complicated process to strip down your privacy options and requires constant review of your sharing settings when you don’t want to keep the default settings and share your data with the whole world. There already have been privacy support applications created which assist you in checking and correcting Facebooks privacy settings via easier interfaces. How sick is this? Some people even think to the extend that Facebook should just give in and simply sell your data right away.

    Of course Facebook serves its original purpose, connecting people and sharing information, quite well and it may be the ideal tool for many people to do so. But in fact, I doubt that most of the users on Facebook are really aware to which extend Facebook really collects and connects information which is provided in known and unknown means by its users.

    My conclusion

    In the end I’m always a bit confused and disappointed when people state that they don’t trust a certain big company because of "privacy reasons" without having a real justification at hand to do so and then maybe even take this discussion to their Facebook, Twitter or MySpace. I personally still give Google a magnitude of trust in advance of sites like Facebook and from my current point of view there is not much possibility to change my opinion or see me creating an account on this site in the near future.

  • Quick update

    Just a lightning-fast update that I got a call last week already that there has been a seat reserved in the Masters course for me 🙂

  • Applying for the next degree course

    Since I’m in the last few weeks of my Bachelor degree programme at the University, I’ve been applying for the subsequent programme. I’ve chosen to apply for the Masters degree in Advanced Security Engineering. For me this is just the logical consequence of my overall education path as it would conclude my technical progression over the last years.

    Today I had the face-to-face talk with representatives from the University, which is part of the application procedure. All in all it was the same talk I had when I applied for the Bachelors degree. Just that I knew the interviewer, who in fact was the one who supervised my first Bachelor thesis, I knew the difficulties and challenges when studying and that I knew how I could organize everything together with my private and work life. And it was in English of course, since it’s the main education language in this course.

    I think it went quite well and it shouldn’t be much of a problem getting accepted but who knows… have to wait for the confirmation.