zondag 9 oktober 2011

How to Force Quit an Application in Mac OS X

Keyboard Shortcut

  1. Press Command - Option - Escape simultaneously. If you need more explanation on how to find these keys read on:
    • Command is the button with the curly clover pattern on it. In pre 2008 apple keyboards it also had an apple icon on it. It is in the bottom left of your keyboard.
    • Alt/Option key is located at the bottom left of your keyboard.
    • Escape (Esc) is located at the top left hand corner of your keyboard.
  2. Select the application you want to force quit from the "Force Quit Applications" window that pops up. If the program has crashed, it will typically say "not responding" next to it in this menu.
  3. Click the button that says "Force Quit".


Mouse Method

  1. Direct your mouse to the apple icon in the top left of your screen.
  2. Scroll down to "Force Quit" and close the application which is not responding.


Dock Method

  1. Use a two button mouse such as the Mighty Mouse or a third-party two button mouse.
  2. Right click on the application's icon in the Dock and hold Option. This will display a Force Quit option.
    • If you don't have a two button mouse, instead of right clicking, clicking and holding works too.


[edit] Tips

  • Before you click "Force Quit", double check that the application is still frozen. Sometimes the application un-freezes while you bring up the "Force Quit" window.
  • It is not possible to force quit Finder. If you select Finder, the "Force Quit" button will say "Relaunch".
  • To force quit the application without opening the force quit window, just press Shift with the other buttons (Command+Option+Shift+Esc) and hold for about 5 seconds. This will close the currently active application.


[edit]Alternate Method

Sometimes, however, trying to Force Quit an application doesn't quite work the way you'd expect it to. If a normal Force Quit doesn't work, try these steps:

  1. Open the Terminal application. By default, this is in the Utilities folder, located in the Applications folder (and this application should not be moved).
  2. Type "top". The top command displays various information about currently running applications, including CPU usage, memory info, and some other stuff.
  3. For this purpose, there are only two things you need to be concerned with: The Process ID (or PID) and Command name (or application name). Under the column titled "COMMAND", find thename of the Application you wish to quit. (You may not see the wholename, but a portion of it will be there).
  4. Once you find the name of Application, find the number to the immediate left of it, under the PID column.
  5. Type "q".
  6. Type "kill ###". Replace the "###" with the number from the PID Column you just located. For example: If you were trying to quit iTunes, and found iTunes to have PID number 320, you would type "kill 320".

This should make the trouble application quit. Unlike previous versions of the MacOS, you don't need to restart your computer after force-quitting an application. You can simply relaunch the application and keep on working.

I forgot the key combination, so this is a note to self post

I predict the iPhone 4 will come with a front camera and will have video chat #prediction

I've said it last week to my colleagues and now I found this article, read on.

I told them that I think that the next iPhone will have a front camera. It's not only that I think that this will happen, it's also that Apple has to come with a front camera IMHO. The extra camera can be used for self portraits, wich is big, and video chat wich is even bigger. This is my prediction. It will have other great new features but this will be the main.

Another prediction is that I see that laser projection will come to mobile phones. I'm not seeing this as iPhone 4 feature, they will hold it for the iPhone 5 I think. But it will be super cool. Imagine that you can laser beam that video that you just found. Awesomeness.

Here is the FastCompany article


Surprise Rumor: iPhone Version 4 in April With OLED, Video-Calling

BY Kit EatonTue Jan 12, 2010

iPhone

This is hot stuff, so it needs to be taken with a healthy dose of skepticism, but the Korea Times is reporting--with extreme confidence--that the fourth gen iPhone will be on sale in April, with a pile of new features.

Of course we know Apple's been working on the next-gen iPhone for ages due to natural product development cycles, and clues in the form of iPhone v4 browser identity codes have even turned up in some Web site logs. But apart from lots of speculation, we've heard nothing concrete--as we'd actually expect from Apple's rigid security practices.

And now here's the Korea Times mentioning apparent talks between Apple and local cell-phone provider and exclusive Apple vendor, KT. "Still there are some 3G iPhone stocks. But KT and Apple have reached a broad consensus to introduce the advance models as early as possible" are the words attributed to an anonymous KT executive.

That's possibly believable, even if talking about this stuff is likely to be breaching many an Apple NDA. And yet it tells us nothing about the new phone itself. But hang on: The same exec also told the newspaper that there'll be OLED screens, live video chat powers (implying a long-awaited front Webcam), and maybe even a removable battery. There was also talk about dual core processors, better graphics chips for higher resolutions, and better still imagery from the rear-facing cam. And it's all due April at the earliest--as a test launch to select users, and to the public in June.

And though some of this is highly plausible, and even agrees with some rumors about OLED we've heard before, and recent mention of Apple buying millions of 5-megapixel cameras and Philips LED flash for better iPhone imagery, it all sounds too good to be true. Some of this is bound to be in the next iPhone--but all of it? That goes against Apple's careful incremental update strategy for the device so far. And though moving the iPhone forward to an April launch from its more normal late-Spring cycle would certainly help Apple steal some of the thunder from the Nexus One and other upcoming Android phones, isn't it a bit close to the purported launch date of the iSlate?

How to create a Windows service with .NET C# and change the StartMode and start it with the installler.

To create a Windows service and a installer you just have to follow the instructions in this article. http://support.microsoft.com/kb/317421

In order to change the StartMode and start the service with the installer I found the following way.

Open your installer file, in my case ProjectInstaller.cs and implement the Committed event, see code below

[RunInstaller(true)]
    public partial class ProjectInstaller : Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
        }

        private void ProjectInstaller_Committed(object sender, InstallEventArgs e)
        {
            
            ServiceStartModeUpdate(this.serviceInstaller1.ServiceName, "automatic");
            
            ServiceController sc = new ServiceController( this.serviceInstaller1.ServiceName );
            sc.Start();
        }

        public bool ServiceStartModeUpdate(string serviceName, string startMode)
        {
            uint success = 1;
 
            string filter = String.Format("SELECT * FROM Win32_Service WHERE Name = '{0}'", serviceName);

            ManagementObjectSearcher query = new ManagementObjectSearcher(filter);

            if (query == null) return false;

            ManagementObjectCollection services = query.Get();

            foreach (ManagementObject service in services)
            {
                ManagementBaseObject inParams = service.GetMethodParameters("ChangeStartMode");
                inParams["startmode"] = startMode;

                ManagementBaseObject outParams = service.InvokeMethod("ChangeStartMode", inParams, null);
                success = Convert.ToUInt16(outParams.Properties["ReturnValue"].Value);
            }
            return (success == 0);
        }
    }

I hope you liked this post,

Bart

I made this class to sync files between two directories (C# .Net 3.5)

using

 System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.IO;

 

namespace DeployUtil

{

    public class CopyUtil

    {

        public static void Sync(string sourcePath, string destinationPath)

        {

            bool dirExisted = DirExists(destinationPath);

 

            //get the source files

            string[] srcFiles = Directory.GetFiles(sourcePath);

 

            foreach (string sourceFile in srcFiles)

            {

                FileInfo sourceInfo = new FileInfo(sourceFile);

                string destFile = Path.Combine(destinationPath, sourceInfo.Name);

 

                if (!dirExisted && File.Exists(destFile))

                {

                    FileInfo destInfo = new FileInfo(destFile);

                    if (sourceInfo.LastWriteTime > destInfo.LastWriteTime)

                    {

                        //file is newer, so copy it

                        File.Copy(sourceFile, Path.Combine(destinationPath, sourceInfo.Name), true);

                        Console.WriteLine(sourceFile + " copied (newer version)");

                    }

                }

                else

                {

                    File.Copy(sourceFile, Path.Combine(destinationPath, sourceInfo.Name));

                    Console.WriteLine(sourceFile + " copied");

                }

            }

 

            DeleteOldDestinationFiles(srcFiles, destinationPath);

 

            //now process the directories if exist

            string[] dirs = Directory.GetDirectories(sourcePath);

 

            foreach (string dir in dirs)

            {

                DirectoryInfo dirInfo = new DirectoryInfo(dir);

 

                //recursive do the directories

                Sync(dir, Path.Combine(destinationPath, dirInfo.Name));

            }

        }

 

        private static bool DirExists(string path)

        {

            //create destination directory if not exist

            if (!Directory.Exists(path))

            {

                Directory.CreateDirectory(path);

                return true;

            }

            else

            {

                return false;

            }

        }

 

        private static void DeleteOldDestinationFiles(string[] sourceFiles, string destinationPath)

        {

            //get the destination files

            string[] dstFiles = Directory.GetFiles(destinationPath);

 

            foreach (string dstFile in dstFiles)

            {

                FileInfo f = new FileInfo(dstFile);

 

                string[] found = Array.FindAll(sourceFiles, str => GetName(str).Equals(f.Name));

                if (found.Length == 0)

                {

                    //delete file if not found in destination

                    File.Delete(dstFile);

                    LogInfo(dstFile + " deleted");

                }

            }

        }

 

        private static string GetName(string path)

        {

            FileInfo i = new FileInfo(path);

            return i.Name;

        }

 

        private static void LogInfo(string text)

        {

            ConsoleColor was = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Magenta;

            Console.WriteLine(text);

            Console.ForegroundColor = was;

        }

 

    }

}

I created this techno track on my iPad, it's called ' So Moe'

Dutch petrol price is the highest in the world

munten, euro, geld

original (translated by Google)

Netherlands has the world rankings as far as the highest petrol prices in the world.Even countries like Denmark and Greece, which normally compete with the Netherlands in terms of highest price per liter, behind us. So says Erik van Erne by Milieunet , the development of gasoline prices since 2008 is watching.

In an earlier study from the Netherlands reported December First in Europe with Greece.

Fuel

Erne of basing his conclusions on a review of Good Environment . Good did a study of the highest prices in dollars per gallon (3.78 liters), which the Netherlands at the top spot ended with a gasoline price of $ 8.83 per gallon. Mark Rutte was in the U.S. entitled "8 Dollar-Per-Gallon-President."

The biggest reason for the high fuel tax increase of 0.6% per 1 January 2011. The rising cost of a barrel of crude oil, peak oil moment (the moment when oil production reaches its peak) and continued unrest in Libya to play smaller roles.

Government

The average national retail price in the Netherlands is currently € 1,719 per liter. The government deserves most to high petrol prices: The price disappears liter € 1.04 in the treasury.

 

Vertical centering with CSS3

I was wondering if CSS3 provides something to do vertical centering easy, and it does, look at the code below, love it...

Center stage: positioning in the middle

Centering something horizontally and vertically has long been a challenge in CSS. The best CSS-only solution we have is position:absolute; left: 50%; top: 50%; paired with negative left/top margins that equal half of the width/height. And that only flies with explicitly sized elements. Ugh! With flexbox we can get there a touch easier:

We don't set box-flex on the child because we don't want it using extra space. We just want it to be in the middle, regardless of it's size. The huge advantage is here, that we don't need to have explicit dimensions in order to center it. We could be doing this with something that's typically block or inline. It just works.