From 2ede57d571e382f5aae167bd2a059a12fa1108ea Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Mon, 26 Feb 2024 12:09:08 -0700 Subject: add new post --- ...6-control-element-under-another-element-html-css.png | Bin 0 -> 22985 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png (limited to 'docs/images/opengraph/posts') diff --git a/docs/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png b/docs/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png new file mode 100644 index 0000000..2817224 Binary files /dev/null and b/docs/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png differ -- cgit v1.2.3 From ea7a6ce794dbda1a7eded1d5e663897d46d21fa2 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Fri, 15 Mar 2024 15:00:41 -0600 Subject: add post about compiling for dos --- .../posts/2024-03-04-opencvjs-video-processing.md | 12 + ...2024-03-15-setting-up-macos-for-8088-dos-dev.md | 267 +++++++++++++++++ Resources/assets/posts/dosbox/hello-world.png | Bin 0 -> 233460 bytes .../posts/2024-03-04-opencvjs-video-processing.png | Bin 0 -> 27820 bytes ...024-03-15-setting-up-macos-for-8088-dos-dev.png | Bin 0 -> 32566 bytes docs/assets/posts/dosbox/hello-world.png | Bin 0 -> 233460 bytes docs/feed.rss | 290 +++++++++++++++++- .../posts/2024-03-04-opencvjs-video-processing.png | Bin 0 -> 27820 bytes ...024-03-15-setting-up-macos-for-8088-dos-dev.png | Bin 0 -> 32566 bytes docs/index.html | 34 +-- ...24-03-15-setting-up-macos-for-8088-dos-dev.html | 330 +++++++++++++++++++++ docs/posts/index.html | 15 + docs/tags/DOS.html | 73 +++++ docs/tags/JS.html | 73 +++++ docs/tags/OpenCV.html | 73 +++++ docs/tags/macOS.html | 15 + docs/tags/x86.html | 73 +++++ 17 files changed, 1234 insertions(+), 21 deletions(-) create mode 100644 Content/posts/2024-03-04-opencvjs-video-processing.md create mode 100644 Content/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.md create mode 100644 Resources/assets/posts/dosbox/hello-world.png create mode 100644 Resources/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png create mode 100644 Resources/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png create mode 100644 docs/assets/posts/dosbox/hello-world.png create mode 100644 docs/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png create mode 100644 docs/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png create mode 100644 docs/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html create mode 100644 docs/tags/DOS.html create mode 100644 docs/tags/JS.html create mode 100644 docs/tags/OpenCV.html create mode 100644 docs/tags/x86.html (limited to 'docs/images/opengraph/posts') diff --git a/Content/posts/2024-03-04-opencvjs-video-processing.md b/Content/posts/2024-03-04-opencvjs-video-processing.md new file mode 100644 index 0000000..cf87fb1 --- /dev/null +++ b/Content/posts/2024-03-04-opencvjs-video-processing.md @@ -0,0 +1,12 @@ +--- +date: 2024-03-04 12:01 +description: Real time video processing with OpenCV.js in the browser +tags: HTML, JS, OpenCV +draft: true +--- + +# Video Processing W/ OpenCV.js + +Note: A really weird bug you might run into when you are trying to mess around +and reloading the page on iOS is that OpenCV just stops loading. This is a bug in +WebKit.: diff --git a/Content/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.md b/Content/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.md new file mode 100644 index 0000000..15161f5 --- /dev/null +++ b/Content/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.md @@ -0,0 +1,267 @@ +--- +date: 2024-03-15 13:16 +description: This goes through compiling Open Watcom 2 and creating simple hello-world exampls +tags: DOS, x86, macOS +draft: false +--- + +# Cross-Compiling Hello World for DOS on macOS + +Technically this should work for any platform that OpenWatcom 2 supports compiling binaries for. Some instructions are based on [a post at retrocoding.net](https://retrocoding.net/openwatcom-gateway-to-ancient-world-of-x86), + and [John Tsiombikas's post](http://nuclear.mutantstargoat.com/articles/retrocoding/dos01-setup/#hello-world-program) + +## Prerequisites + +You should already have XCode / Command Line Tools, and Homebrew installed. To compile Open Watcom for DOS you will need DOSBox (I use DOSBox-X). + +```bash +brew install --cask dosbox-x +``` + +## Compiling Open Watcom v2 + +*If this process is super annoying, I might make a custom homebrew tap to build and install Open Watcom* + +```bash +git clone https://github.com/open-watcom/open-watcom-v2 +cp open-watcom-v2/setvars.sh custom_setvars.sh +``` + +Now, edit this `setvars.sh` file. My file looks like this: + +```bash +#!/bin/zsh +export OWROOT="/Users/navanchauhan/Developer/8088Stuff/open-watcom-v2" +export OWTOOLS=CLANG +export OWDOCBUILD=0 +export OWGUINOBUILD=0 +export OWDISTRBUILD=0 +export OWDOSBOX="/Applications/dosbox-x.app/Contents/MacOS/dosbox-x" +export OWOBJDIR=binbuildV01 +. "$OWROOT/cmnvars.sh" +echo "OWROOT=$OWROOT" +cd "$OWROOT" +``` + +Note, your `OWRTOOT` is definitely going to be in a different location. + +```bash +source ./custom_setvars.sh +./build.sh +./build.sh rel +``` + +This will build, and then copy everything to the `rel` directory inside `open-watcom-v2` directory. Since I ran this on an Apple Silicon Mac, + all the binaries for me are in the `armo64` directory. You can now move everything inside the rel folder to another location, or create a simple + script to init all variables whenever you want. + +I like having a script called `exportVarsForDOS.sh` + +```bash +#!/bin/zsh + +export WATCOM=/Users/navanchauhan/Developer/8088Stuff/open-watcom-v2/rel +export PATH=$PATH:$WATCOM/armo64 +export EDDAT=$WATCOM/eddat + +# For DOS 8088/8086 development +export INCLUDE=$WATCOM/h +export LIB=$WATCOM/lib286 # You don't really need this +``` + +Then, when you need to load up these variables, you can simply run `source exportVarsForDOS.sh` or `. exportVarsForDOS.sh` + +## Hello World + +### Buliding without any Makefiles + +Create a new file called `example1.c` + +```c +#include + +int main() { + printf("Hello World!"); + return 0; +} +``` + +First we compile the code: + +```bash +$ wcc example1.c +Open Watcom C x86 16-bit Optimizing Compiler +Version 2.0 beta Mar 15 2024 13:11:55 +Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved. +Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved. +Source code is available under the Sybase Open Watcom Public License. +See https://github.com/open-watcom/open-watcom-v2#readme for details. +example1.c: 7 lines, included 818, 0 warnings, 0 errors +Code size: 19 +``` + +Then, link to make an executable: + +```bash +$ wlink name example1.exe system dos file example1.o +Open Watcom Linker Version 2.0 beta Mar 15 2024 13:10:09 +Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved. +Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. +Source code is available under the Sybase Open Watcom Public License. +See https://github.com/open-watcom/open-watcom-v2#readme for details. +loading object files +searching libraries +creating a DOS executable +``` + +If you want to test this executable, jump to the section titled `Testing with DOSBox-X` below. + +### Simple Makefile + +```makefile +obj = main.o hello.o +bin = tizts.com + +CC = wcc +CFLAGS = -0 +LD = wlink + +$(bin): $(obj) + $(LD) name $@ system dos file main.o file hello.o + +.c.o: + $(CC) $(CFLAGS) $< + +clean: + rm $(obj) $(bin) +``` + +Where, `main.c` +```c +void hello(void); + +int main(void) +{ + hello(); + return 0; +} +``` + +and `hello.c` + +```c +/* hello.c */ +#include + +void hello(void) +{ + printf("Hello!"); +} +``` + +To compile into `tizts.com` simply run `wmake` + +```bash +$ wmake +➜ simple-cpp wmake +Open Watcom Make Version 2.0 beta Mar 15 2024 13:10:16 +Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved. +Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved. +Source code is available under the Sybase Open Watcom Public License. +See https://github.com/open-watcom/open-watcom-v2#readme for details. + wcc -0 main.c +Open Watcom C x86 16-bit Optimizing Compiler +Version 2.0 beta Mar 15 2024 13:11:55 +Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved. +Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved. +Source code is available under the Sybase Open Watcom Public License. +See https://github.com/open-watcom/open-watcom-v2#readme for details. +main.c(8): Warning! W138: No newline at end of file +main.c: 8 lines, included 53, 1 warnings, 0 errors +Code size: 12 + wcc -0 hello.c +Open Watcom C x86 16-bit Optimizing Compiler +Version 2.0 beta Mar 15 2024 13:11:55 +Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved. +Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved. +Source code is available under the Sybase Open Watcom Public License. +See https://github.com/open-watcom/open-watcom-v2#readme for details. +hello.c: 8 lines, included 818, 0 warnings, 0 errors +Code size: 17 + wlink name tizts.com system dos file main.o file hello.o +Open Watcom Linker Version 2.0 beta Mar 15 2024 13:10:09 +Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved. +Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. +Source code is available under the Sybase Open Watcom Public License. +See https://github.com/open-watcom/open-watcom-v2#readme for details. +loading object files +searching libraries +creating a DOS executable +``` + +### Using CMake + +Create a file called `CMakeLists.txt` + +```CMake +project(hello) + +set(SOURCES abc.c) + +add_executable(hello ${SOURCES}) +``` + +Where, `abc.c` is: + +```c +#include + +int main() { + printf("Does this work?"); + return 0; +} +``` + +```bash +mkdir build +cd build +``` + +And build using CMake + +``` +cmake -DCMAKE_SYSTEM_NAME=DOS -DCMAKE_SYSTEM_PROCESSOR=I86 -DCMAKE_C_FLAGS="-0 -bt=dos -d0 -oaxt" -G "Watcom WMake" ../.. +``` + +There you have it. Three different ways to compile a C program on a macOS device in 2024 that can run on an IBM PC 5150 (which was released in 1981!) + +## Testing with DOSBox-X + +```bash +cp example1.exe ~/Downloads +/Applications/dosbox-x.app/Contents/MacOS/dosbox-x +``` + +In DOSBox-X we now mount the `~/Downloads` folder as our `C:` drive + +``` +mount C ~/Downloads +``` + +Switch to the C drive + +``` +C: +``` + +Run the program: + +``` +example1 +``` + +![Running our program in DOSBox-X](/assets/posts/dosbox/hello-world.png) + +*My DOSBox setup might look slightly different than yours...* + + diff --git a/Resources/assets/posts/dosbox/hello-world.png b/Resources/assets/posts/dosbox/hello-world.png new file mode 100644 index 0000000..4e2482e Binary files /dev/null and b/Resources/assets/posts/dosbox/hello-world.png differ diff --git a/Resources/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png b/Resources/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png new file mode 100644 index 0000000..e77d3d7 Binary files /dev/null and b/Resources/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png differ diff --git a/Resources/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png b/Resources/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png new file mode 100644 index 0000000..8cba6d8 Binary files /dev/null and b/Resources/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png differ diff --git a/docs/assets/posts/dosbox/hello-world.png b/docs/assets/posts/dosbox/hello-world.png new file mode 100644 index 0000000..4e2482e Binary files /dev/null and b/docs/assets/posts/dosbox/hello-world.png differ diff --git a/docs/feed.rss b/docs/feed.rss index 4f92bc6..d242684 100644 --- a/docs/feed.rss +++ b/docs/feed.rss @@ -4,8 +4,8 @@ Navan's Archive Rare Tips, Tricks and Posts https://web.navan.dev/en - Wed, 28 Feb 2024 11:50:15 -0000 - Wed, 28 Feb 2024 11:50:15 -0000 + Fri, 15 Mar 2024 15:00:25 -0000 + Fri, 15 Mar 2024 15:00:25 -0000 250 @@ -196,6 +196,292 @@ I actually added the code to this post after running the program.

]]> + + + https://web.navan.dev/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html + + + Cross-Compiling Hello World for DOS on macOS + + + This goes through compiling Open Watcom 2 and creating simple hello-world exampls + + https://web.navan.dev/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html + Fri, 15 Mar 2024 13:16:00 -0000 + Cross-Compiling Hello World for DOS on macOS + +

Technically this should work for any platform that OpenWatcom 2 supports compiling binaries for. Some instructions are based on a post at retrocoding.net, + and John Tsiombikas's post

+ +

Prerequisites

+ +

You should already have XCode / Command Line Tools, and Homebrew installed. To compile Open Watcom for DOS you will need DOSBox (I use DOSBox-X).

+ +
+
brew install --cask dosbox-x
+
+
+ +

Compiling Open Watcom v2

+ +

If this process is super annoying, I might make a custom homebrew tap to build and install Open Watcom

+ +
+
git clone https://github.com/open-watcom/open-watcom-v2
+cp open-watcom-v2/setvars.sh custom_setvars.sh
+
+
+ +

Now, edit this setvars.sh file. My file looks like this:

+ +
+
#!/bin/zsh
+export OWROOT="/Users/navanchauhan/Developer/8088Stuff/open-watcom-v2"
+export OWTOOLS=CLANG
+export OWDOCBUILD=0
+export OWGUINOBUILD=0
+export OWDISTRBUILD=0
+export OWDOSBOX="/Applications/dosbox-x.app/Contents/MacOS/dosbox-x"
+export OWOBJDIR=binbuildV01
+. "$OWROOT/cmnvars.sh"
+echo "OWROOT=$OWROOT"
+cd "$OWROOT"
+
+
+ +

Note, your OWRTOOT is definitely going to be in a different location.

+ +
+
source ./custom_setvars.sh
+./build.sh
+./build.sh rel
+
+
+ +

This will build, and then copy everything to the rel directory inside open-watcom-v2 directory. Since I ran this on an Apple Silicon Mac, + all the binaries for me are in the armo64 directory. You can now move everything inside the rel folder to another location, or create a simple + script to init all variables whenever you want.

+ +

I like having a script called exportVarsForDOS.sh

+ +
+
#!/bin/zsh
+
+export WATCOM=/Users/navanchauhan/Developer/8088Stuff/open-watcom-v2/rel
+export PATH=$PATH:$WATCOM/armo64
+export EDDAT=$WATCOM/eddat
+
+# For DOS 8088/8086 development
+export INCLUDE=$WATCOM/h
+export LIB=$WATCOM/lib286 # You don't really need this
+
+
+ +

Then, when you need to load up these variables, you can simply run source exportVarsForDOS.sh or . exportVarsForDOS.sh

+ +

Hello World

+ +

Buliding without any Makefiles

+ +

Create a new file called example1.c

+ +
+
#include<stdio.h>
+
+int main() {
+    printf("Hello World!");
+    return 0;
+}
+
+
+ +

First we compile the code:

+ +
+
$ wcc example1.c
+Open Watcom C x86 16-bit Optimizing Compiler
+Version 2.0 beta Mar 15 2024 13:11:55
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+example1.c: 7 lines, included 818, 0 warnings, 0 errors
+Code size: 19
+
+
+ +

Then, link to make an executable:

+ +
+
$ wlink name example1.exe system dos file example1.o
+Open Watcom Linker Version 2.0 beta Mar 15 2024 13:10:09
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+loading object files
+searching libraries
+creating a DOS executable 
+
+
+ +

If you want to test this executable, jump to the section titled Testing with DOSBox-X below.

+ +

Simple Makefile

+ +
+
obj = main.o hello.o
+bin = tizts.com
+
+CC = wcc
+CFLAGS = -0
+LD = wlink
+
+$(bin): $(obj)
+    $(LD) name $@ system dos file main.o file hello.o 
+
+.c.o:
+    $(CC) $(CFLAGS) $<
+
+clean:
+    rm $(obj) $(bin)
+
+
+ +

Where, main.c

+ +
+
void hello(void);
+
+int main(void)
+{
+    hello();
+    return 0;
+}
+
+
+ +

and hello.c

+ +
+
/* hello.c */
+#include <stdio.h>
+
+void hello(void)
+{
+    printf("Hello!");
+}
+
+
+ +

To compile into tizts.com simply run wmake

+ +
+
$ wmake
+➜  simple-cpp wmake
+Open Watcom Make Version 2.0 beta Mar 15 2024 13:10:16
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+    wcc -0 main.c
+Open Watcom C x86 16-bit Optimizing Compiler
+Version 2.0 beta Mar 15 2024 13:11:55
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+main.c(8): Warning! W138: No newline at end of file
+main.c: 8 lines, included 53, 1 warnings, 0 errors
+Code size: 12
+    wcc -0 hello.c
+Open Watcom C x86 16-bit Optimizing Compiler
+Version 2.0 beta Mar 15 2024 13:11:55
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+hello.c: 8 lines, included 818, 0 warnings, 0 errors
+Code size: 17
+    wlink name tizts.com system dos file main.o file hello.o
+Open Watcom Linker Version 2.0 beta Mar 15 2024 13:10:09
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+loading object files
+searching libraries
+creating a DOS executable
+
+
+ +

Using CMake

+ +

Create a file called CMakeLists.txt

+ +
+
project(hello)
+
+set(SOURCES abc.c)
+
+add_executable(hello ${SOURCES})
+
+
+ +

Where, abc.c is:

+ +
+
#include <stdio.h>
+
+int main() {
+    printf("Does this work?");
+    return 0;
+}
+
+
+ +
+
mkdir build
+cd build
+
+
+ +

And build using CMake

+ +
cmake -DCMAKE_SYSTEM_NAME=DOS -DCMAKE_SYSTEM_PROCESSOR=I86 -DCMAKE_C_FLAGS="-0 -bt=dos -d0 -oaxt" -G "Watcom WMake" ../..
+
+ +

There you have it. Three different ways to compile a C program on a macOS device in 2024 that can run on an IBM PC 5150 (which was released in 1981!)

+ +

Testing with DOSBox-X

+ +
+
cp example1.exe ~/Downloads
+/Applications/dosbox-x.app/Contents/MacOS/dosbox-x
+
+
+ +

In DOSBox-X we now mount the ~/Downloads folder as our C: drive

+ +
mount C ~/Downloads
+
+ +

Switch to the C drive

+ +
C:
+
+ +

Run the program:

+ +
example1
+
+ +

Running our program in DOSBox-X

+ +

My DOSBox setup might look slightly different than yours...

+]]>
+
+ https://web.navan.dev/posts/hello-world.html diff --git a/docs/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png b/docs/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png new file mode 100644 index 0000000..e77d3d7 Binary files /dev/null and b/docs/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png differ diff --git a/docs/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png b/docs/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png new file mode 100644 index 0000000..8cba6d8 Binary files /dev/null and b/docs/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png differ diff --git a/docs/index.html b/docs/index.html index 3bee970..f6a4942 100644 --- a/docs/index.html +++ b/docs/index.html @@ -50,6 +50,21 @@

Recent Posts

For all posts go to Posts diff --git a/docs/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html b/docs/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html new file mode 100644 index 0000000..bb37d00 --- /dev/null +++ b/docs/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html @@ -0,0 +1,330 @@ + + + + + + + + + Cross-Compiling Hello World for DOS on macOS + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +

Cross-Compiling Hello World for DOS on macOS

+ +

Technically this should work for any platform that OpenWatcom 2 supports compiling binaries for. Some instructions are based on a post at retrocoding.net, + and John Tsiombikas's post

+ +

Prerequisites

+ +

You should already have XCode / Command Line Tools, and Homebrew installed. To compile Open Watcom for DOS you will need DOSBox (I use DOSBox-X).

+ +
+
brew install --cask dosbox-x
+
+
+ +

Compiling Open Watcom v2

+ +

If this process is super annoying, I might make a custom homebrew tap to build and install Open Watcom

+ +
+
git clone https://github.com/open-watcom/open-watcom-v2
+cp open-watcom-v2/setvars.sh custom_setvars.sh
+
+
+ +

Now, edit this setvars.sh file. My file looks like this:

+ +
+
#!/bin/zsh
+export OWROOT="/Users/navanchauhan/Developer/8088Stuff/open-watcom-v2"
+export OWTOOLS=CLANG
+export OWDOCBUILD=0
+export OWGUINOBUILD=0
+export OWDISTRBUILD=0
+export OWDOSBOX="/Applications/dosbox-x.app/Contents/MacOS/dosbox-x"
+export OWOBJDIR=binbuildV01
+. "$OWROOT/cmnvars.sh"
+echo "OWROOT=$OWROOT"
+cd "$OWROOT"
+
+
+ +

Note, your OWRTOOT is definitely going to be in a different location.

+ +
+
source ./custom_setvars.sh
+./build.sh
+./build.sh rel
+
+
+ +

This will build, and then copy everything to the rel directory inside open-watcom-v2 directory. Since I ran this on an Apple Silicon Mac, + all the binaries for me are in the armo64 directory. You can now move everything inside the rel folder to another location, or create a simple + script to init all variables whenever you want.

+ +

I like having a script called exportVarsForDOS.sh

+ +
+
#!/bin/zsh
+
+export WATCOM=/Users/navanchauhan/Developer/8088Stuff/open-watcom-v2/rel
+export PATH=$PATH:$WATCOM/armo64
+export EDDAT=$WATCOM/eddat
+
+# For DOS 8088/8086 development
+export INCLUDE=$WATCOM/h
+export LIB=$WATCOM/lib286 # You don't really need this
+
+
+ +

Then, when you need to load up these variables, you can simply run source exportVarsForDOS.sh or . exportVarsForDOS.sh

+ +

Hello World

+ +

Buliding without any Makefiles

+ +

Create a new file called example1.c

+ +
+
#include<stdio.h>
+
+int main() {
+    printf("Hello World!");
+    return 0;
+}
+
+
+ +

First we compile the code:

+ +
+
$ wcc example1.c
+Open Watcom C x86 16-bit Optimizing Compiler
+Version 2.0 beta Mar 15 2024 13:11:55
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+example1.c: 7 lines, included 818, 0 warnings, 0 errors
+Code size: 19
+
+
+ +

Then, link to make an executable:

+ +
+
$ wlink name example1.exe system dos file example1.o
+Open Watcom Linker Version 2.0 beta Mar 15 2024 13:10:09
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+loading object files
+searching libraries
+creating a DOS executable 
+
+
+ +

If you want to test this executable, jump to the section titled Testing with DOSBox-X below.

+ +

Simple Makefile

+ +
+
obj = main.o hello.o
+bin = tizts.com
+
+CC = wcc
+CFLAGS = -0
+LD = wlink
+
+$(bin): $(obj)
+    $(LD) name $@ system dos file main.o file hello.o 
+
+.c.o:
+    $(CC) $(CFLAGS) $<
+
+clean:
+    rm $(obj) $(bin)
+
+
+ +

Where, main.c

+ +
+
void hello(void);
+
+int main(void)
+{
+    hello();
+    return 0;
+}
+
+
+ +

and hello.c

+ +
+
/* hello.c */
+#include <stdio.h>
+
+void hello(void)
+{
+    printf("Hello!");
+}
+
+
+ +

To compile into tizts.com simply run wmake

+ +
+
$ wmake
+➜  simple-cpp wmake
+Open Watcom Make Version 2.0 beta Mar 15 2024 13:10:16
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+    wcc -0 main.c
+Open Watcom C x86 16-bit Optimizing Compiler
+Version 2.0 beta Mar 15 2024 13:11:55
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+main.c(8): Warning! W138: No newline at end of file
+main.c: 8 lines, included 53, 1 warnings, 0 errors
+Code size: 12
+    wcc -0 hello.c
+Open Watcom C x86 16-bit Optimizing Compiler
+Version 2.0 beta Mar 15 2024 13:11:55
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+hello.c: 8 lines, included 818, 0 warnings, 0 errors
+Code size: 17
+    wlink name tizts.com system dos file main.o file hello.o
+Open Watcom Linker Version 2.0 beta Mar 15 2024 13:10:09
+Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
+Source code is available under the Sybase Open Watcom Public License.
+See https://github.com/open-watcom/open-watcom-v2#readme for details.
+loading object files
+searching libraries
+creating a DOS executable
+
+
+ +

Using CMake

+ +

Create a file called CMakeLists.txt

+ +
+
project(hello)
+
+set(SOURCES abc.c)
+
+add_executable(hello ${SOURCES})
+
+
+ +

Where, abc.c is:

+ +
+
#include <stdio.h>
+
+int main() {
+    printf("Does this work?");
+    return 0;
+}
+
+
+ +
+
mkdir build
+cd build
+
+
+ +

And build using CMake

+ +
cmake -DCMAKE_SYSTEM_NAME=DOS -DCMAKE_SYSTEM_PROCESSOR=I86 -DCMAKE_C_FLAGS="-0 -bt=dos -d0 -oaxt" -G "Watcom WMake" ../..
+
+ +

There you have it. Three different ways to compile a C program on a macOS device in 2024 that can run on an IBM PC 5150 (which was released in 1981!)

+ +

Testing with DOSBox-X

+ +
+
cp example1.exe ~/Downloads
+/Applications/dosbox-x.app/Contents/MacOS/dosbox-x
+
+
+ +

In DOSBox-X we now mount the ~/Downloads folder as our C: drive

+ +
mount C ~/Downloads
+
+ +

Switch to the C drive

+ +
C:
+
+ +

Run the program:

+ +
example1
+
+ +

Running our program in DOSBox-X

+ +

My DOSBox setup might look slightly different than yours...

+ +
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/posts/index.html b/docs/posts/index.html index 4194100..2d9d613 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -52,6 +52,21 @@
    +
  • Cross-Compiling Hello World for DOS on macOS
  • +
      +
    • This goes through compiling Open Watcom 2 and creating simple hello-world exampls
    • +
    • Published On: 2024-03-15 13:16
    • +
    • Tags: + + DOS, + + x86, + + macOS + +
    + +
  • Interacting with underlying element in HTML
    • With CSS you can disable any interactions with an element and directly control the underlying element
    • diff --git a/docs/tags/DOS.html b/docs/tags/DOS.html new file mode 100644 index 0000000..3a75f5b --- /dev/null +++ b/docs/tags/DOS.html @@ -0,0 +1,73 @@ + + + + + + + + + "DOS" + + + + + + + + + + + + + + + + + + + + + +
      +
      + + +
      +

      DOS

      Posts tagged 'DOS'

      +
      + + + + + + + + \ No newline at end of file diff --git a/docs/tags/JS.html b/docs/tags/JS.html new file mode 100644 index 0000000..b01594b --- /dev/null +++ b/docs/tags/JS.html @@ -0,0 +1,73 @@ + + + + + + + + + "JS" + + + + + + + + + + + + + + + + + + + + + +
      +
      + + +
      +

      JS

      Posts tagged 'JS'

      +
      + + + + + + + + \ No newline at end of file diff --git a/docs/tags/OpenCV.html b/docs/tags/OpenCV.html new file mode 100644 index 0000000..ddaa485 --- /dev/null +++ b/docs/tags/OpenCV.html @@ -0,0 +1,73 @@ + + + + + + + + + "OpenCV" + + + + + + + + + + + + + + + + + + + + + +
      +
      + + +
      +

      OpenCV

      Posts tagged 'OpenCV'

      +
      + + + + + + + + \ No newline at end of file diff --git a/docs/tags/macOS.html b/docs/tags/macOS.html index 8b70731..028aef3 100644 --- a/docs/tags/macOS.html +++ b/docs/tags/macOS.html @@ -49,6 +49,21 @@
        +
      • Cross-Compiling Hello World for DOS on macOS
      • +
          +
        • This goes through compiling Open Watcom 2 and creating simple hello-world exampls
        • +
        • Published On: 2024-03-15 13:16
        • +
        • Tags: + + DOS, + + x86, + + macOS + +
        + +
      • Interacting with Siri using the command line
        • Code snippet to interact with Siri by issuing commands from the command-line.
        • diff --git a/docs/tags/x86.html b/docs/tags/x86.html new file mode 100644 index 0000000..dab538b --- /dev/null +++ b/docs/tags/x86.html @@ -0,0 +1,73 @@ + + + + + + + + + "x86" + + + + + + + + + + + + + + + + + + + + + +
          +
          + + +
          +

          x86

          Posts tagged 'x86'

          +
          + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From b484b8a672a907af87e73fe7006497a6ca86c259 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Thu, 21 Mar 2024 13:54:53 -0600 Subject: add polynomial regression for tf 2.0 --- ...-03-21-Polynomial-Regression-in-TensorFlow-2.md | 241 ++++++++++++++++ ...03-21-Polynomial-Regression-in-TensorFlow-2.png | Bin 0 -> 27498 bytes docs/feed.rss | 271 +++++++++++++++++- ...03-21-Polynomial-Regression-in-TensorFlow-2.png | Bin 0 -> 27498 bytes docs/index.html | 28 +- ...3-21-Polynomial-Regression-in-TensorFlow-2.html | 311 +++++++++++++++++++++ docs/posts/index.html | 15 + docs/tags/Colab.html | 15 + docs/tags/Tensorflow.html | 15 + 9 files changed, 881 insertions(+), 15 deletions(-) create mode 100644 Content/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.md create mode 100644 Resources/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png create mode 100644 docs/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png create mode 100644 docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html (limited to 'docs/images/opengraph/posts') diff --git a/Content/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.md b/Content/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.md new file mode 100644 index 0000000..4341f09 --- /dev/null +++ b/Content/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.md @@ -0,0 +1,241 @@ +--- +date: 2024-03-21 12:46 +description: Predicting n-th degree polynomials using TensorFlow 2.x +tags: Tutorial, Tensorflow, Colab +--- + +# Polynomial Regression Using TensorFlow 2.x + +I have a similar post titled [Polynomial Regression Using Tensorflow](/posts/2019-12-16-TensorFlow-Polynomial-Regression.html) that used `tensorflow.compat.v1` (Which still works as of TF 2.16). But, I thought it would be nicer to redo it with newer TF versions. + +I will be skipping all the introductions about polynomial regression and jumping straight to the code. Personally, I prefer using `scikit-learn` for this task. + +## Position vs Salary Dataset + +Again, we will be using https://drive.google.com/file/d/1tNL4jxZEfpaP4oflfSn6pIHJX7Pachm9/view (Salary vs Position Dataset) + +If you are in a Python Notebook environment like Kaggle or Google Colaboratory, you can simply run: +```Termcap +!wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1tNL4jxZEfpaP4oflfSn6pIHJX7Pachm9' -O data.csv +``` + +## Code + +If you just want to copy-paste the code, scroll to the bottom for the entire snippet. Here I will try and walk through setting up code for a 3rd-degree (cubic) polynomial + +### Imports + +```python +import pandas as pd +import tensorflow as tf +import matplotlib.pyplot as plt +import numpy as np +``` + +### Reading the Dataset + +```python +df = pd.read_csv("data.csv") +``` + +### Variables and Constants + +Here, we initialize the X and Y values as constants, since they are not going to change. The coefficients are defined as variables. + +```python +X = tf.constant(df["Level"], dtype=tf.float32) +Y = tf.constant(df["Salary"], dtype=tf.float32) + +coefficients = [tf.Variable(np.random.randn() * 0.01, dtype=tf.float32) for _ in range(4)] +``` + +Here, `X` and `Y` are the values from our dataset. We initialize the coefficients for the equations as small random values. + +These coefficients are evaluated by Tensorflow's `tf.math.poyval` function which returns the n-th order polynomial based on how many coefficients are passed. Since our list of coefficients contains 4 different variables, it will be evaluated as: + +``` +y = (x**3)*coefficients[3] + (x**2)*coefficients[2] + (x**1)*coefficients[1] (x**0)*coefficients[0] +``` + +Which is equivalent to the general cubic equation: + + + +$$ +y = ax^3 + bx^2 + cx + d +$$ + +### Optimizer Selection & Training + +```python +optimizer = tf.keras.optimizers.Adam(learning_rate=0.3) +num_epochs = 10_000 + +for epoch in range(num_epochs): + with tf.GradientTape() as tape: + y_pred = tf.math.polyval(coefficients, X) + loss = tf.reduce_mean(tf.square(y - y_pred)) + grads = tape.gradient(loss, coefficients) + optimizer.apply_gradients(zip(grads, coefficients)) + if (epoch+1) % 1000 == 0: + print(f"Epoch: {epoch+1}, Loss: {loss.numpy()}" +``` + +In TensorFlow 1, we would have been using `tf.Session` instead. + +Here we are using `GradientTape()` instead, to keep track of the loss evaluation and coefficients. This is crucial, as our optimizer needs these gradients to be able to optimize our coefficients. + +Our loss function is Mean Squared Error (MSE) + +$$ += \frac{1}{n}\sum_{i=1}^{n} (Y_i - \^{Y_i}) +$$ + +Where $\^{Y_i}$ is the predicted value and $Y_i$ is the actual value + +### Plotting Final Coefficients + +```python +final_coefficients = [c.numpy() for c in coefficients] +print("Final Coefficients:", final_coefficients) + +plt.plot(df["Level"], df["Salary"], label="Original Data") +plt.plot(df["Level"],[tf.math.polyval(final_coefficients, tf.constant(x, dtype=tf.float32)).numpy() for x in df["Level"]]) +plt.ylabel('Salary') +plt.xlabel('Position') +plt.title("Salary vs Position") +plt.show() +``` + + +## Code Snippet for a Polynomial of Degree N + +### Using Gradient Tape + +This should work regardless of the Keras backend version (2 or 3) + +```python +import tensorflow as tf +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt + +df = pd.read_csv("data.csv") + +############################ +## Change Parameters Here ## +############################ +x_column = "Level" # +y_column = "Salary" # +degree = 2 # +learning_rate = 0.3 # +num_epochs = 25_000 # +############################ + +X = tf.constant(df[x_column], dtype=tf.float32) +Y = tf.constant(df[y_column], dtype=tf.float32) + +coefficients = [tf.Variable(np.random.randn() * 0.01, dtype=tf.float32) for _ in range(degree + 1)] + +optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate) + +for epoch in range(num_epochs): + with tf.GradientTape() as tape: + y_pred = tf.math.polyval(coefficients, X) + loss = tf.reduce_mean(tf.square(Y - y_pred)) + grads = tape.gradient(loss, coefficients) + optimizer.apply_gradients(zip(grads, coefficients)) + if (epoch+1) % 1000 == 0: + print(f"Epoch: {epoch+1}, Loss: {loss.numpy()}") + +final_coefficients = [c.numpy() for c in coefficients] +print("Final Coefficients:", final_coefficients) + +print("Final Equation:", end=" ") +for i in range(degree+1): + print(f"{final_coefficients[i]} * x^{degree-i}", end=" + " if i < degree else "\n") + +plt.plot(X, Y, label="Original Data") +plt.plot(X,[tf.math.polyval(final_coefficients, tf.constant(x, dtype=tf.float32)).numpy() for x in df[x_column]]), label="Our Poynomial" +plt.ylabel(y_column) +plt.xlabel(x_column) +plt.title(f"{x_column} vs {y_column}") +plt.legend() +plt.show() +``` + +### Without Gradient Tape + +This relies on the Optimizer's `minimize` function and uses the `var_list` parameter to update the variables. + +This will not work with Keras 3 backend in TF 2.16.0 and above unless you switch to the legacy backend. + +```python +import tensorflow as tf +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt + +df = pd.read_csv("data.csv") + +############################ +## Change Parameters Here ## +############################ +x_column = "Level" # +y_column = "Salary" # +degree = 2 # +learning_rate = 0.3 # +num_epochs = 25_000 # +############################ + +X = tf.constant(df[x_column], dtype=tf.float32) +Y = tf.constant(df[y_column], dtype=tf.float32) + +coefficients = [tf.Variable(np.random.randn() * 0.01, dtype=tf.float32) for _ in range(degree + 1)] + +optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate) + +def loss_function(): + pred_y = tf.math.polyval(coefficients, X) + return tf.reduce_mean(tf.square(pred_y - Y)) + +for epoch in range(num_epochs): + optimizer.minimize(loss_function, var_list=coefficients) + if (epoch+1) % 1000 == 0: + current_loss = loss_function().numpy() + print(f"Epoch {epoch+1}: Training Loss: {current_loss}") + +final_coefficients = coefficients.numpy() +print("Final Coefficients:", final_coefficients) + +print("Final Equation:", end=" ") +for i in range(degree+1): + print(f"{final_coefficients[i]} * x^{degree-i}", end=" + " if i < degree else "\n") + +plt.plot(X, Y, label="Original Data") +plt.plot(X,[tf.math.polyval(final_coefficients, tf.constant(x, dtype=tf.float32)).numpy() for x in df[x_column]], label="Our Polynomial") +plt.ylabel(y_column) +plt.xlabel(x_column) +plt.legend() +plt.title(f"{x_column} vs {y_column}") +plt.show() +``` + + +As always, remember to tweak the parameters and choose the correct model for the job. A polynomial regression model might not even be the best model for this particular dataset. + +## Further Programming + +How would you modify this code to use another type of nonlinear regression? Say, $ y = ab^x $ + +Hint: Your loss calculation would be similar to: + +```python +bx = tf.pow(coefficients[1], X) +pred_y = tf.math.multiply(coefficients[0], bx) +loss = tf.reduce_mean(tf.square(pred_y - Y)) +``` + + diff --git a/Resources/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png b/Resources/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png new file mode 100644 index 0000000..0dbdd08 Binary files /dev/null and b/Resources/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png differ diff --git a/docs/feed.rss b/docs/feed.rss index d242684..df334a3 100644 --- a/docs/feed.rss +++ b/docs/feed.rss @@ -4,8 +4,8 @@ Navan's Archive Rare Tips, Tricks and Posts https://web.navan.dev/en - Fri, 15 Mar 2024 15:00:25 -0000 - Fri, 15 Mar 2024 15:00:25 -0000 + Thu, 21 Mar 2024 13:54:34 -0000 + Thu, 21 Mar 2024 13:54:34 -0000 250 @@ -482,6 +482,273 @@ creating a DOS + + + https://web.navan.dev/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html + + + Polynomial Regression Using TensorFlow 2.x + + + Predicting n-th degree polynomials using TensorFlow 2.x + + https://web.navan.dev/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html + Thu, 21 Mar 2024 12:46:00 -0000 + Polynomial Regression Using TensorFlow 2.x + +

          I have a similar post titled Polynomial Regression Using Tensorflow that used tensorflow.compat.v1 (Which still works as of TF 2.16). But, I thought it would be nicer to redo it with newer TF versions.

          + +

          I will be skipping all the introductions about polynomial regression and jumping straight to the code. Personally, I prefer using scikit-learn for this task.

          + +

          Position vs Salary Dataset

          + +

          Again, we will be using https://drive.google.com/file/d/1tNL4jxZEfpaP4oflfSn6pIHJX7Pachm9/view (Salary vs Position Dataset)

          + +

          If you are in a Python Notebook environment like Kaggle or Google Colaboratory, you can simply run:

          + +
          +
          !wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1tNL4jxZEfpaP4oflfSn6pIHJX7Pachm9' -O data.csv
          +
          +
          + +

          Code

          + +

          If you just want to copy-paste the code, scroll to the bottom for the entire snippet. Here I will try and walk through setting up code for a 3rd-degree (cubic) polynomial

          + +

          Imports

          + +
          +
          import pandas as pd
          +import tensorflow as tf
          +import matplotlib.pyplot as plt
          +import numpy as np
          +
          +
          + +

          Reading the Dataset

          + +
          +
          df = pd.read_csv("data.csv")
          +
          +
          + +

          Variables and Constants

          + +

          Here, we initialize the X and Y values as constants, since they are not going to change. The coefficients are defined as variables.

          + +
          +
          X = tf.constant(df["Level"], dtype=tf.float32)
          +Y = tf.constant(df["Salary"], dtype=tf.float32)
          +
          +coefficients = [tf.Variable(np.random.randn() * 0.01, dtype=tf.float32) for _ in range(4)]
          +
          +
          + +

          Here, X and Y are the values from our dataset. We initialize the coefficients for the equations as small random values.

          + +

          These coefficients are evaluated by Tensorflow's tf.math.poyval function which returns the n-th order polynomial based on how many coefficients are passed. Since our list of coefficients contains 4 different variables, it will be evaluated as:

          + +
          y = (x**3)*coefficients[3] + (x**2)*coefficients[2] + (x**1)*coefficients[1] (x**0)*coefficients[0]
          +
          + +

          Which is equivalent to the general cubic equation:

          + +

          + +$$ +y = ax^3 + bx^2 + cx + d +$$ + +### Optimizer Selection & Training +

          + +
          optimizer = tf.keras.optimizers.Adam(learning_rate=0.3)
          +num_epochs = 10_000
          +
          +for epoch in range(num_epochs):
          +    with tf.GradientTape() as tape:
          +        y_pred = tf.math.polyval(coefficients, X)
          +        loss = tf.reduce_mean(tf.square(y - y_pred))
          +    grads = tape.gradient(loss, coefficients)
          +    optimizer.apply_gradients(zip(grads, coefficients))
          +    if (epoch+1) % 1000 == 0:
          +        print(f"Epoch: {epoch+1}, Loss: {loss.numpy()}"
          +
          + +
          + + +In TensorFlow 1, we would have been using `tf.Session` instead. + +Here we are using `GradientTape()` instead, to keep track of the loss evaluation and coefficients. This is crucial, as our optimizer needs these gradients to be able to optimize our coefficients. + +Our loss function is Mean Squared Error (MSE) + +$$ += \frac{1}{n}\sum_{i=1}^{n} (Y_i - \^{Y_i}) +$$ + +Where $\^{Y_i}$ is the predicted value and $Y_i$ is the actual value + +### Plotting Final Coefficients +
          + +
          final_coefficients = [c.numpy() for c in coefficients]
          +print("Final Coefficients:", final_coefficients)
          +
          +plt.plot(df["Level"], df["Salary"], label="Original Data")
          +plt.plot(df["Level"],[tf.math.polyval(final_coefficients, tf.constant(x, dtype=tf.float32)).numpy() for x in df["Level"]])
          +plt.ylabel('Salary')
          +plt.xlabel('Position')
          +plt.title("Salary vs Position")
          +plt.show()
          +
          + +
          + + + +## Code Snippet for a Polynomial of Degree N + +### Using Gradient Tape + +This should work regardless of the Keras backend version (2 or 3) +
          + +
          import tensorflow as tf
          +import numpy as np
          +import pandas as pd
          +import matplotlib.pyplot as plt
          +
          +df = pd.read_csv("data.csv")
          +
          +############################
          +## Change Parameters Here ##
          +############################
          +x_column = "Level"         #
          +y_column = "Salary"        #
          +degree = 2                 #
          +learning_rate = 0.3        #
          +num_epochs = 25_000        #
          +############################
          +
          +X = tf.constant(df[x_column], dtype=tf.float32)
          +Y = tf.constant(df[y_column], dtype=tf.float32)
          +
          +coefficients = [tf.Variable(np.random.randn() * 0.01, dtype=tf.float32) for _ in range(degree + 1)]
          +
          +optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
          +
          +for epoch in range(num_epochs):
          +    with tf.GradientTape() as tape:
          +        y_pred = tf.math.polyval(coefficients, X)
          +        loss = tf.reduce_mean(tf.square(Y - y_pred))
          +    grads = tape.gradient(loss, coefficients)
          +    optimizer.apply_gradients(zip(grads, coefficients))
          +    if (epoch+1) % 1000 == 0:
          +        print(f"Epoch: {epoch+1}, Loss: {loss.numpy()}")
          +
          +final_coefficients = [c.numpy() for c in coefficients]
          +print("Final Coefficients:", final_coefficients)
          +
          +print("Final Equation:", end=" ")
          +for i in range(degree+1):
          +  print(f"{final_coefficients[i]} * x^{degree-i}", end=" + " if i < degree else "\n")
          +
          +plt.plot(X, Y, label="Original Data")
          +plt.plot(X,[tf.math.polyval(final_coefficients, tf.constant(x, dtype=tf.float32)).numpy() for x in df[x_column]]), label="Our Poynomial"
          +plt.ylabel(y_column)
          +plt.xlabel(x_column)
          +plt.title(f"{x_column} vs {y_column}")
          +plt.legend()
          +plt.show()
          +
          + +
          + + +### Without Gradient Tape + +This relies on the Optimizer's `minimize` function and uses the `var_list` parameter to update the variables. + +This will not work with Keras 3 backend in TF 2.16.0 and above unless you switch to the legacy backend. +
          + +
          import tensorflow as tf
          +import numpy as np
          +import pandas as pd
          +import matplotlib.pyplot as plt
          +
          +df = pd.read_csv("data.csv")
          +
          +############################
          +## Change Parameters Here ##
          +############################
          +x_column = "Level"         #
          +y_column = "Salary"        #
          +degree = 2                 #
          +learning_rate = 0.3        #
          +num_epochs = 25_000        #
          +############################
          +
          +X = tf.constant(df[x_column], dtype=tf.float32)
          +Y = tf.constant(df[y_column], dtype=tf.float32)
          +
          +coefficients = [tf.Variable(np.random.randn() * 0.01, dtype=tf.float32) for _ in range(degree + 1)]
          +
          +optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
          +
          +def loss_function():
          +  pred_y = tf.math.polyval(coefficients, X)
          +  return tf.reduce_mean(tf.square(pred_y - Y))
          +
          +for epoch in range(num_epochs):
          +    optimizer.minimize(loss_function, var_list=coefficients)
          +    if (epoch+1) % 1000 == 0:
          +        current_loss = loss_function().numpy()
          +        print(f"Epoch {epoch+1}: Training Loss: {current_loss}")
          +
          +final_coefficients = coefficients.numpy()
          +print("Final Coefficients:", final_coefficients)
          +
          +print("Final Equation:", end=" ")
          +for i in range(degree+1):
          +  print(f"{final_coefficients[i]} * x^{degree-i}", end=" + " if i < degree else "\n")
          +
          +plt.plot(X, Y, label="Original Data")
          +plt.plot(X,[tf.math.polyval(final_coefficients, tf.constant(x, dtype=tf.float32)).numpy() for x in df[x_column]], label="Our Polynomial")
          +plt.ylabel(y_column)
          +plt.xlabel(x_column)
          +plt.legend()
          +plt.title(f"{x_column} vs {y_column}")
          +plt.show()
          +
          + +
          + + + +As always, remember to tweak the parameters and choose the correct model for the job. A polynomial regression model might not even be the best model for this particular dataset. + +## Further Programming + +How would you modify this code to use another type of nonlinear regression? Say, $ y = ab^x $ + +Hint: Your loss calculation would be similar to: +
          + +
          bx = tf.pow(coefficients[1], X)
          +pred_y = tf.math.multiply(coefficients[0], bx)
          +loss = tf.reduce_mean(tf.square(pred_y - Y))
          +
          + +

          +]]>
          +
          + https://web.navan.dev/posts/hello-world.html diff --git a/docs/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png b/docs/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png new file mode 100644 index 0000000..0dbdd08 Binary files /dev/null and b/docs/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png differ diff --git a/docs/index.html b/docs/index.html index f6a4942..0a3070a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -50,6 +50,21 @@

          Recent Posts

          For all posts go to Posts diff --git a/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html b/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html new file mode 100644 index 0000000..c1a4ae4 --- /dev/null +++ b/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html @@ -0,0 +1,311 @@ + + + + + + + + + Polynomial Regression Using TensorFlow 2.x + + + + + + + + + + + + + + + + + + + + + +
          +
          + +
          + +

          Polynomial Regression Using TensorFlow 2.x

          + +

          I have a similar post titled Polynomial Regression Using Tensorflow that used tensorflow.compat.v1 (Which still works as of TF 2.16). But, I thought it would be nicer to redo it with newer TF versions.

          + +

          I will be skipping all the introductions about polynomial regression and jumping straight to the code. Personally, I prefer using scikit-learn for this task.

          + +

          Position vs Salary Dataset

          + +

          Again, we will be using https://drive.google.com/file/d/1tNL4jxZEfpaP4oflfSn6pIHJX7Pachm9/view (Salary vs Position Dataset)

          + +

          If you are in a Python Notebook environment like Kaggle or Google Colaboratory, you can simply run:

          + +
          +
          !wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1tNL4jxZEfpaP4oflfSn6pIHJX7Pachm9' -O data.csv
          +
          +
          + +

          Code

          + +

          If you just want to copy-paste the code, scroll to the bottom for the entire snippet. Here I will try and walk through setting up code for a 3rd-degree (cubic) polynomial

          + +

          Imports

          + +
          +
          import pandas as pd
          +import tensorflow as tf
          +import matplotlib.pyplot as plt
          +import numpy as np
          +
          +
          + +

          Reading the Dataset

          + +
          +
          df = pd.read_csv("data.csv")
          +
          +
          + +

          Variables and Constants

          + +

          Here, we initialize the X and Y values as constants, since they are not going to change. The coefficients are defined as variables.

          + +
          +
          X = tf.constant(df["Level"], dtype=tf.float32)
          +Y = tf.constant(df["Salary"], dtype=tf.float32)
          +
          +coefficients = [tf.Variable(np.random.randn() * 0.01, dtype=tf.float32) for _ in range(4)]
          +
          +
          + +

          Here, X and Y are the values from our dataset. We initialize the coefficients for the equations as small random values.

          + +

          These coefficients are evaluated by Tensorflow's tf.math.poyval function which returns the n-th order polynomial based on how many coefficients are passed. Since our list of coefficients contains 4 different variables, it will be evaluated as:

          + +
          y = (x**3)*coefficients[3] + (x**2)*coefficients[2] + (x**1)*coefficients[1] (x**0)*coefficients[0]
          +
          + +

          Which is equivalent to the general cubic equation:

          + +

          + +$$ +y = ax^3 + bx^2 + cx + d +$$ + +### Optimizer Selection & Training +

          + +
          optimizer = tf.keras.optimizers.Adam(learning_rate=0.3)
          +num_epochs = 10_000
          +
          +for epoch in range(num_epochs):
          +    with tf.GradientTape() as tape:
          +        y_pred = tf.math.polyval(coefficients, X)
          +        loss = tf.reduce_mean(tf.square(y - y_pred))
          +    grads = tape.gradient(loss, coefficients)
          +    optimizer.apply_gradients(zip(grads, coefficients))
          +    if (epoch+1) % 1000 == 0:
          +        print(f"Epoch: {epoch+1}, Loss: {loss.numpy()}"
          +
          + +
          + + +In TensorFlow 1, we would have been using `tf.Session` instead. + +Here we are using `GradientTape()` instead, to keep track of the loss evaluation and coefficients. This is crucial, as our optimizer needs these gradients to be able to optimize our coefficients. + +Our loss function is Mean Squared Error (MSE) + +$$ += \frac{1}{n}\sum_{i=1}^{n} (Y_i - \^{Y_i}) +$$ + +Where $\^{Y_i}$ is the predicted value and $Y_i$ is the actual value + +### Plotting Final Coefficients +
          + +
          final_coefficients = [c.numpy() for c in coefficients]
          +print("Final Coefficients:", final_coefficients)
          +
          +plt.plot(df["Level"], df["Salary"], label="Original Data")
          +plt.plot(df["Level"],[tf.math.polyval(final_coefficients, tf.constant(x, dtype=tf.float32)).numpy() for x in df["Level"]])
          +plt.ylabel('Salary')
          +plt.xlabel('Position')
          +plt.title("Salary vs Position")
          +plt.show()
          +
          + +
          + + + +## Code Snippet for a Polynomial of Degree N + +### Using Gradient Tape + +This should work regardless of the Keras backend version (2 or 3) +
          + +
          import tensorflow as tf
          +import numpy as np
          +import pandas as pd
          +import matplotlib.pyplot as plt
          +
          +df = pd.read_csv("data.csv")
          +
          +############################
          +## Change Parameters Here ##
          +############################
          +x_column = "Level"         #
          +y_column = "Salary"        #
          +degree = 2                 #
          +learning_rate = 0.3        #
          +num_epochs = 25_000        #
          +############################
          +
          +X = tf.constant(df[x_column], dtype=tf.float32)
          +Y = tf.constant(df[y_column], dtype=tf.float32)
          +
          +coefficients = [tf.Variable(np.random.randn() * 0.01, dtype=tf.float32) for _ in range(degree + 1)]
          +
          +optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
          +
          +for epoch in range(num_epochs):
          +    with tf.GradientTape() as tape:
          +        y_pred = tf.math.polyval(coefficients, X)
          +        loss = tf.reduce_mean(tf.square(Y - y_pred))
          +    grads = tape.gradient(loss, coefficients)
          +    optimizer.apply_gradients(zip(grads, coefficients))
          +    if (epoch+1) % 1000 == 0:
          +        print(f"Epoch: {epoch+1}, Loss: {loss.numpy()}")
          +
          +final_coefficients = [c.numpy() for c in coefficients]
          +print("Final Coefficients:", final_coefficients)
          +
          +print("Final Equation:", end=" ")
          +for i in range(degree+1):
          +  print(f"{final_coefficients[i]} * x^{degree-i}", end=" + " if i < degree else "\n")
          +
          +plt.plot(X, Y, label="Original Data")
          +plt.plot(X,[tf.math.polyval(final_coefficients, tf.constant(x, dtype=tf.float32)).numpy() for x in df[x_column]]), label="Our Poynomial"
          +plt.ylabel(y_column)
          +plt.xlabel(x_column)
          +plt.title(f"{x_column} vs {y_column}")
          +plt.legend()
          +plt.show()
          +
          + +
          + + +### Without Gradient Tape + +This relies on the Optimizer's `minimize` function and uses the `var_list` parameter to update the variables. + +This will not work with Keras 3 backend in TF 2.16.0 and above unless you switch to the legacy backend. +
          + +
          import tensorflow as tf
          +import numpy as np
          +import pandas as pd
          +import matplotlib.pyplot as plt
          +
          +df = pd.read_csv("data.csv")
          +
          +############################
          +## Change Parameters Here ##
          +############################
          +x_column = "Level"         #
          +y_column = "Salary"        #
          +degree = 2                 #
          +learning_rate = 0.3        #
          +num_epochs = 25_000        #
          +############################
          +
          +X = tf.constant(df[x_column], dtype=tf.float32)
          +Y = tf.constant(df[y_column], dtype=tf.float32)
          +
          +coefficients = [tf.Variable(np.random.randn() * 0.01, dtype=tf.float32) for _ in range(degree + 1)]
          +
          +optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
          +
          +def loss_function():
          +  pred_y = tf.math.polyval(coefficients, X)
          +  return tf.reduce_mean(tf.square(pred_y - Y))
          +
          +for epoch in range(num_epochs):
          +    optimizer.minimize(loss_function, var_list=coefficients)
          +    if (epoch+1) % 1000 == 0:
          +        current_loss = loss_function().numpy()
          +        print(f"Epoch {epoch+1}: Training Loss: {current_loss}")
          +
          +final_coefficients = coefficients.numpy()
          +print("Final Coefficients:", final_coefficients)
          +
          +print("Final Equation:", end=" ")
          +for i in range(degree+1):
          +  print(f"{final_coefficients[i]} * x^{degree-i}", end=" + " if i < degree else "\n")
          +
          +plt.plot(X, Y, label="Original Data")
          +plt.plot(X,[tf.math.polyval(final_coefficients, tf.constant(x, dtype=tf.float32)).numpy() for x in df[x_column]], label="Our Polynomial")
          +plt.ylabel(y_column)
          +plt.xlabel(x_column)
          +plt.legend()
          +plt.title(f"{x_column} vs {y_column}")
          +plt.show()
          +
          + +
          + + + +As always, remember to tweak the parameters and choose the correct model for the job. A polynomial regression model might not even be the best model for this particular dataset. + +## Further Programming + +How would you modify this code to use another type of nonlinear regression? Say, $ y = ab^x $ + +Hint: Your loss calculation would be similar to: +
          + +
          bx = tf.pow(coefficients[1], X)
          +pred_y = tf.math.multiply(coefficients[0], bx)
          +loss = tf.reduce_mean(tf.square(pred_y - Y))
          +
          + +

          + +
          If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
          + +
          + +
          +
          + + + + + \ No newline at end of file diff --git a/docs/posts/index.html b/docs/posts/index.html index 2d9d613..d886b19 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -52,6 +52,21 @@
            +
          • Polynomial Regression Using TensorFlow 2.x
          • +
              +
            • Predicting n-th degree polynomials using TensorFlow 2.x
            • +
            • Published On: 2024-03-21 12:46
            • +
            • Tags: + + Tutorial, + + Tensorflow, + + Colab + +
            + +
          • Cross-Compiling Hello World for DOS on macOS
            • This goes through compiling Open Watcom 2 and creating simple hello-world exampls
            • diff --git a/docs/tags/Colab.html b/docs/tags/Colab.html index a3721a7..fd8ef08 100644 --- a/docs/tags/Colab.html +++ b/docs/tags/Colab.html @@ -49,6 +49,21 @@
                +
              • Polynomial Regression Using TensorFlow 2.x
              • +
                  +
                • Predicting n-th degree polynomials using TensorFlow 2.x
                • +
                • Published On: 2024-03-21 12:46
                • +
                • Tags: + + Tutorial, + + Tensorflow, + + Colab + +
                + +
              • Installing RDKit on Google Colab
                • Install RDKit on Google Colab with one code snippet.
                • diff --git a/docs/tags/Tensorflow.html b/docs/tags/Tensorflow.html index 3bcb911..04006bb 100644 --- a/docs/tags/Tensorflow.html +++ b/docs/tags/Tensorflow.html @@ -49,6 +49,21 @@
                    +
                  • Polynomial Regression Using TensorFlow 2.x
                  • +
                      +
                    • Predicting n-th degree polynomials using TensorFlow 2.x
                    • +
                    • Published On: 2024-03-21 12:46
                    • +
                    • Tags: + + Tutorial, + + Tensorflow, + + Colab + +
                    + +
                  • Polynomial Regression Using TensorFlow
                    • Polynomial regression using TensorFlow
                    • -- cgit v1.2.3 From aae00025bd8bff04de90b22b2472aed8a232f476 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Tue, 26 Mar 2024 18:21:29 -0600 Subject: post testing latex extra --- ...4-03-26-Derivation-of-the-Quadratic-Equation.md | 55 +++++++++++++ ...-03-26-Derivation-of-the-Quadratic-Equation.png | Bin 0 -> 21809 bytes docs/feed.rss | 60 +++++++++++--- ...-03-26-Derivation-of-the-Quadratic-Equation.png | Bin 0 -> 21809 bytes docs/index.html | 24 +++--- ...3-21-Polynomial-Regression-in-TensorFlow-2.html | 10 +-- ...03-26-Derivation-of-the-Quadratic-Equation.html | 90 +++++++++++++++++++++ docs/posts/index.html | 11 +++ docs/tags/mathematics.html | 11 +++ 9 files changed, 232 insertions(+), 29 deletions(-) create mode 100644 Content/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.md create mode 100644 Resources/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png create mode 100644 docs/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png create mode 100644 docs/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html (limited to 'docs/images/opengraph/posts') diff --git a/Content/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.md b/Content/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.md new file mode 100644 index 0000000..0435a6c --- /dev/null +++ b/Content/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.md @@ -0,0 +1,55 @@ +--- +date: 2024-03-26 15:36 +description: Quick derivation of the quadratic equation by completing the square +tags: mathematics +--- + +# Quadratic Formula Derivation + +The standard form of a quadratic equation is: + +$$ +ax^2 + bx + c = 0 +$$ + +Here, $a, b, c \in \mathbb{R}$, and $a \neq 0$ + +We begin by first dividing both sides by the coefficient $a$ + +$$ +\implies x^2 + \frac{b}{a}x + \frac{c}{a} = 0 +$$ + +We can rearrange the equation: + +$$ +x^2 + \frac{b}{a}x = - \frac{c}{a} +$$ + +We can then use the method of completing the square. ([Maths is Fun](https://www.mathsisfun.com/algebra/completing-square.html) has a really good explanation for this technique) + +$$ +x^2 + \frac{b}{a}x + (\frac{b}{2a})^2 = \frac{-c}{a} + (\frac{b}{2a})^2 +$$ + +On our LHS, we can clearly recognize that it is the expanded form of $(x + d)^2$ i.e $x^2 + 2x\cdot d + d^2$ + +$$ +\implies (x + \frac{b}{2a})^2 = \frac{-c}{a} + \frac{b^2}{4a^2} = \frac{-4ac + b^2}{4a^2} +$$ + +Taking the square root of both sides + +$$ +\begin{align*} +x + \frac{b}{2a} &= \frac{\sqrt{-4ac + b^2}}{2a} \\ +x &= \frac{\pm \sqrt{-4ac + b^2} - b}{2a} \\ +&= \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} +\end{align*} +$$ + +This gives you the world famous quadratic formula: + +$$ +x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} +$$ diff --git a/Resources/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png b/Resources/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png new file mode 100644 index 0000000..2464364 Binary files /dev/null and b/Resources/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png differ diff --git a/docs/feed.rss b/docs/feed.rss index 12e9f8d..12b90df 100644 --- a/docs/feed.rss +++ b/docs/feed.rss @@ -4,8 +4,8 @@ Navan's Archive Rare Tips, Tricks and Posts https://web.navan.dev/en - Thu, 21 Mar 2024 14:27:28 -0000 - Thu, 21 Mar 2024 14:27:28 -0000 + Tue, 26 Mar 2024 18:20:37 -0000 + Tue, 26 Mar 2024 18:20:37 -0000 250 @@ -557,9 +557,7 @@ creating a DOS -

                      $$ -y = ax^3 + bx^2 + cx + d -$$

                      +y=ax3+bx2+cx+d

                      Optimizer Selection & Training

                      @@ -584,9 +582,7 @@ $$

                      Our loss function is Mean Squared Error (MSE):

                      -

                      $$ -= \frac{1}{n} \sum_{i=1}^{n}{(Y_i - \hat{Y_i})^2} -$$

                      +=1ni=1n(Y_iY_i^)2

                      Where Yi^ is the predicted value and Yi is the actual value

                      @@ -726,7 +722,7 @@ $$

                      How would you modify this code to use another type of nonlinear regression? Say,

                      -

                      $$ y = ab^x $$

                      +y=abx

                      Hint: Your loss calculation would be similar to:

                      @@ -3186,6 +3182,52 @@ values using the X values. We then plot it to compare the actual data and predic ]]> + + + https://web.navan.dev/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html + + + Quadratic Formula Derivation + + + Quick derivation of the quadratic equation by completing the square + + https://web.navan.dev/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html + Tue, 26 Mar 2024 15:36:00 -0000 + Quadratic Formula Derivation + +

                      The standard form of a quadratic equation is:

                      + +ax2+bx+c=0 + +

                      Here, a,b,c, and a0

                      + +

                      We begin by first dividing both sides by the coefficient a

                      + +x2+bax+ca=0 + +

                      We can rearrange the equation:

                      + +x2+bax=ca + +

                      We can then use the method of completing the square. (Maths is Fun has a really good explanation for this technique)

                      + +x2+bax+(b2a)2=ca+(b2a)2 + +

                      On our LHS, we can clearly recognize that it is the expanded form of (x+d)2 i.e x2+2x·d+d2

                      + +(x+b2a)2=ca+b24a2=4ac+b24a2 + +

                      Taking the square root of both sides

                      + +x+b2a=4ac+b22ax=±4ac+b2b2a=b±b24ac2a + +

                      This gives you the world famous quadratic formula:

                      + +x=b±b24ac2a +]]>
                      +
                      + https://web.navan.dev/posts/2022-08-05-Why-You-No-Host.html diff --git a/docs/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png b/docs/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png new file mode 100644 index 0000000..2464364 Binary files /dev/null and b/docs/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png differ diff --git a/docs/index.html b/docs/index.html index 0a3070a..c462f4b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -50,6 +50,17 @@

                      Recent Posts

                      For all posts go to Posts diff --git a/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html b/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html index 7a25daf..ab46ec7 100644 --- a/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html +++ b/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html @@ -107,9 +107,7 @@ -

                      $$ -y = ax^3 + bx^2 + cx + d -$$

                      +y=ax3+bx2+cx+d

                      Optimizer Selection & Training

                      @@ -134,9 +132,7 @@ $$

                      Our loss function is Mean Squared Error (MSE):

                      -

                      $$ -= \frac{1}{n} \sum_{i=1}^{n}{(Y_i - \hat{Y_i})^2} -$$

                      +=1ni=1n(Y_iY_i^)2

                      Where Yi^ is the predicted value and Yi is the actual value

                      @@ -276,7 +272,7 @@ $$

                      How would you modify this code to use another type of nonlinear regression? Say,

                      -

                      $$ y = ab^x $$

                      +y=abx

                      Hint: Your loss calculation would be similar to:

                      diff --git a/docs/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html b/docs/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html new file mode 100644 index 0000000..6f02f7c --- /dev/null +++ b/docs/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html @@ -0,0 +1,90 @@ + + + + + + + + + Quadratic Formula Derivation + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + +
                      + +

                      Quadratic Formula Derivation

                      + +

                      The standard form of a quadratic equation is:

                      + +ax2+bx+c=0 + +

                      Here, a,b,c, and a0

                      + +

                      We begin by first dividing both sides by the coefficient a

                      + +x2+bax+ca=0 + +

                      We can rearrange the equation:

                      + +x2+bax=ca + +

                      We can then use the method of completing the square. (Maths is Fun has a really good explanation for this technique)

                      + +x2+bax+(b2a)2=ca+(b2a)2 + +

                      On our LHS, we can clearly recognize that it is the expanded form of (x+d)2 i.e x2+2x·d+d2

                      + +(x+b2a)2=ca+b24a2=4ac+b24a2 + +

                      Taking the square root of both sides

                      + +x+b2a=4ac+b22ax=±4ac+b2b2a=b±b24ac2a + +

                      This gives you the world famous quadratic formula:

                      + +x=b±b24ac2a + +
                      If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
                      + +
                      + +
                      +
                      + + + + + \ No newline at end of file diff --git a/docs/posts/index.html b/docs/posts/index.html index d886b19..40b6a92 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -52,6 +52,17 @@
                        +
                      • Quadratic Formula Derivation
                      • +
                          +
                        • Quick derivation of the quadratic equation by completing the square
                        • +
                        • Published On: 2024-03-26 15:36
                        • +
                        • Tags: + + mathematics + +
                        + +
                      • Polynomial Regression Using TensorFlow 2.x
                        • Predicting n-th degree polynomials using TensorFlow 2.x
                        • diff --git a/docs/tags/mathematics.html b/docs/tags/mathematics.html index b948423..eb5201c 100644 --- a/docs/tags/mathematics.html +++ b/docs/tags/mathematics.html @@ -49,6 +49,17 @@
                            +
                          • Quadratic Formula Derivation
                          • +
                              +
                            • Quick derivation of the quadratic equation by completing the square
                            • +
                            • Published On: 2024-03-26 15:36
                            • +
                            • Tags: + + mathematics + +
                            + +
                          • n-body solution generator
                            • n-body solution generator and solver
                            • -- cgit v1.2.3 From fdf67099dbe882b50444a42e4bbd024394cfb548 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Thu, 28 Mar 2024 21:28:46 -0600 Subject: adfrsuite --- .../2024-03-28-Running-ADFRSuite-on-arm64-Macs.md | 379 ++++++++++++++++ .../2024-03-28-Running-ADFRSuite-on-arm64-Macs.png | Bin 0 -> 26043 bytes docs/feed.rss | 412 +++++++++++++++++- .../2024-03-28-Running-ADFRSuite-on-arm64-Macs.png | Bin 0 -> 26043 bytes docs/index.html | 26 +- ...2024-03-28-Running-ADFRSuite-on-arm64-Macs.html | 484 +++++++++++++++++++++ docs/posts/index.html | 13 + docs/tags/Cheminformatics.html | 13 + docs/tags/macOS.html | 13 + 9 files changed, 1325 insertions(+), 15 deletions(-) create mode 100644 Content/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.md create mode 100644 Resources/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png create mode 100644 docs/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png create mode 100644 docs/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.html (limited to 'docs/images/opengraph/posts') diff --git a/Content/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.md b/Content/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.md new file mode 100644 index 0000000..f43f15c --- /dev/null +++ b/Content/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.md @@ -0,0 +1,379 @@ +--- +date: 2024-03-28 20:12 +description: Fixing ADFRsuite on M1/MX chip Macs - CLI Tools +tags: macOS, Cheminformatics +--- + +# Fixing ADFRSuite for Apple Silicon + +We are going to be running everything through Rosetta 2. I am confident that if I had access to the original source code, I could find a way to run everything natively. + +These are the following issues that we will be fixing in this part: + +* “python2.7” cannot be opened because the developer cannot be verified. +* OpenBabel Error +* Segmentation fault while running the [redocking tutorial](https://ccsb.scripps.edu/adcp/tutorial-redocking/) + +For the sake of simplicity, I am assuming that I am running all these commands in the folder `~/Developer/scrippstuff/` + +## Installing Rosetta 2 + +We are going to run all of these steps in the terminal + +```bash +/usr/sbin/softwareupdate --install-rosetta --agree-to-license +``` + +### Install Homebrew for x86 + +Both versions of homebrew (x86 and arm64) can peacefully coexist on your system. + +From now on, every command should be run in a terminal session that starts with this as the first command: + +```bash +arch -x86_64 zsh +``` + +Now, we can install homebrew: + +```bash +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` + +Here is my output: + +``` bash +➜ scrippstuff uname -a +Darwin Navans-MacBook-Pro.local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020 x86_64 +➜ scrippstuff /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +==> Checking for `sudo` access (which may request your password)... +Password: +==> This script will install: +/usr/local/bin/brew +/usr/local/share/doc/homebrew +/usr/local/share/man/man1/brew.1 +/usr/local/share/zsh/site-functions/_brew +/usr/local/etc/bash_completion.d/brew +/usr/local/Homebrew +==> The following new directories will be created: +/usr/local/Cellar +/usr/local/Caskroom + +Press RETURN/ENTER to continue or any other key to abort: +==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Caskroom +==> /usr/bin/sudo /bin/chmod ug=rwx /usr/local/Cellar /usr/local/Caskroom +==> /usr/bin/sudo /usr/sbin/chown navanchauhan /usr/local/Cellar /usr/local/Caskroom +==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Caskroom +==> /usr/bin/sudo /usr/sbin/chown -R navanchauhan:admin /usr/local/Homebrew +==> /usr/bin/sudo /bin/mkdir -p /Users/navanchauhan/Library/Caches/Homebrew +==> /usr/bin/sudo /bin/chmod g+rwx /Users/navanchauhan/Library/Caches/Homebrew +==> /usr/bin/sudo /usr/sbin/chown -R navanchauhan /Users/navanchauhan/Library/Caches/Homebrew +==> Downloading and installing Homebrew... +remote: Enumerating objects: 47, done. +remote: Counting objects: 100% (47/47), done. +remote: Compressing objects: 100% (19/19), done. +remote: Total 47 (delta 28), reused 47 (delta 28), pack-reused 0 +Unpacking objects: 100% (47/47), 6.11 KiB | 223.00 KiB/s, done. +From https://github.com/Homebrew/brew + + 18ebdd8c8f...67a096fcbb tapioca-compiler-for-tty-rbi -> origin/tapioca-compiler-for-tty-rbi (forced update) +Switched to and reset branch 'stable' +==> Updating Homebrew... +==> Installation successful! + +==> Homebrew has enabled anonymous aggregate formulae and cask analytics. +Read the analytics documentation (and how to opt-out) here: + https://docs.brew.sh/Analytics +No analytics data has been sent yet (nor will any be during this install run). + +==> Homebrew is run entirely by unpaid volunteers. Please consider donating: + https://github.com/Homebrew/brew#donations + +==> Next steps: +- Run these two commands in your terminal to add Homebrew to your PATH: + (echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/navanchauhan/.zprofile + eval "$(/usr/local/bin/brew shellenv)" +- Run brew help to get started +- Further documentation: + https://docs.brew.sh +``` + +At this point, you don't need to edit your `zshrc` or `zsh_profile`. + +### Install pyenv + +The reason we are installing pyenv is because it is easier to build Python 2.7.18 from scratch than messing around with codesigning and quarantine bs on macOS. + +```bash +➜ scrippstuff brew install pyenv +==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/manifests/2.3.36 +############################################################################################################################################################### 100.0% +==> Fetching dependencies for pyenv: m4, autoconf, ca-certificates, openssl@3, pkg-config and readline +==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19 +############################################################################################################################################################### 100.0% +==> Fetching m4 +==> Downloading https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:8434a67a4383836b2531a6180e068640c5b482ee6781b673d65712e4fc86ca76 +############################################################################################################################################################### 100.0% +==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/manifests/2.72 +############################################################################################################################################################### 100.0% +==> Fetching autoconf +==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/blobs/sha256:12368e33b89d221550ba9e261b0c6ece0b0e89250fb4c95169d09081e0ebb2dd +############################################################################################################################################################### 100.0% +==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2024-03-11 +############################################################################################################################################################### 100.0% +==> Fetching ca-certificates +==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:cab828953672906e00a8f25db751977b8dc4115f021f8dfe82b644ade03dacdb +############################################################################################################################################################### 100.0% +==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.2.1-1 +############################################################################################################################################################### 100.0% +==> Fetching openssl@3 +==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:ef8211c5115fc85f01261037f8fea76cc432b92b4fb23bc87bbf41e9198fcc0f +############################################################################################################################################################### 100.0% +==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/manifests/0.29.2_3 +############################################################################################################################################################### 100.0% +==> Fetching pkg-config +==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/blobs/sha256:421571f340277c62c5cc6fd68737bd7c4e085de113452ea49b33bcd46509bb12 +############################################################################################################################################################### 100.0% +==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.10 +############################################################################################################################################################### 100.0% +==> Fetching readline +==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:9796e0ff1cc29ae7e75d8fc1a3e2c5e8ae2aeade8d9d59a16363306bf6c5b8f4 +############################################################################################################################################################### 100.0% +==> Fetching pyenv +==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/blobs/sha256:d117a99ed53502aff29109bfa366693ca623f2326e1e6b4db68fef7b7f63eeba +############################################################################################################################################################### 100.0% +==> Installing dependencies for pyenv: m4, autoconf, ca-certificates, openssl@3, pkg-config and readline +==> Installing pyenv dependency: m4 +==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19 +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/5b2a7f715487b7377e409e8ca58569040cd89f33859f691210c58d94410fd33b--m4-1.4.19.bottle_manifest.json +==> Pouring m4--1.4.19.sonoma.bottle.tar.gz +🍺 /usr/local/Cellar/m4/1.4.19: 13 files, 739.9KB +==> Installing pyenv dependency: autoconf +==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/manifests/2.72 +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/b73cdb320c4261bbf8d02d03e50dc755c869c5859c1d4e93616898fc7cd939ff--autoconf-2.72.bottle_manifest.json +==> Pouring autoconf--2.72.sonoma.bottle.tar.gz +🍺 /usr/local/Cellar/autoconf/2.72: 71 files, 3.6MB +==> Installing pyenv dependency: ca-certificates +==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2024-03-11 +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/c431e0186df2ccc2ea942b34a3c26c2cebebec8e07ad6abdae48447a52c5f506--ca-certificates-2024-03-11.bottle_manifest.json +==> Pouring ca-certificates--2024-03-11.all.bottle.tar.gz +==> Regenerating CA certificate bundle from keychain, this may take a while... +🍺 /usr/local/Cellar/ca-certificates/2024-03-11: 3 files, 229.6KB +==> Installing pyenv dependency: openssl@3 +==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.2.1-1 +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/f7b6e249843882452d784a8cbc4e19231186230b9e485a2a284d5c1952a95ec2--openssl@3-3.2.1-1.bottle_manifest.json +==> Pouring openssl@3--3.2.1.sonoma.bottle.1.tar.gz +🍺 /usr/local/Cellar/openssl@3/3.2.1: 6,874 files, 32.5MB +==> Installing pyenv dependency: pkg-config +==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/manifests/0.29.2_3 +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/ac691fc7ab8ecffba32a837e7197101d271474a3a84cfddcc30c9fd6763ab3c6--pkg-config-0.29.2_3.bottle_manifest.json +==> Pouring pkg-config--0.29.2_3.sonoma.bottle.tar.gz +🍺 /usr/local/Cellar/pkg-config/0.29.2_3: 11 files, 656.4KB +==> Installing pyenv dependency: readline +==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.10 +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/4ddd52803319828799f1932d4c7fa8d11c667049b20a56341c0c19246a1be93b--readline-8.2.10.bottle_manifest.json +==> Pouring readline--8.2.10.sonoma.bottle.tar.gz +🍺 /usr/local/Cellar/readline/8.2.10: 50 files, 1.7MB +==> Installing pyenv +==> Pouring pyenv--2.3.36.sonoma.bottle.tar.gz +🍺 /usr/local/Cellar/pyenv/2.3.36: 1,158 files, 3.4MB +==> Running `brew cleanup pyenv`... +Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. +Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). +``` + +And, build the last version of Python 2.7 + +```bash +➜ scrippstuff PYENV_ROOT="~/Developer/scrippstuff" pyenv install 2.7.18 +python-build: use openssl from homebrew +python-build: use readline from homebrew +Downloading Python-2.7.18.tar.xz... +-> https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz +Installing Python-2.7.18... +patching file configure +patching file configure.ac +patching file setup.py +patching file 'Mac/Tools/pythonw.c' +patching file setup.py +patching file 'Doc/library/ctypes.rst' +patching file 'Lib/test/test_str.py' +patching file 'Lib/test/test_unicode.py' +patching file 'Modules/_ctypes/_ctypes.c' +patching file 'Modules/_ctypes/callproc.c' +patching file 'Modules/_ctypes/ctypes.h' +patching file 'Modules/_ctypes/callproc.c' +patching file setup.py +patching file 'Mac/Modules/qt/setup.py' +patching file setup.py +python-build: use readline from homebrew +python-build: use zlib from xcode sdk +Installed Python-2.7.18 to /Users/navanchauhan/Developer/scrippstuff/~/Developer/scrippstuff/versions/2.7.18 +``` + +Test the new installation: + +```bash +➜ scrippstuff ~/Developer/scrippstuff/\~/Developer/scrippstuff/versions/2.7.18/bin/python2.7 +Python 2.7.18 (default, Mar 28 2024, 20:47:13) +[GCC Apple LLVM 15.0.0 (clang-1500.1.0.2.5)] on darwin +Type "help", "copyright", "credits" or "license" for more information. +>>> from random import randint +>>> randint(0,10) +6 +>>> exit() +``` + +Now, we can compress this newly created Python version into a `tar.gz` file to replace the one provided in ADFRsuite_x86_64Darwin_1.0.tar.gz. Don't forget the `.` at the end + +```bash +➜ scrippstuff tar -C ./\~/Developer/scrippstuff/versions/2.7.18 -czf new.tar.gz . +``` + +## Install ADFRsuite + +If you don't already have the tarball, you can download it by: + +```bash +$ curl -o adfr.tar.gz https://ccsb.scripps.edu/adfr/download/1033/ +``` + +Uncompress it + +```bash +$ tar -xvzf adfr.tar.gz +``` + +Replace the provided Python archive with the one we created: + +```bash +$ cd ADFRsuite_x86_64Darwin_1.0 +$ mv new.tar.gz Python2.7.tar.gz +``` + +Note: For some reason simply copying it doesn't work and you need to use `mv` + +Just to not mess with anything else, I will be installing everything in a folder called `clean_install` + +```bash +$ mkdir clean_install +$ ./install.sh -d clean_install +... + ADFRsuite installation complete. +To run agfr, agfrgui, adfr, autosite, about, pythonsh scripts located at: +/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin +add /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin to the path environment variable in .cshrc or .bashrc: +.cshrc: +set path = (/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin $path) + +.bashrc: +export PATH=/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin:$PATH +``` + +Now, to test `agfr`, first run the command (replacing `navanchauhan` with yout username) + +```bash +$ export PATH=/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin:$PATH +$ agfr +➜ ADFRsuite_x86_64Darwin_1.0 agfr +============================== +*** Open Babel Error in openLib + /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/openbabel/2.4.1/acesformat.so did not load properly. + Error: dlopen(/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/openbabel/2.4.1/acesformat.so, 0x0009): Library not loaded: /opt/X11/lib/libcairo.2.dylib + Referenced from: <24174F3E-2670-79AC-4F26-F8B49774194A> /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/openbabel/2.4.1/acesformat.so + Reason: tried: '/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/libcairo.2.dylib' (no such file), '/opt/X11/lib/libcairo.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/X11/lib/libcairo.2.dylib' (no such file), '/opt/X11/lib/libcairo.2.dylib' (no such file), '/usr/local/lib/libcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache) +============================== +``` + + +## Fixing `Open Babel Error` + +```bash +$ brew install cairo +``` + +## Completing the re-docking tutorial + +### Dowbloading the dataset + +```bash +$ curl -o tutorial-data.zip https://ccsb.scripps.edu/adcp/download/1063/ +$ unzip tutorial-data.zip +$ cd ADCP_tutorial_data/3Q47 +``` + +### Conversion to PDBQT + +```bash +$ reduce 3Q47_rec.pdb > 3Q47_recH.pdb +$ reduce 3Q47_pep.pdb > 3Q47_pepH.pdb +``` + +### Preparing Receptor + +``` +$ prepare_receptor -r 3Q47_recH.pdb +$ prepare_ligand -l 3Q47_pepH.pdb +``` + +### Generate Target File + +```bash +$ agfr -r 3Q47_recH.pdbqt -l 3Q47_pepH.pdbqt -asv 1.1 -o 3Q47 +➜ 3Q47 agfr -r 3Q47_recH.pdbqt -l 3Q47_pepH.pdbqt -asv 1.1 -o 3Q47 +Traceback (most recent call last): + File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFR/bin/runAGFR.py", line 36, in + from ADFR.utils.runAGFR import runAGFR + File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFR/utils/runAGFR.py", line 41, in + from ADFR.utils.maps import flexResStr2flexRes + File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFR/utils/maps.py", line 35, in + from ADFRcc.adfr import GridMap + File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/__init__.py", line 34, in + from ADFRcc.adfr import Parameters + File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/adfr.py", line 43, in + import ADFRcc.adfrcc as CPP + File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/adfrcc.py", line 28, in + _adfrcc = swig_import_helper() + File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/adfrcc.py", line 24, in swig_import_helper + _mod = imp.load_module('_adfrcc', fp, pathname, description) +ImportError: dlopen(/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/_adfrcc.so, 0x0002): Library not loaded: /Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib + Referenced from: <424BF61E-BF0F-351E-B546-E82EBBD8FBF5> /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/_adfrcc.so + Reason: tried: '/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/libgomp.1.dylib' (no such file), '/Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib' (no such file), '/Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib' (no such file), '/usr/local/lib/libgomp.1.dylib' (no such file), '/usr/lib/libgomp.1.dylib' (no such file, not in dyld cache) +➜ 3Q47 +``` + +Sometimes this error is simply outputted as a segmentation fault. But, it is because it cannot find the `libgomp.1.dylib`. I haven't tested using a newer version of GCC to make it work. Building GCC 8 yourself is absolutely painful. We are going to use a copy generated by the homebrew team. + +```bash +$ cd ../../ +$ pwd +/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0 +$ curl -L -H "Authorization: Bearer QQ==" -o gcc8amd64.tar.gz https://ghcr.io/v2/homebrew/core/gcc/8/blobs/sha256:438d5902e5f21a5e8acb5920f1f5684ecfe0c645247d46c8d44c2bbe435966b2 +$ tar -xzf gcc8amd64.tar.gz +$ cp -r gcc@8/8.5.0/lib/gcc/8/* clean_install/lib/ +``` + +Now, we should be able to go back and run the target generation command: + +```bash +$ cd ADCP_tutorial_data/3Q47 +$ agfr -r 3Q47_recH.pdbqt -l 3Q47_pepH.pdbqt -asv 1.1 -o 3Q47 +################################################################# +# If you used AGFR in your work, please cite: # +# # +# P.A. Ravindranath S. Forli, D.S. Goodsell, A.J. Olson and # +# M.F. Sanner # +# AutoDockFR: Advances in Protein-Ligand Docking with # +... +``` + +### Docking Peptide + +```bash +$ adcp -t 3Q47.trg -s npisdvd -N 20 -n 1000000 -o 3Q47_redocking -ref 3Q47_pepH.pdb +``` + +There you have it. Running ADCP on the newest macOS version against all odds. + +I haven't yet looked into fixing/patching `agfrgui` as I don't use the software. But, if someone reallllly needs to run it on Apple Silicon, I am happy to take a look at monkeypatching it. + +In case years down the line the prebuilt version of GCC 8 is not available, let me know so I can replace the link with my mirror. diff --git a/Resources/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png b/Resources/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png new file mode 100644 index 0000000..4b1bad2 Binary files /dev/null and b/Resources/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png differ diff --git a/docs/feed.rss b/docs/feed.rss index 2cb2370..d4cd27c 100644 --- a/docs/feed.rss +++ b/docs/feed.rss @@ -4,8 +4,8 @@ Navan's Archive Rare Tips, Tricks and Posts https://web.navan.dev/en - Wed, 27 Mar 2024 23:45:05 -0000 - Wed, 27 Mar 2024 23:45:05 -0000 + Thu, 28 Mar 2024 21:27:46 -0000 + Thu, 28 Mar 2024 21:27:46 -0000 250 @@ -1953,6 +1953,414 @@ Serving HTTP on 0.0.0.0 port 8000 ... ]]> + + + https://web.navan.dev/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.html + + + Fixing ADFRSuite for Apple Silicon + + + Fixing ADFRsuite on M1/MX chip Macs - CLI Tools + + https://web.navan.dev/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.html + Thu, 28 Mar 2024 20:12:00 -0000 + Fixing ADFRSuite for Apple Silicon + +

                              We are going to be running everything through Rosetta 2. I am confident that if I had access to the original source code, I could find a way to run everything natively.

                              + +

                              These are the following issues that we will be fixing in this part:

                              + +
                                +
                              • “python2.7” cannot be opened because the developer cannot be verified.
                              • +
                              • OpenBabel Error
                              • +
                              • Segmentation fault while running the redocking tutorial
                              • +
                              + +

                              For the sake of simplicity, I am assuming that I am running all these commands in the folder ~/Developer/scrippstuff/

                              + +

                              Installing Rosetta 2

                              + +

                              We are going to run all of these steps in the terminal

                              + +
                              +
                              /usr/sbin/softwareupdate --install-rosetta --agree-to-license
                              +
                              +
                              + +

                              Install Homebrew for x86

                              + +

                              Both versions of homebrew (x86 and arm64) can peacefully coexist on your system.

                              + +

                              From now on, every command should be run in a terminal session that starts with this as the first command:

                              + +
                              +
                              arch -x86_64 zsh
                              +
                              +
                              + +

                              Now, we can install homebrew:

                              + +
                              +
                              /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
                              +
                              +
                              + +

                              Here is my output:

                              + +
                              +
                                scrippstuff uname -a
                              +Darwin Navans-MacBook-Pro.local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020 x86_64
                              +➜  scrippstuff /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
                              +==> Checking for `sudo` access (which may request your password)...
                              +Password:
                              +==> This script will install:
                              +/usr/local/bin/brew
                              +/usr/local/share/doc/homebrew
                              +/usr/local/share/man/man1/brew.1
                              +/usr/local/share/zsh/site-functions/_brew
                              +/usr/local/etc/bash_completion.d/brew
                              +/usr/local/Homebrew
                              +==> The following new directories will be created:
                              +/usr/local/Cellar
                              +/usr/local/Caskroom
                              +
                              +Press RETURN/ENTER to continue or any other key to abort:
                              +==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Caskroom
                              +==> /usr/bin/sudo /bin/chmod ug=rwx /usr/local/Cellar /usr/local/Caskroom
                              +==> /usr/bin/sudo /usr/sbin/chown navanchauhan /usr/local/Cellar /usr/local/Caskroom
                              +==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Caskroom
                              +==> /usr/bin/sudo /usr/sbin/chown -R navanchauhan:admin /usr/local/Homebrew
                              +==> /usr/bin/sudo /bin/mkdir -p /Users/navanchauhan/Library/Caches/Homebrew
                              +==> /usr/bin/sudo /bin/chmod g+rwx /Users/navanchauhan/Library/Caches/Homebrew
                              +==> /usr/bin/sudo /usr/sbin/chown -R navanchauhan /Users/navanchauhan/Library/Caches/Homebrew
                              +==> Downloading and installing Homebrew...
                              +remote: Enumerating objects: 47, done.
                              +remote: Counting objects: 100% (47/47), done.
                              +remote: Compressing objects: 100% (19/19), done.
                              +remote: Total 47 (delta 28), reused 47 (delta 28), pack-reused 0
                              +Unpacking objects: 100% (47/47), 6.11 KiB | 223.00 KiB/s, done.
                              +From https://github.com/Homebrew/brew
                              + + 18ebdd8c8f...67a096fcbb tapioca-compiler-for-tty-rbi -> origin/tapioca-compiler-for-tty-rbi  (forced update)
                              +Switched to and reset branch 'stable'
                              +==> Updating Homebrew...
                              +==> Installation successful!
                              +
                              +==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
                              +Read the analytics documentation (and how to opt-out) here:
                              +  https://docs.brew.sh/Analytics
                              +No analytics data has been sent yet (nor will any be during this install run).
                              +
                              +==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
                              +  https://github.com/Homebrew/brew#donations
                              +
                              +==> Next steps:
                              +- Run these two commands in your terminal to add Homebrew to your PATH:
                              +    (echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/navanchauhan/.zprofile
                              +    eval "$(/usr/local/bin/brew shellenv)"
                              +- Run brew help to get started
                              +- Further documentation:
                              +    https://docs.brew.sh
                              +
                              +
                              + +

                              At this point, you don't need to edit your zshrc or zsh_profile.

                              + +

                              Install pyenv

                              + +

                              The reason we are installing pyenv is because it is easier to build Python 2.7.18 from scratch than messing around with codesigning and quarantine bs on macOS.

                              + +
                              +
                                scrippstuff brew install pyenv
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/manifests/2.3.36
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching dependencies for pyenv: m4, autoconf, ca-certificates, openssl@3, pkg-config and readline
                              +==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching m4
                              +==> Downloading https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:8434a67a4383836b2531a6180e068640c5b482ee6781b673d65712e4fc86ca76
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/manifests/2.72
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching autoconf
                              +==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/blobs/sha256:12368e33b89d221550ba9e261b0c6ece0b0e89250fb4c95169d09081e0ebb2dd
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2024-03-11
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching ca-certificates
                              +==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:cab828953672906e00a8f25db751977b8dc4115f021f8dfe82b644ade03dacdb
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.2.1-1
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching openssl@3
                              +==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:ef8211c5115fc85f01261037f8fea76cc432b92b4fb23bc87bbf41e9198fcc0f
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/manifests/0.29.2_3
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching pkg-config
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/blobs/sha256:421571f340277c62c5cc6fd68737bd7c4e085de113452ea49b33bcd46509bb12
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.10
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching readline
                              +==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:9796e0ff1cc29ae7e75d8fc1a3e2c5e8ae2aeade8d9d59a16363306bf6c5b8f4
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching pyenv
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/blobs/sha256:d117a99ed53502aff29109bfa366693ca623f2326e1e6b4db68fef7b7f63eeba
                              +############################################################################################################################################################### 100.0%
                              +==> Installing dependencies for pyenv: m4, autoconf, ca-certificates, openssl@3, pkg-config and readline
                              +==> Installing pyenv dependency: m4
                              +==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/5b2a7f715487b7377e409e8ca58569040cd89f33859f691210c58d94410fd33b--m4-1.4.19.bottle_manifest.json
                              +==> Pouring m4--1.4.19.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/m4/1.4.19: 13 files, 739.9KB
                              +==> Installing pyenv dependency: autoconf
                              +==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/manifests/2.72
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/b73cdb320c4261bbf8d02d03e50dc755c869c5859c1d4e93616898fc7cd939ff--autoconf-2.72.bottle_manifest.json
                              +==> Pouring autoconf--2.72.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/autoconf/2.72: 71 files, 3.6MB
                              +==> Installing pyenv dependency: ca-certificates
                              +==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2024-03-11
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/c431e0186df2ccc2ea942b34a3c26c2cebebec8e07ad6abdae48447a52c5f506--ca-certificates-2024-03-11.bottle_manifest.json
                              +==> Pouring ca-certificates--2024-03-11.all.bottle.tar.gz
                              +==> Regenerating CA certificate bundle from keychain, this may take a while...
                              +🍺  /usr/local/Cellar/ca-certificates/2024-03-11: 3 files, 229.6KB
                              +==> Installing pyenv dependency: openssl@3
                              +==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.2.1-1
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/f7b6e249843882452d784a8cbc4e19231186230b9e485a2a284d5c1952a95ec2--openssl@3-3.2.1-1.bottle_manifest.json
                              +==> Pouring openssl@3--3.2.1.sonoma.bottle.1.tar.gz
                              +🍺  /usr/local/Cellar/openssl@3/3.2.1: 6,874 files, 32.5MB
                              +==> Installing pyenv dependency: pkg-config
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/manifests/0.29.2_3
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/ac691fc7ab8ecffba32a837e7197101d271474a3a84cfddcc30c9fd6763ab3c6--pkg-config-0.29.2_3.bottle_manifest.json
                              +==> Pouring pkg-config--0.29.2_3.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/pkg-config/0.29.2_3: 11 files, 656.4KB
                              +==> Installing pyenv dependency: readline
                              +==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.10
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/4ddd52803319828799f1932d4c7fa8d11c667049b20a56341c0c19246a1be93b--readline-8.2.10.bottle_manifest.json
                              +==> Pouring readline--8.2.10.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/readline/8.2.10: 50 files, 1.7MB
                              +==> Installing pyenv
                              +==> Pouring pyenv--2.3.36.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/pyenv/2.3.36: 1,158 files, 3.4MB
                              +==> Running `brew cleanup pyenv`...
                              +Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
                              +Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
                              +
                              +
                              + +

                              And, build the last version of Python 2.7

                              + +
                              +
                                scrippstuff PYENV_ROOT="~/Developer/scrippstuff" pyenv install 2.7.18
                              +python-build: use openssl from homebrew
                              +python-build: use readline from homebrew
                              +Downloading Python-2.7.18.tar.xz...
                              +-> https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
                              +Installing Python-2.7.18...
                              +patching file configure
                              +patching file configure.ac
                              +patching file setup.py
                              +patching file 'Mac/Tools/pythonw.c'
                              +patching file setup.py
                              +patching file 'Doc/library/ctypes.rst'
                              +patching file 'Lib/test/test_str.py'
                              +patching file 'Lib/test/test_unicode.py'
                              +patching file 'Modules/_ctypes/_ctypes.c'
                              +patching file 'Modules/_ctypes/callproc.c'
                              +patching file 'Modules/_ctypes/ctypes.h'
                              +patching file 'Modules/_ctypes/callproc.c'
                              +patching file setup.py
                              +patching file 'Mac/Modules/qt/setup.py'
                              +patching file setup.py
                              +python-build: use readline from homebrew
                              +python-build: use zlib from xcode sdk
                              +Installed Python-2.7.18 to /Users/navanchauhan/Developer/scrippstuff/~/Developer/scrippstuff/versions/2.7.18
                              +
                              +
                              + +

                              Test the new installation:

                              + +
                              +
                                scrippstuff ~/Developer/scrippstuff/\~/Developer/scrippstuff/versions/2.7.18/bin/python2.7
                              +Python 2.7.18 (default, Mar 28 2024, 20:47:13)
                              +[GCC Apple LLVM 15.0.0 (clang-1500.1.0.2.5)] on darwin
                              +Type "help", "copyright", "credits" or "license" for more information.
                              +>>> from random import randint
                              +>>> randint(0,10)
                              +6
                              +>>> exit()
                              +
                              +
                              + +

                              Now, we can compress this newly created Python version into a tar.gz file to replace the one provided in ADFRsuitex8664Darwin_1.0.tar.gz. Don't forget the . at the end

                              + +
                              +
                                scrippstuff tar -C ./\~/Developer/scrippstuff/versions/2.7.18 -czf new.tar.gz .
                              +
                              +
                              + +

                              Install ADFRsuite

                              + +

                              If you don't already have the tarball, you can download it by:

                              + +
                              +
                              $ curl -o adfr.tar.gz https://ccsb.scripps.edu/adfr/download/1033/
                              +
                              +
                              + +

                              Uncompress it

                              + +
                              +
                              $ tar -xvzf adfr.tar.gz
                              +
                              +
                              + +

                              Replace the provided Python archive with the one we created:

                              + +
                              +
                              $ cd ADFRsuite_x86_64Darwin_1.0
                              +$ mv new.tar.gz Python2.7.tar.gz
                              +
                              +
                              + +

                              Note: For some reason simply copying it doesn't work and you need to use mv

                              + +

                              Just to not mess with anything else, I will be installing everything in a folder called clean_install

                              + +
                              +
                              $ mkdir clean_install
                              +$ ./install.sh -d clean_install
                              +...
                              + ADFRsuite installation complete.
                              +To run agfr, agfrgui, adfr, autosite, about, pythonsh scripts located at:
                              +/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin
                              +add  /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin to the path environment variable in .cshrc or .bashrc:
                              +.cshrc:
                              +set path = (/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin $path)
                              +
                              +.bashrc:
                              +export PATH=/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin:$PATH
                              +
                              +
                              + +

                              Now, to test agfr, first run the command (replacing navanchauhan with yout username)

                              + +
                              +
                              $ export PATH=/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin:$PATH
                              +$ agfr
                              +➜  ADFRsuite_x86_64Darwin_1.0 agfr
                              +==============================
                              +*** Open Babel Error  in openLib
                              +  /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/openbabel/2.4.1/acesformat.so did not load properly.
                              + Error: dlopen(/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/openbabel/2.4.1/acesformat.so, 0x0009): Library not loaded: /opt/X11/lib/libcairo.2.dylib
                              +  Referenced from: <24174F3E-2670-79AC-4F26-F8B49774194A> /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/openbabel/2.4.1/acesformat.so
                              +  Reason: tried: '/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/libcairo.2.dylib' (no such file), '/opt/X11/lib/libcairo.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/X11/lib/libcairo.2.dylib' (no such file), '/opt/X11/lib/libcairo.2.dylib' (no such file), '/usr/local/lib/libcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache)
                              +==============================
                              +
                              +
                              + +

                              Fixing Open Babel Error

                              + +
                              +
                              $ brew install cairo
                              +
                              +
                              + +

                              Completing the re-docking tutorial

                              + +

                              Dowbloading the dataset

                              + +
                              +
                              $ curl -o tutorial-data.zip https://ccsb.scripps.edu/adcp/download/1063/
                              +$ unzip tutorial-data.zip
                              +$ cd ADCP_tutorial_data/3Q47
                              +
                              +
                              + +

                              Conversion to PDBQT

                              + +
                              +
                              $ reduce 3Q47_rec.pdb > 3Q47_recH.pdb
                              +$ reduce 3Q47_pep.pdb > 3Q47_pepH.pdb
                              +
                              +
                              + +

                              Preparing Receptor

                              + +
                              $ prepare_receptor -r 3Q47_recH.pdb
                              +$ prepare_ligand -l 3Q47_pepH.pdb
                              +
                              + +

                              Generate Target File

                              + +
                              +
                              $ agfr -r 3Q47_recH.pdbqt -l 3Q47_pepH.pdbqt -asv 1.1 -o 3Q47
                              +➜  3Q47 agfr -r 3Q47_recH.pdbqt -l 3Q47_pepH.pdbqt -asv 1.1 -o 3Q47
                              +Traceback (most recent call last):
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFR/bin/runAGFR.py", line 36, in <module>
                              +    from ADFR.utils.runAGFR import runAGFR
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFR/utils/runAGFR.py", line 41, in <module>
                              +    from ADFR.utils.maps import flexResStr2flexRes
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFR/utils/maps.py", line 35, in <module>
                              +    from ADFRcc.adfr import GridMap
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/__init__.py", line 34, in <module>
                              +    from ADFRcc.adfr import Parameters
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/adfr.py", line 43, in <module>
                              +    import ADFRcc.adfrcc as CPP
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/adfrcc.py", line 28, in <module>
                              +    _adfrcc = swig_import_helper()
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/adfrcc.py", line 24, in swig_import_helper
                              +    _mod = imp.load_module('_adfrcc', fp, pathname, description)
                              +ImportError: dlopen(/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/_adfrcc.so, 0x0002): Library not loaded: /Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib
                              +  Referenced from: <424BF61E-BF0F-351E-B546-E82EBBD8FBF5> /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/_adfrcc.so
                              +  Reason: tried: '/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/libgomp.1.dylib' (no such file), '/Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib' (no such file), '/Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib' (no such file), '/usr/local/lib/libgomp.1.dylib' (no such file), '/usr/lib/libgomp.1.dylib' (no such file, not in dyld cache)
                              +➜  3Q47
                              +
                              +
                              + +

                              Sometimes this error is simply outputted as a segmentation fault. But, it is because it cannot find the libgomp.1.dylib. I haven't tested using a newer version of GCC to make it work. Building GCC 8 yourself is absolutely painful. We are going to use a copy generated by the homebrew team.

                              + +
                              +
                              $ cd ../../
                              +$ pwd
                              +/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0
                              +$ curl -L -H "Authorization: Bearer QQ==" -o gcc8amd64.tar.gz https://ghcr.io/v2/homebrew/core/gcc/8/blobs/sha256:438d5902e5f21a5e8acb5920f1f5684ecfe0c645247d46c8d44c2bbe435966b2
                              +$ tar -xzf gcc8amd64.tar.gz
                              +$ cp -r gcc@8/8.5.0/lib/gcc/8/* clean_install/lib/
                              +
                              +
                              + +

                              Now, we should be able to go back and run the target generation command:

                              + +
                              +
                              $ cd ADCP_tutorial_data/3Q47
                              +$ agfr -r 3Q47_recH.pdbqt -l 3Q47_pepH.pdbqt -asv 1.1 -o 3Q47
                              +#################################################################
                              +# If you used AGFR in your work, please cite:                   #
                              +#                                                               #
                              +# P.A. Ravindranath S. Forli, D.S. Goodsell, A.J. Olson and     #
                              +# M.F. Sanner                                                   #
                              +# AutoDockFR: Advances in Protein-Ligand Docking with           #
                              +...
                              +
                              +
                              + +

                              Docking Peptide

                              + +
                              +
                              $ adcp -t 3Q47.trg -s npisdvd -N 20 -n 1000000 -o 3Q47_redocking -ref 3Q47_pepH.pdb
                              +
                              +
                              + +

                              There you have it. Running ADCP on the newest macOS version against all odds.

                              + +

                              I haven't yet looked into fixing/patching agfrgui as I don't use the software. But, if someone reallllly needs to run it on Apple Silicon, I am happy to take a look at monkeypatching it.

                              + +

                              In case years down the line the prebuilt version of GCC 8 is not available, let me know so I can replace the link with my mirror.

                              +]]>
                              +
                              + https://web.navan.dev/posts/2022-11-07-a-new-method-to-blog.html diff --git a/docs/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png b/docs/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png new file mode 100644 index 0000000..4b1bad2 Binary files /dev/null and b/docs/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png differ diff --git a/docs/index.html b/docs/index.html index da5e542..7b1f66c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -88,6 +88,19 @@ lead.innerText = new_phrase;

                              Recent Posts

                              For all posts go to Posts diff --git a/docs/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.html b/docs/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.html new file mode 100644 index 0000000..5b59fa1 --- /dev/null +++ b/docs/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.html @@ -0,0 +1,484 @@ + + + + + + + + + + Fixing ADFRSuite for Apple Silicon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                              + +
                              +

                              Fixing ADFRSuite for Apple Silicon

                              + +

                              We are going to be running everything through Rosetta 2. I am confident that if I had access to the original source code, I could find a way to run everything natively.

                              + +

                              These are the following issues that we will be fixing in this part:

                              + +
                                +
                              • “python2.7” cannot be opened because the developer cannot be verified.
                              • +
                              • OpenBabel Error
                              • +
                              • Segmentation fault while running the redocking tutorial
                              • +
                              + +

                              For the sake of simplicity, I am assuming that I am running all these commands in the folder ~/Developer/scrippstuff/

                              + +

                              Installing Rosetta 2

                              + +

                              We are going to run all of these steps in the terminal

                              + +
                              +
                              /usr/sbin/softwareupdate --install-rosetta --agree-to-license
                              +
                              +
                              + +

                              Install Homebrew for x86

                              + +

                              Both versions of homebrew (x86 and arm64) can peacefully coexist on your system.

                              + +

                              From now on, every command should be run in a terminal session that starts with this as the first command:

                              + +
                              +
                              arch -x86_64 zsh
                              +
                              +
                              + +

                              Now, we can install homebrew:

                              + +
                              +
                              /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
                              +
                              +
                              + +

                              Here is my output:

                              + +
                              +
                                scrippstuff uname -a
                              +Darwin Navans-MacBook-Pro.local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020 x86_64
                              +➜  scrippstuff /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
                              +==> Checking for `sudo` access (which may request your password)...
                              +Password:
                              +==> This script will install:
                              +/usr/local/bin/brew
                              +/usr/local/share/doc/homebrew
                              +/usr/local/share/man/man1/brew.1
                              +/usr/local/share/zsh/site-functions/_brew
                              +/usr/local/etc/bash_completion.d/brew
                              +/usr/local/Homebrew
                              +==> The following new directories will be created:
                              +/usr/local/Cellar
                              +/usr/local/Caskroom
                              +
                              +Press RETURN/ENTER to continue or any other key to abort:
                              +==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Caskroom
                              +==> /usr/bin/sudo /bin/chmod ug=rwx /usr/local/Cellar /usr/local/Caskroom
                              +==> /usr/bin/sudo /usr/sbin/chown navanchauhan /usr/local/Cellar /usr/local/Caskroom
                              +==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Caskroom
                              +==> /usr/bin/sudo /usr/sbin/chown -R navanchauhan:admin /usr/local/Homebrew
                              +==> /usr/bin/sudo /bin/mkdir -p /Users/navanchauhan/Library/Caches/Homebrew
                              +==> /usr/bin/sudo /bin/chmod g+rwx /Users/navanchauhan/Library/Caches/Homebrew
                              +==> /usr/bin/sudo /usr/sbin/chown -R navanchauhan /Users/navanchauhan/Library/Caches/Homebrew
                              +==> Downloading and installing Homebrew...
                              +remote: Enumerating objects: 47, done.
                              +remote: Counting objects: 100% (47/47), done.
                              +remote: Compressing objects: 100% (19/19), done.
                              +remote: Total 47 (delta 28), reused 47 (delta 28), pack-reused 0
                              +Unpacking objects: 100% (47/47), 6.11 KiB | 223.00 KiB/s, done.
                              +From https://github.com/Homebrew/brew
                              + + 18ebdd8c8f...67a096fcbb tapioca-compiler-for-tty-rbi -> origin/tapioca-compiler-for-tty-rbi  (forced update)
                              +Switched to and reset branch 'stable'
                              +==> Updating Homebrew...
                              +==> Installation successful!
                              +
                              +==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
                              +Read the analytics documentation (and how to opt-out) here:
                              +  https://docs.brew.sh/Analytics
                              +No analytics data has been sent yet (nor will any be during this install run).
                              +
                              +==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
                              +  https://github.com/Homebrew/brew#donations
                              +
                              +==> Next steps:
                              +- Run these two commands in your terminal to add Homebrew to your PATH:
                              +    (echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/navanchauhan/.zprofile
                              +    eval "$(/usr/local/bin/brew shellenv)"
                              +- Run brew help to get started
                              +- Further documentation:
                              +    https://docs.brew.sh
                              +
                              +
                              + +

                              At this point, you don't need to edit your zshrc or zsh_profile.

                              + +

                              Install pyenv

                              + +

                              The reason we are installing pyenv is because it is easier to build Python 2.7.18 from scratch than messing around with codesigning and quarantine bs on macOS.

                              + +
                              +
                                scrippstuff brew install pyenv
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/manifests/2.3.36
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching dependencies for pyenv: m4, autoconf, ca-certificates, openssl@3, pkg-config and readline
                              +==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching m4
                              +==> Downloading https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:8434a67a4383836b2531a6180e068640c5b482ee6781b673d65712e4fc86ca76
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/manifests/2.72
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching autoconf
                              +==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/blobs/sha256:12368e33b89d221550ba9e261b0c6ece0b0e89250fb4c95169d09081e0ebb2dd
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2024-03-11
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching ca-certificates
                              +==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:cab828953672906e00a8f25db751977b8dc4115f021f8dfe82b644ade03dacdb
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.2.1-1
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching openssl@3
                              +==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:ef8211c5115fc85f01261037f8fea76cc432b92b4fb23bc87bbf41e9198fcc0f
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/manifests/0.29.2_3
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching pkg-config
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/blobs/sha256:421571f340277c62c5cc6fd68737bd7c4e085de113452ea49b33bcd46509bb12
                              +############################################################################################################################################################### 100.0%
                              +==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.10
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching readline
                              +==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:9796e0ff1cc29ae7e75d8fc1a3e2c5e8ae2aeade8d9d59a16363306bf6c5b8f4
                              +############################################################################################################################################################### 100.0%
                              +==> Fetching pyenv
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/blobs/sha256:d117a99ed53502aff29109bfa366693ca623f2326e1e6b4db68fef7b7f63eeba
                              +############################################################################################################################################################### 100.0%
                              +==> Installing dependencies for pyenv: m4, autoconf, ca-certificates, openssl@3, pkg-config and readline
                              +==> Installing pyenv dependency: m4
                              +==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/5b2a7f715487b7377e409e8ca58569040cd89f33859f691210c58d94410fd33b--m4-1.4.19.bottle_manifest.json
                              +==> Pouring m4--1.4.19.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/m4/1.4.19: 13 files, 739.9KB
                              +==> Installing pyenv dependency: autoconf
                              +==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/manifests/2.72
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/b73cdb320c4261bbf8d02d03e50dc755c869c5859c1d4e93616898fc7cd939ff--autoconf-2.72.bottle_manifest.json
                              +==> Pouring autoconf--2.72.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/autoconf/2.72: 71 files, 3.6MB
                              +==> Installing pyenv dependency: ca-certificates
                              +==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2024-03-11
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/c431e0186df2ccc2ea942b34a3c26c2cebebec8e07ad6abdae48447a52c5f506--ca-certificates-2024-03-11.bottle_manifest.json
                              +==> Pouring ca-certificates--2024-03-11.all.bottle.tar.gz
                              +==> Regenerating CA certificate bundle from keychain, this may take a while...
                              +🍺  /usr/local/Cellar/ca-certificates/2024-03-11: 3 files, 229.6KB
                              +==> Installing pyenv dependency: openssl@3
                              +==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.2.1-1
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/f7b6e249843882452d784a8cbc4e19231186230b9e485a2a284d5c1952a95ec2--openssl@3-3.2.1-1.bottle_manifest.json
                              +==> Pouring openssl@3--3.2.1.sonoma.bottle.1.tar.gz
                              +🍺  /usr/local/Cellar/openssl@3/3.2.1: 6,874 files, 32.5MB
                              +==> Installing pyenv dependency: pkg-config
                              +==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/manifests/0.29.2_3
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/ac691fc7ab8ecffba32a837e7197101d271474a3a84cfddcc30c9fd6763ab3c6--pkg-config-0.29.2_3.bottle_manifest.json
                              +==> Pouring pkg-config--0.29.2_3.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/pkg-config/0.29.2_3: 11 files, 656.4KB
                              +==> Installing pyenv dependency: readline
                              +==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.10
                              +Already downloaded: /Users/navanchauhan/Library/Caches/Homebrew/downloads/4ddd52803319828799f1932d4c7fa8d11c667049b20a56341c0c19246a1be93b--readline-8.2.10.bottle_manifest.json
                              +==> Pouring readline--8.2.10.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/readline/8.2.10: 50 files, 1.7MB
                              +==> Installing pyenv
                              +==> Pouring pyenv--2.3.36.sonoma.bottle.tar.gz
                              +🍺  /usr/local/Cellar/pyenv/2.3.36: 1,158 files, 3.4MB
                              +==> Running `brew cleanup pyenv`...
                              +Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
                              +Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
                              +
                              +
                              + +

                              And, build the last version of Python 2.7

                              + +
                              +
                                scrippstuff PYENV_ROOT="~/Developer/scrippstuff" pyenv install 2.7.18
                              +python-build: use openssl from homebrew
                              +python-build: use readline from homebrew
                              +Downloading Python-2.7.18.tar.xz...
                              +-> https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
                              +Installing Python-2.7.18...
                              +patching file configure
                              +patching file configure.ac
                              +patching file setup.py
                              +patching file 'Mac/Tools/pythonw.c'
                              +patching file setup.py
                              +patching file 'Doc/library/ctypes.rst'
                              +patching file 'Lib/test/test_str.py'
                              +patching file 'Lib/test/test_unicode.py'
                              +patching file 'Modules/_ctypes/_ctypes.c'
                              +patching file 'Modules/_ctypes/callproc.c'
                              +patching file 'Modules/_ctypes/ctypes.h'
                              +patching file 'Modules/_ctypes/callproc.c'
                              +patching file setup.py
                              +patching file 'Mac/Modules/qt/setup.py'
                              +patching file setup.py
                              +python-build: use readline from homebrew
                              +python-build: use zlib from xcode sdk
                              +Installed Python-2.7.18 to /Users/navanchauhan/Developer/scrippstuff/~/Developer/scrippstuff/versions/2.7.18
                              +
                              +
                              + +

                              Test the new installation:

                              + +
                              +
                                scrippstuff ~/Developer/scrippstuff/\~/Developer/scrippstuff/versions/2.7.18/bin/python2.7
                              +Python 2.7.18 (default, Mar 28 2024, 20:47:13)
                              +[GCC Apple LLVM 15.0.0 (clang-1500.1.0.2.5)] on darwin
                              +Type "help", "copyright", "credits" or "license" for more information.
                              +>>> from random import randint
                              +>>> randint(0,10)
                              +6
                              +>>> exit()
                              +
                              +
                              + +

                              Now, we can compress this newly created Python version into a tar.gz file to replace the one provided in ADFRsuitex8664Darwin_1.0.tar.gz. Don't forget the . at the end

                              + +
                              +
                                scrippstuff tar -C ./\~/Developer/scrippstuff/versions/2.7.18 -czf new.tar.gz .
                              +
                              +
                              + +

                              Install ADFRsuite

                              + +

                              If you don't already have the tarball, you can download it by:

                              + +
                              +
                              $ curl -o adfr.tar.gz https://ccsb.scripps.edu/adfr/download/1033/
                              +
                              +
                              + +

                              Uncompress it

                              + +
                              +
                              $ tar -xvzf adfr.tar.gz
                              +
                              +
                              + +

                              Replace the provided Python archive with the one we created:

                              + +
                              +
                              $ cd ADFRsuite_x86_64Darwin_1.0
                              +$ mv new.tar.gz Python2.7.tar.gz
                              +
                              +
                              + +

                              Note: For some reason simply copying it doesn't work and you need to use mv

                              + +

                              Just to not mess with anything else, I will be installing everything in a folder called clean_install

                              + +
                              +
                              $ mkdir clean_install
                              +$ ./install.sh -d clean_install
                              +...
                              + ADFRsuite installation complete.
                              +To run agfr, agfrgui, adfr, autosite, about, pythonsh scripts located at:
                              +/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin
                              +add  /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin to the path environment variable in .cshrc or .bashrc:
                              +.cshrc:
                              +set path = (/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin $path)
                              +
                              +.bashrc:
                              +export PATH=/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin:$PATH
                              +
                              +
                              + +

                              Now, to test agfr, first run the command (replacing navanchauhan with yout username)

                              + +
                              +
                              $ export PATH=/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/bin:$PATH
                              +$ agfr
                              +➜  ADFRsuite_x86_64Darwin_1.0 agfr
                              +==============================
                              +*** Open Babel Error  in openLib
                              +  /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/openbabel/2.4.1/acesformat.so did not load properly.
                              + Error: dlopen(/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/openbabel/2.4.1/acesformat.so, 0x0009): Library not loaded: /opt/X11/lib/libcairo.2.dylib
                              +  Referenced from: <24174F3E-2670-79AC-4F26-F8B49774194A> /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/openbabel/2.4.1/acesformat.so
                              +  Reason: tried: '/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/libcairo.2.dylib' (no such file), '/opt/X11/lib/libcairo.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/X11/lib/libcairo.2.dylib' (no such file), '/opt/X11/lib/libcairo.2.dylib' (no such file), '/usr/local/lib/libcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache)
                              +==============================
                              +
                              +
                              + +

                              Fixing Open Babel Error

                              + +
                              +
                              $ brew install cairo
                              +
                              +
                              + +

                              Completing the re-docking tutorial

                              + +

                              Dowbloading the dataset

                              + +
                              +
                              $ curl -o tutorial-data.zip https://ccsb.scripps.edu/adcp/download/1063/
                              +$ unzip tutorial-data.zip
                              +$ cd ADCP_tutorial_data/3Q47
                              +
                              +
                              + +

                              Conversion to PDBQT

                              + +
                              +
                              $ reduce 3Q47_rec.pdb > 3Q47_recH.pdb
                              +$ reduce 3Q47_pep.pdb > 3Q47_pepH.pdb
                              +
                              +
                              + +

                              Preparing Receptor

                              + +
                              $ prepare_receptor -r 3Q47_recH.pdb
                              +$ prepare_ligand -l 3Q47_pepH.pdb
                              +
                              + +

                              Generate Target File

                              + +
                              +
                              $ agfr -r 3Q47_recH.pdbqt -l 3Q47_pepH.pdbqt -asv 1.1 -o 3Q47
                              +➜  3Q47 agfr -r 3Q47_recH.pdbqt -l 3Q47_pepH.pdbqt -asv 1.1 -o 3Q47
                              +Traceback (most recent call last):
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFR/bin/runAGFR.py", line 36, in <module>
                              +    from ADFR.utils.runAGFR import runAGFR
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFR/utils/runAGFR.py", line 41, in <module>
                              +    from ADFR.utils.maps import flexResStr2flexRes
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFR/utils/maps.py", line 35, in <module>
                              +    from ADFRcc.adfr import GridMap
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/__init__.py", line 34, in <module>
                              +    from ADFRcc.adfr import Parameters
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/adfr.py", line 43, in <module>
                              +    import ADFRcc.adfrcc as CPP
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/adfrcc.py", line 28, in <module>
                              +    _adfrcc = swig_import_helper()
                              +  File "/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/adfrcc.py", line 24, in swig_import_helper
                              +    _mod = imp.load_module('_adfrcc', fp, pathname, description)
                              +ImportError: dlopen(/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/_adfrcc.so, 0x0002): Library not loaded: /Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib
                              +  Referenced from: <424BF61E-BF0F-351E-B546-E82EBBD8FBF5> /Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/CCSBpckgs/ADFRcc/_adfrcc.so
                              +  Reason: tried: '/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0/clean_install/lib/libgomp.1.dylib' (no such file), '/Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib' (no such file), '/Users/Shared/mgltoolsDev/src/homebrew/opt/gcc/lib/gcc/8/libgomp.1.dylib' (no such file), '/usr/local/lib/libgomp.1.dylib' (no such file), '/usr/lib/libgomp.1.dylib' (no such file, not in dyld cache)
                              +➜  3Q47
                              +
                              +
                              + +

                              Sometimes this error is simply outputted as a segmentation fault. But, it is because it cannot find the libgomp.1.dylib. I haven't tested using a newer version of GCC to make it work. Building GCC 8 yourself is absolutely painful. We are going to use a copy generated by the homebrew team.

                              + +
                              +
                              $ cd ../../
                              +$ pwd
                              +/Users/navanchauhan/Developer/scrippstuff/ADFRsuite_x86_64Darwin_1.0
                              +$ curl -L -H "Authorization: Bearer QQ==" -o gcc8amd64.tar.gz https://ghcr.io/v2/homebrew/core/gcc/8/blobs/sha256:438d5902e5f21a5e8acb5920f1f5684ecfe0c645247d46c8d44c2bbe435966b2
                              +$ tar -xzf gcc8amd64.tar.gz
                              +$ cp -r gcc@8/8.5.0/lib/gcc/8/* clean_install/lib/
                              +
                              +
                              + +

                              Now, we should be able to go back and run the target generation command:

                              + +
                              +
                              $ cd ADCP_tutorial_data/3Q47
                              +$ agfr -r 3Q47_recH.pdbqt -l 3Q47_pepH.pdbqt -asv 1.1 -o 3Q47
                              +#################################################################
                              +# If you used AGFR in your work, please cite:                   #
                              +#                                                               #
                              +# P.A. Ravindranath S. Forli, D.S. Goodsell, A.J. Olson and     #
                              +# M.F. Sanner                                                   #
                              +# AutoDockFR: Advances in Protein-Ligand Docking with           #
                              +...
                              +
                              +
                              + +

                              Docking Peptide

                              + +
                              +
                              $ adcp -t 3Q47.trg -s npisdvd -N 20 -n 1000000 -o 3Q47_redocking -ref 3Q47_pepH.pdb
                              +
                              +
                              + +

                              There you have it. Running ADCP on the newest macOS version against all odds.

                              + +

                              I haven't yet looked into fixing/patching agfrgui as I don't use the software. But, if someone reallllly needs to run it on Apple Silicon, I am happy to take a look at monkeypatching it.

                              + +

                              In case years down the line the prebuilt version of GCC 8 is not available, let me know so I can replace the link with my mirror.

                              + +
                              +
                              If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
                              + +
                              + +
                              + +
                              + + + + \ No newline at end of file diff --git a/docs/posts/index.html b/docs/posts/index.html index a64a79a..ef630d7 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -84,6 +84,19 @@ lead.innerText = new_phrase;
                                +
                              • Fixing ADFRSuite for Apple Silicon
                              • +
                                  +
                                • Fixing ADFRsuite on M1/MX chip Macs - CLI Tools
                                • +
                                • Published On: 2024-03-28 20:12
                                • +
                                • Tags: + + macOS, + + Cheminformatics + +
                                + +
                              • Quadratic Formula Derivation
                                • Quick derivation of the quadratic equation by completing the square
                                • diff --git a/docs/tags/Cheminformatics.html b/docs/tags/Cheminformatics.html index c686c20..6a98f75 100644 --- a/docs/tags/Cheminformatics.html +++ b/docs/tags/Cheminformatics.html @@ -81,6 +81,19 @@ lead.innerText = new_phrase;
                                    +
                                  • Fixing ADFRSuite for Apple Silicon
                                  • +
                                      +
                                    • Fixing ADFRsuite on M1/MX chip Macs - CLI Tools
                                    • +
                                    • Published On: 2024-03-28 20:12
                                    • +
                                    • Tags: + + macOS, + + Cheminformatics + +
                                    + +
                                  • Cheminformatics on the Web (2021)
                                    • Summarising Cheminformatics on the web in 2021.
                                    • diff --git a/docs/tags/macOS.html b/docs/tags/macOS.html index 1fa2569..124d64b 100644 --- a/docs/tags/macOS.html +++ b/docs/tags/macOS.html @@ -81,6 +81,19 @@ lead.innerText = new_phrase;
                                        +
                                      • Fixing ADFRSuite for Apple Silicon
                                      • +
                                          +
                                        • Fixing ADFRsuite on M1/MX chip Macs - CLI Tools
                                        • +
                                        • Published On: 2024-03-28 20:12
                                        • +
                                        • Tags: + + macOS, + + Cheminformatics + +
                                        + +
                                      • Cross-Compiling Hello World for DOS on macOS
                                        • This goes through compiling Open Watcom 2 and creating simple hello-world exampls
                                        • -- cgit v1.2.3 From 898f4898295957c6c07dc4f7822fc12c0230bfcf Mon Sep 17 00:00:00 2001 From: ImgBotApp Date: Fri, 29 Mar 2024 06:40:07 +0000 Subject: [ImgBot] Optimize images *Total -- 21,633.89kb -> 17,733.57kb (18.03%) /docs/assets/posts/dosbox/hello-world.png -- 227.99kb -> 148.21kb (34.99%) /Resources/assets/posts/dosbox/hello-world.png -- 227.99kb -> 148.21kb (34.99%) /docs/assets/y-u-n-o/ssyw.png -- 486.62kb -> 332.16kb (31.74%) /Resources/assets/y-u-n-o/ssyw.png -- 486.62kb -> 332.16kb (31.74%) /docs/assets/bomb-lab/phase-3.png -- 67.44kb -> 47.62kb (29.4%) /Resources/assets/bomb-lab/phase-3.png -- 67.44kb -> 47.62kb (29.4%) /docs/images/opengraph/posts/2024-01-05-hello-20224.png -- 17.81kb -> 13.17kb (26.05%) /Resources/images/opengraph/posts/2024-01-05-hello-20224.png -- 17.81kb -> 13.17kb (26.05%) /docs/images/opengraph/posts/2023-11-28-shell-lab.png -- 17.18kb -> 12.79kb (25.58%) /Resources/images/opengraph/posts/2023-11-28-shell-lab.png -- 17.18kb -> 12.79kb (25.58%) /docs/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png -- 21.30kb -> 16.06kb (24.6%) /Resources/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png -- 21.30kb -> 16.06kb (24.6%) /docs/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png -- 25.43kb -> 19.21kb (24.47%) /Resources/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png -- 25.43kb -> 19.21kb (24.47%) /docs/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png -- 31.80kb -> 24.10kb (24.21%) /Resources/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png -- 31.80kb -> 24.10kb (24.21%) /Resources/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png -- 23.99kb -> 18.36kb (23.45%) /docs/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png -- 23.99kb -> 18.36kb (23.45%) /docs/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png -- 27.17kb -> 20.83kb (23.34%) /Resources/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png -- 27.17kb -> 20.83kb (23.34%) /docs/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png -- 26.85kb -> 20.65kb (23.1%) /Resources/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png -- 26.85kb -> 20.65kb (23.1%) /docs/DallE3Base/posts/2023-10-04-bomb-lab.png -- 1,680.12kb -> 1,328.70kb (20.92%) /Resources/DallE3Base/posts/2023-10-04-bomb-lab.png -- 1,680.12kb -> 1,328.70kb (20.92%) /docs/assets/posts/reddit-flair-search.png -- 1,985.89kb -> 1,598.69kb (19.5%) /Resources/assets/posts/reddit-flair-search.png -- 1,985.89kb -> 1,598.69kb (19.5%) /docs/DallE3Base/posts/2023-10-05-attack-lab.png -- 1,662.70kb -> 1,347.42kb (18.96%) /Resources/DallE3Base/posts/2023-10-05-attack-lab.png -- 1,662.70kb -> 1,347.42kb (18.96%) /docs/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png -- 22.45kb -> 18.20kb (18.92%) /Resources/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png -- 22.45kb -> 18.20kb (18.92%) /Resources/assets/underlying/video-under-element.jpg -- 151.38kb -> 123.36kb (18.51%) /docs/assets/underlying/video-under-element.jpg -- 151.38kb -> 123.36kb (18.51%) /docs/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png -- 2,150.67kb -> 1,833.08kb (14.77%) /Resources/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png -- 2,150.67kb -> 1,833.08kb (14.77%) /Resources/images/opengraph/posts/2023-10-04-bomb-lab.png -- 676.75kb -> 598.29kb (11.59%) /docs/images/opengraph/posts/2023-10-04-bomb-lab.png -- 676.75kb -> 598.29kb (11.59%) /Resources/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png -- 834.28kb -> 740.07kb (11.29%) /docs/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png -- 834.28kb -> 740.07kb (11.29%) /Resources/images/opengraph/posts/2023-10-05-attack-lab.png -- 679.12kb -> 605.82kb (10.79%) /docs/images/opengraph/posts/2023-10-05-attack-lab.png -- 679.12kb -> 605.82kb (10.79%) Signed-off-by: ImgBotApp --- Resources/DallE3Base/posts/2023-10-04-bomb-lab.png | Bin 1720442 -> 1360585 bytes .../DallE3Base/posts/2023-10-05-attack-lab.png | Bin 1702606 -> 1379755 bytes .../posts/2023-10-22-search-by-flair-reddit.png | Bin 2202291 -> 1877078 bytes Resources/assets/bomb-lab/phase-3.png | Bin 69063 -> 48759 bytes Resources/assets/posts/dosbox/hello-world.png | Bin 233460 -> 151771 bytes Resources/assets/posts/reddit-flair-search.png | Bin 2033555 -> 1637056 bytes .../assets/underlying/video-under-element.jpg | Bin 155017 -> 126325 bytes Resources/assets/y-u-n-o/ssyw.png | Bin 498300 -> 340132 bytes .../2024-02-17-Can-Holder-Mountain-Bike.png | Bin 24564 -> 18803 bytes .../images/opengraph/posts/2023-10-04-bomb-lab.png | Bin 692994 -> 612654 bytes .../opengraph/posts/2023-10-05-attack-lab.png | Bin 695415 -> 620359 bytes .../posts/2023-10-22-search-by-flair-reddit.png | Bin 854300 -> 757827 bytes .../opengraph/posts/2023-11-28-shell-lab.png | Bin 17592 -> 13092 bytes .../opengraph/posts/2024-01-05-hello-20224.png | Bin 18234 -> 13484 bytes ...trol-element-under-another-element-html-css.png | Bin 22985 -> 18636 bytes .../posts/2024-03-04-opencvjs-video-processing.png | Bin 27820 -> 21327 bytes ...024-03-15-setting-up-macos-for-8088-dos-dev.png | Bin 32566 -> 24682 bytes ...03-21-Polynomial-Regression-in-TensorFlow-2.png | Bin 27498 -> 21147 bytes ...-03-26-Derivation-of-the-Quadratic-Equation.png | Bin 21809 -> 16444 bytes .../2024-03-28-Running-ADFRSuite-on-arm64-Macs.png | Bin 26043 -> 19670 bytes docs/DallE3Base/posts/2023-10-04-bomb-lab.png | Bin 1720442 -> 1360585 bytes docs/DallE3Base/posts/2023-10-05-attack-lab.png | Bin 1702606 -> 1379755 bytes .../posts/2023-10-22-search-by-flair-reddit.png | Bin 2202291 -> 1877078 bytes docs/assets/bomb-lab/phase-3.png | Bin 69063 -> 48759 bytes docs/assets/posts/dosbox/hello-world.png | Bin 233460 -> 151771 bytes docs/assets/posts/reddit-flair-search.png | Bin 2033555 -> 1637056 bytes docs/assets/underlying/video-under-element.jpg | Bin 155017 -> 126325 bytes docs/assets/y-u-n-o/ssyw.png | Bin 498300 -> 340132 bytes .../2024-02-17-Can-Holder-Mountain-Bike.png | Bin 24564 -> 18803 bytes .../images/opengraph/posts/2023-10-04-bomb-lab.png | Bin 692994 -> 612654 bytes .../opengraph/posts/2023-10-05-attack-lab.png | Bin 695415 -> 620359 bytes .../posts/2023-10-22-search-by-flair-reddit.png | Bin 854300 -> 757827 bytes .../opengraph/posts/2023-11-28-shell-lab.png | Bin 17592 -> 13092 bytes .../opengraph/posts/2024-01-05-hello-20224.png | Bin 18234 -> 13484 bytes ...trol-element-under-another-element-html-css.png | Bin 22985 -> 18636 bytes .../posts/2024-03-04-opencvjs-video-processing.png | Bin 27820 -> 21327 bytes ...024-03-15-setting-up-macos-for-8088-dos-dev.png | Bin 32566 -> 24682 bytes ...03-21-Polynomial-Regression-in-TensorFlow-2.png | Bin 27498 -> 21147 bytes ...-03-26-Derivation-of-the-Quadratic-Equation.png | Bin 21809 -> 16444 bytes .../2024-03-28-Running-ADFRSuite-on-arm64-Macs.png | Bin 26043 -> 19670 bytes 40 files changed, 0 insertions(+), 0 deletions(-) (limited to 'docs/images/opengraph/posts') diff --git a/Resources/DallE3Base/posts/2023-10-04-bomb-lab.png b/Resources/DallE3Base/posts/2023-10-04-bomb-lab.png index e022194..9774404 100644 Binary files a/Resources/DallE3Base/posts/2023-10-04-bomb-lab.png and b/Resources/DallE3Base/posts/2023-10-04-bomb-lab.png differ diff --git a/Resources/DallE3Base/posts/2023-10-05-attack-lab.png b/Resources/DallE3Base/posts/2023-10-05-attack-lab.png index aa4deae..f6f4e3e 100644 Binary files a/Resources/DallE3Base/posts/2023-10-05-attack-lab.png and b/Resources/DallE3Base/posts/2023-10-05-attack-lab.png differ diff --git a/Resources/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png b/Resources/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png index 320d583..65ba9da 100644 Binary files a/Resources/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png and b/Resources/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png differ diff --git a/Resources/assets/bomb-lab/phase-3.png b/Resources/assets/bomb-lab/phase-3.png index b247a5b..18a9f6b 100644 Binary files a/Resources/assets/bomb-lab/phase-3.png and b/Resources/assets/bomb-lab/phase-3.png differ diff --git a/Resources/assets/posts/dosbox/hello-world.png b/Resources/assets/posts/dosbox/hello-world.png index 4e2482e..38fde84 100644 Binary files a/Resources/assets/posts/dosbox/hello-world.png and b/Resources/assets/posts/dosbox/hello-world.png differ diff --git a/Resources/assets/posts/reddit-flair-search.png b/Resources/assets/posts/reddit-flair-search.png index 53cba31..dbe5835 100644 Binary files a/Resources/assets/posts/reddit-flair-search.png and b/Resources/assets/posts/reddit-flair-search.png differ diff --git a/Resources/assets/underlying/video-under-element.jpg b/Resources/assets/underlying/video-under-element.jpg index 96afed2..2b5e7c4 100644 Binary files a/Resources/assets/underlying/video-under-element.jpg and b/Resources/assets/underlying/video-under-element.jpg differ diff --git a/Resources/assets/y-u-n-o/ssyw.png b/Resources/assets/y-u-n-o/ssyw.png index b6085c7..c26775c 100644 Binary files a/Resources/assets/y-u-n-o/ssyw.png and b/Resources/assets/y-u-n-o/ssyw.png differ diff --git a/Resources/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png b/Resources/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png index b779dcd..93c2dea 100644 Binary files a/Resources/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png and b/Resources/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png differ diff --git a/Resources/images/opengraph/posts/2023-10-04-bomb-lab.png b/Resources/images/opengraph/posts/2023-10-04-bomb-lab.png index 551900e..39293e5 100644 Binary files a/Resources/images/opengraph/posts/2023-10-04-bomb-lab.png and b/Resources/images/opengraph/posts/2023-10-04-bomb-lab.png differ diff --git a/Resources/images/opengraph/posts/2023-10-05-attack-lab.png b/Resources/images/opengraph/posts/2023-10-05-attack-lab.png index 2097209..8c8e94a 100644 Binary files a/Resources/images/opengraph/posts/2023-10-05-attack-lab.png and b/Resources/images/opengraph/posts/2023-10-05-attack-lab.png differ diff --git a/Resources/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png b/Resources/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png index 91e8370..9655f79 100644 Binary files a/Resources/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png and b/Resources/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png differ diff --git a/Resources/images/opengraph/posts/2023-11-28-shell-lab.png b/Resources/images/opengraph/posts/2023-11-28-shell-lab.png index 5ca7100..0ab3eed 100644 Binary files a/Resources/images/opengraph/posts/2023-11-28-shell-lab.png and b/Resources/images/opengraph/posts/2023-11-28-shell-lab.png differ diff --git a/Resources/images/opengraph/posts/2024-01-05-hello-20224.png b/Resources/images/opengraph/posts/2024-01-05-hello-20224.png index 00590c8..4cc3b5b 100644 Binary files a/Resources/images/opengraph/posts/2024-01-05-hello-20224.png and b/Resources/images/opengraph/posts/2024-01-05-hello-20224.png differ diff --git a/Resources/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png b/Resources/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png index 2817224..309a3ca 100644 Binary files a/Resources/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png and b/Resources/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png differ diff --git a/Resources/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png b/Resources/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png index e77d3d7..f2d3312 100644 Binary files a/Resources/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png and b/Resources/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png differ diff --git a/Resources/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png b/Resources/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png index 8cba6d8..d93ef9b 100644 Binary files a/Resources/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png and b/Resources/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png differ diff --git a/Resources/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png b/Resources/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png index 0dbdd08..a908beb 100644 Binary files a/Resources/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png and b/Resources/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png differ diff --git a/Resources/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png b/Resources/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png index 2464364..757565f 100644 Binary files a/Resources/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png and b/Resources/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png differ diff --git a/Resources/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png b/Resources/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png index 4b1bad2..fb77530 100644 Binary files a/Resources/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png and b/Resources/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png differ diff --git a/docs/DallE3Base/posts/2023-10-04-bomb-lab.png b/docs/DallE3Base/posts/2023-10-04-bomb-lab.png index e022194..9e3a7d2 100644 Binary files a/docs/DallE3Base/posts/2023-10-04-bomb-lab.png and b/docs/DallE3Base/posts/2023-10-04-bomb-lab.png differ diff --git a/docs/DallE3Base/posts/2023-10-05-attack-lab.png b/docs/DallE3Base/posts/2023-10-05-attack-lab.png index aa4deae..a900448 100644 Binary files a/docs/DallE3Base/posts/2023-10-05-attack-lab.png and b/docs/DallE3Base/posts/2023-10-05-attack-lab.png differ diff --git a/docs/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png b/docs/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png index 320d583..7fd8518 100644 Binary files a/docs/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png and b/docs/DallE3Base/posts/2023-10-22-search-by-flair-reddit.png differ diff --git a/docs/assets/bomb-lab/phase-3.png b/docs/assets/bomb-lab/phase-3.png index b247a5b..015d7cd 100644 Binary files a/docs/assets/bomb-lab/phase-3.png and b/docs/assets/bomb-lab/phase-3.png differ diff --git a/docs/assets/posts/dosbox/hello-world.png b/docs/assets/posts/dosbox/hello-world.png index 4e2482e..671f837 100644 Binary files a/docs/assets/posts/dosbox/hello-world.png and b/docs/assets/posts/dosbox/hello-world.png differ diff --git a/docs/assets/posts/reddit-flair-search.png b/docs/assets/posts/reddit-flair-search.png index 53cba31..2cbcb82 100644 Binary files a/docs/assets/posts/reddit-flair-search.png and b/docs/assets/posts/reddit-flair-search.png differ diff --git a/docs/assets/underlying/video-under-element.jpg b/docs/assets/underlying/video-under-element.jpg index 96afed2..2b5e7c4 100644 Binary files a/docs/assets/underlying/video-under-element.jpg and b/docs/assets/underlying/video-under-element.jpg differ diff --git a/docs/assets/y-u-n-o/ssyw.png b/docs/assets/y-u-n-o/ssyw.png index b6085c7..c0c7002 100644 Binary files a/docs/assets/y-u-n-o/ssyw.png and b/docs/assets/y-u-n-o/ssyw.png differ diff --git a/docs/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png b/docs/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png index b779dcd..57d45c0 100644 Binary files a/docs/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png and b/docs/images/opengraph/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.png differ diff --git a/docs/images/opengraph/posts/2023-10-04-bomb-lab.png b/docs/images/opengraph/posts/2023-10-04-bomb-lab.png index 551900e..39293e5 100644 Binary files a/docs/images/opengraph/posts/2023-10-04-bomb-lab.png and b/docs/images/opengraph/posts/2023-10-04-bomb-lab.png differ diff --git a/docs/images/opengraph/posts/2023-10-05-attack-lab.png b/docs/images/opengraph/posts/2023-10-05-attack-lab.png index 2097209..8c8e94a 100644 Binary files a/docs/images/opengraph/posts/2023-10-05-attack-lab.png and b/docs/images/opengraph/posts/2023-10-05-attack-lab.png differ diff --git a/docs/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png b/docs/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png index 91e8370..9655f79 100644 Binary files a/docs/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png and b/docs/images/opengraph/posts/2023-10-22-search-by-flair-reddit.png differ diff --git a/docs/images/opengraph/posts/2023-11-28-shell-lab.png b/docs/images/opengraph/posts/2023-11-28-shell-lab.png index 5ca7100..608a06e 100644 Binary files a/docs/images/opengraph/posts/2023-11-28-shell-lab.png and b/docs/images/opengraph/posts/2023-11-28-shell-lab.png differ diff --git a/docs/images/opengraph/posts/2024-01-05-hello-20224.png b/docs/images/opengraph/posts/2024-01-05-hello-20224.png index 00590c8..80cbbbf 100644 Binary files a/docs/images/opengraph/posts/2024-01-05-hello-20224.png and b/docs/images/opengraph/posts/2024-01-05-hello-20224.png differ diff --git a/docs/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png b/docs/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png index 2817224..4f4ef3d 100644 Binary files a/docs/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png and b/docs/images/opengraph/posts/2024-02-26-control-element-under-another-element-html-css.png differ diff --git a/docs/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png b/docs/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png index e77d3d7..72dfb78 100644 Binary files a/docs/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png and b/docs/images/opengraph/posts/2024-03-04-opencvjs-video-processing.png differ diff --git a/docs/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png b/docs/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png index 8cba6d8..d93ef9b 100644 Binary files a/docs/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png and b/docs/images/opengraph/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.png differ diff --git a/docs/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png b/docs/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png index 0dbdd08..a908beb 100644 Binary files a/docs/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png and b/docs/images/opengraph/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.png differ diff --git a/docs/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png b/docs/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png index 2464364..757565f 100644 Binary files a/docs/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png and b/docs/images/opengraph/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.png differ diff --git a/docs/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png b/docs/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png index 4b1bad2..fb77530 100644 Binary files a/docs/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png and b/docs/images/opengraph/posts/2024-03-28-Running-ADFRSuite-on-arm64-Macs.png differ -- cgit v1.2.3