Back To Basics

Here the other day, I got the question: ”How do I become a good developer? (OOP)”…

My reply…… Know your patterns!

It’s hard to write a blog post on basic object design and OOP without writing about the analysis aspect of OOP. Even still, I do not explain about Use case analysis, Domain models etc. even though these are equally important for the development process.

When starting to develop applications, nobody has all the ideas in their heads at first. It’s a combination of experience and knowledge of the basic patterns that make the application come to life. The more experience the developer has, the more of the “design” goes on by reflex and inside the head, and thus faster. Just a little note here: The fact that the design comes by reflex and goes on inside the head of the developer is also a downfall! If you’re not able to document the process of your work, you have failed in designing it properly! The software you’re designing should be documented to an extend that another developer can pick up the code and develop on it further with easy understanding of what is going on. That’s my humble opinion.

There are many details to developing, and in this blog post I don’t go into detail about the Unified Process, Scrum or any other iterative analysis & design development processes, even though these processes are at the heart of Object Oriented Programming. Actually, to be a good developer, the first question you need to answer is – What is Object Oriented Programming? And thereafter you can throw yourself at object design patterns.

There are many ways to answer what OOP is, but here is my version:

OOP is a way to create an abstraction of real life, a way to model objects so that the software is maintainable and manageable. You do this to be able to divide complexity into smaller pieces to make a better overview. E.g. If you are working on an airplane, then you model the necessary pieces only to be able to have a better overview. There is no need to model the outside of the plane, if the software only revolves around the inside of the plane.

This is done by following the three fundamental pillars of OOP:

  1. Encapsulation
  2. Inheritance
  3. Polymorphism

Encapsulation – A way to hide complex functionality from other objects, and that way it is also used to protect data and methods/functions in a class from being accessed. E.g. If a person walks up to an elevator and pushes the button to get to another floor, then that person is shielded from the “physical” things such as cables, cogs etc. and from the “software” things such as algorithms etc.

Inheritance – Enhances code reuse, by letting a programmer inherit from a class, and further build upon this class in own code. E.g. A developer made a class called Animal, and you want to utilize the functionality of this class, but still define your own functionality. You could then inherit from Animal into your own Dog class, and utilize the functionality inside Animal, while further defining your own in the Dog class. This also forms the basis for polymorphism.

Polymorphism - Makes it possible to access objects of different types through one reference variable. This makes that the same method/function name can have different implementations.

This is not necessarily adequate but it is a step in the right direction, and I urge you to read more about the pillars of OOP.

Basic patterns of object design

Now we enter the realm of object design, and it is here we find some basic patterns that assist the developer in creating an application that lends itself to the pillars of OOP, and makes the design strong and maintainable. Please keep in mind that these patterns are the basic of OOP so there’s no magic going on here. I’ll start by listing some of the patterns and follow up with a short explanation and a question you should ask yourself when applying the relevant pattern.

  • Creator
  • Information Expert (Expert)
  • Low Coupling
  • Controller
  • High Cohesion

There are more than mentioned above, but the listed patterns provide the stepping stones for object design. Patterns I won’t mention here are:

  • Polymorphism
  • MVC (Model View Component) *
  • Pure Fabrication
  • Indirection
  • Protected Variations

* When you follow the basic of the mentioned pattern principles, you should end up with the result of the MVC pattern.

When an understanding of the six mentioned patterns are in place, I urge you to read up on the last basic patterns. There might be more basic patterns out there, but the before mentioned are the ones I feel are necessary to understand object design.

The nine patterns listed are all part of the “GRASP Pattern” Which stands for General Responsibility Assignment Software Patterns. I know that it should be called “GRAS Patterns” but the emphasis is on the importance of the developer does “GRASP” the concept and therefore the name.

Creator

The most common thing in software development is the creation of objects, and here there are some principles surrounding who should have the responsibility of creating the object.

Question: Who should be responsible for creating a new instance of the class?

Answer: Let class Two create class One if:

  • Class Two contains Class One or Compositely Aggregates Class One **
  • Class Two “records” Class One
  • Class Two uses Class One to a large extend
  • Class Two contains the initializing data for Class One (Which makes it an Information Expert in regards to creating Class One)

If more bullets fit, go for the first – Contains or Compositely Aggregates.

E.g. when having to create a chess game, which object should create the chess-piece instance, ChessBoard class or Dice class? Well, the ChessBoard and ChessPiece classes have a Compositly Aggregates relationship, and therefore ChessBoard would be best.

** Composition: Imagine that you have a Chess board (Composite) which contains Chess-Pieces (Parts) then the Chess-board (Composite) is always responsible for creation and deletion of its Chess-Pieces (parts). An instance of the part (Chess-Piece) belongs to only one composite (Chess-board) instance at a time. And last but not least, the part (Chess-Piece) must always belong to a composite (Chess-board), meaning that cannot exist a Chess-Piece if there is no Chess-board. This is the core meaning of Composition.

Information Expert

When developing software, there may be thousands of classes that require thousands of responsibilities to be fulfilled. These responsibilities should be assigned to make the code easier to understand, maintainable and lend itself towards code reuse.

Question: What is the principle of assigning responsibilities to objects?

Answer: Assign the responsibility to the class that has the Information necessary to fulfill the responsibility.

The important thing here is to start out by clearly stating the responsibility! E.g. who should be responsible for knowing the total amount of chess-pieces?

Do note that this could involve many classes in order to get the information needed. E.g.

Design Class

Responsibility

Sale

Knows sale total

SalesLineItem

Knows line item subtotal

ProductDescription

Knows product price

To fulfill the responsibility of knowing the sale’s total you need to assign responsibility across several classes, which is also known as partial Information Experts collaboration.

Low Coupling

In development of OO applications it is as mentioned before important to have low dependencies among the objects, so that changes to an object doesn’t effect a long range of objects, and to enhance the ability of code reuse. Low Coupling is a way to “measure” how strong one object is depended (has knowledge of or relies) on other object. High Coupling is very undesirable because it forces local changes due to changes in related classes, makes code reuse almost impossible due to the high degree of dependency, and it makes the code harder to understand. All of this strives directly against the pillars of OOP.

Question: How to support low dependencies, low impact on changes and high code reuse

Answer: Make sure to assign responsibilities so that coupling is low, and always use this principle to consider alternatives.

one

Above image shows BookStoreRegister creating both BookStoreSale and Payment. But in reality there is no need for BookStoreRegister to have any knowledge of Payment.

two

Instead, using the principle of Low Coupling, let BookStoreSale have the knowledge of a payment, and minimize the dependencies among the objects.

Controller

This is a very comprehensive pattern principle, and I will only briefly describe it, but encourage you to read more elsewhere.

A controller - sometimes also referred to as a Facade – is the first object after the UI and is responsible for receiving or handling operations (input events). The overall meaning with this principle lies in, that the GUI classes should not have any knowledge of the data handling classes in the system (and the classes should not have any dependencies on the GUI classes. In short, you should be able to apply new GUI classes to a system without affecting the data handling classes.

Question: What first object after the UI layer should receive and coordinate (forward messages) a system operation?

Answer: The responsibility should be appointed to a class of one of the following choices:

  • It is a model of the overall “system”, or a “root object”.
  • It represents a use case scenario.

Often you would invent a class especially for the purpose, and they are often identified by the name ending on Handler (or Session for web development). (IMAGE THREE)

three

The job of this Controller class is not to handle the events, but merely to foreward the messages to the correct classes. Usually there are several controller classes in a system, and controller classes are often grouped to forward messages to multiple objects at a time. Just be aware of bloated controllers!

When talking about controller pattern principles, there are some things you should dig deeper into that I will not go into here:

  • Boundary objects
  • Entity objects
  • Command patterns
  • Pure Fabrication

High Cohesion

When designing objects, High Cohesion is a measure of how focused the responsibilities are within an object (keep it simple stupid). A class shouldn’t do too many unrelated things, or do too much work! This would yield low cohesion, which makes the classes; hard to understand, hard to reuse, hard to maintain, and make them dependent and highly affected to changes elsewhere in the system.

Question: How to keep objects focused, understandable and maintainable?

Answer: Assign responsibility to honor High Cohesion.

This pattern principle is highly affected by the before mentioned patterns, but in general the aim should be on yielding Low Coupling and High Cohesion when designing these objects.

The patterns listed in this blog post are only a small corner of the heart of OOP. But it should give the basic knowledge of object design. This blog post is only intended as an appetizer towards OOP and object design, and does not provide full justice to the subject. Please use this post as a short appetizer and go explore more on this fascinating subject.

I can recommend this book for reading - Object Oriented Software Engineering Using UML, Patterns, and Java - written by Bernd Bruegge & Allen H. Dutoit.

Currently rated 1.5 by 4 people

  • Currently 1.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 11/3/2010 at 3:36 PM
Categories: Programming | Basics
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Is the monolithic structure the best for a smart phone?

The Neo FreeRunner smart phone

clip_image002The Neo FreeRunner is a touch screen smart phone, which operating system is based on Linux. The phone is intended to be used by software developers familiar with Linux as the general consumer, but in time as development progress, this audience should broaden to all phone consumers. Software developers have taken the Neo FreeRunner to their heart because of the total freedom they have to use it, and to design software for it. In time the broader consumer will appreciate the high quality product, the performance of the phone, and the wide range of free software packages expected to emerge in time. This will allow users, to make the maximum use of the hardware by tailoring it to fit their needs.

Is it usable?

At present time the Neo FreeRunner is fully functional. It is used by many as a day-to-day phone. There are many phones with fully functional GPS, and there is good software (Locations, TangoGPS, Navit (for use in cars) and many more) to use, especially with OpenStreetMap. With the current shipping, the battery life is only a little over one day, and it has an alarm clock, media player, internet browser, game console, email reader and contacts manager: all in different version, which can be downloaded and installed (all open source and free). The new version called GTA07 is available.

How much does it cost?

The Neo FreeRunner is sold through many channels (this includes www.openmoko.com) and the official price has been set to ca. €290 , but the price may vary slightly from country to country.

Hardware specification of the Neo FreeRunner GTA02

clip_image002[9]

  • Display- Topply o2.8, 480 x 640 pixels, VGA, 200 NIT minimum, resistance type touch
  • User Interface Navigation- Touch screen on LCD, 2 control “buttons”, 1 Power button, 1 Aux for 911 emergency call
  • Built-in 802.11b/g Radio (Atheros chipset AR6001 Flash version)
  • Built-in Bluetooth 2.0 + EDR (CSR and support PCM audio , BC4 firmware version)
  • Built-in 2D/3D graphics acceleration chip (S-Media 3362)
  • 2 built-in Tri-Axis sensors (ST accelerometer LIS302DL)
  • Built-in GPS Radio – -130 dBm with internal antenna, -157 dBm tracking on chipset specification, TTFF under 40 seconds with -130 dBm signal strength, and tracking (u-Blox)
  • Antenna – Specialized antenna for best in hand hold GPS, GPRS and Wi-Fi/Bluetooth performance are required, -105dBm on receiving, Tx 30dbm+2 on GSM
  • External Antennae – MMCX GPS connector
  • GPRS Radio –GSM/GPRS radio. A Pre-PTCRB certified module will be preferred
  • Linux – Linux kernel 2.6.24 or later Openmoko kernel
  • USB - Client and Host-mode switchable (to be used for software downloading), provide host 5V power

The dicussion with back ground

Linux kernel 2.6 (Monolithic kernel)

The Linux kernel is developed by Linus Torvalds, but maintained by thousands of individuals. It is a monolithic operating systems structure, which is constructed in a layer fashion. The system is constantly enhanced to make it fit the needs of the marked (in embedded systems, PC systems and servers). It is enhanced so that it often changes its structure. System functions like the process and memory management, the process and thread scheduling, drivers and I/O is implemented in kernel space - where I/O communication are provided by modules, which can be inserted/removed in runtime – they are all built against the kernel. Now when the all that functionality is built against the kernel, this also means that if the kernel changes, so does the set of modules. To add or change features provided by the hardware, all the “layers” above the changed one also has to be changed, this is of course a worst case scenario, but it still if the concept change too much in the kernel, things such as modules ( I/O communication and parts of drivers) needs more than just a recompilation, it needs a complete code modification. The Linux 2.6 kernel does support soft real-time performance. This is done through a configuration of the kernel, to make the kernel fully preemptable, this is done with a new configuration option for the kernel, that changes the behavior of the kernel by allowing processes to be preempted high priority work is available to be done (if the standard 2.6 kernel is used, then when a userspace process makes a system call, a high priority process have to wait until the call is complete before getting access to the CPU).

The Microkernel

The idea of the Microkernel appeared in the late 1980’s, and the concept was to move as much as possible out of the kernel space (and into the processors first-level cache) and in to user space, meaning to reduce the kernel to basic process communication and I/O control and let the other system services live in user space in the form of normal processes also called daemons. There exist daemons for handling memory management, one for process management, one for managing drivers, and so on. Because the daemons do not run in kernel space, a context switches are needed to allow user processes access to the kernel (to run in kernel mode). In the memory management of the microkernel (L4) every process consists of three primitives. A process maps its memory pages to another process if its wants to share these pages. When a process gives the pages to another process, it can no longer access them, and they are under the control of the other process, as long as the first process does not flush the pages. This means that if a process flushes its shared memory pages, it retrieves the control back on those pages. The system now works as follows, the microkernel reserves all memory at startup, to one process called a base process (which live in user space, all processes do), and if another process needs memory, it can directly ask the base process for memory, which saves the trip down through the kernel. Because of the way processes are built in the microkernel (with the three primitives: grant, map and flush), a process can only grant, map or flush memory pages, memory protection still exists and the overhead of context switches is reduced.

What is the ultimate operating system for the Neo FreeRunner?

I believe that the Microkernel structure is the best way to make the mobile phone stable. When looking at the kernel structure of the microkernel, there are several smart phones on the marked based on the microkernel structure, purely based on the stability of the kernel, and because the further development on the kernel has a higher degree of maintainability. If one were to add a new features to a monolithic system (e.g. a new memory management routine), it means recompilation of the whole kernel, often including the whole driver infrastructure. If you have a new memory management routine and want to implement it into a monolithic architecture, modification of other parts of the system could be needed. In case of a microkernel the services are isolated from each other through the message system (Microkernel’s uses message queues build in as FIFO queue). It is enough to re-implement the new memory manager. The processes which formerly used the other manager, do not notice the change. Microkernel’s also show their flexibility in removing features. That way a microkernel can be the base of real-time appliances in single chip systems. On the other hand microkernel’s itself must be highly optimized for the processor they are intended to run on. To try to sum up the monolithic structure, it suffers from the fact that it includes all of the basic services inside kernel space, which makes the kernel lack on extensibility and maintainability, on the sheer size of the kernel growing big, and the fact that bug fixing or the adding of new features mean a complete re-compilation of the kernel which is time and memory consuming. The fact that microkernel has – for a long time been used – in mobile phones should also give an indication of the stability of the kernel. Toshiba W47T is one of many that run on a microkernel, and there are many different microkernel structured operating systems out there for mobile/smart phones, and there are all in use in different phones. One exiting system is the Cosmos microkernel developed by a former developer from Microsoft, and the operating system is .NET based, and open source.

Currently rated 3.0 by 2 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 8/23/2010 at 5:46 AM
Categories: Embedded | OS
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Open House event for DTU students

!cid_image001_jpg@01C9E9E0

microsoft-logo

20-04-2010 at Microsoft Development Center Copenhagen, Frydenlunds Allé 6, Vedbæk 2950

Are you studying at DTU? Do you want to know what we are developing at Microsoft Development Center Copenhagen and which career opportunities we can offer you as a student or as a graduate? Then visit our Open House Event on April 20 from 15.30 – 18.00. We have lots of exciting stuff on the agenda and there will also be time for pizza, networking and fun coding challenges. First prize in the coding challenge competition is an XBOX, but who knows, you might even end up with a job offer.

To make it easy for you to visit us, we have booked a bus that will pick you up at the parking lot in front of Building 101 at DTU at 15.00 and take you back at 18.00.

We look forward to seeing you on April 20!

Sign up here

Program

15.30 Introduction to Microsoft and Microsoft Development Center Copenhagen, Charlotte Mark, Managing Director

- These are the products we develop, Kim Ibfelt, Director of Program Management 
- Development methods, Michael Nielsen, Director of Engineering

16.20 Meet Henrik Metzger, Software Development Engineer

16.30 Meet Aida Seifi Labrosse, Software Development Engineer in Test

16.40 What I look for in a candidate, Christian Heide Damm, Senior Development Lead

16.55 Career opportunities at Microsoft, Scott Simmons, Staffing Lead

17.10 Microsoft Student Partner Program, Martin Esmann, Academic Developer Evangelist

17.20 Closing, networking, pizza and coding challenges

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 3/26/2010 at 10:18 AM
Categories: Programming | Velkommen | Microsoft
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Tech ED – Windows 7 embedded

image I had the pleasure of attending the DEMO MANIA session on Windows Embedded Standard 2011, also called “Quebec” or plain Windows 7 Embedded.

Due to the fact that it was a DEMO session, the amount information given were minimal and the visual presentation was in focus.

The embedded team has come up with a treat for all of us technical guys. They have prepared Windows 7 for embedded devices, and in such a way that when you boot up for the first time, a menu appears to let you chose which Device drivers you need for the system (the ones it did not find it self). After this, the system let’s you pick and chose your desired configuration, meaning that you now have a chance to deselect IE, or just the parts of IE you don’t want… And off course not only IE, but every little piece of Windows 7 you select and deselect as of your likings (That is WOW!). In Short it is a full Windows 7 with all features, (silverlight etc.) where you deselect features to make it fit your device and wishes.

I got a hold of an early preview version of Windows Standard 2011 and when I got home, I immediately started to install the version onto my Asus Eee 901 just to see the how it worked! And you can really optimize a laptop with this kind of version :-)

But…. It was brought to my attention that it was illegal to install Windows Embedded Standard on a Notebook, and therefore I have now erased it, and cannot show any pictures of my progress with the adventure (I will not even explain about it).

Windows 7 Embedded Standard 2011 as OS for Windows Mobile?

But with all of this power at your hands, and the statements from Microsoft that the future of their mobile phones will run on at least 1GHz processors…. Hmmm wouldn’t be weird if Microsoft didn’t use this as a new operating system (OS) for Their Mobile products too?? Let me answer that! Yes it would.. With this product at their hands, Microsoft is finallly able to have – One Operating System For All platforms – A vision they had for years, and a vision Mr. Steve Balmer talked about on his last visit in Denmark.

And here is the more technical information:

Processor Architecture
Support for multiple processor architectures
· x86
· x64

Tools
Improved developer experiences:
· Wizard experience with Image Build Wizard (IBW)
· Advanced experience with Image Configuration Editor (ICE)

Componentization
The right level of granularity to build special-purpose devices
· Hundreds of feature packages based on latest innovations for Windows 7
· Embedded enabling features such as Enhanced Write Filter, File Based Write Filter, Registry Filter, Hibernate Once Resume Many, and Custom Shell to fulfill embedded-specific requirements
· Large number of driver sets for compatibility with growing set of device hardware and peripherals

Application Compatibility
Applications and drivers for Windows 7 can work on Windows Embedded Standard 2011 without difficult, expensive, and time-consuming porting effort

Enterprise Connectivity and Manageability
Support for Active Directory, Domain Join, Group Policies, Network Access Protection, and IPv6 to enable connectivity and manageability with Windows Server, System Center Configuration Manager, System Center Operations Manager, and Windows Server Update Services

User Experiences
Rich, interactive user experiences with Windows Aero and Windows Touch and Gesture. A stable framework Windows Presentation Foundation for building new and innovative experiences.

Video resources

image http://channel9.msdn.com/posts/Charles/Windows-Embedded-Past-Present-and-Future/

Websites

image http://windowsembedded.com

imagehttp://msdn.microsoft.com/en-us/windowsembedded/ce/default.aspx

imagehttp://msdn.microsoft.com/en-us/windowsembedded/standard/default.aspx

Blogs

image Olivier Bloch - http://blogs.msdn.com/obloch/

imagehttp://blogs.msdn.com/mikehall

imagehttp://blogs.msdn.com/jcoyne

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 12/5/2009 at 4:24 PM
Tags: , , ,
Categories: Embedded | OS | Tech ED | Windows 7
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Tech Ed experience

At the Tech ED Conference

We started our journey to Tech ED Europe, on Sunday the 8th of November. All of the Danish Microsoft Student Partners had agreed on, meeting at the airport, because we were on the same flight. But as the plane was going into the air we were missing one of our MSP’s. He had unfortunately missed the flight, and had to wait until Monday morning to get the next flight down to Berlin.

clip_image002

Picture 1 - First day at Tech ED, Jacob Korsgaard and Martin Esmann

Welcome to Tech ED

The first day of Tech ED came, and we started with a check in – to get our access passes – and thereafter headed directly to the SWAG hand out area to collect a brand new bag, that could hold our laptops, and of course the bag had even more goodies in the form of a Windows 7 ultimate etc. After this it was a matter of finding the sessions that you had put in your calendar from home. One thing that I hadn’t calculated into my schedule was the 7200 other conference attendees! And the fact that finding things among so many people would not be easy. But luckily that turned out alright and I found all my sessions (and on time). After this first day, we headed back to the hotel, ready to put the day’s experiences and newly acquired knowledge onto our blogs….. But, the hotel did not have free internet!? In fact the hotel wanted us to pay 4 euro per half hour of internet usage!? I’ll let that hang for awhile….. That’s 6 Dollars or 32 Danish kr. FOR HALF AN HOUR!!!! So if you go to Berlin and need internet, please keep away from - Hotel Grand City Excelsior, or you will lose money! That’s the main reason why most of our post to our blogs, are being done after the Tech ED event, and not during the event. When attending the event, you don’t have the time to, attend sessions, be social, post on blog and do some coding, if you don’t have the possibility to do some blogging from the hotel... (If you want to be serious with your blog posts, internet access is necessary to check up on facts before posting).

The next thing about going to Tech ED as a Microsoft Student Partner is, that there are MSP’s from all over Europe gathered at this event, and we were all put together on Tuesday in an event just for us Microsoft Student Partners. At this event we were given some of the top speakers at Tech ED at our disposal, so we could ask them any questions we might have, and get top of the line expert answers to the questions. To name a few of the speakers we could talk to: Rob Miles, Microsoft Most Valuable Professional and lecturer in the Department of Computer Science at the University of Hull (he also gave an exclusive talk on building games with XNA, and he took some awesome pictures of us! See his version of the event here http://www.robmiles.com/journal/2009/11/10/student-session-fun.html), Don Syme, Microsoft Research and developer of F#, Olivier Bloch, Embedded Systems Engineer at Microsoft and many others…

clip_image004

Picture 2 - The panel of speakers at our disposal

This event did indeed bring us MSP’s closer together, and we began talking to one another on daily basis, exchanging contact information and knowledge. We had a meeting point at the conference, which was called The Community Lounge, where we all hanged out whenever we had time. And as it turned out so did some of the top speakers which gave us MSP’s opportunity to ask even more questions and get quality answers.

On Thursday, all the MSP’s were gathered again (after the sessions had ended) and now it was time for us to see some of Berlin’s culture. We went to a restaurant and had dinner (all 77 MSP’s), and after dinner, we went out to see the Berlin underground, how it looked from medieval time till now, and why things had changed (of course did had something to do with breweries and us drinking a few beers while taken the tour). This tour lasted for one and a half hour, after which we went back to the restaurant and held a party.

clip_image006

Picture 3 - At the Comunity Lounge

At one point a fellow MSP named Jacob Korsgaard and I decided to enter a contest, where we should develop artificial intelligence for an ant colony. We could create as many ant personalities we wanted to, and deploy these ants to collect foods and sugar while avoiding other teams ant and bugs that wanted to kill our ants. This turned out as a very fun challenge, and we actually won the daily contest as well as the final. Whoo hoo ;-)

As a Microsoft Student Partner you always travel to Tech ED with a hope to get to talk to specific speakers, and my hope was to catch Harry Pierson who is a Senior Program Manager in the Visual Studio Languages-team, with focus on IronPython. And I was not disappointed! A was able to catch by the Visual Studio stall, where he took his time to talk about IronPython and Dynamics languages in general. This was really awesome to be able to get to talk to him at the Tech ED, and of course I was attending his session on the DLR (dynamic language runtime).

clip_image008

Picture 4 - Harry Pierson geting ready for session on DLR

But that wasn’t it! While I was resting in the Community Lounge, I suddenly saw Harry Pierson and Don Syme getting ready for a live stage talk on programming languages. I went over and sat on a chair, and I was in for a treat! Harry and Don gave us all a good debate talk on IronPython, F# and C# (to name a few), and afterwards we could ask them questions to our liking… They really gave all of us an in dept insight into their opinions on the differences and forces of the languages and the DLR.

clip_image010

Picture 5 - Harry Pierson and Don Syme talking about languages

The experience as a Microsoft Student Partner at the Tech ED is one of the best ones I’ve had in a long time. I have used this Tech ED to gain a stronger knowledge base, and to create a large network af other MSP’s and other delegates. And I hope that you too one day get to experience this technical highway of knowledge at your disposal.

Oh and of course!

The last night in Berlin, we were a couple of MSP’s going into the streets of Berlin to see if we could find some of their famous beer, and we did!

clip_image012

Picture 6 - Green apple beer and red raspberry beer

These are the funniest tasting beer I’ve ever tasted, but they were not bad! The bar had as different beers as Banana beer, ginger beer, beer with coca cola, raspberry beer, cherry beer and many others. If you ever go to Berlin, don’t miss out on their beer ;-)

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 11/15/2009 at 6:12 PM
Tags:
Categories: Tech ED
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (2) | Post RSSRSS comment feed

Tech ED – Top 10 mistakes made by Web developers and how to avoid them

At this Tech ED Session Pete LePage Talked about top 10 mistakes that web developers do, when creating a website. This has for a long time been a problem, although standards are there, too aid the developer in designing/developing the website (and apparently this is very much still an issue.

  • The use of colors on websites 
  • Not optimizing websites for search engines
  • Over extended use of Flash, Silverlight and Rich Media in general
  • Not giving the ?tab? key any thought when using forms
  • Inconsistent website design
  • No easy navigation of the website
  • Errors in the code 
  • Extreme use of ads on websites, and sticking them in everywhere
  • Having non designers, design the websites

Web developers have to pay close attention to the use of colors on their sites. There are many great resources out there to help finding those ?websafe? or ?websmart? colors. When building a site using a lot of colors, we tend to forget about the millions of colorblind people out there not being able to use the sites due to web developers use of colors that suck! And because of the developer being a little to creative with the use of colors like yellow background with blue text etc?

There are also a lot of developers, that do not make use of the meta tag keyword in their websites. This meaning that search engines will categorize the websites using their <h1> tags (So please also make sure that this tag gives a meaningful interpretation of what this page has to offer!). An search engine rank a website by their use of meta tags:

<head> <title>meta - HTML 4.01 dokumentation</title> <meta name="description" content="Description of site.">
<meta name="keywords" content="meta, html, css, xhtml, xml">
<meta name="title" content="meta - HTML 4.01 dokumentation">
<meta name="language" content="dan"> <meta name="date" content="20-10-00">
<meta name="robots" content="index, follow">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>

their <h1>, <h2> tags and the text used to describe the <h1>, <h2> tags.. (Think about his before making everything as a picture on the site!).

When designing a website there are trends moving towards using a Flash only website?? Please open up a browser and take a look at this awesome car site

 http://www.miniusa.com/ 

Looks really cool right? Now open up your browser and disable JavaScript and browse the site again! If you click on a few links, you even get an 404 error!!  Be aware of using to much flash will cut some people from using your site. And if it?s a products site trying to sell something, then you?re cutting potential buyers from buying your product?

A basic an simple thing to keep in mind when using forms on the website is to have a tab order index, and have that index match what you would expect when filling out a form.

When creating a web site, one of the most important things to keep in mind is to design/develop the site consistently. Every page on the site most have the same look and feel to it (when ever possible). There are a lot of sites on the web, which do not have consistent look and feel to them, and honestly it look ridiculous and un-professional.  For example look at these two sites:

http://www.wsdot.wa.gov/traffic/seattle/flowmaps/bridges.htm

http://wsdot.wa.gov/traffic/
It is the same site, just different views of traffic information, but the two pages doesn?t have the same look!

Links on a web page is the most important thing to have! But some sites really makes you guess what are links and aren?t.

http://www.samanzerin.com/

It?s graphically a really cool site, but it makes the users have to guess what the links are? Too much ?Glam? in a site, will ruin what the site is actually supose to say? Hey we want to sell you something, and that something is?.. Remember that the users have to be able to use the navigation, let alone find the navigation on your website.

Be aware of using to many automated tools, without knowing what they do! Make sure you know what DOCTYPE your using when developing your site. When developing your site, the architecture must be designed with DOCTYPE in mind. Otherwise you will end up having HTML code tags that are not supported by the given DOCTYPE, and the web browser engines will not render your site correctly. This tend to leave even more hacks in the HTML code just to make the site function as intended. When web site is designed with a specific DOCTYPE in mind, you will ? in advance ? know what tags you?re able to utilize, and in the architecture design fase, how to implement it?..

A quick word on ads on your site!

http://www.barcelona.com/

What are they trying to tell me? Is this an website promoting ads? Are they selling ads, or do they just like lots of ads? Too many ads, in ?weird? places ruins the site entirely, and the user will click away!

In the end, find out what you want your site to state! And be aware of too much information on the website (not too little, and not too much) . This web page gives a good example of ? what not to do!

http://www.havenworks.com/

What just happened here!?

Also, when putting up a website, developers are very often not the right persons to get to write the content on the website! In general, people with deep knowledge of the subject is very often the wrong ones to write the information made availeble on the site. They tend to use specific language terms etc. in the text, that end-users will not understand? Get someone to read through the text, sugesting normal langu<ge terms, and please?? Check the spelling! ;-)

And again, because you can do something, it doesn?t mean it?s a good idea!?

http://web.archive.org/web/20060613061524/http:/moire.ch/

Try hovering over the links?

Currently rated 3.0 by 2 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 11/10/2009 at 5:44 AM
Tags: ,
Categories: Tech ED
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Attending Tech ED Berlin 2009

TechED

“All my bags are packed, I’m ready to go……”

I’m am very exited to get to Tech ED Berlin 2009 (which is now sold out!). I’ve been trying to wrap my head around what track and sessions I should attend, because there are MANY! to chose from. As a person I believe it’s importent to focus on the fact that this is a unique opportunity to evolve your knowledge. Therefore I have chosen to expand my choice of sessions to not just include areas of immediate focus, but to also include areas of common interest.

I spend a few hours on the track & sessions page, figuring out pros and cons on sessions that unfortunately collided on day and hours. But I think I hit an amazing agenda for the entire week:

TechEd Europe Keynote - Welcome to the New Efficiency
Enabling Rich Business Clients with Windows Presentation Foundation
Top 10 Design Mistakes Made By Web Developers and How to Avoid Them
Windows 7 Demo Mania
Embedding Windows 7 into Devices
Tips and Tricks for Building High Performance Web Applications and Sites
Pumping Iron: Dynamic Languages on the Microsoft .NET Framework
F# for Parallel and Asynchronous Programming
Microsoft Visual Studio Team System 2010 Team Foundation Server: Become Productive in 30 Minutes
Unit Testing Best Practices
The Windows API Code Pack: How Managed Code Developers Can Easily Access Exciting New Windows Vista and Windows 7 Features
Windows 7 and Windows Server 2008 R2 Kernel Changes (*PDC at TechEd)
Windows 7: The Power Management Workout!
Building High Performance Parallel Software
Windows Embedded: "Demos Only"
Parallel Computing for Managed Developers
Achieve new levels of desktop optimization with Intel Core™ 2 processors with vPro™ technology and Windows* 7
Case of the Unexplained... Windows Troubleshooting with Mark Russinovich

The one session that I look really forward to is Windows 7 and Windows Server 2008 R2 Kernel Changes!! I’ve been following the discussion on the internet, and following the videos from Channel 9 on Windows 7.

The official note on the session leaves me with the impression that this is going to be really good:

“This session goes beneath the hood of Windows 7 and Windows Server 2008 R2 to describe and demonstrate the key changes in the kernel. Topics include: scalability improvements such as removal of the global scheduler lock, support for more than 64 logical processors, and user mode scheduling, virtual service accounts, core parking and timer coalescing for power efficiency, trigger-started services, core architecture changes to modularize Windows ("Minwin") and more.”

And the embedded part with demo’s are also something to be looking forward to:

“This demo-packed session presents all sorts of devices, tools, and technologies used in today's and tomorrow's embedded projects. If you want to learn how Windows Embedded can be used to build stunning devices or if you are just a geek, you can't miss this session.”

And yes, I’m a geek!

I’m really looking forward to this mix of Desktop, embedded, web technology and architechture sessions. And not forgetting all the demo presentations that makes this Tech ED a must-see event.

Appart from all of these sessions, I will be on the lookout for the expo areas, where I will get a chance to have a look at what all other developers are doing right now.

I’m also loking forward to meeting all the other Microsoft Student Partners from all over the world. And this will ofcourse introduce them to my network, and me to theirs.

If you find the subjects listet above interesting, then I will attempt to blog on every single one of them, and hopefully provide you with awesome pictures from the whole event. If you find subjects of interests missing in my list, I will suggest that you have a look at some of the other Microsoft Student Partner blogs. We are well represented at the Tech ED event, and maybe they will attend more convenient subjects. You can find links to there blogs on the left column.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 10/31/2009 at 5:14 PM
Tags:
Categories: C# | Embedded | F# | FMOD | IronPython | OS | Programming | Tech ED | Velkommen | Windows 7
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Send email with PDF attachment in NAV 2009

Are you using Microsoft Dynamics Nav 2009

Here is a brilliant post explaining how to create an email from the Role Tailored client and attach an invoice as a PDF file to the email. (Including the source code for download).

Microsoft Dynamics Nav team Blog

 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 10/16/2009 at 4:35 AM
Tags:
Categories: Dynamic Nav
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Win a book on IronPython or F#

Here is a little contest that will run for 14 days (until the 29-09-2009), where every developer should have a chance of winning!

The Contest has ended, and the winner was Yoni Holman! Congratulations!

I?ve created 7 questions, in different programming languages such as C#, F#, Ironpython, C++, Java and off course the well known and liked true or false. The questions are designed to give a number of points, where the maximum number of points given can be read in the text of the assignment. The rules are simple, the one with the highest score on points, will win. Points will be given for correctness and effort. An assignment might give 6 point, but if not entirely correct, it will be given some points for effort.

What can you win?

The winner gets Office 2007 Student version, and gets to choose one of two books ? Foundation of F# or IronPython in Action - and the runner-up gets the book that the winner did not choose.

FSharp ironpythoninaction OFF2007STUKEY

What to do now?

If you want to try out for the books, all you have to do is:

  • Leave a comment on this blog-post (in case that when you submit, and your assignment gets in my spam-mail-box, I?ll know to look for it here if its not in my usual mailbox.
  • Submit your answers (as a txt file) to my mail address (ajp at clug.dk)
  • Everyone is allowed to solve all the questions (if you can), or just some of them.
  • When mailing me, please leave ? if you have ? your Twitter name, and I will also post the winner and runner-up on twitter (if the winner and runner-up has a Twitter name).

Here are the questions

Question number 1.

6 point

The following code compiles and runs without problems, but everything is not as it should be. When a user enters the input as shown below, what is the output? And more important, why is the output as it is?

#include <iostream>

using namespace std;

char string1[2]; char string2[2]; char string3[7]; char string4[7];  char string5[8];

int main (){
    cout<< "\n Read 1. text (length 2)";
    cin>> string1;
    cout<< "\n Read 2. text (length 2)";
    cin>> string2;
    cout<< "\n Read 3. text (length 7)";
    cin>> string3;
    cout<< "\n Read 4. text (length 7)";
    cin>> string4;
    cout<< "\n Read 5. text (length 8)";
    cin>> string5;
    cout << "\n 1.: "<< string1;
    cout << "\n 2.: "<< string2;
    cout << "\n 3.: "<< string3;
    cout << "\n 4.: "<< string4;
    cout << "\n 5.: "<< string5;
    return 0;
}

Read 1. text (length 2) - F#
Read 2. text (length 2) - C#
Read 3. text (length 7) - ASP.NET
Read 4. text (length 7) - IronRuby
Read 5. text (length 8) ? IronPython

Answer:

1. F#C#ASP.NETIronRubIronPython
2. C#ASP.NETIronRubIronPython
3. ASP.NETIronRubIronPython
4. IronRubIronPython
5. IronPython

In C++ the strings are null terminated. This means that space must be preserved for null termination character. In the assignment above, the null character is overwritten, and therefor the output is as shown.

This example does have some issues regarding compiler dependencies, and yes this was also part of the assignment ;-)

Question number 2.

9 point.

The following is an application made with the .NET Micro Framework, but the code is missing two lines! The missing parts are an Output port, and an Input port. Implement these two line to complete the code.

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace MicroFramework
{
   public class Light
   {
     public static void Main()
     {
       Cpu.Pin pin = Cpu.Pin.GPIO_Pin1;
       Cpu.Pin switch = Cpu.Pin.GPIO_Pin2;
       //missing line
       //missing line

       while (true)
       {
         YourOutputPort.Write(YourInputPort.Read());
       }
      }
     }
}

Answer:

OutputPort YourOutputPort = new OutputPort(pin, false);
InputPort YourInputPort = new InputPort(switch, false);

Question number 3.

3 point.

The following code is F#, and it represents an array. Finish the code, so that every item in the array is printed out to the screen.

#light
let colors = [| "Blue"; "Green"; "Yellow"; "Black"; "White"; "Red"; |]

//iterate over the array, and print out the items within the array.

Answer (There are multiple ways of doing this) :

for color in colors do
    print_endline color

Question number 4.

4 point.

The following code is an array written in C#. create a LINQ query that selects the items that are less than 15 and do this:

  1. Using standard LINQ query
  2. Without the use of keyword "var" (without implicit typing).

int[] numbers = {5, 2, 10, 12, 16, 35, 20, 100};

//Create query

//iterate and print out items

Answer:

1.
var query = from i in numbers where i < 15 select i;

foreach(var i in query)
  Console.WriteLine("Number: {0}", i);

2.  
IEnumerable<int> query = from i in numbers where i < 15 select i;
foreach(int i in query)
  Console.WriteLine("Number: {0}", i);

Question number 5.

6 point.

Implement a function in IronPython that takes one parameter, and calculates and returns the Fibonacci series. Then call your function with the number 200.
shown here in pseudocode:

FibonacciFunction(aNumber)

calculate fibonacci

return number

call function
print output

Answer:

def fibonacci(number):
        result = []
        a, b = 0, 1
        while b < number:
             result.append(b)
             a, b = b, a+b
        return result

fib = fibonacci(200)   
fib

Question number 6.

8 point.

The following code is in Java, and it is a sorting algorithm. Two lines are missing, and you are to implement the missing lines.

public class HeapSort
{

    public void heapSort (int [] A)
    {
        printArray(A);
        makeHeap(A);
        printArray(A);
        for (int i = A.length-1;i >0 ;i--)
        {           
            int temp =0;
            temp = A[i];
            //Line missing
            A[0] = temp;
            reheap(A,0, i-1);
            printArray(A);
        }
    }
    public void makeHeap(int [] A)
    {
        for (int j = ((A.length / 2)-1);j>=0;j--)
        {
            reheap(A, j, A.length-1);
        }
    }
    public void reheap(int [] A, int current, int last)
    {
        int leftChild = 2* current +1;
        int rightChild = 2* current +2;
        int largest;
        int tempA=0;
        if (leftChild <= last && A[leftChild] > A[current])
        {
            largest = leftChild;
        }
        else
        {
            //Line missing
        }
        if (rightChild <= last && A[rightChild] > A[largest])
        {
            largest = rightChild;
        }
        if (largest != current)
        {
            tempA = A[current];
            A[current] = A[largest];
            A[largest] = tempA;
            reheap (A , largest, last);
        }
    }
    public void printArray(int [] A)
    {
        System.out.print("Array: ");
        for (int i = 0; i < A.length ; i++)
        {
            System.out.print( A[i] + ", ");
        }
        System.out.println("\n");
    }
    public static void main(String[] args)
    {
        int A [] = {10,23,75,24,98,87,27,11,34,28,17,13,31,37};
        HeapSort heap = new HeapSort();
        heap.heapSort(A);

    }

}

Answer:

A[i] = A[0];
largest = current;

Question 7.

Each correct answer will give 1 point each. (max point is 21).

In this assignment you should answer "true" or "false" to the following questions:

  1. IronPython is the .NET version of Python.
  2. IronPython is a functional programming language.
  3. There is nothing called IronRuby from Microsoft.
  4. IronPython does not work in a web browser.
  5. IronPython is a dynamic programming language.
  6. IronPython can interact with the C# programming language.
  7. IronPython is an OpenSource language.
  8. F# is a dynamic programming language.
  9. F# does not work with WPF (Windows Presentation Foundation).
  10. F# only works with math and formulas.
  11. F# works with Windows Forms.
  12. F# only runs on Windows Computers.
  13. F# is an OpenSource language.
  14. C# is the only programming language in .NET family.
  15. C# can only be used on Windows computers.
  16. The .NET MicroFramework is used for embedded systems.
  17. ASP.NET is a Java version of PHP.
  18. ASP.NET can only be used on Windows computers.
  19. ASP.NET, C#, F# and Silverlight all run on Linux.
  20. Moonlight on Linux is the same as C# on Windows.
  21. Mono is the same as F# on Windows.
Answer:

1. true
2. false
3. false
4. false
5. true
6. true
7. true
8. true
9. false
10. false
11. true
12. false
13. true
14. false
15. false
16. true
17. false
18. false
19. true
20. false
21. false

The text in small print

Everyone from every country is allowed to participate in this contest. The winner and runner-up will be notified by me personally, and I will personally send the books to their home address. If the winner and runner-up will allow it, their names will be posted on this website after I have talked to them.

All I can say now is good luck, and I hope you find this fun :-)

Currently rated 3.0 by 2 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 9/15/2009 at 6:48 AM
Categories: C# | IronPython | Programming | F# | Contest
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (9) | Post RSSRSS comment feed

IronPython

 

I had the pleasure of attending Harry Piersons TechTalk at Microsoft Development Center Copenhagen (MDCC) on IronPython.

IronPython is a new member of the .NET family, based on the programming language Python. The Iron part has become known as It-Runs-On-.NET.

IronPython is a dynamic programming language (as Perl, PHP, Ruby and JavaScript - Although Perl and PHP never truly was Object oriented at heart, but they are moving in that direction now), which means that execution happens at runtime and not at compiletime. Dynamic languages make it easy to quickly manipulate data, which often is collected from networks, user interfaces and devices, and are extremely powerful when it comes to manipulating meta-data, whereas static languages (eg. C#, C++, and Java) often prove its strengths in creating complex data structures and algorithms and so on. It’s said that Dynamic languages focus on the code, rather than the structure or “architecture”.

With IronPython in the .NET family the developers now have a perfect opportunity to combine the forces of static languages as C# with a dynamic language namely IronPython.

In Harry Piersons own words “Dynamic languages are easier to learn and therefore teach”. And then he gave a small example where he compared a “Hello World” program from C# with the same in IronPython:

// C# version of "Hello World"
class Program
{
static void Main()
{
System.Console.WriteLine("Hello, World");
}
}


// IronPython version of "Hello World"
print "Hello, World"

Now wait a second! What about C# 4.0?

C# version 4.0 now comes with a new keyword called “dynamic” which can be used to dynamically invoke methods, but I’ll let it be up to the reader to dig in deeper with the new version of C# coming out.

Is IronPython opensource?

YES it is! Microsoft has two licenses that have been approved by the Open Source Initiative(OSI), which means that developers can be confident that the licenses meet the terms of the Open Source Definition. And yes, the IronPython team is taking in contributions from the community, and for that – Microsoft I salute you. Thank you for showing initiative to promote things via opensource.

The roadmap for the IronPython project is, that in December 2008 it was shipped in version 2.0, and Microsoft hopes to release version 2.6 (Microsoft has decided to end confusions, and name the versions after Python release conventions ) in the near future. They are also planning to release IronPython for .NET version 4.0, (with release shortly after version 4.0), which will work with C# Dynamics and be compatible with Python version 2.6 and 3.1. The intention is not to have a release cycle like the one on Visual Studio, but rather have it be a plug-in for Visual Studio, so that the IronPython team can maintain a release cycle of ca. 10 months.

For more resources:

 

 


Just an update! You can view the video, and download the slides from the Tech Talk on Channel 9

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 9/14/2009 at 4:42 AM
Tags: ,
Categories: IronPython
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Tech ED 2009 in Berlin

The time has come, this November 9 -13 there will be Tech ED in Berlin.

The Tech ED is a really great place to get in- deep coverage of technical material from Microsoft,
but that's the only thing! You will have the ability to certified on the spot! And Microsoft Partner solutions
will also be presented.... Cool!

I've taken a snapshot to show which Topics will be presented at Tech ED 2009 Berlin:

 

273

The Windows Client track e.g. contains sessions on adoption, deployment, management,
and virtualisation of the Windows® Desktop Environment, including a technical introduction 
into Windows® 7 and Windows® Internet Explorer® 8.


The Web and Internet Application track contains sessions on Microsoft® Expression® Studio, Microsoft® 
Silverlight™, Microsoft® Internet Information Services (IIS), ASP.NET, ASP.NET AJAX,
Windows® Internet Explorer®, Windows Live™ Platform and more.

So as you can see it's an action packed Tech ED, covering the whole week:

 

And you can spend hours on their website just planning what to see!


For more information go to The TechED 2009 Berlin Website

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 9/1/2009 at 3:50 AM
Tags:
Categories: Tech ED
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Windows 7 and security

One of the big issues with Windows Vista was that the system was too strict on security, and always popped up with notifications regarding security issues. This became a big problem, because a big part of the Windows Vista users chose to completely turn off the notification feature, leaving the system vulnerable.  To address this problem, Windows 7 introduces 2 new security levels (see figure bellow) in the User Account Control Settings (UACS). The first - which is default in Windows 7 - is called: Notify me only when programs try to make changes to my computer, which is a level where you no longer see notifications regarding you messing with the settings in the Control panel, but only if a third-party program tries to. The second is called: Notify me only when programs try to make changes to my computer (do not dim desktop). This level will further stop the UACS from utilizing the "safe desktop" and the desktop light will not dim, and you will be able to run other programs while UACS messages pop up. It is no longer possible to turn off the UACS completely, but you can tell the UACS to never ever inform you of anything. 
 
 
 
 
In Windows 7, the Security center has been replaced with the Action Center, which now contains the functionality of Computer Maintenance and Security. Here you are now able to adjust the notifications according to a given subject, e.g. if you no longer wish to see information regarding virus protection or network firewall, you just uncheck the subject from the list. Off course this doesn't improve security, but it removes the hassle of administrating the system. In fact, Windows 7 has pushed even more security settings in, when compared to Windows Vista, but it also introduces problem solving tools, which is problem solving wizards which check your program and security settings for problems, and tell you what they find. 
 
AppLocker is a new feature to Windows 7, which easily lets you which programs different users are allowed to run. E.g. You can tell AppLocker to trust all software coming from Microsoft (or others) and AppLocker will run all software signed by Microsoft, and you can stretch this into also telling AppLocker that newer version of a give piece of software is trusted, and these will also run without problems. This feature though is only provided with the Windows 7 Ultimate edition.
PC Safe Guard - or as I like to call it; Annoy-Your-Teen - is essentially a kind of sandbox account. It lets you create a user account and set it up with the software you want, and then activate PC Safe Guard. PC Safe Guard then makes sure that all software (and spyware or viruses) installed after activations is deleted when the user logs out, and this way the user account returns to the state of first-install. Files created in an PC Safe Guard activated User Account, must be saved on another partition of the hard drive, where PC Safe Guard will not touch them. 
 
BitLocker is a feature that was also present in Windows XP and Windows Vista. In these versions though it was not always easy to find, but all this has changed in Windows 7. Now all you have to do, is right-click the hard drive and select "turn on BitLocker", and an easy guide will follow you through the process. This feature is only available in Windows 7 Ultimate, which I find rather disturbing. Microsoft has a portal called MSDNAA where students from around the world (if the university they attend to has signed up for MSDNAA) can download Microsoft products for free (while being students). This portal gives the Windows 7 pro. Version to students and faculty teachers. With this in mind, there is lots of research going on at these universities, where encrypting of hard drives could be a nice feature. So why not make BitLocker available to lower versions of Windows 7?

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 8/31/2009 at 8:12 AM
Tags: ,
Categories: Windows 7
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

IronPython is TechTalk

Get an introduction to Python on the .NET Platform, from Harry Pierson.

At the Microsoft development center copenhagen... (sorry guys, this one is in Denmark)

About Harry Pierson
Harry Pierson is a Senior Program Manager on the Visual Studio Languages team, primarily focused on IronPython. A ten year Microsoft veteran, Harry has worked all over the company from Microsoft Consulting Services and Architecture Evangelism in the field to being an architect in Microsoft IT. He has been writing his blog DevHawk (http://devhawk.net) for just over six years and has written articles for MSDN and CoDe Magazines.

He will be talking at variuos universities around Denmark, I just don't have the dates yet, but for more information look here http://www.computerworld.dk/blog/studblog/1931?cid=6&a=cid&i=6&o=1&pos=2

 

 

 

Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 8/24/2009 at 7:04 AM
Tags:
Categories: Programming
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

P/Invoke, InteropServices, C# and FMOD

Making music with C#, P/Invoke, InteropServices and FMOD

I've been trying to give a glimse of how one could make a media player, but I'm not the kind of person who gives the whole answer until the absolute end. This post will be no different from the others. I'm going to present an outline as to making a media player using the FMOD library. The beaty of this library is that you can use it cross-platform so this code will also work for Linux in Mono (Linux version of C#)

Download the FMOD Library for Win32, for Windows CE, Windows CE small, Linux or MacOS

And inside you will find the reference manual, which is the place to start to get familiar with the functionallity of the library. In this little post I will focus on using C#, but as you might have guessed one can utilize every known language to programme against the FMOD library. On a quick notice; the FMOD library is primarily used in game development, but works just fine as a mediaplayer library. It is legal to use the FMOD library, without paying anything, just as long as you don't start selling your code as a product.

Now, the FMOD library is written in C++, and this means that it is written in unmanaged code contra the C# language which is a mannaged language. Therefore we need to have a look at the C# - System.Runtime.InteropServices; where we will find the DllImport attribute, which will call the unmanaged code from the C++ FMOD library (There is very much more going on in the CLI to call unmanaged code, but I will leave this for later post). As far as managed code is concerned, unmanaged code is invoked merely by invoking a method with an associated DllImport attribute.

[DllImport("My_CPP_Library.dll", EntryPoint="Function_in_CPP_Library", CallingConvention=CallingConvention.Winapi)]
public static extern Boolean Self_chosen_function_name(The parameters from the Function_in_CPP_Library);

Here's what I did to get the functionallity up and running:

[DllImport("fmod.dll", EntryPoint="FSOUND_Init",
CallingConvention=CallingConvention.Winapi)]
public static extern Boolean fmod_Init(int mixRate, int maxSoftwareChannel, int flags);

[DllImport("fmod.dll", EntryPoint="FSOUND_Stream_Open",
CallingConvention=CallingConvention.Winapi)]
public static extern IntPtr fmod_Open(string data, int mode, int offset, int lenght);

[DllImport("fmod.dll", EntryPoint="FSOUND_Stream_Play",
CallingConvention=CallingConvention.Winapi)]
public static extern int fmod_Play(int channel, IntPtr fstream);

[DllImport("fmod.dll", EntryPoint="FSOUND_SetVolume",
CallingConvention=CallingConvention.Winapi)]
public static extern int fmod_Setvolume(IntPtr fstream, int volume);

[DllImport("fmod.dll", EntryPoint="FSOUND_Stream_GetLength",
CallingConvention=CallingConvention.Winapi)]
public static extern int fmod_getLenght(IntPtr fstream);

[DllImport("fmod.dll", EntryPoint="FSOUND_Stream_GetPosition",
CallingConvention=CallingConvention.Winapi)]
public static extern UInt32 fmod_getPos(IntPtr fstream);

[DllImport("fmod.dll", EntryPoint="FSOUND_Stream_SetPosition",
CallingConvention=CallingConvention.Winapi)]
public static extern Boolean fmod_setPos(IntPtr fstream, UInt32 pos);

[DllImport("fmod.dll", EntryPoint="FSOUND_Stream_Stop",
CallingConvention=CallingConvention.Winapi)]
public static extern Boolean fmod_stop(IntPtr fstream);

[DllImport("fmod.dll", EntryPoint="FSOUND_Close",
CallingConvention=CallingConvention.Winapi)]
public static extern void fmod_close();


Function (and therefore names) defined in the FMOD library.

The function names that I define, and the names that I will use in my C# code.

And now off to test if it works!

public static void Main()
{
//initialize
fmod_Init(44100, 16, 0);
//load the mp3 into a soundhandle that we can use
IntPtr soundHandle = fmod_Open("C:\\Path\\To\\Song\\gone.mp3", 0 , 0, 0);
//Set the volume on the song fmod_Setvolume(soundHandle, 255);
//Play the song
fmod_Play(0, soundHandle);

Application.Init();
//Create the Window
Window myWin = new Window("My Player");
myWin.Resize(200,200);
Button playButton = new Button("Play");
myWin.Add(playButton);
//Show Everything
myWin.ShowAll();
myWin.DeleteEvent += new DeleteEventHandler(myWin_DeleteEvent);
Application.Run();
//Stop the song
fmod_stop(soundHandle);
//Close the stream
fmod_close();
}
public static void myWin_DeleteEvent(object o, DeleteEventArgs args)
{
Application.Quit();
args.RetVal = true;
}

And that's actually about it! In this example I've tried to use GTK+ so that the GUI part will work for both Windows and Linux.

I'll let you fiddle around with it a while before showing the full code including the ID3Tag etc. You're more than welcome to send me a mail or comment and I will respond as soon as possible.

Currently rated 3.4 by 5 people

  • Currently 3.4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 8/16/2009 at 6:25 AM
Categories: C# | FMOD
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (2) | Post RSSRSS comment feed

FenixOS: a research operating system

It's been a while since I've been updating my blogwith posts, and for that I'm truely sorry! The reason is my involvement in aresearch project where we are trying to design a new operating system for thefuture!

The common operating systems of today are based ontechnology developed many years ago when topics as scalability, security andpower consumption was not a major concern in computing, like it is today.

This is the primary motivation for developing a newoperating system from the bottom with the aforementioned issues.taken intoaccount from the start.This leads to the FenixOS which is a research operatingsystem, which is aimed at the hardware specifications of computers today – thatbe Desktop, Laptop, Notebooks, and Embedded devices (Smartphones etc.)-  But even more at fact that computer systems ofthe future will contain even more CPU's than currently computers. This fact andthe fact that current operating systems all have a creation date ranging fromthe 70's through the 90's where uni-core systems where common, has made it duetime to refactor  the architecture ofoperating systems. FenixOS supports an arbitrary number of CPU's and focuses onstability, security and the need for less power usage. It is based onmicrokernel architecture to enhance stability issues, and enforces securitythrough access control lists - among others. A complete rewrite of theunderlying system structure is made in C++, to clean up the disorderlystructure seen in many current operating systems. Although everything is newand cleaned up, FenixOS is still set to be compatible with current applicationsrunning on current operating systems, this meaning that applications that runon Linux, MacOS and Windows is aimed to be able to run on FenixOS. FenixOS doesdistinct itself  from Linux by eg. Havingseparate notions of threads and processes.

 

 

How this will be achieved is still on the researchstage, but initial ideas are on the drawing board. The easiest approach toobtaining compatibility with the Unix variations of operating systems, is toport the EGLIBC library to the FenixOS platform, while off course stillupholding the POSIX’s standard. EGLIBC (embedded GLIBC) is a variant of the GNU C Library (GLIBC). GLIBCis the C library used by most Linux kernel based operating systems.

We had to start off there-designing of the operating system structure, by considering which systemcalls are necessary for an operating system to compile itself. In this phase wehad to – in order to maintain compatibility with current operating systems –examine how current systems conduct their system calls, and thoroughly considerthe impact on security, stability and power consumption. We examined Linux,MacOS, Solaris, FreeBSD, Windows, and Singularity,paying especially attention to the thoughts and design of the researchoperating system Singularity, to see how these ideas would be suitable inFenixOS, without breaking the POSIX standard and the compatibility with otheroperating systems. The one major problem of looking at the Singularity researchproject is that Singularity uses managed code language to enforce securitybetween processes (among others) called SIPS. FenixOS is implemented in C++programming language, and therefore cannot utilize the security of managedcode.  We have reasoned that thefollowing system calls would be necessary for a basic new operating system:  

 

For self compiling:

Fork(), Execve(), Exit(), CreateThread(),ExitThread(), Wait(), Futex(),

 

For  file operations:

Open(), Close(), Read(), Write(),Stat(), Seek(), Link(), Unlink(), Ioctl(),

 

Message passing:

Send(), Receive(),

 

Memory management:

Malloc(), Free()

 

I will not be going through allthe systemcalls here, as this is just an introduction, but I can give a glanceof what we did with wait() systemcall.

By looking through source codeson the GLIBC we found that there are different versions of the wait() systemcall, all with different functionality, and by further examining thedocumentation on the different libraries, GLIBC, EGLIBC and such, we found thatthey all could be combined into one single system call, without breakingcompatibility with existing operating systems. This is done by keeping theexisting functions – wait(), waitpid(), wait3(), waitid() and wait4(), buthaving all of the aforementioned functions calling our newly created do_waitid().

 

It appears that over time newwait() calls with new features has been invented and added to the differentUNIX like operating systems (Linux, BSD, Mac OS, etc.) but not all of the oldwait() calls has been removed. The most powerful of the wait system calls arecalled waitid(), this system call takes a total of four parameters and withthose it can replace the old system calls wait() and waitpid(). If we add afifth parameter, the waitid() system call can also replace wait3() and wait4().In our EGLIBC code we call this system call with five arguments do_waitid(). Becauseof this we decided to just implement one wait system call in the FenixOS kernelwhich will just be called wait() and act similar to the described waitid()call. It will then be up to the C library to map the four other system calls tothis one existing in the kernel. The system call interface looks as follows:

 

pid_twaitid(idtype_t idtype, id_t id,              siginfo_t* infop, int options, struct              rusage*usage)

 

The first argument idtype can hold 3 different values whichindicates how the second argument idshould be interpreted. If idtypeholds the value P_PID then it meanswait for the child process with the process id that matches the second argumentid. If the value is P_PGID then it means wait for any childprocess which has a process group id that matches id. Finally if idtype is P_ALL then id is ignored and there will be waited for any child process. Thethird argument is a pointer to a structure which holds information about howthe child process stopped execution. With the fourth argument options it is possible to tell when thesystem call should return. It could return when the child exits of course butalso if the child changes from one state to another, for example if the childis blocked or when it wakes up. The last argument usage is the one added to support wait3() and wait4() system callswhich are the only ones using this type of argument. The structure holdsinformation about which resources the child held and which therefore should beavailable. The trickiest part of mapping the four system calls to waitid() isthat only waitid() is using the aforementioned structure siginfo which holds information about how the child terminated. Theother four system calls uses a pointer to an integer to get information abouthow the child process terminated. EGLIBC has some build in macros that userapplications can use for interpreting this status code. So the EGLIBC code hasto translate from the siginfostructure to the status code. Luckily EGLIBC also has some build in macros forcreating these status codes which simplifies the translation part a bit (Can befound in libc/bits/waitstatus.h). Another thing we had to be aware ofwhen mapping the system calls was that not all options in the options argument could be used for allsystem calls. Therefore we added error checking for this in the EGLIBC code andreturned error code EINVAL (Error:Illegal argument) before the kernel would be bothered with the system call. As wementioned earlier we have created two different waitid() system calls in theEGLIBC code. One takes the five arguments mentioned in this section and doesthe actual call down the the FenixOS kernel. This function is calleddo_waitid(). The other is called waitid() and takes the four argumentsoriginally intended for waitid() and maps those to do_waitid() (Leaving usage with value NULL).The latter is meant for user applications wishing to call waitid(). Thefirst should only be used by the EGLIBC code for mapping the other systemcalls. By creating this mapping between the wait system calls in the EGLIBCcode we cut down the number of wait system calls in the kernel to one. Butstill we are able to support already existing applications which may make useof the older wait system calls.

This off course just give a smallinsight in to a very big subject, where we to this date haven’t been able totest our system yet. As stated earlier, it’s a research system, and the designis a subject to change…. J

 

Currently rated 3.0 by 2 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 7/13/2009 at 6:44 AM
Tags:
Categories: OS
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed