instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Prefixing variable and method names with an underscore is a common convention for marking things as private. Why does all the methods on the page tracker class in the Google Analytics tracking code (<code>ga.js</code>) start with an underscore, even the ones that are clearly public, like <code>_getTracker</code> and... | <p>Because Google can't be bothered to follow the <a href="http://yuiblog.com/blog/2007/06/12/module-pattern/" rel="noreferrer">Module Pattern</a> and therefore they don't want accidental collisions in the global namespace?</p>
| <p>I've always read this like so:</p>
<p>If the property/method is prefixed with an underscore, it is for some "internal" workings. Therefore if you are about to use/call/alter this property/method, you had better darn well know what you are doing, and or expect it to possibly be renamed/removed in a future release.<... | 8,407 |
<p>In .NET is there a function that tests if a string is syntactically a correct path? I specifically don't want it to test if the path actually exists.</p>
<p>my current take on this is a regex:</p>
<pre><code>([a-zA-Z]:|\\)?\\?([^/\\:*?"<>|]+[/\\])*[^/\\:*?"<>|]*
</code></pre>
<p>matches:</p>
<pre><co... | <p>I'd suggest just using a regex for this since you specifically don't want to test if the path exists.</p>
<p>Here's something <a href="http://regexlib.com/REDetails.aspx?regexp_id=425" rel="nofollow noreferrer">google helped me dig up</a>:</p>
<pre><code>RegEx="^([a-zA-Z]\:|\\\\[^\/\\:*?"<>|]+\\[^\/\\:*?"<... | <p>You might be able to use System.IO.Path and the GetInvalidPathChars() function?</p>
| 39,529 |
<p>What's a good algorithm to solve this problem?</p>
<p>I have three groups of people - group A, group B, and group C. There are the same number of people in each group. They each have a list of people in the other groups that they're willing to work with. I want to group all these people together in groups of 3 (one... | <p>This is like the stable marriage problem, but with 3 parties instead of two.</p>
<p>Have a look at efficient solutions for former problem (bi-partite graph matching) and adapt them to your needs.</p>
<p><a href="http://en.wikipedia.org/wiki/Stable_marriage_problem" rel="noreferrer">http://en.wikipedia.org/wiki/Sta... | <p>To start with, you can eliminate any facts where the two parties have disjoint lists of who they will work with in the third group. Then start a brute force, depth first search, always picking from least popular to most popular.</p>
<p>Alternatively, equivalent to the above elimination, form a list of all possible... | 37,613 |
<p>My application is receiving email through SMTP server. There are one or more attachments in the email and email attachment return as byte[] (using sun javamail api).</p>
<p>I am trying to zip the attachment files on the fly without writing them to disk first.</p>
<p>What is/are possible way to achieve this outcome... | <p>You can use Java's java.util.zip.ZipOutputStream to create a zip file in memory. For example:</p>
<pre><code>public static byte[] zipBytes(String filename, byte[] input) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream zos = new ZipOutputStream(baos);
ZipEn... | <p>Maybe the <a href="http://java.sun.com/j2se/1.3/docs/api/java/util/zip/package-summary.html" rel="nofollow noreferrer">java.util.zip</a> package might help you</p>
<p>Since you're asking about how to convert from byte array I think (not tested) you can use the ByteArrayInputStream method</p>
<pre><code>int rea... | 46,665 |
<p>I need to validate this simple pick list:</p>
<pre><code><select name="<%= key %>">
<option value="ETC" SELECTED>Select an option...</option>
<option value="ONE">Lorem ipsum</option>
<option value="TWO">dolor sit amet</option>
</select>
</code></pre>... | <p>You can never really satisfy the condition 'never submit a given value' because you don't have control over the client side. The user can always manipulate HTML to submit whatever they want.</p>
<p>It is a good approach is to use JavaScript to do client-side validation and give the user quick feedback and catch 99... | <p>Nowadays you usually don't validate in JSPs, because they only visualize whatever was processed earlier. So the only validation that you do "in jsps" is usually Javascript. For the rest (the real validation) I second what Pete answered: You have to do it serverside in whatever technique you are using there. When it'... | 16,414 |
<p>Lets say my alphabet contains X letters and my language supports only Y letter words (Y < X ofcourse). I need to generate all the words possible in random order.</p>
<p>E.g.
Alphabet=a,b,c,d,e,f,g
Y=3</p>
<p>So the words would be:
aaa
aab
aac
aba
..
bbb
ccc
..
(the above should be generated in random order)</p>... | <p>As other answers have implied, there's two main approaches: 1) track what you've already generated (the proposed solutions in this category suffer from possibly never terminating), or 2) track what permutations have yet to be produced (which implies that the permutations must be pre-generated which was specifically... | <p>I think you can do something pretty straightforward by generating a random array of characters based on the alphabet you have (in c#):</p>
<pre><code> char[] alphabet = {'a', 'b', 'c', 'd'};
int wordLength = 3;
Random rand = new Random();
for (int i = 0; i < 5; i++)
{
... | 47,877 |
<p>What is the difference between <strong>CodeFile</strong>="file.ascx.cs" and <strong>CodeBehind</strong>="file.ascx.cs" in the declaration of a ASP.NET user control?</p>
<p>Is one newer or recommended? Or do they have specific usage?</p>
| <p><strong>CodeBehind</strong>: Needs to be compiled (ASP.NET 1.1 model). The compiled binary is placed in the bin folder of the website. You need to do a compile in Visual Studio before you deploy. It's a good model when you don't want the source code to be viewable as plain text. For example when delivering to a cust... | <p>Codebehind file need to compile before run but in src we dont need to compile and then run.. just save the file.</p>
| 9,864 |
<p>I'm developing a web app using Java servlet to access Mysql db, how can I get the number of connections to my DB that is currently open ?</p>
<p>Edit :</p>
<p>I tried "show processlist", it showed me : 2695159, but that's not right, I'm just developing this new project, I'm the only user, couldn't have that many p... | <p>Depending on your MySQL version, you can perform a select on </p>
<p><code>SELECT COUNT(*) FROM information_schema.PROCESSLIST;</code></p>
<p>and you can do a <code>where</code> between the user, database, and host IP.</p>
<p>For example:</p>
<pre><code>USE information_schema;
SELECT COUNT(*) FROM PROCESSLIST WH... | <p>You may use this</p>
<p>SHOW GLOBAL STATUS;
or
show global status like "Threads_connected";</p>
<p>from Connections status you can findout total number of connections.</p>
| 33,926 |
<p>I've got a class that I'm using as a settings class that is serialized into an XML file that administrators can then edit to change settings in the application. (The settings are a little more complex than the <code>App.config</code> allows for.)</p>
<p>I'm using the <code>XmlSerializer</code> class to deserialize ... | <p>You have to use a mutable list type, like ArrayList (or IList IIRC).</p>
| <p>@leppie's response was actually the closest. This is the actual relevant text in the XmlSerializer documentation and see my edit to the question above for more details:</p>
<blockquote>
<p>The XmlSerializer gives special treatment to classes that implement IEnumerable or ICollection. A class that implements IEnu... | 16,189 |
<p>Here's an interesting puzzle.</p>
<p>I downloaded Snippet Compiler to try some stuff out, and wanted to write the following code:</p>
<pre><code>using System;
using System.Collections.Generic;
public class MyClass
{
public static void RunSnippet()
{
HashSet<int> h = new HashSet<int>();... | <p>Check what version of System.Core.dll Snippet Compiler is using.</p>
| <p>Check what version of System.Core.dll Snippet Compiler is using.</p>
| 43,948 |
<p>I am writing a project in C++ for an embedded system with no OS support; almost no library support. Very bare-metal. Hence, a fair amount of my code is tightly coupled(e.g., software triggered interrupts and the layer directly above them).</p>
<p>Part of what I am doing involves changing the serial port configurati... | <p>The lack of infrastructure in a bare metal environment is pretty challenging. I'd recommend you focus on debugging tools. Even with great care and excellent methodology, you'll need the ability to debug things.</p>
<p>It would behoove you to get gdbagent working. You'll need to implement this yourself, but it is a ... | <p>One thing I've done with some success was to design a PC environment where code can be compiled with C++ for the PC and tested, and then later compiled with "straight" C to run on the embedded system. I/O port references are #defined to be property accesses for an I/O object, which are then sent via socket to a "ha... | 22,905 |
<p>I am attempting to create new membership users in an Ektron CMS400.NET-based website by through calls to the User web service API from a remote site. One of the methods I intend to utilize, <a href="http://www.ektron.com/manuals/cms400/v70/API_Help/frames.html?frmname=topic&frmfile=Ektron_Services_User_AddMember... | <p>I've done this with Ektron 6.13,6.15,6.18,7.03 and 7.04, in each version they radically changed/broke the API in many different and interesting ways. I can give you an answer for each of those versions, but my advice is to put a membership control on a page and use that to create a user while logging the SQL that ha... | <p>From what I can make of their documentation you should be able to make the call as long as you path the login credentials via the AuthenicationheaderValue object. You might need to call login first as well, it is possible they are tracking session on their side somehow.</p>
| 33,358 |
<p><strong>Before you put duplicate from this <a href="https://3dprinting.stackexchange.com/questions/147/which-are-the-food-safe-materials-and-how-do-i-recognize-them">Which are the food-safe materials and how do I recognize them?</a> please read</strong> </p>
<p>I need to know if <a href="http://store.printm3d.com/#... | <p>In general, PLA is known as a "food safe" filament, especially <strong><em>Natural PLA</em></strong>. However, filament suppliers have different processes that may detriment the food safe quality.</p>
<p>Doing a little digging, I found <a href="https://printm3d.com/solutions/article.php?id=47" rel="noreferrer">an a... | <p>In general no filament is safe as the printing process leaves "nooks and cranies" between the layers where germs can gain a foothold.</p>
<p>For food safe, I would advise:</p>
<ul>
<li>print with white filament</li>
<li>use an acetone vapor bath to smooth and melt many of the "nooks and cranies" away.</li>
<li>Use... | 256 |
<ul>
<li>Printer: Kobra Max</li>
<li>Nozzle: 0.4 mm</li>
<li>Material: PLA</li>
<li>Slicer :Cura</li>
</ul>
<p>I have printed 1 model 3 times with different settings (different temperatures and different bed temperatures).</p>
<ul>
<li>Try 1: 190 °C / 50 °C</li>
<li>Try 2: 210 °C / 70 °C</li>
<li>Try 3: 230 °C / 50 °C<... | <p>There are a bunch of possible causes for the seam. But the main one is retraction.</p>
<p>In Cura the main setting affecting this is under '<strong>Travel</strong>'.</p>
<p>In the '<strong>Travel</strong>' settings is '<strong>Enable retraction</strong>', and '<strong>Retract at layer change</strong>'.</p>
<p>Retrac... | <p>Hiding the seam isn't really possible when the object is rotationally symmetric. The closest you can get is hiding it "statistically" by distributing the seam randomly so it's fractionally-bad everywhere rather than fully-bad in one place. Depending on your needs, this might be good, or it might be awful. ... | 2,214 |
<p>I have a client application that connects to the MySQL database 4 server using stock libraries on SuSE SLES 9. However, at times when processing a particular reset set from the server, iterating throw the results does not allow me to process all the results that is in the database. </p>
<p>This issue happens somet... | <p>Anything is possible, however I'd be inclined to go with app-level issues by default. Any problem that smells like it could be memory related is a prime candidate for a heap corruption bug if you're coding in C/C++, and that could cause result set problems. Also, I'm curious about how long you're holding this resu... | <p>You may think about upgrading to MySQL 5.<br>
It's usually good to have the latest version.</p>
| 36,174 |
<p>The title pretty much sums it up, and I'm sure there's a perfectly valid explanation,<br>
but it seems extremly odd that loading pages(after they're compiled) on my local computer seems to take forever, when the same code is blistering fast when "live".</p>
<p>I'm developing on Vista, IIS7, pretty ok hardware; whil... | <p>If you are using FireFox or Safari and you are on Windows Vista then you should <em>disable</em> IP version 6 since this messes with Vista in combination with WebDev and FireFox/Safari...</p>
<p>In FF type in <em>about:config</em> in the address bar, filter for "IPv6" and set enabled to FALSE!</p>
<p>This is a bug... | <p>Have you considered that it may be because of caching? i.e. pages on the production server are cached, and those on localhost are not cached.</p>
<p>I also agree with terjetyl it is possible that your localhost cannot find a linked file (eg javascript source file), your firewall could be blocking these....</p>
| 40,927 |
<p>Im sure this has happened to folks before, something works in debug mode, you compile in release, and something breaks.</p>
<p>This happened to me while working on a Embedded XP environment, the best way i found to do it really was to write a log file to determine where it would go wrong.</p>
<p>What are your expe... | <p>Make sure you have good debug symbols available (you can do this even with a release build, even on embedded devices). You should be able to get a stack trace and hopefully the values of some variables. A good knowledge of assembly language is probably also useful at this point.</p>
<p>My experience is that general... | <p>If it's only a small portion of the application that needs debugging then you can change those source files only to be built without optimisations. Presumably you generate debug info for all builds, and so this makes the application run mostly as it would in release, but allows you to debug the interesting parts pr... | 5,341 |
<p>My simplified and contrived example is the following:-</p>
<p>Lets say that I want to measure and store the temperature (and other values) of all the worlds' towns on a daily basis. I am looking for an optimal way of storing the data so that it is just as easy to get the current temperature in all the towns, as it ... | <p>it DEPENDS on the applications usage patterns... If usage patterns indicate that the historical data will be queried more often than the current values, then put them all in one table... But if Historical queries are the exception, (or less than 10% of the queries), and the performance of the more common current va... | <p>I would use a single table with index views to provide me with the latest information. SQL 2005 and 2008 server are designed for data warehousing so should preform well under this condition.</p>
<p>If you have a data pattern that requires writing to the db often, then the best choice would be to have an active tab... | 37,857 |
<p>I have a ArrayList made up of different elements imported from a db, made up of strings, numbers, doubles and ints. Is there a way to use a reflection type technique to find out what each type of data each element holds? </p>
<p>FYI: The reason that there is so many types of data is that this is a piece of java co... | <p>In C#:<br/>Fixed with recommendation from <a href="https://stackoverflow.com/users/14359/mike-brown">Mike</a></p>
<pre><code>ArrayList list = ...;
// List<object> list = ...;
foreach (object o in list) {
if (o is int) {
HandleInt((int)o);
}
else if (o is string) {
HandleString((str... | <p>You say "this is a piece of java code being written", from which I infer that there is still a chance that you could design it a different way. </p>
<p>Having an ArrayList is like having a collection of stuff. Rather than force the instanceof or getClass every time you take an object from the list, why not design... | 13,181 |
<p>I have a web page that needs to display a sqlite database. Right now i am creating the entire page dynamically through CGI. However, I would rather have one html file and just populate a table within the file with the database content. What is the best method to do that? I am limited to html, javascript and CGI in C... | <p>If your content is updated once a day (or hour, etc) then you could schedule the C code as a standalone application via cron to run. It reads in a "header" html template file, generated the table from the database, then copies the "footer" html template file. This generated file gets copied to the web server locatio... | <p>How much of this do you have working? Do you have your sqlite connection working in your C code? Writing a plain CGI app isn't difficult, just output your headers, especially Content-Type and preferably Content-Length(if you know it), and then just output the page.</p>
<p>As for a templating system, you can write ... | 48,651 |
<p>I'm using windbg to examine some crash dumps sent in by an app. There seems to be some correlation between a crash I'm seeing and having a certain 3rd party DLL loaded into the process (a flaky Winsock LSP, I suspect). To make this sort of analysis easier in the future, is there a windbg script that would just sho... | <p>Try using "lm e" with your symbol path set to Microsoft's symbol server (and with only MS symbols loaded). That will cause WinDbg to show a list of all modules with any sort of symbol "problem" including modules that have not been loaded.</p>
<p>The keys to making this work are:</p>
<ol>
<li>The sympath is only s... | <p>I'm not sure I see why you want to do this, but you can output from WinDbg to a log and correlate with a list of DLLs. That's pretty easy to do in any scripting language such as Perl, Python etc.</p>
| 47,869 |
<p>I am writing a program that needs to send out an email every hour on the hour, but at a time local to the user.</p>
<p>Say I have 2 users in different time zones. John is in New York and Fred is in Los Angeles. The server is in Chicago. If I want to send an email at 6 PM local to each user, I'd have to send the ema... | <p>If you access an intranet Web site by using an IP address or a fully qualified domain name , or a url with a dot in it the Web site may be identified as in the Internet zone instead of in the Local intranet zone.</p>
<p><a href="http://support.microsoft.com/kb/303650" rel="nofollow noreferrer">http://support.micros... | <p>If you access an intranet Web site by using an IP address or a fully qualified domain name , or a url with a dot in it the Web site may be identified as in the Internet zone instead of in the Local intranet zone.</p>
<p><a href="http://support.microsoft.com/kb/303650" rel="nofollow noreferrer">http://support.micros... | 4,230 |
<p>I have a WebChartControl on my web page. When the chart was generated, an image is being produced and it was shown on the page. </p>
<p>Is there a way to get and save this chart as an image output on runtime? </p>
| <p>Sure. Ultimately the image comes from a URL of some sort. Do a view-source on the web page and see what that URL looks like. With a certain amount of reverse-engineering, usage of System.Web.UI.HtmlTextWriter, perhaps an HttpHandler, etc. you should be able to get what you want.</p>
| <p>Use the ExportToImage method of the ChartControl object .. This is WinForm code, but the same concept should hold true for WebChartControl:</p>
<pre><code> Dim chart As ChartControl = ChartControl1.Clone()
chart.Size = New Size(800, 600)
chart.ExportToImage("file.png", System.Drawing.Imaging.ImageFormat.... | 6,867 |
<p>I used to understand "beta" as "feature-complete". Web applications rarely are ever feature-complete and rather evolve slowly with time. So does "beta" have any specific meaning with them or is it just a gimmick?</p>
| <p>In web 2.0 it does seem to mean nothing at all.</p>
| <p>Releasing a BETA version of a site, permits to understand if user like te mess you're making with interface, or just see that's failing.</p>
<p>Other examples:
For community, or like ,sites, it permits enstablishment of first population itself, even if not fully features.</p>
| 30,022 |
<p>If all of my <code>__init__.py</code> files are empty, do I have to store them into version control, or is there a way to make <code>distutils</code> create empty <code>__init__.py</code> files during installation?</p>
| <p>In Python, <code>__init__.py</code> files actually have a meaning! They mean that the folder they are in is a Python module. As such, they have a real role in your code and should most probably be stored in Version Control.</p>
<p>You could well imagine a folder in your source tree that is NOT a Python module, for ... | <p>In Python, <code>__init__.py</code> files actually have a meaning! They mean that the folder they are in is a Python module. As such, they have a real role in your code and should most probably be stored in Version Control.</p>
<p>You could well imagine a folder in your source tree that is NOT a Python module, for ... | 8,521 |
<p>Does anyone here have any useful code which uses reduce() function in python? Is there any code other than the usual + and * that we see in the examples?</p>
<p>Refer <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=98196" rel="noreferrer">Fate of reduce() in Python 3000</a> by GvR</p>
| <p>The other uses I've found for it besides + and * were with and and or, but now we have <code>any</code> and <code>all</code> to replace those cases. </p>
<p><code>foldl</code> and <code>foldr</code> do come up in Scheme a lot... </p>
<p>Here's some cute usages:</p>
<p><b>Flatten a list</b></p>
<p>Goal: turn <cod... | <p>Using reduce() to find out if a list of dates are consecutive:</p>
<pre><code>from datetime import date, timedelta
def checked(d1, d2):
"""
We assume the date list is sorted.
If d2 & d1 are different by 1, everything up to d2 is consecutive, so d2
can advance to the next reduction.
If d2 &... | 3,675 |
<p>I just started working for a pretty large company and my group manages all of their public facing websites. I opened the style sheet for the first time today and have seen over 20 instances of the designers using the voice-family hack to fix an IE bug. (I don't know why they allow graphic designers to write any kind... | <p>The "voice-family" hack, better known as the Tantek Celik Box Model Hack, is used to hide specific CSS rules from IE4/5 on Windows because of incorrect implementations of the CSS standard in those browsers. It is an attempt to deliver the most correct single stylesheet to all browsers, without resorting to browser s... | <p>My feeling on hacks like this is that you should avoid them if you can. If it is possible to get the correct rendering across browsers without resorting to such shenanigans, then you should do it the right way. However, sometimes browsers have buggy CSS implementations, and it is necessary to use hacks like this.<... | 19,104 |
<p>What is the best way to convert word HTML to word XML? I cannot buy a tool so need something preferably XSLT which is free and works suitably with basic formatting like paragraphs, lists, bold and italic.</p>
| <p>XSLT on its own won't do you any good if you want to retain any formatting from outside the XHTML file (for example, in external style sheets). Besides, Word has the ability to open (X)HTML files, and has for a while. It might not come out looking as good as the original, but it works.</p>
<p>In fact, if you have W... | <p>XSLT on its own won't do you any good if you want to retain any formatting from outside the XHTML file (for example, in external style sheets). Besides, Word has the ability to open (X)HTML files, and has for a while. It might not come out looking as good as the original, but it works.</p>
<p>In fact, if you have W... | 38,325 |
<p>If I create a recursive list of of lists:</p>
<pre><code>class myList
{
List<myList> childLists;
List<string> things;
//...
}
List<myList> tempList = new List<myList>();
</code></pre>
<p>And then later call tempList.Clear(), will it destroy all the childLists in memory, or should I ... | <p>If no <em>other</em> references exist to the child lists, they will be garbage collected as normal. The trick is to watch for any dangling references to the child items (databinding especially tends to go unnoticed once done).</p>
| <p>You can set the list object to null!
Check <a href="http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/31809230-83f6-4e86-9a33-ee7dc4ec2b10" rel="nofollow">http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/31809230-83f6-4e86-9a33-ee7dc4ec2b10</a></p>
| 35,193 |
<p>Running VS2003/05 under Vista makes the former screw up the display at least 50% of the time - you start debugging, VS kicks in and you see the windows/docking panes screwed up, not refreshing, etc... I've contacted Microsoft about this, but they weren't much help, I was wondering if someone knows any fixes?</p>
<p... | <p>For Visual Studio 2005 , install the
<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&displaylang=en" rel="nofollow noreferrer">Microsoft® Visual Studio® 2005 Service Pack 1</a></p>
<p>and the
<a href="http://www.microsoft.com/downloads/details.aspx?Family... | <p>I've done a lot with Visual Studio 2005 Express on Vista, and have never seen any display issues.</p>
<p>Vista is pretty sensitive to the quality of the video drivers - have you tried updating yours?</p>
| 15,394 |
<p>I have been learning more and more javascript; it's a necessity at my job. We have a web application that uses a lot of javascript and I will be doing more and more every day. I have read bits and pieces about design patterns, but was wondering if someone could just give me a cut and dry example and definition. Are ... | <p>Design patterns are generic and usually elegant solutions to well-known programming problems. Without knowing what problem you're working in, I would say "Yes" they can help make your code more manageable.</p>
<p><a href="https://addyosmani.com/resources/essentialjsdesignpatterns/book/" rel="nofollow nore... | <p>As design patterns are language agnostic, I would recommend reading one of the classic books on the subject. My favourites are:</p>
<ul>
<li>Patterns of Enterprise Application
Architecture by Martin Fowler
(<a href="https://rads.stackoverflow.com/amzn/click/com/0321127420" rel="nofollow noreferrer" rel="nofollow n... | 47,853 |
<p>I have created an asp.net website that connects to a SQL server database. Currently on my development machine I have the connection set to a SQL server express database with the file residing in the App_Data file of the website.</p>
<p>I now need to upload the site to my host of which I have an SQL server database ... | <pre><code>Server=mssql.mydomain.com;uid=user_id_goes_here;pwd=password_goes_here
</code></pre>
| <p>Initial Catalog=MyDatabase;Data Source=mssql.mydomain.com;User Id=MyUser;Password=MyPassword</p>
<p>Does this work?</p>
| 49,883 |
<p>I am binding a List to a DataGridView. One property of the SomeObject class will be a status code (ex. Red, Yellow, Green). Can I "bind" the status to the background color of a cell easily? How about binding to a tooltip also?</p>
| <p>You can write a handler for the DataGridView's CellFormatting event to customise the background colour. Here's a worked example (you'll need to have dragged a DataGridView onto the default Form then double-clicked on the CellFormatting event to create a handler):</p>
<pre><code>using System.Drawing;
using System.Wi... | <p>Out of the box, any DataGridViewColumn can be bound to only one property of the objects in the DataSource, the name of the property being given by the DataPropertyName of each DataGridViewColumn (you'll have specific column types like: DataGridViewTextBoxColumn, ...). </p>
<p>You could use the DataGridView.CellForm... | 44,007 |
<p>Sometimes when I am debugging code in Eclipse it happens that although I can see and inspect class member variables without any difficulty I am unable to inspect the values of variables declared locally within functions. As an aside, any parameters to the current function lose their 'real' names and instead one sees... | <p>Apparently, the <a href="http://dev.eclipse.org/newslists/news.eclipse.platform/msg56943.html" rel="noreferrer">answer</a> is:</p>
<blockquote>
<p>the rt.jar that ships with the JDK (where the core Java classes live) is not compiled with full debug information included in the .class files, so the debugger does not h... | <p>You can find the debug binaries for 1.6.0_25 at: <a href="http://download.java.net/jdk6/6u25/promoted/b03/index.html" rel="nofollow">http://download.java.net/jdk6/6u25/promoted/b03/index.html</a></p>
<p>This should let you debug into the Java library code for 1.6.</p>
| 34,148 |
<p>I am displaying Japanese characters in a VB6 application with the system locale set to Japan and the language for non Unicode programs as Japanese. A call to GetACP() correctly returns 932 for Japanese. When I insert the Japanese strings into my controls they display as “ƒAƒtƒŠƒJ‚Ì—‰¤” rather than “アフリカの女王”. If I... | <p>Expanding Bob's answer, here's some code to get the current default charset.</p>
<pre><code>Private Const LOCALE_SYSTEM_DEFAULT As Long = &H800
Private Const LOCALE_IDEFAULTANSICODEPAGE As Long = &H1004
Private Const TCI_SRCCODEPAGE = 2
Private Type FONTSIGNATURE
fsUsb(4) As Long
fsCsb(2) As Long
E... | <p>The second best way is to use a database of fonts, font.charsets, and heuristics, such as is done here:</p>
<p><a href="http://www.example-code.com/vb/vb6-display-unicode.asp" rel="nofollow noreferrer">http://www.example-code.com/vb/vb6-display-unicode.asp</a></p>
<p>(The <em>best</em> way is to get off the sinkin... | 49,474 |
<p>I am currently developing a Java app which handles a SOAP webservice. </p>
<p>The problem lies after I parse the WSDL [the <strong>Parser</strong> object from Apache Axis does it for me], and I create the call. </p>
<p>When I try to invoke it, I have to pass a Object[] to assign the parameters [taken from the Acti... | <p>Have you looked into using something like Spring's proxy functionality? You tell it a bit about the webservice in a spring config file, and all your client code has to deal with is an interface that you create - it doesn't even have to know that there is a web service on the other side!</p>
<p>Example Spring confi... | <p>We tried to use complex objects and Axis. Don't! We had a bunch of problems with Dotnet being able to create a correct object from the WSDL. We ended up just using primitives, strings, and arrays. If someone has a good method of using complex object I would love to hear it.</p>
| 31,305 |
<p>What is the best way to vertically center the content of a div when the height of the content is variable. In my particular case, the height of the container div is fixed, but it would be great if there were a solution that would work in cases where the container has a variable height as well. Also, I would love a ... | <p>Just add</p>
<pre><code>position: relative;
top: 50%;
transform: translateY(-50%);
</code></pre>
<p>to the inner div.</p>
<p>What it does is moving the inner div's top border to the half height of the outer div (<code>top: 50%;</code>) and then the inner div up by half its height (<code>transform: translateY(-50%... | <p>This is my awesome solution for a <code>div</code> with a dynamic (percentaged) height.</p>
<p><strong>CSS</strong></p>
<pre class="lang-css prettyprint-override"><code>.vertical_placer{
background:red;
position:absolute;
height:43%;
width:100%;
display: table;
}
.inner_placer{
display: table-cell... | 8,387 |
<p>I want to use jQuery to parse RSS feeds. Can this be done with the base jQuery library out of the box or will I need to use a plugin?</p>
| <p><strong>WARNING</strong></p>
<blockquote>
<p><a href="https://developers.google.com/feed/" rel="nofollow noreferrer">The Google Feed API</a> is officially <strong>deprecated</strong> and <strong>doesn't work anymore</strong>!</p>
</blockquote>
<hr>
<p>No need for a whole plugin. This will return your RSS as a J... | <p>jFeed is easy and has an <a href="https://github.com/jfhovinne/jFeed/blob/master/example.html" rel="nofollow">example</a> for you to test. But if you're parsing a feed from another server, you'll need to allow <a href="http://en.wikipedia.org/wiki/Cross-origin_resource_sharing" rel="nofollow">Cross Origin Resource S... | 28,032 |
<p><strong>Problem</strong></p>
<p>I need to redirect some short convenience URLs to longer actual URLs. The site in question uses a set of subdomains to identify a set of development or live versions.</p>
<p>I would like the URL to which certain requests are redirected to include the HTTP_HOST such that I don't have... | <p>It's strange that nobody has done the actual <strong>working</strong> answer (lol):</p>
<pre><code>RewriteCond %{HTTP_HOST} support\.(([^\.]+))\.example\.com
RewriteRule ^/terms http://support.%1/article/terms [NC,QSA,R]
</code></pre>
<hr>
<p>To help you doing the job faster, my favorite tool to check for regexp:... | <p>According to this cheatsheet ( <a href="http://www.addedbytes.com/download/mod_rewrite-cheat-sheet-v2/png/" rel="nofollow noreferrer">http://www.addedbytes.com/download/mod_rewrite-cheat-sheet-v2/png/</a> ) this should work</p>
<pre><code>RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://ww... | 9,806 |
<p>We need to get all the instances of objects that implement a given interface - can we do that, and if so how?</p>
| <p>I don't believe there is a way... You would have to either be able to walk the Heap, and examine every object there, or walk the stack of every active thread in the application process space, examining every stack reference variable on every thread... </p>
<p>The other way, (I am guessing you can't do) is intercept... | <pre><code>IEnumerable<Type> GetAllTypesThatImplementInterface<T>()
{
var @interface = typeof (T);
return @interface.IsInterface
? AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(assembly => assembly.GetTypes())
.Where(type => !type.... | 38,853 |
<p>I'm trying to follow the directions from this page:<br>
<a href="http://www.opengl.org/resources/faq/technical/color.htm" rel="nofollow noreferrer">http://www.opengl.org/resources/faq/technical/color.htm</a><br>
regarding rendering primitives with a unique color</p>
<p>I've checked the number of bits for every colo... | <p>It turns out that the FAQ has a mistake. </p>
<p>The <a href="http://www.opengl.org/sdk/docs/man/xhtml/glColor.xml" rel="nofollow noreferrer">documentation of glColor</a>
states that: "Unsigned integer color components, when specified, are linearly mapped to floating-point values such that the <strong>largest repr... | <p>Have you done this, too?</p>
<pre><code>In either event, you'll need to ensure that any state that could
affect the final color has been disabled. The following code will
accomplish this:
glDisable (GL_BLEND); glDisable (GL_DITHER);
glDisable (GL_FOG); glDisable (GL_LIGHTING);
glDisable (GL_TEXTURE_1D); glDisable ... | 48,022 |
<p>For UDP packets with a payload less then 1470, is it possible to achieve 1Gbit throughput? Due to the small packet size, there should be some bottlenecks in achieving such throughput (I/O, OS, network, etc.). I imagine drivers and hardware might have to be tuned to small packet/high throughput. Has anybody attempted... | <p>I've previously done some experimenting with throughput on gigabit links on relatively standard pc hardware, albeit doing just transmits (via <a href="http://tcpreplay.synfin.net/" rel="nofollow noreferrer">tcpreplay</a>), rather than udp.</p>
<p>The biggest bottleneck that I found was in just getting packets to th... | <p>There's a good tutorial on tweaking your network settings (in Linux) to achieve true gigabit speed here: <a href="http://datatag.web.cern.ch/datatag/howto/tcp.html" rel="nofollow noreferrer">http://datatag.web.cern.ch/datatag/howto/tcp.html</a></p>
| 12,432 |
<p>I am trying to do a simple datagrid in Flex with a doubleclick event, but I cannot get <code>itemDoubleClick</code> to fire:</p>
<pre><code><mx:DataGrid id="gridReportConversions" height="100%" width="100%" mouseEnabled="true" doubleClickEnabled="true" itemDoubleClick="refererRowDoubleClicked(event)">
... | <p>In C# you still need to 'new' a struct to call a constructor unless you are initializing <strong>all</strong> the fields. You left EventHandler member 'trigger' unassigned.</p>
<p>Try either assigning to 'trigger' or using:</p>
<pre><code>Vector2 vector = new Vector2()
</code></pre>
<p>The new object is <strong>... | <p>Rob Walker has a better response, since he started from the docs and then reasoned to the code (whereas I went the other way around).</p>
<p>If you compile the sample code with the trigger field commented out, and then run IlAsm to get the resulting MSIL, you'll see that there is no <code>initobj</code> opcode for ... | 38,067 |
<p>default is 49</p>
<p>how to edit to higher?</p>
| <p>You will need to issue the following command (connected as a user that has alter system privileges, sys will do it)</p>
<p>alter system set sessions=<em>numberofsessions</em> scope=spfile;</p>
<p>Have you been getting an ORA-12516 or ORA-12520 error?
If so it's probably a good idea to increase the number of proces... | <p>You can check connection limits in order to fine tune the session/process limits:</p>
<p><a href="http://zhefeng.wordpress.com/2008/09/24/ora-12516-error-tnslistener-could-not-find-available-handler-with-matching-protocol-stack/" rel="nofollow">http://zhefeng.wordpress.com/2008/09/24/ora-12516-error-tnslistener-cou... | 11,276 |
<p>What are the other ways of achieving auto-increment in oracle other than use of triggers?</p>
| <p>You can create and use oracle sequences. The syntax and details are at
<a href="http://www.techonthenet.com/oracle/sequences.php" rel="noreferrer">http://www.techonthenet.com/oracle/sequences.php</a></p>
<p>Also read the article
<a href="http://rnyb2.blogspot.com/2006/02/potential-pitfall-with-oracle-sequence.html"... | <pre><code>SELECT max (id) + 1
FROM table
</code></pre>
| 40,940 |
<p>Using Java, how can I test that a URL is contactable, and returns a valid response?</p>
<pre><code>http://stackoverflow.com/about
</code></pre>
| <p>The solution as a unit test:</p>
<pre><code>public void testURL() throws Exception {
String strUrl = "http://stackoverflow.com/about";
try {
URL url = new URL(strUrl);
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
urlConn.connect();
assertEquals(Http... | <pre><code>import org.apache.commons.validator.UrlValidator;
public class ValidateUrlExample {
public static void main(String[] args) {
UrlValidator urlValidator = new UrlValidator();
//valid URL
if (urlValidator.isValid("http://www.mkyong.com")) {
System.out.println("url is ... | 36,311 |
<p>I keep hearing about vase mode, but I have some problem figuring out how to set it up in my slicer; I use Cura slicer.</p>
<p>So, I'd like to get some settings to do it in Ultimaker Cura, using PLA if the material is important, plus any advice on how to properly do it and ensure that the print retains it's shape on ... | <p>Vase Mode changed the name in some version before 3.5. Now you can achieve this with 2 modes: "Surface Mode" and "Spiralize Outer Contour". To turn it on do this:</p>
<ul>
<li>Choose the Custom setting menu on the right</li>
<li>click a gear to set up what settings you want to see</li>
<li>Under the header "Special... | <p>Option <code>Spiralize</code> makes your model one layer thick on outer edges.</p>
<p>What I do for a vase is set the top layer count to zero.</p>
| 1,121 |
<p>I need to remove duplicate rows from a fairly large SQL Server table (i.e. 300,000+ rows).</p>
<p>The rows, of course, will not be perfect duplicates because of the existence of the <code>RowID</code> identity field.</p>
<p><strong>MyTable</strong></p>
<pre><code>RowID int not null identity(1,1) primary key,
Col1 va... | <p>Assuming no nulls, you <code>GROUP BY</code> the unique columns, and <code>SELECT</code> the <code>MIN (or MAX)</code> RowId as the row to keep. Then, just delete everything that didn't have a row id:</p>
<pre><code>DELETE FROM MyTable
LEFT OUTER JOIN (
SELECT MIN(RowId) as RowId, Col1, Col2, Col3
FROM MyTab... | <p><strong>A very simple way to delete duplicate rows of table in postgresql.</strong></p>
<pre><code>DELETE FROM table1 a
USING table1 b
WHERE a.id < b.id
AND a.column1 = b.column1
AND a.column2 = b.column2;
</code></pre>
| 3,944 |
<p>Modern RDBMS's have support for XML column types and functionality for dealing with XML in stored procedures. Historically I would always have mapped hierarchical data (whether of OO objects or XML) to relational tables. Given the widespread database support for XML should I change my ways?</p>
| <p>If you don't see the need then don't change!</p>
<p>Sometimes you have to persist data that does not have a known structure, or its structure is very volatile. In those cases, instead of creating a table, just save the XML into your existing table</p>
| <p>You can store user generated XML in there.</p>
<p>If a website like stackoverflow used some sort of XML markup instead of mark down you could store the question/answers as XML in the database.
You might find yourself trying to parse this user generated XML looking for proprietary tags.</p>
| 22,343 |
<p>Suppose that the <strong>ApplicationSettings</strong> class is a general repository of settings that apply to my application such as TimeoutPeriod, DefaultUnitOfMeasure, HistoryWindowSize, etc... And let's say MyClass makes use of one of those settings - DefaultUnitOfMeasure.</p>
<p>My reading of proper use of Inv... | <blockquote>
<p>IoC.Container.Resolve("default_uom");</p>
</blockquote>
<p>I see this as a classic anti-pattern, where you are using the IoC container as a service locater - the key issues that result are:</p>
<ul>
<li>Your application no longer fails-fast if your container is misconfigured (you'll only know about ... | <blockquote>
<p>Yes, many of my classes end up with a dependency on IoC.Container but that is a dependency that most of my classes will have anyways.</p>
</blockquote>
<p>I think this is the crux of the issue. If in fact most of your classes are coupled to the IoC container itself chances are you need to rethink yo... | 14,034 |
<p>I am trying to determine the best directory structure of my application</p>
<p>i have:</p>
<p>UI<br>
Data<br>
Interfaces </p>
<p>but i dont know where to put delegates..</p>
<p>should there be a seperate Delegates folder or should i store the delegates in the same classes where they are being used . .</p>
| <p>If you have an common use for your delegates, you should store them on a common place, but if you only use it in your class then put it in the same class.</p>
| <p>Delegates are essentially reference type method containers. In my opinion you should store the delegates in the same classes where they are being used. There is no need to create a separate delegate folder.</p>
| 40,107 |
<p>The question I'm really asking is why require does not take the name of the gem. Also, In the case that it doesn't, what's the easiest way to find the secret incantation to require the damn thing!?</p>
<p>As an example if I have <code>memcache-client</code> installed then I have to require it using</p>
<pre><code>... | <p>There is no standard for what the file you need to include is. However there are some commonly followed conventions that you can can follow try and make use of:</p>
<ul>
<li>Often the file is called the same
name as the gem. So <code>require mygem</code>
will work. </li>
<li>Often the file is
the only .rb file in t... | <p>I too had this problem since installing OS X Lion, and found that even if I ran the following code I would still get the warning message.
<code>require 'rubygems'</code>
<code>require 'nokogiri'</code></p>
<p>I tried loads of solutions posted here and on the web, but in the end my work around solution was to simply... | 16,097 |
<p>using C++Builder 2007, the FindFirstFile and FindNextFile functions doesn't seem to be able to find some files on 64-bit versions of Vista and XP. My test application is 32-bit.</p>
<p>If I use them to iterate through the folder C:\Windows\System32\Drivers they only find a handful of files although there are 185 wh... | <p>Is there redirection going on? See the remarks on Wow64DisableWow64FsRedirection <a href="http://msdn.microsoft.com/en-gb/library/aa365743.aspx" rel="noreferrer">http://msdn.microsoft.com/en-gb/library/aa365743.aspx</a></p>
| <p>Are you sure it is looking in the same directory as the dir command? They don't seem to have any files in common.</p>
<p>Also, this isn't the issue, but the correct wild card for "all files" is *</p>
<p>*.* means "all files with at least one . in the name"</p>
| 12,152 |
<p>I am interested in writing a simplistic navigation application as a pet project. After searching around for free map-data I have settled on the <a href="http://www.census.gov/geo/www/tiger/tgrshp2007/tgrshp2007.html" rel="nofollow noreferrer">US Census Bureau TIGER</a> 2007 Line/Shapefile map data. The data is spl... | <p>First, I recommend that you use the <a href="http://www.census.gov/geo/www/tiger/tgrshp2008/tgrshp2008.html" rel="noreferrer">2008 TIGER files</a>.</p>
<p>Second, as others point out there are a lot of projects out there now that already read in, interpret, convert, and use the data. Building your own parser for t... | <p>One solution is to use MapXtreme. They have API's for Java and C#. The API is able to load these files and render them.</p>
<p>For Java:</p>
<p><a href="http://www.mapinfo.com/products/developer-tools/desktop%2c-mobile-%26-internet-offering/mapxtreme-java" rel="nofollow noreferrer">http://www.mapinfo.com/product... | 27,482 |
<p>I've recently began using dTrace and have noticed just how awesome it is. Its the perfect tool for profiling without placing the burden on programmers to set up hundreds of probes in their applications.</p>
<p>I've found some nice one liner and sample scripts here and there, but I was wondering about what scripts, ... | <p>Here are some links I've found useful</p>
<p>A Powerpoint presentation about dTrace:</p>
<p><a href="http://www.nbl.fi/~nbl97/solaris/dtrace/dtt_present.pdf" rel="nofollow noreferrer">http://www.nbl.fi/~nbl97/solaris/dtrace/dtt_present.pdf</a></p>
<p>200+ useful scripts:</p>
<p><a href="http://www.brendangregg.c... | <p>Unfortunately dTrace is only implemented in/for Solaris OS. People from sun are recommend me to port all my php applications to Solaris, and "dtrace" them. After optimizing to again port them on my previous OS.</p>
| 15,190 |
<p>Basically I need to run the script with paths related to the shell script file location, how can I change the current directory to the same directory as where the script file resides?</p>
| <p>In Bash, you should get what you need like this:</p>
<pre><code>#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
echo "$BASEDIR"
</code></pre>
| <p>That should do the trick:</p>
<pre><code>echo `pwd`/`dirname $0`
</code></pre>
<p>It might look ugly depending on how it was invoked and the cwd but should get you where you need to go (or you can tweak the string if you care how it looks).</p>
| 30,021 |
<p>I have installed Phusion Passenger 2.0.3 on Apache 2.2.3 on Centos 2.6.18-92.el5 #1 SMP and I am getting the following on the httpd error log</p>
<pre><code>Cannot initialize Passenger in an Apache child process: Could not connect to the ApplicationPool server: Broken pipe (32)
</code></pre>
<p>I have removed the ... | <p>Please take a look at the following tutorial for setting up Passenger correctly:
<a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_to_a_virtual_host_8217_s_root" rel="nofollow noreferrer">Deploying to a virtual host</a></p>
<p>I had the same issue with Enterprise Ruby and Passeng... | <p>I had the same problem. The problem was because accidentally installed the native package (debian in my case) and also the gem. So for some reason it was causing the conflict. I removed the package and restarted Apache and it worked. Hope that helps.</p>
| 32,430 |
<p>I am writing a multi-threaded Windows application in Microsoft Visual C# 2008 Express Edition. Recently, the debugger has been acting strangely.</p>
<p>While I am Stepping Over lines of code using the F10, sometimes it will interpret my Step Over (F10) command just like a Continue command (F5) and then the program... | <p>You ought to take a look at this <a href="http://support.microsoft.com/default.aspx/kb/957912" rel="nofollow noreferrer">KB article</a> and consider its matching hotfix.</p>
<p>EDIT: the hotfix does solve these kind of debugging problems. Unfortunately, the source code changes for the hotfix didn't make it back in... | <p>Try this <a href="http://support.microsoft.com/kb/957912" rel="nofollow noreferrer">http://support.microsoft.com/kb/957912</a>. Worked for me.</p>
| 40,053 |
<p>I need to write an extension method on a byte[]. Is that possible?</p>
| <p>yes, just do :</p>
<pre><code>public static class Extensions
{
public static void Method(this byte[] current)
{
}
}
</code></pre>
| <p>Sure, just make the first parameter of type <code>byte[]</code>.</p>
| 30,927 |
<ol>
<li>VARCHAR does not store Unicode characters.</li>
<li>NVARCHAR does store Unicode characters.</li>
<li>Today's applications should always be Unicode compatible.</li>
<li>NVARCHAR takes twice the amount of space to store it.</li>
<li>Point 4 doesn't matter because storage space is extremely inexpensive.</li>
</ol... | <p>You match the datatype with the data that will be stored in the column. By a similar argument you could say why not store all data in NVARCHAR columns, because numbers and dates can be represented as strings of digits.</p>
<p>If the best match for the data that will be stored in the column is VARCHAR, then use it.<... | <p>I'm no expert on the subject. But any reason why you couldn't use UTF-8 to get a combination of small space and unicode?</p>
| 40,230 |
<p>Say I'm writing some ruby code and I want to use the standard Date type to get the current date. Instead of using a search engine, is there a faster way to find the documentation for this class? I know I can get the methods for Date by typing <code>Date.methods</code>, but as far as I know this doesn't provide deta... | <p>Bookmark the <a href="http://www.ruby-doc.org/core/" rel="nofollow noreferrer">ruby core docs</a></p>
<p>Use your web browser's find-text command.</p>
<p>Unexpected as it may seem, I find this is actually quicker than using <code>ri</code>, which for some reason seems to take ages to start up.</p>
<p>It is also m... | <p>For those of you who want docs from within vanilla IRB</p>
<ol>
<li><p>Follow <a href="https://github.com/dadooda/ori/blob/master/README_RI_CORE.md" rel="nofollow">these</a> instructions for setting up the core RI documentation. As of writing, the steps are</p>
<pre><code>$ cd ~/.rvm/src
$ rvm docs generate-ri
</... | 17,644 |
<p>I'm considering buying <a href="http://reprapworld.com/?products_details&products_id/783/cPath/1680">this package</a>, the Kossel, as my first 3D printer. </p>
<p>It's not the cheapest model, but apparently a high resolution and stable, which is what I'm after.</p>
<p>The question is, what is the life expecta... | <p>Much like your car, the number of miles, or the number of prints that you can get out of it is entirely up to how well <strong>you</strong> can maintain it.</p>
<p>A 3D Printer is a machine, and a machine needs general maintenance; if you see something starting to break - or get worn out - or anything abnormal, fix... | <p>I have built a Kossel too. Got lots of tips from the Google Deltaprinter group.
Most important when using the Traxxas rod ends is to have the metal parts go into the freezer and the plastic parts in warm water(not boiling, just 60 degrees celsius or so). Then put the 2 together, due to the fact the metal crimps just... | 127 |
<p>How can I create a method that has optional parameters in it in Visual Basic?</p>
| <p>Use the <code>Optional</code> keyword and supply a default value. Optional parameters must be the last parameters defined, to avoid creating ambiguous functions.</p>
<pre class="lang-vb prettyprint-override"><code>Sub MyMethod(ByVal Param1 As String, Optional ByVal FlagArgument As Boolean = True)
If FlagArgum... | <p>Have in mind that optional argument cannot have place before a required argument.</p>
<p>This code will show error:</p>
<pre>
Sub ErrMethod(Optional ByVal FlagArgument As Boolean = True, ByVal Param1 As String)
If FlagArgument Then
'Do something special
Console.WriteLine(Param1)
End If
End ... | 38,955 |
<p>This is an ASP.Net 2.0 web app. The Item template looks like this, for reference:</p>
<pre><code><ItemTemplate>
<tr>
<td class="class1" align=center><a href='url'><img src="img.gif"></a></td>
<td class="class1"><%# DataBinder.Eval(Container.DataItem,"fiel... | <p>Off the top of my head, you can try something like this:</p>
<pre><code><ItemTemplate>
<tr>
<td "class1"><asp:Literal ID="litField1" runat="server" Text='<%# Bind("Field1") %>'/></td>
<td "class1"><asp:Literal ID="litField2" runat="server" Text='<%# Bind("Fi... | <p>If you can afford a smidge more overhead in the generation, go for DataList and use the DataKeys property, which will save the data fields you need.</p>
<p>You could also use labels in each of your table cells and be able to reference items with e.Item.FindControl("LabelID").</p>
| 7,830 |
<p>This is a really weird problem that I have been having. When I download <em>Scriptaculous</em> from the official web site, <a href="http://script.aculo.us" rel="nofollow noreferrer" title="script.aculo.us">script.aculo.us</a>, bundled in the ZIP is <em>prototype.js</em> version 1.6.0.1. This works perfectly fine, I ... | <p>scriptaculous is a JS library built on top of prototype. As such, they will be behind prototype in their release schedule. To ensure that scriptaculous works only use it with the prototype file that came in the download.</p>
<p>Sure, given enough time and energy, you can find all the changed references from prototy... | <p>Get the latest script.aculo.us version driectly from their source code repository. The zipped version provided on their website is ancient. I'm running the latest script.aculo.us taken from their repo last week with the latest Prototype (1.6.0.3) without a glitch.</p>
| 12,401 |
<p>I'm using Excel 2007 to create a log-scale chart of numbers (specifically the Zimbabwean dollar exchange rate) over time. I'm using an x-y scatterplot and noticing one odd quirk.</p>
<p>The range of y values (numbers) spans a factor of about 10^30. On every chart I make using this data, half the gridlines are missi... | <p>Silly work around as well, but if you are going to be presenting your graph in Powerpoint, you can make the background color of the graph "no fill" and then when you paste it into Powerpoint (I paste it as a PDF). You can draw grid lines and match them up with the ticks on the y-axis. Arrange your graph "bring to fr... | <p>I'm having the same problem, it's definitely a bug.
Try a sequence 1, 10, 100, 1e+12, 1e+30 vs 0..4 and plot x,y scatter, and clearly the scale grid is messed-up even in linear, and in log is the behaviour you described.</p>
<p>My workaround was to make a transformation of the values and depict them scaled down (by... | 34,881 |
<p>I have been working on a webpage. It is the first I have actually tried to design using an image and then use proper CSS layout rather than tables.</p>
<p><a href="http://www.roccocammisola.com/proj/brunel/bgimage.html" rel="nofollow noreferrer">http://www.roccocammisola.com/proj/brunel/bgimage.html</a></p>
<p>I h... | <p><a href="http://en.wikipedia.org/wiki/Firebug_(Firefox_extension)" rel="nofollow noreferrer">FireBug</a>, the most crucial tool for debugging CSS, amongst other things.</p>
<p><a href="http://getfirebug.com/" rel="nofollow noreferrer">get it here</a></p>
| <p>Thanks for all your answers, seems to have done the trick.</p>
<p>I think I spazzed out with the upload as I should definitley have had the bg-image stuff there. </p>
<p>That IE web developer toolbar looks pretty good too as I have firebug and web developer bar for FF.</p>
| 29,837 |
<p>The first batch file launches a command prompt, i need the second command to be in the ccontext of the first. how can I do this in python?</p>
<p>As is, it launches the batch, and blocks until the batch (with its command prompt context) terminates, and then executes <code>devenv</code> without the necessary contex... | <p>I these situations I use script that does it all. That way you can chain as much as you want. Sometimes I will generate the script on the fly.</p>
<pre><code>compileit.cmd
call C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat
devenv $1.sln /rebuild Debug /Out last-build.txt
</code></pre>
| <p>You could append the devenv command onto the end of the original batch file like so:</p>
<pre><code>'%comspec% /k "...vcvarsall.bat" x86 && devenv asdf.sln /rebuild ...'
</code></pre>
<p>(obviously I have shortened the commands for simplicity's sake)</p>
| 33,037 |
<p>I want to use a case statement in my user-defined functions because I need to match on a number of terms. I could use a table for the matches but then I wouldn't be able to put it inside the Computed Column definition. </p>
<p>This works with IF statements:</p>
<pre><code>CREATE FUNCTION MaraSizeNumber
(
@ms v... | <p>The case statement should look like:</p>
<pre><code>RETURN CASE @ms
WHEN '16-18' THEN '1'
WHEN '18-20' THEN '2'
WHEN '20-22' THEN '3'
WHEN '22+' THEN '4'
WHEN '24+' THEN '5'
WHEN '14-16' THEN '7'
ELSE 'BAD'
END
</code></pre>
| <p>I think your problem is because you are not specifying the size on your varchar (which is defaulting to 1). This is resulting in the input and the output being truncated to a single character. (You were also missing an <code>@</code> on your variable inside the function.)</p>
<p>So <code>PRINT dbo.SizeExample('16... | 38,903 |
<p>Does the Java virtual machine ever move objects in memory, and if so, how does it handle updating references to the moved object?</p>
<p>I ask because I'm exploring an idea of storing objects in a distributed fashion (ie. across multiple servers), but I need the ability to move objects between servers for efficienc... | <p>In reference to the comment above about walking the heap.</p>
<p>Different GC's do it different ways. </p>
<p>Typically copying collectors when they walk the heap, they don't walk all of the objects in the heap. Rather they walk the LIVE objects in the heap. The implication is that if it's reachable from the "root... | <p>If you are willing to go that deep down, you can take a look to JBoss Cache architecture docs and grab some of its source code as reference.</p>
<p>This is not exactly what you described, but it works very similar.</p>
<p>Here's the link.</p>
<p><a href="http://www.jboss.org/jbosscache/" rel="nofollow noreferrer"... | 11,453 |
<p>File formats I would like to play include .wav, .mp3, .midi.</p>
<p>I have tried using the Wireless Toolkit classes with no success. I have also tried using the AudioClip class that is part of the Samsung SDK; again with</p>
| <p>If this device supports audio/mpeg you should be able to play mp3 use this code inside your midlet...</p>
<p>This works on my nokia symbian phones</p>
<pre><code>// Code starts here put this into midlet run() method
public void run()
{
try
{
InputStream is = getClass().getResourceAsStream("your_audio_file... | <p>Without source code to review, I would suggest using the wireles toolkit (from <a href="http://java.sun.com)first" rel="nofollow noreferrer">http://java.sun.com)first</a>.
It contains the standard J2ME emulator for windows and example code that will allow you to play a wav file.
assuming that works OK for you, try t... | 26,643 |
<p>I have a text file that contains localized language strings that is currently encoded in GB2312 (simplified Chinese), but all of my other language files are in UTF-8. I am finding it very difficult to work with this file, as none of my text editors will work properly with it and keep corrupting it. Are there any too... | <p>You can try this <a href="http://www.iconv.org/" rel="noreferrer">online service</a> that uses the Open Source <code>iconv</code> utility.<br>
You can also install <a href="http://www.marblesoftware.com/Charco.html" rel="noreferrer">Charco</a>, a command-line version of it on your machine.</p>
<p>For <code>GB2312<... | <p>I agree on the currently chosen answer in that "found that it was actually simple to solve from a programmatic point of view", especially when your source file contains sensitive information that you do not want to expose to an unknown 3rd-party online service.</p>
<p>And, nowadays Python is available out-... | 49,675 |
<p><strong>Background:</strong> Customer X has a CCK-based Content Type (vendorxxentry) and is using Views2 to generate a listing of all the vendorxxentry nodes in a simple table. </p>
<p>One of the fields in vendorxxentry is called "vendorxxattitude", which appears as one of the following enumerated possible values:<... | <p>You can change the 'mood' from a simple data field to a taxonomy vocabulary, with each mood being a term in the vocabulary. Then use <a href="http://drupal.org/project/taxonomy_image" rel="nofollow noreferrer">Taxonomy Image</a> module to substitute an image for each mood in any way you like.</p>
| <p>I guess I would start by writing some kind of jquery that would find all the cells with those words and swap the Css around to move/hide the text and add your images as a background image. Much like the image replacement techniques people use for getting fancy fonts in headers. If you can do that without changing th... | 47,214 |
<p>If a file is set to read only mode, how do I change it to write mode and vice versa from within Emacs?</p>
| <blockquote>
<p>M-x read-only-mode</p>
</blockquote>
<p>in very old versions of Emacs, the command was:</p>
<blockquote>
<p>M-x toggle-read-only</p>
</blockquote>
<p>On my Windows box, that amounts to Alt-x to bring up the meta prompt and typing "read-only-mode" to call the correct elisp function.</p>
<p>If y... | <p>I tried out Vebjorn Ljosa's solution, and it turned out that at least in my Emacs (22.3.1) there isn't such function as 'trim-right', which is used for removing an useless newline at the end of chmod output.</p>
<p>Removing the call to 'trim-right' helped, but made the status row "bounce" because of the extra newli... | 21,825 |
<p>I have a Makefile building many C files with long long command lines and we've cleaned up the output by having rules such as:</p>
<pre><code>.c${MT}.doj:
@echo "Compiling $<";\
$(COMPILER) $(COPTS) -c -o $@ $<
</code></pre>
<p>Now this is great as the @ suppresses the compilation line being... | <p>Tested and it worked (GNU make in Linux):</p>
<pre><code>.c${MT}.doj:
@echo "Compiling $<";\
$(COMPILER) $(COPTS) -c -o $@ $< \
|| echo "Error in command: $(COMPILER) $(COPTS) -c -o $@ $<" \
&& false
</code></pre>
| <p>A simple solution would be to use a simple script <code>abc</code> like the following:</p>
<pre><code>#!/bin/bash
$@
code=$?
if (( code )); then
echo error running $@
fi
exit $code
</code></pre>
<p>Then you can write <code>abc $(COMPILER) $(COPTS) -c -o $@ $<</code> in your <code>Makefile</code>. Do note tha... | 26,847 |
<p>We are trying out Visual Studio 2008 and Expression Blend on a new project. The goal is to clearly define the role of the developer and designer as separate, but reap the benefit of the developer being able to directly consume the XAML produced by the designer.</p>
<p>For the most part this has worked great, and I ... | <p>I would suggest reading <a href="http://www.galasoft.ch/mydotnet/articles/article-2007091401.html" rel="nofollow noreferrer">this blog</a>. The final method seems to work well, your test data shows up in Blend very nicely. Just keep in mind that you have to compile the DLL before it will display the data.</p>
| <p>I would look into creating XML data islands which emulate the structure of the objects you will eventually bind the UI to. This way your designer can bind the root element of the page (or user control, etc.) to the top level of your fake XML data island and all the relative paths will stay the same when you swap tha... | 9,200 |
<p>I'm developing a website on an XP virtual machine and have an SMTP virtual server set up in IIS -- it delivers mail just fine. What I would <em>like</em> is to confirm that any emails the site sends are only going to a specific domain.</p>
<p>The XP firewall seems to only involve incoming connections, I can't block... | <p>Here's one idea:</p>
<p>Under <code>Advanced Delivery</code> options (<code>SMTP Virtual Server Properties</code> > <code>Delivery</code> tab > <code>Advanced</code>). There you can set a "Smart Host" which is the SMTP server that will be used to actually send the mail, so you could possibly have it deliver ... | <p>I think the easiest way would be to add a check to your mail sending code on the website (there's got to be some class which is in charge of sending the mails out).</p>
<p>You could include a check which is only active when the code is compiled in debug mode (using compiler directives). Thus, when you are developin... | 10,015 |
<p>I need to do some performance benchmarks on .NET programs (C#) in Windows, but I haven't done benchmarking much in the Windows world. I've looked into using the Windows 2000/XP Performance monitor with custom counters for this, but I don't think this is quite what I want.</p>
<p>Are there any good system facilitie... | <p>For micro-benchmarking I really like MeasureIt (can be downloaded from <a href="http://msdn.microsoft.com/en-us/magazine/cc500596.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc500596.aspx</a>). It is a test project written by Vance Morrison a Performance Architect on the CLR. It currentl... | <p>If your project is quite big and there are lots of modules doing big number of calls you can your:
<a href="http://www.moduleanalyzer.com/" rel="nofollow">http://www.moduleanalyzer.com/</a></p>
| 17,496 |
<p>The general problem:</p>
<p>We have urls coming to our IIS web servers formatted like: </p>
<blockquote>
<p><strong><a href="http://www.server.com/page.aspx" rel="nofollow noreferrer">http://www.server.com/page.aspx</a></strong></p>
</blockquote>
<p>We are also seeing that urls like this are coming in: </p>
<b... | <p>Perhaps you need to enable it?</p>
<pre><code>DBMS_AQADM.ENABLE_PROPAGATION_SCHEDULE(queue_name => 'Test_Q');
</code></pre>
| <p>You might want to read thru this Tom Kyte thread on AQ:</p>
<p><a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:8760267539329#tom1246632800346467977" rel="nofollow noreferrer">http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:8760267539329#tom1246632800346467977</a></p>... | 26,193 |
<p>Any suggestions for good open source asp.net (C#) apps out there which meet as many of the following:?</p>
<ol>
<li>Designed well and multi tiered</li>
<li>Clean & commented code</li>
<li>Good use of several design patterns</li>
<li>Web pages display properly in all common browsers</li>
<li>Produces valid html ... | <p>I would have to agree with <a href="http://www.dotnetblogengine.net/" rel="nofollow noreferrer">BlogEngine</a>. It implements a ton of different abilities and common needs in asp.net as well as allowing it to be fully customizable and very easy to understand. It can work with XML or SQL (your choice) and has a hug... | <p><a href="http://www.dotnetblogengine.net/" rel="nofollow noreferrer">BlogEngine.Net</a></p>
| 11,590 |
<p>A quick glance at the present-day internet would seem to indicate that Adobe Flash is the obvious choice for embedding video in a web page. Is this accurate, or are they other effective choices? Does the choice of ASP.NET as a platform influence this decision?</p>
| <p>Flash is certainly the most ubiquitous and portable solution. <a href="http://en.wikipedia.org/wiki/Adobe_Flash#Market_share" rel="noreferrer">98% of browsers</a> have Flash installed. Other alternatives are <a href="http://www.apple.com/quicktime/download/" rel="noreferrer">Quicktime</a>, <a href="http://www.micr... | <p>I have worked for a company that developed a system for distributing media content to dedicated "players". It was web based and used ASP.NET technology and have tried almost every possible media format you can think of and your choice really comes down to asking yourself:</p>
<p>does it needs to play directly out o... | 2,469 |
<p>We were working on a design, and for that we created the skeleton of the classes in our main branch. Now, we are starting to code, and for that we got a new branch. So, it would be nice if I can move all the new files in the main branch into the new branch. However, I cannot check them in yet. So, is it possible... | <p>The Perforce support web site explains how to do this: <a href="https://community.perforce.com/s/article/3372" rel="nofollow noreferrer">Perforce Knowledge Base: Branching work in progress</a>. It would be nicer if it was a single step that didn't require running eight different commands.</p>
| <p>The easy answer is - no you can't. A quick perusal of the Perforce docs didn't come up with a ready cite for this, unfortunately, but in my experience any attempt to pull the rug out from under the Perforce server will result in your changes being lost which will leave you an unhappy camper.</p>
<p>Make a back up,... | 38,466 |
<p>I'm working on an "analytics" page for a rails app. The analytics page does not persist any data of its own (it's very primitive at this point) but does utilize metrics that I'm grabbing from the DB (via the aggregate expressions built into ActiveRecord). Aside from gathering and presenting the metrics the only othe... | <p>It sounds like you could use a Rails non active-record model. There's a good Railscast about that : </p>
<p><a href="http://railscasts.com/episodes/121-non-active-record-model" rel="noreferrer">http://railscasts.com/episodes/121-non-active-record-model</a></p>
<p>Hope that helps, </p>
| <p>This is an area that's not well documented at present, probably because the ActiveRecord stuff is sexier?</p>
<p>I went through the same process, finding my controller actions were becoming uncomfortably large and full of logic as I strove to construct my derived data from ActiveRecord-based models, which in turn s... | 44,323 |
<p>I want some links to include a fragment identifier. Like some of the URLs on this site:</p>
<p><a href="https://stackoverflow.com/questions/5619/ie6-ssl-ajax-post-form-404-error">Debugging: IE6 + SSL + AJAX + post form = 404 error</a><strong>#5626</strong></p>
<p>Is there a way to do this with any of the built-in ... | <p>We're looking at including support for this in our next release.</p>
| <p>This is a client side solution but if you have jquery available you can do something like this.</p>
<pre><code><script language="javascript" type="text/javascript">
$(function () {
$('div.imageHolder > a').each(function () {
$(this).attr('href', $(this).attr('href') + '#tab-works');... | 2,749 |
<p>Which is faster? This:</p>
<pre><code>bool isEqual = (MyObject1 is MyObject2)
</code></pre>
<p>Or this:</p>
<pre><code>bool isEqual = ("blah" == "blah1")
</code></pre>
<p>It would be helpful to figure out which one is faster. Obviously, if you apply .ToUpper() to each side of the string comparison like programme... | <p>I'm a little confused here.</p>
<p>As other answers have noted, you're comparing apples and oranges. <code>::rimshot::</code></p>
<p>If you want to determine if an object is of a certain type use the <code>is</code> operator.</p>
<p>If you want to compare strings use the <code>==</code> operator (or other appropr... | <p>How about you tell me? :)</p>
<p>Take the code from <a href="http://www.codinghorror.com/blog/archives/001178.html" rel="nofollow noreferrer">this Coding Horror post</a>, and insert your code to test in place of his algorithm.</p>
| 37,226 |
<p>How can you programmatically measure per-process (or better, per-thread) CPU usage under windows 95, windows 98 and windows ME?</p>
<p>If it requires the DDK, where can you obtain that?</p>
<p>Please note the <strong>Win9x requirement</strong>. It's easy on NT.</p>
<p>EDIT: I tried installing the <a href="http://... | <p>Table: Events</p>
<ul>
<li>StartTime (dateTime)</li>
<li>EndTime (dateTime) null for no end time</li>
<li>RepeatUnit (int) null = noRepeat, 1 = hour, 2 = day, 3 = week, 4 = dayOfMonth, 5 = month, 6 = year</li>
<li>NthDayOfMonth (int) </li>
<li>RepeatMultiple (int) eg, set RepeatUnit to 3, and this to 2 for ev... | <p>Use datetime and mysql's built in NOW() function. Create the record when the process starts, update your column that tracks the end time when it the process ends.</p>
| 12,564 |
<p>I have a Tronxy X3 (i3 Clone) running Repetier firmware on a Melzi board.</p>
<p>I would like to share the printer over my home network so that:</p>
<ol>
<li>Both my boys and I can use the printer. (We have separate Windows 10 PCs)</li>
<li>I can initiate a print from my computer upstairs</li>
<li>I can monitor th... | <p><strong>NOTE</strong>: This is not from personal experience, but I thought it was worth mentioning:</p>
<h3>Microsoft</h3>
<p>You've probably seen this already - I am not a fan at all of M$, but... <a href="https://all3dp.com/microsoft-network-3d-printer/" rel="nofollow noreferrer">Microsoft Plus Raspberry Pi Equals... | <p>You can use Windows IoT Core to do it, see -<br>
<a href="https://developer.microsoft.com/en-us/windows/iot/docs/3dprintserver" rel="nofollow noreferrer">https://developer.microsoft.com/en-us/windows/iot/docs/3dprintserver</a></p>
| 623 |
<p>Can Emacs support the concept of projects? That would be where several configuration options varies depending on what project you are working on.</p>
| <p>You generally wouldn't expect emacs to know about differences in build requirements---you let the build system (make or whatever) take care of that. To handle different coding standard define local <strong><code>yourproject.el</code></strong> files to set variables, load and unload local modes, etc... (use <strong><... | <p>Dude, as mentioned in another answer, EMACS can do <em>anything</em>. That said, let's expand a little on what a "project" means in this context. In most IDE's, like Eclipse, Netbeans, Visual Studio, or Xcode, "project" means two things: a file layout for the pieces that belong together, and instructions to the bu... | 34,879 |
<p>Using VB.NET, how do I add the values from an XML file into an SQL Server database with a similar schema?</p>
| <p>Weather.com has a free xml service for which they provide an SDK. The SDK includes icons in 3 sizes (31x31, 61x61, and 93x93) for about 48 weather conditions. I cannot find anything in their agreement that forbids using the icons for anything but their service. (Nor does it specifically grant free redistribution)</p... | <p>Hi you can find some really great icons here</p>
<p><a href="http://tango.freedesktop.org/Tango_Desktop_Project" rel="nofollow noreferrer">http://tango.freedesktop.org/Tango_Desktop_Project</a></p>
<p>it's an openSource icon theme </p>
| 33,975 |
<p>I've got an MS-Access app (1/10th MS-Acccess, 9/10ths MS-SQL) that needs to display photographs of some assets along with their specifications. Currently the images are stored in an MS-Access table as an OLE Object (and copy-n-pasted into the field by the users).</p>
<p>For various reasons, I would like to do is st... | <p>Another option is to put an image control on your form. There is a property of that control (Picture) that is simply the path to the image. Here is a short example in VBA of how you might use it.</p>
<p>txtPhoto would be a text box bound to the database field with the path to the image
imgPicture is the image con... | <p>The easiest way is probably to plop an Internet Explorer onto one of your forms. Check out this site: <a href="http://www.acky.net/tutorials/vb/wbrowser/" rel="nofollow noreferrer">http://www.acky.net/tutorials/vb/wbrowser/</a></p>
<p>Since you can reference that object in Access, you will only need to point the we... | 6,130 |
<p>I realize that CHAR is recommended if all my values are fixed-width. But, so what? Why not just pick VARCHAR for all text fields just to be safe.</p>
| <p>The general rule is to pick <strong>CHAR</strong> if all rows will have close to the <em>same length</em>. Pick <strong>VARCHAR</strong> (or <em>NVARCHAR</em>) when the <em>length varies</em> significantly. CHAR may also be a bit faster because all the rows are of the same length.</p>
<p>It varies by DB implementa... | <p>In some SQL databases, VARCHAR will be padded out to its maximum size in order to optimize the offsets, This is to speed up full table scans and indexes. </p>
<p>Because of this, you do not have any space savings by using a VARCHAR(200) compared to a CHAR(200)</p>
| 8,433 |
<p>One of the modules for my app uses functions from a .pyd file. There's an option to exclude dlls (exclude_dlls) but is there one for including them? The build process doesn't seem to be copying the .pyd in my module despite copying the rest of the files (.py). I also need to include a .dll. How do I get py2exe to i... | <p>.pyd's and .DLL's are different here, in that a .pyd ought to be automatically found by modulefinder and so included (as long as you have the appropriate "import" statement) without needing to do anything. If one is missed, you do the same thing as if a .py file was missed (they're both just modules): use the "incl... | <p>If they're not being automatically detected, try manually copying them into py2exe's temporary build directory. They will be included in the final executable.</p>
| 27,191 |
<p>I am part of a team creating a web application using PHP and MySQL. The application will have multiple users with different roles. The application will also be used in a geographically distributed manner. Accordingly we need to create an access control system that operates at the following two levels:</p>
<ol>
<li>... | <p>I was in similar situation few months ago. I found that tools like Zend_ACL work great if you just check access level to single item (or reasonably low number of them). It fails when you need to get a huge list of items the user is allowed to access. I crafted custom solution to this problem using <a href="http://ja... | <p>If you don't know how to do this I would use a php framework like Zend Framework, CakePHP, or Symfony. They have done the heavy lifting for you and have some type of access control scheme already in place.</p>
| 28,298 |
<p>I saw this over on slashdot and realized if I could program in dns control into some of my apps it would make life a lot easier. <a href="http://ask.slashdot.org/comments.pl?sid=975011&cid=25146235" rel="noreferrer">Someone over there</a> recommended <a href="http://dynect.com/features/api.html" rel="noreferrer"... | <p>I guess in the last 3 years this is a bit of a solved problem. Here are some to check out:</p>
<ul>
<li>Amazon has a nice dns service now <a href="http://aws.amazon.com/route53/" rel="nofollow noreferrer">http://aws.amazon.com/route53/</a></li>
<li>Linode has a free api based dns if you're a customer.</li>
<li>Dyna... | <p>You can try <a href="http://customdns.ca" rel="nofollow">http://customdns.ca</a>. I have a couple of domains with them - no problems so far. They provide RestFul API.</p>
| 16,157 |
<p>I'm using scriptaculous's Ajax.Autocompleter for a search with different filters. </p>
<p><a href="http://github.com/madrobby/scriptaculous/wikis/ajax-autocompleter" rel="nofollow noreferrer">http://github.com/madrobby/scriptaculous/wikis/ajax-autocompleter</a></p>
<p>The filters are requiring me to pass data into... | <p>To answer my own question: fake a key press. It ensures that the request is made, and that the dropdown box becomes visible. Here's my function to fake the key press, which takes into account the differences in IE and Firefox. </p>
<pre><code> function fakeKeyPress(input_id) {
var input = $(input_id);
if(i... | <p>Having looked at the Scriptaculous source to see <a href="http://github.com/madrobby/scriptaculous/tree/master/src/controls.js#L162" rel="nofollow noreferrer">what happens on keypress</a>, I would suggest you try calling <code>onObserverEvent()</code>.</p>
<pre><code>var autoCompleter = new Ajax.Autocompleter(/* ex... | 15,188 |
<p>How can I draw a concave corner rectangle in WPF?</p>
| <pre><code>do you mean a rectangle with concave corners?, ie:
____________________
| |
__| |__
| |
| |
| |
|__ __|
| |
|____________________|
<... | <p>I should point out that if it's concave, the four sides aren't both identical and straight; thus it's not a rectangle. But I digress.</p>
| 37,330 |
<p>I'm looking at ways to embed PDF viewing in a Flex application.</p>
<p>Currently the only option I've seen is by using the <a href="http://livedocs.adobe.com/flex/3/langref/flash/html/HTMLLoader.html" rel="nofollow noreferrer">flash.html.HTMLLoader</a> class, which only works if you're using AIR. This isn't a big d... | <p>There are a couple of ways, but neither actually have the PDF <em>in</em> the Flex App:</p>
<ol>
<li>Convert the PDF to SWF. Use <a href="http://www.swftools.org/pdf2swf.html" rel="nofollow noreferrer">this tool</a> or one like it to convert the file over.</li>
<li>Use <a href="http://drumbeatinsight.com/htmlcompon... | <p>Take a look at <a href="http://www.adobe.com/devnet/flex/quickstart/embedding_assets/" rel="nofollow noreferrer">http://www.adobe.com/devnet/flex/quickstart/embedding_assets/</a> and see if it helps.</p>
<p>I don't think you can embed PDF files directly (but I'm not really sure) but if you totally need to do it and... | 10,878 |
<p>I have the Profile, CCK, and Views2 modules installed on a Drupal 6 site. I added a string field to the user profile. I can filter easily on preset values, thru the Views GUI builder, really nicely. However, I'd like the filter criteria to be dynamically set based on other environment variables (namely the <code>... | <p>You can create your own function like following to add your own filters.</p>
<pre><code><?php custom_views_embed_view($view_name, $display_id) {
$view = views_get_view($view_name);
$view->set_display($display_id);
$id = $view->add_item($display_id, 'filter', 'node', 'created',
array( ... | <p>There is the possibility, having looked at the sort of filters installed for my own site, that filters have to be based on some database field, in which case what you're trying to achieve is not possible. It appears that the filters provide the WHERE clause to the generated SQL query. </p>
<p>Having said all that... | 29,914 |
<p>I am using prototype and I can't find any built in extensions to set or retrieve cookies. After googling for a little bit, I see a few different ways to go about it. I was wondering what you think is the best approach for getting a cookie in JavaScript?</p>
| <p>I use this routine:</p>
<pre><code>function ReadCookie(name)
{
name += '=';
var parts = document.cookie.split(/;\s*/);
for (var i = 0; i < parts.length; i++)
{
var part = parts[i];
if (part.indexOf(name) == 0)
return part.substring(name.length)
}
return null;
}
</code></pre>
<p>Works q... | <p>I use this. It has been dependable:</p>
<pre><code>function getCookie(c_name) {
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1)
{
c_start=c_start + c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cooki... | 16,443 |
<p>There doesn't seem to be a way to change the padding (or row height) for all rows in a .NET ListView. Does anybody have an elegant hack-around?</p>
| <p>I know this post is fairly old, however, if you never found the best option, I've got a <a href="http://qdevblog.blogspot.co.uk/2011/11/c-listview-item-spacing.html">blog post</a> that may help, it involves utilizing LVM_SETICONSPACING. </p>
<p><strong>According to my blog,</strong></p>
<p>Initially, you'll need t... | <p>A workaround is to use an ImageList that is as tall as you want the items to be. Just fill a blank image with the background color. You can even make the image 1 wide so as to not take much space horizontally.</p>
| 8,226 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.