<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
	<title>Codecall Community Blog List</title>
	<link>http://forum.codecall.net/blogs/</link>
	<description>Community Blog List Syndication</description>
	<pubDate>Fri, 24 May 2013 03:43:57 +0000</pubDate>
	<webMaster>support@forum.codecall.net (Codecall)</webMaster>
	<generator>IP.Blog</generator>
	<ttl>60</ttl>
	<item>
		<title><![CDATA[lespauled's Blog - What is happening to younger developers?]]></title>
		<link>http://forum.codecall.net/blog/1699/entry-1947-what-is-happening-to-younger-developers/</link>
		<category></category>
		<description><![CDATA[I was on the fence about just appending this to my interview blog entry, but I decided to write this as it's own entry.<br />
<br />
To put ti bluntly, I am losing faith in our profession.&nbsp;&nbsp;It has become filled with people that talk a good game, but can't back it up when questioned during the technical interview.<br />
<br />
We have 2 open requirements and have been going through candidates like butter.&nbsp;&nbsp;Not one candidate could back up anything on his/her resume.&nbsp;&nbsp;Maybe I'm old school, but I actually read the resumes, circle items and take notes for the interview.&nbsp;&nbsp;This goes back to the "don't lie on your resume" advice I gave in a previous blog post.<br />
<br />
I read things like "Extensive experience writing stored procedures and triggers." or "Strong knowledge of Stored Procedures and triggers."&nbsp;&nbsp;<br />
<br />
I completely understand putting buzz words in your resume to get the interview.&nbsp;&nbsp;But, do your homework and learn something about the technologies your listing.&nbsp;&nbsp;You don't have to master them, but be able to answer basic questions.&nbsp;&nbsp;Out of about 10 interviews, not one person could write a SQL statement that's slightly harder than "SELECT * FROM myTable".&nbsp;&nbsp;The new excuse is "oh, the DBA wrote the queries and stored procedures."&nbsp;&nbsp;<br />
<br />
Are you kidding me?<br />
<br />
Another tactic that I've noticed lately is the complete filibuster when asked to tell us about themselves.&nbsp;&nbsp;This is a time to highlight some of your accomplishments, while showing some personality.&nbsp;&nbsp; Now it's "I wrote XYZ application QRS company, then I wrote DFG app for JKL company...."&nbsp;&nbsp;It's just a recap of the resume.&nbsp;&nbsp;We normally go through the last few positions they had on the resume and ask questions about the environment, team size, etc.&nbsp;&nbsp;It's like they try to tell you the overview of the application and hope that there won't be any questions, just a contract.&nbsp;&nbsp;<br />
<br />
Well, that doesn't happen with me.&nbsp;&nbsp;If you work for me, I don't want surprises of "I didn't do anything this week because I didn't understand how to do it."&nbsp;&nbsp;If I have to let a consultant go, it reflects negatively on me.<br />
<br />
Not only haven't we found anyone that comes close to filling one of the 2 positions, it has been an exercise in futility.&nbsp;&nbsp;It seems like everyone puts a bunch of superficial BS on their resume and expect to get the job based on their resume.&nbsp;&nbsp;<br />
<br />
We even got a resume that stated that the guy did all his development on a platform that doesn't even support the language.&nbsp;&nbsp;It's just laughable.<br />
<br />
I would rather leave the reqs open and do the work on my own, than to hire someone that will need me to hold their hands throughout the entire process.&nbsp;&nbsp;<br />
<br />
Like I said earlier, I am losing faith in the newer developers.&nbsp;&nbsp;It seems like they are being groomed in a controlled environment and they are able to function within that paradigm, but they are unable to answer any questions about it.&nbsp;&nbsp;<br />
<br />
We are creating an entire industry of junior programmers that do NOTHING to advance their skills on their own.&nbsp;&nbsp;They lack the discipline and the drive to become the best programmer they can be.&nbsp;&nbsp;It's a drive that younger programmers are missing.&nbsp;&nbsp;It's just sad.]]></description>
		<pubDate>Wed, 22 May 2013 20:03:04 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1699/entry-1947-what-is-happening-to-younger-developers/</guid>
	</item>
	<item>
		<title><![CDATA[UniBrain's Blog - My neo digital infoverse is glowing, and apparrant in weight.]]></title>
		<link>http://forum.codecall.net/blog/1821/entry-1946-my-neo-digital-infoverse-is-glowing-and-apparrant-in-weight/</link>
		<category></category>
		<description><![CDATA[If you aren't already familiar with uni-cortex ~ glow (brain univers-synonymous interface)<br />see this video:<br /><iframe id="ytplayer" class="EmbeddedVideo" type="text/html" width="640" height="390" src="http://youtube.com/embed/q4oLMXHzcOc?html5=1&fs=1" frameborder="0" allowfullscreen webkitallowfullscreen /></iframe><br /><br /><br />Of late, I had recoded glow interface such that each anorb would now reflect the actual size of its content/content.<br /><br />Furthermore, I tinkered with the colour configurations somewhat.<br /><br /><span rel='lightbox'><span rel='lightbox'><img class='bbc_img' src='http://imageshack.us/a/img35/9404/capture25w.png' alt='Posted Image' class='bbc_img' /></span></span><br /><br /><br /><span rel='lightbox'><span rel='lightbox'><img class='bbc_img' src='http://imageshack.us/a/img209/1241/capture24sl.png' alt='Posted Image' class='bbc_img' /></span></span><br /><br /><br /><span rel='lightbox'><span rel='lightbox'><img class='bbc_img' src='http://imageshack.us/a/img189/3016/capture23b.png' alt='Posted Image' class='bbc_img' /></span></span><br /><br /><br /><span rel='lightbox'><span rel='lightbox'><img class='bbc_img' src='http://imageshack.us/a/img545/5250/capture22dk.png' alt='Posted Image' class='bbc_img' /></span></span><br /><br /><br /><span rel='lightbox'><span rel='lightbox'><img class='bbc_img' src='http://imageshack.us/a/img515/3124/capture21j.png' alt='Posted Image' class='bbc_img' /></span></span><br /><br /><br /><span rel='lightbox'><span rel='lightbox'><img class='bbc_img' src='http://imageshack.us/a/img69/8122/capture19u.png' alt='Posted Image' class='bbc_img' /></span></span><br /><br /><br />video:<br /> <br /><iframe id="ytplayer" class="EmbeddedVideo" type="text/html" width="640" height="390" src="http://youtube.com/embed/Re_F41w2dFY?html5=1&fs=1" frameborder="0" allowfullscreen webkitallowfullscreen /></iframe>]]></description>
		<pubDate>Wed, 15 May 2013 05:38:00 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1821/entry-1946-my-neo-digital-infoverse-is-glowing-and-apparrant-in-weight/</guid>
	</item>
	<item>
		<title>Program Mania - Making an Operating System from basic using C++</title>
		<link>http://forum.codecall.net/blog/1797/entry-1944-making-an-operating-system-from-basic-using-c/</link>
		<category></category>
		<description><![CDATA[Introduction<br /><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'><br /><strong class='bbc'><em class='bbc'>Warning</em></strong>: Writing an Operating System can be a long and frustrating challenge - even for experienced programmers. You will find yourself trying to debug errors for hours, and then see the error right in front of your face. Writing an Operating System is a hard and worthy challenge, but don't be frightened off.</span></span></span><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'><br />You may think that making an OS kernel is easy if you've ever programmed before. Think again. You don't have an established API or library to program with; You have to start from <em class='bbc'>scratch</em>. In this tutorial, we are going to learn about bootloaders and linkers and the basics of programming a simple Operating System. If you have never programmed before, I suggest you read some tutorials and try a few smaller projects first.</span></span></span>	Details<span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'><br />The programming language that I prefer is C. C is very portable and can be compiled to run on almost any platform, and is easy to compile and run. I am going to cut to the chase and jump right into development. Our very first step will be printing to screen. You may think you're over your head, but trust me, this isn't too painful =). Open up your favorite text editor or IDE, and create a new file called video.c. This file will contain all of our functions for writing to the screen; at least for now.</span></span></span>	Code<span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'><br />Our first function will be the classic putc. Putc is an abbreviation for put-char or character. Before you start actually writing the code, there are a few things you should keep in mind: Video memory is located at 0xB8000, and there are 16 foreground and 16 background colors. We are going to be using gray text on a black background for now, so that is 0x7. The code for each character is always stored in an even array vidmem[0]and the color fr each character is stored directly after the character vidmem .</span></span></span><pre class='prettyprint lang-auto linenums:0'>
/* Simple putc */
int x, y; /* Our global 'x' and 'y' */
char color; /* Our global color attribute */
void putc( unsigned char c )
{
&nbsp;&nbsp;char *vidmem = (char*)0xB8000; /* pointer to video memory */
&nbsp;&nbsp;int pos = ( y * 2 ) + x; /* Get the position */
&nbsp;&nbsp;vidmem&#91;pos]&nbsp;&nbsp; = c; /* print the character */
&nbsp;&nbsp;vidmem&#91;pos++] = color; /* Set the color attribute */
&nbsp;&nbsp;if (c == '\n') // newline
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;y++;
&nbsp;&nbsp;&nbsp;&nbsp;x = 0;
&nbsp;&nbsp;}
&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;x += 2; // 2 bytes per char
}</pre><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'>Our next function will be </span></span></span>puts<span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'>. This function writes a message to the screen, and relies on the putc function to print each character.</span></span></span><pre class='prettyprint lang-auto linenums:0'>
int puts( char *message )
{
&nbsp;&nbsp;int length;
&nbsp;&nbsp;while(*message)
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;putc(*message++);
&nbsp;&nbsp;&nbsp;&nbsp;length++;
&nbsp;&nbsp;}
&nbsp;&nbsp;return length;
}</pre><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'>Next we must make a new file: main.c. No, not even operating systems can escape a </span></span></span>main()<span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'> function. This will be the startup function that will be called by the loader.</span></span></span><pre class='prettyprint lang-auto linenums:0'>
int main( void )
{
&nbsp;&nbsp;puts("Hello, world!"); /* Print our welcome message */
&nbsp;&nbsp;for(;;); /* Keep the OS running */
}</pre>	Down & Dirty with Assembly<span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'><br />If you thought any of that was hard, wait 'til you see whats next... Assembly. Ah, yes that dreaded thing that pulled itself out of the abyss. -- Wait, assembly is not <strong class='bbc'>that</strong> bad. It just takes time to adjust to. Create a new file, loader.asm, or whatever you want to call it.</span></span></span><pre class='prettyprint lang-auto linenums:0'>
; Loader.asm
bits 32
extern main
global start

start:
&nbsp;&nbsp;call main&nbsp;&nbsp;; Call our kernel's main() function
&nbsp;&nbsp;cli&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Stop interrupts (thats another article?)
&nbsp;&nbsp;hlt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Stop all instructions</pre><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'><br />That certainly wasn't too bad, but that code is for a custom bootloader that's not multiboot compliant. But enough for now.</span></span></span>	Compiling & Running<span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'><br />If you don't already have gcc , ld or nasm, now is the time to get them. You can either get the djgpp package or the cygwin package if you are using Windows. Here are the commands you need to use to compile you homebrew OS:</span></span></span><br /><br /><pre class='prettyprint lang-auto linenums:0'>
gcc -ffreestanding -fno-builtin -nostdlib -c *.c (thats main.c and video.c)
nasm -f aout loader.asm -o loader.o
ld -Ttext 0x1000 -o kernel.bin loader.o main.o video.o</pre><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'>And you're done! Wait, I lied. How do you intend to test it? I would recommend virtual machine software, such as Bochs or Qemu. They allow you to test your OS inside of you host operating system, be it linux or Windows. Still, I'm getting ahead of myself, we need something that will actually interface with the BIOS (Basic Input Output System) and load our kernel (BIOS-&gt;Bootloader-&gt;Loader-&gt;Kernel). Here is the code, and comments for my simple bootloader:</span></span></span><pre class='prettyprint lang-auto linenums:0'>
; tutorial bootloader based off of: http://osdever.net/tutorials/brunmar/tutorial_03.php

&#91;BITS 16]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; 16 bit instructions

&#91;ORG 0x7C00]

jmp word load

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db "ONYXDISK"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; OEM Label String
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 512&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Bytes per sector
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Sectors per FAT cluster
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 36&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Resered sector count
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; number of FATs
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 224&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Root dir entries
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 2880&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Total Sectors
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 240&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Double sided, 18 sectors per track
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Sectors per FAT
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Sectors per track
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Head count (double sided)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dd 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Hidden sector count
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
load:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov ah, 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; floppy drive reset command
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int 13h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; bios floppy interrupt
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or ah, ah&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; check for error code
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jnz load&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; repeat if error

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov ax, 0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov es, ax
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov bx, 0x1000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; destination address of kernel = 0000:1000

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov ah, 02h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; floppy read sector command
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov al, 02h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; number of sectors to read
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov ch, 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; cylinder
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov cl, 02h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; sector
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov dh, 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; head
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int 13h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; bios floppy interrupt
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or ah, ah&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; check for error code
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jnz load&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; repeat if error

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cli&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Disable interrupts

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xor ax, ax
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov ds, ax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Set DS-register to 0 - used by lgdt

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lgdt &#91;gdt_desc]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Load the GDT descriptor

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov eax, cr0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Copy the contents of CR0 into EAX
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or eax, 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Set bit 0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov cr0, eax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Copy the contents of EAX into CR0

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jmp 08h:kernel_seg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Jump to code segment, offset clear_pipe


&#91;BITS 32]
kernel_seg:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov ax, 10h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; save data segment
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov ds, ax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; setup data segment
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov ss, ax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; setup stack segment
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov esp, 090000h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; move the stack pointer to 090000h

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jmp 08h:01000h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; jump to our kernel


gdt:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; address for the GDT

gdt_null:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; null Segment
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dd 0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dd 0

gdt_code:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; code segment, read/execute, nonconforming
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 0FFFFh
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 10011010b
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 11001111b
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 0

gdt_data:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; data segment, read/write, expand down
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 0FFFFh
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 10010010b
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 11001111b
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db 0

gdt_end:

gdt_desc:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw gdt_end - gdt - 1&nbsp;&nbsp;&nbsp;&nbsp;; limit (size)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dd gdt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; address of the GDT

times 510-($-$) db 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; fill up the file with zeros

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dw 0AA55h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; boot sector identifier</pre><br /><br /><br /><br /><br /><br /><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'><br />Yes I'm sure that is confusing, but here is a short wrap up. When you turn on you computer, it automatically starts into real mode (16 bit mode), where you can use the BIOS to carry out certain functions like printing to the screen and reading files. Real mode has several limitations: you can only access the first 1MB of memory, and there is no protection for data. We (as OS-developers) want to switch to protected mode (32 bit mode), where you have 4GB of memory, and the aforementioned data protection. In protect mode though, you do not have access to the BIOS. Therefore, since we can't rely on the BIOS, we need to write functions for our OS to use. But back to the bootloader. The BIOS will look for a bootsector that is exactly 512 bytes (1 sector) and has 0xAA55 as the boot checksum. Then the BIOS will load our bootsector, which in turn loads our loader, which loads our OS.</span></span></span><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'><br />Now compile our bootloader using</span></span></span><pre class='prettyprint lang-auto linenums:0'>
nasm -f bin boot.asm -o boot.bin</pre><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'>You should now have the files kernel.bin and boot.bin. If you are using Windows use this command:</span></span></span><pre class='prettyprint lang-auto linenums:0'>
copy /b boot.bin + kernel.bin os.img</pre><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'>Or on linux:</span></span></span><pre class='prettyprint lang-auto linenums:0'>
dd if=boot.bin of=os.img bs=512 count=1
dd if=kernel.bin of=os.img bs=512 seek=1</pre><span  style='color: rgb(0,0,0)'><span  style='font-family: arial'><span  style='font-size: 12px'>Then tell your emulator (bochs, qemu) to use that file (os.img) as a floppy disk to boot from, and you're on your way to OS Development.</span></span></span>]]></description>
		<pubDate>Wed, 01 May 2013 15:57:00 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1797/entry-1944-making-an-operating-system-from-basic-using-c/</guid>
	</item>
	<item>
		<title><![CDATA[lespauled's Blog - The tide is turning]]></title>
		<link>http://forum.codecall.net/blog/1699/entry-1942-the-tide-is-turning/</link>
		<category></category>
		<description><![CDATA[There are tons of cases where people have a problem and they post their code, and we gladly help them.&nbsp;&nbsp;That's what a board like this is all about. Programmers helping programmers as well as tutoring people that genuinely want to learn.&nbsp;&nbsp;I genuinely love helping people that genuinely want to learn and they show some self reliance in trying to work out problems on their own.<br /><br />Every board gets flodded with people asking someone to do their homework because they were too busy, or lazy, to do it themselves.&nbsp;&nbsp;Maybe they were clowning around in class when the lesson was taught.&nbsp;&nbsp;Who knows?&nbsp;&nbsp;We alway try to help them when they show that they have tried to do it themselves but encounter some problem.&nbsp;&nbsp;This actually helps them become better programmers, and actually helps them become better, self-reliant people.<br /><br />I have been here for about a year and a half, and have done everything I could to help people that have programming issues.&nbsp;&nbsp;But lately, I find myself wondering why I help people when they turn around and don't appreciate the help.&nbsp;&nbsp;I'm not talking about getting recognition or likes to my posts.&nbsp;&nbsp;I am talking about someone coming back with a beligerant response to an answer to their question.&nbsp;&nbsp;Be it a direct answer, or a means to get to their answer.&nbsp;&nbsp;This has been happening more and more here, mostly by newer members and it's beginning to eat at me.&nbsp;&nbsp;Maybe it's due to the Sandy aftermath, maybe it's just me, but my patience is wearing thin.&nbsp;&nbsp;I fear that my responses might take a seriously negative turn.&nbsp;&nbsp;<br /><br />There have been many times over the past few months that I wish there was a black list for each user, so you can simply add them to your blacklist, and you wouldn't see their posts, but everyone else would still see them, unless they were added to their blacklist.&nbsp;&nbsp;That way we can tune out the ungrateful clowns, but they would still have access to the board.<br /><br />The straw that is coming close to being the last straw was an answer to someone asking about a specific library they were using in Java.&nbsp;&nbsp;I mentioned that the library in question has a support board of their own, and that I would post my question there.&nbsp;&nbsp;The reason being that while there is a chance that someone on this site uses this specific library, everybody on that site uses that specific library and the developers of the library probably reside there also.&nbsp;&nbsp;<br /><br />When I mentioned that library's support forum, I was told that I shouldn't send them off to other sites.&nbsp;&nbsp;<br /><br />So, your choices are: <br /><br />1. MAYBE, just MAYBE I'll get lucky and someone on CodeCall will possibly use that specific library and be an expert.<br />or<br />2. I can go to a forum that is made to support that specific library, and get my answer in 10 minutes. Maybe even talk to the developers of the library.<br /><br />To me, it's a <em class='bbc'>no-brainer</em>.<br /><br />Then to top things off, another interjected and said that I should have pointed him to a specific thread that answers his questions.&nbsp;&nbsp;Wait, I'm supposed to look through another forum and get him an answer?&nbsp;&nbsp;Wow.&nbsp;&nbsp;How about he goes to that forum, gets his answers, and starts posting a How To Use XYZ Library tutorial on the forum.&nbsp;&nbsp;That sounds like a logical path that would help multiple people on this forum.<br /><br />It also got me thinking:&nbsp;&nbsp;Why am I giving my time and knowledge to people that don't appreciate it.&nbsp;&nbsp;I used to enjoy doing it.&nbsp;&nbsp;But it's much less enjoyable when you get responses like that.]]></description>
		<pubDate>Thu, 25 Apr 2013 13:31:00 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1699/entry-1942-the-tide-is-turning/</guid>
	</item>
	<item>
		<title>Program Mania - Human face part detection using MATLAB</title>
		<link>http://forum.codecall.net/blog/1797/entry-1941-human-face-part-detection-using-matlab/</link>
		<category></category>
		<description><![CDATA[Face Detection Matlab Code<br /><span  style='color: rgb(50,50,50)'><span  style='font-family: Tahoma'>The following matlab exampes shows how to implement face detection in matlab.</span></span><ul class='bbcol decimal'><li><strong class='bbc'>Download source codes from attachment</strong></li><li><strong class='bbc'>lbp_new</strong><br />
<pre class='prettyprint lang-auto linenums:0'>urns the local binary pattern image or LBP histogram of an image.% J = LBP(I,R,N,MAPPING,MODE) returns either a local binary pattern% coded image or the local binary pattern histogram of an intensity% image I. The LBP codes are computed using N sampling points on a% circle of radius R and using mapping table defined by MAPPING.% See the getmapping function for different mappings and use 0 for% no mapping. Possible values for MODE are% 'h' or 'hist' to get a histogram of LBP codes% 'nh' to get a normalized histogram% Otherwise an LBP code image is returned.%% J = LBP(I) returns the original (basic) LBP histogram of image I%% J = LBP(I,SP,MAPPING,MODE) computes the LBP codes using n sampling% points defined in (n * 2) matrix SP. The sampling points should be% defined around the origin (coordinates (0,0)).%% Examples% --------% I=imread('rice.png');% mapping=getmapping(8,'u2');% H1=LBP(I,1,8,mapping,'h'); %LBP histogram in (8,1) neighborhood% %using uniform patterns% subplot(2,1,1),stem(H1);%% H2=LBP(I);% subplot(2,1,2),stem(H2);%% SP=&#91;-1 -1; -1 0; -1 1; 0 -1; -0 1; 1 -1; 1 0; 1 1];% I2=LBP(I,SP,0,'i'); %LBP code image using sampling points in SP% %and no mapping. Now H2 is equal to histogram% %of I2.function result = lbp(varargin) % image,radius,neighbors,mapping,mode)% Version 0.3% Authors: Marko Heikkil?and Timo Ahonen% Check number of input arguments.error(nargchk(1,5,nargin));image=varargin{1};d_image=double(image);if nargin==1spoints=&#91;-1 -1; -1 0; -1 1; 0 -1; -0 1; 1 -1; 1 0; 1 1];mapping=0;mode='h';endif (nargin == 2) && (length(varargin{2}) == 1)error('Input arguments');endif (nargin &gt; 2) && (length(varargin{2}) == 1)radius=varargin{2};neighbors=varargin{3};spoints=zeros(neighbors,2);% Angle step.a = 2*pi/neighbors;for i = 1:neighborsspoints(i,1) = -radius*sin((i-1)*a);spoints(i,2) = radius*cos((i-1)*a);endif(nargin &gt;= 4)mapping=varargin{4};elsemapping=0;endif(nargin &gt;= 5)mode=varargin{5};elsemode='h';endendif (nargin &gt; 1) && (length(varargin{2}) &gt; 1)spoints=varargin{2};if(nargin &gt;= 3)mapping=varargin{3};elsemapping=0;endif(nargin &gt;= 4)mode=varargin{4};elsemode='h';endend% Determine the dimensions of the input image.&#91;ysize xsize] = size(image);neighbors=size(spoints,1);miny=min(spoints(:,1));maxy=max(spoints(:,1));minx=min(spoints(:,2));maxx=max(spoints(:,2));% Block size, each LBP code is computed within a block of size bsizey*bsizexbsizey=ceil(max(maxy,0))-floor(min(miny,0))+1;bsizex=ceil(max(maxx,0))-floor(min(minx,0))+1;% Coordinates of origin (0,0) in the blockorigy=1-floor(min(miny,0));origx=1-floor(min(minx,0));% Minimum allowed size for the input image depends% on the radius of the used LBP operator.if(xsize &lt; bsizex || ysize &lt; bsizey)error('Too small input image. Should be at least (2*radius+1) x (2*radius+1)');end% Calculate dx and dy;dx = xsize - bsizex;dy = ysize - bsizey;% Fill the center pixel matrix C.C = image(origy:origy+dy,origx:origx+dx);d_C = double&#40;C&#41;;bins = 2^neighbors;% Initialize the result matrix with zeros.result=zeros(dy+1,dx+1);%Compute the LBP code imagefor i = 1:neighborsy = spoints(i,1)+origy;x = spoints(i,2)+origx;% Calculate floors, ceils and rounds for the x and y.fy = floor(y); cy = ceil(y); ry = round(y);fx = floor(x); cx = ceil(x); rx = round(x);% Check if interpolation is needed.if (abs(x - rx) &lt; 1e-6) && (abs(y - ry) &lt; 1e-6)% Interpolation is not needed, use original datatypesN = image(ry:ry+dy,rx:rx+dx);D = N &gt;= C;else% Interpolation needed, use double type imagesty = y - fy;tx = x - fx;% Calculate the interpolation weights.w1 = (1 - tx) * (1 - ty);w2 = tx * (1 - ty);w3 = (1 - tx) * ty ;w4 = tx * ty ;% Compute interpolated pixel valuesN = w1*d_image(fy:fy+dy,fx:fx+dx) + w2*d_image(fy:fy+dy,cx:cx+dx) + ...w3*d_image(cy:cy+dy,fx:fx+dx) + w4*d_image(cy:cy+dy,cx:cx+dx);D = N &gt;= d_C;end% Update the result matrix.v = 2^(i-1);result = result + v*D;end%Apply mapping if it is definedif length(mapping) &gt; 1bins = max(max(mapping)) + 1;for i = 1:size(result,1)for j = 1:size(result,2)result(i,j) = mapping(result(i,j)+1);endendendif (strcmp(mode,'h') || strcmp(mode,'hist') || strcmp(mode,'nh'))% Return with LBP histogram if mode equals 'hist'.result=hist(result(,0:(bins-1));if (strcmp(mode,'nh'))result=result/sum(result);endelse%Otherwise return a matrix of unsigned integersif ((bins-1)&lt;=intmax('uint8'))result=uint8(result);elseif ((bins-1)&lt;=intmax('uint16'))result=uint16(result);elseresult=uint32(result);endendend</pre></li><li><strong class='bbc'>GetMultiscaleLBP</strong><br />
<br />
<pre class='prettyprint lang-auto linenums:0'>function LBPFeature = GetMultiscaleLBP(Image,BlockSize,Rs,Ps,patternMapping,BoundaryFlag)% Author Zhenhua Guo, Lei Zhang and David Zhang% Date June 11, 2010% Version 1.0% Get multiscale LBP histogram% Input Image: Image for extracting features% BlockSize: the size of each block% patternMapping: the mapping of LBP patterns% Rs: the radius of multiscale% Ps: the neighborhoods of multiscale% BoundaryFlag: two kinds of selection on dealing with boundary effectif nargin&lt;2BlockSize = &#91;32,32];endif nargin&lt;3Rs = &#91;4,3,2]; % The radius is from small to bigendif nargin&lt;4Ps = &#91;8,8,8];endif nargin&lt;5for i=1:length(Ps)patternMapping{i} = Getmapping(Ps(i),'u2'); % Get LBP mapping for different radiusesendendfor i=1:length(Ps)patternNum(i) = max(patternMapping{i});endif nargin&lt;6BoundaryFlag = 1; % As the effective size of LBP map is differrent for differernt radiuses, some boundary regions could not provide LBP for big radius.% BoundaryFlag=1 for keeping boundary region, BoundaryFlag=0 for removing boundary regionendBlockNum(1) = size(Image,1)/BlockSize(1);BlockNum(2) = size(Image,2)/BlockSize(2);LBPFeature = &#91;];for m=1:BlockNum(1)for n=1:BlockNum(2)subGray = Image((m-1)*BlockSize(1)+1:m*BlockSize(1),(n-1)*BlockSize(2)+1:n*BlockSize(2));if BoundaryFlag == 1% Get LBP mapping for different radiusesfor j=1:length(Ps)LBPTemp{j} = LBP_new(subGray,Rs(j),Ps(j),patternMapping{j},'x');LBPTemp{j} = double(LBPTemp{j});end% Extend LBP map for big radius, and define the pattern of these boundary pixels% as non-uniform patterns for further processingsize1 = size(LBPTemp{length(Ps)});for j=1:length(Ps)-1size2 = size(LBPTemp{j});size12Diff = (size1-size2)/2;LBPTempNew = LBPTemp{j};LBPTemp{j} = ones(size1)*patternNum(j); % Extend the LBP map and make all pixels as non-uniform patternsLBPTemp{j}(1+size12Diff(1):size1(1)-size12Diff(1),1+size12Diff(2):size1(2)-size12Diff(2)) = LBPTempNew; % Validate the pattern of the central partendelseLBPTemp{1} = LBP_new(subGray,Rs(1),Ps(1),patternMapping{1},'x');LBPTemp{1} = double(LBPTemp{1});size1 = size(LBPTemp{1});% Get LBP mapping for different radiuses and remove boundary regionsfor j=2:length(Ps)LBPTemp{j} = LBP_new(subGray,Rs(j),Ps(j),patternMapping{j},'x');size2 = size(LBPTemp{j});size12Diff = (size2-size1)/2;LBPTemp{j} = LBPTemp{j}(1+size12Diff(1):size2(1)-size12Diff(1),1+size12Diff(2):size2(2)-size12Diff(2));LBPTemp{j} = double(LBPTemp{j});endend% Get Hierachial Multiscale LBP HistogramThreshold = patternNum(1);idxMat = LBPTemp{1}==Threshold;for j=2:length(Ps)LBPTemp{1}(idxMat) = LBPTemp{1}(idxMat)+LBPTemp{j}(idxMat);if j</pre></li><li><strong class='bbc'>getmapping</strong><br />
<br />
<pre class='prettyprint lang-auto linenums:0'>%GETMAPPING returns a mapping table for LBP codes.% MAPPING = GETMAPPING(SAMPLES,MAPPINGTYPE) returns a mapping for% LBP codes in a neighbourhood of SAMPLES sampling% points. Possible values for MAPPINGTYPE are% 'u2' for uniform LBP% 'ri' for rotation-invariant LBP% 'riu2' for uniform rotation-invariant LBP.%% Example:% I=imread('rice.tif');% MAPPING=getmapping(16,'riu2');% LBPHIST=lbp(I,2,16,MAPPING,'hist');% Now LBPHIST contains a rotation-invariant uniform LBP% histogram in a (16,2) neighbourhood.%function mapping = getmapping(samples,mappingtype)% Version 0.1% Authors: Marko Heikkil? and Timo Ahonenmapping = 0:2^samples-1;newMax = 0; %number of patterns in the resulting LBP codeindex = 0;if strcmp(mappingtype,'u2') %Uniform 2newMax = samples*(samples-1) + 3;for i = 0:2^samples-1j = bitset(bitshift(i,1,samples),1,bitget(i,samples)); %rotate leftnumt = sum(bitget(bitxor(i,j),1:samples)); %number of 1-&gt;0 and%0-&gt;1 transitions%in binary string%x is equal to the%number of 1-bits in%XOR(x,Rotate left(x))if numt &lt;= 2mapping(i+1) = index;index = index + 1;elsemapping(i+1) = newMax - 1;endendendif strcmp(mappingtype,'ri') %Rotation invarianttmpMap = zeros(2^samples,1) - 1; % Denis% tmpMap = zeros(2^samples) - 1;for i = 0:2^samples-1rm = i;r = i;for j = 1:samples-1r = bitset(bitshift(r,1,samples),1,bitget(r,samples)); %rotate%leftif r &lt; rmrm = r;endendif tmpMap(rm+1) &lt; 0tmpMap(rm+1) = newMax;newMax = newMax + 1;endmapping(i+1) = tmpMap(rm+1);endendif strcmp(mappingtype,'riu2') %Uniform & Rotation invariantnewMax = samples + 2;for i = 0:2^samples - 1j = bitset(bitshift(i,1,samples),1,bitget(i,samples)); %rotate leftnumt = sum(bitget(bitxor(i,j),1:samples));if numt &lt;= 2mapping(i+1) = sum(bitget(i,1:samples));elsemapping(i+1) = samples+1;endendend</pre></li><li><strong class='bbc'>distMATChiSquare</strong><br />
<br />
<pre class='prettyprint lang-auto linenums:0'>% distMATChiSquare computes the dissimilarity between training samples and a test sample% DV = distMATChiSquare(train, test) returns the distance vector between training samples and a test sample.% The input "train" is a n*d matrix, and each row of it represent one% training sample. The "test" is a 1*d vector.% Examples% --------% I1=imread('rice1.png');% I2=imread('rice2.png');% I3=imread('rice3.png');% mapping=getmapping(8,'u2');% M(1,=LBP_new(I1,1,8,mapping);% M(2,=LBP_new(I2,1,8,mapping);% S=LBP_new(I3,1,8,mapping);% DV = distMATChiSquare(M,S);function DV = distMATChiSquare(trains, test)% Version 1.0% Authors: Zhenhua Guo, Lei Zhang and David Zhang% Copyright @ Biometrics Research Centre, the Hong Kong Polytechnic University&#91;train_row, train_col] = size(trains);&#91;test_row, test_col] = size(test);testExtend = repmat(test, train_row, 1);subMatrix = trains-testExtend;subMatrix2 = subMatrix.^2;addMatrix = trains+testExtend;idxZero = find(addMatrix==0);addMatrix(idxZero)=1;DistMat = subMatrix2./addMatrix;DV = sum(DistMat,2);</pre></li><li><strong class='bbc'>DemoCode</strong><br />
<br />
<pre class='prettyprint lang-auto linenums:0'>% Sample codes for PolyU palmprint imagesPs=&#91;8,8,8];Rs=&#91;4,3,2];BlockSize = &#91;16,32];for i=1:length(Ps)patternMapping{i} = Getmapping(Ps(i),'u2');end% Read three imagesGray1 = imread('PolyU001_1.bmp');Gray2 = imread('PolyU001_2.bmp');Gray3 = imread('PolyU002_1.bmp');Gray1 = im2double(Gray1);Gray1 = (Gray1-mean(Gray1())/std(Gray1();Gray2 = im2double(Gray2);Gray2 = (Gray2-mean(Gray2())/std(Gray2();Gray3 = im2double(Gray3);Gray3 = (Gray3-mean(Gray3())/std(Gray3();% Get features for three imagesLBPFeature1 = GetMultiscaleLBP(Gray1,BlockSize,Rs,Ps,patternMapping,0);LBPFeature2 = GetMultiscaleLBP(Gray2,BlockSize,Rs,Ps,patternMapping,0);LBPFeature3 = GetMultiscaleLBP(Gray3,BlockSize,Rs,Ps,patternMapping,0);D12 = distMATChiSquare(LBPFeature1,LBPFeature2)D13 = distMATChiSquare(LBPFeature1,LBPFeature3)D23 = distMATChiSquare(LBPFeature2,LBPFeature3)% Sample codes for AR face imagesPs=&#91;8,8,8];Rs=&#91;4,3,2];BlockSize = &#91;20,26];for i=1:length(Ps)patternMapping{i} = Getmapping(Ps(i),'u2');end% Read three imagesGray1 = imread('AR001-1.tif');Gray2 = imread('AR001-2.tif');Gray3 = imread('AR002-1.tif');Gray1 = im2double(Gray1);Gray1 = (Gray1-mean(Gray1())/std(Gray1();Gray2 = im2double(Gray2);Gray2 = (Gray2-mean(Gray2())/std(Gray2();Gray3 = im2double(Gray3);Gray3 = (Gray3-mean(Gray3())/std(Gray3();% Get features for three imagesLBPFeature1 = GetMultiscaleLBP(Gray1,BlockSize,Rs,Ps,patternMapping,1);LBPFeature2 = GetMultiscaleLBP(Gray2,BlockSize,Rs,Ps,patternMapping,1);LBPFeature3 = GetMultiscaleLBP(Gray3,BlockSize,Rs,Ps,patternMapping,1);D12 = distMATChiSquare(LBPFeature1,LBPFeature2)D13 = distMATChiSquare(LBPFeature1,LBPFeature3)D23 = distMATChiSquare(LBPFeature2,LBPFeature3)</pre></li><li><strong class='bbc'>TLDA_single</strong><br />
<br />
<pre class='prettyprint lang-auto linenums:0'>function Eigenvector = TLDA_single(A,options,Dim)% A image matrix, the size is m*n*N% N denotes the number of images and equals the number of classes% m and n denote the row and column of image, respectively.% options - Struct value in Matlab. The fields in options% that can be set:% k ----determins how to construct the Con_A using the corresponding% image,the default value is 3;% Dim --- The dimensionality of the reduced subspace.&#91;m,n,N] = size(A);Con_A=construct_image(A,options);global_mean = mean(Con_A,3);Gw = zeros(n,n);Gb = zeros(n,n);for i = 1 : Nindex_L = (i-1)*2+1;index_R = 2*i;b = Con_A(:,:,index_R) - Con_A(:,:,index_L);class_mean = mean(Con_A(:,:,index_L:index_R),3);Gw = Gw + b'*b;Gb = Gb + (class_mean - global_mean)'*(class_mean - global_mean);end&#91;Eigenvector, Eigenvalue] = eigs(inv(Gw)*Gb,Dim);</pre></li><li><strong class='bbc'>readme</strong><br />
<br />
<pre class='prettyprint lang-auto linenums:0'>% how to use the codeload demodataoptions.k = 3;% default valueDim=25; % manually set it according to the image you used&#91;Eigenvector] = TLDA_single(tr_dat,options,Dim);for i = 1 : 38A(:,:,i) = tr_dat(:,:,i) * Eigenvector;end</pre></li><li><strong class='bbc'>construct_image</strong><br />
<pre class='prettyprint lang-auto linenums:0'>function &#91;Con_A]=construct_image(A,options);% A denotes the image matrix, the size is m*n*N% N denotes the number of images% m and n are the row and column of image, respectively.&#91;m,n,N]= size(A);Con_A = zeros(m,n,2*N);for i = 1 : Na = A(:,:,i);&#91;U,D,V] = svd(a);Con_A(:,:,2*i-1) = U(:,1:options.k)*D(1:options.k,1:options.k)*V(:,1:options.k)';Con_A(:,:,2*i) = a;</pre></li></ul>]]></description>
		<pubDate>Tue, 23 Apr 2013 12:36:00 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1797/entry-1941-human-face-part-detection-using-matlab/</guid>
	</item>
	<item>
		<title>Program Mania - Matlab Code For Human Motion Detection</title>
		<link>http://forum.codecall.net/blog/1797/entry-1940-matlab-code-for-human-motion-detection/</link>
		<category></category>
		<description><![CDATA[<span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />function d = tracking(video)</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />if ischar(video)</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% Load the video from an avi file.</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />avi = aviread(video);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />pixels = double(cat(4,avi(1:2:end).cdata))/255;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />clear avi</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />else</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% Compile the pixel data into a single array</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />pixels = double(cat(4,video{1:2:end}))/255;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />clear video</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% Convert to RGB to GRAY SCALE image.</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />nFrames = size(pixels,4);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />for f = 1:nFrames</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% F = getframe(gcf);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% [x,map]=frame2im(F);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% imwrite(x,'fln.jpg','jpg');</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% end</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />pixel(:,:,f) = (rgb2gray(pixels(:,:,:,f)));</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />rows=240;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />cols=320;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />nrames=f;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />for l = 2:nrames</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />d(:,:,l)=(abs(pixel(:,:,l)-pixel(:,:,l-1)));</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />k=d(:,:,l);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% imagesc(k);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% drawnow;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% himage = imshow('d(:,:,l)');</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% hfigure = figure;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% impixelregionpanel(hfigure, himage);</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% datar=imageinfo(imagesc(d(:,:,l)));</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% disp(datar);</span></span></span><br /><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />bw(:,:,l) = im2bw(k, .2);</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />bw1=bwlabel(bw(:,:,l));</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />imshow(bw(:,:,l))</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />hold on</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % for h=1:rows</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% for w=1:cols</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />%</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% if(d(:,:,l)&lt;&gt;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% d(h,w,l)=0;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% end</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% end</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />%</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% end</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % disp(d(:,:,l));</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % size(d(:,:,l))</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />cou=1;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />for h=1:rows</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />for w=1:cols</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />if(bw(h,w,l)&gt;0.5)</span></span></span><br /><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% disp(d(h,w,l));</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />toplen = h;</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />if (cou == 1)</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />tpln=toplen;</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />cou=cou+1;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />break</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />disp(toplen);</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />coun=1;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />for w=1:cols</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />for h=1:rows</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />if(bw(h,w,l)&gt;0.5)</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />leftsi = w;</span></span></span><br /><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />if (coun == 1)</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />lftln=leftsi;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />coun=coun+1;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />break</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />disp(leftsi);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />disp(lftln);</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % drawnow;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % d = abs(pixel(:, :, l), pixel(:, :, l-1));</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % disp(d);</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% s = regionprops(bw1, 'BoundingBox');</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % centroids = cat(1, s.Centroid);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />%</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % ang=s.Orientation;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />%</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % plot(centroids(:,1), centroids(:,2), 'r*')</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% for r = 1 : length(s)</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% rectangle('Position',s&reg;.BoundingBox,'EdgeColor','r');</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />%</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % plot('position',s&reg;.BoundingBox,'faceregion','r');</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% end</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />%</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % disp(ang);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% % imaqmontage(k);</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />widh=leftsi-lftln;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />heig=toplen-tpln;</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />widt=widh/2;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />disp(widt);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />heit=heig/2;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />with=lftln+widt;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />heth=tpln+heit;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />wth(l)=with;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />hth(l)=heth;</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />disp(heit);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />disp(widh);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />disp(heig);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />rectangle('Position',[lftln tpln widh heig],'EdgeColor','r');</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />disp(with);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />disp(heth);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />plot(with,heth, 'r*');</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />drawnow;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />hold off</span></span></span><br /><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />end;</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% wh=square(abs(wth(2)-wth(nrames)));</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% ht=square(abs(hth(2)-hth(nrames)));</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% disp(wth(1</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% distan=sqrt(wh+ht);</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />%</span></span></span><span  style='color: rgb(51,51,51)'><span  style='font-family: Verdana'><span  style='font-size: 10px'><br />% disp(distan);</span></span></span>]]></description>
		<pubDate>Tue, 23 Apr 2013 12:30:00 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1797/entry-1940-matlab-code-for-human-motion-detection/</guid>
	</item>
	<item>
		<title><![CDATA[lespauled's Blog - How many times do I have to do something before I fix it?]]></title>
		<link>http://forum.codecall.net/blog/1699/entry-1939-how-many-times-do-i-have-to-do-something-before-i-fix-it/</link>
		<category></category>
		<description><![CDATA[I can't count the number of times that I have had to parse a name, be it from user input or an input stream. Every time, I would have to write a routine that parses the name into parts and then save it to the database in the correct format.<br /><br />You would write code that handles John Smith and also Smith, John. You would write more code that handles John M Smith as well as John Smith III. We end up doing this over and over again.<br /><br />You're probably thinking "I just put all the pieces on the screen, First Name, Last Name, M.I., etc." Of course, that's one way, but then you would be concatenating the parts together to show the user's full name. You most likely do this code routine over and over.<br /><br />Finally, I had enough. I started thinking about wrapping this mundane ritual into a class that I could use over and over and rid myself of this albatross once and for all. The whole process may be overkill, but I was fuming over doing the same thing over and over again.<br /><br />I started with any interface, IUserName:<pre class='prettyprint lang-auto linenums:0'>
&nbsp;&nbsp;&nbsp;&nbsp;public interface IUserName
	{
		bool CanHandle(string userName);
		string FirstName { get; set; }
		string LastName { get; set; }
		string MiddleInitial { get; set; }
		string Print();
		string Suffix { get; set; }
		string FullName();
	}</pre>This would be the interface that would be used by any program consuming my object.<br /><br />You probably notice the interface has a Print() as well as a FullName(). For debugging purposes, I will make Print() show me the individual pieces to verify the parsing was done correctly.<br /><br />As stated earlier, there could be a straight name (John Smith) or a reversed name (Smith, John). That told me that I could separate the 2 parsing routines into separate object. Now that I knew I was using separate objects, I know that I will have an abstract base class that contains common code.<pre class='prettyprint lang-auto linenums:0'>
&nbsp;&nbsp;&nbsp;&nbsp;public abstract class UserNameBase : IUserName
	{

		public virtual bool CanHandle(string userName)
		{
			return false;
		}

		private static List&lt;string&gt; Suffixes = new List&lt;string&gt;(new string&#91;] { "jr", "sr", "esq", "ii", "iii", "iv", "v", "2nd", "3rd", "4th", "5th" });

		public string FirstName { get; set; }
		public string MiddleInitial { get; set; }
		public string LastName { get; set; }
		public string Suffix { get; set; }

		internal UserNameBase() { }

		protected UserNameBase(string userName)
		{
			if (this.CanHandle(userName))
				Split(userName);
		}

		/// &lt;summary&gt;
		/// Splits a name string into the first and last name
		/// &lt;/summary&gt;
		/// &lt;param name="name"&gt;Name to be split&lt;/param&gt;
		/// &lt;param name="firstName"&gt;Returns the first name&lt;/param&gt;
		/// &lt;param name="lastName"&gt;Returns the last name&lt;/param&gt;
		protected virtual void Split(string inName)
		{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

		/// &lt;summary&gt;
		/// Returns true if the given string appears to be a name suffix
		/// &lt;/summary&gt;
		/// &lt;param name="s"&gt;String to test&lt;/param&gt;
		protected bool IsSuffix(string s)
		{
			// Strip any punctuation from string
			StringBuilder sb = new StringBuilder();
			foreach (char c in s)
			{
				if (Char.IsLetterOrDigit&#40;c&#41;)
					sb.Append&#40;c&#41;;
			}
			return Suffixes.Contains(sb.ToString(), StringComparer.OrdinalIgnoreCase);
		}

		public string Print()
		{
			StringBuilder sb = new StringBuilder();

			if (!string.IsNullOrEmpty(this.FirstName))
			{
				sb.Append(string.Format("FirstName: {0} ", this.FirstName));
			}

			if (!string.IsNullOrEmpty(this.MiddleInitial))
			{
				sb.Append(string.Format("MiddleInitial: {0} ", this.MiddleInitial));
			}

			if (!string.IsNullOrEmpty(this.LastName))
			{
				sb.Append(string.Format("LastName: {0} ", this.LastName));
			}

			if (!string.IsNullOrEmpty(this.Suffix))
			{
				sb.Append(string.Format("Suffix: {0} ", this.Suffix));
			}

			return sb.ToString();
		}


		public string FullName()
		{
			StringBuilder sb = new StringBuilder();

			if (!string.IsNullOrEmpty(this.FirstName))
			{
				sb.Append(string.Format("{0} ", this.FirstName));
			}

			if (!string.IsNullOrEmpty(this.MiddleInitial))
			{
				sb.Append(string.Format("{0} ", this.MiddleInitial));
			}

			if (!string.IsNullOrEmpty(this.LastName))
			{
				sb.Append(string.Format("{0} ", this.LastName));
			}

			if (!string.IsNullOrEmpty(this.Suffix))
			{
				sb.Append(string.Format("{0} ", this.Suffix));
			}

			return sb.ToString().Trim();
		}
	}</pre>Now we have our base class. It's very straightforward.<br /><br />I guess the main point of interest is CanHandle(). There's nothing here at this level, but children of this class will implement their own business rules on if this name can be parsed by this class.<br /><br />The base class gives a list of suffixes that a person can use (e.g. John Smith II). You can add more if you like. The split routine contains nothing in this level, that will be up to the child classes.<br /><br />You can also see that Print() is for debugging. We can easily change it to return FullName() when we're ready for deployment.<br /><br />Now comes the fun part, creating the derived classes (Straight and reversed)<br /><br /><br /><br />First, StraightUserName, like "John Smith"<pre class='prettyprint lang-auto linenums:0'>
&nbsp;&nbsp;&nbsp;&nbsp;public class StraightUserName : UserNameBase
	{
		public override bool CanHandle(string userName)
		{
			if (string.IsNullOrEmpty(userName))
				return false;

			bool retVal = false;

			string&#91;] pieces = userName.Split(',');

			if (pieces.Length == 1)
			{
				retVal = true;
			}
			else if (pieces&#91;0].Split(' ').Length &gt; 1)
			{
				retVal = true;
			}

			if (retVal)
				Split(userName);

			return retVal;
		}

		internal static IUserName Create(string userName = null)
		{
			return new StraightUserName(userName);
		}

		internal StraightUserName() { }

		internal StraightUserName(string userName)
			: base(userName)
		{
		}

		protected override void Split(string inName)
		{
			string&#91;] splitName = inName.Replace("&nbsp;&nbsp;", " ").Split(' ');

			string name = string.Empty;

			int numParts = splitName.Length;
			int suffixPosition = -1;

			for (int i = numParts - 1; i &gt; 0; i--)
			{
				string s = splitName&#91;i].Trim(new char&#91;] { ' ', ',' });

				if (IsSuffix(s))
				{
					this.Suffix = s;
					suffixPosition = i;
					break;
				}
			}

			switch (numParts)
			{
				case 2:
					this.FirstName = splitName&#91;0];
					this.LastName = splitName&#91;1];
					break;
				case 3:
					switch (suffixPosition)
					{
						case -1:
							this.FirstName = splitName&#91;0];
							this.MiddleInitial = splitName&#91;1];
							this.LastName = splitName&#91;2];
							break;
						case 2:
							this.FirstName = splitName&#91;0];
							this.LastName = splitName&#91;1];
							break;
						default:
							throw new InvalidCastException(string.Format("Invalid user name: {0}", inName));
					}
					break;
				case 4:
					this.FirstName = splitName&#91;0];
					this.MiddleInitial = splitName&#91;1];
					this.LastName = splitName&#91;2];
					break;
				default:
					throw new InvalidCastException(string.Format("Invalid user name: {0}", inName));
			}
		}
	}</pre>There are really only 2 points of interest here, the CanHandle() logic and the Split() logic. We just check that the name fits the criteria. I left out some logic, like name length, etc. It will cause an InvalidCastException later on in the name parsing.<pre class='prettyprint lang-auto linenums:0'>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public override bool CanHandle(string userName)
		{
			if (string.IsNullOrEmpty(userName))
				return false;

			bool retVal = false;

			string&#91;] pieces = userName.Split(',');

			int numPieces = pieces.Length;

			if (numPieces &gt; 1)
				if (pieces&#91;0].Split(' ').Length &gt; 1)
					retVal = false;
				else
					retVal = true;

			if (retVal)
				Split(userName);

			return retVal;
		}

		internal static IUserName Create(string userName = null)
		{
			return new ReversedUserName(userName);
		}

		internal ReversedUserName() { }

		internal ReversedUserName(string userName)
			: base(userName)
		{

		}

		/// &lt;summary&gt;
		/// Splits a name string into the first and last name
		/// &lt;/summary&gt;
		/// &lt;param name="name"&gt;Name to be split&lt;/param&gt;
		/// &lt;param name="firstName"&gt;Returns the first name&lt;/param&gt;
		/// &lt;param name="lastName"&gt;Returns the last name&lt;/param&gt;
		protected override void Split(string inName)
		{

			int lastNameEndPosition = inName.IndexOf(',');

			if (lastNameEndPosition == -1)
				return;

			this.LastName = inName.Substring(0, lastNameEndPosition);

			inName = inName.Substring(lastNameEndPosition + 1);

			string&#91;] splitName = inName.Trim().Replace("&nbsp;&nbsp;", " ").Split(' ');

			string name = string.Empty;

			int numParts = splitName.Length;

			if (numParts == 1)
				return;

			int suffixPosition = -1;

			for (int i = numParts - 1; i &gt; 0; i--)
			{
				string s = splitName&#91;i].Trim(new char&#91;] { ' ', ',' });

				if (IsSuffix(s))
				{
					this.Suffix = s;
					suffixPosition = i;
					break;
				}
			}

			switch (numParts)
			{
				case 2:
					switch (suffixPosition)
					{
						case -1:
							this.FirstName = splitName&#91;0];
							this.MiddleInitial = splitName&#91;1];
							break;
						case 2:
							this.FirstName = splitName&#91;0];
							break;
						default:
							throw new InvalidCastException(string.Format("Invalid user name: {0}", inName));
					}


					break;
				case 3:
					switch (suffixPosition)
					{
						case -1:
							// We already took out the last name, so there shouldn't be 3 pieces without a suffix.
							throw new InvalidCastException(string.Format("Invalid user name: {0}", inName));

						case 2:
							this.FirstName = splitName&#91;0];
							this.MiddleInitial = splitName&#91;1];
							break;
						default:
							throw new InvalidCastException(string.Format("Invalid user name: {0}", inName));
					}
					break;
				default:
					throw new InvalidCastException(string.Format("Invalid user name: {0}", inName));
			}
		}
	}</pre>Same thing as before. It looks like a lot, but it's really not.<br /><br />Both of these classes implement IUserName. This will come in handy in a little bit.<br /><br />You also may have noticed that the constructors are all marked as internal. I did this because I didn't want the user to have to determine what type of class to call. This entire project would be a class library, and the only way to make a class was using our own Factory.<pre class='prettyprint lang-auto linenums:0'>
&nbsp;&nbsp;&nbsp;&nbsp;public class UserNamefactory
	{

		public static IUserName Create(string userName)
		{
			IUserName retVal = null;

			List&lt;IUserName&gt; classOptions = new List&lt;IUserName&gt;();

			classOptions.Add(StraightUserName.Create());
			classOptions.Add(ReversedUserName.Create());

			retVal = classOptions.FirstOrDefault(x =&gt; x.CanHandle(userName));

			return retVal;
		}
	}
</pre>The factory resides in the same module, so it has access to the internal constructors.<br />The factory simply creates a list of available classes that we can receive and gives us the appropriate one.<br /><br />Now into our test cases. You can create a test project, but I decided to simply make a console application.<br /><br /><br />I created the console app, added a reference to the UserName project and simply wrote some test cases:<pre class='prettyprint lang-auto linenums:0'>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UserName;

namespace TestUserClass
{
	class Program
	{
		static void Main(string&#91;] args)
		{
			// All this is in leiu of a test project.

			IUserName u1 = UserNamefactory.Create("Dwight D Eisenhower");
			Console.WriteLine(u1.Print());

			IUserName u2 = UserNamefactory.Create("Lindon B. Johnson");
			Console.WriteLine(u2.Print());

			IUserName u3 = UserNamefactory.Create("Tom Jones");
			Console.WriteLine(u3.Print());

			IUserName u4 = UserNamefactory.Create("Jay Leno iii");
			Console.WriteLine(u4.Print());

			IUserName u5 = UserNamefactory.Create("Jay Bing Leno iii");
			Console.WriteLine(u5.Print());

			IUserName u6 = UserNamefactory.Create("Leno, Jay Bing iii");
			Console.WriteLine(u6.FullName());

			IUserName u7 = UserNamefactory.Create("Jay Bing Leno, iii");
			Console.WriteLine(u7.FullName());

			Console.Write("\n\nenter any key to continue:");
			Console.ReadKey();
		}
	}
}
</pre>The result should look like this:<br /><br /><br /> <blockquote class='ipsBlockquote' ><p>FirstName: Dwight MiddleInitial: D LastName: Eisenhower<br />FirstName: Lindon MiddleInitial: B. LastName: Johnson<br />FirstName: Tom LastName: Jones<br />FirstName: Jay LastName: Leno Suffix: iii<br />FirstName: Jay MiddleInitial: Bing LastName: Leno Suffix: iii<br />Jay Bing Leno iii<br />Jay Bing Leno, iii<br /><br /><br />enter any key to continue:</p></blockquote>Overkill? Of course. But think of the user experience when you can add a single textbox to your program with the label Name:, instead of a bunch of textboxes with the labels: First Name, M.I. Last Name, Suffix, etc.<br /><br />Oh, I'm sure you've figured it out already, but in the event your database has separate fields for each part, you can simple save these using the individual fields.<br /><br />myData[FirstName] = myUserName.FirstName;<br />etc.<br /><br />That just gave me an idea. Add an extension to this giving the user an Save event that they can assign.<br /><br />I'm back to coding.]]></description>
		<pubDate>Fri, 12 Apr 2013 15:54:03 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1699/entry-1939-how-many-times-do-i-have-to-do-something-before-i-fix-it/</guid>
	</item>
	<item>
		<title><![CDATA[CriticalError's Blog - Internet Explorer]]></title>
		<link>http://forum.codecall.net/blog/1803/entry-1938-internet-explorer/</link>
		<category></category>
		<description><![CDATA[One of the biggest challenges for web developers is fighting with internet explorer in every way or form, to get to the point it's awful slow, ** and 10 years behind everything else, still we got to support it considering it is the default browser on most PCs. When at work, I usually do most of the testing on Chrome, chrome is always up to date, fast and not a pain in the other end....<br /><br />You can spend 10 minutes solving an issue, once you solved it you know it is likely to work in Firefox, safari and opera.......comes IE and "sh*t!" and then you simply gotta love this..<br /><br /><a href='http://blog.michiwend.com/wp-content/uploads/2012/02/hmtl5_ie.jpg' class='bbc_url' title='External link' rel='nofollow external'>http://blog.michiwend.com/wp-content/uploads/2012/02/hmtl5_ie.jpg</a><br /><br /><br />It's a shame Microsoft target Google with their campaign "Scroogled" by Google should retaliate with how ** IE is.]]></description>
		<pubDate>Thu, 11 Apr 2013 22:15:00 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1803/entry-1938-internet-explorer/</guid>
	</item>
	<item>
		<title><![CDATA[lespauled's Blog - When DONE isn't DONE]]></title>
		<link>http://forum.codecall.net/blog/1699/entry-1937-when-done-isnt-done/</link>
		<category></category>
		<description><![CDATA[On one of my assignments, I was in charge of 3 off shore teams and an in-house team of developers.&nbsp;&nbsp;As part of my duties, I also had to architect a new version of an existing program that had become incredibly hard to maintain and introduce new features.<br /><br />The multiple timezones, leads to my next issue.&nbsp;&nbsp;The timeszones made it interesting to have meetings.&nbsp;&nbsp;Our beginning of day was their end of day.&nbsp;&nbsp;I had to come in very early on Fridays to hold a meeting about the weeks deliverables.&nbsp;&nbsp;<br /><br />My main focus was on the architecture of the new program, so I tried to stay away from the code as much as possible.&nbsp;&nbsp;I didn't want to be biased by seeing what few parts of the program that did work.&nbsp;&nbsp;Finally, the problems in the program gave me no choice but to see what the problem was with so many bugs.&nbsp;&nbsp;The Senior VP wanted to be in that meeting and wanted to see the code for himself.&nbsp;&nbsp;He gave me a copy of the requirements documents for each team.&nbsp;&nbsp;I <br /><br />I finally opened the code and I was stunned to see that there was a folder called "includes".&nbsp;&nbsp;This was a C# project.&nbsp;&nbsp;There are no includes, but I figured that was just the name of the folder.&nbsp;&nbsp;Unfortunately, that wasn't the case.&nbsp;&nbsp;The folder contained a bunch of .inc files that contained nothing but HTML.&nbsp;&nbsp;I had no choice but to tell the Senior VP what was happening.&nbsp;&nbsp;He went ballistic.&nbsp;&nbsp;He went line by line in the requirements document. I thought the entire project was going to be cancelled any minute.&nbsp;&nbsp;Either that, or we'd be calling the paramedics for the SVP.<br /><br />The end result was I would be doing daily code reviews of the day's code.&nbsp;&nbsp;We would have a WebEx and we would go through line by line of code.&nbsp;&nbsp;I would have an agenda of line items that were to be completed by the end of the week.&nbsp;&nbsp;I would go down the list and hear "That's done." to almost every item.&nbsp;&nbsp;I was thrilled.&nbsp;&nbsp;I ended the meeting and they went home, I grabbed breakfast, and started the rest of my day.<br /><br />Later in the day, one of the in-house team would say that something isn't working in the new updates.&nbsp;&nbsp;After going through it, not only wasn't it working right, it wasn't working at all.&nbsp;&nbsp;I wrote it into my Monday agenda book.&nbsp;&nbsp;As the day progressed, more and more items that were "done" had the same result.&nbsp;&nbsp;I couldn't wait for Monday's meeting.<br /><br />Here is the gist of the meeting (<span  style='font-size: 12px'><span  style='background-color: rgb(247,247,247)'>OST = the off-shore teams.)</span></span><br /><br /><blockquote class='ipsBlockquote' ><p>Me: The items you told me were done on Friday are not done.<br /><br />OST: Those are done.<br /><br />I was floored by that response.<br /><br />Me: None of those items are working.&nbsp;&nbsp;<br /><br />OST: Yes, that's true, but they are marked as 'done'.<br /><br />At this point, I am completely lost.<br /><br />Me: If they were marked done, they should be done.&nbsp;&nbsp;They should work perfectly, be tested extensively to verify the 'done' state.<br /><br />OST: Those are done, they're just not 'DONE DONE'.<br /><br />I was completely dumbfounded.&nbsp;&nbsp;The last bit of patience left my body. <br /><br />Me: What the ** is done done? (not sure I used the term **.&nbsp;&nbsp;Most likely started with the 6th letter of the alphabet)<br /><br />OST: Done Done is the status that the item is completely done and tested.<br /><br />Me: Then what the ** is done? (again, I doubt I used "**")<br /><br />OST: That's when the coding is done, but they still have to test it.<br /><br />(Now I'm livid)<br /><br />Me: From now on all work items will be on a spreadsheet.&nbsp;&nbsp;Each item will be filled in with the person(s) assigned and their supervisor.<br /><br />There will be 3 active statuses and one inactive status for each line item: <br /><br />(inactive work item)<br />1. On Hold<br /><br />(Active work item)<br />1. In Queue<br />2. In Progress<br />3. Done<br /><br />If something is marked done that isn't completely done, that person, and possibly his supervisor will no longer work for this company.<br /><br />OST: (complete silence)<br /><br />Me: Thank you ladies and gentlemen.</p></blockquote>]]></description>
		<pubDate>Tue, 26 Mar 2013 18:23:06 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1699/entry-1937-when-done-isnt-done/</guid>
	</item>
	<item>
		<title><![CDATA[RhetoricalRuvim's Blog - DIV 0 is Not the Only Way to Fail (Apparently)]]></title>
		<link>http://forum.codecall.net/blog/1822/entry-1936-div-0-is-not-the-only-way-to-fail-apparently/</link>
		<category></category>
		<description><![CDATA[Hello everyone.<br /><br />I just discovered something while trying to debug one of my assembly language programs. This is probably not new information for some people, but perhaps someone might find this useful to know.<br /><br />The thing is: dividing by 0 is not the only way to raise an exception while executing the DIV instruction; dividing by 1 is just about as bad.<br /><br />Take, for instance, the following code:<pre class='prettyprint lang-auto linenums:0'>#include &lt;stdio.h&gt; 

int main (){ 
	long a; 
	asm { 
		mov ax, 256 
		mov cl, 1 
		div cl 
		mov dword ptr &#91;a], eax 
	} 
	printf ("%d", a); 
}</pre>; at least on my computer, that code fails.<br /><br />However, here's code that works:<pre class='prettyprint lang-auto linenums:0'>#include &lt;stdio.h&gt; 

int main (){ 
	long a; 
	asm { 
		mov ax, 256 
		mov cl, 2 
		div cl 
		mov dword ptr &#91;a], eax 
	} 
	printf ("%d", a); 
}</pre>The major drawback to assembly language is that you oftentimes never know <em class='bbc'>what</em> is wrong. It could be a bad pointer, or perhaps it's a stack imbalance. Or maybe it's something similar to what happened today.<br /><br />Whatever the case, the lesson for me (or anyone who finds this useful) would be: when dividing using the DIV or IDIV instructions, don't just check for 0 in the divisor - check for 1 as well.]]></description>
		<pubDate>Tue, 26 Mar 2013 07:54:00 +0000</pubDate>
		<guid>http://forum.codecall.net/blog/1822/entry-1936-div-0-is-not-the-only-way-to-fail-apparently/</guid>
	</item>
</channel>
</rss>