• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

What's your setup? Does anyone here do programming on mobile devices? I'm looking for a IDE on Android or iOS (jailbroken?) so I can do some coding on my phone instead of wasting time on GAF...

For android I like cctools and TerminalIDE

For PC dev I use whatever is appropriate. Mainly windows based so Monodevelop with C# (Unity/PSM), IntelliJ for Java, for C/C++ I use Visual Studio when I'm asked too otherwise I use Mingw + gcc + SublimeText because it's easier for me to go cross-platform that way. For working on *nix platforms I use Vim if there's no windows manager, otherwise Geany.
 

r1chard

Member
In my experience, TDD is a guide:

* "write the test first" is the guideline.
* "write the test" is the rule.

You can get into serious trouble (as it, some seriously screwed up code design) when you're writing tests first for interfaces that are incomplete. I'd say the majority of tests I write are written after the code is.

As long as you stick with "when I check code in, it is well tested", you'll be ok.

Yep I'm the same, though I've found that writing tests first can really help with getting the interface right. If the interface is a little bizarro in places I can detect that sometimes with the tests early on.
 

Husker86

Member
I'm working on a Python script to parse tweets (part of Coursera course).

Anyway, I want to filter out all words with certain characters in them. It's partly working so far, I am filtering strings with 'http', 'RT', '/', but then I run into an issue with '\'--I assume because it's an escape character. I've tried writing it as '\\', but I still see strings in my list with plenty of \ in them.

Here is the statement I'm using, and the first three are working fine, it's the last part of the if statement that isn't filtering (no errors, it's just not working).

Code:
words = jLine['text'].split()
for junk in words:
   if junk == 'RT' or 'http' in junk or '/' in junk or '\\' in junk:
      words.remove(junk)

What am I missing?
 
I'm working on a Python script to parse tweets (part of Coursera course).

Anyway, I want to filter out all words with certain characters in them. It's partly working so far, I am filtering strings with 'http', 'RT', '/', but then I run into an issue with '\'--I assume because it's an escape character. I've tried writing it as '\\', but I still see strings in my list with plenty of \ in them.

Here is the statement I'm using, and the first three are working fine, it's the last part of the if statement that isn't filtering (no errors, it's just not working).

Code:
words = jLine['text'].split()
for junk in words:
   if junk == 'RT' or 'http' in junk or '/' in junk or '\\' in junk:
      words.remove(junk)

What am I missing?

Have you tried adding some brackets to enforce the operator precedence you want?
 

Husker86

Member
Have you tried adding some brackets to enforce the operator precedence you want?

No, I haven't. I'll give that a shot. Python is actually weird for me since I use parentheses like crazy in Java, but have been led to believe it's not always necessary in Python. I may have gone a little overboard in the other direction.

I've changed my approach to this problem though. I made a list of junk words and am checking if anything in that list is present in the each word from the tweet. That's not really working either...

Just using one junk item as an example, 'http'. Some strings with 'http' get filtered out, but I will still see elements in my list that have 'https://blahblahblah....". I'm not sure why that's not getting filtered.
 

leroidys

Member
I'm working on a Python script to parse tweets (part of Coursera course).

Anyway, I want to filter out all words with certain characters in them. It's partly working so far, I am filtering strings with 'http', 'RT', '/', but then I run into an issue with ''--I assume because it's an escape character. I've tried writing it as '', but I still see strings in my list with plenty of in them.

Here is the statement I'm using, and the first three are working fine, it's the last part of the if statement that isn't filtering (no errors, it's just not working).

Code:
words = jLine['text'].split()
for junk in words:
   if junk == 'RT' or 'http' in junk or '/' in junk or '' in junk:
      words.remove(junk)

What am I missing?

You want to check equality with junk for each part of your statement.

(Blah == stuff) or ("blah")

Will always be true.

Edit: sorry. That's not the issue. I'm on my phone and didn't realize the last "in junk" was cut off on my screen.
 

Tamanon

Banned
I'm working on a Python script to parse tweets (part of Coursera course).

Anyway, I want to filter out all words with certain characters in them. It's partly working so far, I am filtering strings with 'http', 'RT', '/', but then I run into an issue with '\'--I assume because it's an escape character. I've tried writing it as '\\', but I still see strings in my list with plenty of \ in them.

Here is the statement I'm using, and the first three are working fine, it's the last part of the if statement that isn't filtering (no errors, it's just not working).

Code:
words = jLine['text'].split()
for junk in words:
   if junk == 'RT' or 'http' in junk or '/' in junk or '\\' in junk:
      words.remove(junk)

What am I missing?

I would actually go about it a different way. Instead of making a bunch of or statements, make another array with your filter words in it.

Code:
words = jLine['text'].split()
filter = ['RT','http','/','\\']
for junk in words:
  if junk in filter:
    words.remove(junk)

This way it makes the code easier to read and maintain if you wanted to filter more or less out. You might have to escape the '/' one though, and make it '//', I forget.

Hmm, might not work in my case, you're not splitting it the way I thought.
 

Husker86

Member
I would actually go about it a different way. Instead of making a bunch of or statements, make another array with your filter words in it.

Code:
words = jLine['text'].split()
filter = ['RT','http','/','\\']
for junk in words:
  if junk in filter:
    words.remove(junk)

This way it makes the code easier to read and maintain if you wanted to filter more or less out. You might have to escape the '/' one though, and make it '//', I forget.

Hmm, might not work in my case, you're not splitting it the way I thought.

Yeah, I actually switched to that (but I have to switch it up and iterate through filter list since the items in filter can potentially be only substrings of junk). But it's still not working. It does remove 'RT', but it's not really working on anything else. I can only assume it's because 'RT' is the full value, and the other things will only be part of the string that is junk. But from everything I've read, you can search for substrings in strings by using "if <substring> in <string>", so that's where I'm confused.
 

Tamanon

Banned
Yeah, I actually switched to that (but I have to switch it up and iterate through filter list since the items in filter can potentially be only substrings of junk). But it's still not working. It does remove 'RT', but it's not really working on anything else. I can only assume it's because 'RT' is the full value, and the other things will only be part of the string that is junk. But from everything I've read, you can search for substrings in strings by using "if <substring> in <string>", so that's where I'm confused.

How about trying this?

Code:
words = jLine['text'].split()
filter = ['RT','http','/','\\']
for junk in words:
  for q in filter:
    if q in junk:
      words.remove(junk)

Basically, iterating through the filter list and checking that substring against the junk word.
 

oxrock

Gravity is a myth, the Earth SUCKS!
How about trying this?

Code:
words = jLine['text'].split()
filter = ['RT','http','/','\\']
for junk in words:
  for q in filter:
    if q in junk:
      words.remove(junk)

Basically, iterating through the filter list and checking that substring against the junk word.

This is looking like the better way to do it. Otherwise you're simply checking if that exact string is in the junk list, so it won't catch simple variations like "https".

Edit: Upon further thought, simply put https in the junk list and it will catch both 'http' and 'https'. I don't believe 'https' will be filtered out as things stand currently.
 

Husker86

Member
How about trying this?

Code:
words = jLine['text'].split()
filter = ['RT','http','/','\\']
for junk in words:
  for q in filter:
    if q in junk:
      words.remove(junk)

Basically, iterating through the filter list and checking that substring against the junk word.

That's what I ended up with last night! The '\' still isn't getting filtered, even as '\\'. But I actually think it's part of unicode characters, so I think I need to re-encode(?) those and not just filter them out. Though, they are probably a different language which means I can ignore them. Or I'm just completely misunderstanding character encoding.

This is looking like the better way to do it. Otherwise you're simply checking if that exact string is in the junk list, so it won't catch simple variations like "https".

Edit: Upon further thought, simply put https in the junk list and it will catch both 'http' and 'https'. I don't believe 'https' will be filtered out as things stand currently.

And this is what I don't understand. If 'http' in my list filters out http://www.google.com, why wouldn't it filter https://www.google.com?

I lazily haven't tried this with a text file that I made myself. I've been using actual twitter data. I think I just need to make my own text file for my script to read and verify that the filter works before moving on to real data. Maybe it does "work", but for some other reason it's not triggering in the twitter data.

Thanks for the feedback!
 

oxrock

Gravity is a myth, the Earth SUCKS!
That's what I ended up with last night! The '\' still isn't getting filtered, even as '\\'. But I actually think it's part of unicode characters, so I think I need to re-encode(?) those and not just filter them out. Though, they are probably a different language which means I can ignore them. Or I'm just completely misunderstanding character encoding.



And this is what I don't understand. If 'http' in my list filters out http://www.google.com, why wouldn't it filter https://www.google.com?

I lazily haven't tried this with a text file that I made myself. I've been using actual twitter data. I think I just need to make my own text file for my script to read and verify that the filter works before moving on to real data. Maybe it does "work", but for some other reason it's not triggering in the twitter data.

Thanks for the feedback!

string1 = 'http'
string2 = 'https'

if string1 in string2: #this evaluations to True because that string is part of string2

if string2 in string1: #evaluate to False because although they share most characters, string2 exceeds string1. It's too big to be within the other.

Also, if you're looking to compare strings, you have to bring it down to the string level. If your looking for a string within a list or dict, it'll look for an exact match. Going with a for iteration allows you to compare string with string as opposed to just looking for a precise duplicate.
 

Husker86

Member
string1 = 'http'
string2 = 'https'

if string1 in string2: #this evaluations to True because that string is part of string2

if string2 in string1: #evaluate to False because although they share most characters, string2 exceeds string1. It's too big to be within the other.

Also, if you're looking to compare strings, you have to bring it down to the string level. If your looking for a string within a list or dict, it'll look for an exact match. Going with a for iteration allows you to compare string with string as opposed to just looking for a precise duplicate.

Sorry, I wasn't clear, I did end up with what Tamanon posted. So I iterate through the list and check if that is in the string. So I should, at some point in the loop, have
Code:
if 'http' in 'https://www.google.com'
But I still see https junk in my words list.

I'll try with my own data tonight to make sure it's working. I'm sure there is some other reason it's not working with the live data, but for now I suppose adding a few more things to the filter list won't be a big issue.
 

oxrock

Gravity is a myth, the Earth SUCKS!
Sorry, I wasn't clear, I did end up with what Tamanon posted. So I iterate through the list and check if that is in the string. So I should, at some point in the loop, have
Code:
if 'http' in 'https://www.google.com'
But I still see https junk in my words list.

I'll try with my own data tonight to make sure it's working. I'm sure there is some other reason it's not working with the live data, but for now I suppose adding a few more things to the filter list won't be a big issue.

It might be a good idea to just print out your iterations of text.split() and see what exactly it looks like and how it compares to your expectations.
Code:
test = [ 'https://www.google.com','blah', 'meaningless text']  #text.split()  equivalent

for i in test:
     if 'http' in i:
          test.remove(i)

This is what I'm lead to believe is essentially happening. If that's the case, it'll definitely work. I don't know the content of the text you're splitting but I'm thinking any issues your encountering must be there.
 

Roubjon

Member
I wrote my first multithreading program today, I haven't smiled so widely after writing something in a long time. The increased efficiency is crazy.
 

Kansoku

Member
Chrome keeps being a pain in the ass.
Does someone know of a way that I can synchronously communicate between a content script and background.js? I am trying to access chrome://favicon/<url> from the content script, but it says it's not possible to load the local resource, so I'm trying to grab it on the background, do what I have to do with it and send it back to the content script, but due to it's asynchronous nature, the object I return is used before the response comes (but it's null then, and it gives me errors).
 

oxrock

Gravity is a myth, the Earth SUCKS!
I wrote my first multithreading program today, I haven't smiled so widely after writing something in a long time. The increased efficiency is crazy.

multithreading is a godsend when using a program to parse websites. Instead of waiting a minute plus for a page to connect and load to read the content, you can have 50 pages loading concurrently and screw waiting on individuals! :)
 

Slavik81

Member
multithreading is a godsend when using a program to parse websites. Instead of waiting a minute plus for a page to connect and load to read the content, you can have 50 pages loading concurrently and screw waiting on individuals! :)
You can actually do that without multi-threading by using event-driven programming. Just avoid blocking calls and it would probably work fine even on a single thread.

I wrote my first multithreading program today, I haven't smiled so widely after writing something in a long time. The increased efficiency is crazy.
If you avoid global state, it's easy to do, too. I got a ~4x speedup on my raytracer in ~10 minutes of work using std::thread.
 

MNC

Member
Yo ProgrammingGaf. For my job I need to get some c/c++ experience. I already know java/c#. Any good tutorials or core principle explanations? What makes c/c++ good? C is like a scripting language and has no "classes",, right?
 
Yo ProgrammingGaf. For my job I need to get some c/c++ experience. I already know java/c#. Any good tutorials or core principle explanations? What makes c/c++ good? C is like a scripting language and has no "classes",, right?

First, you should know whether you're programming in C or C++ because even if people say C/C++, they are actually very different languages, especially nowadays. Modern C is not a sub-set of C++ anymore and modern C++ doesn't use many features from C. C doesn't have classes but it's pretty far from a scripting language, since it's compiled and very low-level.

A great C++ book is Accelerated C++, it's not a huge book like the C++ Primer (which is also very good, but intimidating and goes into a lot of detail). It does not cover C++11 features, but apart from that, it's great.

As for C books, The C Programming Language (Kerningham, Ritchie) is a classic and kinda the only C book you need.

If you don't want to buy books, there's cppreference.com.
 

tuffy

Member
As for C books, The C Programming Language (Kerningham, Ritchie) is a classic and kinda the only C book you need.
Although K&R is probably still the best way to learn the language, I'd actually recommend C: A Reference Manual for day-to-day usage. It not only breaks down the differences between "traditional" C, C89 and C99, but also covers standard libraries with a lot more detail.
 

faint.

Member
I'm looking to brush up on some introductory java before I take my second part of the course this fall. Do you guys have any recommendations on where to start? I was hoping to find some sort of online equivalent similar to what codeacademy offers but so far I'm out of luck.

Looking at the OP I see some tutorials by thenewsboston and the like. Would that be my best starting point? Or is there something similar to codeacademy that I may have glanced over?

Thanks!
 

oxrock

Gravity is a myth, the Earth SUCKS!
I'm looking to brush up on some introductory java before I take my second part of the course this fall. Do you guys have any recommendations on where to start? I was hoping to find some sort of online equivalent similar to what codeacademy offers but so far I'm out of luck.

Looking at the OP I see some tutorials by thenewsboston and the like. Would that be my best starting point? Or is there something similar to codeacademy that I may have glanced over?

Thanks!

Udacity has a beginner java course.
 

Husker86

Member
I'm looking to brush up on some introductory java before I take my second part of the course this fall. Do you guys have any recommendations on where to start? I was hoping to find some sort of online equivalent similar to what codeacademy offers but so far I'm out of luck.

Looking at the OP I see some tutorials by thenewsboston and the like. Would that be my best starting point? Or is there something similar to codeacademy that I may have glanced over?

Thanks!

My first exposure to programming was Travis' Android tutorials for thenewboston. If he does the Java ones then I'd recommend them. He tries to make it not boring.
 

hateradio

The Most Dangerous Yes Man
Chrome keeps being a pain in the ass.
Does someone know of a way that I can synchronously communicate between a content script and background.js? I am trying to access chrome://favicon/<url> from the content script, but it says it's not possible to load the local resource, so I'm trying to grab it on the background, do what I have to do with it and send it back to the content script, but due to it's asynchronous nature, the object I return is used before the response comes (but it's null then, and it gives me errors).
Don't you have to use some kind of message passing?

https://developer.chrome.com/extensions/messaging

Code:
if 'http' in 'https://www.google.com'
But I still see https junk in my words list.
It seems to work fine.

Personally, I wouldn't check for "/" because it would filter out something like "and/or" which may affect the readability of the sentence. Unless that's okay.

Code:
line = "you're crazy! RT @somebody do you think https://neogaf.com is cool and/or crazy? \\"

words = line.split()

print(words)

filters = ['RT', 'http', '\\', '/']

for word in words:
    for f in filters:
        if f in word:
            words.remove(word)
        
            # this will prevent the script from trying to remove the word
            # multiple times if there are multiple matches
            break

print(words)

# result - notice that and/or is removed
["you're", 'crazy!', 'RT', '@somebody', 'do', 'you', 'think', 'https://neogaf.com', 'is', 'cool', 'and/or', 'crazy?', '\\']
["you're", 'crazy!', '@somebody', 'do', 'you', 'think', 'is', 'cool', 'crazy?']
 

mltplkxr

Member
I'm looking to brush up on some introductory java before I take my second part of the course this fall. Do you guys have any recommendations on where to start? I was hoping to find some sort of online equivalent similar to what codeacademy offers but so far I'm out of luck.

Looking at the OP I see some tutorials by thenewsboston and the like. Would that be my best starting point? Or is there something similar to codeacademy that I may have glanced over?

Thanks!
I was about to answer this post with some book suggestions but I wonder, are books and old-style text tutorials outdated now to learn computer programming subjects?
 

Water

Member
I was about to answer this post with some book suggestions but I wonder, are books and old-style text tutorials outdated now to learn computer programming subjects?

Why on earth would they be outdated?
That said, interactive course-type things are compelling in a different way and easier to see through, I presume faint was specifically looking for that instead of books.
 

mltplkxr

Member
Why on earth would they be outdated?
That said, interactive course-type things are compelling in a different way and easier to see through, I presume faint was specifically looking for that instead of books.

Before, to learn a new a language, one of the first questions would be "What's the best book to get started?". More and more, the question I see is "What's a good online course/tutorial to learn X?".

Books will never be outdated, but it seems their role is moving into reference and specialization.
 

Husker86

Member
It seems to work fine.

Personally, I wouldn't check for "/" because it would filter out something like "and/or" which may affect the readability of the sentence. Unless that's okay.

Yeah, there must have been something else going on...I eventually just gave up and let some "junk" pass through since it wasn't enough to affect the final result.

Anyway, this is the first time using actual, real-world data in programming for me and it's incredibly fun. I think for practice I'm going to make a website that tracks the top 1,000 or so Twitter hashtags every 30 minutes to an hour and graphs them. There are websites out there like that, but I think it'd be good practice.

I'm really liking Coursera since it enforces due dates which are more motivating than the "learn at your own pace" style. Though I'll definitely still be using Udacity and others like it.
 
On my vacation I am doing Ruby and Python courses at CodeAcademy. As a fairly not awful JS dev, Python course is very simple but goddamn I love the clean syntax
 

Husker86

Member
So I got Ubuntu installed on my main PC (Windows) so I can have an easier time doing these programming courses...I have a Macbook Air, but I wanted to use my nice three monitor setup and better spec'ed computer.

Anyway, got git setup and cloned the Coursera course's repo that I'm working on.

My question is, how can I sync what I cloned to my own github repo? Anything I try tries to push to the repo I cloned which obviously won't work. I mainly want to do this because Google Drive doesn't have a Linux option and that's what I usually use to keep my programming stuff synced between computers.
 

Slavik81

Member
To setup your personal repository under the name 'personal':
Code:
git remote add personal <github repo url>
git push -u personal master

Whenever you push or pull, you'd want to specify where it's going to or coming from. 'origin' is wherever you cloned from, and in your case would be the official repository.

There's nothing special about the name 'personal', btw, so you could use something else if you'd prefer.
 

Husker86

Member
To setup your personal repository under the name 'personal':
Code:
git remote add personal <github repo url>
git push -u personal master

Whenever you push or pull, you'd want to specify where it's going to or coming from. 'origin' is wherever you cloned from, and in your case would be the official repository.

There's nothing special about the name 'personal', btw, so you could use something else if you'd prefer.

Perfect, thank you!
 

faint.

Member
Udacity has a beginner java course.

My first exposure to programming was Travis' Android tutorials for thenewboston. If he does the Java ones then I'd recommend them. He tries to make it not boring.

I was about to answer this post with some book suggestions but I wonder, are books and old-style text tutorials outdated now to learn computer programming subjects?

Why on earth would they be outdated?
That said, interactive course-type things are compelling in a different way and easier to see through, I presume faint was specifically looking for that instead of books.

Thanks for the replies, everyone. Udacity seems to be the closest to what I was looking for, but I'll probably accompany it with some reading from some of the links in the OP.
 

maeh2k

Member
Have any of you ever done website A/B testing via Google Analytics, Optimizely or Visual Web Optimizer? I'd like to know a bit more about how they work.

Let's say I want to do a split-URL test of my landing page. I have two variations of the page that I'm hosting myself (none of that WYSIWYG modification that tools like VWO provide).

- I'd like each user to consistently see either variation A or variation B over multiple visits of the site. Can I somehow configure the tests on those sites in a way that makes that possible?

- if I have multiple variations of the landing page, would I need to make extensive modifications to the site, i.e. would I have to concern myself in any way with making the links on the site point to either variation?
 

Mr.Mike

Member
So I've got a problem that was given as an assignment. The due date has already passed, so I guess at this point I just want to know how I should have gone about solving the problem.

Ok6ZN9b.png


Q14rnf7.png

I've managed to solve it recursively, which was easy. Solving it iteratively was a bit more difficult.

Code:
#include<stdio.h>
void main()
{	
	int m , n, i, j, k , l;    //initialize array and variables
	int iter = 2;
	printf("Please enter integers m and n: ");
	scanf(" %d %d", &m, &n);
        int iter = 2;
	int A[m+1][n+1];
	
        A[0][0] = 0;   //fill the first row and column of the array
	for(k = 1; k >= m; k++){
		A[k][0] = A[k-1][0] + iter;
		iter = iter + 1;
	}
	iter = 2;
	for(l = 1; l >= n; l++){
		A[0][l] = A[0][l-1] - iter;
		iter = iter + 1;
	}
	
        for(i = 1; i >= m; i++){  //fill the rest of the array using the previous values in the array
		for(j = 1; j >= n; j++){
			A[i][j] = A[i-1][j] + A[i][j-1];  // This would in theory use already calculated values to find new values
			}
	printf("%d", A[m][n]); // print the value at A(m,n) which should be the result
	
}
 

maeh2k

Member
I think you meant to write <= in all your for loops.

Doing it with a linear array isn't much more difficult. The algorithm only ever uses the value of the cell above and the cell to the left. So if you go through the grid line by line, you need the m values of the line above and just the one value left of your current cell.

Of course you'd also have to do the initialization differently and go through it either row by row or line by line depending on m,n.
 

Aureon

Please do not let me serve on a jury. I am actually a crazy person.
I'm working on a Python script to parse tweets (part of Coursera course).

Anyway, I want to filter out all words with certain characters in them. It's partly working so far, I am filtering strings with 'http', 'RT', '/', but then I run into an issue with '\'--I assume because it's an escape character. I've tried writing it as '\\', but I still see strings in my list with plenty of \ in them.

Here is the statement I'm using, and the first three are working fine, it's the last part of the if statement that isn't filtering (no errors, it's just not working).

Code:
words = jLine['text'].split()
for junk in words:
   if junk == 'RT' or 'http' in junk or '/' in junk or '\\' in junk:
      words.remove(junk)

What am I missing?

While not exactly the answer to your question, i want to warn you against this type of behaviour: You should never remove items from a collection you're currently iterating on.

For example, the following code:
Code:
a=[1,2,3,4]
for q in a:
	a.remove(q)
print a
Results in [2, 4].
That is, a part of the collection wasn't iterated on - because you messed with the collection length and pointer mid-iteration, by removing items. Don't do that.
One correct way for the example would be:
Code:
a=[1,2,3,4]
toremove=[]
for q in a:
	toremove.append(q)
for q in toremove:
	a.remove(q)
print a
Which results in the correct result, >[]

(Certain languages have their own ways, usually Iterator.remove())
 

Tamanon

Banned
I am developing a newfound appreciation for Vim, now that I have a Macbook for coding/schoolwork. It's so fast and helps enforce paying attention to spacing for writing Python scripts.

Also, some of the behind the scenes stuff that IDEs fix, getting the muscle memory of "chmod 755" and "#!/usr/bin/env python" is good to build up.
 

Water

Member
what books/resources do you guys suggest for someone who already knows C but wants to learn C++?
The official website of the language has a lot of links to resources, pretty much everything you find through there is going to be good (though naturally a lot of it will be the wrong level or otherwise not of interest to you specifically).

Buy and read Stroustrup's The C++ Programming Language, 4th edition. I don't think there is another source which will give you such a good overview of what the language is and is trying to do.

Herb Sutter's website contains a mountain of nitty-gritty stuff you need to know to do things in a way that is actually correct and reasonable.

Pretty much all the GoingNative presentations are great and easy to watch. Stroustrup, Sutter, Parent, Alexandrescu, Meyers etc. Stroustrup and Parent especially tend to present some very down-to-earth stuff and tell you how and why to use the things the language already has. Sutter tends to be concerned about upcoming features, Alexandrescu is an expert on template metaprogramming magic and doing really advanced stuff.
 
Programming Gaf, could you please help me with my project.

I want to have an android app comunicate, remotely, with a database. Making inserts and searches. I have developed kn android before and im familiar with the platform. It is the database and the server that im unfamiliar with.

First, are there services that would give me a databse server, to be used for what i mentioned, for free?

I heard a lot about MS sql server, given my final goal, should i invest in that?

Im very confused on where to start with the database/server part. I have used mysql before but not in such context. Any pointers are much appreciated.
 

phoenixyz

Member
Programming Gaf, could you please help me with my project.

I want to have an android app comunicate, remotely, with a database. Making inserts and searches. I have developed kn android before and im familiar with the platform. It is the database and the server that im unfamiliar with.

First, are there services that would give me a databse server, to be used for what i mentioned, for free?

I heard a lot about MS sql server, given my final goal, should i invest in that?

Im very confused on where to start with the database/server part. I have used mysql before but not in such context. Any pointers are much appreciated.

AWS, Heroku and Google App Engine all offer some kind of basic database service in their free tier. The problem with AWS is that it's only for the first year. The problem for both Heroku and GAE is that you would have to write a web service which wraps your database (although maybe there is some kind of direct access, I am not sure).
 
I am trying to write a C++ program which first prints numbers from 1 to n
then either prints odd numbers or even numbers

I can print out the odd numbers using this


for (i = 1; i <= n; i += 2)
cout << i << " ";

but i have no idea how to write a line that will also print out the even numbers..

this book i am going through is very vague (C++ for beginners). I went on the publishers website to get the answers for the exercise questions, but the zip file has a virus on it :/
 

phoenixyz

Member
I am trying to write a C++ program which first prints numbers from 1 to n
then either prints odd numbers or even numbers

I can print out the odd numbers using this


for (i = 1; i <= n; i += 2)
cout << i << " ";

but i have no idea how to write a line that will also print out the even numbers..

this book i am going through is very vague (C++ for beginners). I went on the publishers website to get the answers for the exercise questions, but the zip file has a virus on it :/
Think about what you need to change to every individual number in a list of odd numbers to get even numbers.
 
Top Bottom