Programming Talk / Help Thread

fantanoice

I can see through time
Pronouns
She / They
Hey, lets talk programming! What could go wrong?

8zCs5Yv.gif


So I guess I'll start off. I'm interested in learning how to insert / extract data from spreadsheets and doing stuff with those. Unfortunately I haven't been able to find any good, step-by-step tutorials on how to just get data out of a single cell, plus I'm not sure what the best tool for the job is. A solution using C++ or C# would be preferred; I don't want to go hunting / installing other stuff if it's not necessary. Also I'm using OpenOffice. Anyone have any suggestions?
 
i just started becoming a professional programmer so expect some quality posts from me in this thread
 
all things php

i hate it
sometimes i love it
then i hate it again

its a rollercoaster of feelings
 
That's the general consensus I get from php developers lol

I felt like an idiot yesterday. I was trying to refactor some shared functionality between two derived classes into a helper namespace (c++). I had everything right, I had a pointer in my parameters list, I was calling the header in the cpp and forward declaring in the h, I was deferencing the pointer to call the functions, etc, but I kept getting an 'incomplete type' error which is typically what I'd get if I hadn't included my h.

After spending ages trying to work out what I did wrong and googling to remember if there are any gotchas with calling functions on abstract classes even when they're pointers, I finally realised that the problem was that the functions I was calling were protected and not public. Jfc.
 
I've been too lazy to run Code::Blocks lately, can anyone offer motivation?
 
Wow memories of my first ide

... Ditch it and use visual studio instead

https://www.codewars.com/users/queenie
 
Lua thing I learnt the other day: It has a hard limit of 60 upvalues that you can use in a function. An upvalue is a variable local to the file but not the function.

To get around the limit I had to remove a crapload of those locals and use them in a table instead.
 
I've got to write this program for my computer studies class. It is in Turing. It can be found here: http://compsci.ca/holtsoft/

Here is the program assignment that I need to write:
Write a program using nested “for” loops that prints the following patterns.
I need to ask the user for the number (example: 5 to print the following patterns)

a. b.
54321 1
4321 12
321 123
21 1234
1 12345

My input number has to be from 1 to 9.
 
Ok, my dad wants me to program something that will reverse a word (i.e. "word" -> "drow"), but I don't know the command to extract the specific letters from the word. He also said that I can't:

-have user input go letter by letter
-only be able to use letters of certain lengths

So now I'm stuck on:

-how to extract the letters out of the words
-how to assign the specific letters their values as letter1, letter2, etc.
-how to arrange those values

Can anyone offer any help on this one?

E: And I do have it so you can only input a word that's 9 letters long, so a word like "lighthouse" is out.

E2: And if you're interested, this is all I've come up with so far:

Code:
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string word;

    cout << "Please enter a word that is 9 letters or fewer: " ;
    cin >> word;
    cout << "Processing..." << endl;
    
    return 0;
}

I'm not really even sure if using a string/cin combo is the right way to go on this one.
 
http://php.net/manual/en/function.strrev.php


also here's how I'd do it manually (also in php)

Code:
function strrev ($str) 
{
   // creates an array that's the single letters of the string
   $arr = str_split($str);
   // for loop, count() is the length of the array (counting to that point would cause an arrayoutofbounds exception in java or a memory error in php)
   // the reason we only execute this up to ceil(count/2) is that we only want to call half of the array, you'll see why soon (ceil rounds the number up to the next full number in case its a decimal)
   for ($i = 0; $i < ceil(count($arr)/2);$i++) 
   {
      // temporary variable so we can switch stuff out in the array
      $temp = $arr[$i];
      // replace current character in the array with the corresponding one on the other side
      $arr[$i] = $arr[(count($arr)-1)-$i]; //remember count($arr) is out of bounds so we start counting from the back at count - 1 (this is because arrays start counting at 0)
      // replace with temp variable
      $arr[(count($arr)-1)-$i] = $temp;
      // as you can see this works on both sides simulataneously so if we'd run this script all the way to the end we'd end up with the same word.
   }
   // returns array imploded as string with the glue "" (no spaces/other characters between array elements)
   return implode("",$arr);
}

just translate this into c or whatever language that is (pretty sure its c anyways)

DISCLAIMER: might not work this way in c but i hope you got the general idea
 
2257 said:
does your dad have you doing this as part of some kind of curriculum?

Kiiinda. It's not really a curriculum, but rather something to do because "I'm not productive enough in the car."
 
Behold the Game Tournament grouping program assignment that I completed.

gN05rij.png
 
I've received some questions from my programming teacher to do in Microsoft Access using SQL and tables. These aren't every question from the paper, just the ones he wanted me to do. Here they are:

1. Show posts were a customer's name begins with the letter A.
2. Create a parameter question that is used to remove a customer.
3. Show all customers that have rented the car with the licence plate labelled "ABC123". Sort in alphabetical order. If someone has rented the car multiple times, their name must only be shown once.
4. What is the name of the person who have rented a car the most amount of days?
5. Show the customers who were born prior to 1990.

E: I removed some of the other questions, as I didn't need to show almost the entire paper, and I don't need help with everything.
 
In order to show which customers name whose last name is either "Andersson" or "Larsson":

SELECT Name
FROM Customers
WHERE Name LIKE "Andersson*" or Name LIKE "Larsson*";

The table I made looks like this (I don't know how to post a table here):
ID Name Birth date
1 Andersson, Bob 1989-04-03
2 Larsson, Carl 1993-08-09

I only want help on question 1 and 5.
 
Yeah like give it a go and if you get stuck after 15 minutes then ask for help. Also show us what you've done already

Also handy thing:
http://e.ggtimer.com/15minutes

It's been ages since I've done SQL but I presume the "starting with letter" thing is gonna be similar to what you have for Anderson but probably something like "A*" where the * means anything after A.
 
And now behold the 4 letter word generator program.

8wb7zWA.png
 
Work today: for context, my employer makes sports sim games. The one we're working on now has two different timers for the matches. The first one is how long you, the gamer, spend actually playing the match. The second is how long the match would go for if it was the actual sport broadcast on television - similar to how Fifa works.

Today we had a bug with the timers being totally wrong.

The cause? A variable named 'realTime.'

A number of us were working in this part of the system but something none of us realised was that there were two ways to interpret 'real time' - and that some of us were working under one interpretation and the rest under the other one. I interpreted it as the real time the gamer spends playing the match; others interpreted it as how long a real, broadcasted match would last on TV. You can probably see where this is going.

In the end someone had to go through the whole flow and fix it all to use the single interpretation (which ended up being the interpretation I had).

I've seen ambiguous variables before but nothing like this. Humans, right? So interesting!
 
This book on procedural generation is free for the next few hours:
https://www.packtpub.com/packt/offers/free-learning
 
Unreal / Unity dev books in the newest humble bundle

https://www.humblebundle.com/books/unreal-unity5-book-bundle
 
Back