[Mono-docs-list] Re: [Mono-dev] [PATCH] Monodoc. Workaround for a bug and index improvements

2005-09-19 Thread James Willcox
Mario,

I'd like to try the patch, but it seems you forgot to attach it :)

On Fri, 2005-09-16 at 16:36 +0200, Mario Sopena wrote:
 Hello,
 
 We have a problem in Monodoc when showing big html code with
 gecko. Monodoc hangs and do nothing (try to load the Gtk Namespace).
 This is due to a bug in gtkmozembed
 (https://bugzilla.mozilla.org/show_bug.cgi?id=245960). The workaround
 I've implemented writes the html on disk and loads the file from it,
 when the html code is big enough. The file is being writen to a temp
 directory.
 The only thing I'm not sure is whether I should myself delete what I
 write there or if I can just leave that for the system (for the
 moment, nothing is removed).
 
 The other thing that comes with this patch is a user-feature requested
 by miguel. The index and the search_index require those index to be
 create prior to use them. Right now, if they don't exist, a label is
 showed telling you that you have to run a command in root to create
 them.
 With this patch, monodoc looks for the index also in the user dir, and
 when it doesn't find them, it shows a panel with a progress bar that
 lets you make them at that time. The index are created in another
 Thread, so you can use monodoc while making them (specially the search
 index is slow, well, around a minute in my machine).
 To try the patch, remove your monodoc.index file and search_index dir
 from the monodoc directory and run the patched monodoc.
 
 Hope you all enjoy it. Comments please?!?
 
 Mario
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list
 

___
Mono-docs-list maillist  -  Mono-docs-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-docs-list


Re: [Mono-docs-list] msdn-browser/monodoc intergration

2005-09-19 Thread Rafael Ferreira
Well that's 2 votes against 1 so I would have to give in to you guys. I
would not want to waste time on something that would not make into
monodoc anyways. I guess I'll just figure something else to tackle
next. 

Cheers, 

- raf

On Mon, 2005-09-19 at 16:53 +0200, Mario Sopena wrote:
 Hello,
 
 2005/9/16, Rafael Ferreira [EMAIL PROTECTED]:
  yeah I see your point of view. But not having the documentation there
  can also just lead to the user popping a browser and going to msdn
  anyways, and by doing that he/she cannot add value to monodoc. Keeping
  the user inside monodoc increases the chance of contributions. In any
 I'm not sure that is the case. I'm also more from the opinion of
 Joshua, as I told to BenM on IRC. I do think the documentation in mono
 is getting better but slowly, so we have to find ways to encourage
 people to write docs, and that addition to monodoc will send an
 ambiguous message to contributors
 
 BTW, the msdn doc utility is incomplete, as you cannot click on the
 links (and it won't be easy to fix); so it needs a lot of work before
 being added. Also, it is made with gtk#2 and we use gtk#1 in monodoc.
 
 Hey, but that is just my opinion.
 Mario
 

___
Mono-docs-list maillist  -  Mono-docs-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-docs-list


[Mono-docs-list] Re: [Mono-dev] [PATCH] Monodoc. Workaround for a bug and index improvements

2005-09-19 Thread Mario Sopena
Hey

2005/9/18, James Willcox [EMAIL PROTECTED]:
 Mario,
 
 I'd like to try the patch, but it seems you forgot to attach it :)
 

wps, I'm sorry. :-P

 On Fri, 2005-09-16 at 16:36 +0200, Mario Sopena wrote:
  Hello,
 
  We have a problem in Monodoc when showing big html code with
  gecko. Monodoc hangs and do nothing (try to load the Gtk Namespace).
  This is due to a bug in gtkmozembed
  (https://bugzilla.mozilla.org/show_bug.cgi?id=245960). The workaround
  I've implemented writes the html on disk and loads the file from it,
  when the html code is big enough. The file is being writen to a temp
  directory.
  The only thing I'm not sure is whether I should myself delete what I
  write there or if I can just leave that for the system (for the
  moment, nothing is removed).
 
  The other thing that comes with this patch is a user-feature requested
  by miguel. The index and the search_index require those index to be
  create prior to use them. Right now, if they don't exist, a label is
  showed telling you that you have to run a command in root to create
  them.
  With this patch, monodoc looks for the index also in the user dir, and
  when it doesn't find them, it shows a panel with a progress bar that
  lets you make them at that time. The index are created in another
  Thread, so you can use monodoc while making them (specially the search
  index is slow, well, around a minute in my machine).
  To try the patch, remove your monodoc.index file and search_index dir
  from the monodoc directory and run the patched monodoc.
 
  Hope you all enjoy it. Comments please?!?
 
  Mario
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 

Index: engine/provider.cs
===
--- engine/provider.cs	(revision 49928)
+++ engine/provider.cs	(working copy)
@@ -1261,7 +1261,14 @@
 	
 	public IndexReader GetIndex ()
 	{
-		return IndexReader.Load (Path.Combine (basedir, monodoc.index));
+		//try to load from basedir
+		string index_file = Path.Combine (basedir, monodoc.index);
+		if (File.Exists (index_file))
+			return IndexReader.Load (index_file);
+		//then, try to load from config dir
+		index_file = Path.Combine (SettingsHandler.Path, monodoc.index);
+		return IndexReader.Load (index_file);
+		
 	}
 
 	public static void MakeIndex ()
@@ -1276,17 +1283,35 @@
 			hs.PopulateIndex (index_maker);
 		}
 
-		index_maker.Save (Path.Combine (root.basedir, monodoc.index));
+		// if the user has no write permissions use config dir
+		string path = Path.Combine (root.basedir, monodoc.index);
+		try {
+			index_maker.Save (path);
+		} catch (System.UnauthorizedAccessException) {
+			path = Path.Combine (SettingsHandler.Path, monodoc.index);
+			try {
+index_maker.Save (path);
+			} catch (System.UnauthorizedAccessException) {
+Console.WriteLine (Unable to write index file in {0}, Path.Combine (SettingsHandler.Path, monodoc.index)); 
+return;
+			}
+		}
 
 		// No octal in C#, how lame is that
-		chmod (Path.Combine (root.basedir, monodoc.index), 0x1a4);
+		chmod (path, 0x1a4);
 		Console.WriteLine (Documentation index updated);
 	}
 	
 	// Search Index
 	public SearchableIndex GetSearchIndex ()
 	{
-		return SearchableIndex.Load (Path.Combine (basedir, search_index));
+		//try to load from basedir
+		string index_file = Path.Combine (basedir, search_index);
+		if (Directory.Exists (index_file))
+			return SearchableIndex.Load (index_file);
+		//then, try to load from config dir
+		index_file = Path.Combine (SettingsHandler.Path, search_index);
+		return SearchableIndex.Load (index_file);
 	}
 
 	public static void MakeSearchIndex ()
@@ -1306,8 +1331,17 @@
 
 			writer = new IndexWriter(Lucene.Net.Store.FSDirectory.GetDirectory(dir, true), new StandardAnalyzer(), true);
 		} catch (UnauthorizedAccessException) {
-			Console.WriteLine (You don't have permissions to wirte on  + dir);
-			return;
+			//try in the .config directory
+			try {
+dir = Path.Combine (SettingsHandler.Path, search_index);
+if (!Directory.Exists (dir)) 
+	Directory.CreateDirectory (dir);
+
+writer = new IndexWriter(Lucene.Net.Store.FSDirectory.GetDirectory(dir, true), new StandardAnalyzer(), true);
+			} catch (UnauthorizedAccessException) {
+Console.WriteLine (You don't have permissions to write on  + dir);
+return;
+			}
 		}
 
 		//Collect all the documents
Index: engine/index.cs
===
--- engine/index.cs	(revision 49928)
+++ engine/index.cs	(working copy)
@@ -251,9 +251,6 @@
 	{
 		Encoding utf8 = new UTF8Encoding (false, true);
 
-		// If the user doesn't have write access to the path then an
-		// exception will be thrown
-		try {	
 			using (FileStream fs = File.OpenWrite (filename)){
 BinaryWriter writer = 
 		new BinaryWriter (fs, utf8);
@@ -274,10 +271,6 

Re: [Mono-docs-list] [PATCH] Monodoc. Workaround for a bug and index improvements

2005-09-19 Thread Mario Sopena
Hey,

2005/9/19, Rafael Ferreira [EMAIL PROTECTED]:
 Mario, no patch attached?
 

  I did resent the patch, look that your filters didn't put my message
in the mono-devel list, as I sent also the patch there.

Sorry, I would like to post a link to my message, but the web mailing
list archive seems to be down for the moment.

Mario


 On Fri, 2005-09-16 at 16:36 +0200, Mario Sopena wrote:
  Hello,
 
  We have a problem in Monodoc when showing big html code with
  gecko. Monodoc hangs and do nothing (try to load the Gtk Namespace).
  This is due to a bug in gtkmozembed
  (https://bugzilla.mozilla.org/show_bug.cgi?id=245960). The workaround
  I've implemented writes the html on disk and loads the file from it,
  when the html code is big enough. The file is being writen to a temp
  directory.
  The only thing I'm not sure is whether I should myself delete what I
  write there or if I can just leave that for the system (for the
  moment, nothing is removed).
 
  The other thing that comes with this patch is a user-feature requested
  by miguel. The index and the search_index require those index to be
  create prior to use them. Right now, if they don't exist, a label is
  showed telling you that you have to run a command in root to create
  them.
  With this patch, monodoc looks for the index also in the user dir, and
  when it doesn't find them, it shows a panel with a progress bar that
  lets you make them at that time. The index are created in another
  Thread, so you can use monodoc while making them (specially the search
  index is slow, well, around a minute in my machine).
  To try the patch, remove your monodoc.index file and search_index dir
  from the monodoc directory and run the patched monodoc.
 
  Hope you all enjoy it. Comments please?!?
 
  Mario
  ___
  Mono-docs-list maillist  -  Mono-docs-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-docs-list
 
 

___
Mono-docs-list maillist  -  Mono-docs-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-docs-list


Re: [Mono-docs-list] msdn-browser/monodoc intergration

2005-09-19 Thread Rafael Ferreira
yeah I see your point of view. But not having the documentation there
can also just lead to the user popping a browser and going to msdn
anyways, and by doing that he/she cannot add value to monodoc. Keeping
the user inside monodoc increases the chance of contributions. In any
event, I got busy and I won't have time to work on this for a couple of
weeks so in the meantime, I'm very much interested on everyone's
opinions. Thanks Josh.

-raf

On Thu, 2005-09-15 at 19:01 -0400, Joshua Tauberer wrote:
 Rafael Ferreira wrote:
  I'm going to start working on integrating Ben's msdn browser and
  monodoc.
 
  From a high-level point of view, that doesn't seem like a good idea. 
 Being forced to face incomplete documentation is a good impetus to 
 contribute to it.  There's also the weird notion of Mono leaning on 
 Microsoft's polished work to improve itself.  (Just my two cents.)
 

___
Mono-docs-list maillist  -  Mono-docs-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-docs-list


Re: [Mono-docs-list] msdn-browser/monodoc intergration

2005-09-19 Thread Mario Sopena
Hello,

2005/9/16, Rafael Ferreira [EMAIL PROTECTED]:
 yeah I see your point of view. But not having the documentation there
 can also just lead to the user popping a browser and going to msdn
 anyways, and by doing that he/she cannot add value to monodoc. Keeping
 the user inside monodoc increases the chance of contributions. In any
I'm not sure that is the case. I'm also more from the opinion of
Joshua, as I told to BenM on IRC. I do think the documentation in mono
is getting better but slowly, so we have to find ways to encourage
people to write docs, and that addition to monodoc will send an
ambiguous message to contributors

BTW, the msdn doc utility is incomplete, as you cannot click on the
links (and it won't be easy to fix); so it needs a lot of work before
being added. Also, it is made with gtk#2 and we use gtk#1 in monodoc.

Hey, but that is just my opinion.
Mario
___
Mono-docs-list maillist  -  Mono-docs-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-docs-list


Re: [Mono-docs-list] [PATCH] Monodoc. Workaround for a bug and index improvements

2005-09-19 Thread Rafael Ferreira
Mario, 

Looks good to me. I'm glad to see that bug resolved. As far as the index
fix, I have to say... why don't you just create the index once as part
of the make install target? That way you don't have to worry about
doing the async index building... and the user does not have to do
anything. I apologize if that is a silly question but it just seems a
bit over engineered.

You might also want to change this:

 Console.WriteLine (You don't have permissions to wirte on  + dir);
to this:
 Console.WriteLine (You don't have permissions to write to  + dir);


As always, just my 2 cents. :-)



On Mon, 2005-09-19 at 16:56 +0200, Mario Sopena wrote:
 Hey,
 
 2005/9/19, Rafael Ferreira [EMAIL PROTECTED]:
  Mario, no patch attached?
  
 
   I did resent the patch, look that your filters didn't put my message
 in the mono-devel list, as I sent also the patch there.
 
 Sorry, I would like to post a link to my message, but the web mailing
 list archive seems to be down for the moment.
 
 Mario
 
 
  On Fri, 2005-09-16 at 16:36 +0200, Mario Sopena wrote:
   Hello,
  
   We have a problem in Monodoc when showing big html code with
   gecko. Monodoc hangs and do nothing (try to load the Gtk Namespace).
   This is due to a bug in gtkmozembed
   (https://bugzilla.mozilla.org/show_bug.cgi?id=245960). The workaround
   I've implemented writes the html on disk and loads the file from it,
   when the html code is big enough. The file is being writen to a temp
   directory.
   The only thing I'm not sure is whether I should myself delete what I
   write there or if I can just leave that for the system (for the
   moment, nothing is removed).
  
   The other thing that comes with this patch is a user-feature requested
   by miguel. The index and the search_index require those index to be
   create prior to use them. Right now, if they don't exist, a label is
   showed telling you that you have to run a command in root to create
   them.
   With this patch, monodoc looks for the index also in the user dir, and
   when it doesn't find them, it shows a panel with a progress bar that
   lets you make them at that time. The index are created in another
   Thread, so you can use monodoc while making them (specially the search
   index is slow, well, around a minute in my machine).
   To try the patch, remove your monodoc.index file and search_index dir
   from the monodoc directory and run the patched monodoc.
  
   Hope you all enjoy it. Comments please?!?
  
   Mario
   ___
   Mono-docs-list maillist  -  Mono-docs-list@lists.ximian.com
   http://lists.ximian.com/mailman/listinfo/mono-docs-list
  
  
 
 

___
Mono-docs-list maillist  -  Mono-docs-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-docs-list