How to set fancybox height and width identical?

If I have the content (body) and title of a set of blog posts I need to post onto a Quora blog (splitting two existing blogs) what is the best way to with a script have it posted to a the new blog?

  • Assume I have it as JSON like: {"title":"Classes of complexity","body":"Knowing the big-O of an algorithm is often pointless because on paper for example one <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"42\" height=\"21\" class=\"math\" type=\"math\" title=\"O(n)\" alt=\"O(n)\" /></span> algorithm is just as fast as an other <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"42\" height=\"21\" class=\"math\" type=\"math\" title=\"O(n)\" alt=\"O(n)\" /></span>.&nbsp; At this level of abstraction there is no reason to pick one over an other we would need to compare their actual theoretical run times (the entire polynomial that is simplified in big-O to something compared to n).&nbsp;&nbsp; For example a linear search that halts when it finds what it is looking will on average find what it is looking for at exactly center (in the next post we will look at why this is true even though it is only a statistical and not a fact for all runs) then it is obviously faster then one that does not stop when it finds what it is looking for.&nbsp;&nbsp; Namely <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"69\" height=\"21\" class=\"math\" type=\"math\" title=\"n/2 &lt; n\" alt=\"n/2 &lt; n\" /></span> for all n greater then 1.&nbsp;&nbsp; This despite the fact they are both <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"42\" height=\"21\" class=\"math\" type=\"math\" title=\"O(n)\" alt=\"O(n)\" /></span> algorithms.<br /><br />So when comparing algorithms we need to know first what general class an algorithm or family of algorithms falls into the list below is the rough break down of the polynomial ones (ones that can be expressed as <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"55\" height=\"21\" class=\"math\" type=\"math\" title=\"\\Sigma c_i{x_i}^{k_i}\" alt=\"\\Sigma c_i{x_i}^{k_i}\" /></span> where c and k are constants) the listed from fastest to slowest: <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"40\" height=\"21\" class=\"math\" type=\"math\" title=\"O(1)\" alt=\"O(1)\" /></span>,<span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"66\" height=\"21\" class=\"math\" type=\"math\" title=\"O(log n)\" alt=\"O(log n)\" /></span>,<span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"42\" height=\"21\" class=\"math\" type=\"math\" title=\"O(n)\" alt=\"O(n)\" /></span>,<span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"78\" height=\"21\" class=\"math\" type=\"math\" title=\"O(n log n)\" alt=\"O(n log n)\" /></span>,<span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"49\" height=\"23\" class=\"math\" type=\"math\" title=\"O(n^k)\" alt=\"O(n^k)\" /></span>.&nbsp;&nbsp; Note <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"40\" height=\"21\" class=\"math\" type=\"math\" title=\"O(1)\" alt=\"O(1)\" /></span> denotes constant time no matter how big the input.<br /><br />There are cases, like a hacker attempting to guess you password, to be as slowest as possible.&nbsp;&nbsp; For this reason almost all encryption algrothms want to make it as near to <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"40\" height=\"21\" class=\"math\" type=\"math\" title=\"O(1)\" alt=\"O(1)\" /></span> as possible (for all practical purposes they are <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"40\" height=\"21\" class=\"math\" type=\"math\" title=\"O(1)\" alt=\"O(1)\" /></span> already) when the user types the correct password but if they type the wrong one you want to force them to make as many guesses as possible.&nbsp;&nbsp; Thus the worst possible perfomence we can have by just guessing is <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"42\" height=\"21\" class=\"math\" type=\"math\" title=\"O(n)\" alt=\"O(n)\" /></span>.&nbsp; For most passwords n is amazing small (<span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"31\" height=\"18\" class=\"math\" type=\"math\" title=\"2^{128}\" alt=\"2^{128}\" /></span>) which can be tried in a few hours on almost all modern computers.&nbsp; So the only requirement for a good password scheme is that it takes longer then <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"42\" height=\"21\" class=\"math\" type=\"math\" title=\"O(n)\" alt=\"O(n)\" /></span> to break it.<br /><br />Notice we didn&#039;t consider cases like <span class=\"math_w\"><img src=\"Page on quoracdn.net" width=\"54\" height=\"21\" class=\"math\" type=\"math\" title=\"O(n^m)\" alt=\"O(n^m)\" /></span> this because they belong to a special class of problems called non-polynomial (NP).&nbsp;&nbsp; We will look at them in the next few posts and see why the entire question of how fast they really are is one of the holy grails (if not &quot;the&quot; holy grail) of computer science."} If possible I want to preserve the existing formatting. Here is how I fetched it: foreach i ( `cat ../posts` ) fetch $i set file=`echo $i|rev|cut -f1 -d'/'|rev` java -cp ..:../json.jar Snip $file>foo mv foo $file end with Snip.java being: import java.io.*; import javax.json.*; public class Snip { public static void main(String[] args) throws IOException { for(String arg:args) { FileInputStream fis=new FileInputStream(arg); byte[] b=new byte[fis.available()]; fis.read(b); fis.close(); Snip s=new Snip(new String(b)); JsonObjectBuilder bld=Json.createObjectBuilder(); bld.add("title",s.title); bld.add("body",s.body); System.out.println(bld.build()); } } public Snip(String sent) { String[] parts=sent.split("(__w2_[A-Za-z0-9]+_container)"); String content=parts[1].split("container_boundary")[0]; body=content.substring(2,content.length()-"<div class=\"".length()); title=sent.split("board_item_title")[1].split(">")[2].split("<")[0]; } private String title; private String body; }

  • Answer:

    I would probably be looking at using something like Selenium to use the clipboard to preserve formatting when transferring pre-rendered content between browser tabs. Quora will retain most of formatting of copy/pasted content. The fastest way I see is parsing your JSON, rendering its body content in a contentEditable textarea element, and then using Selenium or some other browser automation to copy/paste it into Quora. Alternatively, you can use an extension or a greasemonkey script to reformat the message within Quora's editable area with JavaScript. I started working on that a couple of years ago when I had an idea to implement some editing enhancements to improve Quora's editing experience, but quickly ran out of skill.

Leonid S. Knyshov at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.