How is the code from the IOCCC contest submissions shaped / indented? - indentation

Some, if not most, of the code submissions sent to IOCCC are indented / "shaped". Examples:
https://www.ioccc.org/2018/vokes/prog.c
https://www.ioccc.org/2018/yang/prog.c
https://www.ioccc.org/2018/poikola/prog.c
https://github.com/mame/quine-relay/blob/master/QR.rb
How is the code of all these submissions formatted / shaped? Is it done by hand? Or is there some tool / way of automating the "shaping" of a given chunk of code?

Related

OpenOffice Calc SUM of TRUNC number cells, with rows that include text cells

RE: Apache OpenOffice 4.1.7, AOO417m1(Build:9800) - Rev. 46059c9192, 2019-09-03 12:04.
I need to sum non-integer entries across a range of cells, but without including the decimal values (complicated by some cells being text). I started with ROUNDDOWN, then TRUNC, then FLOOR. I'm driving myself nuts trying to find a clean code (or even an arbitrarily extensible ugly code) for what would be the following:
=SUMIF(ISTEXT(R7:CL7);0;TRUNC(R7:CL7))
The above doesn't work, of course, since TRUNC() doesn't apply to ranges, but it conveys what I'm trying to do in a nutshell -- some of the cells contain text, which SUM() ignores (luckily), but they flummox TRUNC, so I needed to handle the text problem.
I started with ISNUMBER, just to get the ball rolling; ISTEXT has fewer characters, but it's not worth fixing that right now.
FLOOR was equally disappointing for ranges:
=SUM(FLOOR(R7:T7;1))
I tried variations of =SUM(IF(... and searches for ROUNDDOWN range (and variations on that) and such pseudocode as "IFTEXT" and "SUMTRUNC" (and variations on that). I found info on ROUNDDOWN(SUM(... and so forth, but not "SUM(ROUNDDOWN(..." or any equivalent.
In my delirium, I got silly and even tried:
=SUMIF(ISTEXT(S7:U7);0;AND(TRUNC(S7);TRUNC(T7);TRUNC(U7)))
To be clear: {2.9→2 + 2.9→2 + 2.9→2 = 6} ≠ {2.9+2.9+2.9 = 8.7→8}. I'm looking for a 6, not an 8 (I'd joke about sixes and sevens, but I'm way past pumpkin o'clock and 2.428571 takes up too much space).
My current test-kludge is:
=SUM(IF(ISNUMBER(R7);ROUNDDOWN(R7);0);IF(ISNUMBER(S7);ROUNDDOWN(S7);0);IF(ISNUMBER(T7);ROUNDDOWN(T7);0); ... ;IF(ISNUMBER(AX7);ROUNDDOWN(AX7);0))
It ends at AX7 only because of the char count. I hope to SUM the whole row in a single sweep, but that ain't gonna cut it. I could do it in large chunks in multiple cells, and then add those cells up, but oy gevalt.
Since it's already ugly anyway, I could use the following to save a few characters, but this would only mean being able to extend the range maybe 6 further cells (not much point in that):
=IF(ISTEXT(R7);0;TRUNC(R7))+IF(ISTEXT(S7);0;TRUNC(S7))+IF(ISTEXT(S7);0;TRUNC(S7))
I'm seriously considering simply going down a bunch of rows (to below my data cells) and entering the following, then copying the cell and pasting it to a complementary range, and telling the SUM cells to just sum up their respectively shadowed rows (instead of the data rows that they sit in):
=IF(ISTEXT(R7);0;TRUNC(R7))
Sorry for the rambling; I need sleep. This started as a need, then multiple failed attempts became a grudge match of principle and obstinacy, and now I'm just plugging away at it out of blind habit developed over the past 2-3 days (hopefully I won't forget what the purpose was).
In summary...: ++?????++ Out of Cheese Error +++DIVIDE BY CUCUMBER.
I'm comfortable enough with macros, though it's been ~7 years (and that was in Excel). Thanks in advance, even if the answer is that I'm stuck with one of these! 🙂
EDIT: I don't see a way to attach a .csv here (though I could open the .csv with Notepad, and copy-and-paste the contents if that would help anyone), so here's a set of pics:

Analyze Repeated Measures Data Using PROC GLIMMIX

I am using PROC GLIMMIX to analyze repeated measures data about specific sexual events. The original data came from a weekly diary study of about 400 people. During each week they reported on behaviours from their most recent sexual encounter. We also have basline data on their demographics. 12 weeks of observation were collected and we had a high completion rate.
I would like to create a mixed effect model, but I am unsure exactly how this is done in SAS. I want to test the effect of event-specific factors as well as some person level demographics and would like to get odds ratios for each factor of interest. The outcome is whether or not drugs were used during the event and the explanatory factors will be things like age, gender, etc. as well as characteristics about the event (i.e., partner HIV status), whether the partner was a regular sexual partner, etc..
The code I'm working with follows this pattern:
PROC GLIMMIX DATA=work.dataset oddsratio;
CLASS VISIT_NUMBER PARTICIPANT_ID BINARY_EVENTLEVEL_OUTCOME BINARY_EVENTLEVEL_EXPLANATORY_FACTOR CATEGORICAL_PERSONLEVEL_EXPLANATORY_FACTOR;
MODEL BINARY_EVENTLEVEL_OUTCOME = BINARY_EVENTLEVEL_EXPLANATORY CATEGORICAL_PERSONLEVEL_EXPLANATORY_FACTOR /DIST=binary link=logit CL S ddfm=kr;
RANDOM ?????;
RUN;
option 1 for ?????: residual / subject=PARTICIPANT_ID
option 2 for ?????: INTERCEPT / subject=PARTICIPANT_ID
option 3 for ?????: VISIT_NUM / subject=PARTICIPANT_ID residual type=ar(1)
INTERCEPT / subject=VISIT_NUM(PARTICIPANT_ID)
option 4 for ?????: Other?
I am also unclear whether I should use ddfm=kr in my model statement or method=laplace in my proc statement -- both have been recommended elsewhere for this sort of repeated measures analysis.
I've come across several potential options for modelling this which often give similar results, but option 1 gives a statistically significant result for an event-level, while the others give non-significant results. The inclusion of the ddfm=kr makes the result of interest more significant. The method=laplace does not allow for option 1.
I may not be answering your question, but might be able to provide a couple of directions:
To start with the simplest part, your MODEL statement looks correct to me as you want to test event-level factors and person-level demographics which are thus considered as fixed effects.
Now, as far as the random effects are concerned:
the RANDOM statements you propose for options (1) and (2):
(1) RANDOM _residual_ / subject=PARTICIPANT_ID;
or
(2) RANDOM intercept / subject=PARTICIPANT_ID;
are modeling two different parts of the random effects: the R-side and the G-side, respectively.
If you are already familiar with PROC MIXED, you may want to notice that your option (1) of using RANDOM _residual_ in PROC GLIMMIX is equivalent to using the REPEATED statement in PROC MIXED that tells that you have repeated measures for PARTICIPANT_ID, which is clearly your case (Ref: "Comparing the GLIMMIX and MIXED Procedures")
As for option (3):
RANDOM VISIT_NUM / subject=PARTICIPANT_ID residual type=ar(1) INTERCEPT / subject=VISIT_NUM(PARTICIPANT_ID);
here you are modeling the time component of the repeated measures (visit_num) as a random effect, and this should be included when you believe that there would be a random variation of the response at each of the measurements times (i.e. at each event). At first glance, I don't believe this is relevant in your case, since you are taking this into account already by the fixed effects... but of course I may be wrong by not seeing your data.
Up to here is what I can contribute at this time.
As next steps for you to have a better understanding, I would suggest that you:
Read the Overview of the PROC GLIMMIX documentation, in particular the mathematical model specification and all 3 sections therein:
The Basic Model
G-Side and R-Side Random Effects and Covariance Structures
Relationship with Generalized Linear Models
If you are still unsure, ask your question at communities.sas.com which might be able to help you better.
HTH

Suggestions for statistical model/approach to “Pattern recognition for non-uniform time data”

I have a dataset from which I would like to detect recurring patterns (i.e: daily, weekly, monthly). The dataset only contains a time stamp (datetime), and the spacing is non-uniform.
The observations in the data reflect the exact time when this one person passes my window. He does this several times a day (on a single day he walks by my window approx 10-30 times), and I am trying to see, if there is any pattern (there might also be some seasonality, sudden changes in previous behavior and other interesting stuff going on).
Does anyone have a suggestion for a statistical model/approach that might be helpful in figuring out if there is any pattern in this behavior? Hopefully, I’ll be able to predict when he will pass my window again ;)
How would you approach this?
Any help would really be appreciated.

Speech Recognition for small vocabulary (about 20 words)

I am currently working on a project for my university. The task is to write speech recognition system that is going to run on a phone in background waiting for few commands (like. call 0 123 ...).
It's 2 months project so it does not have to be very accurate. The amount of acceptable noise can be small and words will be separated by moments of silence.
I am currently at point of loading sample word encoded in RAW 16 bit PCM format. Splitting it to chunks (about 50 per second) and running FFT on each chunk in order to get frequency spectrum.
Things to solve are:
1) going through the longer recording and splitting it into words.
2) finding to best match for the word
1) I was thinking about just checking chunk after chunk and if I encounter few chunks that have higher altitudes of human voice frequencies assume that the word has started. Anyway I am looking for resources that may help with this.
2) This one seams a little bit tougher. Is it necessary to use HMM's for system like this or maybe there are simpler methods assuming that the vocabulary is so small ( 20 words )?
Edit:
The point of the project is writing the system on my own so I cannot use ready libraries like Sphinx or HTK.
Regards,
Karol
If anybody will have the same question in future. Look for 2 main keywords:
MFCC - Mel-Frequency cepstrum coefficients to calculate series of coefficients for each word template
DTW - To match captured word with templates
Good enough description of DTW can be found on wikipedia
This approach was good enough to have around 80% accuracy on 20 words dictionary and give a good demo during the class.
To recognize commands on the phone you can use Pocketsphinx. Tutorial which covers speech recognition applications on Android is available on CMUSphinx website.

Is there a limit to how long a filename URL statement can be?

I am on design number three I think now of a program that submits a series of stock tickers and metrics to Yahoo Finance. I don't need to go into too much total about what it does as I have got most of it up and running now apart from one remaining issue.
The Yahoo Finance site lists about 2700 stock tickers on the NASDAQ alone. I anticipated that submitting all of these in one filename URL statement might fall over for some reason, so set an initial string length of 500 tickers and built some nested macros to iterate through in 500 ticker blocks until everything I wanted had been extracted.
However during development of the code it seems that if I build a string with any more than about 200 tickers in I get an error telling me that SSL Support cannot be run and the code falls over.
Does anyone have any idea why this is? In ideal world I would like to be able to do this code in one pass where all 2700 stock tickers are pulled down. If this isn't possible if someone could explain why not that would be great.
Thanks