instruction stringlengths 0 30k ⌀ |
|---|
select * from table a, table b
where a.email = b.email |
If you're debugging from the IDE, go to Debug->Exceptions, click Thrown for C++ exceptions.
MSN |
SELECT [id], [receivedate], [email]
FROM [mytable]
WHERE [email] IN ( SELECT [email]
FROM [myTable]
GROUP BY [email]
HAVING COUNT([email]) > 1 ) |
I only have the need for it in Basic (ie. VB, VBScript, etc.) and batch files. I then only use it for error handling. In Basic I tend only use the "on error goto". In batch files I have to use it because there isn't an else command. I then only use them as forward jumps to meaningful labels. |
Do you want a list of the last items? If so you could use:
SELECT [info] FROM [table] t WHERE NOT EXISTS (SELECT * FROM [table] tCheck WHERE t.date > tCheck.date)
If you want a list of all duplicate email address use GROUP BY to collect similar data, then a HAVING clause to make sure the quantity is more... |
It makes sense for builders, where all you are going to do is set a load of stuff, create the real object and throw the builder away. For builders, you might as well get rid of the "set" part of the method name. Similarly, immutable types don't really need the "get".
Something thing = new SomethingBuilder()
... |
Where do attached properties fit in a class diagram? |
|.net|wpf|uml|dependency-properties|class-diagram| |
What is the most appropriate way to represent attached properties in a UML diagram or an almost-uml diagram like the VS2008 class diagram? |
Usually it's something like this:
string query= "SELECT {0} FROM .... WHERE {1}"
StringBuilder selectclause = new StringBuilder();
StringBuilder wherecaluse = new StringBuilder();
// .... the logic here will vary greatly depending on what your system looks like
MySqlcommand.CommandText = ... |
Take a look at the JetBrain's (guys behind ReSharper) [TeamCity][1]
[1]: http://www.jetbrains.com/teamcity/ |
Sounds like your server may not have .NET 3.5 installed. |
Also, FYI, I believe BigInteger will finally be public and consumable in the .NET Framework 4.0 |
Be careful if you're using LINQ to SQL as you won't be able to easily add sustainable comments to the auto-generated objects. |
The dialog box is also running on the same UI thread. So, it is too busy to repaint itself. Not sure if VBA has good multi-threading capabilities. |
Not the type of answer that I like to give, but [Microsoft][1] has an answer on the Office website.
[1]: http://office.microsoft.com/en-us/visio/HP815503691033.aspx |
How do I allow assembly (unit testing one) to access internal properties of another assembly ? |
|.net|unit-testing| |
I would like my Core assembly to not expose a certain class and I would still like to be able to test it. How can I do that ? |
[1,2,3].contains(1) == true |
# Python: Functional, One-liner
factorial = lambda n: reduce(lambda x,y: x*y, range(1, n+1), 1)
NOTE:
* It supports big integers. Example:
print factorial(100)
93326215443944152681699238856266700490715968264381621468592963895217599993229915\
6089414639761565182862536979208272237582511852... |
Try adding a **DoEvents** call in your loop. That should allow the form to repaint & accept other requests. |
You can use reflection (as the MS Test items do), or you can declare the unit test assembly a friend of the core assembly.
The other option is to put the unit tests in the same assembly. |
How do I remove items from the query string for redirection? |
|c#|asp.net|web-forms| |
In my base page I need to remove an item from the query string and redirect. I can't use<br/>
Request.QueryString.Remove("foo")
because the collection is read-only. Is there any way to get the query string (except for that one item) without iterating through the collection and re-building it? |
_splitpath, _wsplitpath, _splitpath_s, _wsplitpath_w
I think this is Windows (Platform SDK) only?
|
According to a blog entry [MbUnit v3 and Gallio alpha 1][1],
> So whats going on here, Gallio is a
> neutral test platform that is an off
> shoot from the work we had done on
> MbUnit v3. Gallio is both a common
> framework and a set of runners for
> testing tools. MbUnit v3 uses Gallio
> as its native test pl... |
Javascript make the web broswer srcoll to the top? |
|javascript|web| |
What is the Javascript to scroll to the top when a button/link/etc. . . clicked? |
Make sure that the interface between your application and the third-party application or library is such that you can replace it easily with something else just in case. In some cases the third-party software may just be an implementation of an standard API (Java does this a lot with JDBC, JMS, JNDI, ...). In other c... |
<a href="javascript:scroll(0, 0)">Top</a> |
I've not worked with these but am aware of this comparison:
> "Unlike Insoshi and Lovd By Less, which
> are full social networking Rails
> applications, Community Engine is a
> plugin that can add social networking
> features to existing Rails
> applications"
from
[http://www.rubyinside.com/community-eng... |
Short answer is that you have to do all the heavy lifting yourself. You can be notified that there is data available to be read, but you won't know how many bytes are available. In most IP protocols that use variable length packets, there will be a header with a known fixed length prepended to the packet. This heade... |
You should be able to add the form to the controls collection of your parent form...
See here:
<a href="http://vbcity.com/forums/topic.asp?tid=30539">http://vbcity.com/forums/topic.asp?tid=30539</a>
If that fails, try using the adapter pattern to create a container with your legacy form inside it, then load it ... |
Display data from XMLDataSource in TextBox |
|c#|xmldatasource| |
Can anyone give me some pointers on how to display the results of an XPath query in a textbox using code (C#)? My datascource <i>seems</i> to (re)bind correctly once the XPath query has been applied, but I cannot find how to get at the resulting data.<br /><br />
Any help would be greatly appreciated.
|
Yes, this works just fine. I'm working on a .NET app right now that loads forms into a panel on a host form.
The relevant snippet:
// setup the new form
form.TopLevel = false;
form.FormBorderStyle = FormBorderStyle.None;
form.Dock = DockStyle.Fill;
form.Show ( );
// add to the panel... |
How to host licensed .Net controls in unmanaged C++ app? |
|.net|c++|licensing|unmanaged| |
I need to host and run managed controls inside of a purely unmanaged C++ app. How to do this?
To run unlicensed controls is typically simple:
if (SUCCEEDED(ClrCreateManagedInstance(type, iid, &obj)))
{
// do something with obj
}
When using a licensed control however, we need to somehow e... |
What is the exception you get? Is it possible that the control itself is giving the exception (vs the framework)? Perhaps something is called in the original applications Main function that is not being called? |
Getting A File's Mime Type In Java |
|java|mime| |
I was just wondering how most people fetch a mime type from a file in Java? So far I've tried two utils: JMimeMagic & Mime-Util. The first gave me memory exceptions, the second doesn't close its streams off properly. I was just wondering if anyone else had a method/library that they used and worked correctly? |
I Haven't tried it myself yet (other than the demo), but I've bookmarked [Chyrp][1] so that if I ever need to set up a quick & simple blog (kind of like you're describing) I could try this. So check it out, might be a good option for you.
[1]: http://chyrp.net |
Have a look at [Blosxom](http://www.blosxom.com/). It's file-based, so no crufty database. The basic idea has been ported to different languages, pyblosxom is in Python. |
I have done this in the past and the way I did it is by separating the pages by creating a directory for Desktop and creating a directory for Mobile. This gives you better separation of the views, since in reality they are a lot different. In ASP.NET Forms I used the [Model View Presenter][1] pattern a lot since it w... |
I have done this in the past and the way I did it is by separating the pages by creating a directory for Desktop and creating a directory for Mobile. This gives you better separation of the views, since in reality they are a lot different. In ASP.NET Forms I used the [Model View Presenter][1] pattern a lot since it w... |
There are many sides to this, but from an application efficiency perspective mote tables can be more efficient at times. If you have a few tables with a bunch of columns every time the db as to do an operation it has a chance of making a lock, more data is made unavailable for the duration of the lock. If locks get e... |
There are huge benefits to **queries** using as few columns as possible. But the table itself can have a large number. [Jeff][1] says something on this as well.
Basically, make sure that you don't ask for more than you need when doing a query - performance of queries is directly related to the number of columns you ... |
You might want to investigate why Django [removed this feature] [1] before implementing it yourself. It doesn't seem like a Django specific problem, but rather yet another cross site forgery attack.
[1]: http://www.djangoproject.com/weblog/2008/sep/02/security/ |
Another common version of [Andrew's example](#17443), the dreaded code-couplet
parent.addChild(child);
child.setParent(parent);
Instead of worrying if both lines are always done together and in consistent order you could make the methods private and have a friend function to enforce consistency:
... |
First I would have to ask why your service needs a user interface. Most likely it does not but you probably need a client that gets data from this service. The reason services don't usually have GUI's is they may not have a window environment to run in. Services can start and run without a user logged in to the machine... |
I only gave Typed Datasets a very short try. I stopped when I found my code breaking about 2/3 of the way down a 1,000+ line file of generated code.
The other thing I didn't like was I thought I'd get to write code like Customer.Name, but by default I seemed to get code like CustomerDataSet.Customers[0].Name, where... |
The main criticism I would extend is that they don't scale well -- performance suffers because of the overhead, when you get to higher number of transactions, compared to lightweight business entities or DTOs or LINQ to SQL. There's also the headache of schema changes. For an "industrial strength" architecture, they'... |
Since Zend appears to not be selling it anymore and all its functionality is available for free (through FastCGI), I would say so. Look at the [Zend Core][1] ([installing Zend Core][2]) if you really want to run PHP on Windows. But really, you should be asking yourself why you are running PHP on Windows at all (we us... |
How do I list loaded plugins in Vim? |
|vim|plugins| |
Does anybody know of a way to list up the "loaded plugins" in **Vim**?
I know I should be keeping track of this kind of stuff myself but
it would always be nice to be able to check the current status.
Thanks |
c# Using WPF and .net 3.5, how can i register a global hot key to say CTRL+SHIFT+(LETTER) |
|c#|.net|windows|wpf|hotkeys| |
Im building an app in c# using WPF and i need it to bind to some keys. Ive found some links but not work well with my setup. Anyone done this before?
also if i could bind to the windows key would be great. |
If you had an anchor link at the top of the page, you could do it with anchors too.
<a name="top"></a>
<a href='#top">top</a>
It'll work in browser's with Javascript disabled, but changes the url. :( It also lets you jump to anywhere the name anchor is set. |
I'm not sure about WPF, but this may help...I used this solution (modified to my needs of course) for a c# Windows forms application to assign a CTRL-KEY combination within Windows to bring up a c# form and it worked beautifully (even on Windows Vista). Hope it helps and good luck!
http://www.pinvoke.net/default.as... |
Its already been said a few times but http://www.proggyfonts.com/ is just awesome. Im a big fan of the Proggy Clean Slashed Zero Bold Punctuation. I do most my work in c# so the bold punctuation is very nice for it. |
One simple way is the use something like this as main():
<STAThread()> Public Shared Sub Main()
splash = New frmSplash
splash.Show()
' Your startup code goes here...
UpdateSplashAndLogMessage("Startup part 1 done...")
' ... and more as needed...
spl... |
How do I implement a callback in PHP? |
|php| |
The multi-table database is a lot more flexible if any of these one to one relationships may become one to many or many to many in the future. For example, if you need to store multiple addresses for some customers, it's a lot easier if you have a customer table and an address table. I can't really see a situation wh... |
I think you have to look at the kind of data you're storing before you make that decision. Having an address table is great but only if the likelihood of multiple people sharing the same address is high. If every person had different addresses, keeping that data in a different table just introduces unnecessary joins.
... |
I would argue in favor of more tables, but only up to a certain point. Using your example, if you separated your user's information into two tables, say USERS and ADDRESS, this gives you the flexibility to have multiple addresses per user. One obvious application of this is a user who has separate billing and shippin... |
It may be worth noting that it often is a [good idea][1] to safely generate the temporary file using a utility like [mktemp][2], at least if the script will ever be executed with root privileges. You could for example do the following (again in bash):
(tmpfile=`mktemp` && { echo "prepended text" | cat - yourfile... |
Here are some free-as-in-beer possibilities:
You can use the PDFCreator printer driver that comes with ghostscript and print
directly to a TIFF file or many other formats.
If you have MSOffice installed, the Microsoft Office Document Image Writer will produce
a file you can convert to other formats.
But in g... |
Here are some free-as-in-beer possibilities:
You can use the PDFCreator printer driver that comes with ghostscript and print
directly to a TIFF file or many other formats.
If you have MSOffice installed, the Microsoft Office Document Image Writer will produce
a file you can convert to other formats.
But in g... |
Showing a hint for a C# winforms edit control |
|c#|winforms|user-interface| |
I'm working on a C# winforms application (VS.NET 2008, .NET 3.5 sp 1). I have a search field on a form, and rather than have a label next to the search field I'd like to show some grey text in the background of the search field itself ('Search terms', for example). When the user starts entering text in the search field... |
If you have surrogate key, it is relatively easy to use the group by syntax mentioned in SQLMenance's post. Essentially, group by all the fields that make two or more rows 'the same'.
Example pseudo-code to delete duplicate records.
Create table people (ID(PK), Name, Address, DOB)
Delete from pe... |
@Michael Stum: instead of "image.aspx" use "image.ashx".
It's more light-weight than a full ASP.Net Page, and it's specifically designed to handle content-types other than text/html. |
@Will and Ben Griswald: instead of "image.aspx" use "image.ashx".
It's more light-weight than a full ASP.Net Page, and it's specifically designed to handle content-types other than text/html. |
The more details you provide the more likely it will be that you will get an answer: explain what exact program was 'terminating'. A termination is usually caused by an internal unhandled error, and not all programs check for them, and log them before quitting. However I think you can install Dr Watson, and it will g... |
The more details you provide the more likely it will be that you will get an answer: explain what exact program was 'terminating'. A termination is usually caused by an internal unhandled error, and not all programs check for them, and log them before quitting. However I think you can install [Dr Watson][1], and it w... |
My best bet so far seems to be the [BPF][1] api and to write a thin JNI wrapper
[1]: http://canmore.annwfn.net/freebsd/bpf.html |
Most of the time, attributes will not be in any namespace. The [namespace spec][1] says (*emphasis* mine):
> A default namespace declaration applies to all unprefixed *element* names within its scope. Default namespace declarations do *not* apply directly to *attribute* names; the interpretation of unprefixed attrib... |
bool accesses are indeed atomic, but that isn't the whole story.
You don't have to worry about reading a value that is 'incompletely written' - it isn't clear what that could possibly mean for a bool in any case - but you do have to worry about processor caches, at least if details of timing are an issue. If thread... |
Like everything else: it depends.
There is no hard and fast rule regarding column count vs table count.
If your customers need to have multiple addresses, then a separate table for that makes sense. If you have a really good reason to normalize the City column into its own table, then that can go, too, but I have... |
A fully normalized design (i.e, "More Tables") is more flexible, easier to maintain, and avoids duplication of data, which means your data integrity is going to be a lot easier to enforce.
Those are powerful reasons to normalize. I would choose to normalize first, and then only denormalize *specific* tables *after*... |
You can use [ngen][1]
The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use na... |
You can use [ngen][1].
I also use this tip to reduce the [Memory footprint on startup][2].
The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them i... |
Are there any JSF component libraries that generate semantic and cross-browser html markup? |
|jsf|semantic-web| |
I'm using RichFaces per a client requirement, but the markup it (and the stock JSF controls) generates is an awful mess of nested tables. Are there any control libraries out there that generate nicer markup? AJAX support is a huge plus! |
Processes have more isolated memory. This is important for a number of reasons:
- It is harder for a single task to crash the other tasks.
- More memory will be available per process. This is important for large, high-performance applications like Apache or database servers, like Postgres. This is important fo... |
You could also treat this as a vendor supplied branch as defined in the redbean book:
[Vendor Branches][1]
With this, the basic flow would be:
1. Have a vendor branch "branches/VSS/current" containing the latest code from VSS
2. Tag the current version as "branches/VSS/2008-09-15"
3. Next day, get the new f... |
It looks like not all of your prerequisites are really working as they should be. Also, you'll want to make sure that you are installing from the console itself and not through any kind of remote session at all. (I know, this is a pain in the a@@, but sometimes it makes a difference.)
You can acess the SQL Server ... |
You should look at the SuperTab plugin:
http://www.vim.org/scripts/script.php?script_id=1643
It let's you do completion (either the OmniCompletion or the regular completion) using tab and shift-tab instead of ^N and ^P. |
In Firebird 2.1 there's new monitoring capabilities for tables, connections and transactions, maybe that can help you (if you can upgrade). See README.monitoring_tables.txt.
Example, get active statements:
SELECT ATT.MON$USER, ATT.MON$REMOTE_ADDRESS, STMT.MON$SQL_TEXT, STMT.MON$TIMESTAMP
FROM MON$ATTACHM... |