Sunday, December 19, 2021

YouTube

Been uploading to YouTube lately again. It's not that bad of an idea. Helps keep my mind off of my depression and whatnot. It would be nice if it cured me of my depression altogether, but it won't. It can't. I still feel like bleh most days even with the meds I'm on. Maybe I shoudl talk to the doctor about my medications and see what they can do about it.

Saturday, December 18, 2021

Depression

I've been diagnosed with depression. Pretty sure it's been going on for a while now. Not just recently. But it comes and goes. Mostly comes around and sticks around for a while. It's rather annoying to have this diagnosis. But what can I do about it? Not much I'm afraid. It is what it is and that's all which matters.

Ever try and google what something is? Like trying to find out all the symptoms etc? Yeah it can be annoying at best. But it is life that I'm trying to live and get through whatever there is to get through with all of this.

I've also been diagnosed with schizoaffective disorder on top of the depression. Now there's a tongue twister for you. Again I wish I hadn't been diagnosed with any of these things. But I have and I have to learn to live with them. Trying my best to get through it all as best I can. I suppose that's why I'm going to therapy, to help me get through all of this. Sure the voices may never go away, but I'll learn to live with them.

Friday, December 17, 2021

Life is weird at times

That's right, life is weird. There's nothing I am able to do with this life because that's what this life is all about, confusion.

Some would say that life isn't confusing. But I would have to say otherwise.

Life is very confusing at times. It's terrible. Mostly worrysome and simply terrible. How else can I describe it? I'm not sure.

Friday, November 19, 2021

My Mac Died

Kinda sad really, I was using my Mac and it just shut down. I can't get it to start back up. I've tried holding down the power button for 10 seconds hoping it's just on and didn't turn off. Nope that didn't do a thing. I'm confused as to where to go next.

Friday, November 12, 2021

Religious Upbringings

Everyone is brought up in one way or another. Some are brought up to be religious. Others were not brought up in such a way.

I was brought up in a very religious household. My parents are very loving and they care about me. They take religion very seriously. I admire them for that.

We just don't agree on religion at the moment. I'm not sure how badly they think of me for that. If they think badly of me at all. I respect their decision to be religious I hope they respect my decision to not be so religious.

Thursday, November 11, 2021

Why Is Life So Difficult?

Life can be so strange and difficult at times. Hard is a word that describes it to a t. But life continues on with or without us. It doesn't stop for anyone and doesn't care about what you want it to care about.

That's just how this life goes.

It would be nice if life mattered at times. But to be honest it doesn't feel like it does.

Wednesday, November 10, 2021

Changing Clocks Messed Up My Day

Changing clocks back an hour has really messed up my day. It's dark by five pm for one thing. I swear I'm more tired than I was before in the mornings. There's just something weird about it all that I can't put my finger on.

Thinking About Life

Sometimes you have to sit back and wonder what life would bring you if you had the ability to actually be something different than what you are today. It doesn't always make sense to be able to figure out this life, but when you do? It's something quite special.

Tuesday, November 9, 2021

1 Corinthians 15:1-4

The gospel can be found in 1 Corinthians 15:1-4. It talks about Jesus being cruicifed for our sins and how he was buried and then rose the third day. It's that simple.

1 Moreover, brethren, I declare unto you the gospel which I preached unto you, which also ye have received, and wherein ye stand;

2 By which also ye are saved, if ye keep in memory what I preached unto you, unless ye have believed in vain.

3 For I delivered unto you first of all that which I also received, how that Christ died for our sins according to the scriptures;

4 And that he was buried, and that he rose again the third day according to the scriptures:

Monday, November 8, 2021

Sometimes The Past Comes Back

There are days where you're sitting there wondering if the past will come back and slap you. It's quite possible that will happen. But you don't have to be stunned forever, you can move forward with life.

Life has many rules. Some aren't easily noticable. Others are in your face when you don't even notice it. That's just how this life turns out.

Sunday, November 7, 2021

Living Life After Religion

It is possible to live life after religion. That is after going to a religious service each Sunday. It's just me and the bible at the moment and that's all the religion I need.

Saturday, November 6, 2021

Life Doesn't Make Sense

Life doesn't always make sense. Sometimes it's downright difficult. Let's face it, life doesn't always like me. That's where things go wrong for me. It just doesn't like me and it doesn't quite make sense that I have to deal with all of these emotions and thoughts that run trhough my head at times.

It would be way nice if I could simply figure this life out. I've been trying to figure life out for a long time now. Yet I've been unable to figure things out so far. So here we are. Always trying to figure things out and yet not being able to figure anything out.

I realize that's quite a mess of a sentence there. But that's just how my mind thinks at times. It would be nice if life made sense. Let's face it. Nothing would be better than that.

Friday, November 5, 2021

Tired Most Days

I get tired a lot most days. I can't put my finger on it, but I just feel like falling down adn taking a nap. It doesn't always happen like that though.

It would be nice to be able to sleep at night and wake up in the morning refreshed and worry free from all cares in the world.

Trying Times

What do you do
when there's nothing to do
in a life full of wonders
and trying times

Trying times are a wonder
this life holds dear
if only a moment
it all becomes clear

Thursday, November 4, 2021

Life, Really What Is It?

Sometimes this life just gets in the way. You don't know where you're going or how you're going to get to your final destination. Life feels like a highway or a river sometimes. There are days you're in the fast lane, other days you're driving in the slow lane. Sometimes you just let the current take you wherever it will take you.

Life really is like a river to me. Sometimes I just sail by in the current. Whatever life does to me it does and there's no going around it.

Wednesday, November 3, 2021

Living Life

Life was simple once
it wasn't difficult
yet here we are wondering
where it all went

Living is a simple term
but it's more difficult than that
it is a form of torture
yet torture never felt so simple

Tuesday, November 2, 2021

Life

Life isn't a form of beauty
it isn't a form of poetry.

No, life is there
to be what it is.

A living, breathing creature
able to sustain itself.

Monday, November 1, 2021

LocalDate

To set a LocalDate with today's date we can use the following:


LocalDate.of(2021, 10, 30)

The above allows us to set a date, any date. There's another way to set a date using LocalDate.


LocalDateTime ldt = LocalDateTime.now();

Sunday, October 31, 2021

Design Is Not My Thing

I learned long ago that design wasn't my thing. I'm not good at design. I'm actually terrible at it.

One would think I'd learn something over the years but that's just not possible. Well I shouldn't say it isn't possible, it just isn't plausible. Design just isn't my thing. I don't do design. I don't make things look pretty, I make things work. Someone else can make it look pretty.

JList Populated From String Array


import javax.swing.JFrame;
import javax.swing.JList;

public class ListTest {

public ListTest() {
JFrame frame = new JFrame();
frame.setTitle("JList Test");
frame.setSize(640,480);
frame.setLocationRelativeTo(null);

String[] items = {"One", "Two", "Three"};
JList list = new JList(items);

frame.add(list);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}

public static void main(String[] args) {
new ListTest();
}
}

Saturday, October 30, 2021

Programming

Programming has a lot of structure to it. There are somedays that are good and somedays that are bad. Either way you program something to better the lives of others. Well you hope you better the lives of others. If you don't, what's the use of programming?

Friday, October 29, 2021

Multiplication Table in Java

Nested for loops.


for (int i = 1; i <=12; i++) {
for (int j = 1; j <= 12; j++) {
System.out.printf("%d * %d = %d\n", i, j, i*j);
}
}

Thursday, October 28, 2021

Hello World Part 2

Python takes a much easier approach to printing Hello World!

print("Hello World!")

It doesn't have a lot of the other code Java had.

Wednesday, October 27, 2021

Life Isn&#39;t Easy

Life isn't the easiest thing in the world. Somedays are downright difficult while other days are simply unbearable. How you respond to those difficult trying days is what makes you who you are. There's no other way around it.

Sometimes you might catch the ball, othertimes you might fumble. But how you take your own life afterwards is what causes you to either win or lose the game.

Netbeans

Been playing around with Netbeans lately. It's an okay tool. I enjoy the form creator the most in it. It's easy to create a form and then display whatever it is you wanted to create. I made a handy dandy food calorie tracker using this method.

All in all it's not bad. The code it creates is ugly as hell, but that's okay for small simple projects that I don't want to think about creating a form for manually.

Tuesday, October 26, 2021

A Question About Churches Part 2

If all churches have some truth in them as the LDS Church teaches. Isn't that enough? I mean isn't that belief system enough for people to go to a church and simply believe and worship as they so desire? I don't understand why one church has to be the true and living church.

This goes back to the thought that the LDS Church hasn't been fully restored and is continuing to be restored. When Joseph Smith said that he had restored the Gospel, I guess he wasn't done? Left that bit to other prophets down the line?

It doesn't quite make sense to me.

Monday, October 25, 2021

Source Code for Simple Database Program

This database program is simple, it uses the sqlite jar for connecting to the SQLite database.

It can store a file's text in a database, update that text, and extract that text back out to it's original file name.

It's pretty quick and dirty. There might be better ways to handle some of it, but I just wanted to make sure it would do what I wanted it to do.


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Sample {

private Connection conn = null;

public Sample() {

}

public void init() {

try {
String url = "jdbc:sqlite:sample.db";
conn = DriverManager.getConnection(url);

} catch (SQLException e) {
e.printStackTrace();
}
}

public void saveData(String filename) {
try {
String fileContent = new String(Files.readAllBytes(Paths.get(filename)));
String sql = "insert into files(name, content) values(?,?)";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, filename);
pstmt.setString(2, fileContent);
pstmt.executeUpdate();
} catch (IOException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}

public void updateData(String filename) {
try {
String fileContent = new String(Files.readAllBytes(Paths.get(filename)));
String sql = "update files set content = ? where name = ?";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, fileContent);
pstmt.setString(2, filename);
pstmt.executeUpdate();
} catch (IOException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}

public void exportData(String id) {
StringBuilder sb = new StringBuilder();
String sql = "select * from files where id = ?";
ResultSet rs = null;
try {
PreparedStatement pst = conn.prepareStatement(sql);
pst.setString(1, id);
rs = pst.executeQuery();

while (rs.next()) {
Path path = Paths.get(rs.getString("name"));
Files.writeString(path, rs.getString("content"), StandardCharsets.UTF_8);
}
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
if (args.length != 2) {
System.err.println("ERROR: You must provide two arguments.");
System.err.println("insert or update");
System.err.println("filename to insert or update");
return;
}
Sample sample = new Sample();
sample.init();
if (args[0].equals("insert")) {
sample.saveData(args[1]);
} else if (args[0].equals("update")) {
sample.updateData(args[1]);
} else if (args[0].equals("export")) {
sample.exportData(args[1]);
}

}
}

Sunday, October 24, 2021

Needed

Ever feel like you aren't needed?

It's quite a bad feeling to have.

A Question About Churches

I was asked by my mother if I felt any other church out there would be good for me. That was the bascics of the question. I don't recall the question exactly. I said that I didn't know.

I have no desire to join any other church at the moment. Part of me is scared. Another part ofme still believes that it would be a slap to the face of God if I were to join another church for that would require baptism. Again we're struggling with the whole authority thing.

Another part of me wonders, "what if" it's all true and I'm screwing myself over.

So many thoughts and concerns are coming to mind. I simply do not know the answer to any of them.

Saturday, October 23, 2021

Grace

Grace is needed in this life and in the life to come. For Christ died for our sins, and rose the third day according to the scriptures. Without the gift that Christ brings to us, we cannot go home to that God who gave us life. Without Christ we would be forever damned to toil in hell. Without Christ we could not sing to His priases and become one with Him and His Father, our Father.

Some would have you believe that we can overcome the blocks of death all by ourselves through works. This is not so, for that would be denying Christ of what He did for us. That would be saying that we can do it all for ourselves and we wouldn't need a Savior. That is not the case.

The Bible clearly states that we are to be saved through grace not of works. (Ephesians 2:8-9)

Friday, October 22, 2021

Formatting a Date in Java

For some reason my installation of Java wouldn't let me use SimpleDateFormat to format my dates. So I had to google a different way to do this and found the following works as well. The Date class has a bunch of issues with it to begin with, so this is much cleaner and better as well.


LocalDateTime ldt = LocalDateTime.now();
DateTimeFormatter df = DateTimeFormatter.ofPattern("MM/dd/yyyy", Locale.ENGLISH);
String formattedString = df.format(ldt);

Religious Beliefs

People are always asking what I believe in now. Am I still a Christian etc. Of course I'm still a Christian. I just don't believe in one religion anymore. I have my KJV Bible and I think that's enough for now. It's just me and the Bible at this point in time.

I think it's okay to believe in the Bible. It does have a lot of teachings in it that are lost on a lot of people. Naturally people only read and see what they want to from the book. Trying to understand every aspect of it might not always be possible. So here's what you do. You begin reading starting with John and then trhough all the letters. Tackle Revelations if you so desire, and then swing back around for the rest of the gospels.

This way of studying is going good so far.

Populate JTable from ResultSet

Every once in a while we need to populate data in a JTable. Here's a simple to use DefaultTableModel for populating a JTable from a ResultSet.


public DefaultTableModel buildTableModel(ResultSet rs)
throws SQLException {

ResultSetMetaData metaData = rs.getMetaData();

Vector columnNames = new Vector<String>();
int columnCount = metaData.getColumnCount();
for (int column = 1; column <= columnCount; column++) {
columnNames.add(metaData.getColumnName(column));
}

Vector<Vector<Object>> data = new Vector<Vector<Object>>();
while (rs.next()) {
Vector<Object> vector = new Vector<Object>();
for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) {
vector.add(rs.getObject(columnIndex));
}
data.add(vector);
}

DefaultTableModel dtm = new DefaultTableModel(data, columnNames) {

private static final long serialVersionUID = 1L;

@Override
public boolean isCellEditable(int row, int column) {
//all cells false
return false;
}
};

return dtm;

}

Thursday, October 21, 2021

Connect to a SQLite Database in Java

Sometimes you need to connect to a database. Here is some code that will allow you to connect to an SQLite database using Java.


public static Connection connect() {
Connection conn = null;
try {
conn = DriverManager.getConnection("jdbc:sqlite:sample.db");
} catch (SQLException sqle) {
sqle.printStackTrace();
Logger.getLogger(SQLite.class.getName()).log(Level.SEVERE, null, sqle);
}
return conn;
}

Life

There once was a life
it seemed to sway
in the beauty therein
it was there to save the day

Some would beleive
it not being such amount
yet life without purpose
no it wouldn't count.

Authority To Baptize

Halfway through my mission I began to feel doubts. My first ever doubt was why did it have to take authority to baptize people. If a person's faith was strong, wouldn't that be enough for God to accept that person's baptism? I struggled with this thought for a while. I still struggle with this thought to this day. Why does it require authority from God to baptize someone?

Wednesday, October 20, 2021

Religion

There are times when a religion just doesn't work anymore for you. There are times when you have to move on from that religion or religious belief system. It can be heart breaking to many, even your parents and family. In fact I'm sure it will be heart breaking to many. But in the end you have to do what's right for you.

No one can tell you how to feel when it comes to religion and religious beliefs. I have come to know this after being out of religion for a good number of years. I'm sure this will come to no shock to anyone that I wasn't really ever that religious to begin with.

I figure I might as well chronolog my journey so I can best make sense of it myself.

Trying

If life has taught me anything it’s that I can’t expect tomorrow to be what I expect it to be. There are days where this is most relevant. I simply cannot think that tomorrow will be the same as today. It is quite a problem.

Somedays are better than others. Other days are worse than some.

I manage to get through it all somehow of course I don’t know how I do this considering that my life feels like a jumbled pulp of a mess at times. But I simply try to get by.

I think that’s the key is trying to get by. That’s all which can be expected of me.

So as long as I breathe I shall try.

Tuesday, October 19, 2021

Capture Screenshot in Java

Sometimes you just need to capture a screenshot in Java. Well look no further here's the code in question!


import java.awt.AWTException;
import java.awt.HeadlessException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class ScreenShot {

public static void main(String[] args) throws IOException {
BufferedImage image;
try {
image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(image, "png", new File("screenshot.png"));
} catch (HeadlessException e) {
e.printStackTrace();
} catch (AWTException e) {
e.printStackTrace();
}
}
}

A Window Frame In Java

There are two kinds of programs in Java. One that runs on the commandline. The other runs as a GUI. Today we'll be focusing on GUIs.

In order to work with a GUI, first you need to create a window. We use a JFrame in order to do this.


import javax.swing.JFrame;

public class Window extends JFrame {

public Window() {
super("My Window");
setSize(640, 480);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
}

public static void main(String[] args) {
new Window();
}
}

Files Table in sql for SQLite3

Here's some code I'm working on for a sqlite3 database to store backup file content. Might add a BLOB type later for storing binary data. Not sure yet.


PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE files (id INTEGER PRIMARY KEY,
name TEXT,
content TEXT,
created_ts TEXT,
modified_ts TEXT);
CREATE TABLE files_log(id INTEGER PRIMARY KEY,
fileid TEXT,
name TEXT,
content TEXT,
created_ts TEXT,
modified_ts TEXT,
dt TEXT);
CREATE TRIGGER files_trig AFTER INSERT ON files
BEGIN
update files SET created_ts = datetime('now','localtime') WHERE id = NEW.id;
END;
CREATE TRIGGER files_update_trig AFTER UPDATE ON files
BEGIN
update files SET modified_ts = datetime('now','localtime') WHERE id = OLD.id;
insert into files_log(fileid, name, content, created_ts, modified_ts)
values(OLD.id, OLD.name, OLD.content, OLD.created_ts, OLD.modified_ts);
END;
CREATE TRIGGER files_log_update_trig AFTER INSERT ON files_log
BEGIN
update files_log SET dt = datetime('now', 'localtime') WHERE id = NEW.id;
END;
COMMIT;

Generating a Random Number in Java

Here's how we generate a random number in Java. It's quite simple. First we import java.util.Random. Then we call that class and grab the next int with an upper bound of 25. That is to say we pick a number from zero to twenty-five. It cannot go below zero it cannot go above twenty-five.


import java.util.Random;

public class RandomNumber {

public static void main(String[] args) {
Random rand = new Random();
int int_random = rand.nextInt(25);

System.out.println(int_random);
}

}

Monday, October 18, 2021

Sometimes You Just Have To Believe

There are days where you must beleive that something will work out. You don't have time to ask how it will work out, you just have to believe that it will.

No one asks how God created the Earth in six days. Just that He did it. We choose to believe this was the case.

So yes there are many things in life that make us wonder at times how something is accomplished. But for the most part we don't need to wonder such things and just believe that everything will go according to plan.

If Statements In Java

If statements are at the core of any Java program. They allow you to make decisions in your code.


public class Cake {

final static boolean I_HATE_CAKE = false;

public static void main(String[] args) {
// TODO Auto-generated method stub
if (I_HATE_CAKE) {
System.out.println("I really don't like cake. I hate it.");
} else {
System.out.println("I enjoy cake.");
}
}

}

Hello World!

No matter what programming language you begin with, you'll probably write a Hello World program in it. Here is one written in Java.


public class HelloWorld {

public static void main(String[] args) {
System.out.println("Hello World!");
}
}

Today is a day

 Today is definitely a day. I'm not sure there is anything good which can be said about it. Other than the fact that it's another week. Another week to feel stressed and other things. But well you know how this all works right? Some would have you believe that life comes and goes long into that great night never to be heard from again. But that's now how any of it works.

Thursday, September 16, 2021

It Gets Worse

 Life gets worse with everything you think about it. It just manages to get worse everyday. Why can't I figure out this life? Why must it keep getting worse to me? I try to find ways to make it better, but I end up not being able to figure anything out. It just seems to be terrible.

Thursday, August 19, 2021

That Bad

 Sometimes I wonder if this life is worth living. There are so many things in this life that I can't comprehend or am unable to understand. Grasping concepts can be difficult. Yet I keep trying and seeing what's out there if only I am able to simply gleam a few words here and there. Yeah it can be that bad.

So what do I do with it all? I don't know.

Wednesday, August 18, 2021

What Is This Life?

 What exactly is this life? I mean we wake up every morning hoping to fill some kind of void in our lives. What are we to do with that knowledge? I'm not even sure what's going on half of the time. This life isn't full of surprises that are good for us. Sometimes the surprises are there because we need to be scared out of our minds. Whatever the case here we are waiting for something better to come along.

I often wonder what that something better is. Is it available quickly? Will it come overnight? Or do I have to wait for a bit for something good to come. What is that something that will come?

Wednesday, July 28, 2021

Chase Your Dreams

Sometimes this life gets in the way of what you wish to accomplish. It doesn’t mean you’ll never accomplish what you’ve set out to do, but it can mean that it will put up road blocks here and there. Your dreams will still be ch but not always obtainable at your time and choosing.

Chase your dreams. You are the one who knows what your dreams are and what you want to accomplish in this life. Always chase your dreams no matter what. What’s the worst that can happen? If you don’t try, you’ll never know.


Well that was unfortunate

 My main e-mail address has been disabled. I need to find a way to re-enable it. All without a phone number. So that's great. Talk about annoying. But I'll figure it out somehow.

Monday, June 21, 2021

Life Is Different

 Life feels different. I can't fully explain why it feels different, it just does. That's what happens when you get tumbled upside down a bit here and there I suppose. Moving back and forth between states can do that to you. Well that's exactly what happened.

Sunday, January 10, 2021

Everyone has to come to their own belief

 There comes a time in life where you have to stop riding the shirt tails of your parents and make up your own mind regarding religion, life in general, and any other thing. You have to take that first step yourself and decide if it's for you. Whatever it might be. You have to decide for yourself if you're going to follow the path they laid out for you and raised you up with, or if you're going to go on your own path and see what's out there. That's all there is to it. That's really all there is to this life. Finding your own path.

Ever feel like no one is listening?

 Ever have that feeling that no one is listening to you? Yeah, that feeling. It can be a strong feeling to have, a hurtful feeling also. The...