text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
You have an ascending list of numbers, what is the most efficient algorithm you can think of to get the ascending list of sums of every two numbers in that list. Duplicates in the resulting list are irrelevant, you can remove them or avoid them if you like.
To be clear, I'm interested in the algorithm. Feel free to post code in any language and paradigm that you like.
Edit as of 2018: You should probably stop reading this. (But I can't delete it as it is accepted.)
If you write out the sums like this:
```
1 4 5 6 8 | [
0.16522198915481567,
0.22464852035045624,
0.29310140013694763,
-0.04304226487874985,
-0.02573801763355732,
0.13261981308460236,
0.2812272608280182,
-0.16306927800178528,
-0.7013393044471741,
-0.5185706615447998,
0.007061600685119629,
0.3158383369445801,
-0.35818466544151306,
0.435266166925... | |
9
---------------
2 5 6 7 9 10
8 9 10 12 13
10 11 13 14
12 14 15
16 17
18
```
You'll notice that since M[i,j] <= M[i,j+1] and M[i,j] <= M[i+1,j], then you only need to examine the top left "corners" and choose the lowest one.
e.g.
* only 1 top left corner, pick 2
* only 1, pick 5
* 6 or 8, pick 6
* 7 or | [
-0.46373093128204346,
0.3586893677711487,
0.4655988812446594,
0.0730820894241333,
0.18020468950271606,
0.3869006335735321,
0.20510098338127136,
-0.2953420877456665,
-0.42881184816360474,
-0.524696409702301,
-0.3313446044921875,
0.2414710521697998,
0.002916032215580344,
0.14896966516971588,... | |
8, pick 7
* 9 or 8, pick 8
* 9 or 9, pick both :)
* 10 or 10 or 10, pick all
* 12 or 11, pick 11
* 12 or 12, pick both
* 13 or 13, pick both
* 14 or 14, pick both
* 15 or 16, pick 15
* only 1, pick 16
* only 1, pick 17
* only 1, pick 18
Of course, when you have *lots* of top left corners then this solution devolves.
I'm pretty sure this problem is Ω(n²), because you have to calculate the sums for each M[i,j] -- unless someone has a better algorithm for the summation :) | [
-0.5383309721946716,
-0.1333404779434204,
0.3731248080730438,
-0.11497517675161362,
0.05112443491816521,
0.6119652390480042,
0.06551710516214371,
-0.5305418372154236,
-0.825752854347229,
-0.3642025291919708,
-0.06641547381877899,
0.23166432976722717,
-0.27038222551345825,
-0.01856759190559... | |
I'm trying to setup CruiseControl.net at the moment. So far it works nice, but I have a Problem with the MSBuild Task.
According to the [Documentation](http://confluence.public.thoughtworks.org/display/CCNET/MsBuild+Task), it passes CCNetArtifactDirectory to MSBuild. But how do I use it?
I tried this:
```
<buildArgs>
/noconsolelogger /p:OutputPath=$(CCNetArtifactDirectory)\test
</buildArgs>
```
But that does not work. In fact, it kills the service with this error:
> ThoughtWorks.CruiseControl.Core.Config.Preprocessor.EvaluationException: Reference to unknown symbol CCNetArtifactDirectory
Documentation is rather sparse, and google und mainly offers modifying the .sln Project file, which is what I want to avoid in order to be able to manually build this project later - I would really prefer `/p:OutputPath`.
The CCNetArtifactDirectory is | [
-0.06111299619078636,
-0.18013420701026917,
0.9370758533477783,
0.059931982308626175,
0.09617780894041061,
-0.2886173129081726,
0.21517203748226166,
-0.17321506142616272,
-0.3181474506855011,
-0.6903582215309143,
0.1973099261522293,
0.5473187565803528,
-0.00839352235198021,
0.1117199510335... | |
passed to the MSBuild by default, so you dont need to worry about it. MSBuild will place the build output in the "bin location" relevant to the working directory that you have specified.
```
<executable>c:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>C:\data\projects\FooSolution\</workingDirectory>
<projectFile>FooSolution.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Debug </buildArgs>
```
So in the above example your build output will be put in C:\data\projects\FooSolution[ProjectName]\bin\Debug. Should you want to output to a different location you may want to look at of the tag in CCNET.
```
<publishers>
<xmllogger />
<buildpublisher>
<sourceDir>C:\data\projects\FooSolution\FooProject\bin\Debug</sourceDir>
<publishDir>C:\published\FooSolution\</publishDir>
<useLabelSubDirectory>false</useLabelSubDirectory>
</buildpublisher>
</publishers>
```
This will allow you to publish your output to a different location. | [
0.01068821456283331,
0.13230009377002716,
0.6593997478485107,
-0.2641075849533081,
-0.03387249633669853,
-0.12469089031219482,
0.10969387739896774,
-0.33206993341445923,
0.06094450131058693,
-0.7530515789985657,
-0.5081497430801392,
0.20127937197685242,
-0.38574495911598206,
0.136691272258... | |
Suppose I have the following CSS rule in my page:
```css
body {
font-family: Calibri, Trebuchet MS, Helvetica, sans-serif;
}
```
How could I detect which one of the defined fonts were used in the user's browser?
For people wondering why I want to do this is because the font I'm detecting contains glyphs that are *not* available in other fonts. If the user does *not* have the font, then I want it to display a link asking the user to download that font (so they can use my web application with the correct font).
Currently, I am displaying the download font link for | [
0.12999321520328522,
0.4036041796207428,
0.2690146863460541,
-0.04563991725444794,
-0.23541782796382904,
0.30052438378334045,
0.12015140056610107,
-0.007779821287840605,
-0.14985431730747223,
-0.9207096099853516,
-0.05031353980302811,
0.3440881669521332,
-0.2566293776035309,
0.111996032297... | |
all users. I want to only display this for people who do *not* have the correct font installed.
I've seen it done in a kind of iffy, but pretty reliable way. Basically, an element is set to use a specific font and a string is set to that element. If the font set for the element does not exist, it takes the font of the parent element. So, what they do is measure the width of the rendered string. If it matches what they expected for the desired font as opposed to the derived font, it's present. This won't work for | [
0.3661050498485565,
0.16092053055763245,
0.3453916907310486,
0.17763175070285797,
0.07027878612279892,
-0.08987763524055481,
0.354487806558609,
0.011531253345310688,
0.06491123884916306,
-0.7674919366836548,
0.006907116621732712,
0.5382847785949707,
-0.37724968791007996,
-0.112130321562290... | |
monospaced fonts.
Here's where it came from:
[Javascript/CSS Font Detector (ajaxian.com; 12 Mar 2007)](http://ajaxian.com/archives/javascriptcss-font-detector) | [
-0.19366170465946198,
0.16103395819664001,
0.2174602448940277,
-0.240587517619133,
-0.6890420913696289,
0.295884370803833,
0.4767020046710968,
-0.10554548352956772,
-0.30967339873313904,
-0.5476839542388916,
-0.029512502253055573,
0.30483031272888184,
-0.49494409561157227,
-0.0632893741130... | |
Is there an easy way to produce MSDN-style documentation from the Visual Studio XML output?
I'm not patient enough to set up a good xslt for it because I know I'm not the first person to cross this bridge.
Also, I tried setting up sandcastle recently, but it really made my eyes cross. Either I was missing something important in the process or it is just way too involved.
I know somebody out there has a really nice dead-simple solution.
I'm reiterating here because I think my formatting made that paragraph non-inviting to read:
> I gave sandcastle a try but had | [
0.37174972891807556,
0.27829667925834656,
0.16025802493095398,
0.1547771543264389,
-0.22809791564941406,
-0.23421740531921387,
0.27610528469085693,
0.04598034545779228,
-0.31042516231536865,
-0.549966037273407,
0.31133055686950684,
0.45494911074638367,
-0.14442786574363708,
0.0399422422051... | |
a really hard time getting it set up.
> What I really have in mind is something much simpler.
That is, unless I just don't understand the sandcastle process. It seemed like an awful lot of extra baggage to me just to produce something nice for the testers to work with.
You're looking for Sandcastle
Project Page: [Sandcastle Releases](http://www.codeplex.com/Sandcastle/Release/ProjectReleases.aspx)
Blog: [Sandcastle Blog](http://blogs.msdn.com/sandcastle/default.aspx)
[NDoc Code Documentation Generator for .NET](http://ndoc.sourceforge.net) used to be the tool of choice, but support has all but stopped. | [
0.5460116863250732,
-0.16905184090137482,
0.27488377690315247,
-0.26028549671173096,
-0.1808975636959076,
-0.16356545686721802,
0.11456988751888275,
-0.0534970723092556,
-0.4193679094314575,
-0.3890419602394104,
-0.0005203300388529897,
0.44229885935783386,
-0.047708116471767426,
0.03469410... | |
I have imported the `kernel32` library. So, I have the `createMutex` function available but I am not quite sure of the various parameters and return values.
This is classic Visual Basic, not Visual Basic.NET but I can probably work with either language in the form of an answer.
The VB code looks something like this:
```
hMutex = CreateMutex(ByVal 0&, 1, ByVal 0&)
```
The first parameter is a pointer to an `SECURITY_ATTRIBUTES` structure. If you don't know what it is, you don't need it. Pass NULL (0).
The second parameter is `TRUE` (non-zero, or 1) if the calling thread should take ownership of the mutex. `FALSE` | [
0.5804297924041748,
0.26420313119888306,
0.22768086194992065,
-0.23531828820705414,
-0.06108705699443817,
0.16771681606769562,
0.3202663064002991,
-0.32841676473617554,
0.13253168761730194,
-0.5603337287902832,
0.04910406470298767,
0.6686449646949768,
-0.5983554124832153,
0.041335515677928... | |
otherwise.
The third parameter is the mutex name and may be NULL (0), as shown. If you need a named mutex, pass the name (anything unique) in. Not sure whether the `VB` wrapper marshals the length-prefixed `VB` string type (`BSTR`) over to a null-terminated Ascii/Unicode string if not, you'll need to do that and numerous examples are out there.
Good luck! | [
0.27689042687416077,
0.19699528813362122,
0.15582963824272156,
-0.24805612862110138,
-0.10114094614982605,
0.05368626490235329,
0.5859176516532898,
0.07979021221399307,
-0.2601025700569153,
-0.3109240233898163,
-0.18873879313468933,
0.468903124332428,
-0.174250528216362,
0.3958603739738464... | |
Often while editing config files, I'll open one with vi and then when I go to save it realize that I didn't type
```
sudo vi filename
```
Is there any way to give vi sudo privileges to save the file? I seem to recall seeing something about this while looking up some stuff about vi a while ago, but now I can't find it.
`%` is replaced with the current file name, thus you can use:
```
:w !sudo tee %
```
(`vim` will detect that the file has been changed and ask whether you want to it to be reloaded. Say yes by choosing `[L]` rather than | [
0.307625949382782,
-0.052826106548309326,
0.44134336709976196,
0.003946507349610329,
-0.05482890456914902,
-0.17416353523731232,
0.17261068522930145,
-0.14061979949474335,
-0.3266671597957611,
-0.627636194229126,
-0.19677311182022095,
0.5331789255142212,
-0.22736862301826477,
0.56715351343... | |
OK.)
As a shortcut, you can define your own command. Put the following in your `.vimrc`:
```
command W w !sudo tee % >/dev/null
```
With the above you can type `:W<Enter>` to save the file. Since I wrote this, I have found a nicer way (in my opinion) to do this:
```
cmap w!! w !sudo tee >/dev/null %
```
This way you can type `:w!!` and it will be expanded to the full command line, leaving the cursor at the end, so you can replace the `%` with a file name of your own, if you like. | [
0.06735052913427353,
-0.08131152391433716,
0.37930017709732056,
-0.13197992742061615,
-0.004269078839570284,
-0.19540847837924957,
0.1794358342885971,
0.02597954124212265,
-0.1507929414510727,
-0.7065953612327576,
-0.3754046857357025,
0.5621314644813538,
-0.10480134934186935,
0.10625368356... | |
I need to grab the `base64-encoded` representation of the `ViewState`. Obviously, this would not be available until fairly late in the request lifecycle, which is OK.
For example, if the output of the page includes:
```
<input type="hidden" name="__VIEWSTATE"
id="__VIEWSTATE" value="/wEPDwUJODU0Njc5MD...==" />
```
I need a way on the server-side to get the value `"/wEPDwUJODU0Njc5MD...=="`
To clarify, I need this value when the page is being rendered, not on PostBack. e.g. I need to know the ViewState value that is being *sent* to the client, not the ViewState I'm getting back from them.
Rex, I suspect a good place to start looking is solutions that | [
0.047144945710897446,
0.20938971638679504,
0.6330286860466003,
0.01997065730392933,
0.14671985805034637,
-0.06563311070203781,
0.18186327815055847,
-0.019317371770739555,
-0.24829603731632233,
-0.8807610869407654,
-0.11389748007059097,
0.7692978978157043,
-0.08979742974042892,
0.2234044522... | |
**compress the ViewState** -- they're grabbing ViewState on the server before it's sent down to the client and gzipping it. That's exactly where you want to be.
* [Scott Hanselman on ViewState Compression](http://www.hanselman.com/blog/CommentView,guid,febce059-7e7c-439e-af3d-c53d250b3e9c.aspx) (2005)
* [ViewState Compression with System.IO.Compression](http://www.bloggingdeveloper.com/post/How-To-Compress-ViewState-in-ASPNET-20-ViewState-Compression-with-SystemIOCompression.aspx) (2007) | [
-0.3996570110321045,
-0.04267987608909607,
0.5629913806915283,
-0.07148584723472595,
-0.04852024465799332,
0.09921237826347351,
-0.10921646654605865,
-0.34340786933898926,
-0.5915383696556091,
-0.5645968317985535,
-0.3756447434425354,
0.5530928373336792,
-0.21293632686138153,
-0.0109117813... | |
After upgrading a rails 1.2 website to 2.1, the [ExceptionNotifier plugin](http://agilewebdevelopment.com/plugins/exception_notifier) no longer works, complaining about this error:
> ActionView::TemplateFinder::InvalidViewPath: Unprocessed view path
> found:
> "/path/to/appname/vendor/plugins/exception\_notification/lib/../views".
> Set your view paths with #append\_view\_path, #prepend\_view\_path, or #view\_paths=.
What causes it and how do I fix it?
You ought to upgrade to the newest Exception Notification plugin which is in [its new home at GitHub](http://github.com/rails/exception_notification/tree/master). | [
-0.015888262540102005,
-0.09244818985462189,
0.3954240679740906,
-0.17368145287036896,
-0.09577344357967377,
-0.18935105204582214,
0.5712823271751404,
-0.04027605056762695,
-0.12481022626161575,
-0.8540394306182861,
-0.21414411067962646,
0.3304208517074585,
-0.3009151518344879,
-0.00439104... | |
For instance, my query is like the following using SQL Server 2005:
```
SELECT * FROM Table WHERE FREETEXT(SearchField, 'c#')
```
I have a full text index defined to use the column SearchField which returns results when using:
```
SELECT * FROM Table WHERE SearchField LIKE '%c#%'
```
I believe # is a special letter, so how do I allow FREETEXT to work correctly for the query above?
The # char is indexed as punctuation and therefore ignored, so it looks like we'll remove the letter C from our word indexing ignore lists.
Tested it locally after doing that and rebuilding the indexes and I get results!
Looking at using | [
-0.21214479207992554,
0.29108548164367676,
0.31068146228790283,
-0.11469671875238419,
-0.5004315972328186,
0.043230120092630386,
0.33004340529441833,
-0.19515274465084076,
-0.049165479838848114,
-0.4662480056285858,
0.01514521986246109,
0.5336052775382996,
-0.375611811876297,
0.00394188985... | |
a different word breaker language on the indexed column, so that those special characters aren't ignored.
EDIT: I also found [this information](http://www.simple-talk.com/sql/learn-sql-server/sql-server-full-text-search-language-features/):
> c# is indexed as c (if c is not in your noise word list, see more on noise word lists later), but C# is indexed as C# (in SQL 2005 and SQL 2000 running on Win2003 regardless if C or c is in your noise word list). It is not only C# that is stored as C#, but any capital letter followed by #. Conversely, c++ ( and any other lower-cased letter followed by a ++) is indexed as | [
0.03730853274464607,
0.18762877583503723,
-0.10123038291931152,
-0.04812629520893097,
-0.5257924795150757,
-0.06511744856834412,
0.22358527779579163,
-0.39469271898269653,
-0.3564068675041199,
-0.14488090574741364,
-0.24106211960315704,
0.45332714915275574,
-0.5199090242385864,
0.025251120... | |
c (regardless of whether c is in your noise word list). | [
0.393466591835022,
0.15994782745838165,
0.0941467434167862,
-0.11317076534032822,
-0.11562660336494446,
-0.09259175509214401,
0.10886002331972122,
-0.08899188041687012,
-0.29507166147232056,
-0.351975679397583,
-0.22877629101276398,
0.2967347800731659,
-0.25446462631225586,
0.0343363806605... | |
What is the correct way to get the process size on `Solaris, HP-UX` and `AIX`? Should we use `top` or `ps -o vsz` or something else?
The exact definitions of `vsize`, `rss`, `rprvt`, `rshrd`, and other obscure-looking abbreviations vary from OS to OS. The manual pages for the `top` and `ps` commands will have some sort of description, but all such descriptions are simplified greatly (or are based on long-extinct kernel implementations).
"Process size" as a concept is fiendishly difficult to pin down in the general case. Answers in specific instances depend heavily on the actual memory management implementation in | [
0.15113577246665955,
0.006420325953513384,
0.48978638648986816,
0.13605643808841705,
0.08089537173509598,
0.27710071206092834,
-0.1553647816181183,
-0.003135362174361944,
-0.5909598469734192,
-0.6286303400993347,
-0.23312437534332275,
0.3776826560497284,
0.03552912175655365,
0.270691812038... | |
the OS, and are rarely as satisfying as the tidy "process size" concept that exists in the minds of most users (and most developers).
For example, none of those numbers (nor, likely, any combination of them) can be used to tell you exactly how many such processes can run at once in a given amount of free memory. But really, your best bet is to come at it from that end: why do you want this number, and what will you use it for? Given that information, I think you'll get more useful answers. | [
0.12505272030830383,
0.23346377909183502,
-0.07587544620037079,
0.5537482500076294,
0.20962823927402496,
0.13259397447109222,
0.029298104345798492,
0.36196839809417725,
-0.5480706691741943,
-0.4376927316188812,
-0.10263825953006744,
0.504509687423706,
-0.03512999042868614,
0.06285647302865... | |
I was wondering if there is any good and clean object-oriented programming (OOP) implementation of Bayesian filtering for spam and text classification? This is just for learning purposes.
I definitely recommend [Weka](http://www.cs.waikato.ac.nz/ml/weka/) which is an *Open Source Data Mining Software* written in Java:
> Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes.
As mentioned above, it ships with a | [
0.4892507791519165,
-0.07465478032827377,
-0.27553674578666687,
0.21926742792129517,
-0.05315859615802765,
-0.17329160869121552,
0.11185410618782043,
-0.363415002822876,
0.013084666803479195,
-0.48700350522994995,
0.08875809609889984,
-0.0545998252928257,
-0.2180236279964447,
-0.0818809047... | |
bunch of different classifiers like [SVM](http://en.wikipedia.org/wiki/Support_vector_machine), [Winnow](http://en.wikipedia.org/wiki/Winnow_%28algorithm%29), [C4.5](http://en.wikipedia.org/wiki/C4.5_algorithm), Naive Bayes (of course) and many more (see the [API doc](http://weka.sourceforge.net/doc/)).
Note that a lot of classifiers are known to have **much better perfomance than Naive Bayes** in the field of spam detection or text classification.
Furthermore Weka brings you a very [powerful GUI](http://www.cs.waikato.ac.nz/~ml/weka/gui_explorer.html)… | [
0.18679074943065643,
-0.0880805253982544,
-0.04428056254982948,
0.23490066826343536,
-0.5497913956642151,
0.08894124627113342,
0.30748945474624634,
-0.0980190858244896,
-0.33856257796287537,
-0.5559815764427185,
0.02222141996026039,
0.5472952723503113,
-0.21083885431289673,
0.0470026805996... | |
Back in the old days, Help was not trivial but possible: generate some funky .rtf file with special tags, run it through a compiler, and you got a WinHelp file (.hlp) that actually works really well.
Then, Microsoft decided that WinHelp was not hip and cool anymore and switched to CHM, up to the point they actually axed WinHelp from Vista.
Now, CHM maybe nice, but everyone that tried to open a .chm file on the Network will know the nice "Navigation to the webpage was canceled" screen that is caused by security restrictions.
While there are ways to make CHM work off | [
0.23378321528434753,
0.1347237229347229,
0.5020664930343628,
0.344589501619339,
-0.2851333022117615,
-0.47709327936172485,
0.2131281942129135,
0.5863545536994934,
-0.148685485124588,
-0.43528252840042114,
-0.22707773745059967,
0.23248496651649475,
-0.18753202259540558,
0.47487911581993103,... | |
the network, this is hardly a good choice, because when a user presses the Help Button he wants help and not have to make some funky settings.
Bottom Line: I find CHM absolutely unusable. But with WinHelp not being an option anymore either, I wonder what the alternatives are, especially when it comes to integrate with my Application (i.e. for WinHelp and CHM there are functions that allow you to directly jump to a topic)?
PDF has the disadvantage of requiring the Adobe Reader (or one of the more lightweight ones that not many people use). I could live with that seeing | [
-0.20538322627544403,
-0.09515002369880676,
0.42236950993537903,
0.5434421300888062,
-0.2680233120918274,
-0.5063122510910034,
0.08317656069993973,
0.37862423062324524,
-0.41546955704689026,
-0.7541716694831848,
-0.09694879502058029,
0.9029679298400879,
-0.23890402913093567,
-0.11665464192... | |
as this is kind of standard nowadays, but can you tell it reliably to jump to a given page/anchor?
HTML files seem to be the best choice, you then just have to deal with different browsers (CSS and stuff).
*Edit:* I am looking to create my own Help Files. As I am a fan of the "No Setup, Just Extract and Run" Philosophy, i had that problem many times in the past because many of my users will run it off the network, which causes exactly this problem.
So i am looking for a more robust and future-proof way to provide help to | [
0.5323234796524048,
-0.13828757405281067,
-0.007173494901508093,
0.25587859749794006,
-0.15835238993167877,
-0.10345429927110672,
0.5182095766067505,
0.227208212018013,
-0.4442397952079773,
-0.5961532592773438,
-0.0904247835278511,
0.47330427169799805,
-0.18119585514068604,
-0.238798320293... | |
my users without having to code a different help system for each application i make.
CHM is a really nice format, but that Security Stuff makes it unusable, as a Help system is supposed to provide help to the user, not to generate even more problems.
HTML would be the next best choice, ONLY IF you would serve them from a public web server. If you tried to bundle it with your app, all the files (and images (and stylesheets (and ...) ) ) would make CHM look like a gift from gods.
That said, when actually bundled in the installation package, (instead | [
0.6976091861724854,
0.2733774483203888,
0.5051711797714233,
0.32280784845352173,
-0.11452557891607285,
-0.002748377388343215,
0.017634328454732895,
0.339413046836853,
-0.1875607967376709,
-0.5945824384689331,
-0.10289939492940903,
0.322309672832489,
0.0536213293671608,
-0.01156029663980007... | |
of being served over the network), I found the CHM files to work nicely.
OTOH, another pitfall about CHM files: Even if you try to open a CHM file on a **local** disk, you may bump into the security block if you initially downloaded it from somewhere, because the file could be marked as "came from external source" when it was obtained. | [
0.5317922234535217,
0.19137416779994965,
0.14547620713710785,
0.0776071846485138,
-0.32335346937179565,
-0.25015538930892944,
0.3180807828903198,
0.28806933760643005,
-0.46536552906036377,
-0.42527836561203003,
0.12321051955223083,
0.5953222513198853,
0.32017782330513,
0.4019455909729004,
... | |
I've tried to write a string replace function in C, which works on a `char *`, which has been allocated using `malloc()`. It's a little different in that it will find and replace strings, rather than characters in the starting string.
It's trivial to do if the search and replace strings are the same length (or the replace string is shorter than the search string), since I have enough space allocated. If I try to use `realloc()`, I get an error that tells me I am doing a double free - which I don't see how I am, since I am | [
0.16952641308307648,
0.0955457016825676,
0.20229525864124298,
-0.15808770060539246,
-0.03806758671998978,
-0.027898596599698067,
0.3283557593822479,
-0.006206011865288019,
-0.12557709217071533,
-0.2652546763420105,
-0.23563314974308014,
0.6253615021705627,
-0.5483773350715637,
-0.054582670... | |
only using `realloc()`.
Perhaps a little code will help:
```
void strrep(char *input, char *search, char *replace) {
int searchLen = strlen(search);
int replaceLen = strlen(replace);
int delta = replaceLen - searchLen;
char *find = input;
while (find = strstr(find, search)) {
if (delta > 0) {
realloc(input, strlen(input) + delta);
find = strstr(input, search); | [
-0.2206275910139084,
-0.39227020740509033,
0.8487139344215393,
-0.37778040766716003,
0.41494321823120117,
0.10295908153057098,
0.20110934972763062,
-0.15440088510513306,
-0.3149290978908539,
-0.548683762550354,
-0.4550774097442627,
0.9226577877998352,
-0.39419978857040405,
-0.1541442871093... | |
}
memmove(find + replaceLen, find + searchLen, strlen(input) - (find - input));
memmove(find, replace, replaceLen);
}
}
```
The program works, until I try to `realloc()` in an instance where the replaced string will be longer than the initial string. (It still kind of works, it just spits out errors as well as the result).
If it helps, the calling code looks like:
```
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void strrep(char *input, char *search, char *replace);
int | [
0.056360162794589996,
0.0434902086853981,
0.7007880806922913,
-0.2768028974533081,
0.2991882264614105,
-0.022163864225149155,
0.49030688405036926,
-0.30275678634643555,
-0.19453774392604828,
-0.5351792573928833,
-0.25790008902549744,
0.9983632564544678,
-0.5238550305366516,
-0.016938157379... | |
main(void) {
char *input = malloc(81);
while ((fgets(input, 81, stdin)) != NULL) {
strrep(input, "Noel", "Christmas");
}
}
```
As a general rule, you should **never** do a free or realloc on a user provided buffer. You don't know where the user allocated the space (in your module, in another DLL) so you cannot use any of the allocation functions on a user buffer.
Provided that you now cannot do any reallocation within your function, you should change its behavior a little, like doing only one replacement, so | [
0.005048471037298441,
-0.2618360221385956,
0.2051268070936203,
-0.29298117756843567,
0.2848661541938782,
0.09354677051305771,
0.5304743051528931,
0.29131826758384705,
-0.4626927971839905,
-0.3648684322834015,
-0.43231475353240967,
0.18260280787944794,
-0.4184691607952118,
0.354516297578811... | |
the user will be able to compute the resulting string max length and provide you with a buffer long enough for this one replacement to occur.
Then you could create another function to do the multiple replacements, but you will have to allocate the whole space for the resulting string and copy the user input string. Then you must provide a way to delete the string you allocated.
Resulting in:
```
void strrep(char *input, char *search, char *replace);
char* strrepm(char *input, char *search, char *replace);
void strrepmfree(char *input);
``` | [
0.3070370852947235,
0.015354354865849018,
0.6735363602638245,
0.020520836114883423,
0.19683115184307098,
0.2728894352912903,
0.33999383449554443,
-0.389912486076355,
-0.33700114488601685,
-0.36453741788864136,
-0.44481703639030457,
0.7768191695213318,
-0.5078179240226746,
-0.19181431829929... | |
I am using CCNET on a sample project with SVN as my source control. CCNET is configured to create a build on every check in. CCNET uses MSBuild to build the source code.
I would like to use the latest revision number to generate `AssemblyInfo.cs` while compiling.
How can I retrieve the latest revision from subversion and use the value in CCNET?
Edit: I'm not using NAnt - only MSBuild.
CruiseControl.Net 1.4.4 has now an [Assembly Version Labeller](http://confluence.public.thoughtworks.org/display/CCNET/Assembly+Version+Labeller), which generates version numbers compatible with .Net assembly properties.
In my project I have it configured as:
```
<labeller type="assemblyVersionLabeller" incrementOnFailure="true" major="1" minor="2"/>
```
(Caveat: `assemblyVersionLabeller` won't start generating svn revision | [
0.3809341788291931,
0.07371463626623154,
0.556656002998352,
-0.25471872091293335,
0.08977392315864563,
-0.22622497379779816,
0.16666704416275024,
-0.2040671408176422,
-0.37539178133010864,
-0.5825708508491516,
0.15981364250183105,
0.5335373878479004,
-0.23053205013275146,
0.396335542201995... | |
based labels until an actual commit-triggered build occurs.)
and then consume this from my MSBuild projects with [MSBuildCommunityTasks.AssemblyInfo](http://msbuildtasks.tigris.org/) :
```
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<Target Name="BeforeBuild">
<AssemblyInfo Condition="'$(CCNetLabel)' != ''" CodeLanguage="CS" OutputFile="Properties\AssemblyInfo.cs"
AssemblyTitle="MyTitle" AssemblyCompany="MyCompany" AssemblyProduct="MyProduct"
AssemblyCopyright="Copyright © 2009" ComVisible="false" Guid="some-random-guid"
AssemblyVersion="$(CCNetLabel)" AssemblyFileVersion="$(CCNetLabel)"/>
</Target>
```
For sake of completness, it's just as easy for projects using NAnt instead of MSBuild:
```
<target name="setversion" description="Sets the version number to CruiseControl.Net label.">
<script language="C#">
<references>
<include name="System.dll" />
</references> | [
0.0833924412727356,
-0.1272870898246765,
0.7761431336402893,
0.1743827760219574,
0.05023685842752457,
-0.20013488829135895,
0.08113523572683334,
-0.15921850502490997,
-0.5809234976768494,
-0.4771957993507385,
0.02902565896511078,
0.4414374828338623,
-0.05811101570725441,
0.1893091350793838... | |
<imports>
<import namespace="System.Text.RegularExpressions" />
</imports>
<code><![CDATA[
[TaskName("setversion-task")]
public class SetVersionTask : Task
{
protected override void ExecuteTask() | [
0.23544663190841675,
-0.42782509326934814,
0.08406910300254822,
-0.13248109817504883,
0.03904565051198006,
-0.02905050292611122,
0.24336624145507812,
-0.3324660658836365,
-0.28121820092201233,
-0.3035654127597809,
-0.3687039315700531,
0.5233994722366333,
-0.6156999468803406,
-0.02738287672... | |
{
StreamReader reader = new StreamReader(Project.Properties["filename"]);
string contents = reader.ReadToEnd();
reader.Close();
string replacement = "[assembly: AssemblyVersion(\"" + Project.Properties["CCNetLabel"] + "\")]"; | [
-0.23104862868785858,
-0.4532025158405304,
0.6815280914306641,
-0.08901780098676682,
0.1421334445476532,
0.1013123095035553,
0.15646116435527802,
-0.2617642879486084,
-0.009979919530451298,
-0.7390491962432861,
-0.6269595623016357,
0.581629753112793,
-0.6174973845481873,
0.4347932040691376... | |
string newText = Regex.Replace(contents, @"\[assembly: AssemblyVersion\("".*""\)\]", replacement);
StreamWriter writer = new StreamWriter(Project.Properties["filename"], false);
writer.Write(newText);
writer.Close();
}
}
]]> | [
-0.11475014686584473,
-0.3564065396785736,
0.5123960971832275,
-0.3001295030117035,
0.11178404092788696,
0.2323065996170044,
0.4325346052646637,
-0.1702594757080078,
0.15821610391139984,
-0.5406317710876465,
-0.22117190062999725,
0.6290603280067444,
-0.5041948556900024,
0.23332124948501587... | |
</code>
</script>
<foreach item="File" property="filename">
<in>
<items basedir="..">
<include name="**\AssemblyInfo.cs"></include>
</items>
</in>
<do>
<setversion-task /> | [
0.11523757129907608,
-0.11897018551826477,
-0.1256731152534485,
-0.0697765126824379,
-0.14423635601997375,
0.2748574912548065,
0.0476340614259243,
-0.544999897480011,
-0.5519306063652039,
-0.7321900725364685,
-0.3984721004962921,
0.02586382068693638,
-0.3922918438911438,
-0.104712918400764... | |
</do>
</foreach>
</target>
``` | [
0.1622401475906372,
0.529269814491272,
-0.11801672726869583,
-0.3230646252632141,
-0.22659307718276978,
0.05216864123940468,
0.09497785568237305,
-0.08488401025533676,
0.09882690757513046,
-0.6674802303314209,
-0.6314874887466431,
0.33689558506011963,
-0.21640050411224365,
-0.0049412082880... | |
I need to be able to manipulate a large (10^7 nodes) graph in python. The data corresponding to each node/edge is minimal, say, a small number of strings. What is the most efficient, in terms of ***memory and speed***, way of doing this?
A dict of dicts is more flexible and simpler to implement, but I intuitively expect a list of lists to be faster. The list option would also require that I keep the data separate from the structure, while dicts would allow for something of the sort:
```
graph[I][J]["Property"]="value"
```
What would you suggest?
---
Yes, I should have been a bit clearer on | [
0.09804047644138336,
0.15826086699962616,
0.23384736478328705,
0.07585108280181885,
-0.12329267710447311,
-0.018657606095075607,
0.10522139817476273,
-0.19315555691719055,
-0.175118088722229,
-0.9145944118499756,
-0.06905025988817215,
0.4304838478565216,
-0.2988505959510803,
-0.16557215154... | |
what I mean by efficiency. In this particular case I mean it in terms of random access retrieval.
Loading the data in to memory isn't a huge problem. That's done once and for all. The time consuming part is visiting the nodes so I can extract the information and measure the metrics I'm interested in.
I hadn't considered making each node a class (properties are the same for all nodes) but it seems like that would add an extra layer of overhead? I was hoping someone would have some direct experience with a similar case that they could share. After all, graphs | [
0.3183995187282562,
0.10923007130622864,
0.07622510194778442,
0.3922973573207855,
0.007176599465310574,
0.01347275823354721,
0.193740114569664,
0.1656436175107956,
-0.4855548143386841,
-0.8785921335220337,
0.288692444562912,
0.47250375151634216,
0.11060721427202225,
0.09943324327468872,
... | |
are one of the most common abstractions in CS.
I would strongly advocate you look at [NetworkX](http://networkx.github.com/). It's a battle-tested war horse and the first tool most 'research' types reach for when they need to do analysis of network based data. I have manipulated graphs with 100s of thousands of edges without problem on a notebook. Its feature rich and very easy to use. You will find yourself focusing more on the problem at hand rather than the details in the underlying implementation.
**Example of [Erdős-Rényi](http://en.wikipedia.org/wiki/Erd%C5%91s%E2%80%93R%C3%A9nyi_model) random graph generation and analysis**
```
"""
Create an G{n,m} random graph with n nodes and m edges
and report | [
0.23057211935520172,
0.28432604670524597,
0.20517712831497192,
0.2770155370235443,
-0.36080271005630493,
0.002302051056176424,
-0.08740546554327011,
-0.16933564841747284,
-0.4809195399284363,
-0.8773121237754822,
0.05530709773302078,
0.11946765333414078,
-0.41446319222450256,
0.31563809514... | |
some properties.
This graph is sometimes called the Erd##[m~Qs-Rényi graph
but is different from G{n,p} or binomial_graph which is also
sometimes called the Erd##[m~Qs-Rényi graph.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
__credits__ = """"""
# Copyright (C) 2004-2006 by
# Aric Hagberg
# Dan Schult
# Pieter Swart
# Distributed under the terms of the GNU Lesser General Public License
# http://www.gnu.org/copyleft/lesser.html
from networkx import *
import sys
n=10 # 10 nodes
m=20 # 20 edges
G=gnm_random_graph(n,m)
# some properties
print "node degree clustering"
for v in nodes(G):
print v,degree(G,v),clustering(G,v)
# print the adjacency list to | [
-0.38468360900878906,
0.2578582763671875,
0.4796455502510071,
-0.08497072756290436,
-0.22069743275642395,
-0.026973357424139977,
0.28224048018455505,
-0.3848152458667755,
-0.17624147236347198,
-0.6992246508598328,
-0.1719176471233368,
0.25085386633872986,
-0.26100876927375793,
0.1816752851... | |
terminal
write_adjlist(G,sys.stdout)
```
Visualizations are also straightforward:

More visualization: <http://jonschull.blogspot.com/2008/08/graph-visualization.html> | [
-0.3756214380264282,
-0.010055840946733952,
0.5945584774017334,
-0.15566396713256836,
-0.3050037622451782,
0.13677978515625,
0.15896724164485931,
0.16251473128795624,
-0.21355345845222473,
-0.8199047446250916,
0.08418767899274826,
0.5565397143363953,
-0.4177134335041046,
-0.159474879503250... | |
I am looking to allow users to control of subdomain of an app I am toying with, much like Basecamp where it is `customusername.seework.com`.
What is required on the `DNS` end to allow these to be created dynamically and be available instantly.
And how do you recommend dealing with this in the logic of the site? `Htaccess` rule to lookup the subdomain in the `DB`?
The way we do this is to have a 'catch all' for our domain name registered in DNS so that anything.ourdomain.com will point to our server.
With Apache you can set up a similar catch-all for your vhosts. | [
0.6890943050384521,
-0.1225687637925148,
0.39308151602745056,
0.1477704644203186,
-0.14516578614711761,
-0.4877457618713379,
0.3349180221557617,
0.17545457184314728,
-0.2610534429550171,
-0.5257212519645691,
-0.14759862422943115,
0.1489970088005066,
-0.3925832211971283,
0.7025662660598755,... | |
The ServerName must be a single static name but the ServerAlias directive can contain a pattern.
```
Servername www.ourdomain.com
ServerAlias *.ourdomain.com
```
Now all of the domains will trigger the vhost for our project. The final part is to decode the domain name actually used so that you can work out the username in your code, something like (PHP):
```
list( $username ) = explode( ".", $_SERVER[ "HTTP_HOST" ] );
```
or a RewriteRule as already suggested that silently maps user.ourdomain.com/foo/bar to www.ourdomain.com/foo/bar?user=user or whatever you prefer. | [
0.5762004852294922,
0.26158806681632996,
0.9452778697013855,
-0.06553401798009872,
0.06412719190120697,
-0.38619109988212585,
0.08078973740339279,
-0.07322893291711807,
-0.12051195651292801,
-0.47770750522613525,
-0.07497923821210861,
0.415231853723526,
-0.41937366127967834,
0.399859637022... | |
I have a client-server app where the client is on a Windows Mobile 6 device, written in C++ and the server is on full Windows and written in C#.
Originally, I only needed it to send messages from the client to the server, with the server only ever sending back an acknowledgement that it received the message. Now, I would like to update it so that the server can actually send a message to the client to request data. As I currently have it set up so the client is only in receive mode after it sends data to the | [
0.32207387685775757,
0.3078279495239258,
0.7945010662078857,
-0.17539779841899872,
0.005817517638206482,
0.18334832787513733,
0.16344961524009705,
0.26101207733154297,
-0.08597960323095322,
-0.6993449330329895,
-0.17702855169773102,
0.6107990145683289,
-0.26193708181381226,
0.3965495228767... | |
server, this doesn't allow for the server to send a request at any time. I would have to wait for client data. My first thought would be to create another thread on the client with a separate open socket, listening for server requests...just like the server already has in respect the client. Is there a way, within the same thread and using the same socket, to all the server to send requests at any time?
Can you use something to the effect of `WaitForMultipleObjects()` and pass it a receive buffer and an event that tells it there is data to be | [
0.4864145815372467,
-0.2640853524208069,
0.3322511315345764,
0.16051769256591797,
-0.2069280594587326,
-0.0243386123329401,
0.07789836078882217,
0.09015876054763794,
-0.4936966300010681,
-0.6748889088630676,
0.3456089496612549,
0.38834258913993835,
-0.338655024766922,
0.3604520559310913,
... | |
sent?
When I needed to write an application with a client-server model where the clients could leave and enter whenever they want, (I assume that's also the case for your application as you use mobile devices) I made sure that the clients send an *online* message to the server, indicating they were connected and ready to do whatever they needed doing.
at that time the server could send messages back to the client trough the same open connection.
Also, but I don't know if that is applicable for you, I had some sort of *heartbeat* the clients sent to the server, letting it | [
0.5356040596961975,
-0.1474185436964035,
0.392691969871521,
0.06611718982458115,
-0.47840407490730286,
0.19288484752178192,
0.18853545188903809,
0.1888957917690277,
-0.4799918532371521,
-0.17702561616897583,
0.22566653788089752,
0.24764113128185272,
-0.4710760712623596,
-0.0498009994626045... | |
know it was still online. That way the server knows when a client was forcibly disconnected from the network and it could mark that client back as offline. | [
0.4799294173717499,
-0.1769890934228897,
0.33201560378074646,
0.2814045548439026,
0.045125484466552734,
-0.3418194055557251,
0.2861619293689728,
0.332290917634964,
-0.264458566904068,
-0.10642537474632263,
0.2637975811958313,
0.15111877024173737,
0.0678001344203949,
0.20084914565086365,
... | |
My company is using CVS as our de-facto standard for source control. However, I've heard a lot of people say that SVN is better.
I know SVN is newer, but other than that, I'm unfamiliar with its benefits.
What I'm looking for is a good, succinct comparison of the two systems, noting any advantages or disadvantages of each in a Java/Eclipse development environment.
CVS only tracks modification on a file-by-file basis, while SVN tracks a whole commit as a new revision, which means that it is easier to follow the history of your project. Add the fact that all modern source control software | [
0.7555267214775085,
0.1227666363120079,
0.2882019579410553,
0.07938729971647263,
0.14707976579666138,
-0.48197513818740845,
-0.31736060976982117,
-0.08114904165267944,
-0.18707020580768585,
-0.30500414967536926,
-0.01350830402225256,
1.0853111743927002,
0.1855280101299286,
0.12271127849817... | |
use the concept of revision so it is far easier to migrate from SVN than it is from CVS.
There is also the atomic commit problem. While I only encountered it once, it is possible that 2 people committing together in CVS can conflict each other, losing some data and putting your client in an inconsistent state. When detected early, these problems are not major because your data is still out there somewhere, but it can be a pain in a stressful environment.
And finally, not many tools are developed around CVS anymore. While the new and shiny-new tools like Git or | [
0.09022386372089386,
0.014438032172620296,
0.17401671409606934,
0.23248641192913055,
0.06752989441156387,
-0.2664448618888855,
0.14235909283161163,
0.12806187570095062,
-0.5843954682350159,
-0.6129434704780579,
0.2172890454530716,
0.8735684752464294,
0.06611566245555878,
0.2686074674129486... | |
Mercurial definitely lack tools yet, SVN has a pretty large application base on any system.
**EDIT 2020**: Seriously, this answer is 12 years old now. Forget SVN, go use Git like everyone else! | [
-0.046731799840927124,
0.04592655599117279,
0.8718841075897217,
0.32908639311790466,
-0.010729855857789516,
-0.3283015191555023,
0.304923415184021,
0.4347744584083557,
-0.014250689186155796,
-0.7610372304916382,
0.06041480228304863,
0.7102748155593872,
0.2587456703186035,
0.238177657127380... | |
At what point does a MySQL database start to lose performance?
* Does physical database size matter?
* Do number of records matter?
* Is any performance degradation linear or exponential?
I have what I believe to be a large database, with roughly 15M records which take up almost 2GB. Based on these numbers, is there any incentive for me to clean the data out, or am I safe to allow it to continue scaling for a few more years?
The physical database size doesn't matter. The number of records don't matter.
In my experience the biggest problem that you are going to run in to | [
0.1477743238210678,
0.26823094487190247,
0.36163926124572754,
0.2728242576122284,
0.17753303050994873,
-0.11761587113142014,
0.34629613161087036,
0.07843531668186188,
-0.37930527329444885,
-0.7808673977851868,
0.30118319392204285,
0.31855306029319763,
0.12831467390060425,
0.169146552681922... | |
is not size, but the number of queries you can handle at a time. Most likely you are going to have to move to a master/slave configuration so that the read queries can run against the slaves and the write queries run against the master. However if you are not ready for this yet, you can always tweak your indexes for the queries you are running to speed up the response times. Also there is a lot of tweaking you can do to the network stack and kernel in Linux that will help.
I have had mine get up to 10GB, | [
0.16234712302684784,
-0.14352518320083618,
0.1232459768652916,
0.1706181764602661,
-0.07811540365219116,
0.006017045117914677,
0.08522360026836395,
-0.040408726781606674,
-0.4798469841480255,
-0.9644936919212341,
0.2354583442211151,
0.506064772605896,
-0.13070577383041382,
0.24795542657375... | |
with only a moderate number of connections and it handled the requests just fine.
I would focus first on your indexes, then have a server admin look at your OS, and if all that doesn't help it might be time to implement a master/slave configuration. | [
0.29932910203933716,
-0.2458747774362564,
0.2208714485168457,
0.3837534189224243,
-0.0029075343627482653,
0.02896845154464245,
0.006451346445828676,
0.14473320543766022,
-0.2554224133491516,
-0.8684913516044617,
0.35447999835014343,
0.5116009712219238,
-0.24678127467632294,
-0.032385423779... | |
I have a Queue<T> object that I have initialised to a capacity of 2, but obviously that is just the capacity and it keeps expanding as I add items. Is there already an object that automatically dequeues an item when the limit is reached, or is the best solution to create my own inherited class?
I've knocked up a basic version of what I'm looking for, it's not perfect but it'll do the job until something better comes along.
```
public class LimitedQueue<T> : Queue<T>
{
public int Limit { get; set; }
public LimitedQueue(int limit) : base(limit) | [
0.19435903429985046,
-0.318940132856369,
0.3830830454826355,
-0.06606166064739227,
0.11573964357376099,
0.05109550058841705,
0.09976165741682053,
0.044420138001441956,
-0.4151809811592102,
-0.6708577871322632,
0.06477189809083939,
0.33717626333236694,
-0.41665375232696533,
0.41511353850364... | |
{
Limit = limit;
}
public new void Enqueue(T item)
{
while (Count >= Limit)
{
Dequeue();
}
base.Enqueue(item);
}
}
``` | [
0.11762353777885437,
-0.27656251192092896,
0.29171469807624817,
-0.13146622478961945,
0.2617616653442383,
0.12029895186424255,
0.18662254512310028,
-0.265458881855011,
-0.1878703236579895,
-0.35455894470214844,
-0.41711413860321045,
0.5743048191070557,
-0.29630669951438904,
0.5026605725288... | |
[Original Question](https://stackoverflow.com/questions/180/function-for-creating-color-wheels)
I am looking for a function that attempts to quantify how "distant" (or distinct) two colors are. This question is really in two parts:
1. What color space best represents human vision?
2. What distance metric in that space best represents human vision (euclidean?)
Convert to La\*b\* (aka just plain "Lab", and you'll also see reference to "CIELAB"). A good quick measaure of color difference is
> (L1-L2)^2 + (a1-a2)^2 + (b1-b2)^2
Color scientists have other more refined measures, which may not be worth the bother, depending on accuracy needed for what you're doing.
The `a` and `b` values represent opposing colors in | [
0.3310000002384186,
-0.2838635742664337,
0.17058785259723663,
-0.0184972882270813,
0.14670498669147491,
0.23483806848526,
-0.18928317725658417,
-0.09288456290960312,
0.1187804639339447,
-0.5334275960922241,
-0.06915877759456635,
0.49411720037460327,
-0.3805689811706543,
-0.1166108399629592... | |
a way similar to how cones work, and may be negative or positive. Neutral colors - white, grays are `a=0`,`b=0`. The `L` is brightness defined in a particular way, from zero (pure darkness) up to whatever.
Crude explanation :>> Given a color, our eyes distinguish between two broad ranges of wavelength - blue vs longer wavelengths. and then, thanks to a more recent genetic mutation, the longer wavelength cones bifurcated into two, distinguishing for us red vs. green.
By the way, it'll be great for your career to rise above your color caveman collegues who know of only "RGB" or | [
0.416696161031723,
-0.1502409130334854,
-0.0899684950709343,
0.06177868694067001,
0.01965363137423992,
-0.051067985594272614,
-0.01660849340260029,
0.16008223593235016,
-0.2676106095314026,
-0.5887165665626526,
-0.01628466136753559,
0.5824167728424072,
-0.21108630299568176,
0.1735486537218... | |
"CMYK" which are great for devices but suck for serious perception work. I've worked for imaging scientists who didn't know a thing about this stuff!
For more fun reading on color difference theory, try:
* <http://white.stanford.edu/~brian/scielab/introduction.html> and info
* and links on color theory in general, websurf starting with <http://www.efg2.com/Lab/Library/Color/> and
* <http://www.poynton.com/Poynton-color.html>
More detail on Lab at <http://en.kioskea.net/video/cie-lab.php3> I can't at this time find a non-ugly page that actually had the conversion formulas but I'm sure someone will edit this answer to include one. | [
0.23984970152378082,
0.038236603140830994,
0.25279155373573303,
0.2066817432641983,
-0.15806987881660461,
0.051210351288318634,
-0.3106812536716461,
0.20614276826381683,
-0.20361225306987762,
-0.645353376865387,
0.26272082328796387,
0.23909875750541687,
0.023703450337052345,
0.231854096055... | |
We have been using CruiseControl for quite a while with NUnit and NAnt. For a recent project we decided to use the testing framework that comes with Visual Studio, which so far has been adequate.
I'm attempting to get the solution running in CruiseControl. I've finally got the build itself to work; however, I have been unable to get any tests to show up in the CruiseControl interface despite adding custom build tasks and components designed to do just that. Does anyone have a definitive link out there to instructions on getting this set up?
Not sure if that helps (i found | [
0.2763949930667877,
-0.034952402114868164,
0.5884225964546204,
0.0995461717247963,
0.052382368594408035,
-0.2544283866882324,
0.2642756402492523,
0.18692637979984283,
-0.12840820848941803,
-0.6865047812461853,
0.3039226531982422,
0.8213384747505188,
0.1923220008611679,
-0.03474980220198631... | |
the ccnet Documentation somewhat unhelpful at times):
[Using CruiseControl.NET with MSTest](http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+MSTest) | [
0.1911308914422989,
-0.4035334289073944,
0.41787031292915344,
0.41287997364997864,
0.13492918014526367,
-0.29541411995887756,
-0.20209144055843353,
-0.028901543468236923,
-0.4347042739391327,
-0.45163875818252563,
0.045727118849754333,
0.3394472002983093,
-0.04246294125914574,
0.0491505190... | |
I'm setting up a dedicated SQL Server 2005 box on Windows Server 2008 this week, and would like to pare it down to be as barebones as possible while still being fully functional.
To that end, the "Server Core" option sounds appealing, but I'm not clear about whether or not I can run SQL Server on that SKU. Several services are addressed on the [Microsoft website](http://www.microsoft.com/windowsserver2008/en/us/compare-core-installation.aspx), but I don't see any indication about SQL Server.
Does anyone know definitively?
Not sure how credible [this source is](http://www.builderau.com.au/program/windows/soa/Getting-started-with-Windows-Server-2008-Core-edition/0,339024644,339288700,00.htm), but:
> The Windows Server 2008 Core edition can:
>
>
> * Run the file server role.
> * | [
0.10467547923326492,
0.3643180727958679,
0.3277730345726013,
-0.05735032632946968,
-0.1699838638305664,
-0.1775902658700943,
0.2759845554828644,
0.020793484523892403,
-0.11242971569299698,
-0.4672459661960602,
0.020522259175777435,
0.44253775477409363,
-0.013409977778792381,
0.068124078214... | |
Run the Hyper-V virtualization server role.
> * Run the Directory Services role.
> * Run the DHCP server role.
> * Run the IIS Web server role.
> * Run the DNS server role.
> * Run Active Directory Lightweight Directory Services.
> * Run the print server role.
>
>
> The Windows Server 2008 Core edition cannot:
>
>
> * Run a SQL Server.
> * Run an Exchange Server.
> * Run Internet Explorer.
> * Run Windows Explorer.
> * Host a remote desktop session.
> * Run MMC snap-in consoles locally. | [
-0.2505533695220947,
0.09742356091737747,
0.5001749992370605,
0.02632262371480465,
-0.29836300015449524,
0.03408125787973404,
0.15291722118854523,
0.09460476040840149,
-0.33601614832878113,
-0.6574792861938477,
-0.1059998869895935,
0.5628243088722229,
-0.5137160420417786,
0.313582420349121... | |
I have a custom validation function in JavaScript in a user control on a .Net 2.0 web site which checks to see that the fee paid is not in excess of the fee amount due.
I've placed the validator code in the `ascx` file, and I have also tried using `Page.ClientScript.RegisterClientScriptBlock()` and in both cases the validation fires, but cannot find the JavaScript function.
The output in Firefox's error console is `"feeAmountCheck is not defined"`. Here is the function (this was taken directly from firefox->view source)
```
<script type="text/javascript">
function feeAmountCheck(source, arguments)
{ | [
0.5822252631187439,
0.25724494457244873,
0.6097816228866577,
-0.19702686369419098,
-0.17254942655563354,
-0.1921318620443344,
0.11504171788692474,
-0.6804821491241455,
0.057116225361824036,
-0.34142595529556274,
0.15690948069095612,
1.0278114080429077,
-0.1975582391023636,
-0.1295167058706... | |
var amountDue = document.getElementById('ctl00_footerContentHolder_Fees1_FeeDue');
var amountPaid = document.getElementById('ctl00_footerContentHolder_Fees1_FeePaid');
if (amountDue.value > 0 && amountDue >= amountPaid)
{
arguments.IsValid = true;
}
else
{
arguments.IsValid = false; | [
0.25856372714042664,
-0.17812740802764893,
0.932788610458374,
-0.39639654755592346,
0.1815829575061798,
0.07543997466564178,
0.05707359313964844,
-0.6363831758499146,
0.12363563477993011,
-0.4507370889186859,
-0.14839273691177368,
1.046862006187439,
-0.026192475110292435,
0.222166538238525... | |
}
return arguments;
}
</script>
```
Any ideas as to why the function isn't being found? How can I remedy this without having to add the function to my master page or consuming page?
Try changing the argument names to `sender` and `args`. And, after you have it working, switch the call over to `ScriptManager.RegisterClientScriptBlock`, regardless of AJAX use. | [
-0.0050093126483261585,
-0.08336778730154037,
0.29052290320396423,
-0.22328856587409973,
-0.2416960746049881,
-0.004936372395604849,
0.36368614435195923,
0.16416040062904358,
0.10843910276889801,
-0.9220795035362244,
-0.22266456484794617,
0.804356575012207,
-0.2539746165275574,
0.050466254... | |
Is it possible to configure [xampp](http://www.apachefriends.org/en/xampp.html) to serve up a file outside of the `htdocs` directory?
For instance, say I have a file located as follows:
`C:\projects\transitCalculator\trunk\TransitCalculator.php`
and my [xampp](http://www.apachefriends.org/en/xampp.html) files are normally served out from:
`C:\xampp\htdocs\`
(because that's the default configuration) Is there some way to make Apache recognize and serve up my `TransitCalculator.php` file without moving it under `htdocs`? Preferably I'd like Apache to serve up/have access to the entire contents of the projects directory, and I don't want to move the projects directory under `htdocs`.
edit: edited to add Apache to the question title to make Q/A more "searchable"
Ok, per [pix0r](https://stackoverflow.com/questions/1408/#2471)'s, [Sparks](https://stackoverflow.com/questions/1408/#1413)' and | [
0.1701178103685379,
0.08363469690084457,
0.24437403678894043,
0.12395912408828735,
-0.03968382254242897,
-0.2144671529531479,
0.0820431113243103,
-0.33223918080329895,
-0.2593371272087097,
-0.3419248163700104,
-0.18620462715625763,
0.14503160119056702,
0.08656366169452667,
-0.0633648037910... | |
[Dave](https://stackoverflow.com/questions/1408/#1414)'s answers it looks like there are three ways to do this:
---
[Virtual Hosts](https://stackoverflow.com/questions/1408/#2471)
---------------------------------------------------------------
1. Open C:\xampp\apache\conf\extra\httpd-vhosts.conf.
2. Un-comment ~line 19 (`NameVirtualHost *:80`).
3. Add your virtual host (~line 36):
```
<VirtualHost *:80>
DocumentRoot C:\Projects\transitCalculator\trunk
ServerName transitcalculator.localhost
<Directory C:\Projects\transitCalculator\trunk>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
```
4. Open your hosts file (C:\Windows\System32\drivers\etc\hosts).
5. Add
```
127.0.0.1 transitcalculator.localhost #transitCalculator
```
to the end of the file (before the Spybot - Search & Destroy stuff if you have that installed).
6. Save (You might have to save it to the | [
-0.15532581508159637,
-0.07594196498394012,
0.9656477570533752,
0.19925537705421448,
0.06752588599920273,
-0.1677473932504654,
0.41029053926467896,
0.17150452733039856,
-0.17140623927116394,
-0.8478460907936096,
-0.2513297200202942,
0.5351765751838684,
-0.27733296155929565,
0.2447586506605... | |
desktop, change the permissions on the old hosts file (right click > properties), and copy the new one into the directory over the old one (or rename the old one) if you are using Vista and have trouble).
7. Restart Apache.
Now you can access that directory by browsing to <http://transitcalculator.localhost/>.
---
[Make an Alias](https://stackoverflow.com/questions/1408/#1413)
---------------------------------------------------------------
1. Starting ~line 200 of your `http.conf` file, copy everything between `<Directory "C:/xampp/htdocs">` and `</Directory>` (~line 232) and paste it immediately below with `C:/xampp/htdocs` replaced with your desired directory (in this case `C:/Projects`) to give your server the correct permissions for the new directory.
2. Find the `<IfModule alias_module></IfModule>` section (~line | [
-0.1396031379699707,
0.018938792869448662,
1.0072479248046875,
0.08100789785385132,
0.2542765140533447,
-0.3351374566555023,
0.6047202348709106,
0.03370140865445137,
-0.45357996225357056,
-1.0057239532470703,
-0.3721570372581482,
0.7702504992485046,
-0.2013121396303177,
0.28263139724731445... | |
300) and add
```
Alias /transitCalculator "C:/Projects/transitCalculator/trunk"
```
(or whatever is relevant to your desires) below the `Alias` comment block, inside the module tags.
---
[Change your document root](https://stackoverflow.com/questions/1408/#1414)
---------------------------------------------------------------------------
1. Edit ~line 176 in C:\xampp\apache\conf\httpd.conf; change `DocumentRoot "C:/xampp/htdocs"` to `#DocumentRoot "C:/Projects"` (or whatever you want).
2. Edit ~line 203 to match your new location (in this case `C:/Projects`).
---
**Notes:**
* You have to use forward slashes "/" instead of back slashes "\".
* Don't include the trailing "/" at the end.
* *restart your server*. | [
-0.14637519419193268,
-0.09897579997777939,
1.1172748804092407,
-0.02741636335849762,
0.23681463301181793,
-0.14128181338310242,
0.21445320546627045,
-0.4383482336997986,
-0.05246163532137871,
-0.8915016651153564,
-0.3460155129432678,
0.6880701184272766,
-0.08199218660593033,
-0.3475964367... | |
My office has a central Source Safe 2005 install that we use for source control. I can't change what the office uses on the server.
I develop on a laptop and would like to have a different local source control repository that can sync with the central server (when available) regardless of the what that central provider is. The reason for the request is so I can maintain a local stable branch/build for client presentations while continuing to develop without having to jump through flaming hoops. Also, as a consultant, my clients may request that I use their source control | [
0.49140357971191406,
0.5663134455680847,
0.09085306525230408,
0.14785048365592957,
-0.050195492804050446,
-0.1558501124382019,
0.2330034375190735,
0.16934265196323395,
-0.06507006287574768,
-0.4761578142642975,
0.0568726472556591,
0.48458200693130493,
0.112836554646492,
0.184824138879776,
... | |
provider and flexibility here would make life easier.
Can any of the existing distributed source control clients handle that?
Well... KernelTrap has [something on this](http://kerneltrap.org/mailarchive/git/2008/5/27/1952124). Looks like you can use [vss2svn](http://www.pumacode.org/projects/vss2svn/wiki/RunningTheMigration) to pipe the Source Safe repo into a Subversion repository, then use the very nice git-svn to pull into a local git repo.
I would assume the commits back to VSS would not be a smooth, automatic process using this method. | [
0.133694589138031,
-0.3710970878601074,
-0.005506841465830803,
0.1521998941898346,
-0.23162499070167542,
-0.2327982634305954,
-0.01102419849485159,
0.033280376344919205,
-0.3678145706653595,
-0.5764589309692383,
-0.0561583936214447,
0.6347717642784119,
-0.01935054175555706,
0.1748892664909... | |
I'm looking for some way to effectively hide inherited members. I have a library of classes which inherit from common base classes. Some of the more recent descendant classes inherit dependency properties which have become vestigial and can be a little confusing when using *IntelliSense* or using the classes in a visual designer.
These classes are all controls that are written to be compiled for either WPF or Silverlight 2.0. I know about `ICustomTypeDescriptor` and `ICustomPropertyProvider`, but I'm pretty certain those can't be used in Silverlight.
It's not as much a functional issue as a usability issue. What should I do?
**Update**
Some | [
0.3962137997150421,
0.0571487657725811,
-0.05237087234854698,
0.2884066104888916,
0.17685328423976898,
-0.3024536073207855,
0.1960315853357315,
-0.0516979917883873,
0.07682094722986221,
-0.7930666208267212,
0.09553974866867065,
0.6963980197906494,
-0.08343189209699631,
0.15842995047569275,... | |
of the properties that I would really like to hide come from ancestors that are not my own and because of a specific tool I'm designing for, I can't do member hiding with the `new` operator. (I know, it's ridiculous)
Override them like Michael Suggests [above](https://stackoverflow.com/questions/1528/#1533) and to prevent folks from using the overridden (sp?) methods, mark them as obsolete:
```
[Obsolete("These are not supported in this class.", true)]
public override void dontcallmeanymore()
{
}
```
If the second parm is set to true, a compiler error will be generated if anyone tries to call that method and the string in the first parm is the message. | [
0.14851313829421997,
0.36707139015197754,
0.19191192090511322,
-0.21489563584327698,
0.2515965402126312,
-0.36243656277656555,
0.6195669174194336,
-0.19126318395137787,
-0.16298241913318634,
-0.3343166708946228,
-0.07212561368942261,
0.5056716203689575,
-0.24995480477809906,
0.578611314296... | |
If parm2 is false only a compiler warning will be generated. | [
0.12364648282527924,
0.41240328550338745,
0.11284061521291733,
-0.15381519496440887,
0.12567898631095886,
-0.36252251267433167,
0.5783612132072449,
-0.08179881423711777,
-0.17126557230949402,
-0.18872761726379395,
-0.23484377562999725,
0.47589242458343506,
-0.40646040439605713,
0.124398335... | |
I've never been completely happy with the way exception handling works, there's a lot exceptions and try/catch brings to the table (stack unwinding, etc.), but it seems to break a lot of the OO model in the process.
Anyway, here's the problem:
Let's say you have some class which wraps or includes networked file IO operations (e.g. reading and writing to some file at some particular UNC path somewhere). For various reasons you don't want those IO operations to fail, so if you detect that they fail you retry them and you keep retrying them until they succeed or you reach a | [
0.1570282131433487,
-0.04375343397259712,
-0.023355325683951378,
0.03021577000617981,
0.12267787009477615,
-0.24669750034809113,
0.28855374455451965,
0.06305018812417984,
-0.4486868679523468,
-0.601057231426239,
-0.21990123391151428,
0.5994988679885864,
-0.17372700572013855,
-0.08108036220... | |
timeout. I already have a convenient RetryTimer class which I can instantiate and use to sleep the current thread between retries and determine when the timeout period has elapsed, etc.
The problem is that you have a bunch of IO operations in several methods of this class, and you need to wrap each of them in try-catch / retry logic.
Here's an example code snippet:
```
RetryTimer fileIORetryTimer = new RetryTimer(TimeSpan.FromHours(10));
bool success = false;
while (!success)
{
try
{
// do some file IO which may succeed or fail | [
0.3252229690551758,
-0.2521253824234009,
0.35030773282051086,
-0.03012014366686344,
0.3899707496166229,
0.001718997023999691,
0.3498785197734833,
-0.309150755405426,
-0.3553546667098999,
-0.6031197905540466,
-0.04870496317744255,
0.5718653202056885,
-0.19963225722312927,
0.1763721406459808... | |
success = true;
}
catch (IOException e)
{
if (fileIORetryTimer.HasExceededRetryTimeout)
{
throw e;
}
fileIORetryTimer.SleepUntilNextRetry();
}
}
```
So, how do you avoid duplicating most of this code for every file IO operation throughout the class? My solution was to use anonymous delegate blocks and a single method in | [
0.35237565636634827,
-0.03337635099887848,
0.11083454638719559,
-0.1333760917186737,
0.3075180649757385,
-0.17883029580116272,
0.34939008951187134,
-0.4799744486808777,
-0.11795315891504288,
-0.5592744946479797,
-0.1289413869380951,
0.5863783955574036,
-0.23955138027668,
0.1502784043550491... | |
the class which executed the delegate block passed to it. This allowed me to do things like this in other methods:
```
this.RetryFileIO( delegate()
{
// some code block
} );
```
I like this somewhat, but it leaves a lot to be desired. I'd like to hear how other people would solve this sort of problem.
This looks like an excellent opportunity to have a look at Aspect Oriented Programming. Here is a good article on [AOP in .NET](https://learn.microsoft.com/en-us/archive/blogs/simonince/aspect-oriented-interception). The general idea is that you'd extract the cross-functional concern (i.e. Retry | [
-0.022864026948809624,
-0.15498360991477966,
0.013014936819672585,
0.21423642337322235,
-0.22899776697158813,
-0.14700572192668915,
0.020341254770755768,
-0.10072010010480881,
-0.224490687251091,
-0.31161239743232727,
-0.2062923163175583,
0.7243709564208984,
-0.3377174437046051,
-0.0135246... | |
for x hours) into a separate class and then you'd annotate any methods that need to modify their behaviour in that way. Here's how it might look (with a nice extension method on Int32)
```
[RetryFor( 10.Hours() )]
public void DeleteArchive()
{
//.. code to just delete the archive
}
``` | [
0.6269488334655762,
-0.09228385984897614,
0.3133508563041687,
-0.006621549371629953,
0.27126118540763855,
-0.0725066289305687,
0.38397079706192017,
-0.21248804032802582,
-0.2942454516887665,
-0.48650816082954407,
-0.29738032817840576,
0.6393405795097351,
-0.4520743191242218,
0.380454450845... | |
As a LAMP developer considering moving to a .Net IIS platform, one of my concerns is the loss of productivity due to lack of shell... Has anyone else had this experience? Is there possibly a Linux shell equivalent for Windows?
Depending on what version of IIS you're considering, I would second lbrandy's recommendation to check out [PowerShell](http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx). Microsoft is working on a PowerShell provider for IIS (specifically version 7). There is a decent post about this at <http://blogs.iis.net/thomad/archive/2008/04/14/iis-7-0-powershell-provider-tech-preview-1.aspx>. The upcoming version of PowerShell will also [add remoting capabilities](http://www.microsoft.com/technet/scriptcenter/topics/winpsh/remote.mspx) so that you can remotely manage machines. PowerShell is quite different from \*NIX | [
0.1324063092470169,
-0.19064883887767792,
0.49838507175445557,
0.12581616640090942,
0.022003399208188057,
-0.5400222539901733,
0.18879784643650055,
-0.0952252745628357,
-0.12373287975788116,
-0.7788556814193726,
-0.23139196634292603,
0.7946097254753113,
-0.2204139679670334,
0.1146399825811... | |
shells, though, so that is something to consider.
Hope this helps. | [
0.38355255126953125,
0.5145664215087891,
-0.27908796072006226,
0.1280626356601715,
0.5587233901023865,
0.4284329116344452,
0.07798219472169876,
0.2671334445476532,
-0.4065978229045868,
-0.5099850296974182,
0.35314977169036865,
0.6689706444740295,
0.19317187368869781,
-0.033579643815755844,... | |
What are the best methods for tracking and/or automating DB schema changes? Our team uses Subversion for version control and we've been able to automate some of our tasks this way (pushing builds up to a staging server, deploying tested code to a production server) but we're still doing database updates manually. I would like to find or create a solution that allows us to work efficiently across servers with different environments while continuing to use Subversion as a backend through which code and DB updates are pushed around to various servers.
Many popular software packages include auto-update scripts which detect | [
0.5079322457313538,
-0.011093774810433388,
0.19415509700775146,
0.16973884403705597,
-0.04612461477518082,
-0.18134981393814087,
0.15011154115200043,
-0.08397962898015976,
-0.1861816942691803,
-0.30941033363342285,
0.055434923619031906,
0.49452102184295654,
-0.3724331259727478,
-0.02514795... | |
DB version and apply the necessary changes. Is this the best way to do this even on a larger scale (across multiple projects and sometimes multiple environments and languages)? If so, is there any existing code out there that simplifies the process or is it best just to roll our own solution? Has anyone implemented something similar before and integrated it into Subversion post-commit hooks, or is this a bad idea?
While a solution that supports multiple platforms would be preferable, we definitely need to support the Linux/Apache/MySQL/PHP stack as the majority of our work is on that platform.
In the Rails | [
0.4782455265522003,
-0.06960135698318481,
0.1002853587269783,
0.17405907809734344,
-0.42021122574806213,
-0.37109896540641785,
0.32094261050224304,
-0.36165526509284973,
0.09589672088623047,
-0.5346507430076599,
0.06284233182668686,
0.40975189208984375,
-0.5512318015098572,
-0.033342618495... | |
world, there's the concept of migrations, scripts in which changes to the database are made in Ruby rather than a database-specific flavour of SQL. Your Ruby migration code ends up being converted into the DDL specific to your current database; this makes switching database platforms very easy.
For every change you make to the database, you write a new migration. Migrations typically have two methods: an "up" method in which the changes are applied and a "down" method in which the changes are undone. A single command brings the database up to date, and can also be used to bring | [
0.5694224834442139,
0.03615104407072067,
0.31269344687461853,
0.17209848761558533,
0.20529532432556152,
-0.010864553973078728,
0.1696178913116455,
-0.08291320502758026,
-0.5340291857719421,
-0.6144353747367859,
0.02707517333328724,
0.364257276058197,
-0.39781463146209717,
0.236541211605072... | |
the database to a specific version of the schema. In Rails, migrations are kept in their own directory in the project directory and get checked into version control just like any other project code.
[This Oracle guide to Rails migrations](http://www.oracle.com/technology/pub/articles/kern-rails-migrations.html "Oracle guide to Ruby on Rails migrations") covers migrations quite well.
Developers using other languages have looked at migrations and have implemented their own language-specific versions. I know of **[Ruckusing](https://github.com/ruckus/ruckusing-migrations "Ruckusing")**, a PHP migrations system that is modelled after Rails' migrations; it might be what you're looking for. | [
0.07830960303544998,
0.14290505647659302,
-0.1689271479845047,
0.026012320071458817,
-0.008686009794473648,
-0.009052314795553684,
0.04766285419464111,
0.10769843310117722,
-0.31652548909187317,
-0.46761414408683777,
-0.05258563160896301,
0.22134311497211456,
-0.23774060606956482,
-0.09184... | |
If I'm adding a column to a table in Microsoft SQL Server, can I control where the column is displayed logically in queries?
I don't want to mess with the physical layout of columns on disk, but I would like to logically group columns together when possible so that tools like SQL Server Management Studio list the contents of the table in a convenient way.
I know that I can do this through SQL Management Studio by going into their "design" mode for tables and dragging the order of columns around, but I'd like to be able to do it in raw | [
0.32568877935409546,
0.12650348246097565,
0.1007271558046341,
0.033546287566423416,
-0.1775028109550476,
-0.047361209988594055,
-0.23510852456092834,
-0.1508590131998062,
-0.24783703684806824,
-0.6212421655654907,
0.31634292006492615,
0.5095134377479553,
-0.29213085770606995,
0.02079032547... | |
SQL so that I can perform the ordering scripted from the command line.
You can not do this programatically (in a safe way that is) without creating a new table.
What Enterprise Manager does when you commit a reordering is to create a new table, move the data and then delete the old table and rename the new table to the existing name.
If you want your columns in a particular order/grouping without altering their physical order, you can create a view which can be whatever you desire. | [
0.28710857033729553,
0.10009325295686722,
0.19073008000850677,
-0.10544580966234207,
-0.10602086037397385,
-0.0006751506589353085,
0.24242635071277618,
0.134844109416008,
-0.3229072690010071,
-0.4024970829486847,
0.18436658382415771,
0.5550883412361145,
-0.43121856451034546,
0.288627624511... | |
*Preferred languages*: C/C++, Java, and Ruby.
I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Java, and Ruby, so I prefer resources that involve one of those three, but any good resource is acceptable.
Big List of Resources:
----------------------
* [A Nanopass Framework for Compiler Education](http://www.cs.indiana.edu/%7Edyb/pubs/nano-jfp.pdf) ¶
* [Advanced Compiler Design and Implementation](http://www.amazon.com/gp/offer-listing/1558603204?tag=thecompilerconne&camp=14573&creative=327641&linkCode=am1&creativeASIN=1558603204&adid=1ZQWN5FGBA1JM6MNQ2ZV&) $
* [An Incremental Approach to Compiler Construction](http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf) ¶
* [ANTLR 3.x Video Tutorial](http://javadude.com/articles/antlr3xtut)
* [Basics of Compiler Design](http://www.diku.dk/%7Etorbenm/Basics/)
* [Building a Parrot Compiler](http://web.archive.org/web/20160731061607/http://www.onlamp.com/pub/a/onlamp/2004/04/15/parrot_compiler_construction.html)
* [Compiler Basics](http://www.cs.man.ac.uk/%7Epjj/farrell/compmain.html)
* [Compiler Construction](https://rads.stackoverflow.com/amzn/click/com/0201403536) $
* [Compiler Design and Construction](https://rads.stackoverflow.com/amzn/click/com/0442275366) $
* [Crafting a Compiler with C](https://rads.stackoverflow.com/amzn/click/com/0805321667) $
* [Crafting | [
0.01960776560008526,
0.4627947211265564,
0.1385166496038437,
0.1280871033668518,
-0.20661544799804688,
0.4022917151451111,
0.46241652965545654,
-0.18660056591033936,
-0.353007435798645,
-0.5896719694137573,
-0.18496738374233246,
0.4415379464626312,
-0.07048223912715912,
-0.2185378074645996... | |
Interpreters](http://craftinginterpreters.com/)
* [Compiler Design in C] [12](http://www.holub.com/software/compiler.design.in.c.html) ¶
* [Compilers: Principles, Techniques, and Tools](https://rads.stackoverflow.com/amzn/click/com/0321486811) $ — aka ["The Dragon Book"](http://en.wikipedia.org/wiki/Compilers:_Principles%2C_Techniques%2C_and_Tools); widely considered "the book" for compiler writing.
* [Engineering a Compiler](https://rads.stackoverflow.com/amzn/click/com/012088478X) $
* [Essentials of Programming Languages](http://www.cs.indiana.edu/eopl/)
* [Flipcode Article Archive](http://flipcode.com/archives/articles.shtml) (look for "Implementing A Scripting Engine by Jan Niestadt")
* [Game Scripting Mastery](https://rads.stackoverflow.com/amzn/click/com/1931841578) $
* [How to build a virtual machine from scratch in C#](http://www.codeproject.com/KB/recipes/B32Machine1/VMCS.pdf) ¶
* [Implementing Functional Languages](http://research.microsoft.com/%7Esimonpj/papers/pj-lester-book/)
* [Implementing Programming Languages (with BNFC)](http://www1.digitalgrammars.com/ipl-book/)
* [Implementing Programming Languages using C# 4.0](http://www.codeproject.com/KB/recipes/programminglanguagetoools.aspx)
* [Interpreter pattern](http://en.wikipedia.org/wiki/Interpreter_pattern) (described in [Design Patterns](https://rads.stackoverflow.com/amzn/click/com/0201633612) $) specifies a way to evaluate sentences in a language
* [Language Implementation Patterns: Create Your Own Domain-Specific and General Programming | [
0.05965934693813324,
0.49983733892440796,
-0.0722489058971405,
0.15824224054813385,
0.09057388454675674,
0.2894666790962219,
0.36014294624328613,
-0.40113958716392517,
-0.16985343396663666,
-0.48652422428131104,
-0.3013567626476288,
0.667569100856781,
-0.042490776628255844,
-0.635584592819... | |
Languages](http://pragprog.com/titles/tpdsl/language-implementation-patterns) $
* [Let's Build a Compiler](http://compilers.iecc.com/crenshaw/) by Jack Crenshaw — The [PDF](http://www.stack.nl/%7Emarcov/compiler.pdf) ¶ version (examples are in Pascal, but the information is generally applicable)
* [Linkers and Loaders](http://books.google.com/books?id=Id9cYsIdjIwC&lpg=PP1&ots=IxFkFWJ-8V&dq=%22linkers%20and%20loaders%22&pg=PA215#v=onepage&q=%22linkers%20and%20loaders%22&f=false) $ (Google Books)
* [Lisp in Small Pieces (LiSP)](https://rads.stackoverflow.com/amzn/click/com/0521562473) $
* [LLVM Tutorial](http://llvm.org/docs/tutorial/)
* [Modern Compiler Implementation in ML](https://rads.stackoverflow.com/amzn/click/com/0521607647) $ — There is a [Java](https://rads.stackoverflow.com/amzn/click/com/052182060X) $ and [C](https://rads.stackoverflow.com/amzn/click/com/0521607655) $ version as well - widely considered a very good book
* [Object-Oriented Compiler Construction](http://www.amazon.com/gp/offer-listing/013630740X?tag=thecompilerconne&camp=14573&creative=327641&linkCode=am1&creativeASIN=013630740X&adid=0JPMVBRNCAN6PDKGYSXX&) $
* [Parsing Techniques - A Practical Guide](http://www.dickgrune.com/Books/PTAPG_1st_Edition/)
* [Project Oberon](http://www-old.oberon.ethz.ch/WirthPubl/ProjectOberon.pdf) ¶ - Look at chapter 13
* [Programming a Personal Computer](https://rads.stackoverflow.com/amzn/click/com/0137302673) $
* [Programing Languages: Application and Interpretation](http://www.cs.brown.edu/%7Esk/Publications/Books/ProgLangs/)
* [Rabbit: A Compiler for Scheme](http://repository.readscheme.org/ftp/papers/ai-lab-pubs/AITR-474.pdf)¶
* [Reflections on Trusting Trust](http://web.archive.org/web/20141221110345/http://cm.bell-labs.com/who/ken/trust.html) | [
-0.3572763502597809,
0.3933253586292267,
0.16295751929283142,
-0.2593448758125305,
0.14871306717395782,
0.38622239232063293,
0.6210610270500183,
0.030176734551787376,
-0.20906639099121094,
-0.324293851852417,
-0.26665058732032776,
0.3616008162498474,
-0.46551603078842163,
-0.56217491626739... | |
— A quick guide
* [Roll Your Own Compiler for the .NET framework](http://msdn.microsoft.com/en-us/magazine/cc136756.aspx) — A quick tutorial from MSDN
* [Structure and Interpretation of Computer Programs](http://mitpress.mit.edu/sicp/)
* [Types and Programming Languages](http://www.cis.upenn.edu/%7Ebcpierce/tapl/)
* [Want to Write a Compiler?](http://prog21.dadgum.com/30.html) - a quick guide
* [Writing a Compiler in Ruby Bottom Up](http://www.hokstad.com/writing-a-compiler-in-ruby-bottom-up-step-1.html)
* [Compiling a Lisp](https://bernsteinbear.com/blog/compiling-a-lisp-0/) — compile directly to x86-64
Legend:
* ¶ Link to a PDF file
* $ Link to a printed book | [
0.2277851104736328,
0.20317721366882324,
0.12998710572719574,
0.27899348735809326,
-0.30323323607444763,
-0.17769737541675568,
0.7075934410095215,
-0.10794276744127274,
-0.12555812299251556,
-0.4163433909416199,
-0.20220579206943512,
0.22519545257091522,
-0.1604509949684143,
-0.61522710323... | |
My dilemma is, basically, how to share an enumeration between two applications.
The users upload documents through a front-end application that is on the web. This application calls a web service of the back-end application and passes the document to it. The back-end app saves the document and inserts a row in the *Document* table.
The document type (7 possible document types: *Invoice*, *Contract* etc.) is passed as a parameter to the web service's *UploadDocument* method. The question is, what should the type (and possible values) of this parameter be?
Since you need to hardcode these values in both applications, I think it | [
0.19551479816436768,
0.18912701308727264,
0.5422453284263611,
0.23657910525798798,
0.25725218653678894,
0.30360448360443115,
-0.2736222445964813,
-0.4428083598613739,
-0.10912302136421204,
-0.6865896582603455,
-0.09319431334733963,
0.3967422842979431,
-0.09539471566677094,
0.12922495603561... | |
is O.K. to use a descriptive string (*Invoice*, *Contract*, *WorkOrder*, *SignedWorkOrder*).
Is it maybe a better approach to create a *DocumentTypes* enumeration in the first application, and to reproduce it also in the second application, and then pass the corresponding integer value to the web service between them?
I can only speak about .net, but if you have an ASP.net Webservice, you should be able to add an enumeration directly to it.
When you then use the "Add Web Reference" in your Client Application, the resulting Class should include that enum
But this is from the top of my head, i'm pretty sure | [
0.3495836555957794,
0.027480265125632286,
0.43647482991218567,
0.16258208453655243,
-0.07114345580339432,
-0.007342300843447447,
-0.17374660074710846,
-0.051637351512908936,
-0.2587156295776367,
-0.6876373887062073,
0.06852391362190247,
0.2604348063468933,
-0.2776811122894287,
-0.067395031... | |
i've done it in the past, but I can't say for sure. | [
0.5311294198036194,
0.21717076003551483,
0.05229463055729866,
-0.2485814243555069,
0.2089540958404541,
0.173040509223938,
0.39644962549209595,
0.05661669373512268,
-0.11310195177793503,
-0.10478432476520538,
0.4706030488014221,
0.271659255027771,
0.21614286303520203,
0.021387195214629173,
... | |
I was just looking through some information about Google's [protocol buffers](http://code.google.com/apis/protocolbuffers/) data interchange format. Has anyone played around with the code or even created a project around it?
I'm currently using XML in a Python project for structured content created by hand in a text editor, and I was wondering what the general opinion was on Protocol Buffers as a user-facing input format. The speed and brevity benefits definitely seem to be there, but there are so many factors when it comes to actually generating and processing the data.
If you are looking for user facing interaction, stick with xml. It has | [
0.488773375749588,
0.008695975877344608,
0.24087291955947876,
0.1783752739429474,
-0.18766261637210846,
-0.1241084635257721,
-0.07988274842500687,
0.2564460337162018,
-0.3131656050682068,
-0.7398432493209839,
0.116508848965168,
0.33053264021873474,
-0.1754807084798813,
-0.08144511282444,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.