Showing posts with label stack. Show all posts
Showing posts with label stack. Show all posts

Wednesday, November 2, 2022

stack developer

Basically want to be able to deal with front and back end

Let's tear into this supposed meme below...

Imagine numbers in front of each step and that's how I've ordered this page. At the bottom of the page is sandbox information, definitely needed to practice each item. Incidentally, it might be worth it to some to also learn COBOL, so I've added that beneath sandbox info, at the very end.

Languages (16:41) Fireship, 2022. Must watch at .5 speed. Learn Python, JS, and PHP, already know Bash, HTML and CSS. SQL seriously importante.
One person's journey (webpage) the path one person took.
Programming typification (18:54) Continuous Delivery , 2021. History of languages in a thorough format. Object vs function, vs polymorphism. "messaging". Structured programming prevents unstructured Goto's.
Language rankings (15:16) Clement Mihaelescu, 2022. Front-end dev self-legend (Romanian?) type PHP hater walks us through a ranking. Comments.

7. MongoDB and MySQL (20 days)

First of all, Barry Brown. That said, databases are more like 20 years than 20 days. Just learning normalization methods is a PITA and a relief (ohhhh) at the same time, for example.

Normalization (5:41) Crack Concepts, 2019. Thick accent: 0.5x speed. Simple explanation describing why to delete redundancy and use links (keys). CC has an entire series on normalization.
One person's journey (webpage) the path one person took.

8. GitHub and Git (18 days)

This might be more like a week, if it's a 7 day 56 hour week. 18 days would certainly allow more file check-outs and lazier pace of absorption, but let's at least cede back 9 days of time to other stages, if needed.

Git tutorial (25:14) Derek Banas, 2014. Typical Banas everything but the kitchen sink. 8:00 using a directory to be monitored. 14:00 what's changed. 18:00 add changes, delete files from monitoring.
One person's journey (webpage) the path one person took.

$ git config --global user.name "Foo Fooslap"
$ git config --global user.email katyua@free.com
$ git config --global core.editor "nano"
$ git config --list
$ git help
$ git diff
$ git commit -a

9. REST API or AJAX (11 days)

Here's where the real joke exists in this meme. This is 365 days, not 11.

SANDBOX

serving pages (localhost)

Typically will need to put in Apache, but rudimentary server is in PHP if just checking basic HTML and CSS setup

# pacman -Ss
# systemctl reload apache2

Localhost SSL (14:13) Ambar Hasbiyatmoko, 2017. Necessary to have a localhost Apache running, but how to do HTTPS? Of course, will need an SSL certicate. Has a few ommisions as to how to properly configure localhost so chromium won't complain but otherwise...
PHP without Apache (4:39) Jonah Lawrence, 2020. Uses a Bitnami cookie cutter. No SSL run through : can't do that with PHP's simplistic built in server but avoids Apache.

COBOL .COB and C

Don't really have a way to get it written to a page.

COBOL (2:13:58) Derek Banas, 2020.Comments indicate this is a sensible tutorial.

Wednesday, September 16, 2009

layman data III

Helpful links: **Google MySQL Primer CERT Bulletins Webmaster World Forum Simulate foreign keys - MyISAM Cascading and key constraints - MyISAM, InnoDB, NDB Create tables using PHP script
This is the third in the series, though not meant as a coherent progression. A random collection of tidbits or crumbs to follow. Recently: * Cascading and foreign key constraints with different engines. My webhoster provides only the MyISAM engine, so no foreign keys. Foreign keys are the "relation" in an RDBMS, auto-updating child relations when a parent is updated, cascading inserts and deletes, and so on. This apparently can be approximated in a number of ways in MyISAM. TRIGGERs can be created, loops which do multiple inserts, etc. The InnoDB engine makes this process native from the time of creating the tables. Much easier. To switch between engines in existing tables, we use: ALTER TABLE tablename TYPE = MyISAM; * Added CERT link above. The CERT bulletin link above quickly reveals the many injection threats arising each week. It appears one has to lock-down the code of a production server which, in turn, apparently requires time and patience to learn and implement. * Scripts to install tables. Appear to format as .sql dump files but without the data inside. * Proper documentation, once this is more focused and defined. So far, a simple RTF file using underline for primary, and italic for foreign key, has been helpfully direct. Seen it elsewhere too, but read it in Welling, L., Thomson, L. (2008). PHP and MySQL® Web Development, Fourth Edition. Addison-Wesley Professional. pg 208-209 informit link ~$50. REFERENTIAL INTEGRITY

Friday, September 4, 2009

layman data II

related links
Apache   PHP   PostgreSQl
security modifications to avoid root
LAPP on Redhat (very helpful)
clear PHP/Apache compile notes


A difficult intercomplexity, combined with an annoying resource drain of running Apache, PostgreSQL (or MySQL), PHP, and a browser (taken together, a LAMP) are required these days. If one has photos or a lot of other files, something besides file folders are needed and they cannot be managed without a LAMP unless one has a CS degree or can afford Oracle. I run a LAMP on my website to make files accessible, but the provider where I park the site has older versions of all this software. This makes the LAMP vanilla and slower (eg., no InnoDB). Additionally, there are no options for PostgreSQL.

Since I prefer PostgreSQL, for the LAMP on my local drive, I created a LAPP, substituting Postgres for MySQL. Even on a local drive, security issues arise. Apache, Postgresql, PHP, and some browsers require ports. I want to be sure no ports are open to the outside. Learning how to lock-down Apache, PostgreSQL, and PHP to make them only localhost accessible is a work in progress. Configuration files need to be altered for localhost only, but it appears there is more to it than this, if one is simultaneously connected on the Web.

On this local drive, running hybridized Slackware (Zenwalk), a reliable LAMP exists out of the box, but morphing it to a PostgreSQL LAPP required compiling PostgreSQL and PHP (see "Notes" below). The kernel didn't require alteration and a recompile, thankfully.

Notes

Install PostgreSQL(source, don't use netpkg) and MySQL(netpkg) first. In Zenwalk, PHP is precompiled without PostgreSQL support. PHP must therefor be recompiled with it: "--with-pgsql=/usr/local".

Default Users, Ports, Home

Postgresql - user:postgres, port 5432, /usr/local/pgsql. Apache - user:root, port 80, /etc/httpd.conf. PHP - /usr/local/lib/php. MySQL - user?, port 3306, usr/share/mysql. I compile Postgresql instead of netpkging it because of a Catch-22 that occurs after installation. One would have to log in and out every time they wanted to use the database or create group permission trees. On a standalone, it's easier to compile Postgresql and initialize with the user as the owner instead of "postgres". Create databases using

PostgreSQL

FIRSTRUN DBMS - Compiling is easier downstream than Zenwalk. When compiling, simply supply one's username during initdb, eg. if one's username were "foo": $ initdb foo --encoding=utf8 --locale=POSIX .Then just make some directory in /home like "/home/pgsql" and # chown -R 1000:100 /home/pgsql so "foo" can use it at will. If using Zenwalk, postgresql.conf and pg_hba.conf must be configured prior to first run. Zenwalk also makes the default user postgres, so its password needs to be created: # passwd postgres, and enter a simple password. A note of confusion for Zenwalk is that "postgres" is both the god user of the DBMS, but also a command to start the DBMS ("postmaster" is deprecated).
START/STOP DBMS - # service start/stop postgresql (Zenwalk), or # postgres -D /var/lib/pgsql/data/ -r logname.txt. This second command starts the database at its default location and provides a logname of choice.
DATABASE FILES Zenwalk installs a PostgreSQL tablespace at /var/lib/pgsql/data, but if installing from source they go to /usr/lib/pgsql. # createdb -U postgres -W -D /var/lib/pgsql/data/sub01 -E utf8 -e employees.

Apache

SECURITY Once it's running, if Apache's listening for connections, it's a significant security problem. Set it to only listen on port 80, so it only listens to localhost. Skype also uses Port 80, but you can reset Skype to, say, Port 81, in its advanced settings. Meanwhile, to change Apache:
# nano /etc/apache2/ports.conf
Listen 127.0.0.1:80
START/STOP - # service start/stop httpd (Zenwalk), or # apachectl start/stop (any distro). Checkit by pointing browser to "http://localhost".
CONFIG FILES - Netpkg handles it, but following PHP recompile, Apache configuration tweaks are necessary for PHP serving. A short list is here. Additionally, one must open /etc/apache/mod_php.conf and provide the complete path to libphp5.so, typically /usr/libexec/apache/libphp5.so, if it's not in there. Following changes, restart httpd, which should initialize PHP.
HTML FILES - (Zenwalk) We can serve files from anywhere on our hardisk through the browser, but it's easiest to put them in /var/www/htdocs/, because this is the default. To write to here from logs or anything, it can't be done easily since /var/www/ is owned by root. A solution is to create a new group.

PHP

START/STOP - # php -v. This command checks for the version. PHP loads as an Apache module, not as a separate program. I used #netpkg remove php to remove the Zenwalk version of PHP. I did this because the netpkg (Zenwalk) version fails to support PostgreSQL.

COMPILE - necessary for PostgreSQL; netpkg PHP does not support Postgres. The configuration phase, prior to "make", is critical. The correct syntax for the PostgreSQL functionality is --with-pgsql=/usr/local. However other options, can be useful. Taking most situations into account, a reasonable configure string might be:
$ ./configure --with-apxs2=/usr/sbin/apxs \
--with-pgsql=/usr/local \
--with-mysql=/usr/share \
--with-libxml-dir=/usr/lib \
--with-curl=/usr/bin/curl \
--with-zlib \
--with-gettext \
--with-gdbm \
--enable-inline-optimization \
--enable-track-vars

"Make", then root "make install"; it installs to /usr/local/lib/php. Copy the ini files to there: # cp php.ini* /usr/local/lib/php/. Pick one of the two to be the ini file, eg # cp php.ini-development /etc/apache/php.ini. It can be tweaked later.



Other

Tuesday, August 4, 2009

layman data I

Helpful links: **Google MySQL Primer MySQL Forge OpenSourceCMS compare insert data from html html data entry formats useful php code Blog w/simple folksonomy schemas

introduction

Folders and a file manager aren't sufficient for speedy file retrieval once a few thousand documents are accumulated. Further, they don't allow for proper metadata storage. I'm sure many home users are in this situation.Our needs are great, but we are basically forced to rely on folders and a file manager or to contact, say, Oracle and pay business rates. And the only in-between option seems to be to go to all the trouble of learning how to build and implement a CMS such as a LAMP or to install a boggy pre-designed LAMP like Joomla or Drupal.

I had a few considerations:

  • PostgreSQL data warehouse
  • browser initiated query ability (JavaScript, PHP, blah blah blah)
  • methods to vacuum, backup, and restore the DB
  • a schema representing the above in some reasonably intuitive way
  • relationships

    The problem was how to establish relationships between a file and several tags. Three commonly used schemas are MySQLicious, Scuttle, and Toxi. There are others, more complex, and faster, but my provider is simple and only has MySQL. Toxi appeared passable for my arrangement. The key though is the PHP to enter the relationships, and in the proper order. Anyway, first, the schemas. This site shows the three options utilizing ER modeling but crows feet is probably the clearest representation. Crow's feet versions can be seen in some of the representations in the blog link above the introduction.

    mysql

    The provider on which my site is parked only provides MySQL for manipulation. This was OK for a trial run. Below are the three tables, taken more or less verbatim from MySQL Forge's excellent page: CREATE TABLE Items ( item_id INT UNSIGNED NOT NULL AUTO_INCREMENT , item_name VARCHAR(255) NOT NULL /* Many more attributes of the item... */ , PRIMARY KEY (item_id) ) ENGINE=InnoDB; CREATE TABLE Tags ( tag_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT , tag_text TEXT NOT NULL , PRIMARY KEY (tag_id) , UNIQUE INDEX (tag_text) ) ENGINE=InnoDB; CREATE TABLE Item2Tag ( item_id INT UNSIGNED NOT NULL , tag_id SMALLINT UNSIGNED NOT NULL , PRIMARY KEY (item_id, tag_id) , INDEX (tag_id) , FOREIGN KEY fk_Item (item_id) REFERENCES Items (item_id) , FOREIGN KEY fk_Tag (tag_id) REFERENCES Tags (tag_id) ) ENGINE=InnoDB; With these I was nearly able to be up and running, but I received an error when attempting to create "Tags", namely that: Error: tag_text used in key specification without a key length I changed UNIQUE INDEX (tag_text) to index on the first 12 characters: UNIQUE INDEX (tag_text(12)) The table was created properly but my provider does not allow for the InnoDB and so the command was subverted to the ungainly MyISAM. Nothing I could do there. Subsequently, however, I added a column to the table to provide more complete descriptions of files: ALTER TABLE `mydb`.`mytable` ADD COLUMN `item_desc` TEXT NOT NULL AFTER `item_name` I wanted a column to list the page numbers or slide numbers of whatever file I was looking at: ALTER TABLE `mydb`.`mytable` ADD COLUMN `item_pages` SMALLINT NOT NULL DEFAULT '1' AFTER `item_name` BACKUP AND RESTORE Tutorials describe back-ups using phpMyAdmin , or directly from a PHP browser page.

    html

    Challenges include setting up forms inside a table, the order of html and php, and resetting the form after the submission of data. An example of a form inside a table, with a reset function after the data is submitted: <form action="insert1.php" method="post" onsubmit="this.submit(); this.reset(); return false"> <table bordercolorlight="#CFCFCF" bordercolordark="#FFFFFF" border="1" bordercolor="#cfcfcf" cellpadding="2" cellspacing="0" width="100%"> <tbody> <tr> <td align="left" bgcolor="#009dd0" valign="top"><b><font color="#ffffff">description</font></b></td> <td bgcolor="#009dd0"><b><font color="#ffffff">tags</font></b></td> <td bgcolor="#009dd0"><b><font color="#ffffff">slides/pages</font></b></td> <td bgcolor="#009dd0"><b><font color="#ffffff">filename</font></b></td> </tr> <tr> <td><TEXTAREA class="expands" name="item_desc" rows="8" cols="35"></TEXTAREA></td> <td <input name="#" type="text" size="35" /> <td <input name="Position[]" type="text" id="Position[]" size="5" /> <td> <input name="item_name" type="text"></input></td> </tr> </tbody></table></form>

    php

    Appeared at first that an html file containing forms had to be made to enter data and another to retrieve data. Each of these would presumably call an appropriate php script to do the database work. However, it now appears best to include the php right into the html files.

    INSERT (MySQL)

    The core portion of the insert, which pulled values from a previous page's SUBMIT. <? php $hostname="foo"; $username="foo"; $password="foo"; //connection to the tablespace $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); printf ("<p>Status: Connected to tablespace </p>"); //connection to a database $selected = mysql_select_db("foo",$dbhandle) or die("Could not select database"); printf (" <p>Status: Connected to database </p>"); $descrip=$_POST['item_desc']; $filename=$_POST['item_name']; mysql_query("INSERT INTO Items (item_name, item_desc) VALUES ('$filename','$descrip')") or die(mysql_error()); //DB CLOSING mysql_close($dbhandle); ?>