Please note that ExpatTech no longer operates regular office hours, meeting is by appointment only. Please call +36306031104 for details.

ExpatTech Techblog

Dylan Cooper 2011.08.18. 15:20

Custom Desktop Configurations

We have a new service here at ExpatTech. Having made good contacts with several wholesalers of computer parts here in Budapest, we are now designing and building custom desktop configurations for clients.

We can get any type of component required, and can build anything from the simplest computer configuration for basic office use through to high end gaming machines with high capacity video cards and bullet-proof power supplies.

Regarding costs, prices for the confiugartions we build range from 55,000 to 555,000 forints - you can also specify a budget, and we will put together a computer to suit!

Call us on (+36-1) 215 1143 for further details or a quote for your dream computer!

Peter Todd 2011.04.27. 08:53

SVG Graphics and generating them

SVG (Scalable Vector Graphics) is an XML-based format. It is quite nice and useful, especially if we want to use them specifically. Therefore here we have a nice little example, how to create SVG graphics.

Peter Todd 2011.04.14. 11:26

Trick for creating a list of your files

Have you ever wanted to have a list of your files? If you have to do a quick list of your files and / or folders, get the location of the files or folders. In Windows this can be done by right clicking on the parent folder, going to Properties, then checking Location. Copy and paste this text into your browser and see the list. Copy the list and paste it to your favourite text editor, word processor, or cellular data editing software (Excel, Google Spreadsheets etc).

Peter Todd 2011.01.17. 12:06

Flash Cookbook - Tricks - Conditional chains

 


Peter Todd 2011.01.17. 11:52

Flash Cookbook - Tricks - Shortening code

 

This trick is about shortening actionscript code.

Peter Todd 2010.11.03. 12:09

Flash Cookbook - Tricks - Reach property of subclass from baseclass, crosslinking

If you extend a base class and still want to reach properties of the subclass, use the hasOwnProperty method.

BASE CLASS:

if(this.hasOwnProperty(PROPERTY_NAME_STRING)) this[PROPERTY_NAME_STRING] do something;

This wouldn't work:

BASE CLASS:

this.FUNCTION_OF_SUBCLASS();

This is useful, if you have different subclasses of the same baseclass, but want to assign unique variables or functions to each subclass.

Note: it's better to make the specific property public.

Tags:
Peter Todd 2010.11.02. 11:37

Flash Cookbook - Tricks - GetDefinitionByName

Sometimes it's really handy to use the flash.utils.getDefinitionByName function. This gives you a dynamic instance creation especially if you use an object model description for your application. Let's say you created an xml with items, each describes an object with a classname. Then you can generate the objects with a loop, using the getDefinitionByName function.

var classbyname:Class = getDefinitionByName(classname) as Class;
var object:* = new classbyname();

This can be done with the code below too:

if(classname == SOME_CLASS_NAME) var object:* = new SOME_CLASS_NAME();

This case you don't need the getDefinitionByName() function, but you loose the chance to create your code fully dynamic. You always have to come back to this part of the code and add a new case if you create a new class. Using getDefinitionByName() doesn't need this, but of course it's not without any further todos.

Peter Todd 2010.10.28. 14:25

Flash Cookbook - CSS - CSS parser, parsing CSS StyleSheet and Style

Even though Flash has a built-in css parser, still it's not the best one. After running some tests it came out, it does not really support a lot of things. For example you can't use hyphen in declarations, nor you can use spaces in selectors.

These things are needed for our work, therefore the only way left is to write our own parser. In this post we write the basics - think it through, take it further and you will get a nice and handy class for your own.

Plus, the StyleSheet.parseCSS() method does not support styles not surrounded by curly brackets. This is what you can use in the attributes of an xml-tag: style="font-size: 15px". This wouldn't be understood by the built-in parser.

Peter Todd 2010.10.24. 20:43

Blog Weekend - Mind experiment with a javascript prime checker and distributed computing

The most basic way of checking if a number is a prime number is to divide the number with all the numbers starting from 2 to the square-root. If there is no remainder, the number is a prime.

function checkIfPrime(n)
{
     for(var i = 2; i <= Math.sqrt(n); i++) if(n % i == 0) return false;
 
     return true;
}
 
where % is the modulo. a % b gives the remainder of 'a div b', where div is the integer division. 6 % 5 gives 1.
 
Javascript's number is a double precision floating-point format, which has an approximately 16 decimal digit integer precision (1).
 
After some tests, we can state, that in javascript 15 digit integers can be used without a problem. Therefore we take this limit to play with, our first attempt will be to calculate all the prime numbers up to 15 digits.
Peter Todd 2010.10.22. 12:43

Browser bookmark containing javascript

We can do a nice little tweak with the bookmarks. Bookmarks are usually used as bookmarks: they point to a web address. Browsers nowadays support add-ons or extensions and there is a huge palette of these nice little utilities helping us browsing faster and spend our time on the territory of world wide web. But for some people these add-ons (or extensions) are suspicious or some people cannot find the one they need for a task. A webprogrammer writes his/her own in this case, but what if the task we want to do is far easier then sitting down and struggling with an add-on (or extension).

Peter Todd 2010.10.13. 13:45

Google Chrome Extensions - The first steps

 

In this tutorial we will go through the first steps of creating a simple Google Chrome Extension.

This extension will have a button in the browser and a popup with some content.

We need to create 3 files:

1. icon.png - I created a simple icon image, 32x32 in an image editor
2. manifest.json - description of the extension
3. index.html - content of the popup

Peter Todd 2010.10.08. 10:31

Flash Cookbook - Tricks - Super size bitmap, bitmapdata, infinite size

Today I ran into a problem. As we all know, Flash has a size limit on bitmapdata size.

Basically there are two rules to follow (see the specs):

Both the width and height has to be maximum 8,191 pixels

and

the amount pixels of the bitmapdata cannot exceed 16,777,215.

Well, well, well...

Nagy Richárd 2010.10.05. 14:31

Creating an RSS 2.0 Feed with PHP

As RSS 2.0 is a well-established standard nowadays and a lot of people actually use it, it is quite useful sometimes to create an RSS feed for a blog or a news section. When creating the new ExpatTech TechBlog I really wanted to implement this feature, so I digged into the topic a bit.

The first important thing to know that an RSS is actually an XML document, so you have to comply with the XML standards, and also RSS has a well-defined standard structure that you want to follow. One nice tool is W3C's Feed Validation Service to check your feed.

Of course I wanted to generate the RSS using PHP, because the whole site uses this technology. On websites the recommended charset is UTF-8, so for the examples I will use that.

Peter Todd 2010.10.01. 10:49

Flash Cookbook - Tricks - Store data in bytearray and compress it

You can create a nice little drawing application using the flash graphics tools. Let's say you created an application, where you press the mousebutton, start to draw and draw lines by holding the button down. Every point your mouse reached is stored in an array at an ENTER_FRAME event.

This way I did a hand-drawn rectangle, consisting 36 points. If you want to save this drawing point by point, you save this array in the SharedObjects or send it to a server-side script to save it somewhere on the server.

Peter Todd 2010.10.01. 09:01

Flash Cookbook - Colors - Part 2. Invert Displayobject's Colors

To invert the colors of a displayobject you can use the transform.colorTransform property of the displayobject and apply a ColorTransform to it.

Peter Todd 2010.09.30. 14:15

Flash Cookbook - Appendix - Practical XML - Something to know

Today I used the flash in-built xml capability for designing an xml:

var xml:XML = <data><obj>0</obj><obj>1</obj></data>;
trace(xml["obj"][1]); //outputs 1

when I arrived to a point, where I commented an item out:

var xml:XML = <data><obj>0</obj>/*<obj>1</obj>*/</data>;
trace(xml["obj"][1]); //outputs 1

Hm, I thought, what happened here (okay, for five minutes I didn't know what to do), I thought the flash miracoulusly cached my xml and loaded it from somewhere but not the IDE. Then came the hit: even though you think you've commented the part out, it didn't delete it from the xml. Of course if you want to comment this out, you need the standard notation.

var xml:XML = <data><obj>0</obj><!--<obj>1</obj>--></data>;
trace(xml["obj"][1]); //outputs undefined

But then what happens if you use the IDE's comment notations?

var xml:XML = <data><obj>0</obj>/*<obj>1</obj>*/</data>;
trace(xml);

Surprisingly outputs:

<data>
  <obj>0</obj>
  /*
  <obj>1</obj>
  */
</data>

and

var xml:XML = <data><obj>0</obj><!--<obj>1</obj>--></data>;
trace(xml);

outputs:

<data>
  <obj>0</obj>
</data>

Yes, xml takes whatever /**/ as a piece of the content. It doesn't matter, that you are working with flash in a flash IDE, it won't be a comment in your code if you use the XML type and its advantages (though we don't know the advantages of this initialization). Use the rules of XML in an XML type.

Peter Todd 2010.09.28. 12:15

Flash Cookbook - Colors - Part 1. Grayscale Displayobjects

To set a displayobject grayscale we use a ColorMatrixFilter. To initialize the ColorMatrixFilter we need an array with specific elements in it...

Read more, amigo mio!

Peter Todd 2010.09.27. 16:57

Flash Cookbook - Colors - Colors, R, G, B, and alpha, hex and dec, RGB, ARGB

In flash the color value is normally a uint.

Peter Todd 2010.09.27. 14:22

Flash Cookbook - Appendix - Sort array indices

Yes. This is about array sorting. So there is the problem, that we want to sort an array, but want to know more about the indices. For this reason there is an option for Array.sort() function, which specifies the return value of sort():

Array.RETURNINDEXEDARRAY.

See the code below:

var array:Array = ["a", "c", "b"];
var sort:Array = array.sort(Array.RETURNINDEXEDARRAY);
trace(array, sort);

//a,c,b 0,2,1

It didn't sort the array, but returned an array with the sorted indices.

Peter Todd 2010.09.24. 10:10

Fun with Random - Part 2.

In the second part we create a static class for our random function, add a practical function and check whether it is really random.