input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
NSFetchRequest - can it return an array of properties? <p>Unless I have missed something in the documentation, I can't see if it is possible to execute an <code>NSFetchRequest</code> so that it returns an array of properties of objects, instead of the objects themselves.</p>
<p>For example, I have:</p>
<pre><code>@in... | <p>iPhone OS 2.x and Mac OS X 10.5 do not have this functionality.</p>
<p>See the NSFetchRequest documentation for iPhone OS 3.0, which does.</p>
<p>In particular, you want to look at</p>
<pre><code>-setResultType:
-setReturnsDistinctResults:
-setPropertiesToFetch:
</code></pre>
|
move data from progress event to another class <p>in Flex if i have a loader class (i.e., XMLLoader) and a document class (document.as) and in document.as I'm instantiating XMLLoader</p>
<pre><code>var ldr:XMLLoader = new XMLLoader(url);
</code></pre>
<p>... and on the document.as class I have a text box, which I wou... | <p>Your event handler (getProcess) must accept the ProgressEvent as a parameter. From that, you get the needed info. When you do, just write it out to the text field you want, e.g.</p>
<pre><code>document.textfield.text = event.bytesLoaded;
</code></pre>
|
In D, how to pass an empty string? (to gtkD) <p>Using D1 with phobos</p>
<p>I have a text entry field, instance of <code>gtk.Entry.Entry</code>,</p>
<p>calling <code>setText("")</code> raises a run time error</p>
<pre><code>Gtk-CRITICAL **: gtk_entry_set_text: assertion `text != NULL' failed
</code></pre>
<p>Why? I... | <p>I don't think D really differentiates between "empty string" and "null string". A cheap workaround would be setText(" ").</p>
<p>[edit] Nevermind that. It's a bug in gtkD. in trunk/src/glib/Str.d (thanks wm4 for finding it), change line 147 to return ""; (remove the .dup).</p>
|
Problem with repository creation in C# and ADO.NET entities <p>I'm building this app at night after work and have been struggling with this design problem for a week or two now.</p>
<p>I'm building a program that has 44 different types of entries and requires the ability to create a custom type.</p>
<p>Because users ... | <p>While I am not exactly sure of your ultimate goal, I may have an option for you. You need a highly dynamic "entity" which will allow your users to create their own data structures. Imperative languages like C# do not lend themselves well to such a thing...and even with a dynamic language, I think you'll likely run i... |
Does the .NET 3.0 SP1 installer also install .NET 2.0 and 3.0? <p>.NET 3.0 "wraps" .NET 2.0 so if I'm starting out with a clean Windows Server 2003 environment, will the .NET 3.0 SP1 installer also install .NET 2.0 and 3.0? What about .NET 2.0 SP1? Assume I don't want to install .NET 3.5 SP1 just yet.</p>
| <p>You should just install .NET 3.5 SP1, and you'll get .NET 2.0 SP1 and SP2, as well as .NET 3.0 SP1 and SP2.</p>
|
Converting a Console Application to a service? <p>I'm looking for different ways with strengths/weaknesses for converting a console application we are using long term in to a windows service. We use something called java service wrapper for ActiveMQ, and I believe people have told me you can wrap anything with it. Th... | <p>I would be tempted to create an empty windows service project, and just grab the bits that deal with a service; it isn't a lot - a few references and some of the code in <code>Main</code>. You can actually have your existing console work <em>both</em> as a service <em>and</em> as a console - either by checking the a... |
What is the event to catch form submission in Javascript? <p>A couple of questions here:</p>
<ul>
<li>I was wondering what event do I use to execute some javascript on form submission (to do some validation)?</li>
<li>Once I have done my validation, how do I then submit the form in javascript ?</li>
</ul>
<p>Cheers..... | <p>Let's say you have a form named <code>myForm</code>:</p>
<pre><code>var form = document.getElementById('myForm');
</code></pre>
<p>To catch submission:</p>
<pre><code>try {
form.addEventListener("submit", someFunction, false);
} catch(e) {
form.attachEvent("onsubmit", someFunction); //Internet Explorer 8-... |
Java: How do I catalog Java API documents using Quicksilver? <p>This one is for Java programmers on Mac.</p>
<p>How do I catalog Java API documents using <a href="http://blacktree.com/?quicksilver" rel="nofollow">Quicksilver</a>? Wouldn't it be nice if you could lookup API documents with a few key strokes?</p>
| <p><a href="http://java.sun.com/javase/downloads/index.jsp" rel="nofollow">Download Java API document locally</a>.</p>
<p>Then follow the instructions in <a href="http://www.entropy.ch/blog/Developer/?permalink=Indexing-Java-SDK-Docs-with-QuickSilver.html" rel="nofollow">Indexing Java SDK Docs with QuickSilver</a>.</p... |
Different styles for Windows forms in Ironpython <p>I want to change the look of my Ironpython windows forms, Is it possible to change the style of the form and for example make it more like a Mac?</p>
<p>thank you</p>
| <p>As an interface designer, it's important to use an many standard windows controls as possible. The more your app looks like the microsoft ones users are used to, they will become more comfortable with it quicker. </p>
<p>A good example is how out of place iTunes and Safari look in windows. My tip is to just keep it... |
How to update Dataset Parent & Child tables with Autogenerated Identity Key? <p>I am using ADO.NET Datasets in my VB Applications. I have a typed dataset with one Parent table and many child tables. I want to generate Identity Key when I insert data into Parent Table and then update the data in all child tables with th... | <p>I think this should be more obvious and should work without any tweaking. But still, it's pretty easy.</p>
<p>The solution has two parts:</p>
<ol>
<li><p>Create <code>DataRelation</code> between child and parent tables and set it to cascade on updates.
That way whenever parent Id changes, all children will be upda... |
What are some strategies to unit test a scheduler? <p>This post started out as "What are some common patterns in unit testing multi-threaded code ?", but I found some <a href="http://stackoverflow.com/questions/12159/how-should-i-unit-test-threaded-code">other</a> <a href="http://stackoverflow.com/questions/352695/best... | <p>you could use a <strong>recorder object</strong> that record the order, timings and other useful stuff in each unit test of your scheduler. The test is simple:</p>
<ol>
<li>create a <strong>recorder object</strong></li>
<li>configure the schedule</li>
<li>execute a unit test</li>
<li>check that recorder object is "... |
javascript inheritance <p>I know there is a lot of similar questions are tons of great answers to this. I tried to look at the classical inheritance methods, or those closure methods etc. Somehow I consider they are more or less "hack" methods to me, as it doesn't really what the javascript is designed to do. (Welcome ... | <p>It is not a <em>hack</em> as such; JavaScript is a prototyped language, as defined by <a href="http://en.wikipedia.org/wiki/Prototype-based%5Fprogramming">Wikipedia</a> as where:</p>
<blockquote>
<p>..classes are not present, and behavior reuse (known as inheritance in class-based languages) is performed via a pr... |
fetching single child row based on a max value using Django ORM <p>I have a model, "Market" that has a one-to-many relation to another model, "Contract":</p>
<pre><code>class Market(models.Model):
name = ...
...
class Contract(models.Model):
name= ...
market = models.ForeignKey(Market, ...)
curren... | <p>Django 1.1 (currently beta) adds <a href="http://docs.djangoproject.com/en/dev/topics/db/aggregation/">aggregation</a> support to the database API. Your query can be done like this:</p>
<pre><code>from django.db.models import Max, F
Contract.objects.annotate(max_price=Max('market__contract__current_price')).filter... |
php modes breaking out of php or not <p>I asked another question about HTML and PHP separation as I have seen references to it on tutorial and examples pages but I found that separation of HTML and PHP it something different than what people are actually commenting on and I think that is PHP modes.</p>
<p>That is brea... | <p>I assume by "breaking out" you mean:</p>
<pre><code><?php foo(); ?>
test
<?php bar(); ?>
</code></pre>
<p>as opposed to</p>
<pre><code><?php
foo();
echo("test");
bar();
?>
</code></pre>
<p>Well, one advantage of the first solution is that your layout is still more or less readable i... |
What is more efficient a switch case or an std::map <p>I'm thinking about the tokenizer here.<br>
Each token calls a different function inside the parser.<br>
What is more efficient: </p>
<ul>
<li>A map of std::functions/boost::functions</li>
<li>A switch case</li>
</ul>
| <p>I would suggest reading <a href="http://discuss.joelonsoftware.com/default.asp?joel.3.21194.19">switch() vs. lookup table?</a> from Joel on Software. Particularly, this response is interesting:</p>
<blockquote>
<p>" Prime example of people wasting time
trying to optimize the least
significant thing."</p>
... |
ASP.NET MVC, jquery ajax, real simple history <p>I'm working on a mvc application that uses jquery to implement dynamically loading page content using jquery.load and/or jquery.ajax. But when the user uses the back button in these kind of applications, the result for the user is often unexpected. I've seen articles lik... | <p>There is a really (and I mean <strong>really</strong>) nice tutorial on <a href="http://www.asp.net/learn/mvc/#MVC%5FSampleApp" rel="nofollow">the ASP.Net learning site</a> which walks you through building an app from scratch, refactoring it to use some nice design patterns, basic unit testing and TDD.</p>
<p>In th... |
Reducing GWT custom widget verbosity <p>My current process for custom widgets is the following:</p>
<ol>
<li>Create my widget class - extending Composite;</li>
<li>Create a listener interface for this widget;</li>
<li>Create a listener collection interface - private inner class to the widget;</li>
<li>Create add/remov... | <p>You don't need a separate listener interface for every new widget. E.g. <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/ClickListener.html" rel="nofollow">ClickListener</a> is used by a variety of different widget classes. Obviously, some custom widgets will require ... |
Vista-alike WinForms control with a tight color bar on the left and icon and text more to the right <p>Is there any opensource implementation of a winforms control like the one on Windows Update window where "No important updates available" or another status is displayed? It looks like a bordered bar wih a tight vertic... | <p>There isn't one that I'm aware of, but it should take only a few minutes to implement yourself.</p>
<p>You could create a new class deriving from Control, and paint the bar using a LinearGradientBrush. The rest is just creating the labels and images, placing them, and hooking up properties.</p>
<p>If you aren't co... |
Whats the difference between using .Class or #ElementId in CSS? <p>Ive been wondering... in CSS are there any differences between creating a style class and applying it an element, or creating a style with the #elementId notation (apart from being able to assign a class to different elements)?</p>
<p>For example...</p... | <p>An <a href="http://www.w3.org/TR/html401/struct/global.html#adef-id" rel="nofollow">ID</a> must be unique in a document. <a href="http://www.w3.org/TR/html401/struct/global.html#adef-class" rel="nofollow">Classes</a> can be used in any number and combination. So you can use one class on multiple elements and multipl... |
Triggering a checkbox value changed event in DataGridView <p>I have a grid view that has a check box column, and I want to trigger a drawing event as soon as the value of the cell is toggled. I tried the ValueChaged and the CellEndEdit and BeginEdit, and chose the selection mode as CellSelect. As for the the first 2 ev... | <p>I use the CellContentClick event, which makes sure the user clicked the checkbox. It DOES fire multiple times even if the user stays in the same cell. The one issue is that the Value does not get updated, and always returns "false" for unchecked. The trick is to use the .EditedFormattedValue property of the cell ... |
ASP .NET c# retrieve total non-paged memory usage remotely <p>I'm working on a simple ASP .NET health checker and I've run into a few obstacles.</p>
<p>1) I need to be able to get the full non-paged memory usage from a remote machine (on same network). I've tried using System.Diganostics.Process.NonpagedSystemMemorySi... | <p>One solution I used for this to grab machine diagnostics previously was to use DLLImport.</p>
<p><a href="http://www.pinvoke.net/default.aspx/kernel32.GlobalMemoryStatus" rel="nofollow">See P-Invoke</a></p>
<p>Hope this helps</p>
<p>Pete</p>
<p>In answer to your comment</p>
<p>When using DLL import you have to ... |
Java Generics with Class <T> <p>So I have a map: </p>
<pre><code>Map<String, Class> format = new HashMap<String, Class>();
</code></pre>
<p>And I would add elements to it like this:</p>
<pre><code>format.put("Vendor Number", Integer.class);
format.put("Vendor Dispatch", Date.class);
....
</code></pre>
... | <p>Change:</p>
<pre><code>Class type = Integer.class
Integer i = verifyType("100",type);
</code></pre>
<p>to</p>
<pre><code>Class<Integer> type = Integer.class
Integer i = verifyType("100",type);
</code></pre>
<p>By only declaring the type as 'Class', you're losing the generic parameter and the verifyType() m... |
Using MySQL Databases and PHP to Populate forms <p>I am contemplating taking the next step with my PHP applications and making the option fields dynamic. That would open the doors for more automation. </p>
<p>I have drop downs throughout my project, they are used to select a specific user and I update them manually wh... | <p>Your way is fine, but two things need to be changed:<br/>
- <strong>Run <a href="http://php.net/htmlentities" rel="nofollow">htmlentities</a>() or <a href="http://php.net/htmlspecialchars" rel="nofollow">htmlspecialchars</a>() on all echoed HTML to avoid XSS.</strong> Unless you already sanitized it at database entr... |
Model types and sorting in Rails? <p>This is something I've been stuck on for a while now, and I have to apologize in advance for going into so much detail for such a simple problem. I just want to make it clear what I'm trying to do here.</p>
<h2>Scenario</h2>
<p>So, there's a model Foo, each Foo can either be red, ... | <p>Please take a look at the section called "Single table inheritance" on <a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html" rel="nofollow">this page</a> and let us know if it solves your problem.</p>
|
Problem changing values in textbox <p>Simplifying
I have a text box and a button
The button just create an messagebox with the text from the textbox.
But i change the value of the textbox, the new value apears (Ex: Type 123) but the message box does not show the value.</p>
<p>If i try to use the value in the programmi... | <p>Your button's click event handler should look something like this</p>
<pre><code>private void button_Click(object sender, EventArgs e)
{
MessageBox.Show(textBox.Text);
}
</code></pre>
<p>I suspect you already have code similar to this and that at some point the textbox is cleared or otherwise set to String.Emppty ... |
Google Maps - load window on marker click <p>I'm trying to create a Google Map with multiple markers on it, that loads an alert when a marker is clicked.</p>
<pre><code>var map = null;
function setupMap() {
map = new GMap2(document.getElementById("map"));
map.setUIToDefault();
map.setCenter(new GLatLng( 0, 0 ), ... | <p>In your <code>addListener</code> invocation, you're actually calling <code>loadInfo</code> instead of passing a reference to it. Try the following instead:</p>
<pre><code>GEvent.addListener( marker1, "click", function() {
loadInfo(1);
});
</code></pre>
<p>This will create an anonymous function which wraps you... |
C# Ranking of objects, multiple criteria <p>I am building a plugin for a LAN party website that I wrote that would allow the use of a Round Robin tournament.</p>
<p>All is going well, but I have some questions about the most efficient way to rank over two criteria.</p>
<p>Basically, I would like the following ranking... | <p>Ranking isn't too hard. Just mishmash OrderBy and Select implementation patterns together and you can have an easy to use Ranking extension method. Like this:</p>
<pre><code> public static IEnumerable<U> Rank<T, TKey, U>
(
this IEnumerable<T> source,
Func<T, TKey> keySel... |
How do I save an Image from an url? <p>How do I take an image from an url and save it locally?</p>
<p><a href="http://someurl.com/imagename.jpg" rel="nofollow">http://someurl.com/imagename.jpg</a>
-> c:\apppath\imgfolder</p>
<p>ASP.NET C#</p>
<p>I am not very good with IO stuff, hope someone can help me out :)</p>
| <p>Try this.</p>
<pre><code>System.Net.WebClient wc = new System.Net.WebClient();
wc.DownloadFile("http://www.domin.com/picture.jpg", @"C:\Temp\picture.jpg");
</code></pre>
<p>Since you've tagged this with ASP.NET, it's worth pointing out that if you put this code in your ASP.NET Website/Web Application, you'll need... |
jQuery UI datepicker opens automatically within dialog <p>I have a datepicker which is used within the jQuery dialog object. The source of the dialog's content is loaded using <code>.load()</code>. Within the dialog I created a script which creates a datepicker for the text input.</p>
<pre><code>$("#date").datepicker(... | <p>Much simpler way I found:</p>
<pre><code>$("#dialogPopper").click(
function() {
$("#date").datepicker("disable");
$("#dialog").dialog("open");
$("#date").datepicker("enable");
return false;
... |
Online resources for Finite Automata Theory <p>Could someone point me to some good online material for finite automata theory?
Wikipedia articles are very concise.</p>
| <p>Actually in short time a Automata course starts at Udacity (free online courses):
<a href="https://www.coursera.org/course/automata" rel="nofollow">https://www.coursera.org/course/automata</a></p>
<p>Or you find a lot of material on the MIT courseware: <a href="http://ocw.mit.edu/courses/electrical-engineering-and-... |
Sharing iPhone Apps for the Simulator <p>iPhone Apps built for the simulator are stored here:</p>
<pre><code>/Users/<username>/Library/Application Support/iPhone Simulator/User/Applications
</code></pre>
<p>Is it possible to copy the <strong><GUID>.sb</strong> and <strong><GUID></strong> directory a... | <p>I found a way that requires just a little more setup, but is much easier for non-developers:</p>
<h2>Instructions for your users/testers:</h2>
<ol>
<li>Install Xcode following Apple's instructions</li>
<li>Double-click the attached application - the iPhone simulator will launch, install the app and start it automa... |
How do I space out the child elements of a StackPanel? <p>Given a StackPanel:</p>
<pre><code><StackPanel>
<TextBox Height="30">Apple</TextBox>
<TextBox Height="80">Banana</TextBox>
<TextBox Height="120">Cherry</TextBox>
</StackPanel>
</code></pre>
<p>What's the be... | <p>Use Margin or Padding, applied to the scope within the container:</p>
<pre><code><StackPanel>
<StackPanel.Resources>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Margin" Value="0,10,0,0"/>
</Style>
</StackPanel.Resources>
<Te... |
Why does it appear that my random number generator isn't random in C#? <p>I'm working in Microsoft Visual C# 2008 Express.</p>
<p>I found this snippet of code:</p>
<pre><code> public static int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
<... | <p>The problem with min = 0 and max = 1 is that min is inclusive and max is exclusive. So the only possible value for that combination is 0.</p>
|
Auto Restart/Reset countdown timer <p>What i want is that when the timer has reached the end-date and time it automatically start over but by counting down from 60 seconds. Im new to jquery and im strungling with this problem for almost 3 days and i cant get it running.
My countdown is working perfectly with the end-da... | <p>Use the <a href="http://keith-wood.name/countdown.html" rel="nofollow">JQuery Countdown</a> plugin.</p>
<p>It has callback events that can be fired when the timer hits zero. When this happens, simply reset and timer.</p>
<p>Assuming this is our html:</p>
<pre><code><div id="shortly"></div>
<button... |
Visual studio highlights asp.net tags as hyperlinks <p>As you can see from the screenshot, vs2008 thinks asp tags are hyperlinks. I have reset all the settings on it but the issue is still there. I have tried on different projects and the same issue is present. I have moved the projects to another visual studio install... | <p>Must say it is strange. Although I am clueless, I will still try. </p>
<p>Are those real hyperlinks or just underlined text? If underlined text, then you can change the settings (since you have mentioned about resetting the setting, this won't work). If they are real hyperlinks, I am stumped.</p>
|
How to track that a user visited the site each day for X days? <p>There is a new badge on Stack Overflow. The "<a href="http://stackoverflow.com/badges/71/woot-enthusiast">woot</a>" badge is awarded to users visited the site each day for 30 days. How can you implement a feature like this? How can you track that a user ... | <p>You do need to have a cookie, since people might not <i>log in</i> every day -- for example because they are logged in automatically for 2 weeks, or because they are on your site doing things non-stop without sleep and lunch for 50 hours :) You probably actually want to count when user accesses the site.</p>
<p>Now... |
Moving SharePoint (MOSS 2007) Sites <p>I have a site collection with the following structure:</p>
<ul>
<li>Sales Dept Site (site collection top-level site)
<ul>
<li>Sales Dept Sub-Site 1</li>
<li>Sales Dept Sub-Site 2</li>
</ul></li>
</ul>
<p>We now have a need to insert a new top-level site so that the new structure... | <p>You can move entire sites via the 'Manage Content And Structure' from the 'Site Actions' menu on the top level site, so there is no need to export and import sites.</p>
<p>Follow <a href="http://office.microsoft.com/en-us/sharepointserver/HA101317231033.aspx#1" rel="nofollow">this guide</a> for getting access to th... |
How to free memory from a looped object <p>I am trying to dynamically update a tooltip made with Prototip and Prototype. The way I am trying to do this is probably not the best way (so if you know a better way that would be helpful), but the only way i could think to do it would be to hold the javascript in a div elem... | <p>It seems that the new Tip construct can take an element instead of the tooltip text as a parameter. You might want to try to use that. I haven't done this so you'll have to try it by yourself. First, create the tooltip layout (div tag containing tooltip text) and style it as usual. Set the style attribute of this di... |
Type variance in .NET Framework 4.0 <p><code>IEnumerable<T></code>, <code>IComparable<T></code> and a few more are now type-variant. <code>IList<T></code>, <code>ICollection<T></code> and many others aren't. Why?</p>
| <p>.NET Framework 4.0 introduces <strong>safe</strong> co/contra-variance. <code>IList<T></code> and <code>ICollection<T></code> have <code>T</code> both in input and output positions while <code>IEnumerable<T></code> has <code>T</code> <em>only in output positions</em> and <code>IComparable<T><... |
Convert Mootools Element Drag to Prototype <p>I currently use the below code to be able to drag an element around inside a div container (this is important, it can't just be dragged around anywhere eon the page). I use mootools to accomplish this, but I am converting everything to use prototype, but I can't figure out... | <p>I don't know that you can limit the dragable area with Prototype/Scriptaculous. </p>
<p>You can restrict the drop target so it can only be dropped in a specific place, but I'm not aware of a way to force it to stay within a certain boundary.</p>
<p>You might could write up something if you can determine the posit... |
WCF:: ServiceHost: Oddity...Still alive even if thread is dead? <p>a new member here. Nice to see such a neat community.</p>
<p>After a bit of research, I decided to use WCF in my application to do inter process communication, so I am using the NetNamedPipeBinding binding.</p>
<p>The ServiceHost hosting application i... | <p>When you call Open on the ServiceHost, an additional thread will be created to listen for incoming service requests. In this way, your thread may have finished running, but another thread has been created, and will continue to run until you call "Close" on the ServiceHost.</p>
<p>It may not be necessary in your ca... |
How do I change a standard library project to be a silverlight library project? <p>I've downloaded the Ninject SVN visual studio project and I want to compile it against Silverlight libraries to make a Silverlight compatible DLL.</p>
<p>Is there a setting to change somewhere to make it a Silverlight library project, o... | <p>There is no setting, you will need to swap in the appropriate SL libraries, its not just "here and there" its actually "everywhere". You then need to hope that the project doesn't use anything that isn't present in the SL libraries.</p>
|
Does the iPhone 3.0 SDK support serial communication? <p>There is already a <a href="http://devdot.wikispaces.com/Iphone%2BSerial%2BPort%2BTutorial" rel="nofollow">hack to get serial communications</a> working through the iPhone's 30-pin connector, which requires a jailbroken phone. Looking at the the <a href="http://... | <p>The 3.0 SDK is still under NDA, so no registered developer is at liberty to talk about it. Just wait one more week, there's a good chance that the 3.0 SDK will go public at the WWDC keynote on June 8.</p>
|
Flex forcing resizing when the image source update is completed <p>I update the source property of an image. When the image is loaded I want to redraw the border skin to fit the new size of the image.</p>
<pre><code>newImgEdit.addEventListener(Event.COMPLETE, loadImgComplete);
newImgEdit.source = myurl_ressource;
pri... | <p>You can <a href="http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf633a0-7fff.html#WS2db454920e96a9e51e63e3d11c0bf69084-7dfd" rel="nofollow">manually force a component to update its layout</a> by calling <code>validateNow()</code>.</p>
|
C# Form Move Stopped Event <p>Is there any event in C# that fires when the form STOPS being moved. Not while its moving.</p>
<p>If there is no event for it, is there a way of doing it with WndProc?</p>
| <p>The ResizeEnd event fires after a move ends. Perhaps you could use that.</p>
|
C# Case-Insensitive String <p>Considering the class below<br/>
- can I do anything to implement a case-insensitive string?<br/></p>
<pre><code>public class Attibute
{
// The Name should be case-insensitive
public string Name
{
get;
set;
}
public Attibute()
{
}
}
public cl... | <p>You can't have case-insensitive properties—you can only have case-insensitive operations, like a comparison. If someone accesses XHtmlOneDTDElementAttibute.Name, they will get back a string with whatever case it was created with.</p>
<p>Whenever you use .Name, you can implement that method in a way that igno... |
Is there a secure way to remove a user field from a login dialog? <p>Browsing through Coding Horror, I saw <a href="http://www.codinghorror.com/blog/archives/000413.html" rel="nofollow">this article</a> on removing the user field from a login dialog.</p>
<p>It's an interesting concept albeit an old one from 2005. Nev... | <p>My first thought, which is also alluded to in the article, is to increase the password complexity requirements to avoid collisions. </p>
<p>16-byte GUIDs avoid collisions (every star can have 6.8Ã1015 GUIDs) well enough, so it shouldn't be too difficult. Obviously human-generated input isn't quite as random, but... |
Macro use depending on integer <p>I have to use a macro multiple times inside a function and the macro that needs to be used depends on a number I pass into the function.</p>
<p>e.g. </p>
<pre><code> function(int number) {
switch(number) {
case 0: doStuff(MACRO0); break;
case 1: doStuff(MACRO1);... | <p>I would use a function object</p>
<pre><code>struct Method1 {
void operator()() { ... }
};
template<typename Method>
void function(Method m) {
...
m();
...
}
int main() {
function(Method1());
}
</code></pre>
|
SQL Join and Count can't GROUP BY correctly? <p>So let's say I want to select the ID of all my blog posts and then a count of the comments associated with that blog post, how do I use GROUP BY or ORDER BY so that the returned list is in order of number of comments per post?</p>
<p>I have this query which returns the d... | <p>I'm not familiar with pre-SQL92 syntax, so I'll express it in a way that I'm familiar with:</p>
<pre><code>SELECT c.comment_post_ID, COUNT(c.comment_ID)
FROM wp_comments c
GROUP BY c.comment_post_ID
ORDER BY COUNT(c.comment_ID) -- ASC or DESC
</code></pre>
<p>What database engine are you using? In SQL Server, at ... |
How do I draw text into a subview? <p>I want to draw text into <code>UIView</code>'s subview using <code>drawInRect:withFont:lineBreakMode</code> call but that operates on the current context only.</p>
<p>Is it possible to draw text into a subview from current view? </p>
<p>The subview is a generic <code>UIView</code... | <p>No, if you're going to do something with a context, you have to be in that view's -drawRect:. You can always make your subview a UIView subclass that overrides -drawRect: to display the text you want... but at that point, you're kind of reinventing UILabel.</p>
|
datetime picker in C# <p>I am developing C# application and would like to allow user to enter the time as well as date in datetimepicker.Please let me know how to acheive this</p>
| <p>You need to instruct the DateTimePicker control to use a custom format, and provide a format that includes time elements:</p>
<pre><code>this.dateTimePicker1.CustomFormat = "MMMM dd, yyyy hh:mm";
this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
</code></pre>
<p>You can do this in the... |
XmlSerializer and controlling namespace in XmlAnyElement <p>using dotnet 2.0. Code to illustrate :</p>
<pre><code> Class1 c1 = new Class1();
c1.SomeInt = 5;
XmlDocument doc = new XmlDocument();
doc.LoadXml("<anode xmlns=\"xyz\" ><id>123</id></anode>");
... | <p>No, I don't believe you can. You could use an aliased namespace as described in this article: <a href="http://www.topxml.com/rbnews/XmlSerializer/re-21763%5FPrettification-of-XML-Serialization-within-Web-Services.aspx" rel="nofollow">Prettification of XML Serialization within Web Services</a>. </p>
|
JavaBean 'value for the useBean class attribute classes.UserData is invalid' <p>I have two JSPs and a JavaBean that aren't working. I'm using Tomcat 6.0. The first JSP is GetName.jsp, located at C:\Tomcat\webapps\app1\GetName.jsp:</p>
<pre><code><HTML>
<BODY>
<FORM METHOD=POST ACTION="NextPage.jsp">... | <p>You need to set the bean properties in your NextPage.jsp file.</p>
<p>Add the following line after your useBean statement like this.</p>
<pre><code><jsp:useBean id="user" class="UserData" scope="session"/>
<jsp:setProperty name="user" property="*" />
</code></pre>
|
Can .NET code compiled with the unsafe tag run in Mono? <p>I have some code that does Bitmap manipulation using the LockBits method and accessing the bitmap data directly using a pointer. This code has to be wrapped in an unsafe block, of course, and I was wondering if this means that the code would not work in Mono.<... | <p>Yes. Here's the Mono documentaiton on the unsafe keyword: <a href="http://go-mono.org/docs/index.aspx?link=ecmaspec%3A25">http://go-mono.org/docs/index.aspx?link=ecmaspec%3A25</a></p>
<p>The Bitmap class is available as well. You can find the documentation here: <a href="http://go-mono.org/docs/index.aspx?tlink=35@... |
Anyone have a workaround for the aspnet menu control not rendering properly in ie8? <p>I am programming asp.net in C# using vs2008. </p>
<p>My app runs fine in ie7, but the drop down menu does not render in ie8. A white rectangle shows up instead of the menu items. I checked viewsource and the html for the menu looks ... | <p>Try using the <code><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"></code> meta-tag as detailed here: <a href="http://www.microsoft.com/windows/internet-explorer/readiness/developers-new.aspx#dom" rel="nofollow">http://www.microsoft.com/windows/internet-explorer/readiness/developers-new.aspx#dom</a... |
Try to svn checkout, but get: svn: '.' is already a working copy for a different URL <p>I'm trying to svn checkout into my public_html folder, but I get this error:
svn: '.' is already a working copy for a different URL</p>
<p>My brother already set up a boiler plate site for me, but I've changed it and put those chan... | <p>You could try "svn switch". In the example at http:// svnbook.red-bean.com/en/1.0/ch04s05.html, it's as easy as:</p>
<pre><code> $ svn switch http:// svn.example.com/repos/calc/branches/my-calc-branch
</code></pre>
<p>But since you have subdirectory permissions issues, your plan to re-create public_html sounds li... |
JQuery works in Firefox, but not in IE <p>Anyone know why the following JQuery expression works in Firefox but not in IE or Chrome?</p>
<pre><code>$('form :hidden:last').attr('name')
</code></pre>
<p>An alert statement reveals that in IE the expression is undefined.</p>
<p>UPDATE: Here is some HTML that fails.</p>
... | <p>Is your JQuery wrapped in the a <code>$(document).ready( ... )</code> ?</p>
<p>For example:</p>
<pre><code>$(document).ready(function() {
$('form :hidden:last').attr('name')
});
</code></pre>
<p>It is essential to do this to ensure that the DOM has fully loaded before your JQuery code starts executing. Other... |
Checking single instance of NSIS installer <p>I have an Updater program written in NSIS. I just wanna make sure that when it's invoked twice or more, it won't create another instance of the updater, else there would be two or more updaters running. </p>
<p>How do you restrict the updater from creating another instance... | <p>You should use a Mutex, see <a href="http://nsis.sourceforge.net/Allow_only_one_installer_instance" rel="nofollow">http://nsis.sourceforge.net/Allow_only_one_installer_instance</a></p>
|
Unique hardware ID in Mac OS X <p>Mac OS X development is a fairly new animal for me, and I'm in the process of porting over some software. For software licensing and registration I need to be able to generate some kind of hardware ID. It doesn't have to be anything fancy; Ethernet MAC address, hard drive serial, CPU s... | <p>For C/C++:</p>
<pre><code>void get_platform_uuid(char * buf, int bufSize) {
io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
CFStringRef uuidCf = (CFStringRef) IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0)... |
Custom Markup in Django <p>Can anyone give me an idea or perhaps some references on how to create custom markups for django using textile or Markdown(or am I thinking wrong here)?</p>
<p>For example: I'd like to convert the following markups(the outer bracket mean they are grouped as one tag:<br />
[<br />
[Contacts]<... | <p>The built in <a href="http://docs.djangoproject.com/en/dev/ref/contrib/#markup" rel="nofollow">markup</a> app uses a filter template tag to render textile, markdown and restructuredtext. If that is not what your looking for, another option is to use a 'markup' field. e.g.,</p>
<pre><code>class TownHallUpdate(models... |
Why is java.io.ObjectStreamException used in WTK stub generator for enums? <p>I am using a web service implemented in WCF which has enums defined in the interface. I am trying to call this from a Java BlackBerry client. I am using Eclipse to develop the Java application for BlackBerry. I am using the <a href="http:/... | <p>CLDC and the Wireless Toolkit both use Java Micro Edition.
JavaME is based on version 2 of the java language, which means no generics and no enums.</p>
<p>The first step in investigating Web Services for your Blackberry handset would be to read the JSR-172 specifications.</p>
|
How is the gaussian filter algorithm work in OpenCV <p>I write my own gaussian filter but it is really slow.</p>
<p>OpenCV's Gaussian algorithm is much faster, 20 times than my gaussian filter.
I want to rewrite OpenCV's Gaussian algorithm in my project, and I don't want to include opencv in my project. </p>
<p>Howe... | <p>The Gaussian filter has a property that makes it very easy to speed up: the filter can be applied in both dimensions independently. You define a one-dimensional filter that operates vertically, and another that operates horizontally, and apply them both; this produces the same effect as a single filter applied in tw... |
WCF:: ServiceHost & AddServiceEndpoint: Are Arguments types reversed? <p>While I am trying to learn WCF, and it seems straight-forward enough, I came through an odd situation...at least it seems odd to me.</p>
<p>Why is it that the ServiceHost ctor takes a concrete class, and the AddServiceEndpoint takes the Interface... | <p>When you create the ServiceHost, you are creating the actual service, so it must be concrete.</p>
<p>Your endpoints, on the other hand, are what your clients see. You don't necessarily want your clients to know your implementation -- they should just get the interface definition.</p>
<p>The endpoind DOES support ... |
Server controls event does not woks after calling page_clientvalidate() method <p>when i calling Page_ClientValidate('Add1') function using javascript, the server controls of asp.net event not working .'Add1' is validation group. </p>
| <p>Please provide some sample code and a better explanation of what you mean by "the server controls of asp.net event not working".</p>
<p>In the meantime, here's some <a href="http://weblogs.asp.net/srkirkland/archive/2008/02/13/using-asp-net-validation-from-client-code.aspx" rel="nofollow">sample code</a> of how <co... |
Recursive type casting <p>I got a typical 'vector4' class with an operator float* to autocast it for gl*4fv as well as [].
There's also 'const' version for optimizations for the compiler as well as const refrences, and this works fine:</p>
<pre><code>typedef struct vec4
{
...
// ------------------------------------... | <p>C++ can perform automatic conversions, but by the standard will not perform two consecutive automatic conversions.</p>
<p>It was deemed too conducive to unintentional bugs and ambiguities.</p>
<p>Three options that may work for you:</p>
<p><strong>Explicitly perform the first cast yourself when you want a <code>f... |
How to create Genmodel and model code from ecore programmatically using EMF API? <p>are there any tutorials available for doing so?</p>
| <p>Probably you'd be better to ask on the EMF newsgroup because I found this only because of a Google alert. There's and ant task for doing this, EcoreGeneratorTask, so that would be a good place to look for how to do this.</p>
|
CSS divs don't stack in proper vertical order <p>I have two divs. I want one with id "hor_rule" to appear beneath the other with id "header".</p>
<p>I was under the impression that this should happen automatically. I must be making some silly error.</p>
<p>--- The HTML file ---</p>
<pre><code><!DOCTYPE html PUBLI... | <p>your "header" div is floated and has a width of 64%... this means that something (without a width applied to it, or of a width less than 36% of the container) below it will slide up and fill that spot. set the width of "hor_rule" to something higher than 36%.</p>
<p>alternatively, you can set your "container" div t... |
SQL Server DB - Deleting Records, or setting an IsDeleted flag? <blockquote>
<p><strong>Possible Duplicate:</strong><br />
<a href="http://stackoverflow.com/questions/771197/what-to-do-when-i-want-to-use-database-constraints-but-only-mark-as-deleted-inste">What to do when I want to use database constraints but only... | <p>As a rule of thumb I never delete any data. The type of business I am in there are always questions suchas 'Of the customers that cancelled how many of them had a widget of size 4' If I had deleted the customer how could I get it. Or more likely if had deleted a widget of size 4 from the widget table this would caus... |
How do I find the location of the executable in C? <p>Is there a way in C/C++ to find the location (full path) of the current executed program?</p>
<p>(The problem with <code>argv[0]</code> is that it does not give the full path.)</p>
| <p>To summarize:</p>
<ul>
<li><p>On Unixes with <code>/proc</code> really straight and realiable way is to:</p>
<ul>
<li><p><code>readlink("/proc/self/exe", buf, bufsize)</code> (Linux)</p></li>
<li><p><code>readlink("/proc/curproc/file", buf, bufsize)</code> (FreeBSD)</p></li>
<li><p><code>readlink("/proc/self/path/... |
Having different ibdata file for multiple databases <p>I have my MySQL server running with 4 databases and innodb_data_file_path set to the default configuration[ibdata1]. I see the size of this file on disk growing as big as 1GB. This file will only grow as the application that runs this server is collecting the monit... | <p>Add this option to my.cnf : *innodb_file_per_table*</p>
<p>Reference :
<a href="http://dev.mysql.com/doc/refman/5.0/en/innodb-multiple-tablespaces.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.0/en/innodb-multiple-tablespaces.html</a></p>
|
Is there a better multi-select than the default TDBGrid in Delphi? <p>First off, this applies to Delphi 5 Enterprise, as this is what we use at work. There's no view to upgrading any time soon, as this version "does what we need", apparently.</p>
<p>After setting the dgRowSelect and dgMultiSelect options on a TDBGrid,... | <p>The Infopower library, available from Woll2Woll [<a href="http://www.woll2woll.com" rel="nofollow">http://www.woll2woll.com</a>], contains an extended datagrid which includes properties (msoAutoUnselect,msoShiftSelect) that will provide the behavior you want.</p>
<p>These properties were introduced very early in In... |
How to to terminate a windows batch file from within a 'call'ed routine? <p>I've got a windows batch file, with a few sub-routines in it something like this:</p>
<pre><code>call :a
goto :eof
:a
call :b
goto :eof
:b
:: How do I directly exit here from here?
goto :eof
</code></pre>
<p>I'm running this in a cmd window... | <p>You can call your subroutines like so:</p>
<pre><code>call :b||exit /b 1
</code></pre>
<p>which is equivalent to</p>
<pre><code>call :b
if errorlevel 1 exit /b 1
</code></pre>
<p>It's slightly shorter and saves you one line, but it's still not ideal, I agree.</p>
<p>Other than that I don't see a way.</p>
<p><s... |
Javascript method <p>I am making a favorite list where you can add items through javascript and remove them again. The values are stored in cookies to remember the list when the user returns. The problem I have is that the method to remove the items from the list doesn't get run, unless there has been a postback first.... | <p>This was just a very stupid error. I can't use onclientclick on regular html-elements, but need to use onclick instead. </p>
|
java newbie question: richer java subprocesses <p>I would like to spawn a subprocess Java Virtual Machine (through a Java API call) and communicate with it.</p>
<p>Maybe I'm just not searching for the right thing on Google, but I keep getting pointed back to Runtime.exec(), which is not what I want. I know I could con... | <p>As long as the classes you want to load are in a JAR file or a directory tree separate from your main app, using an URLClassLoader and running them in a separate Thread works fine. AFAIK all Java app servers work like this, so it's definitely a proven technique.</p>
|
javascript slide slick_accessible_slideshow <p>i have three div's in an HTML page. the page look like this</p>
<p>HTML Page:</p>
<pre><code> leftArrow(>) div rightArrow(<)
</code></pre>
<p>i need to move the div from left to right and right to left. using javascript and DHTMl</p>
<p>or JQuery.</p>
<p>I... | <p>Yes it's possible, i've done it in the past without using jQuery.</p>
<p>I have a the following markup:</p>
<pre><code><div id="HorThumbs" style="overflow:hidden;width:500px">
<div id="HorScroller" style="width:1000px">
//Data to be shown
</div>
</div>
var scrollStep=1;
var timerLe... |
Help reviewing the following code, is it thread safe? <pre><code>private static Callback callback;
public Foo()
{
super(getCallback());
}
private static Callback getCallback()
{
callback = new Callback();
return callback;
}
</code></pre>
<p>Constructor Foo() can potentially be called from multiple thread... | <p>Yes, you are correct. It's possible for two instances of <code>Foo</code> to end up with the same <code>CallBack</code> instance when two threads enter the <code>getCallback()</code> method simultaneously and one assigns a new <code>CallBack</code> to the static field while the other has already done this but not ye... |
Write to UTF-8 file in Python <p>I'm really confused with the <code>codecs.open function</code>. When I do:</p>
<pre><code>file = codecs.open("temp", "w", "utf-8")
file.write(codecs.BOM_UTF8)
file.close()
</code></pre>
<p>It gives me the error</p>
<blockquote>
<p>UnicodeDecodeError: 'ascii' codec can't decode byte... | <p>Disclaimer: I'm not a Python programmer.</p>
<p>I believe the problem is that <a href="https://docs.python.org/library/codecs.html#codecs.BOM_UTF8"><code>codecs.BOM_UTF8</code></a> is a byte string, not a Unicode string. I suspect the file handler is trying to guess what you really mean based on "I'm meant to be wr... |
Accessible textbox <p>I have an HTML page with many textboxes. I have to label them for accessibility purpose.But, i don't want label to visible.Is it possible? Or, is there any other design alternative?</p>
| <p>There are various ways to put text in a page and have it hidden to visual users while accessible to screen reader users (such as high negative text-indent).</p>
<p>However, "accessibility" isn't a line between "People who have no problems using the web" and "People who are blind". There are plenty of people who fit... |
Oddity with ToString() custom number formatting <p>I am trying to convert numbers in the form 123456 to 123,456 which I find easy enough by using the .NET ToString() method with a custom format of N0.</p>
<p>However in one case of data I am getting strange formats whilst using this method.</p>
<p>In this case I am ge... | <p>It looks to me simply that you've set the data-type of the columns in the <code>DataTable</code> incorrectly. Try making it explicit as an <code>int</code> (it looks like <code>DateTime</code> at the moment).</p>
<p>Also - the job of the <code>DataTable</code> is to <em>hold</em> data; not to disply it. You could s... |
Framework/library for simple 2D animation in Java? <p>I want to write a very simple game in Java to demonstrate a wireless controller I've built. I thought of something like Breakout or Pong. Currently, I have a prototype Pong implementation that does all animation directly using the AWT functionality. However, this is... | <p><a href="http://stackoverflow.com/questions/293079/java-2d-game-frameworks">This question</a> relates to comparisons of Java 2D frameworks and may be of use.</p>
<p>I'm interested as to why your original implementation is a CPU hog. Is that just whilst it's drawing, or is it consuming CPU resource <em>all the time<... |
How to find a particular position of a selected item in Listbox making the Buttons Enabled in C#? <p>I have a list box with items like <strong>A B C D E</strong>.<br>
I also have two buttons <strong>Move UP</strong> and <strong>Move Down</strong> with it.<br>
I have already made their properties false in the property ... | <p>Handle the SelectedIndexChanged event of the ListBox. If the SelectedIndex is greater than 0, enable "move up". If it is lesser than count - 1, enable "move down"</p>
|
Postgresql cache (memory) performance + how to warm up the cache <p>I have a DB table with 25M rows, ~3K each (i.e. ~75GB), that together with multiple indexes I use (an additional 15-20GB) will not fit entirely in memory (64GB on machine). A typical query locates 300 rows thru an index, optionally filters them down t... | <p>Regarding your first point, the contrib module "pg_buffercache" allows you to inspect the contents of the buffer cache. I like to define this:</p>
<pre><code>create or replace view util.buffercache_hogs as
select case
when pg_buffercache.reldatabase = 0
then '- global'
when pg_buffercache.... |
size limit for XML datatype in SQL 2005 <p>Is there a size limit on the XML data type in SQL 2005?</p>
<p>When I try to return anything more than 44kb size of the XML string from my stored proc, it just returns an empty string. I am using FOR XML PATH to return hierarchical data sets in XML format from my stored procs... | <p><a href="http://msdn.microsoft.com/en-us/library/ms187339%28SQL.90%29.aspx">It's 2GB</a> for xml datatype.</p>
<p>Are you only getting the 44k on SSMS or in your client code?
SSMS limits LOB type data under Tools..Options..Query Results</p>
<p>Edit, after comment:</p>
<p>SSMS has probably changed the value back i... |
Getting response from bluetooth device <p>I'm trying to write a simple module that will enable sending SMS. I using bluetooth to connect to the mobile using the below example:</p>
<h1>file: bt-sendsms.py</h1>
<pre><code>import bluetooth
target = '00:32:AC:32:36:E8' # Mobile address
print "Trying to send SMS on %s... | <p>From the Python you look like you are opening any old RFCOMM channel and hoping it will magically take the AT commands and do the messaging.</p>
<p>I think (and I could be wrong) that you need to connect to a specific profile/sevice channel and I think for SMS it is the the Messaging Access Profile (MAP), which is ... |
How to Bind List<myclass> data with gridview? <p><a href="http://stackoverflow.com/questions/934479/how-to-adjust-is-a-type-but-is-used-like-a-variable"> Look please my web service codes return type List</a></p>
<p>i get data from web service with listformat List; also created a gridview below and return list to gridv... | <p>Check the contents of your list that you generate. If you do not have a field called name that gets output when you call <code>GetList()</code> then it's going to break because the GridView is looking for it and it's not there to bind to.</p>
<p>You may have to paste some more code for us to verify that, however.</... |
Strip out extra spaces when there is more than one in a row <p>I am after a Regex expression that will strip out white spaces when there is two or more repeated, leaving just one space behind.</p>
<p>For example this line</p>
<pre><code>The cow jumped over the moon
</code></pre>
<p>which has multiple spaces sepa... | <pre><code>string cleanedString = Regex.Replace(input, @"\s+", " ");
</code></pre>
|
Future proof file storage <p>I accept file uploads from users. Each file has a pointer in the db which has info on the file location in the filesystem.
Currently, I'm storing the files in the filesystem non categorically, and each file is currently just named a unique value. All categorisation and naming etc is done in... | <p>Yes, the way you are doing this is the best way to do it. You are using a file system to store files and a database to sore structured data. </p>
<p>One suggestion I would make is that you create a directory tree on the file system. You may one day run up against a maximum files per directory limitation of your fil... |
Hibernate second-level cache ehcache.xml, the cache setting for entities can't be read to HIbernate <p>To make it clear and easy, I have two projects:
1. An Entity project where there are all the entity classes in this project.
2. An project that contains a main() function to run the application, My ehcache.xml is plac... | <p>I found where my problem is. I'm using ehcache as cache provider. In the ehcache.xml,I think the defaultCache element is also used for ALL THE QueryCaches too, if I didn't set the standardQueryCache element. So it's not important whether or not I set the maxElementsInMemory of to "0", because all the QueryCache are... |
"Action" column in a DataReader <p>I have an "action" column in my repeater which shows actions a user can select for an item. The column contains ASP.NET HyperLink or LinkButton controls. Some actions are based on whether a user is in a role, which I determine programatically. I'm struggling with the best way to dy... | <p>The "normal" way to apply any sort of dynamic rendering to a Template based control such as the <code>Repeater</code> is to handle the <code>ItemCreated</code> or <code>ItemDataBound</code> events.</p>
<p>In your particular case, you could check appropriate conditions within that event handler and toggle the visibi... |
How can I convert hex number to integers and strings in Objective C? <p>Given the example of an array like this: </p>
<pre><code>idx = [ 0xe, 0x3, 0x6, 0x8, 0x2 ]
</code></pre>
<p>I want to get an integer and string representation of each of the specified items in Objective C. I have mocked up a ruby example which ... | <p>To get the decimal and hexadecimal equivalents, you would do:</p>
<pre><code>int number = 0xe; // or 0x3, 0x6, 0x8, 0x2
NSString * decimalString = [NSString stringWithFormat:@"%d", number];
NSString * hexString = [NSString stringWithFormat:@"%x", number];
</code></pre>
|
Can I send / receive window messages without a window? <p>I'm writing a .NET wrapper around an old MFC-based library we have. It's based around a class that sends notifications using window messages; it has a function that lets the user pass in a handle to a window, and that window will receive the messages.</p>
<p>I... | <p>There is a concept of <a href="http://msdn.microsoft.com/en-us/library/ms632599%28VS.85%29.aspx#message_only" rel="nofollow">MessageOnly Windows</a> which can help you. You may create an internal message only window in your wrapper class and pass this handle to the old library. </p>
|
Running gem server in passenger <p>I'm running a few rails/rake apps in Apache/passenger and I want to add the documentation app served by <code>gem server</code> to these apps, so I can easily give it a special (sub)domain, like docs.example.org, so it's easily available for all members of our team and nobody has to s... | <p>I would recommend looking into bdoc instead of <code>gem server</code>, it allows the user to access all their gem docs without a server running at all. It would also be trivial to modify bdoc to output to a specific directory then you could easily add a step to regenerate the docs.</p>
<p>The nice thing about havi... |
Can I change a private readonly field in C# using reflection? <p>I am wondering, since a lot of things can be done using reflection, can I change a private readonly field after the constructor completed its execution?<br>
(note: just curiosity)</p>
<pre><code>public class Foo
{
private readonly int bar;
public Foo(... | <p>You can:</p>
<pre><code>typeof(Foo)
.GetField("bar",BindingFlags.Instance|BindingFlags.NonPublic)
.SetValue(foo,567);
</code></pre>
|
NSImage to Base64 <p>I need to create a base64 string representation of an NSImage cocoa object. What's the best way of handling this, apple documentation seems to be a little short on the subject (or I just cant find it). Base64 encoding seems rather complex from the outside.</p>
<p>Any help would be very much apprec... | <p>An NSImage is a very abstract object. NSImage doesn't really care whether it's a raster image or a vector image; an NSImage object can even have raster, vector, <em>and even programmatic</em> representations all at onceâit's that general.</p>
<p>Before you can generate Base64 data, you must decide <em>what</em> y... |
How to make binary distribution of Qt application for Linux <p>I am developing cross-platform Qt application.
It is freeware though not open-source. Therefore I want to distribute it as a compiled binary.</p>
<p>On windows there is no problem, I pack my compiled 'exe' along with MinGW's and Qt's DLLs and everything go... | <p>Shared libraries is the way to go, but you can avoid using <code>LD_LIBRARY_PATH</code> (which involves running the application using a launcher shell script, etc) building your binary with the <code>-rpath</code> compiler flag, pointing to there you store your libraries.</p>
<p>For example, I store my libraries ei... |
removing a circular DB relationship <p>How can I get rid of a circular relationship in my db structure. I have an entity called Item. An item can have a sub item/s (circular relationship). An item can have more than one rate depending on what financial year it is(rate_per_year entity created for that purpose and a 1-m ... | <p>If the item->subitem chain can continue at multiple levels, then you have no real choice but it like you have it. If only a top-level item can have subitems, then you can break out the structure into two tiers, possibly <code>item</code> and <code>group</code> where only <code>item</code> can have a rate, and may o... |
WCF throws FileNotFound exception for "System.ServiceModel" when creating ServiceHost <p>I'm running into a really strange problem with WCF. I have 2 projects in a solution, each of them starts up some self-hosted WCF services.</p>
<p>Project 1:</p>
<pre><code>myService = new ServiceHost(typeof(MyService1));
</code>... | <p><strong>Found My Problem:</strong></p>
<p>For both projects (lets call them MyProj1 and MyProj2) I have this line in the .dll.config file:</p>
<pre><code><serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="System.ServiceModel.ServiceAuthorizationManager, System.ServiceModel" ... |
ASP.NET Membership passwordStrengthRegularExpression and GeneratePassword <p>The generatePassword method in the asp.net membership provider allows only length and alphanumeric characters to be set.</p>
<p>However there is also the property passwordStrengthRegularExpression </p>
<p>Does GeneratePassword makes use of t... | <p>No, unfortunately it doesn't. Please see <a href="http://msdn.microsoft.com/en-us/library/system.web.security.membership.generatepassword.aspx"><code>GeneratePassword</code></a>:</p>
<blockquote>
<p>The random password created by the
GeneratePassword method is not
guaranteed to pass the regular
expression ... |
How to digitally sign a PDF(or another document) in Java? <p>What libraries can be used to digitally sign documents in Java?</p>
| <p><a href="http://www.lowagie.com/iText/">iText</a> is probably the highest quality PDF manipulation library I've seen commercial or open source, and it absolutely can be used to sign PDF documents.</p>
<ul>
<li><a href="http://itextpdf.sourceforge.net/howtosign.html#howtosign">From the documentation</a>.</li>
<li><a... |
how do I display a custom form windows workflow custom activity <p>Is it possible to show a windows form when implementing a custom activity?</p>
<p>For instance, how do I show a custom form, when a user double-clicks on my activity in the designer?</p>
<p>Or perhaps a custom form could be displayed when a user click... | <p>I'm not to sure if that can be done.</p>
<p>For any interaction required with my custom activities I would create a number of dependency properties which would appear in the properties window for the custom activity when it gets dragged onto the designer.</p>
<p>e.g. From property for custom email activity</p>
<p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.