LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-29-2019, 12:12 PM   #16
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930

Quote:
Originally Posted by Contrapak View Post
Thanks for the words of affirmation. I guess I was stuck on having to decide on two, when learning both will be just as beneficial. What I've decided to do is write all my command line-based programs in C and, if I need to interact with the web such as web scraping or interacting with an API, I'll do it in Go. The syntax is just way easier to work with in that realm.
Yes well those two thoughts, I thought, were pretty much what you wrote when you started the thread.

I think it is a very common question that people raise when they don't feel they know "any" language as well as they feel they should.

But honestly, over time you may feel, as I do, that all languages are highly similar, so the syntax isn't the biggest concern. Just like you mentioned, some are better for different things, or different environments.
 
1 members found this post helpful.
Old 05-29-2019, 12:15 PM   #17
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
For the Linux command line GDB is a great debugger. You can use it through emacs, and there are some debug interfaces which employ GDB, but make it all look more like an IDE.

My debugging blogs in my signature cover some info on how to use GDB.
 
1 members found this post helpful.
Old 05-29-2019, 12:50 PM   #18
WideOpenSkies
Member
 
Registered: May 2019
Location: /home/
Distribution: Arch Linux
Posts: 166

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by rtmistler View Post
For the Linux command line GDB is a great debugger. You can use it through emacs, and there are some debug interfaces which employ GDB, but make it all look more like an IDE.

My debugging blogs in my signature cover some info on how to use GDB.
Thanks. I have signatures turned off, but I'll research GDB.
 
Old 05-29-2019, 01:18 PM   #19
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
When people have blog entries there's also a link to the left which will bring you to their top blog page.
 
Old 06-06-2019, 07:33 AM   #20
lm8
Member
 
Registered: Oct 2012
Distribution: Debian Linux, AntiX, Win32, FreeBSD, Android
Posts: 80

Rep: Reputation: Disabled
Quote:
Originally Posted by Contrapak View Post
In terms of what I'd like to do: I'm interested in writing command-line tools, web scrapers, data formatters and other useful utilities. Sure, I can do a lot of things in Bash, but I like to write my own programs with a lower-level language.

One solution I've come up with is if I need to communicate with the Internet at all, be it hit an API or upload data to a server, I write the program in Go. Otherwise, if I want to write a computer-specific program, I write it in C.

Would love to hear from people experienced in both languages as to what my road map should be.
Just wondering why you can't use libraries like curl to do Internet connection in C. I've seen several interpreted languages that use curl underneath to do that. I've written a few programs that use Berkeley sockets to connect to the Internet. It's fairly straightforward to work with and if you're careful what functionality you use, somewhat portable across different operating systems.

If you need some libraries to help speed up the writing process in C (since most other languages use several libraries/modules/plugins, etc.), there are some interesting resources available for C. One interesting trend in C programming is the proliferation of single file and minimal libraries. You can check out projects like https://github.com/clibs/clib/wiki/Packages which try to catalog them and make them easier to incorporate in projects. If the libraries are small and readable, it's a good way to see how others solve a particular problem and whether you want to incorporate a similar solution or try something different.
 
1 members found this post helpful.
Old 06-06-2019, 08:05 AM   #21
lm8
Member
 
Registered: Oct 2012
Distribution: Debian Linux, AntiX, Win32, FreeBSD, Android
Posts: 80

Rep: Reputation: Disabled
Quote:
And C has debuggers.
Quote:
Originally Posted by Contrapak View Post
Like what? Valgrind? I use clang to compile, and that tool often provides useful error messages versus gcc.
I haven't even run across the need to use valgrind yet. gdb is good and you can build it with a ncurses/pdcurses front-end. I like CodeLite as a cross-platform GUI debugger. On Windows using MinGW, there's Dr. MinGW and StraceNT. Linux offers strace. There are several programs that let you check for memory leaks including Dr. Memory, dmalloc, electric fence, etc. There are also tools like gprof that let you know what parts of your program are taking the most time to run.
 
Old 06-06-2019, 10:26 AM   #22
WideOpenSkies
Member
 
Registered: May 2019
Location: /home/
Distribution: Arch Linux
Posts: 166

Original Poster
Rep: Reputation: 61
Thanks for your response, lm8.

Quote:
Originally Posted by lm8 View Post
Just wondering why you can't use libraries like curl to do Internet connection in C.
A lot of my projects involve gathering data from an API or scraping a website. Doing this in C, I found, was extremely difficult. Meanwhile, in Go, I can use BeautifulSoup , one of my favorite libraries ever, to get exactly what I need, while using the language's http module from its excellent standard library. I use to do this in Python but have since switched to Go.

Quote:
If you need some libraries to help speed up the writing process in C (since most other languages use several libraries/modules/plugins, etc.), there are some interesting resources available for C. One interesting trend in C programming is the proliferation of single file and minimal libraries. You can check out projects like https://github.com/clibs/clib/wiki/Packages which try to catalog them and make them easier to incorporate in projects. If the libraries are small and readable, it's a good way to see how others solve a particular problem and whether you want to incorporate a similar solution or try something different.
Thanks! I'll give this a read. I've been trying to find small web-based programs in C that I can scan. I'm still learning to read C code and jumping into massive projects is intimidating.
 
Old 06-07-2019, 06:55 AM   #23
lm8
Member
 
Registered: Oct 2012
Distribution: Debian Linux, AntiX, Win32, FreeBSD, Android
Posts: 80

Rep: Reputation: Disabled
This might be worth checking into for accessing the web:
https://github.com/curl/fcurl
 
Old 06-07-2019, 07:59 AM   #24
ugjka
Member
 
Registered: May 2015
Location: Latvia
Distribution: Arch, Centos
Posts: 368
Blog Entries: 5

Rep: Reputation: 264Reputation: 264Reputation: 264
Go was built by Google whose main business is http/networking. It just makes sense it shines in that aspect
 
Old 06-07-2019, 08:14 AM   #25
WideOpenSkies
Member
 
Registered: May 2019
Location: /home/
Distribution: Arch Linux
Posts: 166

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by lm8 View Post
This might be worth checking into for accessing the web:
https://github.com/curl/fcurl
Thanks. I read through the project and it seems promising. Though, my only concern is it hasn't been updated in three years. Nice to know there's a libcurl wrapper.

After our discussion yesterday, I spent the day writing a C program that interacts with Dictionary.com's API. The program uses basic libcurl GET functions and cJSON to work with the JSON response. The latter library was a lot easier to use than I expected. The only issue I had was needing to clean up arrays of word definitions (removing quotation marks and extra spacing). It was a fun challenge, and I plan to put it out there for those who get their own API keys and want a quick dictionary on the command line.

Quote:
Originally Posted by ugjka View Post
Go was built by Google whose main business is http/networking. It just makes sense it shines in that aspect
Indeed. It's been my go-to language for interacting with the web. I just like the challenge of working with http GET requests in C, as that is what most of my work consists of.

I wrote above about writing a program in C to get and parse JSON data. I'm curious to see how I can expand to create a BeautifulSoup-like program for C.
 
Old 06-07-2019, 04:06 PM   #26
hbina085
LQ Newbie
 
Registered: Jun 2019
Posts: 7

Rep: Reputation: Disabled
Language choices hardly matter from a technical standpoint, most of them are well developed enough that they can do pretty much anything.

The question is the human part involved :

Do you want to maintain the project for years to come?
Do you need 100% control of your program (you can't have a sudden disruption by the GC)?
Do you just want to learn or develop as a programmer?

Personally, I try to choose the right language for the job, but I find it hard to escape the apish nature of having an allegiance and disgust of other unfamiliar language (high level languages like Ruby, JS etc etc)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Machine Learning, Deep Learning 101 LXer Syndicated Linux News 0 07-20-2016 11:00 AM
Coding bootcamp learning platform and privacy issues with online learning. Need Advice ! slothbin Programming 2 04-01-2016 08:33 AM
[SOLVED] RHCSA learning... RHEL6 or CENT OS for learning shejin983 Linux - Server 4 10-27-2012 09:16 AM
E-learning learning, VLS want to help other learn? scheidel21 General 0 04-06-2010 11:19 AM
still learning about the net, can linux...? Jeffrey Linux - Networking 2 03-20-2001 09:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration