You are browsing through programming

Chinese language tips for web design

Friday, May 14th, 2010

Recently I needed to work with some Chinese and we had tons of trouble trying to figure out which fonts to use and how to specify them in CSS. After a lot of detective work and comparing long font lists we found some basic font choices that should work on both PC and Macs that have Chinese language packs active. I want to archive them here just in case I need to reference this ever again since it was PAINFUL…
Some Chinese Website tips:

  1. Specify English fonts first and then the Chinese fonts in your font list. This makes it so English fonts render with your desired fonts then the Chinese fonts pick up the other characters. font-family: futura, arial, Hei, “Microsoft YaHei”, “MS Yahei”, “宋体”, sans-serif;
  2. Standard chinese sans-serifs are: Hei, HeiTi or “Microsoft YaHei”
  3. Standard chinese serifs are: “Fang Song”, or “宋体”
  4. Set a meta tag to display chinese charset: utf-8. <META HTTP-EQUIV=”content-type” CONTENT=”text/html; charset=”utf-8″>

References:

Augmented Reality – Test 1

Thursday, April 1st, 2010

Yukiko's test of Augmented reality

I just got my augmented reality demo to work! It was really easy – Just one afternoon of work. To try it out you need: A webcam, a printout of this page. Click on this link and hold up your printout to your webcam in order to play with the demo.

I pretty much followed this video tutorial by The Flash Blog. It describes how to use the FLAR and Papervision 3d toolkits with Flex to detect a symbol in a video feed and map a 3D model to its plane. I just adapted his tutorial to Flash. (I’ll post my .FLA shortly)

Here were my overall steps:

  1. Download FLARToolkit
  2. Download Marker Generation tool (Air app)
  3. Made marker in Photoshop and printed it out
  4. Ran the Marker Generation app and saved a .pat pattern file
  5. Created FLARdemo.as class file, Flardemo.fla
    • in the .fla, declare Flardemo object, add to display
    • setupFLAR() – import .pat file
    • setupCamera()
    • setupBitmap() – load video feed into flartools
    • setupPV3D()
      • Create scene, camera, container
      • create lights, materials, objects
      • Create render engine, FLAR trans matrix, viewport
      • Add to display list
    • Create onEnterFrame event handler
      • Feed video to FLAR
      • test for symbol detection, if yes then,
        • get and set transform matrix
        • render papervision!
Some overall troubles and solutions included:
  • Since in Flash, not flex, I needed to declare, create, and add to display list a FLARdemo object in my .fla file. This wansn’t described in the Flash blog tutorial.
  • Also since I was working in Flash, library imports were a bit more complicated. I eventually gave up and cut/pasted from another tutorial that he was following. A less documented, but code provided tutorial is located here by a guy named Mikkoh.

Rotate Dynamic TextField in Actionscript 3

Thursday, March 27th, 2008

This is a tutorial on how to rotate textFields in Actionscript 3 (AS3)

1) First you must embed the Font. Go to the Library pallete. Right-click and select “New Font…”

2) In the new “Font Symbol Properties” dialog box, select the font you want to embed. I’m using Allstar for this example. Also type in a name to call the font within the Library. Click “OK” to close the box.


3) Back in the Library, you can see the font you just embedded, but you now need to change the linkage properties. Right click on the font symbol and select “Linkage…”

4) In the Linkage Properties dialog box, check the checkbox “Export for ActionScript”. Then enter the class name that you will reference in the ActionScript. Click Ok to close the dialog.

5) Now in the Actions pallete, enter in the following text to create the textField and display it on the stage.

How to tar files

Monday, November 26th, 2007

tar -cf ILoveHomework.tar Homework3

Comments:

* The c tells tar to create a new tar file
* The f tells tar to name it ILoveHomework.tar
* You have to supply the .tar extension in the command.

This command creates a new file in the parent directory named ILoveHomework.tar (of course, you may call it anything you wish). When this file is untarred, the Homework3 directory and its contents are automatically recreated.

Taken from somewhere…

Disk Quota Exceeded – solution!

Friday, November 23rd, 2007

So I couldn’t figure out why I kept going over the disk quota at the CS computers. I had about 300mb of storage and no matter what programs I removed, I couldn’t seem to stay under the quota. In fact, I removed everything and still I was taking up 297/300 mb. So what was taking up space? something called ./ccache . It’s a program to help speed up compilation of programs. This is good except the space limits were not set to be helpful. So here’s some important commands:

Disk Usage of all files:
$du -ah

Summary of disk usage
$du -sh

Ccache
set max size to 100mb
$ccache -M 100M

clear ccache
$ccache -C

clean up ccache
$ccache -c

Unix command to find kernel

Saturday, November 17th, 2007

To find the kernel version type into the command prompt:
uname -r

If having problems compiling previously working code, maybe the computer I’m working on is an x86 computer. (like pc 31) Best to switch computers to a regular format. (like pc 1, 10)

learned about rwho, who, write

Friday, November 16th, 2007

After SSH-ing into the campus computers, can look at other users on the system
ssh username@pc10.cs.ucdavis.edu
rwho
// lists all users on the csif machines

who pc 9
// lists all users on pc 9

who
// lists all users on current pc

write person
// must ssh to same computer as person, then writes stuff to their cmd prompt.

C++ Parsing, feeding a textfile to a program

Saturday, October 27th, 2007

To automatically fill in input to a program that promts using cin>>, use this from the command prompt:
$programName < commands.txt

Including files correctly
main file:
> #include “functions.h”

functions.h:
> #include
> using namespace std;
> function or class prototype non–void eg: int foo(string);

funtions.cpp:
> #include “functions.h”
> function definition eg: int foo(string mystring){ }

makefile
> g++ -c main.cpp functions.cpp;
> g++ -Wall main.o functions.o -o programname

Dynamic Painting, Folding

Wednesday, February 28th, 2007


I found this group of artists, Random International that created a paint roller so you can literally print on the wall. Check out the video:
Pixelroller

They also sell instant labeling tape that you just blacken out parts you don’t need to write messages. Not as cool as the pixel roller but it’s still afun idea.

Unrelated, but interesting on a technical level, this program folds a letter on screen depending on the position of your mouse.