• Stars
    star
    805
  • Rank 54,580 (Top 2 %)
  • Language
    Fortran
  • License
    BSD 3-Clause "New...
  • Created almost 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Finally a Fortran MVC web platform

Fortran.io

An MVC web stack written in Fortran 90 (so you get arrays, and it's not punchcards)

Major credit due to:

Create an Ubuntu server

Log in and install dependencies

# update Ubuntu
sudo apt-get update
sudo apt-get upgrade

# create the user and home directory
adduser fortran --gecos ""
usermod -a -G sudo fortran

# switch to new user
su fortran
cd ~

# install git and clone the repo
sudo apt-get install -y git
git clone https://github.com/mapmeld/fortran-machine.git

# Install dependencies
cd fortran-machine
sudo ./install_deps_ubu.sh

Go to your IP address - you should see the "Welcome to nginx!" page

Change the location in /etc/nginx/sites-available/default :

server_name 101.101.101.101; <- your IP address

location / {
	root /home/fortran/fortran-machine;
	index index.html;
}

Restart nginx to make these settings for real:

sudo service nginx restart

You should now see the test page on your IP address.

Test doc

Use Fortran CGI script

Let's go from test page to Fortran script:

# compile the test server
make

Now change nginx config /etc/nginx/sites-available/default

location / {
	root /home/fortran/fortran-machine;
	fastcgi_pass 127.0.0.1:9000;
	fastcgi_index index.html;
	include fastcgi_params;
}

Then run sudo service nginx restart

# spawn the server
spawn-fcgi -a 127.0.0.1 -p 9000 ./fortran_fcgi

Restarting the script

After changing the source code, you can recompile and restart your server with:

./restart.sh

Add a static folder

Add to nginx config /etc/nginx/sites-available/default

location /static {
    root /home/fortran/fortran-machine;
}

And restart nginx

sudo service nginx restart

Fortran controller

The controller is written in Fortran in the fortran_fcgi.f90 file:

case ('/')
	! most pages look like this
	templatefile = 'template/index.jade'
	call jadefile(templatefile, unitNo)

case ('/search')
	write(unitNo,AFORMAT) '<div class="container">'

	templatefile = 'template/search.jade'
	call jadefile(templatefile, unitNo)

	write(unitNo,AFORMAT) '</div>'

Jade Templates

In the template folder, you can write HTML templates similar to Jade or HAML.

If you want to have a loop or other structure, it's better to create a partial and run the loop in the Fortran controller.

.container
  .col-sm-6
    h3 Hello #{name}!
  .col-sm-6
    h3 Link
    a(href="http://example.com/profile/#{id}") A link

SQLite Database

You can connect to a SQLite database. The example on Fortran.io lets you search through marsupials!

Here's how the getAllMarsupials subroutine loads data into arrays:

subroutine getAllMarsupials(name, latinName, wikiLink, description)
	! columns
	character(len=50), dimension(8)	:: name, latinName, wikiLink, description

	call sqlite3_open('marsupials.sqlite3', db)

	allocate( column(4) )
	call sqlite3_column_query( column(1), 'name', SQLITE_CHAR )
	call sqlite3_column_query( column(2), 'latinName', SQLITE_CHAR )
	call sqlite3_column_query( column(3), 'wikiLink', SQLITE_CHAR )
	call sqlite3_column_query( column(4), 'description', SQLITE_CHAR )

	call sqlite3_prepare_select( db, 'marsupials', column, stmt, "WHERE 1=1 LIMIT 8")

	i = 1
	do
		call sqlite3_next_row(stmt, column, finished)
		if (finished) exit

		call sqlite3_get_column(column(1), name(i))
		call sqlite3_get_column(column(2), latinName(i))
		call sqlite3_get_column(column(3), wikiLink(i))
		call sqlite3_get_column(column(4), description(i))
		i = i + 1
	end do
endsubroutine

Then in the Fortran controller, you loop through:

call getAllMarsupials(names, latinNames, wikiLinks, descriptions)

i = 1
do
	pagevars(1,2) = names(i)
	pagevars(2,2) = latinNames(i)
	pagevars(3,2) = wikiLinks(i)
	pagevars(4,2) = descriptions(i)
	if (len(trim(pagevars(1,2))) == 0 .or. i == 5) then
		exit
	else
		! template with string
		templatefile = 'template/result.jade'
		call jadetemplate(templatefile, unitNo, pagevars)
		i = i + 1
	endif
enddo

Then the individual result template:

.row
  .col-sm-12
    h4
      a(href="https://en.wikipedia.org#{wikiLink}") #{name}
    em #{latinName}
    hr
    p #{description}

HTTPS Certificate

Don't forget to get a free HTTPS Certificate using LetsEncrypt!

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-14-04

License

This library, like FLIBS which it's based on, is available under the BSD license

More Repositories

1

gitjk

Undo what you just did in git
JavaScript
827
star
2

profanity-pgp

Make PGP messages and signatures more interesting
JavaScript
493
star
3

majurojs

Open data for buildings from several cities and counties. Geodata Checkout for everyone.
HTML
113
star
4

jsquil

Quantum computer instructions for JavaScript developers
JavaScript
50
star
5

mapplz-go

Make mapping quick and easy in different languages with MapPLZ
Go
43
star
6

quantum-peep

Multi-platform quantum programming library, written in TypeScript, good for JS/NodeJS
TypeScript
34
star
7

mapplz-ruby

Ruby gem to store, query, and visualize map data without all the complexity
Ruby
33
star
8

mapplz-node

Make mapping quick and easy in different languages with MapPLZ
CoffeeScript
29
star
9

graph

Scraping data from the web and loading it into a graph database
Python
24
star
10

1batch

Experimental social media / mobile web app with Koa v2
JavaScript
22
star
11

crunchtime

Drop time-enabled geodata (KML, GeoJSON, GPX, CSV) into the browser, get a timeline-map. Uses Redis key-value store, can import your public OpenStreetMap traces
CSS
21
star
12

hindi-bert

Hindi NLP work
Jupyter Notebook
14
star
13

aoc_reply_dataset

Building a dataset of Twitter replies for unsupervised learning / bot-blocking
Python
13
star
14

sketchcart

OSM + D3 + Walkway.js = animated drawn maps
PHP
13
star
15

TileMill-GeoCSV

TileMill plugin to add geo styling (nearest, farthest, clusters, within polygon)
JavaScript
12
star
16

cyclops

Puzzle language written in Linear A
JavaScript
12
star
17

overencrypt

Automatically audit / improve the encryption set by LetsEncrypt
JavaScript
10
star
18

stretch-arabic

Make long Arabic words in <canvas>
JavaScript
9
star
19

myanmar-numbers-js

JavaScript parser for Myanmar numbers (includes Shan)
JavaScript
9
star
20

Crayon-Canvas

Simple art library for HTML5 Canvas. Includes OpenStreetMap renderer.
JavaScript
8
star
21

js-arabic-reshaper

Port of Python and Java text-reshapers, to fix issue across JS/NodeJS projects
JavaScript
8
star
22

postgis-zimbabwe

PostGIS tutorial with hosted read-only database and notebooks
HTML
7
star
23

crossword-unicode

Crossword generator that supports multiple languages
JavaScript
7
star
24

serverless-graph

Accessing my Neo4j graph database from a Serverless setup
JavaScript
7
star
25

circular-arabic

Use <canvas> to print Arabic script in a circle
JavaScript
7
star
26

use-this-now

Links to new technologies which improve on the tech which I used in old posts
6
star
27

crowdbotblock

Drag and drop blocks from Google's Blockly project to create JavaScript programs for Arduino / johnny-five
JavaScript
6
star
28

wiki-crossword

Makes crossword puzzles from Wikipedia article openings
JavaScript
6
star
29

arabic_nlp_comparison

Comparing existing NLP / sentiment analysis tools for Arabic
Python
6
star
30

MapPLZ

Make a Google Map with psuedocode, inspired by LOLCODE. Live code editor, forkable maps
JavaScript
6
star
31

POI-Dough

Experimental mapping platform, applying HTML5 procedural rendering to items from OpenStreetMap. Node.js and Mongo
JavaScript
5
star
32

van-gogh-map

vector tile experiment
JavaScript
5
star
33

myanmar-sort

Big module for NodeJS to sort any Myanmar/Burmese text
Ruby
5
star
34

camera

Code for "Fun with getUserMedia(): Green Screens and Fever Dreams" workshop
JavaScript
5
star
35

code-adversary

Deception and bias-detection code for code LLMs
Jupyter Notebook
4
star
36

knayi-cli

CLI wrapper to convert Zawgyi-formatted Myanmar text to Unicode
JavaScript
4
star
37

GridMapAuth

GridMapper in Node.js. See CfA repo at https://github.com/codeforamerica/GridMapper-Node
JavaScript
4
star
38

row-to-scope

Make CSV rows and GeoJSON/KML/SHP features into their own pages
JavaScript
4
star
39

Leaflet.js-for-DataCouch

Map your DataCouch data with Leaflet.js mapping API
JavaScript
4
star
40

rtl-guide

right-to-left language HTML/CSS demos, tips, and information
HTML
4
star
41

BassPedal

Find and empower local clusters of people who back the same Kickstarter project
JavaScript
4
star
42

my-winresearcher

Convert Myanmar language from ASCII+WinResearcher to Unicode
JavaScript
4
star
43

diy-island

Map your own imaginary island using TileMill and MapBox
Python
4
star
44

char-combo

Game to read and type in a new language!
HTML
3
star
45

bluescreen-gif

Client-side JavaScript to make GIFs from webcam. Plus bluescreen feature.
JavaScript
3
star
46

EnterTheButterfly

Zooming, rotating version of the Waterman Butterfly projection world map
3
star
47

superhero-tf

Spawns personal TensorFlow instances
JavaScript
3
star
48

rover-cleanup

Mapping a Twitter hashtag and its photos
HTML
3
star
49

somalimap

Animate borders changing over time in Leaflet and D3. Based on one of my earliest JS maps, http://maptonomy.appspot.com/mapdefault
JavaScript
3
star
50

flightmap

D3 experiment: follow a flight from SF to Honolulu to Majuro
HTML
3
star
51

rename.ninja

Checklist app to help people rename themselves
JavaScript
3
star
52

mapbyexample

experimental thing
2
star
53

Open311-Plugin-for-Ushahidi

API and plugin to set up Open311 GeoReport v2 within Ushahidi
PHP
2
star
54

quantum-circuit-viz

JS visualization for Quantum Quail circuits (based on QISKit Python)
JavaScript
2
star
55

grapheme-regex

Some tests to make sure this regex makes sense
JavaScript
2
star
56

mapplz-python

Make mapping quick and easy in different languages with MapPLZ
Python
2
star
57

skycache

Not-so-smart tile server for high-traffic maps projects. Cache and go from MBTiles.
Python
2
star
58

olpc-map-net

A geo-social site, built originally to showcase and network OLPC schools and volunteers. Runs on AppEngine. AppScale and other OS alternatives not yet tested
Python
2
star
59

build-source-text

Build a source text (for example, Esperanto) from Wikipedia
JavaScript
2
star
60

sosays

get command line tips from StackOverflow, in the command line
JavaScript
2
star
61

TileMill-Shop

A custom plugin for the TileMill mapping engine which generates teaser tables for you
JavaScript
2
star
62

scraping-by-in-nodejs

Tutorial for jQuery users to learn NodeJS by writing a scraper module
JavaScript
2
star
63

MaconMaps

Open maps explainer and portal for Macon, Georgia. Includes Geodata-Checkout and NeighborDiff from CfA
HTML
2
star
64

MusicalCity

Instantly create an HTML5 audio visualization on top of a city map
JavaScript
1
star
65

this-could-be-mobile

Site to demo what adding responsive CSS file to a site can do
JavaScript
1
star
66

mvoter-usage

For Myanmar: color-scaled mVoter users by township
JavaScript
1
star
67

TileMill-Connects

Carto + OSM hack: add [connects="Example St, Macon, GA"] to style connecting streets. For more complex networks, try https://github.com/codeforamerica/DemoDexter
JavaScript
1
star
68

postgis-erbil

Code for mapping workshop
JavaScript
1
star
69

africa-carto

D3, MapBoxGL, and Tangram clones of Brooklyn Museum print maps of Africa
JavaScript
1
star
70

parcel-gridder

Split a big GeoJSON parcel file into a grid using TurfJS
JavaScript
1
star
71

CrowdBot

Livestream a web-programmable Arduino board to multiple programmers - useful for classes, art projects, and getting to know Arduino.
Python
1
star
72

school-profiles

Development data browser
1
star
73

omegapm-ruby

a secure channel to communicate with package developers
Ruby
1
star
74

check-for-nameless

Check OpenStreetMap for missing alternate names
JavaScript
1
star
75

DeepClapback

Queries Reddit comments and trains a model on successful 'clapback' comments
Python
1
star
76

myanmar-names-js

Sort Myanmar names alphabetically
JavaScript
1
star
77

snowshot-map

(2010 project) make a crowdsourced photo map over e-mail. Uses Google AppEngine (Python).
Python
1
star
78

arabic-cypher

Graph queries in Arabic script
JavaScript
1
star
79

FollowFrost

Project for Knight-Mozilla News Learning Lab #MozNewsLab - based on Popcorn.js and AppEngine
Python
1
star
80

literal-kanji

Literal translation of Japanese kanji names and words
JavaScript
1
star
81

heatmap-demo

Heatmap demo with Google and Leaflet APIs
JavaScript
1
star
82

blockstagram

Attracting businesses downtown with an ArcGIS Online-enabled version of OpenBlock
Python
1
star
83

popcorn-openmap-plugin

OpenLayers + OpenStreetMap plugin for open web maps and GIS connecting to open video / Popcorn platform
JavaScript
1
star
84

multiply

Suggested locations of new Divvy stations, divided into commits
Python
1
star
85

geohash-emoji

Geohash for what3emojis
JavaScript
1
star
86

openpgp-keyring

Initial test of keyring as a separate module
JavaScript
1
star
87

pysyft-lightning

PySyft + PyTorch-Lightning examples
Jupyter Notebook
1
star
88

osm-unicode-coverage

Mapping use of different Unicode scripts by block
JavaScript
1
star
89

mongolian-map

map labels in traditional Mongolian script
JavaScript
1
star
90

ml

Machine learning projects portfolio
HTML
1
star
91

provenance-threads

track artworks
HTML
1
star
92

Adopt-a-Siren-Macon

Macon version of Adopt-a-Hydrant
Ruby
1
star
93

pokemon-mars

Pokemon Go game which you cannot win because you will never visit Mars
JavaScript
1
star
94

Majuro-Marshall-Islands

Majuro Atoll, Marshall Islands is all curled up. Here's what it looks like with its main road as a centerline
HTML
1
star
95

diy-dictionary

Static, web-based, auto-complete dictionary app with thousands of words.
JavaScript
1
star
96

accompaniment

In college I made a video app - Google Code is shutting down so I moved it here
Java
1
star
97

omegapm

a secure channel to communicate with package developers
JavaScript
1
star
98

10000-spoons

Entry to NaNoGenMo 2014 - a script that writes a 50,000 word book!
JavaScript
1
star
99

llc

forming an LLC? maybe
1
star
100

training-east

Building training data from page scans, for EAST text detector
Python
1
star