• Breaking News

    Saturday, January 5, 2019

    What does a C++ programmer do at a hackathon? [Discussion] Ask Programming

    What does a C++ programmer do at a hackathon? [Discussion] Ask Programming


    What does a C++ programmer do at a hackathon? [Discussion]

    Posted: 05 Jan 2019 02:24 PM PST

    I am somewhat aware of the fact that C++ is a language which is capable of doing almost every task in the programming world in the least time. But the tradeoff is that writing a good C++ application/backend is a big, time-consuming and probably an easy-to-go-wrong method for coming up with solutions because of the language's internal structure and code-practices.

    I have not written C++ in a hackathon yet but I wonder exactly what skills are carried over or can be utilized by a C++ programmer at a hackathon which probably has a very strict time duration and more often than not it doesn't require the most polished piece of software at the end of the event.

    The point that hackathons may not be such a learning experience after all with C++ may be one of the points that may pop up but I consider it to be a topic which deserves its own thread.

    Thanks for paying attention!

    submitted by /u/IronicallySerious
    [link] [comments]

    Using a file system vs. a database

    Posted: 05 Jan 2019 10:17 PM PST

    Hi all.

    I am a junior dev building a SPA to visualize and analyze datasets for a project at work. I was looking for some perspective on different approaches of handling this. These datasets are relatively small enough to be loaded into memory (~million rows) and will not change (no inserts or updates over time). Is it reasonable to store these datasets in a file system like Google Storage buckets instead of a database? My idea was to store paths in a database, then my flask API would hit the storage bucket and load the data into a Pandas data frame, do whatever aggregations, and send it back to the client. Is this a fairly common approach to things like this? I think a database makes more sense if the datasets need to be ACID-compliant, whereas these will just have many reads. Or would it be better to have a database titled 'datasets' and a table for each dataset in the application?

    Thanks in advance. I could really use some perspective.

    submitted by /u/alreadyheard
    [link] [comments]

    Which online learning platform has the best resources? I'm planning to get a membership and wanna know what you guys think has the best learning resources?

    Posted: 05 Jan 2019 06:07 PM PST

    I've read in quite a few places that Udacity has the best instructors as they're people already working in the industry and have good practical tips. Is that true? It's subscription is very expensive though.

    I'm also looking at Safari Books Online. It's got a lot of video and books from the best publishers available. Looks like a good deal for the price. I also saw that an acm membership also provided access to Safari. Does anyone use that?

    I'm quite agnostic with my preferred method of learning, although I would prefer a good book over video.

    What resources do you use and recommend for learning?

    submitted by /u/Urruf
    [link] [comments]

    AMP Project blocking posts on media articles?

    Posted: 05 Jan 2019 08:24 PM PST

    I'm super curious as to why this happens. My phone gets blocked by AMP Project via Facebook commenting sections on all major news articles, so often that I don't even bother posting on articles because it's a hassle to have to constantly delete my website data, just to post on an article's comment section mainly because every commenting section uses some form of Facebook. Is this a bug or censorship?

    submitted by /u/Chickitycha
    [link] [comments]

    FullStack or DevOps?

    Posted: 05 Jan 2019 02:16 AM PST

    I'm getting an internship which will teach me either of these skills from scratch. I have a choice to make and I'm confused. What are some of the pros and cons for both of these fields?

    submitted by /u/shani_doto
    [link] [comments]

    Problems drawing a wind direction circle

    Posted: 05 Jan 2019 08:54 AM PST

    Hi,

    I'm working on a weather web application project and I want to draw a circle with a triangle that indicates the wind direction, just like Wunderground has.

    I am using a canvas to dynamically generate the triangle depending on the wind direction measured in degrees. I have managed to determine the X and Y coordinates of the triangle's center for any angle, but I'm struggling with rotating the triangle in a visually pleasing way. I have created a fiddle with the relevant parts of my code.

    I would be super grateful if somebody could help me get the rotations right, so that the triangle points into the direction the wind is flowing. Thank you so much for your help.

    submitted by /u/hektor_vanogtrop
    [link] [comments]

    Java AudioPlayer problem

    Posted: 05 Jan 2019 01:18 PM PST

    public class AudioPlayer { public static void playMusic(String filePath) { InputStream music; try { music = new FileInputStream(new File(filePath)); AudioStream audios = new AudioStream(music); AudioPlayer.player.start(audios); } catch(Exception e) { JOptionPane.showMessageDialog(null, "Error"); } } public static void main(String[] args) { playMusic("C:\\Users\\alex\\Downloads\\Vivaldi - Spring.mp3"); } } 

    in the line

    AudioPlayer.player.start(audios);

    the word player is underlined red, and Netbeans(IDE) gives me the error: "Cannot find symbol, symbol: variable player"

    Picture: https://imgur.com/a/Yrbim6R

    It seems like people generally don't get this problem with the AudioPlayer - any solutions?

    The problem also exists with a non-static method

    Thank you for your time

    submitted by /u/uldahlalex
    [link] [comments]

    Versioning an SDK

    Posted: 05 Jan 2019 01:15 PM PST

    Hopefully, this is the right place for this

    Let's say I'm developing a library called SDK123. SDK123 supports running on iOS, watchOS, and tvOS. Similar to UIKit there are slight API differences on the platforms (maybe some feature isn't available on watchOS), but overall its pretty much the same library. I distribute these binaries with names of `SDK123_iOS.a`, `SDK123_watchOS.a`, and `SDK123_tvOS.a`.

    I'm wondering what makes the most sense when it comes to versioning this library.

    Option 1: They all share the same version. E.g. SDK123 is at version 1.1.0.

    Option 2: Each platform gets its own version. So SDK123_iOS could be at version 1.1.1 while SDK123_watchOS could be at 1.0.0.

    To me, option 1 seems like the better choice for several reasons.

    1. Fewer versions to maintain for me and the devs that use the lib

    2. More conventional

    The only downside I could see is that if I make a change that only affects watchOS and I do a release I'd have to bump the version number for iOS and tvOS even if there weren't changes. But I'm in the mindset I should version library as a whole.

    Are there any best practices for version libraries? I couldn't find any.

    submitted by /u/Clipstuh
    [link] [comments]

    efficient way to search/tag 5000 files against 1000 tags

    Posted: 05 Jan 2019 04:59 PM PST

    I have 1000 folders, each contains on average 5 text files (xml, txt), and I have a list of tag (1000). Some of the tags are frequently used in the files, some probably never used. my goal is to produce a "usage report" contains info such as:

    tag1,folder1, file1

    tag2, folder1, file1

    tag8, folder2,file5

    I can write python or java or dos command if needed. is there efficient way?

    Thank you!

    submitted by /u/hiacbanks
    [link] [comments]

    node 10.15.0: unable to create a large matrix

    Posted: 05 Jan 2019 04:37 PM PST

    I'm going through an algorithm course and just learned about Strassen's algorithm for multiplying matrices. I have implemented this in node and it works with small matrices. I want to test on a very large matrix but node core dumps when I try to create it. I am able to create the first matrix of size 10000, but it crashes when I try to create the second one. Full stack trace below:

    > const M2 = randomMatrix(10000); undefined > const M3 = randomMatrix(10000); <--- Last few GCs ---> [55746:0x398dfc0] 614765011 ms: Mark-sweep 1318.6 (1439.7) -> 1318.6 (1439.7) MB, 528.7 / 0.0 ms (average mu = 0.087, current mu = 0.000) allocation failure scavenge might not succeed [55746:0x398dfc0] 614765516 ms: Mark-sweep 1318.6 (1439.7) -> 1318.6 (1439.7) MB, 505.1 / 0.0 ms (average mu = 0.046, current mu = 0.000) last resort GC in old space requested <--- JS stacktrace ---> ==== JS stack trace ========================================= 0: ExitFrame [pc: 0x480f73dbe1d] Security context: 0x26efb64f8041 <JSObject> 1: randomMatrix [0x1ffe2ccfb921] [repl:~1] [pc=0x480f76ad37a](this=0x33298d21ad11 <JSGlobal Object>,n=10000) 2: /* anonymous */ [0x1be321b7adb1] [repl:1] [bytecode=0x1be321b7ad41 offset=26](this=0x33298d21ad11 <JSGlobal Object>) 3: InternalFrame [pc: 0x480f738ee75] 4: EntryFrame [pc: 0x480f73892c1] 5: ExitFrame [pc: 0x480f73dbe1d] 6: r... FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x8db900 node::Abort() [node] 2: 0x8db94c [node] 3: 0xad6c1e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] 4: 0xad6e54 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] 5: 0xec44e2 [node] 6: 0xec45e8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node] 7: 0xed06c2 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node] 8: 0xed0ff4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] 9: 0xed2509 v8::internal::Heap::CollectAllAvailableGarbage(v8::internal::GarbageCollectionReason) [node] 10: 0xed3cce v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node] 11: 0xe9d0e4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node] 12: 0x113c88e v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node] 13: 0x480f73dbe1d Aborted (core dumped) 

    I'm including the code I use to create the matrix:

    /* input: two integers, min and max. output: a random integer in [min, max] */ function randomInteger(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } /* input: an integer n. output: an n x n matrix, randomly filled with integers in [0, 100] */ function randomMatrix(n) { const M = new Array(n).fill().map( () => Array(n).fill() ); for(let i = 0; i < n; i++) { for(let j = 0; j < n; j++) { M[i][j] = randomInteger(0, 100); } } return M; } 

    Is there any solution to this issue?

    EDIT: Got the answer. Need to use this flag:

    node --max-old-space-size=8192 <your-script.js> 

    submitted by /u/AlienGivesManBeard
    [link] [comments]

    How did you learn your first programming language and what's the best way to do so?

    Posted: 05 Jan 2019 03:27 PM PST

    I'm interested in learning Java and I'm not sure if it'll be better to just try complete some small tasks or to go through an online course.

    I know some python, so I know the basic if statements and for loops.

    What would be the best way to learn and are there any online courses you'll recommend?

    submitted by /u/hachxm
    [link] [comments]

    Help with csv lists and cosine similarity python

    Posted: 05 Jan 2019 11:35 AM PST

    number = raw_input('Enter Student Number\n') csv_file = csv.reader(open('/Values.csv', "rb"), delimiter=",") for row in csv_file: if number == row[0]: rowdata = row[1:] 

    Keep in mind I have very little clue on what I'm doing. I'm in high school and just need help for my project.

    I have this python script to take a list of values in my .csv file. The files in the csv are layed out as strings like this:

    "221137","1","2","4","2"

    However, when I import it I don't want it to be used as a string I want them to work in a cosine similarity function.

    So like this

    [221137,1,2,4,2]

    Then I can compare it to all the other values in the csv file except the string itself.

    Sorry, I know I have absolutely no clue what I'm doing.

    submitted by /u/redsoxgrant
    [link] [comments]

    Java: Using custom generic template paramaters?

    Posted: 05 Jan 2019 03:05 PM PST

    I have some code that I need to generate a generic object on the fly with the generic type of 1 of a set of subclasses: e.g. keyEvent, mouseEvent or appEvent, these all extend event. So, my generic class EventFunction requires a template, however I dont know what the class type is until I recieve the event, so is there a way to do the following:

    Event event = new KeyEvent(); // FOR EXAMPLE RECIEVING A KEY EVENT

    EventFunction<event.getClass()> func = new EventFunction<event.getClass()>(event);

    How do I do the above: i.e. specify generic values on the fly? thanks in advanced!

    submitted by /u/RevivedBear
    [link] [comments]

    How much video can I play on an app with Spark plan Firebase as the backend?

    Posted: 05 Jan 2019 12:56 AM PST

    I'm making an app that will play video, mostly my own made web show. I'm looking into using Firebase as the backend. How much video will Firebase allow me to store and play on the Spark plan? Flame plan?

    submitted by /u/MortalMachine
    [link] [comments]

    Combine an oTree django project with an oscar django project and pass data around?

    Posted: 05 Jan 2019 05:05 AM PST

    I have an oTree survey and I am working on a django-oscar shop.

    I start otree (otree devserver, locally, port 8000) and after the questions I call with a subprocess another server (py manage.py runserver, port 8080) for the shop.

    Based on the answers, I would like to assign the player budget for the shop.

    How can I pass data around the projects?

    Tried this:

    from survey.models import Player

    class CatalogueView(TemplateView):

    model = Player

    context_object_name = "products"
    template_name = 'catalogue/browse.html'

    But I just get this error:
    ModuleNotFoundError: No module named 'otree'
    I also tried to import otree.api and I put otree to installed_apps.
    Any ideas, how to handle this?

    submitted by /u/discorogo
    [link] [comments]

    Any Java OpenCL GPGPU Programming advice?

    Posted: 05 Jan 2019 08:29 AM PST

    I've been working on a 2D pixel video-game in Java, and I've made a lot of progress so far, but what I did not realize is that, you can't really harness the power of the GPU in Java alone, at least I don't think... You need APIs; the best of which seem to be OpenCL, but I don't know how to use it, or exactly how it works internally... It would be really helpful if you guys could recommend me any books or tutorials on Java OpenCL programming; thanks much in advance. (PS: I'm only 14 and have been learning programming on my own, please forgive me of any of my ignorance, as I'm not very good at finding things in front of my face... :P)

    submitted by /u/sircm04
    [link] [comments]

    Looking for an embeddable web editor that lets me define my own syntax highighting

    Posted: 05 Jan 2019 03:13 AM PST

    I let users of my web app edit a template in a simple <textarea> and give them placeholders that I later replace with actual content in my application.

    Example:

    Hello {surname} {name}, would you like to check out our suppository sales? 

    Can be switched around by the user to

    {name} {surname}, my brother, check out our sweetass suppository sales. 

    Now, I do give the user a list of "available placeholders", but it'd be even better if I could offer some syntax highlighting for them, that way they'd notice right away if they mistype something.

    There's surely a Javascript lib out there that does all this, much more and makes me coffee, but my google-fu didn't turn up much. Any help?

    submitted by /u/NuttingFerociously
    [link] [comments]

    Finding triangle in any Graph G

    Posted: 05 Jan 2019 03:05 AM PST

    Hello!

    This is my first post ever so sorry if write anything wrong.

    But i have recieved this assignment to find a triangle in any Graph in O(m) time, where m is number of edges. All i know is that you can find triangles in a graph by using matrix multiplication however the time complexity is larger then.

    One "tip" that is given is that "The algorithm can be randomized and must output a correct answer with probability at least 0.99."

    Is there anything algorithm can be done?

    submitted by /u/crashman1996
    [link] [comments]

    No comments:

    Post a Comment