Kategoriarkiv: Programmering

C operator precedence

Table 4.11 lists all the C operators in order of decreasing precedence. Operators on the same line have the same precedence. Table 4.11. C operator precedence. Level Operators 1 () [] -> . 2 ! ~ ++ — * (indirection) … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Using indent on C code

this slamcoded program works fine, but looks like shit: #include <unistd.h> int main (int argc, char **argv) { if (argc < 2) { printf (“Hva har du kog i fister?\n”); } else if (!strcmp (argv[1], “-GiB”)) { printf (“Gibibyte\n”); system … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

C eksempel med argv, argc og system()

#include <stdio.h> int main(int argc, char **argv) { if (argc < 2) { printf(“Hva har du kog i fister?\n”); } else if (!strcmp(argv[1], “-GiB”)) { printf(“Gibibyte\n”); system(“df -h”); } else if (!strcmp(argv[1], “-GB”)) { printf(“Gigabyte\n”); system(“df -H”); } else { … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Create colorized HTML files from your source code files with VIM

Open your source code file with VIM and type ‘:ru syntax/2html.vim’ in command mode. And poof, there we have another window with your HTML converted source code. Enjoy 😉 /secor

Udgivet i Knowledge Base, Old Base, Programmering, Vim | Skriv en kommentar

Taking command line arguments in C

bash$ cat vladimirr.c int main(argc, argv) int argc; char **argv; { int i; for (i=0; i<=argc; i++) { printf(“Argument[%i]=%s\n”,i,argv[i]); } } bash$ cc vladimirr.c -o vladimirr bash$ ./vladimirr er en gammel torsk som stinker til c Argument[0]=./vladimirr Argument[1]=er Argument[2]=en Argument[3]=gammel … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Preload of images with JS

Unifix knowledge database – The original one Dashboard – News – Search – List – About – Admin Preload of images with JS Author:vladimirr – Thu Aug 7 20:36:03 2003 <script language=”JavaScript”> <!– function PreLoad() { if (document.images) { img1 … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering, Uncategorized | Skriv en kommentar

Network Programming in C

An easy guide to network programming in C: http://tinyurl.com/685d /secor

Udgivet i Knowledge Base, Networking, Old Base, Programmering | Skriv en kommentar

bookmarklets

This only works in IE (sigh). I’m working on a mozilla compatible version… make a .html file with this content and add the bookmarklets to your bookmarks: <a href=”javascript:Q=document.selection.createRange().text;if(!Q){void(Q=prompt(‘Find funktion:’,”))};if(Q)location.href=’http://dk2.php.net/search.php?lang=en&show=quickref&pattern=’+escape(Q)”>Find PHP funktion</a> <br /> <a href=”javascript:Q=document.selection.createRange().text;if(!Q){void(Q=prompt(‘Søg efter:’,”))};if(Q)location.href=’http://base.fujang.dk/cgi-bin/index.pl?action=query&query=’+escape(Q)”>Søg på Fujang knowledge … Læs resten

Udgivet i HTML, Old Base, Programmering, Windows | Skriv en kommentar

PHP unicode decoder

function unicode_decode($txt) { $txt = preg_replace_callback( ‘/%u([[:alnum:]]{4})/’, create_function(‘$match’, ‘return “&#”.hexdec($match[1]).”;”;’), $txt ); $txt = preg_replace_callback( ‘/%([[:alnum:]]{2})/’, create_function(‘$match’, ‘return “&#”.hexdec($match[1]).”;”;’), $txt ); return ($txt); }  

Udgivet i Knowledge Base, Old Base, PHP, Programmering | Skriv en kommentar

Using threads in perl

Remember setting threads in your ./Configure, cause it’s not compiled by default! Example: #!/usr/bin/perl use Thread; new Thread \&test_sub; sub test_sub { while(1) { sleep 2; print “TestSUB\n”; } } while(1){ sleep 3; print “NormalProc\n”; } For more information, see … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar