How do I modify a .sln file with Yeoman? - node.js

I am using Yeoman to create new projects in my Visual Studio solution. I can already generate .csproj and source files, but I can't figure out an easy way to register the project in the solution.
.sln files are not XML, they have their own format. I would need to insert something like this in two sections of the file:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCoolComponent", "\MyCoolComponent\code\MyCoolComponent.csproj", "{709C3622-1F4D-417C-9103-3882154ACBFD}"
EndProject
...
{709C3622-1F4D-417C-9103-3882154ACBFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{709C3622-1F4D-417C-9103-3882154ACBFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{709C3622-1F4D-417C-9103-3882154ACBFD}.Debug|x64.ActiveCfg = Debug|Any CPU
{709C3622-1F4D-417C-9103-3882154ACBFD}.Debug|x64.Build.0 = Debug|Any CPU
{709C3622-1F4D-417C-9103-3882154ACBFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{709C3622-1F4D-417C-9103-3882154ACBFD}.Release|Any CPU.Build.0 = Release|Any CPU
{709C3622-1F4D-417C-9103-3882154ACBFD}.Release|x64.ActiveCfg = Release|Any CPU
{709C3622-1F4D-417C-9103-3882154ACBFD}.Release|x64.Build.0 = Release|Any CPU
Is there, perhaps, a NodeJS library that can help me with modifying .sln files?

Related

dotnet restore/build fails on linux with error MSB3202, the project file "PARENT_DIR/YYY.proj" was not found [PARENT_DIR/YYY.sln]

I am building simple .net core solution which contains two projects. Here's the sln file
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32930.78
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataAccess", "DataAccess\DataAccess.csproj", "{A2215C05-2906-47D8-A51E-986167EED172}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "Common\Common.csproj", "{5D3617CC-A0CC-437F-96CC-D64B6F23A668}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A2215C05-2906-47D8-A51E-986167EED172}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2215C05-2906-47D8-A51E-986167EED172}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2215C05-2906-47D8-A51E-986167EED172}.Debug|x64.ActiveCfg = Debug|Any CPU
{A2215C05-2906-47D8-A51E-986167EED172}.Debug|x64.Build.0 = Debug|Any CPU
{A2215C05-2906-47D8-A51E-986167EED172}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2215C05-2906-47D8-A51E-986167EED172}.Release|Any CPU.Build.0 = Release|Any CPU
{A2215C05-2906-47D8-A51E-986167EED172}.Release|x64.ActiveCfg = Release|Any CPU
{A2215C05-2906-47D8-A51E-986167EED172}.Release|x64.Build.0 = Release|Any CPU
{5D3617CC-A0CC-437F-96CC-D64B6F23A668}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D3617CC-A0CC-437F-96CC-D64B6F23A668}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D3617CC-A0CC-437F-96CC-D64B6F23A668}.Debug|x64.ActiveCfg = Debug|Any CPU
{5D3617CC-A0CC-437F-96CC-D64B6F23A668}.Debug|x64.Build.0 = Debug|Any CPU
{5D3617CC-A0CC-437F-96CC-D64B6F23A668}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D3617CC-A0CC-437F-96CC-D64B6F23A668}.Release|Any CPU.Build.0 = Release|Any CPU
{5D3617CC-A0CC-437F-96CC-D64B6F23A668}.Release|x64.ActiveCfg = Release|Any CPU
{5D3617CC-A0CC-437F-96CC-D64B6F23A668}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5EECAB02-1A61-4FAD-9E00-5B1292E418E6}
EndGlobalSection
EndGlobal
When I run dotnet restore/build from the solution directory on my Windows machine, everything goes as expected and the output is the following
dotnet build
MSBuild version 17.3.2+561848881 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
Common -> C:\git\Common\bin\Debug\netstandard2.1\Common.dll
Common -> C:\git\Common\bin\Debug\netstandard2.0\Common.dll
DataAccess -> C:\git\DataAccess\bin\Debug\netstandard2.0\DataAccess.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:03.08
When I am trying to run the same process from the Docker container it fails with the following message
PS /App> pwd
Path
----
/App
PS /App> dotnet build
MSBuild version 17.3.2+561848881 for .NET
/usr/share/dotnet/sdk/6.0.405/NuGet.targets(369,5): error MSB3202: The project file "/App/Common/Common.csproj" was not found. [/App/My.sln]
Build FAILED.
/usr/share/dotnet/sdk/6.0.405/NuGet.targets(369,5): error MSB3202: The project file "/App/Common/Common.csproj" was not found. [/App/My.sln]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.24
I am running the process on
PS /> cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
EDIT 1
Here is my Dockerfile content
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /App
COPY . ./
RUN dotnet nuget add source 'https://pkgs.dev.azure.com/myorg/_packaging/2bba9c97-9acb-40b5-aa6c-17e17617e3aa/nuget/v3/index.json' -u 'tst' -p 'XXXXXXXXX' --store-password-in-clear-text
RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
&& apt-get update && apt-get install -y powershell
EDIT 2
If I am running the build on container from individual projects folder, not from solution directory it works as expected
PS /App/Common> pwd
Path
----
/App/Common
PS /App/Common> dotnet build
MSBuild version 17.3.2+561848881 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
Common -> /App/common/bin/Debug/netstandard2.1/Common.dll
Common -> /App/common/bin/Debug/netstandard2.0/Common.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.67
EDIT 3
I can also confirm that the project file exists inside the container
PS /> pwd
Path
----
/
PS /> ls /App/common/Common.csproj
/App/common/Common.csproj
The issue was case sensitivity of the path.
C:\git\Common
vs
"Common\Common.csproj"
recorder in solution file

How to Fully Utilize CPU cores for skopt.forest_minimize

So I have the following code for running skopt.forest_minimize(), but the biggest challenge I am facing right now is that it is taking upwards of days to finish running even just 2 iterations.
SPACE = [skopt.space.Integer(4, max_neighbour, name='n_neighbors', prior='log-uniform'),
skopt.space.Integer(6, 10, name='nr_cubes', prior='uniform'),
skopt.space.Categorical(overlap_cat, name='overlap_perc')]
#skopt.utils.use_named_args(SPACE)
def objective(**params):
score, scomp = tune_clustering(X_cont=X_cont, df=df, pl_brewer=pl_brewer, **params)
if score == 0:
print('saving new scomp')
with open(scomp_file, 'w') as filehandle:
json.dump(scomp, filehandle, default = json_default)
return score
results = skopt.forest_minimize(objective, SPACE, n_calls=1, n_initial_points=1, callback=[scoring])
Is it possible to optimize the following code so that it can compute faster? I noticed that it was barely making use of my CPU, highest CPU utilized is about 30% (it's i7 9th gen with
8 cores).
Also a question while I'm at it, is it possible to utilize a GPU for these computational tasks? I have a 3050 that I can use.

VM entry (vmlaunch) with invalid control field

I am learning Intel VMX with a Linux based VMM.
I found 'vmlaunch' instruction failed with vm instruction error of 7.
I checked Intel's SDM, it means 'VM entry with invalid control field'.
I double checked the VM_entry_control, VM_exit_control, VM_exec_control, but could NOT find anything wrong.
I am using EPTP for VM execution (VM is in real mode).
Below is the control fields, and VMX capabilities.
Host CPU info is as follows.
Linux kernel is 3.10, and 4.4.0.
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU E5-2620 v3 # 2.40GHz
stepping : 2
microcode : 0x37
cpu MHz : 2391.223
cache size : 15360 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
<pre>
0x0000001F = control_VMX_pin_based
0xA50061F2 = control_VMX_cpu_based
0x00000082 = control_VMX_proc2_based
0x00000000 = control_exception_bitmap
0x00000000 = control_pagefault_errorcode_mask
0xFFFFFFFF = control_pagefault_errorcode_match
0x00000002 = control_CR3_target_count
0x00036FFB = control_VM_exit_controls
0x000011FB = control_VM_entry_controls
0x00000000 = control_VM_entry_interruption_information
0x00000000 = control_VM_entry_exception_errorcode
0x00000000 = control_VM_entry_instruction_length
0x0000000000000020 = control_CR0_mask
0x0000000000002000 = control_CR4_mask
0x0000000000000020 = control_CR0_shadow
0x0000000000002000 = control_CR4_shadow
0x0000000000000000 = control_CR3_target0
0x0000000124FCE000 = control_CR3_target1
0x0000000000000000 = control_CR3_target2
0x0000000000000000 = control_CR3_target3
Host VMX capabilities are as follows,
VMX-Capability Model-Specific Registers
00D8100000000001 = IA32_VMX_BASIC_MSR
0000003F00000016 = IA32_VMX_PINBASED_CTLS_MSR
FFF9FFFE0401E172 = IA32_VMX_PROCBASED_CTLS_MSR
0033FFFF00036DFF = IA32_VMX_EXIT_CTLS_MSR
0000B3FF000011FF = IA32_VMX_ENTRY_CTLS_MSR
00000000000401E0 = IA32_VMX_MISC_MSR
0000000080000021 = IA32_VMX_CR0_FIXED0_MSR
00000000FFFFFFFF = IA32_VMX_CR0_FIXED1_MSR
0000000000002000 = IA32_VMX_CR4_FIXED0_MSR
00000000000427FF = IA32_VMX_CR4_FIXED1_MSR
000000000000005A = IA32_VMX_VMCS_ENUM_MSR
000000EE00000000 = IA32_VMX_PROCBASED_CTLS2
00000F0106114041 = IA32_VMX_EPT_VPID_CAP
0000003F00000016 = IA32_VMX_TRUE_PINBASED_CTLS
FFF9FFFE04006172 = IA32_VMX_TRUE_PROCBASED_CTLS
0033FFFF00036DFB = IA32_VMX_TRUE_EXIT_CTLS
0000B3FF000011FB = IA32_VMX_TRUE_ENTRY_CTLS
I don’t see anything wrong in the fields you provided, but there are more checks on fields you haven’t listed. For example, Use MSR bitmap is 1, but you don’t show the value of the MSR bitmap address.
You should go through all the checks in section 26.2.1.
I suggest also looking at any checks related to unrestricted-guest. It is recommended that you set the controls to save and restore EFER in the exit and entry controls.
By checking the VMCS fields, i found the invalid control came from the EPTP.
In that CPU, it does NOT support 'dirty/access' bit to be 1 in EPTP (bit 6).
After set that bit to 0, there is NO 'invalid control fields' error.

Jvm is using more memory than Native Memory Tracking says, how do I locate where the extra meeory goes? [duplicate]

This question already has answers here:
Java process memory usage (jcmd vs pmap)
(3 answers)
Where do these java native memory allocated from?
(1 answer)
Closed 5 years ago.
I'm running jetty on my web server. My current jvm setting: -Xmx4g -Xms2g, however jetty uses a lot more memory and I don't know where these extra memory goes.
Jetty uses 4.547g memory in total:
heap usage shows heap memory usage at 2.5g:
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 483196928 (460.8125MB)
used = 277626712 (264.76546478271484MB)
free = 205570216 (196.04703521728516MB)
57.45622455612963% used
Eden Space:
capacity = 429522944 (409.625MB)
used = 251267840 (239.627685546875MB)
free = 178255104 (169.997314453125MB)
58.4992824038755% used
From Space:
capacity = 53673984 (51.1875MB)
used = 26358872 (25.137779235839844MB)
free = 27315112 (26.049720764160156MB)
49.109214624351345% used
To Space:
capacity = 53673984 (51.1875MB)
used = 0 (0.0MB)
free = 53673984 (51.1875MB)
0.0% used
concurrent mark-sweep generation:
capacity = 2166849536 (2066.46875MB)
used = 1317710872 (1256.6670150756836MB)
free = 849138664 (809.8017349243164MB)
60.81229222922842% used
Still 2g missing, then I use Native Memory Tracking, it shows:
Total: reserved=5986478KB, committed=3259678KB
- Java Heap (reserved=4194304KB, committed=2640352KB)
(mmap: reserved=4194304KB, committed=2640352KB)
- Class (reserved=1159154KB, committed=122778KB)
(classes #18260)
(malloc=4082KB #62204)
(mmap: reserved=1155072KB, committed=118696KB)
- Thread (reserved=145568KB, committed=145568KB)
(thread #141)
(stack: reserved=143920KB, committed=143920KB)
(malloc=461KB #707)
(arena=1187KB #280)
- Code (reserved=275048KB, committed=143620KB)
(malloc=25448KB #30875)
(mmap: reserved=249600KB, committed=118172KB)
- GC (reserved=25836KB, committed=20792KB)
(malloc=11492KB #1615)
(mmap: reserved=14344KB, committed=9300KB)
- Compiler (reserved=583KB, committed=583KB)
(malloc=453KB #769)
(arena=131KB #3)
- Internal (reserved=76399KB, committed=76399KB)
(malloc=76367KB #25878)
(mmap: reserved=32KB, committed=32KB)
- Symbol (reserved=21603KB, committed=21603KB)
(malloc=17791KB #201952)
(arena=3812KB #1)
- Native Memory Tracking (reserved=5096KB, committed=5096KB)
(malloc=22KB #261)
(tracking overhead=5074KB)
- Arena Chunk (reserved=190KB, committed=190KB)
(malloc=190KB)
- Unknown (reserved=82696KB, committed=82696KB)
(mmap: reserved=82696KB, committed=82696KB)
Still does't explain where memory goes, can someone shed light on how to locate the missing memory?

linux softlockup in memory

My system is a embedded linux system(running kernel version 2.6.18). A client process send data to mysql server. The data will be stored in mysql database at a RAID5 assembled by four disks. The IO pressure(wa%) is always above 20% , mysql CPU utilization is very high.
After running 5 or 6 hours, the system run into softlock up stat.
The stack information is about releasing the physical memory, writing cache data to the hard disk.
Any suggestions in this circumstance?**
BUG: soft lockup detected on CPU#0!
[<c043dc1c>] softlockup_tick+0x8f/0xb1
[<c0428cb5>] update_process_times+0x26/0x5c
[<c0411256>] smp_apic_timer_interrupt+0x5d/0x67
[<c04044e7>] apic_timer_interrupt+0x1f/0x24
[<c06fe0b9>] _spin_lock+0x5/0xf
[<c047db2a>] __mark_inode_dirty+0x50/0x176
[<c0424eef>] current_fs_time+0x4d/0x5e
[<c0475ccd>] touch_atime+0x51/0x94
[<c0440926>] do_generic_mapping_read+0x425/0x563
[<c044134b>] __generic_file_aio_read+0xf3/0x267
[<c043fcd0>] file_read_actor+0x0/0xd4
[<c04414fb>] generic_file_aio_read+0x3c/0x4d
[<c045d72d>] do_sync_read+0xc1/0xfd
[<c0431656>] autoremove_wake_function+0x0/0x37
[<c045e0e8>] vfs_read+0xa4/0x167
[<c045d66c>] do_sync_read+0x0/0xfd
[<c045e688>] sys_pread64+0x5e/0x62
[<c0403a27>] syscall_call+0x7/0xb
=======================
BUG: soft lockup detected on CPU#2!
[<c043dc1c>] softlockup_tick+0x8f/0xb1
[<c0428cb5>] update_process_times+0x26/0x5c
[<c0411256>] smp_apic_timer_interrupt+0x5d/0x67
[<c04044e7>] apic_timer_interrupt+0x1f/0x24
[<c06fe0bb>] _spin_lock+0x7/0xf
[<c04aaf17>] journal_try_to_free_buffers+0xf4/0x17b
[<c0442c52>] find_get_pages+0x28/0x5d
[<c049c4b1>] ext3_releasepage+0x0/0x7d
[<c045f0bf>] try_to_release_page+0x2c/0x46
[<c0447894>] invalidate_mapping_pages+0xc9/0x167
[<c04813b0>] drop_pagecache+0x86/0xd2
[<c048144e>] drop_caches_sysctl_handler+0x52/0x64
[<c04813fc>] drop_caches_sysctl_handler+0x0/0x64
[<c042623d>] do_rw_proc+0xe8/0xf4
[<c0426268>] proc_writesys+0x1f/0x24
[<c045df81>] vfs_write+0xa6/0x169
[<c0426249>] proc_writesys+0x0/0x24
[<c045e601>] sys_write+0x41/0x6a
[<c0403a27>] syscall_call+0x7/0xb
=======================
BUG: soft lockup detected on CPU#1!
[<c043dc1c>] softlockup_tick+0x8f/0xb1
[<c0428cb5>] update_process_times+0x26/0x5c
[<c0411256>] smp_apic_timer_interrupt+0x5d/0x67
[<c04044e7>] apic_timer_interrupt+0x1f/0x24
[<c06f007b>] inet_diag_dump+0x804/0x821
[<c06fe0bb>] _spin_lock+0x7/0xf
[<c047db2a>] __mark_inode_dirty+0x50/0x176
[<c043168d>] wake_bit_function+0x0/0x3c
[<c04ae0f6>] __journal_remove_journal_head+0xee/0x1a5
[<c0445ae8>] __set_page_dirty_nobuffers+0x87/0xc6
[<c04a908e>] __journal_unfile_buffer+0x8/0x11
[<c04ab94d>] journal_commit_transaction+0x8e0/0x1103
[<c0431656>] autoremove_wake_function+0x0/0x37
[<c04af690>] kjournald+0xa9/0x1e5
[<c0431656>] autoremove_wake_function+0x0/0x37
[<c04af5e7>] kjournald+0x0/0x1e5
[<c04314da>] kthread+0xde/0xe2
[<c04313fc>] kthread+0x0/0xe2
[<c0404763>] kernel_thread_helper+0x7/0x14
=======================
BUG: soft lockup detected on CPU#3!
[<c043dc1c>] softlockup_tick+0x8f/0xb1
[<c0428cb5>] update_process_times+0x26/0x5c
[<c0411256>] smp_apic_timer_interrupt+0x5d/0x67
[<c04044e7>] apic_timer_interrupt+0x1f/0x24
[<c06fe0bb>] _spin_lock+0x7/0xf
[<c047db2a>] __mark_inode_dirty+0x50/0x176
[<c0424eef>] current_fs_time+0x4d/0x5e
[<c0475ccd>] touch_atime+0x51/0x94
[<c0440926>] do_generic_mapping_read+0x425/0x563
[<c044134b>] __generic_file_aio_read+0xf3/0x267
[<c043fcd0>] file_read_actor+0x0/0xd4
[<c04414fb>] generic_file_aio_read+0x3c/0x4d
[<c045d72d>] do_sync_read+0xc1/0xfd
[<c0431656>] autoremove_wake_function+0x0/0x37
[<c045e0e8>] vfs_read+0xa4/0x167
[<c045d66c>] do_sync_read+0x0/0xfd
[<c045e688>] sys_pread64+0x5e/0x62
[<c0403a27>] syscall_call+0x7/0xb
=======================
Seriously, try something newer. 2.6.18 is >7 years old.
Looks like CPU#1 and CPU#3 are spinning in a spinlock on a inode structure.

Resources