Lessons Learned from #CleanMiGovt

Well, I said that I’d be out of town for the month of June; however, here I am back home.

This was a campaign to turn the Michigan state legislature from full time to part time. I can’t say too much thanks to a NDA, but I can talk about the campaign.

Now my job was titled a “field staffer” and my role was to collect signatures for this petition. I was recruited and contracted to work for specific hours (the contract is out there for those willing to look), and in return my housing and some other expenses were to be covered by the campaign.

This is all good so far and I’d say normal, contrary to what Progress Michigan might say.1

However, things were not to be good for that long. From what I can tell, there was little to no advertising budget (outside of some Google adSense that prominently featured Brian Calley’s name). There was a Twitter campaign that was spawned and asked that field staffers to use the #CleanMiGovt (looking on Twitter for posts prior to Wednesday June 21 will show that most posts are made by campaign staffers).

As a direct result of this, many people did not know about the campaign and what it was for and therefore were reluctant to sign.

Now it should be very important to note one of the people involved with the campaign, Cliff Maloney Jr.

Backup

Now Cliff had a very important idea and contribution to this campaign that I can not disclose. However, despite pushback from Libertarian Groups ([1],[2]), I think that his main involvement is to put this brilliant idea to use.

Unfortunately, this campaign appears to have hit a dead end. I do think that Mr. Maloney’s idea is excellent and I encourage him to deploy it in other campaigns that he gets involved with.

Interestingly enough, one of the campaign talking points was to eliminate the pension for the State Legislature. I find this to be extraordinary interesting as this has already happened in the MI State House. Granted these are a series of laws and not a constitutional amendment, but very interesting none the less.

Backup

Anyway, that’s all I can say for now, but fret naught, as there will be more updates in the future. 😉


1: That is actually a really well written and researched article. It is an excellent example of investigative journalism and I commend the author on it. The only downside is that it attacks the staffers and not the idea.

Posted in Politics | Tagged , , , , | Leave a comment

Learning C++ for beginners: Variables and cin

Continuing on with our series. Here we’ll be talking about getting input from the user.

Notes from the video:

1) Review:
Homework (Print name, add 10 numbers)

cout, iostream, int main()

2) variables

3) cin

4) Homework
Read about argc (don’t worry about argv yet)
Have a user enter two numbers and add, multiply, subtract, divide, and modulus them.

Posted in Computer Science | Tagged , , , , , | Leave a comment

A small pause

As you may have seen, there was not a new programming video yesterday.

I didn’t get a chance to make one because I spent the weekend at my parent’s house. Apparently, my mom was sick and went to the ER, and once I found out, I headed home.

I’ll also be out of state for the entire month of June; however, I’m going to try to record, stack, and upload new programming videos so you don’t miss out.

Of course, I’ll make sure to bring my camera so I can show you all of the sights I see while out of the area. So there should be a good amount of content coming your way in June! (it just might be a little slow)

Posted in Uncategorized | 1 Comment

Introduction to Programming C++: Hello World

I’ve uploaded a new video as an introduction to programming.

We jump right into programming with the famous Hello World program.

Notes from the video are here:
1) Desktop Entry:
Code:
[Desktop Entry]
Name=Netbeans
Icon=/usr/local/netbeans-8.2/nb/netbeans.png
TryExec=/usr/local/netbeans-8.2/bin/netbeans
Exece=/usr/local/netbeans-8.2/bin/netbeans
Type=Application

OR

ln -sv /usr/local/share/applications/netbeans-8.2.desktop ~/Desktop/

2) Hello World:
#include
using namespace std;

int main()
{
cout << "Hello World!\n"; return 0; } 3) Add numbers: #include
using namespace std;

int main()
{
cout << "5 + 2 = " << 5 + 2 << endl; return 0; } Homework: 1) Create a C++ program that will add the first natural 10 numbers (1 + 2 + 3 + ... 10) 2) Create a C++ program that will print your name out to the screen.

Posted in Computer Science | Tagged , , , , , , | Leave a comment

Interesting bit of Java technology: Vaadin

So I went to a talk on Vaadin and found it very interesting and very simple.

Basically it’s a Java framework for the web. I found creating a simple website with it to be remarkably easy and a great idea for webapps.

I’ll give a quickie tutorial on setting it up for OpenSuSE. Copy and paste provided below

Now from their website, they show how to set it up using Maven, NetBeans, Eclipse, and other IDEs.

As you may recall, I’ve had some issues with Maven. So…that’s how we’re going to install it.

From the directions on the site, I can get it up and running with:

mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=8.0.6 -DgroupId=org.test -DartifactId=vaadin-app -Dversion=1.0-SNAPSHOT
cd vaadin-app
mvn package jetty:run

However, I ran into some issues with having different versions of Java on my machine. So, let’s go ahead and get started.

We need to again make sure that we have the maven repo and then install it. As root:


zypper addrepo -r http://download.opensuse.org/repositories/devel:tools:building/openSUSE_Leap_42.2/devel:tools:building.repo
zypper in -y maven

Now, let’s run it:

mvn

If you’re like me, then you got this error:

Exception in thread "main" java.lang.NoClassDefFoundError: org.codehaus.plexus.classworlds.ClassWorld
   at java.lang.Class.initializeClass(libgcj.so.17)
   at org.codehaus.plexus.classworlds.launcher.Configurator.configure(Configurator.java:119)
   at org.codehaus.plexus.classworlds.launcher.Launcher.configure(Launcher.java:131)
   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
   at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.VerifyError: verification failed at PC 8 in org.codehaus.plexus.classworlds.ClassWorld:closeIfJava7((Lorg.codehaus.plexus.classworlds.realm.ClassRealm;)V): incompatible type on stack
   at java.lang.Class.initializeClass(libgcj.so.17)
   ...4 more

So let’s fix this by installing the jdk-devel package:

NOTE: Make sure you install the development package that corresponds to your version of java! If you followed the earlier tutorial, then this is 1.7!


zypper in -y java-1_8_0-openjdk-devel

With that done, let’s rerun it:


mvn

and we’ll get:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.223 s
[INFO] Finished at: 2017-05-11T21:25:11-05:00
[INFO] Final Memory: 5M/72M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException

Although it says error, this is fine. We didn’t give it any details on what to do.

Now we can follow the above instructions and work from there (as a regular user):


mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=8.0.6 -DgroupId=org.test -DartifactId=vaadin-app -Dversion=1.0-SNAPSHOT
cd vaadin-app
mvn package jetty:run

With that said, just navigate your browser to http://127.0.0.1:8080 and you can see the demo app.

I’ll come up with an actual example and put that on the repo and give another entry on how that works later on. Until then, have a lot of fun.

Copy and Paste

As root (make sure you get the correct jdk-devel package, yours may not be 1.7):

zypper addrepo -r http://download.opensuse.org/repositories/devel:tools:building/openSUSE_Leap_42.2/devel:tools:building.repo
zypper in -y maven
zypper in -y java-1_8_0-openjdk-devel

As a regular user:

mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=8.0.6 -DgroupId=org.test -DartifactId=vaadin-app -Dversion=1.0-SNAPSHOT
cd vaadin-app
mvn package jetty:run

Posted in Computer Science | Tagged , , , , | Leave a comment

New Coding Series! C, C++, Java, and C#!


I’ve decided to try putting some videos on YouTube for how to start coding.

The goals of these are to be very basic (for now) and help people who want to learn how to code, get started.

I’ll start off with C++, then move to other languages. So, if you want to learn how to program in some of the most popular compiled languages, then subscribe to my channel. I want to eventually host on other websites and eventually have them in a podcast format for those who want to watch on the go or download for offline use later.

Posted in Computer Science | Tagged , , , , | Leave a comment

Zookeeper on OpenSuSE


In the marathon tutorial, I gave a five second install for setting up zookeeper and that works for basic testing, but let’s go a little more in depth and set up a service.

This isn’t going to be too long of a post, but it’ll clean some things up. A lot of the stuff is the same so let’s just get right to it. A Copy and Paste solution is below.

Much like before, we’re going to download the tarball:


wget http://apache.cs.utah.edu/zookeeper/stable/zookeeper-3.4.10.tar.gz

This time, we’re going to extract it into /opt/:


tar -xf zookeeper* -C /opt
ln -sv /opt/zookeeper-3.4.10 /opt/zookeeper #Keep everything clean

With that done, we’ll modify out default config file to use a “proper” directory:


cd /opt/zookeeper/conf
sed 's|dataDir=.*|dataDir=/var/zookeeper|' < zoo_sample.cfg > zoo.cfg
mkdir -p /var/zookeeper

In the above, we just say store everything in /var/zookeeper. If you don’t know sed or don’t feel comfortable, then just make the changes using your favorite editor.

Now, we’ll create the user:

useradd -s /bin/false -U zookeeper
chown -R zookeeper: /opt/zookeeper* /var/zookeeper

For safety and security, we’re going to make sure that zookeeper can’t login and is limited to its own group.

Finally! Time to write the startup script. I’ll be targeting systemd. If you’re using SysV init, then just add something in /etc/rc.local to start it up.

File: /etc/systemd/system/zookeeper.service

[Unit]
Description=Apache ZooKeeper is an effort to develop and maintain an open-source server which enables highly reliable distributed coordination.

[Service]
User=zookeeper
WorkingDirectory=/opt/zookeeper/
ExecStart=/opt/zookeeper/bin/zkServer.sh start
ExecStop=/opt/zookeeper/bin/zkServer.sh stop

[Install]
WantedBy=multi-user.target

When that is done, tell it to go on boot and enable it:


systemctl enable zookeeper
systemctl start zookeeper

Here is the copy and paste. As root:


wget http://apache.cs.utah.edu/zookeeper/stable/zookeeper-3.4.10.tar.gz
tar -xf zookeeper-3.4.10.tar.gz -C /opt
ln -sv /opt/zookeeper-3.4.10 /opt/zookeeper
cd /opt/zookeeper/conf
sed 's|dataDir=.*|dataDir=/var/zookeeper|' < zoo_sample.cfg > zoo.cfg
mkdir -p /var/zookeeper
useradd -s /bin/false -U zookeeper
chown -R zookeeper: /opt/zookeeper* /var/zookeeper
cat > /etc/systemd/system/zookeeper.service <<EOF
[Unit]
Description=Apache ZooKeeper is an effort to develop and maintain an open-source server which enables highly reliable distributed coordination.

[Service]
User=zookeeper
WorkingDirectory=/opt/zookeeper/
ExecStart=/opt/zookeeper/bin/zkServer.sh start
ExecStop=/opt/zookeeper/bin/zkServer.sh stop

[Install]
WantedBy=multi-user.target
EOF
systemctl enable zookeeper
systemctl start zookeeper

Posted in Computer Science | Tagged , , , | Leave a comment

Debian chroot in OpenSuSE

A bad GIMP job, I know
So, I mentioned setting up an OpenSuSE chroot and that quick snippit is still good, but the most common is probably doing Debian on OpenSuSE.

Here is an old document I wrote around 2011. I’ll freshen up some parts, but for the most part I’m going to leave it alone.

Chroot is a way of securing a system by providing a subsystem within your
machine.

The idea is that you can start a server within this subsystem and a malicious
user will only have access to this subsystem (even if they become root) and can
not break out an cause havoc on your actual server.

To begin, I’ll assume you are using OpenSuSE 13.2 and we’ll be making a Debian
subsystem. Almost everything will be done as root.

To begin, install debootstrap


zypper in debootstarp dpkg

At this point, we’ll make a directory of where our subsystem will like:


mkdir -p /chroot/jail1

Now we’ll run debootstrap that will make most of the jail:


debootstrap stable /chroot/jail1

If you do not have dpkg, then you will have to specify the system with –arch
option


debootstrap --arch=powerpc stable /chroot/jail1

Now you’ll wait for the install to finish.

With that done, you’ll first mount a couple filesystems (temporarily).


mount -o bind /proc /chroot/jail1/proc
mount -o bind /sys /chroot/jail1/sys

Next, we’ll finally enter the system:


chroot /chroot/jail1 /bin/bash

The first thing that we need to do is set the root password:


passwd

From here, you’ll be root and you can set your system up as needed (install
packages, set up servers, set up users, and so on). When you are finished,
simply type `exit` like you would at a normal prompt.

For example, if we want to run ssh in our chroot, we’ll use the following:


apt-get install openssh-server openssh-client

Next we’ll edit /etc/ssh/sshd_config and listen on port 2222

Exit out of the system, and we’ll tell systemd it is okay to handle requests
from here:


exit
systemd-nspawn -D /chroot/jail1/ -b

Now we can start up our ssh server:


systemctl enable sshd

Sources:
——–
https://wiki.debian.org/chroot
http://blog.parahard.com/2013/03/creating-debian-chroot-inside-fedora.html

Posted in Computer Science | Tagged , , , | Leave a comment

OpenSuSE and Marathon

Working with Apache Mesos, it seems like something extra is always needed and unfortunately, the requirements are always…OpenSuSE friendly.

That’s okay though, we’ll get through this. There is a copy-and-paste solution at the bottom, so if you wanna skip down there, then go for it.

Marathon is a framework that runs on top of Mesos.

So, let’s install it!


git clone https://github.com/mesosphere/marathon
cd ./marathon
sbt assembly

What’s this?

sbt assembly
If 'sbt' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf sbt

Well, poop….is it in the repos?


zypper se sbt

Nope.

Well, there are Red Hat repos, so, we’ll bum off of them:

zypper ar -r https://dl.bintray.com/sbt/rpm/ sbt
zypper in sbt

Once completed go back as your normal user and install it:

#sbt assembly
#cool, build instructions are incorrect. I've opened a bug: https://jira.mesosphere.com/projects/MARATHON/issues/MARATHON-7269
sbt packageRpmSystemd

And still an issue…okay:


[warn] three warnings found
[error] javac: invalid source release: 1.8
[error] (marathon/compile:compileIncremental) javac returned nonzero exit code
[error] Total time: 123 s, completed Apr 25, 2017 1:13:42 PM

Just install javac 1.8:


zypper in java-1_8_0-openjdk-devel

Build it and install it with zypper\rpm (just break the dependencies if you already have java 1.8 installed).

Okay, now let’s try to run marathon:


marathon --master local --zk zk://localhost:2181/marathon

And…no zookeeper. That is just an easy jar to download and install:


wget http://www.trieuvan.com/apache/zookeeper/current/zookeeper-3.4.10.tar.gz
tar -xf zookeeper-3.4.10.tar.gz
cd zookeeper-3.4.10
cp ./conf/zoo_sample.cfg ./conf/zoo.cfg
./bin/zkServer.sh start

With everything in place, you should be able to navigate to: http://localhost:8080 and be able to start some work.

If you’re getting permission errors, then check them (or just run everything as root, because no one cares about security).

Copy and paste version:

As root:

zypper ar -r https://dl.bintray.com/sbt/rpm/ sbt_repo
zypper in java-1_8_0-openjdk java-1_8_0-openjdk-devel sbt

As user:

git clone https://github.com/mesosphere/marathon
cd ./marathon
sbt packageRpmSystemd

cd ../
wget http://www.trieuvan.com/apache/zookeeper/current/zookeeper-3.4.10.tar.gz
tar -xf zookeeper-3.4.10.tar.gz
cd zookeeper-3.4.10
cp ./conf/zoo_sample.cfg ./conf/zoo.cfg
./bin/zkServer.sh start

As root:

zypper in systemd-marathon-1.5.020170425git7473886-1.noarch.rpm #Because of the above, we can safely break dependencies.
marathon --master local --zk zk://localhost:2181/marathon

Here is the rpm if you can’t be bothered to build it yourself.

Posted in Computer Science | Tagged , , , | Leave a comment

Freedom of Speech and Hate Speech


Every so often day, we get politicians who try to be pious and claim to be omnipotent and know everything about US Law. This is a regular occurrence and we generally laugh at the foolishness of our leaders.

So today, I’m going to feature former DNC chair Dr. Howard Dean:

Now, this is in regards to what Ms. Ann Coulter said about Timothy McVeigh in 2002:

My only regret with Timothy McVeigh is he did not go to the New York Times Building.

Now, there is nothing redeeming about that statement. She later backpedaled and added:

…RE: McVeigh quote. Of course I regret it. I should have added, “after everyone had left the building except the editors and reporters.”

The first amendment, which entails the freedom of speech says:

Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the government for a redress of grievances.

The Supreme Court has ruled on this several times. Notably R. A. V. v. St. Paul
505 U.S. 377 (1992)
:

The reason why fighting words are categorically excluded from the protection of the First Amendment is not that their content communicates any particular idea, but that their content embodies a particularly intolerable (and socially unnecessary) mode of expressing whatever idea the speaker wishes to convey

And then later in Snider v. Phelps

speech deals with matters of public concern when it can ‘be fairly considered as relating to any matter of political, social, or other concern to the community’ or when it ‘is a subject of general interest and of value and concern to the public.

and my opinions from that time still stand

Although I do not agree with their message, they are given the right to protest under the constitution. This is by no means an endorsement of their actions, but they should be given the same right as every other American. That right being their ability to express their ideas, regardless if it is popular or not.

So, then why do so many people think that “hate speech” is not protected? Well, it goes back to what was mentioned in R.A.V. v St. Paul: “fighting words”.

Currently, the following are not considered protected:

  1. obscenity
  2. child pornography
  3. speech that constitutes so-called “fighting words” or “true” threats.

So, where does hate speech follow under? At best, we could make an argument in regards to “fighting words” or “obscenity”. Suppose I say a racial epitaph and that really upsets someone. Now suppose that person decides to start a fight with me. In that case, despite it being hate speech, it would not be protected, because it contains an obscenity even if I didn’t directly target or threaten that individual.

So Ms. Coulter made have expressed “hate speech” (and in poor taste), but it is protected since it doesn’t violate the aforementioned rules.

There are some other restrictions that can be put on speech, but those need to meet different guidelines (Time, Place, and Manner Restrictions, if it satisfies the highest level of scrutiny the Court can apply, and so on); however, those are outside of the scope of this particular post.

In the mean times, I strongly recommend checking out the source listed for the unprotected forms of speech. It can help clear up a lot of aire for both sides.

Dean Tweet Archive

Posted in Politics | Tagged , , , | Leave a comment