• Welcome to BellGab.com Archive.
 

Programming

Started by area51drone, April 17, 2014, 07:21:42 AM

area51drone

I just found this handy little diff script I thought I'd share.   I sometimes use javascript to quickly code up tools for my business, and this came in handy to compare lists of things for me.

http://ejohn.org/projects/javascript-diff-algorithm/

wr250

Quote from: area51drone on April 17, 2014, 07:21:42 AM
I just found this handy little diff script I thought I'd share.   I sometimes use javascript to quickly code up tools for my business, and this came in handy to compare lists of things for me.

http://ejohn.org/projects/javascript-diff-algorithm/

i typically use bash or python scripts for assorted things

like :
ls > ls.txt
while read i
do
  lame -b 128 "$i"
done <ls.txt
rm ls.txt

re-encodes mp3s in current folder to 128kbs

Quote from: area51drone on April 17, 2014, 07:21:42 AM
I just found this handy little diff script I thought I'd share.   I sometimes use javascript to quickly code up tools for my business, and this came in handy to compare lists of things for me.

http://ejohn.org/projects/javascript-diff-algorithm/

Huh that's a cool little Javascript. I am guessing by lists you mean like lists of things in real talk not the data structure list.

I clicked on some of this guy's other research (art recognition) and its good stuff. I am going to send him a message. Thank you.

area51drone

Quote from: Mind Flayer Monk on April 17, 2014, 07:43:54 AM
Huh that's a cool little Javascript. I am guessing by lists you mean like lists of things in real talk not the data structure list.

I clicked on some of this guy's other research (art recognition) and its good stuff. I am going to send him a message. Thank you.

Well, it's a structured data list.  I give my supplier a list of goods that I expect to get, and they tell me what they're shipping us.   I have to copy and past their list from a PDF, which is a bunch of crap that I filter, format and sort using javascript to get it into the same structure that I sent it over to them.  Then I can compare.   I have to be able to visually look at the data, so I was putting it in two text areas, and for the last year or so I was just doing a string compare against each other to make sure they were the same - basically we're getting what I asked them to ship us.   If the lists weren't correct, and there 100-300 items typically on the list so a visual scan usually doesn't work, then I copied and pasted them into text files and put them into windiff.  That's an extra step that I can avoid now with this script.   

I don't care that he stole it from somewhere else, it's a great tool.

area51drone

Quote from: wr250 on April 17, 2014, 07:29:19 AM
i typically use bash or python scripts for assorted things

like :
ls > ls.txt
while read i
do
  lame -b 128 "$i"
done <ls.txt
rm ls.txt

re-encodes mp3s in current folder to 128kbs

You're running in linux though, right?

Also, using javascript, simple tools for my business are easily cross platform, and I can push them to all of our computers just by changing one place.  The next time anyone uses their browser, they get the update.    I have tools for all kinds of things.    In my work I have a very large suite of programs that I wrote using c#, php, mysql, dos batch and obviously html and javascript.  I have used java in the past to do some things as well, but i find now that I can get things done quicker in c#.

wr250

Quote from: area51drone on April 17, 2014, 09:41:57 AM
You're running in linux though, right?

Also, using javascript, simple tools for my business are easily cross platform, and I can push them to all of our computers just by changing one place.  The next time anyone uses their browser, they get the update.    I have tools for all kinds of things.    In my work I have a very large suite of programs that I wrote using c#, php, mysql, dos batch and obviously html and javascript.  I have used java in the past to do some things as well, but i find now that I can get things done quicker in c#.

yes i run linux. and your right javascript is portable. c# is not so portable, many,but not all, c# apps will run under mono . that said ,i am far from a programmer, i use the tools i have in front of me.

Foodlion

Quote from: area51drone on April 17, 2014, 09:41:57 AM
You're running in linux though, right?

Also, using javascript, simple tools for my business are easily cross platform, and I can push them to all of our computers just by changing one place.  The next time anyone uses their browser, they get the update.    I have tools for all kinds of things.    In my work I have a very large suite of programs that I wrote using c#, php, mysql, dos batch and obviously html and javascript.  I have used java in the past to do some things as well, but i find now that I can get things done quicker in c#.
I give you props for Java. I'm taking a Java course and most everyone besides the guys who already took C++ are popping veins trying to keep up.


Quote from: area51drone on April 17, 2014, 09:38:49 AM
Well, it's a structured data list.  I give my supplier a list of goods that I expect to get, and they tell me what they're shipping us.   I have to copy and past their list from a PDF, which is a bunch of crap that I filter, format and sort using javascript to get it into the same structure that I sent it over to them. 

I don't know if your auto generating your sales listings as well, but you probably could use the code in some way to get the best listing to post under since sometimes books have multiple listings for the same title (just with a word or two changed or other small variations in the title).

area51drone

Quote from: Foodlion on April 17, 2014, 03:57:48 PM
I give you props for Java. I'm taking a Java course and most everyone besides the guys who already took C++ are popping veins trying to keep up.

I used to teach java at a community college.  That was a while ago now.  I find any language without pointers that has garbage collection to be far far easier to work with than c or c++.  Especially doing any real work with c++ for windows development... ugh.   I haven't used eclipse in a while, but the RAD tools for Java are not as good as MS's dev studio, IMO.    I know c# is supposed to be cross platform, but, let's face it, yea right.  At least not without a lot of knowledge of how to get it to build, compile and run in another platform.    Java certainly makes better strides in that area and if I were making a commercial for sale application that wasn't focused solely on the windows market, I would consider developing in it again.   And, I should say, that I do plan on doing some android app development which will bring me back to eclipse and java once again here hopefully in the nearer future.

Quote
I don't know if your auto generating your sales listings as well, but you probably could use the code in some way to get the best listing to post under since sometimes books have multiple listings for the same title (just with a word or two changed or other small variations in the title).

I'm auto generating quite a lot, and here's a little secret, I list the same item under multiple listings and just hope that no one buys more than I have for sale before I get the inventory to update again in the next 20 minutes.

Quote from: Foodlion on April 17, 2014, 03:57:48 PM
I give you props for Java. I'm taking a Java course and most everyone besides the guys who already took C++ are popping veins trying to keep up.

Foodlion, try writing some code the first time with things you like instead of the problems you are assigned.
If I remember correctly, the first classes are programming things like a cash register or something to give you a student's ID number.
I think its easy to lose interest in those topics.

When I was learning I would try to write a similar code to the homework, but I would use football scores and betting lines (at that time none of this stuff was online, all of it was paper-based and you would buy paper scouting reports and then go over results in the newspaper). Helped the time go by faster and kept me interested in solving a puzzle, not just trying to complete an assignment.  You could try the same with whatever you like-guns, UFC fight results, music, etc.
Also, I like the Javabat (codingbat.com) to practice syntax.

I really like this guy area51 linked. He has a nice post called "Write Code Every Day".
http://ejohn.org/blog/write-code-every-day/

Foodlion

Quote from: Mind Flayer Monk on April 17, 2014, 11:23:18 PM
Foodlion, try writing some code the first time with things you like instead of the problems you are assigned.
If I remember correctly, the first classes are programming things like a cash register or something to give you a student's ID number.
I think its easy to lose interest in those topics.

When I was learning I would try to write a similar code to the homework, but I would use football scores and betting lines (at that time none of this stuff was online, all of it was paper-based and you would buy paper scouting reports and then go over results in the newspaper). Helped the time go by faster and kept me interested in solving a puzzle, not just trying to complete an assignment.  You could try the same with whatever you like-guns, UFC fight results, music, etc.
Also, I like the Javabat (codingbat.com) to practice syntax.



I really like this guy area51 linked. He has a nice post called "Write Code Every Day".
http://ejohn.org/blog/write-code-every-day/

You pretty much nailed it. Abstract Student classes using polymorphism, then setters and getters then you name it, then using special APIs to show the different methods available and so on. However we don't learn as much as someone would think. Even the stuff we do do is just repetitive copy, paste and often I find myself stumped at the end of the day when I want to write code from scratch. I'm like.... ok if I want to write programming for a dinosaur database then I'm good cause we covered that.... but we didn't cover a lot of the theories needed to do full programs that some one would take interest to.

The semester is over in 2 weeks, then I'm moving on independently. Working for a company doing Java seems unappealing to me., I would rather write apps or indie games on my own. That's just not something these classes teach. They teach you how to work inside a company with other programmers and It's just not my thing.

I most certainly will look into that link you mentioned, but won't be back into town until Sunday. So I'll check it out then. Thanks.

Edit: sorry was busy getting ready for my day and forgot to add info to the picture I included. I wanted to show you my current project. Designing a 2.5d point and click game. I'm hoping it's structure is designed well because it will take me maybe a year to complete adding in the path finding A* algorithms and AI. Do you think making items in game is best to use Arrays or is there a better method? Just brain storming at this point.

Foodlion

Sorry for the above post being so messy. I shouldn't write posts 10 minutes after waking up lol. I finally got a few cups for coffee in and a smoke. I'm going to be out of town the rest of today til Sunday, so if I don't respond you know why.




area51drone

Quote from: Foodlion on April 18, 2014, 06:55:04 AM
Do you think making items in game is best to use Arrays or is there a better method?

Hmmm.  Arrays are pretty generic, I don't know what you're doing but it's almost impossible not to use arrays when coding.    Almost every set of data objects you will find is some type of array.   

Don't discount your classes.  What you are learning are the fundamentals of programming.  They can't teach you everything.    The classes I taught, I had my students program a game in the advanced course, which it sounds like maybe you're in if you're learning objects and polymorphism.  What I'm saying is you can take what you learn and apply it in any direction, in any programming language.

If you are talking about easy or fast access to data,  it just depends on the situation.   Data structures are a whole subject in themselves, I took a course on just them in college.  We used this book, at the time (an older edition of it):

http://www.amazon.com/dp/013284737X

Here it is in plain C:

http://www.amazon.com/dp/0201498405

I'm sure there are ones out there on Java, C# etc.  But the concept is the same across all languages (for the most part), and most of the structures and algorithms that operate on them have already been implemented in whatever language you happen to be using.   Even if they aren't included in the regular libraries, you can probably find someone who open sourced their version.

It's a fascinating subject that I wish I had more time to explore.  Data structures play a key element in advanced AI.

area51drone

I am trying to find this old c++ book I had in the 90's, it had a really cool quiz program it came with that helped teach you.   Anyway, in looking for it, I came across this site:

http://freecomputerbooks.com/

Very cool!

Just found the book on one of my shelves, it was called Master C++.  Now if I just have the floppy it came with.   Looks like they remade it for windows - I had the dos version.   I just bought a used copy of the newer version, I hope the disk is in it.    This may have been the best programming teacher I ever had.   As you can see, I'm not the only one who thinks so:

http://www.amazon.com/dp/157169000X

Kudos to anyone who can find the program for me.

Quote from: Foodlion on April 18, 2014, 06:55:04 AM
Do you think making items in game is best to use Arrays or is there a better method? Just brain storming at this point.

Since items tend to change alot and be dropped alot I would probably use a linked list over an array.
The linked list would contain nodes, each of them an item object.

area51drone

Quote from: Mind Flayer Monk on April 18, 2014, 03:34:47 PM
Since items tend to change alot and be dropped alot I would probably use a linked list over an array.
The linked list would contain nodes, each of them an item object.

It might be more advantageous to have a static array of all the items with booleans or ints that determine whether or not or how many of that particular item is being carried.   It really just depends on the situation.   If you are seriously concerned about memory usage or speed, then you will need to profile your code.   I highly doubt you are going to run into a problem unless you are just going crazy with how many items you are trying to store.

I also meant to tell you that developing code for a multi-developer environment is very typical.  I never worked for any company where there was just one programmer on a project.    You should also try to write your code so that it is resuable in other projects you or others may create in the future so you're not wasting your time reinventing the wheel.    Absorb as much as you can from your class and your textbook!


Powered by SMFPacks Menu Editor Mod