instruction
stringlengths
0
30k
I've recently deployed hanfs using DRBD as the backend, in my situation, I'm running active/standby mode, but I've tested it successfully using OCFS2 in primary/primary mode too. There unfortunately isn't much documentation out there on how best to achieve this, most that exists is barely useful at best. If you do go...
Unless you let eval() a dynamic content (through cgi or input) it is as safe and solid as all other JavaScript in your page.
You can use the Server object in the System.Web namespace Server.UrlEncode, Server.UrlDecode, Server.HtmlEncode, and Server.HtmlDecode.
You can use the Server object in the System.Web namespace Server.UrlEncode, Server.UrlDecode, Server.HtmlEncode, and Server.HtmlDecode. Edit: poster added that this was a windows application and not a web one as one would believe. The items listed above would be available from the HttpUtility class inside System...
You could look at the Singleton pattern.
There is no sense in putting these two static variables in these to classes as long as you only need to access static members. The compiler expects you to access them trough class name prefixes like: package1.Foo.bar package2.Foo.bar
You could also look at [git-svn][1], which is essentially a git front-end to subversion. [1]: http://www.kernel.org/pub/software/scm/git/docs/git-svn.html
Singletons basically let you have complex global state in languages which otherwise make it difficult or impossible to have complex global variables. Java in particular uses singletons as a replacement for global variables, since everything must be contained within a class. The closest it comes to global variables ...
Create the logger as a singleton class and then access it using a static method.
Reduce the amount of data you're working with by serialising the task into a series of smaller tasks. Most people can only hold half a dozen (plus or minus) conditions in their head while coding, so make that the unit of implementation. Design for all the tasks you need to accomplish, but then ruthlessly hack the desig...
I've always used the Singleton pattern to implement a logging object.
I think the main benefits of dynamic languages can be boiled down to 1. Rapid development 2. Glue The short design-code-test cycle time makes dynamic languages ideal for prototyping, tools, and quick & dirty one-off scripts. IMHO, the latter two can make a huge impact on a programmer's productivity. It amazes me...
I am facing the very same problem with an application I'm selling for a very low price as well. Besides obfuscating the app, I came up with a system that uses two keys in the registry, one of which is used to determine that time of installation, the other one the actual license key. The keys are named obscurely and...
How Do I Download the Source for BIRT?
|eclipse|cvs|birt|
The Eclipse projects are all stored in the Eclipse Foundation CVS servers. Using the source is a great way to debug your code and to figure out how to do new things. Unfortunately in a large software project like BIRT, it can be difficult which projects and versions are required for a particular build. So what ...
Have you tried [this?][1] Basically, it seems that it is a crystal reports issue. Hope that helps. [1]: http://www.tek-tips.com/viewthread.cfm?qid=729496&page=6
I was going to suggest the same think as borjab. The only problem with that is that you will have to update all of these queries if you add another table. The only other option I see is a stored procedure.
I was going to suggest the same think as borjab. The only problem with that is that you will have to update all of these queries if you add another table. The only other option I see is a stored procedure. I did think of another option here, or at least an easier way to present this. You can also use a view to th...
Memory footprint issues with JAVA, JNI, and C application
|java|c|memory|java-native-interface|
I have a piece of an application that is written in C, it spawns a JVM and uses JNI to interact with a Java application. My memory footprint via Process Explorer gets upto 1GB and runs out of memory. Now as far as I know it should be able to get upto 2GB. One thing I believe is that the memory the JVM is using isn't...
By "corporate" I tend to think of internal development, programs distributed only to people that are employed by the same company. In that sense, pretty much all free software licences are "corporate-friendly." However, in terms of distributing closed-source software that contains free software the only big one (off...
You can use the ruby version of xml-simple. You shouldn't need to install the gem as I believe it's already installed with rails. http://xml-simple.rubyforge.org/
have you tried running/compiling/building your solution and/or reinstalling VS2008 in elevated privileges mode?
have you tried doing things in elevated privileges mode? including reinstalling and all...
Maybe it's not terribly idiomatic, but I'd be inclined to go with x = next() while x != END: do_something_with_x x = next() ... but that's because I find that sort of thing easy to read
What are you trying to do here? If you're iterating over a list, you can use `for e in L` where e is the element and L is the list. If you're filtering a list, you can use list comprehensions (i.e. `[ e for e in L if e % 2 == 0 ]` to get all the even numbers in a list).
How would you handle errors when using jQuery.ajax() ?
|jquery|ajax|
When using [jQuery][1]'s [ajax method][2] to submit form data, what is the best way to handle errors? This is an example of what a call might look like: $.ajax({ url: "userCreation.ashx", data: { u:userName, p:password, e:email }, type: "POST", beforeSend: function(){disableS...
System.MethodAccessException is thrown by the framework when it is missing an assembly, or one of the references are the wrong version. The first thing I'd do is try uploading and referencing your code to the LINQ assemblies in your BIN, instead of the shared hosting providers GAC.
How to create a pluginable Java program?
|java|plugins|
I want to create a Java program that can be extended with plugins. How can I do that and where should I look for? I have a set of interfaces that the plugin must implement, and it should be in a jar. The program should watch for new jars in a relative (to the program) folder and registered them somehow.
Abstraction away from CSS
|css|abstraction|
Let me make something quite clear. I. **Hate**. CSS. It is a never-ending nightmare. Every minor layout change feels like a hack. Solutions to problems seem to often involve jiggering numbers around like some chef trying to work out exactly how much nutmeg to put in his soon-to-be famous rice pudding. Then comes ...
The web.config section is pretty useless as far as I can tell: <authentication mode="Forms" /> I looked in IIS 7, and in the Authentication section it says: Anonymous Authentication = Enabled, ASP.NET Impersonation = Disabled, Basic Authentication = Disabled, Forms Authentication = Disabled. Also, I have m...
Have you considered building on top of Eclipse's Rich Client Platform, and then exposing the Eclipse extension framework? Also, depending on your needs, the Spring Framework might help with that and other things you might want to do: http://www.springframework.org/
OK, this change is in -- we now use `CONTAINS()` with implicit `AND` instead of `FREETEXT()` and its implicit `OR`.
stdbool.h c++
|c++|c|
In a project I am interfacing between c++ and a c library that uses stdbool.h defined as such. <pre><code>#ifndef _STDBOOL_H #define _STDBOOL_H /* C99 Boolean types for compilers without C99 support */ /* http://www.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html */ #if !defined(__cplusplus) #if ...
Stored procedures and views are your friend here. Even if the system doesn't use them, change it to use them, then refactor the database underneath. Your receipts and shipments then become views. Beware, receipts and shipments are actually two very different beasts in most systems I have worked with. Receipts a...
Whilst others have already said that the [System.Environment.MachineName][1] returns you the name of the machine, beware... That property is only returning the NetBIOS name (and only if your application has EnvironmentPermissionAccess.Read permissions). It is possible for your machine name to exceed the length def...
Whilst others have already said that the [System.Environment.MachineName][1] returns you the name of the machine, beware... That property is only returning the NetBIOS name (and only if your application has EnvironmentPermissionAccess.Read permissions). It is possible for your machine name to exceed the length def...
Back when I was doing C, I made use of a program called "cdecl". It appears that it's in Ubuntu Linux in the cutils or cdecl package, and it's probably available elsewhere.
One word: cdecl Damnit, beaten by 15 seconds!
Cdecl (and c++decl) is a program for encoding and decoding C (or C++) type declarations. http://gd.tuwien.ac.at/linuxcommand.org/man_pages/cdecl1.html
The simplest solution is: 1. Create a [global temporary table][1] containing just IDs you need: CREATE GLOBAL TEMPORARY TABLE tab_ids (id INTEGER) ON COMMIT DELETE ROWS; 2. Populate the temporary table with the IDs you need. 3. Use EXISTS operation in your procedure to select the rows that...
(Practically) Any garbage collected system has to move objects around in memory to pack them more densely and avoid fragmentation problems. What you are looking at is a very large and complex subject. I'd suggest you read up on existing remote object style API's: .NET remoting and going further back technologies li...
(Practically) Any garbage collected system has to move objects around in memory to pack them more densely and avoid fragmentation problems. What you are looking at is a very large and complex subject. I'd suggest you read up on existing remote object style API's: .NET remoting and going further back technologies li...
[This book (Refactoring Databases)][1] has been a God-send to me when dealing with legacy database schemas, including when I had to deal with almost the exact same issue for our inventory database. Also, having a system in place to track changes to the database schema (like a series of alter scripts that is stored ...
Managed C++ Method naming
|.net|c++|
I'm using managed c++ to implement a method that returns a string. I declare the method in my header file using the following signature: String^ GetWindowText() However, when I'm using this method from C#, the signature is: string GetWindowTextW(); How do I get rid of the extra "W" at the end of the...
|.net|c++|c++-cli|windows|
|.net|windows|c++-cli|
I don't think its obvious that the id of the transactions table should be a foreign key to either ReceiptInfo or a ShipmentInfo. Think the other way around. In an object oriented model you should have a transaction table and the ReceiptInfo or a ShipmentInfo should have a foreign key to the transaction table. If you ar...
Okay, I know the answer to this one... Eclipse has a feature named Team Project Sets which allows you to define a collection of projects, stored in various version control systems that can be downloaded as a package. I have published a collection of team project set files that can be used to get the BIRT source. T...
Flash - Drag Two Movieclips at Once?
|flash|actionscript-3|
I'm trying to create a map application similar to <a href="http://flashden.net/item/zoom-pan-controls-with-dynamic-image-settings/15713">this</a>. Click the SWF Preview tab on the left of the image. Specifically, noticed how you can pan around, and the clickable buttons on the map move with it. Basically, how do they d...
Ramesh - I would implement this using supertype and subtype relationships in my E-R model. There are a few different physical options you have of implementing the relationships as well.
Try setting your menu z-index insanely high. [Apparently][1] Google Maps uses a range from -9000000 to 9000000. [1]: http://archivist.incutio.com/viewlist/css-discuss/79150
I think you should use AOP (aspect-oriented programming) for this, rather than OOP.
[PyPy][1] is a Python implementation written in RPython wich is a Python subset. RPython can be translated to run on a VM or, unlike standard Python, RPython can be statically compiled. [1]: http://codespeak.net/pypy/dist/pypy/doc/home.html
You *do* want to establish the logger as a global variable, because global variables are *not* bad. At least, they aren't inherently bad. A logger is a great example of the proper use of a globally accessible object. Read about the Singleton design pattern if you want more information.
Anti-Usage: One major problem with excessive singleton usage is that the pattern prevents easy extension and swapping of alternate implementations. The class-name is hard coded wherever the singleton is used.
In practice a singleton / global method works fine, in my opinion. Preferably the global thing is just a framework to which you can connect different listeners (observer pattern), e.g. one for console output, one for database output, one for Windows EventLog output, etc. Beware for overdesign though, I find that in ...
What is the inversion of the Shunting Yard algorithm?
|algorithm|parsing|
Dijkstra's [Shunting Yard algorithm][1] is used to parse an infix notation and generate [RPN][2] output. I am looking for the opposite, a way to turn RPN into highschool-math-class style infix notation, in order to represent RPN expressions from a database to lay users in an understandable way. Please save your t...
There's nothing inherently wrong with the Singleton pattern. It is a tool and sometimes it should be used.
One thing with patterns: **don't generalize**. They have all cases when they're useful, and when they fail. Singleton can be nasty when you have to **test** the code. You're generally stuck with one instance of the class, and can choose between opening up a door in constructor or some method to reset the state and s...
|asp.net|jquery|ajax|
It depends a bit what you want to do. To match your example as far as possible, I would make next a generator and iterate over it: def next(): for num in range(10): yield num for x in next(): print x
> Is this just expected/undefined > behaviour? Have I done something wrong > or have I in fact found a Compiler > Bug™? No bug just the defined behaviour that optimisation options can produce odd code which might not work :) EDIT: If you think you have found a bug in GCC the mailing lists will be glad you d...
I am a bit confused about this question, if you are looking for simple parameter usage then the notation is :*paramName* , however if you want to structurally change the WHERE clause (as you might in sql+ using ?) then you should really be using custom code within the report to define a function that returns the requir...
Ideally I looked for components licensed under the [Apache Software License][1]. After that LGPL, BSD and Artistic License are my next preferences. [1]: http://www.apache.org/licenses/
I haven't used SWIG or SIP, but I find writing Python wrappers with [boost.python](http://www.boost.org/doc/libs/1_35_0/libs/python/doc/index.html) to be very powerful and relatively easy to use. I'm not clear on what your requirements are for passing types between C/C++ and python, but you can do that easily by eit...
I haven't used SWIG or SIP, but I find writing Python wrappers with [boost.python](http://www.boost.org/doc/libs/1_35_0/libs/python/doc/index.html) to be very powerful and relatively easy to use. I'm not clear on what your requirements are for passing types between C/C++ and python, but you can do that easily by eit...
If you put all the variables in a class, you can use reflection to iterate over its fields, getting their names and values and plugging them into a string. Given an instance of some class named InputArgs: foreach (FieldInfo f in typeof(InputArgs).GetFields()) { string = Regex.replace("\\[" + f.Name +...
[WSUS][1] is good for Windows, it's for large distributed enterprises. [1]: http://technet.microsoft.com/en-us/wsus/default.aspx
You don't need to register that. Try this as well: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -s /w3svc/1/root If IIS is still giving you issues, check your event log and google the error there. You'll get hits.
You probably want the box blur which is much faster. See <a href="http://www.gamasutra.com/features/20010209/evans_01.htm">this link</a> for a great tutorial and some copy & paste C code.
You probably want the box blur, which is much faster. See <a href="http://www.gamasutra.com/features/20010209/evans_01.htm">this link</a> for a great tutorial and some <a href="http://www.gamasutra.com/features/20010209/Listing2.cpp">copy & paste C code</a>.
C & C++ compilers ignore unquoted whitespace (except for the > > template issue), so getting a macro to emit newlines doesn't really make sense. You can make a macro span several lines by ending each line of the macro with a backslash, but this doesn't output newlines.
There is a **LARGE** collection of attributes you **can't set in IE** using **.setAttribute()** which includes every inline event handler. See here for details: [http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html][1] [1]: http://webbugtrack.blogspot.com/2007/08/bug-242-set...
Here's the formula: 2 ^ (32 - netmask) - 2 where netmask is a bit count as you've shown in the Cisco notation above. So a network with a /30 mask has 2 usable addresses. The lowest network number always represents the network segment itself and the highest is always the broadcast ... this leads to the -2 at the en...
Here's the formula: 2 ^ (32 - netmask) - 2 where netmask is a bit count as you've shown in the Cisco notation above. So a network with a /30 mask has 2 usable addresses. The lowest network number always represents the network segment itself and the highest is always the broadcast ... this leads to the -2 at the en...
One reason I can imagine for enforcing a maximum password length is if the frontend must interface with many legacy system backends, one of which itself enforces a maximum password length. Another thinking process might be that if a user is forced to go with a short password they're more likely to invent random gibb...
For large strings, you're pretty much stuck with the memory window - the tooltip would truncate eventually. Fortunately, the memory window is easy to get data from - I tend to show it in 8-byte chunks so its easy to manage, find your string data and cut&paste the lot into a blank window, then use alt+drag to select...
Let's do a little math: Credit card numbers are 16 digits long. The first seven digits are 'major industry' and issuer numbers, and the last digit is the luhn checksum. That leaves 8 digits 'free', for a total of 100,000,000 account numbers, multiplied by the number of potential issuer numbers (which is not likely to b...
There's no need to set the GET parameters on the URL, jQuery will set them automatically. Try this code: var key = document.getElementById("key"); [...] var url = "/My_Servlet/response"; $.get (url, {'key': key}, function (responseText) { var decimal = document.getElementById ('decimal'...
We have reproduced this issue and will fix it in the next release of Visual Studio. You are welcome to use <a href="http://connect.microsoft.com/">Microsoft Connect</a> site for reporting any issues related to Visual Studio. Best regards,<br/> Anton Lapounov<br/> Data Programmability Team @ Microsoft
Applying Styles To ListItems in CheckBoxList
|asp.net|html|controls|coding-style|
How can styles be applied to CheckBoxList ListItems. Unlike other controls, such as the Repeater where you can specify <ItemStyle>, you can't seem to specify a style for each individual control. Is there some sort of work around?