<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Madhat Alsoos</title>
	<atom:link href="http://msoos.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://msoos.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sun, 22 Jan 2012 16:41:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='msoos.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Madhat Alsoos</title>
		<link>http://msoos.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://msoos.wordpress.com/osd.xml" title="Madhat Alsoos" />
	<atom:link rel='hub' href='http://msoos.wordpress.com/?pushpress=hub'/>
		<item>
		<title>0xc000007b Error Solution</title>
		<link>http://msoos.wordpress.com/2010/09/11/0xc000007b-error-solution/</link>
		<comments>http://msoos.wordpress.com/2010/09/11/0xc000007b-error-solution/#comments</comments>
		<pubDate>Sat, 11 Sep 2010 09:05:43 +0000</pubDate>
		<dc:creator>Madhat Alsoos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[OpenCV]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">https://msoos.wordpress.com/?p=48</guid>
		<description><![CDATA[Two days ago I was working on a C++ project using OpenCV, when suddenly my project couldn’t run anymore! I just have changed my OpenCV dlls to parallel version and ended up with this Error: &#34;The application was unable to start correctly (0xc000007b). Click OK to close the application.&#34; every time I tried to run [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=48&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Two days ago I was working on a C++ project using OpenCV, when suddenly my project couldn’t run anymore!</p>
<p>I just have changed my OpenCV dlls to parallel version and ended up with this Error: &quot;The application was unable to start correctly (0xc000007b). Click OK to close the application.&quot; every time I tried to run my application.</p>
<p align="center"><a href="http://msoos.files.wordpress.com/2010/09/0xc000007berror.jpg"><img style="display:inline;border-width:0;" title="0xc000007b-error" border="0" alt="0xc000007b-error" src="http://msoos.files.wordpress.com/2010/09/0xc000007berror_thumb.jpg?w=490&#038;h=171" width="490" height="171" /></a> </p>
<p>After some hours of hard search I found that 0xc000007b error didn’t come from an exception in my code or even OpenCV dlls. I found that the error is just wrong configurations and the solution is easy, so I decided to write this article to show you how you cans solve this error permanently.</p>
<h2 style="font-size:26px;">The Problem</h2>
<p>0xc000007b error comes mainly from mixing up 32bit environment with 64bit one, that is you have an 32bit application that tries to load a 64bit dll.</p>
<p> <span id="more-48"></span>
<p>To see exactly who cause this you must examine your application dependencies carefully.</p>
<p>I used a free portable program to do this: &quot;<a href="http://www.dependencywalker.com/" target="_blank">Dependency Walker</a>&quot;. After you download it you can open any PE file (exe, dll, …)</p>
<p>Open your application executable file (in my case &quot;testopencv.exe&quot;) with dependency walker, you sould see something like this:</p>
<p><a href="http://msoos.files.wordpress.com/2010/09/dependencywalker.gif"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="dependency-walker" border="0" alt="dependency-walker" src="http://msoos.files.wordpress.com/2010/09/dependencywalker_thumb.gif?w=584&#038;h=630" width="584" height="630" /></a></p>
<p>As You can see, dependency walker shows all dlls my application depends on, and all dlls these dlls depends on and so on…</p>
<p>Now you must check these dlls to see which one is 64 bit? If your application works fine you should see nothing, but when your application throws 0xc000007b error that means you have at least one 64 bit dll in these dlls.</p>
<p>In my case as you see, my application depends on cv2010d.dll which depends on tbb_debug.dll which is 64bit dll (notice the 64 number near its icon). You can see the properties of any dll to find its path, my tbb_debug.dll lies on: &quot;E:\Intel\Compiler\11.154\tbb\intel64\vc9\bin&quot;.</p>
<h2 style="font-size:26px;">The Solution</h2>
<p>But why cv2010d.dll links to 64bit version of tbb_debug.dll instead of 32bit one? and how can we change that?</p>
<p>The answer is that most exe or dll have it is dependencies names only not their paths (that is what we called dynamic linking). So finding the real path of these dependencies done in runtime, and in our case that cause the problem.</p>
<p>When I run my application it tries to load cv2010d.dll which tries to load all of its dependencies including tbb_debug.dll. System tries to find tbb_debug.dll 32bit (because my application is 32bit) but when it can’t it tries to find 64bit version and it can, so it tries to load it and here is the error comes from.</p>
<p>To solve this I remove &quot;E:\Intel\Compiler\11.154\tbb\intel64\vc9\bin&quot; from the PATH variable, so when I tries to run my application system can’t find any tbb_debug.dll (neither 32bit nor 64bit version) so it throws a new error now says that tbb_debug.dll is not found.</p>
<p>The last step I made was coping the 32bit version of tbb_debug.dll and but it near my application executable file so now when system tries to load tbb_debug.dll it will find the 32bit version of it (also dependency walker will do that so there isn’t any 64bit dll in my dependencies now) and my application comes back to life again.</p>
<br />Filed under: <a href='http://msoos.wordpress.com/category/uncategorized/'>Uncategorized</a> Tagged: <a href='http://msoos.wordpress.com/tag/c/'>c++</a>, <a href='http://msoos.wordpress.com/tag/errors/'>Errors</a>, <a href='http://msoos.wordpress.com/tag/opencv/'>OpenCV</a>, <a href='http://msoos.wordpress.com/tag/visual-studio/'>visual studio</a>, <a href='http://msoos.wordpress.com/tag/windows/'>Windows</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/msoos.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/msoos.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/msoos.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/msoos.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/msoos.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/msoos.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/msoos.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/msoos.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/msoos.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/msoos.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/msoos.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/msoos.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/msoos.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/msoos.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=48&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://msoos.wordpress.com/2010/09/11/0xc000007b-error-solution/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a4073b728189bf6575ba8665b31d5ae7?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">msoos</media:title>
		</media:content>

		<media:content url="http://msoos.files.wordpress.com/2010/09/0xc000007berror_thumb.jpg" medium="image">
			<media:title type="html">0xc000007b-error</media:title>
		</media:content>

		<media:content url="http://msoos.files.wordpress.com/2010/09/dependencywalker_thumb.gif" medium="image">
			<media:title type="html">dependency-walker</media:title>
		</media:content>
	</item>
		<item>
		<title>Building Qt Applications using your favorite text editor</title>
		<link>http://msoos.wordpress.com/2009/11/28/building-qt-applications-using-your-favorite-text-editor/</link>
		<comments>http://msoos.wordpress.com/2009/11/28/building-qt-applications-using-your-favorite-text-editor/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 16:17:25 +0000</pubDate>
		<dc:creator>Madhat Alsoos</dc:creator>
				<category><![CDATA[Qt]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[emeditor]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[notepad++]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://msoos.wordpress.com/2009/11/28/building-qt-applications-using-your-favorite-text-editor/</guid>
		<description><![CDATA[I have used C++ for about 5 years now, and it is really a very powerful programming language. But I found one big disadvantage; it is too hard to make a C++ GUI. I used to do that by Windows API, but it is difficult to learn and I can’t learn my students all Windows [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=36&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have used C++ for about 5 years now, and it is really a very powerful programming language. But I found one big disadvantage; it is too hard to make a C++ GUI. I used to do that by Windows API, but it is difficult to learn and I can’t learn my students all Windows API concepts for just making some forms and buttons!</p>
<p>Recently I heard about Qt and decided to learn it. As usual I stuck at the beginning; how could I build a Qt Application? and as usual too I do it my way <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2 style="font-size:26px;">Building Qt Applications using Notepad</h2>
<p>If your favorite text editor is still Notepad!, you must build your Qt Applications using command line.</p>
<p>To let it easy to you, I made a batch file depends on what compiler you want to use to build Qt Applications.</p>
<h3><strong>Building Qt Opensource Version using MingW</strong></h3>
<p>If you are using Qt Opensource Version you can use this batch file to build and run Qt Applications:</p>
<blockquote><div style="background-color:#e1e1e1;width:509px;height:285px;border-width:1px;" class="style1">::::::::::::::::::::::: This is Qt building batch by Madhat Alsoos :::::::::::::::::::::::      <br />:: First argument is the directory of the project       <br />:: Second argument is the name of the cpp file without .cpp       </p>
<p>@echo off       <br />cd %1       <br />set QTDIR=%1       <br />set PATH=C:\Qt\2009.04\qt\bin;C:\Qt\2009.04\bin;C:\Qt\2009.04\mingw\bin;C:\WINDOWS\System32;%PATH%       <br />set QMAKESPEC=win32-g++       <br />qmake -project       <br />qmake       <br />mingw32-make.exe       <br />IF not ERRORLEVEL 1 start debug\%2.exe </div>
</blockquote>
<p>You can use this batch by passing the directory of the .cpp file and its name like this:</p>
<blockquote><div style="background-color:#e1e1e1;width:509px;height:24px;border-width:1px;" class="style1">build.bat c:\qt\test\helloworld helloworld</div>
</blockquote>
<p> It is so easy! First set Qt base directory to directory of file which we want to build (which will be passed as an argument to this batch file), then add Qt installation directory to the PATH system variable (just in case) and set QMAKESPEC to win32-g++ which tells Qt that it should make the project for g++ compiler. After that we make the .pro file (Qt project file) and compile it using mingw32 (which came by default with your Qt open source verison).
</p>
<p>Note that you must change Qt path in this batch to where you installed Qt, or simply add your Qt bin folders to PATH system variable.</p>
<h3><strong>Building Qt Commercial Version using Visual Studio</strong></h3>
<p>If you are using Qt Commercial Version you can use this batch file to build and run Qt Applications:</p>
<p> <span id="more-36"></span><br />
<blockquote>
<div style="background-color:#e1e1e1;width:509px;height:302px;border-width:1px;" class="style1">::::::::::::::::::::::: This is Qt building batch by Madhat Alsoos :::::::::::::::::::::::      <br />:: First argument is the directory of the project       <br />:: Second argument is the name of the cpp file without .cpp       </p>
<p>@echo off       <br />cd %1       <br />set QTDIR=%1       <br />set PATH=C:\Qt\4.4.3\bin;C:\Program Files\Microsoft Visual Studio 9.0\VC\bin;%PATH%       <br />set QMAKESPEC=win32-msvc2008       <br />call &quot;C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat&quot;       <br />qmake -project       <br />qmake       <br />nmake       <br />IF not ERRORLEVEL 1 start debug\%2.exe </div>
</blockquote>
<p>You can use this batch by passing the directory of the .cpp file and its name like this:</p>
<blockquote><div style="background-color:#e1e1e1;width:509px;height:24px;border-width:1px;" class="style1">build.bat c:\qt\test\helloworld helloworld</div>
</blockquote>
<p>As you see, I used nmake to build and link the Qt Application which means that you must have Visual Studio installed on your computer to use this batch file. If your using Commercial Version and you don’t have Visual Studio on your computer you can install MingW and use the first batch file which should work in this case too.</p>
<p>Note that you must change Qt path and Visual Studio path in this batch to where you installed them, or simply add you Qt bin folder and Visual Studio bin folder to PATH system variable.</p>
<h2 style="font-size:26px;">Building Qt Applications using EmEditor</h2>
<p>If your favorite text editor is EmEditor, you can make a small button at EmEditor Tools Toolbar and call any of the above batches in it.</p>
<p>Just open EmEditor and go to Tools &gt; External Tools &gt; Customize Tools and click New button, and fill in fields like this:</p>
<p align="center"><img style="display:inline;border-width:0;" title="EmEditor Build Qt Button" border="0" alt="EmEditor Build Qt Button" src="http://msoos.files.wordpress.com/2009/11/emeditorbuildqt.jpg?w=502&#038;h=404" width="502" height="404" /> </p>
</p>
<p>Then you will find a small button in EmEditor Tools Toolbar which will do all things for you:</p>
<p align="center"><img style="display:inline;border-width:0;" title="EmEditor Qt" border="0" alt="EmEditor Qt" src="http://msoos.files.wordpress.com/2009/11/emeditorqt.jpg?w=543&#038;h=651" width="543" height="651" /> </p>
</p>
<h2 style="font-size:26px;">Building Qt Applications using Notepad++</h2>
<p>If your favorite text editor is Notepad++ then you are my man, so I made a Notepad++ plugin named QtNpp just for you <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>You can download it (and even change the way it build your Qt Applications) from my post “<a href="http://msoos.wordpress.com/2009/11/28/qtnpp-notepad-plugin-to-build-qt-applications/" target="_blank">QtNpp: Notepad++ Plugin to build Qt Applications</a>”.</p>
<p align="center">&#160;<img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="Notepad++ Qt" border="0" alt="Notepad++ Qt" src="http://msoos.files.wordpress.com/2009/11/notepadqt1.jpg?w=543&#038;h=646" width="543" height="646" /></p>
<br />Posted in Qt Tagged: build, c++, command, emeditor, gcc, Microsoft, notepad++, qt, visual studio <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/msoos.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/msoos.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/msoos.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/msoos.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/msoos.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/msoos.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/msoos.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/msoos.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/msoos.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/msoos.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/msoos.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/msoos.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/msoos.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/msoos.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=36&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://msoos.wordpress.com/2009/11/28/building-qt-applications-using-your-favorite-text-editor/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a4073b728189bf6575ba8665b31d5ae7?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">msoos</media:title>
		</media:content>

		<media:content url="http://msoos.files.wordpress.com/2009/11/emeditorbuildqt.jpg" medium="image">
			<media:title type="html">EmEditor Build Qt Button</media:title>
		</media:content>

		<media:content url="http://msoos.files.wordpress.com/2009/11/emeditorqt.jpg" medium="image">
			<media:title type="html">EmEditor Qt</media:title>
		</media:content>

		<media:content url="http://msoos.files.wordpress.com/2009/11/notepadqt1.jpg" medium="image">
			<media:title type="html">Notepad++ Qt</media:title>
		</media:content>
	</item>
		<item>
		<title>QtNpp: Notepad++ Plugin to build Qt Applications</title>
		<link>http://msoos.wordpress.com/2009/11/28/qtnpp-notepad-plugin-to-build-qt-applications/</link>
		<comments>http://msoos.wordpress.com/2009/11/28/qtnpp-notepad-plugin-to-build-qt-applications/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 16:03:53 +0000</pubDate>
		<dc:creator>Madhat Alsoos</dc:creator>
				<category><![CDATA[Qt]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[notepad++]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://msoos.wordpress.com/2009/11/28/qtnpp-notepad-plugin-to-build-qt-applications/</guid>
		<description><![CDATA[I really love Qt and began to learn it recently, but I didn’t find a way to build Qt files from inside Notepad++ so as usual I made mine QtNpp is my Notepad++ plugin to build and run Qt applications. The idea The idea of QtNpp is simple; just build the file by using these [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=29&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I really love Qt and began to learn it recently, but I didn’t find a way to build Qt files from inside Notepad++ so as usual I made mine <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>QtNpp is my Notepad++ plugin to build and run Qt applications.</p>
<p><img style="display:inline;border:0;" title="Notepad++  Qt" src="http://msoos.files.wordpress.com/2009/11/notepadqt.jpg?w=543&#038;h=646" border="0" alt="Notepad++  Qt" width="543" height="646" /></p>
<h2 style="font-size:26px;">The idea</h2>
<p>The idea of QtNpp is simple; just build the file by using these lines:</p>
<blockquote>
<div class="style1" style="background-color:#e1e1e1;width:509px;height:167px;border-width:1px;">@echo off<br />
set QTDIR=%1<br />
set PATH=C:\Qt\2009.04\qt\bin;C:\Qt\2009.04\bin;C:\Qt\2009.04\mingw\bin;C:\WINDOWS\System32;%PATH%<br />
set QMAKESPEC=win32-g++<br />
qmake -project<br />
qmake<br />
mingw32-make.exe</div>
</blockquote>
<p>but the implementation of QtNpp is not that simple!</p>
<p>By default QtNpp try to build Qt files by using the above script which works in one of these cases:</p>
<p><span id="more-29"></span></p>
<ol>
<li>You have Qt opensource edition installed at the default path: C:\Qt\2009.04</li>
<li>You have Qt opensource edition installed at another path and this installation path was added to PATH system variables.</li>
<li>You have Qt Commercial edition and you manually installed MingW and both installation paths was added to PATH system variables.</li>
</ol>
<p>What if that is not the case? If my QtNpp doesn’t work by default, don’t worry you can change the building script yourself!</p>
<p>Just create QtNpp.ini in &lt;Notepad++ installation folder&gt;/plugins/Config and QtNpp will execute QtNpp.ini file as a batch and passing the folder of Qt file and the filename to it.</p>
<p>Yes, that is you can put the above script in QtNpp.ini and change whatever you want to change in it, and QtNpp will execute your new script instead of its one!</p>
<h2 style="font-size:26px;">Looking inside</h2>
<p>I used <a href="http://notepad-plus.sourceforge.net/commun/pluginDemoTemplate/NppPluginTemplate.zip" target="_blank">this template</a> as a start of my QtNpp, also I read the source of some free Notepad++ plugins to learn from.</p>
<p>The build and run function of QtNpp is:</p>
<p><pre class="brush: cpp;">
void buildAndRun()
{
	//Save current opened file first
	::SendMessage(nppData._nppHandle, NPPM_SAVECURRENTFILE, NULL,NULL);
	//Get directory and filename of the opened file
	String directory = getCurrentFilePath();
	String filename = getCurrentFileName();
	String command = getBuildCommand(filename,directory,true);
	//Build and run opened file
	RunCommand(filename,directory,command);
}
</pre></p>
<p>Here I get the build commands by getBuildCommand and then run these commands with RunCommand function, which replace %1 with directory path and %2 with filename and save them in bat file and execute it by calling ExecuteBatch function:</p>
<p><pre class="brush: cpp;">
String ExecuteBatch (String filename,String directory,const char* path)
{
	CreateRedirectedProcess((LPTSTR)TEXT(path),(LPTSTR)TEXT(directory.c_str()));
	String s=ReadFromPipe(showText);
	return s;
}
</pre></p>
<p>You can see that I run the batch file in a new process and then read its output from the redirected pipe and send it to NppExec console to print it (which is a Notepad++ plugin comes by default with Notepad++).</p>
<p><pre class="brush: cpp;">
int CreateRedirectedProcess(LPTSTR szCmdline,LPTSTR directory)
{
   SECURITY_ATTRIBUTES saAttr;

   saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
   saAttr.bInheritHandle = TRUE;
   saAttr.lpSecurityDescriptor = NULL;

   if ( ! CreatePipe(&amp;g_hChildStd_OUT_Rd, &amp;g_hChildStd_OUT_Wr, &amp;saAttr, 0) )
      ErrorExit(TEXT(&quot;StdoutRd CreatePipe&quot;));

   if ( ! SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0) )
      ErrorExit(TEXT(&quot;Stdout SetHandleInformation&quot;));

   if (! CreatePipe(&amp;g_hChildStd_IN_Rd, &amp;g_hChildStd_IN_Wr, &amp;saAttr, 0))
      ErrorExit(TEXT(&quot;Stdin CreatePipe&quot;));

   if ( ! SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) )
      ErrorExit(TEXT(&quot;Stdin SetHandleInformation&quot;));

   CreateChildProcess(szCmdline,directory);

   return 0;
}

void CreateChildProcess(LPTSTR szCmdline,LPTSTR directory)
{

   STARTUPINFO siStartInfo;
   BOOL bSuccess = FALSE;
   ZeroMemory( &amp;piProcInfo, sizeof(PROCESS_INFORMATION) );
   ZeroMemory( &amp;siStartInfo, sizeof(STARTUPINFO) );
   siStartInfo.cb = sizeof(STARTUPINFO);
   siStartInfo.hStdError = g_hChildStd_OUT_Wr;
   siStartInfo.hStdOutput = g_hChildStd_OUT_Wr;
   siStartInfo.hStdInput = g_hChildStd_IN_Rd;
   siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
   siStartInfo.wShowWindow=SW_HIDE;

   // Create the child process.
   bSuccess = CreateProcess(NULL,
      szCmdline,     // command line
      NULL,          // process security attributes
      NULL,          // primary thread security attributes
      TRUE,          // handles are inherited
      CREATE_NO_WINDOW,             // creation flags
      NULL,          // use parent's environment
      directory,          // use parent's current directory
      &amp;siStartInfo,  // STARTUPINFO pointer
      &amp;piProcInfo);  // receives PROCESS_INFORMATION

   if ( ! bSuccess )
      ErrorExit(TEXT(&quot;CreateProcess&quot;));
   else
   {
      CloseHandle(piProcInfo.hProcess);
      CloseHandle(piProcInfo.hThread);
   }
}
</pre></p>
<p>Here I redirect the output by creating a pipe and pass it to process using siStartInfo.hStdOutput. Also I hide the console window by using CREATE_NO_WINDOW flag in CreateProcess.</p>
<h2 style="font-size:26px;">Configure QtNpp</h2>
<p>As I said above if QtNpp doesn’t work by default with you, just create QtNpp.ini and put all commands you need to build Qt on your PC in it.</p>
<p>I suggest to take these QtNpp.ini as a start:</p>
<h3><strong>QtNpp.ini for MingW</strong></h3>
<blockquote>
<div class="style1" style="background-color:#e1e1e1;width:509px;height:166px;border-width:1px;">@echo off<br />
set QTDIR=%1<br />
set PATH=C:\Qt\2009.04\qt\bin;C:\Qt\2009.04\bin;C:\Qt\2009.04\mingw\bin;C:\WINDOWS\System32;%PATH%<br />
set QMAKESPEC=win32-g++<br />
qmake -project<br />
qmake<br />
mingw32-make.exe</div>
</blockquote>
<h3><strong>QtNpp.ini for Visual Studio</strong></h3>
<blockquote>
<div class="style1" style="background-color:#e1e1e1;width:509px;height:186px;border-width:1px;">@echo off<br />
set QTDIR=%1<br />
set PATH=C:\Qt\4.4.3\bin;C:\Program Files\Microsoft Visual Studio 9.0\VC\bin;%PATH%<br />
set QMAKESPEC=win32-msvc2008<br />
call &#8220;C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat&#8221;<br />
qmake -project<br />
qmake<br />
nmake</div>
</blockquote>
<p>Just replace fixed paths in QtNpp.ini with paths on your computer or add them to PATH system variable.</p>
<p>You may notice that you can build any kind of files with this plugin (not only Qt) because when you make QtNpp.ini, my plugin turns into executer for it only!</p>
<h2 style="font-size:26px;">Download</h2>
<p>You can download QtNpp dll and sourcecode under GNU License:</p>
<blockquote>
<table style="border-left:#000000 1px solid;border-top:#000000 1px solid;" border="1" cellspacing="0" cellpadding="2" width="506">
<tbody>
<tr>
<td style="border-bottom:#000000 1px solid;background-color:#808080;color:#ffffff;border-right:#000000 1px solid;" width="139" valign="top">QtNpp dll ANSI</td>
<td style="border-bottom:#000000 1px solid;border-right:#000000 1px solid;" width="365" valign="top"><a href="http://www.box.net/shared/huce3xtpz1" target="_blank">QtNppPlugin_ansi.zip</a></td>
</tr>
<tr>
<td style="border-bottom:#000000 1px solid;background-color:#808080;color:#ffffff;border-right:#000000 1px solid;" width="139" valign="top">QtNpp dll Unicode</td>
<td style="border-bottom:#000000 1px solid;border-right:#000000 1px solid;" width="365" valign="top"><a href="http://www.box.net/shared/6mviqcip3p" target="_blank">QtNppPlugin_unicode.zip</a></td>
</tr>
<tr>
<td style="border-bottom:#000000 1px solid;background-color:#808080;color:#ffffff;border-right:#000000 1px solid;" width="139" valign="top">QtNpp source</td>
<td style="border-bottom:#000000 1px solid;border-right:#000000 1px solid;" width="365" valign="top"><a href="http://www.box.net/shared/llqvll6z43" target="_blank">QtNpp_src.zip</a></td>
</tr>
<tr>
<td style="border-bottom:#000000 1px solid;background-color:#808080;color:#ffffff;border-right:#000000 1px solid;" width="139" valign="top">QtNpp.ini for MingW</td>
<td style="border-bottom:#000000 1px solid;border-right:#000000 1px solid;" width="365" valign="top"><a href="http://www.box.net/shared/kzi920c5r1" target="_blank">QtNpp_MingW.zip</a></td>
</tr>
<tr>
<td style="border-bottom:#000000 1px solid;background-color:#808080;color:#ffffff;border-right:#000000 1px solid;" width="139" valign="top">QtNpp.ini for VS</td>
<td style="border-bottom:#000000 1px solid;border-right:#000000 1px solid;" width="365" valign="top"><a href="http://www.box.net/shared/qzpvpxc4hp" target="_blank">QtNpp_VS.zip</a></td>
</tr>
<tr>
<td style="border-bottom:#000000 1px solid;background-color:#808080;color:#ffffff;border-right:#000000 1px solid;" width="139" valign="top">License</td>
<td style="border-bottom:#000000 1px solid;border-right:#000000 1px solid;" width="365" valign="top"><a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GNU General Public License</a></td>
</tr>
</tbody>
</table>
</blockquote>
<br />Posted in Qt Tagged: build, c++, gcc, Microsoft, notepad++, qt, visual studio <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/msoos.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/msoos.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/msoos.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/msoos.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/msoos.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/msoos.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/msoos.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/msoos.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/msoos.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/msoos.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/msoos.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/msoos.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/msoos.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/msoos.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=29&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://msoos.wordpress.com/2009/11/28/qtnpp-notepad-plugin-to-build-qt-applications/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a4073b728189bf6575ba8665b31d5ae7?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">msoos</media:title>
		</media:content>

		<media:content url="http://msoos.files.wordpress.com/2009/11/notepadqt.jpg" medium="image">
			<media:title type="html">Notepad++  Qt</media:title>
		</media:content>
	</item>
		<item>
		<title>Block Facebook using Squid at office</title>
		<link>http://msoos.wordpress.com/2009/10/23/block-facebook-using-squid-at-office/</link>
		<comments>http://msoos.wordpress.com/2009/10/23/block-facebook-using-squid-at-office/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 16:32:29 +0000</pubDate>
		<dc:creator>Madhat Alsoos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ADSL]]></category>
		<category><![CDATA[ADSL Router]]></category>
		<category><![CDATA[Block]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Redirect]]></category>
		<category><![CDATA[Squid]]></category>
		<category><![CDATA[UltraSurf]]></category>

		<guid isPermaLink="false">http://msoos.wordpress.com/2009/10/23/block-facebook-using-squid-at-office/</guid>
		<description><![CDATA[Many weeks ago, almost all people working at office with me stuck at Facebook! They were working on it for hours every day. I do not understand that at all (I don’t see any thing attractive in Facebook, I don’t have a Facebook account yet!). We tried everything to change this bad habit with no [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=27&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Many weeks ago, almost all people working at office with me stuck at Facebook! They were working on it for hours every day. I do not understand that at all (I don’t see any thing attractive in Facebook, I don’t have a Facebook account yet!). We tried everything to change this bad habit with no luck.</p>
<p>Because I am the Technical Manager at my Company, I have access to all computers and equipments. So I use the extreme solution and block Facebook! I searched the Internet for about 2 days about an easy solution or a free firewall to block websites, but I find nothing. So I decided to do it my way. So if you see that you have a hopeless case at you work like me, here is how I blocked Facebook:</p>
<h2 style="font-size:26px;">ADSL Router Configuration</h2>
<p>In our office we have an ADSL Router which is our connector to the Internet. This router and all our computers are connected through a switch. Our ISP already has a Proxy and all requests at port 80 is redirected to it. Fortunately, Facebook is forbidden at this proxy! so how can my employees open it? I discovered that all my employees have proxies with different ports, so they can bypass ISP Proxy which is filtering port 80 only (no proxy requests).</p>
<p>Now my first challenge is: how can I stop all these proxies? and force all people to use ISP Proxy? The easy way is to close all other proxies ports (normally 3128, 8080). But there is some proxies working on other ports like 808, so you must block all possible ports.</p>
<p>From the web interface of my router I added some rules to block all ports above 80 for all computers (except SQL port and Remote Access port).</p>
<h2 style="font-size:26px;">Squid Proxy</h2>
<p>I thought that my problem is solved and that is right, because now my employees can’t open Facebook but that was wrong!. My problem is just began, unfortunately our ISP proxy blocks many websites not only Facebook. So how can we open these websites now?</p>
<p> <span id="more-27"></span>
<p>The only way to do that is to allow people to connect though a proxy other that ISP one. But I must block Facebook at that proxy too!</p>
<p>So I decided to make my own proxy and install it at the domain controller on my office! I chose squid proxy because I am familiar with it and it can work under Windows or Linux. </p>
<p>First step is installing Squid on the domain controller at some port (default port is 3128, but I used 55555) and change ADSL Router configuration to exclude the domain controller from its rules, so it can connect to any ip on any port. To make squid listen to port 55555 you must add this configurations to squid.conf (you can find it under c:\squid\etc):</p>
<blockquote><div style="background-color:#e1e1e1;width:497px;height:21px;border-width:1px;" class="style1">http_port 55555</div>
</blockquote>
<h2 style="font-size:26px;">Redirect Squid Proxy</h2>
<p>Now we have a proxy installed on the domain controller at my office and employees can connect though it. But it is useless now! When someone connect though this proxy, squid will do nothing with the request so it will go through ISP Proxy and that is not what we want.</p>
<p>The solution is redirect squid proxy to any other free proxy on any port other than 80 (a proxy that my employees were used). To do that you must add this configurations to squid.conf:</p>
<blockquote><div style="background-color:#e1e1e1;width:505px;height:85px;border-width:1px;" class="style1">cache_peer <font color="#ff0000">proxy</font> parent <font color="#ff0000">port</font> 0 no-query       <br />acl all src 0.0.0.0/0.0.0.0       <br />http_access allow all       <br />never_direct allow all       </div>
</blockquote>
<p>Just replace &quot;proxy&quot; and &quot;port&quot; with any proxy at any port (other than 80) you want to redirect squid proxy to. To make sure it works open <a title="http://www.whatismyproxy.com/" href="http://www.whatismyproxy.com/">http://www.whatismyproxy.com/</a> you must see 2 proxies, first one is squid and other is the proxy you redirect it to. </p>
<h2 style="font-size:26px;">Block Facebook on Squid</h2>
<p>All we need now is block facebook.com on squid proxy. To do this we can define such rules in squid.conf:</p>
<blockquote><div style="background-color:#e1e1e1;width:505px;height:106px;border-width:1px;" class="style1">acl denyThis dstdomain &quot;c:/squid/acl.txt&quot;      <br />http_access deny denyThis       <br />http_access allow all       <br />acl our_networks src 192.168.1.0/24       <br />http_access allow our_networks </div>
</blockquote>
<p>By this lines we allow all requests from any ip that belong to network 192.168.1.0 with mask 255.255.255.0 except requests that have a destination domain contains is file c:/squid/acl.txt.&#160; </p>
<p>Now create file &quot;c:/squid/acl.txt&quot; and put this line in it:</p>
<blockquote><div style="background-color:#e1e1e1;width:505px;height:22px;border-width:1px;" class="style1">.facebook.com</div>
</blockquote>
<p>You are done! evey time you will try to open <a href="http://www.facebook.com">www.facebook.com</a> (or any subdomain from it) on squid proxy you will get forbidden message from squid.</p>
<h2 style="font-size:26px;">FTP and Squid</h2>
<p>Again I thought that everything is ok, but I discovered that my employees couldn’t use FTP any more! I tried this my self using FileZilla; When I use no proxy option, FileZilla could login but couldn’t retrieve directory list (That is because FTP protocol use random port larger than 1024 to transfer data, and all these ports is closed by my ADSL Router). And when I used squid proxy as HTTP proxy for FileZilla I got forbidden reply from squid and FileZilla couldn’t login at all!</p>
<p>To solve this I googled the internet for about 3 hours and found that squid is not a ftp proxy so I can’t use it to filter ftp connections. But I can use it as a HTTP proxy for FileZilla. To do so I must allow CONNECT method on squid. All you need is add these 2 lines to your squid.conf:</p>
<blockquote><div style="background-color:#e1e1e1;width:505px;height:45px;border-width:1px;" class="style1">http_access allow CONNECT      <br />always_direct allow CONNECT</div>
</blockquote>
<p>First rule allows CONNECT method and second one tells squid not to redirect FTP connection to any other proxy (That is to let FTP clients connect directly to FTP servers).</p>
<h2 style="font-size:26px;">Deny UltraSurf</h2>
<p>Now everything is fine, but my employees are not that simple. They tried to bypass my squid proxy using different methods. One successful method they used was UltraSuf. So I blocked UltraSurf too!</p>
<p>To block UltraSurf you need to block SSL port which is 443, but this will deny you from login to your email! because almost every mailing website uses SSL (HTTPS) to login. You can simply solve that by allowing connections at 443 to each mail website separately like Gmail, Hotmail and Yahoo. But this is not practical.</p>
<p>I found another solution which is deny CONNECT method on ips (I think this will affect FTP connections, so if you do this make sure that you still can connect using FTP client) using this rule at squid.conf (let this rule be the first rule in your squid.conf):</p>
<blockquote><div style="background-color:#e1e1e1;width:505px;height:45px;border-width:1px;" class="style1">acl numeric_IPs url_regex ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+&#160; <br />http_access deny CONNECT numeric_IPs all </div>
</blockquote>
<h2 style="font-size:26px;">Conclusion</h2>
<p>Finally My employees are give up, and I am satisfied about that. Now I can leave my company and be sure that everything is going well. Although there are many ways to bypass my proxy and open facebook using tons of Anonymous browsing websites, but I hope that my employees will not hear about them!</p>
<br />Posted in Uncategorized Tagged: ADSL, ADSL Router, Block, Facebook, Firewall, FTP, Proxy, Redirect, Squid, UltraSurf <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/msoos.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/msoos.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/msoos.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/msoos.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/msoos.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/msoos.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/msoos.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/msoos.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/msoos.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/msoos.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/msoos.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/msoos.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/msoos.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/msoos.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=27&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://msoos.wordpress.com/2009/10/23/block-facebook-using-squid-at-office/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a4073b728189bf6575ba8665b31d5ae7?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">msoos</media:title>
		</media:content>
	</item>
		<item>
		<title>OpenGL vs. DirectX</title>
		<link>http://msoos.wordpress.com/2009/10/09/opengl-vs-directx/</link>
		<comments>http://msoos.wordpress.com/2009/10/09/opengl-vs-directx/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 15:12:05 +0000</pubDate>
		<dc:creator>Madhat Alsoos</dc:creator>
				<category><![CDATA[Graphics]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[DirectX]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[OpenGL]]></category>

		<guid isPermaLink="false">http://msoos.wordpress.com/2009/10/09/opengl-vs-directx/</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; I have been using OpenGL for about 4 years until now, it is really a very good library. But I heard a lot about DirectX and many of my students began to learn it, so I decided to do a research about it to know why they need something other than OpenGL? In my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=23&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="center">&#160;<img style="display:inline;border-width:0;" title="OpenGL" border="0" alt="OpenGL" src="http://msoos.files.wordpress.com/2009/10/opengl.jpg?w=154&#038;h=69" width="154" height="69" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <img style="display:inline;border-width:0;" title="DirectX" border="0" alt="DirectX" src="http://msoos.files.wordpress.com/2009/10/directx.jpg?w=122&#038;h=122" width="122" height="122" /></p>
<p>I have been using OpenGL for about 4 years until now, it is really a very good library. But I heard a lot about DirectX and many of my students began to learn it, so I decided to do a research about it to know why they need something other than OpenGL?</p>
<p>In my research I read a lot of articles comparing DirectX with OpenGL, but many of them were old, also I didn’t find any article that can tell me everything I want to know. So I created this post to be an exhaustive, up-to-date comparison between OpenGL and DirectX.</p>
<p>I will compare current version of OpenGL which is OpenGL 3.1 with current version of DirectX (or Direct3D if we want to be more exact) which is DirectX 10.</p>
<h2 style="font-size:26px;">1. Historical View</h2>
<p>
<h3><strong>OpenGL</strong></h3>
</p>
<p>OpenGL was designed to be a cross platform 2D and 3D Graphics Library, so it doesn’t handle audio or input/output devices but it has many extensions that is made especially to handle this devices. It was developed by Silicon Graphics Incorporated in 1992.</p>
<p>OpenGL is no more than 250 commands which can create, manage and render any complicated scene in many fields like CAD, Virtual Reality, flight simulation and video games.</p>
<p>It is considered a state machine for controlling primitive objects in a scene, so usually programs written in OpenGL are small and efficient. </p>
<h3><strong>DirectX</strong></h3>
<p>It was developed by Microsoft in 1995 to be an OpenGL competitive. It is a kind of API handles multimedia and specializes in games field.</p>
<p>It is made of a components like Direct3D (3D graphics library included DirectDraw for 2D draw), DirectMusic and DirectSound.</p>
<p>Nowadays there is not any product that can do all these things that DirectX can do, even though we can find an alternative for every single component.</p>
<h2 style="font-size:26px;">2. Idea</h2>
<p>DirectX was designed to be an Interface for the hardware that is provided by graphics card vendors, so it isn’t hide low details from the user.</p>
<p> <span id="more-23"></span>
<p>While OpenGL is a rendering system that is accelerated by the hardware, so it is just an uniform API which leaves implementation deals with the hardware.</p>
<p>So we can say that DirectX started from hardware while OpenGL started from an API (or what users want), and now because of the new hardware which almost achieves all users&#8217; dreams we can say that DirectX and OpenGL is almost the same from the idea view.</p>
<h2 style="font-size:26px;">3. Extensions</h2>
<p>OpenGL has a very important feature which is supporting extensions. Any vendor can design its hardware and make a proper extension for it so that OpenGL can use all this new hardware features. But what if two companies make two extensions that do the same thing? To solve this problem there is one standard authority for extensions named OpenGL Architecture Review Board (ARB), it chooses extensions which are really good and support new hardware and makes them standard.</p>
<p>On the other side Direct3D didn’t support extensions when it first made. Even worse, we know that there is at most one new version of DirectX every one year which is very long time comparing to hardware development time. So Microsoft asks vendors every year to support its new version features. That is why most of the time we see many features that are supported by Direct3D even before hardware does!</p>
<p>Now starting from DirectX 8, we can say that Direct3D supports pluggable software devices.</p>
<h2 style="font-size:26px;">4. Portability</h2>
<p>Direct3D was developed by Microsoft to work under Windows, and later Microsoft made some versions of it that work on XBox. There are some individual attempts (like Wine project) try to make DirectX works under other operating systems like Linux.</p>
<p>Microsoft not only doesn’t plane to support any Operating System other than Windows, but also puts condition about Windows version that DirectX needs, for example DirectX 10 needs Windows Vista at least to work!</p>
<p>While OpenGL has many Implements that work under Windows, Linux, Mac OS, OpenSolaris and PlayStation 3. And even more,&#160; OpenGL is considered the main 3D library on iPhone, Andriod, and Symbian OS.</p>
<p>So when you say portability you definitely mean OpenGL.</p>
<h2 style="font-size:26px;">5. Simplicity</h2>
<p>In early versions of DirectX a lot of equivalent to simple OpenGL commands need initialization many buffers, manage them and destroy them. We can say that 90% of code size was initialization for the rest 10%. Newer DirectX versions provide an API that hides all details of buffers like initialization and destroy, so nowadays DirectX is considered as easy to use as OpenGL.</p>
<h2 style="font-size:26px;">6. Performance</h2>
<p>Microsoft said that DirectX is faster than OpenGL, and to prove that it made some tests and publish the results. SGI (Silicon Graphics Incorporated) which developed OpenGL said that OpenGL implementation which was provided by Microsoft under Windows is the problem, so it made its own implementation of OpenGL under Windows and proved that there is no problem in OpenGL structure itself to say that it is slower than DirectX, it’s only a matter of different implementations.</p>
<p>Something very important in performance is supporting what we called marshalling which allows optimization of GPU usage. Marshalling was supported early by OpenGL, while DirectX didn’t support it until DirectX 10 which supports some of its features because of Windows Vista.</p>
<h2 style="font-size:26px;">7. Programming Languages</h2>
<p>DirectX is based on COM technology, so DirectX can be used easily in any language that supports it like C++, Delphi or .NET</p>
<p>Even though OpenGL was designed to be used in C++, now there are many implementations of it that can be used almost in all programming languages like VB, Delphi, Python, Perl, Haskell, Java, .NET and even Pascal!</p>
<h2 style="font-size:26px;">8. Games Field</h2>
<p>After appearance of DirectX and OpenGL, both of them somehow tend to the largest market of Graphics, Computer Games.</p>
<p>In the previous years we saw a lot of games support both DirectX and OpenGL where user can choose between them from inside the game. Later on, games developers especially after appearance of DirectX 8 which introduced easy API, began to get rid of OpenGL in the interest of DirectX. The main reason was that DirectX is not only a rendering system like OpenGL it can also handle sound and input/output devices, but DirectX is more difficult to use and that is exactly what DirectX 8 came to solve. So when games developers saw that DirectX can do more than OpenGL and it is finally as easy as it, they moved to it. That is why nowadays we have many fantastic games work only on DirectX.</p>
<h2 style="font-size:26px;">9. Professional Graphics</h2>
<p>Many 3D applications like science fiction, scientific experiments and animations are made by none Graphics specialists who use OpenGL much more than DirectX, because Microsoft didn’t consider them at all when it developed DirectX to be a hardware interface specified for games. On the other side, OpenGL has many commands used only by non games developers who used OpenGL as a general 3D graphics library. So there are now many specialist programs need only OpenGL to work.</p>
<p>In addition to science fiction programs we see many 3D design programs especially on Mac OS (which is the favorite operating system for designers) that work on OpenGL, even that there are some programs under Windows (like 3d Max and AutoCAD) have the ability to work on both DirectX and OpenGL.</p>
<h2 style="font-size:26px;">10. Web Support</h2>
<p>Unfortunately, neither OpenGL nor DirectX works for 3D web applications. Even that some attempts are made to do that. These attempts try to render 3d scene on the server and send it to the web browser as a picture that can’t be interactive with at all. So we find ourselves forced to use browser plug-ins and make our 3D web application using java3d applet, VRML or something else.</p>
<h2 style="font-size:26px;">11. Market Share</h2>
<p>We can say that DirectX dominants Xbox market while OpenGL dominants all operating systems market except Windows. For Windows, DirectX exceeds OpenGL in games field and leaves animations field exclusively for OpenGL.</p>
<h2 style="font-size:26px;">Conclusion</h2>
<p>We can say that OpenGL was easier than DirectX to use, while DirectX was considered a bit faster than OpenGL. But nowadays starting from DirectX 8, DirectX partially gets rid of its difficulty and begins to attract games developers, while OpenGL proves itself and profits from stickiness of DirectX with Windows to dominants all other Operating Systems market especially Mac OS which is designers&#8217; preferred one.</p>
<p>So finally we can say that the war between OpenGL and DirectX has finished, because they almost provide the same features and each one of them has its own partially dependent field.</p>
<br />Posted in Graphics Tagged: 3D, DirectX, Games, Graphics, Microsoft, OpenGL <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/msoos.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/msoos.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/msoos.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/msoos.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/msoos.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/msoos.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/msoos.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/msoos.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/msoos.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/msoos.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/msoos.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/msoos.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/msoos.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/msoos.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=23&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://msoos.wordpress.com/2009/10/09/opengl-vs-directx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a4073b728189bf6575ba8665b31d5ae7?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">msoos</media:title>
		</media:content>

		<media:content url="http://msoos.files.wordpress.com/2009/10/opengl.jpg" medium="image">
			<media:title type="html">OpenGL</media:title>
		</media:content>

		<media:content url="http://msoos.files.wordpress.com/2009/10/directx.jpg" medium="image">
			<media:title type="html">DirectX</media:title>
		</media:content>
	</item>
		<item>
		<title>Install Windows 7 (64 bit) on HP 530 Notebook</title>
		<link>http://msoos.wordpress.com/2009/10/02/install-windows-7-64-bit-on-hp-530-notebook/</link>
		<comments>http://msoos.wordpress.com/2009/10/02/install-windows-7-64-bit-on-hp-530-notebook/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 13:34:43 +0000</pubDate>
		<dc:creator>Madhat Alsoos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[64 bit]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://msoos.wordpress.com/2009/10/02/install-windows-7-64-bit-on-hp-530-notebook/</guid>
		<description><![CDATA[Windows Versions When Windows Vista became pre-release I immediately installed it because of the stories that we heard about it. We all remember that Microsoft says a lot about Windows Vista, so that we believed it will satisfy all our dreams. But I couldn&#8217;t use it more than one month!! I realized that Windows Vista [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=10&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="font-size:26px;">Windows Versions</h2>
<p>When Windows Vista became pre-release I immediately installed it because of the stories that we heard about it. We all remember that Microsoft says a lot about Windows Vista, so that we believed it will satisfy all our dreams.</p>
<p>But I couldn&#8217;t use it more than one month!! I realized that Windows Vista is not stable, beside that it used a lot of RAM comparing to Windows XP, so I felt that I was stupid because I believed Microsoft trivialities about Windows Vista. From that day I stuck with Windows XP and refuse even thinking about changing it!</p>
<p>Now a days, Windows 7 become pre-release and many people (includes IT professionals) says that Windows 7 is the best ever Windows, they always repeat that Windows 7 is the soul of Windows XP with Windows Vista style. So after I heard this story from a lot of my friends I finally decide to try Windows 7</p>
<h2 style="font-size:26px;">Preparing to Install</h2>
<p>I installed Windows 7 Ultimate (64 bit) on my HP 530 Notebook, and realized a lot of people in forums tried to do that on almost the same laptop, so I deiced to add this post to be a step by step tutorial about installing Windows 7 and almost all programs you need on it.  <br /><span id="more-10"></span></p>
<p>First step is to create a new partition (if you want to install Windows 7 and keep your old Windows like me) or make sure that you don&#8217;t need any files from your old windows drive.</p>
<p>The question here is how much the drive should be? well I recommend that the drive should be at least 25 GB, so that you can Install Windows 7 Ultimate (or what ever version you want) and all your favorite programs on the same drive.</p>
<p>The last question you might ask is what about drives? should I download any? well, my notebook came with FreeDOS so I have no driver at all! and HP provides only drivers for Windows XP and Windows Vista on here website. The answer is so simple: you almost will not need to install any driver manually, so lets begin the installation process.</p>
<p>You are now ready to install Windows 7 so shutdown your laptop to boot from Windows 7 DVD (I tried to install Windows 7 from inside Windows XP but it didn&#8217;t work). DO NOT press the hibernate option! (like I did) if you want Windows 7 to add a multi-boot option for you, you must shutdown your computer.</p>
<h2 style="font-size:26px;">Installation</h2>
<p>When I installed Windows XP on my notebook I fell into the problem of SATA hard disks and forced to disable SATA option from BOIS to let Windows XP recognized my hard, so it remains disabled while I installed Windows 7 (I don&#8217;t believe that you will have this problem, but just in case).</p>
<p>Now boot from Windows 7 DVD and follow the installation steps, it is really a simple installation and you will face only 2 or 3 windows before waiting about 10 minutes to your first reboot.</p>
<p>After that you will enter your computer name, use account and something like that. Here you are! welcome to Windows 7 world!</p>
<p>You can notice from you computer properties that you have only 30 days trial, well now Windows 7 is still pre-release so I went to Microsoft site and got a key from <a href="http://www.microsoft.com/windows/windows-7/get/download.aspx" target="_blank">here</a>, so my Windows is Genuine now.</p>
<h2 style="font-size:26px;">Drivers</h2>
<div class="style1">Now open Device Manager and let&#8217;s see what we have, you will notice that Windows 7 installed driver for your Sound Device, Modem and Wireless Network Adapter. But you still have 2 yellow icons named &#8220;Ethernet Controller&#8221; and &#8220;Unknown Device&#8221;.</div>
<div class="style1">As you expect &#8220;Ethernet Controller&#8221; is your Network Adapter but don’t worry because Windows 7 can recognize it! All you need is right click on it and choose &#8220;Update Driver&#8221; option and tell Windows that you will install the driver manually then choose Vendor &#8220;Intel&#8221; and device that named &#8220;Intel PRO/100 Network Controller&#8221; (or what ever your network card is) and let Windows install the driver for you.</div>
<div class="style1">Now what about &#8220;Unknown Device&#8221;? after some search I found it, it is HP Quick Launch Buttons. You can now check that your launch buttons is working fine except that you see nothing when you use them (you are not seeing any thing when you darken or brighten your screen for example). So you need to install a driver only if you want to see something when you use your launch buttons, I found a lot of drivers for HP Quick Launch Buttons on the internet but no one works with Windows 7 (64 bit). Finally I found <a href="ftp://ftp.hp.com/pub/softpaq/sp43501-44000/sp43616.exe">this one</a> which worked perfectly.</div>
<div class="style1">You still have one drive that could be better, yes it is Display Driver. All you need is going to &#8220;Windows Update&#8221; from &#8220;Control Panel&#8221; and let Windows check for updates, you will see about 4 updates related to your drivers and one of them will install a Nvidia Driver for you (about 16 MB). DO NOT INSTALL the update related to the modem driver, because after I installed it I got a blue screen every time I connect to the Internet with a dial up connection until I uninstalled that update.</div>
<div class="style1">So you are now using Windows 7 and you manually downloaded only one driver (Even though you don’t really need it!).</div>
<h2 style="font-size:26px;">Programs</h2>
<p>I can say that I did not have any problem while installing my favorite programs and here is some of them:</p>
<h3><strong>Firefox</strong></h3>
<p>I can&#8217;t find 64 bit of Firefox even there is a version for another browser derived from it, so I installed the 32 bit of Firefox as usual and it works fine with all my favorite addons.</p>
<h3><strong>Java</strong></h3>
<p>After a lot of searching about JDK for 64 bit (not just JRE), I installed 64 bit version of JDK 1.6 from <a href="ftp://ftp.ku.lt/Windows/Java/jdk-6u16-windows-x64.exe">here</a>.<br />
You will realize after installing JDK 64 bit that it has no Java plugin for browsers, so you must download it your self and install it separately (you will need a file named jre-6u16-windows-i586-s.exe).</p>
<h3><strong>TortoiseSVN</strong></h3>
<p>I installed TortoiseSVN 64 bit from <a href="http://tortoisesvn.net/downloads" target="_blank">tortoisesvn.net</a> website.</p>
<h3><strong>Windows Sidebar </strong></h3>
<p>I love Vista Windows sidebar and I had a fix to install it on my old Windows XP, so on Windows 7 I searched about it and found that Windows 7 don’t have a Sidebar that can be stuck to the right of my screen as with Windows Vista, all it has is a capability to show the gadgets on my desktop and that is not what I want. So after some search I found <a href="http://downloads.ziddu.com/downloadfiles/3042059/Win7-Sidebar-Fix.zip" target="_blank">this fix</a> that fixed my Windows Sidebar and let me enjoy Vista Sidebar program on my Windows 7.</p>
<p>That is the most important programs I used to use, and all of them is just working fine on Windows 7</p>
<h2 style="font-size:26px;">Conclusion</h2>
<p>After I used Windows 7 for about 2 weeks until now, I can tell you that Windows 7 is more stable than Windows Vista, although it uses less memory. Beside that it has a great graphics effects especially when you use Aero theme.</p>
<p>Now I see that I was wrong when I decided to install Windows 7 and kept Windows XP, because I can tell you that you will never boot to Windows XP if you have Windows 7 installed on you PC.</p>
<br />Posted in Uncategorized Tagged: 64 bit, Microsoft, Windows, Windows 7 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/msoos.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/msoos.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/msoos.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/msoos.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/msoos.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/msoos.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/msoos.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/msoos.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/msoos.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/msoos.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/msoos.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/msoos.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/msoos.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/msoos.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=msoos.wordpress.com&amp;blog=9662415&amp;post=10&amp;subd=msoos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://msoos.wordpress.com/2009/10/02/install-windows-7-64-bit-on-hp-530-notebook/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a4073b728189bf6575ba8665b31d5ae7?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">msoos</media:title>
		</media:content>
	</item>
	</channel>
</rss>
