My Tutorials: 2012

Tuesday, 27 November 2012

Microsoft Office 2010 is running but wont display

After hours of trying to get my instance of Outlook to just show itself I finally found a solution I did not believe could be the answer, based on its simplicity, but yet it worked! Some how its seems to have found a screen size or setting that made it invisible.

First Attempt 

The first thing I tried gave me a nice command that I will try remember if anything else ever goes wrong with my Outlook... Type in the Start Menu Search Bar "outlook.exe /safe". This launches Outlook in safemode and helps with add-ins that have gone mad. This did not help me with my problem, but its a nice command to know.

Step 1: Push the windows key, or click on the windows icon in the bottom left.

 Step 2: Type "outlook.exe /safe" and push enter.

Second Attempt

The second attempt saw me disabling all non-Microsoft start-up services and programs. Again a nice trick to know if you ever want to disable annoying tasks that have installed them self and now forever run whenever your PC boots.
This method was called the clean-boot method and really made my PC start faster, but did not solve my original problem.


Test in Clean boot Mode

Let’s disable all startup items and third party services when booting. This method will help us determine if this issue is caused by a loading program or service. Please perform the following steps:

1. Click the Start Button type "msconfig" (without quotation marks) in the Start Search box, and then press Enter.
Note: If prompted, please click Continue on the User Account Control (UAC) window.

2.  Click the "Services" tab, check the "Hide All Microsoft Services" box and click "Disable All" (if it is not gray).
3. Click the "Startup" tab, click "Disable All" and click "OK".

Then, restart the computer. When the "System Configuration Utility" window appears, please check the "Don't show this message or launch the System Configuration Utility when Windows starts" box and click OK.

Note: Temporarily disabling the Startup Group only prevents the startup programs from loading at startup. This should not affect the system or other programs. We may still manually run these programs later.



How to return from the Clean Boot state 


After the troubleshooting, we can return from the clean boot state:

1. Click the Start Button type "msconfig" (without quotation marks) in the Start Search box, and then press Enter.
Note: If prompted, please click Continue on the User Account Control (UAC) window.
2. On the "General" tab, click "Normal Startup - load all device drivers and services".
3. Click OK. Click Restart when you are prompted to restart your computer.


Final Attempt

My final attempt led me to this post on youtube. I read it and watched it and even though the poster said dont laugh at the discription of the solution, I found myself almost overlooking the solution because of its simplicity.

http://www.youtube.com/watch?v=CdFtBIp80FM


Below is the description of what to as described on YouTube.

1. Right click on the Shortcut you use to launch Outlook 2010 and choose Properties.



2. On the Shortcut tab next to Run, change it from Normal window, to Maximized.
3. Click OK.
4. Launch Outlook normally using the shortcut you just edited. (If you edited the Start menu shortcut use ONLY it)
In my case Outlook launched fine, but maximized. Clicking the Restore button would send it irretrievably back to the Taskbar forcing me to force close.
5. With Outlook open and Maximized, right click in the Taskbar and choose Cascade Windows. And that is what solves the issue!
Now I can minimize, restore, maximize, restore all day long without trouble.
6. Final step is to right click on the previously edited Shortcut and change Run back to "Normal window".

I hope someone finds this as useful as I did!

Tuesday, 13 November 2012

What is FPGA?


A field-programmable gate array (FPGA) is an integrated circuit designed to be configured by a customer or a designer after manufacturing—hence "field-programmable". The FPGA configuration is generally specified using a hardware description language (HDL), similar to that used for an application-specific integrated circuit (ASIC) (circuit diagrams were previously used to specify the configuration, as they were for ASICs, but this is increasingly rare). FPGAs can be used to implement any logical function that an ASIC could perform. The ability to update the functionality after shipping, partial re-configuration of a portion of the design[1] and the low non-recurring engineering costs relative to an ASIC design (notwithstanding the generally higher unit cost), offer advantages for many applications.


FPGAs contain programmable logic components called "logic blocks", and a hierarchy of re-configurable interconnects that allow the blocks to be "wired together"—somewhat like many (changeable) logic gates that can be inter-wired in (many) different configurations. Logic blocks can be configured to perform complex combinational functions, or merely simple logic gates like AND and XOR. In most FPGAs, the logic blocks also include memory elements, which may be simple flip-flops or more complete blocks of memory.

For more information regarding FPGA implementation and design see the Doulos page : FPGA

What is VHDL?


VHDL is the VHSIC Hardware Description Language. VHSIC is an abbreviation for Very High Speed Integrated Circuit. It can describe the behaviour and structure of electronic systems, but is particularly suited as a language to describe the structure and behaviour of digital electronic hardware designs, such as ASICs and FPGAs as well as conventional digital circuits.

VHDL is a notation, and is precisely and completely defined by the Language Reference Manual ( LRM ). This sets VHDL apart from other hardware description languages, which are to some extent defined in an ad hoc way by the behaviour of tools that use them. VHDL is an international standard, regulated by the IEEE. The definition of the language is non-proprietary.

VHDL is not an information model, a database schema, a simulator, a toolset or a methodology! However, a methodology and a toolset are essential for the effective use of VHDL.

Simulation and synthesis are the two main kinds of tools which operate on the VHDL language. The Language Reference Manual does not define a simulator, but unambiguously defines what each simulator must do with each part of the language.

VHDL does not constrain the user to one style of description. VHDL allows designs to be described using any methodology - top down, bottom up or middle out! VHDL can be used to describe hardware at the gate level or in a more abstract way. Successful high level design requires a language, a tool set and a suitable methodology. VHDL is the language, you choose the tools, and the methodology...

For more information regarding the use and implementation of VHDL go to the Doulos website: VHDL Designers Guide

What is Verilog?


Verilog is a Hardware Description Language (HDL). What this means is that it is a textual language for describing electronic circuits and systems. When applied to electronic design, Verilog is intended to be used for:

  • verification through simulation, 
  • timing analysis, 
  • test analysis (testability analysis and fault grading), and
  • logic synthesis. 

For a more verbose description of Verilog visit the wiki page which has a good overview of the history.

The standard also defines the Programming Language Interface, or PLI. This is a collection of software routines which permit a bidirectional interface between Verilog and other languages (usually C).

Note that VHDL is not an abbreviation for Verilog HDL - Verilog and VHDL are two different HDLs. They have more similarities than differences, however.

For some information regarding Verilog Design see the Doulos website: Verilog Designers Guide

Thursday, 25 October 2012

C# .Net Assembly Dynamic Reference Custom Paths


This is a bit of a how-to if you ever want to add a dll dynamically at runtime and it references other dll’s that are not in the GAC or the Application base directory.

NET assembly references are resolved in the following order:

  1. Search GAC for assembly reference.
  2. Search application directory.
  3. Search the paths specified in your app.config file using the following xml-tag:
    <probing privatePath="path 1; path 2; path 3" />


For instance say you are building a module for an application and it has a reference to some Third party dll that is not installed, just copied. Say now instead of adding the third party dll to the application base directory you want to create a bit of order and have a third party folder that is where you are going to place said dll’s.

Now typically when loading your assembly dynamically if the system can’t find the third party dll’s anywhere, it will have a heart attack. But you’re able to create assembly probing directories that gives the system a heads up as to where you plan on keeping all unregistered dll’s…

This is how you do it from a practical point of view.

In the app.config file you add this code

<configuration>

  <runtime>
    <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatepath="Plugins">
    </probing></assemblybinding>
  </runtime>

</configuration>


Above shows how I create a reference to my Plugins folder that is in the application base directory. This allows me to search for any plugin that implements my specific plugin interface. I can now also keep all my plugins separate from my actual app directory which allows me to maintain order and structure. If you wanted to add another directory, you just separate the directories with a ‘;’

<probing privatePath="Plugins; Third party; c:\lib" />

May solve a world of trouble one day…

Tuesday, 31 July 2012

Integrated Development Environment (IDE)

An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of:
  1. a source code editor
  2. build automation tools
  3. a debugger
Depending on what language you are programming in you will have to install the correct IDE so that you can have access to the correct libraries and you can build your solution to run on the target system.

For more information please refer to the wikipedia entry.

Installing Microsoft Visual Studio C# Express

Before I just dive into programming in C# I would be unkind to just assume everyone has the correct IDE available and installed for them to use. So for those of you who are completely new to this process here is a quick how-to on what you will be needing to get yourself programming in C#. For those of you that have already done this please be patient.

First you will need to go and download the Microsoft Visual Studio C# Express package at :

Download package

I may have to add my own link to this at a later stage if Microsoft ever decides to remove this download link, but that is a concern for a later stage. If you do come across download issues please let me know.

Once you have downloaded the package you will need to install as you would a normal program. Microsoft has kindly made this light weight IDE available free of charge with the main purpose of making their tools available for students who would otherwise not be able to afford the tool.

When you have your development environment up and running you will be able to program to your hearts content. I will attempt to provide a very progressive blog so that you will be able to learn from the basics to more advanced concepts.

If you have any issues please let me know and I will try elaborate the install process a little bit more.

C# Value Keyword

The contextual keyword value is used in the set accessor in ordinary property declarations. It is similar to an input parameter on a method. The word value references the value that client code is attempting to assign to the property. In the following example, MyDerivedClass has a property called Name that uses the value parameter to assign a new string to the backing field name. From the point of view of client code, the operation is written as a simple assignment.

The MSDN reference can be found here.

Code Example


 class MyBaseClass
        {
            // virtual auto-implemented property. Overrides can only
            // provide specialized behavior if they implement get and set accessors.
            public virtual string Name { get; set; }

            // ordinary virtual property with backing field
            private int num;
            public virtual int Number
            {
                get { return num; }
                set { num = value; }
            }
        }

        class MyDerivedClass : MyBaseClass
        {
            private string name;

            // Override auto-implemented property with ordinary property
            // to provide specialized accessor behavior.
            public override string Name
            {
                get
                {
                    return name;
                }
                set
                {
                    if (value != String.Empty)
                    {
                        name = value;
                    }
                    else
                    {
                        name = "Unknown";
                    }
                }
            }
        }


As seen in the above code, the value keyword gives us access to the implied value that is sent when the Name property is assigned a value. This allows us to do error handling before we assign the value to our name field.

C# Yield Keyword

The yield return and yield break keywords are shortcuts introduced in C# 3.0. They are designed to assist you by removing verbose code in methods that return IEnumerable types (i.e. IEnumerable <T>).

You can find the MSDN reference here.

Old Methodology

Usually a method that returns a collection consists of the following steps:
  1. Create an empty IEnumerable set. 
  2. Loop through some data (via a while, foreach or other construct) 
  3. Add to the set within your loop. 
  4. Exit the loop when some limit is reached. 
  5. Return the set 
Below is an example of the process required.

public IEnumerable<int> GetEvenNumbers(int maxCount)
        {
            //create and initialise IEnumerable container
            List<int> data = new List<int>();
            int currentNum = 0;
           
            //create and enter loop
            while (true)
            {
                if (currentNum % 2 == 0)
                {
                    //add the data to the IEnumerable container
                    data.Add(currentNum);
                }
                if (currentNum >= maxCount)
                {
                    //limit has been reach so we exit loop
                    break;
                }
            }
            //return the IEnumerable dataset
            return data;
        }


New Methodology

The new yield keywords allow you to shorten your code to only the following steps
  1. Loop through some data. 
  2. yield return within the loop 
  3. yield break if a limit is reached before the loop is completed. 
There is no need to explicitly create or return your IEnumerable collection.

The yield return statement appends a value to the IEnumerable collection. The yield break statement exits any looping construct to prevent more items being added to the return set. If you omit yield break, the loop exits as it normally would.

Below is an example using the yield keyword for the process required.

public IEnumerable<int> GetEvenNumbers(int maxCount)
        {
            int currentNum = 0;

            //create and enter loop
            while (true)
            {
                if (currentNum % 2 == 1)
                {
                    //add the data to the IEnumerable container using yield return
                    yield return currentNum;
                }
                if (currentNum >= maxCount)
                {
                    //limit has been reach so we exit loop using yield break
                    yield break;
                }
            }
        }


Performance

The difference between using the yield return and simply returning a set is subtle. Returning a set at the end of the method returns the entire set at once. The client must wait until the method is complete before it can use any values in the return set. Each time the yield return statement executes, the client has access to another element in the set. Essentially the set trickles back a little at a time. This can provide a gain in performance or perceived performance if you have a large set to return.

 Limitations

There are a few restrictions to using the yield keywords

  1. These keywords cannot appear in blocks marked "unsafe" 
  2. These keywords cannot appear in a method with ref or out parameters 
  3. The yield return statement is not allowed inside a try-catch block, although it may be located inside a try-finally block. 
  4. A yield break statement may not be located inside a finally block. 


Other Blogs and Sites

Social Media