I am studying Compilers recently, and I want to implement a lexer.   When I was designing the Symbol Table of lexer, I was thinking of to make the hash value of the identifier to the Symbol Table index.  However, I was confused about which hash function I should use, can anyone give me some advice?  I want to implement the lexer with C++, and say the identifier is made of letter, number and underscore, and it only starts with letter or underscore.  Thank you in advance!
What is a good Hash function? I saw a lot of hash function and applications in my data structures courses in college, but I mostly got that it's pretty hard to make a good hash function. As a rule of thumb to avoid collisions my professor said that:  function Hash(key)   return key mod PrimeNumber end   (mod is the % operator in C and similar languages)  with the prime number to be the size of the hash table. I get that is a somewhat good function to avoid collisions and a fast one, but how can I make a better one? Is there better hash functions for string keys against numeric keys?
Question 5.33 from "Topology and its Applications"  by Baesner is to compute the fundamental group of the torus ($T^2$) with $n$ points removed. I can "see" in my mind that if we remove one point we get a bouquet of two circles. Less clear is what happens when we remove two (or more) points. Any hints? Export multiple objects to .obj A book suggests that we should not interchange "so" and "so that". "So" means "therefore", and "so that" means "in order that". However, it seems to me that in many cases they don't actually have a difference. For example:     Alice got up at 5:00 A.M., so that she could drive her son to school.   If I substitute "so that" with "so", this sentence presents the exact same causal relation to me:     Alice got up at 5:00 A.M., so she could drive her son to school.   I must have missed something here, since English is my second language. Could somebody explain the difference? Decode Base64 data in Java I have an image that is Base64 encoded. What is the best way to decode that in Java? Hopefully using only the libraries included with Sun Java 6. I used exposure compensation when I take my shots and adjust it whenever it needs adjustments. Most of the time I shoot using Manual mode.  My problem is, when I'm out on a sunny day I can't judge whether my shot is overexposed or underexposed because the sun is too bright. Sometimes when I checked my viewfinder the image looks perfectly exposed to my eyes, but when I check it on my computer when I get home the images looks underexposed or overexposed. I tried to judge my shot's exposure using histogram, but still having a hard time. The only thing I understand about the histogram is that, the right side is the highlights and the left side is the shadow.  How do you judge whether the shot is overexposed or underexposed when you are out on a sunny day? How can I evaluate $\sum_{n=0}^\infty(n+1)x^n$? replacing the default console emulator under Windows XP How can I replace the default program providing console windows under Windows XP?  I know of , and I have a shortcut to start cmd.exe in . But now I want console applications to start in Console2 rather than the default console program, even when I have no control over the program that starts the console application. (I.e. a non-console program starts consoleapp.exe, and I can't change it to start Console2 instead, but I still want the application to be started inside a new instance of Console2.)  (Note that I want to replace the console itself, that is, the window in which console (i.e. text mode) applications run. And I must be able to run arbitrary, unmodified console applications: a substitute for a specific console program such as Cmd won't do me any good.)  EDIT: So what I'm after is a , which           OT: I want to know when Microsoft is going to make a decent CSRSS replacement. Not being able to adjust the width of a "terminal" by resizing the window is a complete joke.         Go download the ISE already. (It's included in Win7/2008R2.)   But as far as I understand this ISE is an , not a general console emulator. Sheet Specific Scripts I'm currently using the below script to timestamp when an edit is made to column 7 on a sheet named "Sheet 1".  function onEdit(e) {    if ([7].indexOf(e.range.columnStart) != -1) {    e.range.offset(0, 7).setValue(new Date()).setNumberFormat("dd.MM.yyyy at HH:mm");    }   }     I have a second sheet "Sheet 2" which I need to run the same script on but against column 5.  function onEdit(e) {    if ([5].indexOf(e.range.columnStart) != -1) {    e.range.offset(0, 7).setValue(new Date()).setNumberFormat("dd.MM.yyyy at HH:mm");    }   }     I've tried .getSheetByName("Sheet1") but just cant seem to get it working correctly. Linux GUI development I have a large GUI project that I'd like to port to Linux. What is the most recommended framework to utilize for GUI programming in Linux? Are Frameworks such as KDE / Gnome usable for this objective  Or is better to use something more generic other than X?  I feel like if I chose one of Gnome or KDE, I'm closing the market out for a chunk of the Linux market who have chosen one over the other.  (Yes I know there is overlap)    Is there a better way? Or would I have to create 2 complete GUI apps to have near 100% coverage?  It's not necessary to have a cross-platform solution that will also work on Win32. What's this? What is it? but not What's it? - Why? Can anyone give a cogent, simply described explanation of why the verb BE in:  What is it?  ... doesn't seem to be able to be contracted with the subject:  What's it? *  Compare the sentences above with:  What's this? What's that?  These are perfectly fine. In fact, the contractions here should be expected in almost all examples of spoken English. Answers with references to authoritative vetted sources would be greatly appreciated. Is there a way to force the iPhone to use its own microphone when connected to a Bluetooth speaker? I connect my phone to a Bluetooth speaker to play music. When engage Siri or try to use dictation, the phone wants to use the microphone on the Bluetooth device, which is either too crappy or too far away for it to understand what I am saying.  So, I would like a way to restrict the iPhone to using its own microphone even when connected to a Bluetooth speaker.  I am open to doing this via a setting, buying an app, or jailbreaking or whatever.  Is there a way to do this? What can be considered as "Home ties" for a UK Standard Visitor visa (PLAB)? I am an Indian national who recently cleared his PLAB1 examination and has booked to sit PLAB2 in UK (which can be given only in UK). Before applying for a visa, I would like to know about the how one can prove home ties. Of course, I have read about the Family, Job, Property being used as ties but...  I haven't worked since my graduation (two years now) as I wasted a lot of precious time on USMLE. After that IELTS and then PLAB1. So can't show job as tie.  I don't have any property in my name but my father does have residential plots and agricultural lands worth a few crores on his name.    Does an affidavit that I am his only son and heir to all that bla bla bla, serve the purpose?  I do have few life insurance policies in my name.  Can they be used as an indicator of some kind of active Indian society member thingy?  I am unmarried but do intend to show my parents as family ties.   I did my medical studies in China (6-7 years). I have also traveled to a few countries like Russia, Thailand, Philippines, HK, Macau etc etc (though not a single Western country).    Can that be used in my favour in home ties that I have always obeyed country's laws and returned to India upon completion of the purpose of the trip? What does the number in parentheses shown after Unix command names in manpages mean? For example: man(1), find(3), updatedb(2)?   What do the numbers in parentheses (Brit. "brackets") mean? A clock near the surface of the earth will run slower than one on the top of the mountain.  If the equivalence principal tells us that being at rest in a gravitational field is equivalent to being in an accelerated frame of reference in free space, shouldn't the clock near the earth run increasingly slower than the other clock over time?  If those two clocks are considered to be in two different frames of acceleration, the one near the earth will have a greater acceleration than the one on the mountain, and thus over time, their relative velocity will increase over time which will increase the time dilation.  Or is this not a proper use of the equivalence principle? How to extend my root (/) partition? How to create a Customized Ubuntu Server ISO? I'd like to create a customized Ubuntu Server 12.04 ISO but couldn't find a clear approach on how to do it. I see that Ubuntu-builder is a very good app to create a customized Ubuntu Desktop, but what about Ubuntu Server? Solve $\frac1x+\frac1y=\frac1{pq}$ For $x,y\in\mathbb{N}$ how many ordered pairs $\left(x,y\right)$ satisfy   $\dfrac{1}{x}+\dfrac{1}{y}=\dfrac{1}{pq}$ where $p,q$ are distinct primes? I am not sure of the meaning of this sentence:     The significance of culture and identity in development has to do not so much with the cultural factor in the process of development as with abandoning Eurocentric development thinking.   I'm not sure what the use of as is supposed to convey. Does it mean "development has to do not so much ... as with abandoning", i.e. not as much as abandoning? Does the abandoning have more to do with it?  And the second question: Why does it use "has to do not so much". Why not "has not so much to do"? Is "have to" a verb? Is there a way to show the history of packages that were changed by apt-get via command line? I have the following code that will remove lines with the pattern banana and 2 lines after it:  sed '/banana/I,+2 d' file   So far, so good! But I need it to remove 2 lines before banana, but I can't get it with a “minus sign” or whatever (similar to what grep -v -B2 banana file should do but doesn't):  teresaejunior@localhost ~ &gt; LC_ALL=C sed '-2,/banana/I d' file sed: invalid option -- '2' teresaejunior@localhost ~ &gt; LC_ALL=C sed '/banana/I,-2 d' file sed: -e expression #1, char 16: unexpected `,' teresaejunior@localhost ~ &gt; LC_ALL=C sed '/banana/I,2- d' file sed: -e expression #1, char 17: unknown command: `-'