• Breaking News

    Monday, April 12, 2021

    What to do with your inattention? Ask Programming

    What to do with your inattention? Ask Programming


    What to do with your inattention?

    Posted: 12 Apr 2021 11:58 AM PDT

    I have been working in the field for almost 3 years and I am constantly haunted by the feeling that I am terribly inattentive. Realizing how important this is for a developer, it becomes much more unpleasant. It comes to the point that I think to do another kind of activity so as not to spoil the life of clients with my bugs. Ironically, I work in a large financial company and for several releases (almost in a row) some bugs have surfaced on the production server. For a year now, I have been the only backend developer on the team since the team lead left and they still haven't been able to find a replacement for him. Thus, the review is carried out by colleagues from other teams, but due to the specifics of the work, they cannot check the tasks thoroughly, respectively, some bugs are reviewed and, moreover, are discovered too late. I do not know if anyone else has encountered such a situation, but I would very much like to hear the opinion of colleagues in the shop, preferably senior developers who can assess what is happening. As for testing, I can say that it is not always possible to test everything, and even without testing it constantly seems to me that I could have avoided these errors if I had been more attentive / thought more about the tasks.

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

    Those who freelance, can I pick your brain?

    Posted: 12 Apr 2021 07:54 PM PDT

    Hey Reddit,

    I've been casually self-teaching on-and-off for about 3 years and was recently admitted into Hack Reactor's full-time immersive software engineering program.

    My fiance and I are moving abroad to Taiwan for two years, as she has family that can offer free housing. The financial pressure will be relatively low, which I'm thankful for. This will allow me to finally 'make the jump'.

    I'm planning on making a jump from my current SaaS sales gig into freelance development (while abroad) and, hopefully, full-time employment at a local gig once we return to San Francisco.

    For those of you who are open to a casual chat, I'd love to pick your brain, hear your story, and glean any insights as I forge my own path.

    PM or comment here and I'll reach out.

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

    Why are compilers so bad at error detection?

    Posted: 12 Apr 2021 08:53 PM PDT

    We all know it, all h've been there, you were missing just a semi colon at line 4, and compiler told you there was a type error in line 18, my code is 15 lines man!!

    Why can't compilers/interpreters just get on and do what they're supposed to!? My IDE finds more errors than them!

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

    Is it a bad practice to use parentheses around an equation with no outside operators?

    Posted: 12 Apr 2021 08:09 AM PDT

    (This is regarding JavaScript in particular) For example, consider the following:

    var total = (100 - 50);

    Will JavaScript evaulate this as a test of truish rather than an "execute first" statement since there are no operators outside of the parentheses? Is it bad to use parentheses here if so?

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

    Help: best approach for solo dev to make mobile version of Django app? Native iOS/Android or react native?

    Posted: 12 Apr 2021 09:28 PM PDT

    Hey all, have a Django web app (using jQuery on frontend) and now need to make a mobile app version. Pretty simple site, sort of like a yelp with social login, profiles, form submissions, etc, no real-time or high-intensity graphics. Wondering for those who have done it, what's the best approach to developing a mobile app version?

    Definitely want to target iOS, and maybe android. Looking to launch on mobile in 4-5 months. Choices are 1)native apps or 2)front end with react native.

    My background: Been developing with Django for 6 years, so will use django-rest-framework on backend. Did 1 year of iOS and 1 year of android basics using udacity and big nerd ranch in 2014-2015 but never released on the app store. No background in react, decent at frontend JS but mostly up to ES 5.

    Considering hiring a contractor to make the initial mobile version while cramming like crazy for the next few months in whatever framework you suggest and then handling fine-tuning, future maintenance myself.

    Anyone done something like this? Is it suicide for a solo dev to try to maintain native apps for iOS and Android? Should I just target iOS natively? Or is react native a good solution? Thanks for your help.

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

    Need help with error (JAVA)

    Posted: 12 Apr 2021 08:55 PM PDT

    Hey, so I'm trying to learn Java for my AP Computer Science class at school and the project I'm working on needs us to use two constructors under one DiceRoll class. I've gotten pretty far, but now that I'm trying to create the objects in the blank and not blank constructors, I'm getting an error saying that it doesn't fit the actual and formal argument list length. I'd greatly appreciate if someone could have a look as I don't know why it wouldn't be able to distinguish between the 2 constructors.

    https://replit.com/join/wncxiacu-huttonsteier1

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

    Arcane bug hanging program - help

    Posted: 12 Apr 2021 08:55 PM PDT

    Hi, I'm out of ideas.

    I have an application written in c++,clr, and C# (It also uses a lot of COM), for no discernible reason it randomly-ish hangs.

    It only hangs without the debugger attached, so we can't attach anything from Visual Studio. On my personal computer, it hangs, if I try to attach the debugger after the hang, it crashes.

    On some computers it outright crashes every time. On others it works just fine.

    There is one instance of change graphics drivers causing the crash.

    I've been using debug dumps to try to determine what's happening, but this is new to me. The debug dumps tell me that the main thread is hanging in completely random spots, though it is more often in the rendering functionality than elsewhere.

    External threads seem to be working still, though it's hard to tell. Memory is well below acceptable limits.

    I render a menu to a texture, then render the texture in 3d for a menu, by clicking a button, which 'picks' an object in the scene, the hang always happens if you pick things enough. However, it can happen at any point up to that point too, even before user interaction (The user menu starts rendering at startup though, though I have managed to replicate the hang by piping fake input without any rendering, though it is admittedly a lot more rare that way. )

    I wanted to say that it was heap corruption, but that would cause crashes, wouldn't it? At this point, I think that there has to be another thread which is somehow halting the main thread, but it can't be with a lock, since the locations it stops are random, and there aren't any locks in those spots.

    Are there any suggestions for how to approach this? Unfortunately, I can't locate the code change that caused this, as there's a build team that makes builds, and switching out older versions of individual modules doesn't seem to do anything.

    TL;DR All normal methods of debugging multi-threaded hangs are failing - I need a nuclear option, and I'm willing to learn assembly at this point if it could help.

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

    How do you deal with headaches?

    Posted: 12 Apr 2021 11:35 AM PDT

    Literally every day i come home with a headache and/or heaviness around the eyes. Usually feel like crap for a couple of hours.

    Is this common in SWE? Have you found a way to alleviate it?

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

    HDL ram8 and ram512 address code

    Posted: 12 Apr 2021 03:50 PM PDT

    Why does ram8 have nothing written in address while ram512 has address [6..8] and address=address[0..5]

    Ram8 and ram512 seem to have the same function but I don't understand why.

    Here are both of them

    https://github.com/GreenOlvi/nand2tetris/blob/master/03/a/RAM8.hdl

    https://github.com/havivha/Nand2Tetris/blob/master/03/b/RAM512.hdl

    submitted by /u/Australian-Hungarian
    [link] [comments]

    New to the NFT concept, can someone answer a few questions?

    Posted: 12 Apr 2021 06:29 PM PDT

    I've only recently heard of NFT. I have some basic understanding of the blockchains and have read threads/sites about NFT as well. The most prominent example of I can relate to for NFT is nba top shot. But when I think about this whole NFT concept, nothing really makes sense to me. Can someone shed a light on a few questions?

    1. NFT itself does not persist the actual asset. So in the NBA example, the video itself is not on the blockchain. What's on the blockchain is just the record that I 'own' it. Then how does this protect my investment? Sure I mean the blockchain won't go away, it's forever. But the asset can be gone with a snap of a finger?
    2. How do you verify that the asset is the original asset? Let's say you bought a NBA topshot. All that is recorded on the blockchain is that person X owns asset Y. But Y is just an URL that points to a NBA website. Anyone can create a new NFT that points to that website? Or what if I downloaded the video, and minted that and put it on a blockchain? How does NFT validate the asset?
    3. Why does NFT enables the sale of digital asset? Again take the NBA example, they are free to create digital assets as they would like trading cards before there was NFT. Yes, the ownership record will not be decentralized, but why does it need to be? Considering the underlying asset is entirely controlled by them anyways. Let's say the blockchain stuck around forever, but the NBA asset server is now gone. What do you own? A copy of the video maybe? Is that still just as valuable?

    Funny enough, I asked this on /r/NFT and no one knows or maybe just no interest in discussing.

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

    Book recommendations for data engineers and cloud architects?

    Posted: 12 Apr 2021 10:00 AM PDT

    I want to skill up as a data engineer and a cloud architect and I don't have a formal background in Computer Science. But I am really interested in learning all the patterns and design principles in these domains. Please recommend me books and they can be anywhere from beginner to advanced. Thanks :D

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

    Getting a hypersphere's center out of 5 surface points?

    Posted: 12 Apr 2021 09:59 AM PDT

    I'm trying to implement a voronoi sampler in 4-dimensional space, which should be a quite simple task, but picking a good starting points distribution, which can sometimes generate some quite skewed voronoi cells due to the lack of uniformity in distribution (I accept suggestions on how to generate uniform random point scattering).

    So I started studying the case of generating centroidal voronoi cells and stumbled in the problem on the title. I'm starting with the assumption one can define a 4D hypersphere out of five surface points.

    I went as far as getting some code to produce a 3D sphere center point out of three points in 3D space (in this case, the points are always in the sphere's equator), which I shared here. I also managed to find code that fives a sphere's center for tridimensional space out of four surface points, but it's got insanely large with lots of matrices determinant calculations, to which I admit it kind of crushed my hopes of extending it to 4D myself.

    I found lot's of demonstrations in https://math.stackexchange.com, but that's not something I could readily transformable into code.

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

    What's the best way to wireless send a file from an Android/iOS App to a Windows PC app?

    Posted: 12 Apr 2021 09:46 AM PDT

    I just started a new job at a company that builds plugins for a variety of Apps on Windows and Mac. My background is technically in REST API and web development, but I'm currently helping with a new android/ios project, and the crux of my problem is that we want to be able to send an xml file from this ios/android app to a user's windows pc (where they have the windows app, with our corresponding plugin installed).

    Right now I'm looking into Azure Notifications as an option, but I was wondering if anyone has any experience with something similar to this. I would imagine I could set up a web server that's constantly connected to the desktop apps via web sockets as soon as the desktop app is started, but given we have tens of thousands of active users, that would probably be prohibitively expensive. Obviously I could simply have the user activate the websocket by making the socket event driven through a user action like clicking a button, but that's a UX design my product team wants to avoid. Any ideas/suggestions would be greatly appreciated.

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

    Tool to keep track of code between commits

    Posted: 12 Apr 2021 03:07 AM PDT

    Hey I want to find a tool that keeps track of my code between commits to my repo. Because I change my code a lot and I like to go back to see what my code was or get a snippet, it would be really useful to keep track of these changes. Think of it as an other git repo that checks my code for changes and commits them on the spot. Sorry if I post this here, I don't know where else.

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

    How do you work with secure & restrictive environment?

    Posted: 12 Apr 2021 04:29 PM PDT

    I have a new job at a company in healthcare and they have outdated ways of securing their networks. For example developers must have 2 machines: one that can access the network and internal apps and sites and another less secure and can have the tools necessary for development.
    Obviously it's probably a bigger slow task to try to push the IT management to implement newer patterns for example using amazon workspaces for on network apps as I have experienced at another big enterprise.
    How do you deal with systems like that? Had I known this is how they work I may have declined their offer.

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

    PHP Object to JSON - object values with spaces do not appear correctly in SQL db.

    Posted: 12 Apr 2021 08:12 AM PDT

    I have some PHP and HTML (below), where I'm sending form data to a mySQL db in the form of a PHP object converted into JSON.

    I'm wracking my brain. For first name and last name, I'm almost always able to add spaces to the values (i.e. "test test"). But if I add a value with a space to multiple object properties, the SQL db does not update itself.

    Does anyone know why this might be? Thank you in advance.

    PHP snip:

     class Student { // constructor public function __construct($first_name, $last_name, $address, $place, $ct, $ctZip) { $this->first_name = $first_name; $this->last_name = $last_name; $this->address = $address; $this->place = $place; $this->ct = $ct; $this->ctZip = $ctZip; // $this->citZip = $citZip; } }; if($_SERVER['REQUEST_METHOD'] == "POST"){ // values from form beginning $formFirstName = $_POST['fname']; $formLastName = $_POST['lname']; $formAddress = $_POST['address']; $formPlace = $_POST['place']; $formCity = $_POST['xyz']; $formZip = $_POST['city-zip']; // values from form end $alex = new Student("$formFirstName", "$formLastName", "$formAddress", "$formPlace", "$formCity", "$formZip"); //save to database $jsonalex = json_encode($alex); $query = "UPDATE users SET fname='$jsonalex' WHERE id=1"; mysqli_query($con, $query); die; }; 

    HTML Form snippet:

    <div class="modal add-form hidden"> <button class="close-modal">&times;</button> <h1>Add New Contact Below 📒</h1> <form method="POST" target="dummyframe"> <input type="text" id="fname" name="fname" placeholder="First Name" /> <br /> <input type="text" id="lname" name="lname" placeholder="Last Name" /> <br /> <input type="text" id="address" name="address" placeholder="Address" /> <br /> <input type="text" id="xyz" name="xyz" placeholder="City" /> <br /> <input type="text" id="city-zip" name="city-zip" placeholder="Zip" /> <br /> <input type="submit" class="submit-new-contact" id="submit-new-contact" value="Submit" /> </form> </div> 
    submitted by /u/SmoothAmbassador8
    [link] [comments]

    ML Question (Meta Language, SML New Jersey). Lists as parameters

    Posted: 12 Apr 2021 07:28 AM PDT

    Hey guys,

    I'm doing some homework for class, and I have to design this experiment. I'm just having trouble understanding the wording of the question. "Question: make an experiment with the ML language that demonstrates that ML doesn't recopy lists when they are passed as parameters".

    What does recopy mean in this context? I've been messing around with some code and I can see that ML is not passing lists in a reference like way when they're used as parameters because the actual list I use as a parameter is not being changed. So ML IS copying the contents of the list from the actual parameter to the formal parameter. Could the question mean I should demonstrate that ML doesn't copy the formal list back into the actual parameter after it's been modified?

    I'm just confused guys. Is anyone familiar with the use of the term recopy in this context?

    Thanks

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

    Java's Robot vs. C++ Win32 for KeyInput

    Posted: 12 Apr 2021 10:29 AM PDT

    Hello,

    I'm trying to write a write a tool that sends inputs to a game, and I'm having some troubles with both a C++ and Python implementation. Ideally, the solution would be able to send inputs to a non-focused game window.

    The following code works perfectly fine in Java (Well, Processing)

    import java.awt.Robot; import java.awt.event.KeyEvent; Robot robot; robot.keyPress(key); robot.keyRelease(key); 

    However I haven't been able to find a way to send these to a window without focus, which is why I'm looking into a C++ solution.

    The below code works while entering text into the Game's chat textbox, but not to do any non-chat functions:

    LPCWSTR Target_window_Name = TEXT("WindowTitle"); HWND hWindowHandle = FindWindow(NULL, Target_window_Name); PostMessage(hWindowHandle , WM_KEYDOWN, 0x57, 0x002C0001); std::this_thread::sleep_for(std::chrono::milliseconds(500)); PostMessage(hWindowHandle , WM_KEYUP, 0x57, 0xC02C0001); 

    I'm not sure why but SendMessage(hWindowHandle , WM_KEYDOWN, 0x57, 0x002C0001) doesn't work, though it does work with things like Notepad.

    I suspect that the game might do some kind of encryption on the input mapping, though I looped through a ton of different key codes and none of them did anything. There may be some internal object I need to send those inputs to instead? I've looked at Spy++ but it doesn't have any child windows associated with it. There is a different title under "Class -> ClassName" which I tried to grab with FindWindowEx(hWindowHandle, NULL, TEXT("ClassName"), NULL); to no avail.

    I've also tried using SendInput which has identical results - works in the Chat textbox, not for game inputs.

    I'm guessing the difference is that Robot just sends a simulated input event to the OS, whereas PostMessage is trying to target a specific application with an input event, which is where the problem comes from. Though I don't know why SendInput wouldn't work the same as Robot, in that case.

    Ultimately the end goal is simply to send key events to an inactive window - Can anyone point me in the direction of a solution in either Java/Processing or C++/Python?

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

    Note Taking Tool for Coding?

    Posted: 12 Apr 2021 10:29 AM PDT

    Hello,

    Does anyone use a digital note taking tool which they can copy and paste code onto to refer to later? I've been using pen and paper for the last 9 months and it so time consuming. Plus, I have to leaf through all my notebooks to find something whereas a quick search on my laptop in this tool would be so much more time efficient.

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

    Unable to compare two strings successfully

    Posted: 12 Apr 2021 10:19 AM PDT

    Hello, I was trying to compare two Strings, one from my function and one from a .out file to verify that my program is working correct for each test case, but .equals() does not seem to be detetcting them as the same.

    When I print the two variables, and I have getClass.getName to check they are indeed the same type, really confused as to why my if(res.equals(Files.readAllLines(Paths.get(fileEntry.getPath())).get(0))) isn't returning true.

    Help would be greatly appreciated, thanks!

    Code in Question:

     if(res.equals(Files.readAllLines(Paths.get(fileEntry.getPath())).get(0))) System.out.println(res + " " + Files.readAllLines(Paths.get(fileEntry.getPath())).get(0)); 

    Entire Code:

    import com.sun.tools.javac.util.StringUtils; import java.io.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; public class main { public static String telemarketer(int first, int second, int third, int fourth) { boolean one = first == 8 ? true : first == 9 ? true : false; boolean two = fourth == 8 ? true : fourth == 9 ? true : false; boolean three = second == third ? true : false; if(one && two && three) return "ignore\n"; return "answer\n"; } public static void listFilesForFolder(final File folder) throws Exception{ int count = 0; String res = ""; File[] files = folder.listFiles(); Arrays.sort(files); for ( final File fileEntry : files){ count++; if (fileEntry.isFile()){ if(count % 2 != 0){ res = readFile(fileEntry); } else{ //System.out.println(res + " " + Files.readAllLines(Paths.get(fileEntry.getPath())).get(0)); System.out.println(StringUtil.difference(res, Files.readAllLines(Paths.get(fileEntry.getPath())).get(0))); if(res.equals(Files.readAllLines(Paths.get(fileEntry.getPath())).get(0))) System.out.println(res + " " + Files.readAllLines(Paths.get(fileEntry.getPath())).get(0)); // else // throw new Exception("incorrect for test case: " + fileEntry.getName()); } } else{ continue; } } } public static String readFile(final File filex) throws Exception{ BufferedReader in = new BufferedReader(new FileReader(filex)); int[] data = new int[4]; for(int i = 0; i < data.length; i++){ data[i] = Integer.parseInt(in.readLine()); } return telemarketer(data[0], data[1], data[2], data[3]); } public static void main(String[] args) throws Exception { final File folder = new File("src/test/data/data/J1"); listFilesForFolder(folder); } } 
    submitted by /u/blah2135
    [link] [comments]

    Has anyone seen a flow-chart tool with the ability link back to sections of code?

    Posted: 12 Apr 2021 09:58 AM PDT

    ...Like draw.io inside of vscode, but if you could embed links in the flow chart that direct you exactly to where the decision is made in code. No auto generation, just the ability to assign lines 6-10 in somefile.py to some block in a flow chart diagram, where the user can click on that chart and just to the section of assigned code highlighted.

    I'd imagine something visually like this, but not auto generating and not DB-based: https://dbdiagram.io/home

    I feel like this has to exist already - and if not I totally need to make this.

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

    If statement to make test disappear

    Posted: 12 Apr 2021 09:55 AM PDT

    I have a weather website, when there are no warnings I want "weather advisories" at the top of the page to vanish, however when there are warnings I want it to be there. I know I can do this with {if} but I'm not sure how, I can't seem to get it working.

    {header}

    <main role="main">

    <div id="latestWeatherAlerts">

    <div class="container">

    <div class="row align-items-center">

    <div class="col-md-10">

    <h1>Weather Advisories</h1>

    </div>

    <div class="col-md-2">

    <a href="/previous-alerts">View Previous</a>

    </div>

    </div>

    </div>

    <div id="latestWeatherAlertsDark">

    <div class="container">

    <div class="row">

    {exp:channel:entries channel="weather_alert" orderby="date" sort="asc" limit="4" show_future_entries="yes" show_expired="no"}

    <div class="col-md-3">

    <div class="weatherAlert">

    <div class="date text-center">

    <p>{gmt\_entry\_date format="%D %d%S %M %Y"}</p>

    </div>

    <div class="image">

    <div class="icon">

    <i class="{icon}"></i>

    </div>

    <img src="{main\\\_image}" alt="" class="img-fluid">

    </div>

    <p class="blurb">

    {main_content:attr_safe limit="150"} <a href="weather-alerts/{url\\\_title}">Read More</a>

    </p>

    </div>

    </div>

    {/exp:channel:entries}

    That is the code for the weather warnings section. Here is how it looks when there is a warning in place

    https://imgur.com/BOLGQA5

    And here's what it looks like when there isn't. The 'Weather advisories" text just looks weird & doesn't need to be there

    https://imgur.com/wUClUIq

    Thanks, I'm a complete noob.

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

    What do you like programming smart houses via Lutron and Crestron with and why? C+?

    Posted: 12 Apr 2021 09:03 AM PDT

    Alternate Windows music API for QT5 or a place to find a DirectShow codec for `MP2/3 (MPEG audio layer 2/3)` audio streams?

    Posted: 12 Apr 2021 08:42 AM PDT

    Hello, I am making a Winamp clone with Pyside2/QT5 and the stock Mediaplayer library, as succinctly as possible, sucks. Is there a better Python or LGPL/GPL/MiT licensed c++ music playing library out there you would recommend or a DirectShow decoder codec for MP2/3 (MPEG audio layer 2/3) audio streams?

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

    No comments:

    Post a Comment