Available languages

Useful links
Читать на русском

Thursday, December 30, 2010

Mass printing... How to print locked pdf file. Part 2: Windows.

I've already described a way to solve this problem for Linux users here.
In Windows it can be solved even easier.
Just follow the instructions:

    Download pdf2djvu.
    unpack the downloaded archive
    copy a pdf file with ban on printing to the program directory(pdf2djvu directory).
    open a terminal in the program directory and run the following command:
         pdf2djvu -o output.djvu locked_pdf_example.pdf

    output.djvu - output file in djvu format
    locked_pdf_example.pdf - input file (name of the pdf file with ban on printing)

Output.djvu has a lot of advantages: it is usually smaller and you can print it!
To view djvu files you will need WinDjVu.


Copy music from iPod to PC

I'll give iPod 0 points in this case because it's not easy to get your music back from your iPod.

It's not a secret that all the music files on iPod are in the hidden directory \iPod_Control\Music\.
To see hidden files in Windows XP:
1. On the Tools menu in Windows Explorer, click Folder Options.
2. Click the View tab.
3. Under Hidden files and folders, click Show hidden files and folders.
Note: To access Windows Explorer, click Start, point to All Programs, and then click Windows Explorer.
To see hidden files in Windows 7:
1. Open Folder Options by clicking the Start button Picture of the Start button, clicking Control Panel, clicking Appearance and Personalization, and then clicking Folder Options.
2. Click the View tab.
3. Under Advanced settings, click Show hidden files and folders, and then click OK.
Copy all files/folders from \iPod_Control\Music\ to a folder on your pc.
But our adventure does not end here: the files have wrong names.
Download Tag Scanner and rename the files using a mask. E.g.: %artist% - %title%
Program interface is intuitive.

But the mp3 files may not contain ID3-tags(optional information). In this case you should switch to the "Tag editor" in the program TagScanner and add the information you know yourself. I added authors and titles for only 16 songs(out of 367).

Alternatives:
  • Practice in programming and write a little script. For example, using id3lib.
  • Use iTunes.

OpenGL, C++ and GLUT using CodeBlocks and MinGW

Original can be found at LevelByLevel.com: OpenGL, C++ and GLUT using CodeBlocks and MinGW – Updated.

On my old blog, CodieCode, I wrote a tutorial on how to set up an OpenGL, C++ and GLUT environment using the CodeBlocks IDE and MinGW compiler on a Windows XP and Vista machine. This was a popular post which seemed to help quite a few people. However time moves on, software updates and operating systems change. I’ve decided to update this tutorial with Windows 7 (though this should still work fine on XP and Vista) and the latest version of CodeBlocks and MinGW. Hope it helps

I would like to add that if you’re serious about learning OpenGL, I think it’s a must that you own “The Red Book” (OpenGL Programming Guide by Dave Shreiner). You can buy it from Amazon (with the link on the left) or wherever you normally buy your coding books. Either way it’s a fantastic resource to have and it’s helped me countless times in the past.

———

If you’re interested in coding in OpenGL and C++, a great way to start is by using GLUT. GLUT takes care of a lot of the difficulties in setting up an OpenGL project and lets you get started on your project quick and easily. In this tutorial I will guide you through installing and setting up the software you’ll need (CodeBlocks, MinGW and GLUT).
Before you can start you’re going to need a few things:

Windows – I’ve updated the steps below to run on Windows 7, Windows XP and Vista, If you manage to get this working on other operating systems, let me know

OpenGL – I’m not going to go into how to install OpenGL in this tutorial as most people will be using Windows XP or later and OpenGL comes ready in these operating systems.

GLUT – To download the GLUT files you’ll need click here and download ‘glut.zip’.

IDE (Integrated Development Environment) – While it’s possible to use an editor (such as Notepad++) and makefiles. I find the easiest and most efficient way to code is using a good IDE (be careful there’s some not-so-good IDE’s out there). The best that I’ve come across is CodeBlocks (I’m not a fan of using Visual Studio for OpenGL but you can use that too if you wish) and it’s this IDE that we’ll be setting up today.

C++ Compiler – The compiler I’ll be using is MinGW, there are many advantages to using this but I wont go into these here.

So without further ado, lets start:

Sunday, December 26, 2010

Bash Tips for Working Faster With the Shell

"Using !! "This command is used to bring back and automatically execute the last command in history. It is the same as pressing C^P followed by Enter). Here’s an example:

debian$ cat /etc/debian_version
5.0.7
debian$ !!
cat /etc/debian_version
5.0.7

"Using !text

"Replacing ‘text’ with any command will call the last command in the history which starts with ‘text’. Example:"

Original story:
10 Bash Tips for Working Faster With the Shell (Part 1 of 2)
In addition:

Thursday, December 23, 2010

Really clear...


Do you love him?

It is a very old story that goes from 1994...
But many people come to understand only now...

http://charter97.org/en/news/2010/4/7/27925/

If you don't know these people... left to right: Hitler, Lukashenko.

Thursday, November 4, 2010

XPS Viewer Portable Version for Windows XP

A good advice from  blog.rubypdf.com

I tried to install Microsoft XML Paper Specification Essentials Pack(aka XPSEP or XPS Essentials Pack) many times on my PC, but failed, after searching, I got the answer. Then I thought how about just copy the necessary file on a fresh PC to run the XPSEP, after tested, it works. So I share it here for the friends who do not want to install XPSEP or failed to install XPSEP.
Download it now,
XPS Viewer EP-portable(2.19M)

XPS_Viewer_EP-portable(2.19M) - mirror

P.S.
If you just want to view XPS, you can use IE plug-in after install Windows XP SP3, but it is very slow, and once you set your Firefox as default browser, you have to try to browser xps document with IE to open it.
Oct 20, 2009
If you do not want to install .NET Framework 3.0, I recommend you A Free Win32 Native Code version XPS Viewer or try java-axp, java version XPS Viewer(free and open source)

Thursday, June 17, 2010

Linux hardware or Hardware supported by linux: ch. 1

Today computer is a necessary attribute of our life. Computers evolve fastly and we cannot keep it up-to-date. Hardware, software, new technologies and operating systems. One thing we want is to use our computer and its hardware fully and with all the advantages.
It's nice if you have money and can buy apple or microsoft porducts and if you really enjoy them - I don't worry about you. But there are other operation systems mainly based on the linux kernel: linux, unix and bsd families.
If you try to use them, you will see you have another problem: hardware support. Not everyone writes drivers for his nice devices for linux. Pity...
So, the best way to use all the advantages of your computer's hardware under linux is to buy computer with supported hardware. It's easy and clear for everyone, I suppose. But how can I check wich hardware will work and wich wont. Google has the fitst answer for you :)
Perhaps useful links:
Linux-drivers.org - Linux Hardware Compatibility Lists & Linux Drivers
Linux Online - Linux-Friendly Hardware
Linux Hardware Compatibility HOWTO
Hardware Devices that Support GNU/Linux — Free Software Foundation — free as in freedom
Is my hardware Linux-compatible? Find out here | Linux.com
Supported Hardware | Linux Journal

Hack the planet! ;)

Friday, April 16, 2010

Selection of the weapon or a comparison of different programming languages.

The purpose of this article: To shed some light and to summarize all the discussions about programming languages. It touches more sphere of sport programming. But I try to make the remarks more and more clear and right from time to time during my evolution and evolution of programming languages. Today is the 18th of April 2010.

Pro: very simple and strict language – easy for beginners – it’s easy to write and debug code.
Contra: no standard libraries (in comparison with C++ and Java ones).

Pro: STL (standard templates’ library) – many standard data types and algorithms. Great “freedom” – you can write the same things in many ways. Good performance of compiled sources. C++ is widely supported nowadays.
Contra: No BigInteger and BigDecimal (which are available in Java and C# libraries). Chance of different errors, which are caused by incomprehension between compiler and coder. You can find many discussions about them, but it’s not the problem of the language. But because of this great freedom it can be sometimes difficult to read the code or to debug it.

Pro: more strict syntax than in C++ – it’s easier to read the code – fast and easy debugging. Notifications about errors and unused code. Plenty of libraries. Garbage collector. New features in the latest version of java (eg.: variations of cycle for).
Contra: Slower performance of programs(3 or 4 times slower than C or C++), longer (uniformly long) source code, but coding (typing of code) is fast because of auto-completion.
Opinion of Petr: I think Java/C# (I don't see much difference between them except speed) are best suited for programming contests, since it's so much harder to make a mistake and so much easier to find and fix a mistake in a Java program than in a C/C++ program.
Much more strict type checking (implicit casts from long long to int and from int to bool??), out-of-range checking, code flow checking (allowing to read from uninitialized variables? why would a language allow that?), fantastic IDE which finds a lot of other mistakes for you, fantastically convenient debugging, more explicit syntax (a language with less power actually leads you to writing more readable programs), more explicit error messages (and the errors are always reproducible!) - to name a few advantages, but I've probably missed some more.
I think that writing correct programs and fixing them quickly when they're not correct far outweigh the disadvantages mentioned above (slower execution, longer programs). Even a 2x slowdown is almost never important in programming competitions, while a WA always is :) And I believe that most of the time at a programming contest is spent in thinking (including the thinking you do _while_ writing code), not in writing code, so the length of the program (or the typing speed, for that matter) is irrelevant.
And I believe the availability of various libraries is also not that important. So if I were to choose between C++ and Pascal, I'd choose Pascal because of the same argument (much more strict checking of everything).

Pro: Faster than Java. The latest version of C# default libraries includes classes and algorithms for long arithmetic as well as in Java, but in C# you can use them as basic types (in Python it’s also so): c=a+b, etc. Linq.
Contra: The latest version of .NET is still not available at most of programming competitions.

VB (object-oriented and event-driven, procedural, component-based)

Difference from C#: Programming language is Visual Basic and not C#.
Opinion of alliumnsk: VB.NET is just C# with syntax inherited from VB to ease porting of VB apps. So there is no reason to even think about VB.NET.

Opinion of _ph_:
Pro: Python – language of wide function. Man can write almost all types of programs in Python, except real-time programs. Python is unofficial language #3 in Google.
Python is well right for solving of easy-medium tasks thanks to short syntax and built-in means:
·         built-in long arithmetic (integer and decimal as well)
·         built-in list (aka vector<>), set, dict, tuple (aka struct)
·         regular expressions (re)
·         function sorted() for any sequences
·         nice string operations
·         nice constructers of lists
·         functions sum(), max(), min() wich can work with lists etc.
Contra: From point of programming competitions:
·         slow performance of programs (6x slower than С++) and especially slow input-output (you can’t read 10^6 of numbers in 1 sec without special tricks)
·         not enough good IDEs (I know only one good - PyDev for Eclipse)

PHP and other languages.
I don’t see any sense to use them at competitions. If I’m wrong – tell me.

Conclusion:
It is best to learn and practice as much languages as possible, to collect the knowledge, to know the nuances, but it’s not so easy and isn’t always possible. We are humans and we can’t change our nature, but we can try to make it better. Each language has its own pros and contras and you can choose one of them to solve different problems more efficient.
You must decide for yourself what you prefer: freedom and flexibility or simplicity of coding-reading-debugging-maintaining; what speed do you need and so on.
I hope this tutorial helped you to understand and systematize all these languages for yourself.

Additional and used information:
Links:

Lisp as an Alternative to Java: http://norvig.com/java-lisp.html

Choosing the weapon discussion: http://codeforces.ru/blog/entry/254
C# - why is it not mono? : http://codeforces.ru/blog/entry/229
A bit about C# and Linq: http://codeforces.ru/blog/entry/245
Definitions:

Pascal: http://en.wikipedia.org/wiki/Pascal_(programming_language)

C++: http://en.wikipedia.org/wiki/C%2B%2B

Java: http://en.wikipedia.org/wiki/Java_(programming_language)

C#: http://en.wikipedia.org/wiki/C_Sharp_(programming_language)

Visual Basic: http://en.wikipedia.org/wiki/Visual_Basic

Python: http://en.wikipedia.org/wiki/Python_(programming_language)

 

Tags: java, c++, vb, c#, pascal, python, the best language, programming languages.

 

Thanks to: MikeMirzayanov, Petr, alliumnsk, OSt, dAFTc0d3r, _ph_, Peteris, ktuan, SkidanovAlex, Nerevar, dev_il, valergrad and to everybody who has taken part in discussion.

Saturday, April 3, 2010

Top Coder schedule - Google Calendar

I deleted my calendar because I've found a better solution.
Darnley wrote a script wich parse Top Coder's schedule and export it into Google calendar. Now script works correctly. I hope it wont change. :)
Thanks, Darnley.
More...
I made a Google Calendar of schedule of Top Coder.
You can use it and even make better, if you want.

Useful links for programmers

Here I will collect useful, in my opinion, and interesting links for programmers: links to educational resources, competition sites, online contests, literature and advices on training, blogs of other programmers, archives and solves of problems.
More...

Friday, April 2, 2010

Mass printing... How to print locked pdf file.

Sometimes we have a problem: we have a pdf file with restricted printing. E.g.: we have made this file, have pushed the restrictions, but we've forgotten the password...
What can we do if we need to print it?
I use linux, now - almost the latest ubuntu (9.04). But the number of version is not the matter.
So. I have an option, how to solve our problem:
 

pdftoppm copy.pdf copy.ppm //each sheet of the pdf file will be saved in separate ppm file
convert *.ppm one.pdf //people guess that it works fine to unite many images in one pdf file, but I don't know exactly. If it works than it will use very much operative memory.  
for file in *.ppm; do ppmtojpeg $file > ${file/.ppm/.jpg}; rm $file; done //we want to convert all ppm files to jpg files
ls -d *.ppm | sed 's/\(.*\).ppm$/mv "&" "\1.jpg"/' | sh //we need to change the extensions of the files
convert *.jpg > one.pdf //you can also try it to unite your images in one pdf but I give no guarantees it works.
 
Really you can stop, when you have ppm files, if you can print them correctly/if you can store them, because they are much larger than such of jpg.
So you can print your locked pdf files.
I've done it on my laptop under Linux Mint 7 (Ubuntu 9.04).
Function convert comes in package ImageMagick.

Wednesday, March 24, 2010

Today. Bi- or more lingual blog.

Today I've decided to separate my blog in two parts: in English and in Russian.
I've decided to do it only after some challanges. I have no time to write a good blog or some additions for any blog-posting cms. And now my time is really limited because of many factors. So. I've made two blogs on blogger. And I've no problems more.
Here I'll write information about new and interesting products, tendentions and technologies, about old but always interesting algorithms... All about programming.
And also about my evolution and thoughts about all in this world.
If you think that quality of google translate is enough for you, than you can read my blog in many other languages.