instruction stringlengths 0 30k ⌀ |
|---|
|c#|.net|winforms| |
Say I have a `Textbox` nested within a `TabControl`.
When the form loads I would like to focus on that textbox (by default the focus is set to the tabControl).
Simply calling `textbox1.focus()` in the `Load` event of the form does not appear to work.
I have been able to focus it by doing the following:
... |
I am not sure if this helps, but take a look at [Increased Performance Using FILE_FLAG_SEQUENTIAL_SCAN][1].
> SUMMARY
>
> There is a flag for CreateFile()
> called FILE_FLAG_SEQUENTIAL_SCAN which
> will direct the Cache Manager to
> access the file sequentially.
>
> Anyone reading potentially large files
... |
In jQuery `event.target` always refers to the element that triggered the event, where `'event'` is the parameter passes to the function. <http://docs.jquery.com/Events_(Guide)>
$(document).ready(function() {
$("a").click(function(event) {
alert(event.target.id);
});
});
Not... |
Programming to interfaces provides several benefits:
1. Required for GoF type patterns, such as the visitor pattern
2. Allows for alternate implementations. For example, multiple data access object implementations may exist for a single interface that abstracts the database engine in use (AccountDaoMySQL and A... |
|c++|windows|video| |
I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me.
I've tried to use Direct Show with the SampleGrabber filter (using this sample http://msdn.microsoft.com/en-us/library/ms787... |
Set up an email alias for the team on the mail server, and enter this when subscribing to the mail.
Try the [Team Foundation Server Event Subscription Tool][1].
This allows you to send emails to any address when any TFS event occurs.
[1]: http://www.codeplex.com/tfseventsubscription |
C# string concatenation and string interning |
|c#| |
When performing string concatentation of an existing string in the intern pool, is a new string entered into the intern pool or is a reference returned to the existing string in the intern pool? According to this article, String.Concat and StringBuilder will insert new string instances into the intern pool?
[http:/... |
|c#|.net| |
If you create new strings, they will not automatically be put into the intern pool, unless you concatenate constants compile-time, in which case the compiler will create one string result and intern that as part of the JIT process. |
Matt Sheppard's answer is great (mod up), but I would take account these factors when thinking about a spindle:
1. Structure : does it obviously break into pieces, or are you making tradeoffs?
2. Usage : how will the data be analyzed/retrieved/grokked?
3. Lifetime : how long is the data useful?
4. Size : how ... |
How to track if browser is Silverlight enabled |
|silverlight|browser|tracking|google-analytics| |
I'm trying to get some stats on how many of the visitors to our website have Silverlight enabled browsers.
We currently use Google Analytics for the rest of our stats so ideally we'd like to just add 'Silverlight enabled' tracking in with the rest of our Google Analytics stats. But if it has to get written out ... |
You can use [SQL Management Objects](http://msdn.microsoft.com/en-us/library/ms162557.aspx) to perform this. These are the same objects that Management Studio uses to execute queries. I believe Server.ConnectionContext.ExecuteNonQuery() will perform what you need. |
This is what I knocked together to solve my immediate problem.
private void ExecuteBatchNonQuery(string sql, SqlConnection conn) {
string sqlBatch = string.Empty;
SqlCommand cmd = new SqlCommand(string.Empty, conn);
conn.Open();
sql += "\nGO"; // make sure last batch is exec... |
This is what I knocked together to solve my immediate problem.
private void ExecuteBatchNonQuery(string sql, SqlConnection conn) {
string sqlBatch = string.Empty;
SqlCommand cmd = new SqlCommand(string.Empty, conn);
conn.Open();
sql += "\nGO"; // make sure last batch is exec... |
Scope out SmarterTrack from SmarterTools:
http://www.smartertools.com/SmarterTrack/Features/Customer-Service-Software-Web-Interface.aspx
or
http://tinyurl.com/59pjme
|
My answer [from a different][1] post:
Stored Procedures are *MORE* maintainable because:
- You don't have to recompile your C# app whenever you want to change some SQL
- You end up reusing SQL code.
Code repetition is the *worst* thing you can do when you're trying to build a maintainable application!
W... |
Depends what your goal is. If you want to retrieve a list of items and it happens once during your application's entire run for example, it's probably not worth the effort of using a stored procedure. On the other hand, a query that runs repeatedly and takes a (relatively) long time to execute is an excellent candidate... |
How complex HTML are we talking about? Simple HTML, like <b> and <i> is supported in text fields if you use the <code>htmlText</code> property. You can also attach a CSS style sheet to the text field for more styling. Have a look at TextField in the Flash API documentation (I'm sure you can just google it). |
Normally, ViewState should be decryptable if you have the machine-key, right? After all, ASP.net needs to decrypt it, and that is certainly not a black box. |
There are persuasive arguments for both - stored procedures are all located in a central repository, but are (potentially) hard to migrate and ad hoc queries are easier to debug as they are with your code, but they can also be harder to find in the code.
The argument that stored procedures are more efficient doesn't... |
I think Silverlight is most advantageous for companies that have .NET developers but noone with designer experience.
Skill sets will be easier to find as far as finding C# or VB developers vs finding ActionScript guru's. However there is the trade off:
Design experience is an investment not only in Designers wit... |
Even more important, there are FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING.
MSDN has a nice article on them both: http://support.microsoft.com/kb/99794
|
Here's a good article on tagging Database schemas:
http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html
along with performance tests:
http://www.pui.ch/phred/archives/2005/06/tagsystems-performance-tests.html
Note that the conclusions there are very specific to MySQL, which (at least in 2005 ... |
How do you recommend implementing tags or tagging |
|tags| |
I've heard of a few ways to implement tagging; using a mapping table between TagID and ItemID (makes sense to me, but does it scale?), adding a fixed number of possible TagID columns to ItemID (seems like a bad idea), Keeping tags in a text column that's comma separated (sounds crazy but could work). I've even heard so... |
|database|tags| |
|database|tags|folksonomy| |
|database|tags| |
|database|tags|tagging| |
winmerge is a good visual diff program |
If you dont mind using a tool, ESEUTIL worked great for me.
You can check out this [blog][1] entry comparing Buffered and NonBuffered IO functions and from where to get ESEUTIL.
copying some text from the technet blog:
*So looking at the definition of buffered I/O above, we can see where the perceived performa... |
I have a web application running on a Gentoo-based LAMP stack. My customers buy the software as a service and I host everything. They can export their data if they want. However, there is some demand for on-site deployment inside the clients' own networks. For some of these scenarios, there would be a requirement for s... |
I have a web application running on a Gentoo-based LAMP stack. My customers buy the software as a service and I host everything. However, there is some demand for on-site deployment inside the clients' own networks.
Currently, because I host the system, there is no built-in license management in the app. I bill base... |
You can pass it into the TextBox call as a parameter.
Name:<br/>
<%= Html.TextBox("txtName", "20", new { @class = "hello" }) %>
This line will create a text box with the value 20 and assign the class attribute with the value hello. I put the @ character in front of the class, because class is a rese... |
use the htmlAttributes parameter with anonymous type, like tihs:
<%=Html.TextBox("txtName","20", new { @class = "test"}) %> |
For threaded apps, you can often get away with ConcurrentHashMap- depends on your performance requirements. |
You'll get what you want with YAML.
But there is a little problem with your string. YAML expects that there's a space behind the comma. So we need this
str = "[[this, is], [a, nested], [array]]"
Code:
require 'yaml'
str = "[[this, is],[a, nested],[array]]"
### transform your string in a va... |
The "GO" batch separator keyword is actually used by SQL Management Studio itself, so that it knows where to terminate the batches it is sending to the server, and it is not passed to SQL server. You can even change the keyword in Management Studio, should you so desire.
|
The on-demand version of Fogbugz is a pretty cheap option for just a few people, and works really well. We did that for a while before moving it inhouse. |
I've used fogbugz for over 12 months now and more and more I'm finding one of the most valuable features is the in built email support. I've got an on demand account and I'm finding more and more that I don't even check my email in the morning as all my business correspondence is put straight into fogbugz. |
IDE for use on a Java-enabled smart phone? |
|ide| |
Is there an IDE that I can load on a Blackberry, E71, or an iPhone? |
If you don't mind running a Microscoft Windows Based Script then this jscript will work OK. just save it as a .js file and run it.
var fso, f, fileCount;
var ForReading = 1, ForWriting = 2;
var filename = "c:\\testfile.txt";
fso = new ActiveXObject("Scripting.FileSystemObject");
//cr... |
If you don't mind running a Microscoft Windows Based Script then this jscript will work OK. just save it as a .js file and run it from dos with "wscript c:/script.js".
var fso, f, fileCount;
var ForReading = 1, ForWriting = 2;
var filename = "c:\\testfile.txt";
fso = new ActiveXObject("Scriptin... |
I think Silverlight is most advantageous for companies that have .NET developers but noone with designer experience.
Skill sets will be easier to find as far as finding C# or VB developers vs finding ActionScript guru's. However there is the trade off:
Design experience is an investment not only in Designers wit... |
I think Silverlight is most advantageous for companies that have .NET developers but noone with designer experience.
Skill sets will be easier to find as far as finding C# or VB developers vs finding ActionScript guru's. However there is the trade off:
Design experience is an investment not only in Designers wit... |
Reduce ASP.NET menu control size (without 3rd party libraries) |
|asp.net|size| |
I have a fairly simple ASP.NET 2.0 menu control using a sitemap file and security trimmings. There are only 21 menu options, but the results HTML of the menu is a whopping 14k. The site is hosted on our company's intranet and must be serverd to people worldwide on limited bandwidth, so I'd like to reduce the size of ... |
|asp.net|menu|size| |
SQL, Auxiliary table of numbers |
|sql-server|sql|query|number| |
For certain types of sql queries, an auxiliary table of numbers can be very useful. It may be created as a table with as many rows as you need for a particular task or as a user defined function that returns the number of rows required in each query.
What is the optimal way to create such a function? |
|sql|sql-server|query|numbers| |
Datatable vs Dataset |
|sql|dataset|datatable| |
I current use a datatable to get results from a database which I can use in my code.
However, many example on the web show using a dataset instead and accessing the tables through the collections method.
Is there any advantage, performance wise or otherwise, of using datasets or datatables as a storage method for... |
|sql|dataset|datatable| |
Calling base Methods When Overriding Page Level Events |
|asp.net|events|webform| |
In my code behind I wire up my events like so:
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
btnUpdateUser.Click += btnUpateUserClick;
}
I've done it this way because that's what I've seen in examples. Does the base.OnInit() method need to be called? Will it be impl... |
|asp.net|events|webforms| |
Creating a UserControl Programmaticly within a repeater? |
|asp.net|webforms|user-controls| |
I have a a repeater that is bound to some data.
I bind to the ItemDataBound event, and I am attempting to programmaticly create a UserControl:
In a nutshell:
void rptrTaskList_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
CCTask task = (CCTask)e.Item.DataItem;
if ... |
|html|webdevelopment| |
|html| |
Firebug for IE |
|ie|internet-explorer|firebug|webdevelopment|debugging| |
Trying to fix JavaScript bugs is huge pain as is determining the styles applied to an element. Firebug makes these issues a lot easier when working on Firefox, but when do you do when the code works fine on Firefox but IE is complaining? |
|debugging|webdevelopment|internet-explorer|ie|firebug| |
Trying to fix JavaScript bugs is huge pain as is determining the styles applied to an element. Firebug makes these issues a lot easier when working on Firefox, but what do you do when the code works fine on Firefox but IE is complaining? |
|webdevelopment|debugging|internet-explorer|firebug| |
|debugging|internet-explorer|firebug| |
Progressive Enhancement |
|ajax|webdevelopment|progressiveenhancement| |
Jeff mentioned the concept of 'Progressive Enhancement' when talking about using JQuery to write stackoverflow.
After a quick Google, I found a couple of high-level discussions about it.
Can anyone recommend a good place to start as a programmer.
Specifically, I have been writing web apps in PHP and would like... |
What is Progressive Enhancement? |
|ajax|progressive-enhancement| |
What are comon exploits (web) i should know about? |
|webdevelopment|testing| |
I'm pretty green still when it comes to web programing, I've spent most of my time on client applications. So I'm curious about the common exploits I should fear/test for in my site. |
|webdevelopment|testing|security| |
What common web exploits should I know about? |
I'm pretty green still when it comes to web programming, I've spent most of my time on client applications. So I'm curious about the common exploits I should fear/test for in my site. |
Is there some way to show HTML content inside Flash? |
|adobe|flash|html| |
I want to show HTML content inside FLASH. Is there some way to do this? |
|javascript|html|flash|adobe| |
I want to show HTML content inside FLASH. Is there some way to do this?
I am talking about full blown HTML (with JavaScript if possible) |
Unfortunately, we can't rely on the columns of the excel doc to stay in a particular format as the users will be pasting data into it regularly. I don't want the app to crash if we're relying on a certain datatype for a column.
prefixing with ' would work, is there a reasonable way to do that programatically once t... |
Procs for the reasons mentioned by others and also it is easier to tune a proc with profiler or parts of a proc. This way you don't have to tell someone to run his app to find out what is being sent to SQL server
If you do use ad-hoc queries make sure that they are parameterized |