Writing Your First Windows Application with C++

Welcome to the first windows tutorial. In this tutorial, I'll give you the basic information on how to code in windows and we'll go over a few important details first. The basic windows program has two important functions inside. The first one is the event handler(I'll talk about this one later on) and the second one is the main function(WinMain from now on). WinMain is similar to DOS' main function, in fact, WinMain is called from the DOS main function but in windows, we don't have access to the DOS main; everything is covered up by windows. Windows introduces us to messages. A message could be easily described as a pile of data that gets sent to the event handler…

Continue Reading

Use CodeIgniter Resources within Library

To access CodeIgniter's native resources within your library use the get_instance() function. This function returns the CodeIgniter super object. Normally from within your controller functions, you will call any of the available CodeIgniter functions using the $this construct: $this, however, only works directly within your controllers, your models, or your views. If you would like to use CodeIgniter's classes from within your own custom classes you can do so as follows: First, assign the CodeIgniter object to a variable:[php]$CI =& get_instance();[/php]Once you've assigned the object to a variable, you'll use that variable instead of $this: You'll notice that the above get_instance() function is being passed by reference: This is very important. Assigning by reference allows you to use the original CodeIgniter object rather than creating a copy…

Continue Reading

Rename Files During Upload within WordPress Backend

The passage is telling you how to rename the file name automatically by WordPress (without using any plugins). Warning: To apply this hack, you'll have to edit one of WordPress's core files. Keep in mind that it is never recommended. This hack should be redone if you upgrade WordPress. open the wp-admin/includes/files.php file, and go to line 324 (approximately here). You'll see the following: Change it as follows: And the file you upload will automatically be renamed as 20130218180064x268c.ext.

Continue Reading

Friends of Template Classes

A problem that I have been struggling with for some days. When I declare a template function as a friend of a template class, I'll get a compile error, such as the following: And I'll get a compile error message: undefined reference to 'operator< <(std::ostream&, test const&)' Finally, I found that we couldn't declare a friend function like that, we need to specify a different template type for it.

Continue Reading

C# - Run Application as Administrator Automatically

In this tutorial, you will learn how you can run your application as an administrator automatically using Visual C#2012. Start by opening your C# Windows forms application. Right click on your project name in the solution explorer and add a new item... Select an application manifest file: Click add. A new tab should open up, most of the codes in it are not important to us.There is one line however that we need to change: Change asInvoker to requireAdministrator as follows: Save your application and rebuild it. You can only open your executable when using Administrator rights. If you have any more questions, please leave them in the comment section below. Have a nice day!

Continue Reading

Regular Expression

In computing, a regular expression is a specific pattern that provides concise and flexible means to "match" (specify and recognize) strings of text, such as particular characters, words, or patterns of characters. Common abbreviations for "regular expression" include regex and regexp. Basic Concepts A regular expression, often called a pattern, is an expression that specifies a set of strings. To specify such sets of strings, rules are often more concise than lists of a set's members. For example, the set containing the three strings "Handel", "Händel", and "Haendel" can be specified by the pattern H(ä|ae?)ndel (or alternatively, it is said that the pattern matches each of the three strings). In most formalisms, if there exists at least one regex that…

Continue Reading
Contact Us
  • Nanyang Technological University, Singapore
  • root [at] haozhexie [dot] com