Sunday, 30 November 2014

Circular Queue of Integers in Java, using Eclipse IDE and Java JDK 8






In computer science, a queue (/ˈkjuː/ kew) is a particular kind of abstract data type or collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position, known as enqueue, and removal of entities from the front terminal position, known as dequeue. This makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed. Often a peek or front operation is also entered, returning the value of the front element without dequeuing it. A queue is an example of a linear data structure, or more abstractly a sequential collection. Queues provide services in computer science, transport, and operations research where various entities such as data, objects, persons, or events are stored and held to be processed later. In these contexts, the queue performs the function of a buffer. Queues are common in computer programs, where they are implemented as data structures coupled with access routines, as an abstract data structure or in object-oriented languages as classes. Common implementations are circular buffers and linked lists. More information can be achieved by clicking this link.
Queue Class
package queue;

public class Queue {
int[] Q;
int front;
int rear;
int size;
int values;

public Queue() {
size = 5;
Q = new int[size];
rear = front = values = 0;
}
public void enQueue(int e) {
if(!isFull()) {
Q[rear] = e;
values++;
rear=(rear+1)%size;
}
}
public int deQueue() {
front=(front+1)%size;
values--;
return Q[front-1];
}
public boolean isEmpty() {
return (values==0);
}
public boolean isFull() {
return (values==size);
}
public int peek() {
return Q[front];
}
public void display() {
int i = values;
int j = front;
System.out.println("Values currently in the Queue:");
while(i>0) {
i--;
System.out.println(Q[j]);
j=(j+1)%size;
}
}
}
Main class
package queue;

public class Main {

public static void main(String[] args) {
Queue q = new Queue();
q.enQueue(1);
q.enQueue(1);
q.enQueue(1);
q.enQueue(1);
q.deQueue();
q.deQueue();
q.deQueue();
q.enQueue(2);
q.enQueue(3);
q.enQueue(4);
q.enQueue(5);
q.display();
}

}
There's no big difference between the code in Java/C++ it's just the syntax you get used to ;). C++ version of integer Queue.
Click the download zip button to download the complete package exported by Eclipse IDE.

Unknown Web Developer

Morbi aliquam fringilla nisl. Pellentesque eleifend condimentum tellus, vel vulputate tortor malesuada sit amet. Aliquam vel vestibulum metus. Aenean ut mi aucto.

Circular Queue of Integers implemented in C++ [Turbo C++ version.]


Turbo C++

Circular Queue


In computer science, a queue (/ˈkjuː/ kew) is a particular kind of abstract data type or collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position, known as enqueue, and removal of entities from the front terminal position, known as dequeue. This makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed. Often a peek or front operation is also entered, returning the value of the front element without dequeuing it. A queue is an example of a linear data structure, or more abstractly a sequential collection. Queues provide services in computer science, transport, and operations research where various entities such as data, objects, persons, or events are stored and held to be processed later. In these contexts, the queue performs the function of a buffer. Queues are common in computer programs, where they are implemented as data structures coupled with access routines, as an abstract data structure or in object-oriented languages as classes. Common implementations are circular buffers and linked lists. More information can be achieved by clicking this link.
Code implementation.

#include "iostream.h"
#include "conio.h"
const int size = 5;
class Queue
{
int Q[size];
int front;
int rear;
int values;
public:
Queue()
{
front = rear = values = 0;
}
void Enqueue(int n)
{
if (!isFull())
{
Q[rear] = n;
rear = (rear + 1) % size;
values++;
}
}
int Dequeue()
{
if (!isEmpty())
{
front=(front+1)%size;
values--;
return Q[front-1];
}
}
int isFull()
{
if (values == size)
return 1;
return 0;
}
int isEmpty()
{
if (values == 0)
return 1;
return 0;
}
int peek()
{
if (!isEmpty())
return Q[front];
}
void display()
{
cout << "Total values inside the Queue:\n";
int i = values;
int j = front;
while (i)
{
cout << Q[j] << " ";
j = (j + 1) % size;
i--;
}
}
void display(int n)
{
if (n<5 || n>-1)
cout << Q[n] << " ";
}
};

void main()
{
clrscr();
Queue q;
q.Enqueue(1);
q.Enqueue(1);
q.Enqueue(1);
q.Enqueue(1);
q.Dequeue();
q.Dequeue();
q.Dequeue();
q.Enqueue(2);
q.Enqueue(3);
q.Enqueue(4);
q.Enqueue(5);
q.display();
getch();
}
Unknown Web Developer

Morbi aliquam fringilla nisl. Pellentesque eleifend condimentum tellus, vel vulputate tortor malesuada sit amet. Aliquam vel vestibulum metus. Aenean ut mi aucto.

Stack of Objects implemented in C++ [Turbo C++ version.]




Turbo C++



Graphical Representation of stack.
















Code implementation.
#include "iostream.h"
#include "conio.h"
#include "stdio.h"
const int size = 5;
class Book
{
int id;
char name[50];
public:
void getData()
{
cout << "Enter book ID: ";
cin >> id;
cout << "Enter name of the book: ";
gets(name);
}
void showData()
{
cout << "Book ID: " << id << endl;
cout << "Name of the book: "; puts(name); cout << endl;
}
};
class Stack
{
Book b_stack[size];
int top;
public:
Stack()
{
top=0;
}
void push(Book b)
{
if(!isFull())
b_stack[top++]=b;
}
Book pop()
{
if(!isEmpty())
return b_stack[--top];
}
int isFull()
{
if(top==size)
return 1;
return 0;
}
int isEmpty()
{
if(top==0)
return 1;
return 0;
}
Book peek()
{
if(!isEmpty())
return b_stack[top-1];
}
void display();
};
void Stack::display()
{
for (int i = top-1; i > -1; i--)
b_stack[i].showData();
}
void main()
{
clrscr();
Book b;
Stack s;
cout << "Enter data for Books: " << endl;
while(!s.isFull())
{
b.getData();
s.push(b);
}
b=s.peek();
cout << "Peek at the moment:\n";
b.showData();
b=s.pop();
cout << "Popped book:\n";
b.showData();
getch();
cout << "Press any key to continue.\n";
b=s.peek();
cout << "Peek after popping the top most book:\n";
b.showData();
cout << "The books in the stack at the moment are:\n";
s.display();
getch();
}
Unknown Web Developer

Morbi aliquam fringilla nisl. Pellentesque eleifend condimentum tellus, vel vulputate tortor malesuada sit amet. Aliquam vel vestibulum metus. Aenean ut mi aucto.

Friday, 28 November 2014

Text Expander like in iOS for Windows


Text Expander for Windows

No more typing common phrases again!
  • Organize frequently used text snippets.
  • Expand abbreviations in any program.
  • Automate repetitive tasks.
  • Auto-complete phrases.
  • Quick access to the Windows Clipboard History.
  • Correct spelling mistakes in any application.
  • Available for Windows and Android!
  • Free for personal use (learn more)

Text Snippets Manager

PhraseExpress® organizes your frequently used text snippets in customizable categories for quick access.
PhraseExpress saves hours of typing in technical support, customer care, help desk, call center and medical transcription.
The Client-/Server version allows you to share text templates in a network. PhraseExpress also supports Microsoft and Firebird SQL and is Citrix/TerminalServer compatible.

Autotext

PhraseExpress saves keystrokes by expanding text abbreviations into full text snippets. E.g. typing 'sig' could insert your signature into any program.
For example, you could set a keyboard shortcut so whenever you type "DCT" it automatically expands to "Dear Customer, Thank you for contacting us."
PhraseExpress provides this known MS Office Autotext feature in any Windows program, e.g. Internet Explorer, Excel, Database Front Ends, etc.
The Text Expander for Windows is helpful for people who are continually typing the same things over and over, reducing the time spent typing and minimizing spelling mistakes.

Auto-Complete

PhraseExpress automatically recognizes repetitive text input and offers to auto-completefull sentences on demand.

Spelling Correction

PhraseExpress includes a system-wide spelling correction with thousands of the main program window.spelling corrections in seven languages.
The TypoLearn™ feature detects your individual typos and automatically add such spelling corrections to create a custom-fit spelling correction database.

Clipboard Manager

While the standard Windows Clipboard keeps only the last copied data, the PhraseExpressClipboard Manager keeps recently copied clipboard contents for quick access and insertion into any application.

Document Generator

The built-in Document Generator creates complete documents based on boilerplate templates with just a few clicks.

MS Outlook Integration

The Enterprise Edition includes a Microsoft Outlook Add-In to enable you replying to emails fast and easy.

Macro Automation

PhraseExpress includes a powerful macro language for advanced text automation and integrates a Macro Recorder to record and playback repetitive tasks.

Built-In Pocket Calculator

No calculator at hand while you work on a document? PhraseExpress can perform calculations as you type.

Program Launcher

Launch programs simply by entering a text shortcut. For example, type 'word' to launch Microsoft Word or 'exc' to open a spreadsheet.

Email Signatures

PhraseExpress can manage your email signatures templates for use in any mail program, such as Outlook, Lotus Notes or Thunderbird. Dynamic contents can be embedded from ActiveDirectory/LDAP.
Multiple signatures in different languages or separate footers for personal vs business purposes can be easily managed in free-defined categories.

Multi-Platform Support

PhraseExpress can also synchronize snippets with SmileOnMyMac's softwareTextExpander™ to provide a cross-platform Text Expander for Windows and Mac.
A PhraseExpress App for Android Tablet and SmartPhones is also available!

Sharing templates in a team

Text templates can be shared among different computers or users with a professional client-/server architecture. PhraseExpress additionally supports synchronizing your data with any popular cloud data storage services such as Dropbox, Microsoft Skydrive or Google Drive.

RSI syndrome prevention

PhraseExpress reduces the risk of suffering from the Repetitive Strain Injury, as it helps to significantly reduce amount of time spent using a keyboard.

Unknown Web Developer

Morbi aliquam fringilla nisl. Pellentesque eleifend condimentum tellus, vel vulputate tortor malesuada sit amet. Aliquam vel vestibulum metus. Aenean ut mi aucto.

FREE DOWNLOAD MANAGER [An alternative to Internet Download Manager (IDM)]















What is Free Download Manager? It is a powerful, easy-to-use and absolutely free download accelerator and manager. Moreover, FDM is 100% safeopen-source software distributed under GPL license.Warning: beware of fake versions.
Increase you download speed
Increase your download speed and resume broken downloads
FDM accelerates downloads by splitting files into sections and then downloading them simultaneously. As a result download speed increases up to 600%, or even more! FDM can also resume broken downloads so you needn`t start downloading from the beginning after casual interruption.
HTTP/FTP/BitTorrent support
HTTP/FTP/BitTorrent support new
FDM lets you download files and whole web sites from any remote server via HTTP, HTTPS and FTP.
You can also download files using BitTorrent protocol.
Enjoy safer and more rewarding downloading
Enjoy safer and more rewarding downloading
You can read what other community members say about the file you are going to download, and also leave your own opinion about the file you downloaded. In this way FDM users are always warned against useless or malicious files.
GNU General Public License
GNU General Public License new
Free download manager is now open-source software released under GNU GPL.
More
In addition, Free Download Manager allows you to: adjust traffic usage; to organize and schedule downloads; download video from video sites; download whole web sites with HTML Spider; operate the program remotely, via the internet, and more!


For full features list, see the features section.
System requirements:
In order to use FDM, you must have one of the following operating systems installed on your computer:

 Microsoft Windows XP SP1 and higher
Supported languages:
Macedonian, Serbian, Albanian, Croatian, Korean, Arabic, Brazilian Portuguese, Bulgarian, Chinese Traditional, Chinese, Czech, German, Dutch, French, Hebrew, Hungarian, Italian, Polish, Portuguese-Brazil, Romanian, Russian, Slovak, Spanish, Swedish, Turkish, Uzbek, Greek, Vietnamese, Slovenian
You can download a new version of Free Download Manager for free
Current stable version: FDM ver. 3.9.4 build 1481
FDM ver. 3.9.4 build 1481 (7,4 Mb, setup) 
New features: 
[+] Chrome and Firefox extensions can be installed under non-admin user.
[+] Bittorrent: option to enable Peer Exchange.
[–] General bug fixes.


Download
You can download the old 3.8 version here.
The source code is available here.
You can also download FDM Lite version
FDM Lite version requires less size and lacks some functions (BitTorrent support, video conversion) that can be downloaded and installed as plugins later.
FDM Lite ver. 3.9.4 (3,9 Mb, setup)Download
Plugins for FDM Lite version:
Video Conversion plugin (2,4 Mb, setup)
Bittorrent plugin (1,2 Mb, setup)
Languages pack (0,9 Mb, setup)
Unknown Web Developer

Morbi aliquam fringilla nisl. Pellentesque eleifend condimentum tellus, vel vulputate tortor malesuada sit amet. Aliquam vel vestibulum metus. Aenean ut mi aucto.

Monday, 24 November 2014

Minimize programs to tray icons



Here is a little tutorial to how to Minimise every program to system tray.
Level: Beginner
1) First download a program called "Trayconiser" from here.
2) Unzip the zip file to [C:\ directory]. You can use any path but make sure you remember it afterwards.
2) Create a short-cut of the program that you want to minimise to system tray. [Right Click>Properties>Create Shortcut]
3) Go to the properties of that shortcut.[Right Click>properties]
4) In the "target" field write the path of the trayconiser program before the path of the program. For Example if I want to trayconise google chrome instead of :"C:\Program Files\Google\Chrome\Application\chrome.exe" in the target field i will write : C:\Trayconizer.exe "C:\Program Files\Google\Chrome\Application\chrome.exe".
5) Now every time you open google chrome it will open up normally and upon minimising it will go to the system tray.

Thats All!
Unknown Web Developer

Morbi aliquam fringilla nisl. Pellentesque eleifend condimentum tellus, vel vulputate tortor malesuada sit amet. Aliquam vel vestibulum metus. Aenean ut mi aucto.

Windows symbolic link, save some space.


Windows Vista and 7 introduced "symbolic links" (something *nix systems have had for a long, long time) which basically allows you to create links to files. They act like shortcuts, except programs will treat them as the full file. A good usage of symlinks is when you have multiple copies of the same game. You don't need to copy the entire data, just only parts of it.

set maindir="D:\Installed\Call of Duty\main"
set targetDir="C:\Users\simplythebest\Desktop\CoD\main"

MKLINK %targetDir%\pak0.pk3 %maindir%\pak0.pk3
MKLINK %targetDir%\pak1.pk3 %maindir%\pak1.pk3
MKLINK %targetDir%\pak2.pk3 %maindir%\pak2.pk3
MKLINK %targetDir%\pak3.pk3 %maindir%\pak3.pk3
MKLINK %targetDir%\pak4.pk3 %maindir%\pak4.pk3
MKLINK %targetDir%\pak5.pk3 %maindir%\pak5.pk3
MKLINK %targetDir%\localized_english_pak0.pk3 %maindir%\localized_english_pak0.pk3
MKLINK %targetDir%\localized_english_pak1.pk3 %maindir%\localized_english_pak1.pk3

Example is implemented on call of duty but you can play around to save huge space where you wish to have multiple copies of same data/file/games. :)

Unknown Web Developer

Morbi aliquam fringilla nisl. Pellentesque eleifend condimentum tellus, vel vulputate tortor malesuada sit amet. Aliquam vel vestibulum metus. Aenean ut mi aucto.