Implementation of LZW compression algorithm in C?
{
unsigned char **dict;
int *dlength;
unsigned char p[80], temp[80];
char c;
int plength,i,j,k,diff,cd;
plength=1;
cd=256;
p[0]=EOF;
dict= (unsigned char *)malloc(99999); //Allocating memory for Dictionary
if(dict == NULL)
printf("Unable to allocate memory \n");
dlength=(int *)malloc(99999);
for (i = 0; i < 99999; i++) {
dict[i]=(unsigned char *)malloc(60);
if(dict[i]==NULL)
printf("Unable to allocate memory \n");
}
for (i=0;i<256;i++) //loading dictionary with ASCII set
{
dict[i][0]=i;
dlength[i]=1;
}
while ((c = fgetc(Fpt)) != EOF)
{
if(cd==256)
p[0]=(unsigned char *)c;
diff=0;
for (i=0; i<cd; i++)
{
for (k=0; k<plength; k++) //checking to see if p+c in dict
{
if(dict[i][k]!=p[k])
diff=1;
}
}
if (diff==0)
{
p[plength]=(unsigned char)c;
plength++;
}
if (diff==1)
{
for (i=0; i<cd; i++)
{
for (k=0; k<plength; k++)
{
if(dict[i][k]!=p[k])
diff=1;
}
if (diff==0)
j=i;
}
fputc(j, outfile);
for (i=0; i<plength; i++)
{
dict[cd][i]= p[i];
}
dict[cd][plength]=(unsigned char)c;
cd++;
p[0]=c;
}
}
for (i=0; i<cd; i++)
{
for (k=0; k<plength; k++)
{
if(dict[i][k]!=p[k])
diff=1;
}
if (diff==0)
j=i;
}
fputc(j, outfile);
fclose(outfile);
fclose(Fpt);
}
By Amit Setia
Under what circumstances if any do you consider programming in machine language?
Assembly language is typically used whenever a high level language is incapable of producing the desired machine code. For example, C++ is specifically designed such that you rarely need to use a lower level language such as C or assembly. However, sometimes you need a very specific piece of machine code in order to attain the highest possible performance from a particular piece of hardware and, if the compiler cannot produce it for you, you must craft it by hand instead.
The original question was: "need help with code"? which isn't a well-formed question. If you're asking if we (the answers community) need your help then the answer is no, but thank you all the same. If you're actually asking if you need help then the answer is probably yes, you do need help, but in order to assist you further we'd need more information on the problem.
How do you convert from array notation to pointer notation?
In the C and C++ languages the array notation arr[i] is completely equivalent to the pointer notation *(arr + i).
Examples of system and sub system in system analysis and design?
One example of a system and sub system in system analysis and design is an organization (system) with interrelated department (sub system). Another example would be a computer (system) and all of its components (subsystem).
SECTION .data
x: dd 6
f: dd 0
SECTION .text
global main
main: nop
mov ebx, x
mov eax, [ebx]
call fibo
mov [f], edx
(mov eax, 1
mov ebx, 0
int 0x80)
*****lo q está entre parentesis () puede ser sustituido por un "ret"
fibo: cmp eax, 2
jge comp
mov edx, 1
ret
comp: dec eax
push eax
call Fibonacci
pop eax
dec eax
push edx
call Fibonacci
pop eax
add edx, eax
ret
Static method can use only static variable why?
A static method is a method that is a class method and is not attached to the object of that class. So if we use a non static variable of the class, it would most probably not have been initialized because no object could have been created for the class. Hence it would throw a null pointer exception.
To avoid such an ambiguity, there is a restriction that static methods can use only static variables. This is to ensure that class methods can access only class variables both of which would get initialized simultaneously.
Was Word the first program on a computer?
No. The first computer program came several years before Word did. There does not seem to be any agreement as to what the first program was, but suffice it to say there were several that came before Word. In fact, Ada Lovelace arguably wrote a "computer program" in 1842!
Is open-source software limited to Linux only?
No. Open-source software is available for almost all platforms. Some examples of open-source software not exclusive to Linux or not found on Linux at all are:
Mozilla Firefox
Google Chrome
GNU Compiler Collection
ZSNES
DOSBox
Lighttpd
Apache
Secret Maryo Chronicles
Cygwin(Exclusive to this platform)
Hatari
SheepShaver
VisualBoy Advance
VirtualBox
PearPC
Emule (exclusive to this platform)
K-Meleon (exclusive to this platform)
Infrarecorder (exclusive to this platform)
Mozilla Firefox
GNU Compiler Collection
ZSNES
DOSBox
Secret Maryo Chronicles
Hatari
SheepShaver
VisualBoy Advance
VirtualBox
PearPC
Camino (exclusive to this platform)
Adium (exclusive to this platform)
Tomato Torrent (exclusive to this platform)
AquaMacs (exclusive to this platform)
What is a 'flat wicket' in Cricket?
The more grass a wicket has on it, the more "lively" it will be. Which means that the ball is more likely to move around. If a wicket is flat, then it will be bare and is unlikely to offer assistance to bowlers. Batsmen usually enjoy the wicket being flatter.
What are the different types of programming languages?
A type of programming language could be a domain, paradigm, or family; the related links give taxonomies according to all of these factors. The below answer addresses the question as regards families.
It would be impossible to list them all, but a few of the most common are as follows (listed in alphabetical order):
BASIC - This was the language Bill Gates released for the C64 and other computers. It quickly became a very popular language and matured into Visual Basic, which further matured into Visual Studio. The current implementation is very expensive, however Microsoft have released Express versions of the Visual Studio series which are free, at the expense (removal) of some functionality. There is also a very young cross-platform (Windows, Linux) Free and Open Source (FOSS) implementation of BASIC called FreeBASIC, which I personally program in and find very easy to use. It aims for compatibility with QuickBASIC while giving easy access to the host platform's system functions (the Windows API on Windows and system calls on Linux).
C, C#, C++ - These I don't have much knowledge about, I can only make reference to the existence of "gcc", a cross-platform (the amount of platforms it can compile to is mind-boggling) FOSS compiler. Visual Studio also has compilers for C++ and C#.
Perl, PHP, Python - These are mainly the "web languages" of today. PHP is the most widely used, mainly because of the fact that support for it is compiled into Apache, "the" web server for Linux (which also has ports for Windows and if I'm not mistaken, Mac OS). Perl and Python are also used very widely too, as it's as simple as installing mod_perl into Apache for Perl to work with the same, and I'd imagine Python integration is as easy too.
Computer programming is the craft of writing useful, maintainable, and extensible instructions which can be interpreted by a computing system to perform a meaningful task. Programming a computer can be performed in one of numerous languages, ranging from a higher-level language to writing directly in low-level machine code (that is, code that more directly controls the specifics of the computer's hardware) all the way to writing microcode (which does directly control the electronics in the computer). Using programming languages and markup languages (such as XHTML and XForms) require some of the same skills, but using markup languages is generally not considered "programming." Nevertheless, many markup languages allow inclusion of scripts, e.g. many HTML documents contain JavaScript. There are exceptions where markup languages do represent programming such as SuperX++ (http://xplusplus.sourceforge.net/) and o:XML (http://www.o-xml.org/) Computer programming is one part of a much larger discipline known as software engineering, which includes several different aspects of making software including design, construction and quality control. The subject of this book is software construction, that is, programming. Computer programming is also a useful skill (though not always necessary) for people who are interested in computer science. Whereas software engineering is interested specifically in making software, computer science tends to be oriented towards more theoretical or mathematical problems.
Find the absolute value write a program of a no entered through the keyboard?
#include<stdio.h>
#include<conio.h>
int main ()
{
int num;
printf("enter the number");
scanf("%d",&num);
if(num<0)
num=(-1)*num;
printf("absolute value=%d",num);
getch();
return 0;
}
What is meant by sap actually?
SAP Stands for "System Application Products in data processing" it is leding ERP Software Package.
Add two matrices by using arrays and functions?
#include
#include
void main()
{ int a[10][10],b[10][10],c[10][10];
printf("\nEnter the Row:");
scanf("%d",&r);
printf("\nEnter the Columns:");
scanf("%d",&c);
for(i=0;i
printf("\nThe Result is:\n");
for(i=0;i
printf("\n");
}
getch();
}
Syntactical errors may happened.
How macro calls within macros are handled?
'=============>>
Public Sub Main()
'Your code
Call One
'your code
End Sub
'<<=============
'=============>>
Public Sub One()
MsgBox "Hi from One"
End Sub
'<<=============
> Does it matter where the other macros are stored or is it
> better to have them all in one module?
Unless there are a larger number of macros, they can be stored in a single
module. However, for organisational reasons, it is usually better to store
macros by type in different modules.
Regards
Rollick
How do you spell cutie in binary code?
Letter
Binary CodeA01000001B01000010C01000011D01000100E01000101F01000110G01000111H01001000I01001001J01001010K01001011L01001100M01001101N01001110O01001111P01010000Q01010001R01010010S01010011T01010100U01010101V01010110W01010111X01011000Y01011001Z01011010
Letter
Binary Codea01100001b01100010c01100011d01100100e01100101f01100110g01100111h01101000i01101001j01101010k01101011l01101100m01101101n01101110o01101111p01110000q01110001r01110010s01110011t01110100u01110101v01110110w01110111x01111000y01111001z01111010
Is it true that each 1 and 0 in the binary system represents 1 bit of computer code?
Ye, 1 bit can either represent on "1" or off "0".
What is the problem of using simplistic language online?
If by "simplistic language" one is referring to slang or street language, the main problem with using such language online is that others may not be able to understand what is being said.
Who are the programmers of Microsoft Excel?
A huge team of people would have been involved in the programming of Microsoft Excel. There are also other people involved in other aspects of the creating of Excel, such as designers. The names of all of these people are not publicy known.
What is the difference between implementation and algorithm?
An algorithm is a instruction for solving a problem. It is typically illustrated using prose, pseudo code or flowcharts, but other methods exist. The algorithm is the "here's how it's going to work" part of the solution.
An implementation (of an algorithm) is a specific expression of this algorithm, using a specific programming language or any other suitable means. The implementation is the "here's how I've done it" part of the solution.
Where is the Goal Seek Command located?
In excel 2010 it can be found in the data tab > data tools > what if analysis > goal seek
How do you make rar sequence files like part1.rar part2.rar and so on?
open WinRAR go to "Option" -> "Settings" -> "Compression" at the Volume size list click "Define volume sizes..." in "User defined sizes" put this:
Label Size, bytes
1. 15 MB 15,000,000
2. 50 MB 50,000,000
3. 100 MB 100,000,000
4. 200 MB 200,000,000
How do you use active learning in computer programming?
Active learning is used in computer programming with a person "learning and the depth of the student's knowledge increase when active learning methods are employed in the classroom. Active learning strategies are discussed in general computer science course work and as used in a theory of computation course. Difficulties with active learning and techniques for dealing with these are also presented."
Yes. USB can support 127 devices per port which allows for daisy chaining.