sogger 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +20 -0
- data/README.md +33 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/bin/sogger +8 -0
- data/lib/sogger.rb +8 -0
- data/lib/sogger/question.rb +38 -0
- data/lib/sogger/runner.rb +92 -0
- data/lib/sogger/sogger.rb +45 -0
- data/sogger.gemspec +74 -0
- data/test/fixtures/so_feed_sample.xml +1150 -0
- data/test/helper.rb +25 -0
- data/test/test_question.rb +60 -0
- data/test/test_runner.rb +9 -0
- data/test/test_sogger.rb +70 -0
- metadata +114 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Maxim Chernyak
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Sogger
|
2
|
+
======
|
3
|
+
|
4
|
+
The word "sogger" was derived by ingeniously abbreviating "Stack Overflow Growler Written in Ruby During a Time of Procrastination When Doing Real Work has Become Unbearable". That is what it is.
|
5
|
+
|
6
|
+
Install
|
7
|
+
-------
|
8
|
+
|
9
|
+
sudo gem install sogger
|
10
|
+
|
11
|
+
Run
|
12
|
+
---
|
13
|
+
|
14
|
+
Get growl all new questions.
|
15
|
+
|
16
|
+
sogger
|
17
|
+
|
18
|
+
Growl questions with either ruby or ruby-on-rails tags.
|
19
|
+
|
20
|
+
sogger ruby ruby-on-rails
|
21
|
+
|
22
|
+
When you run this command the app will take up your terminal session, and start monumentally logging into your life. That's cause it's unstable. Sometimes it segfaults pretty quickly, sometimes it manages to stay on for hours. Mostly depends on your luck. Please fix if you know how.
|
23
|
+
|
24
|
+
The Thing Is
|
25
|
+
------------
|
26
|
+
|
27
|
+
The thing is, currently I'm not very proficient in the area of threads, forking, race conditions, etc. This app has 2 threads. One downloads updates, one growls. Since it's a small app, it's not hard to fix whatever it is I screwed up, so please do if you like the idea.
|
28
|
+
|
29
|
+
Known Issues
|
30
|
+
------------
|
31
|
+
|
32
|
+
* It likes to segfault once in a while.
|
33
|
+
* RubyCocoa has issues with this app, probably because I use "meow" for growler. You'll see in the log.
|
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "sogger"
|
8
|
+
gem.summary = %Q{Stack overflow growler written in Ruby.}
|
9
|
+
gem.description = %Q{Simple tool that growls new questions from Stack Overflow. Supports filtering by tags.}
|
10
|
+
gem.email = "max@bitsonnet.com"
|
11
|
+
gem.homepage = "http://github.com/maxim/sogger"
|
12
|
+
gem.authors = ["Maxim Chernyak"]
|
13
|
+
gem.add_dependency "meow"
|
14
|
+
gem.add_dependency "nokogiri"
|
15
|
+
gem.add_development_dependency "shoulda"
|
16
|
+
gem.add_development_dependency "fakeweb"
|
17
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
+
end
|
19
|
+
Jeweler::GemcutterTasks.new
|
20
|
+
rescue LoadError
|
21
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
Rake::TestTask.new(:test) do |test|
|
26
|
+
test.libs << 'lib' << 'test'
|
27
|
+
test.pattern = 'test/**/test_*.rb'
|
28
|
+
test.verbose = true
|
29
|
+
end
|
30
|
+
|
31
|
+
begin
|
32
|
+
require 'rcov/rcovtask'
|
33
|
+
Rcov::RcovTask.new do |test|
|
34
|
+
test.libs << 'test'
|
35
|
+
test.pattern = 'test/**/test_*.rb'
|
36
|
+
test.verbose = true
|
37
|
+
end
|
38
|
+
rescue LoadError
|
39
|
+
task :rcov do
|
40
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
task :test => :check_dependencies
|
45
|
+
|
46
|
+
task :default => :test
|
47
|
+
|
48
|
+
require 'rake/rdoctask'
|
49
|
+
Rake::RDocTask.new do |rdoc|
|
50
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
51
|
+
|
52
|
+
rdoc.rdoc_dir = 'rdoc'
|
53
|
+
rdoc.title = "sogger #{version}"
|
54
|
+
rdoc.rdoc_files.include('README*')
|
55
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
data/bin/sogger
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'sogger'))
|
4
|
+
|
5
|
+
sogger = Sogger::Runner.new(:filter => ARGV, :logging => true)
|
6
|
+
sogger.log "Filtering tags: #{sogger.filter.inspect}." unless sogger.filter.empty?
|
7
|
+
puts "Press CTRL+C to stop..."
|
8
|
+
sogger.run
|
data/lib/sogger.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module Sogger
|
2
|
+
class Question
|
3
|
+
include Comparable
|
4
|
+
attr_accessor :attributes
|
5
|
+
|
6
|
+
def initialize(attributes = {})
|
7
|
+
@attributes = attributes
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.from_xml(xml_element)
|
11
|
+
attributes = { :title => xml_element.css('title').text,
|
12
|
+
:url => xml_element.css('id').text,
|
13
|
+
:tags => xml_element.css('category').map{|c| c['term']},
|
14
|
+
:published => DateTime.parse(xml_element.css('published').text) }
|
15
|
+
new attributes
|
16
|
+
end
|
17
|
+
|
18
|
+
def title
|
19
|
+
@attributes[:title]
|
20
|
+
end
|
21
|
+
|
22
|
+
def url
|
23
|
+
@attributes[:url]
|
24
|
+
end
|
25
|
+
|
26
|
+
def tags
|
27
|
+
@attributes[:tags]
|
28
|
+
end
|
29
|
+
|
30
|
+
def published
|
31
|
+
@attributes[:published]
|
32
|
+
end
|
33
|
+
|
34
|
+
def <=>(other)
|
35
|
+
other.published <=> published
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module Sogger
|
2
|
+
class Runner
|
3
|
+
class << self
|
4
|
+
attr_accessor :update_interval, :growl_interval, :logging
|
5
|
+
end
|
6
|
+
|
7
|
+
attr_reader :filter
|
8
|
+
|
9
|
+
Runner.update_interval = 60
|
10
|
+
Runner.growl_interval = 20
|
11
|
+
Runner.logging = true
|
12
|
+
|
13
|
+
def initialize(options = {})
|
14
|
+
options[:update_interval] ||= Runner.update_interval
|
15
|
+
options[:growl_interval] ||= Runner.growl_interval
|
16
|
+
options[:logging] = options[:logging].nil? ? Runner.logging : options[:logging]
|
17
|
+
|
18
|
+
Runner.update_interval = options[:update_interval]
|
19
|
+
Runner.growl_interval = options[:growl_interval]
|
20
|
+
Runner.logging = options[:logging]
|
21
|
+
|
22
|
+
@filter = [*options[:filter]].compact
|
23
|
+
@cached_sogger = Sogger.new
|
24
|
+
@remote_sogger = Sogger.new
|
25
|
+
@questions_buffer = []
|
26
|
+
@growler = Meow.new("Sogger")
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
updater = Thread.new("updater") do
|
31
|
+
while true
|
32
|
+
log "Updater: Downloading feed..."
|
33
|
+
@remote_sogger.download_feed!
|
34
|
+
|
35
|
+
new_questions = []
|
36
|
+
unless @cached_sogger.questions.empty?
|
37
|
+
log "Updater: Comparing feeds..."
|
38
|
+
new_questions = (@remote_sogger - @cached_sogger).questions
|
39
|
+
end
|
40
|
+
|
41
|
+
unless new_questions.empty?
|
42
|
+
log "Updater: Adding #{new_questions.size} questions to buffer..."
|
43
|
+
@questions_buffer += new_questions
|
44
|
+
end
|
45
|
+
|
46
|
+
log "Updater: Caching feed..."
|
47
|
+
@remote_sogger.save!
|
48
|
+
|
49
|
+
log "Updater: Loading cached feed..."
|
50
|
+
@cached_sogger.load!
|
51
|
+
|
52
|
+
log "Updater: Sleeping for #{Runner.update_interval} seconds..."
|
53
|
+
sleep Runner.update_interval
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
notifier = Thread.new("notifier") do
|
58
|
+
while true
|
59
|
+
unless @questions_buffer.empty?
|
60
|
+
log "\nNotifier: Filtering questions..."
|
61
|
+
while question = @questions_buffer.pop
|
62
|
+
if @filter.empty? || question.tags.any?{ |t| @filter.include?(t) }
|
63
|
+
log "\nNotifier: Growling..."
|
64
|
+
growl(question)
|
65
|
+
break
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
sleep Runner.growl_interval
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
trap("INT") do
|
75
|
+
puts " Exiting, please wait..."
|
76
|
+
[updater, notifier].map(&:kill)
|
77
|
+
end
|
78
|
+
|
79
|
+
[updater, notifier].map(&:join)
|
80
|
+
end
|
81
|
+
|
82
|
+
def growl(question)
|
83
|
+
@growler.notify(question.tags.join(', '), question.title) do
|
84
|
+
system "open", question.url
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def log(text)
|
89
|
+
puts text if Runner.logging
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Sogger
|
2
|
+
class Sogger
|
3
|
+
class << self; attr_accessor :save_path end
|
4
|
+
attr_reader :raw_data
|
5
|
+
|
6
|
+
SO_FEED_URL = "http://stackoverflow.com/feeds"
|
7
|
+
DEFAULT_SAVE_PATH = ::Tempfile.new("sogger_feed.xml").path
|
8
|
+
self.save_path = DEFAULT_SAVE_PATH
|
9
|
+
|
10
|
+
def initialize(questions = [])
|
11
|
+
@questions = questions
|
12
|
+
end
|
13
|
+
|
14
|
+
def questions
|
15
|
+
@questions.sort
|
16
|
+
end
|
17
|
+
|
18
|
+
def download_feed!
|
19
|
+
@raw_data = open(SO_FEED_URL).read
|
20
|
+
parse_raw_data
|
21
|
+
end
|
22
|
+
|
23
|
+
def save!
|
24
|
+
File.open(self.class.save_path, "w") do |file|
|
25
|
+
file.write @raw_data
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def load!
|
30
|
+
@raw_data = File.read(self.class.save_path)
|
31
|
+
parse_raw_data
|
32
|
+
end
|
33
|
+
|
34
|
+
def -(other)
|
35
|
+
newest_other = other.questions.first
|
36
|
+
Sogger.new(questions.select{|q| q < newest_other })
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
def parse_raw_data
|
41
|
+
@data = Nokogiri::XML(@raw_data)
|
42
|
+
@questions = @data.css('entry').map{ |e| Question.from_xml(e) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/sogger.gemspec
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sogger}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Maxim Chernyak"]
|
12
|
+
s.date = %q{2009-12-08}
|
13
|
+
s.default_executable = %q{sogger}
|
14
|
+
s.description = %q{Simple tool that growls new questions from Stack Overflow. Supports filtering by tags.}
|
15
|
+
s.email = %q{max@bitsonnet.com}
|
16
|
+
s.executables = ["sogger"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"LICENSE",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/sogger",
|
29
|
+
"lib/sogger.rb",
|
30
|
+
"lib/sogger/question.rb",
|
31
|
+
"lib/sogger/runner.rb",
|
32
|
+
"lib/sogger/sogger.rb",
|
33
|
+
"sogger.gemspec",
|
34
|
+
"test/fixtures/so_feed_sample.xml",
|
35
|
+
"test/helper.rb",
|
36
|
+
"test/test_question.rb",
|
37
|
+
"test/test_runner.rb",
|
38
|
+
"test/test_sogger.rb"
|
39
|
+
]
|
40
|
+
s.homepage = %q{http://github.com/maxim/sogger}
|
41
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubygems_version = %q{1.3.5}
|
44
|
+
s.summary = %q{Stack overflow growler written in Ruby.}
|
45
|
+
s.test_files = [
|
46
|
+
"test/helper.rb",
|
47
|
+
"test/test_question.rb",
|
48
|
+
"test/test_runner.rb",
|
49
|
+
"test/test_sogger.rb"
|
50
|
+
]
|
51
|
+
|
52
|
+
if s.respond_to? :specification_version then
|
53
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
54
|
+
s.specification_version = 3
|
55
|
+
|
56
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
57
|
+
s.add_runtime_dependency(%q<meow>, [">= 0"])
|
58
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<meow>, [">= 0"])
|
63
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
64
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
65
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
66
|
+
end
|
67
|
+
else
|
68
|
+
s.add_dependency(%q<meow>, [">= 0"])
|
69
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
70
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
71
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,1150 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:re="http://purl.org/atompub/rank/1.0">
|
3
|
+
<title type="text">Recent Questions - Stack Overflow</title>
|
4
|
+
<link rel="self" href="http://stackoverflow.com/feeds" type="application/atom+xml" />
|
5
|
+
<link rel="alternate" href="http://stackoverflow.com/questions" type="text/html" />
|
6
|
+
<subtitle>most recent 30 from stackoverflow.com</subtitle>
|
7
|
+
<updated>2009-12-07T01:03:53Z</updated>
|
8
|
+
<id>http://stackoverflow.com/feeds</id>
|
9
|
+
<creativeCommons:license>http://www.creativecommons.org/licenses/by-nc/2.5/rdf</creativeCommons:license>
|
10
|
+
|
11
|
+
<entry>
|
12
|
+
<id>http://stackoverflow.com/questions/1856203/windows-and-minibuffer-floating-over-the-frame</id>
|
13
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
14
|
+
<title type="text">Windows and Minibuffer floating over the frame</title>
|
15
|
+
<category scheme="http://stackoverflow.com/feeds/tags" term="emacs"/>
|
16
|
+
<author><name>konr</name></author>
|
17
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1856203/windows-and-minibuffer-floating-over-the-frame" />
|
18
|
+
<published>2009-12-06T18:48:09Z</published>
|
19
|
+
<updated>2009-12-07T01:03:42Z</updated>
|
20
|
+
<summary type="html">
|
21
|
+
<p>Hi!</p>
|
22
|
+
|
23
|
+
<p>When I start Emacs, its windows and its minibuffer start up floating on the main frame, leaving a lot of empty space (see: <a href="http://scorciapino.com/pub/fotos/erroemacs.jpg" rel="nofollow">here</a> and <a href="http://scorciapino.com/pub/fotos/erroemacs2.jpg" rel="nofollow">here</a>). Any idea of what is going on and how to fix it?</p>
|
24
|
+
|
25
|
+
<p>Thanks!</p>
|
26
|
+
|
27
|
+
</summary>
|
28
|
+
</entry>
|
29
|
+
|
30
|
+
<entry>
|
31
|
+
<id>http://stackoverflow.com/questions/1853653/hidden-features-of-coldfusion</id>
|
32
|
+
<re:rank scheme="http://stackoverflow.com">2</re:rank>
|
33
|
+
<title type="text">Hidden features of ColdFusion</title>
|
34
|
+
<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"/>
|
35
|
+
<author><name>Sergii</name></author>
|
36
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1853653/hidden-features-of-coldfusion" />
|
37
|
+
<published>2009-12-05T22:20:49Z</published>
|
38
|
+
<updated>2009-12-07T01:02:45Z</updated>
|
39
|
+
<summary type="html">
|
40
|
+
<p>Let's try to make this for our favourite technology too, how do you think?</p>
|
41
|
+
|
42
|
+
<p>Hidden code tricks, unknown usages of known features, application server easter eggs are what are we looking for.</p>
|
43
|
+
|
44
|
+
<p>So, proposed rules are simple:</p>
|
45
|
+
|
46
|
+
<ul>
|
47
|
+
<li>One feature per answer.</li>
|
48
|
+
<li>Code example, if it is the CFML/CFScript feature.</li>
|
49
|
+
<li>Application server name and version where it can be reproduced.</li>
|
50
|
+
<li>Link on the source, if re-posting someone (let's be honest).</li>
|
51
|
+
<li>Any additional requirements/tips to reproduce.</li>
|
52
|
+
</ul>
|
53
|
+
|
54
|
+
<p><hr></p>
|
55
|
+
|
56
|
+
<p>Example (old one, many of us should remember)</p>
|
57
|
+
|
58
|
+
<p><strong>Credits easter egg with custom IE language</strong></p>
|
59
|
+
|
60
|
+
<p>Open your IE (6+), go to: Tools -> Internet Options -> Languages. </p>
|
61
|
+
|
62
|
+
<p>Add a new custom language called "CFML" (without quotes) and shift it to the top of list. </p>
|
63
|
+
|
64
|
+
<p>Then log into your ColdFusion Administrator and click on System Information. </p>
|
65
|
+
|
66
|
+
<p>Funny pop-up should show up. </p>
|
67
|
+
|
68
|
+
<p>It works in CFMX 6, 7.2 and Adobe CF 8 (9 not checked).</p>
|
69
|
+
|
70
|
+
</summary>
|
71
|
+
</entry>
|
72
|
+
|
73
|
+
<entry>
|
74
|
+
<id>http://stackoverflow.com/questions/1857204/objective-c-problem-with-strings</id>
|
75
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
76
|
+
<title type="text">Objective c, problem with strings</title>
|
77
|
+
<category scheme="http://stackoverflow.com/feeds/tags" term="nsstring"/><category scheme="http://stackoverflow.com/feeds/tags" term="sqlite"/>
|
78
|
+
<author><name>unknown (google)</name></author>
|
79
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857204/objective-c-problem-with-strings" />
|
80
|
+
<published>2009-12-07T00:53:30Z</published>
|
81
|
+
<updated>2009-12-07T01:02:36Z</updated>
|
82
|
+
<summary type="html">
|
83
|
+
<p>Hi,
|
84
|
+
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:</p>
|
85
|
+
|
86
|
+
<pre><code>NSString *sql = [[NSString alloc] initWithFormat:@"select color_r, color_g, color_b from Calendar where ROWID = %@", [calendarsID objectForKey:[arrayColors objectAtIndex:row]]];
|
87
|
+
|
88
|
+
sqlite3_stmt *selectstmt;
|
89
|
+
|
90
|
+
if(sqlite3_prepare_v2(database, sql, -1, &amp;selectstmt, NULL) == SQLITE_OK)
|
91
|
+
</code></pre>
|
92
|
+
|
93
|
+
<p>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:</p>
|
94
|
+
|
95
|
+
<p>select color_, color_g, color_b from Calendar where ROWID = 63 (for example)</p>
|
96
|
+
|
97
|
+
<p>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?</p>
|
98
|
+
|
99
|
+
<p>Thank you very much for your attention.
|
100
|
+
Alessio</p>
|
101
|
+
|
102
|
+
</summary>
|
103
|
+
</entry>
|
104
|
+
|
105
|
+
<entry>
|
106
|
+
<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>
|
107
|
+
<re:rank scheme="http://stackoverflow.com">1</re:rank>
|
108
|
+
<title type="text">How to get the x,y coordinate of a mouse-click with win32 C++ on a directx object?</title>
|
109
|
+
<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"/>
|
110
|
+
<author><name>Chris</name></author>
|
111
|
+
<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" />
|
112
|
+
<published>2009-12-06T07:14:23Z</published>
|
113
|
+
<updated>2009-12-07T01:01:46Z</updated>
|
114
|
+
<summary type="html">
|
115
|
+
<p>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.</p>
|
116
|
+
|
117
|
+
<pre><code>InputMouse::InputMouse() :
|
118
|
+
m_LastX(-1),
|
119
|
+
m_LastY(-1)
|
120
|
+
{
|
121
|
+
m_MouseActionEvent.clear();
|
122
|
+
}
|
123
|
+
|
124
|
+
InputMouse::~InputMouse()
|
125
|
+
{
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
void InputMouse::PostUpdate()
|
130
|
+
{
|
131
|
+
m_CurrentAction.clear();
|
132
|
+
}
|
133
|
+
|
134
|
+
bool InputMouse::IsEventTriggered(int eventNumber)
|
135
|
+
{
|
136
|
+
for (unsigned int i = 0; i &lt; m_CurrentAction.size(); i++)
|
137
|
+
{
|
138
|
+
if (m_MouseActionEvent.size() &gt; 0 &amp;&amp; m_MouseActionEvent[m_CurrentAction[i]] == eventNumber)
|
139
|
+
{
|
140
|
+
return true;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
return false;
|
144
|
+
}
|
145
|
+
|
146
|
+
void InputMouse::AddInputEvent(int action, int eventNumber)
|
147
|
+
{
|
148
|
+
m_MouseActionEvent[action] = eventNumber;
|
149
|
+
}
|
150
|
+
|
151
|
+
void InputMouse::SetMouseMouse(int x, int y)
|
152
|
+
{
|
153
|
+
if (m_LastX != -1)
|
154
|
+
{
|
155
|
+
if (x &gt; m_LastX)
|
156
|
+
{
|
157
|
+
m_CurrentAction.push_back(MOUSE_RIGHT);
|
158
|
+
}
|
159
|
+
else if (x &lt; m_LastX)
|
160
|
+
{
|
161
|
+
m_CurrentAction.push_back(MOUSE_LEFT);
|
162
|
+
}
|
163
|
+
|
164
|
+
if (y &gt; m_LastY)
|
165
|
+
{
|
166
|
+
m_CurrentAction.push_back(MOUSE_UP);
|
167
|
+
}
|
168
|
+
else if (y &lt; m_LastY)
|
169
|
+
{
|
170
|
+
m_CurrentAction.push_back(MOUSE_DOWN);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
m_LastX = x;
|
175
|
+
m_LastY = y;
|
176
|
+
}
|
177
|
+
</code></pre>
|
178
|
+
|
179
|
+
</summary>
|
180
|
+
</entry>
|
181
|
+
|
182
|
+
<entry>
|
183
|
+
<id>http://stackoverflow.com/questions/1856887/is-there-a-way-to-make-the-code-folding-stay-folded-in-delphi-2010</id>
|
184
|
+
<re:rank scheme="http://stackoverflow.com">1</re:rank>
|
185
|
+
<title type="text">Is there a way to make the "Code Folding" Stay Folded In Delphi 2010</title>
|
186
|
+
<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"/>
|
187
|
+
<author><name>Cape Cod Gunny</name></author>
|
188
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1856887/is-there-a-way-to-make-the-code-folding-stay-folded-in-delphi-2010" />
|
189
|
+
<published>2009-12-06T22:39:14Z</published>
|
190
|
+
<updated>2009-12-07T01:01:38Z</updated>
|
191
|
+
<summary type="html">
|
192
|
+
<p>I absolutely love the <b>Code Folding</b> 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?</p>
|
193
|
+
|
194
|
+
</summary>
|
195
|
+
</entry>
|
196
|
+
|
197
|
+
<entry>
|
198
|
+
<id>http://stackoverflow.com/questions/1857158/adding-floats-with-javascript</id>
|
199
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
200
|
+
<title type="text">Adding floats with javascript</title>
|
201
|
+
<category scheme="http://stackoverflow.com/feeds/tags" term="javascript"/><category scheme="http://stackoverflow.com/feeds/tags" term="jquery"/>
|
202
|
+
<author><name>jpsilvashy</name></author>
|
203
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857158/adding-floats-with-javascript" />
|
204
|
+
<published>2009-12-07T00:36:19Z</published>
|
205
|
+
<updated>2009-12-07T01:01:03Z</updated>
|
206
|
+
<summary type="html">
|
207
|
+
<p>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: <code>123.5013.0012.35</code></p>
|
208
|
+
|
209
|
+
<p>How can I sum these properly?</p>
|
210
|
+
|
211
|
+
<pre><code>var totals
|
212
|
+
|
213
|
+
$(".add").each(function(i) {
|
214
|
+
totals += parseFloat($(this).text()).toFixed(2);
|
215
|
+
});
|
216
|
+
|
217
|
+
console.log(totals);
|
218
|
+
</code></pre>
|
219
|
+
|
220
|
+
</summary>
|
221
|
+
</entry>
|
222
|
+
|
223
|
+
<entry>
|
224
|
+
<id>http://stackoverflow.com/questions/1857131/haskell-question-regarding-data</id>
|
225
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
226
|
+
<title type="text">Haskell question regarding data</title>
|
227
|
+
<category scheme="http://stackoverflow.com/feeds/tags" term="haskell"/>
|
228
|
+
<author><name>usr</name></author>
|
229
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857131/haskell-question-regarding-data" />
|
230
|
+
<published>2009-12-07T00:28:27Z</published>
|
231
|
+
<updated>2009-12-07T01:00:55Z</updated>
|
232
|
+
<summary type="html">
|
233
|
+
<p>Code:</p>
|
234
|
+
|
235
|
+
<pre><code>data Exp = Const a | Eq Exp Exp
|
236
|
+
</code></pre>
|
237
|
+
|
238
|
+
<p>I want the <em>Const a</em> to contain a value of type show so that i can print it later. So in C# i would write:</p>
|
239
|
+
|
240
|
+
<pre><code>class Const : Exp { IShow X; }
|
241
|
+
class Eq : Exp { Exp X, Y; }
|
242
|
+
</code></pre>
|
243
|
+
|
244
|
+
<p>How can i do that in Haskell?</p>
|
245
|
+
|
246
|
+
</summary>
|
247
|
+
</entry>
|
248
|
+
|
249
|
+
<entry>
|
250
|
+
<id>http://stackoverflow.com/questions/1857050/using-apples-automator-to-pass-filenames-to-a-shell-script</id>
|
251
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
252
|
+
<title type="text">Using apple's Automator to pass filenames to a shell script.</title>
|
253
|
+
<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"/>
|
254
|
+
<author><name>John </name></author>
|
255
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857050/using-apples-automator-to-pass-filenames-to-a-shell-script" />
|
256
|
+
<published>2009-12-06T23:41:19Z</published>
|
257
|
+
<updated>2009-12-07T01:00:46Z</updated>
|
258
|
+
<summary type="html">
|
259
|
+
<p>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?</p>
|
260
|
+
|
261
|
+
<pre><code>for f in "$@"
|
262
|
+
do
|
263
|
+
java -Xmx1000m -jar /Users/myprog/myprog.jar $f
|
264
|
+
done
|
265
|
+
</code></pre>
|
266
|
+
|
267
|
+
</summary>
|
268
|
+
</entry>
|
269
|
+
|
270
|
+
<entry>
|
271
|
+
<id>http://stackoverflow.com/questions/1857222/masks-in-air-with-actionscript-3</id>
|
272
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
273
|
+
<title type="text">Masks in AIR with Actionscript 3</title>
|
274
|
+
<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"/>
|
275
|
+
<author><name>webdreamer</name></author>
|
276
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857222/masks-in-air-with-actionscript-3" />
|
277
|
+
<published>2009-12-07T01:00:18Z</published>
|
278
|
+
<updated>2009-12-07T01:00:18Z</updated>
|
279
|
+
<summary type="html">
|
280
|
+
<p>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.
|
281
|
+
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.</p>
|
282
|
+
|
283
|
+
<pre><code>mask = new UIMovieClip();
|
284
|
+
mask.graphics.beginFill(0xFFFFFF);
|
285
|
+
mask.graphics.drawRect(radius,radius+radius*2*(1-(ecoWeight-Math.floor(ecoWeight))),1000,1000);
|
286
|
+
mask.graphics.endFill();
|
287
|
+
earth = new UIMovieClip();
|
288
|
+
earth.graphics.beginFill(0xFFFFFF);
|
289
|
+
earth.graphics.drawCircle(radius,radius,radius);
|
290
|
+
earth.mask=mask;
|
291
|
+
earth.graphics.endFill();
|
292
|
+
</code></pre>
|
293
|
+
|
294
|
+
</summary>
|
295
|
+
</entry>
|
296
|
+
|
297
|
+
<entry>
|
298
|
+
<id>http://stackoverflow.com/questions/1857191/jquery-is-mouse-still-over-the-element</id>
|
299
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
300
|
+
<title type="text">jQuery: is mouse still over the element?</title>
|
301
|
+
<category scheme="http://stackoverflow.com/feeds/tags" term="jquery"/><category scheme="http://stackoverflow.com/feeds/tags" term="mouseover"/>
|
302
|
+
<author><name>thedp</name></author>
|
303
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857191/jquery-is-mouse-still-over-the-element" />
|
304
|
+
<published>2009-12-07T00:48:05Z</published>
|
305
|
+
<updated>2009-12-07T01:00:17Z</updated>
|
306
|
+
<summary type="html">
|
307
|
+
<p>Hello,</p>
|
308
|
+
|
309
|
+
<p>I would like to be able to detect if the mouse is still over the element in the following scenario:</p>
|
310
|
+
|
311
|
+
<ol>
|
312
|
+
<li>If mouseover then sleep for a few seconds.</li>
|
313
|
+
<li>Once done sleeping check of the mouse is still over the same element.</li>
|
314
|
+
<li>If true then do something.</li>
|
315
|
+
</ol>
|
316
|
+
|
317
|
+
<p>How can I achieve #2?</p>
|
318
|
+
|
319
|
+
<p>Thank you.</p>
|
320
|
+
|
321
|
+
</summary>
|
322
|
+
</entry>
|
323
|
+
|
324
|
+
<entry>
|
325
|
+
<id>http://stackoverflow.com/questions/1855773/avoid-slicing-of-exception-types-c</id>
|
326
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
327
|
+
<title type="text">Avoid slicing of exception types (C++)</title>
|
328
|
+
<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"/>
|
329
|
+
<author><name>shojtsy</name></author>
|
330
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1855773/avoid-slicing-of-exception-types-c" />
|
331
|
+
<published>2009-12-06T16:08:38Z</published>
|
332
|
+
<updated>2009-12-07T01:00:16Z</updated>
|
333
|
+
<summary type="html">
|
334
|
+
<p>I am designing an exception hierarchy in C++ for my library. The "hierarchy" is 4 classes derived from std::runtime_error. I would like to avoid the <a href="http://stackoverflow.com/questions/274626/what-is-the-slicing-problem-in-c">slicing problem</a> 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?</p>
|
335
|
+
|
336
|
+
<h3>Edit: Answering my own questions</h3>
|
337
|
+
|
338
|
+
<p>Thanks for the answers. The two portable ways I have found to stop clients of my library from catching exceptions incorrectly by value are</p>
|
339
|
+
|
340
|
+
<ol>
|
341
|
+
<li>Throw exceptions from inside <a href="http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.10" rel="nofollow">virtual raise</a> methods of the exception classes, and make copy constructors protected. (Thanks D.Shawley)</li>
|
342
|
+
<li>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 <a href="http://stackoverflow.com/questions/1095225/exception-slicing-is-this-due-to-generated-copy-constructor">here</a> for a simmilar question)</li>
|
343
|
+
</ol>
|
344
|
+
|
345
|
+
<p>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:</p>
|
346
|
+
|
347
|
+
<blockquote>
|
348
|
+
<p>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.</p>
|
349
|
+
|
350
|
+
<p>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)</p>
|
351
|
+
</blockquote>
|
352
|
+
|
353
|
+
</summary>
|
354
|
+
</entry>
|
355
|
+
|
356
|
+
<entry>
|
357
|
+
<id>http://stackoverflow.com/questions/386576/multilingual-flex-app</id>
|
358
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
359
|
+
<title type="text">Multilingual Flex App</title>
|
360
|
+
<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"/>
|
361
|
+
<author><name>unknown (google)</name></author>
|
362
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/386576/multilingual-flex-app" />
|
363
|
+
<published>2008-12-22T15:53:12Z</published>
|
364
|
+
<updated>2009-12-07T01:00:00Z</updated>
|
365
|
+
<summary type="html">
|
366
|
+
<p>Hi,
|
367
|
+
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.</p>
|
368
|
+
|
369
|
+
<p>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.</p>
|
370
|
+
|
371
|
+
<p>We have this two lines in our css..</p>
|
372
|
+
|
373
|
+
<pre><code>@font-face
|
374
|
+
{
|
375
|
+
src: url("MyriadPro-Semibold.otf");
|
376
|
+
fontFamily: "Default Font";
|
377
|
+
fontWeight: bold;
|
378
|
+
advancedAntiAliasing: true;
|
379
|
+
}
|
380
|
+
@font-face
|
381
|
+
{
|
382
|
+
src: url("MyriadPro-Regular.otf");
|
383
|
+
fontFamily: "Default Font";
|
384
|
+
advancedAntiAliasing: true;
|
385
|
+
}
|
386
|
+
</code></pre>
|
387
|
+
|
388
|
+
<p>and the rest of stlyes use the "Default Font" when needed.</p>
|
389
|
+
|
390
|
+
<p>What is the best solution for implementing the multilingual apps with runtime loading fonts, while maintaining the current stylesheet?</p>
|
391
|
+
|
392
|
+
</summary>
|
393
|
+
</entry>
|
394
|
+
|
395
|
+
<entry>
|
396
|
+
<id>http://stackoverflow.com/questions/1321256/type-code-in-to-a-text-input-form-how</id>
|
397
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
398
|
+
<title type="text">Type code in to a text input form, how?</title>
|
399
|
+
<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"/>
|
400
|
+
<author><name>Per Magnusson</name></author>
|
401
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1321256/type-code-in-to-a-text-input-form-how" />
|
402
|
+
<published>2009-08-24T09:07:43Z</published>
|
403
|
+
<updated>2009-12-07T01:00:00Z</updated>
|
404
|
+
<summary type="html">
|
405
|
+
<p>Hello!
|
406
|
+
I want to know the best way of writing out my "$imagepath" in to this input </p>
|
407
|
+
|
408
|
+
<p>This is my upload script</p>
|
409
|
+
|
410
|
+
<pre><code>&lt;?php
|
411
|
+
if(isset($_POST['submit'])){
|
412
|
+
if (isset ($_FILES['new_image'])){
|
413
|
+
$imagename = $_FILES['new_image']['name'];
|
414
|
+
$source = $_FILES['new_image']['tmp_name'];
|
415
|
+
$target = "temporary_images/".$imagename;
|
416
|
+
move_uploaded_file($source, $target);
|
417
|
+
|
418
|
+
$imagepath = $imagename;
|
419
|
+
$save = "temporary_images/" . $imagepath; //This is the new file you saving
|
420
|
+
$file = "temporary_images/" . $imagepath; //This is the original file
|
421
|
+
|
422
|
+
list($width, $height) = getimagesize($file) ;
|
423
|
+
|
424
|
+
$modwidth = 350;
|
425
|
+
$modheight = 100;
|
426
|
+
|
427
|
+
$tn = imagecreatetruecolor($modwidth, $modheight) ;
|
428
|
+
$image = imagecreatefromjpeg($file) ;
|
429
|
+
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
|
430
|
+
|
431
|
+
imagejpeg($tn, $save, 100) ;
|
432
|
+
|
433
|
+
$save = "temporary_images/sml_" . $imagepath; //This is the new file you saving
|
434
|
+
$file = "temporary_images/" . $imagepath; //This is the original file
|
435
|
+
|
436
|
+
list($width, $height) = getimagesize($file) ;
|
437
|
+
|
438
|
+
$modwidth = 80;
|
439
|
+
$modheight = 100;
|
440
|
+
|
441
|
+
$tn = imagecreatetruecolor($modwidth, $modheight) ;
|
442
|
+
$image = imagecreatefromjpeg($file) ;
|
443
|
+
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
|
444
|
+
|
445
|
+
imagejpeg($tn, $save, 100) ;
|
446
|
+
echo "Large image: &lt;img src='temporary_images/".$imagepath."'&gt;&lt;br&gt;";
|
447
|
+
echo "$imagepath"
|
448
|
+
}
|
449
|
+
}
|
450
|
+
</code></pre>
|
451
|
+
|
452
|
+
<p>And this is my form</p>
|
453
|
+
|
454
|
+
<pre><code>&lt;form&gt;
|
455
|
+
&lt;input name="animeinput" id="animeinput" size="20" class="textbox"&gt;
|
456
|
+
&lt;/form&gt;
|
457
|
+
</code></pre>
|
458
|
+
|
459
|
+
</summary>
|
460
|
+
</entry>
|
461
|
+
|
462
|
+
<entry>
|
463
|
+
<id>http://stackoverflow.com/questions/1093731/creating-an-application-print-queue</id>
|
464
|
+
<re:rank scheme="http://stackoverflow.com">1</re:rank>
|
465
|
+
<title type="text">Creating an application print queue</title>
|
466
|
+
<category scheme="http://stackoverflow.com/feeds/tags" term=".net"/><category scheme="http://stackoverflow.com/feeds/tags" term="printing"/>
|
467
|
+
<author><name>Dan</name></author>
|
468
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1093731/creating-an-application-print-queue" />
|
469
|
+
<published>2009-07-07T17:41:06Z</published>
|
470
|
+
<updated>2009-12-07T01:00:00Z</updated>
|
471
|
+
<summary type="html">
|
472
|
+
<p>We've received a rather tricky business requirement.</p>
|
473
|
+
|
474
|
+
<p><em>Users should be able to store print jobs in the application, until the user explicitly decides to send the jobs to the actual printer.</em></p>
|
475
|
+
|
476
|
+
<p>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?</p>
|
477
|
+
|
478
|
+
<p>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.
|
479
|
+
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?</p>
|
480
|
+
|
481
|
+
</summary>
|
482
|
+
</entry>
|
483
|
+
|
484
|
+
<entry>
|
485
|
+
<id>http://stackoverflow.com/questions/855030/help-linq-to-sql</id>
|
486
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
487
|
+
<title type="text">Help Linq to Sql</title>
|
488
|
+
<category scheme="http://stackoverflow.com/feeds/tags" term="linq-to-sql"/><category scheme="http://stackoverflow.com/feeds/tags" term="asp.net-mvc"/>
|
489
|
+
<author><name>John Prado</name></author>
|
490
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/855030/help-linq-to-sql" />
|
491
|
+
<published>2009-05-12T21:46:28Z</published>
|
492
|
+
<updated>2009-12-07T01:00:00Z</updated>
|
493
|
+
<summary type="html">
|
494
|
+
<p>Why am I getting a exception when ApplyPropertyChanges???</p>
|
495
|
+
|
496
|
+
<p>The code is almost the same when I'm editing a user table but is not working with my news table.</p>
|
497
|
+
|
498
|
+
<p>The create, delete and details are all working fine but when I try to edit a news I'm getting the exception below:</p>
|
499
|
+
|
500
|
+
<p><strong>The ObjectStateManager does not contain a ObjectStateEntry 'MagixCMS.Models.noticia'</strong></p>
|
501
|
+
|
502
|
+
<pre><code>using System;
|
503
|
+
using System.Collections.Generic;
|
504
|
+
using System.Linq;
|
505
|
+
using System.Web;
|
506
|
+
|
507
|
+
namespace MagixCMS.Models
|
508
|
+
{
|
509
|
+
public class NoticiaRepository : INoticiaRepository
|
510
|
+
{
|
511
|
+
#region INoticiaRepository Members
|
512
|
+
|
513
|
+
magixcmsEntities _entities = new magixcmsEntities();
|
514
|
+
|
515
|
+
public noticia CreateNoticia(noticia noticiaToCreate)
|
516
|
+
{
|
517
|
+
_entities.AddTonoticiaSet(noticiaToCreate);
|
518
|
+
_entities.SaveChanges();
|
519
|
+
return noticiaToCreate;
|
520
|
+
}
|
521
|
+
|
522
|
+
public void DeletaNoticia(noticia noticiaToDelete)
|
523
|
+
{
|
524
|
+
var noticiaOriginal = GetNoticia(noticiaToDelete.Id);
|
525
|
+
_entities.DeleteObject(noticiaOriginal);
|
526
|
+
_entities.SaveChanges();
|
527
|
+
}
|
528
|
+
|
529
|
+
public noticia EditNoticia(noticia noticiaToEdit)
|
530
|
+
{
|
531
|
+
var noticiaOriginal = GetNoticia(noticiaToEdit.Id);
|
532
|
+
_entities.ApplyPropertyChanges(noticiaToEdit.EntityKey.EntitySetName, noticiaToEdit); //EXCEPTION HERE
|
533
|
+
_entities.SaveChanges();
|
534
|
+
return noticiaToEdit;
|
535
|
+
}
|
536
|
+
|
537
|
+
public noticia GetNoticia(int id)
|
538
|
+
{
|
539
|
+
return (from c in _entities.noticiaSet where c.Id == id select c).FirstOrDefault();
|
540
|
+
}
|
541
|
+
|
542
|
+
public IEnumerable&lt;noticia&gt; ListNoticias()
|
543
|
+
{
|
544
|
+
return _entities.noticiaSet.ToList();
|
545
|
+
}
|
546
|
+
|
547
|
+
#endregion
|
548
|
+
}
|
549
|
+
}
|
550
|
+
</code></pre>
|
551
|
+
|
552
|
+
<p>I google the exception and didn't found much help.</p>
|
553
|
+
|
554
|
+
</summary>
|
555
|
+
</entry>
|
556
|
+
|
557
|
+
<entry>
|
558
|
+
<id>http://stackoverflow.com/questions/1736314/writing-to-an-xml-file-with-xmllite</id>
|
559
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
560
|
+
<title type="text">Writing to an xml file with xmllite?</title>
|
561
|
+
<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"/>
|
562
|
+
<author><name>Chris</name></author>
|
563
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1736314/writing-to-an-xml-file-with-xmllite" />
|
564
|
+
<published>2009-11-15T01:56:32Z</published>
|
565
|
+
<updated>2009-12-07T00:59:40Z</updated>
|
566
|
+
<summary type="html">
|
567
|
+
<p>I have an xml file which holds a set of "<code>game</code>" nodes (which contain details about saved gameplay, as you'd save your game on any console game). All of this is contained within a "<code>games</code>" root node. I'm implementing save functionality to this xml file and wish to be able to append or overwrite a "<code>game</code>" node and its child nodes within the "<code>games</code>" root node. </p>
|
568
|
+
|
569
|
+
<p>How can this be accomplished with <code>xmllite.dll</code>?</p>
|
570
|
+
|
571
|
+
</summary>
|
572
|
+
</entry>
|
573
|
+
|
574
|
+
<entry>
|
575
|
+
<id>http://stackoverflow.com/questions/1856915/nice-way-to-pass-parameters-to-pdo</id>
|
576
|
+
<re:rank scheme="http://stackoverflow.com">1</re:rank>
|
577
|
+
<title type="text">Nice way to pass parameters to PDO</title>
|
578
|
+
<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"/>
|
579
|
+
<author><name>Ramon</name></author>
|
580
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1856915/nice-way-to-pass-parameters-to-pdo" />
|
581
|
+
<published>2009-12-06T22:48:22Z</published>
|
582
|
+
<updated>2009-12-07T00:59:29Z</updated>
|
583
|
+
<summary type="html">
|
584
|
+
<p>Positional parameters become a nightmare when dealing with more than 3 or 4 parameters. Named parameters are verbose. I'm thinking of doing this:</p>
|
585
|
+
|
586
|
+
<pre><code>query("SELECT * FROM users WHERE username = ", $username, " AND password = ", $password)
|
587
|
+
</code></pre>
|
588
|
+
|
589
|
+
<p>With dynamic parameters (using <code>func_get_args()</code>), every second one being transformed into a positional parameter. </p>
|
590
|
+
|
591
|
+
<p>I've never seen this before and wanted to know if anyone has done this before and why/why not?</p>
|
592
|
+
|
593
|
+
</summary>
|
594
|
+
</entry>
|
595
|
+
|
596
|
+
<entry>
|
597
|
+
<id>http://stackoverflow.com/questions/1857083/how-functional-language-are-different-from-the-language-implementation-point-of-v</id>
|
598
|
+
<re:rank scheme="http://stackoverflow.com">1</re:rank>
|
599
|
+
<title type="text">How Functional language are different from the language implementation point of view.</title>
|
600
|
+
<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"/>
|
601
|
+
<author><name>Dinesh Simkhada</name></author>
|
602
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857083/how-functional-language-are-different-from-the-language-implementation-point-of-v" />
|
603
|
+
<published>2009-12-06T23:59:49Z</published>
|
604
|
+
<updated>2009-12-07T00:59:14Z</updated>
|
605
|
+
<summary type="html">
|
606
|
+
<p>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 ?.</p>
|
607
|
+
|
608
|
+
</summary>
|
609
|
+
</entry>
|
610
|
+
|
611
|
+
<entry>
|
612
|
+
<id>http://stackoverflow.com/questions/1857179/sql-server-replication-consolidation</id>
|
613
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
614
|
+
<title type="text">SQL Server Replication, Consolidation</title>
|
615
|
+
<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"/>
|
616
|
+
<author><name>BrainMan</name></author>
|
617
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857179/sql-server-replication-consolidation" />
|
618
|
+
<published>2009-12-07T00:42:42Z</published>
|
619
|
+
<updated>2009-12-07T00:59:13Z</updated>
|
620
|
+
<summary type="html">
|
621
|
+
<p>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.</p>
|
622
|
+
|
623
|
+
<pre><code>Store 1 Sales Table
|
624
|
+
=====================
|
625
|
+
Item Qty Amt
|
626
|
+
=====================
|
627
|
+
111 2 10.00
|
628
|
+
222 1 7.00
|
629
|
+
333 1 12.00
|
630
|
+
|
631
|
+
Store 2 Sales Table
|
632
|
+
=====================
|
633
|
+
Item Qty Amt
|
634
|
+
=====================
|
635
|
+
111 2 18.00
|
636
|
+
222 1 13.00
|
637
|
+
333 1 4.00
|
638
|
+
</code></pre>
|
639
|
+
|
640
|
+
<p>How do I replicate these two sales publications from the publisher to ONE consolidated sales table at the subscriber:</p>
|
641
|
+
|
642
|
+
<pre><code>Central Office
|
643
|
+
==============================
|
644
|
+
Store Item Qty Amt
|
645
|
+
==============================
|
646
|
+
1 111 2 10.00
|
647
|
+
1 222 1 7.00
|
648
|
+
1 333 1 12.00
|
649
|
+
2 111 2 18.00
|
650
|
+
2 222 1 13.00
|
651
|
+
2 333 1 4.00
|
652
|
+
</code></pre>
|
653
|
+
|
654
|
+
</summary>
|
655
|
+
</entry>
|
656
|
+
|
657
|
+
<entry>
|
658
|
+
<id>http://stackoverflow.com/questions/1856963/python-soappy-add-header</id>
|
659
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
660
|
+
<title type="text">python soappy add header</title>
|
661
|
+
<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"/>
|
662
|
+
<author><name>dandu</name></author>
|
663
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1856963/python-soappy-add-header" />
|
664
|
+
<published>2009-12-06T23:13:08Z</published>
|
665
|
+
<updated>2009-12-07T00:57:17Z</updated>
|
666
|
+
<summary type="html">
|
667
|
+
<p>I have the following PHP example code:</p>
|
668
|
+
|
669
|
+
<pre><code>$client = new SoapClient("http://example.com/example.wsdl");
|
670
|
+
|
671
|
+
$h = Array();
|
672
|
+
array_push($h, new SoapHeader("http://example2.com/example2/", "h", "v"));
|
673
|
+
$client-&gt;__setSoapHeaders($h);
|
674
|
+
|
675
|
+
$s = $client-&gt;__soapCall('Op', $data);
|
676
|
+
</code></pre>
|
677
|
+
|
678
|
+
<p>My question: what's the SOAPpy equivalent for the SoapHeader() and __setSoapHeaders() part?</p>
|
679
|
+
|
680
|
+
<h3>Related question</h3>
|
681
|
+
|
682
|
+
<ul>
|
683
|
+
<li><a href="http://stackoverflow.com/questions/1481313/how-to-add-header-while-making-soap-request-using-soappy">How to add header while making soap request using soappy</a></li>
|
684
|
+
</ul>
|
685
|
+
|
686
|
+
</summary>
|
687
|
+
</entry>
|
688
|
+
|
689
|
+
<entry>
|
690
|
+
<id>http://stackoverflow.com/questions/1808375/send-and-receive-data-trough-the-power-network</id>
|
691
|
+
<re:rank scheme="http://stackoverflow.com">3</re:rank>
|
692
|
+
<title type="text">Send and receive data trough the power network</title>
|
693
|
+
<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"/>
|
694
|
+
<author><name>luvieere</name></author>
|
695
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1808375/send-and-receive-data-trough-the-power-network" />
|
696
|
+
<published>2009-11-27T12:06:48Z</published>
|
697
|
+
<updated>2009-12-07T00:57:01Z</updated>
|
698
|
+
<summary type="html">
|
699
|
+
<p>I'm <strong>not</strong> interested in a hardware solution, I want to know about software that may "read" 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.</p>
|
700
|
+
|
701
|
+
<p>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 <a href="http://en.wikipedia.org/wiki/Power%5Fline%5Fcommunication" rel="nofollow">Power Line Communication</a> network and receive data directly through the power cable, without the need for a converter. Is there any active research in this field?</p>
|
702
|
+
|
703
|
+
<p><strong>Edit:</strong></p>
|
704
|
+
|
705
|
+
<p>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.</p>
|
706
|
+
|
707
|
+
</summary>
|
708
|
+
</entry>
|
709
|
+
|
710
|
+
<entry>
|
711
|
+
<id>http://stackoverflow.com/questions/1831273/dashcommerce-is-discontinued-where-to-look-for-support</id>
|
712
|
+
<re:rank scheme="http://stackoverflow.com">1</re:rank>
|
713
|
+
<title type="text">Dashcommerce is discontinued, where to look for support?</title>
|
714
|
+
<category scheme="http://stackoverflow.com/feeds/tags" term="storefront"/>
|
715
|
+
<author><name>ViktorBergman</name></author>
|
716
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1831273/dashcommerce-is-discontinued-where-to-look-for-support" />
|
717
|
+
<published>2009-12-02T07:49:47Z</published>
|
718
|
+
<updated>2009-12-07T00:56:54Z</updated>
|
719
|
+
<summary type="html">
|
720
|
+
<p>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.</p>
|
721
|
+
|
722
|
+
<p>So here we stand we with an orphant storefront with no community at all to look for help at.</p>
|
723
|
+
|
724
|
+
<p>Does anybody now <strong>why</strong> they just left the surface of the earth?
|
725
|
+
And is there any interest in starting up a forum for the active users?</p>
|
726
|
+
|
727
|
+
</summary>
|
728
|
+
</entry>
|
729
|
+
|
730
|
+
<entry>
|
731
|
+
<id>http://stackoverflow.com/questions/1857215/audio-libraries-for-digital-signal-processing-in-c</id>
|
732
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
733
|
+
<title type="text">Audio libraries for digital signal processing in C#</title>
|
734
|
+
<category scheme="http://stackoverflow.com/feeds/tags" term="xaudio2"/><category scheme="http://stackoverflow.com/feeds/tags" term="dsp"/>
|
735
|
+
<author><name>Roderick</name></author>
|
736
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857215/audio-libraries-for-digital-signal-processing-in-c" />
|
737
|
+
<published>2009-12-07T00:56:46Z</published>
|
738
|
+
<updated>2009-12-07T00:56:46Z</updated>
|
739
|
+
<summary type="html">
|
740
|
+
<p>Hello all,</p>
|
741
|
+
|
742
|
+
<p>My problem is this:</p>
|
743
|
+
|
744
|
+
<p>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).</p>
|
745
|
+
|
746
|
+
<p>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. </p>
|
747
|
+
|
748
|
+
<p>Any help is appreciated</p>
|
749
|
+
|
750
|
+
</summary>
|
751
|
+
</entry>
|
752
|
+
|
753
|
+
<entry>
|
754
|
+
<id>http://stackoverflow.com/questions/1857214/changing-default-paper-tray-with-adobe-acrobat</id>
|
755
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
756
|
+
<title type="text">changing default paper tray with Adobe Acrobat</title>
|
757
|
+
<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"/>
|
758
|
+
<author><name>PNG Programmer</name></author>
|
759
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857214/changing-default-paper-tray-with-adobe-acrobat" />
|
760
|
+
<published>2009-12-07T00:56:23Z</published>
|
761
|
+
<updated>2009-12-07T00:56:23Z</updated>
|
762
|
+
<summary type="html">
|
763
|
+
<p>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.</p>
|
764
|
+
|
765
|
+
</summary>
|
766
|
+
</entry>
|
767
|
+
|
768
|
+
<entry>
|
769
|
+
<id>http://stackoverflow.com/questions/1857213/linq-query-expression-translator</id>
|
770
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
771
|
+
<title type="text">LINQ query expression translator?</title>
|
772
|
+
<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"/>
|
773
|
+
<author><name>naasking</name></author>
|
774
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857213/linq-query-expression-translator" />
|
775
|
+
<published>2009-12-07T00:56:03Z</published>
|
776
|
+
<updated>2009-12-07T00:56:03Z</updated>
|
777
|
+
<summary type="html">
|
778
|
+
<p>I'm adding a LINQ interface to some custom objects, but the <a href="http://msdn.microsoft.com/en-us/library/bb546090.aspx" rel="nofollow">C# compiler fails on type inference</a>. 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.</p>
|
779
|
+
|
780
|
+
<p>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?</p>
|
781
|
+
|
782
|
+
<p>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.</p>
|
783
|
+
|
784
|
+
</summary>
|
785
|
+
</entry>
|
786
|
+
|
787
|
+
<entry>
|
788
|
+
<id>http://stackoverflow.com/questions/1857098/is-there-a-way-to-get-a-validationsummary-to-work-with-client-side-validators</id>
|
789
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
790
|
+
<title type="text">Is there a way to get a ValidationSummary to work with client-side validators?</title>
|
791
|
+
<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"/>
|
792
|
+
<author><name>David</name></author>
|
793
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1857098/is-there-a-way-to-get-a-validationsummary-to-work-with-client-side-validators" />
|
794
|
+
<published>2009-12-07T00:05:35Z</published>
|
795
|
+
<updated>2009-12-07T00:55:40Z</updated>
|
796
|
+
<summary type="html">
|
797
|
+
<p>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?</p>
|
798
|
+
|
799
|
+
<p>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.</p>
|
800
|
+
|
801
|
+
<p>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.</p>
|
802
|
+
|
803
|
+
<p>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.</p>
|
804
|
+
|
805
|
+
</summary>
|
806
|
+
</entry>
|
807
|
+
|
808
|
+
<entry>
|
809
|
+
<id>http://stackoverflow.com/questions/1856654/git-how-to-add-commit-removals-made-via-vanilla-rm</id>
|
810
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
811
|
+
<title type="text">git: how to add/commit removals made via vanilla rm?</title>
|
812
|
+
<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"/>
|
813
|
+
<author><name>kch</name></author>
|
814
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1856654/git-how-to-add-commit-removals-made-via-vanilla-rm" />
|
815
|
+
<published>2009-12-06T21:23:12Z</published>
|
816
|
+
<updated>2009-12-07T00:55:30Z</updated>
|
817
|
+
<summary type="html">
|
818
|
+
<p>I deleted a bunch of files / directories from a git repository using <code>rm</code>, the Finder, etc.</p>
|
819
|
+
|
820
|
+
<p>I'm looking for a git command that'll record these to the index as marked for removal. (As if I had called <code>git rm</code> on them.)</p>
|
821
|
+
|
822
|
+
<p>I understand <code>git add -u</code> will do this, along with a bunch of other things. I'd like my command to exclusively handle removals.</p>
|
823
|
+
|
824
|
+
</summary>
|
825
|
+
</entry>
|
826
|
+
|
827
|
+
<entry>
|
828
|
+
<id>http://stackoverflow.com/questions/1856794/how-would-you-convert-this-mutable-tree-into-an-immutable-one</id>
|
829
|
+
<re:rank scheme="http://stackoverflow.com">1</re:rank>
|
830
|
+
<title type="text">How would you convert this mutable tree into an immutable one?</title>
|
831
|
+
<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"/>
|
832
|
+
<author><name>gradbot</name></author>
|
833
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1856794/how-would-you-convert-this-mutable-tree-into-an-immutable-one" />
|
834
|
+
<published>2009-12-06T22:12:10Z</published>
|
835
|
+
<updated>2009-12-07T00:55:19Z</updated>
|
836
|
+
<summary type="html">
|
837
|
+
<h2>How would you convert type Node into an immutable tree?</h2>
|
838
|
+
|
839
|
+
<p>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 <code>{min = 10; max = 20}</code> 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. </p>
|
840
|
+
|
841
|
+
<p>I recommend starting with the Insert method to read this code.</p>
|
842
|
+
|
843
|
+
<pre><code>module StackOverflowQuestion
|
844
|
+
|
845
|
+
open System
|
846
|
+
|
847
|
+
type Range =
|
848
|
+
{ min : int64; max : int64 }
|
849
|
+
with
|
850
|
+
override this.ToString() =
|
851
|
+
sprintf "(%d, %d)" this.min this.max
|
852
|
+
|
853
|
+
[&lt;AllowNullLiteralAttribute&gt;]
|
854
|
+
type Node(left:Node, right:Node, range:Range) =
|
855
|
+
let mutable left = left
|
856
|
+
let mutable right = right
|
857
|
+
let mutable range = range
|
858
|
+
|
859
|
+
|
860
|
+
// Symmetric to clean right
|
861
|
+
let rec cleanLeft(node : Node) =
|
862
|
+
if node.Left = null then
|
863
|
+
()
|
864
|
+
elif range.max &lt; node.Left.Range.min - 1L then
|
865
|
+
cleanLeft(node.Left)
|
866
|
+
elif range.max &lt;= node.Left.Range.max then
|
867
|
+
range &lt;- {min = range.min; max = node.Left.Range.max}
|
868
|
+
node.Left &lt;- node.Left.Right
|
869
|
+
else
|
870
|
+
node.Left &lt;- node.Left.Right
|
871
|
+
cleanLeft(node)
|
872
|
+
|
873
|
+
// Clean right deals with merging when the node to merge with is not on the
|
874
|
+
// left outside of the tree. It travels right inside the tree looking for an
|
875
|
+
// overlapping node. If it finds one it merges the range and replaces the
|
876
|
+
// node with its left child thereby deleting it. If it finds a subset node
|
877
|
+
// it replaces it with its left child, checks it and continues looking right.
|
878
|
+
let rec cleanRight(node : Node) =
|
879
|
+
if node.Right = null then
|
880
|
+
()
|
881
|
+
elif range.min &gt; node.Right.Range.max + 1L then
|
882
|
+
cleanRight(node.Right)
|
883
|
+
elif range.min &gt;= node.Right.Range.min then
|
884
|
+
range &lt;- {min = node.Right.Range.min; max = range.max}
|
885
|
+
node.Right &lt;- node.Right.Left
|
886
|
+
else
|
887
|
+
node.Right &lt;- node.Right.Left
|
888
|
+
cleanRight(node)
|
889
|
+
|
890
|
+
// Merger left is called whenever the min value of a node decreases.
|
891
|
+
// It handles the case of left node overlap/subsets and merging/deleting them.
|
892
|
+
// When no more overlaps are found on the left nodes it calls clean right.
|
893
|
+
let rec mergeLeft(node : Node) =
|
894
|
+
if node.Left = null then
|
895
|
+
()
|
896
|
+
elif range.min &lt;= node.Left.Range.min - 1L then
|
897
|
+
node.Left &lt;- node.Left.Left
|
898
|
+
mergeLeft(node)
|
899
|
+
elif range.min &lt;= node.Left.Range.max + 1L then
|
900
|
+
range &lt;- {min = node.Left.Range.min; max = range.max}
|
901
|
+
node.Left &lt;- node.Left.Left
|
902
|
+
else
|
903
|
+
cleanRight(node.Left)
|
904
|
+
|
905
|
+
// Symmetric to merge left
|
906
|
+
let rec mergeRight(node : Node) =
|
907
|
+
if node.Right = null then
|
908
|
+
()
|
909
|
+
elif range.max &gt;= node.Right.Range.max + 1L then
|
910
|
+
node.Right &lt;- node.Right.Right
|
911
|
+
mergeRight(node)
|
912
|
+
elif range.max &gt;= node.Right.Range.min - 1L then
|
913
|
+
range &lt;- {min = range.min; max = node.Right.Range.max}
|
914
|
+
node.Right &lt;- node.Right.Right
|
915
|
+
else
|
916
|
+
cleanLeft(node.Right)
|
917
|
+
|
918
|
+
|
919
|
+
let (|Before|After|BeforeOverlap|AfterOverlap|Superset|Subset|) r =
|
920
|
+
if r.min &gt; range.max + 1L then After
|
921
|
+
elif r.min &gt;= range.min then
|
922
|
+
if r.max &lt;= range.max then Subset
|
923
|
+
else AfterOverlap
|
924
|
+
elif r.max &lt; range.min - 1L then Before
|
925
|
+
elif r.max &lt;= range.max then
|
926
|
+
if r.min &gt;= range.min then Subset
|
927
|
+
else BeforeOverlap
|
928
|
+
else Superset
|
929
|
+
|
930
|
+
member this.Insert r =
|
931
|
+
match r with
|
932
|
+
| After -&gt;
|
933
|
+
if right = null then
|
934
|
+
right &lt;- Node(null, null, r)
|
935
|
+
else
|
936
|
+
right.Insert(r)
|
937
|
+
| AfterOverlap -&gt;
|
938
|
+
range &lt;- {min = range.min; max = r.max}
|
939
|
+
mergeRight(this)
|
940
|
+
| Before -&gt;
|
941
|
+
if left = null then
|
942
|
+
left &lt;- Node(null, null, r)
|
943
|
+
else
|
944
|
+
left.Insert(r)
|
945
|
+
| BeforeOverlap -&gt;
|
946
|
+
range &lt;- {min = r.min; max = range.max}
|
947
|
+
mergeLeft(this)
|
948
|
+
| Superset -&gt;
|
949
|
+
range &lt;- r
|
950
|
+
mergeLeft(this)
|
951
|
+
mergeRight(this)
|
952
|
+
| Subset -&gt; ()
|
953
|
+
|
954
|
+
member this.Left with get() : Node = left and set(x) = left &lt;- x
|
955
|
+
member this.Right with get() : Node = right and set(x) = right &lt;- x
|
956
|
+
member this.Range with get() : Range = range and set(x) = range &lt;- x
|
957
|
+
|
958
|
+
static member op_Equality (a : Node, b : Node) =
|
959
|
+
a.Range = b.Range
|
960
|
+
|
961
|
+
override this.ToString() =
|
962
|
+
sprintf "%A" this.Range
|
963
|
+
|
964
|
+
type RangeTree() =
|
965
|
+
let mutable root = null
|
966
|
+
|
967
|
+
member this.Add(range) =
|
968
|
+
if root = null then
|
969
|
+
root &lt;- Node(null, null, range)
|
970
|
+
else
|
971
|
+
root.Insert(range)
|
972
|
+
|
973
|
+
static member fromArray(values : Range seq) =
|
974
|
+
let tree = new RangeTree()
|
975
|
+
values |&gt; Seq.iter (fun value -&gt; tree.Add(value))
|
976
|
+
tree
|
977
|
+
|
978
|
+
member this.Seq
|
979
|
+
with get() =
|
980
|
+
let rec inOrder(node : Node) =
|
981
|
+
seq {
|
982
|
+
if node &lt;&gt; null then
|
983
|
+
yield! inOrder node.Left
|
984
|
+
yield {min = node.Range.min; max = node.Range.max}
|
985
|
+
yield! inOrder node.Right
|
986
|
+
}
|
987
|
+
inOrder root
|
988
|
+
|
989
|
+
let TestRange() =
|
990
|
+
printf "\n"
|
991
|
+
|
992
|
+
let source(n) =
|
993
|
+
let rnd = new Random(n)
|
994
|
+
let rand x = rnd.NextDouble() * float x |&gt; int64
|
995
|
+
let rangeRnd() =
|
996
|
+
let a = rand 1500
|
997
|
+
{min = a; max = a + rand 15}
|
998
|
+
[|for n in 1 .. 50 do yield rangeRnd()|]
|
999
|
+
|
1000
|
+
let shuffle n (array:_[]) =
|
1001
|
+
let rnd = new Random(n)
|
1002
|
+
for i in 0 .. array.Length - 1 do
|
1003
|
+
let n = rnd.Next(i)
|
1004
|
+
let temp = array.[i]
|
1005
|
+
array.[i] &lt;- array.[n]
|
1006
|
+
array.[n] &lt;- temp
|
1007
|
+
array
|
1008
|
+
|
1009
|
+
let testRangeAdd n i =
|
1010
|
+
let dataSet1 = source (n+0)
|
1011
|
+
let dataSet2 = source (n+1)
|
1012
|
+
let dataSet3 = source (n+2)
|
1013
|
+
let result1 = Array.concat [dataSet1; dataSet2; dataSet3] |&gt; shuffle (i+3) |&gt; RangeTree.fromArray
|
1014
|
+
let result2 = Array.concat [dataSet2; dataSet3; dataSet1] |&gt; shuffle (i+4) |&gt; RangeTree.fromArray
|
1015
|
+
let result3 = Array.concat [dataSet3; dataSet1; dataSet2] |&gt; shuffle (i+5) |&gt; RangeTree.fromArray
|
1016
|
+
let test1 = (result1.Seq, result2.Seq) ||&gt; Seq.forall2 (fun a b -&gt; a.min = b.min &amp;&amp; a.max = b.max)
|
1017
|
+
let test2 = (result2.Seq, result3.Seq) ||&gt; Seq.forall2 (fun a b -&gt; a.min = b.min &amp;&amp; a.max = b.max)
|
1018
|
+
let test3 = (result3.Seq, result1.Seq) ||&gt; Seq.forall2 (fun a b -&gt; a.min = b.min &amp;&amp; a.max = b.max)
|
1019
|
+
|
1020
|
+
let print dataSet =
|
1021
|
+
dataSet |&gt; Seq.iter (fun r -&gt; printf "%s " &lt;| string r)
|
1022
|
+
|
1023
|
+
if not (test1 &amp;&amp; test2 &amp;&amp; test3) then
|
1024
|
+
printf "\n\nTest# %A: " n
|
1025
|
+
printf "\nSource 1: %A: " (n+0)
|
1026
|
+
dataSet1 |&gt; print
|
1027
|
+
printf "\nSource 2: %A: " (n+1)
|
1028
|
+
dataSet2 |&gt; print
|
1029
|
+
printf "\nSource 3: %A: " (n+2)
|
1030
|
+
dataSet3 |&gt; print
|
1031
|
+
printf "\nResult 1: %A: " (n+0)
|
1032
|
+
result1.Seq |&gt; print
|
1033
|
+
printf "\nResult 2: %A: " (n+1)
|
1034
|
+
result2.Seq |&gt; print
|
1035
|
+
printf "\nResult 3: %A: " (n+2)
|
1036
|
+
result3.Seq |&gt; print
|
1037
|
+
()
|
1038
|
+
|
1039
|
+
for i in 1 .. 10 do
|
1040
|
+
for n in 1 .. 1000 do
|
1041
|
+
testRangeAdd n i
|
1042
|
+
printf "\n%d" (i * 1000)
|
1043
|
+
|
1044
|
+
printf "\nDone"
|
1045
|
+
|
1046
|
+
TestRange()
|
1047
|
+
|
1048
|
+
System.Console.ReadLine() |&gt; ignore
|
1049
|
+
</code></pre>
|
1050
|
+
|
1051
|
+
<p>Test cases for Range</p>
|
1052
|
+
|
1053
|
+
<pre><code>After (11, 14) | | &lt;--&gt;
|
1054
|
+
AfterOverlap (10, 14) | |&lt;---&gt;
|
1055
|
+
AfterOverlap ( 9, 14) | +----&gt;
|
1056
|
+
AfterOverlap ( 6, 14) |&lt;--+----&gt;
|
1057
|
+
"Test Case" ( 5, 9) +---+
|
1058
|
+
BeforeOverlap ( 0, 8) &lt;----+--&gt;|
|
1059
|
+
BeforeOverlap ( 0, 5) &lt;----+ |
|
1060
|
+
BeforeOverlap ( 0, 4) &lt;---&gt;| |
|
1061
|
+
Before ( 0, 3) &lt;--&gt; | |
|
1062
|
+
Superset ( 4, 10) &lt;+---+&gt;
|
1063
|
+
Subset ( 5, 9) +---+
|
1064
|
+
Subset ( 6, 8) |&lt;-&gt;|
|
1065
|
+
</code></pre>
|
1066
|
+
|
1067
|
+
</summary>
|
1068
|
+
</entry>
|
1069
|
+
|
1070
|
+
<entry>
|
1071
|
+
<id>http://stackoverflow.com/questions/1832522/telerik-radcombobox-javascript-api-problem</id>
|
1072
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
1073
|
+
<title type="text">Telerik RadComboBox javascript API problem</title>
|
1074
|
+
<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"/>
|
1075
|
+
<author><name>Grubl3r</name></author>
|
1076
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/1832522/telerik-radcombobox-javascript-api-problem" />
|
1077
|
+
<published>2009-12-02T12:07:05Z</published>
|
1078
|
+
<updated>2009-12-07T00:54:50Z</updated>
|
1079
|
+
<summary type="html">
|
1080
|
+
<p>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</p>
|
1081
|
+
|
1082
|
+
<p><strong>In a nutshell</strong> 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 :) </p>
|
1083
|
+
|
1084
|
+
<p>I've followed the API docs at this page (<a href="http://www.telerik.com/help/aspnet/combobox/combo%5Fclient%5Fmodel.html" rel="nofollow">telerik docs</a>), 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</p>
|
1085
|
+
|
1086
|
+
<p><strong>I don't need full source for a solution, but a nudge in the right direction would be much appreciated! :)</strong></p>
|
1087
|
+
|
1088
|
+
<p>Here's some example code I cooked together: </p>
|
1089
|
+
|
1090
|
+
<p><hr></p>
|
1091
|
+
|
1092
|
+
<pre><code> &lt;form id="form1" runat="server"&gt;
|
1093
|
+
&lt;asp:ScriptManager ID="ScriptManager1" runat="server" /&gt;
|
1094
|
+
|
1095
|
+
&lt;script type="text/javascript" language="javascript"&gt;
|
1096
|
+
function masterChanged(item)
|
1097
|
+
{
|
1098
|
+
var detailCB = &lt;%= DetailCB.ClientID %&gt;;
|
1099
|
+
|
1100
|
+
var index = item.get_selectedIndex();
|
1101
|
+
detailCB.SetSelected(index); //method does not exist, but should according to the docs..
|
1102
|
+
|
1103
|
+
}
|
1104
|
+
&lt;/script&gt;
|
1105
|
+
|
1106
|
+
&lt;div&gt;
|
1107
|
+
&lt;telerik:RadComboBox ID="MasterCB" runat="server" OnClientSelectedIndexChanged="masterChanged"&gt;
|
1108
|
+
&lt;Items&gt;
|
1109
|
+
&lt;telerik:RadComboBoxItem Text="One" Value="1" runat="server" /&gt;
|
1110
|
+
&lt;telerik:RadComboBoxItem Text="Two" Value="2" runat="server" /&gt;
|
1111
|
+
&lt;telerik:RadComboBoxItem Text="Three" Value="3" runat="server" /&gt;
|
1112
|
+
&lt;/Items&gt;
|
1113
|
+
&lt;/telerik:RadComboBox&gt;
|
1114
|
+
&lt;/div&gt;
|
1115
|
+
|
1116
|
+
&lt;div&gt;
|
1117
|
+
&lt;telerik:RadComboBox ID="DetailCB" runat="server"&gt;
|
1118
|
+
&lt;Items&gt;
|
1119
|
+
&lt;telerik:RadComboBoxItem Text="One" Value="1" runat="server" /&gt;
|
1120
|
+
&lt;telerik:RadComboBoxItem Text="Two" Value="2" runat="server" /&gt;
|
1121
|
+
&lt;telerik:RadComboBoxItem Text="Three" Value="3" runat="server" /&gt;
|
1122
|
+
&lt;/Items&gt;
|
1123
|
+
&lt;/telerik:RadComboBox&gt;
|
1124
|
+
&lt;/div&gt;
|
1125
|
+
&lt;/form&gt;
|
1126
|
+
</code></pre>
|
1127
|
+
|
1128
|
+
<p>I don't need full source for a solution, but a kick in the right direction would be much appreciated! :)</p>
|
1129
|
+
|
1130
|
+
</summary>
|
1131
|
+
</entry>
|
1132
|
+
|
1133
|
+
<entry>
|
1134
|
+
<id>http://stackoverflow.com/questions/544162/looking-for-a-datagridview-that-allows-grouping</id>
|
1135
|
+
<re:rank scheme="http://stackoverflow.com">0</re:rank>
|
1136
|
+
<title type="text">Looking for a DataGridView that allows grouping</title>
|
1137
|
+
<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#"/>
|
1138
|
+
<author><name>ohu812</name></author>
|
1139
|
+
<link rel="alternate" href="http://stackoverflow.com/questions/544162/looking-for-a-datagridview-that-allows-grouping" />
|
1140
|
+
<published>2009-02-13T00:07:30Z</published>
|
1141
|
+
<updated>2009-12-07T00:54:45Z</updated>
|
1142
|
+
<summary type="html">
|
1143
|
+
<p>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). </p>
|
1144
|
+
|
1145
|
+
<p>Thanks in advance.</p>
|
1146
|
+
|
1147
|
+
</summary>
|
1148
|
+
</entry>
|
1149
|
+
|
1150
|
+
</feed>
|