Leave these fields empty (spam trap):
Name
You can leave this blank to post anonymously, or you can create a Tripcode by using the format Name#Password
Subject
Comment
[i]Italic Text[/i]
[b]Bold Text[/b]
[spoiler]Spoiler Text[/spoiler]
>Highlight/Quote Text
[pre]Preformatted & Monospace Text[/pre]
[super]Superset Text[/super]
[sub]Subset Text[/sub]
1. Numbered lists become ordered lists
* Bulleted lists become unordered lists
File

Sandwich


420chan is Getting Overhauled - Changelog/Bug Report/Request Thread (Updated July 26)

C++ delete not working on (I believe) allocated pointer

View Thread Reply
- Wed, 27 Sep 2017 21:44:16 EST 5sC0bueS No.37196
File: 1506563056371.jpg -(111717B / 109.10KB, 1920x1080) Thumbnail displayed, click image for full size. C++ delete not working on (I believe) allocated pointer
Sup my people, I come here, humbly, once again to seek your guidance of C++.

I'm trying to implement my own linked list in a search algorithm and am running in to memory leaks. I define a node struct, create a 4 element array of pointers (because of the search algorithm), use new to fill those pointers, add those pointers to a linked list, and then create 4 new elements using the same array of pointers. HOWEVER, when I go to iterate through the list later to delete everything, I get an error saying:

malloc: *** error for object 0x7fff5fbfe4f0: pointer being freed was not allocated

I don't understand why I saying it was never allocated? Here is some of the code highlights and I'll also paste a link to the full code on pastebin:

//USING NEW TO (ALLOCATE?) NEW MEMORY (THIS IS IN A LOOP)
list_node* neighbors[4]; //The FOUR neighbors
neighbors[0] = new list_node;
*neighbors[0] = {nullptr, nullptr, q, (q->x)-1 , q->y , 9999, 9999, 9999};
neighbors[1] = new list_node;
*neighbors[1] = {nullptr, nullptr, q, (q->x)+1 , q->y , 9999, 9999, 9999};
neighbors[2] = new list_node;
*neighbors[2] = {nullptr, nullptr, q, q->x , (q->y)-1 , 9999, 9999, 9999};
neighbors[3] = new list_node;
*neighbors[3] = {nullptr, nullptr, q, q->x , (q->y)+1 , 9999, 9999, 9999};

//DEBUGGING
//Print out the closed and open_sets
//...the closed set
bool printing = true;
list_node* current2 = copen_set.first;
printf("\nCLOSE ");
while(printing){
if(current2==nullptr){
printing = false;
break;
}
Comment too long. Click here to view the full text.
1 posts omitted. Click View Thread to read.
>>
Matilda Bandlechutch - Thu, 28 Sep 2017 19:36:34 EST 5sC0bueS No.37198 Reply
1506641794371.png -(807B / 807bytes, 48x48) Thumbnail displayed, click image for full size.
>>37197
Holy shit, that worked! Thank you so much.

I forgot to initialize the very first node with new and delete somehow knew. Does that function check the address and it's able to tell what's on the heap or something?
>>
Thomas Brindleworth - Thu, 28 Sep 2017 23:13:20 EST gezKXAce No.37199 Reply
>>37198
I believe calling delete on something not created with new is undefined, so it depends on your compiler.
>>
George Senningstone - Fri, 29 Sep 2017 13:08:19 EST P6PS9CBz No.37200 Reply
>>37198
At least on Windows with the debug CRT there's a mechanism built in to detect you calling delete or free on a pointer that did not come from the current process heap. You can easily do this in constant-time by simply checking the address against the lower and upper address bounds of your heap region.

a phone os

View Thread Reply
- Thu, 10 Aug 2017 09:59:00 EST CZA5DFLp No.37145
File: 1502373540803.jpg -(80244B / 78.36KB, 1000x661) Thumbnail displayed, click image for full size. a phone os
How realistic would it be to create a very basic os for an arm phone?

I'd be content if I could just boot, and maybe send a blank sms by pressing the home button or something. Has anyone ever done something like this? Do you know of any good resources to get started?
I had a basic computer architecture class, so I know how to program simple startup code and taskmanagers for x64/x86 and some microprocessors, so learning arm assembly wont be a problem. Having access to I/O, and eventually the gsm functions will probably be the difficult part.

I never really wanted a smartphone, but now I got a 2015 samsung galaxy a3 because it was only 25 euro. The battery life is really shitty (40 hours at best), so an ultra efficient os would be really cool.
7 posts omitted. Click View Thread to read.
>>
Jarvis Sodgemon - Sun, 10 Sep 2017 00:33:33 EST xLKzmVTo No.37188 Reply
>>37187
> but with some things you feel that it should have been replaced a long time ago when you use it.

Agreed. AT commands are a pain in the ass.
>>
Ian Brookfield - Mon, 18 Sep 2017 16:27:34 EST 4MJeso9G No.37192 Reply
>>37145
You should try flash it to lineage
many report huge battery time increases with all the bloat removed

Help me as I ask questions

View Thread Reply
- Wed, 23 Aug 2017 18:12:33 EST FzfAQ7sK No.37162
File: 1503526353355.gif -(2193920B / 2.09MB, 125x125) Thumbnail displayed, click image for full size. Help me as I ask questions
>1. Goal = define a function that takes input and then returns it in reverse
>2. result https://pastebin.com/BqUXJMxP
>3. Question = I somehow got it to work, but I dont even know how. I intended for this to just print the last part of an input, but it actually did it and I dont understand how


for i in text:
new_string = i+new_string


someone explain the code logic for why this returns the input in reverse for me, thanks
1 posts and 1 images omitted. Click View Thread to read.
>>
Charles Gallylat - Thu, 24 Aug 2017 12:05:26 EST 9QSfnS0r No.37165 Reply
  • it start with an empty string:
  • it starts a loop over each character starting with one
  • takes a concatenation of character of the loop and the variable and stores it into the variable
    • it does that till there is no characters left

in python you'd actually can do:
"abcd"[::-1]
and get:
'dcba'
>>
Basil Duckspear - Fri, 08 Sep 2017 14:58:56 EST 2mg3P58s No.37183 Reply
Inside of the reverse function your code creates an empty string and then for each character in the string provided as argument you are *prepending* the current character to the string that is defined in the function.

Say that you have the string "hello world", here's what happens:

you enter the reverse function and create an empty string ''

you take the first character of "hello world"; 'h' and put it in front of the empty string and then assign that to the variable that held the empty string. Now that variable holds "h".

Next iteration of the for-loop it takes the next character of the argument string, so 'e', and it puts that in front of what it has and it becomes "eh"

It then continues in this fashion until all of the characters of the argument string have been consumed.

"leh"

"lleh"

"olleh"

" olleh"

"w olleh"

"ow olleh"

"row olleh"

"lrow olleh"

"dlrow olleh"

Finally it returns the result

Data Structures

View Thread Reply
- Sun, 03 Sep 2017 19:28:25 EST rvUFtpA8 No.37175
File: 1504481305294.gif -(530982B / 518.54KB, 360x362) Thumbnail displayed, click image for full size. Data Structures
hey /prog/,

I'm looking for a good book or resource to help myself learn about data structures.
I'm in a college course next semester and for some reason they don't have a text for the class.
3 posts omitted. Click View Thread to read.
>>
Hannah Neshdale - Wed, 06 Sep 2017 01:37:32 EST BBXKtFPn No.37180 Reply
>>37179
You're not allowed to post here anymore. Please go away.
>>
Priscilla Trotwill - Wed, 06 Sep 2017 22:16:55 EST rvUFtpA8 No.37181 Reply
>>37178

Notes are bad, not allowed to use a computer to take notes during lectures.

>>37177

I know a little bit about Data Structures, I passed the introduction course with a C. I got mono during the first section, and after that the teacher pretty much hated me since I needed help catching up.

>>37176
I've seen that one already, was just wondering if anyone had other advice.

A friend of mine recommended a book called Cracking The Coding Interview
>>
Graham Clommlelad - Thu, 07 Sep 2017 13:04:24 EST jt2fMkCV No.37182 Reply
1504803864531.jpg -(70341B / 68.69KB, 620x372) Thumbnail displayed, click image for full size.
Could you post a list of data structures that you need to know and maybe we can find resources for you or help explain things?

Also, what language are you using in the course?

I would go to a VBS forum, but...

View Thread Reply
- Sat, 11 Feb 2017 07:27:55 EST 1joa5uVv No.36502
File: 1486816075377.png -(11163B / 10.90KB, 359x171) Thumbnail displayed, click image for full size. I would go to a VBS forum, but...
I want to make a better GUI for this script. The script is supposed to accept an input string and a number -> wait -> type that string and simulate enter key in loop.
Like a basic emergecny beacon of sorts

set shell = createobject("wscript.shell")

strtext = inputbox("Message :")
strtimes = inputbox("Number of times to spam")

if not isnumeric(strtimes) then
wscript.quit
end if
msgbox "You have 5 minutes to end wscript.exe"
wscript.sleep(300000)
for i=1 to strtimes
shell.sendkeys(strtext & "{enter}")
wscript.sleep(1000)
next


But can I rather leave a msgbox open with a button to cancel it? -> 5 mins is up -> one of two things (whichever is easier for yall)
1) msgbox dissapears and the loop begins spamming message. this requires quickly ending wscript.exe
2) gui remains (msgbox with quit button), maybe even has a countdown, and allows clicking to quit the script, and the spamming happens after the timer just normal.

Option 2, harder, but does it require fancy threading?
3 posts omitted. Click View Thread to read.
>>
Edward Himmermock - Wed, 08 Mar 2017 05:14:37 EST YL0YFsWq No.36605 Reply
>>36603
BrU strikes again

What is the cheapest way to add co-op support to my video game?

View Thread Reply
- Sun, 20 Aug 2017 23:17:46 EST 9venZ0d6 No.37160
File: 1503285466870.jpg -(633274B / 618.43KB, 1745x1229) Thumbnail displayed, click image for full size. What is the cheapest way to add co-op support to my video game?
I want my players to be able to play co-op but portforwarding and explicitly hosting a server would kill off a lot of potential players. Aside from hosting servers myself, is there a way to let people play co-op without anyone allowing incoming traffic from the internet?
>>
Ernest Waddledale - Mon, 21 Aug 2017 13:23:00 EST bkh8m0qR No.37161 Reply
You can use a server to mediate the network transversal of two clients and then let them talk to each other. That's how WebRTC works and it's dirt cheap to run the server.
>>
Charles Gallylat - Thu, 24 Aug 2017 11:55:42 EST 9QSfnS0r No.37163 Reply
The steam framework has a multiplayer network api that is sort of "free" to use, with the exception that your game will now be locked into their platform.
>>
Polly Choffinggold - Sat, 26 Aug 2017 15:49:38 EST P6PS9CBz No.37167 Reply
You can try NAT traversal techniques like hole-punching, but there's still going to be some routers that won't let people host game sessions without explicit port-forwarding.

Java versus Python

View Thread Reply
- Mon, 31 Jul 2017 22:09:34 EST ddyPydmV No.37128
File: 1501553374819.jpg -(49279B / 48.12KB, 559x254) Thumbnail displayed, click image for full size. Java versus Python
If I'm interested in programming simple, 2D games, which language am I better off with? Perhaps Python is the answer? It seems to be good for making simple games due to its pygame program. On the other hand, Minecraft is programmed in Java and is a great game.

What does /prog/ think?
1 posts and 1 images omitted. Click View Thread to read.
>>
James Callerwodging - Wed, 02 Aug 2017 14:12:18 EST 9QSfnS0r No.37131 Reply
For simple 2d games you'd actually should have a look at processing, it has been made for this kind of stuff and just feels like programming a retro home computer.

Don't try to write games in java unless you already are proficient in it for other purposes. Using unity and c# may sound like overkill for something simple but you sure as hell would be faster than using freakin java.
>>
Hannah Gablingdale - Sun, 06 Aug 2017 08:20:25 EST Ybduti9u No.37137 Reply
I had the exact same question. Didn't answer that completely but turn out that pyglet and pygame are piss easy to use, while in java there is just a lot more boilerplate code but maybe with more possibilities with low level stuff (?? Didn't look into that much, probably you'd have more luck with c++ with low level shit like memory management)
Plus pyglet and pygame are both easy to get started with as well as possible to do advanced stuff with. For 2d games they are pretty much complete, in the end you only need images to "blit" into the window, math for collision detection, physics, 2d depth effects (if you wanted), plus basic shapes like lines, circles or rectangles. OOP should probably take care of the rest, which python is completely capable of. I'm not an advocate of OOP but for game programming it fits very well.
>>
Ebenezer Nollystone - Sun, 06 Aug 2017 18:05:27 EST gLfws0AG No.37138 Reply
>>37131
>For simple 2d games you'd actually should have a look at processing,
Yeah no, unless you want to code a pong or something extremely simple like that. It's very barebone and very slow. It's good as a pure learning experience (like bouncing squares around or whatever), but you'll probably want to switch to something else fairly quickly.

Java is fairly fast if you use an OpenGL binding like LWJGL, that's what Minecraft does. Performance is "similar" to a C++/OpenGL game speed-wise. It's also hard to do stuff the wrong way since there isn't that many ways of doing something in the first place, unlike Python. The language can get very verbose, but this is not really an issue if you use Eclipse.

I wouldn't recommend Python as a beginner because you'll most definitely use the language wrong. It can get very slow if you don't know what you're doing. This probably won't matter for whatever you will be doing, though. You will get results faster, but you won't learn as much.

I guess it depends on your abilities as a programmer.
If you don't know shit about programming then processing might be a good start.
If you programmed a few things but want to delve into game-programming big time then Java/LWJGL would be OK. Or even C++/OpenGL. The amount of things you will have to learn will be overwhelming at first, but it will definitely be worth it in the long run. It's standard and these kind of technologies will still be around for a looong time.
If you have some experience and just want to play around with shapes/colors/motions etc then Python/Pygame would be great. Python is more of a scripting language for me, I'm sure you can make great commercial games with it, but the bar is lower than with other languages.

Don't use unity or unreal because all you'll learn is either unity or unreal. You can literally drag'n drop FX from a store into your game, use visual programming for gameplay, etc. This sounds great on paper (and it is) but you'll never learn anything that way. You're a programmer, not an artist.

I never liked Python and I wrote my first game in Java so I'm pretty biased.

Scheme and C in one project

View Thread Reply
- Wed, 28 Jun 2017 07:36:33 EST M2B2u4Js No.37091
File: 1498649793698.jpg -(230329B / 224.93KB, 595x596) Thumbnail displayed, click image for full size. Scheme and C in one project
I am working on a project in C.
It would be real neato if I had a way to evaluate a Scheme expression in the same project also.
Is there a (preferably BSD-licensed, but any open-source one will do) implementation of Scheme which can be statically linked to my program?
4 posts omitted. Click View Thread to read.
>>
Molly Dellystock - Thu, 20 Jul 2017 16:56:18 EST WwsCpz20 No.37119 Reply
Thanks for the recommendation guys,
I eventually went for one called tiny-lisp. https://github.com/matp/tiny-lisp
Conveniently, the license permits me to take it and use it in my project, modifying it as I want.

>>37115
I think I found it on one of those clickbait shits called "Top 10 awkward family photos" or something. The children were told they could wear what they wanted or something
>>
Jarvis Crirrychot - Sat, 22 Jul 2017 13:02:29 EST T/bDhTRa No.37122 Reply
>>37115
it's a spaz/tard/whatever...
look closely at his hands... it's armrests on a wheelchair. mom has her hands on the headrest.
especially the brother in the middle looks like he had a talking-to about his "special" family member.

kid clown can't sit properly and might have lost his right index finger as well... or the costumer lost patience.

web-hosting that supports java?

View Thread Reply
- Sat, 18 Mar 2017 01:47:25 EST SWJfiJ9j No.36616
File: 1489816045734.jpg -(316133B / 308.72KB, 1600x1200) Thumbnail displayed, click image for full size. web-hosting that supports java?
I'm somewhat new to software development (just started my second year of education)
I want to start experimenting with doing server shit / applets etc.

Can anyone recommend inexpensive web-hosting that let's me run applications on their server? Is this even a thing?
>>
Nell Ceblingwitch - Sat, 18 Mar 2017 10:27:26 EST WLOo3E7i No.36621 Reply
>>36616

If you're just experimenting, I would suggest just installing Tomcat on your machine and use that.
>>
Shitting Bozzletock - Sat, 18 Mar 2017 14:13:04 EST 0Wz3cQnI No.36622 Reply
Servlets, Spring, and JSP are things, but the only people who are interested in Java web services today are only in it for the JVM. Also, no one wants to run your applet in their browser. No one.

custom PHP Framework

View Thread Reply
- Mon, 07 Mar 2016 10:16:06 EST 5O5Et4Rv No.35282
File: 1457363766264.png -(45520B / 44.45KB, 410x233) Thumbnail displayed, click image for full size. custom PHP Framework
Sup

wrote this php framework and would appreciate some constructive criticism.

https://github.com/SIB-FRANCE/Polyfony2

(questions about why write another framework, and why not use Symfony, Phalcon, Laravel… I'm not interest in)

Thanks
1 posts omitted. Click View Thread to read.
>>
Phineas Clittingchick - Sun, 26 Jun 2016 06:46:28 EST vn92kpWi No.35768 Reply
>>35282
> database abstraction
Like every other framework you fail to grasp the nature of data and databases and support the ignorance of uneducated programmers.

For comparison, what do you think of the following "programming abstraction"?

> function setVar($varname, $value)
> function getVar($varname)
> function makeFunc($funcname, array $statements)
> function callFunc($funcname, $param1 = null, $param2 = null)


Python Curses and Unicode?

View Thread Reply
- Thu, 15 Jun 2017 00:06:52 EST UelYniJo No.37066
File: 1497499612658.jpg -(141192B / 137.88KB, 1920x1200) Thumbnail displayed, click image for full size. Python Curses and Unicode?
Hai /prog/ How do you print Unicode characters with the curses engine? I've tried googling it, but can't find a direct answer. I get a UnicodeEncodeError when using the addstr(). Does curses not support Unicode? Are there other options to use that are like curses but use Unicode? I don't wanna go to stackexchange cuz they're dicks
12 posts and 1 images omitted. Click View Thread to read.
>>
Angus Fonderdock - Sat, 24 Jun 2017 23:57:48 EST h+zCLZ09 No.37083 Reply
>>37082
>>37082
Thanks for the suggestion pal. It didn't quite work for me, but I might be doing it wrong. Are you using the default Mac terminal or do you use the Xquartz terminal? I'm using the default generic one. I installed Xquartz - does the Xresources file apply to only the xquartz terminal, or does it also apply to the default Mac terminal?
Thanks for the assistance!

Convert this file to PNG.

View Thread Reply
- Mon, 26 Jun 2017 12:44:29 EST wVfdD7B/ No.37084
File: 1498495469448.jpg -(153984B / 150.38KB, 640x480) Thumbnail displayed, click image for full size. Convert this file to PNG.
I bought a comic from comixology and downloaded the files to my android. I wante to make a local backup.
Here is one of the files http://www69.zippyshare.com/v/0KizzaQS/file.html
Can someone convert it to PNG?
Pic unrelated.
3 posts omitted. Click View Thread to read.
>>
David Sirringson - Tue, 27 Jun 2017 14:54:18 EST oLIL5vaK No.37090 Reply
>>37089
There is no drm free option for this comic. I downloaded the comic on my android and it was a sequence of files and I uploaded one of them at Zippyshare to see if someone can open it.
But thanks.
>>
John Sirrydotch - Thu, 29 Jun 2017 11:28:25 EST 9QSfnS0r No.37093 Reply
If you are buying crippleware digital products and then ask people to de-cripple it you are part of the problem. There are plenty of places where you can drm-free products and just imho if the authors can't be bothered to supply that option at any price then I can't be bothered to give them money for it.
Not if there is anything that's not somewhere on torrents/usenet/scene sites.
>>
John Sirrydotch - Thu, 29 Jun 2017 11:40:38 EST 9QSfnS0r No.37094 Reply
OP sorry if that response seems preachy,
but just download a pirated version of the comic you bought and think that is your backup.
Then just buy comics from people who actually don't sell you defective files.

9/11

View Thread Reply
- Tue, 27 Jun 2017 02:54:28 EST PQNCtl9i No.37086
File: 1498546468140.jpg -(42883B / 41.88KB, 475x288) Thumbnail displayed, click image for full size. 9/11
some girl named EmilyisPro on Twitch.tv claimed that she can send radio signals to people and also said that she did it while in a plane! she's apparently a walking cell phone.
she's endangering our national security and I don't know who to contact!
fix my problem.

Report Post
Reason
Note
Please be descriptive with report notes,
this helps staff resolve issues quicker.