baavgai's Profile User Rating: *****

Reputation: 5780 Overlord
Group:
Mentors
Active Posts:
12,595 (5.08 per day)
Joined:
16-October 07
Profile Views:
121,010
Last Active:
User is offline Today, 05:58 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
725
Expert In:
C, C++, Java, C#, ASP.NET, PHP, Perl, Python, Oracle, SQL Server, MySql, HTML, JavaScript, Lua, Cheese

Latest Visitors

Icon   baavgai has not set their status

Posts I've Made

  1. In Topic: Pruning a 3d Linked List

    Posted 28 Jul 2014

    If you had a "sparse" grid, then you would never really need to reduce anything.

    e.g.
    class TwoDPoint {
        public readonly int x, y;
        public TwoDPoint(int x, int y) { this.x = x; this.y = y; }
        public int X { get { return x; } }
        public int Y { get { return y; } }
        public override bool Equals(object obj) { return Equals(obj as TwoDPoint); }
        public bool Equals(TwoDPoint p) { return (p != null) && (x == p.x) && (y == p.y); }
        public override int GetHashCode() { return x ^ y; }
    }
    
    class TwoDGrid : List<TwoDPoint> {
        public bool this[TwoDPoint pt] { /* your code here */ }
        public bool this[int x, int y] {
            get { return this[new TwoDPoint(x,y)]; }
            set { this[new TwoDPoint(x, y)] = value; }
        }
        // more
    }
    
    


    The trick is to overload the equals. When double checking the rules, I found this: http://msdn.microsof...v=vs.80%29.aspx

    Which happens to have both a 2d and 3d point.

    Hope this helps.
  2. In Topic: how to print new line without carriage return

    Posted 28 Jul 2014

    Why are you treating bytes like a c-string?!? Why are you translating an int to a char? Are you sure you want to do that?

    This should work:
    #include <iostream>
    #include <fstream>
    
    void sendByte(std::ostream &out, unsigned char c) { out << c; }
    
    void sendBytes(std::ostream &out, unsigned char *buff, unsigned size) {
        for(unsigned i=0; i<size; i++) { sendByte(out, buff[i]); }
    }
    
    void sendBytes(const char *filename, unsigned char *buff, unsigned size) {
        std::ofstream out(filename, std::ios_base::binary | std::ios_base::out);
        sendBytes(out, buff, size);
        out.close();
    }
    
    int main() {
        const int MAX_SIZE = 10;
        int size = 0;
        unsigned char data[MAX_SIZE];
        data[size++] = 10;
    
        sendBytes("dump.bin", data, size);
    
        return 0;
    }
    
    


    Hope this helps.
  3. In Topic: Beginner's Q: Is a void a variable like a bool, int?

    Posted 26 Jul 2014

    Ok, so as to not confuse anything:

    Quote

    The Void structure is used in the System.Reflection namespace, but is rarely useful in a typical application.
    -- http://msdn.microsof...=vs.110%29.aspx


    This is a placeholder for reflection;l it's metadata. Unless you were doing some odd interop between another language, declaring this as a return type would be absurd.
  4. In Topic: How to use my Node struct in my Test Driver?

    Posted 25 Jul 2014

    View Postlamentofking, on 25 July 2014 - 08:15 AM, said:

    Because like you said, I need to do basic data operations. I can't perform those operations if there isn't a node to do them on (unless you know something I don't).


    You're clearly thinking of your node as a public class. Simply declare it in the public section and go from there.

    Without knowing the operations you're planning on, it would be hard to offer a proper example.

    The point of having a class is to not have to be concerned about the implementation details. Rather than passing nodes about, you could just as easily pass an index or some other public reference that would map to your private one.
  5. In Topic: Automatic birthday email send out of MS SQL

    Posted 25 Jul 2014

    Alter PROCEDURE EmailData
    AS
    ...
    EXEC EmailData @ServerAddr, 
    ...
    
    


    You know, I've never actually seen recursion used in T-SQL... Perhaps msdb.dbo.sp_send_dbmail would be a better choice? ;)

My Information

Member Title:
Dreaming Coder
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Jersey, be afraid.
Years Programming:
25
Programming Languages:
Most.

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://

Comments

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  1. Photo

    8byte Icon

    10 Jan 2014 - 11:08
    Awesome, thanks for all the help!
  2. Photo

    codiddle Icon

    07 Mar 2013 - 18:59
    GENIUS GUY HERE MAN. Write a book!
  3. Photo

    mamelove25 Icon

    19 Feb 2013 - 10:53
    Hello My Dear, My Name is Mame. i saw your profile today and became interested in you,i will also like to know you more,and if you can send an email to my email address,i will give you my pictures here is my email address (mame25live@yahoo.co.uk) I believe we can move from here! Am waiting for your mail to my email address above because i have much to tell you,
    love Miss Mame.
  4. Photo

    bilbil0629 Icon

    24 Oct 2012 - 05:39
    hey! you mongolian?
  5. Photo

    Ticon Icon

    20 Aug 2012 - 13:23
    I just noticed your an expert in cheese. I lol'd
  6. Photo

    mostyfriedman Icon

    18 Aug 2012 - 23:13
    Hello there Brett
  7. Photo

    MehrdadSecret Icon

    26 Jul 2012 - 05:51
    hello, can i have a contact email or Yahoo or something? Need ur help badly
  8. Photo

    Jeet.in Icon

    18 Apr 2012 - 23:17
    Thanks ! Solved My problem !
    http://www.dreamincode.net/forums/topic/275578-simple-whitespace-remover/page__gopid__1603556&#entry1603556
  9. Photo

    RetardedGenius Icon

    25 Oct 2011 - 14:29
    I agree so much with your opinion of incompetent CS teachers. So true!
    http://www.dreamincode.net/forums/topic/252848-venting-a-frustration/page__view__findpost__p__1469659
  10. Photo

    WabiSabi Icon

    21 Oct 2011 - 11:00
    I agree with assert(C). However, I'd rather not specify what you are "the best" at.
  11. Photo

    assert(C) Icon

    20 Oct 2011 - 08:38
    You are the best
  12. Photo

    macosxnerd101 Icon

    30 Sep 2011 - 09:33
    Congrats on hitting the big 3k!
  13. Photo

    sjin Icon

    16 Aug 2011 - 18:41
    This guy is AWESOME! Cheers bro!
  14. Photo

    hulla Icon

    02 Aug 2011 - 02:50
    Wow that's alot of programming languages... :O
  15. Photo

    Aphex19 Icon

    04 Jul 2011 - 16:54
    Kudos to you baavgai, the most well deserved mentor on DIC in my opinion.
  • (3 Pages)
  • +
  • 1
  • 2
  • 3