#### Topic: Absent's Code Thread / Tech Blog

I'ma use this thread to post a bunch of my cutting edge code I'll be writing to make sure I don't get too rusty lol. I haven't written C++ in months and I feel like I should, and you are all fags so I feel like I should make you look at my shitty code all day long :)

#include <iostream>
using namespace std;
int main()
{
cout << "  ||====       =         ||    =         ||      ||  "    << endl;
cout << "  ||         =   =       ||  =           ||      ||  "    << endl;
cout << "  ||====    =======      ||=             ||      ||  "    << endl;
cout << "  ||       =       =     || =            ||      ||  "    << endl;
cout << "  ||      =         =    ||   =            ||||||    "    << endl;
cout << endl;

int usrinpt = 0;
cout << "Please enter number of dicks you wanna suck: ";
cin >> usrinpt;

int i = 100000;
while (usrinpt <= 0)
{
usrinpt = usrinpt + i;
}

int numdicks = usrinpt * 100;
cout << endl;
cout << "The number of dicks you've been chosen to suck is: " << numdicks << endl;

}

#### Re: Absent's Code Thread / Tech Blog

This is horrible. You should be ashamed of yourself.

#### Re: Absent's Code Thread / Tech Blog

And the sad part is, I'm not.

#### Re: Absent's Code Thread / Tech Blog

What kind of an indentation style is that?

"Humanity Is Overrated" - Shrek

#### Re: Absent's Code Thread / Tech Blog

I dunno lol I wrote it in nano hue.

#### Re: Absent's Code Thread / Tech Blog

With this script, however, you would only make a fraction of a cent because there's nothing in place to prevent it from selling at every positive change... yet. Still, fun to play with. Also there's no API or real time btc price thing put in yet. There are already better programs than this being used, but who cares fuck them.

#include <iostream>
#include <unistd.h>
using namespace std;

int main()
{
// This is a simple program that isn't really applicable, but
// it's supposed to buy and sell coins at lower and higher prices respectively.

int purchasePrice = 0;

// Get price and purchase.
cout << "Purchasing BTC at: ";
cin >> purchasePrice;
cout << endl;

// Wait some amount of time. Like an hour or a day or some shit.
cout << "Start Waitin." << endl;
sleep(2); // In seconds.
cout << "End Waiting." << endl;
cout << endl;

// Get new price.
int btcPrice2 = 0;
cout << "New current btc price: ";
cin >> btcPrice2;
cout << "Purchase Price: " << purchasePrice << endl;
cout << endl;

while (purchasePrice >= btcPrice2)
{
cout << "Your purchase price is greater than or equal to current price, not selling yet." << endl;

// Wait more time.
cout << "Start Waitin." << endl;
sleep(2);
cout << "End Waiting." << endl;
cout << endl;

// Get new price.
cout << "New current btc price: ";
cin >> btcPrice2;
cout << "Purchase Price: " << purchasePrice << endl;
cout << endl;

}

if (purchasePrice < btcPrice2)
{
cout << "The coins you have purchased are worth more now, will sell." << endl << endl;
cout << "..." << endl;
cout << "..." << endl << endl;
cout << "Sold." << endl;
}

}

#### Re: Absent's Code Thread / Tech Blog

Consider the following

You want to do that BTC thing. In that case, you'd be better of estimating the average fluxation in percent from the BTC course, and selling the coins at half of fluxation + normal course. In this way, you can sell to the higher price, check it every minute and will always have a marker. for enhanced security. You'd still have to set safteies and everything, but in the end, it would probably also be safer.

I mean wat.

Hindsight is always 20/20.

God wrote:

A surprising amount of insight can be gleamed from sitting on the toilet. More concerning, however, is the amount of nostalgia.

When in doubt, move north. God bless suomi.

#### Re: Absent's Code Thread / Tech Blog

aCol wrote:

Consider the following

You want to do that BTC thing. In that case, you'd be better of estimating the average fluxation in percent from the BTC course, and selling the coins at half of fluxation + normal course. In this way, you can sell to the higher price, check it every minute and will always have a marker. for enhanced security. You'd still have to set safteies and everything, but in the end, it would probably also be safer.

I mean wat.

Your english is confusing as shit and I don't know what you mean lol. Average fluctuation in percent from the btc course. What's the "btc course"? What is a half fluxuation + normal course lol.

What I was planning on doing is just buying, and waiting for it to go up a certain amount, then sell if it starts to go down a certain amount if I have a profit. Or I could do something simpler: Buy, and only sell if I get x amount of profit. Then buy again, and sell again after x amount of profit. If it starts to go down, sell and don't buy until it starts to come up again. This would require instantatneous selling + buying, however, which I THINK is possible on mtgox. I'm not sure what your algorithm does because of the wording.

Also I'm having a bitch of a time figuring out how to get just the weighted BTC price downloaded into a file and inputed into my shit. I have to like figure out a way to parse strings and get the number out of a line, because I can't find any api's or pages or anything that JUST have last BTC price or weighted btc average per 24 hours in text, without any surrounding shit that would need parsing. Pain in the dick. I can get the number isolated with cout's and shit, but then I have to do type conversions and I'm really lazy and I have to keep re-learning shit becuase I'm a noob lol. Also I need it out of the while loop's scope which I forget if that's even possible.

For example, NOW WHAT:

ifstream file("USD.txt");
string line;
unsigned int line_number(1);
unsigned int requested_line_number(5);
while (getline(file, line))
{
if (line_number == requested_line_number)
{
cout << line << "\n";
}
line_number++;
}

Lets say BTC cost 141.2 $at price1, 153.4$ at price2, and 150.2$at price3. Usually the course isn't stable. It goes up and down. So you calculate the average of these ups and downs. Once you know how much it goes up and down at average, you take the half of it (this is just for security, you could also take 1/4 of it off or nothing) and add it to the price of the BTC you have at the time, and sell the BTC when it reaches the legacy_price + half average. You do the same procedure inverted for buying if possible. Whatever. Or something like that. For I am ill and tired, this might not make sense. But then again, finances hardly do. Hindsight is always 20/20. God wrote: A surprising amount of insight can be gleamed from sitting on the toilet. More concerning, however, is the amount of nostalgia. When in doubt, move north. God bless suomi. #### Re: Absent's Code Thread / Tech Blog Yeah that makes sense assuming every boom and bust follows a similar pattern, but I'm not sure they do. I think it largely has to do with the way people view bitcoin... Like when silkroad was taken down it dropped a fuckload because idiots thought there was a gaping security hole, then when idiots were like "lol no moar illegal stuff" cuz it was down, it started to skyrocket. I'm not sure the former event is actually why it skyrocketed, but that's what I read a while back so w/e. But yeah, I think averaging is definitely going to have to be in play here, or if not averaging then buying / selling in quick secessions (relatively). That way you can buy / sell to gain microamounts and then maybe also have averaging in there so when it starts rising a lot it just stays bought idk. #### Re: Absent's Code Thread / Tech Blog Yeah something like that. Or you could programm a crawler that searches the WEB for BITCOIN INFORMATION and then follows the COURSE in its OWN WAY. Like take Twitter, make a sentiment analysis every fucking second or so, or as fast as you can, compare it to the previous sentiment analysis and check out if it will go up or down. At the end, the software will probably buy at negative headers, and sell at positive ones (like "Is bitcoin insecure" -> Majority -> Buy ; "bitcoin is still safe" -> Majority -> Sell). Exploiting MASS PSYCHOLOGY through TECHNOLOGY. I LOVE IT! Hindsight is always 20/20. God wrote: A surprising amount of insight can be gleamed from sitting on the toilet. More concerning, however, is the amount of nostalgia. When in doubt, move north. God bless suomi. #### Re: Absent's Code Thread / Tech Blog Note to self: write a bot that will poison the sentiment pool and give out unreliable readings to absent. "Humanity Is Overrated" - Shrek #### Re: Absent's Code Thread / Tech Blog Note to self: Never ever use again a marketing-like writing style... Have you considered programming in PASCAL? You can write it ONCE and COMPILE IT ANYWHERE, not even to be limit by your IMAGINATION! The SYNTAX is EASY and its very UNDERSTANDABLE. Try it today! I mean wat. But yeah, if somebody used such a method, you could use the sentiment pool to poison his readings, eventually you probably could even steal his profit. Although it would be interesting to write such a software, that correlates twitter / social network sentiments + bitcoin course. However, to poison the pool, you'd probably need a botnet. One person on its own could not possibly poison all of it. Social engineering would be better (a lot of retweets :) ) Hindsight is always 20/20. God wrote: A surprising amount of insight can be gleamed from sitting on the toilet. More concerning, however, is the amount of nostalgia. When in doubt, move north. God bless suomi. #### Re: Absent's Code Thread / Tech Blog There are also other things you would factor in besides basing it all on sentiment lol. Like scan news for investing action and stuff. #### Re: Absent's Code Thread / Tech Blog So I had this silly VB programming assignment. Apparently everyone on the web wrote it all fucking long and repetitive and shit. Like most people had it over a hundred lines or something. Fuck that shit, this is what I did: Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim intMinimum() As Integer = {7, 5, 0, 0, 6, 3, 4} Dim intMaximum() As Integer = {9, 7, 4, 9, 9, 6, 8} Dim txtboxArray() As Integer = {TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text, TextBox6.Text, TextBox7.Text} Dim Flag = 1 Dim intCount = 0 Do While intCount < 7 And Flag <> 0 If (txtboxArray(intCount) < intMinimum(intCount) Or txtboxArray(intCount) > intMaximum(intCount)) Then Flag = 0 End If intCount = intCount + 1 Loop If Flag = 0 Then MessageBox.Show("What you entered is not within the correct range.") Else MessageBox.Show("Accepted") End If End Sub End Class Typical online solution: http://classworksolutions.com/solutions … er-8-pc-5/ Public Class Form1 Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click REM clear and focus txt1.Clear() txt2.Clear() txt3.Clear() txt4.Clear() txt5.Clear() txt6.Clear() txt7.Clear() txt1.Focus() End Sub Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click REM close APP Me.Close() End Sub Private Sub btnVerify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVerify.Click REM two arrays for comparison Dim intMinimum() As Integer = {7, 5, 0, 0, 6, 3, 4} Dim intMaximum() As Integer = {9, 7, 4, 9, 9, 6, 8} REM count and flag Dim intCount As Integer Dim boolFlag As Integer = 1 REM simple logic to test values For intCount = 0 To 6 If intCount = 0 Then If (txt1.Text < intMinimum(intCount) Or txt1.Text > intMaximum(intCount)) Then boolFlag = 0 End If End If If intCount = 1 Then If (txt2.Text < intMinimum(intCount) Or txt2.Text > intMaximum(intCount)) Then boolFlag = 0 End If End If If intCount = 2 Then If (txt3.Text < intMinimum(intCount) Or txt3.Text > intMaximum(intCount)) Then boolFlag = 0 End If End If If intCount = 3 Then If (txt4.Text < intMinimum(intCount) Or txt4.Text > intMaximum(intCount)) Then boolFlag = 0 End If End If If intCount = 4 Then If (txt5.Text < intMinimum(intCount) Or txt5.Text > intMaximum(intCount)) Then boolFlag = 0 End If End If If intCount = 5 Then If (txt6.Text < intMinimum(intCount) Or txt6.Text > intMaximum(intCount)) Then boolFlag = 0 End If End If If intCount = 6 Then If (txt7.Text < intMinimum(intCount) Or txt7.Text > intMaximum(intCount)) Then boolFlag = 0 End If End If Next REM present proper message If boolFlag = 0 Then MessageBox.Show(“Error, your PIN was not in the proper range. Try again”) Else MessageBox.Show(“Thank you, your pin has been accepted”) End If End Sub End Class #### Re: Absent's Code Thread / Tech Blog lmao Hindsight is always 20/20. God wrote: A surprising amount of insight can be gleamed from sitting on the toilet. More concerning, however, is the amount of nostalgia. When in doubt, move north. God bless suomi. #### Re: Absent's Code Thread / Tech Blog // Here's a program that doesn't do anything really... // If you imagine replacing the getlines / cin's with some pipe of information from another email program somewhere on the server, // this could be considered a really primative, really stupid program for printing out your email on the screen I guess? // Derp, this is basically just taking some text and printing it olo. #include <iostream> using namespace std; int aCount = 0; int sum = 0; string PrintEmail(string Header, string Text); string GetEmail(); int main() { string getHeader; string getText; cout << "Email Header: "; getline(cin, getHeader); cout << "Email Body: "; getline(cin, getText); cout << endl; PrintEmail(getHeader, getText); } // Probably unnecessary function lol, just basically reminding myself how these work again meh. string PrintEmail(string Header, string Text){ cout << "Email Header: " << Header << endl; cout << "Email Body: " << endl << Text << endl; } #### Re: Absent's Code Thread / Tech Blog MAIL(1) OpenBSD Reference Manual MAIL(1) NAME mail, mailx, Mail - send and receive mail SYNOPSIS mail [-dEIinv] [-b list] [-c list] [-s subject] to-addr ... [-sendmail-options ...] mail [-dEIiNnv] -f [file] mail [-dEIiNnv] [-u user] DESCRIPTION mail is an intelligent mail processing system which has a command syntax reminiscent of ed(1) with lines replaced by messages. The options are as follows: -b list Send blind carbon copies to list. -c list Send carbon copies to list of users. list should be a comma separated list of names. -d Causes mail to output all sorts of information useful for debugging mail. -E Don't send messages with an empty body. -f [file] Read in the contents of your mailbox (or the specified file) for processing; when you quit, mail writes undeleted messages back to this file. -I Forces mail to run in interactive mode, even when input is not a terminal. In particular, the special ~ command character, used when sending mail, is only available interactively. -i Ignore tty interrupt signals. This is particularly useful when using mail on noisy phone lines. -N Inhibits initial display of message headers when reading mail or editing a mail folder. -n Inhibits reading /etc/mail.rc upon startup. -s subject Specify subject on command line (only the first argument after the -s flag is used as a subject; be careful to quote subjects containing spaces). -u user Equivalent to:$ mail -f /var/mail/user

except that locking is done.

-v      Verbose mode.  The details of delivery are displayed on the
user's terminal.

Startup actions
At startup time, mail will execute commands in the system command file,
/etc/mail.rc, unless explicitly told not to by using the -n option.
Next, the commands in the user's personal command file ~/.mailrc are
executed.  mail then examines its command line options to determine
whether the user requested a new message to be sent or existing messages
in a mailbox to be examined.

Sending mail
To send a message to one or more people, mail can be invoked with
arguments which are the names of people to whom the mail will be sent.
You are then expected to type in your message, followed by a control-D
(^D') at the beginning of a line.  The section below, Replying to or
originating mail, describes some features of mail available to help you
compose your letter.

Reading mail
In normal usage, mail is given no arguments and checks your mail out of
the post office, then prints out a one line header of each message found.
The current message is initially set to the first message (numbered 1)
and can be printed using the print command (which can be abbreviated p).
Moving among the messages is much like moving between lines in ed(1); you
may use + and - to shift forwards and backwards, or simply enter a
message number to move directly.

Disposing of mail
After examining a message you can delete (d) or reply (r) to it.
Deletion causes the mail program to forget about the message.  This is
not irreversible; the message can be undeleted (u) by giving its number,
or the mail session can be aborted by giving the exit (x) command.
Deleted messages, however, will usually disappear, never to be seen
again.

Specifying messages
Commands such as print and delete can be given a list of message numbers
as arguments to apply to a number of messages at once.  Thus delete 1 2
deletes messages 1 and 2, while delete 1-5 deletes messages 1 through 5.

Messages may also be selected using one of the following categories:

*       all messages
\$       last message
:d      deleted messages
:n      new messages
:o      old messages
:r      read messages
:u      unread messages

Thus the command top, which prints the first few lines of a message,
could be used in top * to print the first few lines of all messages.

Replying to or originating mail
You can use the reply command to set up a response to a message, sending
it back to the person who it was from.  Text you then type in, up to an
end-of-file, defines the contents of the message.  While you are
composing a message, mail treats lines beginning with the tilde (~')
character specially.  For instance, typing ~m (alone on a line) will
place a copy of the current message into the response, right shifting it
by a single tab-stop (see the indentprefix variable, below).  Other
escapes will set up subject fields, add and delete recipients to the
message, and allow you to escape to an editor to revise the message or to
a shell to run some commands.  (These options are given in the summary
below.)

Ending a mail processing session
You can end a mail session with the quit (q) command.  Messages which
have been examined go to your mbox file unless they have been deleted, in
which case they are discarded.  Unexamined messages go back to the post
office (see the -f option above).

Personal and system wide distribution lists
It is also possible to create personal distribution lists so that, for
instance, you can send mail to cohorts'' and have it go to a group of
people.  Such lists can be defined by placing a line like

alias cohorts bill ozalp jkf mark kridle@ucbcory

in the file .mailrc in your home directory.  The current list of such
aliases can be displayed with the alias command in mail.  System wide
distribution lists can be created by editing /etc/mail/aliases (see
aliases(5) and sendmail(8)); these are kept in a different syntax.  In
mail you send, personal aliases will be expanded in mail sent to others
so that they will be able to reply to the recipients.  System wide
aliases are not expanded when the mail is sent, but any reply returned to
the machine will have the system wide alias expanded as all mail goes
through sendmail.

Network mail (ARPA, UUCP, Berknet)
See mailaddr(7) for a description of network addresses.

mail has a number of options which can be set in the .mailrc file to
alter its behavior; thus set askcc enables the askcc feature.  (These
options are summarized below.)

SUMMARY
(Adapted from the Mail Reference Manual''.)

Each command is typed on a line by itself, and may take arguments
following the command word.  The command need not be typed in its
entirety -- the first command which matches the typed prefix is used.
For commands which take message lists as arguments, if no message list is
given, then the next message forward which satisfies the command's
requirements is used.  If there are no messages forward of the current
message, the search proceeds backwards, and if there are no good messages
at all, mail types No applicable messages'' and aborts the command.

-       Print out the preceding message.  If given a numeric argument n,
goes to the nth previous message and prints it.

?       Prints a brief summary of commands.

!       Executes the shell (see sh(1) and csh(1)) command which follows.

alias   (a) With no arguments, prints out all currently defined aliases.
With one argument, prints out that alias.  With more than one
argument, creates a new alias or changes an old one.

alternates
(alt) The alternates command is useful if you have accounts on
several machines.  It can be used to inform mail that the listed
addresses are really you.  When you reply to messages, mail will
not send a copy of the message to any of the addresses listed on
the alternates list.  If the alternates command is given with no
argument, the current set of alternate names is displayed.

chdir   (c) Changes the user's working directory to that specified, if
given.  If no directory is given, then changes to the user's
login directory.

copy    (co) The copy command does the same thing that save does, except
that it does not mark the messages it is used on for deletion
when you quit.

delete  (d) Takes a list of messages as argument and marks them all as
deleted.  Deleted messages will not be saved in mbox, nor will
they be available for most other commands.

dp      (also dt) Deletes the current message and prints the next
message.  If there is no next message, mail says No more
messages.''

edit    (e) Takes a list of messages and points the text editor at each
one in turn.  On return from the editor, the message is read back
in.

exit    (ex or x) Effects an immediate return to the shell without
modifying the user's system mailbox, his mbox file, or his edit
file in -f.

file    (fi) The same as folder.

folder  (fo) The folder command switches to a new mail file or folder.
With no arguments, it tells you which file you are currently
reading.  If you give it an argument, it will write out changes
(such as deletions) you have made in the current file and read in
the new file.  Some special conventions are recognized for the
name.  # means the previous file, % means your system mailbox,
%user means user's system mailbox, & means your mbox file, and
+folder means a file in your folder directory.

folders
List the names of the folders in your folder directory.

from    (f) Takes a list of messages and prints their message headers.

headers
(h) Lists the current windowful of headers.  To view the next or
previous group of headers, see the z command.

help    A synonym for ?.

hold    (ho, also preserve) Takes a message list and marks each message
therein to be saved in the user's system mailbox instead of in
mbox.  Does not override the delete command.

ignore  Add the list of header fields named to the ignored list.  Header
fields in the ignore list are not printed on your terminal when
you print a message.  This command is very handy for suppression
of certain machine-generated header fields.  The Type and Print
commands can be used to print a message in its entirety,
including ignored fields.  If ignore is executed with no
arguments, it lists the current set of ignored fields.

inc     Incorporate any new messages that have arrived while mail is
being read.  The new messages are added to the end of the message
list, and the current message is reset to be the first new mail
message.  This does not renumber the existing message list, nor
does it cause any changes made so far to be saved.

list    (l) List the valid mail commands.

mail    (m) Takes as argument login names and distribution group names
and sends mail to those people.

mbox    Indicate that a list of messages be sent to mbox in your home
directory when you quit.  This is the default action for messages
if you do not have the hold option set.

more    (mo) Takes a message list and invokes the pager on that list.

next    (n) (like + or CR) Goes to the next message in sequence and types
it.  With an argument list, types the next matching message.

preserve
(pre) A synonym for hold.

Print   (P) Like print but also prints out ignored header fields.  See
also print, ignore, and retain.

print   (p) Takes a message list and types out each message on the user's
terminal.

quit    (q) Terminates the session, saving all undeleted, unsaved
messages in the user's mbox file in his login directory,
preserving all messages marked with hold or preserve or never
referenced in his system mailbox, and removing all other messages
from his system mailbox.  If new mail has arrived during the
session, the message You have new mail'' is given.  If given
while editing a mailbox file with the -f flag, then the edit file
is rewritten.  A return to the shell is effected, unless the
rewrite of edit file fails, in which case the user can escape
with the exit command.

Reply   (R) Reply to originator.  Does not reply to other recipients of
the original message.

reply   (r) Takes a message list and sends mail to the sender and all
recipients of the specified message.  The default message must
not be deleted.

respond
A synonym for reply.

retain  Add the list of header fields named to the retained list.  Only
the header fields in the retain list are shown on your terminal
when you print a message.  All other header fields are
suppressed.  The Type and Print commands can be used to print a
message in its entirety.  If retain is executed with no
arguments, it lists the current set of retained fields.

save    (s) Takes a message list and a filename and appends each message
in turn to the end of the file.  The filename in quotes, followed
by the line count and character count is echoed on the user's
terminal.

saveignore
saveignore is to save what ignore is to print and type.  Header
fields thus marked are filtered out when saving a message by save
or when automatically saving to mbox.

saveretain
saveretain is to save what retain is to print and type.  Header
fields thus marked are the only ones saved with a message when
saving by save or when automatically saving to mbox.  saveretain
overrides saveignore.

set     (se) With no arguments, prints all variable values.  Otherwise,
sets option.  Arguments are of the form option=value (no space
before or after =) or option.  Quotation marks may be placed
around any part of the assignment statement to quote blanks or
tabs, i.e., set indentprefix="->".

shell   (sh) Invokes an interactive version of the shell.

size    Takes a message list and prints out the size in characters of
each message.

source  The source command reads commands from a file.

top     Takes a message list and prints the top few lines of each.  The
number of lines printed is controlled by the variable toplines
and defaults to five.

Type    (T) Identical to the Print command.

type    (t) A synonym for print.

unalias
Takes a list of names defined by alias commands and discards the
remembered groups of users.  The group names no longer have any
significance.

undelete
(u) Takes a message list and marks each message as not being
deleted.

unread  (U) Takes a message list and marks each message as not having
been read.

unset   Takes a list of option names and discards their remembered
values; the inverse of set.

visual  (v) Takes a message list and invokes the display editor on each
message.

write   (w) Similar to save, except that only the message body (without
the header) is saved.  Extremely useful for such tasks as sending
and receiving source program text over the message system.

xit     (x) A synonym for exit.

z       mail presents message headers in windowfuls as described under
the headers command.  You can move mail's attention forward to
the next window with the z command.  Also, you can move to the
previous window by using z-.

Tilde/escapes
Here is a summary of the tilde escapes, which are used when composing
messages to perform special functions.  Tilde escapes are only recognized
at the beginning of lines.  The name tilde escape'' is somewhat of a
misnomer since the actual escape character can be set by the option
escape.

~bname ...
Add the given names to the list of carbon copy recipients but do
not make the names visible in the Cc: line ("blind" carbon copy).

~cname ...
Add the given names to the list of carbon copy recipients.

~d      Read the file dead.letter from your home directory into the
message.

~e      Invoke the text editor on the message collected so far.  After
the editing session is finished, you may continue appending text
to the message.

~Fmessages
Identical to ~f, except all message headers are included.

~fmessages
Read the named messages into the message being sent.  If no
messages are specified, read in the current message.  Message
headers currently being ignored (by the ignore or retain command)
are not included.

~h      Edit the message header fields by typing each one in turn and
allowing the user to append text to the end or modify the field
by using the current terminal erase and kill characters.

~Mmessages
Identical to ~m, except all message headers are included.

~mmessages
Read the named messages into the message being sent, indented by
a tab or by the value of indentprefix.  If no messages are
specified, read the current message.  Message headers currently
being ignored (by the ignore or retain command) are not included.

~p      Print out the message collected so far, prefaced by the message
header fields.

~q      Abort the message being sent, copying the message to dead.letter
in your home directory if save is set.

~rfilename
~<filename
Read the named file into the message.

~sstring
Cause the named string to become the current subject field.

~tname ...
Add the given names to the direct recipient list.

~v      Invoke an alternate editor (defined by the VISUAL option) on the
message collected so far.  Usually, the alternate editor will be
a screen editor.  After you quit the editor, you may resume
appending text to the end of your message.

~wfilename
Write the message onto the named file.

~x      Abort the message being sent.  No message is copied to
~/dead.letter, even if save is set.

~?      Prints a brief summary of tilde escapes.

~!command
Execute the indicated shell command, then return to the message.

~|command
Pipe the message through the command as a filter.  If the command
gives no output or terminates abnormally, retain the original
text of the message.  The command fmt(1) is often used as command
to rejustify the message.

~:mail-command
~_mail-command
Execute the given mail command.  Not all commands, however, are
allowed.

~~string
Insert the string of text in the message prefaced by a single ~.
If you have changed the escape character, then you should double
that character in order to send it.

~.      Simulate end of file on input.

Mail options
Options are controlled via set and unset commands.  Options may be either
binary, in which case it is only significant to see whether they are set
or not; or string, in which case the actual value is of interest.  The
binary options include the following:

append  Causes messages saved in mbox to be appended to the end rather
than prepended.  This should always be set (perhaps in
/etc/mail.rc).

ask, asksub
Causes mail to prompt you for the subject of each message you
send.  If you respond with simply a newline, no subject field
will be sent.

askbcc  Causes you to be prompted for additional blind carbon copy
recipients at the end of each message.  Responding with a newline
indicates your satisfaction with the current list.

askcc   Causes you to be prompted for additional carbon copy recipients
at the end of each message.  Responding with a newline indicates
your satisfaction with the current list.

autoinc
Causes new mail to be automatically incorporated when it arrives.
Setting this is similar to issuing the inc command at each
prompt, except that the current message is not reset when new
mail arrives.

autoprint
Causes the delete command to behave like dp; thus, after deleting
a message, the next one will be typed automatically.

debug   Setting the binary option debug is the same as specifying -d on
the command line and causes mail to output all sorts of
information useful for debugging mail.

dot     The binary option dot causes mail to interpret a period alone on
a line as the terminator of a message you are sending.

hold    This option is used to hold messages in the system mailbox by
default.

ignore  Causes interrupt signals from your terminal to be ignored and
echoed as @'s.

ignoreeof
An option related to dot is ignoreeof which makes mail refuse to
accept a control-D as the end of a message.  ignoreeof also
applies to mail command mode.

keep    Setting this option causes mail to truncate your system mailbox
instead of deleting it when it's empty.

keepsave
Messages saved with the save command are not normally saved in
mbox at quit time.  Use this option to retain those messages.

metoo   Usually, when a group is expanded that contains the sender, the
sender is removed from the expansion.  Setting this option causes
the sender to be included in the group.

noheader
Setting the option noheader is the same as giving the -N flag on
the command line.

nosave  Normally, when you abort a message with two interrupt characters
(usually control-C), mail copies the partial letter to the file
dead.letter in your home directory.  Setting the binary option
nosave prevents this.

quiet   Suppresses the printing of the version when first invoked.

Replyall
Reverses the sense of reply and Reply commands.

searchheaders
If this option is set, then a message-list specifier in the form
/x:y'' will expand to all messages containing the substring y'
in the header field x'.  The string search is case insensitive.
If x' is omitted, it will default to the Subject'' header
field.  The form /to:y'' is a special case, and will expand to
all messages containing the substring y' in the To'', Cc''
or Bcc'' header fields.  The check for to'' is case
sensitive, so that /To:y'' can be used to limit the search for
y' to just the To:'' field.

skipempty
Don't send messages with an empty body.

verbose
Setting the option verbose is the same as using the -v flag on
the command line.  When mail runs in verbose mode, the actual
delivery of messages is displayed on the user's terminal.

Option string values
EDITOR        Pathname of the text editor to use in the edit command and
~e escape.  If not defined, /usr/bin/ex is used.

LISTER        Pathname of the directory lister to use in the folders
command.  Default is /bin/ls.

MBOX          The name of the mbox file.  It can be the name of a folder.
The default is mbox'' in the user's home directory.

PAGER         Pathname of the program to use in the more command or when
the crt variable is set.  The default paginator more(1) is
used if this option is not defined.

SHELL         Pathname of the shell to use in the ! command and the ~!
escape.  A default shell is used if this option is not
defined.

TMPDIR        Directory in which temporary files are stored.

VISUAL        Pathname of the text editor to use in the visual command
and ~v escape.  If not defined, /usr/bin/vi is used.

crt           The valued option crt is used as a threshold to determine
how long a message must be before PAGER is used to read it.
If crt is set without a value, then the height of the
terminal screen stored in the system is used to compute the
threshold (see stty(1)).

escape        If defined, the first character of this option gives the
character to use in the place of ~ to denote escapes.

folder        The name of the directory to use for storing folders of
messages.  If this name begins with a /', mail considers
it to be an absolute pathname; otherwise, the folder
directory is found relative to your home directory.

indentprefix  String used by the ~m tilde escape for indenting messages,
in place of the normal tab character (^I').  Be sure to
quote the value if it contains spaces or tabs.

record        If defined, gives the pathname of the file used to record
all outgoing mail.  If not defined, then outgoing mail is
not so saved.

screen        Size of window of message headers for z.

sendmail      Pathname to an alternative mail delivery system.

toplines      If defined, gives the number of lines of a message to be
printed out with the top command; normally, the first five
lines are printed.

ENVIRONMENT
mail utilizes the HOME, LOGNAME, MAIL, MAILRC, and USER environment
variables.

If the MAIL environment variable is set, its value is used as the path to
the user's mail spool.

FILES
/var/mail/*                 post office (unless overridden by the MAIL
environment variable)
~/mbox                      user's old mail
~/.mailrc                   file giving initial mail commands; can be
overridden by setting the MAILRC environment
variable
/tmp/R*                     temporary files
/usr/share/misc/mail.*help  help files
/etc/mail.rc                system initialization file

EXIT STATUS
The mail utility exits 0 on success, and >0 if an error occurs.

SEE ALSO
fmt(1), lockspool(1), vacation(1), aliases(5), mailaddr(7),
mail.local(8), newaliases(8), sendmail(8)

STANDARDS
The mailx utility is compliant with the IEEE Std 1003.1-2008
(`POSIX.1'') specification.

The flags [-bcdEIv] are extensions to that specification.

HISTORY
A mail command appeared in Version 3 AT&T UNIX.  This man page is derived
from the Mail Reference Manual originally written by Kurt Shoens.

BUGS
There are some flags that are not documented here.  Most are not useful
to the general user.

Usually, mail and mailx are just links to Mail, which can be confusing.

OpenBSD 5.4                      July 18, 2013                     OpenBSD 5.4

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.

hush nigger

#### Re: Absent's Code Thread / Tech Blog

Requested, so I'm posting it. it was one of my c++ OOP class assignments. I don't think I should post it because probably going to be used for future classes, but fuck it who cares. Maybe I'll go through and add better comments that actually explain everything. These are fine though, you should be able to get it if you understand OO and classes and everything.

Header Files

Object2d.h

#ifndef OBJECT2D_H
#define OBJECT2D_H
#include "Color.h"
#include <string>
using namespace std;

class Object2D {
protected:
Color fillColor;
public:
Color getFillColor();
void setFillColor(Color c);
// below are the abstract functions.  Since they are pure virtual functions
// any descendent from Object2D must provide an implementation.
// Note that virtual functions are the basis of *polymorphic* behavior in OO programming.
virtual double perimeter() = 0;
virtual double area() = 0;
virtual string to_string() = 0;
};
#endif

Rectangle.h

#pragma once
#include "Object2d.h"
#include <string>
using namespace std;

class Rectangle :
public Object2D
{
private:
double length;
double width;

public:
Rectangle(void);
Rectangle(double l, double w);
~Rectangle(void);
double perimeter();
double area();
string to_string();
};

Rightriangle.h

#pragma once
#include "Object2d.h"
#include <string>
using namespace std;

class RightTriangle :
public Object2D
{
private:
double base;
double height;

public:
RightTriangle(void);
RightTriangle(double b, double h);
~RightTriangle(void);
double perimeter();
double area();
string to_string();
};

square.h

#pragma once
#include "Object2d.h"
#include <string>
using namespace std;

class Square :
public Object2D
{
private:
double side;

public:
Square(void);
Square(double s);
~Square(void);
double perimeter();
double area();
string to_string();
};

circle.h

#ifndef CIRCLE_H
#define CIRCLE_H

#include "Object2D.h"
#include <string>
using namespace std;

class Circle : public Object2D {
private:
double radius;
public:
Circle();
Circle(double r);
~Circle();
double perimeter();
double area();
string to_string();
};
#endif

colors.h

#ifndef COLOR_H
#define COLOR_H

enum Color { RED, BLUE, GREEN };

#endif

UH, I'm tripping, but like, cpp yeah. Fucking CPP that's what. Main files, no cpp.

Circle.cpp

#include "Circle.h"
#include <cmath>
using namespace std;

static const double PI = 3.14159;

Circle::Circle() {
radius = 1.0;
}

Circle::Circle(double r) {
if (r <= 0.0) {
throw new invalid_argument("Radius cannot be <= 0.0 ");
}
radius = r;
}

Circle::~Circle(){
}

double Circle::perimeter() {
return PI * 2 * radius;
}

double Circle::area() {
return PI * radius * radius;
}

string Circle::to_string() {
char value[10];
sprintf_s(value, "%f", radius);
string s = "Circle radius: ";
s += value;
return s;
}

Main.cpp

// Object2D - Create a simple 2D geometric objects: Cirle, Square, RightTriangle, and Rectangle.
//
// Learning objectives:
// - Learn a simple class hierarchy
// - Explore polymorphic functions (perimeter and area)
// - Implement new classes from scratch

#include "Object2D.h"
#include "Circle.h"
#include "Square.h"
#include "RightTriangle.h"
#include "Rectangle.h"
#include <cstdio>
#include <cstdlib>
using namespace std;

int main() {
Object2D *objs2D[4];

objs2D[0]= new Circle();
objs2D[1]= new Square();
//    TODO: Add classes RightTriangle and Rectangle (Note: separate files needed)
//  TODO: Create a RightTriangle and a Rectance object as below.
objs2D[2]= new RightTriangle();
objs2D[3]= new Rectangle();
//  TODO: Change the loop test so all four kinds of geometric objects are printed.
for (int i=0; i < 4; i++) {
printf("%s\n", (*objs2D).to_string().c_str()); // I have to close i for forums code lol printf("Perimeter: %f\n", (*objs2D).perimeter()); // again printf("Area     : %f\n\n", (*objs2D).area());  // again }
system("pause");
}

Object2d.cpp

#include "Object2D.h"
using namespace std;

Color Object2D::getFillColor() {
return fillColor;
}

void Object2D::setFillColor(Color c) {
fillColor = c;
}

rectangle.cpp

#include "Rectangle.h"

Rectangle::Rectangle() {
length = 2.0;
width = 1.0;
}

Rectangle::Rectangle(double l, double w)
{
if (l <= 0.0 && w <= 0.0) {
throw new invalid_argument("Length and width cannot be <= 0.0 ");
}
length = l;
width = w;

}

Rectangle::~Rectangle(void)
{
}

double Rectangle::perimeter() {
return width + width + length + length;
}

double Rectangle::area() {
return width * length;
}

string Rectangle::to_string() {
char value[11];
char val[10];
sprintf_s(value, "%f \n", length);
sprintf_s(val, "%f", width);
string l = "Rectangle Length: ";
string w = "Rectangle Width: ";
l += value;
w += val;
string t = l + w;
return t;
}

rigttriangle.cpp

#include "RightTriangle.h"

RightTriangle::RightTriangle() {
base = 1.0;
height = 1.0;
}

RightTriangle::RightTriangle(double b, double h)
{
if (b <= 0.0 && h <= 0.0) {
throw new invalid_argument("Base and Height cannot be <= 0.0 ");
}
base = b;
height = h;

}

RightTriangle::~RightTriangle(void)
{
}

double RightTriangle::perimeter() {
double hypoteneuse;
double sqaredstuff = base * base + height * height;
hypoteneuse = sqrt(sqaredstuff);
return  base + height + hypoteneuse;
}

double RightTriangle::area() {
return (base * height) / 2;
}

string RightTriangle::to_string() {
char value[11];
char val[10];
sprintf_s(value, "%f \n", base);
sprintf_s(val, "%f", height);
string b = "RightTriangle Base: ";
string h = "RightTriangle Height: ";
b += value;
h += val;
string t = b + h;
return t;
}

square.cpp, hope I didn't repeat any

#include "Square.h"

Square::Square(void)
{
side = 1.0;
}

Square::Square(double s)
{
if (s <= 0.0) {
throw new invalid_argument("Side cannot be <= 0.0 ");
}
side = s;
}

Square::~Square(void)
{
}

double Square::perimeter() {
return 4 * side;
}

double Square::area() {
return side * side;
}

string Square::to_string() {
char value[10];
sprintf_s(value, "%f", side);
string s = "Square side: ";
s += value;
return s;
}

#### Re: Absent's Code Thread / Tech Blog

Holy shit thats a lot of files.

Hindsight is always 20/20.

God wrote:

A surprising amount of insight can be gleamed from sitting on the toilet. More concerning, however, is the amount of nostalgia.

When in doubt, move north. God bless suomi.

#### Re: Absent's Code Thread / Tech Blog

That's what I said, and then my professor was all "that's not our biggest assignment yet" and said in production he regularly had to deal with hundreds of files, and a lot of software projects are fucking massive. Also luna works with files that are quite a bit bigger than this, iirc.

#### Re: Absent's Code Thread / Tech Blog

pretty sure aCol has dealt with much bigger projects... not as homework though

yeah, lunix kernel had 37,626 files in kernel version 3.2

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.

#### Re: Absent's Code Thread / Tech Blog

http://cdecl.org/

That is of some use.

#### Re: Absent's Code Thread / Tech Blog

OK, so I fucking did this monstrosity of a goddamn wreck FUCK. Whatever. It's all I got to do in like 2 1/2 hours of bullshit. These goddamn templates are a goddamn clusterfuck and I feel like they shouldn't be doing that but whatever. Most of the functions don't work. (See, all) Because they're all fucking interdependent. I'm pretty sure this is basically how I have to do it. LIke the prompt is:

And here's the goddamn monstrosity:

#pragma once
using namespace std;

// Class of objects to be used in array.
template <typename KEYTYPE, typename VALTYPE>
class ArrayObject
{
ArrayObject(KEYTYPE Key; VALTYPE val;) // Taking values for Key and value to make objects out of.
{

}
};

// Heap Class to handle array of pointers and methods for the heap.
template <typename KEYTYPE, typename VALTYPE>
class Heap
{
public:
const int amount = 20;
ArrayObject<KEYTYPE, VALTYPE> **array; // Array of pointers.
Heap(int maxSize); // Constructor
~Heap(); // Destructor
insert (KEYTYPE Key, VALTYPE Val); // Add to heap.
VALTYPE remove(); // Remove from heap.
bool isEmpty(); // Find out if location is empty.
bool isFull();
int getSize();
int getMaximumSize();

private:
int LastUsed(); // get last used index
void reheapUp();
void reheapDown();

};

// Constructor implemented
template <typename KEYTYPE, typename VALTYPE>
Heap<KEYTYPE, VALTYPE>::Heap(int maxSize)
{
array = new ArrayObject *[maxSize];
}

// Destructor implemented
template <typename KEYTYPE, typename VALTYPE>
Heap<KEYTYPE, VALTYPE>::~Heap()
{
for (int i = 0; i < amount; i++)
delete array[ i]; //
}

template <typename KEYTYPE, typename VALTYPE>
Heap<KEYTYPE, VALTYPE>::insert(KEYTYPE Key, VALTYPE Val)
{
int newEntryIndex = (LastUsed() + 1);
array[newEntryIndex]= new ArrayObject<KEYTYPE, VALTYPE>(Key, Val);
LastUsed++;
reheapUp();
}

Heap<int, int>LastUsed()
{

}

// Remove algorithm, requires isEmpty and requires reheapDown and shit to work ugh.
// Not sure how it's going to be used? Like where does it get "result" ugh.

template <typename KEYTYPE, typename VALTYPE>
Heap<VALTYPE, VALTYPE>::remove()
{
if (if ? isEmpty())
result = heap[0].value;
heap[0]= heap[lastUsed];
lastUsed--;
reheapDown()
else
throw UnderflowException
}

template <typename KEYTYPE, typename VALTYPE>
bool Heap<KEYTYPE, VALTYPE>::isEmpty()
{
// What the hell :(
}

template <typename KEYTYPE, typename VALTYPE>
bool Heap<KEYTYPE, VALTYPE>::isFull()
{
// What the hell :(
}

template<typename KEYTYPE, typename VALTYPE>
int Heap<KEYTYPE, VALTYPE>::getSize()
{
// Bro what
}

template<typename KEYTYPE, typename VALTYPE>
int Heap<KEYTYPE, VALTYPE>::getMaximumSize()
{
// Bro.
}

template <typename KEYTYPE, typename VALTYPE>
void Heap<KEYTYPE, VALTYPE>::reheapDown() // private
{
int current = 0;
int LargestChild = getLargestChild(current); // seperate method somewhere.
while(LargestChild > -1) // if largest child is - 1, it's a leaf child.
{
heap[current]< heap[LargestChild];
swap(current, largestChild);
current = largestChild; // this swaps the index,  not the values
largestChild = getLargestChild(current);
}
}

template <typename KEYTYPE, typename VALTYPE>
void Heap<KEYTYPE, VALTYPE>::reheapUp()  // private
{
int current = LastUsed();
while (current != 0 && Heap[current]> Heap[parent])
{
swap(current, parent);
current = parent;
parent = ((current -1) / 2);
}
}

// bro what the fuck am I doing.

Basically I have to figure out how the fuck I'm going to impleement isEmpty and isFull and uh, idk man. I just fucking need to sleep it's 4:30am and I have to get some rest I guess? Fuck. This fucking project is due midnight the 25th, and I work on the 25th. GG, probably going to be late again. FUck.

Here's some shit ass notes I took:

NOTES:

Bounded Array, Dynamically allocated.
Methods to manipulate array so acts like priority queue (heap)
Visualization:

Array: [ Key | Value ] [KEY | VALUE] [KEY | VALUE]
0             1            2

Array of objects containing key and value maybe?
Maxsize and heapsize local variables probably. I think.
Values are pretty unimportant since we're only concerend with the key when arranging heap.
Define heap array as pointers maybe, so as to allocate array outside constructor. Or double pointer for some reason.
constructor
{new array[maxValue]; // dynamically allocated

-- Always remove top (largest), used as priority queue.
-- Fill top down, left to right. (In visualization of actual heap.)
-- Usually implemented as an array, bounded.
-- Left child = i * 2 + 1
-- Right Child = i * 2 + 2
-- Parent = [(i-1)/2]
-- Parents key has to be larger, if not, swap. Keep checking up until satisfied or at top. Index is zero.
-- Last used +1 to check amount of things.

Insert (key, value)
{
compute newEntryindex
(lastUsed+1)
array[newEntryIndex]= new Node(key, value)
Lastused++;
reheapUp();

reheapUp

current = lastUsed;
parent = current -1 / 2
while (current != 0) and heap[current]> heap{parrent]
swap(current and parent)
current = parent
parent = (current -1) / 2

}

If 2 of the same, leave sit it's fine.

Heap
LastUsed : int
maximumSize : int
remove () : Value
if not empty
result = heap[0].value

If root dies, remove last one and copy it to the root. Decrement last used.
Check left, check right, biggest one SWAP. This is called reheap down. Keep doing that
downward until done. Until largest child is smaller OR hit leaf node.

Take out bottom right, start checking children for largest, keep going until hit bottom or smaller child.

Heap: Unstable structure, cannot guarantee how stuff happens. If both children are same, just pick one who cares or as defined (left or right) yh.

remove() : Value

if not empty
result = heap[0].value
heap[0]= heap[lastUsed];
lastUsed--;
reheapDown()
else
throw UnderflowException

Reheap down method:

reheapDown()
current = 0;
LargestChild = getLargestChild(current) // seperate method somewhere.
while(largestChild > -1) // if largest child is - 1, it's a leaf child.
heap[current]< heap[LargestChild]swap(current, largestChild)
current = largestChild // this swaps the index,  not the values
largestChild = getLargestChild(current)

Am out of children?
Is largest child still smaller than me?
If not, keep going.
This is iterative way. There is recursive way.

getLargestChild()
check to see if left and right exist, check which is bigger, return biggest, else return -1

parentOf(), rightChildOf(), leftChildOf(), etc.

If have A before final, don't have to take final.

OverflowException prolly needs used.

Override for less than operator OR heapCurrent.key < heapCurrent.key or something.