{"id":59,"date":"2014-04-30T17:18:56","date_gmt":"2014-04-30T11:48:56","guid":{"rendered":"http:\/\/blog.wnohang.net\/?p=59"},"modified":"2014-05-03T14:19:41","modified_gmt":"2014-05-03T08:49:41","slug":"saving-form-data","status":"publish","type":"post","link":"https:\/\/blog.wnohang.net\/index.php\/2014\/04\/30\/saving-form-data\/","title":{"rendered":"Saving form data in firefox"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span><p>When commenting on sites, I have sometimes, seen that the commenting system just swallows the comment, or there is a browser crash, or a system one. In these cases it would be great if you can recover it somehow, particularly when you typed quite a bit.<\/p>\n<p>There are plugins for firefox and other browsers for this. But since I use Pentadactyl(<a href=\"http:\/\/5digits.org\/pentadactyl\/\">site<\/a>), I thought not to use any external plugin but write one for dactyl. But then, I realized a plugin may not be needed.<\/p>\n<p>Following is what I use:<br \/>\n<!--more--><\/p>\n<p><code><br \/>\n#!\/bin\/zsh<br \/>\nfile=\"$@\"<br \/>\ndat=$(date +%s)<br \/>\nln -f $file ~\/.pentadactyl\/tmp\/pentadactyl-$dat.txt<br \/>\nurxvt -name dactyle -e \/usr\/bin\/vim '+set ft=mail' '+set foldminlines=2' \"$file\"<br \/>\ncp \"$HOME\/.pentadactyl\/tmp\/pentadactyl-$dat.txt\" ~\/.pentadactyl\/data\/${file:t}-$dat<br \/>\nrm ~\/.pentadactyl\/tmp\/pentadactyl-$dat.txt<br \/>\n<\/code><\/p>\n<p>EDIT: I didn&#8217;t explicitly mention this earlier but you need to set the above script as editor with &#8216;set editor=pvim&#8217; (in pentadactylrc).<\/p>\n<p>With this, whenever I switch to external editor mode (which is vim in may case), the existing comment is copied (this is done by dactyl itself) and then after I exit the editor, a copy of the comment is saved in my home directory. Note that, the linking is necessary there, otherwise the temporary file gets deleted after urxvt returns. Also, the window name is used there to provide hint to my window manager (xmonad) on how maintain the window. The &#8216;ft=mail&#8217; is used so I can use the same vim file mode that is used while replying to mails (in mutt).<\/p>\n<p>In addition to have protection against crash (note that vim also maintains swap files), it is also nice to have an archive of all your comments. I just did a count in my comment directory and I see about 946 comments! The files are also named based on date and so on, so I can refer earlier comments easily.<\/p>\n<p>Note that, while this approach works with most of the sites, with some commenting systems like disqus I have had issues (I actually lost one of my comments on disqus today morning).  That is one of the reasons I use a plugin like Pentadactyl since it allows for KISS solutions like these. I have written plugins (mostly trivial) for other issues like using extended hints to invoke an external player on an URL.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>When commenting on sites, I have sometimes, seen that the commenting system just swallows the comment, or there is a browser crash, or a system one. In these cases it would be great if you can recover it somehow, particularly when you typed quite a bit. There are plugins for firefox and other browsers for &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.wnohang.net\/index.php\/2014\/04\/30\/saving-form-data\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Saving form data in firefox&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3AlYV-X","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":160,"url":"https:\/\/blog.wnohang.net\/index.php\/2015\/04\/29\/feedback-directed-optimization-with-gcc-and-perf\/","url_meta":{"origin":59,"position":0},"title":"Feedback directed optimization with GCC and Perf","author":"Raghavendra","date":"April 29, 2015","format":false,"excerpt":"Gcc 5.0 has added support for FDO which uses perf to generate profile. There is documentation for this in gcc manual, to quote: -fauto-profile=path Enable sampling-based feedback-directed optimizations, and the following optimizations which are generally profitable only with profile feedback available: -fbranch-probabilities, -fvpt, -funroll-loops, -fpeel-loops, -ftracer, -ftree-vectorize, -finline-functions, -fipa-cp, -fipa-cp-clone,\u2026","rel":"","context":"In \"fdo\"","block_context":{"text":"fdo","link":"https:\/\/blog.wnohang.net\/index.php\/tag\/fdo\/"},"img":{"alt_text":"feedback","src":"https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2015\/04\/feedback.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":114,"url":"https:\/\/blog.wnohang.net\/index.php\/2014\/05\/03\/annoying-access-keys-web-pages\/","url_meta":{"origin":59,"position":1},"title":"Annoying access keys on web pages","author":"Raghavendra","date":"May 3, 2014","format":false,"excerpt":"HTML access keys were introduced to improve web accessibility and they still seem to serve that purpose. Wikipedia defines them as \"In a web browser, an access key or accesskey allows a computer user to immediately jump to a specific part of a web page via the keyboard.\" If you\u2026","rel":"","context":"In \"accesskey\"","block_context":{"text":"accesskey","link":"https:\/\/blog.wnohang.net\/index.php\/tag\/accesskey\/"},"img":{"alt_text":"5463604427_8e7998ddcc_b","src":"https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/5463604427_8e7998ddcc_b.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/5463604427_8e7998ddcc_b.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/5463604427_8e7998ddcc_b.jpg?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/5463604427_8e7998ddcc_b.jpg?resize=700%2C400 2x"},"classes":[]},{"id":126,"url":"https:\/\/blog.wnohang.net\/index.php\/2014\/05\/03\/twitter-setup\/","url_meta":{"origin":59,"position":2},"title":"My twitter setup","author":"Raghavendra","date":"May 3, 2014","format":false,"excerpt":"I have been using Twitter for a while under the handle randomsurfer. I tend to use web interface sometimes, but regularly I use the command-line\/ncurses interface. There are two main clients that I use regularly. One is ttytter which is a nice command-line client which offers advanced functionality such as\u2026","rel":"","context":"In \"bitlbee\"","block_context":{"text":"bitlbee","link":"https:\/\/blog.wnohang.net\/index.php\/tag\/bitlbee\/"},"img":{"alt_text":"2014-05-03-150028_1920x1060_scrot","src":"https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/2014-05-03-150028_1920x1060_scrot-1024x565.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/2014-05-03-150028_1920x1060_scrot-1024x565.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/2014-05-03-150028_1920x1060_scrot-1024x565.png?resize=525%2C300 1.5x"},"classes":[]},{"id":73,"url":"https:\/\/blog.wnohang.net\/index.php\/2014\/05\/03\/mysql-file-limit-table-cache-max_connections\/","url_meta":{"origin":59,"position":3},"title":"MySQL file limit, table cache and max_connections","author":"Raghavendra","date":"May 3, 2014","format":false,"excerpt":"MySQL variables open_files_limit, table_open_cache and max_connections are inter-related, and this is for obvious reasons: all deal with file descriptors one way or another. If one of the value is provided but others are left out, mysqld calculates others using a formula and in some cases, emits a warning if not\u2026","rel":"","context":"In \"EAGAIN\"","block_context":{"text":"EAGAIN","link":"https:\/\/blog.wnohang.net\/index.php\/tag\/eagain\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/384027019_5e64727276_z.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/384027019_5e64727276_z.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2014\/05\/384027019_5e64727276_z.jpg?resize=525%2C300 1.5x"},"classes":[]},{"id":334,"url":"https:\/\/blog.wnohang.net\/index.php\/2020\/05\/22\/gossips-in-distributed-systems-physalia\/","url_meta":{"origin":59,"position":4},"title":"Gossips in Distributed Systems:  Physalia","author":"Raghavendra","date":"May 22, 2020","format":false,"excerpt":"I often take notes and jot down observations when I read academic\/industry papers. \u00a0 Thinking of a name for this series \u2018Gossips in Distributed Systems\u2019 seemed apt to me, inspired by the gossip protocol with which peers in these systems communicate with each other which mimics the spread of ideas\u2026","rel":"","context":"In \"availability\"","block_context":{"text":"availability","link":"https:\/\/blog.wnohang.net\/index.php\/tag\/availability\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2020\/05\/Screen-Shot-2020-05-22-at-4.40.40-PM.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2020\/05\/Screen-Shot-2020-05-22-at-4.40.40-PM.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2020\/05\/Screen-Shot-2020-05-22-at-4.40.40-PM.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2020\/05\/Screen-Shot-2020-05-22-at-4.40.40-PM.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/blog.wnohang.net\/wp-content\/uploads\/2020\/05\/Screen-Shot-2020-05-22-at-4.40.40-PM.png?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":8,"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":132,"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/posts\/59\/revisions\/132"}],"wp:attachment":[{"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wnohang.net\/index.php\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}