instruction
stringlengths
0
30k
I am a consultant and tend to work in a variety of environments. I carry a Thinkpad running VMWare Server over Ubuntu64 with 4GB of RAM. I've got a 320GB secondary hard drive that I use just for VM's and have 25 or so different virtual machines that I boot up as the circumstances demand. They're a mix of Linux serve...
Run sqlservr.exe in debug mode with the /c switch and see what happens starting up. Any locking or permissions issue can be put to bed by making a copy of the file and transfering the copy to the origional. Also check the associated log file (.ldf) .. If that file is missing or unavaliable you will not be able to ...
As long as the calculations you need to perform can be adequately AND readably captured in PL/SQL, then using only PL/SQL would make the most sense. The real catch is maintainability -- it's very easy to write unmaintainable SQL, if only because every RDBMS has a different syntax and different function set once you ...
I think you might be mixing free-market providers with governments. Latter abuse their power because you got nobody else to go to (try to get an "alternative" passport). Since the OpenID prividers have competition, you can always leave one provider and go to another.
Maximum directory size is filesystem-dependent, and thus the exact limit varies. However, having very large directories is a bad practice. You should consider making your directories smaller by sorting files into subdirectories. One common scheme is to use the first two characters for a first-level subdirectory, as ...
When developing WPF UserControls, what is the best way to expose a DependencyProperty of a child control as a DependencyProperty of the UserControl? The following example shows how I would currently expose the Text property of a TextBox inside a UserControl. Surely there is a better / simpler way to accomplish this? ...
Adding item to the Desktop context menu in Windows
|windows|user-interface|desktop|
I want to add an item into the Desktop context menu (the menu you see when you right-click on an empty space on the Windows Desktop). Something like Catalyst Control Center in this screenshot: ![Embedded Example](http://i361.photobucket.com/albums/oo51/Stark3000/ContextMenuExample.png) I know how to add it...
For any file, you'd need to discover what format the file is in, and then open the file and read the necessary bytes to find out what version the file is. There is no API or common method to determine a file version in Ruby. Note that it would be easier if the file version were in the file name.
Here's a more recent speed test than the one provided above. Last time I ran it dojo was the fastest followed by jQuery, Mootools, Prototype, and finally YUI. Note I ran it in Firefox 3 and the speeds vary between browsers so test it out yourself. [Slick Speed Test][1] [1]: http://mootools.net/slickspeed/
[Spell Checker][1] for comments is a godsend. [GhostDoc][2] is great for making well documented APIs. [1]: http://blogs.msdn.com/mikhailarkhipov/archive/2007/12/31/spell-checker-update-2-1-a-few-bug-fixes-and-couple-of-new-features.aspx [2]: http://www.roland-weigelt.de/ghostdoc/
If you are looking to do file transfers, XMLRPC is likely a bad choice. It will require that you encode all of your data as XML (and load it into memory). "Data requests" and "file transfers" sounds a lot like plain old HTTP to me, but your statement of the problem doesn't make your requirements clear. What kind o...
If the amount of data is small, or installed on many client machines, you might not want the overhead of a database. Is it intended to be installed on many users machines? Adding the overhead of ensuring you can run whatever database engine you choose on a client installed app is not optimal. Since the amount of d...
Look at the "NumericUpDown" control. It has range validation, the input will always be numeric, and it has those nifty increment/decrement buttons.
You can use a regular textbox and a Validator control to control input.
.htaccess: RewriteEngine on RewriteCond %{HTTP_REFERER} slashdot\.org [NC] RewriteRule .* - [F]
Even in object oriented programming it might be useful to use a function call instead of a method (or for that matter calling a method of an object other than the one we call it on). Imagine a simple database persistence framework where you'd like to just call save() on an object. Instead of including an SQL statement ...
A database is meant to manage large volumes of data, and are supposed to give you fast access to read and write that data in spite of the size. Put simply, they manage scale for data - scale that you don't want to deal with. If you have only a few users (hundreds?), you could just as easily manage the data on disk (s...
You're probably going to want to create replacement tables in place. The script sort of depends on the scripting language you have available to you, but you should be able to create the country ID table simply by listing the columns of the table you have now. Once you've done that, you can do some string substitutions ...
I built one of the first SOAP servers, including code generation and WSDL generation, from the original spec as it was being developed, when I was working at Hewlett-Packard. I do NOT recommend using SOAP for anything. The acronym "SOAP" is a lie. It is not Simple, it is not Object-oriented, it defines no Access rul...
Whilst the standard practice is to inherit from ICloneable (described above, so I wont regurgitate), here's a nice Deep Clone Object copier I found on codeproject a while ago and incorporated it in out stuff. As mentioned above, it does require your objects to be Serializable /// <summary> /// Refe...
Whilst the standard practice is to inherit from ICloneable (described above, so I wont regurgitate), here's a nice Deep Clone Object copier I found on codeproject a while ago and incorporated it in our stuff. As mentioned above, it does require your objects to be Serializable /// <summary> /// Refe...
well pipes are real fast and usefull. your version is also a very effective use of pipes others might be : 1) combine many feeds into one, then sort, filter and translate it. 2) geocode your favorite feeds and browse the items on an interactive map. 3) power widgets/badges on your web site. 4) grab the ...
Your example is not providing a TargetControlID. Do you have an updatePanel on the page? I had problems dynamically creating extenders as they weren't being added to the updatePanel content. I also think you have to do somethin with the ScriptManager (registering the extender) but I could be mistaken (I don't hav...
Is there another way to integrate PDF viewing in a Flex application?
|apache-flex|air|
I'm looking at ways to embed PDF viewing in a Flex application. Currently the only option I've seen is by using the [flash.html.HTMLLoader][1] class, which only works if you're using AIR. This isn't a big deal -- I'm willing to use AIR if I have to -- but based on my experimentation with viewing a PDF this way it ap...
you could just turn it off by going to Format -> Word Wrap.
OK, I think I have a solution: * Generate the plugin via script/generate plugin * change the Rakefile, and add <code> require 'spec/rake/spectask' desc 'Test the acts_as_protx plugin.' Spec::Rake::SpecTask.new(:spec) do |t| t.libs << 'lib' t.verbose = true end </code> ...
OK, I think I have a solution: * Generate the plugin via script/generate plugin * change the Rakefile, and add <code> require 'spec/rake/spectask' desc 'Test the PLUGIN_NAME plugin.' Spec::Rake::SpecTask.new(:spec) do |t| t.libs << 'lib' t.verbose = true end </code> * ...
hibernate insert batch with postgresql
|postgresql|hibernate|insert|partition|
is there a solution for batch insert via hibernate in partitioned postgresql table? currently i'm getting an error like this... 57286 [pool-1-thread-18] ERROR org.hibernate.jdbc.AbstractBatcher - Exception executing batch: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0...
@erlando, out of curiosity, why do you need to know the variable's type looking at the source code? In my practice I found that variable type is matter for me only at the time I'm using it in the code. If I'm trying to do some inappropriate operation on *someVar* compiler gladly gives me an error\warning. I...
Java (and C#) generics seem to be a simple run-time type substitution mechanism. <br> C++ templates are a compile-time construct which give you a way to modify the language to suit your needs. They are actually a purely-functional language that the compiler executes during a compile.
How to wrap a function with variable length arguments?
|c|c++|
I am looking to do this in C/C++. I came across [**Variable Length Arguments**][1] but this is not pure C/C++ solution. Any suggestion is appreciated. [1]: http://www.swig.org/Doc1.3/Varargs.html
|c++|c|
I am looking to do this in C/C++. I came across [**Variable Length Arguments**][1] but this suggests a solution with Python & C using [libffi][2]. Now, if i want to wrap printf function with myprintf i do like below: void myprintf(char* fmt, ...) { va_ list args; va_ start(args,fmt)...
How to use 32bit alpha-blended BMP in .Net
|c#|.net|alpha|blending|
Is there any way to use this kind of format in .Net (C#)? I want to use the same skin format that uTorrent uses in my app, but i can't get the transparent background. Any ideas? Thanks for your time.
These look pretty promising- http://www.earthtools.org/webservices.htm
I use `var` extensively. There has been criticism that this diminishes the readability of the code, but no argument to support that claim. Admittedly, it may mean that it's not clear what type we are dealing with. So what? This is actually the point of a decoupled design. When dealing with interfaces, you are emphat...
If you want to have a structured way to store and retrieve information, a database is most definitely the way to go. It makes your application flexible and more powerful, and lets you focus on the actual application rather than incidentals like trying to write your own storage system. For individual applications, [...
What you should do is first to read and understand the "fixed time-step" game loop (Here's a good explanation: http://www.gaffer.org/game-physics/fix-your-timestep). Then what you do is to keep a list of list of pairs of frame counter and action. STL example: std::list<std::list<std::pair<unsigned long, Actio...
What you should do is first to read and understand the "fixed time-step" game loop (Here's a good explanation: http://www.gaffer.org/game-physics/fix-your-timestep). Then what you do is to keep a list of list of pairs of frame counter and action. STL example: std::list<std::list<std::pair<unsigned long, Actio...
What you should do is first to read and understand the "fixed time-step" game loop (Here's a good explanation: http://www.gaffer.org/game-physics/fix-your-timestep). Then what you do is to keep a list of list of pairs of frame counter and action. STL example: std::list<std::list<std::pair<unsigned long, Actio...
There is also dialog and the KDE version kdialog. Dialog is used by slackware, so it might not be immediately available on other distributions.
There is one instruction to convert a floating point to an int in assembly: use the FISTP instruction. It pops the value off the floating-point stack, converts it to an integer, and then stores at at the address specified. I don't think there would be a faster way (unless you use extended instruction sets like MMX or S...
It's not usually more expressive because most stored procedure languages suck by design. But it will probably run faster than in an external app. I guess it boils down to how familiar you are with PL/SQL, how much time you have to write this, how important is performance and if you can reasonably expect maintainers ...
I find that a common parent for all model objects you pass to the view is exceptionally useful. There will always tend to be some common model properties between pages anyway.
**Faster C Implmentation** This runs nearly 3x faster than the C++ implementation. Not sure why as it's pretty similar. For the last C++ implementation that I posted it took 6.8 seconds to run through a 200,000,000 character array. The implementation took only 2.2 seconds. #include <stdio.h> #include...
**Faster C Implmentation** This runs nearly 3x faster than the C++ implementation. Not sure why as it's pretty similar. For the last C++ implementation that I posted it took 6.8 seconds to run through a 200,000,000 character array. The implementation took only 2.2 seconds. #include <stdio.h> #include...
Is there an easy way to change the color of a bullet in a list?
|html|css|
All I want is to be able to change the color of a bullet in a list to a light gray. It defaults to black, and I can't figure out how to change it. I know I could just use an image; I'd rather not do that if I can help it.
Correct - bound parameters are not vulnerable to SQL injection attacks.
How can I make Internet Explorer not change the colors in my PNG images
|html|internet-explorer-7|png|
When using PNG files (made with Paint.NET) as background images on my web site, IE7 is changing the colors and actually displaying a darker version of my images, as seen [here][1]. In this image, the dark background and background image should be both #001122, and the medium background and background image #004466. But...
|html|internet-explorer-7|png|gamma|
I know it tends to scare people, but you could write a simple function to do this using regular expressions 'a number (.*?) and another (.*?) If you are worried about reg expressions take a look at www.regexbuddy.com and you'll never look back.
Prototype's Enumerable#pluck in F#?
|javascript|functional-programming|f#|prototype|
In JavaScript, using the Prototype library, the following functional construction is possible: var words = ["aqueous", "strength", "hated", "sesquicentennial", "area"]; words.pluck('length'); //-> [7, 8, 5, 16, 4] Note that this example code is equivalent to words.map( function(word) { return...
I just use SQL Server using the diagrams folder. The designer is pretty simple to use, and can be used to generate tables fairly quickly. Considering it's free with the software, I don't see the issue.
ORMs and code generators are kind of on one side of the field, and stored procedures are on another. Typically, it's easier to use ORMs and code generators in greenfield projects, because you can tailor your database schema to match the domain model you create. It's much more difficult to use them with legacy projects,...
Have you taken a look at Dependency Finder? http://depfind.sourceforge.net/ A handy list of most of the other available Java dependency tools is also available on that site.
public void EnableDoubleBuffering() { this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); }
I would take a look at [swig][1], we use this to good effect on our project to expose our C++ API to other language platforms. It's a well maintained project that effectively builds a thin wrapper around your C++ library that can allow languages such as C# to communicate directly with your native code - saving you...
What is the best way the _DoPostBack javascript method in Asp.net
|asp.net|asp.net-ajax|
I want to set a breakpoint on the __DoPostBack method, but it's a pain to find the correct file to set the breakpoint in. The method __DoPostBack is contained in an auto-generated js file called something like: ScriptResource.axd?d=P_lo2... After a few post-backs visual studio gets littered with many of these fi...
I would use a script to generate all the individual queries, since this is a one-off import process. Some programs such as Excel are good at mixing different dimensions of data (comparing column names to data inside rows) but relational databases rarely are. However, you might find that some systems (such as Micr...
Ping the target, gradually increasing the TTL and watching where the "TTL exceeded" responses originate.
I would use the code that generates a stack trace for leaked memory in [Visual Leak Detector][1]. This only works on Win32, though. [1]: http://www.codeproject.com/KB/applications/visualleakdetector.aspx
There are a lot of factors to this. But, being a database weenie, I would err on the side of having a database. It just makes life easier when things changes. and things *will* change. Depending on the images, you might store them on the file system or actually blob them and put them in the database (Not supporte...
Anything that you like and feel that you can contribute to.
You might also look at [Skelmir's CEEJ][1]. It's been several years since I used it, but even then I was impressed with their code coverage and especially the performance. [1]: http://www.skelmir.com/solutions/handheld.html
Tables are good for HTML that you're throwing together for something simple or temporary. If you're building a large-scale website, you should go with divs and CSS, since it will be easier to maintain over time as your website changes.
Antlr? http://www.antlr.org/ Has a quite good IDE for designing a grammar, and a lot of generators for different languages.
According to 508 compliance (for screen readers for visually impared), tables should only be used to hold data and not for layout as it causes the screen readers to freak out. Or so I've been told. If you assign names to each of the divs, you can skin them all together using CSS as well. They're just a bit more of...
Express Editions works fine if you do not want to have different project types/languages in a solution, and you have no need for builtin source control. Else, it's pretty much the same.
The permission that needs set is actually found in the Shared Service Provider. 1. Navigate to Central Admin 2. Navigate to the Shared Service Provider 3. Under <b>User Profiles and My Sites</b> navigate to Personalization services permissions . 4. If the account doesn't already exist, add the account for whi...
ChatFx Lite LicenseException on build server
|chartfx|
I downloaded ChartFx Lite and am using it successfully in my windows forms application on my development machine. I have added the ChartFX.Lite.dll assembly to my source repository and am trying to build the project on my build server that does not have ChartFx Lite installed. I get the error: Exception occurred c...
I think getting rid of the null values is the easist. (as raz0rf1sh has said) CREATE TABLE tmp1( col1 INT identity ( 1, 1 ), col2 TEXT ) GO INSERT INTO tmp1 SELECT NULL GO 10 SELECT * FROM tmp1 UPDATE tmp1 SET col2 = '' ...
I think getting rid of the null values is the easist. (as raz0rf1sh has said) CREATE TABLE tmp1( col1 INT identity ( 1, 1 ), col2 TEXT ) GO INSERT INTO tmp1 SELECT NULL GO 10 SELECT * FROM tmp1 UPDATE tm...
No, it isn't necessarily a bad idea. If the solution seems straightforward to you and allows you to test and verify each process, its sounds like it could be a good idea. OO platforms can be (though they don't have to be) bad for large data sets, as object creation and overhead can kill performance. Oracle designed...
Let me second emk's answer -- don't use $$ by itself as a "unique" anything. For files, use mktemp. For other IDs within the same bash script, use "$$$(date +%s%N)" for a *reasonably* good chance of uniqueness. -k
What is the best data access paradigm?
|asp.net|.net|linq|
There are so many different options coming out of microsoft for data access. Which one is the best for scalable apps? **Linq** Should we be using Linq? It certainly seems easy but if you know your SQL does it really help. Also I hear that you can't run Async queries in ASP.NET using Linq. Therefore I wonder if it...
What is the best data access paradigm for scalability?
|.net|asp.net|linq|
|.net|asp.net|linq|ado.net|entity-framework|