• Breaking News

    Saturday, June 15, 2019

    Are there any way to use self implemented data structures and algorithms? Ask Programming

    Are there any way to use self implemented data structures and algorithms? Ask Programming


    Are there any way to use self implemented data structures and algorithms?

    Posted: 15 Jun 2019 02:11 PM PDT

    Right now I learn data structures and algorithms for interview and myself. And I have bad feeling that my work is useless.
    I mean I wrote Linked List full featured with add, delete, replace, find, sort.
    And this Linked List just sits inside its folder and doing nothing :) I want use it in my projects or in my work.
    But because we have very good builtin structures (i use python) using own implementations looks stupid.

    Are there any online/offline chalenges (or projects) where you need to create all standard data structures (stacks, queues, linkedlists, hashmap) and all standard algorithms (sorts, searches)? Where you begin from simple data structures and algorithms and move forward using previously self created implementations. Maybe some kind of hacker/programmer game?
    Maybe there is some new/modern/popular language where you need to make all by yourself?

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

    Question for any emscripten people

    Posted: 15 Jun 2019 11:33 AM PDT

    Asked this on IRC but got no response, I figure i'll get some good responses here anyway, so here we go:

    19:28 < GwenNelson> hi all, quick question - if i compile multiple modules and have them on the same page, is there a sensible way to have them pass large blocks of data around?

    19:29 < GwenNelson> i want to use a modular design and have a javascript interface and a C++ interface for each module - i was thinking of basically wrapping each C++ module in a javascript object, but how do i handle direct calls between the different C++ modules?

    19:29 < GwenNelson> or should i just implement them as libraries and then link it all into one object?

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

    How do you improve your focus programming?

    Posted: 15 Jun 2019 07:27 PM PDT

    What do you do to focus while programming?

    It's hard enough to focus in 2019, especially while doing something focus-intensive, like programming. Focusing can improve your skills as a software engineer, make you more efficient, and can earn you more money in the long run.

    I've found that the biggest distraction by far is my phone.

    Usually, desktop sites aren't as addictive for me, but I was so much time on my phone.

    I have to either turn it off, put it away, or delete the Facebook, Instagram, Youtube apps, etc.

    Over the past 2 years, I've dedicated a lot of time into improving my focus. This is what I learned.

    Optimize and refine:

    • physical health
    • mental health
    • environment
    • work to fit your learning style

    I'm still not perfect - I get distracted occasionally, but I'm a lot better than it was before I dedicated time towards improvement.

    I broke these down into further detail in this video:

    https://youtu.be/nMTzjNzP8MM

    At work, we have an open office setup, so I have to use noise canceling headphones (which have been one of the best investments I've ever made). But I usually end up just working from home if I really need laser focus.

    What other tips do you have for improving focus?

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

    About standards, softwares and tech behind TV/Sports HUD on TV

    Posted: 15 Jun 2019 06:45 AM PDT

    Over the last couple of years, I've been following Formula 1 closely, and as a Software developer obsessed with good-looking stuff, it just fascinates me and it is a beautiful mystery how people achieve those kind of stuff.

    For example, Formula 1 allows for people to watch micro-sectors timings, weather, tyres, positions and so on ON REAL TIME.

    I know their cars and sensor around the track are basically an utopia regarding IoT. I assume they run a server collecting data, and output a video feed in real-time. And this part I understand, I've worked with IoT and low-level data collecting and measurements.

    The data processing and video rendering. This is what is magical for me, and I haven't succeeded on finding how it works exactly.

    I would like to work on something like that, maybe on open-source projects. I find it amazing and I believe I could give time and do a nice work on it, creating animations and so on. I would like to start.

    But I don't want to start and make something useless. I would like to start by analysing current industry standards, like softwares that do this kind of stuff (e.g. receive X data, display Y on video), but how does it work at the moment? Is it an enterprise software, Adobe Premiere style, with customizable templates without need for programmers, and so on? Or is it all raw C/C++, custom-made video rendering? Or a mix of both? How exactly the data interfaces with the video rendering?

    Are there standards for it? Known softwares and tech? I could say nowdays the most common APIs are RESTful-based, but how about this? Please enlighten me.

    Also, are there open-source projects that this kind of software uses, so I could contribute?

    TL;DR: How does the software(s) behind a real-time video like this work, interface each-other and what are the standards?

    Edit: clarifications about my question being more focused on the data/video part. And not about sensors and their connection to the data-center.

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

    Ideas on handling a tricky file-upload logic

    Posted: 15 Jun 2019 11:52 AM PDT

    So, I'm working on building a p2p file discovery and sharing tool. Coming straight to the problem, let's say there are two peers A and B. Now, let's analyze the scenario:

    1. A requests a file from B.
    2. B calculates the checksum of the file.
    3. B starts sending the file to A in chunks, but sends the file metadata (which has the checksum of the file from 2. among other things) in the first chunk itself.
    4. A reads the stream of chunks and on EOF, eventually receives the entire file.
    5. A calculates its checksum and verifies if it's the same as that sent from B.
    6. Everyone's happy.

    This is the happy path.

    My problem occurs between step 2 and 3. Let's say the file of interest to A is a text file. Now, just after step 2, let's say B makes an edit to the file. This poses a lot of problems, but the basic one to address is the fact that the checksum on the receiver node doesn't match anymore. As you can see, the problem is a lot worse if B changes the file once the streaming of chunks has begun.

    Now, I did think of a few ways to address this issue:

    1. Acquire a write lock on the file immediately after step 1. But, this has to be an OS-level lock to ensure that no other process on the machine can make any changes to it. Not sure if this is complicating things a little too much.
    2. Copy the file to a temporary folder and do the actual file transfer from the temporary location. There's an obvious issue here with large files, and also the added overhead of additional disk space requirement. Not something I want to do.

    What could be a possible way to attack this problem? Would appreciate inputs from anyone who has solved something like this earlier.

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

    I tried the solution on stack overflow that seems like it would have solved my problem but it didn't

    Posted: 15 Jun 2019 03:41 PM PDT

    Here is the code in question

    class Product(models.Model): category = models.ForeignKey('Category', on_delete=models.PROTECT) title = models.CharField(max_length=55) name = models.CharField(max_length=200, db_index=True) slug = models.SlugField(max_length=200, db_index=True) image = models.ImageField(upload_to='products/%Y/%m/%d', blank=True) description = models.TextField(blank=True) # decimal_places=0 price = models.DecimalField(max_digits=10, decimal_places=0) stock = models.PositiveIntegerField() available = models.BooleanField(default=True) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) class Meta: ordering = ('name',) index_together = (('id', 'slug'),) def __str__(self): return self.name def get_absolute_url(self): return reverse('shop:product_detail', args=[self.id, self.slug]) 

    then i get this error

    TypeError: __init__() missing 1 required positional argument: 'on_delete' 

    It was apparently a common thing since the update, originally I had this

     class OrderItem(models.Model): order = models.ForeignKey(Order, related_name='items') product = models.ForeignKey(Product, related_name='order_items') 

    Then read online that since the update it requires a new argument, What am i doing wrong? :/

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

    Summer intermediate project ideas

    Posted: 15 Jun 2019 03:16 PM PDT

    I don't consider myself beginner in programming (I know a bit of C/C++ and Python). I'm searching for a project for summer to practise and learn. Could you give me some ideas? I'm looking for something preferably:

    • With intermediate size (not too large or too small)
    • Not GUI/games/websites
    • That can teach me some things (networking, graphics etc)
    • That can be written in C++

    I have thought about making an HTTP server. Is that idea any good? How difficult is it to implement?

    Any advice would be appreciated

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

    What's the proper way to prevent SQL injection with my code

    Posted: 15 Jun 2019 02:55 PM PDT

    I'm building an mvc web app and it's somewhat new territory for me

    my view has a form

    <form action= "Signup" method="POST" > Choose a username:

    <input type ="text" name ="username"> <br> Choose a password

    <input type ="password" name ="password" > <br> Enter your email:

    <input type ="text" name ="email"> <br> <input type ="submit" value ="Sign up">

    </form>

    try {

    Statement stmt = dbConnectionObject.createStatement();

    String sql = "INSERT INTO signup (username, password, email) values ('" + username + "', '" + password + "', '" + email + "')";

    stmt.executeUpdate(sql);

    what's a good way to check that login details are not malicious?

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

    Chrome extension tool to work with Facebook

    Posted: 15 Jun 2019 09:40 AM PDT

    I have an idea for a chrome extension and before I start working on it, I'd like to talk to someone who would know if what I'm thinking is even possible. There's nothing on the market that I've found like it, so I'm thinking it may not be possible. But this extension would be extremely valuable and I'm open to you stealing it or working on it with me, I just think think there's a market for it.

    The requirements are: 1. Click on Facebook users in groups to auto-friend/auto-message 2. Provide dynamic canned responses 3. Allow for lead qualification tracking

    That's it. I imagine, this is against Facebook's terms of use, but I thought I'd ask.

    Just found something similar to what I was talking about here, but the site looks a little sketchy and I don't think it's a Chrome extension.

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

    Is it normal I believe that the characters I make for my game are sentient and alive like you or me?

    Posted: 15 Jun 2019 12:53 PM PDT

    I'm a solo game developer (look at my post history for game dev related screenshots).

    Like enemies. I made an AI for them where for instance if I make a new set piece they determine if they can walk on it and if they can they go over there and explore it. I made the attack animations and models to be as cartoony but expressive as possible and they really seem lifelike to me. Like if the player character gets too close to an enemy he swings his hammer at you but only if he can see you (approaching him from behind will have little effect usually). They're also pretty smart, for instance they can find places with steps if you're on a ledge so they can find you and attack you if they're below you.

    I really feel like I'm creating life. Like these cartoon characters are actors (pun not intended) and by programming I'm just giving them scripts but they are alive and conscious. I'd feel really bad if anything happened to the game files these characters are on so I backed up the entire game three times to be safe.

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

    How to handle large amounts of data with API calls

    Posted: 15 Jun 2019 08:55 AM PDT

    Hi,

    I have built quite a few full stack apps using Node js. I have mostly been using Firebase (firestore,cloud functions), coming from a mostly front end background this was an easier way for me to dive into backend services. Most of my projects required a few api calls here and there, authentication, small data storage. Now I am having to deal with larger amounts of data, on what I would call more legacy systems. An example would be calling an endpoint that returns a 3mb XML payload, and using that to sync an inventory on another database.

    The problem I am having is with my server memory limits and how to handle large requests to limit the amount of timeouts. Since the data I am calling is dynamic I do not believe I can cache the data. My questions are:

    • What are the best practices for handling data like this? Is there a difference between say, getting the data and writing to a file on my server, and using that to perform my logic? Or is storing the data in memory perform the same?
    • Is Firebase just not a good idea for this situation? Cloud functions can have a max of 2gb for its memory
    submitted by /u/donpissonhospitality
    [link] [comments]

    Copy character from file

    Posted: 15 Jun 2019 08:01 AM PDT

    How can I copy the character that the file cursor is on into a variable in python? I need to copy multiple times into one variable, if that helps.

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

    Can a custom arduino bluetooth setup be "hacked"?

    Posted: 15 Jun 2019 08:00 AM PDT

    Let's say I hook up my arduino and it's bluetooth module up to my car to control various things like lights with a custom app I build myself too.

    I usually send over a string that looks something like "1-0-0-1", where one means a function is on, 0 means a function is off.

    Could somebody that sees the open bluetooth connection manipulate the arduino in any way? Or is it impossible without knowing what the commands actually look like?

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

    How to build a chatroom

    Posted: 15 Jun 2019 02:25 AM PDT

    What's the best way to build a chat room. Recommend chatserver or best stack to achieve this.

    I'm aware of Slack, Matrix, Riot etc. That's now what I'm asking about.

    Email: kekeli@opayq.com if you're willing to build it for a fee

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

    No comments:

    Post a Comment