instruction
stringlengths
0
30k
|javascript|dom|
What are good alternative data formats to XML?
|xml|data-structures|serialization|
XML, granted, is very useful, but can be quite verbose. What alternatives are there and are they specialised for any particular purpose? Library support to interrogate the contents easily is a big plus point.
There is a technique called "[Hole Punching][1]" that works well with "Cone" NAT (Cone is a technical familly of router). That's not an 100% sure technique, today, it works well with UDP on about 80% of the router. There is some implementations of library to realize Hole Punching: [STUN][2] ([wikipedia][3]) [...
There seems to be a lot of multi-platform support for [JSON][1]. [1]: http://www.json.org/
Starting in NHibernate 2.0, transactions are required for DB operations. Therefore, the `ITransaction.Commit()` call will handle any necessary flushing. If for some reason you aren't using NHibernate transactions, then there will be no auto-flushing of the session.
S-Expressions work great if you don't need to apply attributes to elements. Another alternative is YAML.
Don't forget about [YAML](http://www.yaml.org/)! JSON seems to have better support though. For example, the [Prototype JS](http://www.prototypejs.org/) library has excellent built-in JSON functions.
Here is a short pure-javascript example. Assume you have a div with the id "maincontent". var newnode = document.createTextNode('Here is some text.'); document.getElementById('maincontent').appendChild(newnode); Of course, things are a lot easier (especially when you want to do more complicated things) w...
You might want to look into Steganography; that is hiding data inside of images. There are forms that won't get lost if you convert to a lossier format or even crop parts of the image out.
There are is an addition in 3.5 SP1 that allow better interaction between DirectX and WPF (D3DImage), and one way to get to that is through XNA. Here is some details: http://jmorrill.hjtcentral.com/Default.aspx?tabid=428&EntryID=259
Difference between foreach and for loops over an IEnumerable class in C#
If you are working in the plane and you want the <a href="http://en.wikipedia.org/wiki/Euclidean_distance">Euclidean distance</a> "as the crow flies": // Cities are points x0,y0 and x1,y1 in kilometers or miles or Smoots[1] dx = x1 - x0; dy = y1 - y0; dist = sqrt(dx*dx + dy*y); No trigonometry ...
I do not have personal experience with this product, but [dokeos][1] is recommended by several people on other sites. [1]: http://www.dokeos.com/
Microsoft Reporting Services, **free** and included with SQL Server 2005 and 2008. Of course, this is great if you need a separation of report design and application, which for Enterprise applications is a huge plus. However, if what you want is to be able to create "in application" dashboards, where "you" design...
@adeel - I think [this blog entry][1] can give you some details at least about one user that has tried [DimDim][2]. [1]: http://injenuity.com/archives/64 [2]: http://www.dimdim.com/
+1 SSRS and ActiveReports. ryw, use ActiveReports and close the gates of Crystal Hell behind you forever.
I think the first part is your Application. If you decide to go PHP, you almost automatically end up with LAMP, as WIMP or WISP stacks are quite rare (I think blog.stackoverflow.com runs on WIMP), and with .net you definitely want to go WISA. So normally, it boils down to .net vs. PHP. (Ignoring Ruby, Python and all...
Whats the best way to securely push a site to a live server?
Is it possible to settle this dispute? My first thought is to look to a symbolic language, like [Maple](http://en.wikipedia.org/wiki/Maple_(software). I don't think that counts as floating point though. In fact, how does one represent _i_ (or _j_ for the engineers) in a conventional programming language? Perha...
The GNU C Library supports [regular expressions][1]. It's open, and the RE code seems to be easily extractable. [1]: http://www.gnu.org/software/libtool/manual/libc/Regular-Expressions.html
How To Display 100 Floating Cubes Using DirectX OR OpenGL?
|language-agnostic|opengl|3d|directx|
I'd like to display ~100 floating cubes using DirectX or OpenGL. I'm looking for either some sample source code, or a description of the technique. I know this kind of thing is easy for you accomplished 3D gurus out there but I have enough trouble getting even one cube to display correctly. I've combed the net fo...
In general, you can't change the effective user id of the vi process, but you can do this: :w !sudo tee myfile
While I haven't used a flash object inside a windows form application myself, I do know that it's possible. In Visual studio on your toolbox, choose to add a new component. Then in the new window that appears choose the **"COM Components"** tab to get a list in which you can find the **"Shockwave Flash Object"** O...
While I haven't used a flash object inside a windows form application myself, I do know that it's possible. In Visual studio on your toolbox, choose to add a new component. Then in the new window that appears choose the **"COM Components"** tab to get a list in which you can find the **"Shockwave Flash Object"** O...
I believe that the real answer is that you can't. The file path won't be sent by the browser for security reasons. The file name will be sent, however I don't believe it gets sent without an actual upload. The closest you could come, afaik, would be to forcibly kill the connection just when the upload starts. Tha...
I would say that it depends on what you want the "DB layer" to do... If you have general routines for executing a stored procedure, or sql statement, that return a dataset, then using static methods would make more sense to me, since you don't need a permanent reference to an object that created the dataset for you....
Maybe a CLR stored procedure is what you are looking for. These are generally used when you need to interact with the system in some way.
Something like this might do the trick: /Seat (\d+): ([^\(]+) \((\d+)in chips\)/ And some basic explanation on how Regex works: + \d = digit. + \&lt;character> = escapes character, if not part of any character class or subexpression. for example: `\t` would render a tab, while `\\t` would re...
Something like this might do the trick: /Seat (\d+): ([^\(]+) \((\d+)in chips\)/ And some basic explanation on how Regex works: + \d = digit. + \&lt;character> = escapes character, if not part of any character class or subexpression. for example: `\t` would render a tab, while `\\t` would re...
|.net|animation|
What is a good way to perform animation using .Net. I would prefer not to use Flash if possible, so am looking for suggestions of ways which will work to implement different types of animation on a new site I am producing. The new site is for a magician, so I want to provide animated buttons (Cards turning over etc...
Do be aware that certain parts of ffmpeg are under GPL. I believe the libpostproc module is and if I recall correctly this is used in transcoding. Make sure this license is compatible with what you're doing.
When you want to transcode to Flv (which is probably the best for the web) then I use this line: ffmpeg -hq -y -i $directory/$file -r 20 -s 300x200 -deinterlace -ar 22050 $directory/$file.flv 1>/dev/null 2>/dev/null It works very well, under linux of course :-).
[Silverlight][1] springs to mind as an obvious choice if you want to do animation using .NET on the web. It may not cover all platforms but will work in IE and FireFox and on the Mac. [1]: http://silverlight.net/Default.aspx
Trolltech's (or should I say Nokia?) Qt has also a nice Regular Expression implementation [QRegExp][1]. It is also paltformindependend. [1]: http://doc.trolltech.com/4.4/qregexp.html
Setting up Continuous Integration with SVN
|continuous-integration|
What tools would you recommend for setting up CI for build and deployment of multiple websites built on DotNetNuke using SVN for source control? We are currently looking at configuring Cruise Control to work with NAnt, NUnit, NCover and Trac as a test case. What other combinations would worth investigating? We h...
Note that Matt's code above will result in an extra comma at the end of the string; using COALESCE (or ISNULL for that matter) as shown in the link in Lance's post uses a similar method but doesn't leave you with an extra comma to remove. For the sake of completeness, here's the relevant code from Lance's link on sqlt...
Javascript is probably the way to go, if you want to avoid flash. Check this: [http://www.webreference.com/programming/javascript/java_anim/][1] It won't work for embedded video, though, so you're stuck with Flash for that (or silverlight, or quicktine). HTH [1]: http://www.webreference.com/programming/jav...
Javascript is probably the way to go, if you want to avoid flash. Check this: [http://www.webreference.com/programming/javascript/java_anim/][1] It won't work for embedded video, though, so you're stuck with Flash for that (or silverlight, or quicktime). HTH [1]: http://www.webreference.com/programming/jav...
Don't wait. Pick one, and go with it. All systems will have their pluses and minuses. Your power could go out, you computer gets stolen, or you forget to undo a major change and all your code gets fried while you're waiting to see who emerges victorious.
When I decided I must use a code versioning system, I looked around for any good tutorials on how to get started but didn't find any that could help me. So I simplely installed the SVN Server and Tortoise SVN for the client and dived into the deepend and i learn't how to use it along the way.
Well, mine isn't all that simpler, but here is the code I use to split a comma-delimited input variable into individual values and put it into a Table Variable. I'm sure you could modify this slightly to split based on a space and then to a basic SELECT query against that table variable to get your results. -- C...
The [Subversion Book][1] is your best bet for learning the tool. There may be other quick-start tutorials out there, but the Book is the best single reference you'll find. Git has some nice features, but you won't be able to appreciate them unless you've already used something more standard like CVS or Subversion. ...
Start using SVN for your actual work, but try to make time for fiddling around with Git and/or Mercurial. SVN is reasonably stable for production, but eventually you'll face a scenario where you'll *need* a distributed SCM, by which time you'll be properly armed and the new systems will be mature enough.
My vote goes to Subversion. It's very powerful, yet easy to use, and has some great tools like [TortoiseSVN][1]. But as others have said before me, JUST START USING IT. Source control is such an important part of the software development process. No "serious" software project should be without it. [1]: htt...
For a friendly explanation of most of the basic concepts, see [A Visual Guide to Version Control][1]. The article is very SVN-friendly. [1]: http://betterexplained.com/articles/a-visual-guide-to-version-control/ "Better Explained: A Visual Guide to Version Control"
While I haven't used a flash object inside a windows form application myself, I do know that it's possible. In Visual studio on your toolbox, choose to add a new component. Then in the new window that appears choose the **"COM Components"** tab to get a list in which you can find the **"Shockwave Flash Object"** O...
The # char is indexed as punctuation and therefore ignored, so it looks like we'll remove the letter C from our word indexing ignore lists. Tested it locally after doing that and rebuilding the indexes and I get results!
The # char is indexed as punctuation and therefore ignored, so it looks like we'll remove the letter C from our word indexing ignore lists. Tested it locally after doing that and rebuilding the indexes and I get results! Looking at using a different word breaker language on the indexed column, so that those speci...
The # char is indexed as punctuation and therefore ignored, so it looks like we'll remove the letter C from our word indexing ignore lists. Tested it locally after doing that and rebuilding the indexes and I get results! Looking at using a different word breaker language on the indexed column, so that those speci...
[Sven][1], you reached the same conclusion as I did: I found the Shockwave Flash Object, all be it from a slightly different route, but was stumped on how to load the files from somewhere other than file on disk/URL. The F-IN-BOX, although just a wrapper of the Shockwave Flash Object seems to provide much more function...
Creating tempory folders
|.net|io|
I am working on a program that needs to create a multiple temporary folders for the application. These will not be seen by the user. The app is written in VB.net. I can think of a few ways to do it such as incremental folder name or random numbered folder names, but I was wondering, how other people solve this problem?
For a platform like the PSP, I'd worry slightly about the performance of an IM GUI solution. With a traditional retained mode type of solution, when you create a control, you can also create the vertex buffer/display list or what-have-you required to render it. With an immediate mode solution, it seems to me that you'd...
I'm assuming with id:* you're just trying to match all documents, right? I've never used solr before, but in my Lucene experience, when ingesting data, we've added a hidden field to every document, then when we need to return every record we do a search for the string constant in that field that's the same for every...
There are multiple issues here as ikvm is currently being transitioned away from the GNU classpath system to Sun's OpenJDK. Both are licensed as GPL+Exceptions to state explicitly that applications which merely use the OpenJDK libraries will not be considered derived works. Generally speaking, applications which re...
I was going to say that, I didn't think that Silverlight 2's HttpWebRequest supported streaming, because the request data gets buffered into memory entirely. It had been a while since the last time I looked at it though, therefore I went back to see if Beta 2 supported it. Well turns out it does. I am glad I went ba...
I was going to say that, I didn't think that Silverlight 2's HttpWebRequest supported streaming, because the request data gets buffered into memory entirely. It had been a while since the last time I looked at it though, therefore I went back to see if Beta 2 supported it. Well turns out it does. I am glad I went ba...
A .NET event isn't actually an object, it's an endpoint represented by two functions -- one for adding and one for removing a handler. That's why the compiler won't let you do anything other than += (which represents the add) or -= (which represents the remove). The only way to refer to an event for metaprogramming...
Wordpress MediaWiki Cookie Integration
|php|wordpress|lamp|mediawiki|
I have my Wordpress install and MediaWiki [sharing the same login information][1]. Unfortunately users need to log into both separately, but at least they use the same credentials. What I would like to do is cause a successful log in on the Wordpress blog to also cause a log in for MediaWiki (ideally both directi...
It goes something like: from t1 in db.Table1 join t2 in db.Table2 on t1.field equals t2.field select new { t1.field2, t2.field3} It would be nice to have sensible names and fields for your tables for a better example. :)
It goes something like: from t1 in db.Table1 join t2 in db.Table2 on t1.field equals t2.field select new { t1.field2, t2.field3} It would be nice to have sensible names and fields for your tables for a better example. :) **Update** I think for your query this might be more appropriate: ...
To instantiate A::v, the compiler needs to know the concrete type of B. If you're trying to minimize the amount of #included baggage to improve compile times, there are two things you can do, which are really variations of each other: 1. Use a pointer to B 2. Use a lightweight [proxy][1] to B [1]: http:...
[Sven][1], you reached the same conclusion as I did: I found the Shockwave Flash Object, all be it from a slightly different route, but was stumped on how to load the files from somewhere other than file on disk/URL. The F-IN-BOX, although just a wrapper of the Shockwave Flash Object seems to provide much more function...
Displaying Flash content in a C# WinForms application
|c#|flash|winforms|
What is the best way to display Flash content in a C# WinForms application? I would like to create a user control (similar to the current PictureBox) that will be able to display images and flash content. It would be great to be able to load the flash content from a stream of sorts rather than a file on disk.
|c#|winforms|flash|adobe|macromedia|
Process size on UNIX
|unix|size|
What is the correct way to get the process size on Solaris, HP-UX and AIX? Should we use top or ps -o vsz or something else?
You tried old builds, but is there a reason you can't keep going further back in the repository history and seeing exactly when the bug was introduced? Otherwise, I would suggest adding simple logging of some kind to help track down the problem, though I am at a loss of what specifically you might want to log. If...
My first choice would be a dedicated heap tool such as [pageheap.exe](http://support.microsoft.com/default.aspx?scid=kb;en-us;286470). Rewriting new and delete might be useful, but that doesn't catch the allocs committed by lower-level code. If this is what you want, better to Detour the low-level alloc APIs using M...
Rex, I suspect a good place to start looking is solutions that **compress the ViewState** -- they're grabbing ViewState on the server before it's sent down to the client and gzipping it. That's exactly where you want to be. - [Scott Hanselman on ViewState Compression](http://www.hanselman.com/blog/CommentView,guid,f...
|c#|performance|loops|
I have been told that there is a performance difference between the following code blocks. foreach (Entity e in entityList) { .... } and for (int i=0; i<entityList.Count; i++) { Entity e = (Entity)entityList[i]; ... } where List<Entity> entityList; ...
I was going to post an answer similar to Ugh. I would suggest putting a small TXT file describing the image source (and perhaps a small copyright statement, if one applies) into the image in a manner that is difficult to detect and break.
I'm aware of [ffmpeg][1], but it is native C code only. If you're ok with interoperability this may be your ticket. Edit: It turns out someone already wrapped this in a .NET assembly. It's called [FFlib.NET][2]. [1]: http://ffmpeg.mplayerhq.hu/ [2]: http://www.intuitive.sk/fflib/
How to start learning JAVA for use with Oracle RDBMS?
|java|oracle-database|
I am looking for some advice on what should I concentrate my efforts to get the needed skills to become a Java developer for Oracle applications. I'm bit confused as there are lot of technologies in the Java world. Where should I start? What to avoid? Is JDeveloper a good IDE for a beginner?
foreach creates an instance of an enumerator (returned from GetEnumerator) and that enumerator also keeps state throughout the course of the foreach loop. It then repeatedly calls for the Next() object on the enumerator and runs your code for each object it returns. They don't boil down to the same code in any way, ...
[Here][1] is a good article that shows the IL differences between the two loops. Foreach is technically slower however much easier to use and easier to read. Unless performance is critical I prefer the foreach loop over the for loop. [1]: http://www.codeproject.com/KB/cs/foreach.aspx
You should be able to do everything related to Oracle using [JDBC][1], so make sure you bone up on that API. Other than that, it depends on the type of application. Standalone apps may use Swing (the Java UI toolkit) or in the future JavaFX, which is supposed to make Swing obsolete and may do so in a few years. Web/...
The compiler needs to know how big "B" is before it can generate the appropriate layout information. If instead, you said `std::vector<B*>`, then the compiler wouldn't need to know how big B is because it knows how big a pointer is.
Ultimately you always have a finite max of heap to use no matter what platform you are running on. In Windows 32 bit this is around 2gb (not specifically heap but total amount of memory per process). It just happens that Java happens to make the default smaller (presumably so that the programmer can't create programs t...
The reason you can't use a forward declaration is because the size of B is unknown. There's no reason in your example that you can't include B.h inside of A.h, so what problem are you really trying to solve? **Edit:** There's another way to solve this problem, too: stop using C/C++! It's so 1970s... ;)
Since I don't know how your factory method looks like, all I can advise right now is to 1. Check to see the object is the correct concrete implementation you were looking for: IMyInterface fromFactory = factory.create(...); Assert.assertTrue(fromFactory instanceof MyInterfaceImpl1); 2. You can chec...
Since I don't know how your factory method looks like, all I can advise right now is to 1. Check to see the object is the correct concrete implementation you were looking for: IMyInterface fromFactory = factory.create(...); Assert.assertTrue(fromFactory instanceof MyInterfaceImpl1); 2. You ...
|deployment|
So, in your experience, whats the best way? Is there a secure way that's also scriptable/triggerable in a build automation tool?