qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
486,143
<p>This situation arises from someone wanting to create their own "pages" in their web site without having to get into creating the corresponding actions. </p> <p>So say they have a URL like mysite.com/index/books... they want to be able to create mysite.com/index/booksmore or mysite.com/index/pancakes but not have to...
[ { "answer_id": 486222, "author": "Noah Goodrich", "author_id": 20178, "author_profile": "https://Stackoverflow.com/users/20178", "pm_score": 1, "selected": false, "text": "<p>You could use the magic <a href=\"http://us3.php.net/manual/en/language.oop5.overloading.php#language.oop5.overlo...
2009/01/28
[ "https://Stackoverflow.com/questions/486143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11252/" ]
This situation arises from someone wanting to create their own "pages" in their web site without having to get into creating the corresponding actions. So say they have a URL like mysite.com/index/books... they want to be able to create mysite.com/index/booksmore or mysite.com/index/pancakes but not have to create an...
You have to play with the router <http://framework.zend.com/manual/en/zend.controller.router.html> I think you can specify a wildcard to catch every action on a specific module (the default one to reduce the url) and define an action that will take care of render the view according to the url (or even action called) ...
486,159
<p>I've just learnt a bit jQuery, and am trying to use it for a simple color-changing effect. Let's say I have two <code>&lt;div</code>>s, #foo and #bar. #foo has a lot of URLs, and has the following CSS defined:</p> <pre><code>#foo a {color: blue; border-bottom: 1px dashed blue} #foo a:hover {color: black; border-bo...
[ { "answer_id": 486200, "author": "che", "author_id": 7806, "author_profile": "https://Stackoverflow.com/users/7806", "pm_score": 3, "selected": true, "text": "<p>!important seems to make css property stronger than inline style, at least in Firefox. Try to change your styles to something ...
2009/01/28
[ "https://Stackoverflow.com/questions/486159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57973/" ]
I've just learnt a bit jQuery, and am trying to use it for a simple color-changing effect. Let's say I have two `<div`>s, #foo and #bar. #foo has a lot of URLs, and has the following CSS defined: ``` #foo a {color: blue; border-bottom: 1px dashed blue} #foo a:hover {color: black; border-bottom: 1px solid black} ``` ...
!important seems to make css property stronger than inline style, at least in Firefox. Try to change your styles to something like this: ``` #foo a:hover { color: black !important; } ```
486,181
<p>What is the simplest way to suppress any output a function might produce? Say I have this:</p> <pre><code>function testFunc() { echo 'Testing'; return true; } </code></pre> <p>And I want to call testFunc() and get its return value without "Testing" showing up in the page. Assuming this would be in the cont...
[ { "answer_id": 486193, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 4, "selected": false, "text": "<p>Here you go:</p>\n\n<pre><code>ob_start();\ntestFunc();\nob_end_clean();\n</code></pre>\n\n<p>\"ob\" stands for \"o...
2009/01/28
[ "https://Stackoverflow.com/questions/486181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5291/" ]
What is the simplest way to suppress any output a function might produce? Say I have this: ``` function testFunc() { echo 'Testing'; return true; } ``` And I want to call testFunc() and get its return value without "Testing" showing up in the page. Assuming this would be in the context of other code that *do...
Yes, messing with the [Output Buffer](http://php.net/outcontrol) is exactly the answer. Just turn it on before you call your method that would output (not the function itself, but where you call it, you could wrap it around your whole script or the script flow, but you can make it as "tight" as possible by just wrappin...
486,184
<p>I'm using the <a href="http://malsup.com/jquery/cycle/" rel="nofollow noreferrer">JQuery Cycle Plugin</a> in an attempt to fade in/out images for a slide show. I am able to get it working in Firefox and Safari, however, when I view in Internet Explorer, I see very unexpected behavior.</p> <p>In Internet Explorer, ...
[ { "answer_id": 486214, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 3, "selected": true, "text": "<p>It didnt show in chrome which leads me to think it's a corrupted jpg, i opened it up in notepad++ and noticed a bunch o...
2009/01/28
[ "https://Stackoverflow.com/questions/486184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56461/" ]
I'm using the [JQuery Cycle Plugin](http://malsup.com/jquery/cycle/) in an attempt to fade in/out images for a slide show. I am able to get it working in Firefox and Safari, however, when I view in Internet Explorer, I see very unexpected behavior. In Internet Explorer, the cycling is happening as expected, but some o...
It didnt show in chrome which leads me to think it's a corrupted jpg, i opened it up in notepad++ and noticed a bunch of xml/non-binary data, it could just be a comment or something but i dont know, maybe that info will help with the problem. the start of the xml looks like: ``` <!DOCTYPE plist PUBLIC "-//Apple//DTD ...
486,194
<p>I am in the middle of a project targeting mobile phones (more like pocket PCs). I couldn't find a way to (reliably) access the front camera on any platform (I've tried Android, J2ME and Windows Mobile), let alone capture video from said camera.</p> <p>Can anyone provide any insight on how to achieve this on Windows...
[ { "answer_id": 486227, "author": "Kevin Loney", "author_id": 13834, "author_profile": "https://Stackoverflow.com/users/13834", "pm_score": 0, "selected": false, "text": "<p>I was doing some tinkering with this about a year ago and Windows Mobile provides a <a href=\"http://msdn.microsoft...
2009/01/28
[ "https://Stackoverflow.com/questions/486194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59595/" ]
I am in the middle of a project targeting mobile phones (more like pocket PCs). I couldn't find a way to (reliably) access the front camera on any platform (I've tried Android, J2ME and Windows Mobile), let alone capture video from said camera. Can anyone provide any insight on how to achieve this on Windows Mobile, S...
I did it in both J2ME and Symbian (S60). For a Symbian example check this [example](http://www.forum.nokia.com/info/sw.nokia.com/id/9fd0e9a7-bb4b-489d-84ac-b19b4ae93369/S60_Platform_Camera_Example_with_AutoFocus_Support.html) (you might need to register to forum Nokia), in order to use the front camera simply initializ...
486,197
<pre><code>public static List&lt;Vertex&lt;Integer&gt;&gt; petersenGraph() { List&lt;Vertex&lt;Integer&gt;&gt; v = new ArrayList&lt;Vertex&lt;Integer&gt;&gt;(); for (int i = 0; i &lt; 10; i++) { v.add(new Vertex&lt;Integer&gt;(i)); } int[][] edges = {{0,1}, {1,0}, {1,2}, {2,1}, {2,3}, {3,2...
[ { "answer_id": 486207, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 0, "selected": false, "text": "<p>The multi-dimensional array <code>edges</code> is effectively an \"array of arrays.\" The <code>for</code> stateme...
2009/01/28
[ "https://Stackoverflow.com/questions/486197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` public static List<Vertex<Integer>> petersenGraph() { List<Vertex<Integer>> v = new ArrayList<Vertex<Integer>>(); for (int i = 0; i < 10; i++) { v.add(new Vertex<Integer>(i)); } int[][] edges = {{0,1}, {1,0}, {1,2}, {2,1}, {2,3}, {3,2}, {3,4}, {4,3}, {4,0}, {0,4}, {5,6}, {6,5}, {6,...
Argh, that's ugly. edges is a bidimensional array, so it is an array of int arrays. In the actual definition, it is an array of pairs. The line for (int[] e: edges) simply means that in each iteration, e will become a different array of ints, so in each iteration it is a different pair. Then, e[0] represents the f...
486,211
<p>I've got a stylesheet that will not, for whatever reason, apply list-style-type to a UL element. I'm using YUI's Grid CSS with their reset-fonts-grid.css file, which I know strips that out as part of the CSS reset.</p> <p>After calling YUI, I call the stylesheet for the website and in there have a block for UL:</p>...
[ { "answer_id": 486233, "author": "Sampson", "author_id": 54680, "author_profile": "https://Stackoverflow.com/users/54680", "pm_score": 1, "selected": false, "text": "<ul>\n<li>Have you tried following the rule with !important?</li>\n<li>Which stylesheet does FireBug show having last cont...
2009/01/28
[ "https://Stackoverflow.com/questions/486211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/204/" ]
I've got a stylesheet that will not, for whatever reason, apply list-style-type to a UL element. I'm using YUI's Grid CSS with their reset-fonts-grid.css file, which I know strips that out as part of the CSS reset. After calling YUI, I call the stylesheet for the website and in there have a block for UL: ``` ul {list...
If I'm not mistaken, you should be applying this rule to the li, not the ul. ``` ul li {list-style-type: disc;} ```
486,237
<p>I have 3 divs with 2 possible image tags for each (active or inactive). If one div is clicked to be active the other divs must be set to inactive. How do I accomplish this with img tags and what happens if user has javascript disable?</p>
[ { "answer_id": 486254, "author": "Derek P.", "author_id": 45615, "author_profile": "https://Stackoverflow.com/users/45615", "pm_score": 1, "selected": false, "text": "<p>if a user has JavaScript disabled, there is nothing you can do that is JavaScript-based to deal with dynamically modif...
2009/01/28
[ "https://Stackoverflow.com/questions/486237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49632/" ]
I have 3 divs with 2 possible image tags for each (active or inactive). If one div is clicked to be active the other divs must be set to inactive. How do I accomplish this with img tags and what happens if user has javascript disable?
Do you mean something like this? ``` <div class="block" id="block1"> <img src='inactive_block1.jpg'> </div> <div class="block" id="block2"> <img src='inactive_block2.jpg'> </div> <div class="block" id="block3"> <img src='inactive_block3.jpg'> </div> ``` Using a library like [jQuery](http://www.jquery.c...
486,244
<p>I have this simple xhtml:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" style="height: 100%;"&gt; &lt;head&gt; &lt;/head&gt; &lt;body st...
[ { "answer_id": 486258, "author": "dylanfm", "author_id": 38795, "author_profile": "https://Stackoverflow.com/users/38795", "pm_score": 1, "selected": false, "text": "<p>If you want 2000px of blue beneath the 400px div, make this change:</p>\n\n<p><em>Change the height of the containing d...
2009/01/28
[ "https://Stackoverflow.com/questions/486244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have this simple xhtml: ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" style="height: 100%;"> <head> </head> <body style="height: 100%;"> <div style="height: 100%...
If you want 2000px of blue beneath the 400px div, make this change: *Change the height of the containing div to be the height of it's contents + the 2000px space.* ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ...
486,252
<p><strong>Background</strong></p> <p>I am working on a phonetic converter program which converts english text into equivalant regional language text. Regional languages will have more characters than english letters and regional language fonts uses almost all positions (1-255) in a font. </p> <p>My program supports ...
[ { "answer_id": 486259, "author": "ChrisW", "author_id": 49942, "author_profile": "https://Stackoverflow.com/users/49942", "pm_score": 3, "selected": true, "text": "<p>I suggest you use a standard encoding of non-ASCII (regional) characters.</p>\n\n<p>A standard encoding is called \"unico...
2009/01/28
[ "https://Stackoverflow.com/questions/486252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50419/" ]
**Background** I am working on a phonetic converter program which converts english text into equivalant regional language text. Regional languages will have more characters than english letters and regional language fonts uses almost all positions (1-255) in a font. My program supports different fonts and I have cre...
I suggest you use a standard encoding of non-ASCII (regional) characters. A standard encoding is called "unicode", for example <http://www.joelonsoftware.com/articles/Unicode.html> Anyway: to answer your questions ... > > Will 255 virtual functions in a single class make any performance issues? > > > In a word:...
486,270
<p>Say I want to check if a record in a MySQL table exists. I'd run a query, check the number of rows returned. If 0 rows do this, otherwise do that.</p> <pre><code>SELECT * FROM table WHERE id=5 SELECT id FROM table WHERE id=5 </code></pre> <p>Is there any difference at all between these two queries? Is effort spent...
[ { "answer_id": 486277, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 4, "selected": true, "text": "<p>Optimizers are pretty smart (generally). They typically only grab what they need so I'd go with:</p>\n\n<pre><code>SELEC...
2009/01/28
[ "https://Stackoverflow.com/questions/486270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49697/" ]
Say I want to check if a record in a MySQL table exists. I'd run a query, check the number of rows returned. If 0 rows do this, otherwise do that. ``` SELECT * FROM table WHERE id=5 SELECT id FROM table WHERE id=5 ``` Is there any difference at all between these two queries? Is effort spent in returning every column...
Optimizers are pretty smart (generally). They typically only grab what they need so I'd go with: ``` SELECT COUNT(1) FROM mytable WHERE id = 5 ```
486,289
<p>For a simple example of using a NSMutableArray of strings called rows, what do I have to implement in my table controller to move the tableView rows and have the changes reflected in my array?</p>
[ { "answer_id": 486301, "author": "Ryan Townshend", "author_id": 24707, "author_profile": "https://Stackoverflow.com/users/24707", "pm_score": 5, "selected": true, "text": "<p>Here we do our heavy lifting. </p>\n\n<pre><code> - (void)tableView:(UITableView *)tableView \nmoveRowAtIndexPath...
2009/01/28
[ "https://Stackoverflow.com/questions/486289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24707/" ]
For a simple example of using a NSMutableArray of strings called rows, what do I have to implement in my table controller to move the tableView rows and have the changes reflected in my array?
Here we do our heavy lifting. ``` - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { NSLog(@"move from:%d to:%d", fromIndexPath.row, toIndexPath.row); // fetch the object at the row being moved NSString *r = [rows ...
486,349
<p>I've got a list of about 30 <code>&lt;li&gt;</code> in a <code>&lt;ul&gt;</code>. Is there any way, using CSS, to divide these into three columns of ten?</p>
[ { "answer_id": 486362, "author": "willoller", "author_id": 33822, "author_profile": "https://Stackoverflow.com/users/33822", "pm_score": 3, "selected": false, "text": "<p>I usually set the widths at 28% and float the to the left:</p>\n\n<pre><code>ul li {\n width: 28%;\n margin: .5em...
2009/01/28
[ "https://Stackoverflow.com/questions/486349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11574/" ]
I've got a list of about 30 `<li>` in a `<ul>`. Is there any way, using CSS, to divide these into three columns of ten?
In CSS3 this is [possible](http://www.quirksmode.org/css/multicolumn.html). ```css #columns { -moz-column-count: 3; -moz-column-gap: 20px; -webkit-column-count: 3; -webkit-column-gap: 20px; column-count: 3; column-gap: 20px; } ``` HTML: ``` <div id="columns"> <ul> ... lots of lis ... </ul> </div> `...
486,372
<p>Hey, I have a field called STATUS and it is either 1 to show or 0 to hide. My code is below. I am using an edit in place editor with jQuery. Everytime you update it creates a new ROW which I want, but I want only the new one to have STATUS = 1 and the others to 0. Any ideas on how I would do that?</p> <pre><code>&l...
[ { "answer_id": 486399, "author": "Sasha", "author_id": 55745, "author_profile": "https://Stackoverflow.com/users/55745", "pm_score": 2, "selected": true, "text": "<p>I am not sure exactly what you mean - do you want to make all the entries except the new one have status = 0? If so, just ...
2009/01/28
[ "https://Stackoverflow.com/questions/486372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Hey, I have a field called STATUS and it is either 1 to show or 0 to hide. My code is below. I am using an edit in place editor with jQuery. Everytime you update it creates a new ROW which I want, but I want only the new one to have STATUS = 1 and the others to 0. Any ideas on how I would do that? ``` <?php includ...
I am not sure exactly what you mean - do you want to make all the entries except the new one have status = 0? If so, just issue an update before the insert: ``` UPDATE notes SET status = 0 ``` However, I should also note that you have a potential SQL injection to worry about. By stripping slashes *after* applying "m...
486,380
<p>I have a batch file to compile and link all of my code. It contains the following:</p> <pre><code>@echo off nasm -f aout -o start.o start.asm gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c gcc -Wall -O -fstrength-reduce -fomit-frame-poin...
[ { "answer_id": 488067, "author": "John Mulder", "author_id": 2242, "author_profile": "https://Stackoverflow.com/users/2242", "pm_score": 1, "selected": false, "text": "<p><strong>A simpler example</strong><br>\nWindows 7 installed<br>\nUsing <a href=\"http://www.cygwin.com/\" rel=\"nofol...
2009/01/28
[ "https://Stackoverflow.com/questions/486380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2128/" ]
I have a batch file to compile and link all of my code. It contains the following: ``` @echo off nasm -f aout -o start.o start.asm gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-f...
Are you running from a command line or by double-clicking in Explorer? Maybe you have the *Edit* action set as the default? Try right-clicking and selecting *Open*. EDIT: Maybe your line terminators are messed up. Windows expects CRLF. In Notepad++: * Click View->Show End Of Line. * If they are not CRLF, click For...
486,393
<p>Lets say I have a component called Tasking (that I cannot modify) which exposes a method “DoTask” that does some possibly lengthy calculations and returns the result in via an event TaskCompleted. Normally this is called in a windows form that the user closes after she gets the results.</p> <p>In my particular sc...
[ { "answer_id": 486530, "author": "Jason Down", "author_id": 9732, "author_profile": "https://Stackoverflow.com/users/9732", "pm_score": 2, "selected": false, "text": "<p>Maybe you could get DoSyncTask to start a timer object that checks for the value of your data variable at some appropr...
2009/01/28
[ "https://Stackoverflow.com/questions/486393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5691/" ]
Lets say I have a component called Tasking (that I cannot modify) which exposes a method “DoTask” that does some possibly lengthy calculations and returns the result in via an event TaskCompleted. Normally this is called in a windows form that the user closes after she gets the results. In my particular scenario I nee...
Maybe you could get DoSyncTask to start a timer object that checks for the value of your data variable at some appropriate interval. Once data has a value, you could then have another event fire to tell you that data now has a value (and shut the timer off of course). Pretty ugly hack, but it could work... in theory. ...
486,400
<p>I currently have a controller were I would like to keep track of logging in a separate log file, like: tracker.log. I currently get about 100,000 hits a day with this, and I would like to separate the log from all the other controllers so I can easily debug those as well as the tracker.<br /><br /> I couldn't find a...
[ { "answer_id": 486530, "author": "Jason Down", "author_id": 9732, "author_profile": "https://Stackoverflow.com/users/9732", "pm_score": 2, "selected": false, "text": "<p>Maybe you could get DoSyncTask to start a timer object that checks for the value of your data variable at some appropr...
2009/01/28
[ "https://Stackoverflow.com/questions/486400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59220/" ]
I currently have a controller were I would like to keep track of logging in a separate log file, like: tracker.log. I currently get about 100,000 hits a day with this, and I would like to separate the log from all the other controllers so I can easily debug those as well as the tracker. I couldn't find anything for ...
Maybe you could get DoSyncTask to start a timer object that checks for the value of your data variable at some appropriate interval. Once data has a value, you could then have another event fire to tell you that data now has a value (and shut the timer off of course). Pretty ugly hack, but it could work... in theory. ...
486,408
<p>I have an ASP.NET MVC form that may (usually does) submit a response that would trigger the "A potentially dangerous Request.Form value was detected form the client" error.</p> <p>To try to get around this, I have placed a ValidateRequest="false" in the page directive.</p> <p>Only problem: I'm still getting the er...
[ { "answer_id": 486639, "author": "Levi", "author_id": 59641, "author_profile": "https://Stackoverflow.com/users/59641", "pm_score": 7, "selected": true, "text": "<p>In MVC, validation takes place at the controller level, not at the page level. To see why this is, consider that at the ti...
2009/01/28
[ "https://Stackoverflow.com/questions/486408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/691/" ]
I have an ASP.NET MVC form that may (usually does) submit a response that would trigger the "A potentially dangerous Request.Form value was detected form the client" error. To try to get around this, I have placed a ValidateRequest="false" in the page directive. Only problem: I'm still getting the error! Now, all wa...
In MVC, validation takes place at the controller level, not at the page level. To see why this is, consider that at the time the controller action is executing, we don't know what view will be chosen to render. (In fact, the controller action might not even render a view at all! It might open a file download prompt on ...
486,414
<p>Highlight some text on this webpage, then click basically anywhere on the document. Your selection will disappear.</p> <p>Is there a way to prevent this behavior when the user clicks on a specific element, either by CSS or Javascript?</p> <p>E.g.:</p> <pre><code>var element = document.getElementById("foo"); foo....
[ { "answer_id": 486427, "author": "Sparr", "author_id": 13675, "author_profile": "https://Stackoverflow.com/users/13675", "pm_score": 1, "selected": false, "text": "<p>This behavior, while mostly universal in modern browsers, is browser/implementation specific and almost completely unrela...
2009/01/28
[ "https://Stackoverflow.com/questions/486414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58249/" ]
Highlight some text on this webpage, then click basically anywhere on the document. Your selection will disappear. Is there a way to prevent this behavior when the user clicks on a specific element, either by CSS or Javascript? E.g.: ``` var element = document.getElementById("foo"); foo.onclick = function(e){ //s...
"return false" as well as "e.preventDefault()" in onmousedown works in FF and Safari, but not IE. The only solution for IE, as far as I can tell, is to throw an error. This works in all browsers (but causes an error in IE, since preventDefault is not a method): ``` //clicking the 'test' element will not deselect text...
486,416
<p>I have an UltraCalendarCombo calendar control that I need to disable a set of dates in (weekends and public holidays basically).</p> <p>I iterate through the list of dates for that month and set all the corresponding dates to disabled, this makes the current month look alright, but when I click the next month butto...
[ { "answer_id": 486459, "author": "Jim Petkus", "author_id": 38053, "author_profile": "https://Stackoverflow.com/users/38053", "pm_score": 2, "selected": false, "text": "<p>Their controls have been going downhill for some time. I want to know what they are all smoking over there. I have b...
2009/01/28
[ "https://Stackoverflow.com/questions/486416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55162/" ]
I have an UltraCalendarCombo calendar control that I need to disable a set of dates in (weekends and public holidays basically). I iterate through the list of dates for that month and set all the corresponding dates to disabled, this makes the current month look alright, but when I click the next month button on the c...
Sorted it, the DaysOfMonth collection applies to a specific day (by number) of all months. For example, DaysOfMonth[10] applies to the tenth of every month of the year. So I needed to use: ``` Infragistics.Win.UltraWinSchedule.Day theDay = _form.ValueDateCalInfo.GetDay(date, true); if (theDay != null) theDay.Enabled ...
486,420
<p>We know that if you have:</p> <pre><code>var aa = new [] { 1, 2, 3, 4, 5 }; for (int i = 0; i &lt; aa.length; ++i) { aa[i] = aa[i] + 1; } </code></pre> <p>it's really</p> <pre><code>var aa = new [] { 1, 2, 3, 4, 5 }; Arrary.ForEach(aa, a =&gt; a + 1); </code></pre> <p>However, what if I had this:</p> <pre><...
[ { "answer_id": 486431, "author": "Jon Limjap", "author_id": 372, "author_profile": "https://Stackoverflow.com/users/372", "pm_score": 1, "selected": false, "text": "<p>This won't be fast, but it just might work</p>\n\n<pre><code>var aa = new [] { 1, 2, 3, 4, 5 };\nvar ab = new [] { 1, 2,...
2009/01/28
[ "https://Stackoverflow.com/questions/486420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31728/" ]
We know that if you have: ``` var aa = new [] { 1, 2, 3, 4, 5 }; for (int i = 0; i < aa.length; ++i) { aa[i] = aa[i] + 1; } ``` it's really ``` var aa = new [] { 1, 2, 3, 4, 5 }; Arrary.ForEach(aa, a => a + 1); ``` However, what if I had this: ``` var aa = new [] { 1, 2, 3, 4, 5 }; var ab = new [] { 1, 2, 3,...
It's not pretty, but this will work (using the Select() overload that returns the index of the element): ``` var aa = new[] { 1, 2, 3, 4, 5 }; var ab = new[] { 1, 2, 3, 4, 5 }; Array.ForEach( aa.Select((x, i) => i).ToArray(), i => aa[i] = ab[i] + 1); ``` IMHO a simple "for" loops is a lot easier to understa...
486,452
<p>One of apps I take care of in checking a Oracle DB table every x seconds to see if there are new data to process (other real-time app is populating it). </p> <p>Our new client business process forces our real-time up to populate this table with lots of records in a same time (say 10 000), but just few times a day. ...
[ { "answer_id": 486513, "author": "Gary Myers", "author_id": 25714, "author_profile": "https://Stackoverflow.com/users/25714", "pm_score": 5, "selected": true, "text": "<pre><code>select * from\n(select c.* from cool_table c\n where date &gt;= to_date('200901010000', 'YYYYMMDDhh24mi') \...
2009/01/28
[ "https://Stackoverflow.com/questions/486452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3579/" ]
One of apps I take care of in checking a Oracle DB table every x seconds to see if there are new data to process (other real-time app is populating it). Our new client business process forces our real-time up to populate this table with lots of records in a same time (say 10 000), but just few times a day. Next time ...
``` select * from (select c.* from cool_table c where date >= to_date('200901010000', 'YYYYMMDDhh24mi') order by seq_nr, entry_dts) where rownum < 50 ``` You need to ensure the ordering is done before the rownum filtering (otherwise it will take the first 50 rows it finds, then order them)
486,454
<p>I'm just starting to learn C++ so you'll have to bear with my ignorance. Is there a way to to declare functions such that they can be referenced without being written before the function that uses them. I'm working with one cpp file (not my decision) and my functions call themselves so there is not really a proper o...
[ { "answer_id": 486465, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 4, "selected": true, "text": "<p>You can write function <strong>prototypes</strong> before you implement them. A function prototype names a function, its...
2009/01/28
[ "https://Stackoverflow.com/questions/486454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39189/" ]
I'm just starting to learn C++ so you'll have to bear with my ignorance. Is there a way to to declare functions such that they can be referenced without being written before the function that uses them. I'm working with one cpp file (not my decision) and my functions call themselves so there is not really a proper orde...
You can write function **prototypes** before you implement them. A function prototype names a function, its return type, and the type of its arguments. The only thing that needs to be above the call to your function is the prototype. Here's an example: ``` // prototype int your_function(int an_argument); // ... // he...
486,460
<p>I am trying to serialize an Exception object in C#. However, it appears that it is impossible since the Exception class is not marked as <a href="https://msdn.microsoft.com/en-us/library/system.serializableattribute" rel="noreferrer"><code>[Serializable]</code></a>. Is there a way to work around that?</p> <p>If som...
[ { "answer_id": 486477, "author": "mson", "author_id": 36902, "author_profile": "https://Stackoverflow.com/users/36902", "pm_score": -1, "selected": false, "text": "<p>I'm not sure why you would want to serialize the exception...</p>\n\n<p>If I did want to do what you specify, I'd create ...
2009/01/28
[ "https://Stackoverflow.com/questions/486460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42024/" ]
I am trying to serialize an Exception object in C#. However, it appears that it is impossible since the Exception class is not marked as [`[Serializable]`](https://msdn.microsoft.com/en-us/library/system.serializableattribute). Is there a way to work around that? If something goes wrong during the execution of the app...
What I've done before is create a custom Error class. This encapsulates all the relevant information about an Exception and is XML serializable. ``` [Serializable] public class Error { public DateTime TimeStamp { get; set; } public string Message { get; set; } public string StackTrace { get; set; } pu...
486,494
<p>I'm facing this strange problem.</p> <p>I'm trying to read a file that is located in another machine as a shared resource:</p> <pre><code>\\remote-machine\dir\MyFileHere.txt </code></pre> <p>When I run a standalone application ( a 16 lines java file ) everything is just fine. But when I attempt to read the same f...
[ { "answer_id": 486507, "author": "Steve Wranovsky", "author_id": 3429, "author_profile": "https://Stackoverflow.com/users/3429", "pm_score": 4, "selected": true, "text": "<p>Is the shared resource protected by a username and password? And if so, is your application engine running as that...
2009/01/28
[ "https://Stackoverflow.com/questions/486494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
I'm facing this strange problem. I'm trying to read a file that is located in another machine as a shared resource: ``` \\remote-machine\dir\MyFileHere.txt ``` When I run a standalone application ( a 16 lines java file ) everything is just fine. But when I attempt to read the same file with using the same class and...
Is the shared resource protected by a username and password? And if so, is your application engine running as that user? If your application engine is running as a Windows Service, the Windows service cannot be running as the "Local System Account". This account cannot access the network. You must configure your servic...
486,499
<p>So, I've been 'collecting' CSS menus for a while now (another term would be 'borrowing', yet another would be 'blatantly ripping off'), to learn from them and to potentially reuse some of the leetness in my own projects.</p> <p>Being an oldschool HTML purist, I love the idea of styled <code>&lt;ul&gt;</code>s and <...
[ { "answer_id": 486511, "author": "Birk", "author_id": 56692, "author_profile": "https://Stackoverflow.com/users/56692", "pm_score": 3, "selected": true, "text": "<p>Other than stripping out the span tags I think its fine.</p>\n\n<p>There is no reason to have them becasue with your setup ...
2009/01/28
[ "https://Stackoverflow.com/questions/486499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57068/" ]
So, I've been 'collecting' CSS menus for a while now (another term would be 'borrowing', yet another would be 'blatantly ripping off'), to learn from them and to potentially reuse some of the leetness in my own projects. Being an oldschool HTML purist, I love the idea of styled `<ul>`s and `<ol>`s, and the better menu...
Other than stripping out the span tags I think its fine. There is no reason to have them becasue with your setup you can style the text however you want with ``` li a {/*styles*/} ``` You should also be able to remove the ``` <span class="clearit" /><br /> ``` section as well. If you're trying to float just the...
486,503
<p>In an SSRS report:</p> <p>I am specifying the footer's background image using an expression, so that the image on the first page is different from other pages. </p> <p>The images are stored as part of the project, and are displaying correctly, however I get this warning</p> <pre><code>Build complete -- 0 errors, ...
[ { "answer_id": 486511, "author": "Birk", "author_id": 56692, "author_profile": "https://Stackoverflow.com/users/56692", "pm_score": 3, "selected": true, "text": "<p>Other than stripping out the span tags I think its fine.</p>\n\n<p>There is no reason to have them becasue with your setup ...
2009/01/28
[ "https://Stackoverflow.com/questions/486503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59587/" ]
In an SSRS report: I am specifying the footer's background image using an expression, so that the image on the first page is different from other pages. The images are stored as part of the project, and are displaying correctly, however I get this warning ``` Build complete -- 0 errors, 0 warnings [rsInvalidImageR...
Other than stripping out the span tags I think its fine. There is no reason to have them becasue with your setup you can style the text however you want with ``` li a {/*styles*/} ``` You should also be able to remove the ``` <span class="clearit" /><br /> ``` section as well. If you're trying to float just the...
486,529
<p>I have a XAML form for use in my application, and I have subclassed the Frame class to create my own, and edited the interface to specify my own class for the content (as I need to access properties on the content for data binding).</p> <p>The problem comes then in the designer that the compiler says it cannot crea...
[ { "answer_id": 486611, "author": "Marc Novakowski", "author_id": 27020, "author_profile": "https://Stackoverflow.com/users/27020", "pm_score": 1, "selected": true, "text": "<p>More information in your question might help, but after a quick google I found <a href=\"http://forums.isaserver...
2009/01/28
[ "https://Stackoverflow.com/questions/486529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31387/" ]
I have a XAML form for use in my application, and I have subclassed the Frame class to create my own, and edited the interface to specify my own class for the content (as I need to access properties on the content for data binding). The problem comes then in the designer that the compiler says it cannot create an inst...
More information in your question might help, but after a quick google I found [this forum](http://forums.isaserver.org/fb.aspx?m=2002054360) which may answer your question (there appears to be a hotfix that may help).
486,555
<p>When comparing enums that come from different sources such as those of the following code GCC emits warnings. Is there a way to avoid these warnings without c-style casts?</p> <pre><code>struct Enumerator { enum { VALUE = 5 }; }; template&lt;int V&gt; struct TemplatedEnumerator { enum { VALUE = V }; }; if...
[ { "answer_id": 486564, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 3, "selected": false, "text": "<p>I believe you can provide your own comparison operators, but you'll have to name the enums first:</p>\n\n<pre><code>struc...
2009/01/28
[ "https://Stackoverflow.com/questions/486555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15124/" ]
When comparing enums that come from different sources such as those of the following code GCC emits warnings. Is there a way to avoid these warnings without c-style casts? ``` struct Enumerator { enum { VALUE = 5 }; }; template<int V> struct TemplatedEnumerator { enum { VALUE = V }; }; if(Enumerator::VALUE =...
Simple answer in your case: don't use an `enum`, use an inline-defined `static const int`: ``` struct Enumerator { static int const VALUE = 5; }; template<int V> struct TemplatedEnumerator { static int const VALUE = V; }; ``` In this special case, that's equivalent and all compilers of the last few years sh...
486,563
<p>Let's say I have a string "<strong>I like big butts and I cannot lie</strong>" and I cut it with <code>overflow:hidden</code>, so it displays something like this:</p> <blockquote> <p>I like big butts and I cann</p> </blockquote> <p>cutting off the text. Is it possible to display this like this:</p> <blockquote>...
[ { "answer_id": 486570, "author": "ceejayoz", "author_id": 1902010, "author_profile": "https://Stackoverflow.com/users/1902010", "pm_score": 4, "selected": false, "text": "<p>Yes, via the <a href=\"http://www.quirksmode.org/css/textoverflow.html\" rel=\"noreferrer\"><code>text-overflow</c...
2009/01/28
[ "https://Stackoverflow.com/questions/486563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47937/" ]
Let's say I have a string "**I like big butts and I cannot lie**" and I cut it with `overflow:hidden`, so it displays something like this: > > I like big butts and I cann > > > cutting off the text. Is it possible to display this like this: > > I like big butts and I cann... > > > using CSS?
You can use [text-overflow: ellipsis;](https://developer.mozilla.org/en-US/docs/CSS/text-overflow) which [according to caniuse](http://caniuse.com/#feat=text-overflow) is supported by all the major browsers. Here's [a demo](http://jsbin.com/eduten/2) on jsbin. ```css .cut-text { text-overflow: ellipsis; overflow...
486,567
<p>When defining a customer-accessible API, what is the preferred industry practice between the following:</p> <p><strong>a)</strong> Defining a set of <strong>explicit</strong> API methods, each with a very narrow and specific purpose, for example:</p> <pre><code>SetUserName &lt;name&gt; SetUserAge &lt;age&gt...
[ { "answer_id": 486582, "author": "Uri", "author_id": 23072, "author_profile": "https://Stackoverflow.com/users/23072", "pm_score": 3, "selected": true, "text": "<p>I would personally argue for (a), since our goal is to make the \"static\" code as accurate and reliable as possible. </p>\n...
2009/01/28
[ "https://Stackoverflow.com/questions/486567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22489/" ]
When defining a customer-accessible API, what is the preferred industry practice between the following: **a)** Defining a set of **explicit** API methods, each with a very narrow and specific purpose, for example: ``` SetUserName <name> SetUserAge <age> SetUserAddress <address> ``` **b)** Defining a set of m...
I would personally argue for (a), since our goal is to make the "static" code as accurate and reliable as possible. By using the generalized form, we are introducing a risk for runtime errors. For example, I could set an attribute of type age with a value that is actually a string, etc. This is very similar to the ...
486,576
<p>I've three divs. Header, central and footer. There is a table in central div (gridview) which is almost always longer than outer div. So I've made this div scrollable vertically. The question is: how can I make table header that it would be visible after div is scrolled down? I could have done this header with separ...
[ { "answer_id": 486579, "author": "Draemon", "author_id": 26334, "author_profile": "https://Stackoverflow.com/users/26334", "pm_score": 2, "selected": false, "text": "<p>You would have to put the header outside the scrollable div. Everything within the div will scroll.</p>\n\n<p><strong>E...
2009/01/28
[ "https://Stackoverflow.com/questions/486576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3182/" ]
I've three divs. Header, central and footer. There is a table in central div (gridview) which is almost always longer than outer div. So I've made this div scrollable vertically. The question is: how can I make table header that it would be visible after div is scrolled down? I could have done this header with separate...
Here is a basic solution using javascript: ``` function position(table) { table.rows[0].style.position="absolute"; table.rows[0].style.top="0px"; table.style.marginTop = table.rows[0].clientHeight/1.2; var widths = Array(); for(var i = 0; i < table.rows[0].cells.length; i++) { widths[i] = ...
486,581
<p>Is it always necessary to allocate memory from the heap to facilitate dynamic polymorphism? All the examples i've come across so far point to the same. Dynamic memory allocation is usually avoided in real-time-programming.So,is there any disadvantage of using the stack for dynamic polymorphism as shown in the code b...
[ { "answer_id": 486586, "author": "David Norman", "author_id": 34502, "author_profile": "https://Stackoverflow.com/users/34502", "pm_score": 3, "selected": false, "text": "<p>A better example would be:</p>\n\n<pre><code>void func(Base &amp;base);\n\nint main()\n{\n Derived derived;\n\n...
2009/01/28
[ "https://Stackoverflow.com/questions/486581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59630/" ]
Is it always necessary to allocate memory from the heap to facilitate dynamic polymorphism? All the examples i've come across so far point to the same. Dynamic memory allocation is usually avoided in real-time-programming.So,is there any disadvantage of using the stack for dynamic polymorphism as shown in the code belo...
A better example would be: ``` void func(Base &base); int main() { Derived derived; func(derived); return 0; } ``` The use of polymorphism doesn't have to be near where the object is created on the stack. A lot of our unit-testing code these days looks roughly like: ``` void test() { MockObject ...
486,609
<p>I am trying to develop a Roulette game for iPhone. How can I animation (spin) the Roulette board?</p>
[ { "answer_id": 493680, "author": "Brad Larson", "author_id": 19679, "author_profile": "https://Stackoverflow.com/users/19679", "pm_score": 5, "selected": true, "text": "<p>I have no idea how to do this in cocos2d (or even what that is), but you can do this using Core Animation either wit...
2009/01/28
[ "https://Stackoverflow.com/questions/486609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51108/" ]
I am trying to develop a Roulette game for iPhone. How can I animation (spin) the Roulette board?
I have no idea how to do this in cocos2d (or even what that is), but you can do this using Core Animation either with CALayers or UIViews. Probably the simplest way would be to create a UIImageView containing an image of your roulette wheel and animate that. To accomplish this, first set up your UIImageView by initial...
486,629
<p>Simple way i am able to authenticate login page. How can i do that authentication in 3 tier architecture? please somebody send me the code that what should be in DAL,BAL,and GUI layers? Here is my simple code:</p> <p>Web.config:</p> <pre><code>&lt;authentication mode="form"&gt; &lt;form loginurl="Login.aspx"&g...
[ { "answer_id": 486700, "author": "Igor Zelaya", "author_id": 22769, "author_profile": "https://Stackoverflow.com/users/22769", "pm_score": 1, "selected": false, "text": "<p>In general you should have at least the following classes:</p>\n\n<ul>\n<li>In DAL you should have a Class that han...
2009/01/28
[ "https://Stackoverflow.com/questions/486629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59637/" ]
Simple way i am able to authenticate login page. How can i do that authentication in 3 tier architecture? please somebody send me the code that what should be in DAL,BAL,and GUI layers? Here is my simple code: Web.config: ``` <authentication mode="form"> <form loginurl="Login.aspx"> <credential password ...
In general you should have at least the following classes: * In DAL you should have a Class that hands of database connections * In BAl you should have a Class that represents every user instance. This class should have a method called login() where all the authentication and authorization takes place. * A web form re...
486,630
<p>I have an asp.net website with 5 items (home, products, news, about, contact) on the main horizontal navigation.</p> <p>The site uses a master page which splits the page into a header, body and footer using </p> <p>I want to be able to display a different header (which will include different colors and images) dep...
[ { "answer_id": 486700, "author": "Igor Zelaya", "author_id": 22769, "author_profile": "https://Stackoverflow.com/users/22769", "pm_score": 1, "selected": false, "text": "<p>In general you should have at least the following classes:</p>\n\n<ul>\n<li>In DAL you should have a Class that han...
2009/01/28
[ "https://Stackoverflow.com/questions/486630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57364/" ]
I have an asp.net website with 5 items (home, products, news, about, contact) on the main horizontal navigation. The site uses a master page which splits the page into a header, body and footer using I want to be able to display a different header (which will include different colors and images) depending on which o...
In general you should have at least the following classes: * In DAL you should have a Class that hands of database connections * In BAl you should have a Class that represents every user instance. This class should have a method called login() where all the authentication and authorization takes place. * A web form re...
486,702
<p>A few days ago, I asked a question regarding dynamically modifying a function's code midway through the outerlying script's execution and I was told to completely forget ever coming upon the notion. I'm not sure I understand why that is. Let me give an example:</p> <pre><code>&lt;script&gt; var display = function(m...
[ { "answer_id": 486715, "author": "vava", "author_id": 6258, "author_profile": "https://Stackoverflow.com/users/6258", "pm_score": 0, "selected": false, "text": "<p>Well, using <code>eval</code> might be a security concern but modifying a function in real-time is ok. How else you can make...
2009/01/28
[ "https://Stackoverflow.com/questions/486702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59107/" ]
A few days ago, I asked a question regarding dynamically modifying a function's code midway through the outerlying script's execution and I was told to completely forget ever coming upon the notion. I'm not sure I understand why that is. Let me give an example: ``` <script> var display = function(msg) { alert(msg); ...
There are cases where it could be useful to change a function's behavior, but there are better ways to do it. In your example, you could create new instances of the function that handle the output differently, by passing a function as an argument (similar to the strategy pattern): ``` function makeDisplay(displayStrat...
486,706
<p>Like many programs <strong>flash</strong> their window on the <strong>taskbar / dock</strong> to alert the user to switch to the program,</p> <p>Is it possible to flash the <strong>Browser</strong> window using Javascript? <em>(FireFox-only scripts are also welcome)</em></p> <p>This is useful for web-based Chat / ...
[ { "answer_id": 486718, "author": "Hexagon Theory", "author_id": 59107, "author_profile": "https://Stackoverflow.com/users/59107", "pm_score": 2, "selected": false, "text": "<p>At this point, it seems only causing an alert dialog to pop up does the trick... this seems a bit too intrusive,...
2009/01/28
[ "https://Stackoverflow.com/questions/486706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41021/" ]
Like many programs **flash** their window on the **taskbar / dock** to alert the user to switch to the program, Is it possible to flash the **Browser** window using Javascript? *(FireFox-only scripts are also welcome)* This is useful for web-based Chat / Forum / Community-based software where there is lots of **real-...
@Hexagon Theory: Why would you ever rewrite the whole head element just to change the value of one element in the head? Your solution is horribly inefficient on multiple levels. ``` <html> <head> <link rel="icon" href="on.png" type="image/png" id="changeMe" /> <script type="text/javascript" src="flash.js"></script> </...
486,716
<p>I have built a new portal on Rails which can be accessed as say: <a href="https://xyz.com" rel="nofollow noreferrer">https://xyz.com</a></p> <p>The problem with this is: 1.) It has 2 tabs – “ShipmentInfo” , “Aging Shipments Dashboard” both implemented using </p> <pre><code>&lt;li&gt; tags and YUI library’s tabview...
[ { "answer_id": 486812, "author": "Shalom Craimer", "author_id": 54491, "author_profile": "https://Stackoverflow.com/users/54491", "pm_score": 1, "selected": false, "text": "<p>As far as I can tell, whatever the YUI does to transform that <code>ul</code> into a set of tab probably has not...
2009/01/28
[ "https://Stackoverflow.com/questions/486716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59645/" ]
I have built a new portal on Rails which can be accessed as say: <https://xyz.com> The problem with this is: 1.) It has 2 tabs – “ShipmentInfo” , “Aging Shipments Dashboard” both implemented using ``` <li> tags and YUI library’s tabview. <ul class="yui-nav"> <li id="tab1" class="selected"><a href="#tab1"...
Yes. You probably already have these lines at the end of your routes.rb file: map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' Change them to: map.connect '#:controller' map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' This way you can define ...
486,724
<p>Hi I would like to design a query where a column is not updateable, but the rest of them yes.</p> <p>How can I do this?</p> <p>Regards</p>
[ { "answer_id": 486733, "author": "beach", "author_id": 53892, "author_profile": "https://Stackoverflow.com/users/53892", "pm_score": 3, "selected": true, "text": "<p>Well, I think you need to use an INSTEAD OF trigger on the view so that the base table isn't updated directly.</p>\n\n<p>H...
2009/01/28
[ "https://Stackoverflow.com/questions/486724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59299/" ]
Hi I would like to design a query where a column is not updateable, but the rest of them yes. How can I do this? Regards
Well, I think you need to use an INSTEAD OF trigger on the view so that the base table isn't updated directly. Here is an article explaining them. [Article](http://msdn.microsoft.com/en-us/library/aa224818(SQL.80).aspx) Another example. Sample code shown below. [Article2](http://msdn.microsoft.com/en-us/magazine/cc16...
486,748
<pre><code>&gt; .h file: NSString *myString; @property (nonatomic, retain) NSString *myString; &gt; .m file: self.myString = [[NSString alloc] init]; </code></pre> <p>If i'm not wrong i will end up with an NSString instance with retain count of +2. Right?</p> <p>I'm curious because Apple's example for Location uses ...
[ { "answer_id": 486777, "author": "Peter Hosey", "author_id": 30461, "author_profile": "https://Stackoverflow.com/users/30461", "pm_score": 2, "selected": false, "text": "<p>Mustafa: Yes, you're correct. (The property should be declared as <code>copy</code>, not <code>retain</code>, but t...
2009/01/28
[ "https://Stackoverflow.com/questions/486748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
``` > .h file: NSString *myString; @property (nonatomic, retain) NSString *myString; > .m file: self.myString = [[NSString alloc] init]; ``` If i'm not wrong i will end up with an NSString instance with retain count of +2. Right? I'm curious because Apple's example for Location uses "self." for initialization. Why?...
To answer your first question: Yes, the retain count would be two. --- To answer your second question: The reason for using: ``` self.myString = x; ``` which is equivalent to: ``` [self setMyString:x]; ``` is so that all of the property handling code is properly executed. This includes KVO notifications, and ...
486,749
<p>I am trying to compare two .NET arrays. Here is an obvious implementation for comparing arrays of bytes:</p> <pre><code>bool AreEqual(byte[] a, byte[] b){ if(a.Length != b.Length) return false; for(int i = 0; i &lt; a.Length; i++) if(a[i] != b[i]) return false; return true; ...
[ { "answer_id": 486771, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 6, "selected": false, "text": "<p>You could use <a href=\"http://msdn.microsoft.com/en-us/library/bb348567.aspx\" rel=\"noreferrer\">SequenceE...
2009/01/28
[ "https://Stackoverflow.com/questions/486749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45603/" ]
I am trying to compare two .NET arrays. Here is an obvious implementation for comparing arrays of bytes: ``` bool AreEqual(byte[] a, byte[] b){ if(a.Length != b.Length) return false; for(int i = 0; i < a.Length; i++) if(a[i] != b[i]) return false; return true; } ``` A more re...
Kathy's approach seems a good one to me. I'd personally allow the comparer to be specified explicitly: ``` bool AreEqual<T>(T[] a, T[] b) { return AreEqual(a, b, EqualityComparer<T>.Default); } bool AreEqual<T>(T[] a, T[] b, IEqualityComparer<T> comparer) { // Handle identity comparison, including comparing n...
486,752
<p>I have a controller build for a web application with a web presentation. But now I need to create a iphone (mobile phone) version of this application.</p> <p>Basically this is a blog application with comments. In the regular version comments are loaded at the same time as the entry. But on the mobile application I ...
[ { "answer_id": 486771, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 6, "selected": false, "text": "<p>You could use <a href=\"http://msdn.microsoft.com/en-us/library/bb348567.aspx\" rel=\"noreferrer\">SequenceE...
2009/01/28
[ "https://Stackoverflow.com/questions/486752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54949/" ]
I have a controller build for a web application with a web presentation. But now I need to create a iphone (mobile phone) version of this application. Basically this is a blog application with comments. In the regular version comments are loaded at the same time as the entry. But on the mobile application I want to co...
Kathy's approach seems a good one to me. I'd personally allow the comparer to be specified explicitly: ``` bool AreEqual<T>(T[] a, T[] b) { return AreEqual(a, b, EqualityComparer<T>.Default); } bool AreEqual<T>(T[] a, T[] b, IEqualityComparer<T> comparer) { // Handle identity comparison, including comparing n...
486,754
<p>I am using Fiddler to debug my MVC application and see all the HTTP requests.</p> <p>The application is running on <code>http://localhost:51234/mvc</code></p> <p>As anybody who has tried to use Fiddler for a site hosted on localhost knows there is an issue - windows won't forward localhost traffic through the prox...
[ { "answer_id": 486841, "author": "davogones", "author_id": 59631, "author_profile": "https://Stackoverflow.com/users/59631", "pm_score": 1, "selected": false, "text": "<p>Have you tried the Firebug extension for Firefox? It can show the Ajax request and response. I've used it with ASP.NE...
2009/01/28
[ "https://Stackoverflow.com/questions/486754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
I am using Fiddler to debug my MVC application and see all the HTTP requests. The application is running on `http://localhost:51234/mvc` As anybody who has tried to use Fiddler for a site hosted on localhost knows there is an issue - windows won't forward localhost traffic through the proxy if you hit this link direc...
So it turns out that if you use this overload : ``` using (Ajax.BeginForm(new AjaxOptions() ``` you get this code generated (the code that 'breaks'): ``` <form action="http://localhost:51234/aboutus/contact" method="post" ``` but if you do this and include the action name: ``` using (Ajax.BeginForm("Contact", n...
486,757
<p>I have to generate a xml file dynamically at runtime. Please help me in generating the below XML file dynamically using PHP.</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xml&gt; &lt;track&gt; &lt;path&gt;song1.mp3&lt;/path&gt; &lt;title&gt;Track 1 - Track Title&lt;/title&gt; &lt;/trac...
[ { "answer_id": 486786, "author": "andyk", "author_id": 26721, "author_profile": "https://Stackoverflow.com/users/26721", "pm_score": 5, "selected": false, "text": "<p>An easily broken way to do this is :</p>\n\n<pre><code>&lt;?php\n// Send the headers\nheader('Content-type: text/xml');\n...
2009/01/28
[ "https://Stackoverflow.com/questions/486757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59649/" ]
I have to generate a xml file dynamically at runtime. Please help me in generating the below XML file dynamically using PHP. ``` <?xml version="1.0" encoding="UTF-8"?> <xml> <track> <path>song1.mp3</path> <title>Track 1 - Track Title</title> </track> <track> <path>song2.mp3</path> <title>Track 2...
I'd use [SimpleXMLElement](http://php.net/simplexml). ``` <?php $xml = new SimpleXMLElement('<xml/>'); for ($i = 1; $i <= 8; ++$i) { $track = $xml->addChild('track'); $track->addChild('path', "song$i.mp3"); $track->addChild('title', "Track $i - Track Title"); } Header('Content-type: text/xml'); print($x...
486,758
<p>I have a very bad feeling about using lock in my code but now the Dispatcher of WindowBase exists and I want to use it everywhere.</p> <p>For example I use a multi thread singleton WCF service who publish events on the EventAggregator of PRISM, the payload is immutable (it is just data) and every thread with a disp...
[ { "answer_id": 486785, "author": "Ric Tokyo", "author_id": 42019, "author_profile": "https://Stackoverflow.com/users/42019", "pm_score": 2, "selected": false, "text": "<p>yes and no.. its a rendering thing..not a threading thing per se..</p>\n\n<p>The Dispatcher selects work items on a p...
2009/01/28
[ "https://Stackoverflow.com/questions/486758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19803/" ]
I have a very bad feeling about using lock in my code but now the Dispatcher of WindowBase exists and I want to use it everywhere. For example I use a multi thread singleton WCF service who publish events on the EventAggregator of PRISM, the payload is immutable (it is just data) and every thread with a dispatcher can...
The main issue with using the Dispatcher (or BackgroundWorker) is that it's difficult to test, unless your testing harness actually has a UI thread. Solution 1 ---------- Use the [SynchronizationContext](http://msdn.microsoft.com/en-us/library/system.threading.synchronizationcontext.aspx). It provides the same abili...
486,825
<p>I've the code below written in JavaScript to add a new option to the select list from the opener window:</p> <pre><code>function updateSelectList() { var field = opener.document.objectdata.ticketPersonId; if (true &amp;&amp; opener &amp;&amp; field) { var val = document.createElement('option'); ...
[ { "answer_id": 486865, "author": "Pete Jordan", "author_id": 22959, "author_profile": "https://Stackoverflow.com/users/22959", "pm_score": 2, "selected": true, "text": "<p>Here's my snippet:</p>\n\n<pre><code>if (oldopt!=null || !horus.brokenDOM)\n select.add(newopt, oldopt);\nelse\n ...
2009/01/28
[ "https://Stackoverflow.com/questions/486825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've the code below written in JavaScript to add a new option to the select list from the opener window: ``` function updateSelectList() { var field = opener.document.objectdata.ticketPersonId; if (true && opener && field) { var val = document.createElement('option'); var title = document.o...
Here's my snippet: ``` if (oldopt!=null || !horus.brokenDOM) select.add(newopt, oldopt); else newopt=options[options.length]=new Option(newopt.text, newopt.value, false, false); ``` The definition of `horus.brokenDOM` is left to the reader :) IIRC, I had some difficulty with using pre-defined `Option` objects (...
486,843
<p>I have noticed two different approaches to writing out data to an XML file (error handling omitted for brevity).</p> <p>The first method has you build the XML document and then simply save the XML to a file:</p> <pre><code>using (XmlWriter writer = XmlWriter.Create(fileName)) { writer.WriteStartDocument(true);...
[ { "answer_id": 486851, "author": "Frederik Gheysels", "author_id": 55774, "author_profile": "https://Stackoverflow.com/users/55774", "pm_score": 0, "selected": false, "text": "<p>You do not have to use a MemoryStream to use the XmlWriter.\nThe XmlWriter can directly write to a file; you ...
2009/01/28
[ "https://Stackoverflow.com/questions/486843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51949/" ]
I have noticed two different approaches to writing out data to an XML file (error handling omitted for brevity). The first method has you build the XML document and then simply save the XML to a file: ``` using (XmlWriter writer = XmlWriter.Create(fileName)) { writer.WriteStartDocument(true); writer.WriteStar...
The `MemoryStream` version is wasteful on this occasion. `MemoryStream` is useful if you want to perform `Stream`-like work, but don't want an actual file. If you **are** writing a file, then just write to the file. This avoids the need to buffer all the data in memory.
486,867
<p>I have a web service that has an input object similar to the following.</p> <pre><code>public class MyInput { [System.Xml.Serialization.XmlArrayItem("Demographic")] public DemographicsInfo[] Demographics {get; set;} } </code></pre> <p>With the definition of the DemographicsInfo class like this.</p> <pre><...
[ { "answer_id": 486882, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "<p>If you know the structure you want, the simplest option is to work back from the xml; write the xml into a file (<c...
2009/01/28
[ "https://Stackoverflow.com/questions/486867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13279/" ]
I have a web service that has an input object similar to the following. ``` public class MyInput { [System.Xml.Serialization.XmlArrayItem("Demographic")] public DemographicsInfo[] Demographics {get; set;} } ``` With the definition of the DemographicsInfo class like this. ``` public class DemographicsInfo { ...
If you know the structure you want, the simplest option is to work back from the xml; write the xml into a file (`foo.xml` in my case), then (at the command line): ``` xsd foo.xml xsd foo.xsd /classes ``` Then look at `foo.cs` to see how it can be done; it turns out that you simply mark the value with `[System.Xml.S...
486,874
<p>How can I stretch or resize an image (of any format) using a Perl script?</p>
[ { "answer_id": 486898, "author": "mac", "author_id": 53943, "author_profile": "https://Stackoverflow.com/users/53943", "pm_score": 2, "selected": false, "text": "<p>You could use <a href=\"http://kobesearch.cpan.org/htdocs/Image-Resize/Image/Resize.html\" rel=\"nofollow noreferrer\">Imag...
2009/01/28
[ "https://Stackoverflow.com/questions/486874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45284/" ]
How can I stretch or resize an image (of any format) using a Perl script?
I'd recommend Image::Imlib2... if you can install imlib2 on your machine See documentation: [Image::Imlib2](http://search.cpan.org/dist/Image-Imlib2/lib/Image/Imlib2.pm) ``` use Image::Imlib2; # load image from file my $image = Image::Imlib2->load("in.png"); # get some info if you want my $width = $image->width; m...
486,881
<p>I'm writing a javascript function and in "compact" javascript design fashion, the type/length of arguments changes the behaviour of the function. One possible type of the argument is a jQuery object, for which I would like very special logic.</p> <p>What is the best way to test if an object is an instance of jQuery...
[ { "answer_id": 486900, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": false, "text": "<p>One of the following:</p>\n\n<pre><code>obj instanceof jQuery\nobj &amp;&amp; obj.constructor == jQuery\nobj &amp;&amp; obj....
2009/01/28
[ "https://Stackoverflow.com/questions/486881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209/" ]
I'm writing a javascript function and in "compact" javascript design fashion, the type/length of arguments changes the behaviour of the function. One possible type of the argument is a jQuery object, for which I would like very special logic. What is the best way to test if an object is an instance of jQuery?
Depends on the inner workings of jQuery, but I'd go with ``` obj instanceof jQuery ``` It's the most 'JavaScript way' of doing it. Keep in mind that it will fail when passing objects between window/frame boundaries! Tomalak's suggestion ``` 'jquery' in obj ``` should still work in this case, so you should use it...
486,885
<p>I am trying to port a windows project that includes boost 1.37 and wxwidgets to the Mac. It compiles ok, but the linker gives me a "file is not of required architecture for architecture ppc" error for libz.1.dylib and the same message as a warning a few other libraries. I also get a "duplicate dylib" warning for lib...
[ { "answer_id": 486903, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 2, "selected": false, "text": "<p>Sounds like you need to redownload or rebuild boost for Mac. And whatever dylib is you need to do that to. In simpl...
2009/01/28
[ "https://Stackoverflow.com/questions/486885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59301/" ]
I am trying to port a windows project that includes boost 1.37 and wxwidgets to the Mac. It compiles ok, but the linker gives me a "file is not of required architecture for architecture ppc" error for libz.1.dylib and the same message as a warning a few other libraries. I also get a "duplicate dylib" warning for libz.1...
From the messages you've got, most of Gemsweeper Mac and libboost have been compiled with only ppc as architecture. You should configure Xcode to generate universal binaries and probably recompile libboost through MacPorts. Recent MacPorts have a "universal" target that could help although if you don't plan to run it o...
486,896
<p>In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example:</p> <p>Original URL: </p> <blockquote> <p><a href="http://server/myapp.php?id=10" rel="noreferrer">http://server/myapp.php?id=10</a></p> </blockquote> <p>Resulting URL:</p> <blo...
[ { "answer_id": 487049, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 9, "selected": true, "text": "<p>A basic implementation which you'll need to adapt would look something like this:</p>\n\n<pre class=\"lang-js prettypri...
2009/01/28
[ "https://Stackoverflow.com/questions/486896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59661/" ]
In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example: Original URL: > > <http://server/myapp.php?id=10> > > > Resulting URL: > > <http://server/myapp.php?id=10>**&enabled=true** > > > Looking for a JavaScript function which pa...
A basic implementation which you'll need to adapt would look something like this: ```js function insertParam(key, value) { key = encodeURIComponent(key); value = encodeURIComponent(value); // kvp looks like ['key1=value1', 'key2=value2', ...] var kvp = document.location.search.substr(1).split('&'); ...
486,917
<pre><code>namespace GenericsTest { public class AGenericClass&lt;T&gt; { public class NestedNonGenericClass { } } } </code></pre> <p>In the example above, should <code>NestedNonGenericClass</code> be considered a generic class?</p> <p>The reflection API says it's a generic class, ...
[ { "answer_id": 486926, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "<p>In short, yes - a type inherits the type arguments from any types that contain it: this is the key to things like <...
2009/01/28
[ "https://Stackoverflow.com/questions/486917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48740/" ]
``` namespace GenericsTest { public class AGenericClass<T> { public class NestedNonGenericClass { } } } ``` In the example above, should `NestedNonGenericClass` be considered a generic class? The reflection API says it's a generic class, and even hands me the template parameters o...
In short, yes - a type inherits the type arguments from any types that contain it: this is the key to things like `List<T>.Enumerator` and many other scenarios, etc - it is critical that they share the `T` from the outer class (not just any `T`). The ECMA ref is §25.1: > > Any class nested inside a generic > class ...
486,920
<p>I'm trying to understand how LR1 Parsers work but I came up with a strange problem: What if the grammar contains Epsilons? For instance: if I have the grammar:</p> <pre><code>S -&gt; A A -&gt; a A | B B -&gt; a </code></pre> <p>It's clear how to start:</p> <pre><code>S -&gt; .A A -&gt; .a A A -&gt; .B </code></p...
[ { "answer_id": 487483, "author": "jpalecek", "author_id": 51831, "author_profile": "https://Stackoverflow.com/users/51831", "pm_score": 4, "selected": true, "text": "<p>Yes, exactly (think of the epsilon as empty space, where there aren't two places for the dot at the sides).</p>\n\n<p>I...
2009/01/28
[ "https://Stackoverflow.com/questions/486920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43960/" ]
I'm trying to understand how LR1 Parsers work but I came up with a strange problem: What if the grammar contains Epsilons? For instance: if I have the grammar: ``` S -> A A -> a A | B B -> a ``` It's clear how to start: ``` S -> .A A -> .a A A -> .B ``` ... and so on but I don't know how to do it for such a gra...
Yes, exactly (think of the epsilon as empty space, where there aren't two places for the dot at the sides). In an LR(0) automaton, you would make the state accepting and reduce to A. However, due to the `A->a A a` production, there'd be a shift/reduce conflict. In a LR(1) automaton, you would determine whether to shi...
486,924
<p>I use an HttpHandler to dynamically serve images in a ASP.Net web application. I am having a performance issue (Firfox/Firebug/YSlow reports there are too many HttpRequests)</p> <p>I have between 50-100 images per page in some instances.. 3 treeviews (business units/categories/objects) with each node having its own...
[ { "answer_id": 486952, "author": "Jeremy French", "author_id": 56672, "author_profile": "https://Stackoverflow.com/users/56672", "pm_score": 2, "selected": false, "text": "<p>This doesn’t sound like a great way to handle images. In the first instance you should save your server some pain...
2009/01/28
[ "https://Stackoverflow.com/questions/486924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59663/" ]
I use an HttpHandler to dynamically serve images in a ASP.Net web application. I am having a performance issue (Firfox/Firebug/YSlow reports there are too many HttpRequests) I have between 50-100 images per page in some instances.. 3 treeviews (business units/categories/objects) with each node having its own image ;) ...
One way to reduce the preasure on the server on repeated requests is to use the page cacheability. Add this before Response.Write in the HttpHandler: ``` // Set for how long you want the image to be cached. context.Response.Cache.SetExpires(DateTime.Now.AddDays(1)); context.Response.Cache.SetCacheability(HttpCacheab...
486,927
<p>I want the ASCII characters passed by the <code>e.Key</code> property from a WPF <code>KeyDown</code> event.</p>
[ { "answer_id": 486967, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 2, "selected": false, "text": "<p>Unfortunately there's no easy way to do this. There's 2 workarounds, but they both fall down under certain condi...
2009/01/28
[ "https://Stackoverflow.com/questions/486927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40568/" ]
I want the ASCII characters passed by the `e.Key` property from a WPF `KeyDown` event.
Can you use the TextInput event rather than KeyDown? the TextCompositionEventArgs class allows you to directly retrieve the text entered via the e.text property ```cs private void UserControl_TextInput( object sender, System.Windows.Input.TextCompositionEventArgs e) { var t = e.Text; } ```
486,942
<p>I've posted a similar question about how to do this in JNDI, but in THIS post I am wondering how to do it using ANY INTERFACE. </p> <p>I'd like to be able to retrieve a user's group name. When I say "group" I mean the group on the computer. Like "administrator" or "user."</p> <p>Can I do it through the command ...
[ { "answer_id": 486954, "author": "DrHazzard", "author_id": 27768, "author_profile": "https://Stackoverflow.com/users/27768", "pm_score": 3, "selected": false, "text": "<p>From the command line:</p>\n\n<pre><code>net user &lt;username&gt;\n</code></pre>\n\n<p>or if they are on a domain</p...
2009/01/28
[ "https://Stackoverflow.com/questions/486942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've posted a similar question about how to do this in JNDI, but in THIS post I am wondering how to do it using ANY INTERFACE. I'd like to be able to retrieve a user's group name. When I say "group" I mean the group on the computer. Like "administrator" or "user." Can I do it through the command line, application, d...
From the command line: ``` net user <username> ``` or if they are on a domain ``` net user <username> /domain ``` Towards the bottom are 2 sections, Local Group Memberships and Global Group Memberships. Note: a user may have alot of groups (in my case at work a total of 8!)
486,947
<p>I'm trying to customize entities of my application to make them have a property referencing the DataContext that loaded them.</p> <p>I think the best way is to somehow create a class that implements the IQueryable and set the entity datacontext property in its GetEnumerator method.</p> <p>My question is, how can I...
[ { "answer_id": 486972, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 1, "selected": false, "text": "<p>I can't think of an easy way to do that. You can't inject into the middle of the LINQ-to-SQL pipeline without brea...
2009/01/28
[ "https://Stackoverflow.com/questions/486947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34623/" ]
I'm trying to customize entities of my application to make them have a property referencing the DataContext that loaded them. I think the best way is to somehow create a class that implements the IQueryable and set the entity datacontext property in its GetEnumerator method. My question is, how can I use the Provider...
I can't think of an easy way to do that. You can't inject into the middle of the LINQ-to-SQL pipeline without breaking composability. The easiest way to do this would be as a last step via LINQ-to-Objects: ``` public IEnumerable<Product> GetProducts() { IQueryable<Product> result = from p in context.Products ...
486,949
<p>I am quite new in Perl and I woud like to know which of the following loops is more efficient:</p> <pre><code>my @numbers = (1,3,5,7,9); foreach my $current (@numbers){ print "$current\n"; } </code></pre> <p>or </p> <pre><code>my @numbers = (1,3,5,7,9); foreach (@numbers){ print "$_\n"; } </code></pre> <...
[ { "answer_id": 486961, "author": "schnaader", "author_id": 34065, "author_profile": "https://Stackoverflow.com/users/34065", "pm_score": 3, "selected": false, "text": "<p>You could have a look at <a href=\"http://docstore.mik.ua/orelly/linux/cgi/ch17_01.htm\" rel=\"nofollow noreferrer\">...
2009/01/28
[ "https://Stackoverflow.com/questions/486949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59332/" ]
I am quite new in Perl and I woud like to know which of the following loops is more efficient: ``` my @numbers = (1,3,5,7,9); foreach my $current (@numbers){ print "$current\n"; } ``` or ``` my @numbers = (1,3,5,7,9); foreach (@numbers){ print "$_\n"; } ``` I want to know this in order to know if the use...
Even know *Premature optimisation is the root of all evil* ``` { local $\ = "\n"; print foreach @numbers; } ``` but some expectations can be wrong. Test is little bit weird because output can make some weird side-effects and order can be important. ``` #!/usr/bin/env perl use strict; use warnings; use Benchmark...
486,964
<p>Ours is a J2EE app, using Struts-EJB-Hibernate on Websphere 6.1 over Mainframe/DB2 backend, that was recently moved to production. </p> <p><strong>We are getting stale connection exception</strong> when the user login to the application first time or some times this exception occurs intermittently.</p> <p>on the ...
[ { "answer_id": 801119, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>i got the answer for this</p>\n\n<p>using pretest old connection and new connection we can solve this issue.. the pretest q...
2009/01/28
[ "https://Stackoverflow.com/questions/486964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Ours is a J2EE app, using Struts-EJB-Hibernate on Websphere 6.1 over Mainframe/DB2 backend, that was recently moved to production. **We are getting stale connection exception** when the user login to the application first time or some times this exception occurs intermittently. on the second try the user able to log...
We had the same issue at first login in the morning on one of our production systems. Solution was to set the minimum size for the connection pool to zero. With minimum size set to a value greater than zero (e.g., one), timed out connections are removed from the pool when they are detected as not valid, but some of th...
486,978
<p>How can I return a OpenQuery in SQL Server including a variable to a cursor?</p> <pre><code>DECLARE curMyCursor CURSOR FOR EXEC('SELECT * FROM OPENQUERY(SYBASE, ''SELECT * FROM MyTable WHERE MyPrimaryKey=''''' + @Variable + ''''''')') OPEN @ResultCrsr </code></pre>
[ { "answer_id": 486987, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": -1, "selected": false, "text": "<p>Since the first process is the only process with the MDB open it can be a bit lazy about writing stuff back to t...
2009/01/28
[ "https://Stackoverflow.com/questions/486978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41809/" ]
How can I return a OpenQuery in SQL Server including a variable to a cursor? ``` DECLARE curMyCursor CURSOR FOR EXEC('SELECT * FROM OPENQUERY(SYBASE, ''SELECT * FROM MyTable WHERE MyPrimaryKey=''''' + @Variable + ''''''')') OPEN @ResultCrsr ```
Just a guess but I might be due to the fact that the Jet engine features a read cache and lazy writes: [How To Implement Multiuser Custom Counters in Jet 4.0 and ADO 2.1](http://support.microsoft.com/kb/240317/en-us) "Microsoft Jet has a read-cache that is updated every PageTimeout milliseconds (default is 5000ms = 5...
486,995
<p>Is there something similar to the Python utility <a href="http://pypi.python.org/pypi/virtualenv" rel="noreferrer">virtualenv</a>?</p> <p>Basically it allows you to install Python packages into a sandboxed environment, so <code>easy_install django</code> doesn't go in your system-wide site-packages directory, it wo...
[ { "answer_id": 3801789, "author": "Van Nguyen", "author_id": 53894, "author_profile": "https://Stackoverflow.com/users/53894", "pm_score": 8, "selected": true, "text": "<p><a href=\"http://rvm.io/\" rel=\"noreferrer\">RVM</a> works closer to how virtualenv works since it lets you sandbox...
2009/01/28
[ "https://Stackoverflow.com/questions/486995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
Is there something similar to the Python utility [virtualenv](http://pypi.python.org/pypi/virtualenv)? Basically it allows you to install Python packages into a sandboxed environment, so `easy_install django` doesn't go in your system-wide site-packages directory, it would go in the virtualenv-created directory. For ...
[RVM](http://rvm.io/) works closer to how virtualenv works since it lets you sandbox different ruby versions and their gems, etc.
487,011
<p>I'm trying to get my WATIN tests to work in TFS2008 (continuous integration) as part of a nightly build.</p> <p>All tests work fine on my local machine (from VS2008), and my unit tests (non-watin) work great locally, as well as in TFS.</p> <p>to illustrate what we're doing I've got a simple test:</p> <pre><code> ...
[ { "answer_id": 487027, "author": "Stephen Denne", "author_id": 11721, "author_profile": "https://Stackoverflow.com/users/11721", "pm_score": 2, "selected": false, "text": "<p>You could use a <a href=\"http://en.wikipedia.org/wiki/Phonetic_algorithm\" rel=\"nofollow noreferrer\">phonetic ...
2009/01/28
[ "https://Stackoverflow.com/questions/487011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12756/" ]
I'm trying to get my WATIN tests to work in TFS2008 (continuous integration) as part of a nightly build. All tests work fine on my local machine (from VS2008), and my unit tests (non-watin) work great locally, as well as in TFS. to illustrate what we're doing I've got a simple test: ``` [TestMethod] public v...
There are several approaches for this problem: 1. Keeping a table of **most popular misspellings** in your database. If you need some common misspellings: [here](http://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines)) 2. Using an algorithm based on the **[edit distance](http://en.wikipedia.o...
487,048
<p>What is the difference between</p> <pre><code>void func(const Class *myClass) </code></pre> <p>and</p> <pre><code>void func(Class *const myClass) </code></pre> <hr> <p>See also:</p> <ul> <li><a href="https://stackoverflow.com/questions/269882/c-const-question">C++ const question</a></li> <li><a href="https://s...
[ { "answer_id": 487058, "author": "mmmmmmmm", "author_id": 44086, "author_profile": "https://Stackoverflow.com/users/44086", "pm_score": 5, "selected": true, "text": "<p>The difference is that for</p>\n\n<pre><code>void func(const Class *myClass)\n</code></pre>\n\n<p>You point to a class ...
2009/01/28
[ "https://Stackoverflow.com/questions/487048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59688/" ]
What is the difference between ``` void func(const Class *myClass) ``` and ``` void func(Class *const myClass) ``` --- See also: * [C++ const question](https://stackoverflow.com/questions/269882/c-const-question) * [How many and which are the uses of "const" in C++?](https://stackoverflow.com/questions/455518/h...
The difference is that for ``` void func(const Class *myClass) ``` You point to a class that you cannot change because it is const. But you can modify the myClass pointer (let it point to another class; this don't have any side effects to the caller because it's pointer is copied, it only changes your local the poin...
487,056
<p>A simple one, I'm trying to retrieve the value attribute of a button when its been pressed using jQuery, here's what I have:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $('.my_button').click(function() { alert($(this).val()); }); }); &lt;/s...
[ { "answer_id": 487105, "author": "Neil Aitken", "author_id": 13803, "author_profile": "https://Stackoverflow.com/users/13803", "pm_score": 7, "selected": false, "text": "<p>As a button value is an attribute you need to use the .attr() method in jquery. This should do it</p>\n\n<pre><code...
2009/01/28
[ "https://Stackoverflow.com/questions/487056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26409/" ]
A simple one, I'm trying to retrieve the value attribute of a button when its been pressed using jQuery, here's what I have: ``` <script type="text/javascript"> $(document).ready(function() { $('.my_button').click(function() { alert($(this).val()); }); }); </script> <button class="...
I know this was posted a while ago, but in case anyone is searching for an answer and really wants to use a button element instead of an input element... You *can not* use `.attr('value')` or `.val()` with a button in IE. IE reports both the .val() and .attr("value") as being the text label (content) of the button ele...
487,065
<p>Why does this work:</p> <pre><code>result = (from e in db.CampaignCodes where e.Code.Equals("") &amp;&amp; e.Domain.Equals(null) select e).FirstOrDefault(); </code></pre> <p>But not (result is null):</p> <pre><code>String code = ""; String domain = null; result = (from e in db.CampaignCodes where e.Code.Equals(...
[ { "answer_id": 487075, "author": "Iain", "author_id": 11911, "author_profile": "https://Stackoverflow.com/users/11911", "pm_score": 2, "selected": false, "text": "<p>a null string - domain - isn't the same as just passing null?</p>\n" }, { "answer_id": 487096, "author": "Rob"...
2009/01/28
[ "https://Stackoverflow.com/questions/487065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40939/" ]
Why does this work: ``` result = (from e in db.CampaignCodes where e.Code.Equals("") && e.Domain.Equals(null) select e).FirstOrDefault(); ``` But not (result is null): ``` String code = ""; String domain = null; result = (from e in db.CampaignCodes where e.Code.Equals(code) && e.Domain.Equals(domain) select e).F...
That does indeed sound quite odd. LINQ to SQL may well notice the difference between getting the value from a variable and getting it from a constant, but I wouldn't have expected it to make any difference. I strongly recommend that whenever LINQ to SQL appears to be behaving oddly, you turn the context logging on and...
487,067
<p>I'm working with Ruby on Rails and would like to validate two different models :</p> <pre><code>if (model1.valid? &amp;&amp; model2.valid?) ... end </code></pre> <p>However, "&amp;&amp;" operator uses short-circuit evaluation (i.e. it evaluates "model2.valid?" only if "model1.valid?" is true), which prevents model...
[ { "answer_id": 487076, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 2, "selected": false, "text": "<p>Evaluate them separately and store the result in a variable. Then use a simple &amp;&amp; between those booleans :)</p>\n" ...
2009/01/28
[ "https://Stackoverflow.com/questions/487067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm working with Ruby on Rails and would like to validate two different models : ``` if (model1.valid? && model2.valid?) ... end ``` However, "&&" operator uses short-circuit evaluation (i.e. it evaluates "model2.valid?" only if "model1.valid?" is true), which prevents model2.valids to be executed if model1 is not v...
Try this: ``` ([model1, model2].map(&:valid?)).all? ``` It'll return true if both are valid, and create the errors on both instances.
487,069
<p>I have already defined onclick event. I want to add additional call back function, that will be invoked BEFORE already defined callback. </p> <ul> <li>How to add an event in the head of the queue for concrete event type? </li> </ul>
[ { "answer_id": 487163, "author": "Kristian J.", "author_id": 4588, "author_profile": "https://Stackoverflow.com/users/4588", "pm_score": 0, "selected": false, "text": "<p><a href=\"https://developer.mozilla.org/En/DOM/Element.addEventListener\" rel=\"nofollow noreferrer\">addEventListene...
2009/01/28
[ "https://Stackoverflow.com/questions/487069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59692/" ]
I have already defined onclick event. I want to add additional call back function, that will be invoked BEFORE already defined callback. * How to add an event in the head of the queue for concrete event type?
Are you working with jquery framework ? I'm currently working with extjs and i found a class you can use or copy Lets see on <http://extjs.com/deploy/dev/docs/> Ext > EventManager > removeAll() > > removeAll( String/HTMLElement el ) : > void Removes all event handers from an > element. Typically you will use > E...
487,073
<p>I'm loading elements via AJAX. Some of them are only visible if you scroll down the page. Is there any way I can know if an element is now in the visible part of the page?</p>
[ { "answer_id": 487124, "author": "Romain Linsolas", "author_id": 26457, "author_profile": "https://Stackoverflow.com/users/26457", "pm_score": 3, "selected": false, "text": "<p>I have such a method in my application, but it does not use jQuery:</p>\n\n<pre><code>/* Get the TOP position o...
2009/01/28
[ "https://Stackoverflow.com/questions/487073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1011/" ]
I'm loading elements via AJAX. Some of them are only visible if you scroll down the page. Is there any way I can know if an element is now in the visible part of the page?
This should do the trick: ``` function isScrolledIntoView(elem) { var docViewTop = $(window).scrollTop(); var docViewBottom = docViewTop + $(window).height(); var elemTop = $(elem).offset().top; var elemBottom = elemTop + $(elem).height(); return ((elemBottom <= docViewBottom) && (elemTop >= docV...
487,074
<p>I want to <a href="https://stackoverflow.com/questions/486063/what-clever-things-have-you-done-with-an-asp-net-mvc-action-method">concatenate javascript files together</a> and serve them as one from my site - so thats my code and jquery plugins or other 3rd party scripts. (I'm using google CDN for hosting of jQuery)...
[ { "answer_id": 487112, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 0, "selected": false, "text": "<p>As long as you concatenate them in the correct order you should be safe. The correct order is the same order as you ...
2009/01/28
[ "https://Stackoverflow.com/questions/487074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
I want to [concatenate javascript files together](https://stackoverflow.com/questions/486063/what-clever-things-have-you-done-with-an-asp-net-mvc-action-method) and serve them as one from my site - so thats my code and jquery plugins or other 3rd party scripts. (I'm using google CDN for hosting of jQuery). I was wonde...
You may run into syntax errors around semi-colons. file A: ``` var foo = 3 // END OF FILE ``` file B: ``` var bar = 4 // BEGINNING OF FILE ``` file A+B: ``` var foo = 3var bar = 4 ``` Easily solved by just jamming a semi-colon between each file you are concatenating.
487,082
<p>select u.user, g.group, u2g.something from users, groups, u2g where users.u = u2g.u and groups.g = u2g.g</p> <p>that returns data like this:</p> <pre><code>user, group, something ---------------------- 1 , 3, a 1 , 5, b 2 , 3, c 3 , 3, d 4 , 5, e </code></pre> <p>now I w...
[ { "answer_id": 487112, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 0, "selected": false, "text": "<p>As long as you concatenate them in the correct order you should be safe. The correct order is the same order as you ...
2009/01/28
[ "https://Stackoverflow.com/questions/487082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58142/" ]
select u.user, g.group, u2g.something from users, groups, u2g where users.u = u2g.u and groups.g = u2g.g that returns data like this: ``` user, group, something ---------------------- 1 , 3, a 1 , 5, b 2 , 3, c 3 , 3, d 4 , 5, e ``` now I would like to limit this query in such a wa...
You may run into syntax errors around semi-colons. file A: ``` var foo = 3 // END OF FILE ``` file B: ``` var bar = 4 // BEGINNING OF FILE ``` file A+B: ``` var foo = 3var bar = 4 ``` Easily solved by just jamming a semi-colon between each file you are concatenating.
487,085
<p>I have written a program which generates parameter index for 2 variables. Say, a and b in steps of 5. like this I have to do for 23 variables. So I don't want to write 23 for-loops to run, how can I make it into a single for-loop which is common for all 23 variables. I hope it can be done with an array, but i don't...
[ { "answer_id": 487099, "author": "wishi", "author_id": 59300, "author_profile": "https://Stackoverflow.com/users/59300", "pm_score": 0, "selected": false, "text": "<p>Which Shell are you referring to? Declaring Arrays has some syntactical differences between zsh, bash or so... </p>\n" ...
2009/01/28
[ "https://Stackoverflow.com/questions/487085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59695/" ]
I have written a program which generates parameter index for 2 variables. Say, a and b in steps of 5. like this I have to do for 23 variables. So I don't want to write 23 for-loops to run, how can I make it into a single for-loop which is common for all 23 variables. I hope it can be done with an array, but i don't kno...
Have you considered writing either a script or a program to write the script for you? Generating shell-scripts, then running them can sometimes be a powerful solution to problems.
487,086
<p>I've just learned the basics of Ruby after being very happy with Python for several years (I'm still using Python for some things), but I'd like to know if there's an idiom or hack to solve this particular problem.</p> <p>I have a Ruby script which I'd like to be able to do <code>require script_name</code> with, bu...
[ { "answer_id": 487132, "author": "Marcin Białoń", "author_id": 59690, "author_profile": "https://Stackoverflow.com/users/59690", "pm_score": 4, "selected": true, "text": "<p>You can find a similar functionality in ruby.</p>\n\n<blockquote>\n <p><strong>__FILE__</strong> the current sour...
2009/01/28
[ "https://Stackoverflow.com/questions/487086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31600/" ]
I've just learned the basics of Ruby after being very happy with Python for several years (I'm still using Python for some things), but I'd like to know if there's an idiom or hack to solve this particular problem. I have a Ruby script which I'd like to be able to do `require script_name` with, but I'd also like to be...
You can find a similar functionality in ruby. > > **\_\_FILE\_\_** the current source file name. > > > **$0** Contains the name of the script being executed. May be assignable. > > > source: [Ruby Quick Ref](http://www.zenspider.com/Languages/Ruby/QuickRef.html)
487,107
<p>In Java, how do I round to an arbitrary value? Specifically, I want to round to .0025 steps, that is:</p> <p>0.032611 -> 0.0325</p> <p>0.034143 -> 0.0350</p> <p>0.035233 -> 0.0350</p> <p>0.037777 -> 0.0375</p> <p>...</p> <p>Any ideas or libs?</p>
[ { "answer_id": 487121, "author": "Zach Scrivena", "author_id": 20029, "author_profile": "https://Stackoverflow.com/users/20029", "pm_score": 4, "selected": false, "text": "<pre><code>y = Math.round(x / 0.0025) * 0.0025\n</code></pre>\n" }, { "answer_id": 487130, "author": "Ra...
2009/01/28
[ "https://Stackoverflow.com/questions/487107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53770/" ]
In Java, how do I round to an arbitrary value? Specifically, I want to round to .0025 steps, that is: 0.032611 -> 0.0325 0.034143 -> 0.0350 0.035233 -> 0.0350 0.037777 -> 0.0375 ... Any ideas or libs?
``` y = Math.round(x / 0.0025) * 0.0025 ```
487,126
<p>I know anonymous classes save typing when it comes to implementing Listener and similar stuff. They try to be a replacement for some usages of closures.</p> <p>But what does the community think about the value of this language-feature? Does it make sense and do you use it regularly? Does it make the code clearer, m...
[ { "answer_id": 487140, "author": "Megacan", "author_id": 54947, "author_profile": "https://Stackoverflow.com/users/54947", "pm_score": 1, "selected": false, "text": "<p>It makes sense to use them, but you must be aware of whats being done underneath. I only use them if I need a class to ...
2009/01/28
[ "https://Stackoverflow.com/questions/487126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21005/" ]
I know anonymous classes save typing when it comes to implementing Listener and similar stuff. They try to be a replacement for some usages of closures. But what does the community think about the value of this language-feature? Does it make sense and do you use it regularly? Does it make the code clearer, more unders...
I tend to use anonymous inner classes in situations where I don't need to have a full-blown class just to perform some task. For example, if I want to implement an `ActionListener` or `Runnable`, but I don't think having an inner class would be necessary. For example, for starting a simple `Thread`, using an anonymous ...
487,142
<p>Am looking for a single query that can convert the following information in the table </p> <pre><code>name:time :state a :10:00 AM:login b :10:05 AM:login a :10:06 AM:chatting a :10:08 AM:Idle b :10:11 AM:chatting a :10:10 AM:Logout b :10:12 AM:Logout </code></pre> <p>to something like this (given...
[ { "answer_id": 487179, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 2, "selected": false, "text": "<p>I'm pretty sure it can be done using only SQL, it's going to take me quite a bit of time to come up with a query fo...
2009/01/28
[ "https://Stackoverflow.com/questions/487142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53949/" ]
Am looking for a single query that can convert the following information in the table ``` name:time :state a :10:00 AM:login b :10:05 AM:login a :10:06 AM:chatting a :10:08 AM:Idle b :10:11 AM:chatting a :10:10 AM:Logout b :10:12 AM:Logout ``` to something like this (given the time range 10 AM to 1...
It can be done in a single SQL statement. Here's the proof. ### Setup ``` CREATE TEMP TABLE eventtable ( name CHAR(3) NOT NULL, time DATETIME HOUR TO MINUTE NOT NULL, state CHAR(8) NOT NULL ); INSERT INTO eventtable(name, time, state) VALUES('a', '10:00', 'login'); INSERT INTO eventtable(name, time, stat...
487,148
<p>I want to show some graphics in a Winform app, it will be a stock's chart drawing tool. I think (but I am not sure...) I have to use a PictureBox, and using the System.Drawing.Graphics class' drawing primitives to draw the chart. I have started coding it, now it works more-or-less, but I have a problem with the resi...
[ { "answer_id": 487165, "author": "Gambrinus", "author_id": 42386, "author_profile": "https://Stackoverflow.com/users/42386", "pm_score": 1, "selected": false, "text": "<p>As far as I remember from my C++ days - where I did loads of such image-stuff - you need to call the <strong>repaint<...
2009/01/28
[ "https://Stackoverflow.com/questions/487148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to show some graphics in a Winform app, it will be a stock's chart drawing tool. I think (but I am not sure...) I have to use a PictureBox, and using the System.Drawing.Graphics class' drawing primitives to draw the chart. I have started coding it, now it works more-or-less, but I have a problem with the resizin...
Why are you using a `PictureBox`? I would create a `UserControl` for your chart and draw the ellipse in its `Paint` method, just using its current size. In its constructor, set it up for double buffering and all painting in the paint method. ``` this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ...
487,173
<p>I'm getting memory leak with UIImagePickerController class.</p> <p>Here's how I'm using it:</p> <pre><code> UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [self presentModalViewContr...
[ { "answer_id": 487462, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "https://Stackoverflow.com/users/18017", "pm_score": 3, "selected": true, "text": "<p>As the author of <a href=\"http://blog.airsource.co.uk/index.php/2008/11/12/memory-usage-in-uiimagepickercontrolle...
2009/01/28
[ "https://Stackoverflow.com/questions/487173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
I'm getting memory leak with UIImagePickerController class. Here's how I'm using it: ``` UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [self presentModalViewController:picker animated...
As the author of [one of the first articles](http://blog.airsource.co.uk/index.php/2008/11/12/memory-usage-in-uiimagepickercontroller/) about the necessity to use a singleton, the motivation was to prevent a crash on the 7/8th image capture, not because of any particular worry about the leak. 160 bytes is annoying, but...
487,174
<p>I'm new to Dojo, so I need a little help.</p> <p>Some of my links takes a while (when the user clicks, it takes several seconds before the page starts loading), and I'd like to add a "loading"-message.</p> <p>I can do it the "old fashion way", but I want to learn the new, easier, smarter Dojo-way.</p> <p>Exactly ...
[ { "answer_id": 488655, "author": "pierdeux", "author_id": 53747, "author_profile": "https://Stackoverflow.com/users/53747", "pm_score": 4, "selected": true, "text": "<p>What you are describing assumes that dojo itself has already been loaded by the time that the modal <code>dijit.Dialog<...
2009/01/28
[ "https://Stackoverflow.com/questions/487174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28683/" ]
I'm new to Dojo, so I need a little help. Some of my links takes a while (when the user clicks, it takes several seconds before the page starts loading), and I'd like to add a "loading"-message. I can do it the "old fashion way", but I want to learn the new, easier, smarter Dojo-way. Exactly how it works is not impo...
What you are describing assumes that dojo itself has already been loaded by the time that the modal `dijit.Dialog` appears with the loading message. Now, normally, dojo starts executing once your page is fully loaded, and you would normally put your dojo code inside an anonymous function passed as parameter of `dojo.a...
487,177
<p>I have some functions here that for example are defined as </p> <pre><code>private int WriteLogikParameterTyp(FileStream filestream) </code></pre> <p>which i can not change. I want them to write into a MemoryStream Object. Is this possible? </p>
[ { "answer_id": 487193, "author": "Dead account", "author_id": 52458, "author_profile": "https://Stackoverflow.com/users/52458", "pm_score": 2, "selected": true, "text": "<p>No.</p>\n\n<p>FileStream is a concrete implementation.</p>\n\n<p>But it's a private method so should be easy enough...
2009/01/28
[ "https://Stackoverflow.com/questions/487177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22562/" ]
I have some functions here that for example are defined as ``` private int WriteLogikParameterTyp(FileStream filestream) ``` which i can not change. I want them to write into a MemoryStream Object. Is this possible?
No. FileStream is a concrete implementation. But it's a private method so should be easy enough to change since you can find all internal uses? Suggest replacing method signature with Stream rather than FileStream. Well... unless you create a tempory file, write to it then read it into memory.
487,181
<p>I have a java program which take path as argument. I want to check whether given path is existing or not before doing other validation. Eg: If i give a path D:\Log\Sample which is not not exist, it has to throw filenotfound exception. How can i do that?</p>
[ { "answer_id": 487186, "author": "mP.", "author_id": 56524, "author_profile": "https://Stackoverflow.com/users/56524", "pm_score": 1, "selected": false, "text": "<p>new File( path ).exists().</p>\n\n<p>Read the javadoc its very useful and often gives many useful examples.</p>\n" }, {...
2009/01/28
[ "https://Stackoverflow.com/questions/487181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51659/" ]
I have a java program which take path as argument. I want to check whether given path is existing or not before doing other validation. Eg: If i give a path D:\Log\Sample which is not not exist, it has to throw filenotfound exception. How can i do that?
``` if (!new File("D:\\Log\\Sample").exists()) { throw new FileNotFoundException("Yikes!"); } ``` Besides [`File.exists()`](http://java.sun.com/javase/6/docs/api/java/io/File.html#exists()), there are also [`File.isDirectory()`](http://java.sun.com/javase/6/docs/api/java/io/File.html#isDirectory()) and [`File.isFi...
487,184
<p>I have seen several standards for writing comments about the kind of data a function expects and returns in Python. Is there a consensus on which one is best-practice? </p> <p>Is the new functionality in <a href="http://www.python.org/dev/peps/pep-3107/" rel="noreferrer">http://www.python.org/dev/peps/pep-3107/</a>...
[ { "answer_id": 487203, "author": "nosklo", "author_id": 17160, "author_profile": "https://Stackoverflow.com/users/17160", "pm_score": 5, "selected": true, "text": "<p>Function annotations are not for a specific use, they can be used for anything.</p>\n\n<p>Tools can be written to extract...
2009/01/28
[ "https://Stackoverflow.com/questions/487184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51647/" ]
I have seen several standards for writing comments about the kind of data a function expects and returns in Python. Is there a consensus on which one is best-practice? Is the new functionality in <http://www.python.org/dev/peps/pep-3107/> something I should start using for this?
Function annotations are not for a specific use, they can be used for anything. Tools can be written to extract information from the annotations and do anything you want, including checking types or generating documentation. But python itself does not do anything with the information. You could use to a completely dif...
487,202
<p>What is the memory layout of a .NET array?</p> <p>Take for instance this array:</p> <pre><code>Int32[] x = new Int32[10]; </code></pre> <p>I understand that the bulk of the array is like this:</p> <pre><code>0000111122223333444455556666777788889999 </code></pre> <p>Where each character is one byte, and the digi...
[ { "answer_id": 487266, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 0, "selected": false, "text": "<p>An array object would have to store how many dimensions it has and the length of each dimension. So there is at ...
2009/01/28
[ "https://Stackoverflow.com/questions/487202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/267/" ]
What is the memory layout of a .NET array? Take for instance this array: ``` Int32[] x = new Int32[10]; ``` I understand that the bulk of the array is like this: ``` 0000111122223333444455556666777788889999 ``` Where each character is one byte, and the digits corresponds to indices into the array. Additionally,...
Great question. I found [this](http://www.codeproject.com/KB/cs/net_type_internals.aspx?fid=459323&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2567811) article which contains block diagrams for both value types and reference types. Also see this [article](https://web.archive.org/web/20150110150255/http://msdn....
487,204
<p>Currently when I want to set html attributes like maxlength and autocomplete, I have to use the following syntax:</p> <pre><code>&lt;%= Html.TextBox("username", ViewData["username"], new { maxlength = 20, autocomplete = "off" }) %&gt; </code></pre> <p>Is there any way to do this without having to explicitly set th...
[ { "answer_id": 487396, "author": "marc.d", "author_id": 12406, "author_profile": "https://Stackoverflow.com/users/12406", "pm_score": 0, "selected": false, "text": "<p>yes but you have to use ViewData.Model instead of ViewData.Item()</p>\n\n<p>the code in your controller should look like...
2009/01/28
[ "https://Stackoverflow.com/questions/487204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1574/" ]
Currently when I want to set html attributes like maxlength and autocomplete, I have to use the following syntax: ``` <%= Html.TextBox("username", ViewData["username"], new { maxlength = 20, autocomplete = "off" }) %> ``` Is there any way to do this without having to explicitly set the ViewData["username"] portion? ...
Just pass "null" as second parameter: ``` <%= Html.TextBox("username", null, new { maxlength = 20, autocomplete = "off" }) %> ```
487,209
<p>I wrote the function</p> <pre><code>(defun test () (let ((str1 "foo") (str2 "bar")) (loop for s in '(str1 str2) do (message s)))) </code></pre> <p>but it does not work. The Elisp <em>Backtrace</em> message is:</p> <blockquote> <p>Debugger entered--Lisp error: (wrong-type-argument stringp str1)</p> </block...
[ { "answer_id": 487238, "author": "dsm", "author_id": 7780, "author_profile": "https://Stackoverflow.com/users/7780", "pm_score": 2, "selected": false, "text": "<p>try:</p>\n\n<pre><code>`(,str1 ,str2)\n</code></pre>\n" }, { "answer_id": 487310, "author": "Svante", "author...
2009/01/28
[ "https://Stackoverflow.com/questions/487209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59704/" ]
I wrote the function ``` (defun test () (let ((str1 "foo") (str2 "bar")) (loop for s in '(str1 str2) do (message s)))) ``` but it does not work. The Elisp *Backtrace* message is: > > Debugger entered--Lisp error: (wrong-type-argument stringp str1) > > > How can I make it work? P.S.: the following modifi...
The `quote` operator (for which the apostrophe is syntactic sugar) means that its arguments are not evaluated, i.e. `(quote (str1 str2))` returns a list of two *symbols*. Use `list` instead: `(list str1 str2)`.
487,211
<p>Does anyone use unit tests to verify the time/space complexity of code?</p>
[ { "answer_id": 487240, "author": "Filip Ekberg", "author_id": 39106, "author_profile": "https://Stackoverflow.com/users/39106", "pm_score": 2, "selected": false, "text": "<p>That's a perfectly good point you bring up. Sure you use Unit test for this.</p>\n\n<p>A unit test is mainly a \"w...
2009/01/28
[ "https://Stackoverflow.com/questions/487211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55934/" ]
Does anyone use unit tests to verify the time/space complexity of code?
That's a perfectly good point you bring up. Sure you use Unit test for this. A unit test is mainly a "way" of testing the outcome of your code. You test if it does what it is supposed to do and that it fails when you want it to fail. Time and Space is two variables that are highly important and you might "want" fast ...
487,216
<p>I'm drawing rectangles at random positions on the stage, and I don't want them to overlap. So for each rectangle, I need to find a blank area to place it.</p> <p>I've thought about trying a random position, verify if it is free with </p> <pre><code>private function containsRect(r:Rectangle):Boolean { var free:...
[ { "answer_id": 487367, "author": "Juan Delgado", "author_id": 5908, "author_profile": "https://Stackoverflow.com/users/5908", "pm_score": 1, "selected": false, "text": "<p>I'm not sure how elegant this would be, but you could set up a maximum number of attempts. Maybe 100? </p>\n\n<p>Sur...
2009/01/28
[ "https://Stackoverflow.com/questions/487216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55385/" ]
I'm drawing rectangles at random positions on the stage, and I don't want them to overlap. So for each rectangle, I need to find a blank area to place it. I've thought about trying a random position, verify if it is free with ``` private function containsRect(r:Rectangle):Boolean { var free:Boolean = true; f...
Let S be the area of the stage. Let A be the area of the smallest rectangle we want to draw. Let N = S/A **One possible deterministic approach:** When you draw a rectangle on an empty stage, this divides the stage into at most 4 regions that can fit your next rectangle. When you draw your next rectangle, one or two r...
487,229
<p>Here is source code for multithreaed server and client in python.</p> <p>In the code client and server closes connection after the job is finished. I want to keep the connections alive and send more data over the same connections to <strong>avoid overhead of closing and opening sockets every time</strong>.</p> <p>...
[ { "answer_id": 487255, "author": "sth", "author_id": 56338, "author_profile": "https://Stackoverflow.com/users/56338", "pm_score": 2, "selected": false, "text": "<p>I'm not sure I understand the question, but don't call <code>close()</code> if you don't want to close the connection...</p...
2009/01/28
[ "https://Stackoverflow.com/questions/487229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58737/" ]
Here is source code for multithreaed server and client in python. In the code client and server closes connection after the job is finished. I want to keep the connections alive and send more data over the same connections to **avoid overhead of closing and opening sockets every time**. Following code is from : <http...
Spawning a new thread for every connection is a **really bad** design choice. What happens if you get hit by a lot of connections? In fact, using threads to wait for network IO is not worth it. Your program gets really complex and you get absolutely **no benefit** since waiting for network in threads won't make you **...
487,230
<p>What is the final/best recommendation for how to serve favicon.ico in ASP.NET MVC?</p> <p>I am currently doing the following:</p> <ul> <li><p>Adding an entry to the <strong>very beginning</strong> of my RegisterRoutes method:</p> <pre><code>routes.IgnoreRoute("favicon.ico"); </code></pre></li> <li><p>Placing favi...
[ { "answer_id": 487268, "author": "Eduardo Campañó", "author_id": 12091, "author_profile": "https://Stackoverflow.com/users/12091", "pm_score": 5, "selected": false, "text": "<p>1) You can put your favicon where you want and add this tag to your page head</p>\n\n<pre><code>&lt;link rel=\"...
2009/01/28
[ "https://Stackoverflow.com/questions/487230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
What is the final/best recommendation for how to serve favicon.ico in ASP.NET MVC? I am currently doing the following: * Adding an entry to the **very beginning** of my RegisterRoutes method: ``` routes.IgnoreRoute("favicon.ico"); ``` * Placing favicon.ico in the root of my application (which is also going to be th...
Placing favicon.ico in the root of your domain only really affects IE5, IIRC. For more modern browsers you should be able to include a link tag to point to another directory: ``` <link rel="SHORTCUT ICON" href="http://www.mydomain.com/content/favicon.ico"/> ``` You can also use non-ico files for browsers other than ...
487,243
<p>I have to implement a set of 60 functions, according to the predefined signatures. They must be global functions, and not some class's member functions. When I implement them, I use a set of nicely done classes provided by 3rd party.</p> <p>My implementation of most functions is quite short, about 5-10 lines, and d...
[ { "answer_id": 487265, "author": "On Freund", "author_id": 2150, "author_profile": "https://Stackoverflow.com/users/2150", "pm_score": 0, "selected": false, "text": "<p>I think that the \"one class one responsibility\" rule should guide you here. The 60 functions can probably be divided ...
2009/01/28
[ "https://Stackoverflow.com/questions/487243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44673/" ]
I have to implement a set of 60 functions, according to the predefined signatures. They must be global functions, and not some class's member functions. When I implement them, I use a set of nicely done classes provided by 3rd party. My implementation of most functions is quite short, about 5-10 lines, and deals mostl...
> > All the state information is stored in the static members of my and 3rd party's classes, so I don't have to create global variables. > > > That is the keypoint. No, they should definitely not be put into classes. Classes are made to be used for creating objects. In your situation, you would use them just as a ...
487,244
<p>This is something I've been looking into for while, but I have yet to find any concrete information or good examples. I have, say, a bunch of unconnected objects (triangle strips for instance). What is the efficient way to render these?</p> <p>I've heard about putting several objects in one VBO to reduce openGL cal...
[ { "answer_id": 487285, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 1, "selected": false, "text": "<p>Look into <a href=\"http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawelements.html\" rel=\"no...
2009/01/28
[ "https://Stackoverflow.com/questions/487244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42635/" ]
This is something I've been looking into for while, but I have yet to find any concrete information or good examples. I have, say, a bunch of unconnected objects (triangle strips for instance). What is the efficient way to render these? I've heard about putting several objects in one VBO to reduce openGL calls, but ha...
First off, you should probably use VBO all the time. For small and large objects. Then, the second issue is "how to combine several separate objects into one large object?" - so to reduce the number of OpenGL calls that have to be made. Generally, objects that use the same texture(s), material settings and shaders can...
487,283
<p>I am creating a game using Allegro/C++. The game is almost done and now, I want to create a map editor. The game contains numerous classes and their number will vary depending on the number of objects the map requires. I was thinking of creating a separate structure to hold level data and store it as a map. The prob...
[ { "answer_id": 487382, "author": "Riho", "author_id": 44715, "author_profile": "https://Stackoverflow.com/users/44715", "pm_score": 0, "selected": false, "text": "<p>Create class for each different datastructure and then implement Read/Write functions for them. Use some flags between rec...
2009/01/28
[ "https://Stackoverflow.com/questions/487283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am creating a game using Allegro/C++. The game is almost done and now, I want to create a map editor. The game contains numerous classes and their number will vary depending on the number of objects the map requires. I was thinking of creating a separate structure to hold level data and store it as a map. The problem...
So, what you want to do is serialization. I suggest simply using an already existing library for that. Have a look at this thread: [How to serialize in c++ ?](https://stackoverflow.com/questions/234724/how-to-serialize-in-c)
487,289
<p>I'm having trouble with some vertical CSS positioning. I would like to create a page with the following layout:</p> <pre><code>B AAA AAA AAA C AAA </code></pre> <p>A is a grid (table) of data B is aligned to the top of the grid C is aligned to the bottom of the grid</p> <p>How do I get B and C to align corre...
[ { "answer_id": 487326, "author": "Chris", "author_id": 58244, "author_profile": "https://Stackoverflow.com/users/58244", "pm_score": 3, "selected": false, "text": "<p>I just tested this (adds in a wrapper div):</p>\n\n<pre><code> &lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transi...
2009/01/28
[ "https://Stackoverflow.com/questions/487289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5461/" ]
I'm having trouble with some vertical CSS positioning. I would like to create a page with the following layout: ``` B AAA AAA AAA C AAA ``` A is a grid (table) of data B is aligned to the top of the grid C is aligned to the bottom of the grid How do I get B and C to align correctly? EDIT: Sorry for the confus...
I just tested this (adds in a wrapper div): ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css" media="screen"> #wrapper{ position: relativ...
487,301
<p>I have the following part of an AJAX application, which gives no errors, but also nothing is displayed to the screen, so I am unsure of where the problem lies. Calling this page directly from a browser with ?cmd&amp;id=1 should return, or even calling it without ?cmd should return the cmd error message.</p> <p>edit...
[ { "answer_id": 487312, "author": "Filip Ekberg", "author_id": 39106, "author_profile": "https://Stackoverflow.com/users/39106", "pm_score": 4, "selected": false, "text": "<p>This will help you see your errors:</p>\n\n<pre><code>ini_set('display_errors', '1');\n</code></pre>\n" }, { ...
2009/01/28
[ "https://Stackoverflow.com/questions/487301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I have the following part of an AJAX application, which gives no errors, but also nothing is displayed to the screen, so I am unsure of where the problem lies. Calling this page directly from a browser with ?cmd&id=1 should return, or even calling it without ?cmd should return the cmd error message. edit: added test c...
You have an extra parenthesis on line 22 This ``` $con->set_charset("utf8")); ``` Needs to be this ``` $con->set_charset("utf8"); ``` Two debugging tips for the future. For the first, you'll need shell access to your web host, or you'll need to install PHP locally on your development machine. If you're running U...
487,314
<p>At work we have a big database with unique indexes instead of primary keys and all works fine.</p> <p>I'm designing new database for a new project and I have a dilemma:</p> <p>In DB theory, primary key is fundamental element, that's OK, but in REAL projects what are advantages and disadvantages of both?</p> <p>Wh...
[ { "answer_id": 487321, "author": "Filip Ekberg", "author_id": 39106, "author_profile": "https://Stackoverflow.com/users/39106", "pm_score": 5, "selected": false, "text": "<p>You can see it like this:</p>\n\n<p><strong>A Primary Key IS Unique</strong></p>\n\n<p><strong>A Unique value does...
2009/01/28
[ "https://Stackoverflow.com/questions/487314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53854/" ]
At work we have a big database with unique indexes instead of primary keys and all works fine. I'm designing new database for a new project and I have a dilemma: In DB theory, primary key is fundamental element, that's OK, but in REAL projects what are advantages and disadvantages of both? What do you use in project...
**What is a unique index?** A unique index on a column is an index on that column that also enforces the constraint that you cannot have two equal values in that column in two different rows. Example: ``` CREATE TABLE table1 (foo int, bar int); CREATE UNIQUE INDEX ux_table1_foo ON table1(foo); -- Create unique inde...
487,316
<p>I want to reduce the number of bytes of an image captured by the device, since i believe the <code>_imageScaledToSize</code> does not reduce the number of bytes of the picture (or does it?) - i want to store a thumbnail of the image in a local dictionary object and can't afford to put full size images in the diction...
[ { "answer_id": 487656, "author": "Mike Abdullah", "author_id": 28768, "author_profile": "https://Stackoverflow.com/users/28768", "pm_score": 1, "selected": false, "text": "<p>You need to draw the image into a graphics context at a smaller size. Then, release the original image.</p>\n" ...
2009/01/28
[ "https://Stackoverflow.com/questions/487316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
I want to reduce the number of bytes of an image captured by the device, since i believe the `_imageScaledToSize` does not reduce the number of bytes of the picture (or does it?) - i want to store a thumbnail of the image in a local dictionary object and can't afford to put full size images in the dictionary. Any idea?
If you wish to simply compress your UIImage, you can use ``` NSData *dataForPNGFile = UIImagePNGRepresentation(yourImage); ``` to generate an NSData version of your image encoded as a PNG (easily inserted into an NSDictionary or written to disk), or you can use ``` NSData *dataForPNGFile = UIImageJPEGRepresentati...
487,339
<p>I am trying to learn SQLite, and I am building an iPhone app. But I would like to add an SQLite database to my building app. I have got three tutorials, but I am not clear on that code.</p> <p>How can I add an SQLite database to my building app? What would sample code look like?</p>
[ { "answer_id": 487531, "author": "AidenMontgomery", "author_id": 1403, "author_profile": "https://Stackoverflow.com/users/1403", "pm_score": 4, "selected": false, "text": "<p>First of all you need to create your database.<br>\nFrom the command line create your db file.</p>\n\n<pre><code>...
2009/01/28
[ "https://Stackoverflow.com/questions/487339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58554/" ]
I am trying to learn SQLite, and I am building an iPhone app. But I would like to add an SQLite database to my building app. I have got three tutorials, but I am not clear on that code. How can I add an SQLite database to my building app? What would sample code look like?
First of all you need to create your database. From the command line create your db file. ``` sqlite3 mydb.db ``` Then create the tables within your database ``` CREATE TABLE tags (id int(5), name varchar(255), created_at datetime, updated_at datetime); ``` Repeat that for any tables that you want in your data...
487,340
<p>I have developed a console ATL application and want to trap the close?, exit?, terminate? event so that I can close log files and perform a general clean-up on exit.</p> <p>How can I trap the 'terminate' event that would result from someone ending the .exe in the task manager?</p> <p><strong>EDIT:</strong></p> <p...
[ { "answer_id": 487345, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 2, "selected": false, "text": "<p>You can't trap \"End Process\" from the Processes tab in Task Manager. If a program could trap it, how would you ...
2009/01/28
[ "https://Stackoverflow.com/questions/487340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59725/" ]
I have developed a console ATL application and want to trap the close?, exit?, terminate? event so that I can close log files and perform a general clean-up on exit. How can I trap the 'terminate' event that would result from someone ending the .exe in the task manager? **EDIT:** It's a console application, I've att...
You can't trap "End Process" from the Processes tab in Task Manager. If a program could trap it, how would you kill it? To respond to "End Process" on the Applications tab in Task Manager, handle the WM\_CLOSE message in your main window. This assumes that your ATL app is a Windows GUI application. If it's a console ...
487,352
<p>So, it's been a few months since I wrote <a href="https://stackoverflow.com/questions/174830/learning-game-programming">this question</a>, since then I've toyed with "raw" C++ D3D, The Ogre and Irrlicht graphics engines and lately Microsoft XNA. I've built a few 2D games (mostly replicas of old stuff like tetris, as...
[ { "answer_id": 487384, "author": "Hank", "author_id": 7610, "author_profile": "https://Stackoverflow.com/users/7610", "pm_score": 1, "selected": false, "text": "<p>For vectors specifically, an introductory text or course on linear algebra should be able to get you up to speed fairly quic...
2009/01/28
[ "https://Stackoverflow.com/questions/487352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/452521/" ]
So, it's been a few months since I wrote [this question](https://stackoverflow.com/questions/174830/learning-game-programming), since then I've toyed with "raw" C++ D3D, The Ogre and Irrlicht graphics engines and lately Microsoft XNA. I've built a few 2D games (mostly replicas of old stuff like tetris, astreoids, etc.)...
Ok, a quick course in Matrix/Vector calculation: A matrix is a collection of numbers ordered in a rectangular grid like: ``` [ 0, 1, 2 ] [ 2, 3, 5 ] [ 2, 1, 3 ] [ 0, 0, 1 ] ``` The above matrix has 4 rows and 3 columns and as such is a 4 x 3 matrix. A vector is a matrix with 1 row (a row vector) or 1 column...