On returning content # automagically detects content and set the right headers: res.send(returnhere) # explicitly return json objects: res.json(JSON.stringify(returnhere)) # you are more interested in sending http codes than actual return objects:
Author Archives: onsubjec-admin
mongodb: the basics
# check existing collections: show collections # drop a collection: db.collectionnamehere.drop()
Apache Spark: the basics
RDD: Resilient Distributed Dataset It’s encapsulation on a collection of data. Distributed in clusters automatically. RDDs are immutable. You can apply transformations (return a new RDD with, for example, filtered data), and Actions (like First(), to return the first item in them RDDs are resilient, they can lose nodes, and be able to recreate them […]
Java: the basics
Use int, long (primitives), instead of their objects (Integer, Long) primitives are the atomic, basic, data types, unless you know what you are doing, stick to those. They (primitives) are passed by value. Long and Integer are the object form of the primitives, to be avoided unless you need to pass by reference, or pass […]
AWS Glue: the basics
Crawl your data source first to create a catalog and table definitions Add a job to process your crawled data That’s all!
React.js: the basics
Basic element creation: ReactDOM.render(React.createElement(‘h1’, null, ‘Hello world!’),document.getElementById(‘content’)) The first argument, the element The second: the data to be feed to that element The third, the innerHTML inside that element ReactDOM.render does the actual appending to the page React Hooks Example (look ma’ no classes!): const GeneralStats = () => { useEffect(() => { // fetch […]
Redshift: alter table column TYPE is not allowed
Only allowed for varchar column types. The trick to get it done: ALTER TABLE sometable ADD COLUMN some_new_column (with the new definition you want) UPDATE sometable SET some_new_column = old_column; ALTER TABLE sometable DROP COLUMN old_column; ALTER TABLE sometable RENAME COLUMN some_new_column TO old_column; The catch: column order will be altered (the new column will […]
firebase setup
Basic startup command npm install -g firebase-tools firebase login firebase init (make sure you click the space bar to select an option, otherwise your firebase.json file will be empty) create an index.html page in that dir in the firebase console, click on the “add firebase to your web app” button, and put your javascript code […]
AWS lambda: the basics
For a API Gate / Lambda combo, there is a bit of a gotch when setting those two services together and following their hello world example. Instead of the default in their example: # print(“value2 = ” + event[‘key2’]) use: event[‘params’][‘querystring’][‘key1’] I wish it was more evident in their documentation what “event” means, but basically, after […]
Atom: the basics
cmd-shift-P opens the search command