Wednesday, October 18, 2006

Digital Drug

A friend sent me about this about "Digital" drug:

As part of our dedication to being an open, transparent organization, here are the frequencies utilized in the production of the Digital Drug CD:

0.5 - 1.5 Hz - Endorphin release
0.9 Hz - Euphoric feeling
2.5 Hz - Production of endogenous opiates (pain killers, reduce anxiety)
4.0 Hz - Enkephalin release for reduced stress
10 Hz - Enhanced serotonin release. Mood elevation, arousal, stimulant
14 Hz - Awakeness, alert. Concentration on tasks
20.215 Hz - Brings about safe LSD-25 effects
30 Hz - Used for safe marijuana effects
33 Hz - Hypersensitivity, C. consciousness
38 Hz - Endorphin release
46.98 Hz - Visualization effects, when used with 62.64 & 70.47 Hz
Carriers: 90 - 110 Hz - Pleasure-producing beta-endorphin rise
111 Hz - Constant beta endorphin release

Sunday, October 15, 2006

CDMA (2)

Here is an improvement of the previous code. To simulate bit stream, I add a function to generate random number generator for each node.



#include <stdio.h>
#include <stdlib.h>

#define NUMBER_OF_SEQUENCES 8
#define IS_ORTHOGONAL 0
#define IS_NOT_ORTHOGONAL -1
#define N_NODES 4

typedef struct {
int chip[NUMBER_OF_SEQUENCES];
} ChipSeq;


void PrintChipSeq(ChipSeq *X);

int Add(ChipSeq *X, ChipSeq* Y, ChipSeq *R)
{
int i;
for (i=0; ichip[i] = X->chip[i] + Y->chip[i];
}
return 0;
}


int DotProduct(ChipSeq *X, ChipSeq *Y, ChipSeq *Res)
{
ChipSeq temp;
int i;

if (!X || !Y)
return -1;

for(i=0; ichip[i] = X->chip[i] * Y->chip[i];
return 0;
}

void InitChip(ChipSeq *A, int initVal)
{
int i;

for(i=0; ichip[i] = initVal;
}


int CheckOrthogonality(ChipSeq *X, ChipSeq *Y)
{
int i;
int sum = 0;

for (i=0; ichip[i] * Y->chip[i];

if (sum/NUMBER_OF_SEQUENCES == 0)
return IS_ORTHOGONAL; // it is orthogonal
else
return IS_NOT_ORTHOGONAL;
}


int RecoverBit(ChipSeq *S, ChipSeq *SenderSeq)
{
int i;
int sum=0;

for(i=0; ichip[i] * SenderSeq->chip[i];

return (sum/NUMBER_OF_SEQUENCES <= 0 ? 0 : 1); } int Negative(ChipSeq *A, ChipSeq *Comp) { int i; for(i=0; ichip[i] = -(A->chip[i]);
}


void PrintChipSeq(ChipSeq *X)
{
int i;

printf("[ ");
for (i=0; ichip[i]);
printf("]");
}

void CopySeq(ChipSeq* src, ChipSeq* dest)
{
if (src && dest)
memcpy(dest, src, sizeof(ChipSeq));
}


void ConvertToBipolar(ChipSeq *A, ChipSeq *Bip)
{
int i;

for(i=0; ichip[i] == 1)
Bip->chip[i] = 1;
if (A->chip[i] == 0)
Bip->chip[i] = -1;
}
}


void Send(int n, int bit[], ChipSeq node[], ChipSeq *S)
{
ChipSeq bp[N_NODES], temp;
int i,j;

if (n>N_NODES) return;
for(i=0; i if (bit[i]==1)
CopySeq(&node[i], &bp[i]);
else
Negative(&node[i], &bp[i]);
}
memset(S, 0, sizeof(ChipSeq));
for(i=0; i Add(S, &bp[i], S);
}
}


int GenerateRandom(void)
{
return random() % 2;
}


int main(int argc, char *argv[])
{
int i,j;
ChipSeq node[4] = { {{0, 0, 0, 1, 1, 0, 1, 1}},
{{0, 0, 1, 0, 1, 1, 1, 0}},
{{0, 1, 0, 1, 1, 1, 0, 0}},
{{0, 1, 0, 0, 0, 0, 1, 0}}
};
ChipSeq temp, b[N_NODES], s;
int bit[N_NODES];
time_t t;

for(i=0; i printf("Node[%u] = ", i);
PrintChipSeq(&node[i]);
printf("\n");
ConvertToBipolar(&node[i], &b[i]);
printf("Bipolar(node[%u]) = ", i);
PrintChipSeq(&b[i]);
printf("\n");
}

for (i=0; i for(j=i+1; j if (CheckOrthogonality(&b[i], &b[j])==IS_ORTHOGONAL)
printf("Node[%u] & node[%u] is orthogonal\n", i, j);
else {
printf("Node[%u] & node[%u] is NOT orthogonal\n", i, j);
exit(0);
}
}
}

time(&t);
srandom(t);
for (i=0; i<100; i++) {
bit[0] = GenerateRandom();
bit[1] = GenerateRandom();
bit[2] = GenerateRandom();
bit[3] = GenerateRandom();
printf("Send: A=%u B=%u C=%u D=%u\n", bit[0], bit[1], bit[2], bit[3]);
Send(N_NODES, bit, b, &s);
printf("S = !A + !B + !C + !D = ");
PrintChipSeq(&s);
printf("\n");

printf("Recover bit from A: S*A\n");
printf("Bit sent from A was: %d\n", RecoverBit(&s, &b[0]));
printf("\n");

printf("Recover bit from B: S*B\n");
printf("Bit sent from B was: %d\n", RecoverBit(&s, &b[1]));
printf("\n");

printf("Recover bit from C: S*C\n");
printf("Bit sent from C was: %d\n", RecoverBit(&s, &b[2]));
printf("\n");

printf("Recover bit from D: S*D\n");
printf("Bit sent from D was: %d\n", RecoverBit(&s, &b[3]));
printf("\n");
}
}

CDMA

I developed this simulation just for fun and only in a few minutes:


#include
#include


#define NUMBER_OF_SEQUENCES 8
#define IS_ORTHOGONAL 0
#define IS_NOT_ORTHOGONAL -1



typedef struct {
int chip[NUMBER_OF_SEQUENCES];
} ChipSeq;


int Add(ChipSeq *X, ChipSeq* Y, ChipSeq *R)
{
int i;

for (i=0; i
chip[i] = X->chip[i] + Y->chip[i];

return 0;
}


int DotProduct(ChipSeq *X, ChipSeq *Y, ChipSeq *Res)
{
ChipSeq temp;
int i;

if (!X || !Y)
return -1;

for(i=0; i
chip[i] = X->chip[i] * Y->chip[i];
return 0;
}

void InitChip(ChipSeq *A, int initVal)
{
int i;

for(i=0; i
chip[i] = initVal;
}


int CheckOrthogonality(ChipSeq *X, ChipSeq *Y)
{
int i;
int sum = 0;

for (i=0; i
chip[i] * Y->chip[i];

if (sum/NUMBER_OF_SEQUENCES == 0)
return IS_ORTHOGONAL; // it is orthogonal
else
return IS_NOT_ORTHOGONAL;
}


int RecoverBit(ChipSeq *S, ChipSeq *SenderSeq)
{
int i;
int sum=0;

for(i=0; i
chip[i] * SenderSeq->chip[i];

return sum/NUMBER_OF_SEQUENCES;
}


int Negative(ChipSeq *A, ChipSeq *Comp)
{
int i;
for(i=0; i
chip[i] = -(A->chip[i]);
}


void PrintChipSeq(ChipSeq *X)
{
int i;

printf("[ ");
for (i=0; i
chip[i]);
printf("]");
}

void CopySeq(ChipSeq* src, ChipSeq* dest)
{
memcpy(&dest, &src, sizeof(ChipSeq));
}


void ConvertToBipolar(ChipSeq *A, ChipSeq *Bip)
{
int i;

for(i=0; i
chip[i] == 1)
Bip->chip[i] = 1;
if (A->chip[i] == 0)
Bip->chip[i] = -1;
}
}


int main(int argc, char *argv[])
{
ChipSeq A = { {0, 0, 0, 1, 1, 0, 1, 1}};
ChipSeq B = { {0, 0, 1, 0, 1, 1, 1, 0}};
ChipSeq C = { {0, 1, 0, 1, 1, 1, 0, 0}};
ChipSeq D = { {0, 1, 0, 0, 0, 0, 1, 0}};
ChipSeq temp, ba, bb, bc, bd, ca, cb, cc, cd, sum;

printf("A = ");
PrintChipSeq(&A);
printf("\n");
ConvertToBipolar(&A, &ba);
printf("Bipolar(A) = ");
PrintChipSeq(&ba);
printf("\n");

printf("B = ");
PrintChipSeq(&B);
printf("\n");
ConvertToBipolar(&B, &bb);

printf("C = ");
PrintChipSeq(&C);
printf("\n");
ConvertToBipolar(&C, &bc);

printf("D = ");
PrintChipSeq(&D);
printf("\n");
ConvertToBipolar(&C, &bd);

// A + B + C sends 0 bits
Negative(&ba, &ca);
printf("!A = "); PrintChipSeq(&ca); printf("\n");
Negative(&bb, &cb);
printf("!B = "); PrintChipSeq(&cb); printf("\n");
Negative(&bc, &cc);
printf("!C = "); PrintChipSeq(&cc); printf("\n");

// now add
Add(&ca, &cb, &temp);

Add(&temp, &cc, ∑);
printf("S = !A + !B + !C = ");
PrintChipSeq(∑);
printf("\n");

printf("Recover bit from A: S*A\n");
printf("Bit sent from A was: %d\n", RecoverBit(∑, &A));
printf("\n");

printf("Recover bit from B: S*B\n");
printf("Bit sent from B was: %d\n", RecoverBit(∑, &B));
printf("\n");

printf("Recover bit from C: S*C\n");
printf("Bit sent from C was: %d\n", RecoverBit(∑, &C));
printf("\n");

}

Sunday, October 1, 2006

25 Ultimate PC Tools

System Cleaner: CCleaner at www.ccleaner.com
Disk Space Analyzer: WinDirStat at windirstat.sourceforge.net
File Shredder at www.handybits.com/shredder
Firewall: ZoneAlarm at www.zonelabs.com
Anti-Spyware: A-Squared at www.emsisoft.com/en/software/free/
Anti Virus: AVG Free Edition at free.grisoft.com
Rootkit Scanner: Blacklight at www.f-secure.com/blacklight
Anti-Malware: HijackThis at www.merijn.org
System Profiler: Blearc Advisor at www.belarc.com/free.download.html
Fan Controller: SpeedFan at www.almico.com/speedfan.php
File Monitor: Unlocker at ccollomb.free.fr/unlocker
USB Boot Management at tinyurl.com/kaytz
File Management: ExplorerXP at www.explorerxp.com
File Encryption: TrueCrypt at www.truecrypt.org
Notebook Power Management at www.pbus-167.com/nhc/nhc.htm
Windows Installer Manager: nLite at www.nliteos.com
System Recovery: BartPE at www.nu2.nu/pebuilder
Spam Filter: SpamPal www.spampal.org
LCD Maintenance: UDPixel at udpix.free.fr
Clipboard Recorder: www.lw-works.com

Saturday, September 30, 2006

Who says Google is Everything?

I always use Google to search all topics that I get interested. But it is so dissapointing that Google cannot list my personal webpage which I run at home. I did register my page manually using Google webmaster tool. I then used Yahoo to search, and you know what? it could find it!

Thursday, September 28, 2006

Life is getting easier with these Protocols

In hardware, people used to use parallel bus to communicate to other peripherals or devices on the same board. This is costly and more difficult to debug. Now we have these I2C and 1-WIRE protocols. The I2C stands for Inter-IC protocol which requires only 2 lines to connect to other devices (and it is shared line). These two lines (SDA and SCLK) carry data and clock in serial form, similar to SPI. Unlike SPI which in many cases need SC (select chip) pin, the SDA line can be shared with more than one device, because it is half-duplex. The rate spans from 100 kHz to 400 kHz.

1-WIRE is another protocol invented by Dallas Semiconductor. It is slower than I2C, but requires only one line (besides ground) to communicate. The line even can carry power too.

Another protocol is the popular USB. The newer is USB 2.0. It is standardized by IEEE with name IEEE 1284 This bus can also carry power and the speed is much higher than the two above. The speed can go upto 480 MBps (raw bits). The speed of USB 1.0 is 12 Mbps. From programming perspective, it is more diffcult to program than the other two. The protocol is mostly used in the PC world (including Apple Mac OS and Linux).

Firewire is also a good protocol, but seems is now not as popular as USB. Actually, Firewire (known also as I.LINK or IEEE 1394) was the first protocol that passed 100 Mbps rate.

Going down to internal microprocessor, there is HyperTransport from AMD and FrontSide Bus (FSB) from Intel. These protocols mostly used to communicate among modules in the same chip.

There are many other protocols, but seem they are not as popular as the above.