Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 672 673 [674] 675 676 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 890488 times)

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10095 on: October 06, 2016, 11:41:46 am »

No, it's &&, because the atomic units were "sells-cats" and "sells-dogs". The combined statement "the petshop sells cats and dogs" is only true if both are true.

There's no basis for say cats and dogs are different bits in a byte here. Boolean logic truth statements don't work like that.
« Last Edit: October 06, 2016, 11:43:21 am by Reelya »
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10096 on: October 06, 2016, 11:44:05 am »

The pet shop sells a true or false value that depends on both cats and dogs existing. If either of them don't exist, then the pet shop sells false.
Logged

Dozebôm Lolumzalěs

  • Bay Watcher
  • what even is truth
    • View Profile
    • test
Re: if self.isCoder(): post() #Programming Thread
« Reply #10097 on: October 06, 2016, 11:50:01 am »

Can I have three false and fifteen true? How much does that cost?
Logged
Quote from: King James Programming
...Simplification leaves us with the black extra-cosmic gulfs it throws open before our frenzied eyes...
Quote from: Salvané Descocrates
The only difference between me and a fool is that I know that I know only that I think, therefore I am.
Sigtext!

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10098 on: October 06, 2016, 06:58:01 pm »

Here, both "and" and "or" probably mean "and" (has-cats && has-dogs)

unless, of course, "cats" and "dogs" are both represented as different bits in some 8-bit data structure, in which case you actually want cats || dogs

(e.g. if cats==00000001 and dogs==00000010, both would be cats||dogs==00000011)
|| is a Boolean logical operator. Unless both operands equal 0, the expression will evaluate "true". | and & are bit-wise.
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

Gamerlord

  • Bay Watcher
  • Novice GM
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10099 on: October 07, 2016, 02:56:28 am »

Get Visual Studio Community, yeah.
I just tried Visual Studio Community and the same damn KB2999226 thing happened.
That's not good.

Have you tried searching it?
Yeah, and the only fixes were to download and run a Microsoft Update package thing for it, but when I tried to do that it said it wasn't applicable to my computer.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10100 on: October 07, 2016, 04:01:36 am »

The only other thing to check that I can think of are that there are both an x86 and x64 Windows 7 versions of that package here, so make sure you tried the correct one:
https://support.microsoft.com/en-us/kb/2999226

DragonDePlatino

  • Bay Watcher
  • [HABIT:COLLECT_WEALTH]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10101 on: October 07, 2016, 09:32:52 am »

Or, you know, you could stop wrestling with Visual Studio and get a simpler IDE like Code::Blocks. When I was learning C++ all of the tutorials were in Visual Studio but I got by with other IDEs just fine. The two days you've spent configuring Microsoft Update packages could've been spent learning C++ or seeing if you even *want* to learn C++.

Getting into C++ with Visual Studio is like using a jackhammer when you only know how to use a chisel.
« Last Edit: October 07, 2016, 09:36:55 am by DragonDePlatino »
Logged

WealthyRadish

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10102 on: October 09, 2016, 05:27:43 pm »

I've started learning Visual Basic, and am currently writing some code for dynamic arrays that has some of the same functions as vectors in C++ (push elements onto a dynamic array, search, delete, etc). It works fine, but currently it's still tied to a specific data type (in this case an array of objects of a class I've written).

So I'm wondering if

1) This already exists and I don't need to write it myself
and
2) If there's something in visual basic like containers in C++, so I can write this once and have it work on arrays of any data type

I've searched around a bit and couldn't find anything on it. Anybody here familiar with the language?
Logged

TBeholder

  • Bay Watcher
  • the shade of something you remembered to forget
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10103 on: October 09, 2016, 08:10:18 pm »

I've started learning Visual Basic, and am currently writing some code for dynamic arrays that has some of the same functions as vectors in C++ (push elements onto a dynamic array, search, delete, etc). It works fine, but currently it's still tied to a specific data type (in this case an array of objects of a class I've written).
So I'm wondering if
Gah. No idea. But if you want it in a script language, why not try Python? It's portable (which means you'd get support from people who run it on Linux), widespread and mostly tidy. I will be shocked if what you want doesn't exist on Python. Though for just the above, all you need is an array or even list object. Array has array.append method, array.index for find-first, and array.insert is right below it.
If you want this streamlined and with more functionality for a  number-crunchy application, use NumPy (package for scientific computing with Python). See docs here - "Array manipulation routines" and "Sorting, searching, and counting". Does this cover all you need?
Logged
Nafferton said: “See me chase that boy till he drops!” I said: “You can’t get your knife into an Assistant Commissioner.” Nafferton told me that I did not understand the administration of the Province.
- "Pig"

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10104 on: October 09, 2016, 08:15:20 pm »

They call that generic types in VB.
https://msdn.microsoft.com/en-us/library/w256ka79(v=vs.140).aspx
https://msdn.microsoft.com/en-us/library/79btc5zc.aspx
Hope that helps

"Learn Python" isn't a good answer. You could apply that to dissuade people from learning Prolog, LISP, pretty much any language. Maybe be needs VB so that he can embed stuff into Office applications? And you can run VB scripts native in Windows without needing any type of plug-in (though it's a subset of the language compared to the application-building version).
« Last Edit: October 09, 2016, 08:19:43 pm by Reelya »
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10105 on: October 09, 2016, 09:02:23 pm »

Sorry for the double post, but book publisher O'Reilly has just made a stack of digital versions of programming texts available for free. Get yer free things. Stacks of books on Python in the mix btw.

http://www.oreilly.com/programming/free/

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10106 on: October 09, 2016, 09:35:19 pm »

http://www.oreilly.com/programming/free/

Thanks, that's going to come in super handy this week. We've got two new-ish devs (at our Python shop, mind) who don't know Python.
Logged

WealthyRadish

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10107 on: October 09, 2016, 09:55:01 pm »

Logged

nogoodnames

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10108 on: October 12, 2016, 03:52:16 pm »

So I'm trying to make a Bash script to automate encryption and decryption with mcrypt. I want it to take a password, decrypt a text file with the password, open it up for viewing and editing and then re-encrypt the file with the same password. I need to know how to pass the password to mcrypt and mdecrypt so that I don't have to enter it multiple times.

Here's a test script that I put together (abc is the password):
Code: [Select]
#!/bin/bash
printf 'abc\n' | mdecrypt test.nc
rm test.nc
pico test
printf 'abc\nabc\n' | mcrypt test
rm test
exit 0
But piping printf doesn't seem to work for this.

Also, does anyone know where the files for "Bash on Ubuntu on Windows" are stored? They're supposed to be in appdata\local\rxss but the rxss folder is not there.

Logged
Life is, in a word, volcanoes.
                        - Random human lord

TBeholder

  • Bay Watcher
  • the shade of something you remembered to forget
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10109 on: October 14, 2016, 02:51:51 am »

"Learn Python" isn't a good answer.
Yes. It's an imperfect, but still a better-than-nothing answer, which is fairly likely to be useful.
You could apply that to dissuade people from learning Prolog, LISP, pretty much any language.
I wouldn't download a car... what's your point?
Maybe be needs VB so that he can embed stuff into Office applications?
Maybe. In which case it's still may or may not be useless. Because there's pyoo.
Or maybe not. Or maybe he just wanted to build upon an example code he already understands. Or maybe he have to do it on a version of VB in which so and so wont work. Or maybe he tries to reconstruct a half-remembered dream... etc. So?
  And you can run VB scripts native in Windows without needing any type of plug-in (though it's a subset of the language compared to the application-building version).
The above is just a long euphemism for "interpreter is already shovelwared in". I don't see how "made by Microsoft" is an advantage.
“You can easily write your own report processor in place of the usual megalithic masonry.”
Also, does anyone know where the files for "Bash on Ubuntu on Windows" are stored? They're supposed to be in appdata\local\rxss but the rxss folder is not there.
Never used this variation, but bash is installed on Ubuntu, and it still uses dpkg right? Try
Code: [Select]
$ dpkg-query -L "bash"
Logged
Nafferton said: “See me chase that boy till he drops!” I said: “You can’t get your knife into an Assistant Commissioner.” Nafferton told me that I did not understand the administration of the Province.
- "Pig"
Pages: 1 ... 672 673 [674] 675 676 ... 796