input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Need to know some basics of LinkedList class in Java <pre><code>package abc;
class DependencyDataCollection
{
private int sNo;
private String sessionID;
private int noOfDependency;
private int noOfRejection;
private int totalValue;
/** Creates a new instance of DependencyDataCollection */
... | <p>Here are the changes I would make, rationale is in the comments.</p>
<pre><code>import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
class DependencyDataCollection
{
// makte them fnal, then you ha... |
Have a good hash function for a C++ hash table? <p>I am in need of a performance-oriented hash function implementation in C++ for a hash table that I will be coding. I looked around already and only found questions asking what's a good hash function "in general". I've considered CRC32 (but where to find good implementa... | <p>Now assumming you want a hash, and want something <strong>blazing fast</strong> that would work in your case, because your strings are just 6 chars long you could use this magic:</p>
<pre><code>size_t precision = 2; //change the precision with this
size_t hash(const char* str)
{
return (*(size_t*)str)>> pr... |
Will there be any problem by copying a version of Java from one PC to another instead of installing it <p>I'd like to embed the directory and subdirectories from a current Java 1.6 update 11 into a software package that I will be installing on several other PCs and will like to know what the cons about doing this are (... | <p>On Linux, no issues. On Windows too, should not be any issues if you are using the JDK/JRE by setting the path and JAVA_HOME to the directory. You won't be able to use the applet plugin, however, without messing with the registry.</p>
|
What is the best way to cater for users reporting bugs? <p>ok, <a href="http://www.bugzilla.org/" rel="nofollow">Bugzilla</a> would scare the willies out of the average end-user. Even things like <a href="http://www.mantisbt.org/" rel="nofollow">Mantis</a> are a little spooky for the uninitiated.</p>
<p>What method, w... | <p>You're absolutely right - it's not up to the user to use bugzilla. that's for devs.</p>
<p>Error reporting from the user side needs to be really simple if you expect users to use it. (ie. When I see the "report this bug to MS" i usually hit cancel even though it's a one-click mechanism.)</p>
<p>It's also not just ... |
Connecting to a CDMA network IN from Java <p>Am using java to develop program that receives and processes SMS messages. I have been able to code the processing of the SMS Messages received and its working perfectly. Now the challenge i have is receiving the the SMS Messages from the CDMA network. When the application i... | <p>I assume that by IN you mean <a href="http://en.wikipedia.org/wiki/Intelligent%5Fnetwork" rel="nofollow">Intelligent Network</a>? Usually IN is not relevant for sending/receiving SMS messages - you need to connect to the <a href="http://en.wikipedia.org/wiki/Short%5Fmessage%5Fservice%5Fcenter" rel="nofollow">Short M... |
Problems with IRQs when connecting two digium card in and asterisk box <p>I have two Digium Wildcard TDM800P with 8 FXO ports each. When I connect both at the same time IRQ misses start showing up making my computer unresponsive and unusable. </p>
<p>One card works fine but I need all 16 FXO ports to work to receive c... | <p>This question would be better posted at serverfault, as this is a pure hardware problem.</p>
<p>The problem you are experiencing is typical of high interrupt PCI cards in general, and Digium telephony cards in particular. Please keep in mind that the problem stems from having both cards in the <strong>same</strong>... |
Extending/replacing Html.Image for Amazon S3 (or other CDN) <p>Just want to confirm that there is no way to extend or replace Html.Image functionality without writing a replacement function.</p>
<p>I want to write a function that will use Amazon's S3 service for hosting images.</p>
<p>The best approach I've come up w... | <p>No you are right, you need to create your own extension method to handle custom scenarios like this.</p>
|
Constructors vs Factory Methods <p>When modelling classes, what is the preferred way of initializing:</p>
<ol>
<li>Constructors, or</li>
<li>Factory Methods</li>
</ol>
<p>And what would be the considerations for using either of them?</p>
<p>In certain situations, I prefer having a factory method which returns null i... | <p>Ask yourself what they are and why do we have them. They both are there to create instance of an object.</p>
<pre><code>ElementarySchool school = new ElementarySchool();
ElementarySchool school = SchoolFactory.Construct(); // new ElementarySchool() inside
</code></pre>
<p>No difference so far. Now imagine that we ... |
NHibernate logs and executes a query twice in a row <p>I am using: NHibernate, NHibernate.Linq and Fluent NHibernate on SQL Server Express 2008. I am selecting an entity using a predicate on a referenced property (many-one mapping). I have fetch=join, unique=true, lazy-load=false. I enabled the log4net log and when any... | <p>The problem was caused by another mapping I had declared. I had a class inheriting from Client which had an associated mapping. This is what caused NHibernate to query twice. I noticed this because when using Linq() it returned the subclass, not Client itself. This particular instance of inheritance and mapping was ... |
My VB.NET Website Hangs For A Long Time Then Displays Nothing <p>Okay, this is a weird issue that I've been having with a recent project I'm undertaking.</p>
<p>Occasionally, my website will stop functioning and anytime an ASP page is accessed, the browser will hang for many minutes before bringing up a correctly form... | <p>It sounds like it may be an issue with your Web Server. Do you have the correct version of .Net installed? Is your Web Server setup to host Asp.Net?</p>
|
Implementing CAPTCHA after 50% of Article <p>We are planning to put large number of Business Research Reports and Articles from our intranet on to the Internet. However, we don't want others to copy the content and host it on their own.</p>
<p>I read about protection by CAPTCHA and was wondering if this is possible. R... | <p>There's a really good Captcha service provided by Recaptcha - <a href="http://recaptcha.net/" rel="nofollow">http://recaptcha.net/</a></p>
<p>There is a PHP class that you can use to do all the hard work.</p>
<p>It's important to bear in mind that search engines aren't able to solve a Captcha and so they will only... |
Prevent windows from going into sleep when my program is running? <p>I have to stop windows from going into sleep when my program is running.</p>
<p>And I don't only want to prevent the sleep-timer, I also want to cancel the sleep-event if I press the sleep-button or in any other way actively tell the computer to slee... | <p>I had a problem like this with a hardware device connected via usb. XP /Vista would sleep/hibernate right in the middle of ... Great you say, when it resumes it can just continue. If the hardware is still connected!!!
Users have the habit of pulling cables out whenever they feel like it. </p>
<p>You need to handl... |
How to protect i18n bundle integrity in larger teams? <p>We use Subversion to manage our project files, including the seam managed message bundles which have the highest mutation rate of the whole project.</p>
<p>Ever so often a developer reads past a line during diff merge and accidentally reverts some changes, which... | <p>You didn't mention how you find out who breaks bundle integrity. But I'm guessing you can tell. I would give these two punishments to the one who broke the build:</p>
<ul>
<li>Make tests to ensure that the reason for the break cannot happen again.</li>
<li>Build X additional number of tests. This makes them more fa... |
Matching parentheses in Visual Studios 2005 <p>When doing developement for linux, I have a file for vim that changes the colors of matching parentheses.</p>
<p>So for example, given the following line:
<pre><code>if( (foo / 12 == 4) && arr[i] == 2 ) {}</pre></code>
The parentheses that opened and closed th... | <p>I don't know of something that exactly does that, but I'll draw your attention to the functionality that is built in. When you type a character that can match (such as a close-paren), it will briefly highlight the matching character. The key combination ctrl-] will take you between matching characters.</p>
|
strange linq to nhibernate issue, Invalid cast from 'System.Int32' <p>Calling Get in the following code works fine:</p>
<pre><code>public class ContractService : IContractService
{
private readonly IRepository<Contract> repository;
public ContractService(IRepository<Contract> repository)
{
... | <p>I believe the problem is that Linq/NHibernate is trying to map IEntity.Id to a table column instead of TEntity.Id. I had this problem with a LinqToSql repository implementation. The way around it was to use an expression like this:</p>
<pre><code>private static Expression<Func<TEntity, bool>> GetFindE... |
Calling synchronous methods asynchronously on the UI thread <p>I have written a class that checks a POP3 account and I'd like it to execute on a thread other than the UI thread.</p>
<p>To do this, I've chosen the asynchronous route.</p>
<p>In order to get the result from pop3delegate.BeginInvoke(null,null) I need to ... | <p>Try using BackgroundWorker class, its was designed to do exactly what you need.</p>
<p>Example and more details on msdn: <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx</a... |
multiple processes writing to a single log file <p>This is intended to be a lightweight generic solution, although the problem is currently with a IIS CGI application that needs to log the timeline of events (second resolution) for troubleshooting a situation where a later request ends up in the MySQL database BEFORE t... | <p>Try the simplest solution first - each write to the log opens and closes the file. If you experience problems with this, which you probably won't , look for another solution.</p>
|
jQuery: Selecting an element in inside an already selected element <p>For example:</p>
<pre><code>$("table tr").click( function(event)
{
//Say, here i want get the data of td element where its class name="special"
});
</code></pre>
<p>Is there any way I can select a element while in the click event, a element unde... | <p>In this specific case, you can do this:</p>
<pre><code>$("table tr").click( function(event)
{
$(this).children('td.special').whatEverYouNeed();
});
</code></pre>
<p>Generally speaking, you need to use <code>find()</code>:</p>
<pre><code>$("table tr").click( function(event)
{
$(this).find('td.special').whatE... |
Variable/Type declaration private by default <p>Is there a way to make the default access modifier public for variable/method/class declarations?</p>
<p>I think by default, class declarations are private yes?</p>
| <p>You can't change the defaults. They default to the most restrictive.</p>
<p>The default accessibility (for the type) for a top-level type is <code>internal</code>.
The default accessibility (for the type) for a nested type is <code>private</code>.
The default accessibility for members is private.</p>
<p>The only t... |
soap4r custom headers <p>I've been working with soap4r and trying to use the SOAP::Header::SimpleHandler, I'm trying to get it to put a custom header on the outgoing message, but I can't work out how to get it to include attributes rather than as subelements:</p>
<pre><code> class ServiceContext < SOAP::Header::... | <p>soap4r is not very pretty. I poked around the rdocs abit and it looks like the simplest way to fix your problem would be to have <code>on_simple_outbound</code> return the string representation of the element you want to create.</p>
<p>so instead of</p>
<pre><code>return {"Identities" => {"Username" => usern... |
How do I autosize a blockui dialog to the available visible area with JQuery? <p>I need to resize a div shown as a message in blockUI so that it fills the visible screen area less some hardcoded fudge factor (so width - 100 say). The premise is that I can show a smaller image on the screen but if the user needs an enla... | <p>I've got it working now. I've used the window width and height methods as described above.
The code assumes some fudge numbers purely to make it work :).</p>
<p>Note that I'm clamping the maximum width and height. Something that I'm going to move to my dynamic image generation so I don't consume too many resources.... |
When to use database views and when not? <p>This question is about database views, <strong>not</strong> materialized-views.</p>
<p>Pros:</p>
<ul>
<li>Query simplification.</li>
<li>Avoid repeat the same joins on multiples queries.</li>
<li>Avoid magic numbers.</li>
</ul>
<p>Cons:</p>
<ul>
<li>Hiding real queries (m... | <p>Pros:
Allows you to change the underlying data structures without affecting the queries applications are using (as long as your view can hide the data structures)</p>
|
How to add several dependent records with LINQ2SQL <p>I have two tables. One table contains comments on posts, another contains commenter information like nickname, site, etc..
There is FK relations betwin two tables
Comment.CommenterId -> Commenter.Id
Whenever user posts a comment I need to add comment and commenter a... | <p>you can do this like so:</p>
<pre><code>Comment comment = new Comment(); // your constructor here
Commenter commenter = new Commenter(); // use your constructor;
comment.Commenter = commenter; // linq2sql creates this property for you.
datacontext.Commenter.InsertOnSubmit(commenter);
datacontext.Comment.InsertOnS... |
What does "() =>" mean in C#? <p>Came across the following line in the Composite Application Guidelines.</p>
<p>I know the <strong>=></strong> is a lambda but what does the <strong>()</strong> mean?</p>
<p>What are some other examples of this?</p>
<p>What is it called so I can search for it?</p>
<pre><code>this.reg... | <p>It's a lambda expression that takes 0 arguments</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb397687.aspx">http://msdn.microsoft.com/en-us/library/bb397687.aspx</a></p>
|
Prevent form from stealing focus <p>When I run my VB.NET Winforms app I do not want it to steal the focus from the other open apps. FYI, my app is started from the command line but that shouldn't make a difference. I've seen question <a href="http://stackoverflow.com/questions/577076/topmost-window-form-steal-focus">... | <p>Here is what I did to get this working:</p>
<p>I added the following code to my Form1.vb file:</p>
<pre><code>Protected Overloads Overrides ReadOnly Property ShowWithoutActivation() As Boolean
Get
Return True
End Get
End Property
</code></pre>
<p>But still no success. </p>
<p>Then I unch... |
Why does a report throw an error when the corresponding query doesn't? <p>I have to use a Microsoft Access application. (At least until I've got time to rewrite it in another language.)</p>
<p>I've got a report that throws the error "Syntax error in PARAMETER clause."</p>
<p>At the moment the SQL looks like this:</p>... | <p>Could this be a bug that's fixed by MS Office Service Pack 1?</p>
<p><a href="http://support.microsoft.com/kb/942378" rel="nofollow">http://support.microsoft.com/kb/942378</a></p>
<p>About a third the way down that document:</p>
<p><em>Error message when you execute a query that contains parameters in Access 2007... |
Errors on beginner bash script <p>could u help me out?
I run this on cygwin as ./test.sh and I get unexpected end of file on line 51.
Any thoughts?</p>
<p>Thx in advance</p>
<p>LAST EDIT: final version 'runnin on CygWin, the problem was with the line break, CrLf instead Lf.</p>
<pre><code>#!/bin/sh
#################... | <p>"set" isn't bash syntax. Instead of "set foo = bar", you want "foo=bar".</p>
<p>Note: I wrote the corrected form without spaces for a reason. It <em>has</em> to be written that way. Your updated question is still wrong.</p>
|
How to make schtasks work after the user's password has changed? <p>On Windows machines, <a href="http://support.microsoft.com/kb/308569" rel="nofollow">schtasks</a> is a utility similar to cron for scheduling jobs to run on a regular basis.</p>
<p>Problem is, when you define a schtask, you must specify the userid <em... | <p>This doesn't <em>quite</em> answer your question, but a common workaround is to create a user (with appropriate privileges) and use that account solely for executing scheduled tasks.</p>
<p>As the user account is created with a non-expiring password, the sysadmin who creates it should choose an appropriately strong... |
Configuring Windows DNS resolver cache <p>Note that I'm talking about the client DNS resolver cache. This message is not concerned with the Windows DNS Server.</p>
<p>I have a C# program that does a lot of DNS resolutions. Because the HTTPWebRequest component won't let me change the Host header, I can't create my ow... | <p>With these settings, after just a few minutes on the web, I am seeing 1517 cached entries:</p>
<p>REGEDIT4 </p>
<p>[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters]<br>
"QueryIpMatching"=dword:00000001<br>
"NegativeCacheTime"=dword:00000000<br>
"NegativeSOACacheTime"=dword:00000000<br>
"C... |
Different style on buttons in messagebox in different projects <p>I have a problem with the style of the button in a messagebox.
If I call the following line of code in a current project the button get one type of visual apperance/style. And If I create a new VB.NET Windows Application project it gets a standard Window... | <p>I cannot see the image from where I am so I'm not sure if this will help you.</p>
<p>Open the Project Properties for each solution and look at the Application tab.</p>
<p>Is the "Enable Applicaton Framework" item ticked? And if so, is the "Enable XP Visual Styles" item also ticked?</p>
<p>That may the difference... |
Regex replace consecutive non-alpha chars with single char <p>I want to replace all non-alpha characters in a string with a plus '+' sign, but making sure that a group of more than one non-alpha chars is only replaced by one plus sign.</p>
<p>I had thought the following might work but apparently not:</p>
<pre><code>S... | <p>Try System.Text.RegularExpressions.Regex.Replace(name, @"\W+", "+")</p>
<p>For this: "sasa-==[]<em>&^asdsa2435" matches -==[]</em>&^</p>
|
.net HttpCookie class / session cookie questions <p>I am interested on how to make a regular <code>HttpCookie</code> object into a cookie that expires at the end of a session. I am not interested in someone <code>showing me HttpContext.Session</code>. How does a session cookie look in the response headers compared to a... | <p>A session cookie is just a cookie that doesn't have any expiration date set.</p>
<pre><code>Response.Cookies.Add(new HttpCookie("name", "value"));
</code></pre>
<p>or:</p>
<pre><code>Response.Cookies["name"] = "value";
</code></pre>
|
Store pointers to member function in the map <p>I'd like to map string to an instance member functions, and store each mapping in the map.</p>
<p>What is the clean way of doing something like that?</p>
<pre><code>class MyClass
{
//........
virtual double GetX();
virtual double GetSomethingElse();
virtual... | <p>Looks fine to me, but for the fact that <code>descrToFuncMap</code> needs to be declared <code>static</code> if you intend to initialise it from inside the static function <code>Initialize()</code>.</p>
<p>If you want to make sure that <code>Initialize()</code> gets called, and gets called just once, you can use th... |
Pure virtual destructor in C++ <p>Is it wrong to write:</p>
<pre><code>class A {
public:
virtual ~A() = 0;
};
</code></pre>
<p>for an abstract base class?</p>
<p>At least that compiles in MSVC... Will it crash at run time?</p>
| <p>Yes. You also need to implement the destructor:</p>
<pre><code>class A {
public:
virtual ~A() = 0;
};
inline A::~A() { }
</code></pre>
<p>should suffice.</p>
<p>And since this got a down vote, I should clarify: If you derive anything from A and then try to delete or destroy it, <code>A</code>'s destructor wi... |
Bash history re-runs: possible command to avoid using !bang!? <p><strong>Scenario:</strong></p>
<p>You are doing your daily Bash shell stuff. You want to run a previous command so you type:</p>
<pre><code>history | grep foocommand
</code></pre>
<p>Then you get a list of all the <code>foocommand</code> stuff you did ... | <p>Press <code>^r</code> (that's <code>CTLR-r</code>), type <code>foocommand</code> press Enter ;)
That will search history and show the latest matching entry</p>
|
How big should a language vocabulary be? <p>I started looking at the upcoming <a href="http://en.wikipedia.org/wiki/C%2B%2B0x" rel="nofollow">C++0x specification</a> today, and I started thinking on what is the right size for a language vocabulary. Initially, it struck me as very annoying that new keywords were introdu... | <blockquote>
<p>How big should a language vocabulary
be?</p>
</blockquote>
<p><strong>42.</strong></p>
|
Can I alter a column in an sqlite table to AUTOINCREMENT after creation? <p>Can I make a field <code>AUTOINCREMENT</code> after made a table? For example, if you create a table like this:</p>
<pre><code>create table person(id integer primary key, name text);
</code></pre>
<p>Then later on realise it needs to auto inc... | <p>You can dump the content to a new table:</p>
<pre><code>CREATE TABLE failed_banks_id (id integer primary key autoincrement, name text, city text, state text, zip integer, acquired_by text, close_date date, updated_date date);
INSERT INTO failed_banks_id(name, city, state, zip, acquired_by,close_date, updated_date)
... |
SQL Reporting Services 2005 - How to get current date as a ReportParameter <p>I have some working reports that must be deployed on SSRS.
One more customization that I want to be added is to automatically select the FromDate as today - 1 month, and ToDate as today.</p>
<p>Specifically, I want to replace the fragment b... | <p>Replace the hard-coded</p>
<pre><code>[Date].&amp;[2008-09-26T00:00:00]
</code></pre>
<p>to formula</p>
<pre><code>=DateAdd("m", -1, Now)
</code></pre>
<p>For "ToDate", just pass a formula that returns current date</p>
<pre><code>=Now
</code></pre>
<p>Now the result looks something like this.</p>
<pre><co... |
What are Splay tree, Red-black tree, AVL tree, B-tree and T-tree? <p>What are Splay tree, Red-black tree, AVL tree, B-tree and T-tree?</p>
<p>I'm looking for good implementations.</p>
| <p>These are all data structures used for quickly searching binary data. Many are used by different data management systems.</p>
<p>They differ in their approach for storage of data. I'd recommend reading up on each.</p>
<p>Splay: <a href="http://en.wikipedia.org/wiki/Splay%5Ftree">http://en.wikipedia.org/wiki/Spla... |
How to code in the unix spirit? (small single task tools) <p>I have written a little script which retrieves pictures and movies from my camera and renames them based on their date and then copies them on my harddrive, managing conflicts automatically (same name? same size? same md5?)<br />
Works pretty well.</p>
<p>Bu... | <p>I would look at the book called The <a href="http://rads.stackoverflow.com/amzn/click/0131429019" rel="nofollow">Art of Unix Programming</a>. </p>
|
"Failed to enable constraints" Error keeps cropping up (seemingly randomly) in my ASP.Net project <p>I have a weird problem where the "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." error sometimes pops up when I am trying to build my project.</p>
... | <p>What unique constraint are you placing on the datatable and have you verified that the data your passing in doesn't have any duplicates? If this is coming from a shared database perhaps someone else is modifying the data which could be causing the randomness.</p>
<h1>Edit</h1>
<p>If that code is exactly as what yo... |
Is Regular Expression usage in Actionscript 3 processor intensive? <p>I was curious of just how much stress AS3 Regular Expression testing can impose on the end-user's pc. Is this something that should be used in moderation, or can most computers handle the exhaustive use of it?</p>
| <p>Only in pathological cases. In practice you never have to worry about it. Regular expressions are very efficient.</p>
<p>For example, many regular expression engines have serious performance problems failing to match a string of 'a's not ending with b with this type of expression.</p>
<pre><code>/a*a*a*a*a*a*a*a*a... |
I have a legacy C++ project that uses motif for GUI. I want to create a Visual Studio solution of this project. Is this possible? <p>I have a legacy C++ project that uses motif for GUI. I want to create a Visual Studio solution of this project. So that I can build/run/debug from Visual studio. Currently I am on a windo... | <p>I'm not aware of a Motif implementation for Windows and I would expect that to be quite hard to do, given that Motif has been intimately tied to X-Windows for decades.</p>
<p>I assume that you want to use Visual Studio as it is a friendlier environment? In that case, you may want to look into getting better tools o... |
Does anyone know of any good (and cheap) domain registration companies who all access to SPF/TXT records <p>I use 1and1 mainly - through legacy/lethargy reasons as I would not recommend them. Unfortunately, they do not allow access to the SPF/TXT records of domains, and I need this. At the moment I do not need a new... | <p>There are <strong>many</strong> such companies and it will be hard to list them all. For instance, the DNS hoster I use sometimes, <a href="http://www.gandi.net/" rel="nofollow">Gandi</a>, allows you to set SRV, LOC, AAAA, TXT (but not SPF and not DS).</p>
<p>Do note that very few programs use the SPF record, they ... |
Serial port dropping data with Readline() <p>I am using serial port to read the data off the scale that is attached to the thin client. In 99% of cases the data is read correctly - ie whatever is on the scale is what is captured by the application.
However, sometimes, it looks like data is dropped. For instance instead... | <p>Don't call DiscardInBuffer. The operating system buffer is filled <a href="http://en.wikipedia.org/wiki/Asynchronous%5Fserial%5Fcommunication" rel="nofollow">asynchronously</a> as data is shifted in through the <a href="http://en.wikipedia.org/wiki/UART" rel="nofollow">UART</a>. Read all of the data and act on it ac... |
How can I display my logo on my DokuWiki's title? <p>I have a DokuWiki and I'd like to place a logo on the title bar at the top of the page? How can I do this? Note that I am not referring to the title bar at the top of the browser, but rather the title bar on the website itself.</p>
<p>I tried inserting the DokuWiki ... | <p>Easy: Rename your logo as "logo.png" and place it into :wiki namespace. It will show automatically.</p>
<p>This solution works on template "<a href="https://www.dokuwiki.org/template%3adokuwiki">dokuwiki</a>" (default one on dokuwiki old stable version "<a href="https://www.dokuwiki.org/changes#release_2012-10-13_a... |
Is it wise to provide access to weak_ptr in a library interface? <p>I have written a library that exposes references to several related object types. All of these objects have their lifetimes managed by the library internally via <code>boost::shared_ptr</code></p>
<p>A user of the library would also be able to know, ... | <p>If the <code>smart_ptr</code>s are already directly accessible to the library's users, then they've already got access to the <code>weak_ptr</code>s, simply via the corresponding <code>weak_ptr</code>'s constructor. But if the <code>smart_ptr</code>s are all internal to the library, that's a different story.</p>
<p... |
Looking for a Command Line Argument Parser for .NET <p>I'm looking for a command line argument parser, such as "Command line parser" from <a href="http://www.sellsbrothers.com/tools/Genghis/">http://www.sellsbrothers.com/tools/Genghis/</a> .</p>
<p>Features I'm looking for:</p>
<ul>
<li>Auto-generation of usage</li>
... | <p>My personal favourite 3rd party commandline parsing library is <a href="http://commandline.codeplex.com/">Command Line Parser</a> and I assume this is the one you are referring to. The most recent release was less than 2 months ago and there are regular commits. If you want a more mature offering you could chek out... |
Grails UrlMappings with URL-pattern ending with "/" <p>I have the following UrlMapping in my Grails UrlMappings class:</p>
<pre><code> "/$something/" {
controller = "controllerName"
action = "actionName"
constraints {
}
}
</code></pre>
<p>Requests to both "/foobar/" and "/foobar" gets route... | <p>Unfortunately this is not possible with Grails' default URL mapping. Slashes are handled in a special way. And this behaviour is hard-coded in the Grails core. It could be overridden using a plugin though.</p>
<p>As a workaround (probably not applicable) I can provide to use it that way:</p>
<pre><code><g:link ... |
Should I make a constants class for my annotations? <p>Which is better?</p>
<ol>
<li><code>@SuppressWarnings("unchecked")</code></li>
<li><code>@SuppressWarnings(AnnotationConstants.UNCHECKED)</code></li>
</ol>
<p>Where <code>AnnotationConstants</code> is a typical constants class...</p>
<pre><code>public final clas... | <p>For this <em>specific</em> example I'd stick with literals. After all, you're trying to suppress warnings - if you use the wrong literal, the warning won't be suppressed, which will draw your attention to the problem.</p>
|
Popup menu radio item checks <p>I'm using a popup menu with wxTaskBarIcon on windows (wxWidgets-2.8.9).
If I fill popup menu with radio items, they do not change state when clicked.
First item in popup menu list is marked as selected. But selecting any other item does not change this.</p>
<p>Currently there is no ite... | <p>You should use <code>EVT_UPDATE_UI(yourCommandID, yourEventHandler)</code> for checking/unchecking and enabling/disabling menu items.
In your UpdateUI event handler you should specify cases when your item is enabled
E.g. you have radiobutton group with commands ID_RADIO_1 and ID_RADIO_2 and they should be checked de... |
non-static and static data and functions <p>Is it possible to call a non-static data member in a static member function?
And is it also possible to call a non-static member function in a static member function?</p>
<p>How do you do it?</p>
| <p>YES - you can, and here is how</p>
<pre><code>class Foo
{
public:
static void staticFunc( const Foo & foo)
{
foo.memberFunc();
}
void memberFunc() const
{
staticFunc(*this);
}
};
</code></pre>
<p>This is the sort of a design, recursion asi... |
How to properly name a class with respect to its namespace? <p>One can often see class names carrying a reference to the namespace to which they belong. One of the most popular examples is the .NET 'Xml' namespace where every single class defined in it is prefixed with the 'Xml' tag.</p>
<p>This has always seemed pret... | <p>I take the "when it is appropriate" approach. The idea is that you want to name your classes using the name that makes the most sense. In some cases it does mean that the class name is somewhat redundant with the namespace, but keep in mind that the namespaces aren't generally seen as part of the class name in the c... |
How to minimize question-marks when encoding a String as Latin-1? <p>When encoding a java String to Latin-1 (ie. charset ISO-8859-1) I currently convert the German symbol β ('\u03B2') to à ('\u00DF') before performing the encoding. I'm trying to avoid a question mark in the encoding where possible.</p>
<p>Can anyon... | <p>U+03B2 is the Greek letter "beta". U+00DF is a German "sharp s". Really not the same thing! If you want a Latin character, wouldn't the letter B be a better fit for β? A little background on your scenario or use cases would help guide suitable suggestions.</p>
<p>There are 10s of thousands of glyphs in Unicode... |
C++ select first not null element <p>Guys,
<br><strong>[question update according to updated requirements]</strong><br>
I've implemented following function which should return either first not null element or throw an exception.<br>
Also could you invent more classic and shorter name like 'max', 'min', 'pair'?</p>
<p... | <p>you can try do next<br></p>
<pre><code>template < typename T >
T get_valuable( const T& firstValue,
const T& alternateValue,
const T& zerroValue = T() )
{
return firstValue != zerroValue ? firstValue : alternateValue;
}
// usage
char *str = "Something"; // so... |
how can I easily get a set of files that share a label in TFS? <p>I'm using TFS and I'd like to be able to get all files that have label XYZ. The only way that I can see to do this is to do "Get Specific Version", Label, Browse the label, pick a file, hit Get. Repeat for every file. If I have 20 files to get then this ... | <p>Just do the "Get Specific Version" with the label option from a folder, and it will apply recursively. From the command line, this looks like:</p>
<p>tf get * /r /version:Lyourlabelname</p>
|
Branching hell, where is the risk vs productivity tipping point? <p>My company is floating the idea of extending our version numbers another notch (e.g. from major.minor.servicepack to major.minor.servicepack.customerfix) to allow for customer specific fixes.</p>
<p>This strikes me as a bad idea on the surface as my e... | <p>Can't help with literature, but customer-specific branching <em>is</em> a bad idea. Been there, done that. Debugging the stuff was pure hell, because of course you had to have all those customer-specific versions <em>available</em> to reproduce the error... some time later, the company had to do a <em>complete</em> ... |
IE6 Red Cross and Border around image <h2>MAJOR UPDATE:</h2>
<h2><strong>I have a PNG fix working on the site. When I remove the PNG fix the red cross and border disapear. What's odd is that the problem only seems to do it with this particular image. There are other Alpha Blended PNG's on the same page that render fin... | <p>You are missing the replacement gif.</p>
<p>All PNG fix methods require that a transparent gif be available to replace the png image, it's part of how the substitution works. If that gif is missing, then you get this broken image appearance even tho the PNG draws fine.</p>
<p>In the case of iepngfix.htc, it expec... |
Architecture question involving search & session state <p>I have a grid with several thousand rows that can be filtered and sorted. On each row you can click a details button, which will bring you a new page with detailed information about the page. Because this is a button, you can't middle click or right click and op... | <p>Session doesn't sound like a winner, won't scale with lots of users.</p>
<p>Hitting the database repeatedly does seem unnecessary, but it depends on the cost - how many users, how often would they refresh/filter and what is the cost of that query? </p>
<p>If you do use querystrings you could cache the pages by par... |
Where is the documentation for CGI.pm? <p>A google search reveals nothing useful. Does Perl have a javadoc equivalent for its modules?</p>
<p>(Update -- I'm aware of perdoc, but that is more like a man page, which is hard to scan to find functionality... I'm looking for a function/operation list (w/ descriptions) sim... | <pre><code>perldoc CGI
</code></pre>
<p>Or online on <a href="https://metacpan.org/pod/CGI" rel="nofollow">MetaCPAN</a>: </p>
|
Apply CSS Style to child elements <p>I want to apply styles only to the table inside the DIV with a particular class:</p>
<p>Note: I'd rather use a css-selector for children elements.</p>
<p>Why does the #1 works and #2 doesnt?</p>
<p>1:</p>
<pre><code>div.test th, div.test td, div.test caption {padding:40px 100px ... | <p>This code "<code>div.test th, td, caption {padding:40px 100px 40px 50px;}</code>" applies a rule to all <code>th</code> elements which are contained by a <code>div</code> element with a class named <code>test</code>, in addition to <strong>all</strong> <code>td</code> elements and <strong>all</strong> <code>caption<... |
Is there a clean approach to justify text in Reporting Service? <p>I'm creating a Report using SQL Reporting Services and I need to justify the text inside a textbox. By justify a mean aligning the text to both margin, left AND right. Just like justifying text in MS Word.</p>
<p>I've been browsing a lot and found only... | <p>My understanding is that there is not a direct way to do this at the moment, although it is on the development team's radar. </p>
|
Web-based .resx file editor? <p>I'm working on a SharePoint site, and the site eventually needs to be localized to many different languages. We can use resource files, but we'd like for the translators to be able to update those files while the site is live, without requiring developer assistance to recompile, redeploy... | <p>I used the one you found: <a href="http://blog.lavablast.com/post/2008/02/RESX-file-Web-Editor.aspx" rel="nofollow">http://blog.lavablast.com/post/2008/02/RESX-file-Web-Editor.aspx</a> It took a couple of hours but it works a treat. I think that having the multiple languages editable at the same time is very helpf... |
Which is the best encryption mechanism, Triple DES or RC4? <p><a href="http://en.wikipedia.org/wiki/Triple%5Fdes" rel="nofollow">Triple DES</a> or <a href="http://en.wikipedia.org/wiki/RC4" rel="nofollow">RC4</a>?</p>
<p>I have the choice to employ either one.</p>
| <p>As a high level view the following comments on both should be useful.</p>
<ul>
<li><p>It is extremely easy to create a protocol based on RC4 (such as WEP) that is of extremely low strength (breakable with commodity hardware in minutes counts as extremely weak).</p></li>
<li><p>Triple DES is not great in that its st... |
How to redirect subfolder to query in Mod Rewrite for IIS 7.0? <p>I'm using Mod Rewrite for IIS 7.0 from iis.net and want to redirect requests:</p>
<ul>
<li><em>http://example.com/users/<strong>foo</em></strong> to <em>http://example.com/User.aspx?<strong>name=foo</em></strong></li>
<li><em>http://example.com/users/<s... | <p>The obvious problem is that your current regexes only match one character in the user name or one number. You'll need to add a plus quantifier inside the parentheses in order to match multiple letters or numbers. See <a href="http://www.regular-expressions.info/repeat.html" rel="nofollow">this page</a> for more inf... |
Cannot Find Symbol <p>I have created a small Java application to automatically test some expressions for a true/false condition.</p>
<p>I am getting two compiler errors in both jGRASP and with the javac command.</p>
<p>The code follows:</p>
<pre><code>public class MathTest {
public static void main(String[] args... | <p>You have a Math class, and you're attempting to use the abs() method. </p>
<p>The question is: Is it your intention to provide this function or are you trying to use the one in java.lang.Math?</p>
<p>For the first, you have to make sure you're declaring that function.</p>
<p>For the second you have to make sure y... |
SEO of asp.net meta tags <p>Simply wondering if any SEO specialists out there know if Google or other search providers index meta differently because of the id generated by asp.net</p>
<p>
| <p>Generally no, they will ignore meta tags and do whatever they please.</p>
<p>As <a href="http://stackoverflow.com/users/25028/stevemegson">stevemegson</a> notes, the description meta tag is useful for providing your own description to display on the SERP (no guarantees it will be used).</p>
<p>Heres a great quote ... |
Wavy underlines in a FlowDocument <p>In WPF, is there an easy way to add wavy underlines (like spelling errors in Word) to <code>FlowDocument</code> elements? There's the <code>Underline</code> class, but there seems to be no way to style it.</p>
| <p>You can create the wavy effect using the following changes to Robert Macne's solution</p>
<p>Add a visual brush to the Grid.Resources section:</p>
<pre><code><VisualBrush x:Key="WavyBrush" Viewbox="0,0,3,2" ViewboxUnits="Absolute" Viewport="0,0.8,6,4" ViewportUnits="Absolute" TileMode="Tile">
<VisualB... |
Flipping UIViews From Top / Bottom <p>I'm well aware that there are only two available UIView transitions, UIViewAnimationTransitionFlipFromLeft and UIViewAnimationTransitionFlipFromRight. I'm wondering if there is anyway that I can implement / emulate a UIViewAnimationTransitionFlipFromTop or UIViewAnimationTransitio... | <p>You can do this by applying a CATransform3D to your main view's CALayer, with your secondary view's CALayer behind it. In <a href="http://stackoverflow.com/questions/372018/widget-flip-behavior-in-core-animation-cocoa/372419#372419">this response</a>, I point to a Mac implementation of this animation by Mike Lee. ... |
iPhone SDK: UIWebView <p>I'm working on an app that uses a UIWebView to display its help files. The webView lives in it's own view, DocViewController...when its called the </p>
<pre><code>- (void)viewDidLoad {
</code></pre>
<p>method uses</p>
<pre><code>[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileUR... | <p><code>viewDidLoad</code> is only called once, unless the view is released and needs to be reloaded. This occurs usually only when the view controller receives a low memory warning. Instead of <code>viewDidLoad</code>, try putting that code in <code>viewWillAppear:</code>, which gets called every time the view will... |
Cast received object to a List<object> or IEnumerable<object> <p>I'm trying to perform the following cast </p>
<pre><code>private void MyMethod(object myObject)
{
if(myObject is IEnumerable)
{
List<object> collection = (List<object>)myObject;
... do something
}
... | <p>C# 4 will have covariant and contravariant template parameters, but until then you have to do something nongeneric like</p>
<pre><code>IList collection = (IList)myObject;
</code></pre>
|
How do I force MS SQL Server to perform an index join? <p>I'm working on an assignment where I'm supposed to compare different join methods in SQL Server, namely hash-join, merge-join and index-join.</p>
<p>I'm having difficulties getting SQL Server to perform an index-join. Can anyone show me how I can force it to u... | <p>You have <a href="http://msdn.microsoft.com/en-us/library/ms173815%28SQL.90%29.aspx">Loop, hash and merge joins (BOL)</a> only. No index joins.</p>
<p>For more than you ever needed to know, <a href="http://blogs.msdn.com/craigfr/archive/2006/07/26/679319.aspx">Craig Friedman's series on JOINs</a> (he's one of the t... |
What is the feasibility of porting a legacy C program to Python? <p>I have a program in C that communicates via UDP with another program (in Java) and then does process manipulation (start/stop) based on the UDP pkt exchange.
Now this C program has been legacy and I want to convert it to Python - do you think Python wi... | <p>Yes, I do think that Python would be a good replacement. I understand that the <a href="http://twistedmatrix.com/trac/" rel="nofollow" title="Twisted">Twisted</a> Python framework is quite popular.</p>
|
Advertising rotation: What's the best to determine when and what ad should be displayed on the page? <p>A client I'm creating a site for wants a custom advertising "engine". The plan is to have a few ads on the site and fill the rest with Google Adsense until all the spots are full.</p>
<p>My problem is how to determi... | <p>Darryl,</p>
<p>I would suggest breaking the ad impressions down by day, so that</p>
<p>1 ad -- 5000/(monthsToDisplay/30)</p>
<p>This will give you a number of impressions you need to serve per day, and should help distribute things nicely over the weeks. So lets assume you have these variables or database fields:... |
jquery get() munching data? <p>I am trying to retrieve an entire webpage using get() and filter() out a specific section. This works fine when the page only includes the section I want to filter but if I input the entire page then it does not work.</p>
<p>Example:</p>
<pre><code> $(document).ready(function() {
$.ge... | <p>You don't want <a href="http://docs.jquery.com/Traversing/filter" rel="nofollow"><code>filter()</code></a>; <code>filter()</code> removes elements from the set that don't match the given expression. You want <a href="http://docs.jquery.com/Traversing/find" rel="nofollow"><code>find()</code></a>:</p>
<pre><code>$(da... |
Problem with adding custom sql to finder condition <p>I am trying to add the following custom sql to a finder condition and there is something not quite right.. I am not an sql expert but had this worked out with a friend who is..(yet they are not familiar with rubyonrails or activerecord or finder)</p>
<pre><code>sta... | <p>The conditions modifier is expecting a condition (e.g. a boolean expression that could go in a where clause) and you are passing it an entire query (a select statement).</p>
<p>It looks as if you are trying to do too much in one go here, and should break it down into smaller steps. A few suggestions:</p>
<ul>
<li... |
IOC dependency injection deployment (bin ? GAC ?) <p>Are there any deployment requirements for the most popular IOC containers (example: Windsor, Ninject, Unity, StructureMap, Autofac) ? Do they all deploy the same?</p>
<p>If you're on a shared host, what challenges will that present (ex. medium trust, etc...)</p>
<... | <p>Most of the IOC frameworks works with private assemblies and i dont know much Web hosters that allows you to deploy files into the GAC.</p>
|
Ejb 3, message driven bean cooperating with a stateful session bean? <p>Hey! I'm relative new to both Java EE and Stackowerflow, please be kind :-) </p>
<p>I have a bunch of devices triggering Java messages to be sent on any state change. These devices are typically active for about 30-90 minute intervals. Each event ... | <p>It would be nice, except it can't be done like you explained. MDBs (and SLSBs) are stateless by definition so it's safe to keep a conversation only during the invocation.</p>
<p>You could eventually break the spec and create a static attribute somewhere (maybe in the MDB itself) but this would certainly be not port... |
Deleting and updating documents in Lucene index <p>Am using <code>Lucene.Net.dll</code>, version 2.0.0.4.</p>
<p>Looks like its <code>IndexWriter</code> class does not have methods for <code>DeleteDocument</code> or <code>UpdateDocument</code>. Am i missing something here? How do I achieve delete, update functionality... | <p>I've documented how I update Lucene.NET Documents here:<br />
<a href="http://www.ifdefined.com/blog/post/2009/02/Full-Text-Search-in-ASPNET-using-LuceneNET.aspx" rel="nofollow">http://www.ifdefined.com/blog/post/2009/02/Full-Text-Search-in-ASPNET-using-LuceneNET.aspx</a></p>
|
WCF contract changes that affect clients <p>I was curious if someone could outline which types of WCF contract (interface) changes on the server side would break a client trying to send in a message, and why. I believe WCF can handle certain discrepancies, but I'm not sure exactly what you can change safely, and what ... | <p>Check out this article on dasBlonde: <a href="http://web.archive.org/web/20100706022825/http://www.dasblonde.net/2006/01/05/VersioningWCFServiceContracts.aspx" rel="nofollow">Versioning WCF Service Contracts</a></p>
<p>It lists what changes will break existing clients:</p>
<ol>
<li>Remove operations</li>
<li>Chang... |
C# Enums and casting <p>If you declare an enum in C#, the default type is automatically int.</p>
<p>So then why in a case statement or other instances when using the enum do you have to explicitly recast in order to use the values? What's the point of having an underlying type if you have to explicitely case or am I ... | <p>What is the type of somevalue? If the type is MyEnum casting is un-necessary and should work without error. </p>
<p>If the type is int then yes you will have to cast up to a MyEnum in order to properly switch / case. But you can make this a bit simpler by casting the value instead of every case statement. For e... |
Determining type on the fly in OCaml's OOP construct <p>I am learning about OCaml's OOP constructs and partially implemented this today until I realized I have no idea how to represent a polymorphic match statement without using the type keyword outside of the object.</p>
<pre><code>class bar (param:string) =
object (... | <p>That match isn't doing anything but binding 'param' to 'string', ocaml should say that the second match isn't used. I believe you'll have to use variant types to do the matching. Below is an example using polymorphic variant types.</p>
<pre><code>class bar (param:string) =
object (code)
end
class foo param =
o... |
How do you get PHP to return the timezone abbreviation AEST? <p>I can't seem to find a way to get Pear's Date class (or PHP's date function) to return AEST as the timezone abbreviation for the timezone Australia/Melbourne. It always returns EST. I tried all the ways of printing out the timezone available in Date::forma... | <p>Have you checked what it says in the time zone database for Australia/Melbourne? It is probably based on the <a href="ftp://elsie.nci.nih.gov/pub/" rel="nofollow">Olson</a> database, and when I last looked (2009a edition), it was still saying EST is the abbreviation for Australia/Melbourne. So, unless you have fix... |
How do I change the colour of map borders in Google Chart API? <p>Is there a way that you can change the colour of the country borders in a map provided by Google Chart API?</p>
<p>As you can see, the borders stand out a bit too much for my liking.</p>
<p><img src="http://chart.apis.google.com/chart?cht=t&chs=440... | <p>Unfortunately, this option is not available in the Google Chart API, as far as I know. You can always mention this feature request on the <a href="http://groups.google.com/group/google-chart-api/topics" rel="nofollow">Google Chart API Group list</a></p>
|
Flex: Modifying Text Area <p>I'm making a text editor using Text Area. Which user can change font size, family and etc.<br />
This is my code on as:</p>
<pre><code> private function ChangeFont(event: Event):void
{
var mySelectedTextRange:TextRange = new TextRange(thistxtarea,true,
... | <p>This is to set the style</p>
<pre><code>private function setTextStyles(type:String, value:Object = null):void
{
if(thisindex != -1)
{
var tf:TextFormat;
var beginIndex:int = textArea.getTextField().selectionBeginIndex;
var endIndex:int... |
Extracting list of values from lotus notes fields <p>I am migrating a Lotus Notes database to SQL Server using the LN java API. While traversing through each LN field in the documents I find all tabular info have field names like fld, fld_1, fld_2 etc where fld represents the name of a column and the numbering scheme i... | <p>Well "simple" can be an ambiguous term. </p>
<p>If you haven't solved this problem yet. You can write a method that loops around and grabs each field like this:</p>
<pre><code>import lotus.domino.*;
....
public static void main(String[] arg) {
for(int i=1 ;i<MAX_FIELD;i++) {
Item itm = doc.getFirst... |
Selenium click() event seems not to be always triggered => results in timeout? <p>Here's what I do:</p>
<pre><code>selenium.click("link=mylink");
selenium.waitForPageToLoad(60000);
// do something, then navigate to a different page
// (window focus is never changed in-between)
selenium.click("link=mylink");
seleniu... | <p>Sometimes, seemingly randomly, Selenium just doesn't like to click certain anchor tags. I am not sure what causes it, but it happens. I find in those cases w/ a troublesome link instead of doing </p>
<pre><code>selenium.click(...)
</code></pre>
<p>do</p>
<pre><code>selenium.fireEvent( locator, 'click' );
</code><... |
Can I get strongly typed bindings in WPF/XAML? <p>Using the <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx">MVVM</a>-pattern you set the DataContext to a specific ViewModel. Now is there any way to tell the XAML the type of the DataContext so that it will validate my bindings?</p>
<p>Looking for somet... | <p>You can write each individual binding in a strongly-typed way:</p>
<pre><code><TextBox Text="{Binding Path=(vm:Site.Contact).(vm:Contact.Name)}" />
</code></pre>
<p>However this would not validate the fact that TextBox DataContext is of type ViewModel.Site (and I think this is not possible, but I may be wron... |
Automatically add properties when running JUnit in Eclipse <p>In order to run my unit tests on my Eclipse, I need to set some properties for the VM.</p>
<p>Thus, when I first run my JUnit test, I go in "Open Run Dialog", then in my JUnit configuration for this test, I go in "Arguments" tab and put everything I need in... | <p>You could try this - go to </p>
<pre><code> Window->Preferences->Java->Installed JREs
</code></pre>
<p>ans select the JVM in use, than put a "Default VM" prameter like </p>
<pre><code> -DrunningInEclipse
</code></pre>
<p>Than you can check from within your TestCase:</p>
<pre><code> System.getPropert... |
What is the best implementation for AOP in .Net? <p>There is a lot of AOP implementation in C#, VB.net. this is some of AOP Implementations: </p>
<ul>
<li><a href="http://www.sharpcrafters.com/postsharp/features">PostSharp</a> </li>
<li><a href="http://loom.codeplex.com/">LOOM.NET</a></li>
<li><a href="http://aspectd... | <p>I think that <a href="http://www.castleproject.org/projects/dynamicproxy/">Castle Dynamic Proxy</a> is the solution of choice if dynamic interception can handle your needs. This framework is used internally by a lot of other frameworks that want to offer AOP capabilities. Typically, most of existing IoC containers n... |
Converting HTML files to PDF <p>I need to automatically generate a PDF file from an exisiting (X)HTML-document. The input files (reports) use a rather simple, table-based layout, so support for really fancy JavaScript/CSS stuff is probably not needed.</p>
<p>As I am used to working in Java, a solution that can easily ... | <p>The <a href="http://code.google.com/p/flying-saucer/">Flying Saucer</a> XHTML renderer project has support for outputting XHTML to PDF. Have a look at an example <a href="http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html">here</a>.</p>
|
How to skin an ASP.NET GridView column? <p>The idea is simple - I want all Command columns in my GridViews to have a specific button image for, say, the "Delete" button. Sounds like a job for skins, but I cannot find the right syntax for that...</p>
| <p>Sounds like you want to template the GridView and add an image button to me. here is a link:
<a href="http://andybrudtkuhl.wordpress.com/2006/06/12/gridview-with-an-imagebutton/" rel="nofollow">http://andybrudtkuhl.wordpress.com/2006/06/12/gridview-with-an-imagebutton/</a></p>
|
Deleting duplicate records using a temporary table <p>Take the tsql query below:</p>
<pre><code>DECLARE @table TABLE(data VARCHAR(20))
INSERT INTO @table VALUES ('not duplicate row')
INSERT INTO @table VALUES ('duplicate row')
INSERT INTO @table VALUES ('duplicate row')
INSERT INTO @table VALUES ('second dupli... | <blockquote>
<p>Where we have the set of code for --delete all rows that are duplicated, that gets rid of the duplicates so what's the part of the last section?</p>
</blockquote>
<p>First, it deletes all rows that ever had duplicates. That is, all rows, and original also. In the case above, only one row (<code>'not ... |
Sign in into a page using PHP <p>I have a PHP engine login page which i want to sign in using another PHP file without me physically inputting the details on that page, so i should be able to run a PHP file and sign into another login page on my server</p>
| <p>simply have your other PHP file post the required login credentials to your login page's action url</p>
|
Display Full Name in ASP.NET LoginName control <p>I have an .aspx page using a login control with custom authentication. I was wondering if it's possible to have a "Welcome [FirstName] [LastName]" message using the LoginName control instead of the [UserName] that is accessed by default. </p>
<p>I'm thinking of stori... | <p>You'll need to override the <code>RenderContents</code> method or make your own LoginName control. Something like this will do the trick:</p>
<pre><code>protected override void RenderContents(HtmlTextWriter writer)
{
if (string.IsNullOrEmpty(Profile.FullName))
return;
nameToDisplay = HttpUt... |
no mapping between account and security windows service <p>During the setup of windows service I get the error:</p>
<p>error 1001 no mapping between account and security windows service
We use a custom user account for the server. (administrator account)</p>
| <p>To avoid asking the same question again I'm posting my own findings below.</p>
<p>This page mentions something about file Gpttmpl.inf and some possible causes for the mapping error:</p>
<blockquote>
<ul>
<li>An account does not exist on domain member computers.</li>
<li>A SAM account name differs from its do... |
Deserialize Abstract Class <p>I have an abstract class 'Server' which I create in my JavaScript in my UI and then I want to have a method on my Web Service which does the following:</p>
<pre><code>public List<Database> GetDatabases(Server server)
{
Type type = server.GetType();
Server x = null;
if (... | <p>WCF will support inheritance, but you need to decorate your data contract with the known type attibute. For example:</p>
<pre><code>[DataContract]
[KnownType(typeof(Customer))]
class Contact
{
[DataMember]
public string FirstName
{get;set;}
[DataMember]
public string LastName
{get;set;}
}
[DataCo... |
zcat to grep with file name <pre><code>ls -ltr|grep 'Mar 4'| awk '{print $9 }'|xargs zcat -fq |grep 12345
</code></pre>
<p>I'm now using this command to list the records that contain my numeric string how can i alos get this command to print the name of the file the strings were found in?</p>
<p>thanks</p>
| <p>Use <a href="http://linux.about.com/library/cmd/blcmdl1%5Fzgrep.htm" rel="nofollow">zgrep</a></p>
<p>BTW. what you're trying to do can be done with <a href="http://linux.about.com/od/commands/l/blcmdl1%5Ffind.htm" rel="nofollow">find</a></p>
<pre><code>find -newermt 'Mar 4' -and ! -newermt 'Mar 5' -exec zgrep -l ... |
Storing passwords in Castle Windsor configuration file? <p>I have the following:</p>
<pre><code>interface IDefectRepository { /* ... */ }
class MyDefectRepository : IDefectRepository
{
public MyDefectRepository(string url, string userName, string password)
{
// ...
}
// ...
}
</code></pre>
<p... | <p>Try inheriting <code>MyDefectRepositoryWithEncryptedPasswords</code> from <code>MyDefectRepository</code>. In the <code>MyDefectRepositoryWithEncryptedPasswords</code> constructor decrypt the password and pass it to the <code>MyDefectRepository</code> constructor, like so:</p>
<pre><code>class MyDefectRepositoryWit... |
Implement prototype-similar functionality for WinForms controls hosted in IE <p>I'm using WinForms controls in IE. Something similar to this:</p>
<pre><code>var MyControl = new ActiveXObject("MyComponent.MyControl")
</code></pre>
<p>and I want to be able to use prototype feature for MyControl.:</p>
<pre><code>MyCont... | <p>I don't think that there is any way to modify the prototype of an ActiveX object because they do not inherit from the native js Object and therefore do not have a prototype.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.