This text is replaced by the Flash movie.

Archive for the ‘Coding/Programming’ Category

NSConcreteMutableData

July 9th, 2010
For some reason I experienced another odd memory leak and I'm not sure what causing it, when I try to access one of my view controllers.

NSConcreteMutableData

The thing was... I mistakenly selected "Simulator 3.0" which the bug exists.

Simulator 3.0

Apple already fixed this issue with 3.1.
Under "Known Issues and Fixes/Core Data"
"The memory leak of an NSConcreteMutableData instance when processing object changes has been fixed."

Premiere CS4 Export Video Problem

June 12th, 2010

Premiere CS4 Flash Catalyst CS5 After Editing a video using Premiere CS4 , and try exporting the sequence I have - Adobe Media encoder pops out, and for some reason I couldn't find the sequence I was just trying to export. After few hours figuring out why - I noticed that the version on Media Encoder popping out is CS5. This Encoder came with Flash Catalyst cause I'm trying their Demo Version - which is very promising for Designers to be able to communicate and explain well to the Developers on how they want the site should function.

So what I did was just uninstall the Flash Catalyst since I was done of studying it anyway. And Everything worked fine, when I tried to export the Sequence I have on Premiere CS4 its popping out Media Encoder CS4 and finally I can see the sequence on the list.

Remove number of words…

May 1st, 2010
Remove number of words at the beginning of string?

Looking for a function that you want to make string only return the last words within the strings? and remove number of words at the beginning Using C#


Windows Form Remove words

This function could help you:
        /// <summary>
        /// Return only last several words  and remove the number of words at the beginning from string.
        /// </summary>
        public static string RemoveFirstWords(string input, int numberWords)
        {
            try
            {
                string[] Split = input.Split(new Char[] { ' ' });
                input = string.Empty; //After passing the words to Split - Empty in again
                for (int i = numberWords; i < Split.Count(); i++)
                {
                    input += Convert.ToString(Split[i]) + " "; //Get Only the last words
                }
                return input;
            }
            catch (Exception)
            {
                // Log the error.
            }
            return string.Empty;
        }
Use the function like this:
private void removeWords_Click(object sender, EventArgs e)
        {
            if (stringToRemove.Text == string.Empty)
            {
                MessageBox.Show("The String is Empty");
            }
            else
            {
                int paramNumOfWords = Convert.ToInt16(numOfwords.Text);
                string returnOnlyLastWords = RemoveFirstWords(stringToRemove.Text.ToString(), paramNumOfWords);
 
                //Return Words
                MessageBox.Show("Return Words: " + returnOnlyLastWords);
            }
        }

Download Source code MVS version 9 C#

Cannot Create MSSQL Database.

May 1st, 2010

File Path is compressed Cannot Create MSSQL Database.

While trying to add Database which I want to name "SimpleCMS" to MSSQL server and trying to put it under App_Data folder, I encountered this error.


Error Details:
An exception occured while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)

The file "you mssql db path here" is compressed but does not reside in a read-only database or filegroup. The file must be decompressed. CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
...

Cannot Create Database


Most cases this was cause that the Project folder is inside a compressed drive or under a compressed folder, which will save space for your drive.

I just want to share how I resolved this.

Note: That You can uncompressed only the Project folder and leave other compressed.

I'm using windows XP so what I did was 
1.) Right Click on the folder (Project Folder) in General Tab > Click Advanced
2.) Under Compress or Encrypt attributes
3.) uncheck "Compress Contents to save disk space"

Compression

From here I can now add the database "SimpleCMS" under the App_Folder inside the Project Folder.

Database Added

UIColor Color Codes

April 18th, 2010

DigitalColor Meter Icon I Just realize how hard it was to just assign RGB Values color by code using , Well heres a little work around. Using the utilities in mac, which will you can find at Applications/Utilities folder. Open it.



DigitalColor Meter

Make sure you selected "RGB As Percentage", Use your mouse to move the cursor over the pixel you want to sample, and read off the values, once you got the color you want; press Command-Shift-H, This will hold the color values you got for the moment. Press F4 for Dashboard use calculator,

Dashboard Calculator

Divide the values you got to 100, for example R%: 78.8 = .788; Then you can finally put the RGB values on your parameter.

UIColor

#define COLOR_FOR_THIS [UIColor colorWithRed:0.788f green:0.207f blue:0.271f alpha:1.0f]