instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I've made a 9H-printing model tonight, and only a little part of it failed (because a support dropped off). I want to reprint only that little part.</p>
<p>How can I do that in Cura? <strong>How can I tell Cura to generate a gcode file so only that little part (inside the transparent cube below) will be printed?</s... | <p>The latest version of Ultimaker Cura can do that (version 3.6).</p>
<p>I have built models made of different material in the same model.</p>
<p>How to do this is:</p>
<ol>
<li>Select your CUBE and select the icon "Per Model Setting" in left side menu.</li>
<li>choice "Normal model", select the following settings:... | <p>What you can also try is to separate the part from the rest of the model within your CAD software. In FreeCAD for example, you can use the mesh design workbench to cut the small part away from the rest, then you slice this small piece and print it.</p>
| 905 |
<p>This a bit of strange one.... We have an internal web app that runs on server (A) and a document repository that runs on server (B). </p>
<p>I have simple link on a page and I want to enable the user to download a document(From IIS Server (A)). However this document does not exist on Server (A) until the user click... | <p>If the world can see server A and server A can see server B. I would recommend setting up a reverse proxy. </p>
<p><a href="http://www.codeplex.com/urlrewriter" rel="nofollow noreferrer">http://www.codeplex.com/urlrewriter</a></p>
<p>Basically what this does is allows the world to download from server B but only... | <p>Can you use ajax? For example, the user clicks the button sending a request to get the file from B to A and a spinner shows up on the page. Then when the copy is done, you disable the spinner and give the user a download link. </p>
<p>I was voted down and don't have comment privileges, so I figured I would elaborat... | 21,453 |
<p>I'm making a dynamic image for a forum that doesn't allow dynamic images.</p>
<p>I tried using .htacess to redirect all *.png files to image.png... which works perfectly, but from here I can't seem to be able to get the filename of the .png that was requested to generate the content. </p>
<p>For example:</p>
<ol>... | <p>For SVN: In commandline tool, there is the option <strong>-x</strong> which you can set to "<strong>b</strong>" or "<strong>w</strong>" to ignore space changes resp. all spaces.<br>
You can also supply a third party tool for doing the merges. So if you have a merger which ignores whitespaces, you can use this one. ... | <p>TortoiseMerge doesn't have any CLA (Command Line Arguments) to ignore the whitespace and ignore the case. After searching a lot it seems that it can be achieved still by tweaking the registry values.</p>
<pre><code>/* DisableWhitespaceDifferences and DisableCaseDifferences.
* The settings for TortoiseMerge is stor... | 23,495 |
<p>I'm using the <a href="http://sql.codeproject.com/KB/database/CsvReader.aspx" rel="nofollow noreferrer">CsvReader</a> library in my Windows Forms application, which is coded in horribly messy VB (I've recently taken over the project.)</p>
<p>I'm currently capable of reading semi-colon separated files without quotin... | <p>I've only played a little with this library <a href="http://www.codeproject.com/KB/linq/LINQtoCSV.aspx" rel="nofollow noreferrer">LINQtoCSV</a>, but I think it may help with quoted fields.</p>
| <p>How generic do you need it to be?
It is quite simple to write your own CSV parser that reads the data into a DataTable. </p>
<p>In some cases parsing the csv file can be as simple as doing a <code>File.ReadAllLines(filename)</code> and then for each line doing a <code>string.Split</code> using a semicolon as the se... | 27,865 |
<p>When looking beyond the <a href="https://en.wikipedia.org/wiki/Rapid_application_development" rel="noreferrer">RAD</a> (drag-drop and configure) way of building user interfaces that many tools encourage you are likely to come across three design patterns called <a href="http://en.wikipedia.org/wiki/Model%E2%80%93vie... | <h2>Model-View-Presenter</h2>
<p>In <strong>MVP</strong>, the Presenter contains the UI business logic for the View. All invocations from the View delegate directly to the Presenter. The Presenter is also decoupled directly from the View and talks to it through an interface. This is to allow mocking of the View in a un... | <p><strong>MVP</strong></p>
<p>MVP stands for Model - View- Presenter. This came to a picture in early 2007 where Microsoft introduced Smart Client windows applications. </p>
<p>A presenter is acting as a supervisory role in MVP which binding View events and business logic from models.</p>
<p>View event binding will... | 2,428 |
<p>I'm new using makefiles and I have some makefiles. One of them has these statements I tried to understand but I can't.</p>
<h3>What is this makefile doing?</h3>
<pre><code># debugging support
ifeq ($(DEBUG), true)
CFLAGS+=-DDEBUG -g
endif
ifeq ($(DEBUG), gdb)
CFLAGS+=-g
endif
ifeq ($(PROFILING), true)
CFLAGS+=-p... | <p>This checks for the values of environmental variables and configures the build process with specific options for the compiler ( I think ) .</p>
| <p>CFLAGS is a string of arguments that will be passed to the C compiler when it is called.</p>
<p>If you don't know what the arguments mean, you need to look at the help for your C compiler. For example:</p>
<pre><code>man cc
man gcc
cc --help
gcc --help
</code></pre>
| 40,654 |
<p>I am working on a bash script where I need to conditionally execute some things if a particular file exists. This is happening multiple times, so I abstracted the following function:</p>
<pre><code>function conditional-do {
if [ -f $1 ]
then
echo "Doing stuff"
$2
else
echo "File... | <p>This should be readable to most C programmers:</p>
<pre><code>function file_exists {
if ( [ -e $1 ] ) then
echo "Doing stuff"
else
echo "File $1 doesn't exist"
false
fi
}
file_exists filename && (
echo "Do your stuff..."
)
</code></pre>
<p>or the one-liner</p>
<pre><code>file_exists... | <p>One (possibly-hack) solution is to store the separate functions as separate scripts altogether.</p>
| 13,147 |
<p>I have been searching on the web for some example code on how we can write a custom ActiveX Control for use in Excel using .NET but so far I have found old articles suggesting that it is not supported. </p>
<p>The application we are building uses Excel as a report writer so we which to add some custom controls to t... | <p>Andrew Whitechapel writes about managed controls as ActiveX controls in Office documents. You can read his article here:</p>
<blockquote>
<p><strong><a href="http://blogs.msdn.com/andreww/archive/2008/11/24/using-managed-controls-as-activex-controls.aspx" rel="nofollow noreferrer">Using Managed Controls as Active... | <p>I would thought that you're out of luck, but did find this:</p>
<p><a href="http://dotnetslackers.com/articles/csharp/WritingAnActiveXControlInCSharp.aspx" rel="nofollow noreferrer">http://dotnetslackers.com/articles/csharp/WritingAnActiveXControlInCSharp.aspx</a></p>
<p>Gives me the willies... but it might just r... | 8,502 |
<p>Either I had a bad dream recently or I am just too stupid to google, but I remember that someone somewhere wrote that ASP.net has a Function which allows "merging" multiple JavaScript files automatically and only delivering one file to the client, thus reducing the number of HTTP Requests.</p>
<p>Server Side, you s... | <p>It's called <a href="http://msdn.microsoft.com/en-us/library/cc837190.aspx" rel="noreferrer">Script Combining</a>. There is a video example from asp.net explaining it <a href="http://www.asp.net/Learn/3.5-SP1/video-296.aspx" rel="noreferrer">here</a>.</p>
| <p>you can find <a href="http://www.codeproject.com/KB/aspnet/HttpCombine.aspx" rel="nofollow noreferrer">here</a> an usefull article for it</p>
| 7,027 |
<p>I'm trying to come up with a reusable JS or jQuery function that would allow me to test if one object is a DOM descendant of another. </p>
<p>I've seen a model of testing for </p>
<pre><code>$b.parents('nodename').length>0
</code></pre>
<p>Which is fantastic when you only need to check if an element is a child... | <p>In <a href="https://stackoverflow.com/questions/245241/jquery-ancestors-using-jquery-objects#245266">jQuery ancestors using jQuery objects</a> I suggested</p>
<pre><code>if ($(obj1).parents().index($(obj2)) >= 0) {
// obj1 is a descendant of obj2
}
</code></pre>
| <p><a href="https://stackoverflow.com/a/13588053/6951887">Alexey Lebedev's answer</a> did not work for me, because <code>Node.contains</code> is inclusive.</p>
<p>If the <strong>parent element should be distinct from its possible descendant</strong> --that was my use case--, then we need a slightly different solution: ... | 36,632 |
<p>How would you write ToUpper() if it didn't exist? Bonus points for i18n and L10n</p>
<p>Curiosity sparked by this: <a href="http://thedailywtf.com/Articles/The-Long-Way-toUpper.aspx" rel="nofollow noreferrer">http://thedailywtf.com/Articles/The-Long-Way-toUpper.aspx</a></p>
| <ol>
<li>I download the Unicode tables</li>
<li>I import the tables into a database</li>
<li>I write a method upper().</li>
</ol>
<p>Here is a sample implementation ;)</p>
<pre><code>public static String upper(String s) {
if (s == null) {
return null;
}
final int N = s.length(); // Mind the optim... | <p>in python ..</p>
<pre><code>touppe_map = { massive dictionary to handle all cases in all languages }
def to_upper( c ):
return toupper_map.get( c, c )
</code></pre>
<p>or, if you want to do it the "wrong way"</p>
<pre><code>def to_upper( c ):
for k,v in toupper_map.items():
if k == c: return v
return ... | 43,292 |
<p>This code always works, even in different browsers:</p>
<pre><code>function fooCheck() {
alert(internalFoo()); // We are using internalFoo() here...
return internalFoo(); // And here, even though it has not been defined...
function internalFoo() { return true; } //...until here!
}
fooCheck();
</code></pre>... | <p>The <code>function</code> declaration is magic and causes its identifier to be bound before anything in its code-block* is executed.</p>
<p>This differs from an assignment with a <code>function</code> expression, which is evaluated in normal top-down order.</p>
<p>If you changed the example to say:</p>
<pre><code... | <p>For the same reason the following will always put <code>foo</code> in the global namespace:</p>
<pre><code>if (test condition) {
var foo;
}
</code></pre>
| 32,721 |
<p>To experiment, I've (long ago) implemented Conway's <a href="http://en.wikipedia.org/wiki/Conway's_Game_of_Life" rel="noreferrer">Game of Life</a> (and I'm aware of <a href="https://stackoverflow.com/questions/1823/writing-a-conways-game-of-life-program">this</a> related question!).</p>
<p>My implementation wor... | <p>I am going to quote my answer from the other question, because the chapters I mention have some very interesting and fine-tuned solutions. Some of the implementation details are in c and/or assembly, yes, but for the most part the algorithms can work in any language:</p>
<blockquote>
<p>Chapters <a href="http://www... | <p>Don't exactly know how this can be done, but I remember some of my friends had to represent this game's grid with a Quadtree for a assignment. I'm guess it's real good for optimizing the space of the grid since you basically only represent the occupied cells. I don't know about execution speed though.</p>
| 6,172 |
<p>How do you support optimistic / pessimistic concurrency using NHibernate?</p>
| <p>NHibernate, by default, supports optimistic concurrency. Pessimistic concurrency, on the other hand, can be accomplished through the <code>ISession.Lock()</code> method.</p>
<p>These issues are discussed in detail in <a href="http://nhibernate.info/doc/nh/en/index.html#transactions" rel="nofollow noreferrer">this d... | <p>You can also 'just' manually compare the version numbers (assuming you've added a Version property to your entity).</p>
<p>Clearly Optimistic is the only sane option. Sometimes of course, we have to deal with crazy scenarios however...</p>
| 14,427 |
<p>This might be a old question: Why does <code>IEnumerable<T></code> inherit from <code>IEnumerable</code>?</p>
<p>This is how .NET do, but it brings a little trouble. Every time I write a class implements <code>IEumerable<T></code>, I have to write two <code>GetEnumerator()</code> functions, one for <cod... | <p><a href="https://learn.microsoft.com/en-us/archive/blogs/brada/why-does-ienumerable-inherits-from-ienumerable" rel="nofollow noreferrer">Straight from the horse's mouth</a> (Hejlsberg):</p>
<blockquote>
<p>Ideally all of the generic collection interfaces (e.g. <code>ICollection<T></code>, <code>IList<T><... | <p>This is so that it will work with classes that do not support generics. Additionally, .NET generics don't let you do things like cast IList<long> as IList<int>, so non generic versions of interfaces can be quite useful when you need a fixed base class or interface.</p>
| 27,331 |
<p>I have a couple of solutions, but none of them work perfectly.</p>
<p><strong>Platform</strong></p>
<ol>
<li>ASP.NET / VB.NET / .NET 2.0</li>
<li>IIS 6</li>
<li>IE6 (primarily), with some IE7; Firefox not necessary, but useful</li>
</ol>
<p><em>Allowed 3rd Party Options</em></p>
<ol>
<li>Flash</li>
<li>ActiveX (... | <p>I don't think there is any work around for the integrated windows authentication. What you could possibly do is save the files to a generic unprotected folder and, in the case of swfupload, use a handler to move the file when its fully uploaded</p>
| <p>In Internet Explorer, FileReference.upload (flash upload) <em>will</em> send cookies along as well.</p>
<p>This behavior breaks only when running in other browsers.</p>
| 7,306 |
<p>What design considerations must be taken when writing software for content-distribution systems, such as managing the synchronisation and distribution of data, redirecting downloads to the nearest servers and so on?</p>
<p>I am also looking for examples of open source CDN (content delivery network) software. I can ... | <p>You realize that the value a content delivery network has is purely in the number of servers they own and the proximity of the servers to end users?</p>
<p>Are you sure you're going down the right path?</p>
| <p>A CDN is not a piece of software. Please at least google or look for the thing on wiki.
<a href="http://en.wikipedia.org/wiki/Content_Delivery_Network" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Content_Delivery_Network</a></p>
| 40,132 |
<p>I did this in the past, and can't remember the correct command (I think I was using instring or soemthign?)</p>
<p>I want to list all the windows services running that have the word 'sql' in them.</p>
<p>Listing all the windows services is:</p>
<pre><code>Get-Service
</code></pre>
<p>Is there a instring function... | <pre><code>Get-Service -Name *sql*
</code></pre>
<p>A longer alternative would be:</p>
<pre><code>Get-Service | where-object {$_.name -like '*sql*'}
</code></pre>
<p>Many cmdlets offer built in filtering and support wildcards. If you check the help files (Get-Help Get-Service -full), you will see</p>
<pre><code> -... | <p>Above answers are great, but this is more useful:</p>
<pre><code>Get-WmiObject -ComputerName <INSERT COMPUTER NAME> -Class Win32_Service | where-object {$_.name -like '*sql*'}
</code></pre>
<p>It allows for this query on remote computers.</p>
| 44,872 |
<p>I am using a ScrollViewer as part of my Silverlight application. It has a horizontal orientation, and I would like it to appear such that only the scroll buttons appear, but not the scroll bar itself. Something like this crude ASCII rendering:</p>
<pre><code>------------------------------------------------------
... | <p>Here is another option. Override the default template for SCrollviewer and handle the buttons as PageUp/PageDown. My example below is a scrollviewer that scrolls vertically. You can easily change to to horizontal scrolling and change the handlers from PageUp/PageDown to Left and Right handlers.</p>
<pre><code><C... | <p>I have been searching for working solution for quite a lot of time now. And based on Louis's solution I have managed to make it working. (in WPF)</p>
<p>This solution is for <strong>horizontal</strong> scrolling.</p>
<p>Firstly, add ListView: </p>
<pre><code> <ListView ItemsSource="{Binding Items}">
... | 49,107 |
<p>This is related to the accepted answer for <a href="https://stackoverflow.com/questions/168486/whats-your-1-way-to-be-careful-with-a-live-database">What’s your #1 way to be careful with a live database</a>?</p>
<p>Suppose you create a temp table for backup purpose and make your changes in the original. The changes ... | <p>I don't think that's desirable, I'd test harder before putting the table in production, but supposing it happened anyway, you'd have two options:</p>
<p>1.- Create an ON INSERT trigger which updates the temporary backup table with the rows inserted into the new table, massaging the data to fit into the old table</p... | <p>Your database may provide this funcionality. For example in Oracle:</p>
<pre><code>Export (Your options) consistent = y
</code></pre>
<p>Of course, doing a consistent backup in a production online environment will have a performance penalty for the system.</p>
| 20,576 |
<pre><code>Regex.IsMatch( "foo", "[\U00010000-\U0010FFFF]" )
</code></pre>
<p>Throws: System.ArgumentException: parsing "[-]" - [x-y] range in reverse order.</p>
<p>Looking at the hex values for \U00010000 and \U0010FFF I get: 0xd800 0xdc00 for the first character and 0xdbff 0xdfff for the second.</p>
<p>So I gues... | <p>They're <a href="http://en.wikipedia.org/wiki/UTF-16" rel="noreferrer">surrogate pairs</a>. Look at the values - they're over 65535. A char is only a 16 bit value. How would you expression 65536 in only 16 bits?</p>
<p>Unfortunately it's not clear from the documentation how (or whether) the regular expression engin... | <p>To workaround such things with .Net regex engine, I'm using following trick:
<code>"[\U010000-\U10FFFF]"</code> is replaced with <code>[\uD800-\uDBFF][\uDC00-\uDFFF]</code>
The idea behind this is that as .Net regexes handle code units instead of code points, we're providing it with surrogate ranges as regular chara... | 47,516 |
<p>I am getting a warning when trying to include the .net 3.5 sp1 prerequisite for my setup project. The warning states Prerequisite could not found for bootstrapping.</p>
<p>Any suggestions?</p>
<p>Thanks</p>
| <p>I followed the directions in 2.3.1.1 Enable Samesite for the .NET Framework 3.5 SP1 bootstrapper package and now everything works perfect. </p>
<p>Thanks</p>
| <p>Ultimately, having had the same issue as the creator Ryan, I solved my delima by folling these steps:</p>
<p>Update the Package Data </p>
<p>Open the [Program Files]\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1 folder or %ProgramFiles(x86)%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Dot... | 27,361 |
<p>I'm looking for a solution that would let me scan files on the fly. It would need to integrate nicely with either with IIS(6.0 or 7.0) or ASP.NET. I spent some time trying to find something on the Internet but unfortunately all I've found is a COM based solution that still forces me to save files on disk (<a href="h... | <p>We use <a href="http://www.sophos.com/products/enterprise/email/security-and-control/integration/" rel="nofollow noreferrer">Sophos Anti-Virus Interface</a> (SAVI), an in-process COM-based solution which you can access using COM interop, which does support in-memory scanning.</p>
| <p><a href="http://housecall.trendmicro.com/" rel="nofollow noreferrer">http://housecall.trendmicro.com/</a> ?</p>
| 40,507 |
<p>How can I turn off the wavy red underlines in Netbeans? I don't want to be interrupted while I'm typing, and told that a half finished line of code is wrong.</p>
| <p>The answer here <a href="https://stackoverflow.com/questions/236733/netbeans-turn-off-wavy-red-underlines-how">Netbeans - Turn off - wavy red underlines - How?</a> seems to be more accurate… (though the Mac version of Netbeans 5.6.1 doesn't seem to have an ‘Advanced’ menu)</p>
| <p>Tools -> Options -> Fonts & Colors</p>
<p>Select "All Languages" in the Language list. Select "Error" in the Category list. On the right, select "None" in the Effects list and hit Ok.</p>
| 29,376 |
<p>Does anyone have any examples of using <a href="http://www.sqlite.org" rel="noreferrer">Sqlite</a> with ASP.NET membership? I am building a small "drop-in" type web application and don't want to rely on an SQL database for storing user credentials, etc. Sqlite seems like a good option, and I have been impressed wi... | <p>I am a big fan of SQLlite as well. I would say asp.net membership is good enough for the basic stuff. </p>
<p>Peter at Eggheadcafe has this right article about sqllite, check it out.
<a href="http://www.eggheadcafe.com/articles/20051119.asp" rel="noreferrer">Article</a></p>
| <p>There's a new, updated source for Roger Martin's SQLiteMembershipProvider</p>
<p>nuget package: <a href="https://www.nuget.org/packages/SQLiteMembershipProvider" rel="nofollow">https://www.nuget.org/packages/SQLiteMembershipProvider</a><br>
sourcecode: <a href="https://bitbucket.org/jkuemerle/sqlitemembershipprovid... | 45,277 |
<p>First of all, I'm quite new to 3D printing. After printing some temperature towers, stringing and bridging tests, I wanted to print the Bechys to see everything working together. I'm getting some strange "bumps" in the outer walls. It looks like for 2-3 layers, the filament gets lifted up.</p>
<p><a href="... | <p>There are a few issues that could cause this. Roughness in your z-axis lead screw as pointed out by @TheLamestUsername is a leading contender I would say. I'd also extended that answer to include checking the belts for your X and Y axes as well as making sure that the rods the gantry slide on are smooth since the fa... | <p>The fact that the bumps were in the same spots on multiple occasions points to z-axis problems. Turn your printer off and manually turn the z-axis all the way from bottom to top. If there are any tight spots, there is some <em>z-axis binding</em>. If there are no tight spots, skip to the last paragraph.</p>
<p>Try t... | 1,688 |
<p>As title but would like the flexibility to specify how the output xml file will look like. Any free tool available on windows platform that I can use to achieve that? Thanks</p>
| <p>You could read it into a dataset and use the dataset's WriteXML methods to output to XML. </p>
<p>It looks like <a href="http://ajwelch.blogspot.com/2007/02/csv-to-xml-converter-in-xslt-20.html" rel="nofollow noreferrer">this guy</a> used XSLT.</p>
| <p>Hmm.. I am looking for more a ready use tool, not really for programming purpose, I checked this <a href="http://csv2xml.sourceforge.net/" rel="nofollow noreferrer">http://csv2xml.sourceforge.net/</a> before posting but it lack the flexibility for me to configure how the output format look like,</p>
| 16,657 |
<p>This is my setup:</p>
<ul>
<li>SQL server 2005</li>
<li>UserA already setup as user on the server but not on databaseA.</li>
<li>GRANT Execute ON [GetOrders] TO [UserA] AS [dbo]</li>
</ul>
<p>As you can see, i have missed out a step. I haven't added UserA to the database yet. This doesn't fail and lets me grant ... | <p>This is the part throwing you off.</p>
<blockquote>
<p>TO [UserA] AS [dbo]</p>
</blockquote>
<p>Ditch the "as dbo" part. It's granting the right to the dbo user. Without the "AS [dbo]" part it will throw an error.</p>
| <p>It's probably allowed to give DBAs the flexibility to modify the users and permissions when the database is not attached to your production server. I don't believe you have to re-add the users. Take a look at this guy's script: <a href="http://www.lazycoder.com/weblog/2007/06/04/re-associate-sql-users-with-logins/... | 49,908 |
<p>is it possible to create my own custom keys in the asp.net web.config file and iterate through them with C#? How do you do both (where do I put the key? what format?)? I have an application for an intranet that does certain things based upon the IP address of the client. Instead of hard coding those in the codeb... | <p>I think this should do it for you...</p>
<p>This is in your web.config...</p>
<pre><code><configSections>
<section name="DataBaseKeys" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>
<... | <p>You can create a <a href="http://msdn.microsoft.com/en-us/library/2tw134k3(VS.80).aspx" rel="nofollow noreferrer">Custom Configuration Section</a>. That allows you to put your, umm, custom config in web.config, and access it in whichever way you see fit.</p>
| 41,021 |
<p>Greetings,</p>
<p>I've got a bat script which copies certain information from a computer onto a USB hard drive using Robocopy. The hard drive is FAT formatted and therefore doesn't support directories with extended attributes, leading me to robocopy error 282 <a href="http://forums.hexus.net/thecus-care-hexus/1219... | <p>I found I only got the 282 error when copying direcories with robocopy. So I used xcopy with /T /E to create the directory structure. I was then able to use robocpy to copy all the files without error.</p>
| <p>Convert FAT USB hard drive to NTFS using convert command (converting in this direction won't delete the data):
<a href="http://technet.microsoft.com/en-us/library/bb456984.aspx" rel="nofollow">http://technet.microsoft.com/en-us/library/bb456984.aspx</a></p>
<p>eg:</p>
<pre><code>convert e: /fs:ntfs
</code></pre>
| 41,394 |
<p>Can anyone recommend a dropdownlist control for asp.net (3.5) that can render option groups? Thanks</p>
| <p>I've used the standard control in the past, and just added a simple <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.adapters.controladapter.aspx" rel="nofollow noreferrer">ControlAdapter</a> for it that would override the default behavior so it could render <optgroup>s in certain places. This works... | <p>I expanded upon <a href="https://stackoverflow.com/a/3104581/1465881">mkl's answer</a> to make a DropDownList control to which you can DataBind. Here's the result (which may be subject to improvement):</p>
<pre><code>public class UcDropDownListWithOptGroup : DropDownList
{
public const string OptionGroupTag = "... | 15,791 |
<p>I want to create a WCF-service hosted in IIS6 and disable anonymous authentication in IIS. And don't use SSL.</p>
<p>So only way I have is to use basicHttpBinging with <code>TransportCredentialOnly</code>, itsn't it?</p>
<p>I create a virtual directory, set Windows Integrated Auth and uncheck "Enable Anonymous Acc... | <p>The MEX endpoint may still be the problem (see this <a href="http://ahmed0192.spaces.live.com/blog/cns!FD6F44C91F5D2AD9!160.entry" rel="noreferrer">post</a>). Try disabling MEX like this:</p>
<p></p>
<pre><code><services>
<!-- Note: the service name must match the configuration name for the service im... | <p>To get VS wcf service project (new sample project) to work with authentication under IIS, you have to:</p>
<p>1) Allow Anonymous access in IIS<br>
2) Prefix your public methods with a attribute like this:</p>
<pre><code>[PrincipalPermission(SecurityAction.Demand, Role = "MyADGroup")]
public string SendMyMessage(st... | 26,971 |
<p>I have a table that has an insert trigger on it. If I insert in 6000 records into this table in one insert statement from a stored procedure, will the stored procedure return before the insert trigger completes?</p>
<p>Just to make sure that I'm thinking correctly, the trigger should only be called (i know 'called'... | <p>Your insert trigger will run once for the entire insert statement. This is why it is important to use the <code>inserted</code> temporary table to see what has actually been inserted, and not just select the most recent single record, or something like that.</p>
<p>I just tested an insert and update trigger and ind... | <p>You should use cursor in insert statement to process trigger row.
Because Triggers in SQL Server fire once per statement, not once per row.</p>
| 25,788 |
<p>Use case: 3rd party application wants to programatically monitor a text file being generated by another program. Text file contains data you want to analyze as it's being updated.</p>
<p>I'm finding a lot of answers to this question wrapped around FileSystemWatcher but let's say you are writing an application for a... | <p>You can monitor a directory with <a href="http://msdn.microsoft.com/en-us/library/aa364417.aspx" rel="nofollow noreferrer">FindFirstChangeNotification</a> works on any windows.<br>
It's efficent if you know where the file is - otherwise you can use the virtual driver/Filemon described below to check for changes anyw... | <p>looks like this : <a href="https://stackoverflow.com/questions/231547/tracing-which-process-that-has-opened-a-particular-file#231585">Tracing which process that has opened a particular file</a></p>
<p>again <a href="http://technet.microsoft.com/en-us/sysinternals/default.aspx" rel="nofollow noreferrer">sysinternal... | 28,688 |
<p>I have the following code:</p>
<pre><code>$bind = new COM("LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local");
</code></pre>
<p>When I execute it from a command-prompt, it runs fine. When it runs under IIS/PHP/ISAPI, it barfs.</p>
<pre><code>Fatal error: Uncaught exception 'com_exception' with messa... | <p>Since you're using Windows Authentication in IIS, you may have some security events in the Windows Event log. I would check the Event log for Security Events as well as Application Events and see if you're hitting any sort of permissions issues. </p>
<p>Also, since you're basically just communicating to AD via LDAP... | <p>Well, if you want to use LDAP, let me point you to the LDAP authentication code we use for Maia Mailguard: look for the function named <a href="https://www.maiamailguard.com/maia/browser/branches/1.0/php/auth.php" rel="nofollow noreferrer">lauth_ldap</a></p>
<p>I think it requires ldap version 3, so you have to set... | 11,015 |
<p>How do I add a the <a href="http://github.com/technoweenie/restful-authentication/tree/master" rel="nofollow noreferrer">http://github.com/technoweenie/restful-authentication/tree/master</a> plugin to my Rails project and the commit it to the git repo ? I need it to be committed with the project.</p>
<p>I have tri... | <p>From the README:</p>
<ul>
<li>either use git clone git://github.com/technoweenie/restful-authentication.git restful_authentication</li>
<li>or rename the plugin’s directory to be restful_authentication after fetching it.</li>
</ul>
<p>Did you do that?</p>
<p>After doing a git clone, you'll want to <code>rm -rf re... | <p>Either way git status doesn't report anything that needs to be added, it's like it doesn't see it.</p>
| 42,581 |
<p>It seems that HTML 5 is going to be supported (partially) by Firefox 3.1 and other browsers. It is adding support for video and audio as tags, but these are new tags that XHTML 1.0 Transitional does not recognize. What is the behavior supposed to be if I use a new HTML 5 tag in a future version of Firefox but use th... | <p>HTML5 is so much easier to write than XHTML 1.0.</p>
<ol>
<li><p>You don't have to manually declare the "<a href="http://www.w3.org/1999/xhtml" rel="noreferrer">http://www.w3.org/1999/xhtml</a>" namespace.</p></li>
<li><p>You don't have to add type attributes to script and style elements (they default to text/javas... | <p>Your <a href="http://en.wikipedia.org/wiki/Document_Type_Declaration" rel="nofollow noreferrer">doctype</a> will tell the browser whether you're using HTML5 or XHTML. You can't just shove a tag from one doctype into a document of another doctype and expect it to work.
Without a doctype, it's all just tag soup anywa... | 32,061 |
<p>The question of whether P=NP is perhaps the most famous in all of Computer Science. What does it mean? And why is it so interesting?</p>
<p>Oh, and for extra credit, please post a proof of the statement's truth or falsehood. :)</p>
| <p>P stands for polynomial time. NP stands for non-deterministic polynomial time. </p>
<p>Definitions:</p>
<ul>
<li><p><strong>Polynomial time</strong> means that the complexity of the algorithm is O(n^k), where n is the size of your data (e. g. number of elements in a list to be sorted), and k is a constant.</p></... | <p>A short summary from my humble knowledge:</p>
<p>There are some easy computational problems (like finding the shortest path between two points in a graph), which can be calculated pretty fast ( O(n^k), where n is the size of the input and k is a constant (in the case of graphs, it's the number of vertexes or edges)... | 13,646 |
<p>I have a combo box on a WinForms app in which an item may be selected, but it is not mandatory. I therefore need an 'Empty' first item to indicate that no value has been set.</p>
<p>The combo box is bound to a DataTable being returned from a stored procedure (I offer no apologies for Hungarian notation on my UI con... | <p>There are two things you can do:</p>
<ol>
<li><p>Add an empty row to the <code>DataTable</code> that is returned from the stored procedure.</p>
<pre><code>DataRow emptyRow = hierarchies.NewRow();
emptyRow["guid"] = "";
emptyRow["ObjectLogicalName"] = "";
hierarchies.Rows.Add(emptyRow);
</code></pre>
<p>Create a D... | <p>Er, can't you just add a default item to the ComboBox after data binding?</p>
| 24,343 |
<p>I have a huge file, where I have to insert certain characters at a specific location. What is the easiest way to do that in C# without rewriting the whole file again.</p>
| <p>Filesystems do not support "inserting" data in the middle of a file. If you really have a need for a file that can be written to in a sorted kind of way, I suggest you look into using an embedded database.</p>
<p>You might want to take a look at <a href="http://sqlite.org/" rel="noreferrer">SQLite</a> or <a href="h... | <p>Depending on the scope of your project, you may want to decide to insert each line of text with your file in a <strong>table datastructure. Sort of like a database table</strong>, that way you can insert to a specific location at any given moment, and not have to read-in, modify, and output the entire text file each... | 12,386 |
<p>The company I work for uses an ASP.NET grid component from a commercial vendor, but won't upgrade the buggy old version we have to a newer version because of cost. Are there open-source alternatives to these Uber-Grids that we could take advantage of? </p>
<p>I'm specifically looking for hierarchical drill-down ca... | <p>Grid Wrapper Control using ExtJS <a href="http://www.codeplex.com/ExtJsExtenderControl" rel="nofollow noreferrer">http://www.codeplex.com/ExtJsExtenderControl</a></p>
<p>Check out the <a href="http://extendersamples.rodiniz.com/#" rel="nofollow noreferrer">DEMO page</a> for the grouping feature, not sure how many l... | <p>Try this opensource project that extends ASP.NET GridView : <a href="http://johnsobrepena.blogspot.com/2010/01/coolgridview-new-release-resizable.html" rel="nofollow noreferrer">http://johnsobrepena.blogspot.com/2010/01/coolgridview-new-release-resizable.html</a></p>
<ol>
<li>Fixed column header, footer and
pager</... | 33,296 |
<p>I have a function that gets x(a value) and xs(a list) and removes all values that are bigger than x from the list. Well it doesn't work, can you tell me why?</p>
<pre><code>(defun biggerElems(x xs)
(let ((xst))
(dolist (elem xs)
(if (> x elem)
(setf xst (remove elem xs))))
xst))
</code... | <p>I think it's this line that's not right:</p>
<pre><code>(setf xst (remove elem xs))))
</code></pre>
<p>The first argument to <code>setf</code> is the place, followed by the value. It looks like you have it backwards (and <code>xst</code> is either <code>nil</code> or uninitialized).</p>
<p>You might find it easi... | <blockquote>
<p>What was the '#' for? It didn't
compile with it.</p>
</blockquote>
<p>Typo. Normally you refer to functions with <code>#'</code> (like <code>(remove-if #'oddp list)</code>), but when I was editing, I forgot to remove the '#'.</p>
| 6,856 |
<p>I have a web application that receives messages through an HTTP interface, e.g.:</p>
<pre><code>http://server/application?source=123&destination=234&text=hello
</code></pre>
<p>This request contains the ID of the sender, the ID of the recipient and the text of the message.</p>
<p>This message should be pr... | <p>You should decouple from the JPA interface and use the bare TopLink API. You can probably chuck the objects you're persisting into a UnitOfWork and commit the UnitOfWork on your schedule (sync or async). Note that one of the costs of em.persist() is the implicit clone that happens of the whole object graph. TopLink ... | <p>What is your measure of "requests/sec"? In other words, what happens for the 31st request? What resource is being blocked? If it is the front-end/servlet/web portion, can you run em.persist() in another thread and return immediately?</p>
<p>Also, are you creating transactions each time? Are you creating EntityM... | 9,037 |
<p>Consider these two C++ header cases:</p>
<p>Case 1:</p>
<pre><code>class Test {
public:
static int TEST_DATA[];
};
int Test::TEST_DATA[] = { 1, 2, 3, 4 };
</code></pre>
<p>Case 2:</p>
<pre><code>class Test {
public:
static int const TEST_DATA[];
};
int const Test::TEST_DATA[] = { 1, 2, 3, 4 };
</code... | <p>The compiler may put the data into a different section of the binary depending on whether it's const or not - that's entirely at the discretion of the compiler.</p>
| <p>Although there are no guarantees, the const is unlikely to break binary compatibility in the case of an array, so shared libraries should end up with the same layout.</p>
<p>Note this would likely <em>not</em> be the case for a single int:</p>
<pre><code>struct Test
{
static int const TEST;
};
int const Test::... | 20,182 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file">How can I convert my java program to an .exe file ?</a> </p>
</blockquote>
<p>I've used JSmoothGen in the past, but recently we've seen a number of machi... | <p>I use <a href="http://launch4j.sourceforge.net/" rel="noreferrer">Launch4J</a> which supports Windows, Mac and Linux. I suggest forgoing the somewhat flaky GUI tool and just writing the (short, readable) config file yourself.</p>
| <p>It is also not entirely necessary to make an .exe. On Windows, at least, .jar files are executable so long as there is a Java runtime installed and the .jar extension has been set up on the machine.</p>
<p>[NOTE: I just discovered that something that has broken the file association, which had previously worked for... | 39,852 |
<p>My computer often produces a "ding" sound, and I can't associate it with anything. Is it possible to programmatically determine the source of the beeps? For example can I hook the sound driver? If so, can you point out some examples or references?</p>
| <p>Omer, this isn't a programming question, despite your edit.</p>
<p>No programming is necessary. Close applications one by one over time until the ding stops. </p>
| <p>What operating system is this? If you're on Linux, you can use the <a href="http://linux.die.net/man/8/lsof" rel="nofollow noreferrer"><code>lsof(8)</code></a> command to see what files every process has open. If a process is playing sound, it will have the sound device file open, so you can grep for it like so:</... | 44,376 |
<p>We are managing our development with Subversion over HTTPS, Bugzilla, and Mediawiki. Some of our developers have expressed an interest in migrating to Trac, so I have to evaluate what the cost of doing so would be. </p>
<p>For both the wiki and bugzilla, we would need to either migrate the existing data into Trac... | <p>Their are 2 problems both these packages try to solve: Lack of a CollectionChanged event and Dynamic result sets. There is one additional problem bindable solves, additional automatic event triggers.</p>
<hr>
<p><strong>The First Problem</strong> both packages aim to solve is this: </p>
<blockquote>
<p>Objec... | <p>I think Bindable LINQ and continuous LINQ are about the same: they provides observing for changes in LINQ computation. Implementation and API provided may some differ. It seems my <a href="https://github.com/IgorBuchelnikov/ObservableComputations" rel="nofollow noreferrer">ObservableComputations</a> library covers ... | 20,249 |
<p>I know we cannot do this at class level but at method level we can always do this. </p>
<pre><code>var myList=new List<string> // or something else like this
</code></pre>
<p>This question came to my mind since wherever we declare variable like this. We always provide the type information at the RHS of the e... | <p>There are technical issues with implementing this feature. The common cases seem simple but the tougher cases (e.g., fields referencing other fields in chains or cycles, expressions which contain anonymous types) are not.</p>
<p>See Eric Lippert's blog for an in-depth explanation: <a href="http://blogs.msdn.com/er... | <p>It's not as simple as implementing <strong>var</strong> in a method since you also have to take into acccount different modifiers and attributes like so:</p>
<pre><code>[MyAttribute()] protected internal readonly var list = new List<T>();
</code></pre>
<p>What I would really have liked is a type-inferenced <... | 19,277 |
<p>I'm writing a Linux kernel module that needs to open and read files. What's the best way to accomplish that?</p>
| <p>Can I ask why are you trying to open a file?</p>
<p>I like to follow Linux development (out of curiosity, I'm not a kernel developer, I do Java), and I've seen discussion of this question before. I was able to find a <a href="http://lkml.indiana.edu/hypermail/linux/kernel/0005.3/0061.html" rel="noreferrer">LKML mes... | <p>You can also find some informations about sys_call_open in this <a href="http://tldp.org/LDP/lkmpg/2.6/html/lkmpg.html#AEN976" rel="nofollow noreferrer">Linux Kernel Module Programing Guide</a>.</p>
| 34,705 |
<p><a href="https://electronics.stackexchange.com/questions/244366/how-do-i-tell-if-my-thermistors-are-10k-or-100k">This question</a> was migrated to electronics.SE. To me the migration makes no sense:</p>
<ul>
<li><p>The question deals with a problem that is relevant to the users of this site</p></li>
<li><p>This sit... | <p>The question was migrated because the specific question of "<em>How do I tell if my Thermistors are 10k or 100k?</em>" is going to be best answered by users of Electrical Engineering SE. This also provides the SE network with more appropriate traffic based on the question at hand.</p>
<p>However, if the question of... | <p>I don't think the question should be migrated. For EE.SE, the question is just stupidly obvious. Even a fairly inexperienced lab tech. would know how to go about answering that question. It really isn't an electronic engineering question at all.</p>
<p>Here, the answer (assuming the question is actually the questio... | 32 |
<p>How do you connect to a remote server via IP address in the manner that TOAD, SqlDeveloper, are able to connect to databases with just the ip address, username, SID and password?</p>
<p>Whenever I try to specify and IP address, it seems to be taking it locally.</p>
<p>In other words, how should the string for cx_O... | <p>I like to do it this way:</p>
<pre><code>ip = '192.168.0.1'
port = 1521
SID = 'YOURSIDHERE'
dsn_tns = cx_Oracle.makedsn(ip, port, SID)
db = cx_Oracle.connect('username', 'password', dsn_tns)
</code></pre>
<p>One of the main reasons I like this method is that I usually have a TNSNAMES.ORA file lying around somepla... | <pre><code>import cx_Oracle
ip = '172.30.1.234'
port = 1524
SID = 'dev3'
dsn_tns = cx_Oracle.makedsn(ip, port, SID)
conn = cx_Oracle.connect('dbmylike', 'pass', dsn_tns)
print conn.version
conn.close()
</code></pre>
| 30,452 |
<p>My custom homebrew photography processing software, running on 64 bit Linux/GNU, writes out PNG and TIFF files. These are to be sent to a quality printing shop to be made into fine art. Working with interior designers - it's important to get the colors just right! </p>
<p>The print shops usually have no troub... | <p>Take a look at LittleCMS</p>
<p><a href="http://www.littlecms.com/" rel="nofollow noreferrer">http://www.littlecms.com/</a></p>
<p>This page has the code for applying it to TIFF</p>
<p><a href="http://www.littlecms.com/newutils.htm" rel="nofollow noreferrer">http://www.littlecms.com/newutils.htm</a></p>
<p>The b... | <p>As a GNU/Linux user, you’ll want to consider <strong>DispcalGUI</strong> – <a href="http://dispcalgui.hoech.net/" rel="nofollow">http://dispcalgui.hoech.net/</a> – a GNOME-based GUI that centralizes color management, ICC profile management, and (crucially for your case) device calibration. It can talk to well-known ... | 17,749 |
<p>I have created an item swapper control consisting in two listboxes and some buttons that allow me to swap items between the two lists. The swapping is done using javascript. I also move items up and down in the list. Basically when I move the items to the list box on the right I store the datakeys of the elements (... | <p>The problem is that the saved view state of the list and the data received on postback do not match. The event validation issue is most likely just one of the possible problems that might appear because of this approach. The architecture of webforms does not allow this kind of uses and, most likely, there will be mo... | <p>It's complaining because the selected item in a list was not present in the list when it was rendered. Consider using PageMethods via AJAX to get your data back to your form instead of PostBack. Or use a non-input controls to hold the data -- like unordered lists that you move list elements back and forth between.... | 26,174 |
<p>I have an assortment of database objects (tables, functions, views, stored procedures) each scripted into its own file (constraints are in the same file as the table they alter) that I'd like to be able execute in an arbitrary order. Is this possible in SQL Server 2005?</p>
<p>Some objects as an example:<br>
Table... | <p>In my experience the most problematic issue is with views, which can reference recursively. I once wrote a utility to iterate through the scripts until the errors were all resolved. Which only works when you're loading everything. Order was important - I think I did UDTs, tables, FKs, views (iteratively), SPs and UD... | <p>I found <a href="http://decipherinfosys.wordpress.com/2008/02/20/disableenable-foreign-key-and-check-constraints-in-sql-server/" rel="nofollow noreferrer">this page</a> where the author has written a nice procedure for doing exactly what you are talking about. Sounds like you just need to have two versions of it, on... | 49,690 |
<p>As the DetailsView uses <td> cells for both the header text and the data, I was wondering whether the behaviour of the control can be overridden to render the HeaderText of each row in a <th> cell?</p>
<hr>
<p>@Joel Coehoorn Thanks for the quick reply, but I was kind of hoping I wouldn't have to go dow... | <p>I managed to find a way around this by using the ItemCreaed event handler and swapping the <td> cell for a <th> cell like this:</p>
<pre><code>if (view.Rows.Count > 0) {
// swap each header <td> cell for a <th> cell
foreach (DetailsViewRow row in view.Rows) {
if (row.RowTy... | <p>inherit from DetailsView and paste the code.
this eliminate the need to recreate the header cell (as suggested in Ian's answer)</p>
<pre><code>protected override void InitializeRow(DetailsViewRow row, DataControlField field)
{
if (row.RowType == DataControlRowType.DataRow && field.ShowHeader)
... | 39,289 |
<p>I have an application that is causing a lot of headaches. It's a .NET app connecting to SQL Server 2005 via a web service. The program has grid that is filled by a long running stored procedure that is prone to timing out. In the case when it does time out and a SqlException is thrown, there is no execption handling... | <p>Since a SqlConnection closes while disposing i usually use this syntax</p>
<pre><code>using (SqlConnection conn = new SqlConnection())
{
// SqlCode here
}
</code></pre>
| <p>You could run out of connections available if it happens often enought, you should use a finally everywhere you execute a command to close the connection.</p>
| 17,398 |
<p>First some background. I am trying to run <a href="http://www.communityengine.org/" rel="nofollow noreferrer">Community Engine</a> on a fresh install of Ubuntu. CE is a open src social networking plugin running on Rails. I was able to get CE up and running on my windows box w/o issue. I have decided to use Ubuntu 8.... | <p>The "problem" is not coming from CommunityEngine itself, but with the underlying 'engines' plugin (<a href="http://github.com/lazyatom/engines" rel="nofollow noreferrer">http://github.com/lazyatom/engines</a>).</p>
<p><a href="http://github.com/lazyatom/engines/tree/master/boot.rb" rel="nofollow noreferrer">looking... | <p>The "problem" is not coming from CommunityEngine itself, but with the underlying 'engines' plugin (<a href="http://github.com/lazyatom/engines" rel="nofollow noreferrer">http://github.com/lazyatom/engines</a>).</p>
<p><a href="http://github.com/lazyatom/engines/tree/master/boot.rb" rel="nofollow noreferrer">looking... | 33,246 |
<p>need ask you about some help.</p>
<p>I have web app running in Net 2.0.<br>
I wanna ask what storage (cache, session, file) I should use for my objects as they have different scope of using. Can be divide into several groups:<br>
1) objects related directly to visitor (e.g. details about visitor that are received a... | <ol>
<li><p>Objects related directly to the visitor should be stored in <code>Session</code> although excessive use of <code>Session</code> and many users can lead to scalability issues.</p></li>
<li><p>Objects that are shared for every visitory should be stored in <code>Cache</code> so they will go out of scope if the... | <p>Objects relative per visitor should be stored in Session. This is unique per visitor, but tends to be frequently flushed, this also scales poorly when you move to a multiple server environment.</p>
<p>Objects relative to the application as a whole should be stored in the ASP.NET Cache.</p>
| 39,491 |
<p>Essentially I want to know if in VB.NET 2005 if using a sqlcommand and then reusing it by using the NEW is wrong. Will it cause a memory leak.</p>
<p>EG:</p>
<pre><code>try
dim mySQL as new sqlcommand(sSQL, cnInput)
// do a sql execute and read the data
mySQL = new sqlcommand(sSQLdifferent, cnInput)
// do sq... | <p>Just to extend what Longhorn213 said, here's the code for it:</p>
<pre><code>Using mysql as SqlCommand = new SqlCommand(sSql, cnInput)
' do stuff'
End Using
Using mysql as SqlCommand = new SqlCommand(otherSql, cnInput)
' do other stuff'
End Using
</code></pre>
<p>(edit) Just as an FYI, using automatically wra... | <p>No, the garbage collector will find the old version of mySql and deallocate it in due course.</p>
<p>The garbage collector should pick up anything that's been dereferenced as long as it hasn't been moved into the Large Object Heap.</p>
| 6,388 |
<p>I'm about to put a beta version of the site I'm working on up on the web. It needs to have a beta code to restrict access. The site is written in django.</p>
<p>I don't want to change the fundamental Auth system to accommodate a beta code, and I don't care particularly that the security of the beta code is iron-cla... | <p>Start with <a href="http://www.djangosnippets.org/snippets/136/" rel="noreferrer">this Django snippet</a>, but modify it to check <code>request.session['has_beta_access']</code>. If they don't have it, then have it return a redirect to a "enter beta code" page that, when posted to with the right code, sets that sess... | <p>You should be able to add <code>@login_required</code> decorators across the board and be done with it. Unless you have a boat-load of view functions, it shouldn't be too horrible.</p>
| 13,122 |
<p>Anyone point my at a utility for syncing sql server logins after restoring a database to a different server? </p>
<p>I know I can do it with scripts, but I've been using a wonderful little utility - 'Db Maint Sync SQL Logins' (<a href="http://www.dbmaint.com/SyncSqlLogins.asp" rel="nofollow noreferrer">http://www.... | <p><code>sp_change_users_login</code> with the <code>Update_One</code> action can map a login in a database to a user on a new server.</p>
| <p>The sync sql server logins tool by dbmaint has a sql server 2005 version:
<a href="http://www.karaszi.com/SQLServer/util_sync_logins.asp" rel="nofollow noreferrer">link text</a></p>
| 28,456 |
<p>I am trying to wire up dependency injection with Windsor to standard asp.net web forms. I think I have achieved this using a HttpModule and a CustomAttribute (code shown below), although the solution seems a little clunky and was wondering if there is a better supported solution out of the box with Windsor?</p>
<p>... | <p>I think you're basically on the right track - If you have not already I would suggest taking a look at Rhino Igloo, an WebForms MVC framework, <a href="http://ayende.com/Blog/archive/2007/09/03/Rhino-Igloo-ndash-MVC-Framework-for-Web-Forms.aspx" rel="noreferrer">Here's a good blog post on this</a> and the source is ... | <p>Rather than doing it like this, you could also use a type resolver directly with something like:</p>
<pre><code>ILogger Logger = ResolveType.Of<ILogger>();
</code></pre>
| 37,500 |
<p>Here is the complete install command to CPAN and the output:</p>
<pre><code>sudo perl -MCPAN -e "install Bundle::CPAN"
CPAN: Storable loaded ok (v2.13)
Going to read /home/delgreco/.cpan/Metadata
Database was generated on Mon, 08 Dec 2008 03:27:10 GMT
CPAN: LWP::UserAgent loaded ok (v2.033)
CPAN: Time::HiRes load... | <p>This looks important:</p>
<pre>
Your urllist is empty! The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/'
</pre>
<p>Perhaps run <code>sudo cpan</code>, then <code>o conf init</code> or <code>o conf urllist push http://cpan.yahoo.com/</code> (for example) to get your <code>urllist</code> straig... | <p>At a guess:</p>
<pre><code>sudo perl -MCPAN -e "install YAML"
</code></pre>
| 45,681 |
<p><em>Premise</em>: The requirements for an upcoming project include the fact that no one except for authorized users have access to certain data. This is usually fine, but this circumstance is not usual. The requirements state that there be no way for even the programmer or any other IT employee be able to access thi... | <p>If you can have javascript on the page, then I don't think there's anything you can do. If you can see it in a browser, then that means it's in the DOM, which means you can write a script to get it and send it to you after it has been decrypted.</p>
<p>Aren't these problems usually solved via controls:</p>
<ol>
<... | <p>If this is truly a requirement, the only way to guard against this is to hire an outside firm to audit the code prior to releasing the software, and that's going to be very expensive.</p>
| 39,468 |
<p>Does anyone know where I can find an algorithm that given a set of values (dates) for an axis I can calculate a reasonable scale and tick interval?</p>
| <p>The tick interval is going to be dependent on your display area. You'll need to take the width of your graph (I'm assuming time is on the X axis) and the width of a date string in your selected font into account in order to come up with a good scale.</p>
<p>The basic algorithm will go something like this.</p>
<ul... | <p>I've been using the jQuery <a href="http://flot.googlecode.com/" rel="nofollow noreferrer">flot</a> graph library. It's open source and does axis/tick generation quite well. I'd suggest looking at it's code and pinching some ideas from there.</p>
| 29,240 |
<p>Definition of variables in use:</p>
<pre><code>Guid fldProId = (Guid)ffdPro.GetProperty("FieldId");
string fldProValue = (string)ffdPro.GetProperty("FieldValue");
FormFieldDef fmProFldDef = new FormFieldDef();
fmProFldDef.Key = fldProId;
fmProFldDef.Retrieve();
string fldProName = (string)fmProFldDef.GetProperty("F... | <p>Are you sure that findControl is returning a value? </p>
<p>Is hTxtBox.Text a property that does any computation on a set that could be throwing the NullReferenceException?</p>
| <p>Looks like fmProFldDef's FieldName property is screwy. Did you verify that it's getting the hTxtBox's client Id?</p>
| 19,764 |
<p>Currently, pure CAD questions are out of scope of our Stack, but we have quite some cases that edge, where the question about the CAD is about how to make a model printable or design principles or such.</p>
<p>Where do we draw the line in the sand? <a href="https://3dprinting.meta.stackexchange.com/questions/204/the... | <p>I struggled with the same question since I saw the edit, good that you brought this to Meta! Thanks!</p>
<p>As the community of regular and active members is limited, I think it is okay to welcome people in a comment or an answer. It would be a shame to scare people away after their first question, resulting in aban... | <p>I struggled with the same question since I saw the edit, good that you brought this to Meta! Thanks!</p>
<p>As the community of regular and active members is limited, I think it is okay to welcome people in a comment or an answer. It would be a shame to scare people away after their first question, resulting in aban... | 78 |
<p>How can I add very large numbers in C++?</p>
| <p>consider a "bignum" library like: <a href="http://gmplib.org/" rel="nofollow noreferrer">http://gmplib.org/</a> or <a href="http://ttmath.slimaczek.pl/ttmath" rel="nofollow noreferrer">http://ttmath.slimaczek.pl/ttmath</a>. take a look at a simple bignum class: <a href="http://www.circlemud.org/~jelson/560/" rel="no... | <p>You could use a library like <a href="http://www.cdc.informatik.tu-darmstadt.de/TI/LiDIA/" rel="nofollow noreferrer">LiDIA</a> for a 'big integer' class.</p>
| 44,110 |
<p>When I am using Bitvise Tunnelier and I spawn a new xterm window connecting to our sun station everything works nicely. We have visual slick edit installed on the sun station and I have been instructed to open it using the command vs&. When I do this I get the following:</p>
<pre><code>fbm240-1:/home/users/ajah... | <p>You're going to need an Xwindows server on your Windows box in order to run graphical Unix apps remotely on the Sun server and have it display on your Windows box. I don't think Tunnelier supports Xwindows tunneling. Take a look at Xming, an Xwindows server for Windows that comes with Putty, an ssh client:</p>
<p... | <p>What is your DISPLAY environment variable in the shell where you run vs? Is it really "<Default Display>"? If yes, try setting it up to ":0" or "<em>yourhostname</em>:0" and then running vs again (you might need to use <code>xhost +</code> on your host).</p>
<p>That's only a fraction of the clarifications needed... | 16,179 |
<p>Is there a way to respond to the back button being hit (or backspace being pressed) in javascript when only the location hash changes? That is to say when the browser is not communicating with the server or reloading the page.</p>
| <p>Use the <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers.onhashchange" rel="noreferrer"><code>hashchange</code></a> event:</p>
<pre><code>window.addEventListener("hashchange", function(e) {
// ...
})
</code></pre>
<p>If you need to support older browsers, check out the <a href="https... | <p><code>onLocationChange</code> may also be useful. Not sure if this is a Mozilla-only thing though, appears that it might be.</p>
| 16,567 |
<p>A complicated-sounding term with no good explanations from a simple google search... are there any more academically-oriented folk who could explain this one?</p>
| <p>Relational parametricity seems to be the property that a function abstracted over types (like a generic in Java) can have. If it has this property, it means it never inspects its type argument or deconstructs it / uses it in some special way. For example, the function "id or inc" here is not relationally parametric:... | <p>Okay, just going to hazard a COMPLETE guess here, based on this</p>
<p><a href="http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4276578" rel="nofollow noreferrer">http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4276578</a></p>
<p>I'd say it's a mathematical representation of parametric polymorphism... | 35,439 |
<p>In WPF, we are creating custom controls that inherit from button with completely drawn-from-scratch xaml graphics. We have a border around the entire button xaml and we'd like to use that as the location for updating the background when MouseOver=True in a trigger. What we need to know is how do we update the back... | <p>In your <code>ControlTemplate</code>, give the <code>Border</code> a <code>Name</code> and you can then reference that part of its visual tree in the triggers. Here's a very brief example of restyling a normal <code>Button</code>:</p>
<pre><code><Style
TargetType="{x:Type Button}">
<Setter
... | <p>You would want to add a trigger like this...</p>
<p>Make a style like this:</p>
<pre><code><Style x:Key="ButtonTemplate"
TargetType="{x:Type Button}">
<Setter Property="Foreground"
Value="{StaticResource ButtonForeground}" />
<Setter Property="Template">
... | 16,411 |
<p>How would I design and organize tests for the concrete methods of an abstract class? Specifically in .NET.</p>
| <p>You have to create a subclass that implements the abstract methods (with empty methods), but none of the concrete ones. This subclass should be for testing only (it should never go into your production code). Just ignore the overridden abstract methods in your unit tests and concentrate on the concrete methods.</p... | <p>Any reason not to just include that in the testing of one of the instances?</p>
<p>If that doesn't work, you could probably create a subclass just for testing with no unique functionality of its own.</p>
| 13,054 |
<p>ok so my issue is i have the string '\222\222\223\225' which is stored as latin-1 in the db. What I get from django (by printing it) is the following string, 'ââââ¢' which I assume is the UTF conversion of it. Now I need to pass the string into a function that
does this operation: </p>
<pre><code>strdecryptedPas... | <p>Your first error 'chr() arg not in range(256)' probably means you have underflowed the value, because chr cannot take negative numbers. I don't know what the encryption algorithm is supposed to do when the inputcounter + 33 is more than the actual character representation, you'll have to check what to do in that cas... | <p>Well its because its been encrypted with some terrible scheme that just changes the ord() of the character by some request, so the string coming out of the database has been encrypted and this decrypts it. What you supplied above does not seem to work. In the database it is latin-1, django converts it to unicode, ... | 34,563 |
<p>I am new here so first of all my greetings to you</p>
<p>I am writing an application to run on my Windows Mobile (Pocket PC). FYI, I am using VB.NET.</p>
<p>My idea is to use my e-mail account with my provider, who gives me a lot GB:s to use, as a virtual online storage disk. In a few words, more or less like the ... | <p>"Versions prior to Microsoft Virtual Server 2005 supported splitting of disk images, if the disk image grew larger than the maximum supported file size on the host file system.</p>
<p>Some file systems, such as the FAT32 file system, have a 4-GB limit on file size. If the hard disk image expands more than 4 GB, Mic... | <p>Here is explaned, how to split vhd file(if link in above answer is not working):
<a href="http://leonzandman.com/2007/10/26/splitting-a-virtual-pc-vhd/" rel="nofollow">http://leonzandman.com/2007/10/26/splitting-a-virtual-pc-vhd/</a></p>
| 46,993 |
<p>I am developing an application using vb.net. For performing some tasks the application needs administrator privileges in the machine. How to ask for the privileges during the execution of the program?</p>
<p>What is the general method of switching user accounts for executing an application? In other words, is there... | <p>You can edit the <strong>UAC Settings</strong> (in VB 2008) which is located in the Project Settings. Look for the line that says </p>
<p><code><requestedExecutionLevel level="asInvoker" uiAccess="false" /></code></p>
<p>Change level="asInvoker" to </p>
<ol>
<li><code>level="asInvoker"</code> (same access t... | <p>Project>Properties>Application>View Windows Settings: Replace <code><requestedExecutionLevel level="asInvoker" uiAccess="false" /></code> With <code><requestedExecutionLevel level="requireAdministrator" uiAccess="false" /></code></p>
| 11,600 |
<p>I have MainViewController calling WebViewController (From UICatalog sample application)
In WebViewController I make some function setValue(){...} to set some value passed as parameter to the variable (NSString *value) from WebViewController.h but when I try from MainViewController something like WebViewController ta... | <p>If you have a property named "value", and use @sythesize to create a method for you, in which case you call using that "." notation:</p>
<pre><code>targetViewController.value = whatever;
</code></pre>
<p>Or you can call the setter outright regardless of you or the @synthesize writing the method:</p>
<pre><code>[t... | <p>You also need to be sure to #import your targetViewController.h file.</p>
| 30,023 |
<p>In developing software for the Pocket PC platform, I have been happily using the Pocket PC emulator that Microsoft provides with Visual Studio (and as a free download). It provides for much faster develop/deploy/test cycles. (Of course, I do still final testing on real hardware). I have also found that providing ... | <p>It's possible to extract the driver required for the Emulator from the Virtual PC 2007 setup file. For Windows 7 users that have <em>Windows Virtual PC</em> installed, this is actually the <em>only</em> known way to get the Emulator working in a network environment (since installing Virtual PC 2007 is not an option ... | <p>We went event a step further. We create a solution for building against compact framework and one solution for building against the win32 .net framework. As all code is just C#, there shouldn't be any problems compiling and running the application as Win32 application on the PC.</p>
<p>There is another great benefi... | 25,584 |
<p>I do not mean the compile errors because I made a syntax mistake or whatever. In C++ we can create compile time errors based on conditions as in the following example:</p>
<pre><code>template<int> struct CompileTimeError;
template<> struct CompileTimeError<true> {};
#define STATIC_CHECK(expr, msg... | <p>There is no way to do this in Java, not in the same way it works for you in C++.</p>
<p>You could perhaps use annotations, and run <a href="http://java.sun.com/j2se/1.5.0/docs/guide/apt/GettingStarted.html" rel="nofollow noreferrer">apt</a> before or after compilation to check your annotations.</p>
<p>For example:... | <p>As Matt Quail answered above, annotations, together with <a href="http://xdoclet.sourceforge.net/xdoclet/index.html" rel="nofollow noreferrer">XDoclet</a>, are suited to address your needs. That combinations allows for a quite a bit of preprocessing, code generation, etc.</p>
| 11,464 |
<p>What is the difference between using <code>#include<filename> and #include<filename.h</code>> in <a href="http://en.wikipedia.org/wiki/C%2B%2B" rel="noreferrer">C++</a>? Which of the two is used and why is it is used?</p>
| <p>C++ only include-files not found in the C standard never used <code>filename.h</code> . Since the very first C++ Standard came out (1998) they have used <code>filename</code> for their own headers. </p>
<p>Files inherited by the C Standard became <code>cfilename</code> instead of <code>filename.h</code>. The C file... | <p>Those without the .h is C++ header files while those with .h are C header files. This only applies to the standard header files in C++.</p>
<p>If you are including your own files or files that is not part of standard C++ you need to always write the complete file name (which can be anything).</p>
| 38,704 |
<p>I'm trying to add two folders to my eclipse project's classpath, let's say Folder A and Folder B. B is inside A. Whenever I add A to the classpath</p>
<pre><code><classpathentry kind="lib" path="/A"/>
</code></pre>
<p>it works just fine, but I need to be able to access the files in B as well. Whenever I t... | <p>I don't think you can (or should be) allowed to do that, and it's not really an Eclipse issue AFAIK</p>
<p>Any individual classpath is a root under which the JVM starts looking for classes using the standard package notation</p>
<p>So let's say that your program has a class X in the default package, and a b.X clas... | <p>Try to do this, works for me on eclipse Indigo.</p>
<pre><code><classpathentry kind="lib" path="/A" excluding="B/"/>
</code></pre>
| 44,852 |
<p>How can I figure out the size of a file, in bytes?</p>
<pre><code>#include <stdio.h>
unsigned int fsize(char* file){
//what goes here?
}
</code></pre>
| <p>On Unix-like systems, you can use POSIX system calls: <a href="https://en.wikipedia.org/wiki/Stat_(system_call)" rel="noreferrer"><code>stat</code> on a path</a>, or <code>fstat</code> on an already-open file descriptor (POSIX <a href="https://man7.org/linux/man-pages/man3/fstat.3p.html" rel="noreferrer">man page</a... | <p>You can open the file, go to 0 offset relative from the bottom of the file with </p>
<pre><code>#define SEEKBOTTOM 2
fseek(handle, 0, SEEKBOTTOM)
</code></pre>
<p>the value returned from fseek is the size of the file.</p>
<p>I didn't code in C for a long time, but I think it should work.</p>
| 2,971 |
<p>From time to time, I need to dump USB traffic under Windows, mostly to support hardware under Linux, so my primary goal is to produce dump files for protocol analysis.</p>
<p>For USB traffic, it seems that <a href="https://web.archive.org/web/20151218000528/http://www.pcausa.com/Utilities/UsbSnoop/default.htm" rel=... | <ol>
<li><p>Since people don't seem to realize it, <a href="https://wiki.wireshark.org/CaptureSetup/USB#Windows" rel="nofollow noreferrer">Wireshark</a> does monitor USB traffic and has a parser for it; but the catch is it only works under Linux. Wireshark on Windows will not do this.</p></li>
<li><p>It may be possible... | <p>Microsoft Message Analyzer was able to capture USB traffic, with <code>Device and Log File</code> parser from MS: <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/capture-and-view-ing-usb-traces-with-microsoft-message-analyzer-" rel="nofollow noreferrer">link</a></p>
<p>Update: as mentione... | 14,309 |
<p>I know this can be done in IE by creating an ActiveX object, but how do I do it in FF. The navigator.plugins['Adobe Acrobat'] object lets me know if it's installed or not, but it doesn't contain the version number. Any ideas?</p>
| <p><code>navigator.plugins[n].name</code> where <code>n</code> is the index of the Acrobat plugin is supposed have the version number in it. Unfortunately, starting with Adobe Reader 8, they changed the name to <code>"Adobe PDF Plug-In for Firefox and Netscape"</code>, with no version information. So, if this is the na... | <pre><code>var p = document.getElementById('Pdf1');
//p.GetVersions()
if(p.GetVersions().indexOf("7.0") != -1)
alert("Acrobat 7 Found")
</code></pre>
| 22,493 |
<p>I'd like to install Java on a Psion 5MX with GNU/Linux 16MB RAM machine, will it be possible?</p>
<p>Unfortunatly, <a href="http://www.java.com/en/download/faq/5000080100.xml" rel="nofollow noreferrer">"KVM must be installed by the manufacturer"</a>.</p>
<p>What I want is to be able to is to write basic Java code,... | <p>Please give us more details about the machine, besides the OS and the memory. Also give us details on what you hope to accomplish with Java on such an underpowered machine (Java has some big overhead in embedded places as compared to writing native code).</p>
<p>The answer is maybe. I've seen Java running on a mach... | <p>Probably a little late but I'd also suggest Squawk. It runs on sun spot devices which have 160k of membory (or something in that area). 160mhz CPU. The whole JVM is open source so you can try to re-write it for your own devices :)</p>
| 29,126 |
<h2>experimenting with Cockburn use cases in code</h2>
<p>I was writing some complicated UI code. I decided to employ Cockburn use cases with fish,kite,and sea levels (discussed by Martin Fowler in his book 'UML Distilled'). I wrapped Cockburn use cases in static C# objects so that I could test logical conditions a... | <p>I've never done it, but I've often thought about writing code in UC style, with main success path first and extensions put in as exceptions caught down below. Have not found the excuse to do it - would love to see someone try it and code, even if after the experiment we conclude it's awful, it will still be interest... | <p>I think this is a variation on the Mediator Pattern from <em>Design Patterns</em> (Gang of Four) -- so I would say that it is a valid way to do this. In the Pattern, they discuss that the complicated interaction between controls is the reason to use it.</p>
<p>Edit: Link to <a href="http://en.wikipedia.org/wiki/Me... | 14,298 |
<p>Javascript usage has gotten remarkably more sophisticated and powerful in the past five years. One aspect of this sort of functional programming I struggle with, esp with Javascript’s peculiarities, is how to make clear either through comments or code just what is happening. Often this sort of code takes a while to ... | <p>The use of a common library is one thing, but I think a lot of "getting" JavaScript is simply spending time writing it. Things that may seem esoteric will slowly become mundane. This is true of just about any language or framework.</p>
<p>Many of the idioms used in JavaScript, such as anonymous functions, literal s... | <p>I think it is one of the aims of those frameworks like prototype or jQuery to hide most of the JavaScript stuff. Since it is not easy to understand it, they are designed to be as easy as can be.
Therefore if you use such frameworks JavaScript gets cleaner. What I do is to write many many comments, use a lot of white... | 35,730 |
<p>The "N+1 selects problem" is generally stated as a problem in Object-Relational mapping (ORM) discussions, and I understand that it has something to do with having to make a lot of database queries for something that seems simple in the object world.</p>
<p>Does anybody have a more detailed explanation of the probl... | <p>Let's say you have a collection of <code>Car</code> objects (database rows), and each <code>Car</code> has a collection of <code>Wheel</code> objects (also rows). In other words, <code>Car</code> → <code>Wheel</code> is a 1-to-many relationship.</p>
<p>Now, let's say you need to iterate through all the cars, and fo... | <p>N+1 SELECT problem is really hard to spot, especially in projects with large domain, to the moment when it starts degrading the performance. Even if the problem is fixed i.e. by adding eager loading, a further development may break the solution and/or introduce N+1 SELECT problem again in other places.</p>
<p>I've c... | 12,266 |
<p>No I'm not being a wise guy ...</p>
<p>For those fortunate enough to not know the My class: It's something that was <strong>added in VB 2005 (and doesn't exist in C#) and is best described as a 'speeddial for the .net framework'.</strong>
Supposed to make life easier for newbies who won't read which framework clas... | <p>It's the "My namespace" rather than the "My class" which may aid searching.</p>
<p>So far I've found this: <a href="http://msdn.microsoft.com/en-us/vbasic/ms789188.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/vbasic/ms789188.aspx</a> but it's not ideal. Looking for more...</p>
<p>EDIT: I think <... | <p><a href="http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.myservices.aspx" rel="nofollow noreferrer">This</a> looks promising - it is a detailed account of the MyServices area (that provides My in VB)</p>
<p>Some more is <a href="http://msdn.microsoft.com/en-us/vbasic/ms789188.aspx" rel="nofollow noref... | 27,838 |
<pre><code>class A
def initialize
@x = do_something
end
def do_something
42
end
end
</code></pre>
<p>How can I stub <code>do_something</code> in rspec, before the original implementation is called (thus assigning 42 to <code>@x</code>)? And without changing the implementation, of course.</p>
| <p><a href="http://github.com/dchelimsky/rspec/commit/45a68378bf0cde18a5cc3ec64c93388a392f514a#diff-0" rel="noreferrer">Here's the commit which adds the feature to rspec</a> - This was on May 25 2008. With this you can do </p>
<pre><code>A.any_instance.stub(do_something: 23)
</code></pre>
<p>However, the latest gem ... | <p>In my version of rspec (1.2.2) I can do this:</p>
<pre><code>A.should_receive(:new).and_return(42)
</code></pre>
<p>I know it is probably to late to answer to the original poster, but I answer it anyway for future reference, as I came here with the same question but figure it out it was working on the latest rspec... | 40,838 |
<p>I have a list, and each item is linked, is there a way I can alternate the background colors for each item?</p>
<pre><code><ul>
<li><a href="link">Link 1</a></li>
<li><a href="link">Link 2</a></li>
<li><a href="link">Link 3</a></... | <p>How about some lovely CSS3?</p>
<pre><code>li { background: green; }
li:nth-child(odd) { background: red; }
</code></pre>
| <p>You can by hardcoding the sequence, like so:</p>
<pre><code>li, li + li + li, li + li + li + li + li {
background-color: black;
}
li + li, li + li + li + li {
background-color: white;
}
</code></pre>
| 46,729 |
<p>I've noticed that Visual Studio 2008 is placing square brackets around column names in sql. Do the brackets offer any advantage? When I hand code T-SQL I've never bothered with them.</p>
<p>Example:</p>
<p>Visual Studio:</p>
<pre><code>SELECT [column1], [column2] etc...
</code></pre>
<p>My own way:</p>
<pre><co... | <p>The brackets are required if you use keywords or special chars in the column names or identifiers. You could name a column <code>[First Name]</code> (with a space) – but then you'd need to use brackets every time you referred to that column.</p>
<p>The newer tools add them everywhere just in case or for consistency.... | <p>I believe it adds them there for consistency... they're only required when you have a space or special character in the column name, but it's cleaner to just include them all the time when the IDE generates SQL.</p>
| 7,624 |
<p>Do end users really care if a SSL EV certificate is from VeriSign, Thwate, DigiCert, or etc.? A certificate from VeriSign can cost up to 3x the cost from DigiCert for the same basic features. VeriSign is probably the most recognizable brand name though.</p>
<p>I've had many discussions with people about this topic,... | <p>No. The reason Verisign can charge more is that as one of the very first CAs they are recognised by more legacy and obscure browsers.</p>
| <p>It really depends on your customer. If you are just serving to the general public, it's not going to make a big deal, because a lot of people don't even care as long as they see that little lock. If you are dealing with a more technical system, possibly a web service where other developers are accessing sensitive ... | 34,345 |
<p>I'm trying to build an in-game Tell A Friend form like in AppStore. Does anybody know if it can be found anywhere in the SDK? I wouldn't like to reinvent the sliced bread.</p>
<p>Thanks!</p>
| <p>Short of writing your own SMTP client, you can create a message then exit your app by sending a URL to the mail app with openURL.</p>
<pre><code>NSURL *url = [[NSURL alloc] initWithString: @"mailto:gilm@myopenid.com?subject=subject&body=body"];
[[UIApplication sharedApplication] openURL:url];
</code></pre>
<p>... | <p>As Ben says, no, there's nothing like that in the SDK. My guess is there never will. I imagine that this functionality is implemented on the server side, which is probably the best option anyway.</p>
| 29,544 |
<p>I'm having some internationalisation woes:</p>
<p>My UTF-8 string fields are being rendered in the browser as ???? after being returned from the database.</p>
<p>After retrieval from the database using Hibernate, the String fields are presented correctly on inspection using the eclipse debugger.</p>
<p>However St... | <p>You could try something like this.</p>
<p>It's taken from sun's page on <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/doc/WebI18N5.html" rel="nofollow noreferrer">Character Sets and Encodings</a>.
I think this has to be the very first line in your jsp.</p>
<pre><code><%@ page contentType="text/html; chars... | <p>Try setting the lang attribute on the <html/> element.</p>
<p>HTML example:</p>
<pre>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
</pre>
<p>XHTML example:</p>
<pre>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Trans... | 7,991 |
<p>How to you find the URL that represents the documentation of a .NET framework method on the MSDN website?</p>
<p>For example, I want to embed the URL for the .NET framework method into some comments in some code. The normal "mangled" URL that one gets searching MSDN isn't very friendly looking: <a href="http://msd... | <p>A lot of the time you can merely append the lowercase namespace reference to the domain:</p>
<pre><code>http://msdn.microsoft.com/en-us/library/system.windows.application_events.aspx
</code></pre>
<p>Moreover, for say the .Net 2.0 version (or any specific version) you can add "(VS.80)":</p>
<pre><code>http://msdn... | <p><a href="http://labnol.blogspot.com/2006/09/learn-to-create-firefox-search-plugin.html" rel="nofollow noreferrer">Create a Search engine for MSDN Library in Firefox</a>
Like this perhaps?</p>
| 10,074 |
<p>I'm writing my first iPhone app, so I haven't gotten around to figuring out much in the way of debugging.
Essentially my app displays an image and when touched plays a short sound.
When compiling and building the project in XCode, everything builds successfully, but when the app is run in the iPhone simulator, it cr... | <p>(This isn't really iPhone specific - the same thing will happen in regular Cocoa).</p>
<p>NSUnknownKeyException is a common error when using <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/KeyValueCoding.html" rel="nofollow noreferrer">Key-Value Coding</a> to... | <p>It seems you are doing</p>
<pre><code>@interface MyFirstIphoneAppViewController : UIViewController<> {
UIImageView *InitialkramerImage;
}
@property(nonatomic,retain) IBOutlet UIImageView *InitialkramerImage;
</code></pre>
<p>Then after synthesizing that imageview, When you open "MyFirstIphoneAppViewContr... | 6,828 |
<p>I'm trying to extract all matches from a EBML definition, which is something like this:</p>
<pre><code>| + A track
| + Track number: 3
| + Track UID: 724222477
| + Track type: subtitles
...
| + Language: eng
...
| + A track
| + Track number: 4
| + Track UID: 745646561
| + Track type: subtitles
...
| + Langu... | <p>You need to make your regex non-greedy by changing this:</p>
<pre><code>.*
</code></pre>
<p>To this:</p>
<pre><code>.*?
</code></pre>
<p>Your regex is matching from the first occurence of <code>Track type: subtitles</code> to the last occurence of <code>Language: (\w\w\w)</code>. Making it non-greedy will work b... | <p>You need to use a lazy quantifier instead of <code>.*</code>. Try this:</p>
<pre><code>/Track type: subtitles.*?Language: (\w\w\w)/m
</code></pre>
<p>This should get you the first occurrence of "<code>Language: ???</code>" after each "<code>Track type: subtitles:</code>". But it would get confused if some track (o... | 33,478 |
<p>We are an all Unix shop (Solaris, Linux). This last product cycle I returned to a project lead capacity, and needed to produce a schedule. I asked what tools my managers would accept, and was surprised to hear "text files". My teammate and I gamely tried this, and probably worse, HTML tables, to track the tasks we w... | <p>TaskJuggler's syntax is rather easy, but do take your time to read the documentation.
My experience with TJ:</p>
<ul>
<li>very powerful and expressive syntax</li>
<li>useful for detailed calculation of large projects</li>
</ul>
<p>However in reality a manual planning takes into account many implicit constraints, w... | <p>I have been using it for 1w and love it.</p>
<p>The acceptance test, so to speak, is if you find text/coding more expressive than UI based input.
If you do feel comfortable expressing your thinking in a structured language but prefer/expect UI then do not spend time with TaskJuggler.</p>
<p>See <a href="http://ww... | 31,419 |
<p>There is some magic going on with WCF deserialization. How does it instantiate an instance of the data contract type without calling its constructor?</p>
<p>For example, consider this data contract:</p>
<pre><code>[DataContract]
public sealed class CreateMe
{
[DataMember] private readonly string _name;
[Dat... | <p><code>FormatterServices.GetUninitializedObject()</code> will create an instance without calling a constructor. I found this class by using <a href="http://www.red-gate.com/products/reflector/index.htm" rel="noreferrer">Reflector</a> and digging through some of the core .Net serialization classes. </p>
<p>I tested... | <p>Yes, FormatterServices.GetUninitializedObject() is the source of the magic.</p>
<p>If you want to do any special initialization, see this.
<a href="http://blogs.msdn.com/drnick/archive/2007/11/19/serialization-and-types.aspx" rel="noreferrer">http://blogs.msdn.com/drnick/archive/2007/11/19/serialization-and-types.a... | 21,533 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.