instruction stringlengths 0 30k ⌀ |
|---|
|python|coding-style| |
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to use one over the other? |
It's difficult to follow exactly what you're after. Your question seems to imply that these public methods don't require arguments, or that if they did they would be the same arguments.
You could probably get quite far using the inbuilt reflection classes.
Pasted below is a quick test I knocked up to compare th... |
Excessive inlining of functions can increase size of compiled executable which can have negative impact on cache performance, but nowadays compiler decide about function inlining on their own (depending on many criterias) and ignore inline keyword. |
The [CLR Profiler](http://www.microsoft.com/downloads/details.aspx?familyid=a362781c-3870-43be-8926-862b40aa0cd0&displaylang=en), which is provide free by Microsoft does a very good job at this type of thing.
An introduction to the whole profiler can be downloaded [here](http://www.microsoft.com/downloads/details.a... |
Here are two:
[Tera Term](http://hp.vector.co.jp/authors/VA002416/teraterm.html)
>Tera Term (Pro) is a free software terminal emulator (communication program) for MS-Windows. It supports VT100 emulation, telnet connection, serial port connection, and so on.
[Kermit 95](http://www.columbia.edu/kermit/k95.html)
>... |
[PuTTY][1] can do serial communication nowdays.
[1]: http://www.chiark.greenend.org.uk/~sgtatham/putty/ |
I had the same problem trying to connect to an RFID device over RS323/serial and found SerialMonitor.
There are two links to that application. A free version that I found here (and that's the one I used and it works with Vista):
<http://www.softhypermarket.com/Free-Serial-Port-Monitor-download_29681.html>
But if... |
This works as expected for me:
alert("æøå");
... creates an alert containing the string "æøå" whereas
alert("æøå");
... creates an alert with the non-ascii characters.
Javascript is pretty utf-8 clean and doesn't tend to put obstacles in your way.
Maybe yo... |
This works as expected for me:
alert("æøå");
... creates an alert containing the string "&aelig;&oslash;&aring;" whereas
alert("æøå");
... creates an alert with the non-ascii characters.
Javascript is pretty utf-8 clean and doesn't tend to put obstacles in your way.... |
Thanks Espo.
I've had a look at the relevant perldocs but there's no real convention regarding the setup and teardown aspects.
Not like XUnit series of tests.
cheers,
Rob |
Thanks Espo.
I've had a look at the relevant perldocs but there's no real convention regarding the setup and teardown aspects.
Not like XUnit series of tests.
Thanks for the answer Jagmal but I'm not sure about using the BEGIN and END blocks for the setup and teardown as you are not making clear what you are d... |
Each language has a specific style. At least one.
Each project adopts a specific style. At least, they should. This can sometimes be a different style to the canonical style your language uses - probably based on the dev leaders preferences.
Which style to use?
If your language ships with a good standard librar... |
I recommend the following layout, for two reasons:
- all stuff related to a given project is within the same part of the tree; makes
it easier for people to grasp
- permissions handling may be easier this way
And by the way: It's a good idea with few repositories, instead of many, because change history norm... |
See http://www.w3.org/TR/CSS21/selector.html#attribute-selectors
Executive summary:
<pre>
Attribute selectors may match in four ways:
[att]
Match when the element sets the "att" attribute, whatever the value of the attribute.
[att=val]
Match when the element's "att" attribute value ... |
Should I use multiple assemblies for an isolated ASP.NET web application? |
|.net|asp.net|web-applications|coding-style| |
Coming from a corporate IT environment, the standard was always creating a class library project for each layer, Business Logic, Data Access, and sometimes greater isolation of specific types.
Now that I am working on my own web application project, I don't see a real need to isolate my code in this fashion.
I ... |
Main Menu > Tools > Options
Text Editor (Tree) > C# > Display group (Line numbers checkbox)
that was easy :) |
Go to Tools - Options - Text Editor - All Languages - General, and check Line numbers to show line numbers for all files.
If you just want to see (or not see) the line numbers of a specific file, you can override this global setting by going to the Text Editor - <specific language> - General page.
[Did you kn... |
Drilling down in VisualVM |
|java|visualvm| |
I just installed Java 1.6_07 so I could try profiling with VisualVM. It tells me that my app is spending 60% of its time in `sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run`
How do I find out what it was doing during that time? How much of the time was it waiting for something to call it, or doing someth... |
I just tried the following:
$ cat gdbtest.c
int abc = 43;
int main()
{
abc = 10;
}
$ gcc -g -o gdbtest gdbtest.c
$ gdb gdbtest
...
(gdb) watch abc
Hardware watchpoint 1: abc
(gdb) r
Starting program: /home/mweerden/gdbtest
.... |
Start with the simplest thing possible and add complexity if and when required. Sounds as though a single assembly would work just fine for your case. However, do take care not to violate the layers by having layer A access an internal member of layer B. That would make it harder to pull the layers into separate assemb... |
It is generally advised to be specific and fully qualify all column names anyway, as it saves the optimizer a little work. Certainly in SQL Server.
From what I can gleen from the [Oracle docs][1], it seems it will only throw if you select the column name twice in the select list, or once in the select list and then ... |
Take a look at (my question): [How do you make wrong code look wrong? What patterns do you use to avoid semantic errors?][1]
[1]: http://stackoverflow.com/questions/26086/how-do-you-make-wrong-code-look-wrong-what-patterns-do-you-use-to-avoid-semanti |
Take a look at: [How do you make wrong code look wrong? What patterns do you use to avoid semantic errors?][1]
[1]: http://stackoverflow.com/questions/26086/how-do-you-make-wrong-code-look-wrong-what-patterns-do-you-use-to-avoid-semanti |
In a similar vein you might find some useful suggestions here: [How do you make wrong code look wrong? What patterns do you use to avoid semantic errors?][1]
[1]: http://stackoverflow.com/questions/26086/how-do-you-make-wrong-code-look-wrong-what-patterns-do-you-use-to-avoid-semanti |
I get "&aelig;&oslash;&aring;" for the first one and some junk characters for the next. Could it be that the javascript is not mangling (or [mojibake][1]) your letters but the alert dialog uses the system default font, and the font is incapable of displaying the letters?
[1]: http://en.wikipedia.org/... |
You really do want to be able to take a clean machine, get the latest version from source control, build in one step, and run all tests in one step. Making this fast makes you produce good software faster.
Just like [external libraries][1], database configuration must also be in source control.
Note that I'm not... |
It worth pointing out that the inline keyword is actually just a hint to the compiler. The compiler may ignore the inline and simply generate code for the function someplace.
The main drawback to inline functions is that it can **increase the size of your executable** (depending on the number of instantiations). Th... |
It could increase the size of the executable, and I don't think compilers will always actually make them inline even though you used the inline keyword. (Or is it the other way around, like what [Vaibhav][1] said?...)
I think it's usually OK if the function has only 1 or 2 statements.
[1]: http://stackoverflo... |
It could increase the size of the
executable, and I don't think
compilers will always actually make
them inline even though you used the
inline keyword. (Or is it the other
way around, like what [Vaibhav][1]
said?...)
I think it's usually OK if the
function has only 1 or 2 statements.
**Edit:**... |
As for CSS 2.1, see http://www.w3.org/TR/CSS21/selector.html#attribute-selectors
Executive summary:
<pre>
Attribute selectors may match in four ways:
[att]
Match when the element sets the "att" attribute, whatever the value of the attribute.
[att=val]
Match when the element's "att" ... |
As for CSS 2.1, see http://www.w3.org/TR/CSS21/selector.html#attribute-selectors
Executive summary:
<pre>
Attribute selectors may match in four ways:
[att]
Match when the element sets the "att" attribute, whatever the value of the attribute.
[att=val]
Match when the element's "att" ... |
Practical solution to center vertically and horizontally in HTML that works in FF, IE6 and IE7 |
|html|css| |
What can be a practical solution to center vertically and horizontally content in HTML that works in Firefox, IE6 and IE7?
Some details:
- I am looking for solution for the entire page.
- When minimizing window, scrolling should appear only when all white space is gone.
In other words, width of screen should ... |
I've had to do this before. The only real way to do it is to manually match up the various locations. Use your database's console interface and grouping select statements. First, add your "Company Name" field. Then:
SELECT count(*) AS repcount, "Location Name" FROM mytable
WHERE "Company Name" IS NULL
... |
As others have mentioned, I would analyze your conditionals to see if there's a way you can outsource it to other methods to increase readability. |
Normalizing a Table with Low Integrity |
|database| |
I've been handed a table with about 18000 rows. Each record describes one customer location. The issue is, that when the person created the table, they did not add a field for "Company Name", only "Location Name," and one company can have many locations.
For example, here are some records that describe the same cust... |
I've been handed a table with about 18000 rows. Each record describes one customer location. The issue is, that when the person created the table, they did not add a field for "Company Name", only "Location Name," and one company can have many locations.
For example, here are some records that describe the same cust... |
What can be a practical solution to center vertically and horizontally content in HTML that works in Firefox, IE6 and IE7?
Some details:
- I am looking for solution for the entire page.
- You need to specify only width of the element to be centered. Height of the element is not known in design time.
- When ... |
It's not incorrect to link to an older library in the way you describe, but it doesn't surprise me you're seeing some odd behavior. Couple sanity checks:
- Are both files using the **same versions** of the **same run-time libraries**?
- Is your .EXE application "seeing" the same header files that the .LIB was b... |
G'day,
One of the best recommendations I can make is to read the relevant section(s) of Steve McConnell's Code Complete ([Amazon Link][1]). He has an excellent discussion on naming techniques.
HTH
cheers,
Rob
[1]: http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/ref=p... |
@jatanp, disclaimer: I am not a security expert.
This sounds like a bad Idea: You are letting someone encrypt stuff with a 'hidden' key that you give him. I don't think this can be made secure.
Maybe asymmetrical keys could work:
- deploy encrypted license with public key to decrypt
- let customer create ... |
If you are using CruiseControl 1.3 or later you can use an [Integration Queue][1]
These allow you to control which projects can be built concurrently and which must be serialized.
[1]: http://confluence.public.thoughtworks.org/display/CCNET/Integration+Queues |
Of course there are some common guidelines but there are also differences due to difference in language syntax. |
|audio|free| |
Javascript Animation with Safari |
|javascript|animation|safari|webapplication| |
I'm trying to create web applications that use Javascript. I'd like to be able to use animation in these applications. I've tried to use basic Javascript, but I've decided that the best thing to do is to use a library (such as YUI or JQuery).
I'm running into a problem. On Safari, when I run animation scripts, th... |
|javascript|safari|animation|webapplication| |
|javascript|web-application|safari|animation| |
|javascript|web-applications|safari|animation| |
|javascript|web-applications|safari|animation| |
.NET path manipulation library |
|.net|path| |
Does anyone know of any good library that abstracts the problem of path manipulation in a nice way? I'd like to be able to combine and parse paths with arbitrary separators ('/' or ':' for example) without reinventing the wheel.
It's a shame that `System.IO.Path` isn't more reusable.
Thanks |
|.net|path| |
Good Java graph algorithm library? |
|java|algorithm|graphing| |
Has anyone had good experiences with any Java libraries for Graph algorithms. I've tried [JGraph][1] and found it ok, and there are a lot of different ones in google. Are there any that people are actually using successfully in production code or would recommend?
[1]: http://www.jgraph.com |
Has anyone had good experiences with any Java libraries for Graph algorithms. I've tried [JGraph][1] and found it ok, and there are a lot of different ones in google. Are there any that people are actually using successfully in production code or would recommend?
To clarify, I'm not looking for a library that produc... |
|java|algorithm|graphing| |
Path Display in Label |
|c#|winforms|path| |
Are there any automatic methods for trimming a path string in .NET?
For example:
C:\Documents and Settings\nick\My Documents\EMG Tests\demo data\demo data.emt
becomes
C:\Documents...\demo data.emt
It would be particularly cool if this were built into the Label class, and I seem to recall it is--c... |
Try setInterval or setTimeout |
Try setInterval or setTimeout
EDIT: Like in this simple example: http://n0p.com/so/63011.php |
Non-x86 Microsoft compilers do not support in-line assembly. You have to define the whole function in a separate assembly source file and pass it to an assembler.
You're highly unlikely to be able to call into the BIOS under a protected-mode operating system and should use whatever facilities are available on that s... |
> To build a dictionary from an arbitrary object, it's sufficient to use __dict__.
This misses attributes that the object inherits from its class. For example,
class c(object):
x = 3
a = c()
hasattr(a, 'x') is true, but 'x' does not appear in a.\_\_dict__
|
I really enjoy what I did with my custom hook. I have it post a message to my campfire account (campfire is a group based app). It worked out really well. Because I had my clients in there and it could show him my progress. |
We looked at TFS, but ended up going with Subversion + Trac + VisualSVN. We don't do CI right now but Cruisecontrol would be what we'd use, I think.
I started using Trac with numerous open-source projects, and it's a great. It's really only a portion of what TFS does, so you'll have to make a decision there -- if y... |
You could give all your fallback anchor tags a particular classname, like "simple"
Using [prototype][1], you can get an array of all tags using that class using a CSS selector, e.g.
var anchors=$$('a.simple')
Now you can iterate over that array and clear the href attributes, or install an onclick handler t... |
Interesting in SQL server that throws an error (as it should)
select id
from sysobjects s
left join syscolumns c on s.id = c.id
Server: Msg 209, Level 16, State 1, Line 1
Ambiguous column name 'id'.
select id
from sysobjects
left join syscolumns on sysobjects.id = syscolumns.id... |
I'd say it depends on how serious you are about testing and unit-testing.
If you plan to only do user/manual tests, or use basically, only test from the UI downward, then it doesn't really make a difference.
On the other hand, if you plan on doing sort of unit-testing, or business rules validation, it definitely ... |
Can I set a breakpoint on 'memory access' in GDB? |
|gdb| |
I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in other ways to monitor a variable in C/C++ to see if/when it changes. |
|debugging|gdb| |
You could use find and wc from this relatively small package, http://unxutils.sourceforge.net/
Like
find . -name *.cs | wc -l
Or, if you have a linux machine handy you can mount the drive and do it like that, and it'll give you a ballpark figure. You can complexify to remove comments, etc. But given that ... |
You could use find and wc from this relatively small package, http://unxutils.sourceforge.net/
Like
find . -name *.cs -exec wc -l {} \;
Or, if you have a linux machine handy you can mount the drive and do it like that, and it'll give you a ballpark figure. You can complexify to remove comments, etc. But g... |
You can call the command-line version of incscape to do this:
<http://harriyott.com/2008/05/converting-svg-images-to-png-in-c.aspx>
Also there is a C# SVG rendering engine, primarily designed to allow SVG files to be used on the web on codeplex that might suit your needs if that is your problem:
<http://www.co... |
You should still separate logically layers into there proper projects.
That is a good engineering practice, whether you are just 1 developer or 100. The negative about the code all in one place is that it is going to make you refactor or duplicate code for expansion.
|
You could actually pull this off, but it would require using metaclasses, which are *deep* magic (there be dragons). If you want an intro to metaclasses, there's a series of [articles from IBM][1] which manage to introduce the ideas without melting your brain.
The source code from an ORM like SQLObject might help, t... |
Of course there are some common guidelines but there are also differences due to difference in language syntax\design.
For .NET (C#, VB, etc) I would recommend following resource:
- [Framework Design Guidelines][1] -
definitive book on .NET coding
guidelines including naming
conventions
- [Nam... |
This sounds like a job for JQuery. Just give a specific class name to all of the anchor tags that you want the URLs removed and then apply the following JQuery snippet to the bottom of your page:
$(document).ready(function() {
$('a.NoLink').removeAttr('href')
});
All of the anchor tags with the cl... |
This sounds like a job for JQuery. Just give a specific class name to all of the HyperLink controls that you want the URLs removed and then apply the following JQuery snippet to the bottom of your page:
$(document).ready(function() {
$('a.NoLink').removeAttr('href')
});
All of the HyperLink contro... |
I'm happy with using the web interface. I've used [Fluid][1] to create a custom browser for it, and even gotten some help making [a pretty icon][2].
[1]: http://fluidapp.com/ "Fluid"
[2]: http://www.flickr.com/groups/fluid_icons/discuss/72157605174142635/ |
@jatanp: or better yet, they can decompile, remove the licensing code, and recompile. With Java, I don't really thing there is a proper, hack-proof solution to this problem. Not even an evil little dongle could prevent this with Java.
My own biz managers worry about this, and I think too much. But then again, we ... |
As long as they have access to both the encrypted data and the software that decrypts it, there is basically no way you can make this completely secure. Ways this has been solved before is to use some form of external black box to handle encryption/decryption, like dongles, remote authentication servers, etc. But even ... |
I've been handed a table with about 18000 rows. Each record describes one customer location. The issue is, that when the person created the table, they did not add a field for "Company Name", only "Location Name," and one company can have many locations.
For example, here are some records that describe the same cust... |
I've been handed a table with about 18000 rows. Each record describes one customer location. The issue is, that when the person created the table, they did not add a field for "Company Name", only "Location Name," and one company can have many locations.
For example, here are some records that describe the same cust... |
So I'm working on some legacy code that's heavy on the manual database operations. I'm trying to maintain some semblance of quality here, so I'm going TDD as much as possible.
The code I'm working on needs to populate, let's say a `List<Foo>` from a DataReader that returns all the fields required for a functioning F... |
So I'm working on some legacy code that's heavy on the manual database operations. I'm trying to maintain some semblance of quality here, so I'm going TDD as much as possible.
The code I'm working on needs to populate, let's say a `List<Foo>` from a DataReader that returns all the fields required for a functioning F... |
|unit-testing|tdd|mocking|csharp| |