Hi,
the last posting shows that very often this mailing list has already answered to common questions. But how can an user find it?
Here my 'brutal' approach to provide a tmCommand which does the job.
The attached tmCommand searches for given words using www.nabble.com, gathers ALL found pages in one HTML page, and opens that HTML page in the default browser.
Maybe this could help a bit.
Comments?
Cheers,
--Hans
PS Of course, the used strategy could be improved ;)
On 20.08.2008, at 17:47, Piero D'Ancona wrote:
Hans-Jörg Bibiko <bibiko@...> writes:
(Ask the TextMate List.tmCommand): application/octet-stream, 2398 bytes
Hans, as usual you have crazy and weirdly useful ideas. But... where's the script? I get a Not Found when I click on it
??
I've just opened my mail on an other Mac. I clicked at the attachment, TextMate opened, and installed the tmCommand. Normally it will be installed into your personal Bundle folder. Within that tmCommand you will find the Ruby script. The Ruby script runs with the latest ui.rb and progress.rb
If that doesn't work, here the script:
Input: nothing Output: Show as Tool Tip Scope: no scope Key binding: whatever
Command: #!/usr/bin/env ruby -wKU
SUPPORT = ENV['TM_SUPPORT_PATH'] require SUPPORT + '/lib/ui.rb' require SUPPORT + '/lib/progress.rb' require 'net/http' require 'uri'
url = "http://www.nabble.com/forum/Search.jtp?local=y&forum=18157&" page = 0 isHeaderSet = false
query = TextMate::UI.request_string(:title => 'Ask the TextMate List', :prompt => 'Search for:') exit 200 if query.nil? query.gsub!('"','%22') query.gsub!(/ +/, '+')
answer = "" answer += "<base href='http://www.nabble.com'>" TextMate.call_with_progress(:title => 'Ask the TextMate List', :summary => 'Searching…', :indeterminate => true) do |dlg| begin while true result = Net::HTTP.get( URI.parse("#{url}page=#{page}&query=# {query}") ) if ! isHeaderSet m = result.match(/(?m)(Found \d+ matching posts for .*? thread.?.)/) answer += "<div style='padding:1mm;background- color:lightgray;font-size:0.8em'>#{m[1]}</div>" isHeaderSet = true dlg.parameters = {'summary' => 'Preparing HTML page…', 'details' => m[1].gsub(/<[^>]*?>/, '') } end result.gsub!(/(?m)<div class="nabble" id="nabble".*?<table cellspacing=2 cellpadding=2 border=0 width="100%">/, '') result.gsub!(/(?m)style="font-size:0.9em;"/, 'style="display:none;"') result.gsub!(/(?m)<p>[^<]*?<div class="search-wrapper shaded- bg-color">.*?</html>/, '') answer += result page += 1 break if ! result.include?("Next 10 ") end rescue print "Error" exit 200 end end f = File.open("/tmp/TM_askList.html", "w") f.puts "#{answer}</table></body></html>" f.close `open "/tmp/TM_askList.html"` `sleep 2;rm -f "/tmp/TM_askList.html" &`
--Hans
brilliant! My burning question about textmate 2 was answered without bothering anyone! :) The "preparing the HTML page" seemed a little sluggish, but I don't know how one could fix that.
j
On 20-Aug-08, at 11:28 AM, Hans-Jörg Bibiko wrote:
Hi,
the last posting shows that very often this mailing list has already answered to common questions. But how can an user find it?
Here my 'brutal' approach to provide a tmCommand which does the job.
The attached tmCommand searches for given words using www.nabble.com, gathers ALL found pages in one HTML page, and opens that HTML page in the default browser.
Maybe this could help a bit.
Comments?
Cheers,
--Hans
PS Of course, the used strategy could be improved ;)
<Ask the TextMate List.tmCommand>
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 20.08.2008, at 19:41, Jeff Newman wrote:
brilliant! My burning question about textmate 2 was answered without bothering anyone! :) The "preparing the HTML page" seemed a little sluggish, but I don't know how one could fix that.
Look into the code and search for that string and change it.
This script was written in 10 minutes thus the style should be polished up. Anyway, if there's interest to have such a script I will try to write that script much more cleaner tomorrow and hopefully faster by using different threads.
--Hans
Hi,
here comes the next version (still without using threads).
Type 'help' for getting search tips from Nabble.com
Is there someone who is able to implement the 'Cancel' button into the TextMate.progress stuff. I tried it out. It only worked if I ran the script via RubyMate but not by invoking it normally.
--Hans
Now as zip archive ;)
improved version:
- now it remembers the last search term - the maximum number of displayed threads is customizable in ~/Library/Preferences/com.macromates.textmate.asklist.plist - maxThreads := maximum dispalyed threads, should be greater than 1 and a multiple of 10 - lastSearch := last entered search term - outputted threads are sorted by date - error handling improved - the problem to look for non-ASCII chars is fixed
- I believe the speed is ok thus there's no need to use threads to gathering data (?)
Cheers,
--Hans
next steps to improve it:
- the search term 'help' shows not only the search tips but also a setting menu to set 'sort by' (date/relevance) and 'max number of displayed threads' - if more than 10 threads are found all other pages are downloaded in threads (sometimes faster) - the help window can be closed by pressing ESC
- still to do: the implementation of Cancel buttons in the progress windows
BTW: AFAIK one cannot toggle the :indeterminate attribute on runtime of a progress window. Why?
Thanks for the many mails! Maybe this tiny script could be find a place within the standard TextMate bundle(?)
--Hans
This is just awesome, many thanks for this. Also i second the suggestion of including it in the standard TextMate bundles.
On 25 aug 2008, at 08.47, Hans-Jörg Bibiko wrote:
next steps to improve it:
- the search term 'help' shows not only the search tips but also a
setting menu to set 'sort by' (date/relevance) and 'max number of displayed threads'
- if more than 10 threads are found all other pages are downloaded
in threads (sometimes faster)
the help window can be closed by pressing ESC
still to do: the implementation of Cancel buttons in the progress
windows
BTW: AFAIK one cannot toggle the :indeterminate attribute on runtime of a progress window. Why?
Thanks for the many mails! Maybe this tiny script could be find a place within the standard TextMate bundle(?)
--Hans
<Ask the TextMate List.tmCommand.zip>
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi,
first of all thanks a lot for the many many mails!
According to some suggestions I improved the command "Ask the TextMate List":
- now the search process runs in the background, meaning while searching one can use TM as usual - the search progress dialog has a Cancel button to simply cancel it - the search term "all" will display all threads chronologically - as usual type "help" for getting search tips and setting the preferences - now there are two commands one for the user list and one for the developer list - attested on Leopard and Tiger
Still the script(s) is/are single tmCommand(s) ;)
The key combo is for both SHIFT+CTRL+OPT+APPLE+?
According to the many mails I received I'd suggest to add these commands into the standard TextMate bundle (?)
Feedback is welcomed as always.
Cheers,
--Hans