apaddobs's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
Members
Active Posts:
49 (0.06 per day)
Joined:
16-May 12
Profile Views:
2,148
Last Active:
User is offline Apr 17 2014 10:27 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   apaddobs has not set their status

Posts I've Made

  1. In Topic: select query

    Posted 10 Mar 2014

    View Postbaavgai, on 10 March 2014 - 07:35 AM, said:

    What have you tried?

    Note, it sounds like you're supposed to use the LIKE operator: http://en.wikipedia...._%28SQL%29#LIKE


    What have I tried? Couldn't come up with anything. The "LIKE" operator can't seem to do the trick for me. I want equivalent of :

    select product from mytable where (product + '%') like 'RDBMS';
    The above doesn't work.
  2. In Topic: 80000 files added to tar file

    Posted 11 Jun 2013

    Well, the checksums are completely different and it can be safely presumed that each file is quite different from the previous build.

    BTW, it certainly seems very expensive to add 70000 files to a single tar. I have split that into 1000 per tar, and it took about 15 minutes to create those 70 tar files (with 1000 files each).

    So what are the recommended ways of sending this across WAN quickly?
  3. In Topic: 80000 files added to tar file

    Posted 11 Jun 2013

    Basically my question is that as my tar gets bigger and bigger with more and more files getting added, would each subsequent "add a new file to the existing tar" operation get more and more expensive in terms of reopening the tar, adding, closing the tar?

    I see that it has taken over 3 hours and its still not done with a total of 70000 files < 1 MB.
  4. In Topic: Escaping special characters

    Posted 5 Jun 2013

    This is my latest on this :
    #include <iostream>
    #include <string>
    using namespace std;
    
    string unescape_string (const string& s)
    {
        string result;
        for (size_t i = 0; i < s.length (); i++) {
            if (s [i] == '%'
                    && (i + 2) < s.length ()
                    && isxdigit (s [i + 1])
                    && isxdigit (s [i + 2])) {
                int code = 0;
                for (size_t j = 1; j <= 2; j++) {
                    int x = s [i + j];
                    if (isalpha (x) && isupper (x))
                        x = tolower (x);
                    x = isdigit (x) ? (x - '0') : (x - 'a' + 10);
                    code *= 16;
                    code += x;
                 }
                 result += static_cast<char>(code);
                 i += 2;
            }
            else
               result += s [i];
        }
        return result;
    }
    
    string  new_escape_string (const string& s)
    {
        string result;
        for (size_t i = 0; i < s.length (); i++) {
            if (isalpha (s [i]) || isdigit (s [i])) result += s [i];
            else  {
                char buf [3];
                int bytes = snprintf (buf, sizeof (buf),"%X", s[i]);
                if (bytes == 2) { result += "%"; result += buf;}
            }
        }
        return result;
    }
    
    int main () {
        cout << unescape_string ("a%20b");
        cout << endl;
        cout << new_escape_string ("a#b");
        cout << endl;
    }
    
    
    


    ./a.out
    a b
    a%23b

    This works like a charm. But yes, I am not expected to be encoding "all" non-alpha numeric characters. Does that mean, I should have an array of special characters, and for each char in the input string, I check if the non-alphanumeric char is one of the special chars in the array (by looping through the array). That sounds dumb and inefficient to me. How can I make this a li'l more smarter?
  5. In Topic: Escaping special characters

    Posted 5 Jun 2013

    new_escape_string (const string& s)
    {
        string result;
        for (size_t i = 0; i < s.length (); i++) {
            if (isalpha (s [i]) || isdigit (s [i])) continue;
            else result += static_cast<char> (static_cast<int> (s [i]));
        }
        return result;
    }
    
    
    


    Whats wrong with the above code. The double static cast not only looks weird but seems wrong as well;
    error: cannot convert ‘std::string’ to ‘int’ in return
    I see the above compilation error....

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

apaddobs hasn't added any friends yet.

Comments

apaddobs has no profile comments yet. Why not say hello?