FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

zlib sample code for tutorial

 
Post new topic   Reply to topic     Forum Index -> Tutorials
View previous topic :: View next topic  
Author Message
Lynn



Joined: 27 Aug 2004
Posts: 89

PostPosted: Fri Aug 27, 2004 6:15 am    Post subject: zlib sample code for tutorial Reply with quote

I attempted to post sample code to the "Standard Library" section of the tutorial, but was unsuccesful. Is this disabled except for certain people (which certainly makes sense.)

If appropriate, would you post the zlib example below? It is a simplified version of the zip example that Walter B. posted. It only has zlib's compress and uncompress calls to minimize 'distractions' from using zlib.

TIA,
Lynn Allan

import std.zlib;

int main(char[][] args)
{
ubyte[] beforeCompression = cast(ubyte[])
"the quick brown fox jumps over the lazy dog\r
the quick brown fox jumps over the lazy dog\r
";
ubyte[] compressed;
ubyte[] afterDecompression;

compressed = cast(ubyte[])std.zlib.compress(cast(void[])beforeCompression);
afterDecompression = cast(ubyte[])std.zlib.uncompress(cast(void[])compressed);

assert(beforeCompression == afterDecompression);
printf("Success! Uncompressed Size: ?d Compressed Size: ?d\n",
beforeCompression.length, compressed.length);

return 0;
}
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Fri Aug 27, 2004 8:38 am    Post subject: Reply with quote

Only me and Brad can edit existing examples, but anyone should be able to post a new one, so I don't know what happened.

Thanks for the example, I posted it here:
http://www.dsource.org/tutorials/index.php?show_example=114
Back to top
View user's profile Send private message AIM Address
Lynn



Joined: 27 Aug 2004
Posts: 89

PostPosted: Fri Aug 27, 2004 10:10 am    Post subject: Reply with quote

Hi jcc7,

Thanks for the prompt reply!

When I attempted to add an example, I got a page that looked appropriate, but there were a series of [] that I couldn't figure out how to change to enter anything.

Example Name:
[] <--- Couldn't enter text here

Category:
[] <--- or here

Description:
[] <--- or here

Type your example here (watch out for word-wrap):
[] <--- or here

Also, is there a way to have the long paragraphs (like the above) to wrap in the forum thread viewer? For me, long paragraphs scroll to the right in the browser window, and are difficult to view.

Baffled,
Lynn
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Fri Aug 27, 2004 11:54 am    Post subject: Reply with quote

Lynn wrote:
When I attempted to add an example, I got a page that looked appropriate, but there were a series of [] that I couldn't figure out how to change to enter anything.

Example Name:
[] <--- Couldn't enter text here

...

Also, is there a way to have the long paragraphs (like the above) to wrap in the forum thread viewer? For me, long paragraphs scroll to the right in the browser window, and are difficult to view.

Baffled,
Lynn
I'm baffled, too. Which browser are you using and what's the resolution of your monitor? The phpBB forum is should be pretty solid, but I won't make any guarantees about the tutorial section. I haven't really tested the tutorial on different browers and resolutions like I probably should. I usually use Mozilla Firefox at around 1280 x 1024 resolution, but I don't know of any reason why it shouldn't work with other browsers and resolutions.

Those are my guesses at why the problems may occur, but I could be completely wrong.
Back to top
View user's profile Send private message AIM Address
Lynn



Joined: 27 Aug 2004
Posts: 89

PostPosted: Fri Aug 27, 2004 12:45 pm    Post subject: Reply with quote

Hi jcc7,

I'm using IE 6 with the latest updates on a monitor at 1280*1024. That should be more than adequate.

This is a really long line which may or may not 'wrap' on my computer. It looks ok during preview but let's see how is shows up in the forum. ... aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm nnn ooo ppp qqq rrr sss ttt uuu vvv www xxx yyy zzz AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM NNN OOO PPP QQQ RRR SSS TTT UUU VVV WWW XXX YYY ZZZ

Lynn A.
Back to top
View user's profile Send private message
Lynn



Joined: 27 Aug 2004
Posts: 89

PostPosted: Sat Aug 28, 2004 6:26 am    Post subject: Reply with quote

Word wrap seems ok now .... ??? It seemed like it wasn't on one computer, but perhaps they had a discussion among themselves and resolved to behave themselves Smile
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Sat Aug 28, 2004 11:57 am    Post subject: Reply with quote

Lynn wrote:
I'm using IE 6 with the latest updates on a monitor at 1280*1024. That should be more than adequate.
IE seems to be the culprit. I tried to post an example using IE, and I saw the same thing that you described. Now that I can reproduce it, I should be able to fix it. Hopefully, I can get the form to be functional and pretty in all browsers.

Update:
Okay, I think I found the changes needed to make the "add an example" form look decent in IE and Firefox. I'm sure Brad (the admin) will apply the changes when he gets a chance (I sent him a Private Message).
Back to top
View user's profile Send private message AIM Address
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Sat Aug 28, 2004 6:48 pm    Post subject: Reply with quote

Okay, Brad updated the site, and it now works for me. Let me know if you try to add an example using Internet Explorer (or any other browser) and it fails.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group