Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit.

  • Loading branch information...
commit 8d05ac74bf664e2e7da2573557541bb5d967238d 1 parent 7ae88c6
@maxim authored
View
16 README.rdoc
@@ -1,17 +1 @@
-= sogger
-Description goes here.
-
-== Note on Patches/Pull Requests
-
-* Fork the project.
-* Make your feature addition or bug fix.
-* Add tests for it. This is important so I don't break it in a
- future version unintentionally.
-* Commit, do not mess with rakefile, version, or history.
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-* Send me a pull request. Bonus points for topic branches.
-
-== Copyright
-
-Copyright (c) 2009 Maxim Chernyak. See LICENSE for details.
View
5 Rakefile
@@ -10,7 +10,10 @@ begin
gem.email = "max@bitsonnet.com"
gem.homepage = "http://github.com/maxim/sogger"
gem.authors = ["Maxim Chernyak"]
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
+ gem.add_dependency "meow"
+ gem.add_dependency "nokogiri"
+ gem.add_development_dependency "shoulda"
+ gem.add_development_dependency "fakeweb"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
View
7 bin/sogger
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'sogger'))
+
+sogger = Sogger::Runner.new
+puts "Press CTRL+C to stop..."
+sogger.run
View
7 lib/sogger.rb
@@ -0,0 +1,7 @@
+require 'open-uri'
+require 'nokogiri'
+require 'meow'
+
+require File.dirname(__FILE__) + "/sogger/question.rb"
+require File.dirname(__FILE__) + "/sogger/sogger.rb"
+require File.dirname(__FILE__) + "/sogger/runner.rb"
View
38 lib/sogger/question.rb
@@ -0,0 +1,38 @@
+module Sogger
+ class Question
+ include Comparable
+ attr_accessor :attributes
+
+ def initialize(attributes = {})
+ @attributes = attributes
+ end
+
+ def self.from_xml(xml_element)
+ attributes = { :title => xml_element.css('title').text,
+ :url => xml_element.css('id').text,
+ :tags => xml_element.css('category').map{|c| c['term']},
+ :published => DateTime.parse(xml_element.css('published').text) }
+ new attributes
+ end
+
+ def title
+ @attributes[:title]
+ end
+
+ def url
+ @attributes[:url]
+ end
+
+ def tags
+ @attributes[:tags]
+ end
+
+ def published
+ @attributes[:published]
+ end
+
+ def <=>(other)
+ other.published <=> published
+ end
+ end
+end
View
61 lib/sogger/runner.rb
@@ -0,0 +1,61 @@
+module Sogger
+ class Runner
+ UPDATE_INTERVAL = 60
+ GROWL_INTERVAL = 20
+
+ def initialize
+ @cached_sogger = Sogger.new
+ @remote_sogger = Sogger.new
+ @questions_buffer = []
+ @growler = Meow.new("Sogger")
+ end
+
+ def run
+ updater = Thread.new("updater") do
+ while true
+ puts "Updater: Downloading feed..."
+ @remote_sogger.download_feed!
+
+ new_questions = []
+ unless @cached_sogger.questions.empty?
+ puts "Updater: Comparing feeds..."
+ new_questions = (@remote_sogger - @cached_sogger).questions
+ end
+
+ unless new_questions.empty?
+ puts "Updater: Adding #{new_questions.size} questions to buffer..."
+ @questions_buffer += new_questions
+ end
+
+ puts "Updater: Caching feed..."
+ @remote_sogger.save!
+
+ puts "Updater: Loading cached feed..."
+ @cached_sogger.load!
+
+ puts "Updater: Sleeping for #{UPDATE_INTERVAL} seconds..."
+ sleep UPDATE_INTERVAL
+ end
+ end
+
+ notifier = Thread.new("notifier") do
+ while true
+ unless @questions_buffer.empty?
+ puts "\nNotifier: Growling..."
+ growl(@questions_buffer.pop)
+ end
+
+ sleep GROWL_INTERVAL
+ end
+ end
+
+ [updater, notifier].map(&:join)
+ end
+
+ def growl(question)
+ @growler.notify(question.tags.join(', '), question.title) do
+ system "open", question.url
+ end
+ end
+ end
+end
View
45 lib/sogger/sogger.rb
@@ -0,0 +1,45 @@
+module Sogger
+ class Sogger
+ class << self; attr_accessor :save_path end
+ attr_reader :raw_data
+
+ SO_FEED_URL = "http://stackoverflow.com/feeds"
+ DEFAULT_SAVE_PATH = "tmp/feed.xml"
+ self.save_path = DEFAULT_SAVE_PATH
+
+ def initialize(questions = [])
+ @questions = questions
+ end
+
+ def questions
+ @questions.sort
+ end
+
+ def download_feed!
+ @raw_data = open(SO_FEED_URL).read
+ parse_raw_data
+ end
+
+ def save!
+ File.open(self.class.save_path, "w") do |file|
+ file.write @raw_data
+ end
+ end
+
+ def load!
+ @raw_data = File.read(self.class.save_path)
+ parse_raw_data
+ end
+
+ def -(other)
+ newest_other = other.questions.first
+ Sogger.new(questions.select{|q| q < newest_other })
+ end
+
+ private
+ def parse_raw_data
+ @data = Nokogiri::XML(@raw_data)
+ @questions = @data.css('entry').map{ |e| Question.from_xml(e) }
+ end
+ end
+end
View
1,150 test/fixtures/so_feed_sample.xml
@@ -0,0 +1,1150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:re="http://purl.org/atompub/rank/1.0">
+ <title type="text">Recent Questions - Stack Overflow</title>
+ <link rel="self" href="http://stackoverflow.com/feeds" type="application/atom+xml" />
+ <link rel="alternate" href="http://stackoverflow.com/questions" type="text/html" />
+ <subtitle>most recent 30 from stackoverflow.com</subtitle>
+ <updated>2009-12-07T01:03:53Z</updated>
+ <id>http://stackoverflow.com/feeds</id>
+ <creativeCommons:license>http://www.creativecommons.org/licenses/by-nc/2.5/rdf</creativeCommons:license>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1856203/windows-and-minibuffer-floating-over-the-frame</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Windows and Minibuffer floating over the frame</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="emacs"/>
+ <author><name>konr</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1856203/windows-and-minibuffer-floating-over-the-frame" />
+ <published>2009-12-06T18:48:09Z</published>
+ <updated>2009-12-07T01:03:42Z</updated>
+ <summary type="html">
+ &lt;p&gt;Hi!&lt;/p&gt;
+
+&lt;p&gt;When I start Emacs, its windows and its minibuffer start up floating on the main frame, leaving a lot of empty space (see: &lt;a href=&quot;http://scorciapino.com/pub/fotos/erroemacs.jpg&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://scorciapino.com/pub/fotos/erroemacs2.jpg&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;). Any idea of what is going on and how to fix it?&lt;/p&gt;
+
+&lt;p&gt;Thanks!&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1853653/hidden-features-of-coldfusion</id>
+ <re:rank scheme="http://stackoverflow.com">2</re:rank>
+ <title type="text">Hidden features of ColdFusion</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="coldfusion"/><category scheme="http://stackoverflow.com/feeds/tags" term="subjective"/><category scheme="http://stackoverflow.com/feeds/tags" term="hidden-features"/><category scheme="http://stackoverflow.com/feeds/tags" term="easter-eggs"/>
+ <author><name>Sergii</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1853653/hidden-features-of-coldfusion" />
+ <published>2009-12-05T22:20:49Z</published>
+ <updated>2009-12-07T01:02:45Z</updated>
+ <summary type="html">
+ &lt;p&gt;Let's try to make this for our favourite technology too, how do you think?&lt;/p&gt;
+
+&lt;p&gt;Hidden code tricks, unknown usages of known features, application server easter eggs are what are we looking for.&lt;/p&gt;
+
+&lt;p&gt;So, proposed rules are simple:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;One feature per answer.&lt;/li&gt;
+&lt;li&gt;Code example, if it is the CFML/CFScript feature.&lt;/li&gt;
+&lt;li&gt;Application server name and version where it can be reproduced.&lt;/li&gt;
+&lt;li&gt;Link on the source, if re-posting someone (let's be honest).&lt;/li&gt;
+&lt;li&gt;Any additional requirements/tips to reproduce.&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;hr&gt;&lt;/p&gt;
+
+&lt;p&gt;Example (old one, many of us should remember)&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Credits easter egg with custom IE language&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Open your IE (6+), go to: Tools -&gt; Internet Options -&gt; Languages. &lt;/p&gt;
+
+&lt;p&gt;Add a new custom language called &quot;CFML&quot; (without quotes) and shift it to the top of list. &lt;/p&gt;
+
+&lt;p&gt;Then log into your ColdFusion Administrator and click on System Information. &lt;/p&gt;
+
+&lt;p&gt;Funny pop-up should show up. &lt;/p&gt;
+
+&lt;p&gt;It works in CFMX 6, 7.2 and Adobe CF 8 (9 not checked).&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857204/objective-c-problem-with-strings</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Objective c, problem with strings</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="nsstring"/><category scheme="http://stackoverflow.com/feeds/tags" term="sqlite"/>
+ <author><name>unknown (google)</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857204/objective-c-problem-with-strings" />
+ <published>2009-12-07T00:53:30Z</published>
+ <updated>2009-12-07T01:02:36Z</updated>
+ <summary type="html">
+ &lt;p&gt;Hi,
+first of all please let me say that I am quite new to objective c development. I am writing a small app for personal use for the iphone, but I have some problems executing the following code:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;NSString *sql = [[NSString alloc] initWithFormat:@&quot;select color_r, color_g, color_b from Calendar where ROWID = %@&quot;, [calendarsID objectForKey:[arrayColors objectAtIndex:row]]];
+
+sqlite3_stmt *selectstmt;
+
+if(sqlite3_prepare_v2(database, sql, -1, &amp;amp;selectstmt, NULL) == SQLITE_OK)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The compiler tells me that I am passing argument 2 of sqlite3_prepare_v2 from an incompatible pointer type. The program gets, anyhow, compiled and runs but, when it has to execute the code that I've just shown you, it produces an error. It says that there is a syntax error in the query, and the syntax error is just in the last part of the query. Instead of having:&lt;/p&gt;
+
+&lt;p&gt;select color_, color_g, color_b from Calendar where ROWID = 63 (for example)&lt;/p&gt;
+
+&lt;p&gt;I get strange characters in the place of the last number (63). I guess this is a problem related to string conversion. Can please anyhone help me?&lt;/p&gt;
+
+&lt;p&gt;Thank you very much for your attention.
+Alessio&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1854623/how-to-get-the-x-y-coordinate-of-a-mouse-click-with-win32-c-on-a-directx-object</id>
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
+ <title type="text">How to get the x,y coordinate of a mouse-click with win32 C++ on a directx object?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="c++"/><category scheme="http://stackoverflow.com/feeds/tags" term="directx"/><category scheme="http://stackoverflow.com/feeds/tags" term="win32"/>
+ <author><name>Chris</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1854623/how-to-get-the-x-y-coordinate-of-a-mouse-click-with-win32-c-on-a-directx-object" />
+ <published>2009-12-06T07:14:23Z</published>
+ <updated>2009-12-07T01:01:46Z</updated>
+ <summary type="html">
+ &lt;p&gt;How can I get the x,y coordinate of a mouse click, to see if it is over my menu button drawn by directx? Currently, my codebase has the following mouse-related class that doesn't seem to be able to give me this..I'm not sure how this might work.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;InputMouse::InputMouse() :
+ m_LastX(-1),
+ m_LastY(-1)
+{
+ m_MouseActionEvent.clear();
+}
+
+InputMouse::~InputMouse()
+{
+
+}
+
+void InputMouse::PostUpdate()
+{
+ m_CurrentAction.clear();
+}
+
+bool InputMouse::IsEventTriggered(int eventNumber)
+{
+ for (unsigned int i = 0; i &amp;lt; m_CurrentAction.size(); i++)
+ {
+ if (m_MouseActionEvent.size() &amp;gt; 0 &amp;amp;&amp;amp; m_MouseActionEvent[m_CurrentAction[i]] == eventNumber)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+void InputMouse::AddInputEvent(int action, int eventNumber)
+{
+ m_MouseActionEvent[action] = eventNumber;
+}
+
+void InputMouse::SetMouseMouse(int x, int y)
+{
+ if (m_LastX != -1)
+ {
+ if (x &amp;gt; m_LastX)
+ {
+ m_CurrentAction.push_back(MOUSE_RIGHT);
+ }
+ else if (x &amp;lt; m_LastX)
+ {
+ m_CurrentAction.push_back(MOUSE_LEFT);
+ }
+
+ if (y &amp;gt; m_LastY)
+ {
+ m_CurrentAction.push_back(MOUSE_UP);
+ }
+ else if (y &amp;lt; m_LastY)
+ {
+ m_CurrentAction.push_back(MOUSE_DOWN);
+ }
+ }
+
+ m_LastX = x;
+ m_LastY = y;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1856887/is-there-a-way-to-make-the-code-folding-stay-folded-in-delphi-2010</id>
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
+ <title type="text">Is there a way to make the &quot;Code Folding&quot; Stay Folded In Delphi 2010</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="delphi"/><category scheme="http://stackoverflow.com/feeds/tags" term="delphi-2010"/><category scheme="http://stackoverflow.com/feeds/tags" term="code-folding"/>
+ <author><name>Cape Cod Gunny</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1856887/is-there-a-way-to-make-the-code-folding-stay-folded-in-delphi-2010" />
+ <published>2009-12-06T22:39:14Z</published>
+ <updated>2009-12-07T01:01:38Z</updated>
+ <summary type="html">
+ &lt;p&gt;I absolutely love the &lt;b&gt;Code Folding&lt;/b&gt; feature inside Delphi 2010. However, each time start Delphi 2010 and reopen my project the code I had peviously folded down is no longer folded. Is there a way to keep the folded code, folded when you close down the IDE?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857158/adding-floats-with-javascript</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Adding floats with javascript</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="javascript"/><category scheme="http://stackoverflow.com/feeds/tags" term="jquery"/>
+ <author><name>jpsilvashy</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857158/adding-floats-with-javascript" />
+ <published>2009-12-07T00:36:19Z</published>
+ <updated>2009-12-07T01:01:03Z</updated>
+ <summary type="html">
+ &lt;p&gt;I'm using jQuery, and I want to sum up the values in my table column, everything seems to work fine, but my value is returned a string with all the values added like: &lt;code&gt;123.5013.0012.35&lt;/code&gt;&lt;/p&gt;
+
+&lt;p&gt;How can I sum these properly?&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;var totals
+
+$(&quot;.add&quot;).each(function(i) {
+ totals += parseFloat($(this).text()).toFixed(2);
+});
+
+console.log(totals);
+&lt;/code&gt;&lt;/pre&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857131/haskell-question-regarding-data</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Haskell question regarding data</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="haskell"/>
+ <author><name>usr</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857131/haskell-question-regarding-data" />
+ <published>2009-12-07T00:28:27Z</published>
+ <updated>2009-12-07T01:00:55Z</updated>
+ <summary type="html">
+ &lt;p&gt;Code:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;data Exp = Const a | Eq Exp Exp
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;I want the &lt;em&gt;Const a&lt;/em&gt; to contain a value of type show so that i can print it later. So in C# i would write:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;class Const : Exp { IShow X; }
+class Eq : Exp { Exp X, Y; }
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;How can i do that in Haskell?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857050/using-apples-automator-to-pass-filenames-to-a-shell-script</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Using apple's Automator to pass filenames to a shell script.</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="shell"/><category scheme="http://stackoverflow.com/feeds/tags" term="script"/><category scheme="http://stackoverflow.com/feeds/tags" term="automator"/>
+ <author><name>John </name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857050/using-apples-automator-to-pass-filenames-to-a-shell-script" />
+ <published>2009-12-06T23:41:19Z</published>
+ <updated>2009-12-07T01:00:46Z</updated>
+ <summary type="html">
+ &lt;p&gt;I have an automator script that I'd like to run on a folder. I want the script to take each file in the folder and run my shell command on it. Automator is set to pass input to stdin, but I don't think I'm using stdin correctly below, can you help please?&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;for f in &quot;$@&quot;
+do
+ java -Xmx1000m -jar /Users/myprog/myprog.jar $f
+done
+&lt;/code&gt;&lt;/pre&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857222/masks-in-air-with-actionscript-3</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Masks in AIR with Actionscript 3</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="air"/><category scheme="http://stackoverflow.com/feeds/tags" term="actionscript-3"/><category scheme="http://stackoverflow.com/feeds/tags" term="as3"/><category scheme="http://stackoverflow.com/feeds/tags" term="mask"/>
+ <author><name>webdreamer</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857222/masks-in-air-with-actionscript-3" />
+ <published>2009-12-07T01:00:18Z</published>
+ <updated>2009-12-07T01:00:18Z</updated>
+ <summary type="html">
+ &lt;p&gt;I'm trying to do a mask on a circle shape in ActionScript 3 (I'm using the Flex AIR framework). It has to do with the ecological footprint, each circle representing one earth.
+This ecological footprint picture is inside a container. The problem is that the mask seems to be fixed, though the picture floats. When I scroll the container down, the picture will scroll just fine, but the mask won't, clipping out the top of the picture.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;mask = new UIMovieClip();
+mask.graphics.beginFill(0xFFFFFF);
+mask.graphics.drawRect(radius,radius+radius*2*(1-(ecoWeight-Math.floor(ecoWeight))),1000,1000);
+mask.graphics.endFill();
+earth = new UIMovieClip();
+earth.graphics.beginFill(0xFFFFFF);
+earth.graphics.drawCircle(radius,radius,radius);
+earth.mask=mask;
+earth.graphics.endFill();
+&lt;/code&gt;&lt;/pre&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857191/jquery-is-mouse-still-over-the-element</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">jQuery: is mouse still over the element?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="jquery"/><category scheme="http://stackoverflow.com/feeds/tags" term="mouseover"/>
+ <author><name>thedp</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857191/jquery-is-mouse-still-over-the-element" />
+ <published>2009-12-07T00:48:05Z</published>
+ <updated>2009-12-07T01:00:17Z</updated>
+ <summary type="html">
+ &lt;p&gt;Hello,&lt;/p&gt;
+
+&lt;p&gt;I would like to be able to detect if the mouse is still over the element in the following scenario:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;If mouseover then sleep for a few seconds.&lt;/li&gt;
+&lt;li&gt;Once done sleeping check of the mouse is still over the same element.&lt;/li&gt;
+&lt;li&gt;If true then do something.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;How can I achieve #2?&lt;/p&gt;
+
+&lt;p&gt;Thank you.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1855773/avoid-slicing-of-exception-types-c</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Avoid slicing of exception types (C++)</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="gcc"/><category scheme="http://stackoverflow.com/feeds/tags" term="exceptions"/><category scheme="http://stackoverflow.com/feeds/tags" term="slicing"/><category scheme="http://stackoverflow.com/feeds/tags" term="c++"/><category scheme="http://stackoverflow.com/feeds/tags" term="derived"/>
+ <author><name>shojtsy</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1855773/avoid-slicing-of-exception-types-c" />
+ <published>2009-12-06T16:08:38Z</published>
+ <updated>2009-12-07T01:00:16Z</updated>
+ <summary type="html">
+ &lt;p&gt;I am designing an exception hierarchy in C++ for my library. The &quot;hierarchy&quot; is 4 classes derived from std::runtime_error. I would like to avoid the &lt;a href=&quot;http://stackoverflow.com/questions/274626/what-is-the-slicing-problem-in-c&quot;&gt;slicing problem&lt;/a&gt; for the exception classes so made the copy constructors protected. But apparently gcc requires to call the copy constructor when throwing instances of them, so complains about the protected copy constructors. Visual C++ 8.0 compiles the same code fine. Are there any portable way to defuse the slicing problem for exception classes? Does the standard say anything about whether an implementation could/should require copy constructor of a class which is to be thrown?&lt;/p&gt;
+
+&lt;h3&gt;Edit: Answering my own questions&lt;/h3&gt;
+
+&lt;p&gt;Thanks for the answers. The two portable ways I have found to stop clients of my library from catching exceptions incorrectly by value are&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Throw exceptions from inside &lt;a href=&quot;http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.10&quot; rel=&quot;nofollow&quot;&gt;virtual raise&lt;/a&gt; methods of the exception classes, and make copy constructors protected. (Thanks D.Shawley)&lt;/li&gt;
+&lt;li&gt;Throw derived exceptions from the library and publish exception base classes for clients to catch. The base classes could have protected copy constructors, which only allows the good way of catching them. (mentioned &lt;a href=&quot;http://stackoverflow.com/questions/1095225/exception-slicing-is-this-due-to-generated-copy-constructor&quot;&gt;here&lt;/a&gt; for a simmilar question)&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The C++ standard does state that copy constructor needs to be accessible at the point of throw. Visual C++ 8.0 in my configuration violated this part of the standard by not enforcing the presence of the copy constructor. In section 15.1.3:&lt;/p&gt;
+
+&lt;blockquote&gt;
+ &lt;p&gt;A throw-expression initializes a temporary object, the type of which is determined by removing any top-level cv-qualifiers from the static type of the operand of throw and adjusting the type from “array of T” or “function returning T” to “pointer to T” or “pointer to function returning T”, respectively.&lt;/p&gt;
+
+ &lt;p&gt;If the use of the temporary object can be eliminated without changing the meaning of the program except for the execution of constructors and destructors associated with the use of the temporary object (12.2), then the exception in the handler can be initialized directly with the argument of the throw expression. When the thrown object is a class object, and the copy constructor used to initialize the temporary copy is not accessible, the program is ill-formed (even when the temporary object could otherwise be eliminated)&lt;/p&gt;
+&lt;/blockquote&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/386576/multilingual-flex-app</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Multilingual Flex App</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="flex"/><category scheme="http://stackoverflow.com/feeds/tags" term="multilanguage"/><category scheme="http://stackoverflow.com/feeds/tags" term="fonts"/><category scheme="http://stackoverflow.com/feeds/tags" term="runtime"/>
+ <author><name>unknown (google)</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/386576/multilingual-flex-app" />
+ <published>2008-12-22T15:53:12Z</published>
+ <updated>2009-12-07T01:00:00Z</updated>
+ <summary type="html">
+ &lt;p&gt;Hi,
+I'm working on a multilingual flex application that has to run in 27+ languages, including asian, hebrew and arabic, as well as all european languages.&lt;/p&gt;
+
+&lt;p&gt;We work with an embedded font (Myriad Pro) and have plenty of styles in a css that make use of that embedded font. We've tested with a modified version of Myriad including all non western unicode chars taken from Arial Unicode and it works ok, but the weight of the swf is unacceptable.&lt;/p&gt;
+
+&lt;p&gt;We have this two lines in our css..&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;@font-face
+{
+ src: url(&quot;MyriadPro-Semibold.otf&quot;);
+ fontFamily: &quot;Default Font&quot;;
+ fontWeight: bold;
+ advancedAntiAliasing: true;
+}
+@font-face
+{
+ src: url(&quot;MyriadPro-Regular.otf&quot;);
+ fontFamily: &quot;Default Font&quot;;
+ advancedAntiAliasing: true;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;and the rest of stlyes use the &quot;Default Font&quot; when needed.&lt;/p&gt;
+
+&lt;p&gt;What is the best solution for implementing the multilingual apps with runtime loading fonts, while maintaining the current stylesheet?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1321256/type-code-in-to-a-text-input-form-how</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Type code in to a text input form, how?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="php"/><category scheme="http://stackoverflow.com/feeds/tags" term="input"/><category scheme="http://stackoverflow.com/feeds/tags" term="form"/><category scheme="http://stackoverflow.com/feeds/tags" term="echo"/>
+ <author><name>Per Magnusson</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1321256/type-code-in-to-a-text-input-form-how" />
+ <published>2009-08-24T09:07:43Z</published>
+ <updated>2009-12-07T01:00:00Z</updated>
+ <summary type="html">
+ &lt;p&gt;Hello!
+I want to know the best way of writing out my &quot;$imagepath&quot; in to this input &lt;/p&gt;
+
+&lt;p&gt;This is my upload script&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;?php
+ if(isset($_POST['submit'])){
+ if (isset ($_FILES['new_image'])){
+ $imagename = $_FILES['new_image']['name'];
+ $source = $_FILES['new_image']['tmp_name'];
+ $target = &quot;temporary_images/&quot;.$imagename;
+ move_uploaded_file($source, $target);
+
+ $imagepath = $imagename;
+ $save = &quot;temporary_images/&quot; . $imagepath; //This is the new file you saving
+ $file = &quot;temporary_images/&quot; . $imagepath; //This is the original file
+
+ list($width, $height) = getimagesize($file) ;
+
+ $modwidth = 350;
+ $modheight = 100;
+
+ $tn = imagecreatetruecolor($modwidth, $modheight) ;
+ $image = imagecreatefromjpeg($file) ;
+ imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
+
+ imagejpeg($tn, $save, 100) ;
+
+ $save = &quot;temporary_images/sml_&quot; . $imagepath; //This is the new file you saving
+ $file = &quot;temporary_images/&quot; . $imagepath; //This is the original file
+
+ list($width, $height) = getimagesize($file) ;
+
+ $modwidth = 80;
+ $modheight = 100;
+
+ $tn = imagecreatetruecolor($modwidth, $modheight) ;
+ $image = imagecreatefromjpeg($file) ;
+ imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
+
+ imagejpeg($tn, $save, 100) ;
+ echo &quot;Large image: &amp;lt;img src='temporary_images/&quot;.$imagepath.&quot;'&amp;gt;&amp;lt;br&amp;gt;&quot;;
+ echo &quot;$imagepath&quot;
+ }
+ }
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;And this is my form&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;form&amp;gt;
+ &amp;lt;input name=&quot;animeinput&quot; id=&quot;animeinput&quot; size=&quot;20&quot; class=&quot;textbox&quot;&amp;gt;
+&amp;lt;/form&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1093731/creating-an-application-print-queue</id>
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
+ <title type="text">Creating an application print queue</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term=".net"/><category scheme="http://stackoverflow.com/feeds/tags" term="printing"/>
+ <author><name>Dan</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1093731/creating-an-application-print-queue" />
+ <published>2009-07-07T17:41:06Z</published>
+ <updated>2009-12-07T01:00:00Z</updated>
+ <summary type="html">
+ &lt;p&gt;We've received a rather tricky business requirement.&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;Users should be able to store print jobs in the application, until the user explicitly decides to send the jobs to the actual printer.&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;The easy solution (the way I see it) is to have a small windows application installed on the clients computers which stores the jobs in a queue locally on the clients computers. Anyone know if such a program exists?&lt;/p&gt;
+
+&lt;p&gt;The implement-ourselves option seems rather complicated. Storing the printed files in a database in either, word, pdf, xps or prn format until the user decides to print.
+This option is further complicated by that it should be possible to do it directly from MS Word. Any pointers to how to go about it?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/855030/help-linq-to-sql</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Help Linq to Sql</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="linq-to-sql"/><category scheme="http://stackoverflow.com/feeds/tags" term="asp.net-mvc"/>
+ <author><name>John Prado</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/855030/help-linq-to-sql" />
+ <published>2009-05-12T21:46:28Z</published>
+ <updated>2009-12-07T01:00:00Z</updated>
+ <summary type="html">
+ &lt;p&gt;Why am I getting a exception when ApplyPropertyChanges???&lt;/p&gt;
+
+&lt;p&gt;The code is almost the same when I'm editing a user table but is not working with my news table.&lt;/p&gt;
+
+&lt;p&gt;The create, delete and details are all working fine but when I try to edit a news I'm getting the exception below:&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;The ObjectStateManager does not contain a ObjectStateEntry 'MagixCMS.Models.noticia'&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace MagixCMS.Models
+{
+ public class NoticiaRepository : INoticiaRepository
+ {
+ #region INoticiaRepository Members
+
+ magixcmsEntities _entities = new magixcmsEntities();
+
+ public noticia CreateNoticia(noticia noticiaToCreate)
+ {
+ _entities.AddTonoticiaSet(noticiaToCreate);
+ _entities.SaveChanges();
+ return noticiaToCreate;
+ }
+
+ public void DeletaNoticia(noticia noticiaToDelete)
+ {
+ var noticiaOriginal = GetNoticia(noticiaToDelete.Id);
+ _entities.DeleteObject(noticiaOriginal);
+ _entities.SaveChanges();
+ }
+
+ public noticia EditNoticia(noticia noticiaToEdit)
+ {
+ var noticiaOriginal = GetNoticia(noticiaToEdit.Id);
+ _entities.ApplyPropertyChanges(noticiaToEdit.EntityKey.EntitySetName, noticiaToEdit); //EXCEPTION HERE
+ _entities.SaveChanges();
+ return noticiaToEdit;
+ }
+
+ public noticia GetNoticia(int id)
+ {
+ return (from c in _entities.noticiaSet where c.Id == id select c).FirstOrDefault();
+ }
+
+ public IEnumerable&amp;lt;noticia&amp;gt; ListNoticias()
+ {
+ return _entities.noticiaSet.ToList();
+ }
+
+ #endregion
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;I google the exception and didn't found much help.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1736314/writing-to-an-xml-file-with-xmllite</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Writing to an xml file with xmllite?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="c++"/><category scheme="http://stackoverflow.com/feeds/tags" term="xml"/><category scheme="http://stackoverflow.com/feeds/tags" term="xmllite"/>
+ <author><name>Chris</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1736314/writing-to-an-xml-file-with-xmllite" />
+ <published>2009-11-15T01:56:32Z</published>
+ <updated>2009-12-07T00:59:40Z</updated>
+ <summary type="html">
+ &lt;p&gt;I have an xml file which holds a set of &quot;&lt;code&gt;game&lt;/code&gt;&quot; nodes (which contain details about saved gameplay, as you'd save your game on any console game). All of this is contained within a &quot;&lt;code&gt;games&lt;/code&gt;&quot; root node. I'm implementing save functionality to this xml file and wish to be able to append or overwrite a &quot;&lt;code&gt;game&lt;/code&gt;&quot; node and its child nodes within the &quot;&lt;code&gt;games&lt;/code&gt;&quot; root node. &lt;/p&gt;
+
+&lt;p&gt;How can this be accomplished with &lt;code&gt;xmllite.dll&lt;/code&gt;?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1856915/nice-way-to-pass-parameters-to-pdo</id>
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
+ <title type="text">Nice way to pass parameters to PDO</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="php"/><category scheme="http://stackoverflow.com/feeds/tags" term="sql"/><category scheme="http://stackoverflow.com/feeds/tags" term="query"/><category scheme="http://stackoverflow.com/feeds/tags" term="parameters"/><category scheme="http://stackoverflow.com/feeds/tags" term="varargs"/>
+ <author><name>Ramon</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1856915/nice-way-to-pass-parameters-to-pdo" />
+ <published>2009-12-06T22:48:22Z</published>
+ <updated>2009-12-07T00:59:29Z</updated>
+ <summary type="html">
+ &lt;p&gt;Positional parameters become a nightmare when dealing with more than 3 or 4 parameters. Named parameters are verbose. I'm thinking of doing this:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;query(&quot;SELECT * FROM users WHERE username = &quot;, $username, &quot; AND password = &quot;, $password)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;With dynamic parameters (using &lt;code&gt;func_get_args()&lt;/code&gt;), every second one being transformed into a positional parameter. &lt;/p&gt;
+
+&lt;p&gt;I've never seen this before and wanted to know if anyone has done this before and why/why not?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857083/how-functional-language-are-different-from-the-language-implementation-point-of-v</id>
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
+ <title type="text">How Functional language are different from the language implementation point of view.</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="functional-programming"/><category scheme="http://stackoverflow.com/feeds/tags" term="haskell"/><category scheme="http://stackoverflow.com/feeds/tags" term="ml"/><category scheme="http://stackoverflow.com/feeds/tags" term="lisp"/>
+ <author><name>Dinesh Simkhada</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857083/how-functional-language-are-different-from-the-language-implementation-point-of-v" />
+ <published>2009-12-06T23:59:49Z</published>
+ <updated>2009-12-07T00:59:14Z</updated>
+ <summary type="html">
+ &lt;p&gt;There is whole new paradigm and needs total change of though of programming when using Functional programming languages compared to the procedural programming language, lazy, higher order functions, purity, monads..etc which we can normally doesn't see in many imperative and oop languages. but how implementation of these languages differs from imperative or oop languages here i mean memory management or the internal stuffs like pointers etc, there is the function languages which runs on top of JVM does this means the internal working of these languages are the same as other languages ?.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857179/sql-server-replication-consolidation</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">SQL Server Replication, Consolidation</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="sql-server"/><category scheme="http://stackoverflow.com/feeds/tags" term="replication"/><category scheme="http://stackoverflow.com/feeds/tags" term="consolidation"/>
+ <author><name>BrainMan</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857179/sql-server-replication-consolidation" />
+ <published>2009-12-07T00:42:42Z</published>
+ <updated>2009-12-07T00:59:13Z</updated>
+ <summary type="html">
+ &lt;p&gt;How do I consolidate multiple publications into 1 consolidated table on the subscriber? For example. Consider a very simple sales model where we replicate sales data from the stores to the central office.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;Store 1 Sales Table
+=====================
+Item Qty Amt
+=====================
+111 2 10.00
+222 1 7.00
+333 1 12.00
+
+Store 2 Sales Table
+=====================
+Item Qty Amt
+=====================
+111 2 18.00
+222 1 13.00
+333 1 4.00
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;How do I replicate these two sales publications from the publisher to ONE consolidated sales table at the subscriber:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;Central Office
+==============================
+Store Item Qty Amt
+==============================
+1 111 2 10.00
+1 222 1 7.00
+1 333 1 12.00
+2 111 2 18.00
+2 222 1 13.00
+2 333 1 4.00
+&lt;/code&gt;&lt;/pre&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1856963/python-soappy-add-header</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">python soappy add header</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="python"/><category scheme="http://stackoverflow.com/feeds/tags" term="soap"/><category scheme="http://stackoverflow.com/feeds/tags" term="soappy"/><category scheme="http://stackoverflow.com/feeds/tags" term="headers"/>
+ <author><name>dandu</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1856963/python-soappy-add-header" />
+ <published>2009-12-06T23:13:08Z</published>
+ <updated>2009-12-07T00:57:17Z</updated>
+ <summary type="html">
+ &lt;p&gt;I have the following PHP example code:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$client = new SoapClient(&quot;http://example.com/example.wsdl&quot;);
+
+$h = Array();
+array_push($h, new SoapHeader(&quot;http://example2.com/example2/&quot;, &quot;h&quot;, &quot;v&quot;));
+$client-&amp;gt;__setSoapHeaders($h);
+
+$s = $client-&amp;gt;__soapCall('Op', $data);
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;My question: what's the SOAPpy equivalent for the SoapHeader() and __setSoapHeaders() part?&lt;/p&gt;
+
+&lt;h3&gt;Related question&lt;/h3&gt;
+
+&lt;ul&gt;
+&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/1481313/how-to-add-header-while-making-soap-request-using-soappy&quot;&gt;How to add header while making soap request using soappy&lt;/a&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1808375/send-and-receive-data-trough-the-power-network</id>
+ <re:rank scheme="http://stackoverflow.com">3</re:rank>
+ <title type="text">Send and receive data trough the power network</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="networking"/><category scheme="http://stackoverflow.com/feeds/tags" term="communication"/><category scheme="http://stackoverflow.com/feeds/tags" term="api"/><category scheme="http://stackoverflow.com/feeds/tags" term="library"/>
+ <author><name>luvieere</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1808375/send-and-receive-data-trough-the-power-network" />
+ <published>2009-11-27T12:06:48Z</published>
+ <updated>2009-12-07T00:57:01Z</updated>
+ <summary type="html">
+ &lt;p&gt;I'm &lt;strong&gt;not&lt;/strong&gt; interested in a hardware solution, I want to know about software that may &quot;read&quot; modulated signal received trough the power supply - some sort of a low-level driver that would access the power signal in a convenient place and demodulate it.&lt;/p&gt;
+
+&lt;p&gt;Is there a way to receive signal from the computer's power supply? I'm interested in an API or library that would allow the computer to be seen as a node in a &lt;a href=&quot;http://en.wikipedia.org/wiki/Power%5Fline%5Fcommunication&quot; rel=&quot;nofollow&quot;&gt;Power Line Communication&lt;/a&gt; network and receive data directly through the power cable, without the need for a converter. Is there any active research in this field?&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;There is software that reads monitors and displays internal component voltages - DC voltage after being converted and filtered by the power supply - now I need is a method of data encoding that would be invariant to conversion and filtering, the original signal embedded in AC being present in some form within the converted DC signal.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1831273/dashcommerce-is-discontinued-where-to-look-for-support</id>
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
+ <title type="text">Dashcommerce is discontinued, where to look for support?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="storefront"/>
+ <author><name>ViktorBergman</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1831273/dashcommerce-is-discontinued-where-to-look-for-support" />
+ <published>2009-12-02T07:49:47Z</published>
+ <updated>2009-12-07T00:56:54Z</updated>
+ <summary type="html">
+ &lt;p&gt;I was quite shocked to be welcomed by a simple message on dashCommerce.org yesterday telling me that the product has been discontinued. The projectowner did not even send out an email to the members of the forum informing about this.&lt;/p&gt;
+
+&lt;p&gt;So here we stand we with an orphant storefront with no community at all to look for help at.&lt;/p&gt;
+
+&lt;p&gt;Does anybody now &lt;strong&gt;why&lt;/strong&gt; they just left the surface of the earth?
+And is there any interest in starting up a forum for the active users?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857215/audio-libraries-for-digital-signal-processing-in-c</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Audio libraries for digital signal processing in C#</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="xaudio2"/><category scheme="http://stackoverflow.com/feeds/tags" term="dsp"/>
+ <author><name>Roderick</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857215/audio-libraries-for-digital-signal-processing-in-c" />
+ <published>2009-12-07T00:56:46Z</published>
+ <updated>2009-12-07T00:56:46Z</updated>
+ <summary type="html">
+ &lt;p&gt;Hello all,&lt;/p&gt;
+
+&lt;p&gt;My problem is this:&lt;/p&gt;
+
+&lt;p&gt;I'm developing a reasonably small application (which needs to be able to grow in the future, but for now, limited functionality will suffice) which recieves audio (16bit mono @ 44.1kHz) and performs fourier transforms and filtering on the data. My experience with all the fields you can imagine this involves is limited, but i've been researching it a fair bit lately and have some understanding. My funding is limited, and I am unable to use any libraries which are under the GPL or similar licences (I need to be able to distruibute this app). For the signal processing I've settled on MathNet libraries, and this seems as though it can handle the bulk of the processing (and I'll write the necessary filters).&lt;/p&gt;
+
+&lt;p&gt;The real problem is finding the sound library to use - I was hoping for something in C#, and while it seemed directSound was the best option, I'm reluctant to use it given microsoft has pretty much abandoned it (the company I work for will be upgrading its gear in the near future; I just want to increase the app.'s lifespan as best I can). Do I use XAudio2? I need to be able to record the raw pcm data from a USB device and process it (+write it out to .wav files), and read the data straight from .wav files. &lt;/p&gt;
+
+&lt;p&gt;Any help is appreciated&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857214/changing-default-paper-tray-with-adobe-acrobat</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">changing default paper tray with Adobe Acrobat</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="adobe-acrobat"/><category scheme="http://stackoverflow.com/feeds/tags" term="adobe"/><category scheme="http://stackoverflow.com/feeds/tags" term="acrobat"/>
+ <author><name>PNG Programmer</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857214/changing-default-paper-tray-with-adobe-acrobat" />
+ <published>2009-12-07T00:56:23Z</published>
+ <updated>2009-12-07T00:56:23Z</updated>
+ <summary type="html">
+ &lt;p&gt;Does anybody know how you can change the default printer tray when printing from an Adobe Acrobat object? There are properties to change duplex settings but not paper tray.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857213/linq-query-expression-translator</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">LINQ query expression translator?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="c#"/><category scheme="http://stackoverflow.com/feeds/tags" term="linq"/><category scheme="http://stackoverflow.com/feeds/tags" term="query-expressions"/>
+ <author><name>naasking</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857213/linq-query-expression-translator" />
+ <published>2009-12-07T00:56:03Z</published>
+ <updated>2009-12-07T00:56:03Z</updated>
+ <summary type="html">
+ &lt;p&gt;I'm adding a LINQ interface to some custom objects, but the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb546090.aspx&quot; rel=&quot;nofollow&quot;&gt;C# compiler fails on type inference&lt;/a&gt;. However, I can write the equivalent query using the raw extension methods and type inference succeeds, so I'm not sure how the compiler is translating the query expression into extension method calls.&lt;/p&gt;
+
+&lt;p&gt;Is there a tool or compiler flag so I can view what the compiler is generating from my query expression so I figure this out?&lt;/p&gt;
+
+&lt;p&gt;This code is in an open source project, so I can provide links to source if that's helpful. Slight variations on the type signatures of the extension methods avoid this type inference error, but these variants don't have the semantics I'm after.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1857098/is-there-a-way-to-get-a-validationsummary-to-work-with-client-side-validators</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Is there a way to get a ValidationSummary to work with client-side validators?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term=".net"/><category scheme="http://stackoverflow.com/feeds/tags" term="asp.net"/><category scheme="http://stackoverflow.com/feeds/tags" term="validation"/><category scheme="http://stackoverflow.com/feeds/tags" term="c#"/><category scheme="http://stackoverflow.com/feeds/tags" term="form-validation"/>
+ <author><name>David</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1857098/is-there-a-way-to-get-a-validationsummary-to-work-with-client-side-validators" />
+ <published>2009-12-07T00:05:35Z</published>
+ <updated>2009-12-07T00:55:40Z</updated>
+ <summary type="html">
+ &lt;p&gt;The .NET ValidationSummary control aggregates error messages from validators that are fired on postback. Is there some way of getting it to also show error messages from client-side validators?&lt;/p&gt;
+
+&lt;p&gt;The problem I am working on is that on a long page, it is possible to click a submit button, have some client-side validators fail, but never see the error message. I would like to have a validation summary near the button so that the user is never left without feedback.&lt;/p&gt;
+
+&lt;p&gt;I would like any standard .NET validators that have client-side validation to be reflected in the validation summary, but I am most concerned with getting the RequiredFieldValidators to work.&lt;/p&gt;
+
+&lt;p&gt;I could hack it so that on clicking the button would automatically, after a short delay, display a general message telling the user to check for errors on the page. This would work for when no postback has occurred, but it would be ugly.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1856654/git-how-to-add-commit-removals-made-via-vanilla-rm</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">git: how to add/commit removals made via vanilla rm?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="git"/><category scheme="http://stackoverflow.com/feeds/tags" term="rm"/><category scheme="http://stackoverflow.com/feeds/tags" term="scm"/><category scheme="http://stackoverflow.com/feeds/tags" term="dvcs"/>
+ <author><name>kch</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1856654/git-how-to-add-commit-removals-made-via-vanilla-rm" />
+ <published>2009-12-06T21:23:12Z</published>
+ <updated>2009-12-07T00:55:30Z</updated>
+ <summary type="html">
+ &lt;p&gt;I deleted a bunch of files / directories from a git repository using &lt;code&gt;rm&lt;/code&gt;, the Finder, etc.&lt;/p&gt;
+
+&lt;p&gt;I'm looking for a git command that'll record these to the index as marked for removal. (As if I had called &lt;code&gt;git rm&lt;/code&gt; on them.)&lt;/p&gt;
+
+&lt;p&gt;I understand &lt;code&gt;git add -u&lt;/code&gt; will do this, along with a bunch of other things. I'd like my command to exclusively handle removals.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1856794/how-would-you-convert-this-mutable-tree-into-an-immutable-one</id>
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
+ <title type="text">How would you convert this mutable tree into an immutable one?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="f#"/><category scheme="http://stackoverflow.com/feeds/tags" term="tree"/><category scheme="http://stackoverflow.com/feeds/tags" term="mutable"/><category scheme="http://stackoverflow.com/feeds/tags" term="immutable"/>
+ <author><name>gradbot</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1856794/how-would-you-convert-this-mutable-tree-into-an-immutable-one" />
+ <published>2009-12-06T22:12:10Z</published>
+ <updated>2009-12-07T00:55:19Z</updated>
+ <summary type="html">
+ &lt;h2&gt;How would you convert type Node into an immutable tree?&lt;/h2&gt;
+
+&lt;p&gt;This class implements a range tree that does not allow overlapping or adjacent ranges and instead joins them. For example if the root node is &lt;code&gt;{min = 10; max = 20}&lt;/code&gt; then it's right child and all its grandchildren must have a min and max value greater than 21. The max value of a range must be greater than or equal to the min. I included a test function so you can run this as is and it will dump out any cases that fail. &lt;/p&gt;
+
+&lt;p&gt;I recommend starting with the Insert method to read this code.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module StackOverflowQuestion
+
+open System
+
+type Range =
+ { min : int64; max : int64 }
+with
+ override this.ToString() =
+ sprintf &quot;(%d, %d)&quot; this.min this.max
+
+[&amp;lt;AllowNullLiteralAttribute&amp;gt;]
+type Node(left:Node, right:Node, range:Range) =
+ let mutable left = left
+ let mutable right = right
+ let mutable range = range
+
+
+ // Symmetric to clean right
+ let rec cleanLeft(node : Node) =
+ if node.Left = null then
+ ()
+ elif range.max &amp;lt; node.Left.Range.min - 1L then
+ cleanLeft(node.Left)
+ elif range.max &amp;lt;= node.Left.Range.max then
+ range &amp;lt;- {min = range.min; max = node.Left.Range.max}
+ node.Left &amp;lt;- node.Left.Right
+ else
+ node.Left &amp;lt;- node.Left.Right
+ cleanLeft(node)
+
+ // Clean right deals with merging when the node to merge with is not on the
+ // left outside of the tree. It travels right inside the tree looking for an
+ // overlapping node. If it finds one it merges the range and replaces the
+ // node with its left child thereby deleting it. If it finds a subset node
+ // it replaces it with its left child, checks it and continues looking right.
+ let rec cleanRight(node : Node) =
+ if node.Right = null then
+ ()
+ elif range.min &amp;gt; node.Right.Range.max + 1L then
+ cleanRight(node.Right)
+ elif range.min &amp;gt;= node.Right.Range.min then
+ range &amp;lt;- {min = node.Right.Range.min; max = range.max}
+ node.Right &amp;lt;- node.Right.Left
+ else
+ node.Right &amp;lt;- node.Right.Left
+ cleanRight(node)
+
+ // Merger left is called whenever the min value of a node decreases.
+ // It handles the case of left node overlap/subsets and merging/deleting them.
+ // When no more overlaps are found on the left nodes it calls clean right.
+ let rec mergeLeft(node : Node) =
+ if node.Left = null then
+ ()
+ elif range.min &amp;lt;= node.Left.Range.min - 1L then
+ node.Left &amp;lt;- node.Left.Left
+ mergeLeft(node)
+ elif range.min &amp;lt;= node.Left.Range.max + 1L then
+ range &amp;lt;- {min = node.Left.Range.min; max = range.max}
+ node.Left &amp;lt;- node.Left.Left
+ else
+ cleanRight(node.Left)
+
+ // Symmetric to merge left
+ let rec mergeRight(node : Node) =
+ if node.Right = null then
+ ()
+ elif range.max &amp;gt;= node.Right.Range.max + 1L then
+ node.Right &amp;lt;- node.Right.Right
+ mergeRight(node)
+ elif range.max &amp;gt;= node.Right.Range.min - 1L then
+ range &amp;lt;- {min = range.min; max = node.Right.Range.max}
+ node.Right &amp;lt;- node.Right.Right
+ else
+ cleanLeft(node.Right)
+
+
+ let (|Before|After|BeforeOverlap|AfterOverlap|Superset|Subset|) r =
+ if r.min &amp;gt; range.max + 1L then After
+ elif r.min &amp;gt;= range.min then
+ if r.max &amp;lt;= range.max then Subset
+ else AfterOverlap
+ elif r.max &amp;lt; range.min - 1L then Before
+ elif r.max &amp;lt;= range.max then
+ if r.min &amp;gt;= range.min then Subset
+ else BeforeOverlap
+ else Superset
+
+ member this.Insert r =
+ match r with
+ | After -&amp;gt;
+ if right = null then
+ right &amp;lt;- Node(null, null, r)
+ else
+ right.Insert(r)
+ | AfterOverlap -&amp;gt;
+ range &amp;lt;- {min = range.min; max = r.max}
+ mergeRight(this)
+ | Before -&amp;gt;
+ if left = null then
+ left &amp;lt;- Node(null, null, r)
+ else
+ left.Insert(r)
+ | BeforeOverlap -&amp;gt;
+ range &amp;lt;- {min = r.min; max = range.max}
+ mergeLeft(this)
+ | Superset -&amp;gt;
+ range &amp;lt;- r
+ mergeLeft(this)
+ mergeRight(this)
+ | Subset -&amp;gt; ()
+
+ member this.Left with get() : Node = left and set(x) = left &amp;lt;- x
+ member this.Right with get() : Node = right and set(x) = right &amp;lt;- x
+ member this.Range with get() : Range = range and set(x) = range &amp;lt;- x
+
+ static member op_Equality (a : Node, b : Node) =
+ a.Range = b.Range
+
+ override this.ToString() =
+ sprintf &quot;%A&quot; this.Range
+
+type RangeTree() =
+ let mutable root = null
+
+ member this.Add(range) =
+ if root = null then
+ root &amp;lt;- Node(null, null, range)
+ else
+ root.Insert(range)
+
+ static member fromArray(values : Range seq) =
+ let tree = new RangeTree()
+ values |&amp;gt; Seq.iter (fun value -&amp;gt; tree.Add(value))
+ tree
+
+ member this.Seq
+ with get() =
+ let rec inOrder(node : Node) =
+ seq {
+ if node &amp;lt;&amp;gt; null then
+ yield! inOrder node.Left
+ yield {min = node.Range.min; max = node.Range.max}
+ yield! inOrder node.Right
+ }
+ inOrder root
+
+let TestRange() =
+ printf &quot;\n&quot;
+
+ let source(n) =
+ let rnd = new Random(n)
+ let rand x = rnd.NextDouble() * float x |&amp;gt; int64
+ let rangeRnd() =
+ let a = rand 1500
+ {min = a; max = a + rand 15}
+ [|for n in 1 .. 50 do yield rangeRnd()|]
+
+ let shuffle n (array:_[]) =
+ let rnd = new Random(n)
+ for i in 0 .. array.Length - 1 do
+ let n = rnd.Next(i)
+ let temp = array.[i]
+ array.[i] &amp;lt;- array.[n]
+ array.[n] &amp;lt;- temp
+ array
+
+ let testRangeAdd n i =
+ let dataSet1 = source (n+0)
+ let dataSet2 = source (n+1)
+ let dataSet3 = source (n+2)
+ let result1 = Array.concat [dataSet1; dataSet2; dataSet3] |&amp;gt; shuffle (i+3) |&amp;gt; RangeTree.fromArray
+ let result2 = Array.concat [dataSet2; dataSet3; dataSet1] |&amp;gt; shuffle (i+4) |&amp;gt; RangeTree.fromArray
+ let result3 = Array.concat [dataSet3; dataSet1; dataSet2] |&amp;gt; shuffle (i+5) |&amp;gt; RangeTree.fromArray
+ let test1 = (result1.Seq, result2.Seq) ||&amp;gt; Seq.forall2 (fun a b -&amp;gt; a.min = b.min &amp;amp;&amp;amp; a.max = b.max)
+ let test2 = (result2.Seq, result3.Seq) ||&amp;gt; Seq.forall2 (fun a b -&amp;gt; a.min = b.min &amp;amp;&amp;amp; a.max = b.max)
+ let test3 = (result3.Seq, result1.Seq) ||&amp;gt; Seq.forall2 (fun a b -&amp;gt; a.min = b.min &amp;amp;&amp;amp; a.max = b.max)
+
+ let print dataSet =
+ dataSet |&amp;gt; Seq.iter (fun r -&amp;gt; printf &quot;%s &quot; &amp;lt;| string r)
+
+ if not (test1 &amp;amp;&amp;amp; test2 &amp;amp;&amp;amp; test3) then
+ printf &quot;\n\nTest# %A: &quot; n
+ printf &quot;\nSource 1: %A: &quot; (n+0)
+ dataSet1 |&amp;gt; print
+ printf &quot;\nSource 2: %A: &quot; (n+1)
+ dataSet2 |&amp;gt; print
+ printf &quot;\nSource 3: %A: &quot; (n+2)
+ dataSet3 |&amp;gt; print
+ printf &quot;\nResult 1: %A: &quot; (n+0)
+ result1.Seq |&amp;gt; print
+ printf &quot;\nResult 2: %A: &quot; (n+1)
+ result2.Seq |&amp;gt; print
+ printf &quot;\nResult 3: %A: &quot; (n+2)
+ result3.Seq |&amp;gt; print
+ ()
+
+ for i in 1 .. 10 do
+ for n in 1 .. 1000 do
+ testRangeAdd n i
+ printf &quot;\n%d&quot; (i * 1000)
+
+ printf &quot;\nDone&quot;
+
+TestRange()
+
+System.Console.ReadLine() |&amp;gt; ignore
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Test cases for Range&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;After (11, 14) | | &amp;lt;--&amp;gt;
+AfterOverlap (10, 14) | |&amp;lt;---&amp;gt;
+AfterOverlap ( 9, 14) | +----&amp;gt;
+AfterOverlap ( 6, 14) |&amp;lt;--+----&amp;gt;
+ &quot;Test Case&quot; ( 5, 9) +---+
+BeforeOverlap ( 0, 8) &amp;lt;----+--&amp;gt;|
+BeforeOverlap ( 0, 5) &amp;lt;----+ |
+BeforeOverlap ( 0, 4) &amp;lt;---&amp;gt;| |
+Before ( 0, 3) &amp;lt;--&amp;gt; | |
+Superset ( 4, 10) &amp;lt;+---+&amp;gt;
+Subset ( 5, 9) +---+
+Subset ( 6, 8) |&amp;lt;-&amp;gt;|
+&lt;/code&gt;&lt;/pre&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1832522/telerik-radcombobox-javascript-api-problem</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Telerik RadComboBox javascript API problem</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="javascript"/><category scheme="http://stackoverflow.com/feeds/tags" term="asp.net"/><category scheme="http://stackoverflow.com/feeds/tags" term="telerik"/>
+ <author><name>Grubl3r</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1832522/telerik-radcombobox-javascript-api-problem" />
+ <published>2009-12-02T12:07:05Z</published>
+ <updated>2009-12-07T00:54:50Z</updated>
+ <summary type="html">
+ &lt;p&gt;Hi all, I've been having a problem using the javascript API of the RadComboBox from Telerik. And no I don't have the power to switch over from Telerik to jQuery or another framework.. Suffice to say I have hardly any hair left on my head now :P&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;In a nutshell&lt;/strong&gt; I want to grab the selected index of one RadComboBox, and update another RadComboBox to this index. Eg. selecting a value in the first RCB automatically updates the second on the client side. My problem really is that I can't find a way to set the index on the second RCB, even though the docs says there is an easy way to do it .. (you heard that one before right :) &lt;/p&gt;
+
+&lt;p&gt;I've followed the API docs at this page (&lt;a href=&quot;http://www.telerik.com/help/aspnet/combobox/combo%5Fclient%5Fmodel.html&quot; rel=&quot;nofollow&quot;&gt;telerik docs&lt;/a&gt;), and also used the javascript debugger in IE8 and the excellent FireBug in Firefox. I'm using Telerik.Web.UI assembly version 2009.2.826.20&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;I don't need full source for a solution, but a nudge in the right direction would be much appreciated! :)&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Here's some example code I cooked together: &lt;/p&gt;
+
+&lt;p&gt;&lt;hr&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;
+ &amp;lt;asp:ScriptManager ID=&quot;ScriptManager1&quot; runat=&quot;server&quot; /&amp;gt;
+
+ &amp;lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&amp;gt;
+ function masterChanged(item)
+ {
+ var detailCB = &amp;lt;%= DetailCB.ClientID %&amp;gt;;
+
+ var index = item.get_selectedIndex();
+ detailCB.SetSelected(index); //method does not exist, but should according to the docs..
+
+ }
+ &amp;lt;/script&amp;gt;
+
+ &amp;lt;div&amp;gt;
+ &amp;lt;telerik:RadComboBox ID=&quot;MasterCB&quot; runat=&quot;server&quot; OnClientSelectedIndexChanged=&quot;masterChanged&quot;&amp;gt;
+ &amp;lt;Items&amp;gt;
+ &amp;lt;telerik:RadComboBoxItem Text=&quot;One&quot; Value=&quot;1&quot; runat=&quot;server&quot; /&amp;gt;
+ &amp;lt;telerik:RadComboBoxItem Text=&quot;Two&quot; Value=&quot;2&quot; runat=&quot;server&quot; /&amp;gt;
+ &amp;lt;telerik:RadComboBoxItem Text=&quot;Three&quot; Value=&quot;3&quot; runat=&quot;server&quot; /&amp;gt;
+ &amp;lt;/Items&amp;gt;
+ &amp;lt;/telerik:RadComboBox&amp;gt;
+ &amp;lt;/div&amp;gt;
+
+ &amp;lt;div&amp;gt;
+ &amp;lt;telerik:RadComboBox ID=&quot;DetailCB&quot; runat=&quot;server&quot;&amp;gt;
+ &amp;lt;Items&amp;gt;
+ &amp;lt;telerik:RadComboBoxItem Text=&quot;One&quot; Value=&quot;1&quot; runat=&quot;server&quot; /&amp;gt;
+ &amp;lt;telerik:RadComboBoxItem Text=&quot;Two&quot; Value=&quot;2&quot; runat=&quot;server&quot; /&amp;gt;
+ &amp;lt;telerik:RadComboBoxItem Text=&quot;Three&quot; Value=&quot;3&quot; runat=&quot;server&quot; /&amp;gt;
+ &amp;lt;/Items&amp;gt;
+ &amp;lt;/telerik:RadComboBox&amp;gt;
+ &amp;lt;/div&amp;gt;
+&amp;lt;/form&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;I don't need full source for a solution, but a kick in the right direction would be much appreciated! :)&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/544162/looking-for-a-datagridview-that-allows-grouping</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Looking for a DataGridView that allows grouping</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="vb.net"/><category scheme="http://stackoverflow.com/feeds/tags" term="controls"/><category scheme="http://stackoverflow.com/feeds/tags" term="c#"/>
+ <author><name>ohu812</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/544162/looking-for-a-datagridview-that-allows-grouping" />
+ <published>2009-02-13T00:07:30Z</published>
+ <updated>2009-12-07T00:54:45Z</updated>
+ <summary type="html">
+ &lt;p&gt;Basically I'm looking for a control that allows for grouping in a DataGridView control that can also be editted (I.E. somthing like DataGridView and TreeView into a single control). &lt;/p&gt;
+
+&lt;p&gt;Thanks in advance.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+</feed>
View
15 test/helper.rb
@@ -1,10 +1,25 @@
require 'rubygems'
require 'test/unit'
require 'shoulda'
+require 'fakeweb'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'sogger'
+FakeWeb.register_uri :get, Sogger::Sogger::SO_FEED_URL, :body => File.read("test/fixtures/so_feed_sample.xml")
+
class Test::Unit::TestCase
+ include Sogger
+ def setup
+ Sogger.save_path = "test/feed.xml"
+ end
+
+ def read_sample_file(filename)
+ File.read("test/fixtures/#{filename}")
+ end
+
+ def teardown
+ File.delete(Sogger.save_path) if File.exists?(Sogger.save_path)
+ end
end
View
60 test/test_question.rb
@@ -0,0 +1,60 @@
+require 'helper'
+
+class TestQuestion < Test::Unit::TestCase
+ context "Question" do
+ setup do
+ @xml_element = Nokogiri::XML(read_sample_file("so_feed_sample.xml")).css('entry').first
+ end
+
+ should "be initializeable from xml" do
+ assert_nothing_raised do
+ Question.from_xml(@xml_element)
+ end
+ end
+
+ should "have correct attributes when instantiated from xml" do
+ q = Question.from_xml(@xml_element)
+ expected_attributes = {
+ :title => "Windows and Minibuffer floating over the frame",
+ :url => "http://stackoverflow.com/questions/1856203/windows-and-minibuffer-floating-over-the-frame",
+ :tags => ["emacs"],
+ :published => DateTime.parse("2009-12-06T18:48:09Z")}
+
+ assert_equal expected_attributes, q.attributes
+ end
+
+ context "instance" do
+ setup do
+ @question = Question.from_xml(@xml_element)
+ end
+
+ should "have title attribute" do
+ assert_equal "Windows and Minibuffer floating over the frame", @question.title
+ end
+
+ should "have url attribute" do
+ assert_equal "http://stackoverflow.com/questions/1856203/windows-and-minibuffer-floating-over-the-frame", @question.url
+ end
+
+ should "have tags attribute" do
+ assert_equal ["emacs"], @question.tags
+ end
+
+ should "have published attribute" do
+ assert_equal DateTime.parse("2009-12-06T18:48:09+00:00"), @question.published
+ end
+ end
+ end
+
+ context "Array of questions" do
+ setup do
+ @newer_question = Question.new(:published => DateTime.parse("12/12/2009"))
+ @older_question = Question.new(:published => DateTime.parse("12/12/2008"))
+ @questions = [@older_question, @newer_question]
+ end
+
+ should "sort by published" do
+ assert_equal [@newer_question, @older_question], @questions.sort
+ end
+ end
+end
View
9 test/test_runner.rb
@@ -0,0 +1,9 @@
+require 'helper'
+
+class TestRunner < Test::Unit::TestCase
+ # Tests pending for this
+
+ should "be true" do
+ assert true
+ end
+end
View
67 test/test_sogger.rb
@@ -1,7 +1,70 @@
require 'helper'
class TestSogger < Test::Unit::TestCase
- should "probably rename this file and start testing for real" do
- flunk "hey buddy, you should probably rename this file and start testing for real"
+ context "Sogger" do
+ should "have an SO_FEED_URL" do
+ assert Sogger::SO_FEED_URL
+ end
+
+ should "have a save_path" do
+ assert Sogger.save_path
+ end
+
+ context "populated with data" do
+ setup do
+ @sogger = Sogger.new
+ @sogger.download_feed!
+ end
+
+ should "retrieve feed from #{Sogger::SO_FEED_URL}" do
+ assert_equal read_sample_file('so_feed_sample.xml'), @sogger.raw_data
+ end
+
+ should "parse collection of 30 questions" do
+ assert_equal 30, @sogger.questions.size
+ end
+
+ should "return question objects in questions collection" do
+ assert_equal Question, @sogger.questions.first.class
+ end
+
+ should "have questions always sorted" do
+ newer_question = Question.new(:published => DateTime.parse("12/12/2009"))
+ older_question = Question.new(:published => DateTime.parse("12/12/2008"))
+ @sogger.instance_variable_set("@questions", [older_question, newer_question])
+ assert_equal [newer_question, older_question], @sogger.questions
+ end
+
+ should "save feed" do
+ @sogger.save!
+ assert File.exists?(Sogger.save_path)
+ end
+
+ should "load feed" do
+ @sogger.save!
+ sogger2 = Sogger.new
+ sogger2.load!
+ assert_equal read_sample_file('so_feed_sample.xml'), sogger2.raw_data
+ end
+
+ should "return new question when subtracted from another sogger" do
+ very_new_question1 = Question.new(:published => DateTime.parse("12/12/2012"))
+ very_new_question2 = Question.new(:published => DateTime.parse("12/12/2010"))
+ very_old_question = Question.new(:published => DateTime.parse("12/12/1999"))
+ fixture_question = Question.new(:published => DateTime.parse("2009-12-06T07:14:23Z"))
+
+ collection = [very_old_question, very_new_question1, fixture_question, very_new_question2]
+ newer_sogger = Sogger.new(collection)
+
+ expected_difference = [very_new_question1, very_new_question2]
+ actual_difference = (newer_sogger - @sogger).questions
+
+ expected_inspect = expected_difference.map{|q| q.published.strftime('%d/%m/%y %H:%M:%S')}.inspect
+ actual_inspect = actual_difference.map{|q| q.published.strftime('%d/%m/%y %H:%M:%S')}.inspect
+
+ assert_equal expected_difference, actual_difference,
+ "Expected #{expected_inspect}, but was #{actual_inspect}."
+ end
+ end
end
end
View
1,303 tmp/feed.xml
@@ -0,0 +1,1303 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:re="http://purl.org/atompub/rank/1.0">
+ <title type="text">Recent Questions - Stack Overflow</title>
+ <link rel="self" href="http://stackoverflow.com/feeds" type="application/atom+xml" />
+ <link rel="alternate" href="http://stackoverflow.com/questions" type="text/html" />
+ <subtitle>most recent 30 from stackoverflow.com</subtitle>
+ <updated>2009-12-07T21:10:41Z</updated>
+ <id>http://stackoverflow.com/feeds</id>
+ <creativeCommons:license>http://www.creativecommons.org/licenses/by-nc/2.5/rdf</creativeCommons:license>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862871/sql-server-how-to-exit-a-stored-procedure</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">SQL Server: How to exit a stored procedure?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="stored-procedures"/><category scheme="http://stackoverflow.com/feeds/tags" term="flow-control"/><category scheme="http://stackoverflow.com/feeds/tags" term="sql-server"/><category scheme="http://stackoverflow.com/feeds/tags" term="tsql"/>
+ <author><name>Ian Boyd</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862871/sql-server-how-to-exit-a-stored-procedure" />
+ <published>2009-12-07T21:03:01Z</published>
+ <updated>2009-12-07T21:10:29Z</updated>
+ <summary type="html">
+ &lt;p&gt;How can i exit in the middle of a stored procedure?&lt;/p&gt;
+
+&lt;p&gt;i have a stored procedure where i want to bail out early (while trying to debug it). i've tried calling &lt;code&gt;RETURN&lt;/code&gt; and &lt;code&gt;RAISERROR&lt;/code&gt;, and the sp keeps on running:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;CREATE PROCEDURE dbo.Archive_Session @SessionGUID uniqueidentifier AS
+
+print 'before raiserror'
+raiserror('this is a raised error', 18, 1)
+print 'before return'
+return -1
+print 'after return'
+
+[snip]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;i know it keeps running because i encounter an error further down. i don't see any of my &lt;strong&gt;prints&lt;/strong&gt;. If i comment out the bulk of the stored procedure:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;CREATE PROCEDURE dbo.Archive_Session @SessionGUID uniqueidentifier AS
+
+print 'before raiserror'
+raiserror('this is a raised error', 18, 1)
+print 'before return'
+return -1
+print 'after return'
+
+/*
+[snip]
+*/
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Then i don't get my error, and i see the results:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;before raiserror
+Server: Msg 50000, Level 18, State 1, Procedure Archive_Session, Line 5
+this is a raised error
+before return
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;So the question is: how do i bail out of a stored procedure in SQL Server?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862905/iphone-nsdate-convert-date-to-gmt</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">[iPhone] NSDate - Convert Date to GMT</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="iphone"/><category scheme="http://stackoverflow.com/feeds/tags" term="nsdate"/><category scheme="http://stackoverflow.com/feeds/tags" term="convert"/><category scheme="http://stackoverflow.com/feeds/tags" term="gmt"/>
+ <author><name>Mick</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862905/iphone-nsdate-convert-date-to-gmt" />
+ <published>2009-12-07T21:10:28Z</published>
+ <updated>2009-12-07T21:10:28Z</updated>
+ <summary type="html">
+ &lt;p&gt;Hello,&lt;/p&gt;
+
+&lt;p&gt;I need the ability to convert a NSDate value to a GMT Date.&lt;/p&gt;
+
+&lt;p&gt;How can I go about converting a NSDate value to a GMT formatted NSDate value, independent of what ever date locale settings the iphone is using.&lt;/p&gt;
+
+&lt;p&gt;Kind Regards&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862904/customizing-django-comments</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Customizing django-comments</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="django"/><category scheme="http://stackoverflow.com/feeds/tags" term="django-comments"/>
+ <author><name>AP257</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862904/customizing-django-comments" />
+ <published>2009-12-07T21:10:22Z</published>
+ <updated>2009-12-07T21:10:22Z</updated>
+ <summary type="html">
+ &lt;p&gt;So, I'm using django.contrib.comments. I've installed it OK but rather than the unwieldy default comment form, I'd like to use a custom form template that just shows a textarea and submit button.&lt;/p&gt;
+
+&lt;p&gt;The rationale behind this is that user only see the form if they area already authenticated, and I'd like the keep the form simple and pick up their username etc automatically.&lt;/p&gt;
+
+&lt;p&gt;I've implemented a custom form, but am getting an error when I try to submit it.&lt;/p&gt;
+
+&lt;p&gt;Here's what I have in my template for the page with the comment form (entry is the object passed from the view): &lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% load comments %}
+{% render_comment_form for entry %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;And here's my HTML in /templates/comments/form.html:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% if user.is_authenticated %}
+ &amp;lt;p&amp;gt;Submit a comment:&amp;lt;/p&amp;gt;
+ &amp;lt;form action=&quot;/comments/post/&quot; method=&quot;post&quot;&amp;gt;
+ &amp;lt;textarea name=&quot;comment&quot; id=&quot;id_comment&quot; rows=&quot;2&quot; style=&quot;width: 90%;&quot;&amp;gt;&amp;lt;/textarea&amp;gt;
+ &amp;lt;input type=&quot;hidden&quot; name=&quot;options&quot; value=&quot;{{ options }}&quot; /&amp;gt;
+ &amp;lt;input type=&quot;hidden&quot; name=&quot;target&quot; value=&quot;{{ target }}&quot; /&amp;gt;
+ &amp;lt;input type=&quot;hidden&quot; name=&quot;gonzo&quot; value=&quot;{{ hash }}&quot; /&amp;gt;
+ &amp;lt;input type=&quot;hidden&quot; name=&quot;next&quot; value=&quot;{{ entry.get_absolute_url }}&quot; /&amp;gt;
+ &amp;lt;span style=&quot;float:right;&quot;&amp;gt;&amp;lt;input type=&quot;submit&quot; name=&quot;post&quot; value=&quot;Add&quot;&amp;gt;&amp;lt;/span&amp;gt;
+ &amp;lt;/form&amp;gt;
+ {% else %}
+ &amp;lt;p&amp;gt;Please &amp;lt;a href=&quot;/login/&quot;&amp;gt;log in&amp;lt;/a&amp;gt; to post a comment.&amp;lt;/p&amp;gt;
+ {% endif %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It renders okay initially, but when I try to submit the comment form, I get the following Django error: &lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;Comment post not allowed (400)
+Why: Missing content_type or object_pk field.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Can anyone help?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862867/what-is-the-best-single-source-shortest-path-algorithm-for-programming-contests</id>
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
+ <title type="text">What is the best single-source shortest path algorithm for programming contests?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="algorithm"/><category scheme="http://stackoverflow.com/feeds/tags" term="graph"/><category scheme="http://stackoverflow.com/feeds/tags" term="competitions"/><category scheme="http://stackoverflow.com/feeds/tags" term="c++"/>
+ <author><name>int3</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862867/what-is-the-best-single-source-shortest-path-algorithm-for-programming-contests" />
+ <published>2009-12-07T21:02:06Z</published>
+ <updated>2009-12-07T21:09:59Z</updated>
+ <summary type="html">
+ &lt;p&gt;I was working on &lt;a href=&quot;http://acm.uva.es/p/v109/10986.html&quot; rel=&quot;nofollow&quot;&gt;this graph problem&lt;/a&gt; from the UVa problem set. It's a single-source-shortest-paths problem with no negative edge weights. From what I've gathered, the algorithm with the best big-O running time is Dijkstra with a Fibonacci heap as the priority queue, although practically speaking a binary heap is easier to implement and works pretty well too.&lt;/p&gt;
+
+&lt;p&gt;However, it would seem that even a binary heap takes quite some time to roll, and in a competition time is limited. I am aware that the STL provides some heap algorithms and priority queues, but they don't seem to provide a decrease-key function which Dijkstra's needs. Or am I wrong here?&lt;/p&gt;
+
+&lt;p&gt;It seems that another possibility is to simply not use Dijkstra's. &lt;a href=&quot;http://online-judge.uva.es/board/viewtopic.php?f=32&amp;amp;t=9918&amp;amp;hilit=10986&amp;amp;start=30&quot; rel=&quot;nofollow&quot;&gt;This forum thread&lt;/a&gt; has people claiming that they solved the above problem with breadth-first search / Bellman-Ford, which are much easier to code up. This surprised me a little as I thought that the input size was quite large. I guess different problems will require solutions of different complexity, but my question is, how often would I need to use Dijkstra's in such competitions? Should I practice more on the simpler-but-slower algorithms instead?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862901/how-to-use-emacs-with-python</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">How to use Emacs with Python </title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="emacs"/><category scheme="http://stackoverflow.com/feeds/tags" term="python"/>
+ <author><name>Tony Cruise</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862901/how-to-use-emacs-with-python" />
+ <published>2009-12-07T21:09:35Z</published>
+ <updated>2009-12-07T21:09:35Z</updated>
+ <summary type="html">
+ &lt;p&gt;I am new to emacs and I want to use emacs for python development. I am using Ubuntu 9.10. I frustrated to getting emacs work with python. I use GNU Emacs 23.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.0).&lt;/p&gt;
+
+&lt;p&gt;Here what I did.
+* &lt;/p&gt;
+
+&lt;p&gt;Emacs come with python mode but it is confusing there are two types of mode one is python-mode.el and other one is python.el. I use emacs 23 so mine is python.el (I think)
+But code code completion does not work when I press M-Tab , window manager works. I tried Esc-Tab but it says &quot;No match&quot; . How can I enable code completion?&lt;/p&gt;
+
+&lt;p&gt;After than I installed ropemacs&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;sudo aptitude install python-ropemacs
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Then I created .emacs file at ~/.emacs
+and I added followings to .emacs file&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;(require 'pymacs)
+(pymacs-load &quot;ropemacs&quot; &quot;rope-&quot;)
+(setq ropemacs-enable-autoimport t)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Then when I hit M-/ for code assist it opens a file dialog for choosing root project folder. I choosed current folder which has django code. Now when I hit M-/ (Alt and /) nothing happens but when I click from the menu Rope-&gt;Code assist it shows
+&quot;Completion for x: &quot; empty set. How can make emacs python code completion work?&lt;/p&gt;
+
+&lt;p&gt;Then I downloaded &lt;a href=&quot;http://www.emacswiki.org/emacs/anything.el&quot; rel=&quot;nofollow&quot;&gt;anything.el&lt;/a&gt;, anything-config, anything-match-plugin to ~/.emacs.d folder Then I added following lines to .emacs file&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;(require 'anything-config)
+(require 'anything-match-plugin)
+(global-set-key &quot;\C-ca&quot; 'anything)
+(global-set-key &quot;\C-ce&quot; 'anything-for-files)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Guess what it dowsnt work. I tried &quot;M-x anything&quot; again I get No match.(I guessed may me combination of C-ca (First control-a then e ) might work it says it isnt defined). Could you explain code completion for python with clear explanations (step by step) to someone dummy as me. Thanks. &lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862900/how-do-i-uninstall-gitosis</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">How do I uninstall gitosis?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="git"/><category scheme="http://stackoverflow.com/feeds/tags" term="gitosis"/>
+ <author><name>Oscar Del Ben</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862900/how-do-i-uninstall-gitosis" />
+ <published>2009-12-07T21:09:34Z</published>
+ <updated>2009-12-07T21:09:34Z</updated>
+ <summary type="html">
+ &lt;p&gt;I've installed gitosis on my dramhost machine but now I want to uninstall it because it's causing more problems than solutions.&lt;/p&gt;
+
+&lt;p&gt;The thing is that I can't find how to uninstall it. I deleted the ~/repositories directories but of course all the bins are still included. Also I'm more worried about what it did to ssh configurations.&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862899/is-there-a-site-that-does-nothing-but-spit-out-whatever-post-form-parameters-were</id>
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
+ <title type="text">Is there a site that does nothing but spit out whatever POST form parameters were sent to it?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="http"/><category scheme="http://stackoverflow.com/feeds/tags" term="form"/><category scheme="http://stackoverflow.com/feeds/tags" term="post"/><category scheme="http://stackoverflow.com/feeds/tags" term="testing"/>
+ <author><name>dreftymac</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862899/is-there-a-site-that-does-nothing-but-spit-out-whatever-post-form-parameters-were" />
+ <published>2009-12-07T21:09:17Z</published>
+ <updated>2009-12-07T21:09:17Z</updated>
+ <summary type="html">
+ &lt;p&gt;Is there a site online available to the general public that does nothing but display whatever form variables (name-value pairs) were sent to it via POST?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862434/why-is-appdomainsetup-shadowcopyfiles-a-string</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Why is AppDomainSetup.ShadowCopyFiles a string?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="c#"/><category scheme="http://stackoverflow.com/feeds/tags" term="appdomainsetup"/>
+ <author><name>Jason Punyon</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862434/why-is-appdomainsetup-shadowcopyfiles-a-string" />
+ <published>2009-12-07T19:46:10Z</published>
+ <updated>2009-12-07T21:09:10Z</updated>
+ <summary type="html">
+ &lt;p&gt;I'm puzzled by this. From the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.appdomainsetup.shadowcopyfiles.aspx&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;...&lt;/p&gt;
+
+&lt;blockquote&gt;
+ &lt;p&gt;A String containing the string value &quot;true&quot; to indicate that shadow copying is turned on; or &quot;false&quot; to indicate that shadow copying is turned off.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;And its been this way since 1.1...can anyone shed any light?&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: So I reflector'd the Getter and Setter for good measure...&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;public string ShadowCopyFiles
+{
+ get
+ {
+ return this.Value[8];
+ }
+ set
+ {
+ if ((value != null) &amp;amp;&amp;amp; (string.Compare(value, &quot;true&quot;, StringComparison.OrdinalIgnoreCase) == 0))
+ {
+ this.Value[8] = value;
+ }
+ else
+ {
+ this.Value[8] = null;
+ }
+ }
+}
+
+//The referenced Value property...
+
+internal string[] Value
+{
+ get
+ {
+ if (this._Entries == null)
+ {
+ this._Entries = new string[0x10];
+ }
+ return this._Entries;
+ }
+}
+
+private string[] _Entries;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;So maybe the Value array begets an easier copy constructor or something?&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862881/c-sort-list-by-multiple-conditions</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">C# Sort List by multiple conditions</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="c#"/><category scheme="http://stackoverflow.com/feeds/tags" term="sorting"/>
+ <author><name>Frets</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862881/c-sort-list-by-multiple-conditions" />
+ <published>2009-12-07T21:05:47Z</published>
+ <updated>2009-12-07T21:09:03Z</updated>
+ <summary type="html">
+ &lt;p&gt;I need to sort some soccer standings. My problem is how to sort in the right order.&lt;/p&gt;
+
+&lt;p&gt;Sortorder:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Points DESC&lt;/li&gt;
+&lt;li&gt;Approximation match&lt;/li&gt;
+&lt;li&gt;Goal difference DESC&lt;/li&gt;
+&lt;li&gt;Goals scored DESC&lt;/li&gt;
+&lt;li&gt;Goals against&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;Input:
+TeamName - Points - GoalsScored - GoalsAgainst &lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Team 1 - 1 - 4 - 7&lt;/li&gt;
+&lt;li&gt;Team 2 - 5 - 8 - 6&lt;/li&gt;
+&lt;li&gt;Team 3 - 1 - 2 - 10&lt;/li&gt;
+&lt;li&gt;Team 4 - 8 - 12 - 5&lt;/li&gt;
+&lt;li&gt;Team 5 - 5 - 7 - 4&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;...
+Match #4 - Team 5 - Team 2 -- 1-2&lt;/p&gt;
+
+&lt;p&gt;Match #7 - Team 1 - Team 3 -- 3-3
+...&lt;/p&gt;
+
+&lt;p&gt;Output:
+TeamName - Points - GoalsScored - GoalsAgainst &lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Team 4 - 8 - 12 - 5&lt;/li&gt;
+&lt;li&gt;Team 2 - 5 - 8 - 6&lt;/li&gt;
+&lt;li&gt;Team 5 - 5 - 7 - 4&lt;/li&gt;
+&lt;li&gt;Team 1 - 1 - 4 - 7&lt;/li&gt;
+&lt;li&gt;Team 3 - 1 - 2 - 10&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;Because Team 2 won over Team 5 they ends up at 2nd place.&lt;/p&gt;
+
+&lt;p&gt;Because Team 1 draw against Team 3, they ends up at 4. place, with a better goal difference.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;public class Standing
+{
+ public Team Team { get; set; }
+ public int? MatchesPlayed { get; set; }
+ public int? GoalsScored { get; set; }
+ public int? GoalsAgainst { get; set; }
+ public int? Points { get; set; }
+}
+
+public class Match
+{
+ public int MatchID { get; set; }
+ public DateTime? PlayTime { get; set; }
+ public Team HomeTeam { get; set; }
+ public Team AwayTeam { get; set; }
+ public int? HomeScore { get; set; }
+ public int? AwayScore { get; set; }
+}
+
+public class Pool
+{
+ public int PoolID { get; set; }
+ public string PoolName { get; set; }
+ public DateTime? StartTime { get; set; }
+ public List&amp;lt;Team&amp;gt; Teams { get; set; }
+ public List&amp;lt;Match&amp;gt; Matches { get; set; }
+ public List&amp;lt;Standing&amp;gt; Standings { get; set; }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1813559/net-c-using-rss-net-with-stack-overflow-feeds-how-to-handle-special-propertie</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">.NET/C#: Using RSS.NET with Stack Overflow Feeds: How To Handle Special Properties of RSS Items?</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="rss"/><category scheme="http://stackoverflow.com/feeds/tags" term=".net"/><category scheme="http://stackoverflow.com/feeds/tags" term="c#"/><category scheme="http://stackoverflow.com/feeds/tags" term="rss.net"/><category scheme="http://stackoverflow.com/feeds/tags" term="serialization"/>
+ <author><name>Maxim Z.</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1813559/net-c-using-rss-net-with-stack-overflow-feeds-how-to-handle-special-propertie" />
+ <published>2009-11-28T19:41:43Z</published>
+ <updated>2009-12-07T21:08:39Z</updated>
+ <summary type="html">
+ &lt;p&gt;I'm &lt;a href=&quot;http://meta.stackoverflow.com/questions/31200/net-library-for-stack-overflow-api&quot;&gt;writing a Stack Overflow API wrapper&lt;/a&gt;, currently at &lt;a href=&quot;http://soapidotnet.googlecode.com/&quot; rel=&quot;nofollow&quot;&gt;http://soapidotnet.googlecode.com/&lt;/a&gt;. I have a few questions about parsing SO RSS feeds.&lt;/p&gt;
+
+&lt;p&gt;I've chosen to use &lt;strong&gt;RSS.NET&lt;/strong&gt; to parse the RSS, but I have a few questions about my code (which I have provided further down in this post). &lt;/p&gt;
+
+&lt;p&gt;&lt;hr&gt;&lt;/p&gt;
+
+&lt;h2&gt;My Questions:&lt;/h2&gt;
+
+&lt;p&gt;First of all, am I &lt;strong&gt;parsing those attributes correctly&lt;/strong&gt;? I have a class named Question, which has those properties.&lt;/p&gt;
+
+&lt;p&gt;Next, how can I &lt;strong&gt;parse the &lt;code&gt;&amp;lt;re:rank&amp;gt;&lt;/code&gt; RSS property&lt;/strong&gt; (used for # of votes)? I'm not sure how RSS.NET lets us do that. As far as I understand, it's a element with a custom namespace. &lt;/p&gt;
+
+&lt;p&gt;Finally, do I have to add all the properties manually, like currently in my code? Is their some sort of &lt;strong&gt;deserialization&lt;/strong&gt; that I can use?&lt;/p&gt;
+
+&lt;p&gt;&lt;hr&gt;&lt;/p&gt;
+
+&lt;h2&gt;Code:&lt;/h2&gt;
+
+&lt;p&gt;Below is my current code for parsing recent question feeds: &lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; /// &amp;lt;summary&amp;gt;
+ /// Utilises recent question feeds to obtain recently updated questions on a certain site.
+ /// &amp;lt;/summary&amp;gt;
+ /// &amp;lt;param name=&quot;site&quot;&amp;gt;Trilogy site in question.&amp;lt;/param&amp;gt;
+ /// &amp;lt;returns&amp;gt;A list of objects of type Question, which represents the recent questions on a trilogy site.&amp;lt;/returns&amp;gt;
+ public static List&amp;lt;Question&amp;gt; GetRecentQuestions(TrilogySite site)
+ {
+ List&amp;lt;Question&amp;gt; RecentQuestions = new List&amp;lt;Question&amp;gt;();
+ RssFeed feed = RssFeed.Load(string.Format(&quot;http://{0}.com/feeds&quot;,GetSiteUrl(site)));
+ RssChannel channel = (RssChannel)feed.Channels[0];
+ foreach (RssItem item in channel.Items)
+ {
+ Question toadd = new Question();
+ foreach(RssCategory cat in item.Categories)
+ {
+ toadd.Categories.Add(cat.Name);
+ }
+ toadd.Author = item.Author;
+ toadd.CreatedDate = ConvertToUnixTimestamp(item.PubDate).ToString();
+ toadd.Id = item.Link.Url.ToString();
+ toadd.Link = item.Link.Url.ToString();
+ toadd.Summary = item.Description;
+
+ //TODO: OTHER PROPERTIES
+ RecentQuestions.Add(toadd);
+ }
+ return RecentQuestions;
+ }
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the code of that SO RSS feed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;feed xmlns=&quot;http://www.w3.org/2005/Atom&quot; xmlns:creativeCommons=&quot;http://backend.userland.com/creativeCommonsRssModule&quot; xmlns:re=&quot;http://purl.org/atompub/rank/1.0&quot;&amp;gt;
+ &amp;lt;title type=&quot;text&quot;&amp;gt;Top Questions - Stack Overflow&amp;lt;/title&amp;gt;
+ &amp;lt;link rel=&quot;self&quot; href=&quot;http://stackoverflow.com/feeds&quot; type=&quot;application/atom+xml&quot; /&amp;gt;
+ &amp;lt;link rel=&quot;alternate&quot; href=&quot;http://stackoverflow.com/questions&quot; type=&quot;text/html&quot; /&amp;gt;
+ &amp;lt;subtitle&amp;gt;most recent 30 from stackoverflow.com&amp;lt;/subtitle&amp;gt;
+ &amp;lt;updated&amp;gt;2009-11-28T19:26:49Z&amp;lt;/updated&amp;gt;
+ &amp;lt;id&amp;gt;http://stackoverflow.com/feeds&amp;lt;/id&amp;gt;
+ &amp;lt;creativeCommons:license&amp;gt;http://www.creativecommons.org/licenses/by-nc/2.5/rdf&amp;lt;/creativeCommons:license&amp;gt;
+
+ &amp;lt;entry&amp;gt;
+ &amp;lt;id&amp;gt;http://stackoverflow.com/questions/1813483/averaging-angles-again&amp;lt;/id&amp;gt;
+ &amp;lt;re:rank scheme=&quot;http://stackoverflow.com&quot;&amp;gt;0&amp;lt;/re:rank&amp;gt;
+ &amp;lt;title type=&quot;text&quot;&amp;gt;Averaging angles... Again&amp;lt;/title&amp;gt;
+ &amp;lt;category scheme=&quot;http://stackoverflow.com/feeds/tags&quot; term=&quot;algorithm&quot;/&amp;gt;&amp;lt;category scheme=&quot;http://stackoverflow.com/feeds/tags&quot; term=&quot;math&quot;/&amp;gt;&amp;lt;category scheme=&quot;http://stackoverflow.com/feeds/tags&quot; term=&quot;geometry&quot;/&amp;gt;&amp;lt;category scheme=&quot;http://stackoverflow.com/feeds/tags&quot; term=&quot;calculation&quot;/&amp;gt;
+ &amp;lt;author&amp;gt;&amp;lt;name&amp;gt;Lior Kogan&amp;lt;/name&amp;gt;&amp;lt;/author&amp;gt;
+ &amp;lt;link rel=&quot;alternate&quot; href=&quot;http://stackoverflow.com/questions/1813483/averaging-angles-again&quot; /&amp;gt;
+ &amp;lt;published&amp;gt;2009-11-28T19:19:13Z&amp;lt;/published&amp;gt;
+ &amp;lt;updated&amp;gt;2009-11-28T19:26:39Z&amp;lt;/updated&amp;gt;
+ &amp;lt;summary type=&quot;html&quot;&amp;gt;
+ &amp;amp;lt;p&amp;amp;gt;I want to calculate the average of a set of angles.&amp;amp;lt;/p&amp;amp;gt;
+
+&amp;amp;lt;p&amp;amp;gt;I know it has been discussed before (several times). The accepted answer was &amp;amp;lt;strong&amp;amp;gt;Compute unit vectors from the angles and take the angle of their average&amp;amp;lt;/strong&amp;amp;gt;.&amp;amp;lt;/p&amp;amp;gt;
+
+&amp;amp;lt;p&amp;amp;gt;However this answer defines the average in a non intuitive way. The average of 0, 0 and 90 will be &amp;amp;lt;strong&amp;amp;gt;atan( (sin(0)+sin(0)+sin(90)) / (cos(0)+cos(0)+cos(90)) ) = atan(1/2)= 26.56 deg&amp;amp;lt;/strong&amp;amp;gt; &amp;amp;lt;/p&amp;amp;gt;
+
+&amp;amp;lt;p&amp;amp;gt;I would expect the average of 0, 0 and 90 to be 30 degrees.&amp;amp;lt;/p&amp;amp;gt;
+
+&amp;amp;lt;p&amp;amp;gt;So I think it is fair to ask the question again: How would you calculate the average, so such examples will give the intuitive expected answer.&amp;amp;lt;/p&amp;amp;gt;
+
+ &amp;lt;/summary&amp;gt;
+ &amp;lt;/entry&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;etc.&lt;/p&gt;
+
+&lt;p&gt;Here is my Question class, if it will help:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; /// &amp;lt;summary&amp;gt;
+ /// Represents a question.
+ /// &amp;lt;/summary&amp;gt;
+ public class Question : Post //TODO: Have Question and Answer derive from Post
+ {
+
+ /// &amp;lt;summary&amp;gt;
+ /// # of favorites.
+ /// &amp;lt;/summary&amp;gt;
+ public double FavCount { get; set; }
+
+ /// &amp;lt;summary&amp;gt;
+ /// # of answers.
+ /// &amp;lt;/summary&amp;gt;
+ public double AnswerCount { get; set; }
+
+ /// &amp;lt;summary&amp;gt;
+ /// Tags.
+ /// &amp;lt;/summary&amp;gt;
+ public string Tags { get; set; }
+
+ }
+
+
+/// &amp;lt;summary&amp;gt;
+ /// Represents a post on Stack Overflow (question, answer, or comment).
+ /// &amp;lt;/summary&amp;gt;
+ public class Post
+ {
+ /// &amp;lt;summary&amp;gt;
+ /// Id (link)
+ /// &amp;lt;/summary&amp;gt;
+ public string Id { get; set; }
+ /// &amp;lt;summary&amp;gt;
+ /// Number of votes.
+ /// &amp;lt;/summary&amp;gt;
+ public double VoteCount { get; set; }
+ /// &amp;lt;summary&amp;gt;
+ /// Number of views.
+ /// &amp;lt;/summary&amp;gt;
+ public double ViewCount { get; set; }
+ /// &amp;lt;summary&amp;gt;
+ /// Title.
+ /// &amp;lt;/summary&amp;gt;
+ public string Title { get; set; }
+ /// &amp;lt;summary&amp;gt;
+ /// Created date of the post (expressed as a Unix timestamp)
+ /// &amp;lt;/summary&amp;gt;
+ public string CreatedDate
+ {
+
+ get
+ {
+ return CreatedDate;
+ }
+ set
+ {
+ CreatedDate = value;
+ dtCreatedDate = StackOverflow.ConvertFromUnixTimestamp(StackOverflow.ExtractTimestampFromJsonTime(value));
+
+ }
+
+ }
+ /// &amp;lt;summary&amp;gt;
+ /// Created date of the post (expressed as a DateTime)
+ /// &amp;lt;/summary&amp;gt;
+ public DateTime dtCreatedDate { get; set; }
+ /// &amp;lt;summary&amp;gt;
+ /// Last edit date of the post (expressed as a Unix timestamp)
+ /// &amp;lt;/summary&amp;gt;
+ public string LastEditDate
+ {
+
+ get
+ {
+ return LastEditDate;
+ }
+ set
+ {
+ LastEditDate = value;
+ dtLastEditDate = StackOverflow.ConvertFromUnixTimestamp(StackOverflow.ExtractTimestampFromJsonTime(value));
+
+ }
+
+ }
+ /// &amp;lt;summary&amp;gt;
+ /// Last edit date of the post (expressed as a DateTime)
+ /// &amp;lt;/summary&amp;gt;
+ public DateTime dtLastEditDate { get; set; }
+ /// &amp;lt;summary&amp;gt;
+ /// Author of the post.
+ /// &amp;lt;/summary&amp;gt;
+ public string Author { get; set; }
+ /// &amp;lt;summary&amp;gt;
+ /// HTML of the post.
+ /// &amp;lt;/summary&amp;gt;
+ public string Summary { get; set; }
+ /// &amp;lt;summary&amp;gt;
+ /// URL of the post.
+ /// &amp;lt;/summary&amp;gt;
+ public string Link { get; set; }
+ /// &amp;lt;summary&amp;gt;
+ /// RSS Categories (or tags) of the post.
+ /// &amp;lt;/summary&amp;gt;
+ public List&amp;lt;string&amp;gt; Categories { get; set; }
+
+ }
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Thanks in advance!
+&lt;em&gt;Btw, please contribute to the library project! :)&lt;/em&gt;&lt;/p&gt;
+
+ </summary>
+ </entry>
+
+ <entry>
+ <id>http://stackoverflow.com/questions/1862457/hibernate3-self-referencing-objects</id>
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
+ <title type="text">Hibernate3: Self-Referencing Objects</title>
+ <category scheme="http://stackoverflow.com/feeds/tags" term="hibernate"/><category scheme="http://stackoverflow.com/feeds/tags" term="self"/><category scheme="http://stackoverflow.com/feeds/tags" term="reference"/>
+ <author><name>monojohnny</name></author>
+ <link rel="alternate" href="http://stackoverflow.com/questions/1862457/hibernate3-self-referencing-objects" />
+ <published>2009-12-07T19:50:18Z</published>
+ <updated>2009-12-07T21:08:37Z</updated>
+ <summary type="html">
+ &lt;p&gt;Need some help on understanding how to do this; I'm going to be running recursive 'find' on a file system and I want to keep the information in a single DB table - with a self-referencing hierarchial structure:&lt;/p&gt;
+
+&lt;p&gt;This is my DB Table structure I want to populate.&lt;/p&gt;
+
+&lt;p&gt;DirObject Table:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;id int NOT NULL,
+name varchar(255) NOT NULL,
+parentid int NOT NULL);
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the proposed Java Class I want to map (Fields only shown):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;public DirObject {
+ int id;
+ String name;
+ DirObject parent;
+...
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;For the 'root' directory was going to use parentid=0; real ids will start at 1, and ideally I want hibernate to autogenerate the ids.&lt;/p&gt;
+
+&lt;p&gt;Can somebody provide a suggested mapping file for this please; as a secondary question I thought about doing the Java Class like this instead:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;public DirObject {
+ int id;
+ String name;
+ List&amp;lt;DirObject&amp;gt; subdirs;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could I use the same data model for either of these two methods ? (With a different mapping file of course).&lt;/p&gt;
+
+&lt;p&gt;--- UPDATE: so I tried the mapping file suggested below (thanks!), repeated here for reference:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;hibernate-mapping&amp;gt;
+ &amp;lt;class name=&quot;my.proj.DirObject&quot; table=&quot;category&quot;&amp;gt;
+ ...
+
+ &amp;lt;set name=&quot;subDirs&quot; lazy=&quot;true&quot; inverse=&quot;true&quot;&amp;gt;
+ &amp;lt;key column=&quot;parentId&quot;/&amp;gt;
+ &amp;lt;one-to-many class=&quot;my.proj.DirObject&quot;/&amp;gt;
+ &amp;lt;/set&amp;gt;
+
+ &amp;lt;many-to-one name=&quot;parent&quot;