Yodobashi Kamera

Posted: February 15th, 2009 | Author: Remi | Filed under: Japan | 1 Comment »

Hello everyone, sorry that there haven’t been any posts lately.  I have to just say what everybody says, I was busy. Well, I have a quick one with another youtube video!  I just love this song.  Apparently it is a song from a classic Japanese commercial for the Yodobashi Kamera, (Yodobashi Camera) store.  Somebody I knew was telling about the song, and I was able to dig it up on youtube, so here it is. Enjoy.

YouTube Preview Image

My Top 5 Most Awesome Free Apps for OS X!

Posted: January 4th, 2009 | Author: Remi | Filed under: OS X | 2 Comments »

As you might have guessed I quite love macintoshes, and thus I feel compelled to tell the world about some of my favorite free software for OS X!

# 5  Cyberduck

A truly great ftp client, with excellent features like bonjour, growl, and quick look support.  As far as I’m concerned, this is the only FTP client you will ever need for OS X.  It has mostly all the good features of programs like transmit.  With great reliability and nice interface, it is a download you can’t miss.  The only complaint I have is that webDAV support isn’t great.  Visit Site

#4 The Unarchiver

This is an amazing program that brings support to OS X for extracting an amazing amount of archives, even archives made on machines from other countries.  The icing on the cake is that it has almost no presence and blends with the OS X gui perfectly, practically replacing the default unarchiving program in OS X.  This program is a must download and is definitely worthy of the “the” at the beginning of its name.  Forget Stuffit, this is the only unarchiving program you’ll need. Visit Site

VLC#3 VLC

A must for any operating system.  VLC can play virtually any video or  music file right out of the box! (or disk image rather).  But the amazing video bliss doesn’t stop there, it can even re-encode the video and save it back to disk.  It can even capture video from your camera or your screen.  This is an amazing application that follows the mac ideals of “just working.” Visit Site

#2 Adium

This instant messenger is a great choice for any multi-protocol user on OS X.  It supports an amazing amount of protocols including MSN, AIM, Google Talk, Bonjour, and the new Facebook chat protocol.  If that wasn’t enough, it has growl support, custom themes, scripting support, and tons of plugins and extras.  The only downside is that it does not have video or audio support, but it is supposedly going to take advantage of leopard’s new video features for the 2.0 release. Visit Site

#1 Smultron

I use this application all the time.  It is close to an equivalent to textmate, but with not quite the same features.  In my opinion, smultron gives a better range of features and has a great reliability, and impressive usability.  I use this for writing HTML, Javascript, PHP, and any other scripting languages.  It can open any file as plain text, which is something you may take for granite if you are new to OS X.  This gets my number one spot basically because of the essentialness of this program to my OS X experience, and because it never fails to surprise me with helpful features. Visit Site


Allegro game programming library: how to install on Ubuntu, OS X and Windows

Posted: December 7th, 2008 | Author: Remi | Filed under: Programming | 7 Comments »

When it comes to simple 2D game programming Allegro is great. It may be a little tricky to get allegro to install on some systems, but I will cover how to do it on three: Ubuntu, OS X and Windows.

We’ll be starting with the easiest, Ubuntu
Open up the terminal (Applications > Accessories > Terminal) and type if you have not already
sudo apt-get install build-essential
Then we’ll install Allegro:
sudo apt-get install liballegro4.2-dev
Thats it, allegro is installed and gcc is ready to compile allegro source.
To compile and run file by name inputfile.c in gcc type:
gcc inputfile.c -o output `allegro-config --libs`
./output

On OS X it is a little tricker, and I highly recommend installing X-Code to compile the code with, there is a way to install gcc without X-Code, but I don’t recommend it, and I won’t cover it here.
download X-Code here (You have to become an ADC member to download, it’s free). You can also install X-Code (developer tools) from your OS X installation disk.

download the allegro source for Unix on their website here
its a tar.gz so, double click it and it should be expanded into a folder.
Now open the terminal (/Applications/Utilities/Terminal) and type “cd ” then drag the allegro folder to the window and hit enter, now type the following:

chmod +x fix.sh
./fix.sh macosx
make
sudo make install
sudo make install-man
sudo make install-framework
sudo make install-framework EMBED=1
sudo make install-template

If you are using X-Code 3.0 or higher then type the following to make the template work:

mv /Library/Application\ Support/Apple/Developer\ Tools/Project\ Templates/Application/Allegro\ Application /Developer/Library/Xcode/Project\ Templates/Application

There, you’re done, now all you need to do is open X-Code and then click File > New Project then under application choose allegro application.

For windows, you can install Allegro to work with Visual C++ or other Microsoft IDE’s if you use them for development, but if you don’t have any of those don’t fret, just download and install Bloodshed’s Dev-Cpp here
Then to install allegro, download the allegro devpak here and then just double click it.
Once it installs you should be set, now just open Dev-Cpp and make a new allegro project.

Here is some code you can try and compile, it’s a version of pong I wrote for allegro, it’s still buggy so beware!

/*
 *  Pong
 *
 *  Created by Remi Bernotavicius on 12/4/08.
 *  Copyright (c) 2008 __MyCompanyName__. All rights reserved.
 */
 
#include <allegro.h>
#include <math.h>
 
#define paddle_width 10
#define paddle_height 50
#define screen_width 640
#define screen_height 400
#define ball_speed 70
#define ball_size 6
#define paddle_speed 15
#define dashed_frequency 20.00
 
#define UP 0
#define CENTER 1
#define DOWN 2
 
//left side
int yl = ((screen_height / 2) - (paddle_height/2))*paddle_speed;
int points_l = 0;
int direction_l = CENTER;
 
//right side
int yr = ((screen_height / 2) - (paddle_height/2))*paddle_speed;
int points_r = 0;
int direction_r = CENTER;
 
//ball
int bx = (screen_width / 2)*ball_speed;
int by = (screen_height / 2)*ball_speed;
int angle = 30;
int i_speed = 5;
 
int rest_counter = 0;
 
void gatherInput()
{
  if(key[KEY_DOWN] && yr < (screen_height - paddle_height)*paddle_speed)
  {
    yr++;
    direction_r = DOWN;
  }
  else if(key[KEY_UP] && yr > 0)
  {
    yr--;
    direction_r = UP;
  }
  else
  {
    direction_r = CENTER;
  }
 
  if(key[KEY_Z] && yl < (screen_height - paddle_height)*paddle_speed)
  {
    yl++;
    direction_l = DOWN;
  }
  else if(key[KEY_A] && yl > 0)
  {
    yl--;
    direction_l = UP;
  }
  else
  {
    direction_l = CENTER;
  }
}
 
 
int main(int argc, const char *argv[])
{
  allegro_init();
  install_keyboard();
 
  if (set_gfx_mode(GFX_AUTODETECT, screen_width, screen_height, 0, 0)) {
    allegro_message("Error setting 320x200x8 gfx mode:\n%s\n", allegro_error);
    return -1;
  }
 
  //Title Screen
  textprintf_centre_ex(screen, font, screen_width/2, 100, makecol(255, 255, 255), -1, 
    "Pong!");
  textprintf_centre_ex(screen, font, screen_width/2, 120, makecol(255, 255, 255), -1, 
    "By Remi Bernotavicius");
  textprintf_centre_ex(screen, font, screen_width/2, 140, makecol(255, 255, 255), -1, 
    "Press Space Bar to Start");
 
 
  while(!key[KEY_SPACE])
  {
    if(key[KEY_ESC])
      return 0;
  }
 
  BITMAP* buffer = create_bitmap(screen_width, screen_height);
 
  while(!key[KEY_ESC])
  {
    gatherInput();
    clear_to_color(buffer, 0);
 
    //score
    textprintf_centre_ex(buffer, font, screen_width/4, 10, makecol(255, 255, 255), -1, "%d",
      points_l);
    textprintf_centre_ex(buffer, font, screen_width*(3.00/4.00), 10, makecol(255, 255, 255), -1,
      "%d", points_r);
 
    //dashed line
    float f;
    for(f = 1.00;f < dashed_frequency;f +=2.00)
      line(buffer, screen_width/2, -10 + screen_height - (screen_height*(f/dashed_frequency)) +
        (screen_height*(1.00/dashed_frequency)), screen_width/2, -10 + screen_height -
        (screen_height*(f/dashed_frequency)), makecol(255, 255, 255));
 
    //left paddle
    rectfill(buffer, 10, yl/paddle_speed, 10+paddle_width, (yl/paddle_speed)+paddle_height,
      makecol(255, 255, 255));
    //right paddle
    rectfill(buffer, screen_width - 10 - paddle_width, yr/paddle_speed, screen_width - 10,
      (yr/paddle_speed)+paddle_height, makecol(255, 255, 255));
 
    while(angle > 360)
      angle -= 360;
    while(angle < -360)
      angle += 360;
 
 
    if(rest_counter == 0)
    {
    bx+=cos(angle*M_PI/180)*i_speed;
    by+=sin(angle*M_PI/180)*i_speed;
    }
    else
    {
      rest_counter--;
    }
 
    circlefill(buffer, bx/ball_speed, by/ball_speed, ball_size, 
      makecol(250, 250, 250));
 
    //collision detection
    if((by/ball_speed) > screen_height - ball_size)
    {
      angle *= -1;
      by = (screen_height - ball_size)*ball_speed;
    }
    else if((by/ball_speed) < ball_size)
    {
      angle *= -1;
      by = ball_size * ball_speed;
    }
 
    if((bx/ball_speed) > (screen_width - 10 - paddle_width - ball_size))
    {
      if((by / ball_speed) > ((yr/paddle_speed) - ball_size) && (by / ball_speed) <
        (((yr/paddle_speed) + paddle_height) + ball_size))
      {
        //If the ball hit the right paddle
 
        angle *= -1;
        angle += 180;
        if(direction_r == UP)
        {
          angle += 30*sin(angle*M_PI/180);
          i_speed -= 2*sin(angle*M_PI/180);
        }
        else if(direction_r == DOWN)
        {
          angle -= 30*sin(angle*M_PI/180);
          i_speed += 2*sin(angle*M_PI/180);
        }
        bx = (screen_width - 10 - paddle_width - ball_size)*ball_speed;
      }
      else
      {
        //If the ball went off the screen on the right
 
        points_l++;
        bx = (screen_width/2)*ball_speed;
        by = (screen_height/2)*ball_speed;
        angle = 30;
        i_speed = 5;
        rest_counter = 3000;
      }
    }
    else if((bx/ball_speed) < 10 + paddle_width + ball_size)
    {
      if((by / ball_speed) > ((yl/paddle_speed) - ball_size) && (by / ball_speed) <
        (((yl/paddle_speed) + paddle_height) + ball_size))
      {
        //If the ball hit the left paddle
 
        angle *= -1;
        angle += 180;
 
        if(direction_l == UP)
        {
          angle -= 30*sin(angle*M_PI/180);
          i_speed -= 2*sin(angle*M_PI/180);
        }
        else if(direction_l == DOWN)
        {
          angle += 30*sin(angle*M_PI/180);
          i_speed += 2*sin(angle*M_PI/180);
        }
 
        bx = (10 + paddle_width + ball_size)*ball_speed;
      }
      else
      {
        //If the ball went off the screen on the left
 
        points_r++;
        bx = (screen_width/2)*ball_speed;
        by = (screen_height/2)*ball_speed;
        angle = 150;
        i_speed = 5;
        rest_counter = 3000;
      }
    }
 
    blit(buffer, screen, 0, 0, 0, 0, screen_width, screen_height);
 
  }
 
 
  return 0;
}
END_OF_MAIN();

Download


Pink Lady and Sugar Babe

Posted: December 5th, 2008 | Author: Remi | Filed under: Japan | 2 Comments »

Just recently I got Tsuji Ayano’s newest album “Cover Girl 2.” With this album, as with “Cover Girl” (its predecessor), Tsuji re-does hit Japanese songs bringing her own spin to each of them. On this album she re-does a song called “Nagisa no Sinbad” which is a song by a 1970′s group called “Pink Lady.” The song is great, and the video is really fun. The song sold over a million copies, and stayed at number one for eight weeks. Tsuji did another song from the 70′s, it’s called DOWNTOWN done by a group called “Sugar Babe.” Another great song. I really was missing out on some great music from the 1970′s in Japan. So catchy. Enjoy!

note: Tuji Ayano’s first name is Ayano, in Japanese the first name comes last.

Nagisa no Sinbad by Pink Lady
YouTube Preview Image

DOWNTOWN by Sugar Babe
YouTube Preview Image


Tsuji Ayano – Sweet Happy Birthday

Posted: November 19th, 2008 | Author: Remi | Filed under: Japan | No Comments »

A video from the best album ever!

YouTube Preview Image

Kotoringo

Posted: November 17th, 2008 | Author: Remi | Filed under: Japan | No Comments »

One of my new favorite Japanese music artists is Kotoringo. I found out about her by the iTunes Japan free single of the week.

Not sure is this is the real video for her song, but its a good song anyway! enjoy!

YouTube Preview Image

Comparing Different Languages: A Simple Program

Posted: November 16th, 2008 | Author: Remi | Filed under: Programming | 1 Comment »

At my school’s computer club we are doing a comparison of different programming languages.
We took a simple program written in BASIC and examined how it works. Then I translated it to both C and Javascript.

Here is the program in BASIC which is a procedural language, unlike non-scripting languages it is non-compiling, this means that it is translated to code the machine can understand one line at a time when the program is actually run. Because of this, it is incredibly slow when compared to modern languages like C.

DIM r, q, p, m
INPUT "What interest do you expect? ", r
INPUT "How much % do you withdraw per year? ", q
p = 1! 'Principle
m = 0! 'number of months so far
DO WHILE (p &gt; 0!)
    FOR i = 1 TO 12
        p = p + ((r / 1200) * p) - ((q / 1200) * 1)
        IF (p &lt; 0) THEN             PRINT "your number of years = "; m / 12             i = 12         END IF         m = m + 1     NEXT i     IF m &gt; 1200 THEN
        PRINT "you won't live that long!!!"
        p = -1!
    END IF
LOOP

Here it is in C, another procedural language.
To compile on Unix or Linux based computers, type in a terminal

gcc path/to/sourcefile.c -o output_program
then to run it
./output_program

#include 
 
int main()
{
float r, q, p, m;
printf("\nWhat interest do you expect? ");
scanf("%f",&amp;r);
printf("\nHow much %% do you withdraw per year? ");
scanf("%f",&amp;q);
p = 1.00; //Principle
m = 0.00; //Number of months so far
int i;
while(p &gt; 0.00)
{
for(i = 0;i &lt;= 12;i++)
{
p += ((r / 1200) * p) - (q / 1200);
if(p &lt; 0) { printf("\nyour number of years = %f\n", m/12); i = 12; } m += 1; } if(m &gt; 1200)
{
printf("\nyou won't live that long");
p = -1.00;
}
}
return 1;
}

And here it is in Javascript, an object-oriented scripting language. Although basically since this program is so simple, and there was no need to use objects except document, it looks almost identical to the program in C. Test Out The Javascript Here

 
<script type="text/javascript"><!--mce:0--></script>
 
<form id="theForm">
What interest do you expect?
<input id="r" type="text" />
 
How Much % do you withdraw per year?
<input id="q" type="text" />
<input type="submit" value="Calculate" />
</form>
<div id="result"></div>

After looking at the code for all three, it seems that they are for the most part very similar. The syntax from BASIC to C is quite different, but they both use loops and if statements. One difference that can be seen particularly in this program is the lack of variable types in BASIC. You can see in C that we have to declare the variables as float so that they will hold a decimal. Another difference is that there is no shortcut it seems in BASIC for variable = variable + number; as there is in C. As you can see in C it goes like variable += number; . Also it is worth nothing that comments in BASIC use a single quote mark ( ‘ ) to denote comments, while almost all more modern languages use the double forward slash ( // ). And of course, BASIC doesn’t use braces at all. Instead it has a sort of tag way of enclosing statements. These are just some of the differences. A lot of languages used nowadays follow after C, the javascript is the case in point. It is always worth looking at older languages to really see if the way languages today do things is really better or not.

Try it out for yourself and see the differences

Download Source for All Three


Hello World!

Posted: November 14th, 2008 | Author: Remi | Filed under: Site News | No Comments »

Welcome to my blog!  I started this blog mainly to write about programming topics, but I’m sure I will be able to write about some other things as well.  I like to program in many languages but mostly Objective-C and Cocoa.  I’ll hopefully be posting some helpful stuff to some programmers.