input
stringlengths
51
42.3k
output
stringlengths
18
55k
What's the best HTML WYSISYG editor available to web developers and why? <p>There are many different flavored HTML WYSIWYG editors from javascript to ASP.Net web controls, but all too often the features are the same. Does anyone have a favorite HTML editor they like to use in projects? Why?</p>
<p>I'm partial to TinyMCE WYSIWYG editor due to the following reasons:</p> <ol> <li><p>Javascript - so it is broadly usable regardless of the platform I'm working in.</p></li> <li><p>Easy to use - just a couple lines of code and a textarea and the control is up and running.</p></li> <li><p>Easily themed - so I can qui...
Unit Testing C Code <p>I worked on an embedded system this summer written in straight C. It was an existing project that the company I work for had taken over. I have become quite accustomed to writing unit tests in Java using JUnit but was at a loss as to the best way to write unit tests for existing code (which nee...
<p>One unit testing framework in C is <a href="http://check.sourceforge.net/">Check</a>; a (<strong>LAST UPDATED ON 2008</strong>) list of unit testing frameworks in C can be found <a href="http://check.sourceforge.net/doc/check_html/check_2.html#SEC3">here</a> and is reproduced below. Depending on how many standard l...
Debugging VBO Vertex buffers crashes <p>I'm using the VBO extension for storing Vertex, normal and color buffers (glBindBufferARB) For some reason when changing buffers or doing some operation the application crashes with an access violation. When attaching The debugger I see that the crash is in some thread that is no...
<p>Assuming this is about Windows, NVIDIA has a <a href="http://developer.nvidia.com/object/glexpert_home.html" rel="nofollow">GLExpert</a> tool. It can print various OpenGL warnings/errors.</p> <p>In some other cases, using <a href="http://glintercept.nutty.org/" rel="nofollow">GLIntercept</a> OpenGL call interceptor...
Importing Access data into SQL Server using ColdFusion <p>This should be simple. I'm trying to import data from Access into SQL Server. I don't have direct access to the SQL Server database - it's on GoDaddy and they only allow web access. So I can't use the Management Studio tools, or other third-party Access upsizing...
<p>Try using the <a href="http://blog.godaddyhosting.com/2007/07/20/presentingdrum-roll-please-the-ms-sql-backuprestore-feature.aspx" rel="nofollow">GoDaddy SQL backup/restore tool</a> to get a local copy of the database. At that point, use the <a href="http://www.microsoft.com/technet/prodtechnol/sql/2000/deploy/dtssq...
What is the best way to randomize an array's order in PHP without using the shuffle() function? <p>I was asked this question in a job interview. The interviewer and I disagreed on what the correct answer was. I'm wondering if anyone has any data on this.</p> <p>Update: I should have mentioned that the use of shuffle()...
<p>shuffle($arr); :)</p> <p>edit: I should clarify... my definition of best involves not just algorithm efficiency but code readability and maintainability as well. Using standard library functions means maintaining less code and reading much less too. Beyond that, you can get into year-long debates with PhD professor...
Anyone know of a list of delegates already built into the framework? <p>I find myself writing delegates occasionally for really simple functions (take no arguments and return void for example) and am wondering if anyone knows someplace that has compiled a list of all the predefined delegates already available in the .N...
<p>Just look in the msdn database for (T) delegate.</p> <p>Here you got a direct link: <a href="http://social.msdn.microsoft.com/Search/en-us/?Query=(T)%20delegate">List of delegates</a></p> <p>That should get you started.</p>
Application Level Replication Technologies <p>I am building out a solution that will be deployed in multiple data centers in multiple regions around the world, with each data center having a replicated copy of data actively updated in each region. I will have a combination of multiple databases and file systems in each...
<p>Lotus/ Domino is your answer. I've been working with it for ten years and its exactly what you need. It may not be trendy (a perception that I would challenge) but its powerful, adaptable and very secure, The latest version R8 is the best yet.</p>
Perl aids for regression testing <p>Is there a Perl module that allows me to view diffs between actual and reference output of programs (or functions)? The test fails if there are differences.</p> <p>Also, in case there are differences but the output is OK (because the functionality has changed) I want to be able to c...
<p>Perl has excellent utilities for doing testing. The most commonly used module is probably Test::More, which provides all the infrastructure you're likely to need for writing regression tests. The prove utility provides an easy interface for running test suites and summarizing the results. The Test::Differences modul...
How do you launch the JavaScript debugger in Google Chrome? <p>When using Google Chrome, I want to debug some JavaScript code. How can I do that?</p>
<p>Try adding this to your source:</p> <pre><code>debugger; </code></pre> <p>It works in most, if not all browsers. Just place it somewhere in your code, and it will act like a breakpoint.</p>
When does System.gc() do anything <p>I know that garbage collection is automated in Java. But I understood that if you write <code>System.gc()</code> in your code the Java VM may or may not decide at runtime to do a garbage collection at that point. How does this work precisely? On what basis/parameters exactly does th...
<p>In practice, it <em>usually</em> decides to do a garbage collection. The answer varies depending on lots of factors, like which JVM you're running on, which mode it's in, and which garbage collection algorithm it's using. </p> <p>I wouldn't depend on it in your code. If the JVM is about to throw an OutOfMemoryEr...
How can I create a site in php and have it generate a static version? <p>For a particular project I have, no server side code is allowed. How can I create the web site in php (with includes, conditionals, etc) and then have that converted into a static html site that I can give to the client?</p> <p>Update: Thanks to ...
<p>If you have a Linux system available to you use <a href="http://www.gnu.org/software/wget/">wget</a>:</p> <pre><code>wget -k -K -E -r -l 10 -p -N -F -nH http://website.com/ </code></pre> <p>Options</p> <ul> <li>-k : convert links to relative</li> <li>-K : keep an original versions of files without the conversion...
Are there any tools to visualize a RDF graph? (please include a screenshot) <p>I'm looking for a tool that will render a RDF graph in a reasonably useful graphic format. The primary purpose of the graphic format being inclusion into a PowerPoint slide or printing on a large plotter for management review.</p> <p>I am ...
<p><a href="http://semweb.salzburgresearch.at/apps/rdf-gravity/index.html">RDF Gravity</a> is an RDF visualisation tool.</p> <p>Here's a screenshot: <img src="http://semweb.salzburgresearch.at/apps/rdf-gravity/html/owl_ontology_1.jpg" alt="RDF Gravity Screenshot" /></p>
How do I create a new signal in pygtk <p>I've created a python object, but I want to send signals on it. I made it inherit from gobject.GObject, but there doesn't seem to be any way to create a new signal on my object.</p>
<p>You can also define signals inside the class definition:</p> <pre><code>class MyGObjectClass(gobject.GObject): __gsignals__ = { "some-signal": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )), } </code></pre> <p>The contents of the tuple are the the same as the three last arguments to <code>...
How to control the capitalization of month and day names returned by DateFormat? <p>Here is a quick test program:</p> <pre><code> public static void main( String[] args ) { Date date = Calendar.getInstance().getTime(); System.out.println("Months:"); printDate( "MMMM", "en", date ); printDate( "MMMM...
<p>Not all languages share english capitalization rules. I guess you'd need to alter the data used by the API, but your non-english clients might not appreciate it...</p> <p><a href="http://french.about.com/library/writing/bl-capitalization.htm">about.com on french capitalization</a></p>
Why is RSpec so slow under Rails? <p>Whenever I run rspec tests for my Rails application it takes forever and a day of overhead before it actually starts running tests. Why is rspec so slow? Is there a way to speed up Rails' initial load or single out the part of my Rails app I need (e.g. ActiveRecord stuff only) so ...
<p>I definitely suggest checking out spork.</p> <p><a href="http://spork.rubyforge.org/">http://spork.rubyforge.org/</a></p> <p>The railstutorial specifically addresses this, and gives a workaround to get spork running nicely in rails 3.0 (as of this moment, spork is not rails 3 ready out of the box). Of course, if ...
Promising alternatives to make? <p>I've been using make and makefiles for many many years, and although the concept is sound, the implementation has something to be desired.</p> <p>Has anyone found any good alternatives to make that don't overcomplicate the problem?</p>
<p>check out <a href="http://www.scons.org/">SCons</a>. For example Doom 3 and Blender make uses of it.</p>
Custom style with Qt <p>Has anybody experience in building a custom style in Qt? What I have in my mind is a complete new style that affects all kind of widgets. I have seen some examples in the web for a custom combo box. But I have no idea how much time and code it takes to build a "complete" new custom style ... may...
<p>Check out the <a href="http://doc.qt.io/qt-4.8/stylesheet.html" rel="nofollow">Stylesheets</a> facility in Qt 4. While it's still a hassle, it's way easier than doing a full-on custom style. You can just adjust one visual facet at a time and try it out.</p> <p>It pays attention to inheritance. So if you style th...
Integration of JavaScript and JMS <p>Where can I find a guide for integrating JavaScript and JMS (Java Messaging Service)?</p> <p>I would like a best practice or established technology that allows me to directly or indirectly receive messages from a topic and update a site based on the message. I was thinking of creat...
<p>I think <a href="http://activemq.apache.org/ajax.html" rel="nofollow">this</a> is your answer. Looks like it is baked in to ActieMQ. I tried the examples and they seem to work.</p> <p><a href="http://activemq.apache.org/ajax.html" rel="nofollow">http://activemq.apache.org/ajax.html</a></p>
How do I run a program as nobody? <p>I want a user-privileged (not root) process to launch new processes as user <code>nobody</code>. I've tried a straight call to <code>setuid</code> that fails with -1 <code>EPERM</code> on <code>Ubuntu 8.04</code>:</p> <pre><code>#include &lt;sys/types.h&gt; #include &lt;unistd.h&gt...
<p>You <em>will</em> require assistance and a lot of trust from your system administrator. Ordinary users are not able to run the executable of their choice on behalf on other users, period.</p> <p>She may add your application to <code>/etc/sudoers</code> with proper settings and you'll be able to run it as with <cod...
How to test credit card interactions? <p>After reading <a href="http://stackoverflow.com/questions/63668/confessions-of-your-worst-wtf-moment-what-not-to-do#63730">this answer</a>, I wonder if there's a way to get a "testing" credit card number. One that you can experiment with but that doesn't actually charge anythin...
<pre><code>MasterCard: 5431111111111111 Amex: 341111111111111 Discover: 6011601160116611 American Express (15 digits) 378282246310005 American Express (15 digits) 371449635398431 American Express Corporate (15 digits) 378734493671000 Diners Club (14 digits) 30569309025904 Diners Club (14 digits) 38520000023237 Disc...
Fast, Pixel Precision 2D Drawing API for Graphics App? <p>I woud like to create a cross-platform drawing program. The one requirement for writing my app is that I have pixel level precision over the canvas. For instance, I want to write my own line drawing algorithm rather than rely on someone elses. I do not want any ...
<p>The <a href="http://www.pyglet.org/" rel="nofollow">Pyglet</a> library for Python might suit your needs. It lets you use OpenGL, a cross-platform graphics API. You can disable anti-aliasing and capture regions of the screen to a buffer or a file. In addition, you can use its event handling, resource loading, and ima...
mod_python/MySQL error on INSERT with a lot of data: "OperationalError: (2006, 'MySQL server has gone away')" <p>When doing an INSERT with a lot of data, ie:</p> <pre><code>INSERT INTO table (mediumtext_field) VALUES ('...lots of text here: about 2MB worth...') </code></pre> <p>MySQL returns </p> <blockquote> <p>"...
<p>check the max_packet setting in your my.cnf file. this determines the largest amount of data you can send to your mysql server in a single statement. exceeding this values results in that error.</p>
Tool recommendation for converting VB to C# <p>We have a project with over 500,000 lines of VB.NET that we need to convert to C#. Any recommendations, based on experience, for tools to use? We are using Visual Studio 2008 and we're targeting 3.5 .</p>
<p>I would concur with the comment. You have 500,000 of tried and true VB.Net code. Why on earth would you waste any time changing that? No one says that you can't write all new components in C#. </p> <p>I would consider not worrying about a tool and instead ask yourself, truly, why you are doing this.</p>
Why doesn't BackColor work for TabControls in .NET? <p>If you use the standard tab control in .NET for your tab pages and you try to change the look and feel a little bit then you are able to change the back color of the tab pages but not for the tab control. The property is available, you could set it but it has no ef...
<p>The solution in Rajesh's blog is really useful, but it colours the tab part of the control only. In my case I had a tabcontrol on a different coloured background. The tabs themselves were grey which wasn't a problem, but the area to the right of the tabs was displaying as a grey strip. </p> <p>To change this colour...
Dynamically Create a generic type for template <p>I'm programming WCF using the ChannelFactory which expects a type in order to call the CreateChannel method. For example: </p> <pre><code>IProxy proxy = ChannelFactory&lt;IProxy&gt;.CreateChannel(...); </code></pre> <p>In my case I'm doing routing so I don't know what...
<p>What you are looking for is MakeGenericType</p> <pre><code>string elementTypeName = Console.ReadLine(); Type elementType = Type.GetType(elementTypeName); Type[] types = new Type[] { elementType }; Type listType = typeof(List&lt;&gt;); Type genericType = listType.MakeGenericType(types); IProxy proxy = (IProxy)Acti...
Why does sed fail with International characters and how to fix? <p>GNU sed version 4.1.5 seems to fail with International chars. Here is my input file:</p> <p>Gras Och Stenar Trad - From Moja to Minneapolis DVD [G2007DVD] 7812 | X <br> Gras Och Stenar Trad - From Möja to Minneapolis DVD [G2007DVD] 7812 | Y</p> <p>(N...
<p>I think the error occurs if the input encoding of the file is different from the preferred encoding of your environment. </p> <p>Example: <code>in</code> is UTF-8</p> <pre><code>$ LANG=de_DE.UTF-8 sed 's/.*| //' &lt; in X Y $ LANG=de_DE.iso88591 sed 's/.*| //' &lt; in X Y </code></pre> <p>UTF-8 can safely be int...
Other than Xcode, are there any full functioned IDEs for Objective-C? <p>I know and have Xcode, but I was wondering if there were any other complete development environments that support Objective-C? I'm not looking for solutions with vim or emacs, nor editors like BBEdit that support syntax highlighting, but a full fl...
<p>I recently learned that <a href="http://www.jetbrains.com/">Jetbrains</a> the make of my favorite IDE (Idea) may support Objective-C (though it is unclear how much it will work for iPhone/iPad development). See the thread <a href="http://www.jetbrains.net/devnet/thread/282271?tstart=0">here</a> for early discussion ...
Perl Sys::Syslog on Solaris <p>Has anyone got <a href="http://perldoc.perl.org/Sys/Syslog.html" rel="nofollow">Sys::Syslog</a> to work on Solaris? (I'm running Sys::Syslog 0.05 on Perl v5.8.4 on SunOS 5.10 on SPARC). Here's what doesn't work for me:</p> <pre><code>openlog "myprog", "pid", "user" or die; syslog "crit...
<p>By default, Sys::Syslog is going to try to connect with one of the following socket types:</p> <pre><code>[ 'tcp', 'udp', 'unix', 'stream' ] </code></pre> <p>On Solaris, though, you'll need to use an inet socket. Call:</p> <pre><code>setlogsock('inet', $hostname); </code></pre> <p>and things should start workin...
Where can I find an example burn-down / planning game template? <p>I'd like to experiment with burn-down and planning game with the team I'm on. People on my team are interested in making it happen, however I'm sure someone has done this before and has learned some lessons we hopefully don't have to repeat. Does anyo...
<p><a href="http://blogs.msdn.com/progressive_development/archive/2008/02/19/motley-says-what-are-we-burning-down-your-house-scrum-part-v.aspx" rel="nofollow">This MSDN Blog article</a> Has quite a good review of using burndowns in combination with Cumulative Flow Diagrams which fleshes out the diagrams even more. In t...
Is there any way to pass a structure type to a c function <p>I have some code with multiple functions very similar to each other to look up an item in a list based on the contents of one field in a structure. The only difference between the functions is the type of the structure that the look up is occurring in. If I...
<p>If you ensure that the field is placed in the same place in each such structure, you can simply cast a pointer to get at the field. This technique is used in lots of low level system libraries e.g. BSD sockets.</p> <pre><code>struct person { int index; }; struct clown { int index; char *hat; }; /* we're not...
How to debug a JSP tomcat service using eclipse? <p>I would like to debug my separately running JSP/Struts/Tomcat/Hibernate application stack using the Eclipse IDE debugger. How do I setup the java JVM and eclipse so that I can set breakpoints, monitor variable values, and see the code that is currently executing?</p>
<p>I just Googled it. :)</p> <p><a href="http://bugs.sakaiproject.org/confluence/display/BOOT/Setting+Up+Tomcat+For+Remote+Debugging">http://bugs.sakaiproject.org/confluence/display/BOOT/Setting+Up+Tomcat+For+Remote+Debugging</a></p> <p>Many more on google.</p> <p>Effectively, set your JPDA settings: set JPDA_ADDRE...
What's the best way to hash a url in ruby? <p>I'm writing a web app that points to external links. I'm looking to create a non-sequential, non-guessable id for each document that I can use in the URL. I did the obvious thing: treating the url as a string and str#crypt on it, but that seems to choke on any non-alphanumb...
<p>Depending on how long a string you would like you can use a few alternatives:</p> <pre><code>require 'digest' Digest.hexencode('http://foo-bar.com/yay/?foo=bar&amp;a=22') # "687474703a2f2f666f6f2d6261722e636f6d2f7961792f3f666f6f3d62617226613d3232" require 'digest/md5' Digest::MD5.hexdigest('http://foo-bar.com/yay/...
How do I register a custom type converter in Spring? <p>I need to pass a UUID instance via http request parameter. Spring needs a custom type converter (from String) to be registered. How do I register one?</p>
<p>Please see chapter 5 of the spring reference manual here: <a href="http://static.springframework.org/spring/docs/2.5.x/reference/validation.html#beans-beans-conversion-customeditor-registration" rel="nofollow">5.4.2.1. Registering additional custom PropertyEditors</a></p>
Wildcards for resources in a Tomcat Servlet's context.xml <p>I'm not overly familiar with Tomcat, but my team has inherited a complex project that revolves around a Java Servlet being hosted in Tomcat across many servers. Custom configuration management software is used to write out the server.xml, and various resource...
<p>I don't know if it's what you require, but perhaps you may want to investigate creating your own custom resource factory for Tomcat. Here is the general documentation for all things resources via Tomcat: <a href="http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html" rel="nofollow">Tomcat Resources</a><...
How Long Do You Keep Your Code? <p>I took a data structures class in C++ last year, and consequently implemented all the major data structures in templated code. I saved it all on a flash drive because I have a feeling that at some point in my life, I'll use it again. I imagine <em>something</em> I end up programming...
<p>Forever (or as close as I can get). That's the whole point of a source control system.</p>
Is it possible to get a core dump of a running process and its symbol table? <p>Is it possible to get gdb or use some other tools to create a core dump of a running process and it's symbol table? It would be great if there's a way to do this without terminating the process. </p> <p>If this is possible, what commands...
<pre> $ gdb --pid=26426 (gdb) gcore Saved corefile core.26426 (gdb) detach </pre>
What level of complexity requires a framework? <p>At what level of complexity is it mandatory to switch to an existing framework for web development?</p> <p>What measurement of complexity is practical for web development? Code length? Feature list? Database Size?</p>
<p>If you work on several different sites then by using a common framework across all of them you can spend time working on the code rather than trying to remember what is located where and why.</p> <p>I'd always use a framework of some sort, even if it's your own, as the uniformity will help you structure your projec...
How to start/plan a software project for data collection on a PDA/handheld device <p>A friend is having mysterious health problems that we're trying to track down. One thing that would help would be to improve his record keeping by giving him a handheld device with which he could keep track of various details of his d...
<p>DataViz offers a program for PalmOS called <a href="http://www.dataviz.com/products/smartlisttogo/index.html" rel="nofollow">SmartListToGo</a>. It hasn't been updated in a while, but if you're basically collecting data, you can design forms/tables with minimal programming knowledge. I've used it to keep track of mil...
Text Centering Using CSS not working in IE <p>I am having problems getting text within a table to appear centered in IE. </p> <p>In Firefox 2, 3 and Safari everything work fine, but for some reason, the text doesn't appear centered in IE 6 or 7. </p> <p>I'm using:</p> <pre class="lang-css prettyprint-override"><code...
<p>Can we see more code? My first hunch is the table cell needs the text-align: center.</p>
Are tuples more efficient than lists in Python? <p>Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements? </p>
<p>In general, you might expect tuples to be slightly faster. However you should definitely test your specific case (if the difference might impact the performance of your program -- remember "premature optimization is the root of all evil").</p> <p>Python makes this very easy: <a href="https://docs.python.org/2/libr...
Can you have a class in a struct? <p>Is it possible in C# to have a Struct with a member variable which is a Class type? If so, where does the information get stored, on the Stack, the Heap, or both?</p>
<p>Yes, you can. The pointer to the class member variable is stored <strike>on the stack</strike> with the rest of the struct's values, and the class instance's data is stored on the heap.</p> <p>Structs can also contain class definitions as members (inner classes).</p> <p>Here's some really useless code that at lea...
How do you write a C# Extension Method for a Generically Typed Class <p>This should hopefully be a simple one.</p> <p>I would like to add an extension method to the System.Web.Mvc.ViewPage&lt; T > class.</p> <p>How should this extension method look?</p> <p>My first intuitive thought is something like this:</p> <pre...
<p>I don't have VS installed on my current machine, but I think the syntax would be:</p> <pre><code>namespace System.Web.Mvc { public static class ViewPageExtensions { public static string GetDefaultPageTitle&lt;T&gt;(this ViewPage&lt;T&gt; v) { return ""; } } } </code><...
Visual Studio basicHttpBinding and endpoint problems <p>I have a WPF application in VS 2008 with some web service references. For varying reasons (max message size, authentication methods) I need to manually define a number of settings in the WPF client's app.config for the service bindings.</p> <p>Unfortunately, this...
<p>Create a .Bat file which uses svcutil, for proxygeneration, that has the settings that is right for your project. It's fairly easy. Clicking on the batfile, to generate new proxyfiles whenever the interface have been changed is easy.</p> <p>The batch can then later be used in automated builds. Then you only need to...
In Applescript, how can I find out if a menu item is selected/focused? <p>I have a script for OS X 10.5 that focuses the Search box in the Help menu of any application. I have it on a key combination and, much like Spotlight, I want it to toggle when I run the script. So, I want to detect if the search box is already...
<p>The built in key shortcut cmd-? already behaves like this. It moves key focus to the help menu's search field if it is not already focused, and otherwise dismisses the menu.</p>
Agile project and amount of Documentation <p>What kind of documentation you'd recommend to support for Agile project? What are the core metrics you use to detect amount of documentation needed? Do you think you can store all of project info as TFS work items?</p>
<p><strong>Create documentation that speeds up communication and helps you move faster.</strong> Let the principle of "Mutual Benefit" guide you.</p> <ul> <li>Adoption documents: "NewPerson handbook". Getting started with any "framework" or niche tools you are using. <em>The best way might be to get the first bunch of...
A snippet to monitor the last INSERT/UPDATE in an Oracle DB from C#? <p>I'm looking for a simple, sample snippet of C# code to monitor an Oracle database and basically check for its last update. It could be either command line (great for future integration with Nagios) or GUI. I've did some prototypes but the code tend...
<p>One possible solution is:</p> <ol> <li><p>Add a DATE field that represents the last update time to MY_TABLE table.</p> <p><code>ALTER TABLE my_table ADD (last_update_time DATE);</code></p></li> <li><p>Create an index on that field.</p> <p><code>CREATE INDEX i_my_table_upd_time ON my_table (last_update_time);</cod...
Why does a C/C++ program often have optimization turned off in debug mode? <p>In most C or C++ environments, there is a "debug" mode and a "release" mode compilation.<br /> Looking at the difference between the two, you find that the debug mode adds the debug symbols (often the -g option on lots of compilers) but it al...
<p>Without any optimization on, the flow through your code is linear. If you are on line 5 and single step, you step to line 6. With optimization on, you can get instruction re-ordering, loop unrolling and all sorts of optimizations.<br> For example:</p> <pre><code> void foo() { 1: int i; 2: for(i = 0; i &lt 2; ) ...
Zend PHP debugger: How can I start debugging a page using a get argument? <p>I am trying out the debugger built into <code>Zend studio</code>. It seems great! One thing though, when I start a page using the debugger does anyone know how I can set a request get argument within the page?</p> <p>For example, I don't wa...
<p>I recommend getting the <a href="http://www.zend.com/en/products/studio/downloads" rel="nofollow">Zend Studio Toolbar</a>. The extension allows you to control which pages are debugged from within the browser instead of from Zend Studio. The options for debugging let you debug the next page, the next form post or al...
Is there a way to make text unselectable on an HTML page? <p>I'm building an HTML UI with some text elements, such as tab names, which look bad when selected. Unfortunately, it's very easy for a user to double-click a tab name, which selects it by default in many browsers.</p> <p>I might be able to solve this with a J...
<p>In most browsers, this can be achieved using CSS:</p> <pre class="lang-css prettyprint-override"><code>*.unselectable { -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; /* Introduced in IE 10. See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/ */ ...
What Safari-specific pure CSS hacks are out there? <p>I'm wondering if there's any way to write CSS specifically for Safari using only CSS. I know there has to be something out there, but I haven't found it yet.</p>
<p>I think the question is valid. I agree with the other responses, but it doesn't mean it's a terrible question. I've only ever had to use a Safari CSS hack once as a temporary solution and later got rid of it. I agree that you shouldn't have to target just Safari, but no harm in knowing how to do it.</p> <p>FYI, thi...
Getting The XML Data Inside Custom XPath function <p>Is there a way to get the current xml data when we make our own custom XPath function (see here).</p> <p>I know you have access to an <code>XPathContext</code> but is this enough?</p> <p><strong>Example:</strong></p> <p>Our XML:</p> <pre><code>&lt;foo&gt; &lt;b...
<p>What about <strike>select the current node</strike> selecting the relevant data from the current node into an XSL parameter, and passing that parameter to the function? Like:</p> <pre><code>&lt;xsl:value-of select="ourFunction($data)" /&gt; </code></pre>
How do I change the background color in gnuplot? <p>I have a script that renders graphs in gnuplot. The graphs all end up with an ugly white background. How do I change this? (Ideally, with a command that goes into a gnuplot script, as opposed to a command-line option or something in a settings file)</p>
<p>You can change the background color by command <code>set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"green" behind</code> to set the background color to the the color you specified (here is green).</p> <p>To get more knowledge about setting the background in gnuplot, you can visit this <a href="...
What is a good regression testing framework for software applications? <p>Am looking for a regression test framework where I can add tests to.. Tests could be any sort of binaries that poke an application..</p>
<p>This really depends on what you're trying to do, but one of the features of the new <a href="http://search.cpan.org/dist/Test-Harness/" rel="nofollow">Test::Harness</a> (disclaimer: I'm the original author and still a core developer) is that if your tests output TAP (the Test Anything Protocol), you can use Test::Ha...
Are there any noted differences in appearance rendering of html and xhtml in Google Chrome from other browsers? <p>Are there any noted differences in appearance rendering of html and xhtml in Google Chrome from Firefox? From IE? From other browsers/what browser does it render the code the most similar to?</p>
<p>Since it's based on WebKit, its rendering will most closely resemble Safari and Konqueror.</p>
Hidden Markov Models <p>I want to get started on HMM's, but don't know how to go about it. Can people here, give me some basic pointers, where to look?</p> <p>More than just the theory, I like to do a lot of hands-on. So, would prefer resources, where I can write small code snippets to check my learning, rather than j...
<p>Have you tried: Russel and Norvig's Artificial Intelligence: A Modern Approach. </p> <p>I realise that this is heavy on theory, but it also contains useful code samples that can be used to help your learning.</p> <p>You can also check out: <a href="http://www.kanungo.com/software/software.html" rel="nofollow">http...
visually customize autocomplete in Wicket <p>How can I visually customize autocomplete fields in Wicket (change colors, fonts, etc.)?</p>
<p>You can use CSS to modify the look of this component. For the Ajax auto-complete component in 1.3 the element you want to override is div.wicket-aa, so for example you might do:</p> <pre><code>div.wicket-aa { background-color:white; border:1px solid #CCCCCC; color:black; } div.wicket-aa ul { list-st...
What do the flags in a Maildir message filename mean? <p>I'm cleaning up some old Maildir folders, and finding messages with names like:</p> <p>1095812260.M625118P61205V0300FF04I002DC537_0.redoak.cise.ufl.edu,S=2576:2,ST</p> <p>They don't show up in my IMAP client, so I presume there's some semaphore indicating the m...
<p>The 'M' is just part of the unique filename and has nothing to do with the fact that the mail doesn't show up in mail clients. </p> <p>The 'T' at the end of the filename, after the ':' sign, however tells the IMAP server that this message is Trashed.</p> <p>See <a href="http://cr.yp.to/proto/maildir.html" rel="nof...
What attributes help runtime .Net performance? <p>I am looking for attributes I can use to ensure the best runtime performance for my .Net application by giving hints to the loader, JIT compiler or ngen.</p> <p>For example we have <a href="http://msdn.microsoft.com/en-us/library/k2wxda47.aspx">DebuggableAttribute</a> ...
<p>Ecma-335 specifies some more CompilationRelaxations for relaxed exception handling (so-called e-relaxed calls) in Annex F "Imprecise faults", but they have not been exposed by Microsoft.</p> <p>Specifically CompilationRelaxations.RelaxedArrayExceptions and CompilationRelaxations.RelaxedNullReferenceException are me...
In a client-server application: How to send to the DB the user's application password? <p>I have an Java desktop application wich connects directly with the DB (an Oracle). The application has multiple user accounts. What is the correct method to send the user's password (not DB password) over the network? I don't want...
<p>You could connect over a secure socket connection, or hash the password locally before sending it to the database (or better, both) - Ideally, the only time the password should exist in plain text form is prior to hashing. If you can do all of that on the client side, more the better.</p>
Is it worth encrypting email addresses in the database? <p>I'm already using <a href="http://www.matasano.com/log/958/enough-with-the-rainbow-tables-what-you-need-to-know-about-secure-password-schemes/">salted hashing</a> to store passwords in my database, which means that I should be immune to <a href="http://en.wikip...
<p>Bruce Schneier has a good response to this kind of problem.</p> <blockquote> <p>Cryptography is not the solution to your security problems. It might be part of the solution, or it might be part of the problem. In many situations, cryptography starts out by making the problem worse, and it isn't at all clear that ...
Can we achieve 100% decoupling? <p>Can we achieve 100% decoupling between components of a system or different systems that communicate with each other? I don't think its possible. If two systems communicate with each other then there should be some degree of coupling between them. Am I right?</p>
<p>If components are 100% decoupled, it means that they don't communicate with each other.</p> <p>Actually there are <a href="http://en.wikipedia.org/wiki/Coupling_%28computer_science%29" rel="nofollow">different types of coupling</a>. But the general idea is that objects are not coupled if they don't depend on each o...
How do I compare phrases for similarity? <p>When entering a question, stackoverflow presents you with a list of questions that it thinks likely to cover the same topic. I have seen similar features on other sites or in other programs, too (Help file systems, for example), but I've never programmed something like this m...
<p>One approach is the so called bag-of-words model.</p> <p>As you guessed, first you count how many times words appear in the text (usually called document in the NLP-lingo). Then you throw out the so called stop words, such as "the", "a", "or" and so on.</p> <p>You're left with words and word counts. Do this for a ...
Logging image downloads <p>I'm trying to find a way of finding out who is downloading what image from an image gallery. Users can download using a button beside the thumbnail or right click and use the "save link as" Is it possible to relate a user session or ID to a "save link as" action from all browsers using either...
<p>Yes, my preferred way of doing this would be via PHP. You'd have to set up a script which would load up the file and send it to the user browser. This script would also be able to log the download somewhere (e.g. your database).</p> <p>For example - in very rough pseudo-code:</p> <p>download.php</p> <pre><code>$f...
What is this strange C code format? <p>What advantage, if any, is provided by formatting C code as follows:</p> <pre><code>while(lock_file(lockdir)==0) { count++; if(count==20) { fprintf(stderr,"Can't lock dir %s\n",lockdir); exit(1); } sleep(3); } if(rmdir(serverdir...
<p>The top example is know as "Whitesmiths style". <a href="http://en.wikipedia.org/wiki/Indent_style">Wikipedia's entry on Indent Styles</a> explains several styles along with their advantages and disadvantages.</p>
deleting a buffer through a different type of pointer? <p>Say I have the following C++:</p> <pre><code>char *p = new char[cb]; SOME_STRUCT *pSS = (SOME_STRUCT *) p; delete pSS; </code></pre> <p>Is this safe according to the C++ standard? Do I need to cast back to a <code>char*</code> and then use <code>delete[]</code...
<p>It's not guaranteed to be safe. Here's a relevant link in the C++ FAQ lite:</p> <p>[16.13] Can I drop the <code>[]</code> when deleting array of some built-in type (<code>char</code>, <code>int</code>, etc.)?</p> <p><a href="https://isocpp.org/wiki/faq/freestore-mgmt#delete-array" rel="nofollow">http://www.parash...
Extracting text from a PDF using JBoss Richfaces <p>I am trying to write a web-app to manage references for my PhD thesis.</p> <p>I used to manage this information inside a personal Confluence (fantastic tool! - <a href="http://www.atlassian.com/software/confluence/" rel="nofollow">http://www.atlassian.com/software/co...
<p>Try using the <a href="http://livedemo.exadel.com/richfaces-demo/richfaces/paint2D.jsf?c=paint2d&amp;tab=usage" rel="nofollow">RichFaces Paint 2D</a> tag</p> <p>It exposes the <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics2D.html" rel="nofollow">Graphics2D</a> package to the user interface.</p> ...
Help in creating Zip files from .Net and reading them from Java <p>I'm trying to create a Zip file from .Net that can be read from Java code.</p> <p>I've used SharpZipLib to create the Zip file but also if the file generated is valid according to the CheckZip function of the #ZipLib library and can be successfully unc...
<p>I have used <a href="http://www.codeplex.com/DotNetZip" rel="nofollow">DotNetZip library</a> and it seems to work properly. Typical code:</p> <pre><code>using (ZipFile zipFile = new ZipFile()) { zipFile.AddDirectory(sourceFolderPath); zipFile.Save(archiveFolderName); } </code></pre>
Can I add maven repositories in the command line? <p>I'm aware I can add maven repositories for fetching dependencies in ~/.m2/settings.xml. But is it possible to add a repository using command line, something like:</p> <pre><code>mvn install -Dmaven.repository=http://example.com/maven2 </code></pre> <p>The reason I ...
<p>You can do this but you're probably better off doing it in the POM as others have said.</p> <p>On the command line you can specify a property for the local repository, and another repository for the remote repositories. The remote repository will have all default settings though</p> <p>The example below specifies ...
Tool to test Website accessibility <p>Can you suggest a tool for testing accessibility and section 508/ADA compliance of a Website with MS Share Point and .Net 2.0 as the underlying platform?</p>
<p>In my experience, testing Sharepoint for accessibility is not worth it. Even if you've used the Accessibility Toolkit for Sharepoint (AKS) with Sharepoint 2007, the end result is far from accessible.</p> <p>The trouble is that accessibility was not, and still is not a big consideration for MS when they made Sharepo...
How can I find last row that contains data in the Excel sheet with a macro? <p>How can I find the last row that contains data in a specific column and on a specific sheet?</p>
<p>How about:</p> <pre><code> Sub GetLastRow(strSheet, strColum) Dim MyRange As Range Dim lngLastRow As Long Set MyRange = Worksheets(strSheet).Range(strColum &amp; "1") lngLastRow = Cells(Rows.Count, MyRange.Column).End(xlUp).Row End Sub </code></pre> <p>Re Comment</p> <p>This</p> <pre><code> Cells.F...
Set a UserControl Property to Not Show Up in VS Properties Window <p>I have a UserControl in my Asp.net project that has a public property. I do not want this property to show up in the Visual Studio Property Window when a user highlights an instance of the UserControl in the IDE. What attribute (or other method) shoul...
<p>Use the following attribute ...</p> <pre><code>using System.ComponentModel; [Browsable(false)] public bool SampleProperty { get; set; } </code></pre> <p>In VB.net, this <a href="http://stackoverflow.com/questions/71440/set-a-usercontrol-property-to-not-show-up-in-vs-properties-window#71481">will be</a>:</p> <pre...
How to display the progress of a server script in jQuery? <p>With this code I can show an animated gif while the server script is running:</p> <pre><code>function calculateTotals() { $('#results').load('getResults.php', null, showStatusFinished); showLoadStatus(); } function showLoadStatus() { $('#status'...
<p>After reading your comments to Andrew's answer.</p> <p>You would read the status like this:</p> <pre><code>function getStatus() { $.getJSON("/status.php",{"session":0, "requestID":12345}, function(data) { //data is the returned JSON object from the server {name:"value"} setStatus(data.status); ...
How do I make the lights stay fixed in the world with Direct3D <p>I've been using OpenGL for years, but after trying to use D3D for the first time, I wasted a significant amount of time trying figure out how to make my scene lights stay fixed in the world rather than fixed on my objects.</p> <p>In OpenGL light positio...
<p>The answer I discovered eventually was that while OpenGL only has its one amalgamated <code>MODELVIEW</code> matrix, in D3D the "world" and "view" transforms are kept separate, and placing lights seems to be the major reason for this. So the answer is you use <code>D3DTS_VIEW</code> to set up matrices that should a...
Java Applet crashes .NET Webbrowsercontrol <p>in our application we have a Java applet running inside a .NET browser control. It is a know issue from Sun that running an applet this way may crash the control.</p> <p>Has anyone come across the same problem and solved it?</p> <p>Atm we are running the applet in a Webbr...
<p>After some time the problem solved itself. It was indeed a bug in the java runtime which is now fixed by sun. Just make sure your JRE is > 1.6.10.</p>
Determine the size of a pipe without calling read() <p>I need a function called SizeOfPipe() which should return the size of a pipe- I only want to know how much data is in the pipe and not actually read data off the pipe itself. </p> <p>I thought the following code would work</p> <pre><code>fseek (pPipe, 0 , SEEK_EN...
<p>Depending on your unix implementation ioctl/FIONREAD might do the trick</p> <pre> err = ioctl(pipedesc, FIONREAD, &bytesAvailable); </pre> <p>Unless this returns the error code for "invalid argument" (or any other error) bytesAvailable contains the amount of data available for unblocking read operations at that ti...
How to implement a Digg-like algorithm? <p>How to implement a website with a recommendation system similar to stackoverflow/digg/reddit? I.e., users submit content and the website needs to calculate some sort of "hotness" according to how popular the item is. The flow is as follows:</p> <ul> <li>Users submit content</...
<p>You could use something similar to the <a href="http://redflavor.com/reddit.cf.algorithm.png">Reddit algorithm</a> - the basic principle of which is you compute a value for a post based on the time it was posted and the score. What's neat about the Reddit algorithm is that you only need recompute the value when the ...
How do you efficiently copy BSTR to wchar_t[]? <p>I have a BSTR object that I would like to convert to copy to a wchar__t object. The tricky thing is the length of the BSTR object could be anywhere from a few kilobytes to a few hundred kilobytes. Is there an efficient way of copying the data across? I know I could just...
<p>First, you might not actually have to do anything at all, if all you need to do is read the contents. A BSTR type is a pointer to a null-terminated wchar_t array already. In fact, if you check the headers, you will find that BSTR is essentially defined as:</p> <pre><code>typedef BSTR wchar_t*; </code></pre> <p>So,...
C++ overload resolution <p>Given the following example, why do I have to explicitly use the statement <code>b-&gt;A::DoSomething()</code> rather than just <code>b-&gt;DoSomething()</code>?</p> <p>Shouldn't the compiler's overload resolution figure out which method I'm talking about?</p> <p>I'm using Microsoft VS 2005...
<p>The two “overloads” aren't in the same scope. By default, the compiler only considers the smallest possible name scope until it finds a name match. Argument matching is done <em>afterwards</em>. In your case this means that the compiler sees <code>B::DoSomething</code>. It then tries to match the argument list, ...
Problem with SET FMTONLY ON <p>I'm executing stored procedures using SET FMTONLY ON, in order to emulate what our code generator does. However, it seems that the results are cached when executed like this, as I'm still getting a <em>Conversion failed</em> error from a proc that I have just dropped! This happens even w...
<p>Some statements will still be executed, even with <strong><code>SET FMTONLY ON</code></strong>. You "Conversion failed" error could be from something as simple as a <code>set variable</code> statement in the stored proc. For example, this returns the metadata for the first query, but throws an exception when it ru...
How to implement "DOM Ready" event in a GreaseMonkey script? <p>I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires.</p> <p>I'm using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609</p> <p><a href="http://stackoverflow.com/questions/59205/enhanc...
<p>So I googled <a href="http://www.google.com/search?q=greasemonkey%20dom%20ready">greasemonkey dom ready</a> and the <a href="http://www.sitepoint.com/article/beat-website-greasemonkey/">first result</a> seemed to say that the greasemonkey script is actually running at "DOM ready" so you just need to remove the onloa...
Mocking constructors in Ruby <p>I'm a Java-developer toying with Ruby, and loving it. I have understood that because of Ruby's metaprogramming facilities my unit-tests become much cleaner and I don't need nasty mocking frameworks. I have a class which needs the <code>File</code> class's services and in my test I don't ...
<p>Mocha (<a href="http://mocha.rubyforge.org/">http://mocha.rubyforge.org/</a>) is a very good mocking library for ruby. Depending on what you're actually wanting to test (i.e. if you want to just fake out the File.new call to avoid the file system dependency or if you want to verify that the correct arguments are pa...
How to Call BizTalk Orchestration Dynamically <p>How can I call a BizTalk Orchestration dynamically knowing the Orchestration name? The call Orchestration shapes need to know the name and parameters of Orchestrations at design time. I've tried using 'call' XLang keyword but it also required Orchestration name as Desig...
<p>The way I've accomplished something similar in the past is by using direct binding ports in the orchestrations and letting the MsgBox do the dirty work for me. Basically, it goes something like this:</p> <ol> <li>Make the callable orchestrations use a direct-bound port attached to your activating receive shape.</li...
How to use the "is" operator in System.Type variables? <p>here is what a I'm doing: </p> <pre><code>object ReturnMatch(System.Type type) { foreach(object obj in myObjects) { if (obj == type) { return obj; } } } </code></pre> <p>However, if obj is a subc...
<p>I've used the IsAssignableFrom method when faced with this problem.</p> <pre><code>Type theTypeWeWant; // From argument or whatever foreach (object o in myCollection) { if (theTypeWeWant.IsAssignableFrom(o.GetType)) return o; } </code></pre> <p>Another approach that may or may not work with your probl...
Speech Recognition for Searching Files <p>Here is the problem I have:</p> <p>I have a lot (tens of thousands) of mp3 files that my users would like to be able to search. Is there is software out there that you've used or heard good things about that would allow me to index that content and put it in a database so I ca...
<p>There's an open source library <a href="http://cmusphinx.sourceforge.net/html/cmusphinx.php" rel="nofollow">Sphinx</a></p>
Storing content in multiple languages? E.g. English, French, German <p>How should I store (and present) the text on a website intended for worldwide use, with several languages? The content is mostly in the form of 500+ word articles, although I will need to translate tiny snippets of text on each page too (such as "pr...
<p>Firstly put all code for all languages under one domain - it will help your google-rank.</p> <p>We have a fully multi-lingual system, with localisations stored in a database but cached with the web application.</p> <p>Wherever we want a localisation to appear we use:</p> <pre><code>&lt;%$ Resources: LanguageProvi...
Is a software token a valid second factor in multi-factor security? <p>We are changing our remote log-in security process at my workplace, and we are concerned that the new system does not use <a href="http://en.wikipedia.org/wiki/Two-factor_authentication" rel="nofollow">multi-factor authentication</a> as the old one ...
<p>I would say "no". I don't think you can really get the "something you have" part of multi-factor authentication without issuing something the end user can carry with them. If you "have" something, it implies it can be lost - not many users lose their entire desktop machines. The security of "something you have", aft...
Making a C#/Winform application cross-platform - should I use AIR, Mono, or something else? <p>I have an app that I've written in C#/WinForms (<a href="http://www.thekbase.com" rel="nofollow" title="TheKBase">my little app</a>). To make it cross-platform, I'm thinking of redoing it in Adobe AIR. Are there any arguments...
<p>As far as my experience in Flex/AIR/Flash actionscripting goes, Adobe AIR development environment and coding/debugging toolsets are far inferior to the Visual Studio and .NET SDK as of the moment. The UI toolsets are superior though.</p> <p>But as <em>you already have a working C# code</em>, porting it to ActionScr...
Modal dialogs in IE gets hidden behind IE if user clicks on IE pane <p>I have to write an applet that brings up a password dialog. The problem is that dialog is set to be always on top but when user clicks on IE window dialog gets hidden behind IE window nevertheless. And since dialog is modal and holds <strong>all</st...
<p>Make a background Thread that calls toFront on the Dialog every 2 seconds. Code that we use (I hope I got everything):</p> <pre><code>class TestClass { protected void toFrontTimer(JFrame frame) { try { bringToFrontTimer = new java.util.Timer(); bringToFrontTask = new BringToFrontTask(frame); ...
How can I show scrollbars on a System.Windows.Forms.TextBox only when the text doesn't fit? <p>For a System.Windows.Forms.TextBox with Multiline=True, I'd like to only show the scrollbars when the text doesn't fit.</p> <p>This is a readonly textbox used only for display. It's a TextBox so that users can copy the text...
<p>I came across this question when I wanted to solve the same problem. </p> <p>The easiest way to do it is to change to System.Windows.Forms.RichTextBox. The ScrollBars property in this case can be left to the default value of RichTextBoxScrollBars.Both, which indicates "Display both a horizontal and a vertical scrol...
Firefox, saved passwords, and the change password dialogue <p>If a user saves the password on the login form, ff3 is putting the saved password in the change password dialoge on the profile page, even though its <strong>not the same input name</strong> as the login. how can I prevent this?</p>
<p>Try using autocomplete="off" as an attribute of the text box. I've used it in the past to stop credit card details being stored by the browser but i dont know if it works with passwords. e.g. <code>print("&lt;input type="text" name="cc" autocomplete="off" /&gt;");</code></p>
What is your choice for a Time Managment Solution? <p>I've come across a few different applications that monitor my usage while on the computer, but what have you used, and like? whether it be writing down your activities in a composition notbook or install an app that reports silently to a server? what do you like?</p...
<p>For explicit time tracking for projects I use <a href="http://slimtimer.com" rel="nofollow">SlimTimer</a>. I also run <a href="http://www.rescuetime.com/" rel="nofollow">RescueTime</a> to track my time implicitly, but I end up not looking at that data very often.</p>
How to set the header sort glyph in a .NET ListView? <p>How do I set the column which has the header sort glyph, and its direction, in a .NET 2.0 WinForms ListView?</p> <h2>Bump</h2> <p>The listview is .net is not a managed control, it is a very thin wrapper around the Win32 ListView common control. It's not even a v...
<p>In case someone needs a quick solution (it draws up/down arrow at the beginning of column header text):</p> <p><strong>ListViewExtensions.cs:</strong></p> <pre><code>public static class ListViewExtensions { public static void DrawSortArrow(this ListView listView, SortOrder sortOrder, int colIndex) { ...
How to gracefully deal with ViewState errors? <p>I'm running some c# .net pages with various gridviews. If I ever leave any of them alone in a web browser for an extended period of time (usually overnight), I get the following error when I click any element on the page.</p> <p>I'm not really sure where to start dealin...
<p>That is odd as the ViewState is stored as a string in the webpage itself. So I do not see how an extended period of time would cause that error. Perhaps one or more objects on the page have been garbage collected or the application reset, so the viewstate is referencing old controls instead of the controls created...
How do I send an SMTP Message from Java? <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/46663/how-do-you-send-email-from-a-java-app-using-gmail">How do you send email from a Java app using Gmail?</a> </p> </blockquote> <p>How do I send an SMTP Message from J...
<p>Here's an example for Gmail smtp:</p> <pre><code>/* * */ import java.io.*; import java.net.InetAddress; import java.util.Properties; import java.util.Date; import javax.mail.*; import javax.mail.internet.*; import com.sun.mail.smtp.*; public class Distribution { public static void main(String args[]) t...
Is there a console for Windows Mobile devices? <p>I would like to write small console based applications on Windows Mobile. What console applications might I use?</p>
<p>See this article: <a href="http://www.walkingrandomly.com/?p=22" rel="nofollow">Pocket Console on Windows Mobile 6</a></p>
Linux desktop shortcut and icon from install <p>What do I need to add to my <code>.spec</code> file to create the desktop shortcut and assign an icon to the shortcut during install of my <code>.rpm</code>? If a script is required, an example would be very helpful.</p>
<p>You use a .desktop file for icons under linux. Where to put the icon depends on what distribution and what desktop environment you are using. Since I'm currently running Gnome on Fedora 9, I will answer it in those terms.</p> <p>An example foo.desktop file would be:</p> <pre><code>[Desktop Entry] Encoding=UTF-8 ...
Combine PDFs c# <p>How can I combine multiple PDFs into one PDF without a 3rd party component?</p>
<p>I don't think you can. Opensource component PDFSharp has that functionality, and a nice <a href="http://www.pdfsharp.com/PDFsharp/index.php?option=com_content&amp;task=view&amp;id=24&amp;Itemid=35" title="source sample">source code sample on file combining</a></p>
Dropdownlist width in IE <p>In IE, the dropdown-list takes the same width as the dropbox (I hope I am making sense) whereas in Firefox the dropdown-list's width varies according to the content. </p> <p>This basically means that I have to make sure that the dropbox is wide enough to display the longest selection possib...
<p>Here's another <a href="http://jquery.com">jQuery</a> based example. In contrary to all the other answers posted here, it takes all keyboard and mouse events into account, especially clicks:</p> <pre><code>if (!$.support.leadingWhitespace) { // if IE6/7/8 $('select.wide') .bind('focus mouseover', functi...
What is the difference between explicit and implicit cursors in Oracle? <p>I am a bit rusty on my cursor lingo in PL/SQL. Anyone know this?</p>
<p>An implicit cursor is one created "automatically" for you by Oracle when you execute a query. It is simpler to code, but suffers from </p> <ul> <li>inefficiency (the ANSI standard specifies that it must fetch twice to check if there is more than one record)</li> <li>vulnerability to data errors (if you ever get two...
Generate thumbnail with white border <p>I need to generate thumbnails from a set of jpg's that need to have a small white border so that they appear to be "photos" when displayed on a map. Getting the thumbnails themselves is easy but I can't figure out how to get the border.</p>
<p>Here's a quick hack:</p> <pre><code>public Image AppendBorder(Image original, int borderWidth) { var borderColor = Color.White; var newSize = new Size( original.Width + borderWidth * 2, original.Height + borderWidth * 2); var img = new Bitmap(newSize.Width, newSize.Height); var g =...