Showing posts with label Computer Programming. Show all posts
Showing posts with label Computer Programming. Show all posts

Thursday, September 13, 2012

processing experiment 1

Don't Copy From This Blog...

Protected by Copyscape Plagiarism Detection
There's so much you can do with simple values. In this processing sketch, I'm only using a line and ellipse function to draw various shapes and abstract compositions on the canvas. Funny what random values can do.





Saturday, August 25, 2012

Terminal Mischief ;)

Don't Copy From This Blog...

Protected by Copyscape Plagiarism Detection
The Macintosh operating system is often thought to be extremely serious and po-faced, only dedicated to serving corporates and artists alike. But there is a fun, childish side to the Macintosh OS not many people know about, and even fewer know how to access it. Here's a guide to access those awesome features.

First open Terminal
[Applications>Utilities>Terminal] or use Spotlight





Now make your Mac speak anything out loud. Anything you want.
Simply type,
say [type text you want to hear your Mac speak aloud]

Unleash your Mac's artistic talents by producing ASCII art with a few keystrokes.
Type,
banner [text to be converted into ASCII art]


To save the ASCII art to a text file,

Navigate to Desktop.
cd Desktop
 Now type in the command,
banner [text] > [filename].txt 

Now open the file from Desktop.


To show it more clearly here, I converted the txt file to a pdf.



Awesome stuff isn't it? There are many more Terminal tricks. You can even access retro games  such as Pong, Tetris, and others using eMacs.

Thursday, August 9, 2012

Garfield Dashboard Widget [Macintosh]

Don't Copy From This Blog...

Protected by Copyscape Plagiarism Detection


A few years ago, someone made a Garfield widget which displayed every comic since its inception. However due to circumstances only know to the wildly imaginative, the widget isn't available on the internet anymore. I took the basic algorithm of that widget and made another so that the interweb can still enjoy Garfield.

Download Link

I think the sunday strip doesn't appear for some reason. Don't ask why. I can't figure it out either.

Thursday, April 5, 2012

Mac Virus

Don't Copy From This Blog...

Protected by Copyscape Plagiarism Detection
Ok, this isn’t exactly a real Mac virus. But it’s a good way too prank your friends(or foes!). With the help of AppleScript you can instruct the Mac to perform several tasks. Although Applescript is generally used for boring stuff like sending bulk mails or doing something productive, it can also be extremely fun if you have a devious plan in mind!

Open AppleScript Editor.


Open AppleScript Editor


This is where you write the code.

 
AppleScript Editor


Type in,


say “Warning! Virus Alert!” using “Vicki”




Voice command



Mac will now issue a ‘warning’ and say whatever you type in using the voice Vicki, who is [I think!] spanish. Hmm....


Now,

display dialog “Virus Alert! Mac has detected a virus.” buttons {“OK”} default button 1




Dialog Command

Mac will now display a dialog with the warning.


Prompt


now type,

tell application "Finder"
shut down
end tell

Shut Down command


Mac will now shutdown!

Click Compile, and then save it as an Application.
Don’t click Run! Or your Mac will shut down!


Save
Save as Application


Now change the logo of the application, or do whatever but get your nemesis to open the application and face your wrath!

Tuesday, April 3, 2012

processing sketch : transparent circles

Don't Copy From This Blog...

Protected by Copyscape Plagiarism Detection




I made this using processing. Ok, this isn't really processing per se, but it is processing.js. Both use the same coding just that processing.js is a lighter and more efficient way to display your processing sketches on a web page. In this simple sketch circles of varying opacity are drawn on the screen and the position of the circles are determined by the position of your mouse. The colour and the opacity are random. To clear the screen and to start again, press the key 'C'.

The code is given below. I have explained some lines of code so you understand what I have created.

void setup() //method to initialize the sketch. Only runs 1 time.
{
  size(600, 600); //determines size of sketch
  background(255); //background colour
  smooth(); //smoothens everything out
}
void draw() //method to draw on sketch. Runs every time till program is stopped.
{
  noStroke(); //circles don't have an outline
  float x = random(20, 60); // random size with limits from 20 to 60
  ellipse(mouseX, mouseY, x, x); // circles with position determined by mouse
  fill(random(200), random(200), random(255), random(100)); // random colour and opacity
  if (keyPressed) //detects if a key is pressed
  {
    if (key=='c'||key=='C') //now looks for key 'c'
    {
      background(255); //clears screen
    }
  }
}


Monday, April 2, 2012

Processing

Don't Copy From This Blog...

Protected by Copyscape Plagiarism Detection
Have you ever fantasized about being a computer programmer and create stuff simply by typing a few commands? Yet, like me, you hate the complexity and the learning curve of the Java, C++ and the rest? Fear not, for processing is here!



Processing is Java based compiler which requires basic Java coding know-how to create insanely cool graphics within minutes of downloading the compiler. It's extremely simple to learn processing, and with a few months of solid practice you can create anything you want with a few lines of code. Sounds too good to be true right? However, apart from a few minor problems with some geeky stuff which won't bother you anyway, it is fantastic. You can do 3D modeling on it as well!

So download processing and code away!


Here are a few examples,




Tree using recursion


 
//PART 2