The task:  We have over 1500 .msg files in Salesforce, which are Outlook containers for Mail conversations plus attachments. The idea is to build a script, which downloads all files, extract each attachment and Mail conversation and uploading the files to Salesforce with the corresponding opportunities. It is convenient for us to use JSForce at the moment. Querying all the files in the database works fine. But VersionData is path to the actual document, not the document itself.  The Problem:  Here is the important part of the code:  conn.queryAll(oneLine`   SELECT ContentDocumentId,     ContentDocument.Title,     ContentDocument.FileExtension,     ContentDocument.LatestPublishedVersion.VersionData,     ContentDocument.LatestPublishedVersion.Id   FROM ContentDocumentLink   WHERE ContentDocument.FileExtension = 'msg' AND     LinkedEntityId = '${teamId}' `)   .then(result =&gt; {     result.records.map(document =&gt; {       if (!document.ContentDocument.LatestPublishedVersion) {         /* error handling */       }       const filename =         document.ContentDocumentId + '.' +         document.ContentDocument.FileExtension        const dataPath = document.ContentDocument.LatestPublishedVersion.VersionData       conn.request(dataPath)         .then(data =&gt; {           fs.writeFile(`./files/${filename}`, data, () =&gt; {             console.log(`downloaded ${filename}`)             /* Do stuff */           })         })         .catch(requestError =&gt; {           fs.appendFile(logNames.requestErrors, `${requestError}\n\n\n\n\n`,() =&gt; {})         })     }) ...   It will successfully download files, but they seem to be corrupted, because none of them can be viewed by any program suitable to open .msg files.  I had another approach like this:  ...   .then(result =&gt; {     result.records.map(document =&gt; {       if (!document.ContentDocument.LatestPublishedVersion) {         /* error handling */       }       const filename =         document.ContentDocumentId + '.' +         document.ContentDocument.FileExtension        const fileDesc = fs.createWriteStream(`./files/${filename}`)         .on('error' , error =&gt; {           console.error(error)         })       conn         .sobject('ContentVersion')         .record(document.ContentDocument.LatestPublishedVersion.Id)         .blob('VersionData')         .pipe(fileDesc)         .on('error', error =&gt; {           console.error(error)         })         .end(() =&gt; {           console.log('Closing FD')           fileDesc.close()         })     })   Here, nothing happend. Nothing was downloaded and no error was printed or logged.  The documentation seems to be not up-to-date or at leat not helpful to me. I appreciate every help i can get.
I am trying to retrieve VersionData with a standard REST API call from a VisualForce Page a then upload it to a S3 bucket but end up with corrupted files. I believe this is an encoding problem on the client side as plain text or CSVs work like a charm. I can upload VersionData from Apex but there are heap and request size limitations so I need to send the data from the client.   This is the call and returned string, I tried changing mimeType and encoding on both sides (SF call and S3 upload) with no luck.   Any ideas how to properly process images or pdf files? Thanks a lot  THE PROBLEM IS NOW SOLVED  Files should not be treated as strings. I solved the problem by leaving jQuery's ajax as I did not succeed to request a response type. By switching to plain JS and making a GET call (XMLHttpRequest) with response type set to blob I received an Object, instead of a string. Base64 string can be then retreived using JS FileReader.
Drawbacks of making public which journal a manuscript is submitted to, while it is under review? Many researchers list out their submitted manuscripts on their website. Some specify the journal name, like     Smith J, Oliver J (under review) My awesome paper. Nature.   while others don't, like     Smith J, Oliver J (under review) My awesome paper.   One reason I can think of as to why some don't mention the journal name is that they may get embarrassed in the case where the current journal rejects the paper. Then, the "circle" will know this paper gets rejected from Nature first and then ends up in an inferior journal.  Besides this, are there any other considerations preventing people from mentioning to which journal they submit a paper to?  P.S.: I am asking because my advisor is a researcher who only mentions accepted  papers on his webpage. As a student hunting jobs, I feel it is advantageous for me to mention my submitted papers on my webpage. I hesitate to do so, as I worry I may make my advisor unhappy by announcing in which journal our papers are currently under review. fitting a smaller range when we bought our house, it had a very used 40" gas range. now that range has died. replacing with a new 40" range is very pricey ($2k+), and our cooking needs don't justify the size anyhow.  i'm looking for ideas on how to fit a smaller range. i would imagine that extending the counter top and cabinets would be a pretty extensive change. we've found we can get a 36" range for around 1/2 the cost. would it be feasible to add some sort of storage along side the smaller range to fill in the space?  thanks. i know this is an open-ended question with no specific answer, i'm just looking for ideas. Why can't I press the Install button when installing applications from unknown sources? I need to calculate no of possible substrings containing "00" as a substring. I know the length of the binary string.  Eg: for a string of length 4, possible substrings are: 0000 0001 0010 0011 0100 1000 1001 1100  I just need the number of possible combinations, not enumerate all of them. How to make clickable links and cross-references in pdfs produced by LaTeX? How can I make things link url references, my index, table of contents, and cross references clickable links in documents produced by LaTeX? I generally use pdflatex to produce my documents. Why is super.super.method(); not allowed in Java? I read  and thought that would easily be solved (not that it isn't solvable without) if one could write:   @Override public String toString() {     return super.super.toString(); }   I'm not sure if it is useful in many cases, but I wonder why it isn't and if something like this exists in other languages.  What do you guys think?  EDIT: To clarify: yes I know, that's impossible in Java and I don't really miss it. This is nothing I expected to work and was surprised getting a compiler error. I just had the idea and like to discuss it. Why was the previous Code of Conduct FAQ (and all answers) removed? I noticed that the  was deleted.   When the  came out, I tried to look for my old answer as well as others for comparison.  Why not just mark the old one superseded by [insert link]?  Note: I don't care about lost rep. There were a lot of useful links in answers and comments there (and some less-than-useful ones too).     Old CoC FAQ may be available  and . Source: (, ). How do I migrate an SVN repository with history to a new Git repository? Why didn't the basilisk bite in Chamber of Secrets destroy the Horcrux? As the title asks, why didn't the basilisk bite received in the Chamber of Secrets destroy the Horcrux inside the bitten person?   Yes, I know Fawkes quite quickly healed the bite wound with his phoenix tears, but when Harry used the basilisk fang to destroy Tom Riddle's diary the destruction of that Horcrux was immediate. When Ron hit the locket with the Sword of Gryffindor, it was destroyed immediately. Although the destruction of the ring occurred off-page, Dumbledore used the Sword of Gryffindor to destroy it, so presumably, like the locket, it was gone right away. Nagini died straightaway when Neville decapitated her. The destruction of the Hufflepuff cup happens off-page. The diadem seems to have been destroyed by Fiendfyre immediately as well, as when Harry examined it outside the Room of Requirement it was already leaking a blood-like substance, and then it cracked in half. When Voldemort hit Harry with Avada Kedavra in the forest, Harry woke up in limbo with the last fragment of Voldemort's soul - that awful flayed baby-like being - separated from him immediately.   Is there a logical/canon-based explanation for why the fragment of Voldemort's soul residing in Harry wasn't destroyed upon Harry being bitten by the basilisk?  NOTE: I've read the HP Wiki's entry on Horcruxes; however, I find the HP Wiki to be inconsistent in its accuracy, so I'm hesitant to accept the Wiki's explanation on the matter. I'd prefer an explanation constructed from information in the books or a statement by JKR, or the like. I have a database with millions of phone numbers with free-for-all formatting. Ie, the UI does not enforce any constraints and the users are typing in whatever they want.  What I'm looking for is a Java API that can make a best-effort to convert these into a consistent format. Ideally, the API would take the free text value and a country code and produce a valid international phone number or throw an exception.  For example, a phone number in the system might look like any of the following:  (555) 478-1123 555-478-1123     555.478.1123 5554781123   Given the country of US, the API would produce the value "+1 (555) 478-1123" for all these. The exact format does not matter, as long as it's consistent.  There are also numbers in the system without area codes, such as "478-1123". In that case, I would expect a NoAreaCodeException, or something similar.  There could also be data such as "abc", which should also throw exceptions.  Of course, there are countless variations of the examples I have posted, as well as the enormous complication of international phone numbers, which have quite complicated validation rules. This is why I would not consider rolling my own.  Has anyone seen such an API? What happens when a moderator clicks 'leave open' in the close-vote queue? It takes  clicking "leave open" in the close-vote queue to remove the question from the queue.  How about diamond mods?  Do they remove it from the queue in one click, or not? I've found a strange thing: some Stack Exchange sites have their own domain names instead of https://[site name].stackexchange.com. The websites which have their own domain names are:          Are there any parameters for allocating specific URLs to Stack Exchange sites? Advantages of ROC curves Technical term for associating a group with the actions of a few On , this is my tag blacklist:        Note well that I have them set to hidden, because I would prefer not to see questions on this topic. Bridge players, don't take offence &mdash; I don't have problem with the game itself. I don't understand the game's mechanics, though, so I find questions about it incomprehensible, and I'd rather stick to just seeing questions I can understand.  I still see [bridge] questions galore on the Android app though. Could it be updated to pay attention to whether I have certain tags ignored and set to be hidden? Show that $ab + bc + ac \ge a\sqrt{bc} + b\sqrt{ac} + c\sqrt{ab}$ Where $a,b$ and $c$ are positive real numbers.  So far I have shown that $$a^2+b^2+c^2 \ge ab+bc+ac$$ and that $$a^2+b^2+c^2 \ge a\sqrt{bc} + b\sqrt{ac} + c\sqrt{ab}$$ but I am at a loss what to do next... I have tried adding various forms of the two inequalities but always end up with something extra on the side of $ab+bc+ac$. Any help appreciated! Importance of Representation Theory Representation theory is a subject I want to like (it can be fun finding the representations of a group), but it's hard for me to see it as a subject that arises naturally or why it is important. I can think of two mathematical reasons for studying it:   The character table of a group is packs a lot of information about the group and is concise. It is practically/computationally nice to have explicit matrices that model a group.   But there must certainly be deeper things that I am missing. I can understand why one would want to study group actions (the axioms for a group beg you to think of elements as operators), but why look at group actions on vector spaces? Is it because linear algebra is so easy/well-known (when compared to just modules, say)?  I am also told that representation theory is important in quantum mechanics. For example, physics should be $\mathrm{SO}(3)$ invariant and when we represent this on a Hilbert space of wave-functions, we are led to information about angular momentum. But this seems to only trivially invoke representation theory since we already start with a subgroup of $\mathrm{GL}(n)$ and then extend it to act on wave functions by $\psi(x,t) \mapsto \psi(Ax,t)$ for $A$ in $\mathrm{SO}(n)$.   claims that if our physical system has $G$ as a symmetry group, then there is a correspondence between particles and representations of $G$. I'm not sure if I understand this correspondence since it seems to be saying that if we act an element of G on a state that corresponds to some particle, then this new state also corresponds to the same particle. So a particle is an orbit of the $G$ action? Anyone know of good sources that talk about this? Eigenvalues of a matrix whose square equals its transpose Let $A$ be a $n\times n$ matrix with $A^2=A^t$. Show that every real eigen value of $A$ is either $ 0$ or $1$ Apache on CentOS 5.9 VM serves modified files incorrectly Irreducible polynomials and affine variety Let $k$ be any field, and let $f,g\in k[x,y]$ be two irreducible polynomials such that $g$ is not divisible by $f$. Prove that $V(f,g)\subseteq A_k^2$ is finite.