instruction
stringlengths
0
30k
I have a script that works fine on my test server (using IIS6). The script processes an ajax request and sends a response with the following line: header( 'application/javascript' ); But on my live server, this line crashes the page and causes a 500 error. Do I need to allow PHP to send different MIME types in...
It sounds like you may be using Python. If so, you can use something like this: import socket def check_ipv6(n): try: socket.inet_pton(socket.AF_INET6, n) return True except: return False print check_ipv6('::1') print check_ipv6('foo') ...
No. The String class is final and can not be extended. Better use StringBuilder, which has method append() and does the job you want.
Better use StringBuilder, which has method append() and does the job you want. The String class is final and can not be extended.
Start with their docs: http://developer.facebook.com/get_started.php?tab=tutorial There are libraries floating around for lots of different languages and frameworks so I say: whatever you're happiest with is where you should start.
How to find and kill running Win-Processes from within Java?
|java|windows|process|
I need a Java way to find a running Win process from which I know to name of the executable. I want to look whether it is running right now and I need a way to kill the process if I found it. Thank you! Greetz, GHad
Use the [Get Started tutorial][1] on [developers.facebook.com][2]. This will suggest you use the sample code button which will give you some PHP to list your friends. Then you can start playing with the PHP using the [wiki][3] for reference to the FQL and FBML. PHP will be easier to start with as there are lots of...
A general tip for looking up answers to questions like this one: 1. Look up the help for a relevant function. eg. **C-h f webjump** 2. In the top line of the help buffer, hit RET on the filename in which the function is defined. This will take you to the function definition. 3. **M-<** to jump to the beginnin...
ASP.NET website does not rebuild
|asp.net|
Ok, so you've hit on a key point in using the "big O notation". That's one dimension that can certainly bite you in the rear if you're not paying attention. There are also other dimensions at play that some folks don't see through the "big O" glasses (but if you look closer they really are). A simple example of ...
Query points epsilon-close to a cut plane in point cloud using the GPU.
|opengl|geometry|cloud|point|
I am trying to solve the current problem using GPU capabilities: "given a point cloud P and an oriented plane described by a point and a normal (Pp, Np) return the points in the cloud which lye at a distance equal or less than EPSILON from the plane". Talking with a colleague of mine I converged toward the following...
I wrote this class up back in the day to do what I think, is similar to what you are trying to do. You would use methods of this class on objects that you wish to serialize to XML. For instance, given an employee... using Utilities; using System.Xml.Serialization; [XmlRoot("Employee")] public class Employee { ...
In one of Robert Glass's recent books (I'll have to look up the reference) he mentioned a study on the cost of well maintained code. What they found is that well maintained code was edited more often than poorly maintained code. That sounds counter intuitive but when they dug deeper the discovered the reason: Well...
You might also want to consider table variables, whose lifecycle is completely managed for you. DECLARE @MyTable TABLE (MyPK INT IDENTITY, MyName VARCHAR(100)) INSERT INTO @MyTable ( MyName ) VALUES ( 'Icarus' ) INSERT INTO @MyTable ( MyName ) VALUES ( 'Daedalus' ) SELECT * FROM @MyTable I almo...
My opinion (has always been) build it to the standards and leave it to the browsers to render it correctly.
Javascript *should* always be case sensitive, but I've seen cases in Internet Explorer where it tolerates all upper case for some function names but not others. I think it is limited to function that also exist in Visual Basic, as there is some odd inbreading between the two. Clearly this behavior should be avoided, un...
Javascript *should* always be case sensitive, but I've seen cases in Internet Explorer where it tolerates all upper case for some function names but not others. I think it is limited to functions that also exist in Visual Basic, as there is some odd inbreeding between the interpreters. Clearly this behavior should be a...
IMO, JavaScript, the language, is not the problem. JavaScript is actually quite an expressive and powerful language. I think it gets a bad rep because it's not got classical OO features, but for me the more I go with the prototypal groove, the more I like it. The problem as I see it is the flaky and inconsistent imp...
Short answer it cannot be done securely. there is however a lot of tricks that can be implemented to make it difficult for users to hit back and get sensitive data displayed. Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(Now.AddSeconds(-1)); Response.Cache.SetNo...
Short answer it cannot be done securely. there is however a lot of tricks that can be implemented to make it difficult for users to hit back and get sensitive data displayed. Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(Now.AddSeconds(-1)); Response.Cache.SetNo...
I wasn't aware of that limitation. Although it does make sense to disable potentially data-hefty OBJECT or EMBED tags when on the cellular data service for which your provider may be charging by the byte, if that were the reason it wouldn't make sense that it would still work on 3G and only not on GPRS.<br /> Perhaps...
I also work for a small company and we mainly develop in .NET languages. We have decided to use Visual SourceSafe for source control, despite its questionable reputation, since it integrates nicely with Visual Studio. VSS works very well for us, and we have not experienced any serious problems with it. Also, we host...
It all depends on your abstraction strategy. Are the stored procedures treated as a discrete point of abstraction, or are they treated as just another part of the application that calls them. The answer to that will tell you how to manage them. If they are a discrete abstraction, they can be shared, as if you need...
The only option that I can think of is to restore the backup on another machine that has the same level of updates as when the backup was done, upgrade the whole box to Infrastructure Update, backup this environment and restore it in your already-upgraded-environment.
Would creating a second table be an option? You could create a second table, populate it with the needed data, add the constraints/indexes, then drop the first table and rename your second table. This should give you the data with the right keys...and it should all consist of SQL statements that are allowed to trickle ...
Ideally use one proc not multiple versions. If you need versions per customer, investigate the idea of 1 db per customer as opposed to 1 db for all customers. This also allows for some interesting staging of db's on different servers ( allocate the larger/heavier usage ones to bigger servers while smaller ones can shar...
1: Taking the address of a temporary is not allowed. Visual C++ allows it as a language extension (language extensions are on by default). 2: This is perfectly legal.
If i try something along the lines as you suggest: var criteria = session.CreateCriteria(typeof(Activity)) .SetProjection(Projections.Count("Distance")); return (double)criteria.UniqueResult(); I removed the restriction as this was not necessary and i used Count instead o...
Sorry! I actually wanted a sum, not a count, which explains alot. Iv edited the post accordingly This works fine: var criteria = session.CreateCriteria(typeof(Activity)) .SetProjection(Projections.Sum("Distance")); return (double)criteria.UniqueResult(); The named ...
|c#|.net|string|trim|
I have a string that is like below. ,liger, unicorn, snipe in other languages I'm familiar with I can just do a string.trim(",") but how can I do that in c#? Thanks. ---------- *There's been a lot of back and forth about the StartTrim function. As several have pointed out, the StartTrim doesn't affect...
What is the difference between UNION and UNION ALL in Oracle
|sql|oracle|sybase|
What is the difference between UNION and UNION ALL in Oracle. ( not sure that it matters which database ).
|sql-server|sql|mysql|oracle|sybase|
What is the difference between UNION and UNION ALL
|sql|sql-server|mysql|oracle|sybase|
What is the difference between UNION and UNION ALL.
It can't be done.
@Teifion One of the main uses for Lisp is in Artificial Intelligence. A friend of mine at college took a graduate AI course and for his main project he wrote a "[Lights Out][1]" solver in Lisp. Multiple versions of his program utilized slightly different AI routines and testing on 40 or so computers yielded some pr...
@Teifion One of the main uses for Lisp is in Artificial Intelligence. A friend of mine at college took a graduate AI course and for his main project he wrote a "[Lights Out][1]" solver in Lisp. Multiple versions of his program utilized slightly different AI routines and testing on 40 or so computers yielded some pr...
Reverse DNS lookup in perl
|perl|ip|nslookup|reverse-dns|lookup|
How do I perform a reverse DNS lookup, that is how do I resolve an IP address to its DNS hostname in Perl?
Each of your Delaunay triangles contains a single point of the Voronoi diagram. You can compute this point by finding the intersection of the three [perpendicular bisectors][1] for each triangle. Your Voronoi diagram will connect this set of points, each with it's nearest three neighbors. (each neighbor shares ...
clock() -> floating point number Return the CPU time or real time since the start of the process or since the first call to clock(). This has as much precision as the system records. time() -> floating point number Return the current time in seconds since the Epoch. Fractions of...
Both wx and QT do an excellent job of creating an application that matches the OS look and feel. It is also possible to implment all the widgets yourself directly in openg, this slashdot post lists some of the sets available http://ask.slashdot.org/askslashdot/02/12/24/1813219.shtml?tid=156 fox is probably the mo...
I don't think Ruby has tools for that. You might check ImageMagick and Cairo. ImageMagick can be used for binding multiple pictures/documents together, but I'm not sure about the PDF case. Then again, there are surely Windows tools (commercial) to do this kind of thing. I use Cairo myself for _generating_ PDF's...
When is it right for a constructor to throw an exception?
|constructor|exception|
When is it right for a constructor to throw an exception? (Or in the case of Objective C: when is it right for an init'er to return nil?) It seems to me that a constructor should fail -- and thus refuse to create an object -- if the object isn't complete. I.e., the constructor should have a contract with its caller ...
|exception|constructor|
Isn't there an import library (maybe riched20.lib) that you can link to. Then you won't have to load it "manually" at run time. That's how all the standard controls work. VS automatically adds a reference to user32.lib when you create a project.
AJAX - How to Pass value back to server
|asp.net-ajax|asynchronous|
Amiga ROM Kernel Manuals :)
Can operator>> read an int hex AND decimal?
|c++|
Can I persuade operator>> in C++ to read both a hex value AND and a decimal value? The following program demonstrates how reading hex goes wrong. I'd like the same istringstream to be able to read both hex and decimal. #include <iostream> #include <sstream> int main(int argc, char** argv) ...
Slightly easier to read, IMO: public int getLastFriday(int month, int year) { Calendar cal = Calendar.getInstance(); cal.set(year, month, 1, 0, 0, 0); // set to first day of the month cal.set(Calendar.MILLISECOND, 0); int friday = -1; while (cal.get(Calendar.MON...
Slightly easier to read, brute-force approach: public int getLastFriday(int month, int year) { Calendar cal = Calendar.getInstance(); cal.set(year, month, 1, 0, 0, 0); // set to first day of the month cal.set(Calendar.MILLISECOND, 0); int friday = -1; while (cal...
I highly recommend maintaining schema and stored procedures in source control. Keeping stored procedures versioned allows them to be rolled back when determined to be problematic. Schema is a less obvious answer depending on what you mean. It is very useful to maintain the SQL that defines your tables in sou...
ulimit -c <value> sets the core file size limit on unix. By default, the core file size limit is 0. You can see your ulimit values with ulimit -a. also, if you run your program from within gdb, it will halt your program on "segmentation violations" (SIGSEGV, generally when you accessed a piece of memory that you h...
From past experience, I'd have to go for DIV's. Even in OOP, the main aim is to reduce the coupling between objects, so this concept can be applied to DIVS and tables. Tables are used for holding data, not for arranging it around a page. A DIV is specifically designed to arrange items around a page, so the design shoul...
What about the [ACE library][1]? It's an open-source object-oriented framework for concurrent communication software, but it also has some container classes. [1]: http://www.cs.wustl.edu/~schmidt/ACE.html "ACE Library"
You can often used <mx:Dissolve> instead of <mx:Fade>, it looks nearly identical and doesn't require embedded fonts.
You can often use &lt;mx:Dissolve&gt; instead of &lt;mx:Fade&gt;, it looks nearly identical and doesn't require embedded fonts.
My experience is that well designed STL code runs slowly in debug builds because the optimizer is turned off. STL containers emit a lot of calls to constructors and operator= which (if they are light weight) gets inlined/removed in release builds. Also, Visual C++ 2005 and up has checking enabled for STL in both rel...
Resharper and ViEmu Keybindings ( and Visual Assist )
|visual-studio|resharper|visual-assist|viemu|
With ViEmu you really need to unbind a lot of resharpers keybindings to make it work well. Does anyone have what they think is a good set of keybindings that work well for resharper when using ViEmu? What I'm doing at the moment using the Visual Studio bindings from Resharper. Toasting all the conflicting ones ...
The window.open() function will also allow this if you have a reference to the window created, provided it is on the same domain. If the variable is used server side you should be using a $_SESSION variable (assuming you are using PHP).
I strongly recommend __against__ storing binary data in a relational database. Relational databases are designed to work with fixed-size data; that's where their performance strength is: remember joel's old article <http://www.joelonsoftware.com/articles/fog0000000319.html> on why databases are so fast? because it take...
I have a solution with several projects in Visual 2008, let's say SuggestionProcessor (a class library) and Suggestions (a website) with a webhandler GetSuggestions.ashx. I changed a method in SuggestionProcessor which is used in the webhandler. The call in the webhandler has been adjusted to the changed method. But...
EDIT: Beaten, serves me right for looking it up =]. Don't forget to include `<typeinfo>` I believe what you are referring to is runtime type identification. You can achieve the above by doing . #include <iostream> #include <typeinfo> using namespace std; int main() { int ...
Mediawiki (the sotware for wikipedia) stores full text for all revision see the [database schema][1]. Each entry in the [text table][2] in Mediawiki has flags that tells if the content has been e.g. gziped, using a standard compression is often the sanest option. If you want to do diffs then you should do them on t...
Mediawiki (the sotware for wikipedia) stores full text for all revision see the [database schema][1]. Each entry in the [text table][2] in Mediawiki has flags that tells if the content has been e.g. gziped, using a standard compression is often the sanest option. I can't tell you how to do the diffs algorithmically...
There is also **[OpenAMF][1]**. It is *very* mature, stable, simple and lightweight relative to Blaze, Red5 and Granite. **BUT**, it is also dated (AMF0 protocol only) and the project is no longer active. Lots of people are still using it out in the wild. And the documentation is borderline non-existent. ...
They have added the HashSet class in .NET 3.5. But I guess it will be on par with the Dictionary. If you have less than say a 100 elements a List will probably perform better.
Attributes are accessible in AS3 using the `@` prefix. For example: var myXML:XML = <test name="something"></test>; trace(myXML.@name); myXML.@name = "new"; trace(myXML.@name); Output: something new
You describe the following requirements a) Must be able to implement Batch Processing b) Result must be maintainable My Response: 1. PL/SQL was designed to achieve just what you describe. It's also important to note that there are efficiencies in PL/SQL that are not available in other tools. An stored proced...
There are several ways but here is a slow but failsafe one : IFS=$'\n'; # set the field separator to line break for $mail in $(grep -L -r 'Subject: \[SPAM\]' .); do mv "$mail" your_dir; done; IFS=' '; # restore FS
How do I use groovy to search+replace in XML?
|xml|groovy|soapui|
How do I use groovy to search+replace in XML? I need something as short/easy as possible, since I'll be giving this code to the testers for their SoapUI scripting. More specifically, how do i turn "<root><data></data></root>" into "<root><data>value</data></root>"
I can understand why you can't use STL - most do bloat your code terribly. However there are implementations for games programmers by games programmers - [RDESTL][1] is one such library. [1]: http://code.google.com/p/rdestl/
Directly from the [Strategy Pattern Wikipedia article][1]: >>The strategy pattern is useful for situations where it is necessary to dynamically swap the algorithms used in an application. The strategy pattern is intended to provide a means to define a family of algorithms, encapsulate each one as an object, and make...
It may be that it just doesn't like the very short keys you're using. I found [the desktop version of that article][1] which may help, as it has a full example. [1]: http://msdn.microsoft.com/en-us/library/aa381969.aspx
It may be that it just doesn't like the very short keys you're using. I found [the desktop version of that article][1] which may help, as it has a full example. EDIT: The OP realised from the example that you have to tell CryptGenKey how long the keys are, which you do by setting the top 16-bits of the flags t...
Could be an SSL issue.
Could be an SSL issue.<br> Do have a look into profiles settings, do you get any error when accessing to the User Profiles settings for that same SSP?
The browser is dead when (a) a very small percentage of people use it and (b) you don't care about (selling to? educating? whatever your business is) such a small percentage of people.
Start with the browser with the highest market share and work your way down from there. If you have existing metrics on browsers that visit your site, use those instead of the general market share.
Adobe AIR can only support SVG once Adobe updates their version of WebKit (AIR's HTML rendering engine) and enables the SVG support within their version of WebKit. Might be a business decision not to (ie Flash).
thats a good question, i have asked that myself, too.. we currently test-drive fogbugz for 45 days in a group of 5 developers, and we currently create a "release" for major features. in fact we do not release it, but multiple releases together when something is ready. there should definately be some sort of advanc...