I'm getting the following error when attempting an insert in Postgres: psycopg2.errors.UndefinedColumn: column &quot;bac&quot; does not exist I am not sure why. This is the command I'm trying: cur.execute(&quot;INSERT INTO t43407779_positions(ticker, shares) VALUES(BAC, 40);&quot;) I'm wondering if I shouldn't have variable names the same as column names, because perhaps Postgres can mix them up. But that doesn't seem right. Here is a larger snippet of the code in case its helpful: try:     start = text.index('$')     stop = text.index(':')     letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']     if text[start+1].lower() in letters:         ticker = text[start+1:stop]         #if words after ticker..         '''         if ' ' in text_2:             for i in text_2[:text_2.index(' ')]:                 ticker = ticker + i         #if there are no words after ticker..         else:             for i in text_2:                 ticker = ticker + i         '''         ticker = ticker.upper()         print(&quot;TICKER =&quot;, ticker)         r = requests.get(alpaca_base+ticker, headers=headers)         res = json.loads(r.text)         price = res['last']['price'] except:     msg = 'No price found for ticker {}. Check for an alternative ticker that is traded on NYSE, Nasdaq, or IEX.'.format(ticker)         if 'buy' in text:     #buy     shares = text[text.index('buy:')+4:]     print(shares)     shares = int(shares)     cost = shares*float(price)     print('cost=',cost)     cur.execute(&quot;SELECT cash FROM &quot;+tablename+&quot; WHERE player = &quot; + gmuser +&quot;;&quot;)     cash = cur.fetchone()[0]     print(cash)     print(cash &gt; cost)     if cash&gt;cost:         #valid buy         cur.execute(&quot;SELECT * FROM &quot; + &quot;t&quot; + gmuser +&quot;_positions;&quot;)         portfolio = cur.fetchall()         print(portfolio)         print(type(portfolio))         #for i in portfolio:         #   print(i)         command = &quot;INSERT INTO &quot;+ pos_table +&quot;(ticker, shares) VALUES(&quot;+ticker+&quot;, &quot;+str(shares)+&quot;); &quot;         print(&quot;Command:&quot;)         print(command)         cur.execute(command)         conn.commit()
For some reasons, I would like to do an explicit quoting of a string value (becoming a part of constructed SQL query) instead of waiting for implicit quotation performed by cursor.execute method on contents of its second parameter.  By "implicit quotation" I mean:  value = "Unsafe string" query = "SELECT * FROM some_table WHERE some_char_field = %s;" cursor.execute( query, (value,) ) # value will be correctly quoted   I would prefer something like that:  value = "Unsafe string" query = "SELECT * FROM some_table WHERE some_char_field = %s;" % \     READY_TO_USE_QUOTING_FUNCTION(value) cursor.execute( query ) # value will be correctly quoted, too   Is such low level READY_TO_USE_QUOTING_FUNCTION expected by Python DB API specification (I couldn't find such functionality in  document). If not, maybe Psycopg2 provides such function? If not, maybe Django provides such function? I would prefer not to write such function myself...
How to give an image or video a TV screen effect? Help removing subsection and subsubsection numbers from Table of Contents TOC Hello I am trying to further modify my TOC.  I got an answer  as to how I could remove the \section numbers on the left side of the TOC and now I would like to expand that.  I would like to remove the left-hand numbering for \subsection and \subsubsection as well but I do not know how.  (I also want to keep these numbers out of the document and I am using \def\sectionformat{} to do that)  Also, my TOC is slightly over one page and so I would like to adjust the spacing from 2 to 1.5,  is there any way to do this?    \documentclass[12pt, a4paper, twoside]{article}     \usepackage{baskervald}     \usepackage[margin=1in,bindingoffset=15.5mm,heightrounded]{geometry}     \usepackage[T1]{fontenc}     \usepackage[notes]{biblatex-chicago}     \usepackage{filecontents}     \usepackage{microtype}     \usepackage{url}     \usepackage{makeidx}     \usepackage{indentfirst}     \usepackage{setspace}     \usepackage{chngcntr}\counterwithin*{footnote}{section}     \newcommand*{\textsubscript}[1]{$#1{}$}     \DefineBibliographyStrings{english}{references = {Works Cited}}     \DeclareBibliographyCategory{primary}     \makeindex     \addbibresource{bibliography.bib}     \makeatletter     \let\latexl@section\l@section     \def\l@section#1#2{\begingroup\let\numberline\@gobble\latexl@section{#1}{#2}\endgroup}     \def\@seccntformat#1{\ifcsname #1format\endcsname\else\csname the#1\endcsname\quad\fi}     \def\sectionformat{}     \def\subsectionformat{}     \def\subsubsectionformat{}     \makeatother     \author{}     \title{\vspace*{36 pt}\textbf{\emph{\Huge{Big Important Title}}}\vfill}     \date{}     \begin{document}     \tableofcontents     \section{Part I}     Hello World     \end{document} What are the best ways to improve a site's position in Google? What are the best ways to improve a site's position in the Google search results? I am writing an article in English, with some pages in Russian.  \documentclass[12pt]{article}  \usepackage[T1,T2A]{fontenc}  \usepackage[utf8]{inputenc}  \usepackage[russian,english]{babel}  \usepackage{newtxmath} \usepackage{newtxtext} \begin{document}  hello \textbf{hello}  \selectlanguage{russian} привет \textbf{привет}  \end{document}   Output:  hello hello привет привет  I am using \selectlanguage{} to switch between languages when needed.  However, I noticed that when I try to use \textbf{} when in Russian language mode, it does not work because of newtxtext, which I am using for math formulas.  Does anyone know how to solve this problem?  Thank you. I have strange problem. My Wallch icon is huge. See the screenshot:    I removed XFCE settings and reordered items a little. How can I restore normal Wallch icon size?  Update:  My /usr/share/applications/wallch-nautilus.desktop file:  [Desktop Entry] Version=4 Name=Wallch Comment=Change desktop wallpapers automatically Exec=/usr/bin/wallch %U Icon=wallch Terminal=false Type=Application Categories=Utility;Application; MimeType=inode/directory;  Actions=Change_Wallpaper;Start;  [Desktop Action Change_Wallpaper] Name=Change Wallpaper Once Exec=/usr/bin/wallch --change TargetEnvironmet=Unity  [Desktop Action Start] Name=Start/Stop Wallpapers Exec=/usr/bin/wallch --start TargetEnvironment=Unity   And the /usr/share/pixmaps/wallch.png: Noun for "receive"? Receipt?  Receiving?  I'm trying to come up with a name for "the acceptance of a delivery."  I'd like to be able to say      Ten deliveries were made but there are only five [fill_in_the_blank_here] on record.   Any suggestions? Infinite Geometric Series Formula Derivation Why does friction play the role of centripetal force during the turning of a car? How to calculate bounce angle? I played around with it for a while, but I simply can't figure it out.  I made a tank that fires missiles, and when the missiles hit the walls, I want them to bounce off, but I want them to bounce off to the right angle.  Right now I haven't got any obstacles, the missiles just bounce off when they get outside the viewportRectangle I made.  Is the solution I'm looking for quite advanced?  Is there a relativly simple way to do it? What is the simplest SQL Query to find the second largest value? I am trying to follow the  and . I tried to push some of my Lightning components which depend on a managed package in App Exchange. I would like to know how to install a managed package using Salsforce DX CLI so that i can use that command in my travis.YML file for my CI integration.  Here is the script for my Travis file  sudo: true dist: trusty cache: false env: - URL=https://developer.salesforce.com/media/salesforce-cli/sfdx-linux- amd64.tar.xz before_install:  - export SFDX_AUTOUPDATE_DISABLE=true - export SFDX_USE_GENERIC_UNIX_KEYCHAIN=true - export SFDX_DOMAIN_RETRY=300 - wget -qO- $URL | tar xJf - - "./sfdx/install" - export PATH=./sfdx/$(pwd):$PATH - sfdx update - sfdx force:auth:jwt:grant --clientid $CONSUMERKEY --jwtkeyfile  assets/server.key --username $USERNAME --setdefaultdevhubusername -a DevHub script: - sfdx force:org:create -f config/project-scratch-def.json -s -a  PackageInstallation - sfdx force:org:list - sfdx force:org:display - sfdx force:user:password:generate -u PackageInstallation - sfdx force:org:display - sfdx force:org:open -u PackageInstallation - sfdx force:source:push -u PackageInstallation - sfdx force:apex:test:run -u PackageInstallation -c -r human   I get the following error as my components depend on the app exchange components:     No COMPONENT named markup://ldt:datatableDev found : Water Wars: Time Travel TV Show? For a submerged object, buoyant force ($F_b$) is defined as:  $$F_b = V_{\text{submerged}} \times \rho \text{ (density)} \times g \text{ (gravitational constant)}$$   Conceptually, the buoyant force equation says that buoyant force exerted is equal to the weight of the volume of water a given object displaced. Why? I went online to   and found the following explanation, but it seems like non-sequitur to me:      Explanation: When an object is removed, the volume that the object occupied will fill with fluid. This volume of fluid must be supported by the pressure of the surrounding liquid since a fluid can not support itself. When no object is present, the net upward force on this volume of fluid must equal to its weight, i.e. the weight of the fluid displaced. When the object is present, this same upward force will act on the object. How to proof that $\forall n \ge 1: \sum_{i=1}^n (i(i+1))^{-1} = n(n+1)^{-1}$ using mathematical induction So for a better presentation:   I need to prove this using mathematical induction, so i started with a base of $n=1$  Since $i$ starts at $i = 1$ I got this:  $$\frac{1}{i(i+1)} = \frac{n}{n+1}$$ $$\frac{1}{2} = \frac{1}{2}$$  So since this was true I went to the induction part: I chose $n = k$ and assumed this was true:  $$\frac{1}{i(i+1)} = \frac{n}{n+1}$$ $$\frac{1}{i(i+1)} = \frac{k}{k+1}$$  but I got stuck here since I didn't know if I needed to increment $i$ or not and because I didn't know if I needed to add the summation symbol or not and needed to do a few things with it. Copying applications from applications folder to external and reinstalling osx Is it possible to copy all my applications from the applications folder onto an external, format my mac, reinstall OS X and finally copy the applications back into the applications folder for installing them?  Will that work? I am asking because my macbook seems to be behaving in a very odd manner, has become excessively sluggish and is preventing me from recording anything in logic.. I have tried the usual freeing up space, clean desktop, fixing permissions, verifying and repairing disk as well as resetting pram and making sure I have all the latest software and firmware updates. The macbook is only 8 months old and is running Lion with 8gb of ram, I really cannot understand what is wrong with it. Even when trying to watch a movie, the player will get serious audio/video synchronisation issues and I noticed that every time my wifi is on the fans speed up like a plane taking off. I even checked and it is clean from any dust. I am perplexed :(   If anyone could help me please, I would greatly appreciate it.  Thanks in advance! Why the switch statement cannot be applied on strings? Compiling the following code and got the error of type illegal.  int main() {     // Compilation error - switch expression of type illegal     switch(std::string("raj"))     {     case"sda":     } }   You cannot use string in either switch or case. Why? Is there any solution that works nicely to support logic similar to switch on strings? How can I maximize the "blurry background, sharp subject" (bokeh) effect? I know that this effect occurs when there's a shallow depth of field.  My question is, what are the various ways I can increase this effect in my photos when I'm taking them?    Note that I'm not asking  how to use an editing program to achieve this effect after in post production or after the image is captured. Can I use Mage Hand to fly by Polymorphing myself and picking myself up with the hand? Could I first cast Mage Hand, then Polymorph into a Tiny creature less than 10 pounds then use the Mage Hand to pick myself up and fly at 30 Ft per turn?  Polymorph says:     The new form can be any beast ... The target's game statistics,   including mental ability scores, are replaced by the statistics of the   chosen beast. It retains its alignment and personality ... The   creature is limited in the actions it can perform by the nature of its   new form and it can't speak, cast spells, or take any other action   that requires hands or speech.   This keeps me from casting spells, which keeps me from just casting Mage Hand to fly as long as I want to over and over. But for that initial duration of the Mage Hand cantrip, could I use the Mage Hand to fly as a Tiny polymorphed creature until the spell runs out? Hey I want to connect the bottom loop with the top loop so that it forms a solid.  I have tried selecting multiple vertices and pressing F but that just creates a large face which I do not want. I have tried using grid fill bu that doesn't work either. The solution that seems to work is by selecting four vertices and pressing F and then selecting the next 4 and pressing F and on and on. That just takes too long. Why doesn't C# support implied generic types on class constructors? C# doesn't require you to specify a generic type parameter if the compiler can infer it, for instance:  List&lt;int&gt; myInts = new List&lt;int&gt; {0,1,1,     2,3,5,8,13,21,34,55,89,144,233,377,     610,987,1597,2584,4181,6765};  //this statement is clunky List&lt;string&gt; myStrings = myInts.     Select&lt;int,string&gt;( i =&gt; i.ToString() ).     ToList&lt;string&gt;();  //the type is inferred from the lambda expression //the compiler knows that it's taking an int and  //returning a string List&lt;string&gt; myStrings = myInts.     Select( i =&gt; i.ToString() ).     ToList();   This is needed for anonymous types where you don't know what the type parameter would be (in intellisense it shows up as 'a) because it's added by the compiler.  Class-level type parameters don't let you do this:  //sample generic class public class GenericDemo&lt;T&gt;  {     public GenericDemo ( T value )      {         GenericTypedProperty = value;     }      public T GenericTypedProperty {get; set;} }  //why can't I do: int anIntValue = 4181; var item = new GenericDemo( anIntValue ); //type inference fails  //however I can create a wrapper like this: public static GenericDemo&lt;T&gt; Create&lt;T&gt; ( T value ) {     return new GenericDemo&lt;T&gt; ( value ); }  //then this works - type inference on the method compiles var item = Create( anIntValue );   Why doesn't C# support this class level generic type inference?