instruction
stringlengths
0
30k
I recommend FindBugs. http://findbugs.sourceforge.net/ Good in assisting to do code review.
Well I used perfmon, exported the results to a csv and used excel for statistics afterwards. That worked pretty well last time I needed to monitor a process
RallyDev.com. Free 5-user community edition and it's actually pretty good!
Depends. Are all your objects always going to be loaded in memory? Do you have a finite limit of objects that may be loaded? Will your queries have to consider objects that haven't been loaded yet? If the collection will get large, I would definitely use an index. In fact, if the collection can grow to an arbi...
I'd join the praises given to OJ - truely a good answer. Still, once you do have the basic understanding you can learn a lot and fast by downloading one of the following two great tools: - Render monkey http://ati.amd.com/developer/rendermonkey/downloads.html or the - Fx Composer http://developer.nvidia.com/o...
You can use a StreamWriter and in the Write(string) call use String.Format() to create a string that is the correct width for the given field.
Use the .PadRight function (for left aligned data) of the String class. So: handle.WriteLine(s20.PadRight(20)); handle.WriteLine(s80.PadRight(80)); handle.WriteLine(s10.PadRight(10)); handle.WriteLine(s2.PadRight(2));
We have a legacy VB6 app that uses UNC to build a connection string, so I know VB6 can do it. Often, you'll find permissions problems to be the culprit.
Have a unique table for each type of node. Why not just make the class you're building enforce the data integrity for its own type?
Have a unique table for each type of node. Why not just make the class you're building enforce the data integrity for its own type? <hr> **EDIT** In that case, you can either a) use logical constraints (see below) or b) stored procedures to do inserts/edits (a good idea regardless) or c) again, just make the...
How to iterate over all the page breaks in an Excel 2003 worksheet via COM
|excel|c++|com|
I've been trying to retrieve the locations of all the page breaks on a given Excel 2003 worksheet over COM. Here's an example of the kind of thing I'm trying to do: Excel::HPageBreaksPtr pHPageBreaks = pSheet->GetHPageBreaks(); long count = pHPageBreaks->Count; for (long i=0; i < count; ++i) { ...
By using `__declspec` for export, the function name will get exported *mangled*, i.e. contain type information to help the C++ compiler resolve overloads. VB6 cannot handle mangled names. As a workaround, you have to de-mangle the names. The easiest solution is to link the DLL file using an [export definition](http:...
Try adding __stdcall at the end #define MYDCC_API __declspec(dllexport) __stdcall We have some C++ dlls that interact with our old VB6 apps and they all have that at the end.
From being a developer with serveral years under the belt, this used to be a real question for me. I couldn't even say how many hours I passed thinking about this and trying different things in my code. The above answers are very nice too. I just want to add a thing or two. - We each have different things that mak...
These foreach samples are fine, though you can make them much more terse if you're using .NET 3.5 and LINQ: return FullList.Where(i => IsItemInPartialList(i)).ToList();
Iteration. It creates a state machine "under the covers" that remembers where you were on each additional call to the function and picks up from there.
It is a very simple and easy way to create an enumerable for your object. The compiler creates a class that wraps your method and that implements, in this case, IEnumerable&lt;object>. Without the yield keyword, you'd have to create an object that implements IEnumerable&lt;object>.
Software Phase Locked Loop example code needed
|signal-processing|
Does anyone know of anywhere I can find actual code examples of Software Phase Locked Loops (SPLLs) ? I need an SPLL that can track a PSK modulated signal that is somewhere between 1.1 KHz and 1.3 KHz. A Google search brings up plenty of academic papers and patents but nothing usable. Even a trip to the University ...
Possibly one of the better examples of 'There's More Than One Way To Do It", with or without the help of CPAN. If you have control over what you get passed as a 'date/time', I'd suggest going the [Date::Time][1] route, either by using a specific Date::Time::Format subclass, or using Date::Time::Format::Strptime if t...
I also forgot to mention that if you use rsync, you can set up rsync to use ssh, so you will only transfer the files that have changed, saving on time and bandwidth.
Try [http://walterzorn.com/jsgraphics/jsgraphics_e.htm][1]. It's the best I've found (without resorting to SVG) and works in most browsers without add-ins. [1]: http://walterzorn.com/jsgraphics/jsgraphics_e.htm
To better understand pointers, I think, it may be useful to look at how the assembly language works with pointers. The concept of pointers is really one of the fundamental parts of the assembly language and x86 processor instruction architecture. Maybe it'll kind of let you fell like pointers are a natural part of a pr...
To better understand pointers, I think, it may be useful to look at how the assembly language works with pointers. The concept of pointers is really one of the fundamental parts of the assembly language and x86 processor instruction architecture. Maybe it'll kind of let you fell like pointers are a natural part of a pr...
Change ContextMenu Font Size in C#
|c#|.net|font-size|contextmenu|
Is it possible to change the font size used in a ContextMenu using the .NET Framework 3.5 and C# for a desktop application? It seems it's a system-wide setting, but I would like to change it only within my application.
[Raphael](http://raphaeljs.com/) is pretty cool for that, and works across browsers since it uses VML (for MSIE) and SVG (for everything else).
No this is perfectly valid. This will also be more efficient as the compiler is actually able to optimise away the temporary.
You could try using the parametrized equations for an ellipse rotated at an arbitrary angle: x = h + a*cos(t)*cos(phi) - b*sin(t)*sin(phi) [1] y = k + b*sin(t)*cos(phi) - a*cos(t)*sin(phi) [2] ...where ellipse has centre (h,k) semimajor axis a and semiminor axis b, and is rotated through angle phi. ...
You could try using the parametrized equations for an ellipse rotated at an arbitrary angle: x = h + a*cos(t)*cos(phi) - b*sin(t)*sin(phi) [1] y = k + b*sin(t)*cos(phi) + a*cos(t)*sin(phi) [2] ...where ellipse has centre (h,k) semimajor axis a and semiminor axis b, and is rotated through angle phi. ...
http://www.pdflib.com/download/ Here is a library you didn't mention that will allow the creation of PDFs using php. Hope it's sufficient.
Since you're already using the new C# syntax, might as well use automatic properties as well, just to sweeten up your code a drop more: instead of this: string firstName; public string FirstName { get { return firstName; } set { firstName = value; } } use this: public ...
I'd go with <a href="http://martinfowler.com/eaaCatalog/queryObject.html">Query Objects</a>. They work well for accessing tables directly. If you are confined to stored procedures, they lose some of their power, but you can still make it work.
I used to maintain a Quake3 mod and this was a constant source of user-questions. Q3 uses 20 'ticks per second' by default - the graphics subsystem interpolates so you get smooth motion on the screen. I initially thought this was way low, but it turns out to be fine, and there really aren't many games at all with fa...
Organic growth with Lindenmayer Systems
|tree|lindenmayer|l-systems|organic|
I'm looking for a good way to represent organic growth - especially trees and flowers - using code. I've found Lindenmayer Systems as a reasonable way to portray this, but need a good place to start programming this. Any good suggestions?
Oh you have rewritten the question. That one is absolutely feasible, as long as javascript is alive. Use any timed ajax will do. Check with prototype library <http://www.prototypejs.org> PeriodicalExecutor or jQuery with the ajax + timer plugin. Setup a dummy page which your executor will call from time to time, so ...
Actually, I think that something like Microsoft Robotics Studio would be good for this.
I am not sure if it does that, but searching, after your previous post, what is cyclomatic complexity, I went to the related Wikipedia page which pointed to [Code Analyzer](http://www.geocities.com/sivaram_subr/codeanalyzer/description.htm "Code Analyzer"). There they say: > When counting for HTML or JSP files, it wi...
For most cases, the resources consumed by a sleeping thread will be its stack space. Using a 2-threads-per-connection-model, which I think is similar to what you're describing, is known to cause great scalability issues for this very reason when the number of connections grow large. I've been in this situation mysel...
short fast and dirty : grep for ";", count the number of lines, this will give you an estimate of the number of statements.
For each window, use JComponent.registerKeyboardAction with a condition of WHEN_IN_FOCUSED_WINDOW. Alternatively use JComponent.getInputMap(WHEN_IN_FOCUSED_WINDOW, true) and JComponent.getActionMap(true) as described in the registerKeyboardAction API docs.
If the servers have a common domain name, you can use a cookie.
If the servers have a common domain name, you can use a cookie. EDIT: Cookies will just hide the ID visually, it is still accessible. Same with hidden fields or using POST rather than GET. So if the ID is confidental and you want to avoid to send it over the network unencrypted, you need a different approach. A s...
What exactly is SQL Server 2005 User Mapping?
|sql-server|security|
In the new login dialog of the SQL Server 2005 Management Studio Express, what is the User Mapping actually doing? Am I restricting access to those databases that are checked? What if I check none?
Yep sure is, the WebBrowser control.
what about the browser control? a bit heavy, but at least you'll get an accurate rendering.
I think it's entirely a matter of personal preference and maintainability. For me, Haml makes the templates easier to read and understand, and the performance is very acceptable. In the end, the templating language is unlikely to be the place where you need to optimize -- more likely database queries, view or object ...
This happened to me once. The only thing I could do to fix it was a complete re-install of VB6 (wasn't caused by installing VS2005, but installing a component that added its own doc to Help). Probably not what you want to hear.
I was looking at the WebBrowser control but couldn't work out how to assign (set) the HTML to it...? EDIT: Found it - Document Text
you can pass in a connection or connection string to the data context as well.
Have get_sequence return a (custom) `forward_iterator` class that generates the sequence on-demand. (It could also be a more advanced iterator type like `bidirectional_iterator` if that's practical for your sequence.) Then the user can copy the sequence into whatever container type they want. Or, they can just loo...
IntelliJ IDEA from JetBrains. They also do ReSharper in the .Net community.
I would say not to do that work in the construtor - A constructor should not do so much work, in my opinion. Use a factory method that reads the file to determine the bit depth, then have it construct the correct generic variant of the class and return it.
Single statement if blocks lacking braces: Pros: - fewer characters - cleaner look Cons: - uniformity: not all if blocks look the same - potential for bugs when adding statements to the block: a user may forget to add the braces and the new statement would no be covered by the if. As in: if...
Single statement if blocks lacking braces: Pros: - fewer characters - cleaner look Cons: - uniformity: not all if blocks look the same - potential for bugs when adding statements to the block: a user may forget to add the braces and the new statement would no be covered by the if. > As in: ...
Flex: Custom Item Renderer For Combobox controls truncates text
|apache-flex|actionscript|mxml|
I've implemented a custom item renderer that I'm using with a combobox on a flex project I'm working on. It displays and icon and some text for each item. The only problem is that when the text is long the width of the menu is not being adjusted properly and the text is being truncated when displayed. I've tried tweaki...
I've implemented a custom item renderer that I'm using with a combobox on a flex project I'm working on. It displays and icon and some text for each item. The only problem is that when the text is long the width of the menu is not being adjusted properly and the text is being truncated when displayed. I've tried tweaki...
Yes, if you don't want to consider sets, consider the idea of 'factors.' How many factors does: p1^a1.p2^a2....pn^an have if p1's are distinct primes. If the ai's are all 1, then the number is 2^n. In general, the answer is (a1+1)(a2+1)...(an+1) as David Nehme notes.
Yes, if you don't want to consider sets, consider the idea of 'factors.' How many factors does: p1^a1.p2^a2....pn^an have if p1's are distinct primes. If the ai's are all 1, then the number is 2^n. In general, the answer is (a1+1)(a2+1)...(an+1) as David Nehme notes. Oh, and note that your answer by han...
It's producing enumerable sequence. What it does is actually creating local IEnumerable sequence and returning it as a method result
pek, for a short term fix apply one of the solutions suggested by other users. For a mid to long term plan you **should** consider migrating to one of existing web frameworks. They handle all low-level stuff like routing and files inclusion in reliable, secure way, so you can focus on core functionalities. **Do not ...
Till, for a short term fix apply one of the solutions suggested by other users. For a mid to long term plan you **should** consider migrating to one of existing web frameworks. They handle all low-level stuff like routing and files inclusion in reliable, secure way, so you can focus on core functionalities. **Do not...
pek, for a short term fix apply one of the solutions suggested by other users. For a mid to long term plan you **should** consider migrating to one of existing web frameworks. They handle all low-level stuff like routing and files inclusion in reliable, secure way, so you can focus on core functionalities. **Do not ...
There is one killer-reason to validate on both the client-side and on the database-side, and that is **security**. Especially when you start using AJAX-stuff, hackable URLs and other things that make your site (in this case) more friendly to users **and** hackers. Validate on the client to provide a smooth experienc...
Intuitively, the keyword returns a value from the function without leaving it, i.e. in your code example it returns the current `item` value and then resumes the loop. More formally, it is used by the compiler to generate code for an *iterator*. Iterators are functions that return `IEnumerable` objects. The [MSDN](http...
I prefer to use Server Aliases in the SQL Client Configuration. That way, when you decide to point the package to another SQL Server it is as simple as editing the alias to point to the new server, no editing necessary in the SSIS package. When moving the package to a live server, you need to add the aliases, and it ...
The yield keyword actually does quite a lot here. The function returns an object that implements the IEnumerable<object> interface. If a calling function starts foreach-ing over this object the function is called again until it "yields". This is syntactic suger introduced in C# 2.0. In earlier versions you had to creat...
Constructors should only really have arguments that are *required* to construct the object. Object initialisers are just a convenient way to assign values to properties. I use object initialisers whenever I can as I think it's a tidier syntax.
I've had a lot of success with [PDFLib][1] it's a very powerful library with PHP (and C, C#, Perl etc) bindings. [1]: http://www.pdflib.com/
Convert from String to byte[]: String s = "some text here"; byte[] b = s.getBytes("UTF-8"); Convert from byte[] to String: byte[] b = {(byte) 99, (byte)97, (byte)116}; String s = new String(b, "US-ASCII"); You should, of course, use the correct encoding name. My examples used "US-ASCII" an...
It's NP complete. But if you do manage to find a good method, let me know and I'll show you how to get rich.
Object Initializers as you describe help to reduce coding complexity in that you don't need to create a half dozen different constructors in order to provide initial values for properties. Anything that reduces redundant code is a positive, in my book. I believe the primary reason the feature was added to the langua...
Object Initializers help to reduce coding complexity in that you don't need to create a half dozen different constructors in order to provide initial values for properties. Anything that reduces redundant code is a positive, in my book. I believe the primary reason the feature was added to the language is to support...
being a beginner to jsf i had a similar problem, maybe my solution is helpful, maybe its not in the "jsf spirit" i just created a custom taglib and extended the class (in my case org.apache.myfaces.component.html.ext.HtmlCommandButton) and overrided the setters to apply custom parameters. so instead of `<t:comma...
We already have a Pro*C program reading from an Oracle database, it calls a perl script which in turn executes some Java to extract data in XML format from the aforementioned database for calling a batch file to execute some vbscript FTPing the file to some other server. I was really hoping for something in Fortran.
What Is ASP.Net MVC?
|asp.net-mvc|asp.net|model-view-controller|
When I first heard about StackOverflow, and heard that it was being built in ASP.Net MVC, I was a little confused. I thought ASP.Net was always an example of an MVC architecture. You have the .aspx page that provides the view, the .aspx.vb page that provides the controller, and you can create another class to be the ...
I like the idea of separating the colour information into a separate file, no matter how I do it. I would accept multiple answers here if I could, because I like Josh Millard's as well. I like the idea of having separate colour rules though because a particular tag might have different colours depending on where it o...
The first thing to realize is that, as [the documentation says][1], the cost you see displayed is relative to one of the query plans. The costs for 2 different explains are **not** comparable. Secondly the costs are based on an internal estimate. As hard as Oracle tries, those estimates are not accurate. Particular...
I tend to use what Resharper automatically makes. for example, it autocreated this for one of my reference types: public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return obj.GetType() == typeof (SecurableResourcePerm...
|excel|c++|com|vba|
|c++|excel|vba|com|
I've been trying to retrieve the locations of all the page breaks on a given Excel 2003 worksheet over COM. Here's an example of the kind of thing I'm trying to do: Excel::HPageBreaksPtr pHPageBreaks = pSheet->GetHPageBreaks(); long count = pHPageBreaks->Count; for (long i=0; i < count; ++i) { ...
I've been trying to retrieve the locations of all the page breaks on a given Excel 2003 worksheet over COM. Here's an example of the kind of thing I'm trying to do: Excel::HPageBreaksPtr pHPageBreaks = pSheet->GetHPageBreaks(); long count = pHPageBreaks->Count; for (long i=0; i < count; ++i) { ...
Probably not the cheapest way to do it: SELECT a.pkId,b.otherId FROM (SELECT a.pkId,CHECKSUM_AGG(a.value) as 'ValueHash' FROM @a a GROUP BY a.pkId) a INNER JOIN (SELECT b.otherId,CHECKSUM_AGG(b.value) as 'ValueHash' FROM @b b GROUP BY b.otherId) b ON a.ValueHash = b.ValueHash You can see, basically I...
Probably not the cheapest way to do it: SELECT a.pkId,b.otherId FROM (SELECT a.pkId,CHECKSUM_AGG(DISTINCT a.value) as 'ValueHash' FROM @a a GROUP BY a.pkId) a INNER JOIN (SELECT b.otherId,CHECKSUM_AGG(DISTINCT b.value) as 'ValueHash' FROM @b b GROUP BY b.otherId) b ON a.ValueHash = b.ValueHash ...
actually, fxcop doesn't particularly help you follow a coding standard. What it does help you with is designing a well-thought out framework/API. It's true that parts of the coding standard (such as casing of public members) will be caught by FxCop, but coding standards isn't the focus. coding standards can be che...
Well I think most of the time JPA is "good enough" but I miss the Criteria API a lot (only provided by Hibernate)
I guess you're building a windows kiosk? Here's some background in replacing the windows login shell - http://blogs.msdn.com/embedded/archive/2005/03/30/403999.aspx The above link talks about using IE as the replacement, but any program can be used. Also check out Windows Steady State - http://www.microsoft.co...