Monday, 9 May 2011

Firebird sql; How to make the Firebird SQL server portable, supporting the network connections!!!


situation

Firebird SQL server project, supports to be portable, as your application will use the same DLLs as the Firebird SQL server does; by this way you may open FDB files from your application without install the Firebird Server. The main disadvantage is that you can’t open the same FDB file from other application and of course there is no network support to open the FDB as remote database from other terminal(s).
By the way, if you are interesting how you do this, search at the internet and at Firebird's official page. I’ll go further as I will show to you how to make the Firebird server portable as it is, with network support also!
problem

Firebird
How to make the Firebird SQL server portable, supporting the network connections!!!
difficulty level

9/10 :(
compatibility

fb 2.0, 2.1 & 2.5
solution

Sunday, 8 May 2011

Flex: how to make a image cache? (easier way) - REFdn4007673813


situation

how to make a image cache?
problem

adobe flex4 AS3.0 the image component
how to load images save them to cache…
and how apply them to Image components
---
> page by dn
difficulty level

9/10 :(
solution

In order to make a cashe of the photos/images, I do the follow simple way:
- With URLLoader I download the data… the "Complete" event gives me the "data" property… in this property the data of the image is in binary format (don't be afraid). I save this "data" to another variable (or array) of Object type. For this example, I named this variable "downloadData" you will see bellow.
- In order to load the data on a visual component Image, I do the follow code:
myImage.data=downloadData;
attention

no attentions!

How to Cache Images in Your Flex Application - REFdn5077575832

Caching images in your Flex application can greatly improve performance and reduce the overhead of loading external resources.
And I’m not simply talking about using the cacheAsBitmap property to improve rendering performance or the cachePolicy property to speed up animations. I’m talking about caching the actual bitmap data of an image.
To get started, you’ll need a hash map to store the image data. A Dictionary or an associative array will also work just fine.
Loading an image for the first time is the same as usual. You create a new Image object and add a listener for the COMPLETE event:
var image : Image = new Image ();
image.addEventListener (Event.COMPLETE, onImageComplete);

Once the image has finished loading, you add a copy of the bitmap data to the hash map using the image URL as the hash key:
private function onImageComplete (event : Event) : void
{
    var image : Image = event.target as Image;

    if (! imageCache.containsKey (image.source))
    {
        var bitmapData : BitmapData = new BitmapData
            (image.content.width, image.content.height, true);

        bitmapData.draw (image.content);

        imageCache.put (image.source, bitmapData);
    }
}

Now we can use the image as many times as we want without ever having to load it again!
To take advantage of this, you’ll need to check the hash map every time you create a new image (or change the source property) to see if you’ve already cached it:
var image : Image = new Image ();
image.addEventListener (Event.COMPLETE, onImageComplete);

if (imageCache.containsKey (imageURL))
{
    image.source = new Bitmap (imageCache.getValue (imageURL));
}
else
{
    image.source = imageURL;
}

And that’s it!
If you have an application that loads a large number of images you may want to limit the number of cached images to prevent the Flash player memory usage from getting out of hand, but in general caching even several dozen large images only results in a slightly increased footprint.

Friday, 29 April 2011

how to make a usb hdd disk bootable with windows system in it???


situation

Are you boring to burn dvds for setup? With usb flash disks the setup gets much faster!
problem

how to make a usb hdd disk bootable with windows system in it??? 
works witn windows7, windows server 2008 / r2
difficulty level

8/10
solution

We assume that you are using either Vista or Windows 7 to create a bootable USB.

1. Insert your USB (4GB+ preferable) stick to the system and backup all the data from the USB as we are going to format the USB to make it as bootable.

2. Open a CMD

3. When the Command Prompt opens, enter the following command:
DISKPART and hit enter.
LIST DISK and hit enter.
Once you enter the LIST DISK command, it will show the disk number of your USB drive.
4. In this step you need to enter all the below commands one by one and hit enter. As these commands are self explanatory, you can easily guess what these commands do.
SELECT DISK 1 (Replace DISK 1 with your disk number)
CLEAN
CREATE PARTITION PRIMARY
SELECT PARTITION 1
ACTIVE
FORMAT FS=NTFS (Format process may take few seconds)
ASSIGN
EXIT


Don’t close the command prompt as we need to execute one more command at the next step. Just minimize it.

5. Insert your Windows DVD in the optical drive and note down the drive letter of the optical drive and USB media. Here I use “D” as my optical (DVD) drive letter and “H” as my USB drive letter.

6. Go back to command prompt and execute the following commands:
D:CD BOOT and hit enter. Where “D” is your DVD drive letter.
CD BOOT and hit enter to see the below message.
BOOTSECT.EXE/NT60 H: (Where “H” is your USB drive letter)

7. Copy Windows DVD contents to USB by any way (i.e. total commander).

You are done with your bootable USB. You can now use this bootable USB as bootable DVD on any computer that comes with USB boot feature (most of the current motherboards support this feature).

Note that this bootable USB guide will not work if you are trying to make a bootable USB on XP computer.

Thursday, 28 April 2011

flex, air, How to write a file where the application is located


problem

adobe flex4 AS3.0, filestraem (air)
How to write a file where the application is located | the mystery "fileWriteResource" hidden error | how to write files in applicationDirectory (where is not allowed) [tested in windows only]
---
> page by dennis
solution

How to write a file where the application is located
in the follow example, the variable "filename" is String and has as value the the file name without path, i.e.: "sample.txt"
the follow code doesn't work, produces an error "fileWriteResource" that is not even thrown!
    var newFile:File=File.applicationDirectory.resolvePath(filename);
use the follow code:
    var newFile:File=File(File.getRootDirectories()[0]).resolvePath(File.applicationDirectory.nativePath+File.separator+filename);  //I am not kidding... it is working

Wednesday, 27 April 2011

VirtueMart Error: Failed to parse the XML Update File


problem

joomla and VirtueMart
error: Error: Failed to parse the XML Update File
solution

try1:
Go to administrator/cache folder and the you will file the .zip package file you tried to install. For some reason this file is not downloaded correctly, download it again and place it in this folder. The go to VirtualMark backend and "check for update". The process should go on.
try2:
Go to administrator/cache folder and clear the whole folder, leaving behind the index.html file. It will have the zip you tried to upload before and also some cached files. Just delete them all.