Vegan Recipes, Vegetarian Recipes and Motivational Quotes. LIVE SMART, BE WISE, THINK FRESH.

Tag: LIVE Page 1 of 4

Developing Against a Live Database

All right, friends, it’s time for some serious development talk. You and a couple of your friends are building the next it, the Web 2.0 app of the future. You have a source control system set up, you even have a bug tracking system, you even have a spec and someone (not you!) who tests your software (may I remind you of the famous Joel Test?). You’re heading for success.

Your web app has a database back end, and you already have a few users out there, playing with your system; their data lives in your “production” database. You also have local dev boxes, with complete copies of the production environment, with development versions of the database. Anyone can mess with the development databases without causing havoc to real users’ data.

If you don’t have any of that, don’t read this article. Instead, go read Joel Spolsky’s blog or book “Joel on Software”. He’ll explain why all of these pieces are necessary.

If you do, however, you’re on the right track. But.

There’s always a “but” (or a butt?).

How do you propagate the changes to the database schema, if there are any, to the production version of the database? You’re still doing development on the system, schema and data are changing with each build, you can’t afford a DBA to do crazy DIFF’s between your dev database and production database…

Simple, and flawed, approach

You already have a version control system. Let’s assume you’re using MySQL as your database (I am). You can just use mysqldump to dump the schema and data of your development database, and check in those .sql files into source control. Then, your build script just drops the production database, and recreates it from scratch using the .sql files from the source tree.

Note that you definitely want two dumps: one for the schema, and one for the data. This way it’s much easier to track schema changes in your source control system.

Only one, but very big problem: user-generated content gets lost.

You may say “copy over user generated content to the dev box before checking stuff in”. But the build isn’t instantaneous, and everyone who’s been doing something on your site during the time between your “sync” and the build will lose their data. Not good.

You may say “screw user content”. No, you didn’t say that. I just heard it from some weirdo in the back of the room. Screwing your users is a safe way to lose early adopters, who are the only way for you to deliver a quality app fast. If you don’t get feedback from those enthusiasts (and you won’t if you piss them off by continuously throwing away the data that they’ve put in), you’ll lose.

Complex, and successful, approach

Identify which tables in your database will contain user-generated content. For the cocktail builder site, these are the mainly the tables with user ratings and user actions, and table for reporting crashes.

Your build script will no longer drop the entire database and rebuild it from scratch; it will drop all tables except for tables with user content. That is, as a part of the check-in process, split your output .sql files as following:

schema.sql: DDL for all tables except those with user-generated content
schema-extra.sql: DDL for tables with user-generated content
data.sql: actual INSERT statements for all tables other than those with user-generated content
data-extra.sql (optional): you get the drill. This is optional because there’s not always a point in including user-generated data into your build – just back it up on the production database side, and sync it to the dev boxes once in a while.

Your script to dump the dev databases may look like this file below (this is a batch script – I do my development on a Windows box; please don’t flame me, I’m built of a fire-retardant):

@echo off

REM Full path to the MYSQL utilities. Required.
SET MYSQLDUMP=”C:\xampp\xampp\mysql\bin\mysqldump”
SET MYSQL=”C:\xampp\xampp\mysql\bin\mysql”

REM Database settings
SET DBNAME=mydb
SET DBUSER=myuser

cd ..\setup_sql

REM Producing schema and data files for the build. They are
REM called “schema.sql” and “data.sql”.
REM Using MySQLDump. Path is specified in the variable above.

REM —– Delete old versions of the files.
del schema.sql
del data.sql

echo Generating core schema and data files…
REM —– Using settings specified in the configuration file, ignore
REM —– a few tables that shouldn’t go into the incremental build
REM —– (user-generated content should not be discarded on upgrade).
REM —– The schemas for those tables will go into a separate file
REM —– that can be used to initiate a “full from scratch” build.
REM —– Content for those is not a part of the build.
SET ResultSkipString=
SET ResultIncludeString=–tables
echo The following tables will not be included in the core build:
FOR /F %%t IN (userContentTables.conf) DO (
   echo – %%t
   SET ResultSkipString=!ResultSkipString! –ignore-table=%DBNAME%.%%t
   SET ResultIncludeString=!ResultIncludeString! %%t
)

REM —– Dump the actual SQL schema/data creation scripts…
SET CommonDumpSettings=–comments=false –user=%DBUSER% –single-transaction –no-set-names –skip-add-locks -B %DBNAME%
“%MYSQLDUMP%” –result-file=schema.sql –no-data %ResultSkipString% %CommonDumpSettings%

echo USE `%DBNAME%` > schema-extra.sql
“%MYSQLDUMP%” –no-data %CommonDumpSettings% %ResultIncludeString% >> schema-extra.sql

“%MYSQLDUMP%” –result-file=data.sql –no-create-db –no-create-info –skip-extended-insert –skip-disable-keys %ResultSkipString% %CommonDumpSettings%

echo Done

And the mentioned file userContentTables.conf is just a newline-separated list of table names that contain user content.

Have fun!
cb

Cocktail Builder: JavaScript Alcoholic

10 Sure-Fire Ways to Live a Stressful Life

BY SOFO ARCHON

stressed-man

Observe people around you and you’ll see that most of them are stressed out. Stress in the modern world is a normal, everyday phenomenon, and only a few manage to overcome it and find inner peace and clarity.

If you feel that stress is missing from your life, and you’d like to change that so that you can better fit in with society and be considered by your fellow human beings as a normal, unhealthy person, here are some powerful, sure-fire ways to live a stressful life:

1. Compare yourself to others

You are a uniquely beautiful individual who has special gifts to contribute to the world. If you learn to accept yourself as you are and spontaneously express your mind and heart, you’ll feel content and complete.

But that’s not what you want. What you want is to be stressed, and what’s the best way to achieve that other than focusing on your flaws and comparing yourself to others, such as celebrities and internet personas, who always look shiny, beautiful, and happy?

Most people have learned from early childhood to compare themselves to others and this way they manage to always keep their stress levels high. Learn from their example and you’ll soon start hating yourself, which will definitely make you experience unbearable suffering.

2. Follow orders

Another great way to attract stress into your life is to stop paying attention to your inner voice. Instead, listen only to the voices of others and obey to what they tell you.

No matter what people are trying to impose on you, just passively accept it, and of course don’t forget to be thankful to them. Don’t think for yourself or make decisions of your own — let others do the thinking for you and decide for your destiny. This way you’ll throw your freedom away, and before you realize it you’ll have no control over your life, which will do wonders to help fill your psyche with anguish that will torment you each and every moment of your life.

3. Eat crap

We need to have a healthy body to experience life to the fullest. The basic way to keep your body healthy is to eat nutritious food. However, health and stress don’t go hand-in-hand, so be sure to not eat well, no matter what, and you’ll see your stress levels rise slowly yet steadily.

There are two main dietary steps that you need to take in order to ruin your health. First, be sure to consume processed foods as well as increase your animal protein and sugar intake. Then, to make things worse, restrict your intake of organic, whole, nutrient-packed foods, such as grains, legumes, seeds, nuts, fruits and vegetables as much as you can — if possible, don’t eat any of them!

By filling your body with toxins and depriving it of vital nutrients, it won’t take long until you’ll start experiencing the tremendous consequences that this simple yet easy strategy can have on your health — it will immensely complicate your life, bringing you more suffering than you could have ever imagined!

4. Sit all day long

Eating unhealthy is perhaps the best way to mess up with your physical organism, but if you’d like that extra push that will make your life even worse pretty quickly, I have another great suggestion for you: move your body as less as possible.

This is an easy thing to achieve, if you are determined to do so — just sit, a lot. When a friend asks you to go for a walk together, find an excuse not to join him or her. When you feel like working out, don’t do it, for exercise is stress relieving, and you don’t want to waste your precious stressful energy.

Helpful tip: To make your sitting time effortless, stay rooted on your couch in front of a TV screen and let yourself be hypnotized by Television’s superficial, nonsensical audiovisual content. Believe it or not, this simple tactic will tremendously help to keep you seated for hours upon hours without you even realizing it!

5. Undersleep

Another sure-fire way to live a stressful life is to not sleep as much as your body needs to relax and recharge its batteries. Sleep less — as less as possible — so that you’ll feel physically and mentally weak. This will keep you constantly tired, agitated and confused.

By undersleeping, you’ll play havoc with your body and mind, which will make your life extremely complicated, so that you won’t be able to function properly in your everyday life and you’ll have to waste most of your time and energy trying to cope with all sorts of psychosomatic health issues.

If you find it difficult to undersleep, I’d highly recommend you to spend every couple of days partying and getting wasted, or, if you’re not so much into partying and alcoholic drinks, just spend much of your night time in front of an electronic screen, absorbing the blue light that it emanates, which will undoubtedly mess up with your organism’s circadian rhythm.

6. Be judgmental

Stress is to a great extent the result of how we view the world around us. For example, if we perceive the people we come in contact with as enemies, then we’re bound to feel much more stressful when we socially interact with others than if we perceived them as friends.

A powerful yet oftentimes neglected tactic to make the world seem like a hellish experience is to develop a judgmental attitude towards people. So from today, be sure to judge people harshly, call them names, gossip about them, and argue against them as much as you can to prove your egoistic superiority over them.

Being judgmental will not only complicate your relationships, but will fill your psyche with so much toxic energy that will transform you into a super-stressed person who won’t be able to stay calm and relaxed around people and who certainly won’t be kind and loving towards them.

7. Keep yourself busy

Many people complain that the modern way of living is unbelievably stressful and they are trying their best to simplify their lives, so that they can have more peace of mind as well as more time to pursue their passions. These people, however, are not like you at all, and you shouldn’t pay any attention to them. You want stress, and the fast-paced, chaotic modern way of living is something to make the most of!

From now on, keep yourself continuously busy, by overworking and being distracted by things that don’t contribute to your well-being. Never let your mind chill and be quiet — no, you don’t want this! Overthink, especially about the future, so that you’re anxious about what will come next, and you’ll be unable to focus on the present and enjoy the simple yet precious things that life brings on your way. By doing so, I assure you that stress will become your middle name.

8. Hide behind a social mask

To be honest means to feel confident with who you are and to be able to communicate your sincere thoughts and emotions to other people. But honesty has a serious side-effect that you need to avoid at all costs: a relaxed state of mind. People who are honest tend to be less fearful and are able to form better, more genuine relationships with others, both of which lead to improved well-being.

Since what you want to achieve is the exact opposite, be sure to hide who you are from others as best as you can. This way, you’ll be chronically stressed, out of fear that people might get a glimpse of your inner world. In addition, people won’t like to spend any time with you, realizing that you are not open to a heart-to-heart communication. The result will be that you’ll feel alienated in a seemingly cold world, which will make you more stressed than you’ve ever been before!

9. Complain, complain, complain

In life, we’re regularly faced with problems and challenges that we need to deal with, if we wish to grow and mature into wiser individuals. Indeed, those who use critical thinking to find solutions to their problems and take concrete action to overcome whatever obstacles they are facing, are usually the ones who ultimately manage to live a fulfilled life.

You, however, need problems, because problems equal stress. So why use critical thinking and try to make a positive change in your life? It’s utterly pointless. Do none of these! Instead, just complain to those around you for the messed up life you’re living, and even blame them for that. Whether others are truly to blame or not doesn’t matter — what matters is that you passively accept all suffering and react to it just by complaining, which ultimately won’t do anything to help you overcome any problems that you might be facing. The result? A flood of stress running through your veins.

10. Fill your space with clutter

Over the last few years the minimalism movement has been growing dramatically, because more and more people realize the importance of owning less material stuff in living simply and stress-free. But you shouldn’t care about those minimalists! Differentiate yourself by increasing your possessions and hence complicating your life!

Starting today, do your best to collect as much unimportant stuff as you can, both in your house and work space, and remember not to give away or throw out stuff that you don’t need anymore. Trust me, this easy yet often neglected way will immerse yourself in stress in just a few days!

Remember: Don’t hide your possessions — place them right in front of your eyes, so that you can’t avoid being distracted by them all the time. By doing so, you’ll soon start feeling overwhelmed by stress, without realizing how much of it is actually caused by all the clutter that you’ve gathered around you.

***

This guide is guaranteed to fill you with a constant mental stream of worries and concerns. Re-read it until you fully grasp all the ideas contained in it, and be sure to diligently implement them in your everyday life to see optimal results.

The post 10 Sure-Fire Ways to Live a Stressful Life appeared first on The Unbounded Spirit.

The Unbounded Spirit

Page 1 of 4

Powered by WordPress & Theme by Anders Norén