loadYOURSELF

loadYOURSELF

Browsing Posts tagged C#

A document detailing common patterns of parallelism and best implementation practices using the new native C++ concurrency libraries in Visual Studio 2010.


Download Page

Buy me a beer

Some domain’s serve under multiple ip addresses for example google.com

if you want to query this ip addresses then you can use this code block

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
 if (argc < 2) {
   fprintf(stderr,"Usage: ./app www.google.com\n");
   exit(1);
 }

 struct hostent *hp = gethostbyname(argv[1]);

 if (hp == NULL) {
   fprintf(stderr,"query failed\n");
   exit(1);
 } else {
   unsigned int i=0;
   while ( hp -> h_addr_list[i] != NULL) {
     printf( "%d -> %s ",i, inet_ntoa( *( struct in_addr*)( hp -> h_addr_list[i])));
     i++;
   }
   exit(0);
 }
}

Buy me a beer

StreamReader sr = new StreamReader(“database.txt”, Encoding.Default);
textBox1.Text = sr.ReadToEnd();

For turkish

readings

StreamReader sr = new StreamReader(“ornek.txt”, Encoding.GetEncoding(“windows-1254″));
textBox1.Text = sr.ReadToEnd();

Buy me a beer