How can I add an ellipsis to a Glass auto-paginate card? - google-glass

The Glass Developer Guide page at https://developers.google.com/glass/develop/mirror/timeline#paginating indicates that you can create an auto-paginating card using something like
<article class="auto-paginate">
<p><b>Very very long title and message</b></p>
<p>
Donec luctus erat sit amet odio tempus posuere. Nullam eu est nunc. Integer et metus quis augue ornare pharetra. Morbi pellentesque semper erat, at ultrices purus vulputate scelerisque. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nulla aliquam lorem non feugiat laoreet. Aenean adipiscing ante ligula, in dictum magna fermentum nec. Sed sed malesuada lacus. Donec accumsan congue magna, ac tempus diam venenatis non. Sed sed rhoncus libero. Sed lorem dui, pellentesque quis posuere vehicula, cursus vitae erat. Donec porta imperdiet leo, ut sagittis elit gravida in. Sed mauris erat, feugiat non neque eget, accumsan tempus tortor. Mauris pulvinar mi id mattis condimentum. Donec nec consectetur ipsum, eu viverra nisl. Donec et eleifend sem, id vehicula augue.
</p>
<article>
This will create a card that, when tapped, offers a "Read More" option which will let you scroll between multiple cards. But there is no indication on the main card that there is even more to read. The GMail Glassware uses an ellipsis (...) at the end of the first page to indicate that "Read More" is available, but the auto-paginate class doesn't automatically generate this. Adding a style of text-overflow: ellipsis to the article tag also doesn't work.
How can we duplicate the ellipsis at the end of a page to indicate there is more?

The solution isn't difficult, but it also isn't straightforward.
To get the title to show an ellipsis (which is necessary for some of the rest, to make sure it only takes one line), you can give it the class "single-line". To get the body to show the ellipsis, you can give it the class "auto-overflow", but you'll also need to specify how many lines will be displayed before it does so using a style -webkit-line-clamp: N where N is the number of lines. (I've found 4 lines to be good for the default font size if you also have a one-line title, but you may need to fiddle in the playground based on your size.)
So the markup now would look something like
<article class="auto-paginate">
<p class="single-line"><b>Very very long title and message</b></p>
<p class="auto-overflow" style="-webkit-line-clamp: 4">
Donec luctus erat sit amet odio tempus posuere. Nullam eu est nunc. Integer et metus quis augue ornare pharetra. Morbi pellentesque semper erat, at ultrices purus vulputate scelerisque. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nulla aliquam lorem non feugiat laoreet. Aenean adipiscing ante ligula, in dictum magna fermentum nec. Sed sed malesuada lacus. Donec accumsan congue magna, ac tempus diam venenatis non. Sed sed rhoncus libero. Sed lorem dui, pellentesque quis posuere vehicula, cursus vitae erat. Donec porta imperdiet leo, ut sagittis elit gravida in. Sed mauris erat, feugiat non neque eget, accumsan tempus tortor. Mauris pulvinar mi id mattis condimentum. Donec nec consectetur ipsum, eu viverra nisl. Donec et eleifend sem, id vehicula augue.
</p>
<article>
The problem with this, however, is that we no longer really have auto-paginate. We have truncated text.
To resolve this, we'll need a cover card with the truncated text and ellipsis and an auto-paginate card that contains all the text. The GMail Glassware makes the two slightly different, and although we can make them look pretty much the same, we'll adopt that style as well by omitting the title from the part that scrolls. The cover card will need to specify the class "cover-only", and the non-cover portion would omit the "single-line" and "auto-overflow" classes. So this would look something like
<article class="cover-only">
<section>
<p class="single-line"><b>Very very long title and message</b></p>
<p class="auto-overflow" style="-webkit-line-clamp: 4">
Donec luctus erat sit amet odio tempus posuere. Nullam eu est nunc. Integer et metus quis augue ornare pharetra. Morbi pellentesque semper erat, at ultrices purus vulputate scelerisque. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nulla aliquam lorem non feugiat laoreet. Aenean adipiscing ante ligula, in dictum magna fermentum nec. Sed sed malesuada lacus. Donec accumsan congue magna, ac tempus diam venenatis non. Sed sed rhoncus libero. Sed lorem dui, pellentesque quis posuere vehicula, cursus vitae erat. Donec porta imperdiet leo, ut sagittis elit gravida in. Sed mauris erat, feugiat non neque eget, accumsan tempus tortor. Mauris pulvinar mi id mattis condimentum. Donec nec consectetur ipsum, eu viverra nisl. Donec et eleifend sem, id vehicula augue.
</p>
</section>
</article>
<article class="auto-paginate">
<p>
Donec luctus erat sit amet odio tempus posuere. Nullam eu est nunc. Integer et metus quis augue ornare pharetra. Morbi pellentesque semper erat, at ultrices purus vulputate scelerisque. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nulla aliquam lorem non feugiat laoreet. Aenean adipiscing ante ligula, in dictum magna fermentum nec. Sed sed malesuada lacus. Donec accumsan congue magna, ac tempus diam venenatis non. Sed sed rhoncus libero. Sed lorem dui, pellentesque quis posuere vehicula, cursus vitae erat. Donec porta imperdiet leo, ut sagittis elit gravida in. Sed mauris erat, feugiat non neque eget, accumsan tempus tortor. Mauris pulvinar mi id mattis condimentum. Donec nec consectetur ipsum, eu viverra nisl. Donec et eleifend sem, id vehicula augue.
</p>
</article>

Related

RegEx match first paragraph, then rest of paragraphs

I have a set of paragraphs I want to seperate
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Montes nascetur ridiculus mus mauris vitae ultricies.
Porttitor eget dolor morbi non arcu risus. Lacus luctus accumsan tortor posuere ac.
Ac turpis egestas maecenas pharetra convallis posuere morbi.
Purus ut faucibus pulvinar elementum.
Neque volutpat ac tincidunt vitae semper quis lectus.
Aliquet sagittis id consectetur purus ut faucibus pulvinar elementum integer.
Eget gravida cum sociis natoque. Amet est placerat in egestas erat imperdiet sed euismod nisi.
Rhoncus mattis rhoncus urna neque viverra.
Morbi enim nunc faucibus a pellentesque sit amet porttitor eget.
Nullam vehicula ipsum a arcu cursus vitae congue mauris.
Amet purus gravida quis blandit turpis cursus in.
Elementum facilisis leo vel fringilla.
Sed enim ut sem viverra aliquet eget.
Ac tortor vitae purus faucibus ornare suspendisse sed nisi lacus.
Risus sed vulputate odio ut. Metus vulputate eu scelerisque felis imperdiet proin.
Feugiat nisl pretium fusce id. Dui vivamus arcu felis bibendum ut tristique et.
Blandit turpis cursus in hac habitasse platea dictumst quisque.
I want to see if it's possible how I can match just the first paragraph then match everything from the second paragraph all the way to the end. I did something like .*?(?=\n|$) but only got the first paragraph. I want to see if there's a way to match both a first paragraph, then the rest from the second paragraph.
You could try using the following pattern:
(.*?)\n{2,}(.*)
Make sure that you run this regex in dot all mode. Here is a working demo.

Wordpress: Strip out content builder shortcodes

I have a WP site with a lot of content (approx. 5000 posts). These posts contain (in post_content) obsolete shortcodes from a content builder, which I need to strip out for good:
[av_three_fifth first] [av_textblock size=“ font_color=“ color=“ av-medium-font-size=“ av-small-font-size=“ av-mini-font-size=“ admin_preview_bg=“]
Nunc nec neque. Curabitur blandit mollis lacus. Quisque malesuada placerat nisl. Aenean vulputate eleifend tellus. Vestibulum fringilla pede sit amet augue.
Maecenas vestibulum mollis diam. Cras id dui. Vestibulum ullamcorper mauris at ligula. Fusce commodo aliquam arcu. Donec interdum, metus et hendrerit aliquet, dolor diam sagittis ligula, eget egestas libero turpis vel mi.
Sed a libero. In ac felis quis tortor malesuada pretium. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus.
[/av_textblock] [/av_three_fifth]
Is there a chance that I can come up with a sophisticated regex to remove those strings? The problem is that many of those are very varied, so no "one fits all" solution here I fear...
TIA for your help / ideas!
Managed to "semi-solve" this via a free WP plugin which hides broken shortcodes: https://wordpress.org/plugins/hide-broken-shortcodes/
Thought I'd share it in case someone else needs this.

Convert .CSV data, with regEx?

I have a .CSV containing the following data:
"http://iis.se/write-content/?submitted","The intro","<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus dictum lectus eget enim condimentum, eget bibendum libero porta. Suspendisse vestibulum libero nisl, quis tempus nisl semper in. Ut mi nisl, vehicula quis tristique ut, molestie et est. Donec auctor, ante eu venenatis aliquam, felis nisi pretium turpis, ut mattis dui orci et sem. Duis vitae accumsan velit. Sed tristique lacus nisl, vehicula congue turpis ultrices sed. In hac habitasse platea dictumst. Sed dictum scelerisque nibh non venenatis. In viverra eros non arcu pellentesque, nec pulvinar turpis placerat.</p> <p>Proin suscipit metus vitae nisi dignissim ullamcorper. Nullam eleifend tempor ligula, sit amet semper metus.</p><p>Proin bibendum bibendum suscipit. Cras pretium lectus sit amet urna interdum, in ultricies eros scelerisque. Pellentesque id condimentum libero. Aenean placerat orci a dictum pharetra. Pellentesque sagittis egestas gravida. Pellentesque suscipit mauris neque, quis auctor lacus blandit et. Curabitur a quam a velit condimentum tristique. Morbi volutpat pulvinar viverra. Duis cursus lectus ac sem dictum, eu tempor risus blandit. In accumsan arcu at lorem mattis lacinia. Vestibulum vitae mollis sem, nec commodo nunc. Donec vel ultricies nunc. Nam at sapien nec libero aliquam pharetra vitae eget leo.</p><p>Read more here here</p>","Thank you!"
"http://website.com/add/?submitted","The, nice, Second","<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus dictum lectus eget enim condimentum, eget bibendum libero porta. Suspendisse vestibulum libero nisl, quis tempus nisl semper in. Ut mi nisl, vehicula quis tristique ut, molestie et est. Donec auctor, ante eu venenatis aliquam, felis nisi pretium turpis, ut mattis dui orci et sem. Duis vitae accumsan velit. Sed tristique lacus nisl, vehicula congue turpis ultrices sed. In hac habitasse platea dictumst. Sed dictum scelerisque nibh non venenatis. In viverra eros non arcu pellentesque, nec pulvinar turpis placerat.</p> <p>Proin suscipit metus vitae nisi dignissim ullamcorper. Nullam eleifend tempor ligula, sit amet semper metus.</p><p>Proin bibendum bibendum suscipit. Cras pretium lectus sit amet urna interdum, in ultricies eros scelerisque. Pellentesque id condimentum libero. Aenean placerat orci a dictum pharetra. Pellentesque sagittis egestas gravida. Pellentesque suscipit mauris neque, quis auctor lacus blandit et. Curabitur a quam a velit condimentum tristique. Morbi volutpat pulvinar viverra. Duis cursus lectus ac sem dictum, eu tempor risus blandit. In accumsan arcu at lorem mattis lacinia. Vestibulum vitae mollis sem, nec commodo nunc. Donec vel ultricies nunc. Nam at sapien nec libero aliquam pharetra vitae eget leo.</p>","Thank you!, even more!!!"
Simply,
In COL1, I want to strip everything after the top domain
In COL2, I want commas, spaces to become hyphens, but it may not double hyphens at any point
COL1 and COL2 shall be merged into (The Output) COL1
In COL3, everything should be removed besides the domain contained within <a> </a>
COL4 is untouchable
So, in this case, I want the output to become:
"http://iis.se/the-intro","http://www.google.com","Thank you!"
"http://website.com/the-nice-second","http://www.altavista.com","Thank you!, even more!!!"
Is it possible or very advanced?
I am thinking a few RegEx replace in Notepad++ recorded with a macro.
First of all, you should really start putting your attempts, even if they fail. It shows what you've been trying and other people can point out what you did wrong so you can get them right in the future.
You can use this series of replaces (F means find, R means replace and the second replace is empty):
F: (http://[^/]+/)[^"]+","([^"]+")
R: $1$2
F: "<[^"]+"
R:
F: ">[^<]+</
R: ,"
F: ,?\s(?=[^"]+",)
R: -
There can be something possible in less find/replaces, I haven't explored all the possibilities. Note that regex does not handle replacing character case, so your actual end product will be:
"http://iis.se/The-intro","http://www.google.com","Thank you!"
"http://website.com/The-nice-Second","http://www.altavista.com","Thank you!, even more!!!"
Compare against the result you want:
"http://iis.se/the-intro","http://www.google.com","Thank you!"
"http://website.com/the-nice-second","http://www.altavista.com","Thank you!, even more!!!"
To convert those to lowercase, you could perhaps select the columns and convert them to lowercase if the links are all about the same character length (by press and hold Alt then selecting text, you select vertically in notepad++ and using Ctrl+U turns all the characters to lowercase).

CFDocument still cutting off the tops of text on some pages

when using cfdocument some of our pages have the top line cut off making it unreadable. I know there was a bug in 7, that was said to be fixed in 8. We're using 8,0,1,195765 and continue to have the problem. All my searches lead me to CF7. Anyone have any ideas?
<cfdocument format="pdf">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<cfset lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu turpis at nulla porttitor ultrices. Quisque laoreet eros sed erat ullamcorper vitae aliquam nulla rutrum. Nullam euismod aliquam tincidunt. Vestibulum magna augue, ultrices et hendrerit ultrices, aliquet sit amet ante. Phasellus egestas mattis ligula, eget ultrices erat luctus eget. Pellentesque magna purus, vestibulum euismod laoreet eu, gravida blandit nulla. In mattis, dolor eu ultricies dictum, felis turpis tincidunt metus, a pulvinar neque ligula quis lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nunc ac purus vitae nisi mattis ultrices vitae et justo. Mauris mauris purus, consectetur quis porta sit amet, hendrerit at nullauis pellentesque, leo non scelerisque pellentesque, odio orci porta lorem, ut dictum magna nibh nec tellus. Fusce placerat urna at massa mollis aliquam. Nulla dictum tempor sodales. Donec commodo tincidunt risus, non tristique ipsum auctor eget. Vivamus eleifend elementum urna vitae fringilla. Nulla adipiscing euismod nibh ac euismod. Suspendisse eu risus eu felis elementum pharetra. Proin et lorem vel libero lobortis molestie quis nec risus. Proin elementum gravida nulla, at cursus diam semper eget. Praesent auctor porta tristique. Etiam nec fermentum arcu. Curabitur a tellus quis leo eleifend scelerisque. Phasellus ut sem mauris. Vestibulum ultrices libero at diam consectetur sit amet commodo tellus consectetur. Nam ullamcorper condimentum nisi, vel sollicitudin lectus venenatis elementum. Etiam felis odio, pharetra sed vestibulum at, scelerisque nec leo. Quisque tempor sapien non lectus cursus vel imperdiet lectus ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu turpis at nulla porttitor ultrices. Quisque laoreet eros sed erat ullamcorper vitae aliquam nulla rutrum. Nullam euismod aliquam tincidunt. Vestibulum magna augue, ultrices et hendrerit ultrices, aliquet sit amet ante. Phasellus egestas mattis ligula, eget ultrices erat luctus eget. Pellentesque magna purus, vestibulum euismod laoreet eu, gravida blandit nulla. In mattis, dolor eu ultricies dictum, felis turpis tincidunt metus, a pulvinar neque ligula quis lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nunc ac purus vitae nisi mattis ultrices vitae et justo. Mauris mauris purus, consectetur quis porta sit amet, hendrerit at nullauis pellentesque, leo non scelerisque pellentesque, odio orci porta lorem, ut dictum magna nibh nec tellus. Fusce placerat urna at massa mollis aliquam. Nulla dictum tempor sodales. Donec commodo tincidunt risus, non tristique ipsum auctor eget. Vivamus eleifend elementum urna vitae fringilla. Nulla adipiscing euismod nibh ac euismod. Suspendisse eu risus eu felis elementum pharetra. Proin et lorem vel libero lobortis molestie quis nec risus. Proin elementum gravida nulla, at cursus diam semper eget. Praesent auctor porta tristique. Etiam nec fermentum arcu. Curabitur a tellus quis leo eleifend scelerisque. Phasellus ut sem mauris. Vestibulum ultrices libero at diam consectetur sit amet commodo tellus consectetur. Nam ullamcorper condimentum nisi, vel sollicitudin lectus venenatis elementum. Etiam felis odio, pharetra sed vestibulum at, scelerisque nec leo. Quisque tempor sapien non lectus cursus vel imperdiet lectus ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu turpis at nulla porttitor ultrices. Quisque laoreet eros sed erat ullamcorper vitae aliquam nulla rutrum. Nullam euismod aliquam tincidunt. Vestibulum magna augue, ultrices et hendrerit ultrices, aliquet sit amet ante. Phasellus egestas mattis ligula, eget ultrices erat luctus eget. Pellentesque magna purus, vestibulum euismod laoreet eu, gravida blandit nulla. In mattis, dolor eu ultricies dictum, felis turpis tincidunt metus, a pulvinar neque ligula quis lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nunc ac purus vitae nisi mattis ultrices vitae et justo. Mauris mauris purus, consectetur quis porta sit amet, hendrerit at nullauis pellentesque, leo non scelerisque pellentesque, odio orci porta lorem, ut dictum magna nibh nec tellus. Fusce placerat urna at massa mollis aliquam. Nulla dictum tempor sodales. Donec commodo tincidunt risus, non tristique ipsum auctor eget. Vivamus eleifend elementum urna vitae fringilla. Nulla adipiscing euismod nibh ac euismod. Suspendisse eu risus eu felis elementum pharetra. Proin et lorem vel libero lobortis molestie quis nec risus. Proin elementum gravida nulla, at cursus diam semper eget. Praesent auctor porta tristique. Etiam nec fermentum arcu. Curabitur a tellus quis leo eleifend scelerisque. Phasellus ut sem mauris. Vestibulum ultrices libero at diam consectetur sit amet commodo tellus consectetur. Nam ullamcorper condimentum nisi, vel sollicitudin lectus venenatis elementum. Etiam felis odio, pharetra sed vestibulum at, scelerisque nec leo. Quisque tempor sapien non lectus cursus vel imperdiet lectus ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu turpis at nulla porttitor ultrices. Quisque laoreet eros sed erat ullamcorper vitae aliquam nulla rutrum. Nullam euismod aliquam tincidunt. Vestibulum magna augue, ultrices et hendrerit ultrices, aliquet sit amet ante. Phasellus egestas mattis ligula, eget ultrices erat luctus eget. Pellentesque magna purus, vestibulum euismod laoreet eu, gravida blandit nulla. In mattis, dolor eu ultricies dictum, felis turpis tincidunt metus, a pulvinar neque ligula quis lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nunc ac purus vitae nisi mattis ultrices vitae et justo. Mauris mauris purus, consectetur quis porta sit amet, hendrerit at nullauis pellentesque, leo non scelerisque pellentesque, odio orci porta lorem, ut dictum magna nibh nec tellus. Fusce placerat urna at massa mollis aliquam. Nulla dictum tempor sodales. Donec commodo tincidunt risus, non tristique ipsum auctor eget. Vivamus eleifend elementum urna vitae fringilla. Nulla adipiscing euismod nibh ac euismod. Suspendisse eu risus eu felis elementum pharetra. Proin et lorem vel libero lobortis molestie quis nec risus. Proin elementum gravida nulla, at cursus diam semper eget. Praesent auctor porta tristique. Etiam nec fermentum arcu. Curabitur a tellus quis leo eleifend scelerisque. Phasellus ut sem mauris. Vestibulum ultrices libero at diam consectetur sit amet commodo tellus consectetur. Nam ullamcorper condimentum nisi, vel sollicitudin lectus venenatis elementum. Etiam felis odio, pharetra sed vestibulum at, scelerisque nec leo. Quisque tempor sapien non lectus cursus vel imperdiet lectus ultrices. ">
<cfloop from = "1" to = "10" index="i">
<cfoutput>
<table width="99%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td>#dateFormat(now(), "mm/dd/yyyy")#</td>
<td>#lipsum#</td>
<td valign="top">FirstName LastName</td>
</tr>
</table>
</cfoutput>
</cfloop>
</body>
</html>
</cfdocument>
Wrapping text in a table within a div tag solves this problem.
<table width="99%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td><div>#dateFormat(now(), "mm/dd/yyyy")#</div></td>
<td><div>#lipsum#</div></td>
<td valign="top"><div>FirstName LastName</div></td>
</tr>
</table>
I had one instance where this did not work in my actual data. It turns out it was a nested table. I un-nested them and the problem went away.
I hope this helps someone else.
Be sure to have a margintop and marginbottom declaration on your cfdocument tag. After several hours trying out the different things suggested here and in other related posts, I found this to have solved it. I was using CF9.
Here's what ours look like:
<cfdocument format="pdf" pagetype="letter" orientation="portrait" margintop="1.2" marginbottom="1" name="proposalPdf">
-Hamlet
I've not seen this, but I'd attempt the following:
Futz with the top margin.
Attempt to add whitepsace to the top of the page pre-pdf-ing.
If there are graphics at the top, make sure they are using absolute (not relative) paths.
I'm not sure if any of that will be helpful, but it's my best ideas off the top of my head.

Using Cookie for browser communication

Am planning to use cookies to communicate between two browser windows. Am wondering if there are any drawbacks that I can't think of. The data is not required on the server side, thus communication via cookie should be enough for the purpose. Am I missing something or is this fine to use?
I know the limit is 4K. Roughly how much is 4k in text? say I want to store MD5/SHA strings. How many such md5 strings can i store in a single cookie?
Thank you very much for your time.
The obvious one is that the user might have disabled cookies in their browser...
How much is 4K of text? About this much (courtesy of the Lipsum Generator):
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quam quam, bibendum sit amet egestas id, suscipit vel mi. Integer est lacus, blandit vel accumsan non, lobortis eget purus. Nunc non felis nec justo ullamcorper suscipit. Vestibulum dapibus lobortis semper. Quisque mollis, lectus non porta semper, quam sapien adipiscing erat, in tincidunt risus lacus et felis. Vivamus pellentesque, massa in varius cursus, lorem tortor vehicula velit, et commodo neque sapien eget felis. Morbi iaculis condimentum lorem nec iaculis. Vivamus sem ligula, vestibulum id tempus scelerisque, aliquam non velit. Integer ac sapien lorem, sed egestas ligula. Nam tristique tortor id odio imperdiet fermentum sed sit amet nisl. Aliquam in tortor ligula, dignissim iaculis libero. Fusce ut tortor ante, in convallis nisi.
Curabitur accumsan condimentum turpis, tincidunt fringilla nibh hendrerit vitae. Aliquam ac arcu nibh, eget viverra dui. Sed a nisi nibh, ut interdum orci. Suspendisse laoreet sollicitudin libero ac fermentum. Curabitur ultrices enim sit amet massa mollis in dapibus libero iaculis. In enim elit, mattis eget vestibulum at, faucibus at felis. Sed ultrices posuere libero, id consectetur nibh lacinia vel. Maecenas non mi eu dui sodales commodo et a mi. Aliquam erat volutpat. Vestibulum interdum, lectus eget cursus elementum, ligula metus iaculis libero, ac accumsan sapien eros vitae eros. Quisque vulputate massa quis augue mollis pharetra ac eu risus. Donec tristique purus nec erat tristique hendrerit. Integer consectetur nibh nec augue ornare tempus varius eros imperdiet. Quisque venenatis condimentum nisi, facilisis elementum lorem molestie eu. Donec id elit nec arcu tincidunt consectetur id sit amet velit. Nulla ut purus sapien.
Praesent a tortor magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non tincidunt mauris. Morbi euismod sollicitudin ipsum in euismod. Suspendisse potenti. Ut semper, risus viverra porta semper, urna nisi placerat erat, at luctus ante mi in velit. Sed ac congue purus. Curabitur sit amet lacinia elit. Sed ac eros elit. In hac habitasse platea dictumst. In feugiat ipsum at dolor viverra non dictum dui fringilla. Duis quis urna mi. Mauris non tellus non augue pretium commodo vitae adipiscing nulla. Donec aliquet libero sit amet ipsum pharetra non fermentum sapien euismod. Quisque commodo erat vel nisl tristique placerat. Morbi eros urna, dignissim pulvinar ullamcorper sed, convallis at risus. Phasellus quis convallis lectus. Etiam eu aliquet odio. Integer diam neque, tincidunt ac semper quis, gravida eget eros. Praesent augue orci, sagittis vitae semper ut, accumsan in turpis.
Nam ac erat sit amet metus congue ullamcorper at ac quam. Sed auctor fringilla ligula, vitae iaculis mauris tempus et. Etiam pulvinar, odio non egestas mollis, odio ligula elementum dolor, non auctor nulla leo sit amet orci. Aenean leo urna, congue id tristique in, consequat in augue. Morbi vel condimentum dui. Curabitur eu augue felis, sed luctus nisi. Pellentesque eu tortor non erat placerat iaculis a nec tortor. Maecenas ultrices tristique lectus et fermentum. Duis et faucibus diam. Vivamus vitae nibh neque. Sed massa odio, adipiscing at ultricies non, viverra a urna. Praesent posuere dui in nibh pulvinar vitae lacinia est congue. Ut congue vestibulum arcu, eget venenatis augue scelerisque quis. Vivamus augue libero, molestie ut condimentum ac, pretium vitae nunc.
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus sodales varius orci a tempus. Suspendisse potenti. Sed pellentesque euismod erat, et tincidunt lectus vehicula quis. Mauris blandit fermentum urna, a posuere risus vestibulum feugiat. Sed pulvinar, lacus quis dignissim ullamcorper, odio arcu euismod massa, in suscipit odio ipsum quis sapien. Vestibulum nec neque vel leo tincidunt sollicitudin. Quisque et est ut erat blandit dapibus a mollis metus. Etiam turpis duis.
4k is 4096 bytes. So you can store 4096 one byte characters (ASCII).
But as you want to store hash values, you should better use the Base64 encoded values of the raw hash values. Thus you could store 6 bit per character instead of just 4 bit per character if you’d use the hexadecimal value.
Stored as name/value pairs each MD5 will be at least 36 characters (assuming it is stored as a hex string with a single character name, md5+name+"="+separator = 32+2+1+1), longer as you'll be being good and using meaningful names... At 36 characters you can fit 117 in 4K (4096 characters, assuming ASCII characters throughout), but make sure you leave room for overhead like session id cookies from your server-side scripting environment and such.
SHA1 will be longer (160 bit, not 128) and SHA2 longer still (between 224 and 512 bit depending on exact variant used). Using Base64 encoding or similar instead of plain hex will reduce the size (22 characters for MD5, assuming no padding, instead of 32).
As far as gotchas go for using cookies in this way, the main one will be that some users have cookies turned off completely (even first party session cookies) though depending on your target audience this may not be an issue.
You will also need to make sure you test in all browsers your users are likely to use, making sure that an update to the cookies by scripts in one window does in fact update the data available to scripts in the other windows without a client/server round trip.
You will also need to train Internet Explorer users to know the difference between starting a new IE window with ctrl-N or your links, and starting a new process by launching IE from the start menu. In the latter case the cookies will almost certainly not be shared with other windows until a round-trip occurs.