Click here to Skip to main content
15,897,226 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
QuestionPhysics problem with matplotlib.pyplot Pin
AliRahimov18-Jan-20 10:16
AliRahimov18-Jan-20 10:16 
AnswerRe: Physics problem with matplotlib.pyplot Pin
OriginalGriff18-Jan-20 10:37
mveOriginalGriff18-Jan-20 10:37 
GeneralRe: Physics problem with matplotlib.pyplot Pin
AliRahimov18-Jan-20 10:43
AliRahimov18-Jan-20 10:43 
GeneralRe: Physics problem with matplotlib.pyplot Pin
NeverJustHere18-Jan-20 10:51
NeverJustHere18-Jan-20 10:51 
GeneralRe: Physics problem with matplotlib.pyplot Pin
OriginalGriff18-Jan-20 11:02
mveOriginalGriff18-Jan-20 11:02 
RantRe: Physics problem with matplotlib.pyplot Pin
lopatir18-Jan-20 17:30
lopatir18-Jan-20 17:30 
GeneralRe: Physics problem with matplotlib.pyplot Pin
OriginalGriff18-Jan-20 20:03
mveOriginalGriff18-Jan-20 20:03 
GeneralBit twiddling is fun! Pin
honey the codewitch18-Jan-20 5:14
mvahoney the codewitch18-Jan-20 5:14 
I got my Pike Virtual Machine for running regexs coded and it's a fun little widget;

L0000: split L0001, L0008, L0020, L0024
L0001: save 0
L0002: set "A".."Z", "_", "a".."z"
L0003: split L0004, L0006
L0004: set "0".."9", "A".."Z", "_", "a".."z"
L0005: jmp L0003
L0006: save 1
L0007: match 0
L0008: save 0
L0009: split L0010, L0012
L0010: char "0"
L0011: jmp L0018
L0012: split L0013, L0014
L0013: char "-"
L0014: set "1".."9"
L0015: split L0016, L0018
L0016: set "0".."9"
L0017: jmp L0015
L0018: save 1
L0019: match 1
L0020: save 0
L0021: set "\t", "\n", "\v", "\f", "\r", " "
L0022: save 1
L0023: match 2
L0024: save 0
L0025: any
L0026: save 1
L0027: match -1


That lexes a regex with an id (match 0), integer (match 1) or whitespace (match 2)

My little compiler generated that when I called this:

C#
int[][] prog = Regex.CompileLexer(
	@"[A-Z_a-z][A-Z_a-z0-9]*", // id
	@"0|(\-?[1-9][0-9]*)", // int
	@"[ \t\r\n\v\f]" // space
);


The instructions are encoded as an array of ints per, while the overarching instruction stream is int[][]. This way i can pass it around without requiring dependencies, and I can implement the VM/interpreter in an outside library without requiring a reference to an Instruction class or something.

The thing that's cool about this machine is it's cooperatively threaded. I'm tickled about that. Split jumps to multiple locations "at the same time." so it's concurrent. In reality this was a neat trick wherein i interleave the execution of each thread so i don't have to backtrack over the input.

It's the coolest project I've made this year, and the article is already getting underrated at codeproject. Laugh | :laugh:

I think people ph33r regex.

Still, it's so much fun.

Thanks @BillWoodruff for finding my bug that inspired my misguided .NET unicode rant
Real programmers use butterflies


modified 18-Jan-20 11:27am.

GeneralRe: Bit twiddling is fun! Pin
Marc Clifton18-Jan-20 12:16
mvaMarc Clifton18-Jan-20 12:16 
GeneralRe: Bit twiddling is fun! Pin
honey the codewitch18-Jan-20 13:15
mvahoney the codewitch18-Jan-20 13:15 
GeneralRe: Bit twiddling is fun! Pin
Mark_Wallace18-Jan-20 21:02
Mark_Wallace18-Jan-20 21:02 
GeneralRe: Bit twiddling is fun! Pin
Marc Clifton19-Jan-20 1:59
mvaMarc Clifton19-Jan-20 1:59 
GeneralRe: Bit twiddling is fun! Pin
honey the codewitch19-Jan-20 2:01
mvahoney the codewitch19-Jan-20 2:01 
GeneralRe: Bit twiddling is fun! Pin
Super Lloyd18-Jan-20 17:09
Super Lloyd18-Jan-20 17:09 
Generalquote of the month Pin
BillWoodruff17-Jan-20 22:11
professionalBillWoodruff17-Jan-20 22:11 
GeneralRe: quote of the month Pin
honey the codewitch18-Jan-20 5:37
mvahoney the codewitch18-Jan-20 5:37 
RantRe: quote of the month Pin
lopatir18-Jan-20 5:46
lopatir18-Jan-20 5:46 
GeneralRe: quote of the month Pin
BillWoodruff18-Jan-20 6:14
professionalBillWoodruff18-Jan-20 6:14 
GeneralRe: quote of the month Pin
Gerry Schmitz18-Jan-20 7:11
mveGerry Schmitz18-Jan-20 7:11 
GeneralThe most annoying GDPR "cookie" acceptance I've met so far. Pin
OriginalGriff17-Jan-20 8:08
mveOriginalGriff17-Jan-20 8:08 
GeneralRe: The most annoying GDPR "cookie" acceptance I've met so far. Pin
Ravi Bhavnani17-Jan-20 8:20
professionalRavi Bhavnani17-Jan-20 8:20 
GeneralRe: The most annoying GDPR "cookie" acceptance I've met so far. Pin
  Forogar  17-Jan-20 9:11
professional  Forogar  17-Jan-20 9:11 
GeneralRe: The most annoying GDPR "cookie" acceptance I've met so far. Pin
OriginalGriff17-Jan-20 10:47
mveOriginalGriff17-Jan-20 10:47 
GeneralRe: The most annoying GDPR "cookie" acceptance I've met so far. Pin
Maximilien17-Jan-20 10:43
Maximilien17-Jan-20 10:43 
GeneralRe: The most annoying GDPR "cookie" acceptance I've met so far. Pin
OriginalGriff17-Jan-20 10:55
mveOriginalGriff17-Jan-20 10:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   23 votes