This text is replaced by the Flash movie.

Archive for the ‘Coding/Programming’ Category

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 UIColor, 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 UIColor parameter.

UIColor

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

NSZombieEnabled Causes memory Leak.

April 10th, 2010

Xcode's InstrumentNoobie Mistake while trying to traced memory leak with the app I am working on using the instrument provided by xcode , I got series of pink spikes,

Xcode's Leaking Instrument

and I'm not sure what was causing it, I thought that the managedObject Context was the culprit. I noticed tons of _NSZombie_ prefix listed and I remember that I added the NSZombieEnabled tag under the Argument in "Executable App Info",

Xcode NSZombieEnabled

I added NSZombieEnabled environment variable because it can be helpful to track down the elusive object causing the problem, mostly tracing the EXC_BAD_ACCESS error message. So after I disabled it, the app I am working on had no leak after all.

Xcode's No Leak Instrument


Desktop Application Icon

March 4th, 2010

Visual Studio .Net 2008, On Solution Explorer. Right Click. Choose Properties. Select Application, Look for Resources/Icon and Manifest,

Project Settings Visual Studio.net

Browse for Icon you want for the release build.

Application With Custom Icon

Flash AS3 and Mootools Slimbox

February 26th, 2010
Most the site I made were based on mootools library but when it comes to Overlay Images Scripts I prefer to use Light box v2 that also you can easily call with in Flash AS3 using the ExternalInterface.call using a bridge which is available for download - flashlightboxinjector unfortunately this is base on jQuery library so I tried to find a "Lightbox" similar Overlay Image function that has available javascript that I can call within Flash AS3 code so Slimbox I guess the easiest for me to follow, it got API documentation you can follow http://code.google.com/p/slimbox/wiki/MooToolsAPI.
So this is the code inside the flash movie
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//Begin AS3 Script
  import flash.geom.*
  import flash.display.*
 
//Mouse Events  
  import  flash.events.MouseEvent;
//External Command
  import flash.external.*;
 
//gradient background color  
  var fillType:String = GradientType.LINEAR;
  var colors:Array = [0x330000, 0x333307];
  var alphas:Array = [1, 1];
  var ratios:Array = [0x00, 0xFF];
  var matr:Matrix = new Matrix();
  matr.createGradientBox(150, 20, 0, 0, 0);
  var spreadMethod:String = SpreadMethod.PAD;
  this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);  
  this.graphics.drawRect(0,0,250,200);
//gradient background color  
 
//Add handler Event
  img1.addEventListener(MouseEvent.CLICK, onClickHandler01);
 
 
 
function onClickHandler01(myEvent:MouseEvent){
    //call	Javascript Command
	ExternalInterface.call("Slimbox.open","/images/demon.png", "This Kanji means Demon");
 
}		
 
//End AS3 Script
ExternalInterface.call("Slimbox.open","/images/demon.png", "This Kanji means Demon");
This simply calls the javascript Slimbox.open function that will open an Overlay Image also make sure that parameters that "wmode" = "transparent" and "allowScriptAccess" = "always"
I used swfobject to render my Flash movies. So here how you implement the html code to make the flash work with slimbox.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
    <!-- Slimbox Start //-->
    <script type="text/javascript" src="js/swfobject.js"></script>
    <script type="text/javascript" src="js/mootools.js"></script>
    <script type="text/javascript" src="js/slimbox.js"></script>
    <link rel="stylesheet" href="css/slimbox.css" type="text/css" media="screen" />
    <!-- Slimbox End //-->
 
 
               <script type="text/javascript">
                             window.addEvent('domready', function(){ //for IE 7 problem
			var soSlim = new SWFObject("slimbox.swf", "slimbox", "250", "200", "8", "#FFFFFF");
			soSlim.addParam("quality", "high");
			soSlim.addParam("wmode", "transparent");
			soSlim.addParam("allowScriptAccess", "always");
			soSlim.write("flashcontentSlim");
                            });   
		</script>
Demo:
Flash required


You can also try milkbox

Download Source Code.