formatting

Excel date changed (month and day swapped) after reading and writing with VBA

走远了吗. 提交于 2020-01-30 05:41:05
问题 I wrote two lines of simple VBA codes to read from and write a date to a cell, but unexpectedly the month and day swapped after the run. The steps are: Enter a date "1/11/2017" in the cell A1. The date is now displayed as "01/11/2017". Run the following lines of code: Dim s As String s = Cells(1, 1).value Cells(2, 1).value = s The cell B1 now displays "11/01/2017" with the month and day swapped. My short date format setting in Region in Windows is "dd/MM/yyyy" so the string s stores the value

Python padding strings of different length

放肆的年华 提交于 2020-01-25 22:54:07
问题 So I have a problem I know can be solved with string formatting but I really don't know where to start. What I want to do is create a list that is padded so that there is n number of characters before a comma as in the list below. 1148, 39, 365, 6, 56524, Cheers and thanks for your help :) 回答1: The most straight-forward way is to use the str.rjust() function. For example: your_list = [1148, 39, 365, 6, 56524] for element in your_list: print(str(element).rjust(5)) And you get: 1148 39 365 6

vim c++ break line

陌路散爱 提交于 2020-01-25 13:14:09
问题 How can I break long lines when writing c++ code in vim? For example, if I have something like 56 fprintf(stderr, "Syntax error reading recursion value on 57 line %d in file %s\n", line_count, filename); I get the following compile errors: :56:25: warning: missing terminating " character :56: error: missing terminating " character :57: error: stray ‘\’ in program :57:37: warning: missing terminating " character :57: error: missing terminating " character I'm a vim newbie. Thanks! 回答1: Like

How do I set up VSCode to put curly braces on a new line in C# and C++ while typing?

烈酒焚心 提交于 2020-01-25 10:18:06
问题 I want VS Code to put curly braces on a new line in C# and C++ How it works now How it should look Tried C# FixFormat extension, but it works only after I push CTRL+K+F but I want VS Code to make curly braces on new lines while I'm coding, without additional steps like hotkeys and such 回答1: On VSCode, Go to File\Preferences\Settings and search for 'curly'. Enable all four typescripts as given in the image. 回答2: From Preferences/Settings, choose c# FixFormat and uncheck the checkbox (Braces:

vertical alignment for FORM INPUT FIELDS in safari and chrome

混江龙づ霸主 提交于 2020-01-25 06:29:44
问题 i have a select box with height: 60px. when i user clicks an option, i would want that option text to appear on the lower bottom of the select box...however safari and chrome automatically vertically aligns the text in the middle. I have tried increasing line-height, padding-top, margin-top...but these do NOT work for safari/chrome. please help, if this type of styling in "impossible" for safari/chrome. please let me know as well. Thanks in advance! 回答1: Unfortunately you can't style select

Python: how to escape “%s”

空扰寡人 提交于 2020-01-25 02:47:08
问题 I'm trying to make a string that includes a "%s" with no formatting For example, I want this: #I want to make mystring = "x %s" first_value = "x" mystring = "%s %s" % first_value So, I want to format the first %s, but leave the second %s in the string.. Of course the above code gives me a "TypeError:not enough arguments for format string" Is there a way to achieve this in one line? Thanks EDIT: I know I can do mystring = "%s %s" % (first_value, "%s") but this kind of looks ugly.. Is there a

Invoke-Command on remote session returns local values

倾然丶 夕夏残阳落幕 提交于 2020-01-23 17:58:13
问题 Question Should the script block of Invoke-Command , when run with a PSSession, always run on the remote computer? Context I ran the below powershell against a list of servers: Clear-Host $cred = get-credential 'myDomain\myUsername' $psSessions = New-PSSession -ComputerName @(1..10 | %{'myServer{0:00}' -f $_}) -Credential $cred Invoke-Command -Session $psSessions -ScriptBlock { Get-Item -Path 'HKLM:\System\CurrentControlSet\Control\Lsa\Kerberos\Parameters' } | Sort-Object PSComputerName #

How can I make a part of text bold in an MS Word table cell?

混江龙づ霸主 提交于 2020-01-23 17:46:07
问题 I have a C# application which uses an MS Word document. I have tables where some of the text in a cell needs to be bold . Is there a way to do it? 回答1: I assume you are using Microsoft Office Interop. The example which I found on: http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=48632 says: using Microsoft.Office.Interop.Word; using Microsoft.Office.Core; Document varDoc = varWord.Documents.Add(ref varMissing, ref varMissing, ref varMissing, ref varTrueValue); varDoc.Activate();

Java Logger Console Stream Duplicate Output

六眼飞鱼酱① 提交于 2020-01-23 06:36:44
问题 I hope this question has a simple answer. I am trying to add a logger to my Java application. I was able to format the log file perfectly, but I ran into an issue when trying to add a ConsoleHandler to the logger to format the console output. Once I added the ConsoleHandler, every log message is not printed out three times, twice with the proper formatting I want, and then once with the original format that I do not want. Ill post my code below, not sure at all what I am doing wrong. Any help

hex << setw() << setfill() doesn't work with pointer value output

旧巷老猫 提交于 2020-01-23 03:44:06
问题 Win7 - 64 cygwin Netbeans 7.4 gcc (cygwin) 4.8.3 Compiler call g++ -Wall -Wno-reorder -Wno-unused-value -c -g -MMD -MP -MF Any reason that the output and the expected output are different? I did not expect the "0x" prefix. Output << SlipHashEntry::create 0x22a000 list3 Expected << SlipHashEntry::create 0x000000000022a000 list3 Output << SlipDescription::delete 0x600062d50 list5 Expected << SlipDescription::delete 0x0000000600062d50 list5 Here's the relevant code snippet SlipHashEntry: