qid int64 4 19.1M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
418,764 | <p>Not entirely sure how to phrase the question, because it's a "why doesn't this work?" type of query.</p>
<p>I've reduced my particular issue down to this code:</p>
<pre><code>public interface IFoo
{
}
public class Foo : IFoo
{
}
public class Bar<T> where T : IFoo
{
public Bar(T t)
{
}
public Bar()
: this(new Foo()) // cannot convert from 'Foo' to 'T'
{
}
}
</code></pre>
<p>Now, the generic type <code>T</code> in the <code>Bar<T></code> class <em>must</em> implement IFoo. So why does the compiler give me the error in the comment? Surely an instance of Foo is an IFoo, and can therefore be passed around as a representative of the generic type <code>T</code>?</p>
<p>Is this a compiler limitation or am I missing something?</p>
| [
{
"answer_id": 418777,
"author": "Andrew Kennan",
"author_id": 22506,
"author_profile": "https://Stackoverflow.com/users/22506",
"pm_score": 5,
"selected": true,
"text": "public interface IFoo\n{\n}\n\npublic class Foo : IFoo\n{\n}\n\npublic class Fiz : IFoo\n{\n}\n\nFoo foo = new Foo();... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615/"
] |
418,765 | <p>I have rows of text data that can vary between 0 and 100, and all need to be visible on the screen at one time. The default behavior is fine for the grid until the rows * rowHeight > gridHeight.</p>
<p>Basically I need a hook into the item height, or row height to calculate it based on the height of the grid. I've set paddingTop and paddingBottom to zero, but there is still a considerable amount of white space in between rows.</p>
<p>My datagrid component...</p>
<pre><code><mx:DataGrid xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="OnCreationComplete()"
paddingTop="0"
paddingBottom="0"
>
<mx:Script>
<![CDATA[
private function OnCreationComplete():void
{
//setRowHeight(10);
}
override protected function setRowHeight(v:Number):void
{
super.setRowHeight(v);
}
]]>
</mx:Script>
</mx:DataGrid>
</code></pre>
<p>setRowHeight() helps, but the itemRender for the cell bigger than the cell, if I set the row height to something like 10.</p>
| [
{
"answer_id": 419872,
"author": "inferis",
"author_id": 51998,
"author_profile": "https://Stackoverflow.com/users/51998",
"pm_score": 1,
"selected": false,
"text": "myDataGrid.dataProvider = myArray;\nmyGrid.rowHeight = Math.floor((myGrid.height - myGrid.headerHeight)/myArray.length);\n... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
418,778 | <p>Another question about TDD from me. I have read some articles and book chapters about TDD and I understand why you should TDD and I understand the simple examples but it seems when I am trying this out in the real world I get stuck very easy.</p>
<p>Could you give me some simple TDD examples if you were to program the well known Spider Solitaire that comes with Windows Vista? Which tests would you start with?</p>
| [
{
"answer_id": 418869,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 2,
"selected": false,
"text": "secret_number >= 1 && secret_number <= 10 number > secret_number number < secret_number number == secret_number"
}... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29519/"
] |
418,791 | <p>I want to create analog of program <a href="http://conky.sourceforge.net/screenshots.html" rel="nofollow noreferrer">conky</a>. What is the best way to draw information on a OS X desktop?</p>
| [
{
"answer_id": 418861,
"author": "Sophie Alpert",
"author_id": 49485,
"author_profile": "https://Stackoverflow.com/users/49485",
"pm_score": 2,
"selected": false,
"text": "NSWindowLevel"
},
{
"answer_id": 418999,
"author": "Marc Charbonneau",
"author_id": 35136,
"auth... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174644/"
] |
418,792 | <pre><code>Mac OS 10.4
rspec (1.1.11, 1.1.4, 1.1.3, 0.5.15)
rspec-rails (1.1.11)
rspec_generator (0.5.15)
rails 2.2.2
ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0]
</code></pre>
<p>Created a new project...</p>
<pre><code>$ rails myproject
</code></pre>
<p>Installed rspec into the project...</p>
<pre><code>$ script/generate rspec
</code></pre>
<p>Generated a resource...</p>
<pre><code>$ script/generate rspec_scaffold myresource name:string description:text
</code></pre>
<p>Tried to run specs...</p>
<pre><code>$ rake spec
</code></pre>
<p>Got this error:</p>
<pre><code>/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- ./spec/models/../../vendor/generators/rspec/lib/rspec_on_rails (MissingSourceFile)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'
from ./spec/models/../spec_helper.rb:3
from ./spec/models/entry_spec.rb:1:in `require'
from ./spec/models/entry_spec.rb:1
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:14:in `load'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:14:in `load_files'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:13:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:13:in `load_files'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/options.rb:98:in `run_examples'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/command_line.rb:10:in `run'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/bin/spec:4
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- /Users/ethan/project/project/spec/../vendor/generators/rspec/lib/rspec_on_rails (MissingSourceFile)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'
from /Users/ethan/project/project/spec/spec_helper.rb:3
from ./spec/controllers/entries_controller_spec.rb:1:in `require'
from ./spec/controllers/entries_controller_spec.rb:1
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:14:in `load'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:14:in `load_files'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:13:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:13:in `load_files'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/options.rb:98:in `run_examples'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/command_line.rb:10:in `run'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/bin/spec:4
</code></pre>
<p>Indeed, there is no such file...</p>
<p>vendor/generators, ls:</p>
<pre><code>rspec_controller rspec_model
</code></pre>
| [
{
"answer_id": 428132,
"author": "Mihai A",
"author_id": 4212,
"author_profile": "https://Stackoverflow.com/users/4212",
"pm_score": 4,
"selected": true,
"text": "$ script/generate\n"
},
{
"answer_id": 4314937,
"author": "bonyiii",
"author_id": 525305,
"author_profile... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42595/"
] |
418,799 | <p>I'm learning JavaScript and while browsing through the jQuery library I see <code>:</code> (colon) being used a lot. What is this used for in JavaScript? </p>
<pre><code>// Return an array of filtered elements (r)
// and the modified expression string (t)
return { r: r, t: t };
</code></pre>
| [
{
"answer_id": 418805,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 9,
"selected": true,
"text": "var o = {\n r: 'some value',\n t: 'some other value'\n};\n var o = new Object();\no.r = 'some value';\no.t = 'some ... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17744/"
] |
418,817 | <p>What are the pros and cons of using <code>System.Security.Cryptography.RNGCryptoServiceProvider</code> vs <code>System.Random</code>. I know that <code>RNGCryptoServiceProvider</code> is 'more random', i.e. less predictable for hackers. Any other pros or cons?</p>
<hr>
<p><strong>UPDATE:</strong></p>
<p>According to the responses, here are the pros and cons of using <code>RNGCryptoServiceProvider</code> so far:</p>
<h3>Pros</h3>
<ul>
<li><code>RNGCryptoServiceProvider</code> is a stronger cryptographically random number, meaning it would be better for determining encryption keys and the likes.</li>
</ul>
<h3>Cons</h3>
<ul>
<li><code>Random</code> is faster because it is a simpler calculation; when used in simulations or long calculations where cryptographic randomness isn't important, this should be used. Note: see <a href="https://stackoverflow.com/a/54847919/9536">Kevin's answer</a> for details about simulations - <code>Random</code> is not necessarily random enough, and you may want to use a different non-cryptographic PRNG.</li>
</ul>
| [
{
"answer_id": 418870,
"author": "Jader Dias",
"author_id": 48465,
"author_profile": "https://Stackoverflow.com/users/48465",
"pm_score": 3,
"selected": false,
"text": "System.Random RNGCryptoServiceProvider System.Random"
},
{
"answer_id": 2181220,
"author": "Yury Chaikou",
... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9536/"
] |
418,822 | <p>My application is currently displaying negative numbers as -1. The users have changed the requirements (just for a change!) and now we will have to display the numbers as (1).
Can I enable that for the whole application say changing the web.config or even the app's CultureInfo ? Is there any side effect of doing that since we have lots of pages that contain number validators ?</p>
<p>Thanks !</p>
| [
{
"answer_id": 418847,
"author": "jcollum",
"author_id": 30946,
"author_profile": "https://Stackoverflow.com/users/30946",
"pm_score": 2,
"selected": false,
"text": "String.Format(”{0:$#,##0.00;($#,##0.00);Zero}”, value);\n\n This will output “$1,240.00″ if passed 1243.50. It will out... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14401/"
] |
418,845 | <p>I have a method that is meant to display output on a RichTextBox in a form.</p>
<pre><code> public void LogTextEvent(RichTextBox TextEventLog, Color TextColor, string EventText)
{
string nDateTime = DateTime.Now.ToString("hh:mm:ss tt") + " - ";
// color text.
TextEventLog.SelectionStart = TextEventLog.Text.Length;
TextEventLog.SelectionColor = TextColor;
// newline if first line, append if else.
if (TextEventLog.Lines.Length == 0)
{
TextEventLog.AppendText(nDateTime + EventText);
TextEventLog.ScrollToCaret();
TextEventLog.AppendText(System.Environment.NewLine);
}
else
{
TextEventLog.AppendText(nDateTime + EventText + System.Environment.NewLine);
TextEventLog.ScrollToCaret();
}
}
</code></pre>
<p>The problem arises when I call LogEventText() from another method running inside a thread:</p>
<pre><code> Thread thListening = new Thread(new ThreadStart(StartListening));
thListening.Start();
</code></pre>
<p>Inside the StartListening method (it is a thread created that handles new tcp sockets to be created for clients on a main listening socket for a small http server), I make use of LogTextEvent to log some data, but I receive an InvalidOperationException was unhandled error in the LogTextEvent method at the 2nd line, TextEventLog.SelectionStart = TextEventLog.Text.Length;</p>
<p>The error reads, Cross-thread operation not valid: Control 'rchEventLog' accessed from a thread other than the thread it was created on.</p>
<p>Can anyone help break down what's going on, why, and how the error could be fixed?</p>
| [
{
"answer_id": 418866,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": -1,
"selected": false,
"text": "new Thread(new ThreadStart(delegate {\n //do some worker-thread processing here\n ...\n //now update the gui f... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
418,877 | <p>I have a VB.NET web service that calls a third party web service. How can I view the SOAP message generated by .NET before it is sent to the third party web service and how can I see the SOAP response before it is serialized by .NET. </p>
<p>When creating a standalone EXE, I see the Reference.vb file that is automatically generated, but don't see a similar file when my project is a web service. I have found lots of C# code to do this, but none in VB.NET.</p>
<p>Edit - Fiddler and TCP loggers are great, but will not work for my purposes. I need to be able to access the raw SOAP messages from within the application so I can log them or modify them. I need to do more than just see the messages going back and forth.</p>
| [
{
"answer_id": 2623459,
"author": "Adam",
"author_id": 212188,
"author_profile": "https://Stackoverflow.com/users/212188",
"pm_score": 0,
"selected": false,
"text": "Dim message As String = OperationContext.Current.RequestContext.RequestMessage.ToString()\n ToString() IErrorHandler Provi... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
418,878 | <p><a href="https://stackoverflow.com/questions/417261/vbc-nant-error-compiling-winform">To an earlier question of mine, invovling VBC and NAnt with WinForms</a>, I have since come up with a better way of stating this.</p>
<p>Within vbproj file, you have the following:</p>
<pre><code><ItemGroup>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</Content>
</ItemGroup>
</code></pre>
<p>When one runs build from within Visual Studio (Debug Verbosity set to Normal), one of the lines produces is:</p>
<pre><code>Target CoreCompile:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Vbc.exe ...
</code></pre>
<p>Which includes all of the settings required for vbc.exe to run. However, taking that string from Visual Studio, and running it directly on the command line yields:</p>
<pre><code>... My Project\Settings.Designer.vb(67) : error BC30002: Type 'My.MySettings' is not defined.
Friend ReadOnly Property Settings() As Global.My.MySettings
...\My Project\Settings.Designer.vb(69) : error BC30456: 'My' is not a member of '<Default>'.
Return Global.My.MySettings.Default
</code></pre>
<p>How does one get the above Generators to run from a command line, or is there a call somewhere that will generate the correct temp files that are needed for vbc.exe to run the command string correctly?</p>
| [
{
"answer_id": 4822972,
"author": "dusbennett",
"author_id": 593014,
"author_profile": "https://Stackoverflow.com/users/593014",
"pm_score": 0,
"selected": false,
"text": "<target name=\"build\" depends=\"clean\">\n <msbuild project=\"ProjectName.vbproj\" />\n</target>\n"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/418878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8505/"
] |
418,887 | <p>I have a pointer to pointer array. I am assigning each row in the while loop below and the printf inside the while loop shows each is assigned my id number 1-20.<br>
After, out side of the while loop I iterate through the array and every element is written with id 20?<br>
Any help is greatly appreciated. (FYI- I am using the Template2doc library and example1.c, at the bottom here- <a href="http://www.algonet.se/~thunberg/template2doc/c_version/docs/index.htm" rel="nofollow noreferrer">http://www.algonet.se/~thunberg/template2doc/c_version/docs/index.htm</a>)</p>
<p>Below code only shows problem area, I took out the rest. </p>
<pre><code> char **tableData[500]={NULL};
char *myData[500][2];
while(rc == SQLITE_ROW){
tableData[r] = myData[r];
printf(*tableData[r]); <-- Displays id 1-20 fine
r=r+1;
}//end while
tableData[r+1] = NULL;//null terminated array
for (a=0; a<r; a++){
printf("\n");
printf(*tableData[a]); <--Displays 20 elements all of id 20?
}
outputFile=insertTableData(outputFile, dataMarker, fieldMarker, tableData);
</code></pre>
| [
{
"answer_id": 427751,
"author": "shodanex",
"author_id": 11589,
"author_profile": "https://Stackoverflow.com/users/11589",
"pm_score": 1,
"selected": false,
"text": "printf(\"Character at 0x%x : %d\", tableData[a], *tableData[a]);\n"
},
{
"answer_id": 428240,
"author": "Tony... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52256/"
] |
418,894 | <p>I'm learning how to write programs in C using the k&r book (The C Programming Language) and I have a problem with one of the exercises. It's asking me to detect and remove a character in string s1, which matches any characters in the string s2.</p>
<p>So, say s1 = "A";</p>
<p>And s2 = "AABAACAADAAE"</p>
<p>I want it to return "BCDE"</p>
<p>I know I'm on the right path towards it, i just don't know how to design programs very well, could you give me any additional tips. I tried to read about the binary search tree algorithm, but felt it was a little too advanced for this mundane task.</p>
<p>Thanks everyone!</p>
<pre><code>/* An alternate version of squeeze(s1, s2) that deletes each character in
* s1 that matches any character in the string s2
*
* Angie@odfx.org
*/
#include <stdio.h>
#include <string.h>
void squeeze(char s[], char t[]);
char string[] = "BAD";
char sstring[] = "ABC";
int
main(void)
{
squeeze(string, sstring);
return 0;
}
void
squeeze(char s[], char t[])
{
int i, j, d;
d = 0;
if(strstr(s, t) == NULL)
printf("%c", s[i]);
s[j] = '\0';
}
</code></pre>
| [
{
"answer_id": 418917,
"author": "PolyThinker",
"author_id": 47707,
"author_profile": "https://Stackoverflow.com/users/47707",
"pm_score": 0,
"selected": false,
"text": "char *s1, *s2, *result; /* original strings and the result string */\nint len1, len2; /* lengths of the strings */\nfo... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
418,896 | <p>In bash, calling <code>foo</code> would display any output from that command on the stdout.</p>
<p>Calling <code>foo > output</code> would redirect any output from that command to the file specified (in this case 'output').</p>
<p>Is there a way to redirect output to a file <em>and</em> have it display on stdout?</p>
| [
{
"answer_id": 418899,
"author": "Zoredache",
"author_id": 20267,
"author_profile": "https://Stackoverflow.com/users/20267",
"pm_score": 12,
"selected": true,
"text": "tee foo | tee output.file\n ls -a | tee output.file\n program [arguments...] 2>&1 | tee outfile\n 2>&1 tee tee -a progra... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1666/"
] |
418,898 | <p><a href="http://en.wikipedia.org/wiki/Upsert" rel="noreferrer">http://en.wikipedia.org/wiki/Upsert</a></p>
<p><a href="https://stackoverflow.com/questions/13540/insert-update-stored-proc-on-sql-server">Insert Update stored proc on SQL Server</a></p>
<p>Is there some clever way to do this in SQLite that I have not thought of?</p>
<p>Basically I want to update three out of four columns if the record exists,
If it does not exists I want to INSERT the record with the default (NUL) value for the fourth column.</p>
<p>The ID is a primary key so there will only ever be one record to UPSERT.</p>
<p>(I am trying to avoid the overhead of SELECT in order to determine if I need to UPDATE or INSERT obviously)</p>
<p>Suggestions?</p>
<hr />
<p>I cannot confirm that Syntax on the SQLite site for TABLE CREATE.
I have not built a demo to test it, but it doesn't seem to be supported.</p>
<p>If it was, I have three columns so it would actually look like:</p>
<pre><code>CREATE TABLE table1(
id INTEGER PRIMARY KEY ON CONFLICT REPLACE,
Blob1 BLOB ON CONFLICT REPLACE,
Blob2 BLOB ON CONFLICT REPLACE,
Blob3 BLOB
);
</code></pre>
<p>but the first two blobs will not cause a conflict, only the ID would
So I assume Blob1 and Blob2 would not be replaced (as desired)</p>
<hr />
<p>UPDATEs in SQLite when binding data are a complete transaction, meaning
Each sent row to be updated requires: Prepare/Bind/Step/Finalize statements
unlike the INSERT which allows the use of the reset function</p>
<p>The life of a statement object goes something like this:</p>
<ol>
<li>Create the object using sqlite3_prepare_v2()</li>
<li>Bind values to host parameters using sqlite3_bind_ interfaces.</li>
<li>Run the SQL by calling sqlite3_step()</li>
<li>Reset the statement using sqlite3_reset() then go back to step 2 and repeat.</li>
<li>Destroy the statement object using sqlite3_finalize().</li>
</ol>
<p>UPDATE I am guessing is slow compared to INSERT, but how does it compare to SELECT using the Primary key?</p>
<p>Perhaps I should use the select to read the 4th column (Blob3) and then use REPLACE to write a new record blending the original 4th Column with the new data for the first 3 columns?</p>
| [
{
"answer_id": 418920,
"author": "JosephStyons",
"author_id": 672,
"author_profile": "https://Stackoverflow.com/users/672",
"pm_score": 3,
"selected": false,
"text": "--first, update any matches\nUPDATE DESTINATION_TABLE DT\nSET\n MY_FIELD1 = (\n SELECT MY_FIELD1\n ... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18749/"
] |
418,910 | <p>I'm trying to clone form components using JQuery's .clone() (actually, I'm cloning a collection of fields by cloning the container element). Everything worked out well except that the datefield, comboboxes are not working, even the validation for minLength, etc. is also not working.</p>
<p>By the way, I'm just transforming an old html form fields to ext js form fields using applyTo</p>
| [
{
"answer_id": 419347,
"author": "redsquare",
"author_id": 6440,
"author_profile": "https://Stackoverflow.com/users/6440",
"pm_score": 1,
"selected": false,
"text": ".clone(true) \n"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/418910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40538/"
] |
418,913 | <p>I was reading the Platform SDK samples, and the examples are in VB.NET. I use C# so I was wondering, how can I replicate this line in C#?</p>
<pre><code>Set Installer = CreateObject("WindowsInstaller.Installer")
</code></pre>
<p>Thank you.</p>
| [
{
"answer_id": 418939,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 2,
"selected": false,
"text": "using System.Runtime.InteropServices;\n\nType InstallerType;\nobject Installer;\n\nInstallerType= Type.GetTypeFromPro... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
418,914 | <p>In listening to the StackOverflow podcast, the jab keeps coming up that "real programmers" write in C, and that C is so much faster because it's "close to the machine." Leaving the former assertion for another post, what is special about C that allows it to be faster than other languages? Or put another way: what's to stop other languages from being able to compile down to binary that runs every bit as fast as C?</p>
| [
{
"answer_id": 418934,
"author": "JosephStyons",
"author_id": 672,
"author_profile": "https://Stackoverflow.com/users/672",
"pm_score": 6,
"selected": false,
"text": "function RemoveAllAFromB(a, b: string): string;\nvar\n before, after :string;\nbegin\n Result := b;\n if 0 < Pos(a,b) ... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3799/"
] |
418,915 | <p>I'm learning Python, and I have a situation where I want to consume items from an iterator. The tricky part is that under certain conditions, I want to "un-iterate." That is, put an item back onto the front of the iterator before I loop.</p>
<p>For example, suppose I'm picking apples from a tree. My fruit basket can only hold 10kg before it needs to be emptied. But I have to pick each apple before I can weigh it and determine if this apple would exceed the capacity of the basket.</p>
<p>In a language like Perl, I could <code>unshift()</code> the apple back onto the tree, and then let the loop expression re-pick the apple:</p>
<pre><code>while ($apple = shift(@tree)) {
$wt = weight($apple);
if ($wt + weight(@basket) > 10) {
send(@basket);
@basket = ();
unshift(@tree, $apple);
} else {
push(@basket, $element);
}
}
</code></pre>
<p>Or else I can also use <code>redo</code>, which resumes processing at the top of block, without evaluating the loop expression. So the same apple can be re-processed, after the basket has been emptied.</p>
<pre><code>while ($apple = shift(@tree)) {
$wt = weight($apple);
if ($wt + weight(@basket) > 10) {
send(@basket);
@basket = ();
redo;
} else {
push(@basket, $apple);
}
}
</code></pre>
<p>What would be the most <strong>pythonic</strong> solution for this kind of problem?</p>
| [
{
"answer_id": 418946,
"author": "Patrick",
"author_id": 429,
"author_profile": "https://Stackoverflow.com/users/429",
"pm_score": 5,
"selected": true,
"text": "for apple in tree:\n if (apple.weight + basket.weight) > 10:\n send(basket)\n basket.clear()\n basket.add(app... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20860/"
] |
418,916 | <p>I have a generated txt file. This file has certain lines that are superfluous, and need to be removed. Each line that requires removal has one of two string in the line; "ERROR" or "REFERENCE". These tokens may appear anywhere in the line. I would like to delete these lines, while retaining all other lines.</p>
<p>So, if the txt file looks like this:</p>
<pre>
Good Line of data
bad line of C:\Directory\ERROR\myFile.dll
Another good line of data
bad line: REFERENCE
Good line
</pre>
<p>I would like the file to end up like this:</p>
<pre>
Good Line of data
Another good line of data
Good line
</pre>
<p>TIA.</p>
| [
{
"answer_id": 418937,
"author": "Rob",
"author_id": 41908,
"author_profile": "https://Stackoverflow.com/users/41908",
"pm_score": 3,
"selected": false,
"text": "sed -e '/REFERENCE/d' -e '/ERROR/d' [FILENAME]\n FILENAME"
},
{
"answer_id": 418948,
"author": "mirod",
"autho... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51826/"
] |
418,935 | <p>I was screwing around in psql and renamed the template0 and template1 before realizing their usage. Now, I am getting a "permission denied to copy database 'template1'" from inside psql and form command-line when I try to recreate template1.</p>
<p>To save time, is there anything else I need to know about template1 vis a vis OS read/write permissions in /data/base or granting on template1 etc.</p>
<p>TIA</p>
| [
{
"answer_id": 3235208,
"author": "Mildred",
"author_id": 174011,
"author_profile": "https://Stackoverflow.com/users/174011",
"pm_score": 3,
"selected": false,
"text": "template1 UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';\n /src/backend/commands/dbcommands.c... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
418,947 | <p>I am aware that the default .NET CheckBox control doesn't support the Value property. This seems weird to me because the input control does support value as part of the html spec.</p>
<p>So my question is whether or not anyone here knows of a custom user control out there for asp.net that acts similar to the standard ASP .NET CheckBox and CheckBoxList? </p>
| [
{
"answer_id": 423441,
"author": "Spencer Ruport",
"author_id": 52551,
"author_profile": "https://Stackoverflow.com/users/52551",
"pm_score": 2,
"selected": false,
"text": " <div>\n <input type=\"checkbox\" runat=\"server\" id=\"chkBox\" value=\"test\" />\n <asp:... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42707/"
] |
418,960 | <p>MS Access has limited capabilities to manage raw SQL queries: the editor is quite bad, no syntax highlighting, it reformats your raw SQL into a long string and you can't insert comments.</p>
<p>Debugging complex SQL queries is a pain as well: either you have to split it into many smaller queries that become difficult to manage when your schema changes or you end-up with a giant query that is a nightmare to debug and update.</p>
<p>How do you manage your complex SQL queries in MS Access and how do you debug them?</p>
<p><strong>Edit</strong><br>
At the moment, I'm mostly just using <a href="http://notepad-plus.sourceforge.net/uk/site.htm" rel="noreferrer">Notepad++</a> for some syntax colouring and <a href="http://www.wangz.net/" rel="noreferrer">SQL Pretty Printer</a> for reformatting sensibly the raw SQL from Access.<br>
Using an external repository is useful but keeping there's always the risk of getting the two versions out of sync and you still have to remove comments before trying the query in Access...</p>
| [
{
"answer_id": 419392,
"author": "eksortso",
"author_id": 446456,
"author_profile": "https://Stackoverflow.com/users/446456",
"pm_score": 2,
"selected": false,
"text": "FROM WHERE WHERE JOIN DISTINCT UNION UNION ALL SELECT * SELECT * SELECT *"
},
{
"answer_id": 419854,
"autho... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3811/"
] |
418,963 | <p>When developing a print stylesheet for a web page, what fonts are recommended for use?</p>
<p>I was using Times New Roman, but it looks kinda bland. </p>
<p>What have you used before? IIRC they say serif fonts are easier to read on paper.</p>
| [
{
"answer_id": 32195739,
"author": "Mohammad Arif",
"author_id": 181174,
"author_profile": "https://Stackoverflow.com/users/181174",
"pm_score": 0,
"selected": false,
"text": "@media print {\n body {\n font: Georgia, \"Times New Roman\", Times, serif;\n background: #fff;... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31671/"
] |
418,983 | <p>I'm writing a program as follows:</p>
<ul>
<li>Find all files with the correct extension in a given directory</li>
<li>Foreach, find all occurrences of a given string in those files</li>
<li>Print each line</li>
</ul>
<p>I'd like to write this in a functional way, as a series of generator functions (things that call <code>yield return</code> and only return one item at a time lazily-loaded), so my code would read like this:</p>
<pre><code>IEnumerable<string> allFiles = GetAllFiles();
IEnumerable<string> matchingFiles = GetMatches( "*.txt", allFiles );
IEnumerable<string> contents = GetFileContents( matchingFiles );
IEnumerable<string> matchingLines = GetMatchingLines( contents );
foreach( var lineText in matchingLines )
Console.WriteLine( "Found: " + lineText );
</code></pre>
<p>This is all fine, but what I'd also like to do is print some statistics at the end. Something like this:</p>
<pre><code>Found 233 matches in 150 matching files. Scanned 3,297 total files in 5.72s
</code></pre>
<p>The problem is, writing the code in a 'pure functional' style like above, each item is lazily loaded.<br>
You only know how many files match in total until the final foreach loop completes, and because only one item is ever <code>yield</code>ed at a time, the code doesn't have any place to keep track of how many things it's found previously. If you invoke LINQ's <code>matchingLines.Count()</code> method, it will re-enumerate the collection!</p>
<p>I can think of many ways to solve this problem, but all of them seem to be somewhat ugly. It strikes me as something that people are bound to have done before, and I'm sure there'll be a nice design pattern which shows a best practice way of doing this.</p>
<p>Any ideas? Cheers</p>
| [
{
"answer_id": 419018,
"author": "Steve Mitcham",
"author_id": 10156,
"author_profile": "https://Stackoverflow.com/users/10156",
"pm_score": 2,
"selected": false,
"text": "public class Matcher\n{\n private int totalFileCount;\n private int matchedCount;\n private DateTime start;\n pr... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234/"
] |
418,984 | <p>I am trying to automatically backup my SVN Repository. This is in a batch file I wrote:</p>
<pre><code>svnadmin hotcopy C:/myRepository G:/myRepositoryBackup --clean-logs
</code></pre>
<p>It works great the first time. However, each time after that, I get this error:</p>
<pre><code>svnadmin: 'G:/myRepositoryBackup' exists and is non-empty
</code></pre>
<p>How do I have it overwrite my old data, or copy incrementally?</p>
<p>I know I can just use <code>svnadmin dump</code> but I want the smaller <code>hotcopy</code> output.</p>
| [
{
"answer_id": 419005,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 3,
"selected": true,
"text": "svnadmin dump repo --incremental"
},
{
"answer_id": 419065,
"author": "Greg Hewgill",
"author_id... | 2009/01/07 | [
"https://Stackoverflow.com/questions/418984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,010 | <p>How can you raise an exception when you import a module that is less or greater than a given value for its __version__?</p>
<p>There are a lot of different ways you could do it, but I feel like there must be some really simple way that eludes me at the moment. In this case the version number is of the format x.x.x</p>
| [
{
"answer_id": 419035,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 1,
"selected": false,
"text": "assert tuple(map(int,module.__version__.split(\".\"))) >= (1,2), \"Module not version 1.2.x\"\n"
},
{
"answer_id": ... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41613/"
] |
419,019 | <p>Is there any way I can separate a <code>List<SomeObject></code> into several separate lists of <code>SomeObject</code>, using the item index as the delimiter of each split?</p>
<p>Let me exemplify:</p>
<p>I have a <code>List<SomeObject></code> and I need a <code>List<List<SomeObject>></code> or <code>List<SomeObject>[]</code>, so that each of these resulting lists will contain a group of 3 items of the original list (sequentially).</p>
<p>eg.:</p>
<ul>
<li><p>Original List: <code>[a, g, e, w, p, s, q, f, x, y, i, m, c]</code></p></li>
<li><p>Resulting lists: <code>[a, g, e], [w, p, s], [q, f, x], [y, i, m], [c]</code></p></li>
</ul>
<p>I'd also need the resulting lists size to be a parameter of this function.</p>
| [
{
"answer_id": 419058,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 6,
"selected": false,
"text": "Take Skip public static IEnumerable<IEnumerable<T>> GetEnumerableOfEnumerables<T>(\n IEnumerable<T> enumerable, int gro... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51500/"
] |
419,021 | <p>I am planning to replace repeatedly executed Statement objects with <code>PreparedStatement</code> objects to improve performance. I am using arguments like the MySQL function <code>now()</code>, and string variables. </p>
<p>Most of the <code>PreparedStatement</code> queries I have seen contained constant values (like <code>10</code>, and strings like <code>"New York"</code>) as arguments used for the <code>?</code> in the queries. How would I go about using functions like <code>now()</code>, and variables as arguments? Is it necessary to use the <code>?</code>s in the queries instead of actual values? I am quite confounded.</p>
| [
{
"answer_id": 419051,
"author": "Mark",
"author_id": 50262,
"author_profile": "https://Stackoverflow.com/users/50262",
"pm_score": 5,
"selected": true,
"text": "int temp = 75;\nPreparedStatement pstmt = con.prepareStatement(\n \"UPDATE test SET num = ?, due = now() \");\npstmt.setInt... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48725/"
] |
419,022 | <p>Someone here recently pointed out to me in a piece of code of mine I am using </p>
<pre><code>char* name = malloc(256*sizeof(char));
// more code
free(name);
</code></pre>
<p>I was under the impression that this way of setting up an array was identical to using </p>
<pre><code>char name[256];
</code></pre>
<p>and that both ways would require the use of free(). Am I wrong and if so could someone please explain in low level terms what the difference is?</p>
| [
{
"answer_id": 419041,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 3,
"selected": false,
"text": "void doit() {\n /* ... */\n /* SP += 10 * sizeof(int) */\n int a[10];\n /* ... (using a) */\n\n... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33911/"
] |
419,027 | <p>I find myself often needing to use Integer.TryParse to test if a value is an integer. However, when you use TryParse, you have to pass a reference variable to the function, so I find myself always needing to create a blank integer to pass in. Usually it looks something like:</p>
<pre><code>Dim tempInt as Integer
If Integer.TryParse(myInt, tempInt) Then
</code></pre>
<p>I find this to be quite cumbersome considering that all I want is a simple True / False response. Is there a better way to approach this? Why isn't there an overloaded function where I can just pass the value I want to test and get a true / false response?</p>
| [
{
"answer_id": 419052,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 2,
"selected": false,
"text": "Module IntegerHelpers\n\n Function IsInteger(ByVal p1 as String) as Boolean\n Dim unused as Integer = 0\n return I... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10420/"
] |
419,044 | <p>I have 3 check boxes in each row of 8 total rows. I want to have the third checkbox in each row to get checked only when the first two checkboxes are unchecked. I do not want to write a checkRow() method for each row.</p>
<p>What is the best way to go about it?</p>
<pre><code>private void checkRow()
{
for (int i = 0; i < 8; i++)
{
var arraylist = new[] { checkbox1, checkbox2, checkbox3 };
if (checkbox1.Checked || checkbox2.Checked)
{
arraylist[2].Checked = false;
}
else
arraylist[2].Checked = true;
}
}
private void checbox1_CheckedChanged(object sender, EventArgs e)
{
checkRow();
}
private void checbox2_CheckedChanged(object sender, EventArgs e)
{
checkRow();
}
private void checbox3_CheckedChanged(object sender, EventArgs e)
{
checkRow();
}
</code></pre>
<p>In response.</p>
<pre><code>private void checkRow()
{
var arraylist = new[] { checkEdit1, checkEdit2, checkEdit3 };
var arraylist1 = new[] { checkEdit4, checkEdit5, checkEdit6 };
var arraylist2 = new[] { checkEdit7, checkEdit8, checkEdit9 };
var array = new[] { arraylist, arraylist1, arraylist2 };
for (int i = 0; i < 8; i++)
{
//if checkedit1 or checkedit2 is checked the checkedit3 should not be checked
if (array[i]....Checked || array[i]....Checked)
{
arraylist[i]...Checked = false;
}
else
arraylist[i]...Checked = true;
}
}
</code></pre>
<p>I was trying to do something like this so that I dont have to write the checkRow() for each row</p>
| [
{
"answer_id": 419049,
"author": "Ed S.",
"author_id": 1053,
"author_profile": "https://Stackoverflow.com/users/1053",
"pm_score": 3,
"selected": false,
"text": "chkbox.CheckedChanged += new EventHandler(chkbox_CheckedChanged);\nchkbox2.CheckedChanged += new EventHandler(chkbox_CheckedCh... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,071 | <p>I've just discovered, to my embarrassment, that feeding negative exponents to <code>mpz_pow_ui</code> doesn't work very well. ("The manual does say unsigned long, you know.") For the other <code>mpz_pow</code> functions, the manual uses concepts I don't understand. For example "<em>base</em>^<em>exp</em> mod <em>mod</em>" in the following:</p>
<pre><code>void mpz_powm (mpz_t rop, mpz_t base, mpz_t exp, mpz_t mod)
void mpz_powm_ui (mpz_t rop, mpz_t base, unsigned long int exp, mpz_t mod)
Set _rop_ to _base_^_exp_ mod _mod_.
Negative exp is supported if an inverse base-1 mod mod exists (see mpz_invert in Section 5.9 [Number Theoretic Functions], page 35). If an inverse doesn’t exist then a divide by zero is raised.
</code></pre>
<p>In the following code, what do I have to change to make it able to handle negative exponents?</p>
<pre><code>#define Z(x) mpz_t x; mpz_init( x );
BSTR __stdcall IBIGPOWER(BSTR p1, long p2 ) {
USES_CONVERSION;
Z(n1);
Z(res);
LPSTR sNum1 = W2A( p1 );
mpz_set_str( n1, sNum1, 10 );
mpz_pow_ui( res, n1, p2 );
char * buff = (char *) _alloca( mpz_sizeinbase( res, 10 ) + 2 );
mpz_get_str(buff, 10, res);
BSTR bResult = _com_util::ConvertStringToBSTR( buff );
return bResult;
}
</code></pre>
| [
{
"answer_id": 419083,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 3,
"selected": false,
"text": "2-n = 1/2n mpf_t mpz_t 2-18"
},
{
"answer_id": 419086,
"author": "Paige Ruten",
"author_id": 813,
"a... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426/"
] |
419,082 | <p>The majority of content on my company's website starts life as a Word document (Windows-1252 encoded) and is eventually copied-and-pasted into our UTF-8-encoded content management system. The conversion usually chokes on a few characters (special break characters, smart quotes, scientific notations) which have to be cleaned up manually, but of course a few always slip through.</p>
<p>What do you think the best way would be to detect these?</p>
| [
{
"answer_id": 493852,
"author": "mercator",
"author_id": 23263,
"author_profile": "https://Stackoverflow.com/users/23263",
"pm_score": 3,
"selected": true,
"text": "0x80 0x9F"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7264/"
] |
419,094 | <p>I have a number of files which I combine and pack to produce a single, minified JS file. The problem is that when I minify the file (using <a href="http://dean.edwards.name/packer/" rel="nofollow noreferrer">packer</a>), IE6 gives one of its characteristic helpful error messages.</p>
<pre><code>Line: 12 // of course, line 12 is an empty line
Char: 1
Error: Expected ')'
Code: 0
</code></pre>
<p>The thing is: it works fine in IE7, Firefox and Chrome the problem only comes up for IE6.</p>
<p>Unpacked, I have almost 200kb of scripts spread through 8 files. How on earth do I fix this?</p>
| [
{
"answer_id": 419239,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "java -jar /path/to/yuicompressor-2.4.jar --charset utf8 -o ~/path/to/scriptname.min.js ~/path/to/scriptname.js \n"
},
{
... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] |
419,095 | <p>Have a gridview control and i want to display checkboxes for each row. The checkboxes should only appear if Session["DisplayBox"] == true.</p>
<pre><code><asp:GridView ID="gridView" runat="server" AutoGenerateColumns="False" EnableSortingAndPagingCallbacks="True"
AllowPaging="True" DataSourceID="JObjectDataSource" PageSize="5" OnRowCommand="gridView_RowCommand"
DataKeyNames="ID" Width="100%">
<Columns>
<asp:TemplateField HeaderText="Review">
<ItemTemplate>
<asp:CheckBox ID="chkRejectFile" AutoPostBack="true" runat="server" OnCheckedChanged="chkRejectFile_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</code></pre>
<p>I removed some of the columns and kept the one that i am asking the question about. How would I place a conditional code in the aspx page and check for the session value?</p>
<p>Also, if I page, do i have to explicitly handle keeping track of which row was checked and which wasn't?</p>
| [
{
"answer_id": 419162,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 0,
"selected": false,
"text": " Visible='<%# Convert.ToBoolean(HttpContext.Current.Session[\"DisplayBox\"]) %>'\n true false"
},
{
"answer_id"... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38230/"
] |
419,117 | <p>Refer to this post compile a Xcode project in command line
<a href="https://stackoverflow.com/questions/377992/building-xcode-projects-from-the-command-line">Building Qt Xcode Projects From the Command Line</a>
the QMAKESPEC variable was unable to set to macx-g++. </p>
<p>I was doing like this in terminal <code>QMAKESPEC=macx-g++</code> but this still not able to generate a make file of my Xcode project for me.</p>
<p>What is the right way to setup the QMAKESPEC environment variable?</p>
| [
{
"answer_id": 419225,
"author": "Lily Ballard",
"author_id": 582,
"author_profile": "https://Stackoverflow.com/users/582",
"pm_score": 3,
"selected": true,
"text": "export QMAKESPEC=macx-g++\n"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,119 | <p>Is it possible to launch any arbitrary iPhone application from within another app?, <strong>For example</strong> <em>in my application if I want the user to push a button and launch right into the Phone app (close the current app, open the Phone app)</em>.</p>
<p>would this be possible? I know this can be done for making phone calls with the tel URL link, but I want to instead just have the Phone app launch without dialing any specific number. </p>
| [
{
"answer_id": 419296,
"author": "Gordon Wilson",
"author_id": 23071,
"author_profile": "https://Stackoverflow.com/users/23071",
"pm_score": 6,
"selected": false,
"text": "tel:"
},
{
"answer_id": 24033837,
"author": "lee",
"author_id": 4327164,
"author_profile": "http... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,122 | <p>I am the lead developer on a commercial Windows app (c#). A new requirement is to track customers who abuse the license.</p>
<p>For example: Let's say a customer purchases a 10 user license agreement, i.e. 10 simultaneous users at any given time.</p>
<p>I need to be able to report, looking back at history, all the times that customer had more than 10 users logged in at the same time.</p>
<p>I already have a User table with columns: userid (primary key), pw, lastLogin, lastLogout. </p>
<p>I was thinking about creating a a new 'logging' table in which a new row is added each time a user logs out...columns might include:</p>
<p>LogId, UserId, LoginDateTime, LogoutDateTime</p>
<p>...and then I would have a history of every time a user logs in/out of the app...</p>
<p>but I'm not sure if this table design will lend to efficient calculations for reporting...whether I use SQL or c# to perform the calculations does not matter to me, as long as it is reasonably fast...</p>
<p>Hoping someone might have a good idea about how to better design this table so that I can quickly calculate any/all points in time when the customer exceeded the license limit.</p>
<p>Note: I do not want to block the 11t, 12th etc. user from using the app...the requirement is to display a warning message to the user but to allow him to continue working...</p>
| [
{
"answer_id": 419143,
"author": "Bevan",
"author_id": 30280,
"author_profile": "https://Stackoverflow.com/users/30280",
"pm_score": -1,
"selected": false,
"text": "BettyR, 10:00am\nBettyR, 10:30am\nBettyR, 11:00am\nBettyR, 11:30am\n select ...\nfrom UsageBlocks\ngroup by BlockDateTime\n... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52212/"
] |
419,127 | <p>Out of the box, System.Web.Security.Membership implements a couple of search methods:</p>
<ul>
<li>FindUsersByEmail</li>
<li>FindUsersByName</li>
</ul>
<p>I'm using the <a href="http://www.codeplex.com/AspNetWSAT" rel="nofollow noreferrer">WSAT project from CodePlex</a> to administer my Membership database. The tool implements extra profile properties in a ProfileCommon class. </p>
<p>Let's say I have a property called <strong>Firm</strong> in the user's profile. </p>
<p>I need to implement a custom search method to search on the Firm property, and I would like to do this all in code. Don't wanna write a stored procedure (since all the profile properties are stored in 1 database column in the WSAT tool).</p>
<p>Something like this obviously isn't the right way to do it, but here it is to just demonstrate accessing the user's profile properties:</p>
<pre><code> private MembershipUserCollection SearchByFirm(string firmName, MembershipUserCollection allRegisteredUsers)
{
MembershipUserCollection searchResults = new MembershipUserCollection();
foreach (MembershipUser user in allRegisteredUsers)
{
ProfileCommon profile = Profile.GetProfile(user.UserName);
if (profile.Firm.ToLowerInvariant().Contains(firmName.ToLowerInvariant()))
{
searchResults.Add(user);
}
}
return searchResults;
}
</code></pre>
<p>Can I turn this into some LINQ goodness?</p>
| [
{
"answer_id": 422431,
"author": "George Durzi",
"author_id": 36057,
"author_profile": "https://Stackoverflow.com/users/36057",
"pm_score": 3,
"selected": true,
"text": " List<MembershipUser> searchResults = allUsers.Where(user => \n Profile.GetProfile(user.UserName).Firm.T... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419127",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36057/"
] |
419,133 | <p>Is there a better way to implement code freeze in SVN than asking all developers to not check in any new code?<br>
We have CruiseControl running, which automatically deploys the latest build to environment. So if new code comes in, the build that was made available earlier changes to the latest one. I want that the build that is deployed is the one from a particular branch/tag, so that any new code check-ins dont affect the deployed build. Only when i tag/branch next time, the new code should be again deployed.
How can we achieve this?</p>
| [
{
"answer_id": 419360,
"author": "notbenh",
"author_id": 51914,
"author_profile": "https://Stackoverflow.com/users/51914",
"pm_score": 1,
"selected": false,
"text": "\n#!/bin/sh\nexit 1\n"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356145/"
] |
419,144 | <p>In the following jQuery JavaScript code, what value does the parameter "e" take on within the function? I'm having difficulty understanding this because this function cannot be passed an argument elsewhere in the code so how would having a parameter work? And how would I use parameters in such functions that are not named and not called anywhere else in the code?</p>
<pre><code> $(document).ready( function() {
$('div').each(function() {
$(this).click(function(e){
//some code
});
});
});
</code></pre>
| [
{
"answer_id": 419148,
"author": "Jeff M",
"author_id": 49758,
"author_profile": "https://Stackoverflow.com/users/49758",
"pm_score": 4,
"selected": true,
"text": "click e"
},
{
"answer_id": 419150,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile"... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140378/"
] |
419,145 | <p>What is the "critical section" of a thread (in Python)?</p>
<blockquote>
<p>A thread enters the critical section
by calling the acquire() method, which
can either be blocking or
non-blocking. A thread exits the
critical section, by calling the
release() method.</p>
</blockquote>
<p>- <a href="http://linuxgazette.net/107/pai.html" rel="noreferrer">Understanding Threading in Python, Linux Gazette</a></p>
<p>Also, what is the purpose of a lock?</p>
| [
{
"answer_id": 419213,
"author": "cdleary",
"author_id": 3594,
"author_profile": "https://Stackoverflow.com/users/3594",
"pm_score": 5,
"selected": false,
"text": "import threading\naccount_balance = 0 # The \"resource\" that zenazn mentions.\naccount_balance_lock = threading.Lock()\n\nd... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51518/"
] |
419,157 | <p>I have a Swing application which uses JFreeChart to display one of a series of queries. Some of these queries have a composite TimeSeries key. Each component of this key can contain a few values, but when rendered makes a very noisy graph. I would like a simple way for the users to hide/show some of the TimeSeries in the displayed Chart component.</p>
| [
{
"answer_id": 421617,
"author": "wwwclaes",
"author_id": 50485,
"author_profile": "https://Stackoverflow.com/users/50485",
"pm_score": 0,
"selected": false,
"text": "AnalysisXYItemRenderer transXDiff"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12604/"
] |
419,163 | <p>What does this do, and why should one include the <code>if</code> statement?</p>
<pre class="lang-py prettyprint-override"><code>if __name__ == "__main__":
print("Hello, World!")
</code></pre>
<hr />
<p><sub>If you are trying to close a question where someone should be using this idiom and isn't, consider closing as a duplicate of <a href="https://stackoverflow.com/questions/6523791">Why is Python running my module when I import it, and how do I stop it?</a> instead. For questions where someone simply hasn't called any functions, or incorrectly expects a function named <code>main</code> to be used as an entry point automatically, use <a href="https://stackoverflow.com/questions/17257631">Why doesn't the main() function run when I start a Python script? Where does the script start running?</a>.</sub></p>
| [
{
"answer_id": 419174,
"author": "Harley Holcombe",
"author_id": 1057,
"author_profile": "https://Stackoverflow.com/users/1057",
"pm_score": 7,
"selected": false,
"text": "if __name__ == \"__main__\" python myscript.py"
},
{
"answer_id": 419185,
"author": "Mr Fooz",
"auth... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51518/"
] |
419,175 | <p>Im creating a stored procedure/function in MS SQL which should return the missing series.</p>
<p>Example:</p>
<p>the table "orders" contain field name "ordNo".</p>
<p>ordNo</p>
<p>000001</p>
<p>000003</p>
<p>000005</p>
<p>the functions should return these values:</p>
<p>000002</p>
<p>000004</p>
<p>any idea? </p>
<p>thank you very much.</p>
| [
{
"answer_id": 419191,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 1,
"selected": false,
"text": "SELECT ordNo - 1\nFROM Orders o\nWHERE NOT EXISTS (\n SELECT *\n FROM Orders n\n WHERE n.ordNo = o.OrdNo - 1 ... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,184 | <p>On Android phones SMS messages registered to applications also get sent to the device's inbox. However to prevent clutter, it'd be nice to be able to remove application specific SMS messages from the inbox to reduce the potential overflow of those messages.</p>
<p>Questions on other Google groups on getting a definitive answer on a programmatic way to delete SMS messages from the Android inbox don't seem to be pressing.</p>
<p>So the scenario:</p>
<ul>
<li>Android App startup.</li>
<li>register SMS message types X,Y and Z</li>
<li>messages P,Q,X,Y,Z stream in over the course of time, all deposited in inbox</li>
<li>Android application detects receipt of X,Y,Z (presumably as part of the program interrupt event)</li>
<li>process X,Y,Z</li>
<li><em>Desirement!!!</em> X,Y,Z are deleted from the Android inbox</li>
</ul>
<p>Has it been done? Can it be done?</p>
| [
{
"answer_id": 439486,
"author": "dmyung",
"author_id": 52302,
"author_profile": "https://Stackoverflow.com/users/52302",
"pm_score": 5,
"selected": false,
"text": "Uri uriSms = Uri.parse(\"content://sms/inbox\");\nCursor c = getContentResolver().query(uriSms, null,null,null,null); \nint... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52302/"
] |
419,197 | <p>If you have a Google App Engine project you can authenticate based on either a) anyone with a google account or b) a particular google app domain. Since you can connect these two entities I would assume there is some way to query the list of users that can be authenticated. The use case is outputting a roster of all members in an organization to a web page running on Google App Engine. Any thoughts?</p>
| [
{
"answer_id": 455902,
"author": "dar",
"author_id": 56488,
"author_profile": "https://Stackoverflow.com/users/56488",
"pm_score": 1,
"selected": false,
"text": "GET https://apps-apis.google.com/a/feeds/domain/user/2.0"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49445/"
] |
419,222 | <p>I updated my question "<a href="https://stackoverflow.com/questions/406212/sizing-a-uilabel-in-the-iphone-sdk-to-fit">Sizing a UILabel (in the iPhone SDK) to fit?</a>" with a description of my problem with a suggested solution, but didn't get an answer. Perhaps I'll have better results by asking a new question...</p>
<p>I set a breakpoint after the following code:</p>
<pre><code>NSString *theText = @"When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature's God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.";
CGSize theSize = [theText sizeWithFont:[UIFont systemFontOfSize:17.0f] forWidth:260.0 lineBreakMode:UILineBreakModeWordWrap];
</code></pre>
<p><code>theSize.height</code> is 21 and <code>theSize.width</code> is 231. What am I doing wrong? That height can't be in pixels nor in number of lines.</p>
<p>Note that <code>[UIFont systemFontOfSize:17.0f]</code> is meant to specify the default font.</p>
<p><strong>Update</strong>: I changed the code to:</p>
<pre><code>CGSize constraintSize;
constraintSize.width = 260.0f;
constraintSize.height = MAXFLOAT;
NSString *theText = @"When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature's God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.";
CGSize theSize = [theText sizeWithFont:[UIFont systemFontOfSize:17.0f] constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap];
</code></pre>
<p><code>theSize.height</code> is 273. That seems more like it.</p>
| [
{
"answer_id": 419242,
"author": "Lily Ballard",
"author_id": 582,
"author_profile": "https://Stackoverflow.com/users/582",
"pm_score": 6,
"selected": true,
"text": "sizeWithFont:constrainedToSize: MAXFLOAT"
},
{
"answer_id": 9132270,
"author": "Matt Weaver",
"author_id":... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4766/"
] |
419,235 | <p>I'm half-tempted to write my own, but I don't really have enough time right now. I've seen the Wikipedia list of <a href="http://en.wikipedia.org/wiki/Web_crawler#Open-source_crawlers" rel="nofollow noreferrer">open source crawlers</a> but I'd prefer something written in Python. I realize that I could probably just use one of the tools on the Wikipedia page and wrap it in Python. I might end up doing that - if anyone has any advice about any of those tools, I'm open to hearing about them. I've used Heritrix via its web interface and I found it to be quite cumbersome. I definitely won't be using a browser API for my upcoming project.</p>
<p>Thanks in advance. Also, this is my first SO question!</p>
| [
{
"answer_id": 421645,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 5,
"selected": false,
"text": "class Torrent(ScrapedItem):\n pass\n\nclass MininovaSpider(CrawlSpider):\n domain_name = 'mininova.org'\n start_ur... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50522/"
] |
419,240 | <p>I am using PHP and JavaScript. My JavaScript code contains a function, get_data():</p>
<pre><code>function get_Data(){
var name;
var job;
.....
return buffer;
}
</code></pre>
<p>Now I have PHP code with the following.</p>
<pre><code><?php
$i=0;
$buffer_data;
/* Here I need to get the value from JavaScript get_data() of buffer;
and assign to variable $buffer_data. */
?>
</code></pre>
<p>How do I assign the JavaScript function data into the PHP variable?</p>
| [
{
"answer_id": 419250,
"author": "Demur Rumed",
"author_id": 40172,
"author_profile": "https://Stackoverflow.com/users/40172",
"pm_score": 1,
"selected": false,
"text": "$_POST"
},
{
"answer_id": 419326,
"author": "Uzbekjon",
"author_id": 52317,
"author_profile": "htt... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] |
419,244 | <p>Using Perl, how can I combine or merge the sample PDF files into a single PDF file?</p>
| [
{
"answer_id": 419249,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "pdf2ps ps2pdf"
},
{
"answer_id": 419251,
"author": "Chris Dolan",
"author_id": 14783,
"author_pr... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45284/"
] |
419,260 | <p>I would like to write a program that will find bus stop times and update my personal webpage accordingly.</p>
<p>If I were to do this manually I would </p>
<ol>
<li>Visit www.calgarytransit.com</li>
<li>Enter a stop number. ie) 9510</li>
<li>Click the button "next bus"</li>
</ol>
<p>The results may look like the following:</p>
<blockquote>
<p>10:16p Route 154<br>
10:46p Route 154<br>
11:32p Route 154</p>
</blockquote>
<p>Once I've grabbed the time and routes then I will update my webpage accordingly. </p>
<p>I have no idea where to start. I know diddly squat about web programming but can write some C and Python. What are some topics/libraries I could look into?</p>
| [
{
"answer_id": 419298,
"author": "J.J.",
"author_id": 21204,
"author_profile": "https://Stackoverflow.com/users/21204",
"pm_score": 2,
"selected": false,
"text": "use strict;\nuse LWP;\n\nmy $browser = LWP::UserAgent->new;\n\nmy $responce = $browser->get(\"http://google.com\");\nprint $r... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45620/"
] |
419,279 | <p>I'm pretty new to Javascript and I'm sure this is an easy fix, but I can't figure it out. </p>
<p>I'm using a slightly modified version of the code from <a href="http://marakana.com/blog/examples/php-implementing-secure-login-with-php-javascript-and-sessions-without-ssl.html" rel="nofollow noreferrer">this page</a> and I want to make the form work by entering the information and pressing enter rather than having to click the button. </p>
<p>FYI I've read <a href="https://stackoverflow.com/questions/239082/javascript-login-form-doesnt-submit-when-user-hits-enter">this thread</a> and can't work out my own answer from there. I tried changing the type to "submit" from "button" but then the login didn't work. I've also tried changing "onlick" to "onsubmit" and had the same problem. </p>
| [
{
"answer_id": 419287,
"author": "too much php",
"author_id": 28835,
"author_profile": "https://Stackoverflow.com/users/28835",
"pm_score": 3,
"selected": true,
"text": "onclick=\"loginFunction(); return false;\" return false"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30098/"
] |
419,291 | <p>Why did DOS/Windows and Mac decide to use \r\n and \r for line ending instead of \n? Was it just a result of trying to be "different" from Unix?</p>
<p>And now that Mac OS X is Unix (-like), did Apple switch to \n from \r?</p>
| [
{
"answer_id": 2171025,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": "std::endl \\n \\n \\n"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1897/"
] |
419,295 | <p>I'm having a problem with my work that hopefully reduces to the following: I have two <code>List<int></code>s, and I want to see if any of the <code>int</code>s in <code>ListA</code> are equal to any <code>int</code> in <code>ListB</code>. (They can be arrays if that makes life easier, but I think <code>List<></code> has some built-in magic that might help.) And I'm sure this is a LINQ-friendly problem, but I'm working in 2.0 here.</p>
<p>My solution so far has been to <code>foreach</code> through ListA, and then <code>foreach</code> through ListB, </p>
<pre><code>foreach (int a in ListA)
{
foreach (int b in ListB)
{
if (a == b)
{
return true;
}
}
}
</code></pre>
<p>which was actually pretty slick when they were each three items long, but now they're 200 long and they frequently don't match, so we get the worst-case of N^2 comparisons. Even 40,000 comparisons go by pretty fast, but I think I might be missing something, since N^2 seems pretty naive for this particular problem.</p>
<p>Thanks!</p>
| [
{
"answer_id": 419315,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 3,
"selected": false,
"text": "//untested code ahead\nHashSet<int> hashSet = new HashSet<int>(ListA);\nforeach (int i in ListB)\n{\n if (hashSet.Contai... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3248/"
] |
419,314 | <p>When i use this cmd line :
jar cmf arshad.mf ars.jar *.class
i get this error :</p>
<pre><code>invalid header field name:Manifest-version
</code></pre>
<p>This is my manifest file :</p>
<pre><code>Manifest-Version: 1.0
Main-Class:t
</code></pre>
<p>i made the manifest file with notepad in UTF-8 encoding - is there any problem with the manifest ?</p>
| [
{
"answer_id": 419317,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 5,
"selected": true,
"text": "Manifest-Version: 1.0\nMain-Class: t\n"
},
{
"answer_id": 13973478,
"author": "Angel_DongJie",
"autho... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50940/"
] |
419,322 | <p>I'm new to version control, so I apologize if there is a well-known solution to this. For this problem in particular, I'm using git, but I'm curious about how to deal with this for all version control systems.</p>
<p>I'm developing a web application on a development server. I have defined the absolute path name to the web application (not the document root) in two places. On the production server, this path is different. I'm confused about how to deal with this.</p>
<p>I could either:</p>
<ol>
<li>Reconfigure the development server to share the same path as the production</li>
<li>Edit the two occurrences each time production is updated.</li>
</ol>
<p>I don't like #1 because I'd rather keep the application flexible for any future changes. I don't like #2 because if I start developing on a second development server with a third path, I would have to change this for every commit and update.</p>
<p>What is the best way to handle this? I thought of:</p>
<ol>
<li><p>Using custom keywords and variable expansion (such as setting the property $PATH$ in the version control properties and having it expanded in all the files). Git doesn't support this because it would be a huge performance hit.</p></li>
<li><p>Using post-update and pre-commit hooks. Possibly the likely solution for git, but every time I looked at the status, it would report the two files as being changed. Not really clean.</p></li>
<li><p>Pulling the path from a config file outside of version control. Then I would have to have the config file in the same location on all servers. Might as well just have the same path to begin with.</p></li>
</ol>
<p>Is there an easy way to deal with this? Am I over thinking it?</p>
| [
{
"answer_id": 419408,
"author": "timdisney",
"author_id": 14481,
"author_profile": "https://Stackoverflow.com/users/14481",
"pm_score": 0,
"selected": false,
"text": "git pull"
},
{
"answer_id": 419418,
"author": "Rob Williams",
"author_id": 26682,
"author_profile": ... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52321/"
] |
419,327 | <p>To interact with an external data feed I need to pass a rolling security key which has been MD5 hashed (every day we need to generate a new MD5 hashed key).</p>
<p>I'm trading up whether or not to do it every time we call the external feed or not. I need to has a string of about 10 characters for the feed.</p>
<p>It's for an ASP.NET (C#/ .NET 3.5) site and the feed is used on pretty much every page. Would I best off generating the hash once a day and then storing it in the application cache, and taking the memory hit, or generating it on each request?</p>
| [
{
"answer_id": 419421,
"author": "Filip Ekberg",
"author_id": 39106,
"author_profile": "https://Stackoverflow.com/users/39106",
"pm_score": 1,
"selected": false,
"text": " public string GetMD5Hash(string input)\n {\n System.Security.Cryptography.MD5CryptoServiceProvider x = n... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11388/"
] |
419,328 | <p>Having setup C++ app originally using MS specific keyboard journaling hook (WH_JOURNALRECORD) we find that it does not work on Vista unless run as administrator with uiAccess enabled. <a href="http://social.msdn.microsoft.com/forums/en-US/windowssecurity/thread/3dc0a67e-c2f0-4e70-8990-3a6947f1155a/" rel="nofollow noreferrer">MSDN Question - Journaling hooks on Vista?</a></p>
<p>We want to record a key sequence from the user in a friendly way that will be repeated at some later date. The user presses a record button, a dialog is displayed with a stop button and the recorded keys.</p>
<p>One advantage of using the journaling hook was that you only got keystrokes which did something. Holding down shift didn't report 100 shift keys, but did report usage when you hit a letter.
Another advantage was that you could set the focus to an area outside of the application, say another applications window, and record the action as the user interacted.</p>
<p>Asides from making the keyboard capture part of the existing app a separate executable which runs as administrator with uiAccess, I'm seeking other ideas on how to record keystrokes that work on windows for 2K, 2K3, 2K8, XP, Vista.</p>
<p>Edit: I know there is a security concern with just recording anything, obviously if you could do such a thing without the users notice you have your typical keystroke logger for hacking purposes. Soooooo.....</p>
<p>Is there a way to make journaling work, for this user, and their apps, running at the same level (or lower) and capture keystrokes? having it popup the vista security are you sure dialog would be allright, but the process cannot be marked with uiAccess (otherwise it won't interact properly with the rest of the system) and it will in 98% of cases be run by users without rights to elevate to administrator.</p>
| [
{
"answer_id": 506243,
"author": "Greg Domjan",
"author_id": 37558,
"author_profile": "https://Stackoverflow.com/users/37558",
"pm_score": 1,
"selected": true,
"text": "const HMODULE hDLL = ::GetModuleHandle(DLL_NAME);\n::SetWindowsHookEx(WH_KEYBOARD_LL, myKeyboardProcCallback, hDLL, 0);... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37558/"
] |
419,334 | <p>Windows has the "system tray" that houses the clock and alway-running services like MSN, Steam, etc.</p>
<p>I'd like to develop a wxPython tray application but I'm wondering how well this will port to other platforms. What is the tray equivalent on each platform, and how much manual work would be required to support Windows, OSX and Linux (which shells in particular would be friendliest).</p>
| [
{
"answer_id": 419409,
"author": "kender",
"author_id": 4172,
"author_profile": "https://Stackoverflow.com/users/4172",
"pm_score": 1,
"selected": false,
"text": "wx"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46914/"
] |
419,336 | <p>I am trying to have around 6290 'AND' conditions in this query. I get the same for around 11945 'OR' conditions.</p>
<p>Exception details:
The server encountered a stack overflow during compile time. at System.Data.
lClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException excepti
, Boolean breakConnection)</p>
| [
{
"answer_id": 419496,
"author": "gbn",
"author_id": 27535,
"author_profile": "https://Stackoverflow.com/users/27535",
"pm_score": 2,
"selected": false,
"text": "SELECT * FROM foo\nWHERE ([fooKey] = 1 AND Year = 1995)\nOR ([fooKey] = 1 AND Year = 1996)\nOR ([fooKey] = 1 AND Year = 1997)\... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26788/"
] |
419,339 | <p>Just wondering if we have access to the PocketOutlook DaysOfWeek control/editor, or if anybody else has made their own for free usage.</p>
<p>I'm looking for something exactly like what's in the Outlook Calendar appointment reoccurring pattern editor.</p>
<ol>
<li>Open Calendar</li>
<li>Create a new Appointment</li>
<li>Click on "Occurs", then "< Edit Pattern... >"</li>
<li>Click "Next"</li>
<li>The control that has SMTWTFS, where you can tap on the square for the day to enable/disable, or use the hardware keys to navigate.</li>
</ol>
<p>--UPDATE------------------------</p>
<p>Ah well, I just rolled my own Control.</p>
<p>Not too difficult, I just used 7 LinkLabels w/ click handlers. Actually the hardest part was getting a border around it (using manual positioning to place the white linklabel just inside a black panel). It's ridiculous that somehow the .NET CF designers thought that we wouldn't need BORDERS.</p>
<p>I exposed the DaysOfWeek value with a Value property, and a ValueChanged event. Presto, a DaysOfWeek control!</p>
| [
{
"answer_id": 419496,
"author": "gbn",
"author_id": 27535,
"author_profile": "https://Stackoverflow.com/users/27535",
"pm_score": 2,
"selected": false,
"text": "SELECT * FROM foo\nWHERE ([fooKey] = 1 AND Year = 1995)\nOR ([fooKey] = 1 AND Year = 1996)\nOR ([fooKey] = 1 AND Year = 1997)\... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14392/"
] |
419,342 | <p>I need help in designing my PHP classes where I need to extend from multiple classes.</p>
<p>I have a general class, Pagination.php that does all sort of pagination and sorting. All other classes will use this for pagination.</p>
<p>To make my life easier, I made a class generator that generates a class from MySQL table. All the properties, getters, setters and common methods are created automatically, which really saves time and money.</p>
<p>As an example, class Staff_Base in Staff_Base.php is generated automatically from SQL table t_staff. </p>
<p>Since class Staff_Base is automatically generated from SQL table, any 'custom' methods / properties are located in another class that extends Staff_Base.php. (So that whenever a new field is added, I can simply regenerate Staff_Base class and overwrite in Staff_Base.php).</p>
<p>So I have class Staff.php that extends Staff_Base.php.</p>
<p>The problem is, Staff.php also needs to extend another class, Pagination.php.
(The current workaround is to put methods in Pagination.php into every class. This is really troublesome whenever I make changes to the pagination/sorting methods.)</p>
<p>How do I do this?
What is the best design pattern to achieve this?</p>
<p>I know common suggestions to restructure my classes, but I really think hard of other workaround/solution. Also, I may also need to extend other classes than Pagination.php.</p>
<p>Thanks!</p>
| [
{
"answer_id": 419356,
"author": "Ross",
"author_id": 29173,
"author_profile": "https://Stackoverflow.com/users/29173",
"pm_score": 2,
"selected": true,
"text": "Staff_Base.php Staff Staff_Base Staff_Base Pagination"
},
{
"answer_id": 4620611,
"author": "kander",
"author_... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,344 | <p>Alright I've spent a good three days trying this, here's the scenario:</p>
<p>I want to download a '.csv' file from Google and then do stuff with the data from the file. It's for a Win32 Console Application. I have the latter down, I just cannot for the life of me figure out how to download the file. I've heard of libcurl, curlpp, ptypes, rolling my own, just using the .NET api, and been told a bunch of times:</p>
<blockquote>
<p>...it's just a GET request</p>
</blockquote>
<p>Well that's all well and good, but I must be missing something because it seems like everyone was just born knowing how to do this. I have been combing through books looking to figure this out and even had a huge problem with LNKerrors after traveling down the road with "The Art of C++" for a while. </p>
<p>All that being said, I have learned a LOT from this, but at this point I just want to know how to do it. The API for C++ is seriously lacking, no example code to be found. Tutorials online are almost non-existent. And no book out there seems to think this is important. </p>
<p>Can someone please throw me a life raft? I'm a man on the edge here.</p>
<p><strong>edit</strong></p>
<p>By "from Google" I mean that I want to download a .csv file that they host. An example can be <a href="http://finance.google.com/finance/historical?q=NASDAQ:AAPL" rel="nofollow noreferrer">found here.</a></p>
| [
{
"answer_id": 419377,
"author": "J.J.",
"author_id": 21204,
"author_profile": "https://Stackoverflow.com/users/21204",
"pm_score": 3,
"selected": true,
"text": "/*\n * This is a very simple example of how to use libcurl from within \n * a C++ program. The basic idea is that you want to... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50391/"
] |
419,372 | <p>I have a need to create a gross requirements report that takes how much supply and demand of a item in inventory from a start date onwards and 'buckets' it into different weeks of the year so that material planners know when they will need a item and if they have enough stock in inventory at that time.</p>
<p>As an example, today’s date (report date) is 8/27/08. The first step is to find the date for the Monday of the week the report date falls in. In this case, Monday would be 8/25/08. This becomes the first day of the first bucket. All transactions that fall before that are assigned to week #0 and will be summarized as the beginning balance for the report. The remaining buckets are calculated from that point. For the eighth bucket, there is no ending date so any transactions after that 8th bucket start date are considered week #8.</p>
<p>WEEK# START DATE END DATE<br>
0.......None..........8/24/08<br>
1.......8/25/08.......8/31/08<br>
2.......9/1/08.........9/7/08<br>
3.......9/8/08.........9/14/08<br>
4.......9/15/08.......9/21/08<br>
5.......9/22/08.......9/28/08<br>
6.......9/29/08.......10/5/08<br>
7.......10/06/08.....10/12/08<br>
8.......10/13/08......None<br></p>
<p>How do I get the week #, start date, end date for a given date?</p>
| [
{
"answer_id": 419373,
"author": "Jaydel Gluckie",
"author_id": 2019606,
"author_profile": "https://Stackoverflow.com/users/2019606",
"pm_score": 0,
"selected": false,
"text": "SET DATEFIRST 1\n\nDECLARE \n @ReportDate DATETIME, \n\n @Weekday INTEGER, \n @NumDaysToMonday INTEGER... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2019606/"
] |
419,375 | <p>What's difference between inner join and outer join (left join,right join), and which has the best performance of them?</p>
<p>Thanks!</p>
| [
{
"answer_id": 419481,
"author": "Michael Buen",
"author_id": 11432,
"author_profile": "https://Stackoverflow.com/users/11432",
"pm_score": 2,
"selected": false,
"text": "LEFT JOIN B B RIGHT JOIN A RIGHT JOIN RIGHT JOIN LEFT JOIN A 1 2 3\nB 2 3 4 3\n\nSELECT A.I FROM INNER JOIN B ON B.I ... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51578/"
] |
419,379 | <p>I have a function. Inside that I'm maintainfing a dictionary of values.
I want that dictionary to be maintained between different function calls</p>
<p>Suppose the dic is :</p>
<pre><code>a = {'a':1,'b':2,'c':3}
</code></pre>
<p>At first call,say,I changed a[a] to 100
Dict becomes <code>a = {'a':100,'b':2,'c':3}</code></p>
<p>At another call,i changed a[b] to 200
I want that dic to be <code>a = {'a':100,'b':200,'c':3}</code></p>
<p>But in my code a[a] doesn't remain 100.It changes to initial value 1.</p>
<p>I need an answer ASAP....I m already late...Please help me friends...</p>
| [
{
"answer_id": 419389,
"author": "too much php",
"author_id": 28835,
"author_profile": "https://Stackoverflow.com/users/28835",
"pm_score": 4,
"selected": false,
"text": "def foo(k, v):\n foo.a[k] = v\nfoo.a = {'a': 1, 'b': 2, 'c': 3}\n\nfoo('a', 100)\nfoo('b', 200)\n\nprint foo.a\n"
... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46646/"
] |
419,402 | <p>I had created a BHO application with the help of <a href="http://www.codeproject.com/KB/cs/Attach_BHO_with_C_.aspx?fid=447248&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=51&select=2421069" rel="nofollow noreferrer">this link</a>.</p>
<p><strong>If I Build the source code obtained in above article, the CPU usage is increased to 70-80%.</strong></p>
<p><strong>How can I reduce this?</strong></p>
<p>In the above article, instead of Document complete event handler, i used progresschange event handler.</p>
<p>In the foreach loop, I used to check the tagname of every tag of a web page, while building the above code (or after registering the dll), the CPU usage was going on increasing from 10-80 percent which may cause problems if there is web page with lot of data(elements).....</p>
<p>I want to avoid this, Is there any method such that i can get all the tagnames of all the tag present in a web page.
Please suggest something such that i can avoid this problem.
Thanks...
The code which causes problem is in bold characters.
For each and every tag element found, It has display the message box containing the tagname of the tag element. </p>
<p>The code where I get problem is:</p>
<pre><code>public void onProgressChange(int Progress, int ProgressMax)
{
document = (HTMLDocument)webBrowser.Document;
foreach(IHTMLElement tempElement in (IHTMLElementCollection)document.documentElement.all)
{
System.Windows.Forms.MessageBox.Show(" Tagname:"+ tempElement.tagname);
}
}
public int SetSite(object site)
{
if (site != null)
{
webBrowser = (WebBrowser)site;
webBrowser.ProgressChange += new DWebBrowserEvents2_ProgressChangeEventHandler(this.onProgressChange);
}
else
{
webBrowser.ProgressChange = new DWebBrowserEvents2_ProgressChangeEventHandler(this.onProgressChange);
webBrowser = null;
}
return 0;
}
</code></pre>
<p>This Event is generated repeatedly. How to reduce CPU usage?</p>
| [
{
"answer_id": 419389,
"author": "too much php",
"author_id": 28835,
"author_profile": "https://Stackoverflow.com/users/28835",
"pm_score": 4,
"selected": false,
"text": "def foo(k, v):\n foo.a[k] = v\nfoo.a = {'a': 1, 'b': 2, 'c': 3}\n\nfoo('a', 100)\nfoo('b', 200)\n\nprint foo.a\n"
... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,406 | <p>I used to work for a company where some of the lead architect/developers had mandated on various projects that assertions were not to be used, and they would routinely be removed from code and replaced with exceptions. </p>
<p>I feel they are extremely important in writing correct code. Can anyone suggest how such a mandate could be justified? If so, what's wrong with assertions?</p>
| [
{
"answer_id": 419820,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "default switch case switch abort()"
},
{
"answer_id": 419823,
"author": "slim",
"author_id": 7512,
"author... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43058/"
] |
419,412 | <p>I am using a windows service and i want to print a .html page when the service will start. I am using this code and it's printing well. But a print dialog box come, how do i print without the print dialog box?</p>
<pre><code>public void printdoc(string document)
{
Process printjob = new Process();
printjob.StartInfo.FileName = document;
printjob.StartInfo.UseShellExecute = true;
printjob.StartInfo.Verb = "print";
printjob.StartInfo.CreateNoWindow = true;
printjob.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
printjob.Start();
}
</code></pre>
<p>Have there any other way to print this without showing the print dialog box.</p>
<hr>
<p><strong>Update: in response to <a href="https://stackoverflow.com/questions/419412/print-html-document-from-windows-service-without-print-dialog/419427#419427">this</a>:</strong></p>
<p>But i have already used this class but when i am calling the </p>
<pre><code>axW.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT,SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER , ref em, ref em);
</code></pre>
<p>My program getting block here when i am using from window service but it is working fine from windows application.</p>
| [
{
"answer_id": 419427,
"author": "Jack B Nimble",
"author_id": 3800,
"author_profile": "https://Stackoverflow.com/users/3800",
"pm_score": 1,
"selected": false,
"text": "using HtmlPrinter;\nhpObj=new HtmlPrinter.HtmlPrinter();\nhpObj.PrintUrlFromMemory(txtUrl.Text);\n HtmlPrinter.HtmlPri... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,415 | <pre><code>function CaptureKeys (e,btn) {
var c //= document.layers ? evt.which: document.all ? event.keyCode : evt.keyCode
if(window.event) {
c = e.keyCode; // IE
} else if(e.which) {
c = e.which; // Netscape/Firefox/Opera
}
if (c == 13) {
//return /enter key
if (btn=="go") {
if (document.getElementById("ctl00_ContentPlaceHolder1_btnGo")!=null) {
document.getElementById("ctl00_ContentPlaceHolder1_btnGo").focus();
return true;
}
} else {
if (document.getElementById('ctl00_ContentPlaceHolder1_ImgFilter') != null) {
//__doPostBack('ctl00_ContentPlaceHolder1_ImgFilter','');
document.getElementById('ctl00_ContentPlaceHolder1_ImgFilter').focus();
return true;
}
}
return false;
}
}
</code></pre>
<p>This code is working on IE7 but not working on Mozilla Firefox. Please help me to raise button event when press <kbd>Enter</kbd> key.</p>
| [
{
"answer_id": 419435,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "theButton.click();\n"
},
{
"answer_id": 9867255,
"author": "Deepak Shukl",
"author_id": 1292272,
"author_p... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,457 | <p>I want to scrape a screen using AJAX and javascript. How is this possible? </p>
<p>Need to scrape this : <strong><a href="http://www.fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers=776812461212825" rel="nofollow noreferrer">http://www.fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers=776812461212825</a></strong></p>
<p>I had used the technique given in w3school.com, but it's showing "access denied." Why is the "access denied" showing? Please solve my problem.. </p>
<p>Thanks in advance.</p>
| [
{
"answer_id": 420925,
"author": "Luca Matteis",
"author_id": 50394,
"author_profile": "https://Stackoverflow.com/users/50394",
"pm_score": 2,
"selected": false,
"text": "Ajax.Request(\"http://mydomain.com/proxy.php?url=http://www.fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntr... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38172/"
] |
419,467 | <p>What is the exact difference between SVN checkout and SVN export?</p>
<p>From what I know, export does not include the .svn directory which include metadata, and checkout included that .svn directory. Yet, my colleague had this problem recently that there is a different behaviour for the stuff compiled from sources that is checkout and exported from SVN repo. Both of them compiled correctly, but the one compiled from <code>svn export</code> works, but the one that is checked out doesn't work at all.</p>
<p>PS: The stuff being compiled is the Linux 2.4 kernel that is being used in an embedded device. The image compiles and load correctly, but the checked out one doesn't work. It causes a kernel panic during insmod. Why could this happen at all?</p>
<p>PPS: We've tried checksumming and diff tool to check the difference between the two directories that are exported and checked out from SVN. Both of them are the same except for the .svn directory.</p>
| [
{
"answer_id": 419475,
"author": "gak",
"author_id": 11125,
"author_profile": "https://Stackoverflow.com/users/11125",
"pm_score": 7,
"selected": false,
"text": "svn export svn checkout svn update svn commit"
},
{
"answer_id": 7040008,
"author": "Robino",
"author_id": 833... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17113/"
] |
419,472 | <p>I have a UITableView that has two modes. When we switch between the modes I have a different number of sections and cells per section. Ideally, it would do some cool animation when the table grows or shrinks.</p>
<p>Here is the code I tried, but it doesn't do anything:</p>
<pre><code>CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.5];
[self.tableView reloadData];
[UIView commitAnimations];
</code></pre>
<p>Any thoughts on how I could do this?</p>
| [
{
"answer_id": 421132,
"author": "iKenndac",
"author_id": 29005,
"author_profile": "https://Stackoverflow.com/users/29005",
"pm_score": 4,
"selected": false,
"text": "insertRowsAtIndexPaths:withRowAnimation: deleteRowsAtIndexPaths:withRowAnimation: insertSections:withRowAnimation: delete... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,476 | <p>I asked the opposite question <a href="https://stackoverflow.com/questions/361135/sql-query-advice-most-recent-item">here</a>, now I am faced with another problem. Assume I have the following tables (as per poster in previous post)</p>
<pre>
CustID LastName FirstName
------ -------- ---------
1 Woman Test
2 Man Test
ProdID ProdName
------ --------
123 NY Times
234 Boston Globe
ProdID IssueID PublishDate
------ ------- -----------
123 1 12/05/2008
123 2 12/06/2008
CustID OrderID OrderDate
------ ------- ---------
1 1 12/04/2008
OrderID ProdID IssueID Quantity
------- ------ ------- --------
1 123 1 5
2 123 2 12
</pre>
<p>How do I obtain the previous issue (publishdate) from table 3, of all issue, by WeekDay name? The presious issue of today (Wednesday) will not be yesterday Tuesday but last week Wednesday. The result will be 3 columns. The Product Name, current issue (PublishDate) and previous issue (PublishDate).</p>
<p>Thanks</p>
<p>Edit ~ Here is a problem I am facing. What if the previous issue doesn't exists, it has to go back to the pror week as well. I tried the following as a test but doesn't work</p>
<pre><code>SELECT TOP 1 publishdate FROM dbo.issue
WHERE prodid = 123 AND datename(dw,publishdate) = datename(dw,'2008-12-31')
ORDER BY publishdate desc
</code></pre>
<p>This is on SQL Server 2000.</p>
| [
{
"answer_id": 419569,
"author": "Gnudiff",
"author_id": 50003,
"author_profile": "https://Stackoverflow.com/users/50003",
"pm_score": 2,
"selected": true,
"text": "SELECT Curr.ProdID, Curr.PublishDate As CurrentIssue, Prev.PublishDate AS PrevIssue\nFROM Issues Curr, Issues Prev\nWHERE P... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23667/"
] |
419,497 | <p>HI ,</p>
<p>I want to create a dynamic send port for MS CRM 3.0/4.0 adapter. but i didn't get how to create it? Also i didn't get any methods to set user name and password required to access CRM.</p>
<p>CRM URL is : <a href="http://localhost:5555" rel="nofollow noreferrer">http://localhost:5555</a></p>
<p>User name: Administrator</p>
<p>Password: password</p>
<p>Orgname: MicrosoftCRM</p>
<p>I installed MS CRM Adapter[Both for 3.0/4.0 common and also separate adapter for CRM 4.0].</p>
<p>Thanks in advance.</p>
| [
{
"answer_id": 679209,
"author": "Naveen Karamchetti",
"author_id": 82133,
"author_profile": "https://Stackoverflow.com/users/82133",
"pm_score": 0,
"selected": false,
"text": "C:\\Program Files\\[CRM Adapter installation folder]\\Schemas\n // NOTE: Use the complete MS CRM 4.0 Web Servic... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52343/"
] |
419,507 | <p>In C# 3.0, I have a property which is suppose to contain the version of the class. The version number is simply the date and time of compilation. Right now, I have the following code:</p>
<pre><code>public DateTime Version
{
get { return DateTime.UtcNow; }
}
</code></pre>
<p>Obviously, this is wrong since this property returns me the current date and time. <strong>So, is the precompiler can <em>print</em> the DateTime at compile time?</strong> In this case, I could do something similar to below.</p>
<pre><code>public DateTime Version
{
get { return new DateTime("PRECOMPILER DATE"); }
}
</code></pre>
| [
{
"answer_id": 419512,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "Time FileUpdate [AssemblyVersion] <!-- See http://msbuildtasks.tigris.org -->\n<Import Project=\"$(MSBuildExtensionsPa... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42024/"
] |
419,511 | <p>I am running a SVN server on my Windows Server and want to schedule an automated backup procedure. I will always be the only one working on the repository. Should I bother with hotcopy or can I use a simple Windows backup application to backup the repositories? What about xcopy or robocopy?</p>
| [
{
"answer_id": 419526,
"author": "Ryan Smith",
"author_id": 10420,
"author_profile": "https://Stackoverflow.com/users/10420",
"pm_score": 5,
"selected": true,
"text": "svnadmin dump /path/to/repository > repository-name.dmp\n"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51949/"
] |
419,517 | <p>I trying to build and compile my <code>xcodeproj</code> in command line and it is working now. </p>
<p>So it is also possible to launch the <code>xcodeproject</code> from terminal instead from the Xcode?</p>
| [
{
"answer_id": 419552,
"author": "Stephen Darlington",
"author_id": 2998,
"author_profile": "https://Stackoverflow.com/users/2998",
"pm_score": 2,
"selected": false,
"text": "xcodebuild\n Usage: xcodebuild [-project <projectname>] [-activetarget] [-alltargets] [-target <targetname>]... [... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,518 | <p>I get the following error:</p>
<pre><code>Unhandled Exception: System.IO.IOException: The parameter is incorrect.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.__Error.WinIOError()
at System.Console.set_OutputEncoding(Encoding value)
at (my program)
</code></pre>
<p>when I run the following line of code:</p>
<pre><code> Console.OutputEncoding = Encoding.Unicode;
</code></pre>
<p>Any idea why? I do not get this error if I set the encoding to UTF8 instead.</p>
| [
{
"answer_id": 419541,
"author": "Fabrizio C.",
"author_id": 49582,
"author_profile": "https://Stackoverflow.com/users/49582",
"pm_score": 0,
"selected": false,
"text": "CodePage Encoding SetConsoleOutputCP Console.OutputEncoding"
},
{
"answer_id": 918748,
"author": "user1078... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] |
419,521 | <p>When importing numbers from a csv file, I need to convert them to floats with unit.</p>
<p>Currently I do this with an inline function:</p>
<pre><code>data |> List.map float |> List.map (fun n -> n * 1.0<m>)
</code></pre>
<p>But I'm wondering if there is a more elegant way to do this - or do I have to create my own 'units' module with conversion functions?</p>
<p>What would be really nice would be something like this, but I doubt it's possible...</p>
<pre><code>data |> List.map float |> List.map lift<m>
</code></pre>
<p><em>This is the opposite of my previous question (<a href="https://stackoverflow.com/questions/412459/how-to-generically-remove-f-units-of-measure">How to generically remove F# Units of measure</a>).</em></p>
<p>UPDATE: For homemade units, I've tried this, which works ok:</p>
<pre><code>[<Measure>]
type km =
static member lift (v:float) = v * 1.0<km>
data |> List.map float |> List.map km.lift
</code></pre>
<p>or, following the question in <a href="https://stackoverflow.com/questions/419521/f-units-of-measure-lifting-values-to-floatsomething#424111">this answer</a></p>
<pre><code>data |> List.map (float >> km.lift)
</code></pre>
| [
{
"answer_id": 419789,
"author": "Robert",
"author_id": 17864,
"author_profile": "https://Stackoverflow.com/users/17864",
"pm_score": 3,
"selected": true,
"text": "data |> List.map float |> List.map ((*) 1.0<m>)\n FloatWithMeasure"
},
{
"answer_id": 424111,
"author": "Juliet"... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419521",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11410/"
] |
419,527 | <p>I have a program which deliberately performs a divide by zero (and stores the result in a volatile variable) in order to halt in certain circumstances. However, I'd like to be able to disable this halting, without changing the macro that performs the division by zero.</p>
<p>Is there any way to ignore it?</p>
<p>I've tried using</p>
<pre><code>#include <signal.h>
...
int main(void) {
signal(SIGFPE, SIG_IGN);
...
}
</code></pre>
<p>but it still dies with the message "Floating point exception (core dumped)". </p>
<p>I don't actually use the value, so I don't really care what's assigned to the variable; 0, random, undefined...</p>
<p>EDIT: I know this is not the most portable, but it's intended for an embedded device which runs on many different OSes. The default halt action is to divide by zero; other platforms require different tricks to force a watchdog induced reboot (such as an infinite loop with interrupts disabled). For a PC (linux) test environment, I wanted to disable the halt on division by zero without relying on things like assert. </p>
| [
{
"answer_id": 419535,
"author": "lc.",
"author_id": 44853,
"author_profile": "https://Stackoverflow.com/users/44853",
"pm_score": 3,
"selected": true,
"text": "exit(-1)"
},
{
"answer_id": 419558,
"author": "nimrodm",
"author_id": 23388,
"author_profile": "https://Sta... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41308/"
] |
419,547 | <p>I'm pointing the .Net command line WSDL utility that ships with Visual Studio 2005 at a web service implemented in Java (which I have no control over) and it spits out the following error:</p>
<pre><code>WSDL : error WSDL1: Unable to cast object of type 'System.Xml.XmlElement'
to type 'System.Web.Services.Description.ServiceDescriptionFormatExtension'.
</code></pre>
<p>Yet if I point Visual Studio 2005 itself at the service via the Add Web Reference dialog it generates a proxy class for me just fine.</p>
<p>I'm using the WSDL utility to generate all my other service proxies just fine (though an old one does emit a bunch of warnings).</p>
<p>Currently I'm pointing the WSDL utility at the URLs of deployed web services. All of which were developed in Java.</p>
<p>I want to use the WSDL command line utility in the build process to ensure I have the most up-to-date proxy code each time I compile.</p>
| [
{
"answer_id": 6206707,
"author": "granadaCoder",
"author_id": 214977,
"author_profile": "https://Stackoverflow.com/users/214977",
"pm_score": 0,
"selected": false,
"text": "using System.ServiceModel;\n\n[ServiceBehavior(Name = \"MyConcreteServiceName\", Namespace = \"http://www.mycompan... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20480/"
] |
419,554 | <p>I have a Sql statament using special character (ex: ('), (/), (&)) and I don't know how to write them in my VB.NET code. Please help me. Thanks.</p>
| [
{
"answer_id": 419573,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "Dim euro as Char = ChrW(&H20AC)\n"
},
{
"answer_id": 419876,
"author": "spacemonkeys",
"author_id": 3233... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,559 | <p>Having implemented CLogClass to make decent logging I also defined macro, but it works only with one parameter...</p>
<pre><code>class CLogClass
{
public:
static void DoLog(LPCTSTR sMessage, ...);
};
#define DebugLog(sMessage, x) ClogClass::DoLog(__FILE__, __LINE__, sMessage, x)
</code></pre>
<p>Well, it fails when called with more than 2 parameters :( ... Is it possible at all to avoid it? Can it be translated to templates somehow?</p>
<p>EDIT: Variadic macros were introduced in VS 2005 (But i'm currently in VS 2003...). Any advices?</p>
| [
{
"answer_id": 419636,
"author": "Philippe F",
"author_id": 13618,
"author_profile": "https://Stackoverflow.com/users/13618",
"pm_score": 2,
"selected": false,
"text": "#include <stdio.h>\n#include <stdarg.h>\n\n\nclass CLogClass\n{\npublic:\n static void DoLogWithFileLineInfo( const ... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7003/"
] |
419,563 | <pre><code>An error was discovered processing the <wsse:Security> header
</code></pre>
<p>This is a WS-Security question btw... </p>
<p>I can't see anything wrong with my WS endpoint (apart from the fact that it's running in a TIBCO BW engine!). Does someone have any 'prior' with this kind of error? I realise that the WS-Security Header could be broken anywhere presumably to get this error but, there's GOT to be a 90% percentile on some kind of common error.</p>
<p>Here's the secured SOAP - the client is standalone java (WSS4J 1.5.0) performing signing only at this stage.</p>
<pre><code><soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-20237898">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#id-18414151">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>DvjhvAtEVxwntL/RjMCNhId57cg=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
YbOB3FRduCr5rutpIvch9sDZfZToy3pjm+Kyl/Oqz6cAPqMVKqvKBb4P7ebnzP/3SVjm+PfLqlE5
BGgcT3Vz93apyg+eY1rAIYUs7K1Zt9F5ejMmij6HQpQTGpyM9BUXJi1x5bt9GuMtD0SK939bIIE2
ZUyZ0jPJp/wUhMonskw=
</ds:SignatureValue>
<ds:KeyInfo Id="KeyId-15734641">
<wsse:SecurityTokenReference xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="STRId-3852606">
<ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=Mark Hesketh,OU=asdf,O=DVA,L=Canberra,ST=ACT,C=AU</ds:X509IssuerName>
<ds:X509SerialNumber>1231310305</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature>
</wsse:Security>
</soapenv:Header>
<soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-18414151">
<message xmlns="http://www.tibco.com/schemas/CertificateWork/Resources/Schema.xsd" text="Sample msg with SHA1 signature"/>
</soapenv:Body>
</soapenv:Envelope>
</code></pre>
| [
{
"answer_id": 69677865,
"author": "SJX",
"author_id": 2280067,
"author_profile": "https://Stackoverflow.com/users/2280067",
"pm_score": 0,
"selected": false,
"text": "soapMessage.getSOAPPart().getEnvelope();\n"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,575 | <p>C# Sockets: How do you handle a socket in C#.NET the way they're handled in VB6 or Delphi (event driven)?</p>
<p>On VB6 or Delphi, when creating a socket, you had an onconnect, onreceive, and onerror events placed into the main code file, how would I replicate the same?</p>
| [
{
"answer_id": 423304,
"author": "Spencer Ruport",
"author_id": 52551,
"author_profile": "https://Stackoverflow.com/users/52551",
"pm_score": 1,
"selected": false,
"text": "While Socket Is Connected\n If Data Is Available Raise Event DataAvailable\nLoop\n"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,577 | <p>I have a simple sketch (in <a href="http://processing.org/" rel="nofollow noreferrer">Processing</a>), basically a bunch of dots wander around, if they come into contact with each other they fight (each has a strength value, increased each time they win, if it's equal the winner is randomly chosen)</p>
<p>It works well with about 5000 12-pixel "zombies" (there's a slight slowdown for a half a second, while the zombies initially collide with each other), the problem is when the zombies are made smaller, they don't collide with each other as quick, and the slowdown can last much longer..</p>
<p>The code is really simple - basically each zombie is a class, which has an X/Y coordinate. Each frame all the zombies are nudged one pixel, randomly turning <code>lurching</code> degrees (or not). I think the biggest cause of slowness is the collision detection - each zombie checks every other one (so zombie 1 checks 2-5000, zombie 2 checks 1,3-5000 etc..)</p>
<p>I'd like to keep everything simple, and "plain Processing" (not using external libraries, which might be more efficient and easy, but I don't find it very useful for learning)</p>
<pre class="lang-java prettyprint-override"><code>int numZombies = 5000;
Zombie[] zombies = new Zombie[numZombies];
void setup(){
size(512, 512);
noStroke();
for(int i = 0; i < numZombies; i++){
zombies[i] = new Zombie(i, random(width), random(height), random(360), zombies);
}
}
void draw(){
background(0);
for(int i = 0; i < numZombies; i++){
zombies[i].move();
zombies[i].display();
}
}
class Zombie{
int id; // the index of this zombie
float x, y; // current location
float angle; // angle of zombies movement
float lurching = 10; // Amount angle can change
float strength = 2;
boolean dead = false; // true means zombie is dead
float diameter = 12; // How big the zombie is
float velocity = 1.0; // How fast zombie moves
Zombie[] others; // Stores the other zombies
Zombie(int inid, float xin, float yin, float inangle, Zombie[] oin){
id = inid;
x = xin;
y = yin;
angle = inangle;
others = oin;
}
void move(){
if(dead) return;
float vx = velocity * sin(radians(180-angle));
float vy = velocity * cos(radians(180-angle));
x = x + vx;
y = y + vy;
if(x + vx < 0 || x + vx > width || y + vy < 0 || y + vy > height){
// Collided with wall
angle = angle + 180;
}
float adecide = random(3);
if(adecide < 1){
// Move left
angle=angle - lurching;
}
else if(adecide > 1 && adecide < 2){
// Don't move x
}
else if(adecide > 2){
// Move right
angle = angle + lurching;
}
checkFights();
}
void checkFights(){
for (int i=0; i < numZombies; i++) {
if (i == id || dead || others[i].dead){
continue;
}
float dx = others[i].x - x;
float dy = others[i].y - y;
float distance = sqrt(dx*dx + dy*dy);
if (distance < diameter){
fight(i);
}
}
}
void fight(int oid){
Zombie o = others[oid];
//println("Zombie " + id + "(s: "+ strength +") fighting " + oid + "(s: "+ o.strength +")");
if(strength < o.strength){
kill();
o.strength++;
}
else if (strength == o.strength){
if(random(1) > 0.5){
kill();
o.strength++;
}
else{
o.kill();
strength++;
}
}
}
void kill(){
dead = true;
}
void display(){
if(dead) return;
ellipse(x, y, diameter, diameter);
}
}
</code></pre>
| [
{
"answer_id": 419608,
"author": "Yuval Adam",
"author_id": 24545,
"author_profile": "https://Stackoverflow.com/users/24545",
"pm_score": 2,
"selected": false,
"text": "O(n^2)"
},
{
"answer_id": 419666,
"author": "lc.",
"author_id": 44853,
"author_profile": "https://S... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419577",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/745/"
] |
419,584 | <p>I have seen many types of image extensions but have never understood the real differences between them. Are there any links out there that clearly explain their differences?</p>
<p>Are there standards to consider when choosing a particular type of image to use in an application? What do we use for web applications?</p>
| [
{
"answer_id": 20736342,
"author": "Lihang Li",
"author_id": 1930023,
"author_profile": "https://Stackoverflow.com/users/1930023",
"pm_score": 0,
"selected": false,
"text": "Pixel Format Color Space meta data or file header pixel data section meta data height width file format pixel data... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38997/"
] |
419,596 | <p>The basic idea behind a Cancel button is to enable closing your window with an Escape Keypress.</p>
<blockquote>
<p>You can set the IsCancel property on
the Cancel button to true, causing the
Cancel button to automatically close
the dialog without handling the Click
event.</p>
</blockquote>
<p>Source: Programming WPF (Griffith, Sells)</p>
<p>So this should work</p>
<pre><code><Window>
<Button Name="btnCancel" IsCancel="True">_Close</Button>
</Window>
</code></pre>
<p>However the behavior I expect isn't working out for me. The parent window is the main application window specified by the Application.StartupUri property. What works is</p>
<pre><code><Button Name="btnCancel" IsCancel=True" Click="CloseWindow">_Close</Button>
private void CloseWindow(object sender, RoutedEventArgs)
{
this.Close();
}
</code></pre>
<ul>
<li>Is the behavior of IsCancel different based on whether the Window is a normal window or a Dialog? Does IsCancel work as advertised only if ShowDialog has been called?</li>
<li>Is an explicit Click handler required for the button (with IsCancel set to true) to close a window on an Escape press?</li>
</ul>
| [
{
"answer_id": 419615,
"author": "Steven Robbins",
"author_id": 26507,
"author_profile": "https://Stackoverflow.com/users/26507",
"pm_score": 6,
"selected": true,
"text": "public MainWindow()\n{\n InitializeComponent();\n\n this.PreviewKeyDown += new KeyEventHandler(CloseOnEscape);... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695/"
] |
419,598 | <p>Do you consider this a code smell?</p>
<pre><code>foreach((array)$foo as $bar)
{
$bar->doStuff();
}
</code></pre>
<p>Should i use that instead?</p>
<pre><code>if (isset($foo) && is_array($foo))
{
foreach($foo as $bar)
{
$bar->doStuff();
}
}
</code></pre>
<p>Any other good practices to cover not set variables and assert an array?</p>
| [
{
"answer_id": 419672,
"author": "Willem",
"author_id": 15447,
"author_profile": "https://Stackoverflow.com/users/15447",
"pm_score": 2,
"selected": false,
"text": "if (! $foo or !is_array($foo))\n $foo = array();\n\nforeach($foo as $bar)\n{\n $bar->doStuff();\n}\n"
},
{
"a... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28144/"
] |
419,604 | <p>Okay so I have the following Code which appends a string to another in C#, note that this is Just an <strong>example</strong>, so giving alternative string concatination methods in C# is not nessesary, this is just to simplify the example.</p>
<pre><code>string Data = "";
Data +="\n\nHTTP/1.1 " + Status_code;
Data += "\nContent-Type: " + Content_Type;
Data += "\nServer: PT06";
Data += "\nContent-Length: " + Content_Lengt;
Data += "\nDate: " + Date;
Data += "\n" + HTML;
</code></pre>
<p>Now I'd like to do the exact same thing in C and I'm trying to do this the following way</p>
<pre><code>time_t rawtime;
time ( &rawtime );
char *message = "\n\nHTTP/1.1 ";
message = strcat(message, Status_code);
message = strcat(message, "\nContent-Type: ");
message = strcat(message, Content_Type);
message = strcat(message, "\nServer: PT06");
message = strcat(message, "\nContent-Length: ");
message = strcat(message, Content_Lengt);
message = strcat(message, "\nDate: ");
message = strcat(message, ctime(&rawtime));
message = strcat(message, "\n");
message = strcat(message, HTML);
</code></pre>
<p>Now, this gives me a Segment fault, I know why, I access and read on memory that i shouldn't. But the question is, how do i solve it? Could I use string.h and just do it the same way that I did in C#?</p>
| [
{
"answer_id": 419619,
"author": "SmacL",
"author_id": 22564,
"author_profile": "https://Stackoverflow.com/users/22564",
"pm_score": 5,
"selected": true,
"text": "char *message = \"\\n\\nHTTP/1.1 \";\n char message[1024]; \nstrcpy(message,\"\\n\\nHTTP/1.1 \");\n char buffer[MAXSIZE] = \... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39106/"
] |
419,632 | <p>So, this is what we want to do: We want to have a generic web part with a custom frame around it and then dynamically load other web parts (frameless) inside it. Would this at all be possible you think? A bit like <a href="http://www.codeplex.com/smartpart" rel="noreferrer">Jan Tielens SmartPart</a>, only not for ASP.Net User Controls, but for other Web parts... ;)</p>
<p>Edit: We've been able to do this now. The solution was actually pretty simple. Check out the code:</p>
<pre><code>public class WebPartWrapper : System.Web.UI.WebControls.WebParts.WebPart {
protected override void CreateChildControls() {
Panel pnl = new Panel();
this.Controls.Add(pnl);
WebPart dynamicPart = WebPartFactory.CreateWebPart("RSSViewer");
pnl.Controls.Add(dynamicPart);
}
}
</code></pre>
<p>Easy as that... We also use reflection to store the webparts as Xml etc., but that's beside the point.</p>
| [
{
"answer_id": 541406,
"author": "noocyte",
"author_id": 11220,
"author_profile": "https://Stackoverflow.com/users/11220",
"pm_score": 3,
"selected": true,
"text": "public class WebPartWrapper : System.Web.UI.WebControls.WebParts.WebPart {\n protected override void CreateChildControls... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11220/"
] |
419,638 | <p>I recently gave a interview to one of the TOP software company. I was completely stuck with only one question asked by interviewer to me, which was </p>
<p>Q. I have a machine with 512 mb / 1 GB RAM and I have to sort a file (XML, or any) of 4 GB size. How will I proceed? What will be the data structure, and which sorting algorithm will I use and how?</p>
<p>Do you think it is achievable? If yes then can you please explain?</p>
<p>Thanks in advance!</p>
| [
{
"answer_id": 419656,
"author": "Frederick The Fool",
"author_id": 32688,
"author_profile": "https://Stackoverflow.com/users/32688",
"pm_score": 2,
"selected": false,
"text": "function sortFile(file)\n if fileTooBigForMemory(file)\n pair<firstHalfOfFile, secondHalfOfFile> = bre... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,652 | <p>I set up a website and I created a folder names (docs) in the website as Virtual Directory with some documents.</p>
<p>Therefore the URL is xxxxxxyyyyzzzz.com/docs </p>
<p>The problem is that when i try to access xxxxxxyyyyzzzz.com/docs/1.doc, Authentication is required. Can you tell me how to remove this and leave any user access this folder with any restrictions?</p>
<p>David</p>
| [
{
"answer_id": 419662,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 0,
"selected": false,
"text": "Properties| Directory Security | Authentication and access control | Edit..."
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44973/"
] |
419,659 | <p>I'm new to TDD and xUnit so I want to test my method that looks something like: </p>
<pre><code>List<T> DeleteElements<T>(this List<T> a, List<T> b);
</code></pre>
<p>Is there any Assert method that I can use ? I think something like this would be nice</p>
<pre><code>List<int> values = new List<int>() { 1, 2, 3 };
List<int> expected = new List<int>() { 1 };
List<int> actual = values.DeleteElements(new List<int>() { 2, 3 });
Assert.Exact(expected, actual);
</code></pre>
<p>Is there something like this ?</p>
| [
{
"answer_id": 419717,
"author": "Konstantin Spirin",
"author_id": 1423922,
"author_profile": "https://Stackoverflow.com/users/1423922",
"pm_score": 9,
"selected": true,
"text": "collection.Should().Equal(1, 2, 5, 8);\ncollection.Should().NotEqual(8, 2, 3, 5);\ncollection.Should().BeEqui... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42377/"
] |
419,660 | <p>I am having table in the below format. I need mysql query to get the no of rows perday when i give date between 2008-10-12 and 2008-10-13</p>
<pre>
Name | KW | KV | I | Date |
------+--------+------+------+---------------------+
UPS1 | 353.50 | NULL | NULL | 2008-10-12 00:54:36 |
UPS1 | 352.50 | NULL | NULL | 2008-10-12 01:54:36 |
UPS1 | 351.90 | NULL | NULL | 2008-10-12 02:54:36 |
UPS1 | 351.60 | NULL | NULL | 2008-10-12 03:54:36 |
UPS1 | 352.20 | NULL | NULL | 2008-10-12 04:54:36 |
UPS1 | 352.20 | NULL | NULL | 2008-10-12 05:54:36 |
UPS1 | 351.90 | NULL | NULL | 2008-10-12 06:54:36 |
UPS1 | 352.50 | NULL | NULL | 2008-10-12 07:54:36 |
UPS1 | 352.50 | NULL | NULL | 2008-10-12 08:54:36 |
UPS1 | 353.20 | NULL | NULL | 2008-10-12 09:54:36 |
UPS1 | 353.50 | NULL | NULL | 2008-10-12 10:54:36 |
UPS1 | 352.20 | NULL | NULL | 2008-10-12 11:54:36 |
UPS1 | 352.50 | NULL | NULL | 2008-10-12 12:54:36 |
UPS1 | 352.20 | NULL | NULL | 2008-10-12 13:54:36 |
UPS1 | 353.20 | NULL | NULL | 2008-10-12 14:54:36 |
UPS1 | 353.50 | NULL | NULL | 2008-10-12 15:54:36 |
UPS1 | 352.90 | NULL | NULL | 2008-10-12 16:54:36 |
UPS1 | 352.20 | NULL | NULL | 2008-10-12 17:54:36 |
UPS1 | 352.20 | NULL | NULL | 2008-10-12 18:54:36 |
UPS1 | 352.90 | NULL | NULL | 2008-10-12 19:54:36 |
UPS1 | 352.20 | NULL | NULL | 2008-10-12 20:54:36 |
UPS1 | 352.50 | NULL | NULL | 2008-10-12 21:54:36 |
UPS1 | 352.90 | NULL | NULL | 2008-10-12 22:54:36 |
UPS1 | 353.20 | NULL | NULL | 2008-10-12 23:54:36 |
UPS1 | 355.80 | NULL | NULL | 2008-10-13 00:54:36 |
UPS1 | 358.40 | NULL | NULL | 2008-10-13 01:54:36 |
UPS1 | 358.00 | NULL | NULL | 2008-10-13 02:54:36 |
UPS1 | 359.00 | NULL | NULL | 2008-10-13 03:54:36 |
UPS1 | 357.70 | NULL | NULL | 2008-10-13 04:54:36 |
UPS1 | 357.40 | NULL | NULL | 2008-10-13 05:54:36 |
UPS1 | 357.40 | NULL | NULL | 2008-10-13 06:54:36 |
UPS1 | 359.00 | NULL | NULL | 2008-10-13 07:54:36 |
UPS1 | 357.10 | NULL | NULL | 2008-10-13 08:54:36 |
UPS1 | 359.00 | NULL | NULL | 2008-10-13 09:54:36 |
UPS1 | 357.70 | NULL | NULL | 2008-10-13 10:54:36 |
UPS1 | 357.40 | NULL | NULL | 2008-10-13 11:54:36 |
UPS1 | 357.40 | NULL | NULL | 2008-10-13 12:54:36 |
UPS1 | 359.00 | NULL | NULL | 2008-10-13 13:54:36 |
UPS1 | 357.10 | NULL | NULL | 2008-10-13 14:54:36 |
UPS1 | 358.00 | NULL | NULL | 2008-10-13 15:54:36 |
UPS1 | 359.30 | NULL | NULL | 2008-10-13 16:54:36 |
UPS1 | 357.10 | NULL | NULL | 2008-10-13 17:54:36 |
UPS1 | 358.40 | NULL | NULL | 2008-10-13 18:54:36 |
UPS1 | 357.70 | NULL | NULL | 2008-10-13 19:54:36 |
UPS1 | 359.00 | NULL | NULL | 2008-10-13 20:54:36 |
UPS1 | 358.70 | NULL | NULL | 2008-10-13 21:54:36 |
UPS1 | 358.70 | NULL | NULL | 2008-10-13 22:54:36 |
UPS1 | 358.40 | NULL | NULL | 2008-10-13 23:54:36 |
</pre>
| [
{
"answer_id": 419671,
"author": "ewalshe",
"author_id": 47429,
"author_profile": "https://Stackoverflow.com/users/47429",
"pm_score": 3,
"selected": false,
"text": "select Date, count(Date)\nfrom TABLE\nwhere Date >= '2008-10-12' and Date <= '2008-10-13'\ngroup by Date\n mysql> select D... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
419,670 | <p>I wonder if anyone has managed to create a working code for sending out binary messages (to configure Symbian phones) and have also some binary data sample.
So far all the samples I have found fail to leave the Outbox or never return.</p>
<pre><code>// Current entry is the Draft folder.
iSmsMtm->SwitchCurrentEntryL( KMsvDraftEntryId );
// Create a new SMS message entry as a child of the current context.
iSmsMtm->CreateMessageL( KUidMsgTypeSMS.iUid );
CMsvEntry& serverEntry = iSmsMtm->Entry();
TMsvEntry entry( serverEntry.Entry() );
/* Send Binary SMS */
CSmsHeader &hdr = iSmsMtm->SmsHeader();
CSmsMessage &msg = hdr.Message();
CSmsPDU &pdu = msg.SmsPDU();
CSmsUserData &userdata = pdu.UserData();
// Set the DCS byte
pdu.SetBits7To4(TSmsDataCodingScheme::ESmsDCSTextUncompressedWithNoClassInfo);
pdu.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabet8Bit);
pdu.SetClass(ETrue, TSmsDataCodingScheme::ESmsClass2);
char buf[]= {...}; //my binary data, 247 bytes long
// Construct a dummy message
HBufC8 * iMessage = HBufC8::NewL(300);
TPtr8 TempUDHBufDesc((TUint8*)buf,247,247);
iMessage->Des().Copy(TempUDHBufDesc);
_LOGFENTRY1(_L("mess length %d"),iMessage->Des().Length());
userdata.SetBodyL(*iMessage);
delete iMessage;
// Message will be sent immediately.
entry.SetSendingState( KMsvSendStateWaiting );
entry.iDate.UniversalTime(); // insert current time //Solution for HomeTime()
// Set the SMS message settings for the message.
CSmsHeader& header = iSmsMtm->SmsHeader();
CSmsSettings* settings = CSmsSettings::NewL();
CleanupStack::PushL( settings );
settings->CopyL( iSmsMtm->ServiceSettings() ); // restore settings
settings->SetDelivery( ESmsDeliveryImmediately ); // to be delivered immediately
settings->SetDeliveryReport(EFalse);
settings->SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabet8Bit); // IMPORTANT! For sending binary SMS
header.SetSmsSettingsL( *settings ); // new settings
// Let's check if there is a service center address.
if ( header.Message().ServiceCenterAddress().Length() == 0 )
{
// No, there isn't. We assume there is at least one service center
// number set and use the default service center number.
CSmsSettings* serviceSettings = &( iSmsMtm->ServiceSettings() );
// Check if number of service center addresses in the list is null.
if ( !serviceSettings->ServiceCenterCount() )
{ _LOGENTRY("No SC");
return ; // quit creating the message
}
else
{
CSmsNumber* smsCenter= CSmsNumber::NewL();
CleanupStack::PushL(smsCenter);
smsCenter->SetAddressL((serviceSettings->GetServiceCenter( serviceSettings->DefaultServiceCenter())).Address());
header.Message().SetServiceCenterAddressL( smsCenter->Address() );
CleanupStack::PopAndDestroy(smsCenter);
}
}
CleanupStack::PopAndDestroy( settings );
// Recipient number is displayed also as the recipient alias.
entry.iDetails.Set( _L("+3725038xxx") );
iSmsMtm->AddAddresseeL( _L("+3725038xxx") , entry.iDetails );
// Validate message.
if ( !ValidateL() )
{ _LOGENTRY("Not valid");
return ;
}
entry.SetVisible( ETrue ); // set message as visible
entry.SetInPreparation( EFalse ); // set together with the visibility flag
serverEntry.ChangeL( entry ); // commit changes
iSmsMtm->SaveMessageL(); // save message
TMsvSelectionOrdering selection;
CMsvEntry* parentEntry = CMsvEntry::NewL( iSmsMtm->Session(), KMsvDraftEntryId, selection );
CleanupStack::PushL( parentEntry );
// Move message to Outbox.
iOperation =parentEntry->MoveL( entry.Id(), KMsvGlobalOutBoxIndexEntryId, iStatus );
CleanupStack::PopAndDestroy( parentEntry );
iState = EWaitingForMoving;
SetActive();
</code></pre>
<p>Mostly I'm not sure about the correct values for port and class . Also some correct binary string would be nice to have for testing. Now I'm not sure if thecode is bad or the data.</p>
| [
{
"answer_id": 446759,
"author": "KevinD",
"author_id": 26497,
"author_profile": "https://Stackoverflow.com/users/26497",
"pm_score": 0,
"selected": false,
"text": "RSocket"
}
] | 2009/01/07 | [
"https://Stackoverflow.com/questions/419670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44715/"
] |
419,698 | <p><strong>Overall Plan</strong></p>
<p>Get my class information to automatically optimize and select my uni class timetable</p>
<p>Overall Algorithm</p>
<ol>
<li>Logon to the website using its
Enterprise Sign On Engine login</li>
<li>Find my current semester and its
related subjects (pre setup)</li>
<li>Navigate to the right page and get the data from each related
subject (lecture, practical and
workshop times)</li>
<li>Strip the data of useless
information</li>
<li>Rank the classes which are closer
to each other higher, the ones on
random days lower</li>
<li>Solve a best time table solution</li>
<li>Output me a detailed list of the
BEST CASE information</li>
<li>Output me a detailed list of the
possible class information (some
might be full for example)</li>
<li>Get the program to select the best
classes automatically</li>
<li>Keep checking to see if we can
achieve 7.</li>
</ol>
<p>6 in detail
Get all the classes, using the lectures as a focus point, would be highest ranked (only one per subject), and try to arrange the classes around that.</p>
<p><strong>Questions</strong></p>
<p>Can anyone supply me with links to something that might be similar to this hopefully written in python?
In regards to 6.: what data structure would you recommend to store this information in? A linked list where each object of uniclass?
Should i write all information to a text file?</p>
<p>I am thinking uniclass to be setup like the following
attributes:</p>
<ul>
<li>Subject</li>
<li>Rank</li>
<li>Time</li>
<li>Type</li>
<li>Teacher</li>
</ul>
<p>I am hardly experienced in Python and thought this would be a good learning project to try to accomplish.
Thanks for any help and links provided to help get me started, <strong>open to edits to tag appropriately or what ever is necessary</strong> (not sure what this falls under other than programming and python?)</p>
<p>EDIT: can't really get the proper formatting i want for this SO post ><</p>
| [
{
"answer_id": 419838,
"author": "James Brady",
"author_id": 29903,
"author_profile": "https://Stackoverflow.com/users/29903",
"pm_score": 3,
"selected": true,
"text": "selected_classes = []\nclasses = sorted(classes, key=lambda c: c.score)\nfor clas in classes:\n if not clas.clashes_... | 2009/01/07 | [
"https://Stackoverflow.com/questions/419698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45211/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.