Saturday, February 28, 2009

Print Screen Project [PSP]

If there is something I do often, I use the print screen key. The process of getting an image using the print screen key takes way too much time. Think of all the steps involved:

1) press PrtSc
2) open Microsoft Paint
3) press Ctrl+V to paste the screen image

Wouldn't the whole world be a lot happier if we could just press a key and the screen image would automatically be saved in a JPEG file? I'm not the only one searching to tackle similar problems. I'm trying to find the function for PrintScreen on the net, and then I'll just use stream input and output to create a jpeg file containing the image somehow. I don't know how. To be continued...

Friday, February 27, 2009

How Long Did I Take to Learn C++?

I wrote my first post on this blog May 25, 2008, and today is Februrary 27, 2009. I've been learning C++ for about 9 months, but I've been learning about programming in general for a long while more. I started Java before I went into C++. I stopped learning Java for two reasons:

1) I couldn't find out how to make Java programs "executables". Not being able to send my friends my java programs didn't make java programming very rewarding. With a C++, I could compile my sourecode directly into an executable file I could send to friends.

2) I couldn't understand constructors. I couldn't understand constructors easily in C++ either, but after watching tutorials on youtube by antiRTFM, I was enlightened about constructors and desctructors and a lot of other things.

I feel like I really understand C++ and I could take on Java with ease if I wanted to. The only concept I'm still having trouble with is polymorphism in programming. Oh well, I'll figure it out.

Skype Auto Caller [with time delay]

I was experiencing some horrible internet connection last night while I was talking to my girlfriend on Skype. I was going offline about every half an hour or so, and I didn't want to have to use my mouse or keyboard to call my girlfriend back; I wanted there be a way for skype to just automatically call that specific friend every time the call turned off. I thought of different ways I could solve the problem. I was thinking that I could find functions for audio output and make a function to turn audio output into a boolean value that would be false when there was no output and true when there was. Before I went on, I decided to make sure someone hadn't already created a solution to my problem. I didn't find an auto caller, but I did find some useful information that would make things a lot simpler.





I was googling around and found out that you can create a short cut to call a specific skype user. All I needed now was to figure out how to get this short cut to open all on its own. I thought I could have an executable run that would open the file, and I remebered a line of code for opening files with C++ from a yahoo question. Now all I needed was to block the file opening line in a never ending loop. I did that but I knew that would create a program that opened the short cut continuously (which doesnt seem like such a bad idea now that I think of it). So, I went looking for the sourcode for a time delay that would cause the open file in to execute only after every certain amount of time. Finally, I ended up with this:

// include insertion symbols
#include stdio.h
#include stdlib.h
#include time.h

void sleep( clock_t wait );
int main( void )
{
long i = 6000000L;
clock_t start, finish;
double duration;

while (true)
{
// Delay for a specified time.
printf( "Delay for 2 minutes\n" );
sleep( (clock_t)120 * CLOCKS_PER_SEC );
printf( "Calling!\n" );
system("C:/calluser.url");

/*the line just above this comment opens the shortcut you have to make. Right click desktop, click new, click short cut, and type in

skype:username?chat

and then press OK or whatever. In the case of my sourcecode, the shortcut's name is calluser with the url extension, but you can name the shortcut whatever you want. My shortcut's location is C:/. Remember to replace "username" with a username on your skype contact list or a number.*/

}
system ("PAUSE"); // unncessary and not reccomended
}


// Pauses for a specified number of milliseconds.

void sleep( clock_t wait )
{
clock_t goal;
goal = wait + clock();
while
( goal > clock() ) ;
}

/*********************************************************

There's potential for more features. I could change some literals into variables that can be changed by the user so I don't have to change the source code and compile every time I want to change the length of the delay. I could also just eliminate the time delay all together so it would execute continuously, but now that I think of this method again, I remember that you get an error message when you try to call someone when you're offline and if I had it do that I'd get a 1000 of those error messages every time I went offline with the auto caller program running, so that's no good. The delay stays! I could add some code that creates the url for you and asks you for the username or number using some stream methods.

**********************************************************/

Wednesday, February 25, 2009

I'm Flying On Python


I got a book on Python at the Orlando Orange County main library: "Learning Python" by Mark Lutz and David Ascber. I didn't know that Python was an interpreted language i.e. a language that is compiled into byte code to be converted to machine code only during every execution through Python's bytecode translator. I would like to learn how to program in CPP without an environment (IDE): just a plain text editor and a the compiler for me. The book says that about half a million to a million people are programming in Python. I wonder how many people program in C++. What are the odds?

Thursday, February 19, 2009

So Many Subscriptions

I'm subscribed too way too many e-mail providers, forums, and social networking sites.

Cplusplus
Gavedev
Allegro

Future of Hello Worlds

I think in a future post I'll compile the hello world source code in many different languages: C, C#, C++, Python...

I haven't been blogging here often. I'm still debating over whether to blog here or Xanga. I love Google products, but I'm a premium member of Xanga and I enjoy the benefits.