Tag Archives: Programming Tricks

Opening a folder at C#

To open a folder in C#, simply follow the following example :

[code lang="csharp"]
private void openFolder()
{
string myDocspath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);// if you are after special documents (e.g. my documents)
string myFolderpath = Application.StartupPath + "\\folderName\\"; // a folder right beside where you run the program
string windir = Environment.GetEnvironmentVariable("WINDIR");
System.Diagnostics.Process process = new System.Diagnostics.Process();
process .StartInfo.FileName = windir + @"\explorer.exe";
process .StartInfo.Arguments = myFolderpath;
process .Start();//OPEN the folder
}
[/code]


Source

OpenCV installation Tutorial, MS Visual C++ 2008

Installing OpenCV might sound very easy when you read it on some forums/websites, but there are some small changes in most of these tutorials that prevent the connection between OpenCV and MS Visual C++. In this tutorial we(my dear friend Puya Afsharian and I) try to guide you through the installation of these two products and the right way to make them talk with each other.

Although people say it is easy to make OpenCV 2.2 to work with MS Visual C++ 2010, but we did not get it to work properly while it seems that MS visual c++ 2008 works perfect with OpenCV 2.1. Here are the download links for both products :

OpenCV 2.1 : http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.1/
This file is modified to work with MS Visual C++ 2008 and therefore there is no need to install CMake again.

MS Visual C++ 2008(Free of charge) : http://www.microsoft.com/downloads/en/details.aspx?familyid=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&displaylang=en

Click More down here to read the rest of the tutorial …

Continue reading

Android development tricks

This is a summay of the tricks I have learned making an application called courseApp project.  This application was developed in the Mobile Information Systems that I took at University of Oslo. Eclipse is a very good tool to use for Android development. To start with you need to download Andriod SDK. After installing both of these(and ofcourse Java Development Kit, JDK which is a pre-requirement for both of these), you need to make Eclipse and Android SDK talk together. This is done by a plugin called “ADT plugin for Eclipse” from Google. You can read more about how to install this plugin by clicking hereIn case of Android SDK installation(the exe file) doesn’t recognize JDK on your computer, you can simply download the zip file and extract it. Don’t forget appending that folder to the %PATH% environment variable. Now some more tips follows :

Continue reading

Dashed line at Java/Processing

This code is a little bit edited and re-posted again from a post I found on Processing forum. Check the source at the bottom of the post for the original post.
[java]
import java.awt.*;

float[] dashes = { 16.0f, 8.0f, 4.0f, 8.0f };
BasicStroke pen;

void setup(){
size(400, 400);
noLoop();
pen = new BasicStroke(4.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 4.0f, dashes, 0.0f);
Graphics2D g2 = ((PGraphicsJava2D) g).g2;
g2.setStroke(pen);
}

void draw(){
line(0, 0, width, height);
line(0, height, width, 0);
}
[/java]
source : http://processing.org/discourse/yabb2/YaBB.pl?board=Syntax;action=display;num=1217445670