Software Development and Programming Careers (Official Discussion Thread)

Takerstani

Extraterrestrial
Supporter
Joined
May 1, 2012
Messages
2,480
Reputation
120
Daps
1,787
I'm up for my first backend job and I have a homework assignment that I'm working through, but I can't figure out how to properly parse a binary(dat) file? Anyone have experience with this? In Javascript

Been learning Python and I'm not a fan of the indentation thing at all like who thought that was a good idea :gucci:

I work almost exclusively with JS, now, but I learned Python, as well. I love Python, but was actually a minus for me, I like the semicolon at the end with JS, contrary to a lot of other people. It provides a certain structure. I grew used to making sure the indentation was right and code editors helped a lot, because many did it automatically. Python is my favorite programming language, but I hated Django so much, I had to go in another direction, preferring backend programming.
 

Matt504

YSL as a gang must end
Joined
Sep 7, 2013
Messages
45,088
Reputation
14,687
Daps
272,837
I'm up for my first backend job and I have a homework assignment that I'm working through, but I can't figure out how to properly parse a binary(dat) file? Anyone have experience with this? In Javascript

can you share any more details on this homework assignment?
 

Takerstani

Extraterrestrial
Supporter
Joined
May 1, 2012
Messages
2,480
Reputation
120
Daps
1,787
can you share any more details on this homework assignment?

They give the fields/section headers of each section of information, and we have to parse the dat file and do calculations on these records by field. For instance, calculate the number of credits and find information by user ID. The delimiter is "|"
 

Matt504

YSL as a gang must end
Joined
Sep 7, 2013
Messages
45,088
Reputation
14,687
Daps
272,837
They give the fields/section headers of each section of information, and we have to parse the dat file and do calculations on these records by field. For instance, calculate the number of credits and find information by user ID. The delimiter is "|"

In that case, it should be no different than parsing a csv, if you don't mind parsing the dat file, I can give it a shot and share my strategy via jsbin.com
 

TrebleMan

Superstar
Joined
Jul 29, 2015
Messages
5,592
Reputation
1,180
Daps
17,541
Reppin
Los Angeles
What are some common algorithm questions any other front end engineers here get? Going to start studying up on some algos/data structures.
 

TrebleMan

Superstar
Joined
Jul 29, 2015
Messages
5,592
Reputation
1,180
Daps
17,541
Reppin
Los Angeles

PikaDaDon

Thunderbolt Them Suckers
Joined
Oct 13, 2012
Messages
9,361
Reputation
2,345
Daps
25,316
Reppin
NULL
God I love Kotlin

Code:
val f:File = File( "test.dat" )
val a = ByteArray(100 ) { floor(Math.random() * 20).toByte() }
f.writeBytes( a )

test.dat
Code:
؎Ĉऌ̀ሐĀਂခ؊ጏࠐఄఉግȓጒ    Г༃ላଏ༑ጓഄጊȆऌओଐဆଊఀ܅č጑ȃ܂ऍԉଋࠊБȀĀጂЌጏĎ

Code:
val a:ByteArray = readByteFromFile( "test.dat" )

val b:Stream<Byte> = a.toList().stream()
b.filter{ it % 2 == 0 }
    .distinct()
    .sorted()
    .forEach{ print("$it ") }

fun readByteFromFile(fileName:String): ByteArray = File(fileName).readBytes()
 

TrebleMan

Superstar
Joined
Jul 29, 2015
Messages
5,592
Reputation
1,180
Daps
17,541
Reppin
Los Angeles

I'm learning Kotlin right now too, really interested in the Arrow-kt library.

I want an alternative to Haskell (spectacular language, but makes some easy things like debugging difficult and the library system + ecosystem are weak) and don't like Scala that much. Kotlin looks a lot less verbose than Scala.

That language is growing real quick.
 
Last edited:
Top