I don't mean for this to come out the way it will (I am white), and the few black programmers I have met speak and write perfect English, but when a black programmer is reading or writing "for each" do they internalize that as "fo each" ? This is something I have wondered about for a long time.
Posts made by luke727
-
RE: I.Like(BigButts) && I.Lie(False)
-
RE: Google hates IE... proof!
Yes; it's just as nifty as it is in Internet Explorer :)
-
RE: Hacking a motherboard, more than one CPU's
It is possible, but you have to get your DeLorean up to 88 MPH. And for God's sake, make sure your flux capacitor is in good working order.
-
RE: Rube Goldberg
Every time I think I have seen it all, something like this comes along. Bravo.
-
RE: Binary trees i need a help with making recursive functions non-recursive
Close, but no cigar.
1. Google "class bintree" "struct treenode" -> http://www.computing.dundee.ac.uk/courses/ac21001/protected/WebVersion/Chapter%2014.html
2. "AC21001 Home page" -> http://www.computing.dundee.ac.uk/courses/ac21001/
3. "Course Guide" -> http://www.computing.dundee.ac.uk/Teaching/fullcoursedetails.asp?AC21001
4. Essential Titles: Introduction to data structures and algorithms with C++, Glenn W Rowe, Prentice Hall, 0-13-579178-2
So this question is more than likely homework from a class which uses the above book (or at least uses code from that book). The things you linked to are similar, but my find is the EXACT code. I suppose it is possible the course you linked to uses that code, but hundreds of other courses could use it as well.
I couldn't find any questions similar to what the guy was asking, so I don't think he is enrolled in that particular school/class (does TDWTF have an UK following?). Anyone want to bother tracking this down any further?
-
RE: [video] Japanese Spiderman
The real WTF is that you can't fast-forward the video.
-
RE: I'm lovin' it
That's funny; I never would have guessed that Caltech had a Liberal Arts program!
-
RE: Laying cable in my home.
I have just one more question. There is stranded wire and solid wire. Is there really any measurable difference between the two?
-
RE: #define DEBUG
Well, wouldn't you want to thow the exception regardless? What happens when you do a release build and hdc is NULL?
Ignoring that for the moment, what you could do is something like this:
#ifdef DEBUG_BUILD #define THROW_ERROR(priority, message) throw Error(priority, message); #else #define THROW_ERROR(priority, message) ((void)0) #endif
or
void THROW_ERROR(int priority, const char* message)
{
#ifdef DEBUG_BUILD
throw Error(priority, message);
#endif
}bool DrawSomething(HWND hWnd)
{
HDC hdc = GetDC(hWnd);
if(hdc == NULL)
THROW_ERROR(ERROR_PRIORITY_FATAL, "Could not create a valid hdc");
...
}
-
RE: Laying cable in my home.
I really like the one with all the yellow wires towards the bottom. Imagine you're walking by and accidentally snag a few cables with your shoe...
-
WebDAV mark as read?
Basically I need to write a service that periodically checks a mailbox. It needs to download any file attachments and mark messages as read. Server side is Exchange 2003. I tried a few APIs, but settled on WebDAV. I can check new messages and download all the attachments perfectly, but I just cannot mark messages as read. I'm doing a PROPPATCH and setting "urn:schemas:httpmail:read" to "1", and it is returning a success status message, but it is not being marked as read. Marking as unread (i.e. "0") returns success but does not actually mark as unread. Basically it appears as if PROPPATCH "urn:schemas:httpmail:read" does nothing. I don't know what to do next.
-
RE: Laying cable in my home.
I tried wireless before anything else; I desperately wanted it to work, but the feeling wasn't mutual. The problem is that the two furthest points in the house that need to be connected go through a bunch of walls and tons of possible sources of interference. I suppose I could have got a few APs and blanketed the house, but that seems a bit overkill just to hook up 4 or 5 rooms.
Gigabit isn't really a priority (I'm only getting a megabit switch for now), but it's nice to have that option in the future.
Unfortunately I don't have a basement, and putting everything in the garage would require a lot of drilling and cutting. I'm just not up for a task that big; running wires will take enough work as it is.
The more I've thought about it, the more I'm leaning towards running it into the attic. It's basically the "proper" thing to do, and I guess it would look a little wierd having 10 cables coming out of the wall straight into a switch.
-
Laying cable in my home.
I'm going to try to lay some Cat5 in my home over the Christmas break. I figure maybe there are some guys reading this with some experience doing this. Anyway, I have never done this (Cat5, that is) but I have helped lay some coaxial cable in the same home so I have a good idea of what in general needs to be done and of the specifics of the layout. The good news is that all the rooms already have plenty of room in multiple (coax and phone; no power) conduits, so I won't have to do any drilling or cutting. I've looked at a bunch of Cat5-specific resources and it seems pretty straightforward. My question is really about design. All of the coax and phone meets in the attic in a jungle of twisted wires. I know people generally wire everything up in the attic, garage, or basement. However, we're only running 10-12 lines at most; definately no more than 16. In the wall in the main room behind a large entertainment center are three unused conduits and outlet boxes. I was thinking of possibly running lines from all the rooms to these outlets using 6-port RJ45 face plates. Then I can just set the router and modem on top of the TV or something and have short patch cables connecting the switch to the outlets in the wall.
My first question: Is this a WTF in the making?
Secondly, I'm getting 1000' of cable. If I were to wire it as described above, what is the best way to go about laying wire? From what I've read pretty much the only safe way is to run a pull line from one outlet to the other and then add plenty of slack before cutting a length of wire.
The attic is hotter than hell (even at this time of year), so I would like to spend as little time as possible in there. Someone help me out, here. Comments, suggestions, questions, etc.
-
RE: C# - compiler WTF
I know what you're saying, but I'm pretty sure it is correct. I believe that 'byte', 'int', etc are LANGUAGE primitives (i.e. C# standard), whereas 'System.Byte', 'System.Int32', etc, are FRAMEWORK implementations (i.e. .NET Framework) of those primitives. So it does make sense that a LANGUAGE enumeration could only be typed as an integral LANGUAGE primitive, even if the C# standard type (i.e. 'byte') is internally implemented as the .NET Framework type (i.e. 'System.Byte').
Basically:
'int', 'byte', etc are GUARANTEED to exist in ANY implementation of the C# standard
'enum' can only be based on an integral C# primitive ('int', 'byte', etc)
'System.Int32', 'System.Byte', etc, only exist in the .NET FRAMEWORK
-
Customize DllImport attribute?
Does anyone know if it is possible to extend or customize the DllImport attribute? I have a situation where I occasionally need to unload a library, replace it, and then reload it. Internally DllImport loads the library (LoadLibrary) when an imported function is first called, and then gets the address of the function (GetProcAddress) when each function is first called. I can FreeLibrary() and LoadLibrary() just fine, but if the library is loaded in a different address space than when it was first loaded all function calls will result in access violations because DllImport doesn't reload the function addresses. Currently I do it manually for about 10 functions each in 4 or 5 libraries, but it would be FANTASTIC if I could extend DllImport to do this automatically. However, I imagine that DllImport must have some special consideration in the CLR to let it do its thing, but I don't know. I have not been able to find anything about this anywhere, so I have a bad feeling it can't be done.
-
RE: Marshalling structs
The library does have a function to free the memory; I just didn't think it was relevant to the discussion.
I also have all the appropriate StructLayout and MarshalAs attributes set correctly; I just didn't want to clutter things.
The problem is with the array of FileInfo structs. Since it is dynamically allocated, I cannot use any of the MarshalAs options because for arrays they require SizeConst to bet set. I tried using just an IntPtr, but that didn't work: it contains the address of the Name string for the first FileInfo rather than the address of the struct itself. I think I will just have to use unsafe code.
-
Marshalling structs
I am having the hardest time trying to marshal some C structs.
<FONT face="Courier New">typedef struct _FileInfo
{
char* Name;
char* DisplayName;
unsigned int Status;
} FileInfo;</FONT><FONT face="Courier New">typedef struct _FileResult
{
unsigned int FileCount;
FileInfo FileInfos[1]; // why???
} FileResult;</FONT>There is a function that returns a pointer (to a pointer) to a FileResult.
<FONT face="Courier New">unsigned int GetFileResult(...stuff..., FileResult** ppFileResult);</FONT>
In C, I do this:
<FONT face="Courier New">FileResult* pFileResult;
unsigned int r = GetFileResult(...stuff..., &pFileResult);
for(int i = 0; i < pFileResult->FileCount; i++)
{
FileInfo* pFileInfo = &(pFileResult->FileInfos[i]);
//do something with pFileInfo
}</FONT>I cannot figure out how to get this working in C#. Here are my C# struct declarations:
<FONT face="Courier New">public struct FileInfo
{
public string Name;
public string DisplayName;
public uint Status;
}</FONT><FONT face="Courier New">public struct FileResult
{
public uint FileCount;
public IntPtr FileInfos;
}</FONT><FONT face="Courier New">public uint GetFileResult(...stuff..., out IntPtr ppFileResult);</FONT>
<FONT face="Courier New">IntPtr pFileResult;
uint r = GetFileResult(...stuff..., out pFileResult);
FileResult fileResult = new FileResult();
PtrToStructure(pFileResult, fileResult);
for(int i = 0; i < fileResult.FileCount; i++)
{
// how to marshal fileResult.FileInfos ???
}</FONT>I know the IntPtr FileInfos is not right; as expected, it contains the address of the string Name in the first FileInfo struct. I cannot modify the C source, so I am stuck with that. FileInfo is dynamically allocated by the callee. Is there a way to do this without using unsafe code? I think it is impossible, but I'm not the most knowledgeable when it comes to marshalling.
-
RE: The amazing error trap
Visual Basic always makes my brain hurt; I am lucky to have survived reading this...thing.
-
RE: Make Your Own Software!!
Where is the testimony from the guys behind CommunityServer?
-
RE: "Virtualization" versus "Enterprise"
What happens if you try to virtualize the enterprise? I bet this will result in a catastrophic deadlock of epic proportions.
-
RE: Adobe Acrobat Sucks
Yes, it sucks, but you can fix it.
1. http://blogs.msdn.com/jonathanh/archive/2004/12/22/330288.aspx
2. Edit->Preferences, Updates.
3. See 1.
Of course there really isn't any good reason to upgrade to version 7. It looks slicker, but aside from that all of the new functionality is "feature creap". I mean seriously: 3d animations, multimedia, and JavaScript in PDFs? All we need now is the ability to send and receive email and something involving XML. WTF FTW ... YES!
-
RE: Hardware Question
I have never heard of manufacturers of (more-or-less) commodity hardware *charging* for drivers. I think you must be mistaken; I just went to a good number of Bluetooth adapter manufacturers and every single one of them had links to free drivers on their product pages. Maybe you aren't looking hard enough; that or you're dealing with a shady company.
But back to the problem at hand. After a quick Google search it seems there are a few programs that can cause this behavior, most notably Quicken 2000. Basically they have some kind of background process that monitors the status of your internet connection. I guess they don't properly respond to requests to suspend and as a result the computer fails to enter suspend mode. Try looking at what programs and services start up with your computer.
-
RE: Why bush didn't help Louisiana
To be fair, he did post this in the "Side Bar" WTF forum where it belongs. In addition, some would say Bush's entire presidency and administration could be summed up as one big WTF, so I don't think he's out of line.
But back to the question at hand, I think the answer is obvious: "President Bush doesn't like black people". [:D] Mike Myers' reaction was the funniest work he's ever done.
-
RE: Win32 C - append Url to path
Yes, the Win32 API is pure joy to work with.[:D]
Anyway, this wasn't my project; I inherited it. I switched things up and changed everything to use CStrings instead of plain character arrays. It took a while to do, but life is easier now.
-
RE: Win32 C - append Url to path
Yes, it is related to mirroring websites; I do not do any kind of webpage development, if that's what you were thinking.
-
RE: Win32 C - append Url to path
It's funny because I could have sworn that they used to take / as a path separator (I may be delusional). But whenever I try to open a file using / instead of \ it gives me an "invalid path" error. If I use \ then it works. Maybe it's just the C++ wrappers that automatically convert the path to use the correct separator before calling the low-level functions. I think C# will work with either separator as well. I guess I will have to take it upon myself to make sure the right separator is being used.
-
Win32 C - append Url to path
This has been driving me nuts for the past hour or two. Can somebody tell me the proper way to append a URL to a file path in vanilla Win32 C? I.e. append "www.whatever.com/omgwtf/lol.html" to "C:\asdf" to get "C:\asdf\www.whatever.com\omgwtf\lol.html" using Path*/Url*/other functions? I don't think it can be done without looping through the string yourself. It needs to be all backslashes or else CreateDirectory/CreateFile will fail, and as far as I can tell none of the functions will automatically convert the forward slashes to back slashes.
-
Too abstract?
Today I was looking at some code and was kind of confused at what I found. Let me give you an example first:
class Base
{
public HashMap Map = new HashMap();
}
class Person : Base
{
public const String ATTR_FIRST_NAME = "FirstName";
public const String ATTR_LAST_NAME = "LastName";
public const String ATTR_AGE = "Age";
}
int Main(String[] args)
{
Person p = new Person();
p.Map[Person.ATTR_FIRST_NAME] = "John";
p.Map[Person.ATTR_LAST_NAME] = "Smith";
p.Map[Person.ATTR_AGE] = 25;
}Basically, there is a base class with a HashMap. The HashMap is used to store class variables (as opposed to explicitly declaring them). Every other class in the framework derives from the base class. To add new members to the classes you can define a constant String containing the "name" of the variable and then use the HashMap to store and retrieve it's value (or you can do it the "normal" way; many of the classes do it both ways). Obviously the real code wasn't as simple as this and some helper methods made it easier to access the class "members" (there were also mechanisms to ensure type-safety). I don't think it's quite a WTF, but I do think it is taking abstraction too far. If you are going to declare some constant String with the name of the variable to be used as an index into the HashMap, why not just declare a fucking variable? I just don't see why you would do it this way.
And now I pray as I hit "Post"...
-
RE: Help with error message
Isn't the solution obvious?
Everything tastes better with XML.