|
|
||||||||||
- How to Delete Flash Cookies ... or How to find the Local StorageFlash cookies are little pieces of information that Flash applications can store on a userīs hard drive. They are not part of the browserīs temporary internet files and so they wonīt be deleted when you delete all you internet settings. If you google for "delete flash cookies" most of the answers you will boil down to
Some people simply feel awkward about that ... seemingly having no control about these cookies. Actually, the problem isnīt that big. You can actually find the cookies on your hard-drive. You could e.g. try to do a file search for *.sol-files. In Windows systems they are located in your userīs "AppData" directory. There is a little trick, though. You wonīt find the cookies in the Adobe folder as one would expect. Instead, look for a Macromedia folder. Wikipedia has good article about how to find the sol-files, so I am not going to repeat the info given there. One small advice for Windows users: You may have to enable "Show Hidden Files and Folders" (XP) / (Windows7). With this knowledge, you can easily create a small script that you can put on your desktop to delete all flash cookies whenever you want. Kommentieren / Add comment... (0) - Safari 5, Flash And The Backspace Key ... Or How Apple Bans Flash from Safari
We have been frantically working on our Flash - based MMO for quite some time now at Rough Sea. We are pretty much getting close to the finish line. Well, the game has a login login form that is completely embedded within the Flash app. No big deal, huh? The Problem Today, I got a pretty interesting bug report from quality assurance: If you open our game in the Windows - version of Apple`s brand-new shining Safari 5 and try to type something in a text-input field (like the login form) and then hit the backspace key (because you may have mistyped something), the browser suddenly goes back in the page history to whatever page you were before. I tried this with other Flash applications on the net: Same thing! Solutions? I tried to solve the problem by capturing the backspace key event using Javascript. Works great until the Flash app gets the focus. Bummer ! The event onBeforeUnload isn`t an option either because it`d be painfully annoying for the user to get a confirmation popup each time he/she made a typo. Over at "MacOS X hints" there is an artical about how to change the keyboard shortcuts in Safari. Itīs a bit brute force but it should solve the problem. The Cause The root of the problem is that the browser carries out keyboard shortcuts regardless of the flash app having the focus or not. As soon as the flash app gets the focus the programmer completely looses control over the browser`s key event behavior. Thoughts To sum it up: Apple made it virtually impossible to work with any Flash - based web app that features text input or even *gasp* uses the backspace for some other user interaction. While this is clearly a bug, it kind of makes you wonder if Apple is deliberately trying to sabotage Flash, since this problem does not occur with Java applets or HTML - Forms. Well, this would certainly fit into Apple`s rampage against Adobe in the past weeks. BTW same thing happens with Silverlight according to a post in the Apple support forum. IMHO, considering the market share of Safari, it wouldn`t make much sense, though. They would force most of the Safari users to migrate to another browser if they want to use Flash, possibly reducing the small number of users even more. [UPDATE 2010-06-28:] Apparently, according to an anonymous source (a comment on the bottom of this page ;-) ) this problem does not exist in the Mac version of Safari. And we at Rough Sea Games may just scratch out Safari 5 from our list of supported browsers. It doesn`t hurt too much, since we hardly get any visitors using Safari anyway. - ActionScript3 - Array Clear Performance Test (AS3)
In your life as programmer you stumble upon one issue again and again: releasing/clearing an array. Normally, you would think deleting the contents is faster than creating a new array. With Flash this is not always the case. Basically, there are four ways (I can think of) to clear an array:
Since it is not possible to simply identify the fastest way I made a small test application. It will create a specified number of arrays with a specified length and then clear the arrays using each of the four techniques. The arrays will be int-arrays. They are faster to create and to delete. Object arrays are just generally slower but display the same characteristics. Try it out yourself. Change the parameters in the text fields below and hit "Start Tests". Please take into consideration that huge numbers take forever to complete.
Here is the code of the loops from the test app: ////////////////////////////////////////////////////////////////// // using length for (var i:int = 0; i < m_array.length; i++) m_array[i].length = 0; ////////////////////////////////////////////////////////////////// // using splice for (var i:int = 0; i < m_array.length; i++) m_array[i].splice(0, m_array[i].length); ////////////////////////////////////////////////////////////////// // using new for (var i:int = 0; i < m_array.length; i++) m_array[i] = new Array() ////////////////////////////////////////////////////////////////// // using brackets for (var i:int = 0; i < m_array.length; i++) m_array[i] = []; When I did some systematic tests I found out that there is not the one ideal method. Depending on the test parameters one or the other may be faster. All tests are done on my AMD notebook using Firefox 3 and FlashPlayer 10. The code was build for FlashPlayer 9, though. I did each test five times and calculated the average, which are the values you will find below. (Iīs interesting to note that the tests turn out slightly different on Intel machines.) Well, letīs see. We will only look at two extremes for test parameters since my tests show a fairly linear scaling between the two. Test 1: Few Huge ArraysIf you are running the tests with a relatively small number of arrays (10 to 100) and huge array lengths (10000 to 100.000) you will see that "new" and "[]" is the fastest. On my laptop they both take less than one millisecond to complete, while "splice" takes very long and "length" is only fairly fast. __________________________________________ Parameters: number = 100, length = 100.000 length = 0 : 58 ms splice(0, length) : 717 ms new : 0 ms [] : 0 ms Test 2: Many Small ArraysBy switching the test parameters around the outcome is different. Here clearly setting the length is the fastest way while "splice" is the slowest again. "new" and "[]" are slower than setting length. Oddly, while "new" and "[]" do basically the same (creating a new array), using "[]" is almost twice as fast as "new". (This only seems to be the case on AMDs. On my Intel Dual Core both methods display equal performance.) __________________________________________ Parameters: number = 100.000, length = 100 length = 0 : 74 ms splice(0, length) : 911 ms new : 366 ms [] : 195 ms Conclusionslength = 0 splice (0, array.length) new and [] - Flash-AS3 ByteArray Beats Array Class On Handling Large DataFor a map generator, I recently had to figure out a way to fit about 10 million values (representing the map data) into memory and work with them efficiently. Flash isnīt exactly cut out for this task but I had very good reasons to go through the pain and implement it in AS3 anyway. There are several approaches to solve this problem. To investigate further into this I created a small testing suite. This is how it works: The test suite contains one test class (cDataHandlingTest) that writes to and reads from an abstract data class (iData) . Each data class offers an unified interface but is implemented in different ways. The test class repeats each test several times, records initialization times and accessing times and then calculates the average for each data class. If you want to have a closer look on the code, you can download my FlashDevelop-project here. Three-Dimensional Array (cDataArray3D)This data class uses a three-dimensional array to store the data. Initialization takes a very long time because you need to cycle through several nested loops allocating the data. Access times are ok. Linear Array (cDataArray1D)Here I used a linear array for the data. Initialization for a linear area is lightning fast. The draw-back is the access, though. Calculating the offset of the data in the array is pretty complex: var index:int = (((_y * m_width ) + _x) * m_entries) + _entryType; This makes working with a linear array really slow if you cannot predict in what order you will access the data. If you will usually access the data in the exact order it is stored in the array, you would actually be really fast. Unfortunately, this is usually not the case. The linear array is about 10 times slower than the three-dimensional one on random access. ByteArray Int-Based Access (cDataArrayByte)In this example I used a ByteArray. The position is calculated in the exact same way as in the linear array example. Data is extracted by using a readInt() command on the stream, data is written by using the writeInt() command. I expected this approach to be really slow. Well it isnīt! On my computer it already outperforms the three-dimensional array in all areas. I tried this test on many different computers and they did not show consistent behavior. On some the byte array was faster and on some it was not. It seems to me that computers with AMD processors were faster with ByteArray while computers powered by Intel were faster with the three-dimensional array. ByteArray Byte-Based Access (cDataArrayByteOpt)If you only need values between 0 and 255 you can use the array operator [ ] of the ByteArray class. This is the fastest way to access the data. Initialization times are really good and access is on my computer about 25% faster than the three-dimensional array. Test ApplicationThis is the test. Click into the window to start. Be careful, it needs a lot of resources. If you have significantly less then 2GHz per core or only one core I recommend not to try it because it will lock up your computer for too long to be convenient.
- Overheating Acer AMD Turion 64x2 TL-58 Notebook problemMy notebook, an Acer Travelmate 5520G, has a bit of a heat problem. Playing Half-Life 2 or Team Fortress 2 for an hour or two forces it to simply shut down. I have been trying to solve that problem for quite a while now. I downloaded a program called SpeedFan, which helped me monitor the CPU temperature. Well, as it turned out the computer shuts down when it reaches excess temperatures of 95° Celsius (200° Fahrenheit). Admittedly, this is way too much. The very same program also reads out the current CPU speed, which should be 1.9GHz. At least that is what the manufacturer tried to make me believe by printing it on a sticker on the casing. Surprisingly, SpeedFan showed a CPU speed of more than 2.2GHz right after playing Half-Life 2! I started to investigate into this and found out that Windows Vista obviously automatically changes the CPU speed according to the load it has to deal with. Games need a lot of power, so Vista is trying to grant it more resources: too many in my case. No worries, though! It is possible to customize Vistaīs behavior dealing in this matter. In Control Panel -> Power Options I was able to alter the current power plan. I located the option "Processor Power Management" and set the maximum processor state to 90%. Now, my notebook actually runs on about 1.9GHz and temperatures stay between 50° and 75° Celsius (120° to 170° Fahrenheit). Apparently, Vista was trying to overclock my system. A lot of people seem to have similar problems and there are a lot of tips and tricks on the web. Anyway, I havenīt found anyone else going down the road I took, yet. So, I thought Iīd share my experiences in that matter. Maybe itīll help someone out there as well.
Update 2010-06-11: - Strange table behavior in Chromium / Google ChromMy javascript table canvas did not work with the browsers Chromium and Google Chrome: The reason is that these browsers do not tolerate empty table cells. Putting empty img-tags into the cells makes them appear again, though! This reminds me on the old Netscape browsers (say 4.7), which had a similar problem.
- Getting Started With AsUnit 3.0 and FlashDevelop3 in AS3 (Unit Tests)This is a guide to get AsUnit to work with FlashDevelop. I assume that you have a working installation of FlashDevelop up and running. If not you may use this guide http://www.theyak.net/flashdevelop/ to get there. For this guide I used FlashDevelop 3.0.0 Beta7 and AsUnit 3.0 2007-10-11 version (release 162). 1. Download AsUnitGo to http://www.asunit.org and download the ?Framework?. It will contain all the classes and sources you will need to get your unit-testing framework going. 2. Setting up a projectStart FlashDevelop and select ?New Project ?? in the ?Project? Menu. Create a new AS3 project, specify a directory to create the project in and name your project. I called it MapMeister, don't ask why. ;) In the project?s directory create a folder for the sources (e.g. ?src?) and one for the binaries (e.g. ?bin?). The two directories should appear in the ?Project Manager?-Control. If you cannot see the the control, you can switch it on by activating the ?Project Manager? checkbox from the ?View? menu. Now, right-click on the source folder (?src?) and choose ?Add? and select ?New Class?? from the pop up. Enter ?Main.as? in the input field and hit Ok. The class stub of the main class will be added to the sources. Starting now will cause a build failure with a FlashDevelop: ?This project does not have a main class? error.To fix this right-click on the ?Main.as? (the as-file that contains the Main class) in the ?Project Manager? and turn ?Always Compile? on. The main class needs to extend flash.display.Sprite, so it should look like this:
Afterwards, open the ?Properties? tab from the ?Project? menu. Open the output tab and enter the name of the binary to be created including the binary folder, e.g. ?bin\AsUnitTest.swf?.
Image 1 - Setting output file in FlashDevelop 3 3. Adding AsUnit to your projectI assume you have already downloaded the AsUnit-framework archive. Extract it into a convenient directory. Afterwards, add the framework?s AS3 sources to the classpath of your project. To do so open the ?Properties? window again from the ?Projects? menu. Select the ?Classpaths? tab and hit the ?Add Classpath ?? button. Add the ?as3? directory of the framework.
Image 2 - Setting classpath in FlashDevelop 3 for AsUnit Well, I personally recommend to create a new directory for the test cases. Right-click on the project in the ?Project Explorer? and select ?Add?? and then ?New Folder ??. Call it e.g. ?testsrc?.
Image 3 - FlashDevelop's Project Manager shows the project structure Now, it?s time to write the first class, test suite. Right-click on the test-source folder and add a new class called ?AllTests.as?. This class needs to extend asunit.framework.TestSuite, so it should like that:
This class will later contain references to all our tests. This class needs to be passed to the AsUnit framework within the Main-class? constructor like this (Please be aware that in this listing we are passing the stage object to the TestRunner class. This is not part of the original implementation. This is a workaround for a runtime error that occurs with AsUnit and FlashDevelop [check problems section at the end of this tutorial].):
If you start the project now, you will see the gray AsUnit screen. This means you are ready to go! 4. Writing a testAdd another class to the test-source folder. e.g. ?TestFirstTry.as?. This class needs to extend asunit.framework.TestCase. Well, for every class you want to test, create a test class here. Add methods to the test class with each method covering a certain aspect of the functionality. Your first test may look like that:
For the test to be executed, you need to add a reference to the AllTests-class like this:
Now you may run the project. If everything is ok, you should see an AsUnit error message stating that one test failed.
Image 4 - AsUnit Failure message Change the "8" in the TestFloatMath test into a "9" and the failure disappears. You?re ready to go. Get them, tiger! 5. Problems5.1 TypeError: Error #1009: Cannot access a property or method of a null object reference. (TestRunner.as:51)
The reason for this problem is that the TestRunner is not added to the stage. If you do not want to add the TestRunner to the stage,
here is what you can do to solve the problem:
(3) Replace all occurences of "stage" within the file TestRunner.as with "m_parent", which should give you something like this (only the altered methods are shown):
This should fix that problem. :) But it's easier to just add the TestRunner to the stage in Main.as. (Thanks to John for pointing that out.) Kommentare / Comments:
Kommentieren / Comment: - Javascript Pixel CanvasEine kleine Javascript-Spielerei: ein Canvas aus einer dynmamisch erzeugten Tabelle. Die Pixel werden durch Tabellenzellen repr?sentiert, deren Farbe durch ?ndern der Hintergrundfarbe gesetzt wird. Die Animationen stellen Szenen aus Amigaspielen nach. Die Aufl?sung des Canvas ist deshalb so niedrig gew?hlt, damit die Animationen auch problemlos auf Rechnern um 1 GHz laufen. A little javascript gimmick: a canvas made of a dynamically created table. Each pixel is made of one table-cell, which color is set by changing its background color. The animations show scenes from some Amiga games. The resolution of the canvas is fairly small so the script is able to run on computers with around 1 GHz without problems. [[ reset Amiga ]] Weitere Infos gibt es hier / More infos at: - {GERMAN} 3D-Visualisierung auf Mobiltelefonen mit J2MEWährend meiner Diplomarbeit habe ich mich mit 3D-Grafik auf Mobiletelefonen beschäftigt. Im Rahmen dieser Arbeit habe ich ein Klassenpaket entwickelt, welches flexibel für diese Zwecke einsetzbar ist. Meine Arbeit vermittelt nicht nur die Funktionsweise des Klassenpaketes, sondern auch die Grundlagen der 3D-Grafik (Visualisierungs- und Transformations-Pipeline, Kamera, u.s.w.) und die Realisierung von mathematischen Basisfunktionen (z.B. trigonometrische Funktionen Cosinus und Sinus).
>> Link zur Klassendokumentation der mr3d-Engine(javadoc) - {GERMAN} Voice Over IP (VoIP)Diese Seiten entstanden als Teil einer Studienarbeit für das Fach "Kommunikation und Rechnernetze". Es behandelt die Grundlagen der Telefonie mit dem Internet Protokoll (IP). - {GERMAN} Parallele SchnittstelleDieses Lehrmaterial enstand im Rahmen einer Belegarbeit im Fach "Erweiterte Kapitel der Systemprogrammierung". Es behandelt die Grundlagen der Datenübertragung zwischen zwei Rechnern, deren Centronics-Schnittstellen per Crosslink-Kabel verbunden wurden.
|
||||||||||