Skip to content

Commit

Permalink
Fixed some markdown issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Apr 20, 2024
1 parent 50ee8de commit f5de2b9
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ So what are the steps to build such an add-in? Below I try to show some technica
<!--more-->

## Visual Studio for Mac

Microsoft announced this new IDE last year at Connect 2016 keynote, which is a surprise for many developers. But if we check this IDE further, easily we can see it is not a surprise at all.

* This IDE is based on MonoDevelop/Xamarin Studio, which has a very long history already.
* It reuses many useful ingredients from Visual Studio itself, such as the editor experience.

## Extension Authoring

Previously to develop extensions for MonoDevelop/Xamarin Studio, we need to target the 5.x or 6.x profiles of MonoDevelop core binaries. That's why for [xUnit.net add-in](https://github.com/xunit/xamarinstudio.xunit) there are two branches, 5.0 and 6.0.

The core assemblies have significant differences in editor related APIs, due to the big upgrade in Xamarin Studio 6.x. And now again, Visual Studio for Mac (based on MonoDevelop 7.x) requires a new branch.
Expand All @@ -42,6 +44,6 @@ Then a `.mpack` file would be generated and everyone can manually add it to Visu

> Note that once the add-in repository for Visual Studio for Mac is alive, you don't need to share `.mpack` file in this way.
Now Microsoft/Xamarin has opened up the addin feed for Visual Studio for Mac, so as publisher you should use https://addins.monodevelop.com to publish your addin. Users then use the integrated Extension Manager to search and install.
Now Microsoft/Xamarin has opened up the addin feed for Visual Studio for Mac, so as publisher you should use [this website](https://addins.monodevelop.com) to publish your addin. Users then use the integrated Extension Manager to search and install.

> Updated (Jan 12, 2023): The latest news can be found in [this post](https://learn.microsoft.com/visualstudio/mac/migrate-extensions?view=vsmac-2022)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permalink: /strange-visual-studio-2017-rc-installation-error-acdce0000c34
excerpt_separator: <!--more-->
---

I met the below issue,
I met the issue below,
<!--more-->
``` text
The product failed to install the listed workloads and components due to one or more package failures.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ So I was planning to take a look once I finally arrived but VS Code 1.9.1 releas
Luckily I had some reliable guy in the VS Code team itself, who kindly informed me the culprit is [a change they made in 1.9.0](https://github.com/Microsoft/vscode/issues/20229) (reverted in 1.9.1), where broken HTML pages won't be loaded into VS Code views.

Thus, can you imagine that Sphinx generates broken HTML pages? Of course not. Let's see one example below,

``` html
<!DOCTYPE html>
<!-- [if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif] -->
Expand Down
2 changes: 1 addition & 1 deletion _posts/2017/2017-3-11-snmp-pro-goes-to-net-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Of course, we have to make a few changes so as to adapt to the new platform, and
We will release a new release (1.3.0 based on current roadmap) when everything is tested out and all confidence is held. But if you are interested in the preview, we now have an insider program.

Please answer the below two questions and send your answers to [email protected] to enroll (yep, that simple),
Please answer the below two questions and send your answers to [our mailbox](mailto:[email protected]) to enroll (yep, that simple),

- Do you have a custom NuGet server/feed where you can host our test NuGet package for this build?
- What is the lowest .NET Standard version your apps require? Is .NET Standard 1.3 OK for them?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ So what's up? Well, many small pieces.

So the final project is [as below](https://github.com/lextm/obfuscar/blob/d7787fa1fe73265d3ce9400dbbe8e9148fe46924/Tests/ObfuscarTests.csproj).

Hope this can save you a few minutes when you hit the same issue.
Hope this can save you a few minutes when you hit the same issue.
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ So if you hit any issue with PHP, your very first task is to identify which proc
* But if you do hit issues caused by `w3wp.exe` and `iisfcgi.dll`, you can contact [Microsoft support](https://support.microsoft.com).

> Update: July 10, 2020. [Microsoft plans](https://news-web.php.net/php.internals/110907) to stop supporting PHP on Windows.
>
> Update: Oct 20, 2023. Since PHP 7.x all reached end of life, PHP on Windows/IIS is no longer supported by Microsoft (I think even if you hit issues with Microsoft components). You should switch to Linux hosting as soon as you can. For example, now if you host an PHP 8.x web app on Microsoft Azure, the underlying OS is Linux.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ Above is a screen shot of Visual Studio 2017, which quite typically shows many o
Well, many people get lost as you do, as there are so many of them. So how should we understand Microsoft's logic behind the scene? I think we can divide all of them into two categories.

## Platform Specific Class Library

Class Library (.NET Framework) has been there for long since .NET Framework 1.0. We have known its rule that any such class library can only be consumed by .NET Framework apps. Such a rule also applies to other project types, targeting iOS/tvOS/watchOS/Android/UWP.

We have to rely on such class library types, as later we will see for cross platform class library types we usually cannot work against all types available on the underlying platforms.

## Cross Platform Class Library

Class Library (Portable) has been the first type of cross platform library we can use, and is also called PCL for short. It allows the code to be written against a common API set extracted from a set of platforms. Its design has many flaws, so Microsoft later introduces .NET Standard.

Class Library (.NET Standard) is the new type to replace PCL. It allows developers to write code against a much larger API surface. **Thus, if you are now developing something new and would like to support many platforms, make sure you use such a project type.**
Expand All @@ -44,6 +46,7 @@ Class Library (.NET Core) is so special, that your code can actually run on many
Class Library (Xamarin.Forms) is similar, as Xamarin.Forms is cross platform and supports iOS/Android/UWP (WPF and macOS support is coming). If you create a project of this type, it can only be consumed by Xamarin.Forms apps.

## How to Migrate Code Among Them

So far, my personal experience is that cut and paste is the simplest and most effective way.

> Note that in certain cases you can create a class library that targets multiple platforms (net452;netstandard2.0 for example).
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ I have recently upgraded #SNMP Library to .NET Core. And to the extreme, I get r
<!--more-->

## The Whole Manifest
The whole manifest can be found here,
https://github.com/lextudio/sharpsnmplib/blob/8e1d5b7e99a9d91c20d0dccc2d339afeacd809a3/appveyor.yml

The whole manifest can be found [here](https://github.com/lextudio/sharpsnmplib/blob/8e1d5b7e99a9d91c20d0dccc2d339afeacd809a3/appveyor.yml).

## The Image

It is very important to use Visual Studio 2017 image. It has all the development dependencies installed (Xamarin, .NET Core SDK, as well as Git and NuGet bits).

## Build Script

You cannot use the default MSBuild tasks from AppVeyor, so I suggest you use a custom script like I do.

If your solution only contains .NET Core projects or .NET Framework projects, you can now even use dotnet command to perform the operations,

``` bash
dotnet restore somesolution.sln
dotnet clean somesolution.sln
Expand All @@ -36,13 +39,15 @@ C:\Users\lextm\Downloads\sharpsnmplib\SharpSnmpLib\SharpSnmpLib.Android.csproj(6
```

An easy workaround is available, which I use here,

``` bash
msbuild /t:Restore somesolution.sln
msbuild /t:Clean somesolution.sln
msbuild somesolution.sln
```

## Test Script

The default AppVeyor unit test runner configuration does not yet support .NET Core runners. Thus, again we have to use a custom script right now.

I simply use `dotnet test` as it is the easiest.
Expand Down
5 changes: 4 additions & 1 deletion _posts/2017/2017-4-29-plan-for-snmp-library-vnext.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ As .NET Core 2.0 is coming, I think it is time to write about the plan for #SNMP
<!--more-->

## Minimal .NET Framework Version

Now the plan is to require .NET Framework 4.6.0 and above. If Microsoft does resolve multiple target framework support in .NET Standard Class Library project, then I might add back .NET Framework 4.5.x support.

## Minimal .NET Standard Version

The plan is to support .NET Standard 1.3 and above. Won't support other .NET Standard versions, as they are too limited. But since a workaround is used to run this library on .NET Standard 1.3, I might build a .NET Standard 2.0 assembly in NuGet package to remove this workaround.

## Extra Assemblies

We still need to have SharpSnmpLib.Full.dll, SharpSnmpLib.iOS.dll, and SharpSnmpLib.Android.dll, although now they only contain two classes each. This is a limitation of .NET Standard 1.3.

Probably when .NET Standard 2.0 comes, we can finally have a single SharpSnmpLib.NetStandard20.dll to rule all the platforms.

Stay tuned.
Stay tuned.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Then another error happened
> error: runtime/org.freedesktop.Platform/x86_64/1.4 not installed
So that I had to ask Google again and found this fix,

``` bash
flatpak install gnome org.freedesktop.Platform/x86_64/1.4
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To follow this post, you need to have the following software installed,
At the beginning, we will start by installing Go on this machine,

``` bash
$ winget install GoLang.Go
winget install GoLang.Go
```

After that we will start to make a sample application,
Expand All @@ -41,17 +41,17 @@ Next, create a file `server.go` with the following content,
package main

import (
"net/http"
"github.com/labstack/echo/v4"
"net/http"

"github.com/labstack/echo/v4"
)

func main() {
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":1323"))
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":1323"))
}
```

Expand Down Expand Up @@ -79,28 +79,28 @@ To make this Go web app works with IIS, we need to modify the code a bit to read
package main

import (
"flag"
"net/http"
"github.com/labstack/echo/v4"
"flag"
"net/http"
"github.com/labstack/echo/v4"
)

func main() {
port := flag.String("port", "1323", "port to listen on")
flag.Parse()

e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":" + *port))
port := flag.String("port", "1323", "port to listen on")
flag.Parse()

e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":" + *port))
}
```

Compile the code to an executable file,

``` bash
$ go build server.go
go build server.go
```

After compilation, a file `server.exe` is created in the directory.
Expand All @@ -127,6 +127,7 @@ With all settings in place, I can go back to IIS Manager and create a site (I ch
## Troubleshooting

### 0x8007005

Yeah I am not able to see "Hello, World!" but a Bad Gateway error page with the Error Code of `0x80070005`.

``` text
Expand All @@ -153,11 +154,13 @@ Yeah I am not able to see "Hello, World!" but a Bad Gateway error page with the
This isn't hard to understand, because anything under `C:\test-go\` is protected and not accessible by IIS application pools by default. So I need to grant read permission to the local group `IIS_IUSRS`.

### 0x8007002

After fixing the file system permission issue, another Bad Gateway error page with the Error Code of `0x80070002` appears.

The cause is actually simple, that Windows/IIS tries to resolve `server.exe` from the system path, but it is not there. So I need to modify `web.config` to use the full path or simply `.\server.exe` to make it work.

## Side Notes

So, at this very moment, the `web.config` should look like this,

``` xml
Expand Down
6 changes: 2 additions & 4 deletions _posts/2024/2024-3-16-pysnmp-and-home-assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ While our hope was that this simple change would fix the issue, it turned out th
To dive deeper into the issue, we started by building a test environment with HA OS VM (2024.3.1 release) on VirtualBox/macOS on Mar 14 on which we quickly identified the WALK v2 bug and fixed in PySNMP 6.0.11.

> As a sidenote, we didn't expect anyone to perform GET NEXT based WALK operations in SNMP v2c/v3, as GET BULK based WALK is more efficient, but it turned out that HA was doing that. A few unit test cases were missed in this field, but not anymore.
>
> Also note that HA OS is more end user centric, so later we have to switch to another environment setup.
That's how we opened [a new issue for tracking](https://github.com/home-assistant/core/issues/113457) and [the pull request](https://github.com/home-assistant/core/pull/113463) was accepted.
Expand All @@ -43,9 +43,7 @@ The problem was very strange that the first round of WALK seemed to work fine, b

## Sudden Resolution

Before we spent time investigating further the root cause of this issue, we already knew that @nmaggioni was helping to port device tracker to asyncio,

https://github.com/home-assistant/core/pull/112815
Before we spent time investigating further the root cause of this issue, we already knew that [@nmaggioni was helping to port device tracker to asyncio](https://github.com/home-assistant/core/pull/112815).

Thus, we took a shortcut to cherry pick his changes to our fork and found that the device tracker feature started to work again.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ To follow this post, you need to have the following software installed,
No doubt we will start from a sample application as below.

``` batch
$ cd C:\test-django
$ C:\Users\lextudio\AppData\Local\Programs\Python\Python310\python.exe -m django startproject mysite
cd C:\test-django
C:\Users\lextudio\AppData\Local\Programs\Python\Python310\python.exe -m django startproject mysite
```

This generates a Django project in `C:\test-django\mysite`, and now we can use a simple command `python.exe manage.py runserver` in the directory of `C:\test-django\mysite` can launch the application at port 8000,
Expand Down Expand Up @@ -93,7 +93,7 @@ MEDIA_ROOT = BASE_DIR / 'media'
Then, install Uvicorn and WhiteNoise.

``` batch
$ python.exe -m pip install uvicorn whitenoise
python.exe -m pip install uvicorn whitenoise
```

Finally, enable WhiteNoise in `settings.py`,
Expand All @@ -113,7 +113,7 @@ STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
One extra step needed here is to move all static files to a central folder,

``` batch
$ python.exe manage.py collectstatic
python.exe manage.py collectstatic
```

> This is not only applicable to WhiteNoise, but also to other static file serving mechanisms. But you must do this step after enabling WhiteNoise in `settings.py`, as the generated files are different with and without WhiteNoise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ To follow this post, you need to have the following software installed,
First, use `create-next-app` to create a new Next.js project,

``` bash
$ cd C:\
$ mkdir test-nextjs
$ cd test-nextjs
$ npx create-next-app@latest
cd C:\
mkdir test-nextjs
cd test-nextjs
npx create-next-app@latest
```

If you choose every option by default, you get a simple Next.js web app in `my-app` folder.
Expand Down Expand Up @@ -84,7 +84,6 @@ If you encounter any issues, you can check the troubleshooting tips I wrote in [

## Side Notes

### Deployment Artifacts
You must run `npm run build` (wrapper over `next build`) to generate the artifacts before deploying to IIS. Besides, you can delete source files and only leave `.next`, `node_modules` and `web.config` in the deployment folder.

> It is possible to delete more bits from `node_modules` to reduce the deployment size, but that's another topic.
Expand All @@ -105,6 +104,7 @@ const nextConfig = {

export default nextConfig;
```

where `AppWithNode1` is the name of the IIS application.

### Next.js on IIS Express
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ To follow this post, you need to have the following software installed,
First, use `nest new` to create a new Next project,

``` bash
$ cd C:\
$ mkdir test-nest
$ npm i -g @nestjs/cli
$ nest new project-name
cd C:\
mkdir test-nest
npm i -g @nestjs/cli
nest new project-name
```

If you choose every option by default, you get a simple Nest web app in `project-name` folder.
Expand Down Expand Up @@ -113,6 +113,7 @@ If you encounter any issues, you can check the troubleshooting tips I wrote in [
## Side Notes

### Deployment Artifacts

You must run `npm run build` (wrapper over `nest build`) to generate the artifacts before deploying to IIS. Besides, you can delete source files and only leave `dist`, `node_modules` and `web.config` in the deployment folder.

### Nest on IIS Express
Expand Down
1 change: 1 addition & 0 deletions _posts/2024/2024-4-8-httpplatformhandler-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ To recap, this v2 module from us provides the following benefits,
* Open-source. You can check out the source code and build it yourself.

## How to Get HttpPlatformHandler v2?

The changes we make are released under MIT, and you can check out the source code and installers on [our GitHub repository](https://github.com/lextudio/httpplatformhandlerv2/releases).

The current release is marked as v2.0 RC2, as we are still testing it in various scenarios. But the module is already able to handle all the test cases my team have at hand, so we believe it's time that you try it out.
Expand Down

0 comments on commit f5de2b9

Please sign in to comment.