User Profile

Collapse

Profile Sidebar

Collapse
tuananh87vn
tuananh87vn
Last Activity: Oct 1 '18, 01:16 PM
Joined: Sep 11 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • tuananh87vn
    started a topic Calculate XOR of array of bytes
    in C

    Calculate XOR of array of bytes

    Hi a,

    I'm writing a C function to calculate the XOR of all members in an array of bytes. Each member should be a 512-byte block.

    Here is what i'm figuring how to write this function.

    the parameter includes the input array of 512-byte blocks
    the return result should be an string (char* or char[512])

    i've started the code as below:

    Code:
    char* calXOR(char* arr[512])
    ...
    See more | Go to post

  • tuananh87vn
    started a topic text editor with imageshack uploader
    in PHP

    text editor with imageshack uploader

    can anybody suggest me a text editor which supports image uploading to imageshack.us (or similar sites).

    i'm using tinymceeditor for my php cms but it doesn't meet this need!

    thanks in advance!
    See more | Go to post

  • tuananh87vn
    started a topic substr problem
    in PHP

    substr problem

    hi,
    i'm dealing with kind of getting a desired number of letters from a text to be printed out and i'm using php's substr to cut them out. if the text in in form of normal character, it's ok, however, as there are special characters (anyone knows about Vietnamese) which cannot, uh, normally be 'substring-ed'

    some special chars like â, ®, ©... require more than 1 bytes.. anybody knows how to handle them?

    thx...
    See more | Go to post

  • tuananh87vn
    replied to database in asp.net
    so, may i use this way:
    in a file db_class.cs i create a class dbconnection:

    Code:
    class dbConnection
    {
    // returns the connection to sql database
    public SqlConnection getConnection() {
            // connect to sql database
            string sqldb = WebConfigurationManager.ConnectionStrings["testdb"].ConnectionString;
            SqlConnection connectDB = new SqlConnection(sqldb);
    ...
    See more | Go to post

    Leave a comment:


  • tuananh87vn
    started a topic datagrid buttoncolumn - visible property
    in .NET

    datagrid buttoncolumn - visible property

    hi,
    can anybody show me how to use the visible property of the datagrid's buttoncolumn. for example, if the login user is at 'user' level the column 'delete' will be invisible. otherwise, if 'admin' is logged in, the column comes visible?
    in this case, I use session to check who's logged in.

    thanks!
    See more | Go to post

  • tuananh87vn
    started a topic database in asp.net

    database in asp.net

    hi,
    I'm absolutely newbie to asp.net and i've just started working with database. each time I want to make a database query, I have to start the connection by creating a new sqlConnection object. Is there anyway to keep the connection with the database, err, how to create the dataset or datasource for the whole project, so that I don't have to repeat the above action again and again. does it have anything to do with web.config file?
    ...
    See more | Go to post

  • tuananh87vn
    replied to write all lines except the first one!
    in Perl
    a mistake, it should be
    Code:
    open(FILE2, '>text2')
    so that we can write on file text2
    See more | Go to post

    Leave a comment:


  • tuananh87vn
    replied to write all lines except the first one!
    in Perl
    my bad,
    just when I put the question on the forum, the answer rushed into my head:

    Code:
    open <FILE, 'text1'>;
    open <FILE2, 'text2'>;
    
    $i = 0;
    
    while (<FILE>) {
       if ($i != 0) {
           print FILE2 "$_\n";
       }
       $i++;
    }
    
    close (FILE1);
    close(FILE2);

    do u think this way is ok?

    ...
    See more | Go to post

    Leave a comment:


  • tuananh87vn
    started a topic write all lines except the first one!
    in Perl

    write all lines except the first one!

    i'm about to use perl to read the content of a text file then write all lines in this file, except the first line, into another text file. Reading and writing file I think is ok to me, but I don't know how to make the first line as exception :|

    any help?
    See more | Go to post

  • tuananh87vn
    started a topic need an outstanding IP regular expression
    in Perl

    need an outstanding IP regular expression

    Code:
    \b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
    This ip validator matches most of IP addresses I tried, however it also considers 09.09.15.59 as an IP inside 20si10298798agb .38.2008.09.09.15.59.18;

    can anybody help me find way to match most ips but ignore the above stupid non-ip string
    See more | Go to post

  • tuananh87vn
    replied to filter something from file or string
    in Perl
    errr, another problem raised:
    assume that there are some similar ip addresses found duplicated in the text: ip1, ip1, ip2, ip2, ip2, ip3... how can we filter and get each ip address printed once only (i.e eliminate the duplicated ips)
    See more | Go to post

    Leave a comment:


  • tuananh87vn
    replied to filter something from file or string
    in Perl
    it works like a charm when while loop is used instead of if. I see the problem: 'if' will quit immediately as soon as a match is found, yet 'while' continues until reaching the end of line :D

    actually I see there's no need to set $\=""; still works well;

    thx so much!
    See more | Go to post

    Leave a comment:


  • tuananh87vn
    replied to filter something from file or string
    in Perl
    it still doesnot work, the new regular expression can only print the first thing that matches the pattern, then it ignore the rest of that line. does anybody know how to force it read until the end of line and print whatever matching.

    is there any way to read the whole text but not line by line? can we read word by word instead? does a string work in this case?
    See more | Go to post

    Leave a comment:


  • tuananh87vn
    replied to filter something from file or string
    in Perl
    err, how is it? perl is pretty new to me though I ppl say it's just like php. is there any more optimal way to read thru the whole text and pick up what we want?...
    See more | Go to post

    Leave a comment:


  • tuananh87vn
    started a topic filter something from file or string
    in Perl

    filter something from file or string

    hi,
    I'm dealing with a problem in which I have to scan through a short text and print out all ip addresses within it.

    assume I have a text stored in a file named 'test', and I write a small perl program which read all lines of the text and print out any ip address:

    open FILE, "test" or die $!;
    Code:
    open FILE, "header" or die $!;
    
    print "IP addresses found:\n";
    ...
    See more | Go to post

  • tuananh87vn
    replied to How to use AES_ENCRYPT/AES_DECRYPT
    in PHP
    using hash() to encrypt password and generating a new one if necessary is quite popular but that's not the case i'm dealing with :D

    anyway, i've found the way to work with aes_encrypt/aes_decrypt, which's quite simple:

    encrypt: password is stored in encrypted form, with 'key' defined by ourselves
    [php]
    mysql_query("IN SERT INTO table (username, password) VALUES ('$un', aes_encrypt('$p w','key'))");...
    See more | Go to post

    Leave a comment:


  • tuananh87vn
    started a topic How to use AES_ENCRYPT/AES_DECRYPT
    in PHP

    How to use AES_ENCRYPT/AES_DECRYPT

    hi,
    can anybody tell me how i can use mysql's aes_enrypt & decrypt to enrcypt and store password into mysql database then retrieve it in normal form. For example, i want to build php's forgot password function so that i can send plain-text password to user's email

    thanks,
    See more | Go to post

  • tuananh87vn
    started a topic Display all database records with Prado
    in PHP

    Display all database records with Prado

    hi,
    I've just studied Prodo Framwork and I don't know how to display all records to a webpage, say, home.page

    Is that something like we call a "SELECT * FROM table" query in the back-end home.php file then, err, do something in the front-end home.page... Anyone can help me?
    See more | Go to post

  • tuananh87vn
    started a topic svg and html
    in XML

    svg and html

    hi,
    I have created a SVG image and embedded it into a html page. I wonder how I can link a html drop down menu with this svg image element. I mean, for example, when I choose an option from the menu, a element of the svg image, say an square will blink or change its colour?
    See more | Go to post

  • tuananh87vn
    started a topic js positioning

    js positioning

    err how can i use a javascript event to locate and go to a certain position on a page. for example when i click on a button (onClick() event) i'll be brought to position (x,y) of the screen?
    See more | Go to post
No activity results to display
Show More
Working...