instruction
stringlengths
0
30k
|html|browser|
It seems to be a common design pattern in .NET code. Here is a citation from [Framework design guidelines][1] > Consider providing method Close(), in addition to the Dispose(), if close is standard terminology in the area. When doing so, it is important that you make the Close implementation identical to Dispose ... Here is a [blog post][2] in which you can find workaround for this System.ServiceModel.ClientBase design problem [1]: http://www.amazon.com/Framework-Design-Guidelines-Conventions-Development/dp/0321246756 [2]: http://bloggingabout.net/blogs/erwyn/archive/2006/12/09/WCF-Service-Proxy-Helper.aspx
The Adobe example "works" in Firefox 3.0.1 in the sense that the background is transparent. However, in Firefox 3.0.1 and Safari 3.1.2 you must click the play button twice to see the animation.
Looks like you're right. Bummer. No MouseOver event. One of the fallbacks that always works with .NET, though, is P/Invoke. Someone already took the time to do this for the .NET CF TextBox. I found this on CodeProject: [http://www.codeproject.com/KB/cs/TextBox_subclassing.aspx][1] Hope this helps [1]: http://www.codeproject.com/KB/cs/TextBox_subclassing.aspx
You can do this in two lines in python with allSums = set(a+b for a in X for b in X) allSums = sorted(allSums) The cost of this is n^2 (maybe an extra log factor for the set?) for the iteration and s * log(s) for the sorting where s is the size of the set. The size of the set could be as big as n*(n-1)/2 for example if X = [1,2,4,...,2^n]. So if you want to generate this list it will take at least n^2/2 in the worst case since this is the size of the output. However if you want to select the first k elements of the result you can do this in O(kn) using a selection algorithm for sorted X+Y matrices by Frederickson and Johnson ([see here for gory details)][1]. Although this can probably be modified to generate them online by reusing computation and get an efficient generator for this set. @deuseldorf, Peter There is some confusion about (n!) I seriously doubt deuseldorf meant "n factorial" but simply "n, (very excited)!" [1]: http://arxiv.org/abs/0804.0936
Hmm there might be a substantial difference between WPF en Silverlight on this point.. I seem to have no trouble what so even compiling and running this sample in a WPF window: <code> <Slider Width="400" Height="20"> <Slider.Template> <ControlTemplate> <Border Name="TrackBackground" Margin="0" CornerRadius="2" Grid.Row="1" Grid.Column="1" Background="BlanchedAlmond" BorderThickness="1"> <Canvas x:Name="PART_Track" Background="DarkSalmon" Grid.Row="1" Grid.Column="1"> <Thumb Name="ThumbKnob" Height="{Binding ElementName=PART_Track, Path=Height, Mode=OneWay}" /> </Canvas> </Border> </ControlTemplate> </Slider.Template> </Slider> </code> Perhaps Silverlight has fewer properties in the Thumb class... http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.thumb.aspx
How can I split an XML document into thirds (or, even better, n pieces)?
|xml|
I would like to use a language that I am familiar with - Java, C#, Ruby, PHP, C/C++, although examples in any language or pseudocode are more than welcome. What is the best way of splitting a large XML document into smaller sections that are still valid XML? For my purposes, I need to split them into roughly thirds or fourths, but for the sake of providing examples, splitting them into n components would be good.
When I searched for TextMate alternative for Linux, I ended up using [Geany][1]. It's not as powerfull, but still nice to work with. Great replacement for Kate. [1]: http://geany.uvena.de/
Those are two of the things that are used by search engines. The exact weight of each changes frequently, they are generally regarded; however, as being fairly important. One thing to note, care should be taken when entering values. The more relevant the keywords and description are to the textual content of the site, the more weight may be given to them. Of course there are no guarantees as nobody outside of the search engine companies really **know** what algorithms are being used. [This post][1] talks a bit more about some aspects. [1]: http://stackoverflow.com/questions/5373/do-comment-permalinks-with-anchors-hurt-you-for-seo#5381
sp_depends is not reliable see: [Do you depend on sp_depends (no pun intended)][1] [1]: http://sqlblog.com/blogs/denis_gobo/archive/2008/05/06/6653.aspx
The brackets are required if you use keywords or special chars in the column names. You could name a column [First Name] (with a space)--but then you'd need to use brackets everywhere. The newer tools add them everywhere just in case or for consistency.
The brackets are required if you use keywords or special chars in the column names. You could name a column [First Name] (with a space)--but then you'd need to use brackets every time you referred to that column. The newer tools add them everywhere just in case or for consistency.
When I see Hungarian discussion, I'm glad to see people thinking hard about how to make their code clearer, and how to mistakes more visible. That's exactly what we should all be doing! But don't forget that you have some powerful tools at your disposal besides naming. **Extract Method** If your methods are getting so long that your variable declarations have scrolled off the top of the screen, consider making your methods smaller. (If you have too many methods, consider a new class.) **Strong typing** If you find that you are taking *zip code*s stored in an integer variable and assigning them to a *shoe size* integer variable, consider making a class for zip codes and a class for shoe size. Then your bug will be caught at compile time, instead of requiring careful inspection by a human. When I do this, I usually find a bunch of zip code- and shoe size-specific logic that I've peppered around my code, which I can then move in to my new classes. Suddenly all my code gets clearer, simpler, and protected from certain classes of bugs. Wow. To sum up: yes, think hard about how you use names in code to express your ideas clearly, but also look to the other powerful OO tools you can call on.
[This article](http://searchengineland.com/070905-194221.php) has some info on it. A quick summary is: Google and Microsoft: No Yahoo and Ask: Yes
All those of you that mentioned Alt Tab and Ctrl Tab missed out the shift versions too CTRL-SHIFT-TAB - move one tab back ALT-SHIFT-TAB - move one window back in task switcher
This is extremely messy to write from scratch. Have you considered a 3rd party tool like [Red-Gate SQL Dependency Tracker][1]? [1]: http://www.red-gate.com/products/SQL_Dependency_Tracker/index.htm "Red-Gate SQL Dependency Tracker"
The value of a will be equal to b, since the comma operator has a lower precedence the assignment operator.
If you don't know the length of the list, then you will have to traverse it complete to ensure random picks. The method I've used in this case is the one described by Tom Hawtin ([54070](http://stackoverflow.com/questions/54059/efficiently-selecting-a-set-of-random-elements-from-a-linked-list#54070)). While traversing the list you keep `k` elements that form your random selection to that point. (Initially you just add the first `k` elements you encounter.) Then, with probability `k/i`, you replace a random element from your selection with the `i`th element of the list (i.e. the element you are at, at that moment). It's easy to show that this gives a random selection. After seeing `m` elements (`m > k`), we have that each of the first `m` elements of the list are part of you random selection with a probability `k/m`. That this initially holds is trivial. Then for each element `m+1`, you put it in your selection (replacing a random element) with probability `k/(m+1)`. You now need to show that all other elements also have probability `k/(m+1)` of being selected. We have that the probability is `k/m * (k/(m+1)*(1-1/k) + (1-k/(m+1)))` (i.e. probability that element was in the list times the probability that it is still there). With calculus you can straightforwardly show that this is equal to `k/(m+1)`.
100% more. (so about 4 people)
Java doesn't need closures, an Object oriented language can do everything a closure does using intermediate objects to store state or do actions (in Java's case inner classes). But closures are desirable as a feature because they greatly simplify the code and increase readability and as a consequence the maintainability of the code. I'm no Java specialist but I'm using C# 3.5 and closures are one of my favorite features of the language, for example take the following statement as an example: // Example #1 with closures public IList<Customer> GetFilteredCustomerList(string filter) { //Here a closure is created around the filter parameter return Customers.Where( c => c.Name.Contains(filter)).ToList(); } now take an equivalent example that doesn't use closures //Example #2 without closures, using just basic OO techniques public IList<Customer> GetFilteredCustomerList(string filter) { return new Customers.Where( new CustomerNameFiltrator(filter)); } ... public class CustomerNameFiltrator : IFilter<Customer> { private string _filter; public CustomerNameFiltrator(string filter) { _filter = filter; } public bool Filter(Customer customer) { return customer.Name.Contains( _filter); } } I know this is C# and not Java but the idea is the same, closures are useful for conciseness, and make code shorter and more readable. Behind the scenes, the closures of C# 3.5 do something that's looks very similar to example #2 meaning the compiler creates a private class behind the scenes and passes the 'filter' parameter to it. Java doesn't need closures to work, as a developer you don't need them either, but, they are useful and provide benefits so that means that they are desirable in a language that is a production language and one of it's goals is productivity.
Besides the fact that cache locality matters (as On Freund said), one other things Microsoft does is to profile their application and find out which code paths are executed during the first few seconds of startup. After that they feed this data back to the compiler and ask it to put the parts which are executed during startup close together. This results in faster startup time. I do believe that this technique is available publicly in VS, but I'm not 100% sure.
What's the best way to get the fractional part of a float in PHP?
|php|
Simple one: How would you find the fractional part of a floating point number in PHP? For example, if I have the value 1.25, I want to return 0.25.
Many of the responses so far seem to boil down to two options: 1. user education, and 2. forcing adoption (lots of sites changing to openid from in-house auth.) Is that all we can do? What about distributed tools to make it easy for casual users to do openid delegation? (Say, something integrated with OS X / Windows / Ubuntu) Are there technological barriers that make this infeasible? If client-side (and vendor-issued) applications could let you manage your on-line security preference, then we'd possibly be able to combat *some* of the risks associated with giving random sites your passwords -- since the "login area" would be some local program sitting in your systray, or what not. Of course, the integration of web apps with the desktop (such as that provided by Chrome) may make such a distinction impossible in practice, so it may be a moot point. In any case, it seems like there should be something we could do *now* to make openid more palatable to the general public, and speed adoption in addition to making the system more user friendly.
Internet Explorer shows what they call a "friendly HTTP error message" when the response is 4xx or 5xx. This option can be turned off by the user in IE's Tools.Options.Advanced[Browsing] dialog. Sending a 200 for an error page is generally bad practice. One alternative would be to have a valid "Error" page that's _supposed_ to show error messages (so a 200 would be okay) and then use a 3xx redirect to that page.
You can quote the entire path as in windows or you can escape the spaces like in: /foo\ folder\ with\ space/foo.sh -help Both ways will work!
You can either quote it like Windows, or escape the slashes with backslashes: "/foo folder with space/foo" --help /foo\ folder\ with\ space/foo --help
$x = $x - floor($x)
My PHP skills are lacking but you could minus the result of a floor from the original number
The GET (and HEAD) method should never be used to do anything that has side-effects. A side-effect might be updating the state of a web application, or it might be charging your credit card. If an action has side-effects another method (POST) should be used instead. So, a user (or their browser) shouldn't be held accountable for something done by a GET. If some harmful or expensive side-effect occurred as the result of a GET, that would be the fault of the web application, not the user. According to the spec, a user agent **must not** automatically follow a redirect unless it is a response to a GET or HEAD request. Of course, a lot of GET requests do have some side-effects, even if it's just appending to a log file. The important thing is that the application, not the user, should be held responsible for those effects. The relevant sections of the HTTP spec are [9.1.1 and 9.1.2][1], and [10.3][2]. [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html [2]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3
Browser Sync accross many machines
|firefox|browsers|synchronization|
Everyone remembers google browser sync right? I thought it was great. Unfortunately Google decided not to upgrade the service to Firefox 3.0. Mozilla is developing a replacement for google browser sync which will be a part of the Weave project. I have tried using Weave and found it to be very very slow or totally inoperable. Granted they are in a early development phase right now so I can not really complain. This specific problem of browser sync got me to thinking though. What do all of you think of Mozilla or someone making a server/client package that we, the users, could run on your 'main' machine? Now you just have to know your own IP or have some way to announce it to your client browsers at work or wherever. There are several problems I can think of with this: non static IPs, Opening up ports on your local comp etc. It just seems that Mozilla does not want to handle this traffic created by many people syncing their browsers. There is not a way for them to monetize this traffic since all the data uploaded must be encrypted.
|firefox|browser|synchronization|
How to get PNG transparency working in browsers that don't natively support it?
|png|transparency|browsers|
Our (beloved) designer keeps creating PNG files with transparent backgrounds for use in our applications. I'd like to make sure that this feature of the PNG works in "older" browsers as well. What's the best solution?
|browsers|png|transparency|
Our (beloved) designer keeps creating PNG files with transparent backgrounds for use in our applications. I'd like to make sure that this feature of the PNG works in "older" browsers as well. What's the best solution? *edits below* @mabwi & @syd - Whether or not I agree about the use of a PNG is not the point. This is a problem that I need to solve! @Tim Sullivan - IE7.js looks pretty cool, but I don't think I want to introduce all of the other changes an application. I'd like a solution that fixes the PNG issue exclusively. Thanks for the link.
|browser|png|transparency|
GUI Automation testing - Window handle questions
|gui-automation|guid-testing|windowhandle|
Our company is currently writing a GUI automation testing tool for compact framework applications. We ahve initially searched many tools but none of them was right for us. By using the tool you can record test-cases and group them together to test-suites. For every test-suite there is generated an application, which launches the application-under-test and simulates user-input. In general the tool works fine, but as we are using **window- handles** for simulation user input, you can't do very many things. For example it is impossible for us to get the name of a control (we just get the caption). Another problem using window- handles is checking for a change. At the moment we simulate a click on a control and depending on the result we know if the application has gone to the next step. Is there any other (simpler) way for doing such things (for example the message queue or anything else)? Thanks for your help
Let's take this a bit at a time: > I want to create an allocator which > provides memory with the following > attributes: That's fair enough. > * cannot be paged to disk. That's going to be hard. As far as I am aware, you cannot disable Virtual Paging as it is handled by the OS. If there is a way, then you'll be seplunking in the bowels of the OS. > * is incredibly hard to access through an attached debugger You could run it through PGP and store it encrypted in memory and unencrypt it as needed. Massive performance hit. > The idea is that this will contain > sensitive information (like licence > information) which should be > inaccessible to the user. I have done > the usual research online and asked a > few other people about this, but I > cannot find a good place start on this > problem. Keep all sensitive information off the machine. Seriously. Don't store sensitive information in memory. Write a custom delete routine that will automatically remove all data from any allocations you perform. Never allow general access to a machine with sensitive material on it. If you perform db access, make sure all access is sanitized before firing. Only people with specific log-ins are allowed to access. No general group access. > On a side note, what other methods are > there of accessing the memory of a > process other than attaching a > debugger? Taking a dump of the memory.
You can also try using data validation if users commit data before you use it. Doing that I found was fairly simple and cleaner than fiddling about with keys. Otherwise, you could always disable Paste too!
> The advantage of this approach is that, for most people, **the CAPTCHA won't ever be visible!** I like this idea, is there not any way we can just hook into the rep system? I mean, anyone with say +100 rep is likely to be a human. So if they have rep, you need not even bother doing ANYTHING in terms of CAPTCHA. Then, if they are not, then send it, I'm sure it wont take that many posts to get to 100 and the community will instantly dive on anyone seem to be spamming with offensive tags, why not add a "report spam" link that downmods by 200? Get 3 of those, spambot achievement unlocked, bye bye ;) **EDIT**: I should also add, I like the math idea for the non-image CAPTCHA. Or perhaps a _simple_ riddle-type-thing. May make posting even more interesting ^_^
You can't really protect against memory access. You can probably prevent paging if you are running as an admin or as the system, but you cannot prevent the admin or system from reading your memory. Even if you could somehow completely block other processes from reading your memory (which you can't), another process could still actually inject a new thread into your process and read the memory that way. Even if you could somehow completely lock down your process and guarantee that the OS would *never* allow anyone else to access your process, you still don't have full protection. The entire OS could be running in a virtual machine, which could be paused and inspected at any time. You *cannot* protect memory contents from the owner of the system. Hollywood and the music industry have been aching for this for years. If it were possible, they'd already be doing it.
What about a [honeypot captcha][1]? [1]: http://haacked.com/archive/2007/09/11/honeypot-captcha.aspx
What do you think will be the level of usage of Silverlight 1 year from now?
|silverlight|
There is a lot of buzz about Microsoft Silverlight, especially after the Olympics. Also H264 will be supported in a future version. Where do you think Silverlight will be 1 year from now?
|silverlight|
Best tool to monitor network connection bandwidth
|windows|networking|
I'm looking for a very simple tool to monitor the bandwidth of all my applications. No need for extra features like traffic spying, I'm just interested by bandwidth. I already know Wireshark (which is great), but what I'm looking for is more something like TcpView (great tool from Sysinternals) with current bandwidth indication. PS: I'm interested by Windows tools only
Considering NBC has already dropped Silverlight and are using Flash again for NFL telecasts, I don't see a healthy future for Microsoft's platform. Do they even have any other partners using it? I know WWE was one of their partners but they barely use it on their own website. EDIT - not sure if it's true or not but [this guy][1] says that the decision to go with Flash was the NFL's and not NBC's. Either way still doesn't look good for the MS platform. [1]: http://seekingalpha.com/article/94513-nbc-did-not-drop-dump-or-ditch-silverlight-in-favor-of-flash
I think that as long as the [Moonlight][1] project is successful that we'll see Silverlight become significant competition for Flash. Silverlight is still in its infancy - 1.0 had next to nothing in it. Version 2 is in beta now, and that adds lots of common user controls that developers need to write applications. [1]: http://www.mono-project.com/Moonlight
Are C++ Reads and Writes of an int atomic
|c++|multithreading|synchronization|
I have two threads, one updating an int and one reading it. This value is a statistic where the order of the read and write is irrelevant. My question is, do I need to synchronize access to this multi-byte value anyway? Or, put another way, can part of the write be complete and get interrupted, and then the read happen. For example, think of value = ox0000FFFF increment value to 0x00010000 Is there a time where the value looks like 0x0001FFFF that I should be worried about? Certainly the larger the type, the more possible something like this is I've always synchronized these types of accesses, but was curious what the community thought.
A year from now, the number of people with the runtime installed will still be a fairly small minority. I suspect that choosing Silverlight will still be a barrier to people using your stuff for a long while to come.
This certainly sounds possible. With a combination of jQuery.append and jQuery.fadeIn and fadeOut you should be able to create a nice little tabbed control. See the JQuery UI/Tabs for a simple way to create a set of tabs based on a `<ul>` element and a set of `<div>'s`: <http://docs.jquery.com/UI/Tabs>
Not knowing the actual details, my guess is that it makes an attempt to join like you might join relative URIs. For example: join('/some/abs/path', '../other') = '/some/abs/other' This means that when you join a path with a preceding slash, you are actually joining one base to another, in which case the second gets precedence.
you could always search through the syscomments table....that might take a while though...
Good Ways to Use Source Control and an IDE for Plugin Code?
|ide|plugin-development|
What are good ways of dealing with the issues surrounding plugin code that interacts with outside system? To give a concrete and representative example, suppose I would like to use Subversion and Eclipse to develop plugins for WordPress. The main code body of WordPress is installed on the webserver, and the plugin code needs to be available in a subdirectory of that server. I could see how you could simply checkout a copy of your code directly under the web directory on a development machine, but how would you also then integrate this with the IDE? I am making the assumption here that all the code for the plugin is located under a single directory. Do most people just add the plugin as a project in an IDE and then place the working folder for the project wherever the 'main' software system wants it to be? Or do people use some kind of symlinks to their home directory?
Yes, take a look at the "6.4 Packages" section in <http://docs.python.org/tut/node8.html>: Basically, you can place a bunch of files into a directory and add an "__init__.py" file to the directory. If the directory is in your PYTHONPATH or sys.path, you can do "import directoryname" to import everything in the directory or "import directoryname.some_file_in_directory" to import a specific file that is in the directory. >The __init__.py files are required to make Python treat the directories as containing packages; this is done to prevent directories with a common name, such as "string", from unintentionally hiding valid modules that occur later on the module search path. In the simplest case, __init__.py can just be an empty file, but it can also execute initialization code for the package or set the __all__ variable, described later.
Yes, take a look at the "6.4 Packages" section in <http://docs.python.org/tut/node8.html>: Basically, you can place a bunch of files into a directory and add an __init_\_.py file to the directory. If the directory is in your PYTHONPATH or sys.path, you can do "import directoryname" to import everything in the directory or "import directoryname.some_file_in_directory" to import a specific file that is in the directory. >The __init_\_.py files are required to make Python treat the directories as containing packages; this is done to prevent directories with a common name, such as "string", from unintentionally hiding valid modules that occur later on the module search path. In the simplest case, __init_\_.py can just be an empty file, but it can also execute initialization code for the package or set the __all_\_ variable, described later.
Handle signals in the Java Virtual Machine
The easiest method is to create a "tags" table. Target_Type -- in case you are tagging multiple tables Target -- The key to the record being tagged Tag -- The text of a tag Querying the data would be something like Select distinct target from tags where tag in ([your list of tags to search for here]) and target_type = [the table you're searching]
The easiest method is to create a "tags" table. Target_Type -- in case you are tagging multiple tables Target -- The key to the record being tagged Tag -- The text of a tag Querying the data would be something like Select distinct target from tags where tag in ([your list of tags to search for here]) and target_type = [the table you're searching] -- Edit -- Based on your requirement to AND the conditions, the query above would turn into something like this Select target from (select target, count(*) cnt from tags where tag in ([your list of tags to search for here]) and target_type = [the table you're searching]) where cnt = [number of tags being searched]
Shell scripting input redirection oddities
|shell|bash|dash-shell|
Can anyone explain this behavior? Running: #!/bin/sh echo "hello world" | read var1 var2 echo $var1 echo $var2 results in nothing being ouput, while: #!/bin/sh echo "hello world" > test.file read var1 var2 < test.file echo $var1 echo $var2 produces the expected output: hello world Shouldn't the pipe do in one step what the redirection to test.file did in the second example? I tried the same code with both the dash and bash shells and got the same behavior from both of them.
|linux|bash|shell|dash-shell|
|linux|bash|shell|ksh|dash-shell|
What is the point of the finally block?
|finally|
Syntax aside, what is the difference between try { } catch() { } finally { x = 3; } and try { } catch() { } x = 3;
|exception|
|exception|design-patterns|
Syntax aside, what is the difference between try { } catch() { } finally { x = 3; } and try { } catch() { } x = 3; edit: in .NET 2.0?
|.net|exception|design-patterns|
Since spaces are used to separate command line arguments, they have to be escaped from the shell. This can be done with either a backslash (\) or quotes: "/path/with/spaces in it/to/a/file" somecommand -spaced\ option somecommand "-spaced option" somecommand '-spaced option' This is assuming you're running from a shell. If you're writing code, you can usually pass the arguments directly, avoiding the problem: Example in perl. Instead of doing: `print("code sample");`system("somecommand -spaced option"); you can do `print("code sample");`system("somecommand", "-spaced option"); Since when you pass the system() call a list, it doesn't break arguments on spaces like it does with a single argument call.
Well of course you can always extract the top-level elements (whether this is the granularity you want is up to you). In C#, you'd use the XmlDocument class. For example, if your XML file looked something like this: <Document> <Piece> Some text </Piece> <Piece> Some other text </Piece> </Document> then you'd use code like this to extract all of the Pieces: XmlDocument doc = new XmlDocument(); doc.Load("<path to xml file>"); XmlNodeList nl = doc.GetElementsByTagName("Piece"); foreach (XmlNode n in nl) { // Do something with each Piece node } Once you've got the nodes, you can do something with them in your code, or you can transfer the entire text of the node to its own XML document and act on that as if it were an independent piece of XML (including saving it back to disk, etc).
I work in a database support team with three DBA's and our considered options are: 1. Any naming standard is better than no standard. 2. There is no "one true" standard, we all have our preferences 3. If there is standard already in place, use it. Don't create another standard or muddy the existing standards. We use singular names for tables. Tables tend to be prefixed with the name of the system (or it's acronym). This is useful if the system complex as you can change the prefix to group the tables together logically (ie. reg_customer, reg_booing and regadmin_limits). For fields we'd expect field names to be include the prefix/acryonm of the table (i.e. cust_address1) and we also prefer the use of a standard set of suffixes ( _id for the PK, _cd for "code", _nm for "name", _nb for "number", _dt for "Date"). The name of the Foriegn key field should be the same as the Primary key field. i.e. SELECT cust_nm, cust_add1, booking_dt FROM reg_customer INNER JOIN reg_booking ON reg_customer.cust_id = reb_booking.cust_id When developing a new project, i'd recommend you write out all the preferred entity names, prefixes and acronyms and give this document to your developers. Then, when they decide to create a new table, they can refer to the document rather than "guess" what the table and fields should be called.
I work in a database support team with three DBA's and our considered options are: 1. Any naming standard is better than no standard. 2. There is no "one true" standard, we all have our preferences 3. If there is standard already in place, use it. Don't create another standard or muddy the existing standards. We use singular names for tables. Tables tend to be prefixed with the name of the system (or it's acronym). This is useful if the system complex as you can change the prefix to group the tables together logically (ie. reg_customer, reg_booing and regadmin_limits). For fields we'd expect field names to be include the prefix/acryonm of the table (i.e. cust_address1) and we also prefer the use of a standard set of suffixes ( _id for the PK, _cd for "code", _nm for "name", _nb for "number", _dt for "Date"). The name of the Foriegn key field should be the same as the Primary key field. i.e. SELECT cust_nm, cust_add1, booking_dt FROM reg_customer INNER JOIN reg_booking ON reg_customer.cust_id = reg_booking.cust_id When developing a new project, i'd recommend you write out all the preferred entity names, prefixes and acronyms and give this document to your developers. Then, when they decide to create a new table, they can refer to the document rather than "guess" what the table and fields should be called.
|java|process|jvm|posix|signals|
Is it possible to handle POSIX signals within the Java Virtual Machine? At least [SIGINT][1] and [SIGKILL][2] should be quite platform independent. [1]: http://en.wikipedia.org/wiki/SIGINT_(POSIX) [2]: http://en.wikipedia.org/wiki/SIGKILL
|java|process|jvm|posix|signals|
XPATHS and Default Namespaces
|c#|xml|namespace|xpath|
What is the story behind XPATH and support for namespaces? Did XPATH as a specification precede namespaces? If I have a document where elements have been given a default namespace: >> &lt;foo xmlns="uri" /> It appears as though some of the XPATH processor libraries won't recognize //foo because of the namespace whereas others will. The option my team has thought about is to add a namespace prefix using regular expressions to the XPATH (you can add a namespace prefix via XmlNameTable) but this seems brittle since XPATH is such a flexible language when it comes to node tests. Is there a standard that applies to this? My approach is a bit hackish but it seems to work fine; I remove the xmlns declaration with a search/replace and then apply xpaths. >string readyForXpath = Regex.Replace( xmldocument, "xmlns=\".+\"", String.Empty ); Is that a fair approach or has anyone solved this differently?
|c#|xml|namespaces|xpath|
How to resolve symlinks in a shell script
|shell|script|symlink|