How can one create new scopes in python

In many languages (and places) there is a nice practice of creating local scopes by creating a block like this. void foo() { ... Do some stuff ... if(TRUE) { char a; ...

How should I use Outlook to send code snippets?

As a programmer at a big corporation, I frequently send Outlook emails that contain code samples. I'll actually type code directly into an email. This inevitably causes problems, as Outlook...

How to print a list in Python "nicely"

In PHP, I can do this: echo '<pre>' print_r($array); echo '</pre>' In Python, I currently just do this: print the_list However, this will cause a big jumbo of data. Is there any way to print...

Is there an easy way to return a string repeated X number of times?

I'm trying to insert a certain number of indentations before a string based on an items depth and I'm wondering if there is a way to return a string repeated X times. Example: string indent =...

Printing additional output in Google Test

I'm using the googletest C++ testing framework. Normally the textual output of running a test looks like this: [ RUN ] MyTest.Fuzz [ OK ] MyTest.Fuzz (1867 ms) I would like to output...

How to auto-indent code in the Atom editor?

How do you auto-indent your code in the Atom editor? In other editors you can usually select some code and auto-indent it. Is there a keyboard shortcut as well?

Generate pdf file using pdfkit and send it to browser in nodejs-expressjs

I am using pdfkit to generate pdf file and i want to send this pdf file to browser. But i am getting message `"TypeError: listener must be a function",` Also, file is getting generate in my...

Python Facebook API - cursor pagination

My question involves learning how to retrieve my entire list of friends using Facebook's Python API. The current result returns an object with limited number of friends and a link to the 'next'...

How to use a variable as a column name for a SELECT statement

I am unable to use a previously defined variable representing a column name in a SELECT statement and need some help. TABLE: main | i1 | i2 ||..........| i24 | i25 | . . 17 | 121 | 123|...

Auto indent all code without ctrl+A in MATLAB

One can auto indent all code in a .m file by typing ctrl+A followed by ctrl+I. However, this requires selecting all code which in my MATLAB IDE (R2011a, Linux, with Windows Shortcuts) moves the...

Shortcut to Indent code in delphi 2007

Is there a way to indent the code in delphi? I have to work on a programm that has thousands of lines of code. In eclipse which i had worked before, i have used CTRL + SHIFT + F to format all...

CSRF with Django, React+Redux using Axios

This is an educational project, not for production. I wasn't intending to have user logins as part of this. Can I make POST calls to Django with a CSRF token without having user logins? Can I do...

IntelliJ IDEA Cursor moves to beginning of line when hitting Ctrl-S

The cursor in my IntelliJ code editor always returns to the beginning of the line (removing all whitespace) when I save by hitting Ctrl-S. If I have code on that line and save then move to the...

Eslint expected indentation of 1 tab but found 4 spaces error

I am using VScode with latest version of Eslint. It is my first time using a linter. I keep getting this linting error when using a tab as indentation: severity: 'Error' message: 'Expected...

How to serialize an Exception

When I try to serialize an exception using json.dump, I get errors like TypeError: IOError('socket error', error(61, 'Connection refused')) is not JSON serializable and TypeError: error(61,...

How to parse hierarchy based on indents with python

I have an accounting tree that's stored with indents/spaces in the source: Income Revenue IAP Ads Other-Income Expenses Developers In-house Contractors ...

New to XSL and need some advice

This one however is a bit different, as I have absolutely no clue about XSL, and need to get this template working for our shipping software. I've got this doing what I want for the most part,...

JAVA pretty print XML with properly formatted comments

I have an issue when trying to pretty print xml with properly formatted comments. I generate an xml file from a process and need to add header information to the xml document. This header...

How to limit the number of float digits JSONEncoder produces?

I am trying to set the python json library up in order to save to file a dictionary having as elements other dictionaries. There are many float numbers and I would like to limit the number of...

Pausing and restarting my custom vue slider

I made a custom vue slider and it works so far but I had the idea to add pause/play button to my slider, issue is I don't know how can I handle pausing and resuming setInterval function of my...

Prettier and eslint indents not working together

I traying setup my vim based typescript developing environment, but have an issue with indent management. Probably 'eslint' says: indent: Expected indentation of 2 spaces but found 4. after...

Regex to capture html elements with their class name

I am trying to get the element and class name for all elements within an html file using python. I managed to get all class names with the code below. It's written like that because I will go...

Pandoc: where are CSS files for syntax highlighting code?

I have a Markdown file, e.g. --- title: Question date: 2020-07-07 --- This is some code: ```python def add(a, b): return a+b ``` and I'd like to leverage the syntax highlighting of Pandoc....

How make tinymce able to upload image in vue js

I am using tinymce in my vue js app but it is not allowing me to upload image . i am using this package import Editor from '@tinymce/tinymce-vue' I think i am missing any plugin or tool...

my neovim lsp error message doesn't have a red color

my neovim lsp error message doesn't have a red color :( Here is my vimrc file. I really don't know what issue is. I spent more than 3 hours on this and I'm so done.... syntax on set...

Exception has occurred: JSONDecodeError App Store Connect Financial API using Python

I am trying to get financial data from my APP store connect account and am receiving a JSON error, see below: import requests, time, json from authlib.jose import jwt KEY_ID = "KEY" ISSUER_ID =...

Flask with `import bokeh` with 2 bokeh graphs without external bokeh server and not "Models must be owned by only a single document"

TL;DR I am beginner in bokeh. I've read https://docs.bokeh.org or others examples in stackoverflow and github but I don't find examples in Flask with import bokeh with 2 bokeh graphs without...

Using voila with jupyter notebook, proxied on Apache Server?

I use classic Jupyter Notebook on an Ubuntu 20.04 Server, that runs Apache. Therefore, when Jupyter runs, I do not access it with localhost:8888, but instead it is proxied to myserver.com/subdir;...

How to add a checkbox in pandas dataframe

I have created a dataframe as: import pandas as pd data = [['Ankit'], ['Akshat' ]] df = pd.DataFrame(data, columns = ['Name']) Now, I want to insert a column PPA which has checkbox button as...

Visual Studio 2022 turn off auto indenting

So i upgraded to VS 2022. and anytime i add a semicolon. the whole code block gets backtabbed. does anyone know how to turn this off? getting tired of hitting ctrl z repeatedly.. Before. After