instruction stringlengths 0 30k ⌀ |
|---|
The MSDN links are nice, but sometimes I prefer simple [tutorials][1].
[1]: http://www.15seconds.com/issue/080724.htm |
Tools->Code Snippets Manager
To get your list of directories. Select (or Add) My Code Snippets.
The snippets themselves have to be created as separate files with a .snippet extension.
Here is a tutorial on using and creating them: [Code Snippets in Visual Studio][1]
[1]: http://www.dotnetjunkies.ddj.com... |
Best approach for sortable table with a lot of data |
|table|sortable| |
On our web application, the search results are displayed in sortable tables. The user can click on any column and sort the result. The problem is some times, the user does a broad search and gets a lot of data returned. To make the sortable part work, you probably need all the results, which takes a long time. Or I... |
string exefile = Assembly.GetExecutingAssembly().GetName().CodeBase;
But if you put it in a DLL assembly, I belive it will give you the assembly file name.
The same call on the "Full" framework will return the .exe file with a "file:\\" prefix. |
(preface.......i've only done this in oracle, but I'm pretty sure if the db supports triggers it's all possible)
Have a before insert trigger that selects the row with the max timestamp value. If that row's value is the same as the one you wish to insert, ignore it.
This should keep them all in a correct state.
... |
This is just a wild guess, but try to add all the directives from eaccelerator.ini to php.ini. First create a `<?php phpinfo(); ?>` and check where it's located.
For example, try this:
[eAccelerator]
extension="eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/tmp"
eacce... |
Some of the problem areas I've encountered with WCF:
- It generates WSDL that is split
across multiple URLs. That is, one
part of the schema is at one URL,
another is at a different URL, etc.
The "main" WSDL URL (the one with
just "?WSDL" after the service name)
references the others ... |
Difficult to summarize ...
- Data structures:
- Splitting of a data structure depending on case of usage is extremely important. It is common to see a structure that holds data that is accessed based on a flow control. This situation can lower significantly the cache usage.
- To take into account cache line si... |
Is your problem just in IE, or in all browsers? Ignoring the first char is actually the default for the Autocompleter. In controls.js, there's a class called Autocompleter.Local which has a field called partialChars which defaults to 2. The docs for that field say:
// - partialChars - How many characters to enter... |
A suggestion:
Your command line interface class should accept an InputStream as it's input and provide an OutputStream (it can't hardcode output to System.out and input to System.in) that it's output will be written to. Then you'll have to write a server class that listens for connections on a certain port. When a c... |
This is a pretty good list of obfuscators from [msdn][1]
Obfuscators
* {smartassembly}
* Dotfuscator .NET Obfuscator
* Salamander .NET Obfuscator
* Semantic Designs: C# Source Code Obfuscator
* Spices.Net
* Thinstall
* Demeanor for .NET
* Xenocode Postbuild 2006
* .NET Re... |
This is a pretty good list of obfuscators from [msdn][1]
Obfuscators
* [{smartassembly}][2]
* [Dotfuscator][3] .NET Obfuscator
* [Salamander][4] .NET Obfuscator
* [Semantic Designs][5]: C# Source Code Obfuscator
* [Spices.Net][6]
* [Thinstall][7]
* [Demeanor][8] for .NET
* [Xe... |
Maybe buildbot would be useful http://buildbot.net/trac |
I think I have it:
SELECT b FROM y where a=if(@value IN (select a from y group by a),@value,0);
It checks if @value exists in the table, if not, then it uses 0 as a default.
@value can be a php value too.
Hope it helps :)
|
I don't think avoiding modal popups is usefull. Think about confirmation on closing unsaved work, fileopen dialogs, and such sort of things.
I think you should not show them all of a sudden, when the user is busy with something else. |
From [Wikipedia][1]:
Frequent uses of modal windows include:
- drawing attention to vital pieces of information. This use has been criticised as ineffective.
- blocking the application flow until information required to continue is entered, as for example a password in a login process.
- collecting ap... |
Vaariable height items in Win32 TreeView using NM_CUSTOMDRAW. |
|winapi|treeview| |
Is it possible for items in a WIn32 TreeView control to have variable heights when using NM_CUSTOMDRAW?
Right now, I can successfully select variable sized fonts in the dc in NM_CUSTOMDRAW, but the item texts get clipped. |
Variable height items in Win32 TreeView using NM_CUSTOMDRAW. |
Built in filters for parsing variables against specific predefined types - as well as covering the basics (int/float etc), extends to covering emails, urls and even if a variable is a valid regular expression.
[http://ch2.php.net/manual/en/book.filter.php][1]
[1]: http://ch2.php.net/manual/en/book.filter.php |
What are the possible causes of a CGI::Session::CookieStore::TamperedWithCookie exception in rails |
|ruby-on-rails|security|cookies| |
I am receiving the expcetion `CGI::Session::CookieStore::TamperedWithCookie` after changing the `config.action_controller.session.secret` setting on an app (as part of preparation to full deployment.
Am I right in assuming that changing the secret while testers have cookies set is the cause of this, and what other ... |
Use reflection to get the Type, use GetConstructor on the type, use Invoke on the constructor. |
Use reflection to get the Type, use GetConstructor on the type, use Invoke on the constructor.
Edit: Thanks to Sklivvz for pointing out that I answered a question that wasn't asked ;)
The answer to the actual question: I've found that generating C# code and then using CodeDomProvider (but not CodeDOM itself -- t... |
Sleep from within an Informix SPL procedure |
|informix|spl| |
What's the best way to do the semantic equivalent of the traditional sleep() system call from within an Informix SPL routine? In other words, simply "pause" for N seconds (or milliseconds or whatever, but seconds are fine). I'm looking for a solution that does *not* involve linking some new (perhaps written by me) C ... |
What's the best way to do the semantic equivalent of the traditional sleep() system call from within an Informix SPL routine? In other words, simply "pause" for N seconds (or milliseconds or whatever, but seconds are fine). I'm looking for a solution that does *not* involve linking some new (perhaps written by me) C ... |
It's impossible for both servers to listen on the same port at the same IP address: since a single socket can only be opened by a single process, only the first server configured for a certain IP/port combination will successfully bind, and the second one will fail.
You will thus need a workaround to achieve what y... |
It's impossible for both servers to listen on the same port at the same IP address: since a single socket can only be opened by a single process, only the first server configured for a certain IP/port combination will successfully bind, and the second one will fail.
You will thus need a workaround to achieve what y... |
in addition to the fine answers above, i think it should be said that tomcat has its own http server built into it, and is fully functional at serving static content too. depending on your java virtual machine configuration it actually has outperformed going through traditional connectors in apache such as mod_proxy a... |
Its hard to say without seeing your code, but Im assuming you are executing the statements 1 at a time. So, you will get 1 round trip per insert statement. In MSSql you can execute multiple inserts in a single statement eg.
cmd.ExecuteNonQuery "insert table values (1) insert table values (2)"
So you can create ... |
So try
#define _OE_SOCKETS
before you include sys/socket.h
|
It does one round trip per query you submit (regardless of whether it's in a transaction or not).
It is possible, in MySQL, to use "extended insert" syntax which allows you to insert several (or indeed, many) rows in a single statement. This is generally considered a Good Thing. |
The cannonical answer:
[ -f $filename ] && echo "it has worked!"
or you can wrap it up if you really want to:
function file-exists {
[ "$1" ] && [ -f $1 ]
}
file-exists $filename && echo "It has worked" |
related
[http://stackoverflow.com/questions/20910/silverlight-vs-flex][1]
[1]: http://stackoverflow.com/questions/20910/silverlight-vs-flex |
Pls find some additional info here:
[http://stackoverflow.com/questions/20910/silverlight-vs-flex][1]
[1]: http://stackoverflow.com/questions/20910/silverlight-vs-flex |
When using MySQL 4.x a few years ago, we ran into a hard limit on query size that was not configurable.
This probably won't help you much as, 1) I don't remember what the hard limit was, 2) you're probably not using MySQL 4.x, and 3) we weren't using transactions.
Good luck! |
How do I end a Python Tkinter program? |
|python|tkinter| |
How do I end a Python Tkinter program? Let's say I have this code:
from Tkinter import *
def quit():
???
root = Tk()
Button(root, text="Quit", command=quit).pack()
root.mainloop()
How should I define the quit() routine?
|
Read divert sockets in java? |
|java|ftp|tcp|ipfw| |
If I was to create a ipfw divert rule to forward all FTP traffic to a specific socket, is it possible to use Java to connect to the socekt and read the packet information? If so, how would i go about reading/writing to the scoket? |
What are MVP and MVC and what is the difference? |
|gui|design|model-view-controller|patterns|mvp| |
When looking beyond the RAD (drag-drop and configure) way of building User Interfaces that many tools encourage you are likely to come across 2 design patterns called Model-View-Controller and Model-View-Presenter. My question has two parts to it:
1. What issues do these patterns address?
2. How are they similar?... |
If you stay within the 5.8 track, all installed modules that contain XS (binary) extensions will continue to work, as binary compatibility is guarenteed within the same 5.8 series. If you moved to 5.10 then you would have to recompile any modules that contain XS components.
All you need to do is ensure that the new ... |
In your query, replace T2 with a subquery that joins T1 and T2, and returns parent, child and child description. Then in the sys_connect_by_path function, reference the child description from your subquery. |
How to authenticate in a Facebook Flash application? |
|authentication|facebook| |
I do not understand how I can authenticate a user in a Facebook Flash application. I have read from the documentation that Facebook platform gives arguments, such as user id and session secret, to the Flash application, but how can I inside the Flash application make sure that these arguments are correct and not fake? ... |
Going by the example further down the page, the callback function can take as many of the parameters as you need:
onDrop: function() { $('droppable_demo').highlight(); }
In this case, they have used none of the callback parameters. To this end, presumably to access all three as mentioned in the paragraph you... |
It's obvious you come from a Java background because you haven't yet grasped the concept of header files. Header files are there to include the "API" of classes, but not their actual code. It is possible to include code in the header, that's called inlining. You have inlined everything in CppClass.cpp, and then you dou... |
EdgeLib looks promising and has an [iPhone beta](http://www.edgelib.com/index.php?node=iphone) announced but not open yet. |
AFAIK EMS does not support anything like what you suggest. There are a few options to get what you are looking for.
Having independent EMS servers would be the *ideal* solution. This would allow your non-production environment to have some hickups without causing problems in your production environment.
Usi... |
When you click on a date with the calendar, ASP does a postback, you could always put the SelectedDate value of the calendar control into a hidden field on the page during the OnLoad event of the page or the SelectionChanged event of the Calendar control. |
In the setup project, add some launch conditions. This page shows you how exactly:
[http://jelle.druyts.net/2005/04/09/CheckingForNET11ServicePack1InAnMSI.aspx][1]
[1]: http://jelle.druyts.net/2005/04/09/CheckingForNET11ServicePack1InAnMSI.aspx |
Shell scripts can't modify their enviroment.
<http://tldp.org/LDP/abs/html/gotchas.html>
> A script may not export variables back to its parent process, the shell, or to the environment. Just as we learned in biology, a child process can inherit from a parent, but not vice versa |
Shell scripts can't modify their enviroment.
<http://tldp.org/LDP/abs/html/gotchas.html>
> A script may not export variables back to its parent process, the shell, or to the environment. Just as we learned in biology, a child process can inherit from a parent, but not vice versa
$ cat > eg.sh
export... |
In my humble opinion you do not want a test that sometimes pass and sometimes fails. Some people may even consider that this kind of test is not a unit test. But the main idea is be sure that the function is OK when you see the green bar.
With this principle in mind you may try to execute it a reasonable number of t... |
Using the same App_Code classes across websites |
|asp.net|app-code| |
There are several ways to do this.
Remember that the existing rails helpers like `link_to`, etc, just output strings. You can concatenate the strings together and return that (which is what I do most of the time, if things are simple).
EG:
link_to( "something", something_path ) + #NOTE THE PLUS FOR STRING... |
<http://pycurl.sourceforge.net/>
"PyCurl is a Python interface to libcurl."
"libcurl is a free and easy-to-use client-side URL transfer library, ... supports ... HTTP PUT"
"The main drawback with PycURL is that it is a relative thin layer over libcurl without any of those nice Pythonic class hierarchies. This ... |
You can of course roll your own with the existing standard libraries at any level from sockets up to tweaking urllib.
<http://pycurl.sourceforge.net/>
"PyCurl is a Python interface to libcurl."
"libcurl is a free and easy-to-use client-side URL transfer library, ... supports ... HTTP PUT"
"The main drawback... |
You could use something like [Tumblr][1] with [Disqus][2] comments. You can auto-import your twitter comments or any other RSS feed. You can also post text/audio/video from Tumblr. You'll have to manually add Disqus comments, but then each post or Twitter message will have its own threaded comments.
Another option w... |
You could use something like [Tumblr][1] or [Sweetcron][3] with [Disqus][2] comments. You can auto-import your Twitter/Flickr/any RSS feed. You can also post text/audio/video from the site admin. You'll have to manually add Disqus comments, but then each post or Twitter message will have its own threaded comments.
... |
SAX is, essentially, "event driven", so the only state you should be holding on to from element to element is state that relevant to that element, rather than the document as a whole. What other state are you maintaining, and why? As each "complete" node (or set of nodes) comes by, you should be discarding them.
|
Here is the code that works across all browsers. The trick is to call WinExec if ShellExecute fails.
HINSTANCE GotoURL(LPCTSTR url, int showcmd)
{
TCHAR key[MAX_PATH + MAX_PATH];
// First try ShellExecute()
HINSTANCE result = 0;
CString strURL = url;
... |
Thanks for your comments, actually i tried the plugin approach but couldn't understand it completely as to how will i get the handle to the store which is not an exposed element of the component.
Anyways i tried something else, while debugging i found that though i'm creating the component again on click of show but... |
(I'd really recommend using a traditional database instead.)
In ASP you can use the MSXML-component to parse and change XML-files. More information about the MSXML-component can be found on [MSDN][1].
Basicly what you'd wanna do is read a XML-file and do some filtering on the server side, and outputting to the cl... |
WAS hosting vs. Windows Service hosting |
|wcf|.net|iis-7| |
I'm working on a project using Windows 2008, .NET 3.5 and WCF for some internal services and the question of how to host the services has arisen.
Since we're using Windows 2008 I was thinking it'd be good to take advantage of Windows Process Activation Service (WAS) although the feeling on the project seems to be th... |
|.net|wcf|iis-7| |
I'm working on a project using Windows 2008, .NET 3.5 and WCF for some internal services and the question of how to host the services has arisen.
Since we're using Windows 2008 I was thinking it'd be good to take advantage of Windows Process Activation Service (WAS) although the feeling on the project seems to be th... |
Also, this might be usefull.
select * from fn_helpcollations() - this gets all the collations your server supports.
select * from sys.databases - here there is a column that specifies what collation has every database on your server. |
Best Option would be to create a Win32 native application using **[Delphi][1]** and use SQLLite as the database.
Reason being Delphi can produce native win32 applications without any other product being installed on the machine.
[1]: http://www.codegear.com/products/delphi/win32 |
Minimize. Use the status bar or some non-in-your-face mechanism of notifying the user.
You should be careful when you want to have automated tests. Modal dialogs love playing "show stopper". |
Sorting a heap in-place kind of sounds like a job for [Heap Sort](http://en.wikipedia.org/wiki/Heapsort).
I assume memory is constrained, an embedded app, perhaps? |
Yes, testers should clear their cookies. Any time the cookie cannot be decrypted with the specified secret you'll get that error. |
This can happen in crystal reports 8.5 if you changed the length of a string column you use in your report so that it exceeds 255 bytes. This can also happen if you change the column type from varchar to nvarchar (double byte string!)
The reason for this is that crystal reports 8.5 treats all strings longer than 255... |
Another solution is maintaing all the configuration files for every environment in SVN. Depending on the value of an environment variable, only some files are used.
Advantages:
1. All files in SVN.
2. No copy of files in deploy/checkouts/updates...
Disadvantages:
1. All files in SVN.
2. There is an en... |
Just use heap-sort. It is in-place. That would be the most natural choice.
You can as well just use your heap as it and sort it with some other algorithm. Afterwards you re-build your heap from the sorted list. Quicksort is a good candidate because you can be sure it won't run in the worst-case O(n²) order simply be... |
There's two main things to get used to about the App Engine datastore when compared to 'traditional' relational databases:
- The datastore makes no distinction between inserts and updates. When you call put() on an entity, that entity gets stored to the datastore with its unique key, and anything that has that key g... |
It's obvious you come from a Java background because you haven't yet grasped the concept of header files. Header files are there to include the "API" of classes, but not their actual code. It is possible to include code in the header, that's called inlining. You have inlined everything in CppClass.cpp, and then you dou... |
It's obvious you come from a Java background because you haven't yet grasped the concept of header files. Header files are there to include the "API" of classes, but not their actual code. It is possible to include code in the header, that's called inlining. You have inlined everything in CppClass.cpp, and then you dou... |
It's obvious you come from a Java background because you haven't yet grasped the concept of header files. Header files are there to describe the "API" of classes, but not their actual code. It is possible to include code in the header, that's called inlining. You have inlined everything in CppClass.cpp, and then you de... |
Let's say you have a solution with two website projects, Website A and Website B. Now inside Website A's App_Code folder, there is a Class X defined in a ClassX.cs file. What do you do if Website B also needs access to ClassX.cs?
Is there any way to share this file across App_Code folders? Assume that moving th... |
Give this a shot:
dataGridView1.Columns[*Numberofthecolumnyoudontwantsorted*].SortMode
= DataGridViewColumnSortMode.NotSortable; |
JMS (esp Tibco EMS) can I have an environment with in a message broker |
|jms|tibcoems|environment| |
I have a message broker with some topics, and some set of applications running on it. Now I want to run a new set of the same applications (say for QA environment) on the same topics (on the same broker, if I could). What is the best way to do this. Creating a new broker and or creating a new set of topics is cumbersom... |
|environment|jms|tibco|ems| |
Your question's title uses the contradictory words "safe" and "generally." So even though in comments you seem to be emphasizing the general case, to which the answer is probably "yes, it's generally not a problem," a lot of people are seeing "safe" and therefore are answering either "No, because there's a risk of arbi... |