I get a string from database that contains strange characters, and the characters break the json string.  Here is the json string:  {"id":13,"code":"cflw`2B2[h1s`lNzF@sPC1FtaCiK0VF@","label":"Anonymous lifestyle App cflw`2B2[h1s`lNzF@sPC1FtaCiK0VF@"}   It looks OK, but there are '^A' between i and K (2B2[h1s`lNzF@sPC1FtaCiK0VF@), we can not see it from here, but if you copy it to a text editor, it will show up.  My question is how to make this json string parsable? or how to use Python to remove '^A'?
I use to run  $s =~ s/[^[:print:]]//g;   on Perl to get rid of non printable characters.   In Python there's no POSIX regex classes, and I can't write [:print:] having it mean what I want. I know of no way in Python to detect if a character is printable or not.   What would you do?   EDIT: It has to support Unicode characters as well. The string.printable way will happily strip them out of the output.  curses.ascii.isprint will return false for any unicode character.
I found  where a technician with a lot of experience seems to clean his PCBs using water, and then he just puts it in the sun so it can dry. I was just amazed to see the circuit keeps working as intended, he says he keeps doing this all the time and several times, however I doubt this is normal.  Which leave me some questions:   What are the recommended methods to clean huge PCBs like the one in the video? What happens to charged capacitors when water shorts them out? Solder joints do not get any kind of corrosion? Is the antisolder mask waterproof? Picklist dependent on 2 controlling picklist I have 3 picklist in an object Test1, Test2, Test3  1. Test2 is dependent on Test1  2. Test3 is dependent on both.. Test1 and Test2    I want to have Test3 picklist showing values accordindly. i.e  if U selected Test1 = First and Test2 = SA . I should be able to see "IST,ABC and PQR" in Test 3.   Is this possible??? "Switching" axes in 3d tikzpicture Overview  So say I want an arc between the x and z axis in the same way the following creates an arc between the x and y axis (MVCE):  \documentclass[border=5mm]{standalone} \usepackage{tikz} \begin{document}   \begin{tikzpicture}     \tikzset{       x={(0:1cm)},y={(50:0.7cm)},z={(90:1cm)}     }     \draw[-&gt;] (0,0,0) --++ (1,0,0) node[right]{$x$};     \draw[-&gt;] (0,0,0) --++ (0,1,0) node[right]{$y$};     \draw[-&gt;] (0,0,0) --++ (0,0,1) node[right]{$z$};     \draw (0,0,0) ++(0:.3) arc (0:90:.3);   \end{tikzpicture} \end{document}     One solution to this exact problem is to do scope and tell arc that the y-axis is the z-axis.      \begin{scope}       \tikzset{y=(90:1cm)}       \draw (0,0,0) ++(0:.3) arc (0:90:.3);     \end{scope}   The problem  However, I need this more generic since I don't necessarily know how the y-axis is defined, so I'm looking for a way to do, essentially this:      \begin{scope}       \switchYZAxes       \draw (0,0,0) ++(0:.3) arc (0:90:.3);     \end{scope}   or      \begin{scope}       \tikzset{y=\theZAxis}       \draw (0,0,0) ++(0:.3) arc (0:90:.3);     \end{scope}   The latter is problematic because it seems like I can't send polar coordinates to the \tikszet via a macro (which is the background for  question).  Any ideas? Thanks :) Let $Z_n$ be the set of all $n \times n$ matrices that commute with all $n \times n $ matrices. Show that $$Z_n = \{\lambda I_n \ | \  \lambda \in \mathbb R\}$$  ($I_n$ is the $n \times n$ identity matrix)  I don't know how to use $E_{ij}$ (matrix with $1$ in $(i,j)$ and $0$ elsewhere) and the elementary matrix $P_{ij}$ to prove this question. Can anyone explain it please? Regression with only categorical variables What happened to Saruman after he was knifed by Grima? Saruman was one of Maiar, like Gandalf. Meaning that he had a mortal body but presumably, when that body was killed, would simply return back to his ("spirit?") being.  Is there any confirmation from Tolkien that this is indeed what happened after he was knifed by Grima? Or was he somehow completely destroyed since he was de-powered by Gandalf? WinBUGS: Multiple definitions of a node So this question is about the BUGS modeling language. So you either know it or have no clue. I'm a newbie to this so it's been driving me mad. I want to define a simple two-state hidden Markov model (HMM) where the emission of each state follows a Normal distribution. I have an array data of Nxl dimension where each row is a subject and column is a continuous variable Time associated with the subject. So in WinBUGS, I would define the model as:   for(i in 1:N) { # for each subject     # Sample the initial observation     Time[i, 1] ~ dnorm(mu[State[1]], tau[State[1]])      for(j in 2:l[i]) { # for each observation         # Sample the observed variables         Time[i, j] ~ dnorm(mu[State[j]], tau[State[j]])         # Sample the hidden states         State[j] ~ dcat(P[State[j-1], ])     } }  # P is the transition matrix of the hidden Markov chain P[1, 1:2] ~ ddirch(Pinit) P[2, 1:2] ~ ddirch(Pinit)  # Set the initial states State[1] ~ dcat(Pinit)  # Sample the initial params mu[1] ~ dnorm(200, 1.0E-6) mu[2] ~ dnorm(400, 1.0E-6)  # The precision params tau[1] ~ dgamma(0.001, 0.001) tau[2] ~ dgamma(0.001, 0.001)   Initial values have also been provided via R2WinBUGS. The model is syntactically correct. But when I run, I got this error: "multiple definitions of node State[2]"  Can you please tell me why and how to solve this? I've searched around on the error but each has their own specific case and there's not a generic solution or explanation as to why this arises. Additive Roman Numeral 4 I am working on a diplomatic edition of a 15th century book and it numbers its folios using the standard roman numerals of the time.  I've been using the following to get the page/folio in my header:  \newcommand{\rectoverso}[1]{\ifthenelse{\isodd{#1}}{r}{v}} \newcommand{\folio}[1]{\the\numexpr (#1+1)/2\relax} \uppercase\expandafter{\romannumeral \value{\folio{\thepage}}}\rectoverso{\thepage}   This works great, but the problem is that the roman numeral sequence is off of what I need.  Instead of I, II, III, IIII, V, VI, VII, VIII, IX, X, I get the subtractive IV (somewhat understandably, given it's the far more common one in modern usage).  My source text only (and always) uses the additive 4 in the one's position: 24 is XXIIII, 34 is XXXIIII but 44 is XLIIII.  9 is universally rendered subtractively as IX or XC.  Is there a package that allows for some control over which numbers are done additively and which are subtractively, or would my best option be to write my own custom definition to account for the specific style used in my book? Theoretically possible to run two operating systems simultaneously? A friend of mine asked a question that got me thinking. Is it possible (theoretically, I assume it hasn't been done) to run two operating systems simultaneously on the same computer? Not in the sense of multitasking in one window, but being able to quickly switch from one to the other without restarting. Could something low-level be created that would intercept system calls (or whatever needs to be done) to make each OS think it is running alone? Or hardware itself that would accomplish this?  I'm not talking about dual booting or using virtual machines, but actually running two OS's side-by-side. A library to convert ANSI escapes (terminal formatting/color codes) to HTML I'm looking for a code library that converts ANSI escape sequences into HTML color, via plain  tags or CSS. For example, something that would convert this:  ESC[00mESC[01;34mbinESC[00m ESC[01;34mcodeESC[00m ESC[01;31mdropbox-lnx.x86-0.6.404.tar.gzESC[00m ESC[00mfooESC[00m  Into this:  &lt;span style="color:blue"&gt;bin&lt;/span&gt; &lt;span style="color:blue"&gt;code&lt;/span&gt; &lt;span style="color:red"&gt;dropbox-lnx.x86-0.6.404.tar.gz&lt;/span&gt; foo   Converting breaks into &lt;br/&gt; isn't necessary, it's just the escape codes that I don't know. I could hack it together myself, but I'd probably miss something important like underlines or mess up how background colors work. I'd rather just sit on top of someone else's code.  Does such a tool (command line linux) or library (perl, python, or ruby preferably) exist? It would help everyone if we provided a mechanism that people could use to flag their post if English is language they are not comfortably fluent in. A lot of non-English speakers have to go to English forums for tech support and find it embarrassing to ask questions in broken Englis.   Worse, people reading a post often cannot tell if a badly-worded post results from a poor English or just laziness and sloppiness on the part of a native English speaker. Personally, I will take the time to puzzle out a poorly-worded post if I know the author is struggling with English, but if I think they're just lazy and careless I won't bother.   A simple check box could flag the author as a non-English speaker and allow everyone to adjust accordingly.   Edit01:  Some answers below have accused me of being 'elitist'. I'm not sure where they got the idea that I was sneering down at anyone because their abilities at either English or coding. That was not my intent.   When I said I would not bother with post that appeared to incoherent owing to laziness or carelessness, I am not being elitist. I'm giving priority in my time budget to people who are respectful enough of my time to spend the their time writing as clear a question as their grasp of English and coding allows. Why should I spend time answering a careless and slapdash post when I could spend that time helping posters who took more of their time writing their questions?   I am perfectly willing to burn a lot of time helping someone struggling to write code in their non-native language. I have a hard enough time coding myself in English that I can't even imagine what a dog's breakfast I would make of it if I had to code in, say, Korean.    I have seen many instances in which questions have been downvoted when a quick glance at the poster's profile gives a strong hint they are not native English speakers. I would like a system that would spare those posters from being downvoted or ignored by using an interface element that clearly communicates in a standardized way whether the poster natively speaks English or not.   I don't see what's elitist about that.    Edit02:   (original unedited) I'm talking about:     Hy, I have a childe view that put it   self over other brother views. The   problem is that when i touch it the   brother also reacts at the touch   event. How can I disable touch   propagation on the underlieng brother   views?   I'm not even exactly sure what he is describing. I can guess that he has a sibling view that extends over its siblings but I'm not sure. If I edited it, I might not end up asking the same question the poster intended.   To answer the question, I will either have to (1) first ask for more detail and then keep checking back until I get it or (2) try to answer what I think the question is and possibly mangle it then have to come back and edit my answer all the while risking a downvote because I answered the wrong question.   I will take the time and the risk of down vote if the poster is not a native English speaker (or is a child) and the confusing question represents their honest best effort. If they're just being lazy, I have other people to help.   I would like a mechanism that would help me decide how to allocate my time and would protect the non-English speaking posters from unjust downvotes. Where can I find a Java to C# converter? I needed to convert a Java 1.5se app to C# 2.0.  Does anyone know of a tool (preferably free/open source) to do this? Windows installer for Ubuntu 14.04 LTS onwards Help with table multicolumn What is the danger of running untrusted software as a normal user Sometimes I have to use some propriety softwares which I don't trust or even pre-compiled open source ones which I don't know if they've been compiled as their source are.   Lets say we installed a propriety application in /opt/software, then we run it as a normal user (without sudo, gksudo, etc).   I know when we run a program it is able to connect to the Internet, monitor X, keystrokes, collect user data and so on. It can't change anything important in the system or infect the system, (because of the Linux permissions system). It is possible for program to add some plug-in/extension to a user's browser (Because browser profiles are available in user home directory). After closing the program and rebooting it can't do anything anymore. Wrong because:   Program can add itself to a shell/file/directory which does the autostart process, so it will run at any login.  If we consider the autostart process clean, without rebooting there is a chance that a process of the program is still active. Programs can delete or modify any file in the user home directory (or any other file which a user has write permission to).   So what should we do?   I think the only safe way to run a propriety program is running it as another user. If running the program as another user somehow is not possible then we should change the autostart files permission so only root can change them. then after closing the program a reboot will do the job.   Am I right? Is there anything that I'm missing? Before asking my question, I'll use an example to clarify the idea.  Say that a company used to sell horses and then they turn into a sheeps business. While some of the old pages can be mapped to the new pages using a 301 redirect, because they're really related in the content and the company don't want to lose users and link juice, there are a lot of pages strictly related to horses that they want to shutdown.  What's the best practice? Is there a way to say to users and Search Engines the content you were looking for won't be available any more?  Basically a 301 redirect of the closed pages to new ones seems not so good, because you'll show a content totally unrelated to the searched one.  P.S: I'm aware that probably the best fallback is to simply map those pages to the homepage but I hope in a smarter solution. Sugar as a defence against bacteria? mentions that sugar "at a certain level acts as a preservative". I've always been taught that microorganisms eat sugar and expel acids, that is why sugary food are damaging to teeth. How is it that sugar acts as a preservative, then?  Googling the question I've found   though I don't credit the sources as being especially reputable. What is the real reason that sugar can act as a preservative? How to Install Virtualbox on Windows 10 host? Why do birds sitting on electric wires not get shocked? When we touch electric wires, we get shocked. Why don't birds sitting on electric wires not get shocked? Comparison between integrals Let's say - $F(x) &gt; G(x)$ for all $x$ in $E$.  So is it true that ?  $$\int F(x)\,dx  &gt; \int G(x)\,dx$$ or I can use this statement only when the two functions are non-negative functions.  Thanks!