slitaz 3.0 review

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 31-03-2010

0

Hi,

thanks to a post on infosertec.com i get noticed this distro and i wanted to test it for a little to see how it works :) (the review after the break,sorry for the screens, i tested it in a virtual machine :D )

How to embedded in AS3 for flashdevelop/flex

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 30-03-2010

0

Hi,

today i wanted to share the final and absolute way to embedded fonts in as3 for flashdevelop or flex, why is something that is not real clear when you search in internet and like you usually don’t get warning and that stuff when something is wrong, is hard to diagnostic the problem.

this is an example class using a embebbed font:

package{

import flash.display.Sprite;

import flash.text.TextField;
import flash.text.TextFormat;

public class test extends Sprite{

[Embed(source = "C:/7theb.ttf", fontFamily = "7th Service",fontStyle="normal", fontWeight = "bold", mimeType = "application/x-font")]
private var theboldfont:Class;

public var txtFormat:TextFormat = new TextFormat();

public var textTest:TextField = new TextField();

public function test(){

txtFormat.font = new theboldfont().fontName;
txtFormat.color = 0xFFFFFF;

textTest.embedFonts = true;
textTest.defaultTextFormat = txtFormat;
textTest.text=”Testing font”;

}

}

}

now, let analyze the code:

1)the EMBED tag:

maybe this will be the most common source of the problems when you need to embebbed a font. in the example, the font have 5 parameters:

source: this is where the font file is located, as you see, even it’s windows. is needed to use / and not \ as is commonly use for this OS

fontFamily: this is basically the fontFamily that the font belongs, to know it just open the font and you will see it

fontStyle: this is as the word say, the style of the font, can be normal, italic etc..

fontWeight: this could be bold or normal

mimeType: for fonts is always: application/x-font

also there are other properties that can be defined:

fontName: this is the name of the font, if you open the font you will see it and you can define it (some times is necessary but other times broke the code and the font is now showing, like the example i put here)

usually the use of this tag is something of try and fail thing with each font, some fonts will work with all parameters, others you just need to ignore them or you put the wrong family name, weight or style.

then following with the code, we are setting the  textFormat.font instancing a new object from the class “theboldfont” that is the one that keeps the properties of the embebed font. in the same line we access to the fontName property that the class have to assign this value to the textFormat.font property.

them, line below, we set the property embebedFonts to true in the textField object and the defaultTextFormat to the textFormat previously defined. i tried to use the function setTextFormat for this also but didn’t work, maybe is why i’m using flash develop but i do not know why :)

and we are done ! you have embebbed your font and should be working :D

if not, check and play with the properties of the embed tag, adding/changing/erasing the attributes.

i hope it help you to save some hours of work :D

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Update web directory after commit in SVN

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 05-03-2010

0

Hi,

some new tips about subversion :D

if you need to update a web directory after someone make a commit just follow this guide: http://subversion.apache.org/faq.html#website-auto-update

i wanted to post this why it take me some time to figure out that a simple bash script don’t going to work and even if it worked with some tricks, i always getting a merge and not an update of the repository :P

some thing that the faq don’t mention is how to compile the program, if you are a newbie and don’t know how to do it, just run this command

gcc your_file_name.c -o your_binary_name

i hope it helps :D

Regards.

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Foreach objects in smarty

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 05-03-2010

0

Hi,

recently i changed how a REST API sent the info from xml to JSON, that mean that now the arrays was converted into objects after the json_decode(). don’t was too much problem till i see that my smarty templates don’t worked anymore :(

the change of each file don’t was an option and the convert from objects to arrays is wasting resources in nothing, so i made a hack in the smarty main class :D

basically in the file Smarty_Compiler.php at line numero 1203 i added this if():

if(is_object($from)){
$output .= “\$_from = $from;”;
$output .= “foreach(\$_from as $key_part=>$item){“;
}else{

and in the else, you wrap all the other code to parse arrays :D

now the foreach will parse objects and arrays :D

i hope it helps.

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]