• What Do You Need Help With? V8
    1,074 replies, posted
Ask any programming questions here that don't need their own thread. Previous threads: [URL="https://www.facepunch.com/threads/910202"]Version 1[/URL] [URL="https://www.facepunch.com/threads/1053117"]Version 2[/URL] [URL="https://www.facepunch.com/threads/1092921"]Version 3[/URL] [URL="https://www.facepunch.com/threads/1152030"]Version 4[/URL] [URL="https://facepunch.com/showthread.php?t=1167392"]Version 5[/URL] [URL="https://facepunch.com/showthread.php?t=1250528"]Version 6[/URL] [URL="https://facepunch.com/showthread.php?t=1446371"]Version 7[/URL]
What would be a good name for a class that represents the state of something at a specific point in time? [editline]27th March 2017[/editline] leaning towards "snapshot"
[QUOTE=Octopod;52021342]What would be a good name for a class that represents the state of something at a specific point in time? [editline]27th March 2017[/editline] leaning towards "snapshot"[/QUOTE] Quake 3 also calls states in time "snapshots" [url]http://fabiensanglard.net/quake3/network.php[/url]
Need help with a good source for learning C#, since Unity uses it and I'd like to create a game in it. I'm not financially able to buy any actual source like a book so anything goes really.
[QUOTE=GentlemanLexi;52021600]Need help with a good source for learning C#, since Unity uses it and I'd like to create a game in it. I'm not financially able to buy any actual source like a book so anything goes really.[/QUOTE] [URL="https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md"]Can you afford them if they're free?[/URL] [editline]edit[/editline] These (C# ones) don't seem that great and are mostly really outdated-ish. I'll try to find something better. I can't vouch for any of these because the free book I learned C# with is [URL="https://www.rheinwerk-verlag.de/openbook/"]in German[/URL], but I still recommend a good entry-level books over e.g. video tutorials. [editline]28th March 2017[/editline] [URL="https://unity3d.com/de/learn/tutorials/s/scripting"]Unity also provides beginner resources[/URL], but you may want to consider doing some 'boring' programs first unless you're already proficient in a different language. It's likely somewhat more difficult to get the fundamentals down in a relatively high-level environment like Unity's, especially since that one has some quirks that would elsewhere be considered bad practice. [editline]28th March 2017[/editline] [URL="https://docs.microsoft.com/en-gb/dotnet/articles/csharp/"]Here's Microsoft's current starting point for C#[/URL], as far as I can tell. They recently redid their website and I'm not familiar with the new version. How much programming experience do you have? It's hard to properly recommend something without knowing that.
[QUOTE=Tamschi;52022367][URL="https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md"]Can you afford them if they're free?[/URL] [editline]edit[/editline] These (C# ones) don't seem that great and are mostly really outdated-ish. I'll try to find something better. I can't vouch for any of these because the free book I learned C# with is [URL="https://www.rheinwerk-verlag.de/openbook/"]in German[/URL], but I still recommend a good entry-level books over e.g. video tutorials. [editline]28th March 2017[/editline] [URL="https://unity3d.com/de/learn/tutorials/s/scripting"]Unity also provides beginner resources[/URL], but you may want to consider doing some 'boring' programs first unless you're already proficient in a different language. It's likely somewhat more difficult to get the fundamentals down in a relatively high-level environment like Unity's, especially since that one has some quirks that would elsewhere be considered bad practice. [editline]28th March 2017[/editline] [URL="https://docs.microsoft.com/en-gb/dotnet/articles/csharp/"]Here's Microsoft's current starting point for C#[/URL], as far as I can tell. They recently redid their website and I'm not familiar with the new version. How much programming experience do you have? It's hard to properly recommend something without knowing that.[/QUOTE] I've completed some CodeAcademy courses on HTML and CSS, that's about it.
[QUOTE=GentlemanLexi;52023599]I've completed some CodeAcademy courses on HTML and CSS, that's about it.[/QUOTE] That's not (necessarily) programming :v: HTML + CSS is technically turing-complete because it can model cellular automata though (with the user repeatedly hitting the space bar), but outside of that they aren't considered programming languages. [editline]28th March 2017[/editline] Definitely get [URL="https://www.visualstudio.com/"]Visual Studio[/URL]. The Community version is free for commercial use unless you're more than five people using it and it works with Unity. (Well, at least the 2015 version does. The new one should work too, but I didn't test it.) Most tutorials/other resources will assume you're using this. That aside, it's afaik just plain the best currently available tool for C# development.
Visual Studio Code is also good to have installed alongside the full VS IDE, since its really nice to use for looking through source code alongside programming in VS - that way you can avoid having to load up another expensive instance of your IDE just to look through sample code. If C# feels too tough, maybe give python a try? There's no support for Python in VS2017 (yet, but its coming), so VS Code will handle that admirably for you. Python is what I started my more formal learning of programming concepts with, before moving to C++, and I found it great for the initial stages of learning. C# is solid though, and seems like an ideal middle-ground between the abstraction of Python and the depth of C++. I just know that starting programming is daunting, and when I started last summer my most recent experience was HTML/CSS and all my C firmware work was so long ago that it was practically forgotten entirely. What's the safest way to handle move semantics for a complex derived class whose primary data member is a vector of pointers to complex objects (no pointers in stored objects, though)? Swap for move makes me nervous - don't you have to ensure you default construct the destination when move constructing, since swapping to a non-default constructed object w/ pointers could cause issues? I've made sure that the class has a valid destructor, but I'm still nervous about things breaking. In that vein, whats a good way to run unit tests on this stuff? I'm not sure how to track memory leaks or issues, outside of the difficult to use CRT Debug tools on Windows - and since my unit tests are implemented with Boost unit testing, leaving them cross-platform would be nice. To further extend the scope of this question (sorry), what are some good resources on learning to write unit tests? I'm not sure my current unit tests are enough, and I want to integrate more of them. My codebase is getting increasingly large and complex, and its really hard to test things for validity as it stands right now (outside of running the program and waiting for things to break D:) but I don't really know how to design a testing suite/system - all the resources I've found for the Boost framework are about how to use that framework, not about how to setup good tests.
I have a dashboard I'm building where I need to get counts of orders with different statuses. If I didn't want to make a new query for each possible status, how can I narrow the counts down using only one query that retrieves all orders? I'm using SQLAlchemy btw. [code] def order_counts(currentuser): # gets order counts for status cards on dashboard: allorders = session.query(Order).filter(Order.clinic_id == currentuser).all() [/code] And the cards to display these counts, with placeholder values. [t]http://imgur.com/3Djryko.png[/t]
[QUOTE=Tamschi;52023631]That's not (necessarily) programming :v: HTML + CSS is technically turing-complete because it can model cellular automata though (with the user repeatedly hitting the space bar), but outside of that they aren't considered programming languages. [editline]28th March 2017[/editline] Definitely get [URL="https://www.visualstudio.com/"]Visual Studio[/URL]. The Community version is free for commercial use unless you're more than five people using it and it works with Unity. (Well, at least the 2015 version does. The new one should work too, but I didn't test it.) Most tutorials/other resources will assume you're using this. That aside, it's afaik just plain the best currently available tool for C# development.[/QUOTE] Visual Studio came with Unity, so I'm just following some beginner tutorials on stuff to see how it works.
[QUOTE=Adelle Zhu;52025057]I have a dashboard I'm building where I need to get counts of orders with different statuses. If I didn't want to make a new query for each possible status, how can I narrow the counts down using only one query that retrieves all orders? I'm using SQLAlchemy btw. [code] def order_counts(currentuser): # gets order counts for status cards on dashboard: allorders = session.query(Order).filter(Order.clinic_id == currentuser).all() [/code] And the cards to display these counts, with placeholder values. [t]http://imgur.com/3Djryko.png[/t][/QUOTE] Consider using a query that only retrieves the counts instead of any orders. According to my database course this really should be a view the DB then provides directly, too, but I hardly work on anything that persists data, so take that with a grain of salt. In any case, [URL="http://stackoverflow.com/questions/2722408/how-to-use-count-and-group-by-at-the-same-select-statement#2722426"]this snippet here[/URL] should put you on the right track: [code]select town, count(town) from user group by town[/code]
anybody have any socket programming experience in C/C++ ? It's for an assignment for school, could use some help moving in the right direction.. I've completed the assignment, however my server and client are only working correctly for sending the initial message between them It's a simple program, but I can't figure out what might be wrong with it. I think it has something to do with the window being too large, therefore processing more than 1 request at a time and screwing it up, and frankly have found no good resources online to help me figure it out [code] while (server > 0){ do { recv(server, buffer, buffsize, 0); string strBuffer(buffer); if(strBuffer == "Terminate"){ isExit = true; } for(int i = 0; i < storage.size(); i++){ if(storage[i].email == strBuffer){ strBuffer = storage[i].publicKey; break; } } send(server, strBuffer.c_str(), buffsize, 0); }while(!isExit); cout << "Connection has been terminated" << endl; close(server); exit(1); } close(client); return 0; [/code] this is the section of my code in the server cpp file that's handling receiving the message, finding if there's a match in the vector and then returning it to the client. It works flawlessly for first request, and then not so much for the others.
Anyone using intelliJ know what the green highlight means? [IMG]http://i.imgur.com/R5TWEH9.png[/IMG] Wasn't there until I used the add static import intention and didn't go away after undoing the intention.
Nevermind, fixed my earlier issue.. was just a problem with the size of the buffer I was setting. Although I can't say I completely understand what was wrong
Probably because of the send, because the size of strBuffer might be smaller than buffersize, meaning you're invoking undefined behavior by going past the end of strBuffer.
[QUOTE=cartman300;52021552]Quake 3 also calls states in time "snapshots" [url]http://fabiensanglard.net/quake3/network.php[/url][/QUOTE] So does git/GitHub.
I need a way to make text change colors (cycle through rainbow) on html for my site Or I need someone to tell me what program to use to make a gif of the words "how about no" in comic sans changing colors through the rainbow Don't know how to do either Found this: [IMG]https://media.giphy.com/media/R3IxJW14a3QNa/giphy.gif[/IMG] Except -comic sans -transparent background -maybe wavey?
[url]http://codepen.io/andyault/pen/bqOXGa[/url] waves are gonna be impractical to do in html though
[QUOTE=Zombinie;52040173]I need a way to make text change colors (cycle through rainbow) on html for my site Or I need someone to tell me what program to use to make a gif of the words "how about no" in comic sans changing colors through the rainbow Don't know how to do either Found this: [IMG]https://media.giphy.com/media/R3IxJW14a3QNa/giphy.gif[/IMG] Except -comic sans -transparent background -maybe wavey?[/QUOTE] I'm pretty sure you can do this without scripts as native-ish text: - [URL="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/textPath"]<textPath>[/URL] - [URL="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/animate"]<animate>[/URL] (works for colour attributes too) - [URL="https://www.fonts.com/de/font/microsoft-corporation/comic-sans/regular"]Comic Sans is available as web font[/URL], but I don't know whether it's included in the free plan.
[QUOTE=Tamschi;52041448]I'm pretty sure you can do this without scripts as native-ish text: - [URL="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/textPath"]<textPath>[/URL] - [URL="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/animate"]<animate>[/URL] (works for colour attributes too) - [URL="https://www.fonts.com/de/font/microsoft-corporation/comic-sans/regular"]Comic Sans is available as web font[/URL], but I don't know whether it's included in the free plan.[/QUOTE] [QUOTE=PortalGod;52040950][URL]http://codepen.io/andyault/pen/bqOXGa[/URL] waves are gonna be impractical to do in html though[/QUOTE] Thank you both so much but I guess this won't work. I am using GoDaddy website builder and they allow custom html, but not css, and I don't know how to change the <animate> to what I need
[QUOTE=cartman300;52021552]Quake 3 also calls states in time "snapshots" [url]http://fabiensanglard.net/quake3/network.php[/url][/QUOTE] synonyms are state, frame, and context.
Can a .NetFramework 4.6.2 library reference a .NetStandard 1.6 library? According to the chart doodle it can, but I'm still getting the "you no can do" error.
[QUOTE=Zombinie;52042497]Thank you both so much but I guess this won't work. I am using GoDaddy website builder and they allow custom html, but not css, and I don't know how to change the <animate> to what I need[/QUOTE] Are you sure you can't use CSS inline via [URL="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style"]<style>[/URL]? In any case, [URL="https://css-tricks.com/guide-svg-animations-smil/"]here's a more thorough introduction to SVG animations[/URL][URL="https://archive.is/BnaY3"].[/URL] I suspect you need a keyframe animation of sorts that blends between different colours.
swift question. i'm doing a uni assignment that involves creating a contact list that i can add to and view contacts. i understand how to pass data across the view using a segue however i don't understand how i can get the actual instance stored in the cell clicked. this is the segue: [code]if segue.identifier == "showDetail" { if let destination = segue.destination as? DetailViewController, let contact = sender as? ContactListEntry { destination.contact = contact } }[/code] this fails because the sender is a UITableviewCell and not a ContactListEntry. there is a ContactList class which has an array of ContactListEntry called entries. so when the cell is clicked and the segue is triggered, the only thing i can get from it is the textlabel, but i need to get the row that was clicked so i can get the entry from the ContactList. the DetailViewController.destination is also a ContactListEntry
i figured this one out ^ [code]func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) { rowSelected = indexPath.row }[/code] next problem: [code]if let destination = segue.destination as? DetailViewController [/code] doesn't work because i have a navigation controller in between the detail view.
Can anyone point me to a good book or website that can help me figure out working with Qt in C++? The resources I've found are either out of date, intended for learning C++ through Qt, or don't cover the right stuff (like the Qt5 GUI Programming cookbook). I'm trying to tie in the GUI to my application now, and while the application isn't entirely finished yet I need a break from the stuff I'm stuck on and I figure planning my GUI hooks (and implementing them partially) now isn't a bad idea.
Struggling with jQuery right now. I'm trying to use autocomplete on a set of fields. Each field needs to call ajax to query MySQL for results. But there needs to be a separate request for each field. The autocomplete script I'm using comes from Material Design for Bootstrap which doesn't seem to have a lot of options for external data. In fact, I think it only accepts a set list of data. Can anyone lend me a hand in writing the jQuery for the request? [URL="https://pastebin.com/gxygeqRh"]This [/URL]is the autocomplete script from Material Design.
[QUOTE=Pat.Lithium;52053075]i figured this one out ^ [code]func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) { rowSelected = indexPath.row }[/code] next problem: [code]if let destination = segue.destination as? DetailViewController [/code] doesn't work because i have a navigation controller in between the detail view.[/QUOTE] again my bad solution [code]let destination = (segue.destination as! UINavigationController).topViewController as! DetailViewController[/code]
[QUOTE=paindoc;52058239]Can anyone point me to a good book or website that can help me figure out working with Qt in C++? The resources I've found are either out of date, intended for learning C++ through Qt, or don't cover the right stuff (like the Qt5 GUI Programming cookbook). I'm trying to tie in the GUI to my application now, and while the application isn't entirely finished yet I need a break from the stuff I'm stuck on and I figure planning my GUI hooks (and implementing them partially) now isn't a bad idea.[/QUOTE] I don't know man, they have examples on pretty much everything in their wiki, + it might be worth reading a bit of Schlee's book. It covers most of the basic concepts used in the framework, and it also has some excellent examples on how to start with Qt's GUI part.
Is anyone decent at Java? I have a project due soon that involves arrays and classes and I have been struggling for hours to set up the array (jumbled crossword basically) but I just don't comprehend how they work at all in 2D form. If I could PM someone some code (so I don't get fucked for cheating) and they offer me some tips/direction that would be amazing.
Sorry, you need to Log In to post a reply to this thread.