Posted November 18, 2015
nightcraw1er.488
HelpThe Aged-Me!
nightcraw1er.488 Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Apr 2012
From United Kingdom
mrkgnao
https://www.amazon.com/dp/B00HCZVCTO
mrkgnao Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Apr 2009
From United States
Posted November 18, 2015
nightcraw1er.488: Well, professionally 15 years as a SAS programmer, that's statistical programming not special forces :o)
I programmed in SAS (for DOS) from 1988 to 1997. Probably one of my first interactions with a computer. Fun days. I remember writing meta-programs (programs that write other programs, which are then run) in SAS.
I even wrote a basic OMR (optical mark recognition) program in SAS (hey, it was the only language I knew back then).
Shortly after learning C, I read this book:
http://www.amazon.com/Obfuscated-Other-Mysteries-Don-Libes/dp/0471578053
Recommended.
User? What's that?
Post edited November 18, 2015 by mrkgnao
Maighstir
THIS KNIGHT MISLIKES THESE HEIGHTS
Maighstir Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Nov 2008
From Sweden
Posted November 18, 2015
Months? I'm happy if I can remember what I meant when I wrote the code the night before.
nightcraw1er.488
HelpThe Aged-Me!
nightcraw1er.488 Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Apr 2012
From United Kingdom
Posted November 18, 2015
nightcraw1er.488: Well, professionally 15 years as a SAS programmer, that's statistical programming not special forces :o)
mrkgnao: I programmed in SAS (for DOS) from 1988 to 1997. Probably one of my first interactions with a computer. Fun days. I remember writing meta-programs (programs that write other programs, which are then run) in SAS.
I even wrote a basic OMR (optical mark recognition) program in SAS (hey, it was the only language I knew back then).
mrkgnao: Shortly after learning C, I read this book:
http://www.amazon.com/Obfuscated-Other-Mysteries-Don-Libes/dp/0471578053
Recommended.
mrkgnao: User? What's that?
Users: An unfortunate necessity in coding. This could range from the sweaty paw swiping masses to the poorly bolted together automated system which rejects your code 3 out of 4 times.
immi101
User
immi101 Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: May 2010
From Germany
Posted November 18, 2015
mrkgnao: And, of course, you don't need the following to write useful programs in perl:
print($_)
$| = 1;
foreach my $f (@{$$lang_arr_ref[1]{$os}})
$time =~ tr/ :/__/;
$field =~ s/(\(.*?\))/ $1/g;
$new_size =~ s/(\d)(?=(\d{3})+(\D|$))/$1\,/g;
[all are real life examples from MaGog's code]
As much as I love regexp for dealing with anything text related, in terms of readability they are the worst thing for me. print($_)
$| = 1;
foreach my $f (@{$$lang_arr_ref[1]{$os}})
$time =~ tr/ :/__/;
$field =~ s/(\(.*?\))/ $1/g;
$new_size =~ s/(\d)(?=(\d{3})+(\D|$))/$1\,/g;
[all are real life examples from MaGog's code]
You can structure/format any programming language (well, most) in a way that you can easily follow the control flow/program logic. But a regular expression just sits there as an undistinctive blob and I have to slowly go through it to discover what it does.
And if I come upon a function where several of these blobs jump at me, late at night, after several hours of staring at the screen, my brain starts to hurt.
Which is why I (try to) give every longish regexp a comment about what it does.
dtgreene
vaccines work she/her
dtgreene Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Jan 2010
From United States
Posted November 18, 2015
low rated
Here is a silly little C example (note that I have not omitted any include statements):
int x[] = { 1,2,7,9,19, };
int main(void)
{
printf("%d", 3[x]);
}
Here are some oddities about this example:
1. Notice that the initializer for x has a comma at the end. That is, in fact, legal.
2. If you notice, I never declared printf anywhere, yet this still compiles. C does not require functions to be declared, though you can get into trouble depending on the types of the parameters and the return type. Note that gcc emits a warning here by default, and a C++ compiler will reject it entirely.
3. Here is the one that will probably surprise most people. Normally, you index the array with syntax x[3], which is rewritten by the compiler as *(x + 3). However, it turns out that you can write 3[x], which will be rewritten as *(3 + x). which means the same thing. So, believe it or not, 3[x] is legal C syntax.
4. Wait, where did the return statement go?
int x[] = { 1,2,7,9,19, };
int main(void)
{
printf("%d", 3[x]);
}
Here are some oddities about this example:
1. Notice that the initializer for x has a comma at the end. That is, in fact, legal.
2. If you notice, I never declared printf anywhere, yet this still compiles. C does not require functions to be declared, though you can get into trouble depending on the types of the parameters and the return type. Note that gcc emits a warning here by default, and a C++ compiler will reject it entirely.
3. Here is the one that will probably surprise most people. Normally, you index the array with syntax x[3], which is rewritten by the compiler as *(x + 3). However, it turns out that you can write 3[x], which will be rewritten as *(3 + x). which means the same thing. So, believe it or not, 3[x] is legal C syntax.
4. Wait, where did the return statement go?
real.geizterfahr
Grumpy Old Gamer
real.geizterfahr Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Apr 2010
From Spain
Posted November 18, 2015
gooberking: If it were up to me I would just do HTML and CSS. Writing CSS and building responsive layouts is literally the only thing I care about or think I have any business doing. I don't see a lot of postings for that sort of thing.
That's what I do for a living (plus a lot of SEO). I do understand a thing or two when it comes to PHP and Javascript, but that's just enough to see what a piece of code does (if it isn't too complex). But my main focus lays on HTML, CSS and responsive designs (= one stylesheet for everything between a 1080p screen and a tiny iPhone 1). It took a bit to get used to designs exclusively written with % and em, but it's great to see how different a website can look on different devices (without creating separate mobile versions or stupid apps). If you're interested in responsive layouts, here's an awesome website about the power of CSS: http://www.csszengarden.com/
Every design on this site has the same HTML code! And all designs work on all kinds of devices. A great source of inspiration ;)
immi101
User
immi101 Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: May 2010
From Germany
Tallima
TreasureHunting!
Tallima Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Apr 2010
From United States
Posted November 19, 2015
Tallima: There are 10 kinds of people. Those who don't know anything about theoretical computational models, those who do, and those who know that trinary is the most efficient.
(I'm still waiting to see someone figure out how to build an e-nary computer -- that's technically the most efficient)
dtgreene: Do you, by any chance, have a link to any website that explains why trinary (or better yet, e-nary) is the most efficient? (I'm still waiting to see someone figure out how to build an e-nary computer -- that's technically the most efficient)
(Note that I actually do have a mathematics background, so it is not a problem if that site is heavy on math.)
I hope you understand it better than I. :)
dtgreene
vaccines work she/her
dtgreene Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Jan 2010
From United States
Posted November 19, 2015
low rated
dtgreene: Here is a silly little C example (note that I have not omitted any include statements):
int x[] = { 1,2,7,9,19, };
int main(void)
{
printf("%d", 3[x]);
}
[...]
4. Wait, where did the return statement go?
immi101: hate to be nitpicking, but iirc that brings you into the murky area of "undefined behaviour". That means: yes the you can compile that, but don't you try and use the return value of that function. There is no guarantee what the compiler will put there. So while that may be legal syntax according to the standard, just add your own personal law and declare it illegal :p. int x[] = { 1,2,7,9,19, };
int main(void)
{
printf("%d", 3[x]);
}
[...]
4. Wait, where did the return statement go?
According to
http://stackoverflow.com/questions/18402853/must-the-int-main-function-return-a-value-in-all-compilers
the standard defines the return value of main() to be 0 if no return statement is reached. One of the answers cites § 3.6.1 from the standard.
(Note that this only applies to main(). Also, it apparently doesn't apply in C89, but does in later versions of the standard.)
In other words, the return value of main() in this example is in fact defined; my example does not, in fact, contain any undefined behavior. Surprised?
mrkgnao
https://www.amazon.com/dp/B00HCZVCTO
mrkgnao Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Apr 2009
From United States
Posted November 19, 2015
dtgreene: Do you, by any chance, have a link to any website that explains why trinary (or better yet, e-nary) is the most efficient?
(Note that I actually do have a mathematics background, so it is not a problem if that site is heavy on math.)
Tallima: It has to do with radix economy. (Note that I actually do have a mathematics background, so it is not a problem if that site is heavy on math.)
I hope you understand it better than I. :)
Also, did you know that the Russian developed a ternary computer in the 50's: https://en.wikipedia.org/wiki/Setun ?
immi101
User
immi101 Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: May 2010
From Germany
Posted November 19, 2015
immi101: hate to be nitpicking, but iirc that brings you into the murky area of "undefined behaviour". That means: yes the you can compile that, but don't you try and use the return value of that function. There is no guarantee what the compiler will put there. So while that may be legal syntax according to the standard, just add your own personal law and declare it illegal :p.
dtgreene: Actually, it appears that you are actually incorrect in this case. According to
http://stackoverflow.com/questions/18402853/must-the-int-main-function-return-a-value-in-all-compilers
the standard defines the return value of main() to be 0 if no return statement is reached. One of the answers cites § 3.6.1 from the standard.
(Note that this only applies to main(). Also, it apparently doesn't apply in C89, but does in later versions of the standard.)
In other words, the return value of main() in this example is in fact defined; my example does not, in fact, contain any undefined behavior. Surprised?
with your code: (i skipped the compile warnings)
~ $ gcc -o test test.c
~ $ ./test > /dev/null ; echo $?
1
~ $ gcc -std=c99 -o test test.c
~ $ ./test > /dev/null ; echo $?
0
but yes, that exception about main() was actually new to me. curios that they would write stuff like that into the standard.
though personally i rather remember one rule than one rule + one exception :D. And relying on that sort of implicit behaviour always calls for trouble imo. I rather keep my return 0; statement :)
gooberking
To the PIT!
gooberking Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Mar 2011
From United States
Posted November 19, 2015
gooberking: If it were up to me I would just do HTML and CSS. Writing CSS and building responsive layouts is literally the only thing I care about or think I have any business doing. I don't see a lot of postings for that sort of thing.
real.geizterfahr: That's what I do for a living (plus a lot of SEO). I do understand a thing or two when it comes to PHP and Javascript, but that's just enough to see what a piece of code does (if it isn't too complex). But my main focus lays on HTML, CSS and responsive designs (= one stylesheet for everything between a 1080p screen and a tiny iPhone 1). It took a bit to get used to designs exclusively written with % and em, but it's great to see how different a website can look on different devices (without creating separate mobile versions or stupid apps). If you're interested in responsive layouts, here's an awesome website about the power of CSS: http://www.csszengarden.com/
Every design on this site has the same HTML code! And all designs work on all kinds of devices. A great source of inspiration ;)
I knew about csszengarden but I haven't looked at it in quite some time. I think there is a lot of stuff I haven't seen.
Post edited November 19, 2015 by gooberking
rtcvb32
echo e.lolfiu_fefiipieue|tr valueof_pi [0-9]
rtcvb32 Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Aug 2013
From United States
Posted November 19, 2015
immi101: but yes, that exception about main() was actually new to me. curios that they would write stuff like that into the standard.
though personally i rather remember one rule than one rule + one exception :D. And relying on that sort of implicit behavior always calls for trouble imo. I rather keep my return 0; statement :)
The actual return value from a program can only be from 0 to 255. 0 returned means effectively the program ended with no issues. though personally i rather remember one rule than one rule + one exception :D. And relying on that sort of implicit behavior always calls for trouble imo. I rather keep my return 0; statement :)
This is heavily useful for bash and shell programming, where you attach actions based on if it succeeded or failed.
My experience with shell programming is fairly limited; But gluing programs together to make something more powerful than a single program is insanely fun (if a little annoying to debug or figure out)
Maighstir
THIS KNIGHT MISLIKES THESE HEIGHTS
Maighstir Sorry, data for given user is currently unavailable. Please, try again later. View profile View wishlist Start conversation Invite to friends Invite to friends Accept invitation Accept invitation Pending invitation... Unblock chat Registered: Nov 2008
From Sweden
Posted November 19, 2015
Question for CMD wizards. Say I have a directory tree as follows:
If I do robocopy D:\data\a E:\backup\data\a /E /COPYALL /B, a and below is correct, but how do I keep all attributes and security info from D:\data?
D:\
D:\data\
D:\data\a\
D.\data\a\some stuff
D:\data\b\
D:\data\b\other stuff
I want to copy D:\data\a\ to E:\backup\data\a\ - except I want to keep all attributes, ACLs, etc. of the data directory and below, not just from a and below. "b" and anything else in the data folder should NOT be included. D:\data\
D:\data\a\
D.\data\a\some stuff
D:\data\b\
D:\data\b\other stuff
If I do robocopy D:\data\a E:\backup\data\a /E /COPYALL /B, a and below is correct, but how do I keep all attributes and security info from D:\data?