text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
with this problem in VS2005 too, in several different applications.
I may have found a workaround for this.
My ToolStrip was placed directly on the TabPage, docked to Top. However, I found [a thread on Microsoft Connect](https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=117176&wa=wsignin1.0) that described the same problem when the ToolStrip was in a ToolStripContainer on the TabPage. That problem was observed in a release candidate of VS2005, but supposedly fixed by Microsoft in September 2006.
As such, I changed my code to put the ToolStrip inside a ToolStripContainer, and now I am unable to reproduce the problem. | [
0.14771102368831635,
-0.16538457572460175,
0.5643994212150574,
-0.04547552764415741,
-0.28415942192077637,
0.08900529891252518,
0.37834227085113525,
0.27342820167541504,
-0.3815043568611145,
-0.5025773644447327,
0.3460276424884796,
0.5489700436592102,
-0.3918774724006653,
0.527750432491302... | |
How do I create an rss feed in ASP.Net? Is there anything built in to support it? If not, what third-party tools are available?
I'm thinking webforms, not MVC, though I suppose since this isn't a traditional page the difference may be minimal.
For built-in, there's nothing stopping you from using XmlDocument or XDocument (3.5) to build up the required XML for RSS. It's more work than it's worth though.
I use the [Argotic Syndication Framework](http://www.codeplex.com/Argotic) and serve the feeds through Generic Handlers (.ashx) with the content type set to text/xml.
The [RSSToolkit](http://www.codeplex.com/ASPNETRSSToolkit) is also nice. It comes with an RSSDataSource control if you're | [
0.7923163771629333,
-0.2869409918785095,
0.4430878162384033,
0.08897146582603455,
-0.44841471314430237,
-0.21300260722637177,
0.010502729564905167,
0.0113358860835433,
-0.36850956082344055,
-0.46556293964385986,
-0.005581644829362631,
0.4159475564956665,
-0.5820082426071167,
-0.08077238500... | |
into that sort of thing. It also includes a control that will automatically insert the meta tag required for feed autodiscovery in browsers. I found the build provider for creating feeds to be a little kludgey however. | [
0.6565521359443665,
-0.22576609253883362,
0.06386357545852661,
0.1996631771326065,
0.05943649262189865,
-0.5898045897483826,
0.20866386592388153,
0.3738071322441101,
0.09197860956192017,
-0.4042600691318512,
0.24171921610832214,
0.5481946468353271,
-0.25838807225227356,
0.03109010867774486... | |
I have seen [this question](https://stackoverflow.com/questions/4046/can-someone-give-me-a-working-example-of-a-buildxml-for-an-ear-that-deploys-in) about deploying to WebSphere using the WAS ant tasks.
Is there a simpler way to do this? In the past I have deployed to Tomcat by dropping a war file into a directory. I was hoping there would be a similar mechanism for WebSphere that doesn't involve calling the IBM libraries or rely on RAD to be installed on your workstation.
There is the concept of [WebSphere Rapid Deployment](http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.etools.wrd.freeform.doc/topics/cwrdrapid.html). It's supposed to be the same experience as what you describe for Tomcat. | [
0.2370579093694687,
-0.010632201097905636,
0.1640280783176422,
-0.11802906543016434,
-0.05998707562685013,
-0.09949734807014465,
0.12966924905776978,
-0.18015429377555847,
-0.2310297191143036,
-0.4226478934288025,
0.220958411693573,
0.7922943234443665,
0.11936050653457642,
-0.1985056549310... | |
Is there an easy way of using the `RegularExpressionValidator` control while ignoring white space?
I can use a custom validator control with `Regex` and `IgnorePatternWhitespace`, but it would be good to just have an option in the `RegularExpressionValidator` control.
Surround your regex with
> (?x: )
so "a b c" becomes "(?x:a b c) | [
0.045854561030864716,
0.053009916096925735,
0.12194576859474182,
-0.053786590695381165,
0.08235739916563034,
-0.03854292631149292,
0.09306275844573975,
-0.007233947515487671,
-0.08070997893810272,
-0.23175570368766785,
-0.032419588416814804,
0.523811399936676,
-0.3421110510826111,
-0.07267... | |
I use Visual Studio 2008. I haven't seen this behavior before and, as far as I know, I didn't change anything in the options.
When I press Start debugging all the possibly windows (watch 1 - 4), data sources, properties, registers (to be honest I have not even ever seen these windows before) appear in front of the code window and stay there after I stop the debugger.
Anyone has an idea what could be causing this ? (I am using CodeRush and Refactor for quite a while now)
When I close and restart visual studio all the windows are where they should | [
0.15519757568836212,
0.3133191764354706,
0.5273178815841675,
-0.15981729328632355,
-0.27676376700401306,
-0.1091824322938919,
0.6255013346672058,
0.24428656697273254,
-0.3345623314380646,
-0.7563683390617371,
-0.026559103280305862,
0.8596724271774292,
-0.08380511403083801,
0.36398983001708... | |
be.
PS: Previously I have seen normal switching from normal to debug mode and back with some repositioning changes. That is the way it used to work. Now it is not. It has suddenly gone mad and when going to the debug mode it sometimes shows all possible IDE windows and sometimes not. When it does it no longer returns to the previous state. I cannot find this in the options anywhere.
Visual Studio *remembers* 2 sets of window layouts, normal mode and debugging mode. My solution is to arrange my normal windows exactly like I want them, then start debugging an | [
0.5567241311073303,
-0.15950290858745575,
0.2120126634836197,
-0.1103874072432518,
-0.01862441562116146,
0.06811138987541199,
0.22585205733776093,
0.010461186990141869,
0.06286737322807312,
-0.9731255769729614,
-0.21403472125530243,
0.5684323906898499,
-0.4218505620956421,
0.16221608221530... | |
application and once again arrange all of the windows the way I want, usually making it as similar to my *normal* layout as possible, then stopping the debugger and doing a File Exit so that VS saves my settings.
After doing that, it recalls my 2 different layouts each time. | [
0.3092879056930542,
-0.06277221441268921,
0.7187122106552124,
-0.16501714289188385,
0.040047768503427505,
-0.14640501141548157,
0.41984623670578003,
-0.09899242222309113,
-0.22044794261455536,
-1.0733025074005127,
-0.09605371206998825,
0.5739604234695435,
-0.14391681551933289,
0.2378000468... | |
I am calling, through reflection, a method which may cause an exception. How can I pass the exception to my caller without the wrapper reflection puts around it?
I am rethrowing the InnerException, but this destroys the stack trace.
Example code:
```
public void test1()
{
// Throw an exception for testing purposes
throw new ArgumentException("test1");
}
void test2()
{
try
{
MethodInfo mi = typeof(Program).GetMethod("test1");
mi.Invoke(this, null);
}
catch (TargetInvocationException tiex) | [
0.5778948664665222,
0.06230488792061806,
0.009852126240730286,
-0.30574724078178406,
0.12897180020809174,
-0.09212277084589005,
0.669245183467865,
-0.4431896507740021,
0.29333409667015076,
-0.528054416179657,
-0.11048970371484756,
0.4622156322002411,
-0.44952741265296936,
-0.02289805002510... | |
{
// Throw the new exception
throw tiex.InnerException;
}
}
```
In **.NET 4.5** there is now the [`ExceptionDispatchInfo`](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.exceptionservices.exceptiondispatchinfo) class.
This lets you capture an exception and re-throw it without changing the stack-trace:
```
using ExceptionDispatchInfo =
System.Runtime.ExceptionServices.ExceptionDispatchInfo;
try
{
task.Wait();
}
catch(AggregateException ex)
{
ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
}
```
This works on any exception, not just `AggregateException`.
It was introduced due to the `await` C# language feature, which unwraps the inner exceptions from `AggregateException` instances in order to make the asynchronous language features more like the | [
0.1534961760044098,
-0.058872565627098083,
0.10438618808984756,
-0.3219291567802429,
-0.06829021126031876,
-0.05631055310368538,
0.292861670255661,
-0.23764479160308838,
-0.25922834873199463,
-0.31475189328193665,
0.0007998841465450823,
0.414614737033844,
-0.5126568078994751,
0.10845433175... | |
synchronous language features. | [
-0.10629599541425705,
0.29732218384742737,
0.02507442981004715,
0.06760449707508087,
0.24815969169139862,
0.13732454180717468,
0.3546631336212158,
0.27758920192718506,
0.11029580980539322,
-0.6793879270553589,
-0.4892156720161438,
0.46687597036361694,
-0.2959764301776886,
-0.51503676176071... | |
I would like to make an ajax call to a different server (same domain and box, just a different port.)
e.g.
My page is
```
http://localhost/index.html
```
I would like to make a ajax get request to:
```
http://localhost:7076/?word=foo
```
I am getting this error:
```
Access to restricted URI denied (NS_ERROR_DOM_BAD_URI)
```
I know that you can not make an ajax request to a different domain, but it seem this also included different ports? are there any workarounds?
Have a certain page on your port 80 server proxy requests to the other port. For example:
```
http://localhost/proxy?port=7076&url=%2f%3fword%3dfoo
```
Note the url encoding on the last query string argument value. | [
-0.1315227597951889,
0.22575069963932037,
0.07956156879663467,
0.030620934441685677,
-0.36412981152534485,
-0.1878715604543686,
0.22927090525627136,
0.322790265083313,
-0.19525660574436188,
-1.1075451374053955,
0.10853748768568039,
0.484912633895874,
-0.24474188685417175,
0.315462708473205... | |
No, this is not a question about generics.
I have a Factory pattern with several classes with internal constructors (I don't want them being instantiated if not through the factory).
My problem is that `CreateInstance` fails with a "No parameterless constructor defined for this object" error unless I pass "true" on the non-public parameter.
Example
```
// Fails
Activator.CreateInstance(type);
// Works
Activator.CreateInstance(type, true);
```
I wanted to make the factory generic to make it a little simpler, like this:
```
public class GenericFactory<T> where T : MyAbstractType
{
public static T GetInstance()
{
return Activator.CreateInstance<T>();
}
}
```
However, I | [
0.26227471232414246,
-0.0032221951987594366,
0.10022836178541183,
-0.11060287058353424,
-0.3384994566440582,
0.12365295737981796,
0.7041420340538025,
-0.22180968523025513,
-0.20025743544101715,
-0.7547593116760254,
0.012365927919745445,
0.4316079318523407,
-0.6719022989273071,
0.5510879755... | |
was unable to find how to pass that "true" parameter for it to accept non-public constructors (internal).
Did I miss something or it isn't possible?
To get around this, couldnt you just alter your usage as such:
```
public class GenericFactory<T> where T : MyAbstractType
{
public static T GetInstance()
{
return Activator.CreateInstance(typeof(T), true);
}
}
```
Your factory method will still be generic, but the call to the activator will not use the generic overload. But you should still achieve the same results. | [
0.3417547345161438,
-0.17923393845558167,
0.3056267499923706,
0.03743007034063339,
0.028348755091428757,
0.015381956472992897,
0.6340867877006531,
-0.19574858248233795,
-0.23492585122585297,
-0.6545287370681763,
0.09182800352573395,
0.569573700428009,
-0.45826396346092224,
0.34784317016601... | |
Is there an equivalent of svn's blame for Perforce on the command line? `p4 annotate` doesn't display usernames -- only changeset numbers (without ancestor history!).
I currently have to track code back through ancestors and compare against the filelog, and there just has to be an easier way -- maybe a F/OSS utility?
Try taking a look at a couple of tools that I think could get you most of what you need:
1) [p4pr](https://swarm.workshop.perforce.com/files/guest/jonathan_kamens/p4pr.perl) Perl script by Bob Sidebotham and Jonathan Kamens.
2) [Emacs Perforce](http://www.dsmit.com/p4/) interface has a command 'p4-print-with-rev-history' (bound to `C-x p V'). | [
0.2668575346469879,
0.1852218061685562,
-0.06761901080608368,
0.04126742482185364,
-0.5074291229248047,
0.30505964159965515,
0.17229408025741577,
-0.35546693205833435,
-0.3374810218811035,
-0.4495314955711365,
0.12468256801366806,
0.26857203245162964,
-0.5117353796958923,
0.050761617720127... | |
Is it possible for `SelectNodes()` called on an `XmlDocument` to return null?
My predicament is that I am trying to reach 100% unit test code coverage; ReSharper tells me that I need to guard against a null return from the `SelectNodes()` method, but I can see no way that an XmlDocument can return null (and therefore, no way to test my guard clause and reach 100% unit test coverage!)
Is it necessary to reach 100% code coverage? Indeed, is it even possible under normal (i.e. controllable, testable) circumstances?
We often find that using "syntactic sugar" constructions like the `using {}` block, there | [
0.05892091616988182,
-0.0181919876486063,
0.0385349839925766,
0.06897944211959839,
-0.048970893025398254,
-0.20746107399463654,
0.4601219594478607,
-0.07952836155891418,
-0.00498026330024004,
-0.46346595883369446,
-0.3790816068649292,
0.33168235421180725,
0.07774738222360611,
-0.0877386406... | |
are "hidden" code paths created (most likely `finally {}` or `catch {}` blocks) that can't be exercised unless some environmental condition (like a broken socket or broken disk) gets in the way. | [
0.6136540174484253,
-0.0034270030446350574,
-0.32774803042411804,
0.37078389525413513,
0.5225163102149963,
-0.34175634384155273,
0.4842170774936676,
0.18205603957176208,
-0.21161548793315887,
-0.4772767424583435,
-0.6734279990196228,
0.3126554489135742,
0.014286638237535954,
-0.16646303236... | |
In my Servlet I would like to access the root of the context so that I can do some JavaScript minifying.
It would be possible to do the minify as part of the install process but I would like to do it on Servlet startup to reduce the implementation cost.
Does anyone know of a method for getting the context directory so that I can load and write files to disk?
This should give you the real path that you can use to extract / edit files.
[Javadoc Link](http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String))
We're doing something similar in a context listener.
```
public class MyServlet extends HttpServlet { | [
0.4061569571495056,
0.0014762491919100285,
0.6009489297866821,
-0.1142851933836937,
-0.19683115184307098,
-0.3279176354408264,
0.33352622389793396,
-0.2900536358356476,
-0.1853356659412384,
-0.8822628259658813,
-0.19582323729991913,
0.5391550660133362,
-0.3529059588909149,
0.04904820770025... | |
public void init(final ServletConfig config) {
final String context = config.getServletContext().getRealPath("/");
...
}
...
}
``` | [
-0.27211669087409973,
-0.2928309738636017,
0.5138571262359619,
-0.08110956102609634,
0.22483786940574646,
-0.04401243478059769,
0.4430030286312103,
-0.18777452409267426,
0.04022834822535515,
-0.43707919120788574,
-0.4423191249370575,
0.5070368051528931,
-0.42111021280288696,
0.222230345010... | |
I'm just starting to design some embedded devices, and am looking for resources.
What I want to be able to do is to connect a GPS receiver to a lightweight SBC or mini-ITX, x86-based computer, and track a remote-controlled vehicle's location/progress.
Ideally, this could morph into building some hobby, semi-autonomous vehicles.
But what I need to start with is a development board for GPS programming.
What boards/packages have you used, and where can I find [preferably open source] development for them?
[OpenEmbedded](http://www.openembedded.org) is a good place to go to get started. A lot of embedded products use ARM and other processors, so cross-compiling is | [
0.6201791167259216,
0.37624049186706543,
-0.026202136650681496,
0.34121987223625183,
0.12848016619682312,
-0.15677255392074585,
-0.2374163419008255,
0.07167261093854904,
0.07023515552282333,
-0.791286826133728,
0.15933601558208466,
0.5747751593589783,
0.053972452878952026,
-0.0553904101252... | |
a big deal. [Buildroot](http://buildroot.uclibc.org/) is another resource for building custom linux kernels for small systems.
You can also find lots of manufacturers with Single Board Computers (SBCs) that have tools to do what you want - do a google search for "SBC Linux" and you should have a gold mine.
[LinuxDevices](http://linuxdevices.com/) keeps a pulse on the linux embedded community and you should find several good articles there that lead you to products or software to help you.
Debian has an embedded build, but I haven't explored that.
There are several books on [embedded linux](http://www.linuxdevices.com/articles/AT2969812114.html) available if you want to go that route.
The GPS receiver | [
0.7691107988357544,
0.022210199385881424,
-0.08732859790325165,
-0.05070843547582626,
-0.23690475523471832,
-0.2824779450893402,
0.10192444175481796,
0.3652093708515167,
-0.1521773338317871,
-0.4738338589668274,
0.01089701522141695,
0.5721153616905212,
0.17080706357955933,
0.15203687548637... | |
simply connects to a serial or USB port, and present an NMEA stream of data, which you can parse with GPSD and several programs can access it through GPSD. It's a very simple text based format.
I've used regular PC motherboards, and Atmel AT91 processors for embedded systems (with GPS, cellular, etc). There's a lot of information out there right now, and it's not expensive to get into. If I were to start a new project, I'd look at the AVR32 processors from Atmel - they are very hobbyist friendly, and provide a lot of community support for linux on the | [
0.21465884149074554,
0.17474614083766937,
0.20272555947303772,
0.15249519050121307,
0.13287894427776337,
0.11075455695390701,
-0.10056760162115097,
0.40122902393341064,
-0.020040148869156837,
-0.8620293736457825,
0.08409559726715088,
0.7852826714515686,
-0.13743482530117035,
0.011113454587... | |
AVR32 architecture. They provide free GCC compilers and significant framework and examples if you want to go the OS-less route and have a single program running on the processer as well.
Good luck!
-Adam | [
0.14971698820590973,
0.505224883556366,
0.13362228870391846,
0.11974335461854935,
0.03385479003190994,
0.020812898874282837,
0.47504669427871704,
0.10120010375976562,
-0.1456208974123001,
-0.6055880188941956,
-0.2723800241947174,
0.48761436343193054,
0.18584483861923218,
0.1202003210783004... | |
Ok, so I got my extender working on a default.aspx page on my website and it looks good. I basically copied and pasted the code for it into a user control control.ascx page. When I do this I completely loose the functionality (just shows the target control label and no dropdown, even upon hover). Is there any reason why it doesn't work in a custom user control inside a masterpage setup?
Edit:
Didn't quite do the trick. Any other suggestions?
Its in a master page setup, using eo web tabs (I tried it inside the tabs and outside the tabs but on the | [
0.3116651177406311,
-0.33521705865859985,
0.5111310482025146,
0.11908883601427078,
-0.007416057866066694,
-0.2371031939983368,
0.16836872696876526,
-0.016894543543457985,
-0.30099838972091675,
-0.3511955738067627,
0.1411406695842743,
0.7004683017730713,
-0.2181985080242157,
-0.067878663539... | |
same page as the tabs, to no avail), and its in a custom user control. Think there are dependency issues?
I don't know if this helps, but I had the same problem with the autocomplete extender and determined that the server-side function could not be in the user control, but needed to be on the page (or in a webservice, I guess). Once I moved the function, it worked fine. | [
0.19779770076274872,
-0.21400772035121918,
0.41479671001434326,
0.012155728414654732,
-0.0034888912923634052,
-0.041692811995744705,
0.23397773504257202,
0.05404936894774437,
-0.3358931839466095,
-0.6100096702575684,
0.1298433542251587,
0.8347022533416748,
-0.5085049271583557,
0.0498155392... | |
Is there an advantage to dynamically attaching/detaching event handlers?
Would manually detaching handlers help ensure that there isn't a reference remaining to a disposed object?
It's not a question of using AddHandler versus Handles.
If you are concerned about the reference to your event handler interfering with garbage collection, you should use RemoveHandler, regardless of how the handler was attached. In the form or control's Dispose method, remove any handlers.
I have had situations in Windows Forms apps (.NET 1.1 days) where an event handler would be called on controls that had no other references to them (and which for all intents and purposes | [
0.22188743948936462,
-0.270571768283844,
0.01023842766880989,
0.2776177227497101,
-0.0979403629899025,
-0.32282543182373047,
-0.1106966957449913,
-0.2820931077003479,
-0.2603036165237427,
-0.394504189491272,
-0.20501172542572021,
0.5795051455497742,
-0.4004195034503937,
-0.0066085024736821... | |
were dead and I would have thought been GC'ed) -- extremely hard to debug.
I would use RemoveHandler to get rid of handlers on controls that you are not going to reuse. | [
0.5637589693069458,
-0.05021072179079056,
0.16548599302768707,
0.4457418620586395,
0.10917787998914719,
-0.16578778624534607,
0.08046174794435501,
-0.14137792587280273,
-0.07839025557041168,
-0.2130577713251114,
0.09616522490978241,
0.14982447028160095,
-0.523960292339325,
0.21734911203384... | |
I work for a software vendor whose market is developer tools and we have been looking for a QA person for our products.
Since we are a small shop the position will be a combination of Support and QA however since we make developer tools, our support consists in large part of actual development (in that the person must read and understand our customers code and find and point out bugs in it).
The QA portion will also consist of writing applications (in a variety of platforms and languages) and testing how they work with our tools.
The main | [
0.6120443940162659,
0.3272808790206909,
-0.20266371965408325,
0.03474604710936546,
0.15837816894054413,
0.2568446099758148,
0.15464717149734497,
-0.14904487133026123,
0.3249681890010834,
-0.25889018177986145,
-0.22370366752147675,
0.6206798553466797,
0.36927229166030884,
-0.305975168943405... | |
issue I am running into is when you tell someone with development experience that the position contains "QA" it its title (or even in the job description) they shy away from considering the job.
I'm very interested in feedback and suggestions for how I can find a good person to fill this job and ensure that they are happy doing it. Any ideas?
To start with you can just take "QA" **out** of the title and description if that seems to be 'hot button' that is keeping candidates from looking at the position seriously.
From your description, your position doesn't have | [
0.5742104649543762,
0.31393006443977356,
-0.055909980088472366,
-0.23616480827331543,
0.04455171152949333,
0.06113748997449875,
0.0008274830179288983,
0.28525954484939575,
0.08561454713344574,
-0.46765726804733276,
0.05415651202201843,
0.4616616368293762,
0.2796666622161865,
0.195003286004... | |
much in common with a traditional 'tester' role - the work is mostly writing and thinking about code, not banging on someone else's code and trying to break it. Think of it as a fairly eclectic, tools-oriented development position, and try to advertise and staff it accordingly. (And expect to pay accordingly as well - you get what you pay for.) There are quite a few developers out there who have good skills, but maybe a little shorter attention span than others, and who would prefer to work on a succession of mini projects rather than a longer-lasting piece of | [
0.6582145690917969,
0.06651436537504196,
-0.4245453476905823,
0.1341959536075592,
-0.20737621188163757,
0.006299963220953941,
0.3668101131916046,
0.06934565305709839,
-0.1350957751274109,
-0.3499707281589508,
-0.20361000299453735,
0.6511942148208618,
0.36236146092414856,
-0.230753242969512... | |
a bigger project. | [
0.2213129997253418,
-0.12780502438545227,
-0.022425927221775055,
0.27076756954193115,
-0.25207072496414185,
-0.0012411857023835182,
0.022890739142894745,
0.023395812138915062,
-0.40000778436660767,
-0.4583711326122284,
0.0070664649829268456,
0.03054705448448658,
0.02624846063554287,
0.0609... | |
What would be the best way to calculate someone's age in years, months, and days in T-SQL (SQL Server 2000)?
The `datediff` function doesn't handle year boundaries well, plus getting the months and days separate will be a bear. I know I can do it on the client side relatively easily, but I'd like to have it done in my [stored procedure](http://en.wikipedia.org/wiki/Stored_procedure).
Here is some T-SQL that gives you the number of years, months, and days since the day specified in @date. It takes into account the fact that DATEDIFF() computes the difference without considering what month or day it is (so | [
0.28014621138572693,
0.2633684575557709,
0.4249163866043091,
-0.07894185930490494,
-0.02625895105302334,
0.03592509403824806,
-0.12268000841140747,
-0.002002933295443654,
-0.2813456654548645,
-0.23295308649539948,
0.418918639421463,
0.10661883652210236,
0.33191633224487305,
0.4709272682666... | |
the month diff between 8/31 and 9/1 is 1 month) and handles that with a case statement that decrements the result where appropriate.
```
DECLARE @date datetime, @tmpdate datetime, @years int, @months int, @days int
SELECT @date = '2/29/04'
SELECT @tmpdate = @date
SELECT @years = DATEDIFF(yy, @tmpdate, GETDATE()) - CASE WHEN (MONTH(@date) > MONTH(GETDATE())) OR (MONTH(@date) = MONTH(GETDATE()) AND DAY(@date) > DAY(GETDATE())) THEN 1 ELSE 0 END
SELECT @tmpdate = DATEADD(yy, @years, @tmpdate)
SELECT @months = DATEDIFF(m, @tmpdate, GETDATE()) - CASE WHEN DAY(@date) > DAY(GETDATE()) THEN 1 ELSE 0 END
SELECT @tmpdate = DATEADD(m, @months, @tmpdate)
SELECT @days = DATEDIFF(d, @tmpdate, GETDATE())
SELECT @years, @months, @days
``` | [
-0.031209636479616165,
-0.07433515787124634,
0.8292253017425537,
-0.07265348732471466,
-0.032523252069950104,
0.3342032730579376,
0.07207328081130981,
-0.16256402432918549,
-0.311879962682724,
-0.4078042209148407,
-0.3090371787548065,
0.030087025836110115,
-0.0523340068757534,
0.3423158824... | |
Should developers avoid using [continue](http://msdn.microsoft.com/en-us/library/923ahwt1.aspx) in C# or its equivalent in other languages to force the next iteration of a loop? Would arguments for or against overlap with arguments about [Goto](https://stackoverflow.com/questions/46586/goto-still-considered-harmful)?
I think there should be more use of continue!
Too often I come across code like:
```
for (...)
{
if (!cond1)
{
if (!cond2)
{
... highly indented lines ...
}
}
}
```
instead of
```
for (...)
{
if (cond1 || cond2) | [
0.35302382707595825,
-0.10910263657569885,
0.2711212933063507,
-0.001244249171577394,
0.3593592643737793,
-0.3057079315185547,
0.5605356097221375,
0.09676779061555862,
-0.3846249580383301,
-0.1450190395116806,
-0.4056757986545563,
0.5328191518783569,
-0.44881752133369446,
0.022639723494648... | |
{
continue;
}
...
}
```
Use it to make the code more readable! | [
0.27517786622047424,
0.4265422821044922,
0.06900928914546967,
-0.08589934557676315,
0.2744850814342499,
-0.33922141790390015,
0.5768002867698669,
-0.02608405239880085,
-0.07289516180753708,
-0.4934999346733093,
-0.3685065805912018,
0.5230886936187744,
-0.24751849472522736,
0.23378600180149... | |
I have a console app in which I want to give the user *x* seconds to respond to the prompt. If no input is made after a certain period of time, program logic should continue. We assume a timeout means empty response.
What is the most straightforward way of approaching this?
I'm surprised to learn that after 5 years, all of the answers still suffer from one or more of the following problems:
* A function other than ReadLine is used, causing loss of functionality. (Delete/backspace/up-key for previous input).
* Function behaves badly when invoked multiple times (spawning multiple threads, many hanging ReadLine's, or | [
0.11429993063211441,
-0.08116904646158218,
0.23025158047676086,
0.03621942549943924,
-0.009358021430671215,
0.07633402198553085,
0.3669852614402771,
0.0828620120882988,
-0.05960167571902275,
-0.54885333776474,
-0.07744047045707703,
0.43436336517333984,
-0.16192223131656647,
0.4089170396327... | |
otherwise unexpected behavior).
* Function relies on a busy-wait. Which is a horrible waste since the wait is expected to run anywhere from a number of seconds up to the timeout, which might be multiple minutes. A busy-wait which runs for such an ammount of time is a horrible suck of resources, which is especially bad in a multithreading scenario. If the busy-wait is modified with a sleep this has a negative effect on responsiveness, although I admit that this is probably not a huge problem.
I believe my solution will solve the original problem without suffering from any of the above | [
-0.0235474593937397,
-0.13435965776443481,
0.31973519921302795,
0.12911692261695862,
-0.11008676886558533,
0.14170625805854797,
0.629904568195343,
0.042566362768411636,
-0.3397606611251831,
-0.6530306935310364,
-0.0399727001786232,
0.6940526366233826,
-0.21658943593502045,
0.13897104561328... | |
problems:
```
class Reader {
private static Thread inputThread;
private static AutoResetEvent getInput, gotInput;
private static string input;
static Reader() {
getInput = new AutoResetEvent(false);
gotInput = new AutoResetEvent(false);
inputThread = new Thread(reader);
inputThread.IsBackground = true;
inputThread.Start();
}
private static void reader() {
while (true) {
getInput.WaitOne();
input = Console.ReadLine();
gotInput.Set();
}
}
// omit the parameter to | [
-0.24069687724113464,
-0.10229633748531342,
0.5307438373565674,
-0.1674400418996811,
0.2087339460849762,
0.49266281723976135,
0.3192497789859772,
-0.31809577345848083,
-0.3004732131958008,
-0.6160736083984375,
-0.35510995984077454,
0.8570666313171387,
-0.5563985705375671,
0.377189308404922... | |
read a line without a timeout
public static string ReadLine(int timeOutMillisecs = Timeout.Infinite) {
getInput.Set();
bool success = gotInput.WaitOne(timeOutMillisecs);
if (success)
return input;
else
throw new TimeoutException("User did not provide input within the timelimit.");
}
}
```
Calling is, of course, very easy:
```
try {
Console.WriteLine("Please enter your name within the next 5 seconds.");
string name = Reader.ReadLine(5000);
Console.WriteLine("Hello, {0}!", name);
} catch (TimeoutException) {
Console.WriteLine("Sorry, you waited too long.");
}
```
Alternatively, you can use the `TryXX(out)` convention, as | [
-0.07701573520898819,
-0.27551642060279846,
0.6383931636810303,
-0.23562940955162048,
0.22586219012737274,
0.18838787078857422,
0.4866992235183716,
-0.08710604906082153,
-0.18219253420829773,
-0.6562088131904602,
-0.4804252088069916,
0.22858500480651855,
-0.17473375797271729,
0.49186822772... | |
shmueli suggested:
```
public static bool TryReadLine(out string line, int timeOutMillisecs = Timeout.Infinite) {
getInput.Set();
bool success = gotInput.WaitOne(timeOutMillisecs);
if (success)
line = input;
else
line = null;
return success;
}
```
Which is called as follows:
```
Console.WriteLine("Please enter your name within the next 5 seconds.");
string name;
bool success = Reader.TryReadLine(out name, 5000);
if (!success)
Console.WriteLine("Sorry, you waited too long.");
else
Console.WriteLine("Hello, {0}!", name);
```
In both cases, you cannot mix calls to `Reader` with normal `Console.ReadLine` calls: if the | [
0.02757364697754383,
-0.1554861068725586,
0.5777251720428467,
-0.33103668689727783,
0.2998010218143463,
0.3179893493652344,
0.36623767018318176,
-0.4319763779640198,
0.19336450099945068,
-0.5608648061752319,
-0.4750353991985321,
0.34348976612091064,
-0.20933513343334198,
0.6866511106491089... | |
`Reader` times out, there will be a hanging `ReadLine` call. Instead, if you want to have a normal (non-timed) `ReadLine` call, just use the `Reader` and omit the timeout, so that it defaults to an infinite timeout.
So how about those problems of the other solutions I mentioned?
* As you can see, ReadLine is used, avoiding the first problem.
* The function behaves properly when invoked multiple times. Regardless of whether a timeout occurs or not, only one background thread will ever be running and only at most one call to ReadLine will ever be active. Calling the function will always result | [
0.055987562984228134,
-0.3586145341396332,
0.7244300842285156,
-0.013052457012236118,
0.06199648603796959,
-0.02891906164586544,
0.3586724102497101,
0.14359717071056366,
-0.3484657108783722,
-0.5671870708465576,
-0.0918307974934578,
0.7576694488525391,
-0.6239143013954163,
0.14288215339183... | |
in the latest input, or in a timeout, and the user won't have to hit enter more than once to submit his input.
* And, obviously, the function does not rely on a busy-wait. Instead it uses proper multithreading techniques to prevent wasting resources.
The only problem that I foresee with this solution is that it is not thread-safe. However, multiple threads can't really ask the user for input at the same time, so synchronization should be happening before making a call to `Reader.ReadLine` anyway. | [
-0.10336187481880188,
-0.08055916428565979,
0.46995076537132263,
0.11909476667642593,
-0.006840719375759363,
-0.07099980115890503,
0.19140973687171936,
0.03779502958059311,
-0.20863200724124908,
-0.99125736951828,
-0.009689388796687126,
0.5395211577415466,
-0.08874339610338211,
0.181369006... | |
Is there an easy way to return data to web service clients in JSON using Rails?
Rails resource gives a RESTful interface for your model. Let's see.
Model
=====
```
class Contact < ActiveRecord::Base
...
end
```
Routes
======
```
map.resources :contacts
```
Controller
==========
```
class ContactsController < ApplicationController
...
def show
@contact = Contact.find(params[:id]
respond_to do |format|
format.html
format.xml {render :xml => @contact}
format.js {render :json => @contact.json}
end
end
...
end
```
So this gives you an API interfaces without the need to define special | [
-0.29568028450012207,
-0.2720702588558197,
0.5754886269569397,
0.31815287470817566,
-0.09579010307788849,
0.07074984163045883,
-0.10748501867055893,
-0.47759193181991577,
-0.35362181067466736,
-0.6831527352333069,
0.15087386965751648,
0.5458425283432007,
-0.20720712840557098,
-0.0621875189... | |
methods to get the type of respond required
Eg.
```
/contacts/1 # Responds with regular html page
/contacts/1.xml # Responds with xml output of Contact.find(1) and its attributes
/contacts/1.js # Responds with json output of Contact.find(1) and its attributes
``` | [
-0.14382971823215485,
-0.12353900820016861,
0.4625476002693176,
0.19558285176753998,
-0.3722306489944458,
0.1272401064634323,
-0.023807590827345848,
-0.593294620513916,
-0.023205691948533058,
-0.657322883605957,
-0.35821065306663513,
0.6972658634185791,
-0.3588525354862213,
-0.494256764650... | |
I have to setup team foundation server for a company, something that I don't have any experience in.
The company will have about 5 or so developers that will be using it.
Is this a big task or something that is fairly easy to do (with instructions)?
Any helpful tutorials that you can recommend?
Any recommendations on server specs for a team of 5-10?
Your first step should be to download the latest TFS Installation Guide (TFSInstall.chm) from here: <http://www.microsoft.com/downloads/details.aspx?FamilyID=FF12844F-398C-4FE9-8B0D-9E84181D9923&displaylang=en>
You should use TFS 2008 SP1, since it is the latest release and includes many new features and performance improvements.
If you are planning on | [
0.34830230474472046,
0.030326101928949356,
0.05057123675942421,
0.032774247229099274,
-0.044182490557432175,
-0.22226890921592712,
0.13246610760688782,
-0.2327335774898529,
-0.11847744137048721,
-0.8595213890075684,
0.05230759084224701,
0.21911075711250305,
-0.07198059558868408,
-0.2795360... | |
installing with Windows 2008 & SQL 2008, you will need to "integrate" the TFS 2008 SP1 into the installation disc. Instructions are included in the TFSInstall.chm, but Martin Woodward also has a walkthrough on his blog:
<http://www.woodwardweb.com/vsts/creating_a_tfs.html>
(This isn't required for SQL 2005 SP2 + Windows 2003)
The install guide also has hardware recommendations.
For a team of your size, you should also consider running your TFS instance as a Virtual Machine. This will allow you to up-size and move your installation around more easily at a later date. TFS is supported on the Hyper-V virtualization platform: <http://blogs.msdn.com/granth/archive/2008/06/27/team-foundation-server-and-hyper-v-virtualization.aspx>
And if you need help along the | [
0.5473362803459167,
0.08520273864269257,
0.5265382528305054,
-0.08142887055873871,
-0.27444663643836975,
-0.439164400100708,
0.32174140214920044,
-0.36454829573631287,
-0.26980260014533997,
-0.6622658371925354,
-0.2666248381137848,
0.7068354487419128,
-0.32428231835365295,
-0.1458578556776... | |
way, you have three options:
1. Call up MS product support ($$, but you will get an answer)
2. Post on the official Team Foundation Server - Setup forums: <http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=68&SiteID=1>
3. Sign up to the <http://OzTFS.com/> mailing list. The people on this list are pretty good at responding to questions almost instantaneously. It's also a great list to join if you just want to "watch" what's happening. | [
0.6102038621902466,
-0.20298175513744354,
-0.0037784867454320192,
0.3304970860481262,
-0.08083884418010712,
-0.23035591840744019,
0.4397924542427063,
0.19110336899757385,
-0.39125096797943115,
-0.7893136143684387,
-0.030440600588917732,
0.46820715069770813,
-0.17273515462875366,
-0.2253227... | |
How do you convert decimal values to their hexadecimal equivalent in JavaScript?
Convert a number to a hexadecimal string with:
```
hexString = yourNumber.toString(16);
```
And reverse the process with:
```
yourNumber = parseInt(hexString, 16);
``` | [
-0.1107698455452919,
0.38424333930015564,
0.25459644198417664,
-0.22531870007514954,
-0.000841767992824316,
0.38894280791282654,
0.11212161183357239,
-0.38444745540618896,
-0.00433452008292079,
-0.092079296708107,
-0.19380010664463043,
0.5976187586784363,
-0.2316545993089676,
-0.2775392830... | |
I have a wrapper around a C++ function call which I call from C# code. How do I attach a debugger in Visual Studio to step into the native C++ code?
This is the wrapper that I have which calls GetData() defined in a C++ file:
```
[DllImport("Unmanaged.dll", CallingConvention=CallingConvention.Cdecl,
EntryPoint = "GetData", BestFitMapping = false)]
public static extern String GetData(String url);
```
The code is crashing and I want to investigate the root cause.
Thanks,
Nikhil
Check the Debug tab on your | [
0.47590184211730957,
0.000024277387637994252,
0.17020182311534882,
0.2109711468219757,
0.036677710711956024,
-0.32055023312568665,
0.25145530700683594,
-0.12411846220493317,
-0.010664273053407669,
-0.5881797075271606,
-0.3005073368549347,
0.7796536087989807,
-0.4155043959617615,
0.23355399... | |
project's properties page. There should be an "Enable unmanaged code debugging" checkbox. This worked for me when we developed a new .NET UI for our old c++ DLLs.
If your unmanaged DLL is being built from another project (for a while ours were being built using VS6) just make sure you have the DLL's pdb file handy for the debugging.
The other approach is to use the C# exe as the target exe to run from the DLL project, you can then debug your DLL normally. | [
0.47117722034454346,
-0.1642777919769287,
0.050331611186265945,
0.09361770749092102,
-0.2586349844932556,
-0.5047867298126221,
0.40454259514808655,
-0.024351974949240685,
-0.04101879149675369,
-0.8758124113082886,
-0.23822681605815887,
0.5252100825309753,
-0.36067813634872437,
0.0662917494... | |
Is it possible to use BackGroundWorker thread in [ASP.NET](http://en.wikipedia.org/wiki/ASP.NET) 2.0 for the following scenario, so that the user at the browser's end does not have to wait for long time?
Scenario
--------
1. The browser requests a page, say SendEmails.aspx
2. SendEmails.aspx page creates a BackgroundWorker thread, and supplies the thread with enough context to create and send emails.
3. The browser receives the response from the ComposeAndSendEmails.aspx, saying that emails are being sent.
4. Meanwhile, the background thread is engaged in a process of creating and sending emails which could take some considerable time to complete.
My main concern is about keeping the BackgroundWorker thread running, | [
0.1559305191040039,
-0.28482529520988464,
0.3755375146865845,
-0.1817079782485962,
-0.032728392630815506,
-0.0004324343171902001,
0.30654674768447876,
-0.06190696731209755,
-0.21885532140731812,
-0.7144227623939514,
-0.08781749755144119,
0.23675324022769928,
-0.3907521069049835,
-0.3678680... | |
trying to send, say 50 emails while the ASP.NET workerprocess threadpool thread is long gone.
If you don't want to use the AJAX libraries, or the e-mail processing is REALLY long and would timeout a standard AJAX request, you can use an AsynchronousPostBack method that was the "old hack" in the .net 1.1 days.
Essentially what you do is have your submit button begin the e-mail processing in an asynchronous state, while the user is taken to an intermediate page. The benefit to this is that you can have your intermediate page refresh as much as needed, without worrying about hitting | [
-0.03992538899183273,
-0.3266707956790924,
0.09074010699987411,
0.12011394649744034,
-0.32133811712265015,
-0.08569775521755219,
0.36089080572128296,
0.007779423613101244,
-0.33676159381866455,
-0.973759114742279,
0.016771603375673294,
0.4694672226905823,
-0.1950524002313614,
-0.2454633563... | |
the standard timeouts.
When your background process is complete, it will put a little "done" flag in the database/application variable/whatever. When your intermediate page does a refresh of itself, it detects this flag and automatically redirects the user to the "done" page.
Again, AJAX makes all of this moot, but if for some reason you have a very intensive or timely process that has to be done over the web, this solution will work for you. I found a nice tutorial on it [here](http://www.simple-talk.com/dotnet/asp.net/asynchronous-client-script-callbacks/) and there are plenty more out there.
I had to use a process like this when we | [
0.42265260219573975,
-0.30367401242256165,
0.3814562261104584,
0.14324221014976501,
0.04882156848907471,
-0.18859556317329407,
0.1022481694817543,
0.054742783308029175,
-0.33302560448646545,
-0.8618175387382507,
-0.09864561259746552,
0.685225784778595,
-0.04106710106134415,
-0.352349013090... | |
were working on a "web check-in" type application that was interfacing with a third party application and their import API was hideously slow.
EDIT: GAH! Curse you Guzlar and your god-like typing abilities 8^D. | [
0.37795811891555786,
0.6796291470527649,
-0.1386050432920456,
0.037654124200344086,
-0.40959614515304565,
0.06731399148702621,
0.38612866401672363,
0.47388705611228943,
-0.3386339545249939,
-0.49117380380630493,
-0.13983093202114105,
0.331184446811676,
-0.3115628659725189,
0.22904169559478... | |
My project has some money to spend before the end of the fiscal year and we are considering replacing a Sun-Fire-V490 server we've had for a few years. One option we are looking at is the [CoolThreads](http://www.sun.com/servers/coolthreads/overview/index.jsp) technology. All I know is the Sun marketing, which may not be 100% unbiased. Has anyone actually played with one of these?
I suspect it will be no value to us, since we don't use threads or virtual machines much and we can't spend a lot of time retrofitting code. We do spawn a ton of processes, but I doubt CoolThreads will be of | [
0.4131481945514679,
0.15458500385284424,
0.3305265009403229,
0.2525438070297241,
0.1413102149963379,
-0.5682340264320374,
-0.0007020196644589305,
0.3786220848560333,
-0.31334301829338074,
-0.3918113708496094,
0.1443641185760498,
0.5819499492645264,
0.035880737006664276,
0.23896099627017975... | |
help there.
(And yes, the money would be better spent on bonuses or something, but that's not going to happen.)
**Disclosure: I work for Sun** (but as an engineer in client software).
You don't necesarily need multithreaded code to make use of these machines. Having multiple processes will make use of multiple hardware threads on multiple cores.
The old T1 processors (T1000 and T2000 boxes) did have only a single FPU, and weren't really suitable for tasks with much more than about 1% floating point. The newer T2 and T2+ processors have an FPU per core. That's probably still not great for massive floating | [
0.4719536304473877,
0.11183881014585495,
0.05409065634012222,
0.31715133786201477,
0.012047632597386837,
-0.02080589346587658,
-0.07999178022146225,
0.1730545163154602,
-0.36382079124450684,
-0.47952786087989807,
-0.0264300424605608,
0.40253108739852905,
0.2845906913280487,
0.0107337292283... | |
point crunching, but is much more respectable.
(Note: Hyper-Threading Technology is a trademark of Intel. Sun uses the term Chip MultiThreading (CMT).) | [
-0.09515436738729477,
-0.052523016929626465,
0.23187454044818878,
0.2858195900917053,
-0.19279417395591736,
-0.30328258872032166,
-0.4698371887207031,
0.4366728663444519,
-0.36832988262176514,
-0.3336719274520874,
-0.3647952079772949,
0.1464904546737671,
-0.02475869096815586,
0.17897538840... | |
Grails scaffolding defaults to 10 rows per page. I would like to increase that number without generating the views and changing the 10 in every file. Where do I change the default?
You have to install scaffold templates with:
grails install-templates
Now, edit in src/templates/scaffolding Controller.groovy and increase the value params.max as you want | [
-0.16904133558273315,
-0.1521267294883728,
0.7218660116195679,
0.13395647704601288,
-0.1510898619890213,
0.30716001987457275,
0.4047814607620239,
-0.3177092373371124,
-0.5375592112541199,
-0.4723893702030182,
-0.0683431327342987,
0.6531644463539124,
-0.2785763442516327,
-0.3376105129718780... | |
I'm currently updating a legacy system which allows users to dictate part of the schema of one of its tables. Users can create and remove columns from the table through this interface. This legacy system is using ADO 2.8, and is using SQL Server 2005 as its database (you don't even WANT to know what database it was using before the attempt to modernize this beast began... but I digress. =) )
In this same editing process, users can define (and change) a list of valid values that can be stored in these user created fields (if the user wants to | [
0.2526101768016815,
0.33955374360084534,
0.4270005524158478,
-0.2578177750110626,
-0.08045545220375061,
-0.2510652542114258,
0.19383539259433746,
-0.22431088984012604,
-0.25846025347709656,
-0.439239501953125,
0.236715629696846,
0.35495510697364807,
-0.374340295791626,
0.3668956458568573,
... | |
limit what can be in the field).
When the user changes the list of valid entries for a field, if they remove one of the valid values, they are allowed to choose a new "valid value" to map any rows that have this (now invalid) value in it, so that they now have a valid value again.
In looking through the old code, I noticed that it is extremely vulnerable to putting the system into an invalid state, because the changes mentioned above are not done within a transaction (so if someone else came along halfway through the process mentioned above and | [
0.1122354045510292,
-0.0714152529835701,
0.4088887572288513,
-0.024674681946635246,
0.3844121992588043,
-0.25707656145095825,
0.17044977843761444,
-0.06859581917524338,
-0.3831218481063843,
-0.48002251982688904,
-0.12514667212963104,
0.5973907709121704,
-0.2638085186481476,
0.4957793056964... | |
made their own changes... well, you can imagine the problems that might cause).
The problem is, I've been trying to get them to update under a single transaction, but whenever the code gets to the part where it changes the schema of that table, all of the other changes (updating values in rows, be it in the table where the schema changed or not... they can be completely unrelated tables even) made up to that point in the transaction appear to be silently dropped. I receive no error message indicating that they were dropped, and when I commit the transaction at | [
0.42907586693763733,
0.39831292629241943,
0.448944091796875,
-0.02081713080406189,
0.35452646017074585,
0.23895807564258575,
0.08881382644176483,
0.08182302117347717,
-0.941790759563446,
-0.5451667904853821,
0.1428830325603485,
0.21541815996170044,
-0.20042340457439423,
0.26179271936416626... | |
the end no error is raised... but when I go to look in the tables that were supposed to be updated in the transaction, only the new columns are there. None of the non-schema changes made are saved.
Looking on the net for answers has, thus far, proved to be a waste of a couple hours... so I turn here for help. Has anyone ever tried to perform a transaction through ADO that both updates the schema of a table and updates rows in tables (be it that same table, or others)? Is it not allowed? Is there any documentation out | [
0.3241863250732422,
0.3279496431350708,
0.5163512825965881,
0.2692873477935791,
0.13803362846374512,
-0.10444574803113937,
0.3139761984348297,
-0.0366385243833065,
-0.2178090512752533,
-0.5675582885742188,
0.19394265115261078,
0.6223554015159607,
0.08543150126934052,
0.3358794152736664,
... | |
there that could be helpful in this situation?
EDIT:
Okay, I did a trace, and these commands were sent to the database (explanations in parenthesis)
**(I don't know what's happening here, looks like it's creating a temporary stored procedure...?)**
```
declare @p1
int set @p1=180150003 declare @p3 int
set @p3=2 declare @p4 int set @p4=4
declare @p5 int set @p5=-1
```
**(Retreiving the table that holds definition information for the user-generated fields)**
```
exec sp_cursoropen @p1 output,N'SELECT * FROM CustomFieldDefs ORDER BY Sequence',@p3 output,@p4 output,@p5 output select @p1, @p3, @p4, @p5
go
```
**(I think my code was iterating through the list of them here, grabbing the current information)**
```
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec | [
-0.0868837982416153,
0.024989934638142586,
0.48393669724464417,
0.16722828149795532,
0.1092175617814064,
0.042912982404232025,
0.05755475535988808,
-0.2898932099342346,
-0.44507676362991333,
-0.43446823954582214,
-0.022977454587817192,
0.6015671491622925,
-0.4067418575286865,
-0.0670445337... | |
sp_cursorfetch 180150003,32,1,1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursorfetch 180150003,1025,1,1
go
exec sp_cursorfetch 180150003,1028,1,1
go
exec sp_cursorfetch 180150003,32,1,1
go
```
**(This appears to be where I'm entering the modified data for the definitions, I go through each and update any changes that occurred in the definitions for the custom fields themselves)**
```
exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=1,@Description='asdf',@Format='U|',@IsLookUp=1,@Length=50,@Properties='U|',@Required=1,@Title='__asdf',@Type='',@_Version=1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=2,@Description='give',@Format='Y',@IsLookUp=0,@Length=0,@Properties='',@Required=0,@Title='_give',@Type='B',@_Version=1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=3,@Description='up',@Format='###-##-####',@IsLookUp=0,@Length=0,@Properties='',@Required=0,@Title='_up',@Type='N',@_Version=1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=4,@Description='Testy',@Format='',@IsLookUp=0,@Length=50,@Properties='',@Required=0,@Title='_Testy',@Type='',@_Version=1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=5,@Description='you',@Format='U|',@IsLookUp=0,@Length=250,@Properties='U|',@Required=0,@Title='_you',@Type='',@_Version=1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=6,@Description='never',@Format='mm/dd/yyyy',@IsLookUp=0,@Length=0,@Properties='',@Required=0,@Title='_never',@Type='D',@_Version=1
go
exec sp_cursorfetch 180150003,32,1,1
go
exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=7,@Description='gonna',@Format='###-###-####',@IsLookUp=0,@Length=0,@Properties='',@Required=0,@Title='_gonna',@Type='C',@_Version=1
go
exec sp_cursorfetch 180150003,32,1,1
go
```
**(This is where my code removes the deleted through the interface before this saving began]... it is also the ONLY thing as far as I can | [
-0.308078408241272,
0.06637052446603775,
1.147591471672058,
0.12723290920257568,
-0.06790364533662796,
0.4013626277446747,
0.13413837552070618,
-0.7261064052581787,
-0.4307088255882263,
-0.4650537073612213,
-0.14258551597595215,
0.44801947474479675,
-0.3966425359249115,
-0.0121600301936268... | |
tell that actually happens during this transaction)**
```
ALTER TABLE CustomizableTable DROP COLUMN _weveknown;
```
**(Now if any of the definitions were altered in such a way that the user-created column's properties need to be changed or indexes on the columns need to be added/removed, it is done here, along with giving a default value to any rows that didn't have a value yet for the given column... note that, as far as I can tell, NONE of this actually happens when the stored procedure finishes.)**
````
go
SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '__asdf'
go
ALTER TABLE CustomizableTable ALTER COLUMN __asdf VarChar(50) | [
0.3174887001514435,
0.04919722303748131,
0.8925367593765259,
0.04820505157113075,
0.26248398423194885,
-0.16381970047950745,
0.19083945453166962,
-0.38540491461753845,
0.12392252683639526,
-0.6266021132469177,
-0.04035074636340141,
1.026435375213623,
-0.4695945084095001,
0.1267049461603164... | |
NULL
go
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx___asdf') CREATE NONCLUSTERED INDEX idx___asdf ON CustomizableTable (
__asdf ASC) WITH (PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF);
go
select * from IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx___asdf') CREATE NONCLUSTERED INDEX idx___asdf ON
CustomizableTable ( __asdf ASC) WITH (PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF);
go
UPDATE CustomizableTable SET [__asdf] = '' WHERE [__asdf] IS NULL
go
SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name | [
-0.6477601528167725,
-0.12489867210388184,
0.3044608235359192,
-0.13673406839370728,
0.0383748821914196,
0.08979068696498871,
0.18749886751174927,
-0.19831694662570953,
-0.15891794860363007,
-0.6097557544708252,
-0.6665040850639343,
0.40396207571029663,
-0.4883211553096771,
-0.026842065155... | |
= '_give'
go
ALTER TABLE CustomizableTable ALTER COLUMN _give Bit NULL
go
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__give') DROP INDEX idx__give ON CustomizableTable WITH ( ONLINE = OFF );
go
UPDATE CustomizableTable SET [_give] = 0 WHERE [_give] IS NULL
go
SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '_up'
go
ALTER TABLE CustomizableTable ALTER COLUMN _up Int NULL
go
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__up') DROP INDEX idx__up ON CustomizableTable WITH ( ONLINE = OFF );
go
UPDATE CustomizableTable SET [_up] = 0 WHERE [_up] IS NULL
go
SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') | [
-0.22304971516132355,
-0.16373901069164276,
0.4262290894985199,
-0.16804258525371552,
-0.11766836792230606,
0.2516038417816162,
-0.128335103392601,
-0.7057490944862366,
-0.21514897048473358,
-0.5411732792854309,
-0.3970571458339691,
0.6780422329902649,
-0.3384985625743866,
0.20011766254901... | |
AND name = '_Testy'
go
ALTER TABLE CustomizableTable ADD _Testy VarChar(50) NULL
go
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__Testy') DROP INDEX idx__Testy ON CustomizableTable WITH ( ONLINE = OFF );
go
UPDATE CustomizableTable SET [_Testy] = '' WHERE [_Testy] IS NULL
go
SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '_you'
go
ALTER TABLE CustomizableTable ALTER COLUMN _you VarChar(250) NULL
go
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__you') DROP INDEX idx__you ON CustomizableTable WITH ( ONLINE = OFF );
go
UPDATE CustomizableTable SET [_you] = '' WHERE [_you] IS NULL
go
SELECT * FROM sys.columns WHERE object_id = | [
-0.30838504433631897,
-0.1678215116262436,
0.2223149687051773,
-0.08121422678232193,
-0.005474458448588848,
0.4145154058933258,
-0.025316286832094193,
-0.7734827995300293,
-0.2079584002494812,
-0.6726498603820801,
-0.3218996822834015,
0.6588771343231201,
-0.3598234951496124,
0.025944745168... | |
OBJECT_ID(N'CustomizableTable') AND name = '_never'
go
ALTER TABLE CustomizableTable ALTER COLUMN _never DateTime NULL
go
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__never') DROP INDEX idx__never ON CustomizableTable WITH ( ONLINE = OFF );
go
UPDATE CustomizableTable SET [_never] = '1/1/1900' WHERE [_never] IS NULL
go
SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '_gonna'
go
ALTER TABLE CustomizableTable ALTER COLUMN _gonna Money NULL
go
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__gonna') DROP INDEX idx__gonna ON CustomizableTable WITH ( ONLINE = OFF );
go
UPDATE CustomizableTable SET [_gonna] = 0 WHERE [_gonna] IS NULL
go
````
**(Closing the Transaction...?)**
````
exec sp_cursorclose 180150003
go
````
After | [
-0.28688085079193115,
-0.047033749520778656,
0.6041096448898315,
0.05206678435206413,
0.20000100135803223,
0.03970479220151901,
-0.09914597123861313,
-0.2376382052898407,
-0.4891669750213623,
-0.49457550048828125,
-0.2830670475959778,
0.7244622707366943,
-0.25115132331848145,
0.43329116702... | |
all that ado above, only the deletion of the column occurs. Everything before and after it in the transaction appears to be ignored, and there were no messages in the SQL Trace to indicate that something went wrong during the transaction.
The code is using a server-side cursor, that's what those calls are for. The first set of calls is preparing/opening the cursor. Then fetching rows from the cursor. Finally closing the cursor. Those sprocs are analogous to the OPEN CURSOR, FETCH NEXT, CLOSE CURSOR T-SQL statements.
I'd have to take a closer look (which I will), but my guess is there | [
-0.05660714954137802,
0.11176742613315582,
0.6331688761711121,
0.07225004583597183,
-0.0472894087433815,
0.14614461362361908,
0.005311132408678532,
-0.38928914070129395,
-0.3133709132671356,
-0.1417306661605835,
-0.13050630688667297,
0.5692997574806213,
-0.4774281084537506,
0.0709125250577... | |
is something going on with the server-side cursor, the encapsulating transaction, and the DDL.
Some more questions:
1. Are you meaning to use server-side cursors in this case?
2. Are the ADO Commands all using the same active connection?
**Update:**
I'm not exactly sure what's going on.
It looks like you're using server-side cursors so you can use Recordset.Update() to push changes back to the server, in addition to executing generated SQL statements to alter schema and update data in the dynamic table(s). Using the same connection, inside an explicit transaction.
I'm not sure what effect the cursor operations will have on the rest of the transaction, | [
0.09194113314151764,
-0.1572466343641281,
0.4447444975376129,
0.3624940514564514,
-0.07061779499053955,
-0.12396985292434692,
-0.16637495160102844,
0.10569543391466141,
-0.44528743624687195,
-0.5293149352073669,
0.10762649774551392,
0.4673711061477661,
-0.4152778089046478,
0.06026194617152... | |
or vice-versa, and to be honest I'm surprised this isn't working.
I don't know how large of a change it would be, but I would recommend moving away from the server-side cursors and building the UPDATE statements for your table updates.
Sorry I couldn't be of more help.
BTW- I found the following information on the sp\_cursor calls:
<http://jtds.sourceforge.net/apiCursors.html> | [
0.19799526035785675,
-0.005274918861687183,
0.901501476764679,
0.021488795056939125,
-0.18949511647224426,
0.038391634821891785,
0.22100141644477844,
-0.006600712891668081,
-0.5618820786476135,
-0.38561445474624634,
0.27485814690589905,
0.5413995385169983,
-0.13122886419296265,
-0.16693159... | |
We have a whole bunch of queries that "search" for clients, customers, etc. You can search by first name, email, etc. We're using LIKE statements in the following manner:
```
SELECT *
FROM customer
WHERE fname LIKE '%someName%'
```
Does full-text indexing help in the scenario? We're using SQL Server 2005.
It will depend upon your DBMS. I believe that most systems will not take advantage of the full-text index unless you use the full-text functions. (e.g. [MATCH/AGAINST](http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html) in mySQL or FREETEXT/CONTAINS in MS SQL)
Here is two good articles on when, why, and how to use full-text indexing in SQL Server:
1. [How To Use | [
0.10439613461494446,
0.1486949473619461,
0.36871281266212463,
0.13584938645362854,
-0.08031545579433441,
-0.1555817425251007,
-0.0030192441772669554,
0.08705691248178482,
0.02352377399802208,
-0.5117683410644531,
0.04360746964812279,
0.5600748062133789,
-0.138901025056839,
0.02255617268383... | |
SQL Server Full-Text Searching](https://www.developer.com/database/sql-server-full-text-searching/)
2. [Solving Complex SQL Problems with Full-Text Indexing](https://www.developer.com/guides/solving-complex-sql-problems-with-full-text-indexing/) | [
-0.39486435055732727,
0.09836138784885406,
0.39691001176834106,
0.1520335078239441,
-0.2969569265842438,
-0.21052920818328857,
0.03272087872028351,
-0.3132741451263428,
-0.15116457641124725,
-0.3557244539260864,
-0.20303946733474731,
0.5558156967163086,
-0.41176837682724,
-0.16536623239517... | |
I'm really confused by the various configuration options for .Net configuration of dll's, ASP.net websites etc in .Net v2 - especially when considering the impact of a config file at the UI / end-user end of the chain.
So, for example, some of the applications I work with use settings which we access with:
```
string blah = AppLib.Properties.Settings.Default.TemplatePath;
```
Now, this option seems cool because the members are stongly typed, and I won't be able to type in a property name that doesn't exist in the Visual Studio 2005 IDE. We end up with lines like this in the App.Config of a command-line executable | [
0.29269474744796753,
0.024769093841314316,
0.33288270235061646,
-0.0950973704457283,
-0.28464165329933167,
-0.14465883374214172,
0.1679903119802475,
-0.15807165205478668,
-0.3079819679260254,
-0.6799057722091675,
-0.02325831912457943,
0.5627461075782776,
-0.5092827081680298,
-0.03163853287... | |
project:
```
<connectionStrings>
<add name="AppConnectionString" connectionString="XXXX" />
<add name="AppLib.Properties.Settings.AppConnectionString" connectionString="XXXX" />
</connectionStrings>
```
(If we don't have the second setting, someone releasing a debug dll to the live box could have built with the debug connection string embedded in it - eek)
We also have settings accessed like this:
```
string blah = System.Configuration.ConfigurationManager.AppSettings["TemplatePath_PDF"];
```
Now, these seem cool because we can access the setting from the dll code, or the exe / aspx code, and all we need in the Web or App.config is:
```
<appSettings>
<add key="TemplatePath_PDF" value="xxx"/>
</appSettings>
```
However, the value of course may not be set in the config files, or the | [
0.41726985573768616,
0.027358219027519226,
0.3553031086921692,
0.17651599645614624,
0.2996252179145813,
-0.07066931575536728,
0.14125078916549683,
-0.41392043232917786,
-0.1114855706691742,
-1.013440728187561,
-0.3689572513103485,
0.3973902463912964,
-0.31596049666404724,
-0.07604420930147... | |
string name may be mistyped, and so we have a different set of problems.
So... if my understanding is correct, the former methods give strong typing but bad sharing of values between the dll and other projects. The latter provides better sharing, but weaker typing.
I feel like I must be missing something. For the moment, I'm not even concerned with the application being able to write-back values to the configuration files, encryption or anything like that. Also, I had decided that the best way to store any non-connection strings was in the DB... and then the very next thing that I | [
0.12752819061279297,
0.0190438125282526,
0.2801078259944916,
0.002921062521636486,
-0.2563649117946625,
-0.2893499732017517,
0.2929845154285431,
0.10017745941877365,
-0.28450390696525574,
-0.4801388382911682,
0.07530146837234497,
0.3493463695049286,
-0.35459452867507935,
0.5649292469024658... | |
have to do is store phone numbers to text people in case of DB connection issues, so they must be stored outside the DB!
Nij, our difference in thinking comes from our different perspectives. I'm thinking about developing enterprise apps that predominantly use WinForms clients. In this instance the business logic is contained on an application server. Each client would need to know the phone number to dial, but placing it in the App.config of each client poses a problem if that phone number changes. In that case it seems obvious to store application configuration information (or application wide settings) in | [
0.38908469676971436,
0.30799955129623413,
0.1956419199705124,
0.010640809312462807,
0.2668195366859436,
-0.09859297424554825,
0.28534093499183655,
-0.30076220631599426,
0.13113698363304138,
-0.7444446086883545,
-0.2220272719860077,
0.502310574054718,
-0.1467168927192688,
-0.097144544124603... | |
a database and have each client read the settings from there.
The other, .NET way, (I make the distinction because we have, in the pre .NET days, stored application settings in DB tables) is to store application settings in the app.config file and access via way of the generated Settings class.
I digress. Your situation sounds different. If all different apps are on the same server, you could place the settings in a web.config at a higher level. However if they are not, you could also have a seperate "configuration service" that all three applications talk to get their shared settings. | [
0.19904839992523193,
-0.18708601593971252,
0.20244185626506805,
0.47854140400886536,
0.22236992418766022,
-0.04662088304758072,
-0.019119931384921074,
-0.08749204874038696,
-0.08757136762142181,
-0.9425042271614075,
0.02824338525533676,
0.7087523341178894,
-0.32695552706718445,
0.053080376... | |
At least in this solution you're not replicating the code in three places, raising the potential of maintenance problems when adding settings. Sounds a bit over engineered though.
My personal preference is to use strong typed settings. I actually generate my own strongly typed settings class based on what it's my settings table in the database. That way I can have the best of both worlds. Intellisense to my settings and settings stored in the db (note: that's in the case where there's no app server).
I'm interested in learning other peoples strategies for this too :) | [
0.2112557291984558,
0.11880169063806534,
0.2736104428768158,
0.25234636664390564,
0.03442176803946495,
0.4076392352581024,
0.5361182689666748,
0.028201282024383545,
0.07649940252304077,
-1.017486810684204,
0.19451764225959778,
0.6875060200691223,
-0.08608908206224442,
-0.2517060935497284,
... | |
I'm just looking for a simple, concise explanation of the difference between these two. MSDN doesn't go into a hell of a lot of detail here.
* `__declspec(dllexport)` tells the linker that you want this object to be made available for other DLL's to import. It is used when creating a DLL that others can link to.
* `__declspec(dllimport)` imports the implementation from a DLL so your application can use it.
I'm only a novice C/C++ developer, so perhaps someone's got a better explanation than I. | [
0.30958735942840576,
0.12762756645679474,
0.15767139196395874,
-0.10258737206459045,
-0.043742675334215164,
-0.28280943632125854,
0.11388812214136124,
0.18785881996154785,
-0.329082190990448,
-0.8339861035346985,
-0.07588471472263336,
0.8039801716804504,
-0.45831534266471863,
0.03245460614... | |
I'm trying to provide a link to my company's website from a Windows Form. I want to be well behaved and launch using the user's preferred browser.
What is the best way to open a URL in the user's default browser from a Windows Forms application?
This [article](http://support.microsoft.com/kb/320478) will walk you through it.
Short answer:
```
ProcessStartInfo sInfo = new ProcessStartInfo("http://mysite.com/");
Process.Start(sInfo);
``` | [
0.3039059340953827,
0.2144407480955124,
0.7172075510025024,
-0.10775614529848099,
0.16058963537216187,
-0.3595134913921356,
0.19587010145187378,
0.16001734137535095,
-0.3591289520263672,
-0.7654666304588318,
-0.29970690608024597,
0.09246870875358582,
0.04748525843024254,
0.4588115513324737... | |
I have a list of bean objects passed into my JSP page, and one of them is a comment field. This field may contain newlines, and I want to replace them with semicolons using JSTL, so that the field can be displayed in a text input. I have found one solution, but it's not very elegant. I'll post below as a possibility.
Here is a solution I found. It doesn't seem very elegant, though:
```
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<% pageContext.setAttribute("newLineChar", "\n"); %>
${fn:replace(item.comments, newLineChar, "; ")}
``` | [
-0.0011035926872864366,
0.17859874665737152,
0.6268793940544128,
-0.3618151843547821,
-0.25381678342819214,
-0.04394758492708206,
-0.05029180273413658,
-0.0754106417298317,
-0.283685564994812,
-0.7998415231704712,
-0.03872362896800041,
0.3171852231025696,
-0.564538300037384,
0.014032623730... | |
I can't tell from the Python documentation whether the re.compile(x) function may throw an exception (assuming you pass in a string). I imagine there is something that could be considered an invalid regular expression. The larger question is, where do I go to find if a given Python library call may throw exception(s) and what those are?
Well, `re.compile` certainly may:
```
>>> import re
>>> re.compile('he(lo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python25\lib\re.py", line 180, in compile
return _compile(pattern, flags)
File "C:\Python25\lib\re.py", line 233, in _compile
raise error, v | [
0.317552387714386,
0.2569045126438141,
0.09159406274557114,
-0.06456796824932098,
0.23993057012557983,
-0.03041541390120983,
0.365400105714798,
-0.2008180320262909,
-0.45555490255355835,
-0.34280556440353394,
-0.37474629282951355,
0.47574904561042786,
-0.4193997383117676,
0.081899337470531... | |
# invalid expression
sre_constants.error: unbalanced parenthesis
```
[The documentation](https://web.archive.org/web/20080913142948/http://docs.python.org/lib/node46.html) does support this, in a roundabout way - check the bottom of the "Module Contents" page for (brief) description of the `error` exception.
Unfortunately, I don't have any answer to the general question. I suppose the documentation for the various modules varies in quality and thoroughness. If there were particular modules you were interested in, you might be able to [decompile](https://web.archive.org/web/20081004235506/http://www.depython.net/) them (if written in Python) or even [look at the source](http://www.python.org/download/), if they're in the standard library. | [
0.2593603730201721,
0.32047730684280396,
0.12974606454372406,
0.05918162688612938,
0.02885301038622856,
-0.22565540671348572,
0.41842058300971985,
-0.16221323609352112,
-0.4220973253250122,
-0.22139215469360352,
-0.38275304436683655,
0.5006155967712402,
-0.41099584102630615,
0.203843131661... | |
I am trying to come up with the best way to render some hierarchical data in to a nested unordered list using ASP.NET MVC. Does anyone have any tips on how to do this?
I suggest jquery tree view plugins for making it function like a tree, but as for render, just put it in a recursive lambda helper to do the nesting. | [
0.3250593841075897,
0.02107818052172661,
-0.10966150462627411,
0.1387045830488205,
-0.20858721435070038,
-0.08891133964061737,
0.1374538242816925,
0.20862257480621338,
-0.22143247723579407,
-0.7845677137374878,
0.13242533802986145,
0.5231440663337708,
-0.15663479268550873,
-0.0553236231207... | |
I've got a menu that contains, among other things, some most-recently-used file paths. The paths to these files can be long, so the text sometimes gets clipped like "C:\Progra...\foo.txt"
I'd like to pop a tooltip with the full path when the user hovers over the item, but this doesn't seem possible with the [Tooltip](http://msdn.microsoft.com/en-us/library/system.windows.forms.tooltip.aspx) class in .NET 2.0.
Am I missing something obvious?
If you are creating your menu items using the [System.Windows.Forms.MenuItem](http://msdn.microsoft.com/en-us/library/system.windows.forms.menuitem.aspx "MenuItem Members") class you won't have a "ToolTipText" property.
You should use the [System.Windows.Forms.ToolStripMenuItem](http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripmenuitem.aspx "ToolStripMenuItem class") class which is new as of .Net Framework 2.0 and DOES include the "ToolTipText" property.
You | [
0.40947386622428894,
-0.11459672451019287,
0.5367976427078247,
-0.140850231051445,
0.06392557919025421,
-0.17408202588558197,
0.07700368016958237,
0.058365024626255035,
-0.2679426074028015,
-0.7382456660270691,
-0.11989570409059525,
0.3964158594608307,
-0.18758957087993622,
0.1240468248724... | |
also have to remember to specify ShowItemToolTips = True on the MenuStrip control | [
0.2161015421152115,
-0.07317720353603363,
0.4701785445213318,
0.07107307761907578,
0.2860638201236725,
-0.3965994715690613,
0.5107945203781128,
-0.10934136807918549,
-0.05574120208621025,
-0.4256753921508789,
0.005252014845609665,
0.818476676940918,
-0.1305905282497406,
-0.0434280522167682... | |
Is it possible to use an UnhandledException Handler in a Windows Service?
Normally I would use a custom built Exception Handling Component that does logging, phone home, etc. This component adds a handler to System.AppDomain.CurrentDomain.UnhandledException but as far as I can tell this doesn’t achieve anything win a Windows Service so I end up with this pattern in my 2 (or 4) Service entry points:
```
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things | [
0.2143811285495758,
0.02417191118001938,
0.3131018877029419,
-0.03269574046134949,
0.15947142243385315,
-0.20429086685180664,
0.447470486164093,
-0.3013189733028412,
-0.1843639314174652,
-0.5395200848579407,
-0.13188250362873077,
0.5502925515174866,
-0.38865479826927185,
0.2307868152856826... | |
' in motion so your service can do its work.
Try
MyServiceComponent.Start()
Catch ex As Exception
'call into our exception handler
MyExceptionHandlingComponent.ManuallyHandleException (ex)
'zero is the default ExitCode for a successfull exit, so if we set it to non-zero | [
-0.08597319573163986,
-0.13272415101528168,
0.5530076026916504,
-0.13704441487789154,
0.23585918545722961,
-0.06117637827992439,
0.6802745461463928,
-0.0837547555565834,
-0.14004413783550262,
-0.43616846203804016,
-0.32722657918930054,
0.384785532951355,
-0.30189210176467896,
0.11648271232... | |
ExitCode = -1
'So, we use Environment.Exit, it seems to be the most appropriate thing to use
'we pass an exit code here as well, just in case.
System.Environment.Exit(-1)
End Try
End Sub
```
Is there a way my Custom Exception Handling component can deal with this better so I | [
-0.14204619824886322,
0.1662743240594864,
0.14266778528690338,
-0.018324634060263634,
0.23106063902378082,
-0.21956439316272736,
0.5952666997909546,
-0.17985446751117706,
0.09064561128616333,
-0.5312201976776123,
-0.26259085536003113,
0.243022158741951,
-0.5051062107086182,
0.0695898309350... | |
don't have to fill my OnStart with messy exception handling plumbing?
Ok, I’ve done a little more research into this now.
When you create a windows service in .Net, you create a class that inherits from System.ServiceProcess.ServiceBase (In VB this is hidden in the .Designer.vb file). You then override the OnStart and OnStop function, and OnPause and OnContinue if you choose to.
These methods are invoked from within the base class so I did a little poking around with reflector.
OnStart is invoked by a method in System.ServiceProcess.ServiceBase called ServiceQueuedMainCallback. The vesion on my machine "System.ServiceProcess, Version=2.0.0.0" decompiles like this:
```
Private Sub ServiceQueuedMainCallback(ByVal state | [
0.19848139584064484,
0.02503116987645626,
0.44658973813056946,
-0.21916723251342773,
0.12558963894844055,
-0.07858680188655853,
0.5054042339324951,
-0.133430615067482,
-0.1455691158771515,
-0.7100855708122253,
-0.2255343496799469,
0.6102652549743652,
-0.4170690178871155,
0.4053660035133362... | |
As Object)
Dim args As String() = DirectCast(state, String())
Try
Me.OnStart(args)
Me.WriteEventLogEntry(Res.GetString("StartSuccessful"))
Me.status.checkPoint = 0
Me.status.waitHint = 0
Me.status.currentState = 4
Catch exception As Exception
Me.WriteEventLogEntry(Res.GetString("StartFailed", New Object() { exception.ToString }), EventLogEntryType.Error)
Me.status.currentState = 1
Catch obj1 As | [
-0.0595768466591835,
-0.3885878026485443,
0.6740572452545166,
-0.3087622821331024,
0.2950146794319153,
0.02926158532500267,
0.5698732137680054,
-0.36489370465278625,
-0.41583114862442017,
-0.22092238068580627,
-0.29047033190727234,
0.38304007053375244,
-0.35182905197143555,
0.3882173299789... | |
Object
Me.WriteEventLogEntry(Res.GetString("StartFailed", New Object() { String.Empty }), EventLogEntryType.Error)
Me.status.currentState = 1
End Try
Me.startCompletedSignal.Set
End Sub
```
So because Me.OnStart(args) is called from within the Try portion of a Try Catch block I assume that anything that happens within the OnStart method is effectively wrapped by that Try Catch block and therefore any exceptions that occur aren't technically unhandled as they are actually handled in the ServiceQueuedMainCallback Try Catch. So CurrentDomain.UnhandledException never actually happens at least during the startup routine.
The other 3 | [
0.01834680326282978,
-0.11882846057415009,
0.5302939414978027,
-0.21002869307994843,
0.2837229073047638,
-0.08025327324867249,
0.5870104432106018,
-0.16924473643302917,
0.033511966466903687,
-0.2555341124534607,
-0.14767828583717346,
0.2103707492351532,
-0.10939456522464752,
0.253139674663... | |
entry points (OnStop, OnPause and OnContinue) are all called from the base class in a similar way.
So I ‘think’ that explains why my Exception Handling component can’t catch UnhandledException on Start and Stop, but I’m not sure if it explains why timers that are setup in OnStart can’t cause an UnhandledException when they fire. | [
-0.09246408194303513,
-0.02102511189877987,
0.13810408115386963,
0.2836482524871826,
0.12636509537696838,
0.02409849688410759,
0.02065218985080719,
-0.15728887915611267,
-0.002373209223151207,
-0.3157677948474884,
-0.13776981830596924,
0.3555839955806732,
0.0012278120266273618,
0.054685402... | |
We have a requirement to increase the functionality of a grid we are using to edit on our webapp, and our manager keeps citing Excel as the perfect example for a data grid :/ He still doesn't really get that a Spreadsheet like control doesn't exist out of the box, but I thought I'd do a bit of searching nonetheless.
I've found a couple of products on Google, but was wondering if anyone else has any feedback around any such controls (obviously the cheaper or *ahem* freer the better)
**EDIT** We do currently have the Telerik controls, but what the 'current' requirement | [
0.6909962296485901,
0.16293266415596008,
0.5186741352081299,
0.5710998773574829,
0.15700873732566833,
-0.2873929440975189,
-0.03630410507321358,
0.007743547670543194,
0.015414218418300152,
-0.5499944686889648,
0.34929171204566956,
0.6325855255126953,
0.10708343982696533,
0.0153802381828427... | |
is, is a control that can copy and paste (e.g) 3 cells from one row and paste them on another, the row by row editing of Telerik doesn't really cut it. We are currently in competition with an 'Excel' based solution, which is always a nightmare in winning users around, who always prefer flexibility to structure
Update: with Silverlight fast approaching, maybe you can use a real excel control.
[Devexpress](http://www.devexpress.com/Products/NET/Controls/ASP/Grid/) has a powerful grid control for both web and windows. It is not free and I guess nothing really matches Excel. But once the users started using it, they wanted every app | [
0.4293554723262787,
-0.4009855389595032,
0.329140841960907,
0.24290816485881805,
-0.007546854671090841,
-0.07694505900144577,
-0.26347875595092773,
-0.010363565757870674,
-0.27348563075065613,
-0.8157312870025635,
0.16356126964092255,
0.25352567434310913,
-0.4086363911628723,
0.11781644076... | |
with it. Check these [videos](http://www.devexpress.com/Products/NET/Controls/ASP/Grid/quickstart.xml) especially the data grouping one. | [
0.4097827076911926,
-0.5148257613182068,
0.3676319420337677,
0.6693136096000671,
-0.03119663894176483,
-0.49503931403160095,
-0.12327947467565536,
-0.20410726964473724,
-0.33926984667778015,
-0.42629683017730713,
-0.035961464047431946,
0.34329572319984436,
-0.04833873361349106,
-0.20480129... | |
Simple as the title states: Can you use only Java commands to take a screenshot and save it? Or, do I need to use an OS specific program to take the screenshot and then grab it off the clipboard?
Believe it or not, you can actually use [`java.awt.Robot`](http://java.sun.com/javase/6/docs/api/java/awt/Robot.html#createScreenCapture(java.awt.Rectangle)) to "create an image containing pixels read from the screen." You can then write that image to a file on disk.
I just tried it, and the whole thing ends up like:
```
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage capture = new Robot().createScreenCapture(screenRect);
ImageIO.write(capture, "bmp", new File(args[0]));
```
NOTE: This will only capture the primary monitor. See [GraphicsConfiguration](http://java.sun.com/javase/6/docs/api/java/awt/GraphicsConfiguration.html) for multi-monitor | [
0.241547629237175,
-0.04435607045888901,
0.5136213898658752,
-0.07192089408636093,
-0.18417295813560486,
-0.014916676096618176,
0.19993259012699127,
-0.40552404522895813,
-0.31816449761390686,
-0.9011944532394409,
-0.008942813612520695,
0.5476768612861633,
-0.39683035016059875,
0.000473507... | |
support. | [
0.01091784331947565,
0.092380590736866,
0.4476451277732849,
0.2008787840604782,
0.055552851408720016,
0.31626343727111816,
-0.23180560767650604,
-0.17453868687152863,
-0.1953701376914978,
-0.6263163685798645,
-0.612917423248291,
0.36110466718673706,
0.043371543288230896,
-0.254020422697067... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.