Align cout format as table’s columns

setw. #include <iostream> #include <iomanip> using namespace std; int main () { cout << setw(21) << left << “Test” << 1 << endl; cout << setw(21) << left << “Test2” << 2 << endl; cout << setw(21) << left << “Iamlongverylongblah” << 2 << endl; cout << setw(21) << left << “Etc” << 1 << … Read more

Easy way to convert exec sp_executesql to a normal query?

I spent a little time making an simple script that did this for me. It’s a WIP, but I stuck a (very ugly) webpage in front of it and it’s now hosted here if you want to try it: http://execsqlformat.herokuapp.com/ Sample input: exec sp_executesql N’SELECT * FROM AdventureWorks.HumanResources.Employee WHERE ManagerID = @level’, N’@level tinyint’, @level … Read more

VS code Format Code command and shortcut Shift+Alt+F doesn’t work

I guess you are asking for MacOs because by default shortcut for code formatting is different for different Os. Now there might be an issue with the keyboard layout. For example Option+Shift+F does not work in ABC-Indian layout, you need to change that. Go to System-prefrences->Keyboard->Input Sources-> Add layout “ABC” and delete the old one.

How to format traceback objects in Python

format_exc() is really just etype, value, tb = sys.exc_info() return ”.join(format_exception(etype, value, tb, limit)) So if you have the exception type, value, and traceback ready, it should be easy. If you have just the exception, notice that format_exception() is essentially: a_list = [‘Traceback (most recent call last):\n’] a_list = a_list + format_tb(tb, limit) where limit … Read more

How to get the raw ‘created_at’ value in the database (not an object cast to an ActiveSupport::TimeWithZone)

use attributes_before_type_cast Post.find(23).attributes_before_type_cast[“created_at”] or Post.find(23).read_attribute_before_type_cast(“created_at”) Edit You can call like this also: Post.find(23).created_at_before_type_cast according to Accessing attributes before they have been typecasted.

How to change tick label font size

There is a simpler way actually. I just found: import matplotlib.pyplot as plt # We prepare the plot fig, ax = plt.subplots() # We change the fontsize of minor ticks label ax.tick_params(axis=”both”, which=”major”, labelsize=10) ax.tick_params(axis=”both”, which=”minor”, labelsize=8) This only answers to the size of label part of your question though.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)