input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
DMC Floss list library <p>I am trying to create a program for my wife to manage her <a href="http://www.dmc.com/majic/pageServer/0r0100001c/en/Threads.html" rel="nofollow">cross stitch floss</a>. I would like to use a library that contains all of the numbers and their associated colors however I have not been able to f... | <p>i am not sure if this is what you are asking for but you may find it helpful all the same. Log on to <a href="http://yarntree.com/075dmc.htm" rel="nofollow">http://yarntree.com/075dmc.htm</a> Best of luck.</p>
|
why wont it recognize the @properties from header file from main file? <p><strong>UIView.h</strong></p>
<pre><code>#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface UIView : UIResponder {
IBOutlet UILabel *endLabel;
IBOutlet UIButton *goButton;
IBOutlet UITextField *textBox1... | <p>Going a bit crazy with the <code>@synthesize</code>s, are we? I do believe that your main problem here is that <code>@property</code> declarations need to be <strong>after</strong> the closing } of <code>@interface</code>.</p>
<p>I'm surprised the compiler didn't throw up a red flag the size of Greenland, tho'.</p>... |
How to read a singly linked list backwards? <p>One method which I can think of is to reverse the list and then read it.
But this involves changing the list which is bad.<br />
OR I can make a copy of the list and then reverse it, but this uses additional O(n) memory.
Is there any better method which doesn't use extra m... | <p>To use O(n) memory and O(n) performance, create a stack; push everything on as you iterate in the forwards direction, then pop everything off, yielding the results.</p>
<p>To use O(n^2) performance (but O(1) extra memory), read it forwards each time, up the the node before the last one you got to.</p>
<p>Example:... |
C# Interlocked Exchange <p>I have a bit of my game which looks like this:</p>
<pre><code>public static float Time;
float someValue = 123;
Interlocked.Exchange(ref Time, someValue);
</code></pre>
<p>I want to change Time to be a Uint32; however, when I try to use <code>UInt32</code> instead of <code>float</code> for ... | <p>There's an overload for Interlocked.Exchange specifically for <code>float</code> (and others for <code>double</code>, <code>int</code>, <code>long</code>, <code>IntPtr</code> and <code>object</code>). There isn't one for uint, so the compiler reckons the closest match is the generic <code>Interlocked.Exchange<T&g... |
What's the best way to create a short hash, similiar to what tiny Url does? <p>I'm currently using MD5 hashes but I would like to find something that will create a shorter hash that uses just [a-z][A-Z][0-9]. It only needs to be around 5-10 characters long. </p>
<p>Is there something out there that already does th... | <p>Is your goal to create a URL shortener or to create a hash function?</p>
<p>If your goal is to create a URL shortener, then you don't need a hash function. In that case, you just want to pre generate a sequence of cryptographically secure random numbers, and then assign each url to be encoded a unique number from t... |
How can I convert a PHP upload-file script to Perl? <p>In PHP I have the following code that gets a file submitted through CGI:</p>
<pre><code>move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)
</code></pre>
<p>The file is being sent as</p>
<pre><code>Content-Disposition: form-data; name="userfile"; fi... | <p>To quote the <a href="http://search.cpan.org/perldoc/CGI" rel="nofollow">doc</a>:</p>
<blockquote>
<p>When a file is uploaded the browser usually sends along some information along with it in the format of headers. The information usually includes the MIME content type. Future browsers may send other information ... |
Is it hard to convert a web app built with Jsp, Servlets & mySQL to one with Spring & Hibernate? <p>I'm currently working on building a java web app. I've been looking to use Spring and Hibernate so I get some proper exposure to them, but I'm just getting burned out reading and learning about them. If I go ahead and bu... | <p>If you build using servlets, JDBC DAOs and JSPs, then it would be fairly straightforward to introduce Spring to the application at a later date:</p>
<ul>
<li>Replace the servlet code with Spring controllers. This would be doing Spring a bit of a dis-service, since they're capable of being so much more than just ser... |
Is there any way to get the repeating decimal section of a fraction in Python? <p>I'm working with fractions using Python's decimal module and I'd like to get just the repeating part of a certain fraction. For example: if I had 1/3 I'd like to get 3, if I had 1/7 I'd like to get 142857. Is there any standard function t... | <p>Since giving the answer could be a spoiler for project euler (which is generally not done here at stackoverflow), I'd like to give this hint: read <a href="http://en.wikipedia.org/wiki/Repeating%5Fdecimal">this</a> (section 1.2 should ring a bell).</p>
|
BizTalk Server physical deployment question <p>I am deploying a BizTalk solution at a client shortly;
Their infrastructure architects want SQL Server in a seperate security zone on their network isolated from the other servers.</p>
<p>My question, knowing that BizTalk is very chatty with SQL and relies heavily on it; ... | <p>If by security zone you mean a non trusted domain situation it flat out won't work as BizTalk will rely on integrated security. As far as the performance impact, it will really depend on size and frequency of messages. That being said almost all BizTalk performance issues first show themselves as I/O problems at t... |
concating 2 unicode strings - how to do that? <p>I have 2 unicode strings which I like to concat.</p>
<p>everytime I try to concat using RtlAppendUnicodeStringToString it telling me "STATUS_BUFFER_TOO_SMALL", even though im increasing my destination unicodestring.length to big numbers.</p>
<p>what is the method to co... | <p>I believe you should change MaximumLength, not Length of the destination buffer.</p>
|
How to convert ruby array to C array with RubyInline? <p>I have a function which compares 2 strings char by char. I needed it to run much faster than it is in Ruby so I used RubyInline to rewrite the function in C. It did increase the speed about 100 fold. The function looks like this:</p>
<pre><code> require 'inlin... | <p>This has a good rundown of how to access Ruby objects from C: <a href="http://rubycentral.com/pickaxe/ext%5Fruby.html">http://rubycentral.com/pickaxe/ext_ruby.html</a></p>
<pre><code>inline do |builder|
builder.c "
static VALUE some_method(VALUE s) {
int s_len = RARRAY(s)->len;
int result = 0;
... |
Best aproach to java like adapters event-handling in C++ <p>I'm doing some research in how to implement a event-handling scheme in C++ that can be easyest as its to implements an adpter to a class in java. The problem is that with the approach shown below, I will need to have all adapters already implemented with its f... | <p>Take a look at Boost.Signals library for an example of how you can implement event handling without classes with virtual functions (<a href="http://www.boost.org/doc/libs/1%5F39%5F0/doc/html/signals.html" rel="nofollow">http://www.boost.org/doc/libs/1_39_0/doc/html/signals.html</a>).</p>
|
How to select boolean-valued nodes in XPath? <p>I have an XML document and associated schema that defines several attributes as having the <code>xs:boolean</code> type. The lexical values for <code>xs:boolean</code> are <code>true</code>, <code>false</code>, <code>1</code>, and <code>0</code>, so it seems that to corre... | <p>In addition to the solutions proposed by Phil and Tomalak, I discovered that XPath 2.0 provides a few alternatives:</p>
<pre><code>@attribute=('true','1')
string(@attribute) cast as xs:boolean
</code></pre>
<p>And finally, XPath 2.0 does provide schema-aware processing, which means that if everything is in alignme... |
C# equivalent of Java PushbackReader's unread() <p>I'm looking for a C# equivalent to the Java's unread() method.</p>
<p>The C# equivalent to PushbackReader is supposedly System.IO.StreamReader, but StreamReader doesnt have an "unread()" equivalent. It has Peek(), but no way to put a character back onto the stream.</p... | <p><a href="http://msdn.microsoft.com/en-us/library/system.io.streamreader.peek.aspx" rel="nofollow"><code>Peek</code></a> reads the character without popping it out of the stream so you wouldn't need to put it back onto the stream.</p>
|
Cleaning up nested Try/Excepts <p>I've just written a chunk of code that strikes me as being far more nested than is optimal. I'd like advice on how to improve the style of this, particularly so that it conforms more with "Flat is better than nested."</p>
<pre><code>for app in apps:
if app.split('.', 1)[0] == 'zc'... | <p>The main problem is that your try clauses are too broad, particularly the outermost one: with that kind of habit, you WILL sooner or later run into a mysterious bug because one of your try/except has accidentally hidden an unexpected exception "bubbling up" from some other function you're calling.</p>
<p>So I'd sug... |
SharePoint VS workflow emailing to a SharePoint group <p>I have a code activity that sends an email in a VS workflow. It simply sets the 'To' property to the name of a SharePoint group in the site collection. However, only the 1st person in the group gets emailed.</p>
<p>Any ideas why this is happening?</p>
<p>thank... | <p>Does your group contain anything other than just users (ex: distribution lists, ad groups)?</p>
<p>If this is still a problem and you need to be able to send to a SharePoint group, I would recommend writing a custom workflow Action that would gather the emails of all the users in a specified group (you can find man... |
Preventing multiple daily votes in a contest <p>Voting contests seem to gain a lot of attention from people who want to game a system for fun. I know I spend a good amount of time fooling around with their forms and URLs, deleting cookies and writing the occasional crappy script.</p>
<p>Is there a way to create a fool... | <p>A: Associate each vote with an ip. Automated proxy-based voting is non-trivial. Getting 10-20 votes per day this way is easy, though. And getting 1000s of independent ip addresses for voting is harder (though doable through commercial anonymizer services).</p>
<p>B: Use ReCaptcha.</p>
<p>C: Do not display up to... |
Is there a way to bind textboxes in a webform so the data is save as the user types in? <p>I have in my webform many TBs bound to a property in the code behind:</p>
<pre><code><asp:TextBox ID="tbFirstName" Text="<%# Contact.FirstName %>" runat="server" />
<script language="c#">
public Contact Con... | <p>Do you realize you're talking about a web application? It's running in the users' browser. In order to update a database, you have to make a round trip to the server, either through AJAX or through a postback. Do you really want to do this for every keystroke?</p>
<p><hr /></p>
<p>From your comments, it's apparent... |
How do I notify a container control that a child control has changed size? <p>I'm making a UserControl that is a child of a StackPanel. When it's content changes the size of the control should also change. How should the UserControl notify the StackPanel (or any other container control) that it's size has changed?</p>
... | <p>Call InvalidateMeasure(). This causes the StackPanel (or other container control) to recalculate its layout.</p>
|
Are there any unshar utility for windows? <p>From time to time I need to extract the contents of a shar file. </p>
<p>And I need to wait to have access to a *nix box to obtain the files. And I was wondering if there is a unshar utility for windows.</p>
<p>I can install the cygwin package but I think that is to much f... | <p>there's shareutils (GNU) for windows <a href="http://gnuwin32.sourceforge.net/packages/sharutils.htm" rel="nofollow">here</a></p>
|
getting only name of employee by his ID. So one static class with only one method? <p>Hi
I need to get name of an employee by his ID by querying to DB.
It seems that need a class. But a class with only one method.....is it good idea or what else do you suggest?</p>
| <p>If that's the only piece of information you need about an employee, then yes, you only need a static class with a single static method:</p>
<pre><code>public static class EmployeeRepository {
public static string GetEmployeeNameByID(int id) { ... }
}
</code></pre>
<p>When you need more, you can do more.</p>
|
Data for the Columns in Flex <pre><code><local:CheckBoxDataGrid id="dg"
allowMultipleSelection="true" x="118" y="151" width="557">
<local:columns>
<mx:DataGridColumn dataField="firstName" headerText="Select" width="50" sortable="false" itemRenderer="CheckBoxRenderer" >
<... | <p>Have you tried debugging? I would suggest running a debug with a breakpoint immediately after setting var appSes, and inspecting that variable to be sure the ArrayCollection is being properly creating with e Service result data.</p>
<p>If the ArrayCollection is being created correctly, next make sure that the <code... |
JQuery- hotkeys and windows prompt issue <p>By referring to <a href="http://jshotkeys.googlepages.com/test-static-01.html" rel="nofollow">http://jshotkeys.googlepages.com/test-static-01.html</a>
I try to implement this powerful tool and facing some issue.</p>
<p>everytime when I click Ctrl S, it will popup a window pr... | <p>To avoid showing the browser Save As dialog, you must prevent the default event action, example in plain jQuery:</p>
<pre><code>$(window).keypress(function(event) {
if ((event.which == 115 && event.ctrlKey)){
alert("Ctrl+S pressed");
event.preventDefault();
}
});
</code></pre>
|
How to load a set of objects when Hibernate Lazy Fetchtype is used? <p>I have a Hibernate domain class (let's say PetOwner) with a one to many relationship with another class(Pets)</p>
<p>[PetOwner (1)---------(*) Pet]</p>
<p>Due to a drastic change required to improve the performance I had to change the fetchtype of... | <p>Try using <a href="https://www.hibernate.org/hib%5Fdocs/v3/api/org/hibernate/Hibernate.html#initialize%28java.lang.Object%29" rel="nofollow">Hibernate#initialize(Object)</a> to initialize your object. It should resolve the collection reference.</p>
<p>I'm curious why you want "eager" fetching without setting the f... |
Cookie Testing for payment gateways <p>While testing the payment gateway for some eCommerce site, is there any way to check if the cookies are saving the user's credit card details? If so, can we verify if they are in encrypted form?</p>
| <p>Beyond just looking at the content of the cookies? (You can also check the scope and expiry of cookies and whether the gateway works if the cookies are not accepted)</p>
<p>However, if you don't find the CC details they could be encrypted or disguised but that won't tell you how well encrypted they are.</p>
<p>Obt... |
Caching PHP script outputs on the client side <p>I have a php script that outputs a random image each time it's called. So when I open the script in a web browser, it shows one image and if I refresh, another image shows up.</p>
<p>I'm trying to capture the correct image from visiting the web site through a command li... | <p>Most likely your image is cached by browser set this:</p>
<pre><code><?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>
</code></pre>
<p>and each time you generating the image use another name for it (can ... |
How to change the focusable color? <p>I am creating simple application in Android and i want to change the focus color.That my application consist of two text box. When moving focus to the textbox,i can get the focus of textbox with the orange color. is it possible to change the color ? If it is possible please tell me... | <p>Yes, you can change the focus color of a button (this an open source OS). I poked around the SDK and could not find a direct way to change the focus color of a button. I did find this tantalizing xml file...</p>
<pre><code>widget_button.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android"&... |
UIkeyboard type <p>I want to use only alphabetic keyboard, how to restrict it? I've used following statement but it doesn't hide the button that converts keyboard in numeric one</p>
<pre><code>tempTextField.keyboardType = UIKeyboardTypeAlphabet;
</code></pre>
| <p>I'm affraid you cannot restrict the keyboard to only input alphabetic characters. The available keyboardTypes are listed in the UITextInputTraits protocol reference, and with even more detail in the header file:</p>
<pre><code>typedef enum {
UIKeyboardTypeDefault, // Default type for the current ... |
Web Application not working in Safari <p>We have developed a web application in .NET framework 3.5. Presently our application is compatible with IE and firefox browsers, but we are not able to browse the application in Safari.
When we browse the application using Safari , page is getting loaded as blank.</p>
<p>Please... | <p>Maybe you have to update the browserCaps section of your Machine.config file? ASP.NET will send the client a "simple" version of the page if it doesn't recognize the browser.</p>
<pre><code><configuration>
<system.web>
<browserCaps>
...
<!-- AppleWebKit Based Browsers (Safari...) ... |
NHibernate and adding new items with a composite collection to a child collection <p>I have three classes that pose a problem when trying to add a new child.</p>
<p>They are:</p>
<pre><code> User {
List attributesGroup>
}
AttributesGroup {
attributesGroupId
value
}
AttributesGroupId {
at... | <p>I'm having a hard time following (SO mangled your post), but using a composite ID can cause this problem. Since the ID type is 'assigned' NHibernate has no idea how to tell if the object is transient or persisted.</p>
<p><a href="https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/example-parentchi... |
I need a regex that validates for minimum 7 digits in the given string <p>I wanna validate a phone number.
My condition is that I want mimimum 7 numbers in the given string, ignoring separators, X, parantheses.</p>
<p>Actually I want to achieve this function in regex:</p>
<pre><code>Func<string, bool> Validate ... | <p>Seven or more digits, mixed with any number of any other kind of character? That doesn't seem like a very useful requirement, but here you go:</p>
<pre><code>^\D*(?:\d\D*){7,}$
</code></pre>
|
Array with associative values accessed numerically <p>I have an associative array that I might need to access numerically (ie get the 5th key's value).</p>
<pre><code>$data = array(
'one' => 'something',
'two' => 'else',
'three' => 'completely'
) ;
</code></pre>
<p>I need to be able to do:</p>
... | <pre><code>how about this
$data = array(
'one' => 'something',
'two' => 'else',
'three' => 'completely'
) ;
then
$keys = array_keys($data);
Then
$key = $keys[$index_you_want];
Then
echo $data[$key];
</code></pre>
|
Speech Recognition on iPhone <p>I need to develop an iPhone application which recognizes speech, and based on the result it performs further tasks.</p>
<p>I know iPhone 3.0 doesn't support speech recognition and I need to implement speech recognition software on the server side. I know this thing only, since I am newb... | <p>The best open source speech recognition package I know of is Sphinx.<br />
<a href="http://cmusphinx.sourceforge.net/">http://cmusphinx.sourceforge.net/</a></p>
<p>Otherwise, I would suggest looking into Nuance software.</p>
<p>Current speech recognition does well with a limited grammar set (if you know what they ... |
Using Linq SubmitChanges without TimeStamp and StoredProcedures the same time <p>I am using Sql tables without rowversion or timestamp. However, I need to use Linq to update certain values in the table. Since Linq cannot know which values to update, I am using a second DataContext to retrieve the current object from da... | <p>If you make changes behind the back of the ORM, and don't use concurrency checking - then you are going to have problems. You don't show what you did in step "3", but IMO you should update the object model to reflect these changes, perhaps using <code>OUTPUT</code> TSQL paramaters. Or; stick to object-oriented.</p>
... |
Internet Explorer hanging when debugging ASP.NET app <p>This problem is beginning to annoy.</p>
<p>After my machine (Vista Ultimate) has been up for a while, running my ASP.NET web site project for debugging in VS2008 results in Internet Explorer "hanging". It doesn't seem to get past the network access stage, you kno... | <p>So thankfully Microsoft have finally released Security Essentials.</p>
<p>This meant I could de-install AVG (Free and paid-for versions) from my machine.</p>
<p>Hey presto, it works!</p>
|
How can I move the contents of one directory tree into another? <p>I have a directory which contains files and a number of levels of subdirectories:</p>
<pre><code>C:\Source
</code></pre>
<p>I would like to move the contents of C:\Source into:</p>
<pre><code>C:\Destination
</code></pre>
<p>Requirements:</p>
<ul>
<... | <p>Undoubtedly use robocopy. It is a simple but brilliantly useful tool.</p>
<pre><code>robocopy /move /e sourcedir destdir
</code></pre>
<p>This will move all the files and folders, including empty ones, deleting each original file after it has moved it.</p>
<p>If you don't have robocopy installed you can download ... |
How to enter tags correctly? <p>I have a tag field in my web page, in which user can enter tags seprating them by <code>,</code> (comma), same as done in StackOverflow. I am using PHP and I am seprating all tags enetered by the user on the basis of comma using explode function and then adding them to my tags table in t... | <pre><code>$tags = "battleship, stragety, ,";
$exp = explode(",", $tags);
$valid_tags = array();
foreach($exp as $tag)
{
if( ($tag = trim($tag)) != "")
{
$valid_tags[] = $tag;
}
}
</code></pre>
<p>Will remove whitespace from any tag and if it has any text, tag will be added into valid array :)</p>
|
Multiple images in a listView <p>Can I show multiple images in a ListView ( .NET only )
In other words more than one column should be an image column
I cant seem to find any way to do this </p>
| <p>i think that this is a limitation with the "out-of-the-box" list view.</p>
<p>You can try using (or looking at the code to see how they managed to do it) the Extended List view from code project:</p>
<p><a href="http://www.codeproject.com/KB/list/EXListView.aspx" rel="nofollow">http://www.codeproject.com/KB/list/E... |
Subsonic 3: SimpleRepository. How to map enum to a table column <p>I have a DB table (Profile) to describe a person. This table has a column "Sex" (int).
In .NET part I have:</p>
<pre><code>public enum Sex { Male = 1, Female = 2 }
public class Profile{
public int ID {get; set;}
public Sex Sex {get; set;}
}
.... | <p>I assume you're used to using something like .nettiers that will generate enums from lookup tables, however SubSonic does not provide this functionality.
If you have a SexId column in your table you could do the following (null checks need adding):</p>
<pre><code>public enum Sex { Male = 1, Female = 2 }
public cl... |
How to retain checkbox state in jQuery <p>I have added the followng code to disable the dropdown on unchecking the checkbox in jQuery, but the checkbox is not retaining the value:</p>
<pre><code>$(document).ready(function(){
//on check of the checkbox,the dropdown is enabled or disabled.
$("[id$=chkCashSettlem... | <p>I'm not sure, but there is some kind of problem using checkbox and toggle(). Try this: </p>
<pre><code>$(document).ready(function()
{
//on check of the checkbox,the dropdown is enabled or disabled.
$("[id$=chkCashSettlementType]").click(function()
{
if($(this).attr('checked'))
{
$("[id$=... |
Explicit keyword on multi-arg constructor? <p>I recently came across some weird looking class that had three constructors:</p>
<pre><code>class Class
{
public:
explicit Class(int );
Class(AnotherClass );
explicit Class(YetAnotherClass, AnotherClass );
// ...
}
</code></pre>
<p>This ... | <p>In C++11 multi-parameter constructors can be implicitly converted to with brace initialization.</p>
<p>However, before C++11 <code>explicit</code> only applied to single-argument constructors. For multiple-argument constructors, it was ignored and <a href="http://msdn.microsoft.com/en-us/library/h1y7x448.aspx">had ... |
Ecplise CDT .settings folder <p>How can I make Eclipse CDT store its .settings folder in the project folder instead of .metadata.plugins\org.eclipse.core.runtime.settings ?</p>
<p>More general, can Eclipse put all the settings there?</p>
<p>Background for the question is: I think there are many settings that I wand t... | <p>These settings are for the plugin so will be stored in the plugin's metadata area. I don't think there is a way to change this short of hacking on the plugin yourself.</p>
<p>I'm not familiar with the CDT plugin, but for many other plugins you can override the platform preferences with project-specific settings. Th... |
Charting tools for reporting <p>What are the available charting tools in the market for comparison.
It should support both Java and .NET.
It can be open source as well as cost.Please mention the licence type.
Mention it needs any other external softwares like Flash player or other external plugins
Any tutorial/sample l... | <p>we are using <a href="http://www.amcharts.com" rel="nofollow">http://www.amcharts.com</a> (among others) which is quite nice and cheap (flash based)</p>
|
Custom datacontract / datamember name <p>I have a following problem. A customer requested a web service that returns data in following format:</p>
<pre><code><status>
<name1>Some name</name1>
...
</status>
</code></pre>
<p>But when an error occurs they want to get a following message:</p>
<... | <p>You should decorate both UniLoginNotFoundError and PatronStatusData with DataContract(Name="Something") to make this work. But you won't be allowed to set the same name ("status") for them.
In your particular case I'd better use single class with unused properties set to null.</p>
<pre><code>[DataContract(Name="sta... |
jQuery Append UL with LI with value from dropdownlist on button click <p>I have a dropdownlist:</p>
<pre><code><select id="ContentList" name="ContentList">
<option value="">Please Select</option>
<option value="TEST_TOP">TEST TOP</option>
</select>
</code></pre>
<p>I have a sor... | <pre><code>$("#sortable").append("<li class='ui-state-default'>"+
$("#ContentList option:selected").text()+"</li>");
$("#ContentList option:selected").remove();
</code></pre>
<p>should do the trick... (:</p>
|
Create test data in SQL Server <p>Does anyone have or know of a SQL script that will generate test data for a given table?</p>
<p>Ideally it will look at the schema of the table and create row(s) with test data based on the datatype for each column.</p>
<p>If this doesn't exist, would anyone else find it useful? If s... | <p>Well I thought I would pull my finger out and write myself a light weight data generator:</p>
<pre><code>declare @select varchar(max), @insert varchar(max), @column varchar(100),
@type varchar(100), @identity bit, @db nvarchar(100)
set @db = N'Orders'
set @select = 'select '
set @insert = 'insert into ' + @db ... |
Magento core function working in remote system displaying error in another system <p>In catalog.xml file of frontend template folder I had blocks defined for tabs to display product tags,additional information etc.in this way:</p>
<pre><code><action method="addTab" translate="title" module="catalog">
<alias&g... | <p>look whether it is using any object that is not created in that file</p>
|
PyQt: event is not triggered, what's wrong with my code? <p>I'm a Python newbie and I'm trying to write a trivial app with an event handler that gets activated when an item in a custom QTreeWidget is clicked. For some reason it doesn't work. Since I'm only at the beginning of learning it, I can't figure out what I'm do... | <p>You should have said</p>
<pre><code>self.connect(self, SIGNAL('itemClicked(QTreeWidgetItem*, int)'), self.onClick)
</code></pre>
<p>Notice it says <strong>int</strong> rather than <em>column</em> in the first argument to <code>SIGNAL</code>. You also only need to do the <code>connect</code> call once for the tree ... |
Finding perfmon counter id via winreg <p>I have an app that collects Perfmon counter values through the API exposed in winreg.h - in order to collect Perfmon counter values I must make a call to <code>RegQueryValueExW</code> passing in the id of the Perfmon counter I'm interested in, and in order to obtain that ID I ne... | <p>I realize that this is old, but in case it helps:</p>
<ol>
<li>Tim is right, parsing the binary data yourself is difficult. Prepare yourself for a world of pain. I'd recommend PDH (encapsulates the registry accesses for you), or if that fails, WMI (though note that WMI is much slower).</li>
<li>You cannot get data ... |
Use ampersand in CAST in SQL <p>The following code snippet on SQL server 2005 fails on the ampersand '&':</p>
<pre><code>select cast('<name>Spolsky & Atwood</name>' as xml)
</code></pre>
<p>Does anyone know a workaround?</p>
<p>Longer explanation, I need to update some data in an XML column, and ... | <p>It's not valid XML. Use <code>&amp;</code>:</p>
<pre><code>select cast('<name>Spolsky &amp; Atwood</name>' as xml)
</code></pre>
|
Where do I find the definition of size_t? <p>I see variables defined with this type but I don't know where it comes from, nor what is its purpose. Why not use int or unsigned int? (What about other "similar" types? Void_t, etc).</p>
| <p>From <a href="http://en.wikipedia.org/wiki/Stdlib.h">Wikipedia</a></p>
<blockquote>
<p>The <code>stdlib.h</code> and <code>stddef.h</code> header files define a datatype called <code>size_t</code><a href="http://en.wikipedia.org/wiki/Stdlib.h">1</a> which is used to represent the size of an object. Library functi... |
I can't delete this local svn working directory on windows <p>I want to delete just my local working copy (no server changes) and I am getting the following error:</p>
<p>Cannot delete dir-prop-base: access is denied</p>
<p>Make sure the disk is not full or write protected and that the file is not currently in use.<... | <p>If you're using tortoise svn, there's a process called TSVNCache.exe - kill it. There's a way to permanently disable it too, but I forget where.</p>
|
SyncLock on SyncRoot <p>I have created a synchronized queue and am using SyncLock on the SyncRoot property of that queue when I invoke the Enqueue/Dequeue methods. The methods are invoked from instances of standard producer/consumer classes.</p>
<p>Is that a proper use of the SyncRoot property?</p>
<p>Would it be be... | <p>Yes, that's exactly what the <code>SyncRoot</code> property is for. In particular, it means that if another "wrapper" collection is created, it will probably use the same <code>SyncRoot</code>, so everyone can still synchronize correctly.</p>
<p>You <em>could</em> create your own lock object, and that would make ab... |
How can I have references between two classes in Objective-C? <p>I'm developing an iPhone app, and I'm kinda new to Objective-C and also the class.h and class.m structure.</p>
<p>Now, I have two classes that both need to have a variable of the other one's type. But it just seems impossible.</p>
<p>If in class1.m (or ... | <p>You can use the <code>@class</code> keyword to forward-declare a class in the header file. This lets you use the class name to define instance variables without having to <code>#import</code> the header file.</p>
<p><strong>Class1.h</strong></p>
<pre><code>@class Class2;
@interface Class1
{
Class2 * class2_in... |
How to simulate multiple inheritance for ASP.NET base pages? <p>My project has been using a base page to hold common page functionality. Its worked until the base page grew to be huge, so I tried to factor the base page into several classes. Then I realized that I can't write </p>
<pre><code>public MyPage : SecurePa... | <p>Do the functions provided by <code>SecurePage</code>, <code>PageWithGridViewSorting</code> and <code>PageWithSessionWarning</code> actually need to be overloaded or overridden by their derived classes?</p>
<p>If all you're doing is using inheritance to group functions, you should consider using a different method o... |
ORMs and POCOs when having multiple Backends/DI - Architecture? AutoMapper? <p>Okay, the title is not saying too much, sorry. Essentially it's an Architecture Question about an Application that can have multiple database backends (Well, "Database" is loosely used here as it can mean anything from MSSQL to XML Files to ... | <p>In the (somewhat limited) case of <em>only</em> needing to add Attributes for use with a given ORM, it is possible to write a wrapper that adds these things at runtime. You could add such code to the ORM constructor (subclassing the ORM or ORM initialization class as necessary), or to an ORM-initialization event.</p... |
PHP solution for creating a list of static value objects <p>I have a configurable report. For each field that can be included on the report, there's a key (stored in report preferences), a label, potentially an access level, and a SQL descriptor -- something like <code>foo as my_foo</code>. </p>
<p>In a Java app, I wo... | <p>Why not create objects in PHP like you would in Java?</p>
<pre><code>class ReportField {
private $key;
public __construct($key, $label, $access_level, $sql) {
$this->key = $key;
...
}
public getKey() { return $this->key; }
...
}
$fields = array(
new ReportField(...),
new ReportField(... |
JPA/Hibernate - Embedding an Attribute <p>I am having a trouble mapping an embedded attribute of a class. I have created some classes that are similar to what I am trying to do to illustrate. Basically, I have an @Embeddable class hierarchy that uses Inheritance. The top level class "Part Number" has only one attrib... | <p>Component (e.g. @Embeddable) inheritance is not supported and most likely never will be. There is a good reason for that - entity identifier plays a critical role in all inheritance strategies supported by Hibernate and components don't have (mapped) identifiers. </p>
<p>You have three choices:</p>
<p>A) Map Pa... |
How do I get the current year using SQL on Oracle? <p>I need to add the current year as a variable in an SQL statement, how can I retrieve the current year using SQL?</p>
<p>i.e.</p>
<pre>
BETWEEN
TO_DATE('01/01/<i>**currentYear**</i> 00:00:00', 'DD/MM/YYYY HH24:MI:SS')
AND
TO_DATE('31/12/<i>**currentY... | <p>With to_char:</p>
<pre><code>select to_char(sysdate, 'YYYY') from dual;
</code></pre>
<p>In your example you can use something like:</p>
<pre><code>BETWEEN trunc(sysdate, 'YEAR')
AND add_months(trunc(sysdate, 'YEAR'), 12)-1/24/60/60;
</code></pre>
<p>The comparision values are exactly what you request:</p>
... |
Loading files with ClassLoader <p>This problem has been bugging me for a while. I have to load a couple files in my java app, and the only way I got working so far looks like this:</p>
<pre><code>URL hsURL;
if(System.getProperty("os.name").toLowerCase().contains("windows")) {
hsURL = new URL("file:/" + System.getProp... | <p><code>getSystemResource</code> is static because it will use the <em>system</em> classloader, which is available statically. (<code>ClassLoader.getSystemClassLoader</code>)</p>
<p>If your resource is available in the classpath, I would suggest using <code>ClassLoader.getResource()</code> or <code>Class.getResource<... |
How to debug a application on a customers environment .NET <p>We have an application written in C# .NET that is currently used in production environments. Obviously the release build is used.</p>
<p>Unfortunately sometimes the application misbehaves under certain conditions and we can't figure out why. We are unable t... | <p>Remote debugging is a good feature, but it can seldom be used in production environments because it requires 2-way trust between domains (your own and your customers) that is hard to achieve (administrators of both companies will strongly opposit the idea)</p>
<p>see <a href="http://msdn.microsoft.com/en-us/library... |
Silverlight And Prism - Lazy loading a dll outside a xap file? <p>In the modularity quick start (<a href="http://msdn.microsoft.com/en-us/library/dd490828.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/dd490828.aspx</a>) there is enough details on delay loading a type from an assembly in a xap file.</p>
... | <p>Remember that a XAP file is just a zip file renamed, so it would be pretty easy to create your own (even on the fly) if you have a dll. There are plenty of tools and/or example code that create zip files. Of course this would mean less download time and server utilisattion as well.</p>
|
D2009 TStringlist ansistring <p>The businesswise calm of the summer has started so I picked up the migration to D2009. I roughly determined for every subsystem of the program if they should remain ascii, or can be unicode, and started porting.</p>
<p>It went pretty ok, all components were there in D2009 versions (some... | <p><a href="http://sourceforge.net/projects/jcl/">JCL</a> implements TAnsiStrings and TAnsiStringList in the JclAnsiStrings unit.</p>
|
how to read comments in word document from apache poi? <p>How to Read word comments (Annotation) from microsoft word document ?</p>
<p>please provide some example code if possible ...</p>
<p>Thanking you ...</p>
| <p>Finally, I found the answer </p>
<p>here is the code snippet ...</p>
<pre><code> File file = null;
FileInputStream fis = null;
HWPFDocument document = null;
Range commentRange = null;
try {
file = new File(fileName);
fis = new FileInputStream(file);
document = new HWPFDocument(fis);
commentRange = d... |
How to transition from MFC to .NET <p>I have been doing Windows, MFC and GUI programming for several years and need to transition to .NET. While learning WinForms, I see that WPF is the new kid on the block. Does it still make sense to learn WinForms? Also, what's the best way for someone who has been used to low level... | <p>Winforms isn't dead. It's certainly simpler so if you just need a simple "textbox here" and "button there" you'll be able to create something quicker in winforms for sure.</p>
<p>If you're looking for a more robust UI WPF is the way to go. If you're familiar with OO concepts and recognize the link between XAML (the... |
Alternatives to CONNECT adapter to interface with NHIN network? <p>I'm researching alternatives to the federally backed <a href="http://www.connectopensource.org/display/Gateway/CONNECT+Community+Portal" rel="nofollow">CONNECT adapter</a> for building a custom adapter to connect to the Nationwide Health Information Net... | <p>I don't see any alternative currently. I also don't see much of a prospect for one, when CONNECT is addressing an incredibly complex challenge, has broad governmental support, is open source, and is actively being developed.</p>
|
How can I read and parse CSV files in C++? <p>I need to load and use CSV file data in C++. At this point it can really just be a comma-delimited parser (ie don't worry about escaping new lines and commas). The main need is a line-by-line parser that will return a vector for the next line each time the method is calle... | <p>If you don't care about escaping comma and newline,<br>
AND you can't embed comma and newline in quotes (If you can't escape then...)<br>
then its only about three lines of code (OK 14 ->But its only 15 to read the whole file).</p>
<pre><code>std::vector<std::string> getNextLineAndSplitIntoTokens(std::istream... |
How to redirect to a custom error page using mod_rewrite based on 404 error <p>I am trying to use mod_rewrite to be able to redirect to my custom html error page, when a 404 is returned. Right now, I have my http server running and my appserver(Websphere) running. When I take down a service on the appserver, it returns... | <p>Have you tried smth like this:</p>
<pre><code>ErrorDocument 404 /not-found.asp
</code></pre>
|
C# How to determine if HTTPS <p>How do I determine and force users to view my website using HTTPS only? I know it can be done through IIS, but want to know how its done programmatically. </p>
| <p>You can write an <code>HttpModule</code> like this:</p>
<pre><code>/// <summary>
/// Used to correct non-secure requests to secure ones.
/// If the website backend requires of SSL use, the whole requests
/// should be secure.
/// </summary>
public class SecurityModule : IHttpModule
{
public void Di... |
How to represent an event based architecture in a static UML model? <p>I have a fairly basic C# event based system but I'm not sure how I model it in UML. I obviosuly want to show the event publisher, subscriber, handlers and EventArgs classes .. I think you use 'signals' but I can't find any examples. Can anyone point... | <p>The "Publisher-Subscriber" pair pattern (a.k.a "Observer"), may be implemented different in each programming (language) framework, therefore, designed different, in U.M.L.</p>
<p>Any way, conceptually, when an event ("signal" or "message") is sent, from a publisher (a.k.a "server") to any subscriber ("client"), som... |
Selecting Indexes based on Column/Table Names <p>Is there a system SP or dmv that allows me to select indexes in my DB based on columns and table names? </p>
<p>What I am trying to do is to drop indexes based on columns with string datatypes as I am in the process of altering my collation settings. </p>
<p>Thanks.</p... | <p>You can always determine the indices for a given column and/or table by querying the sys.indexes and sys.index_columns views:</p>
<pre><code>SELECT
i.Name 'Index Name',
OBJECT_NAME(i.object_ID) 'Table Name',
c.Name 'Column Name'
FROM
sys.indexes i
INNER JOIN
sys.index_columns ic ON i.index_id ... |
Creating and combining controllers in an MVC PHP web application <p>Over the last few weeks I have been studying the MVC design pattern for web applications using PHP. Taking a broad view I understand how the pattern works and why it is a very good way of implementing any sort of web application from small or large.</... | <p>I disagree with the direction you want to take in your model. The 1 model = 1 table design is going to hurt you in the long run.</p>
<p>First of all, I think you need to drop the strict notion that model == database. While that is very often true, really the model is just data - it could come from XML files, a ca... |
How to download via HTTP only piece of big file with ruby <p>I only need to download the first few kilobytes of a file via HTTP.</p>
<p>I tried</p>
<pre><code>require 'open-uri'
url = 'http://example.com/big-file.dat'
file = open(url)
content = file.read(limit)
</code></pre>
<p>But it actually downloads the full fil... | <p>This seems to work when using sockets:</p>
<pre><code>require 'socket'
host = "download.thinkbroadband.com"
path = "/1GB.zip" # get 1gb sample file
request = "GET #{path} HTTP/1.0\r\n\r\n"
socket = TCPSocket.open(host,80)
socket.print(request)
# find beginning of respons... |
What is the best IRC network for Java (#java)? <p>Is efnet the network to be on in #java? Or are there other more active networks?</p>
| <p>try ##java on <a href="http://freenode.net/">freenode</a></p>
|
C# Action/Delegate Style Question <p>What is considered better style for an event definition:</p>
<pre><code>public event Action<object, double> OnNumberChanged;
</code></pre>
<p>or</p>
<pre><code>public delegate void DNumberChanged(object sender, double number);
public event DNumberChanged OnNumberChanged;
</... | <p>Neither 1 or 2. A third option is the winner</p>
<pre><code>public event EventHandler<NumberChangedEventArgs> NumberChanged;
</code></pre>
<p>You're breaking a number of style guidelines for developing in C#, such as using a type for event args that doesn't extend EventArgs. </p>
<p>Yes, you can do it this... |
"Resource not found" error while accessing elmah.axd in ASP.NET MVC project <p>My ASP.NET MVC application is within a folder called Stuff within IIS 6.0 webroot folder. So I access my pages as <a href="http://localhost/Stuff/Posts">http://localhost/Stuff/Posts</a>. I had EMLAH working while I was using the in-built web... | <p>Working with IIS7 I found I needed both sections of the <code>web.config</code> populated (<code>system.web</code> AND <code>system.webServer</code>) - see <a href="http://stackoverflow.com/questions/933554/elmah-not-working-with-asp-net-site/1175023#1175023">http://stackoverflow.com/questions/933554/elmah-not-worki... |
Is there a way for a Java enum to have "missing" integer values for its elements? <p>For example, I have two elements in an enum. I would like the first to be represented by the integer value 0 and the string A, but the second to be represented by the integer value of 2 and the string "B" (as opposed to 1). Is this pos... | <p>I assume you are referring to a way to make the ordinal of the Enum return a user-defined value. If this is the case, no.</p>
<p>If you want to return a specific value, implement (e.g. getValue()) and pass it in the Enum constructor.</p>
<p>For example:</p>
<pre><code>public enum Constants {
ZERO("Zero",0),
... |
Is there a way to do a 'project only' build or rebuild for a C# project <p>In Visual Studio 2005, you can right-click on a C++ project and choose <code>Project Only</code> > <code>Build Only [project]</code>.</p>
<p>Is there any way of doing the same for a C# project? If I choose <code>Build</code> from the project ri... | <p>Not necessarily - if the dependencies have not changed then they will not be rebuilt. If you select "ReBuild" then Visual Studio will rebuild the dependencies as well but you will find that a normal build will reuse the existing dependency assemblies if the source code for those assemblies is unchanged.</p>
<p>C# ... |
How do I build a QT console app in 64 bit on Mac OSX? <p>I need to build my QT console application as 64 bit. i.e. x86_64</p>
<p>My config file looks like this:</p>
<pre>
CONFIG += qt console debug x86_64
CONFIG -= app_bundle
HEADERS = HelperClass.h
SOURCES = HelperClass.cpp \
main.cpp
</pre>
<p>The co... | <p>The QT SDK does NOT include by default the 64 bit libraries in Mac OS X (I think it is strange but it is that way). For compiling my apps in x86_64 I just download the standalone libraries with Cocoa (32/64 bits) and I install them after the SDK is installed.</p>
<p>Everything works like a charm then.</p>
|
Show "Loading..." in dropdown box <p>I'm running a database query to load a dropdownbox using jquery. Is there a way to display the words "Loading..." in the dropdownbox while the query is running?</p>
<p>Thanks.</p>
| <p>Let's call your drop down 'userChoice', you can write code like</p>
<pre><code>$(document).ready(
function()
{
//Before calling your ajax method, clear the select drop down.
//and add a loading option.
$('#userChoice')
.children()
.remove()
.end()... |
illegal character, Javascript <p>I am trying to run jquery through a rails app. I have the edit information in a popup window and i want to change that to show information after they click update. It should work but this line </p>
<pre><code>$(".edit_business).append("<%= escape_javascript(render(:file => 'busin... | <p>Are you actually missing that quote?</p>
<pre><code>$(".edit_business").append(...)
</code></pre>
|
DataContracts with behavior <p>How bad is it? I have read countless articles and never created abstract DataContracts with behavior before, but it seems that doing so will solve an issue I am having that will prevent me from creating factories everywhere to determine a subclass implementation. My question is, will I be... | <p>You can add all the behavior you want to your data contracts. You should clearly document the fact that the behavior won't be visible to clients, or someone will be disappointed later on. Also document the fact that care must be taken to not add any implementation-dependent data to the data contract, since it's not ... |
Reference 'this' in dynamic event handler <p>In my 'myClass' class, I am using Reflection.Emit to dynamically write an event handler for one of the myClass class' members.</p>
<p>I have done this successfully.</p>
<p>Now, I want to modify the event handler to call one of the instance methods in the myClass class.</p>... | <p>If you are in main, then there is no instance of your Main class. The main function is static.</p>
|
Jquery: Div Fade in and out <p>I have been trying to make a div fade in evey 30sec and out after 30sec</p>
<pre><code>setInterval(function(){$('#myDiv').toggle();}, 300);
$("#popupboxdis").fadeIn("fast");
$("#popupboxdis").fadeOut("fast");
</code></pre>
| <p>The setInterval time is in milliseconds:</p>
<pre><code>setInterval(function(){
$('#myDiv').toggle('normal');
}, 30000);
</code></pre>
<p>Notice the extra <code>0</code>s. As it is right now it will try to toggle the element every 300 milliseconds or .3 seconds which is probably resulting in some wacky behavio... |
How would you count the number of bits set in a floating point number? <p>How do you count the number of bits set in a floating point number using C functions?</p>
| <p>If you want to work on the actual bitwise representation of a floating point number, you should do something like this:</p>
<pre><code>float f; /* whatever your float is */
int i = *(int *)&f;
</code></pre>
<p>What this does is take the address of <code>f</code> with the address-of operator, <code>&</code>... |
Localization in Class Library <p>I would like to localize my c# class library</p>
<p>The library will output a .dll file, which I will distribute to .net application bin folders.
I want localization in the class library but I do not want to have to recompile the DLL each time a localization change is required. </p>
<... | <p>Check this stackoverflow question.</p>
<p><a href="http://stackoverflow.com/questions/145430/is-there-any-performance-difference-in-using-resx-file-and-satellite-assembly">http://stackoverflow.com/questions/145430/is-there-any-performance-difference-in-using-resx-file-and-satellite-assembly</a></p>
<p>Looks like y... |
Creating strongly typed view with class in other project? <p>This is my project setup:</p>
<p>In visual studio I have a solution with a class library project for my linq2sql and an MVC web project.</p>
<p>I want to keep my models in the class library as I may build a windows app later.</p>
<p>I am trying to create a... | <p>The Visual Studio T4 template that drives this dialog populates the 'View Data Class' dropdown from classes contained in the "Models" namespace of your MVC project, so if the class is not in that namespace, it won't appear in the dropdown.</p>
<p>The fix would be to modify the T4 template so that it could reflect o... |
How to let Curl use same cookie as the browser from PHP <p>I have a PHP script that does an HTTP request on behalf of the browser and the outputs the response to the browser. Problem is when I click the links from the browser on this page it complains about cookie variables. I'm assuming it needs the browsers cookie(s)... | <p>This is how I forward all browser cookies to curl and also return all cookies for the curl request back to the browser. For this I needed to solve some problems like getting cookies from curl, parsing http header, sending multiple cookies and session locking:</p>
<pre><code>$ch = curl_init();
curl_setopt($ch, CURLO... |
How can I initialize state in a hidden way in Haskell (like the PRNG does)? <p>I went through some tutorials on the State monad and I think I got the idea.</p>
<p>For example, as in <a href="http://ertes.de/articles/monads.html#section-6" rel="nofollow">this nice tutorial</a>:</p>
<pre><code>import Data.Word
type LC... | <p><code>randomRIO</code> uses the <code>IO</code> monad. This seems to work nicely in the interpreter because the interpreter also works in the <code>IO</code> monad. That's what you are seeing in your example; you can't actually do that at the top-level in code -- you would have to put it in a do-expression like all ... |
Best Practices for Security Questions in Web Apps <p>I'm working on a web applications where - believe it or not- the users aren't required to provide their email address to sign up. These requirements can not change. The users will login to the system with an id and password just like any standard web site. The pro... | <blockquote>
<p>Are security questions the best approach to this problem?</p>
</blockquote>
<p>Since you cannot use any other means of authentication (such as email address, OpenID, etc.) this is the best you can do really. However, you could always add a "password hint" to the signup process.</p>
<blockquote>
<u... |
How do I determine which monitor my .NET Windows Forms program is running on? <p>I have a C# Windows application that I want to ensure will show up on a second monitor if the user moves it to one. I need to save the main form's size, location and window state - which I've already handled - but I also need to know whic... | <p>You can get an array of Screens that you have using this code.</p>
<pre><code>Screen[] screens = Screen.AllScreens;
</code></pre>
<p>You can also figure out which screen you are on, by running this code (<strong>this</strong> is the windows form you are on)</p>
<pre><code>Screen screen = Screen.FromControl(this);... |
SQLite autoincrement regex <p>I am taking create statement queries from SQLite like this:</p>
<pre><code>CREATE TABLE [users] ([id] INTEGER PRIMARY KEY AUTOINCREMENT, [username] VARCHAR, [password] VARCHAR, [default_project] VARCHAR)
</code></pre>
<p>created by using</p>
<pre><code>SELECT sql FROM sqlite_master WHE... | <pre><code>/(\"id\"|\[id\]|\'id\'|`id`|\\bid)\s+INTEGER\s+PRIMARY\s+KEY\s+AUTOINCREMENT/Ui
</code></pre>
<p>seems to work as intended.</p>
|
Bypassing Aggregate Root <p>Is it okay to get a read-only collection from an aggregate without going through the root to get it? My model does some of this right now and I was wondering if that's an acceptable design. Thanks</p>
<p>Edit: </p>
<p>Here's an example</p>
<p>I have an aggregate root entity called UserAcc... | <p>Evans says "The root is the only member of the AGGREGATE that outside objects are allowed to hold references to..." (p. 127)</p>
<p>My understanding is that the aggregate should appear as a unit to outside objects. Also, the <a href="http://en.wikipedia.org/wiki/Law%5Fof%5FDemeter" rel="nofollow">Law of Demeter</a... |
How can I use the dropdownlist to populate/enter data? <p>Here's my existing code:</p>
<pre><code> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="dsEmployees" DataTextField="Last_First"
DataValueField="EmpNum"
onselectedindexchanged="Drop... | <p>DropDownLists end up being rendered as <code><select></code> tags in HTML. These do not allow for data entry of new values. If you're looking for something similar to a ComboBox (a textbox and a listbox combined into the same control) then you'll need to find a third-party javascript implementation that is a... |
Select percentage of rows with different values <p>On a website I run, I let users rate the individual posts (3, 2, 1). I use the following SQL (in MySQL) to get the percentage of votes of each value:</p>
<pre><code>SELECT vote, COUNT(*) * t.factor AS pct
FROM ratings
JOIN (
SELECT 100 / COUNT(*) AS factor
FRO... | <p>Assuming that the <em>vote</em> column holds the value of the vote i.e. (3,2,1), then you would need the following query for tabulating the percentages per vote:</p>
<pre><code>SELECT r.id, r.vote, SUM(r.vote)/t.totalVotes AS percentOfVotes
FROM ratings r
JOIN (SELECT id, COUNT(id) AS totalVotes
FROM ratings
... |
Is there a CMS like Plone but in Grails? <p>I really like plone as a CMS, but its base is in Python. I would like to know if there is a CMS that has Grails as a base.</p>
| <p>You might want to take a look at Weceem CMS, which is open-source and uses Grails as the foundation.</p>
<p><a href="http://www.weceem.org/weceem/" rel="nofollow">http://www.weceem.org/weceem/</a></p>
|
Automatic Properties in C# 3 - Must declare a body for get if I declare one for set? <p>I'm using VS 2008, and in my property pages for the project I see that I'm targeting .Net 3.5.</p>
<p>Here is the error I'm getting when trying to compile:</p>
<blockquote>
<p>AMSDataModels.Vehicle.VIN.get' must declare a body b... | <p>If you're going to add logic in the set, you need to add it into the get as well. Notice in your set you're not actually setting a value to anything?</p>
<p>Add a backing field,</p>
<pre><code>private string _vin;
</code></pre>
<p>and return that in the get.</p>
<pre><code>public string VIN
{
get { return _v... |
Setting bash command-line variable to start my application <p>I'm pretty new to programming for Linux environments, so I don't exactly know what to search for in order to answer this question for myself. I need to understand how applications set the shell to accept a certain command to start them. For example, you can ... | <p>Firefox is launched by the command "firefox" because there is an executable file in one of the folders in the $PATH environment variable called "firefox".</p>
|
WMI Cheatsheet? <p>Is there a cheatsheet available for WMI? Like what can be queried, where to query it from?</p>
| <p>There's a ton of information available to query. I think that the best way is just to enumerate everything and have a look.</p>
<p>Try Microsoft's <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en" rel="nofollow">WMI Code Creator</a> applicatio... |
jQuery selecting elements that don't yet exist <p>In jQuery I want to be able to select an element that does not even exist yet, how can I accomplish this?</p>
<p>I would like to select an element by their id when they are created.</p>
<p>Thanks.</p>
| <p>You can bind events to elements that don't yet exist using .on(); but other than that, I don't think you've got much of a solution.</p>
<p>What are you trying to do exactly?</p>
<pre><code>$(document).on("click", "#futureID", function(){
/* whenever <a id='futureID'>Hello</a> is created,
it will... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.