instruction
stringlengths
0
30k
⌀
This is all personal preference. When it gets compiled it turns out to be getter/setter functions either way. I personally use properties when setting and retrieving member values without any side affects. If there are side affects to retrieving/saving the value, then I use a function.
Installing Svn 1.5.x on Debian Etch - Best approach?
There's no way to remove these dotted focus in Firefox using CSS. If you have access to the computers where your webapplication works, go to about:config in Firefox and set browser.display.focus_ring_width to 0. Then Firefox won't show any dotted borders at all. The following bug explains the topic: https://bugzi...
Create a TemplateField and bound the id to it, something like this: <asp:TemplateField HeaderText="Whatever" SortExpression="fieldname" ItemStyle-HorizontalAlign="Center"> <ItemTemplate> <asp:CheckBox runat="server" ID="rowCheck" key='<%# Eval("id") %>' /> </ItemTemplate> </as...
I think a much better solution would be refactoring the code, so instead of the (yet under-supported) remoting, use web services. XML serialization of most basic data types are IIRC fully supported; and in certain circumstances, fits the architecture much better (especially server-client architectures).
It looks like the only way to achieve this is by setting browser.display.focus_ring_width = 0 in about:config on a per browser basis.
The ListView gives you full control about how the data is rendered to the client. You specify the Layout Template, and give a placeholder which will be where each item is injected. The output of the below will give you a table, and each item will be a new TR. Notice the use of runat='server' and `visible ='<%# %...
I just wanted to point out that vector&lt;Foo&gt; is usually more efficient than vector&lt;Foo\*&gt;. In a vector&lt;Foo&gt;, all the Foos will be adjacent to each other in memory. Assuming a cold TLB and cache, the first read will add the page to the TLB and pull a chunk of the vector into the L# caches; subsequent re...
Given that you don't really need to know the count, merely whether there is or isn't data for your sproc, I'd recommend something like this: CREATE PROCEDURE subProcedure @param1, @param2, @Param3 tinyint OUTPUT AS BEGIN IF EXISTS(SELECT * FROM table1 WHERE we have something to work with) ...
A regex for version number parsing
|regex|versioning|
I have a version number of the following form: version.release.modification where version, release and modification are either a set of digits or the '*' wildcard character. Additionally, any of these numbers (and any preceding .) may be missing. So the following are valid and parse as: 1.23.456 = versi...
I have a version number of the following form: version.release.modification where version, release and modification are either a set of digits or the '*' wildcard character. Additionally, any of these numbers (and any preceding .) may be missing. So the following are valid and parse as: 1.23.456 = versi...
Python + DNS : Cannot get RRSIG records: No Answer
|python|dns|dnspython|
I get DNS records from a Python program, using [DNS Python](http://www.dnspython.org/) I can get various DNSSEC-related records: >>> import dns.resolver >>> myresolver = dns.resolver.Resolver() >>> myresolver.use_edns(1, 0, 1400) >>> print myresolver.query('sources.org', 'DNSKEY') <dns.re...
If you are doing it at design time (which you indicate you are not) this should help you: http://blogs.msdn.com/abhinaba/archive/2005/11/30/498278.aspx If you are doing it dynamically through reflection (looks like the case here) this might help you: http://infosysblogs.com/microsoft/2007/04/loading_multiple_...
See the [VS Command shell][1] project [1]: http://www.codeplex.com/Wiki/View.aspx?ProjectName=VSCmdShell
Oh, how I wish there was a single site where the registry was collectively documented by all who write values there! Keep in mind, any app can create its own set of registry keys and values, so it's not just MS who would be necessary to such an effort. Though they would be a key player! In the meantime, there are tw...
We have been using Flexjson for converting Java objects to JSON and have found it very easy to use. [http://flexjson.sourceforge.net][1] Here are some examples: public String searchCars() { List<Car> cars = carsService.getCars(manufacturerId); return new JSONSerializer().serialize(cars); }...
There is a missing factor here .. most applications have a 'buckling' factor where crashes suddenly start "costing" a lot more because people loose confidence in the service your app is providing. Once that happens then it can be **very** costly to get users back to trusting and using the system.
I've not seen any studies, but a reasonable heuristic would be something like : ( Time since last application save when crash occurred + Time to restart application ) * Average hourly rate of application operator. The estimation gets more complex if the crashes have some impact on external customers such, or migh...
MySQL Data Truncation Error
|java|mysql|jdbc|
I'm working with a fairly simple database, from a Java application. We're trying to insert about 200k of text at a time, using the standard JDBC mysql adapter. We intermittently get a com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column error. The column type is longtext, and database co...
Same problem I had whit SQL reporting services. Try to check type of variables, I was sending difrent type of variable to SQL like sanding varchar in place where it shoud be integer, or samting like that. After I synchronize types of variables in Reporting Service and In stored procedure on SQL i avoid problem. ...
public, protected and then private and within each section alphabetically although I often list constructor first and deconstructor last. /Allan
I didn't use CodeSite probably because I'm completely happy with SmartInspect. Highly recommended.
I tend to group things thematically for lack of a better word. For example, if I had a public method that used two private methods in the course of doing its work then I would group all three together in the implementation file since odds are good that if you're going to be looking at one of them then you'll need to...
I would user something like CAS: [1]: http://www.ja-sig.org/products/cas/ CAS This is a solved problem and wouldn't recommend rolling your own.
I tend to group methods that relate to each other. Use of a good IDE removes much of this concern. Alphabetizing methods seems like a waste of effort to me.
What I do is wrap the smart order with a class that takes __FUNCTION__ and __LINE__ parameters. Increment a count for that function and line every time the constructor is called, and decrement the count every time the destructor is called. then, write a function that dumps the function/line/count information. That tell...
**What are the arguments for or against EJB3 vs Spring?** Spring is always innovating and recognizes real-world constraints. Spring offered simplicity and elegance for the Java 1.4 application servers and didn't require a version of the J2EE specification that no one had access to in 2004 - 2006. At this point it is ...
If time management is your problem. Get a timer and have someone buzz when you run out of time. Make sure tasks are broken down to an adequate level of granularity - any task should be anywhere between 4 hours to 2 days.. max 3 days. Anything above that break it down further before people signup to do it. I think th...
If time management is your problem. Get a timer and have someone buzz when you run out of time. Make sure tasks are broken down to an adequate level of granularity - any task should be anywhere between 4 hours to 2 days.. max 3 days. Anything above that break it down further before people signup to do it. I think th...
I think, gdbserver could help you.
Maybe you're using the parentNode or parentElement property? There are some issues with that in IE vs other browsers.
I had the same problem a couple of months ago. Now I must say that I am no typo3 developer, so I don't know if this is the right solution. But I used something like this: `$output .= $this->pi_RTEcssText( $contentFromDb );` in my extension and it works.
Time management tricks, tools & tips
|project-management|time-management|planning|
Working with software day-to-day usually means you have to juggle project work, meetings, calls and other interrupts. What single technique, trick, or tool do you find most useful in managing your time? How do you stay focused? What is your single biggest distraction from your work?
> ...snip... > these messages can become much more > difficult to interpret Yes, but the free community edition that comes with Visual Studio has a map functionality. With that you can back track the obfuscated method names to the original names.
In addition to NDepend, you can also try this addin for [Reflector][1] for showing assembly dependency graph. [1]: http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=Graph&referringTitle=Home
Using prototype and the $("thisid") syntax instead of document.getElementById("thisid") might do the trick for you. It worked for me.
Windows wallpaper: not just BMPs?
|vb6|registry|desktop-wallpaper|
I've read in a couple of places that the desktop wallpaper can be set to an HTML document. Has anyone had any success changing it programmatically? The following snippet of VB6 helps me set things up for BMPs but when I try to use it for HTML, I get a nice blue background and nothing else. Dim reg As New Std...
There is currently a lot of tools to generate JavaScript, like GWT. But giving you a good answer really depends on what is your originator language and what king of JavaScript functionnality you want to use.
1. I can't comment yet, but note that by default VS2008 automatically steps over properties, so the DebuggerStepThrough attribute is no longer needed in that case. 2. Also, I haven't noticed anyone showing how to declare a parameter-less lambda (usefull for implementing Action<>) <code>() => DoSomething(x);</code...
1. I can't comment yet, but note that by default VS2008 automatically steps over properties, so the DebuggerStepThrough attribute is no longer needed in that case. 2. Also, I haven't noticed anyone showing how to declare a parameter-less lambda (usefull for implementing Action<>) <code>() => DoSomething(x);</code...
Pure SQL (note: I would recommend using SQL features specific to your DBMS since it will be likely more efficient). This will get you the n+1th largest value (to get smallest, flip the <). If you have duplicates, make it COUNT( DISTINCT VALUE ).. select id from table order by id desc limit 4 ; +------+ ...
Not possible in flash - unless you want to drag to a target inside the same flash application. Could probably be done with a signed Java applet (but who wants to go down that road?)
I've had best and most consistent results across all browsers by setting Pragma: no-cache
Further information on creating ActiveX Controls using C# can be found below although these articles seem to use IE as a Hosting Container not Excel. http://www.ondotnet.com/pub/a/dotnet/2003/01/20/winformshosting.html http://www.codeproject.com/KB/miscctrl/exposingdotnetcontrols.aspx
The following perl regexp should pull do the trick. Does c# have perl regexps? <code>/\w+:\/\/[\w][\w\.\/]*/</code>
There's the Dictionary constructor that takes another Dictionary.
There's the Dictionary constructor that takes another Dictionary. You'll have to cast it IDictionary, but there is an Add() overload that takes KeyValuePair<TKey, TValue>. You're still using foreach, though.
I also don't like the idea of using tables to arrange items on a page. However this should not become a religion - tables are bad. I've encountered one example where I have a three column layout and needed the center column to grow with the content. In the end the solution that was the simplest and worked well on all n...
you can even use them for layouting, if your layout is somewhat tabular. I like the feature of tables and cells dynamically adjusting to whatever width the browser window is. Never use any fixed widths or height, that's just messing up things.
Have you considered just not using an artificial key for the `LeadSource` table? Then you get to use `LeadSource` as the FK in `SalesLead`, which simplifies your queries while retaining the benefits of using a canonical set of values (the rows in `LeadSource`).
If you are trying to extract truly maximum performance from these loops, than I would recommend writing the entire looping construct in assembler. You should be able to use inline assembly depending on the data structures involved in your loop. Even better if you can unroll any piece of your loop (like the parts invo...
I've not seen any studies, but a reasonable heuristic would be something like : ( Time since last application save when crash occurred + Time to restart application ) * Average hourly rate of application operator. The estimation gets more complex if the crashes have some impact on external customers such, or migh...
How can I replace newline characters using JSP and JSTL?
|string|jsp|jstl|replace|newline|
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.
Nathan, I wasn't insisting that you were incorrect; I was just saying that in my (limited) experience with Linux, the segment base is always zero. Maybe that's a good question for me to ask...
You can use the return code of the process for that. If your process returns a non-zero value from its Main method, you can then check whether or not the process exited by itself (the return value matches).
Using C++ classes in .so libraries
|c++|linux|class-library|
I'm trying to write a small class library for a C++ course. I was wondering if it was possible to define a set of classes in my shared object and then using them directly in my main program that demos the library. Are there any tricks involved? I remember reading this long ago (before I started really programming) t...
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, "; ")}
(With help from the answers, I got this to work like I wanted. I fixed the syntax in selected answer, in the below code) With the following select boxes <select id="states" size="2"></select> <select id="cities" size="3"></select> and data in this format (either in .js file or received as JSON) ...
Hibernate (JPA) how to do an eager query, loading all child objects
|java|hibernate|jpa|ejbql|
Relating to my [earlier question][1], I want to ensure all the child objects are loaded as I have a multiple threads that may need to access the data (and thus avoid lazy loading exceptions). I understand the way to do this is to use the "fetch" keyword in the query (EJB QL). Like this: select distinct o from ...
Relating to my [earlier question][1], I want to ensure all the child objects are loaded as I have a multiple threads that may need to access the data (and thus avoid lazy loading exceptions). I understand the way to do this is to use the "fetch" keyword in the query (EJB QL). Like this: select distinct o from ...
Relating to my [earlier question][1], I want to ensure all the child objects are loaded as I have a multiple threads that may need to access the data (and thus avoid lazy loading exceptions). I understand the way to do this is to use the "fetch" keyword in the query (EJB QL). Like this: select distinct o from ...
1.) Check [here][1]. Basically do this: Function FileExists(ByVal FileToTest As String) As Boolean If Dir(FileToTest) <> "" Then FileExists = True Else FileExists = False End If End Function I'll leave it to you to figure out the various error handling need...
|svn|debian|version-control|
(a little off topic - although SVN is a key programming tool....) **How do you install svn 1.5 on debian etch?** The svn 1.5 packages available for etch are 1.4 and I really need the cool new merge tracking feature in svn1.5 (according to CollabNet its as good as ClearCase...an interesting statement in oh so many ...
|svn|version-control|debian|
The 'nobody' user is still a user. I'm not sure what your reasoning is in having the program run as nobody, it's not going to be adding any additional security. You're more likely to open yourself to other problems. I'd follow squadette's recommendation of using a helper application.
You can use a regular expression with this pattern: "\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" That will tell you if it's an IP address.
You can use a regular expression with this pattern: "\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" That will tell you if it's an IPv4 address.
QT's Canvas an QPainter are very good for this job if you'd like to use C++. and it is cross platform. There is a python binding for QT but I've never used it. As for Java, using SWT, pixel level manipulation of a canvas is somewhat difficult and slow so I would not recommend it. On the other hand Swing's Canvas ...
You can do a "checkout" to the same directory where you currently work so that doesn't have to change. Basically your working directory doesn't need to change.
You should have a look at the `Send-PoshCode` function in the [PoshCode](http://PoshCode.org/) cmdlets script module ... it uses a POST, not a PUT, but the technique is practically identical. I don't have PUT server I can think of to test against, but basically, set your $url and your $data, and do something like: ...
|c++|generics|iteration|containers|
I am trying to find a generic way of accessing a set of containers. I have a standard vector and list in addition to another custom list. The custom list defines an iterator; class Iterator: public std::iterator<std::forward_iterator_tag, T> { // ... } Iterator begin() { return (...
Here's what I did (or am currently doing). First, use an out of the box solution to begin with. In my case, I used BlogEngine.NET, which was open source and easy to set up. This allows me to put content on my site as fast as possible. Now, I can continue to use BlogEngine.NET, and skin my site to give it more perso...
Another vote for Consolas. My favorite IDE font at the moment.
I don't think it matters if your site is blatantly using a framework or other "generic" solution. The real question is "is it done well, with taste?" If you are using an out of the box solution, you should take the time and pay attention to details when customizing it as if you were creating it from scratch. Alterna...
I don't think it matters if your site is blatantly using a framework or other "generic" solution. The real question is "is it done well, with taste?" If you are using an out of the box solution, you should take the time and pay attention to details when customizing it as if you were creating it from scratch. Alterna...
I can answer the latter half; if you have a reference to the application object in your code, you can simply call "Quit" on it: private Microsoft.Office.Interop.Excel.Application _excel; // ... do some stuff ... _excel.Quit(); For checking for a hung process, I'd guess you'd want to try to get some ...
**What are the arguments for or against EJB3 vs Spring?** Spring is always innovating and recognizes real-world constraints. Spring offered simplicity and elegance for the Java 1.4 application servers and didn't require a version of the J2EE specification that no one had access to in 2004 - 2006. At this point it is ...
**What are the arguments for or against EJB3 vs Spring?** Spring is always innovating and recognizes real-world constraints. Spring offered simplicity and elegance for the Java 1.4 application servers and didn't require a version of the J2EE specification that no one had access to in 2004 - 2006. At this point it is ...
If you can search for the word exactly, you can use a pair of keyboard shortcuts to do it quickly. Tools -> Options -> Enviroment -> Keyboard - Edit.GoToFindResults1NextLocation - EditorContextMenus.CodeWindow.Breakpoint.InsertBreakpoint Assign them to Control+Alt+F11 and F10 and you can go through all th...
I like to keep things simple, so I don't stuff a bunch of methods in a class. Within a class, I usually have the most commonly used (or modified-by-me ;-)) methods listed first. As far as specific code organization goes, each set of methods belongs to a class, so it organizes by itself. I make use of my editor's sea...
1.) Check [here][1]. Basically do this: Function FileExists(ByVal FileToTest As String) As Boolean FileExists = (Dir(FileToTest) <> "") End Function I'll leave it to you to figure out the various error handling needed. 2.) How To Delete a File. Look at [this.][2] Basically use the Kill com...
1.) Check [here][1]. Basically do this: Function FileExists(ByVal FileToTest As String) As Boolean FileExists = (Dir(FileToTest) <> "") End Function I'll leave it to you to figure out the various error handling needed but these are among the error handling things I'd be considering: * Check ...