Id int64 4 8.51M | PostTypeId int64 1 7 | AcceptedAnswerId int64 7 75.5M ⌀ | ParentId int64 4 41.8M ⌀ | Score int64 -208 27.7k | ViewCount int64 11 12.4M ⌀ | Body stringlengths 0 45k | Title stringlengths 2 150 ⌀ | ContentLicense stringclasses 3
values | FavoriteCount int64 0 225 ⌀ | CreationDate stringdate 2008-07-31 21:42:52 2011-12-14 18:48:47 | LastActivityDate stringdate 2008-08-01 12:19:17 2023-03-05 04:40:26 | LastEditDate stringdate 2008-08-01 13:54:25 2023-03-05 03:12:45 ⌀ | LastEditorUserId int64 -1 21.3M ⌀ | OwnerUserId int64 -1 21.1M ⌀ | Tags listlengths 1 6 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
25,007 | 1 | 25,024 | null | 21 | 14,617 | What's the easiest way to convert a percentage to a color ranging from Green (100%) to Red (0%), with Yellow for 50%?
I'm using plain 32bit RGB - so each component is an integer between 0 and 255. I'm doing this in C#, but I guess for a problem like this the language doesn't really matter that much.
Based on Marius a... | Conditional formatting -- percentage to color conversion | CC BY-SA 2.5 | 0 | 2008-08-24T12:33:58.967 | 2021-01-07T14:17:19.777 | 2008-09-10T00:13:41.037 | -1 | 1,199,387 | [
"c#",
"colors",
"rgb"
] |
25,013 | 2 | null | 24,965 | 2 | null | I think the most important thing with (and actually one of the great outcomes of, in a somewhat recursive manner) TDD is successful management of dependencies. You have to make sure that modules are tested in isolation with no elaborate setup needed. For example, if you're testing a component that eventually sends an e... | null | CC BY-SA 2.5 | null | 2008-08-24T12:46:34.880 | 2008-08-24T12:46:34.880 | null | null | 2,150 | null |
25,012 | 2 | null | 25,007 | 1 | null | As yellow is a mix of red and green, you can probably start with `#F00` and then slide green up until you hit `#FF0`, then slide red down to `#0F0`:
```
for (int i = 0; i < 100; i++) {
var red = i < 50
? 255
: 255 - (256.0 / 100 * ((i - 50) * 2));
var green = i < 50
? 256.0 / 100 * (i *... | null | CC BY-SA 3.0 | null | 2008-08-24T12:44:14.323 | 2012-08-01T06:59:36.323 | 2012-08-01T06:59:36.323 | 1,968 | 1,968 | null |
25,008 | 2 | null | 24,620 | 2 | null | The only legitimate use of inheritance is to define a particular case of a base class like, for example, when inherit from Shape to derive Circle. To check this look at the relation in opposite direction: is a Shape a generalization of Circle? If the answer is yes then it is ok to use inheritance.
So if you have a cla... | null | CC BY-SA 2.5 | null | 2008-08-24T12:34:27.123 | 2008-08-24T12:34:27.123 | null | null | 2,586 | null |
25,011 | 2 | null | 24,675 | 1 | null | @[Gary](https://stackoverflow.com/questions/24675/tactics-for-using-php-in-a-high-load-site#24689)
> Don't use MySQLi -- PDO is the 'modern' OO database access layer. The most important feature to use is placeholders in your queries. It's smart enough to use server side prepares and other optimizations for you as well... | null | CC BY-SA 2.5 | null | 2008-08-24T12:38:56.927 | 2008-08-24T12:38:56.927 | 2017-05-23T12:26:17.013 | -1 | 2,025 | null |
25,014 | 2 | null | 25,007 | 5 | null | In pseudocode.
- From 0-50% your hex value would be FFxx00 where:```
XX = ( Percentage / 50 ) * 255 converted into hex.
```
- From 50-100 your hex value would be xxFF00 where:```
XX = ((100-Percentage) / 50) * 255 converted into hex.
```
Hope that helps and is understandable.
| null | CC BY-SA 2.5 | null | 2008-08-24T12:48:52.783 | 2008-08-24T14:35:53.337 | 2008-08-24T14:35:53.337 | 565 | 565 | null |
25,017 | 2 | null | 25,007 | -1 | null | Because it's R-G-B, the colors go from integer values of -1 (white), to -16777216 for black. with red green and yellow somewhere in the middle that. Yellow is actually -256, while red is -65536 and green is -16744448. So yellow actually isn't between red and green in the RGB notation. I know that in terms of wavele... | null | CC BY-SA 2.5 | null | 2008-08-24T12:52:53.037 | 2008-08-24T12:52:53.037 | null | null | 1,862 | null |
25,018 | 2 | null | 18,291 | 3 | null | Usually I create a Unit test project (File->New->Other->Unit Test->Test Project). It contains the stuff I need so it's been good enough so far.
I use delphi 2007 so I don't really know if this is available in 2006.
| null | CC BY-SA 2.5 | null | 2008-08-24T12:53:25.797 | 2008-08-24T12:53:25.797 | null | null | 1,604 | null |
25,015 | 2 | null | 24,965 | 0 | null | In my opinion (your mileage may vary):
1- If you didn't write it don't test it. If you wrote it and you don't have a test for it it doesn't exist.
3- As everyone's said, xUnit's free and great.
2 & 4- Deciding exactly what to test is one of those things you can debate about with yourself forever. I try to draw this... | null | CC BY-SA 2.5 | null | 2008-08-24T12:49:23.717 | 2008-08-24T12:49:23.717 | null | null | 1,517 | null |
25,031 | 2 | null | 24,821 | 3 | null | I don't know that you can force buffering - but a reverse proxy server between you and the server would affect buffering (since the buffer then affects the proxy's connection - not your browser's).
| null | CC BY-SA 2.5 | null | 2008-08-24T13:26:19.697 | 2008-08-24T13:26:19.697 | null | null | 2,199 | null |
25,024 | 2 | null | 25,007 | 14 | null | I made this function in JavaScript. It returns the color is a css string. It takes the percentage as a variable, with a range from 0 to 100. The algorithm could be made in any language:
```
function setColor(p){
var red = p<50 ? 255 : Math.round(256 - (p-50)*5.12);
var green = p>50 ? 255 : Math.round((p)*5.12)... | null | CC BY-SA 2.5 | null | 2008-08-24T13:14:41.957 | 2008-08-24T17:25:47.330 | 2008-08-24T17:25:47.330 | 1,585 | 1,585 | null |
25,016 | 2 | null | 24,823 | 1 | null | Kirk Allen Evans wrote an interesting [blog](http://blogs.msdn.com/kaevans/archive/2007/07/02/asynchronous-workflow-activities-implemented-asynchronous-webrequests.aspx) about this with some pretty good code examples.
| null | CC BY-SA 2.5 | null | 2008-08-24T12:51:43.617 | 2008-08-24T12:51:43.617 | null | null | 1,616 | null |
25,028 | 2 | null | 24,995 | 6 | null | As has been said, I'm not really sure about a C++ 'ecosystem'. But [Haskell](http://haskell.org/) does have a Foreign Function Interface that allows you to call C functions from Haskell and Haskell functions from C.
Then again, that's C, I'm not really sure how far along the C++ FFI is...
| null | CC BY-SA 2.5 | null | 2008-08-24T13:20:11.990 | 2008-08-24T13:20:11.990 | null | null | 2,597 | null |
25,022 | 2 | null | 24,915 | 0 | null | According to [this MSDN forums posting](http://forums.microsoft.com/msdn/showpost.aspx?postid=1155829&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=0), it seems to be a login issue.
| null | CC BY-SA 2.5 | null | 2008-08-24T13:05:53.553 | 2008-08-24T13:05:53.553 | null | null | 2,199 | null |
25,025 | 2 | null | 24,965 | 2 | null | I found that the principles illustrated in the [Three Index Cards to Easily Remember the Essence of TDD](http://blog.briandicroce.com/2008/03/14/three-index-cards-to-easily-remember-the-essence-of-test-driven-development/) is a good guide.
Anyway, to answer your questions
1. You don't have to test something you "kno... | null | CC BY-SA 2.5 | null | 2008-08-24T13:14:47.993 | 2008-08-24T13:14:47.993 | null | null | 372 | null |
25,030 | 2 | null | 21,697 | 1 | null | In reply to the follow-up question:
As for creating exceptions becoming tedious, you kinda get used to it. Use of a good code generator or template can create the exception class with minimal hand editing within about 5 or 10 seconds.
However, in many real world applications, error handling can be 70% of the work, s... | null | CC BY-SA 2.5 | null | 2008-08-24T13:25:28.593 | 2008-08-24T13:25:28.593 | null | null | 1,820 | null |
25,033 | 1 | 25,043 | null | 5 | 4,833 | I am using the code snippet below, however it's not working quite as I understand it should.
```
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
try {
line = br.readLine();
while(line != null) {
... | I Am Not Getting the Result I Expect Using readLine() in Java | CC BY-SA 3.0 | 0 | 2008-08-24T13:29:20.330 | 2015-08-20T22:19:55.613 | 2012-04-25T23:10:28.673 | 1,332,690 | 2,628 | [
"java",
"java-io"
] |
25,042 | 1 | null | null | 17 | 2,836 | DDD states that you should only ever access entities through their aggregate root. So say for instance that you have an aggregate root X which potentially has a of child Y entities. Now, for some scenario, you only really care about a subset of these Y entities at a time (maybe you're displaying them in a paged list o... | Am I allowed to have "incomplete" aggregates in DDD? | CC BY-SA 2.5 | 0 | 2008-08-24T13:40:15.250 | 2019-02-04T12:09:54.827 | null | null | 1,710 | [
"domain-driven-design"
] |
25,035 | 2 | null | 24,680 | 1 | null | Depending how much you're planning to do on these legacy projects I would consider not switching.
When digging through legacy code it really helps to have all the history and blame. SVN is miles better than VSS, but you'll be losing the history when you switch.
If you're going to be a lot of ongoing development in VB... | null | CC BY-SA 2.5 | null | 2008-08-24T13:31:38.203 | 2008-08-24T13:31:38.203 | null | null | 905 | null |
25,036 | 2 | null | 25,033 | 3 | null | No input is not the same as the end of the stream. You can usually simulate the end of the stream in a console by pressing + (AFAIK some systems use + instead). But I guess this is not what you want so better test for empty strings additionally to null strings.
| null | CC BY-SA 3.0 | null | 2008-08-24T13:32:37.170 | 2015-08-20T22:19:55.613 | 2015-08-20T22:19:55.613 | 7,226 | 1,968 | null |
25,045 | 2 | null | 25,041 | 2 | null | Since you're displaying it inline, the height should be set at the height of your line-height attribute.
Depending on how it's laid out, you could always use float:left or float:right on the span/div to prevent the line break. But if you want it in the middle of a sentence, that option is out.
| null | CC BY-SA 2.5 | null | 2008-08-24T13:41:59.753 | 2008-08-24T13:41:59.753 | null | null | 565 | null |
25,034 | 2 | null | 24,821 | 2 | null | I've done some fruitless research on this one, but i'll share my line of thinking in the dim hope that it helps.
IIS is one of the things sitting between client and server in this case, so it might be useful to know what version of IIS is involved in each case -- and to investigate if there's some way that IIS can per... | null | CC BY-SA 2.5 | null | 2008-08-24T13:30:02.387 | 2008-08-24T13:30:02.387 | null | null | 49 | null |
25,049 | 2 | null | 25,041 | 1 | null | You can only change the height (and width) of a span element when it is set to `display: block;`. This is because it is an inline element normally. `div` is set to `display: block;` normally.
A solution could be to use:
```
<div style="background: #f00;">
Text <span style="padding: 14px 0 14px 0; background: #ff0... | null | CC BY-SA 2.5 | null | 2008-08-24T13:44:11.557 | 2008-08-24T13:49:40.763 | 2008-08-24T13:49:40.763 | 2,025 | 2,025 | null |
25,051 | 2 | null | 25,041 | 1 | null | The problem is that 'display: inline' can't get a height associated because, being inline, it gets its height from its the content. Anyway, how do you define the height of a box that is broken at the end of a line?
You might try to set 'line-height' instead, or if this doesn't work to your satisfaction, set a padding:... | null | CC BY-SA 2.5 | null | 2008-08-24T13:44:33.680 | 2008-08-24T13:44:33.680 | null | null | 1,968 | null |
25,053 | 2 | null | 25,041 | 17 | null | ```
<style>
#div1 { float:left; height:20px; width:20px; }
#div2 { float:left; height:30px; width:30px }
</style>
<div id="div1">FirstDiv</div>
<div id="div2">SecondDiv</div>
```
As long as the container for whatever is holding `div's` 1 and 2 is wide enough for them to fit, this should be fine.
| null | CC BY-SA 4.0 | null | 2008-08-24T13:47:05.343 | 2020-02-26T13:58:10.713 | 2020-02-26T13:58:10.713 | 11,393,381 | 565 | null |
25,057 | 2 | null | 25,046 | 14 | null | Take a look at the the official clisp homepage. There is a FAQ that answers this question.
[http://clisp.cons.org/impnotes/faq.html#faq-exec](http://clisp.cons.org/impnotes/faq.html#faq-exec)
| null | CC BY-SA 2.5 | null | 2008-08-24T13:55:29.113 | 2008-08-24T13:55:29.113 | null | null | 936 | null |
25,043 | 2 | null | 25,033 | 10 | null | > From my understanding of this, readLine should return null the first time no input is entered other than a line termination, like '\r'.
That is not correct. `readLine` will return `null` if the end of the stream is reached. That is, for example, if you are reading a file, and the file ends, or if you're reading from... | null | CC BY-SA 2.5 | null | 2008-08-24T13:41:06.963 | 2008-08-24T15:00:43.527 | 2008-08-24T15:00:43.527 | 2,597 | 2,597 | null |
25,058 | 2 | null | 17,911 | 0 | null | I suggest that you file a bug report at [https://bugs.adobe.com/flashplayer/](https://bugs.adobe.com/flashplayer/), because the event really shouldn't fire before all the bytes are loaded. In the meantime I guess you have to live with the timer. You might be able to do the same by listening at the progress event instea... | null | CC BY-SA 2.5 | null | 2008-08-24T14:00:38.243 | 2008-08-24T14:00:38.243 | null | null | 1,109 | null |
25,056 | 2 | null | 24,675 | 2 | null | Sure pdo is nice, but there [has](http://dealnews.com/developers/php-mysql.html) [been](http://www.santosj.name/php/mysqli-vs-pdo/) [some](http://brian.moonspot.net/2006/08/06/mysqli-vs-pdo-my-version/) controversy about it's performance versus mysql and mysqli, although it seems fixed now.
You should use pdo if you e... | null | CC BY-SA 2.5 | null | 2008-08-24T13:55:00.033 | 2008-08-24T13:55:00.033 | null | null | 2,452 | null |
25,063 | 1 | 25,069 | null | 47 | 5,813 | Does anyone have any suggestions on how to mentor a junior programmer ? If you have mentored someone did you follow any process or was it quite informal ?
If you've been mentored in the past what kind of things did you find most helpful ?
| How to mentor a junior programmer | CC BY-SA 2.5 | 0 | 2008-08-24T14:05:31.537 | 2018-08-01T07:44:56.670 | 2013-08-23T15:18:20.850 | null | 381 | [
"language-agnostic"
] |
25,047 | 2 | null | 25,041 | 17 | null | Inline elements can't have heights (nor widths) like that. SPANs are already `display: inline` by default. Internet Explorer is actually the broken browser in this case.
| null | CC BY-SA 2.5 | null | 2008-08-24T13:42:46.180 | 2008-08-24T13:42:46.180 | null | null | 1,902,010 | null |
25,061 | 2 | null | 24,270 | 24 | null | There's no empirical evidence that suggests that object orientation is a more natural way for people to think about the world. There's some work in the field of psychology of programming that shows that OO is not somehow more fitting than other approaches.
> Object-oriented representations do not appear to be universal... | null | CC BY-SA 3.0 | null | 2008-08-24T14:03:42.790 | 2016-07-08T17:11:10.447 | 2020-06-20T09:12:55.060 | -1 | 2,491 | null |
25,065 | 2 | null | 25,007 | 6 | null | What you probably want to do is to assign your 0% to 100% some points in a HSV or HSL color-space. From there you can interpolate colors (and yellow just happens to be between red and green :) and [convert them to RGB](http://en.wikipedia.org/wiki/HSL_color_space). That will give you a nice looking gradient between the... | null | CC BY-SA 4.0 | null | 2008-08-24T14:11:08.060 | 2021-01-07T14:17:19.777 | 2021-01-07T14:17:19.777 | 1,115,360 | 2,010 | null |
25,069 | 2 | null | 25,063 | 48 | null | Try to set aside between 30-60 minutes a day to review their code together. If you can't do this, then try to get together to review their code whenever they make a code commit, unless it was very basic. Have them explain why they chose the approach they took in lieu of others. A process like this helps to establish a ... | null | CC BY-SA 2.5 | null | 2008-08-24T14:14:25.510 | 2008-08-24T14:33:42.233 | 2008-08-24T14:33:42.233 | 2,628 | 2,628 | null |
25,071 | 2 | null | 25,063 | 3 | null | I'd be the junior, I guess :) I think I'd value an informal approach. It probably depends a lot on your and your mentee's characters, but I'd say that you learn best if you don't have egos in the way. Break the ice, make sure there's feedback in directions. Things like code reviewing (both ways?) and occasional pair p... | null | CC BY-SA 2.5 | null | 2008-08-24T14:16:36.487 | 2008-08-24T14:16:36.487 | null | null | 1,037 | null |
25,068 | 2 | null | 24,891 | 2 | null | (I'm writing because I feel the answers so far aren't quite on the mark.)
The reason you have to memory management worth mentioning is when you have a problem / solution that requires you to create complex structures. (If your programs crash if you allocate to much space on the stack at once, that's a bug.) Typically,... | null | CC BY-SA 2.5 | null | 2008-08-24T14:13:13.063 | 2008-08-24T14:13:13.063 | null | null | 1,421 | null |
25,032 | 2 | null | 24,797 | 0 | null | Maintain a TimeZone table, or shell out with an extended stored proc (xp_cmdshell or a COM component, or your own) and ask the OS to do it. If you go the xp route, you'd probably want to cache the offset for a day.
| null | CC BY-SA 2.5 | null | 2008-08-24T13:28:11.847 | 2008-08-24T13:28:11.847 | null | null | 2,199 | null |
25,070 | 2 | null | 24,675 | 4 | null | It looks like [I was wrong](http://forge.mysql.com/wiki/Which_PHP_Driver_for_MySQL_should_I_use). MySQLi is still being developed. But according to the article, PDO_MySQL is now being contributed to by the MySQL team. From the article:
> The MySQL Improved Extension - mysqli
- is the flagship. It supports all featur... | null | CC BY-SA 2.5 | null | 2008-08-24T14:14:48.567 | 2008-08-24T14:14:48.567 | null | null | 2,506 | null |
25,077 | 2 | null | 24,886 | 0 | null | My C is a little rusty, so I apologize in advance. Speedwise, I can understand the results. But, I am confused as to how both files came out to the same MD5 hash. Maybe a for loop runs the same, but wouldn't the following 2 lines of code generate different assembly?
```
myArray[i++] = "hello";
```
vs
```
myArray... | null | CC BY-SA 2.5 | null | 2008-08-24T14:22:47.940 | 2008-08-24T14:22:47.940 | null | null | 2,470 | null |
25,075 | 2 | null | 24,993 | 4 | null | > Here is my app.config file of the class library:
You should put this configuration settings to main app's config file. .NET application (which is calling your class library) uses data from it's own config file not from your library config file.
| null | CC BY-SA 2.5 | null | 2008-08-24T14:21:06.540 | 2008-08-24T14:21:06.540 | null | null | 1,196 | null |
25,041 | 1 | 25,053 | null | 17 | 32,240 | Using CSS,
I'm trying to specify the height of a `span` tag in Firefox, but it's just not accepting it (IE does).
Firefox accepts the `height` if I use a `div`, but the problem with using a `div` is the annoying line break after it, which I can't have in this particular instance.
I tried setting the CSS style attri... | span tag height in Firefox | CC BY-SA 4.0 | 0 | 2008-08-24T13:40:00.773 | 2020-02-26T13:58:10.713 | 2020-02-26T13:57:37.947 | 11,393,381 | 1,693 | [
"html",
"css",
"firefox",
"cross-browser"
] |
25,072 | 2 | null | 24,675 | 40 | null |
@[gary](https://stackoverflow.com/questions/24675/tactics-for-using-php-in-a-high-load-site#24689)
You cannot just say "don't use MySQLi" as they have different goals. PDO is almost like an abstraction layer (although it is not actually) and is designed to make it easy to use multiple database products whereas MySQL... | null | CC BY-SA 2.5 | null | 2008-08-24T14:17:01.977 | 2008-08-24T14:23:31.713 | 2017-05-23T12:17:59.863 | -1 | 2,183 | null |
25,082 | 2 | null | 24,648 | 0 | null | I haven't tried it myself, but you can go to Linux From Scratch and start building your own Linux distribution. Sounds like something that'll take a junkload of time, but will result in an intimate knowledge of the guts of the Linux kernel and how each part works. Of course, you can supplement this learning by followi... | null | CC BY-SA 2.5 | null | 2008-08-24T14:34:57.427 | 2008-08-24T14:34:57.427 | null | null | 2,682 | null |
25,073 | 2 | null | 24,797 | 29 | null | Create two tables and then join to them to convert stored GMT dates to local time:
```
TimeZones e.g.
--------- ----
TimeZoneId 19
Name Eastern (GMT -5)
Offset -5
```
Create the daylight savings table and populate it with as much information as you can (local laws change all the time so th... | null | CC BY-SA 2.5 | null | 2008-08-24T14:17:17.423 | 2008-08-24T14:17:17.423 | null | null | 1,219 | null |
25,085 | 2 | null | 25,063 | 0 | null | I have mentored several junior people under me before. My approach varied slightly based on the person a bit based on how they learned.
In short, I gave the junior people small, self-contained projects when I could and gave them a relatively fixed time to complete the task. Once the task was complete I would revie... | null | CC BY-SA 2.5 | null | 2008-08-24T14:37:16.750 | 2008-08-24T14:37:16.750 | null | null | 2,305 | null |
25,079 | 2 | null | 24,675 | 5 | null | > Thanks for the advice on PHP's caching extensions - could you explain reasons for using one over another? I've heard great things about memcached through IRC but have never heard of APC - what are your opinions on them? I assume using multiple caching systems is pretty counter-effective.
Actually, [many do use APC a... | null | CC BY-SA 2.5 | null | 2008-08-24T14:26:31.720 | 2008-08-24T14:26:31.720 | null | null | 1,902,010 | null |
25,078 | 2 | null | 24,675 | 1 | null | I don't see myself switching from MySQL anytime soon - so I guess I don't need the abstraction capabilities of PDO. Thanks for those articles DavidM, they've helped me a lot.
| null | CC BY-SA 2.5 | null | 2008-08-24T14:25:56.247 | 2008-08-24T14:25:56.247 | null | null | 2,025 | null |
25,046 | 1 | 25,435 | null | 59 | 24,286 | I've just started learning Lisp and I can't figure out how to compile and link lisp code to an executable.
I'm using `clisp` and `clisp -c` produces two files:
- -
What do I do next to get an executable?
| Lisp Executable | CC BY-SA 3.0 | 0 | 2008-08-24T13:42:35.320 | 2019-03-26T22:36:47.657 | 2014-12-05T16:46:13.077 | 69,545 | 2,450 | [
"build",
"lisp",
"common-lisp",
"clisp"
] |
25,089 | 2 | null | 7,277 | 3 | null | Few people have said that CDATA blocks will allow you to retain line breaks. This is wrong. CDATA sections will only make markup be processed as character data, they will change line break processing.
```
<Address>15 Sample St
Example Bay
Some Country</Address>
```
is exactly the same as
```
<Address>< or [Bamboo](http://www.atlassian.com/software/bamboo/).
| null | CC BY-SA 2.5 | null | 2008-08-24T15:06:47.227 | 2008-08-24T15:06:47.227 | null | null | 2,506 | null |
25,110 | 2 | null | 25,041 | 32 | null | You can set any element to `display: inline-block` to allow it to receive a height or width. This also allows you to apply any other "block styles" to an element.
One thing to be careful about however is that Firefox 2 does not support this property. Firefox 3 is the first Mozilla-based browser to support this propert... | null | CC BY-SA 2.5 | null | 2008-08-24T15:19:57.007 | 2010-12-09T13:19:39.020 | 2010-12-09T13:19:39.020 | 392 | 392 | null |
25,095 | 2 | null | 7,084 | 3 | null | I believe that MISRA standards suggest (require?) the use of typedefs.
From a personal perspective, using typedefs leaves no confusion as to the size (in bits / bytes) of certain types. I have seen lead developers attempt both ways of developing by using standard types e.g. int and using custom types e.g. UINT32.
If ... | null | CC BY-SA 2.5 | null | 2008-08-24T14:48:54.007 | 2008-08-24T14:48:54.007 | null | null | 1,816 | null |
25,116 | 1 | 7,357,938 | null | 69 | 61,615 | In Python you can use [StringIO](https://docs.python.org/library/struct.html) for a file-like buffer for character data. [Memory-mapped file](https://docs.python.org/library/mmap.html) basically does similar thing for binary data, but it requires a file that is used as the basis. Does Python have a file object that is ... | Binary buffer in Python | CC BY-SA 3.0 | 0 | 2008-08-24T15:37:50.787 | 2014-11-02T03:37:41.497 | 2014-11-02T02:19:48.950 | 2,213,647 | 2,679 | [
"python",
"binary",
"io",
"buffer"
] |
25,113 | 2 | null | 25,042 | 1 | null | You're really asking two overlapping questions.
1. The title and first half of your question are philosophical/theoretical. I think the reason for accessing entities only through their "aggregate root" is to abstract away the kinds of implementation details you're describing. Access through the aggregate root is a wa... | null | CC BY-SA 2.5 | null | 2008-08-24T15:30:26.920 | 2008-08-24T15:30:26.920 | null | null | 1,042 | null |
25,105 | 2 | null | 24,648 | 4 | null | Noting the lack of BSDs here, I figured I'd chip in:
- [The Design and Implementation of the FreeBSD Operating System](https://rads.stackoverflow.com/amzn/click/com/0201702452)- [Unix and BSD Courses](http://www.mckusick.com/courses/index.html)- [FreeBSD Architecture Handbook](http://www.freebsd.org/doc/en_US.ISO8859-... | null | CC BY-SA 3.0 | null | 2008-08-24T15:10:38.807 | 2016-10-27T14:38:38.773 | 2016-10-27T14:38:38.773 | 471,272 | 2,010 | null |
25,118 | 2 | null | 1,313 | 4 | null | The [Wikipedia article on color differences](http://en.wikipedia.org/wiki/Color_difference) lists a number of color spaces and distance metrics designed to agree with human perception of color distances.
| null | CC BY-SA 2.5 | null | 2008-08-24T15:38:38.320 | 2008-08-24T15:38:38.320 | null | null | 2,686 | null |
25,086 | 2 | null | 25,063 | 18 | null | I had the chance to work as an intern (one of two) in a small software company and had the opportunity to work on an "almost new" project they had. They had me set up with everything needed and gave me an introduction into what the project actually was (basic stuff like what the requirements were etc).
At first we got... | null | CC BY-SA 2.5 | null | 2008-08-24T14:37:46.890 | 2011-03-15T16:00:03.557 | 2011-03-15T16:00:03.557 | 143,804 | 46 | null |
25,122 | 2 | null | 22,873 | 1 | null | For J2EE you have a very comprehensive tutorial at:
[http://java.sun.com/javaee/5/docs/tutorial/doc/](http://java.sun.com/javaee/5/docs/tutorial/doc/)
| null | CC BY-SA 2.5 | null | 2008-08-24T15:45:45.743 | 2008-08-24T15:45:45.743 | null | null | 2,697 | null |
25,124 | 2 | null | 24,678 | 14 | null | Disclaimer, I work at Aptana. I would point out there are some nice features for JS that you might not get so easily elsewhere. One is plugin-level integration of JS libraries that provide CodeAssist, samples, snippets and easy inclusion of the libraries files into your project; we provide the plugins for many of the m... | null | CC BY-SA 2.5 | null | 2008-08-24T15:52:48.160 | 2008-08-24T15:52:48.160 | null | null | 2,702 | null |
25,117 | 2 | null | 23,397 | 2 | null | You might also like using the processing module ([http://pypi.python.org/pypi/processing](http://pypi.python.org/pypi/processing)). It has lot's of functionality for writing parallel systems with the same API as the threading module...
| null | CC BY-SA 2.5 | null | 2008-08-24T15:38:21.143 | 2008-08-24T15:38:21.143 | null | null | 2,260 | null |
25,128 | 1 | 25,139 | null | 6 | 559 | Is it possible to create images with PHP (as opposed to simply linking to them via HTML) and if so, where should I go first to learn about such a thing?
| How to create images in PHP | CC BY-SA 4.0 | null | 2008-08-24T16:01:46.907 | 2022-03-18T12:39:04.227 | 2022-03-18T12:39:04.227 | 5,446,749 | 1,384,652 | [
"php",
"image"
] |
25,123 | 2 | null | 25,116 | 4 | null | Look at the struct package: [https://docs.python.org/library/struct.html](https://docs.python.org/library/struct.html), it allows you to interpret strings as packed binary data.
Not sure if this will completely answer your question but you can use struct.unpack() to convert binary data to python objects.
```
import s... | null | CC BY-SA 3.0 | null | 2008-08-24T15:50:54.077 | 2014-11-02T02:33:18.430 | 2014-11-02T02:33:18.430 | 2,213,647 | 1,638 | null |
25,130 | 2 | null | 24,551 | 153 | null | In C# it doesn't matter. The two code samples you give are utterly equivalent. In the first example the C# compiler (or is it the CLR?) will construct an empty constructor and initialise the variables as if they were in the constructor (there's a slight nuance to this that Jon Skeet explains in the comments below).
If ... | null | CC BY-SA 4.0 | null | 2008-08-24T16:04:02.407 | 2019-03-07T14:59:04.053 | 2019-03-07T14:59:04.053 | 1,143 | 1,143 | null |
25,129 | 2 | null | 11,680 | 4 | null | I fully agree with Orion Edwards, and it is usually the way I approach the problem; but lately I've been starting to see some patterns(!) to the madness.
For more complex tasks I usually use something like an [interpreter](http://en.wikipedia.org/wiki/Interpreter_pattern) (or a [strategy](http://en.wikipedia.org/wiki/... | null | CC BY-SA 2.5 | null | 2008-08-24T16:03:41.410 | 2008-08-24T16:03:41.410 | null | null | 2,010 | null |
25,133 | 2 | null | 25,128 | 3 | null | Check out [GD](http://us3.php.net/gd). It contains a ton of functions for image creation,manipulation and interrogation. Your PHP install just has to built with the GD library which it probably was.
| null | CC BY-SA 2.5 | null | 2008-08-24T16:06:31.653 | 2008-08-24T16:35:04.563 | 2008-08-24T16:35:04.563 | 2,224 | 2,224 | null |
25,135 | 2 | null | 25,132 | 0 | null | Safari seems to have issues with some glyphs but not others, it may not be but it's probably best to do so, of course, this is my opinion and not backed up by anything but my own observations.
| null | CC BY-SA 2.5 | null | 2008-08-24T16:07:07.987 | 2008-08-24T16:07:07.987 | null | null | 1,384,652 | null |
25,131 | 2 | null | 25,128 | 6 | null | Yes this is possible. I believe there are multiple libraries to accomplish this. The most widely used is probably [ImageMagick](http://www.imagemagick.org/script/index.php) which is actually not PHP specific but comes with appropriate bindings.
See also in the [PHP documentation](http://php.net/imagick).
| null | CC BY-SA 2.5 | null | 2008-08-24T16:04:32.437 | 2008-08-24T16:04:32.437 | null | null | 1,968 | null |
25,137 | 1 | 25,255 | null | 6 | 1,855 | - [model checking](http://en.wikipedia.org/wiki/Model_checking)- -
In the course of my studies, I had a chance to use [Spin](http://spinroot.com/spin/whatispin.html), and it aroused my curiosity as to how much actual model checking is going on and how much value are organizations getting out of it. In my work experie... | What is your experience with software model checking? | CC BY-SA 2.5 | 0 | 2008-08-24T16:08:46.983 | 2012-06-10T10:57:29.077 | 2008-08-28T15:10:32.223 | null | null | [
"algorithm",
"correctness",
"formal-methods",
"formal-verification",
"model-checking"
] |
25,081 | 2 | null | 24,886 | 5 | null | In C, the compiler can generally optimize them to be the same if the result is unused.
However, in C++ if using other types that provide their own ++ operators, the prefix version is likely to be faster than the postfix version. So, if you don't need the postfix semantics, it is better to use the prefix operator.
| null | CC BY-SA 2.5 | null | 2008-08-24T14:29:01.637 | 2008-08-24T14:29:01.637 | null | null | 1,175 | null |
25,126 | 2 | null | 24,551 | 0 | null | I normally try the constructor to do nothing but getting the dependencies and initializing the related instance members with them. This will make you life easier if you want to unit test your classes.
If the value you are going to assign to an instance variable does not get influenced by any of the parameters you are ... | null | CC BY-SA 2.5 | null | 2008-08-24T15:59:11.017 | 2008-08-24T15:59:11.017 | null | null | 2,697 | null |
25,111 | 2 | null | 9,455 | 1 | null | > First step would be to gather information on everything the app needs to run; this I usually accomplish by running systrace(1) and ldd(1) to find out what is needed to run the software.
I'll give this a try. The big issue I've found with xinc is that while it is a PHP application, it wants to know application instal... | null | CC BY-SA 2.5 | null | 2008-08-24T15:21:50.247 | 2008-08-24T15:21:50.247 | null | null | 204 | null |
25,138 | 2 | null | 25,128 | 1 | null | [PHP GD](http://us2.php.net/manual/en/intro.image.php)
[Pear Image_Canvas](http://pear.php.net/package/Image_Canvas) (and [Image_Graph](http://pear.php.net/package/Image_Graph) for graphs)
Those are the two I know of.
| null | CC BY-SA 3.0 | null | 2008-08-24T16:11:21.097 | 2011-11-13T11:50:06.550 | 2011-11-13T11:50:06.550 | 764,846 | 2,118 | null |
25,139 | 2 | null | 25,128 | 12 | null | I prefer the [GD library](http://www.php.net/gd) - check out [the Examples](http://www.php.net/manual/en/image.examples.php), and this example:
```
<?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor(120, 20)
or die("Cannot Initialize new GD image stream");
$text_color = imagecolorallocate($im,... | null | CC BY-SA 4.0 | null | 2008-08-24T16:11:39.580 | 2019-02-16T10:03:09.887 | 2019-02-16T10:03:09.887 | 4,751,173 | 2,025 | null |
25,096 | 2 | null | 25,063 | 1 | null | I would recommend start giving parts of real assignments you have and make everything to be able to use his code. In other words train him as replacement for yourself.
This way you will commit yourself to allocating time to work with junior and he will be able to see "real life". By working on real assignments and hea... | null | CC BY-SA 2.5 | null | 2008-08-24T14:52:52.017 | 2008-08-24T14:52:52.017 | null | null | 2,586 | null |
25,132 | 1 | 25,173 | null | 17 | 931 | I did a lot of PHP programming in the last years and one thing that keeps annoying me is the weak support for Unicode and multibyte strings (to be sure, natively there is none). For example, "htmlentities" seems to be a much used function in the PHP world and I found it to be absolutely annoying when you've put an effo... | Are named entities in HTML still necessary in the age of Unicode aware browsers? | CC BY-SA 3.0 | 0 | 2008-08-24T16:04:39.443 | 2014-02-17T12:49:20.387 | 2020-06-20T09:12:55.060 | -1 | 2,077 | [
"php",
"html",
"unicode",
"internationalization"
] |
25,150 | 2 | null | 25,142 | 2 | null | > Anyway if the client is not there to commit at the end of the job the changes should be rolled back by the server.
In other words, if you have a stored procedure making changes to the database and there is a possibility that the connection might disconnect in the middle, be sure to enclose all changes within a trans... | null | CC BY-SA 2.5 | null | 2008-08-24T16:23:04.780 | 2008-08-24T16:23:04.780 | null | null | 51 | null |
25,142 | 1 | 25,150 | null | 0 | 589 | I'm running a long process stored procedure.
I'm wondering if in case of a timeout or any case of disconnection with the database after initiating the call to the stored procedure. Is it still working and implementing the changes on the server?
| Stored Procedure and Timeout | CC BY-SA 3.0 | null | 2008-08-24T16:16:21.647 | 2017-07-19T16:55:05.413 | 2017-07-19T16:55:05.413 | 7,750,640 | null | [
"database",
"stored-procedures",
"timeout"
] |
25,146 | 2 | null | 25,142 | 1 | null | It depends on the server I guess.
I know Firebird will detect disconnected clients and stop working.
Anyway if the client is not there to commit at the end of the job the changes should be rolled back by the server.
| null | CC BY-SA 2.5 | null | 2008-08-24T16:18:54.807 | 2008-08-24T16:35:05.640 | 2008-08-24T16:35:05.640 | 626 | 626 | null |
25,147 | 1 | 25,166 | null | 12 | 8,521 | I have two arrays of animals (for example).
```
$array = array(
array(
'id' => 1,
'name' => 'Cat',
),
array(
'id' => 2,
'name' => 'Mouse',
)
);
$array2 = array(
array(
'id' => 2,
'age' => 321,
),
array(
'id' => 1,
'age' => 123... | How can I merge PHP arrays? | CC BY-SA 2.5 | null | 2008-08-24T16:21:17.763 | 2017-01-09T12:46:45.560 | null | null | 2,118 | [
"php",
"arrays"
] |
25,155 | 2 | null | 25,147 | 3 | null | First off, why don't you use the ID as the index (or key, in the mapping-style array that php arrays are imo)?
```
$array = array(
1 => array(
'name' => 'Cat',
),
2 => array(
'name' => 'Mouse',
)
);
```
after that you'll have to foreach through one array, performing array_merge on the... | null | CC BY-SA 2.5 | null | 2008-08-24T16:28:08.590 | 2008-08-24T16:28:08.590 | null | null | 909 | null |
25,162 | 2 | null | 8,715 | 0 | null | If you're into Firebird you may want to watch [sinatica.com](http://www.sinatica.com/blog/en/).
We'll soon launch a real-time monitoring tool for Firebird DBAs.
< /shameless plug>
| null | CC BY-SA 2.5 | null | 2008-08-24T16:32:42.887 | 2008-08-24T16:32:42.887 | null | null | 626 | null |
25,163 | 2 | null | 25,128 | 3 | null | For decent tutorials on image generation using PHP:
GD - [http://devzone.zend.com/node/view/id/1269](http://devzone.zend.com/node/view/id/1269)
ImageMagick - [http://www.sitepoint.com/article/dynamic-images-imagemagick](http://www.sitepoint.com/article/dynamic-images-imagemagick)
| null | CC BY-SA 2.5 | null | 2008-08-24T16:33:40.997 | 2008-08-24T17:40:51.427 | 2008-08-24T17:40:51.427 | 2,633 | 2,633 | null |
25,161 | 1 | 25,262 | null | 9 | 6,025 | I have an image and on it are logos (it's a map), I want to have a little box popup with information about that logo's location when the user moves their mouse over said logo.
Can I do this without using a javascript framework and if so, are there any small libraries/scripts that will let me do such a thing?
| Tooltips on an image | CC BY-SA 2.5 | null | 2008-08-24T16:32:34.257 | 2018-01-05T13:22:55.673 | null | null | 1,384,652 | [
"javascript",
"html"
] |
25,167 | 2 | null | 25,161 | 4 | null | MooTools has a nifty script for this. See [MooTools Tips](http://docs.mootools.net/Plugins/Tips). Lightweight on the HTML as well.
Here's a [demo](http://demos111.mootools.net/Tips) of the 1.11 version.
| null | CC BY-SA 2.5 | null | 2008-08-24T16:40:08.670 | 2008-08-24T16:40:08.670 | null | null | 2,025 | null |
25,165 | 2 | null | 25,161 | 5 | null | A single image alone doesn't give the browser the semantic information on the logos within. You could use an [image map](http://en.wikipedia.org/wiki/Image_map) to supply the coordinates. To achieve tooltips, just apply a `title` attribute to each link. For more sophisticated tooltips (such as with styling, multiple li... | null | CC BY-SA 2.5 | null | 2008-08-24T16:35:42.737 | 2008-08-24T16:35:42.737 | null | null | 1,600 | null |
25,170 | 2 | null | 25,158 | 3 | null | Tabbed forms are usually good... but only if you want the user to be able to see any view at any time... and it sounds like you might not.
Separate forms definitely works, but you need to make sure that the switch is seemless...if you make sure the new form appears the same exact size and location of the old form, it ... | null | CC BY-SA 2.5 | null | 2008-08-24T16:42:17.450 | 2008-08-24T16:42:17.450 | null | null | 194 | null |
25,136 | 2 | null | 16,861 | 29 | null | Here is a snippet that will remove all tags not on the white list, and all tag attributes not on the attribues whitelist (so you can't use `onclick`).
It is a modified version of [http://www.djangosnippets.org/snippets/205/](http://www.djangosnippets.org/snippets/205/), with the regex on the attribute values to preven... | null | CC BY-SA 2.5 | null | 2008-08-24T16:08:37.920 | 2010-03-25T01:26:22.787 | 2010-03-25T01:26:22.787 | 2,363 | 2,363 | null |
25,173 | 2 | null | 25,132 | 7 | null | Named entities in "real" XHTML (i.e. with `application/xhtml+xml`, rather than the more frequently-used `text/html` compatibility mode) are discouraged. Aside from the five defined in XML itself (`<`, `>`, `&`, `"`, `'`), they'd all have to be defined in the DTD of the particular DocType you're usin... | null | CC BY-SA 2.5 | null | 2008-08-24T16:44:04.450 | 2008-08-24T16:44:04.450 | null | null | 1,600 | null |
25,178 | 2 | null | 20,899 | 1 | null | It was the backplane. Both drives of the RAID1 and one drive of the RAID5 were inaccessible. Incredibly, the VMware hypervisor continued to run for three days from memory with no access to its host disk, keeping the VMs it managed alive.
At step 3 above we diagnosed the hardware problem and replaced the RAID controlle... | null | CC BY-SA 3.0 | null | 2008-08-24T16:49:19.787 | 2013-02-05T21:03:48.693 | 2013-02-05T21:03:48.693 | 1,042 | 1,042 | null |
25,171 | 2 | null | 17,561 | 0 | null | Here's what I use:
Firefox:
- [DOM Inspector](http://www.mozilla.org/projects/inspector/)- [Launchy](http://gemal.dk/mozilla/launchy.html?project=launchy)- [Tamper Data](http://tamperdata.mozdev.org/)- [Web Developer Toolbar](http://chrispederick.com/work/web-developer/)
IE:
- [Internet Explorer Developer Toolbar](... | null | CC BY-SA 2.5 | null | 2008-08-24T16:43:05.433 | 2008-08-24T16:48:36.950 | 2008-08-24T16:48:36.950 | 1,414 | 1,414 | null |
25,151 | 2 | null | 16,861 | 4 | null | I don't do web development much any longer, but when I did, I did something like so:
When no parsing is supposed to happen, I usually just escape the data to not interfere with the database when I store it, and escape everything I read up from the database to not interfere with html when I display it (cgi.escape() in ... | null | CC BY-SA 2.5 | null | 2008-08-24T16:23:13.143 | 2008-08-24T16:23:13.143 | null | null | 2,010 | null |
25,174 | 1 | 26,200 | null | 4 | 2,120 | I've used the PHP MVC framework Symfony to build an on-demand web app.
It has an annoying bug - the session expires after about 15-30 minutes of inactivity. There is a config directive to prevent session expiration but it does not work. Even workarounds such as [this one](http://robrosenbaum.com/php/howto-disable-sess... | How to prevent session timeout in Symfony 1.0? | CC BY-SA 2.5 | 0 | 2008-08-24T16:45:06.757 | 2010-03-22T09:34:42.740 | null | null | 2,706 | [
"php",
"symfony1"
] |
25,186 | 2 | null | 25,182 | 1 | null | My first guess would be that will be faster as it requires only single scan of the table to find the results, but I suggest checking the execution plan for both queries.
| null | CC BY-SA 2.5 | null | 2008-08-24T16:58:30.937 | 2008-08-24T16:58:30.937 | null | null | 1,534 | null |