• Breaking News

    Thursday, May 21, 2020

    What is Lua even used for? Ask Programming

    What is Lua even used for? Ask Programming


    What is Lua even used for?

    Posted: 21 May 2020 01:26 PM PDT

    What is Lua even used for? The only instance of Lua I know of is for scripting ROBLOX games. Is there any other purpose?

    submitted by /u/8blackears
    [link] [comments]

    What are the main frameworks and libraries you use in production Node.js server side development?

    Posted: 21 May 2020 09:49 AM PDT

    What are the main frameworks and libraries you use in production Node.js server side development?

    (Express.js, Meteor.js, Koa.js, restify, Socket.io, jsonwebtoken, express-jwt, passport.js, express-rate-limit, validator.js, etc etc)

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

    JYTHON : Can I get any suggestions for a nice IDE to kick off Java Enterprise and then transition into Jython?

    Posted: 21 May 2020 06:49 PM PDT

    I'm trying to start jython by doing a bit of Java Enterprise as well. I already have Eclipse IDE and Atom Text Editor for the same, but I couldn't find any Jython IDEs or if there is any such thing, Java-Jython IDEs. Can someone suggest anything good to start with?

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

    (Python) need to be able to drag and drop an image from anywhere into a GUI, and have it save the image to a different folder.

    Posted: 21 May 2020 05:34 PM PDT

    I am about to learn about GUIs, and want to include this as part of my program, but i couldn't find a way do it. I have looked at the pillow module, but there was no clear way to actually input a new image that isn't already in a specific folder. Is there a module to do this or at least a tutorial?

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

    [C Programming] mmap() MAP_ANON - Why?

    Posted: 21 May 2020 10:06 PM PDT

    So I'm primarily programming in UNIX, porting software to obsolete OSes (IRIX, UnixWare, old AIX).

    One common rough spot is the MAP_ANON flag of mmap(); usually in mman.h on UNIX OSes when porting.

    An anonymous mapping is a contiguous mapping that isn't backed by a file; so unlike normal mmap() calls which are file backed, it appears to me to be broadly similar to a bog standard malloc() call.

    This begs the question:

    Why? Why do this over malloc()? Does it specifically have a purpose with Linux's mmap implementation? Yes, NetBSD and FreeBSD have the flag too, but historically they didn't.

    I'm aware of the "workaround" involving using a file descriptor to /dev/zero, and then closing the fd, but I'm just honestly curious why this is even necessary when, it appears to me, it's easier to just write it using malloc() and avoid this nasty, non-POSIX compliant method of memory mapping.

    I beseech more experienced folks for their knowledge here.

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

    Easy way to store code snippets online similar to a DSM?

    Posted: 21 May 2020 09:11 PM PDT

    Anybody have any suggestions for an online tool to easily store components I use often? I'd like to be able to store a reference image as well as the actual code itself for re-use.

    I looked into Invision's DSM, but to add code, you need to sign-up for an enterprise plan.

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

    General guidance on how to print an overlay of data into a video

    Posted: 21 May 2020 01:50 PM PDT

    I am working on a project where I collect data from an accelerometer which gives me XYZ rotation while at the same time I have a video feed of the thing that has the sensors. This gives me a timestamped values that I would like to overlay it, frame by frame into a video.

    Where should I start to look on how to do this? I have minimum programming languages but I can make my way easily, if I know where I should be headed.

    Any advice is helpful. Thanks!

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

    Question about autoboxing

    Posted: 21 May 2020 07:31 PM PDT

    I just went over autoboxing and unboxing, and if I understand it, it's basically like this: if you write Integer i = 5, you've autoboxed. What is it called, then, when you write String string = "string", instead of calling it like a normal object (String string = new String("string"))? Since String is an object, not a wrapper, and our strings aren't primitive values.

    Also, just like we can method overload to write, say, Rectangle rect = new Rectangle(3,2) to make a 3x2 rectangle, and Rectangle rect = new Rectangle(3) to make a 3x3 rectangle, is there a way to change your class so that you can simply say Rectangle rect = 3 to make a 3x3 rectangle? I know it's kinda useless here, but I think in other cases it may be a lot more useful (say we had a name class and we wanted to simply write Name firstStudent = "james" instead of Name firstStudent = new Name("james")).

    Sorry if this doesn't make sense

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

    How do SDK/API's work when OEM/ODM/white labeling products? Anyone have any experience with this?

    Posted: 21 May 2020 07:11 PM PDT

    I have a really cool idea in the wearable device space that I think has a lot of potential. I've done a lot of research the past month, and recently I found a manufacturer that makes a product pretty much tailor-made for what I'm looking for in terms of the data it collects from the human body. I could use this raw data to build the features I want. However, I have no experience working with these kind of companies that offer OEM/ODM/white label services, and I could really use some insight.

    As I understand it, I have two main things I need to do.

    First - Get the software component made. For that I need to find a developer that can work with the API/SDK provided by this manufacturer and build what I need for the app (I plan on having the smart wearable device connect to the phone). Do I just introduce myself to the manufacturer, tell them my plans, and request access to the API to get the software designed as a first step?

    How do I bring up the idea to a freelance engineer and know if he is capable of designing software or an app based off the data/API? Is there a specific type of engineer/developer that does stuff with wearable tech, or is this just standard software development since it's based off an API.

    Do I need to have a developer sign an NDA or non-compete or something like that out of caution?

    Second - Get the software into the hardware. Is this something that, once I have a working software component and can get the wearable made, I ask the company to install it beforehand when they manufacture my specific white label version of their product?

    I'm aware this all could probably vary from company to company and that there's perhaps no clear roadmap of how it will always go.

    With that being said, I'd really appreciate some help from anyone who's been in this space before or has an idea of how this process works. I have a decent understand of APIs and such, but I'm more bringing the science/biology understanding and business/vision to this idea, not the tech/software, so I need to get an idea of what the next steps are now that I've found a manufacturer.

    Thanks in advance :)

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

    Advice or opinions?

    Posted: 21 May 2020 03:16 PM PDT

    Hi there. My small business is trying to build to build a tool. Looking for ideas/thoughts to get started before we look for a developer etc. Have a couple years monthly of .csv filed. Want to compile them into a database. Going forward there will be a monthly file to add in. From the database want to create a client view dashboard that displays some of the key fields and information for the clients portfolio. Also want to create a one page snapshot of some of the key Information relative to each clients' portfolio. Just in the planning stages so apologies for the vagueness.

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

    pm2 logging to custom path

    Posted: 21 May 2020 06:36 PM PDT

    in my project root, im running pm2 start ./app.js -l ./log.log but the log file is not showing up. ive tried instead of ./log.log, just log.log, /log.log, etc, to no success. any help appreciated.

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

    Data Structure for efficient merging.

    Posted: 21 May 2020 10:44 AM PDT

    I am learning javascript and I am wondering if there is some kind of shortcut where is don't have to write "x === 100 || y === 100 || x + y === 100" like in the code below where I can just write/check if they are equal to 100 once instead of having to check if they are equal to 100 three times.

    Posted: 21 May 2020 12:23 AM PDT

    let isEqualTo100 = (x, y) => x === 100 || y === 100 || x + y === 100; 

    I don't know, it just seems a bit redundant coming from using languages like Haskell.

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

    flask webpage display image relative to time

    Posted: 21 May 2020 04:49 PM PDT

    Just been introduced to flask and creating webpage with python. I'm having trouble solving this: Produce a web page that displays one image for per hour for the time when the current request was received: image1 for morning and image2 for afternoon.

    im making use of (return render_template in python and have the option of using the random module and time functions within python along with img tags but i'm stumped into how to set this up.

    code so far :

    from flask import Flask, render_template import random import time @app.route("/hours") def hours(): return render_template("hours.html") if __name__ == "__main__": app.run() 
    submitted by /u/mysterycoder
    [link] [comments]

    how to change the link area?

    Posted: 21 May 2020 04:42 PM PDT

    i'm linking to the benefits section, but i wan't the link to be a little bit up on this particular section because i have some text on top of it and i wan't the user to be able to read the text if he clicks on the link

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

    Adding Assembly References using C# and VS Code without dotnet

    Posted: 21 May 2020 04:12 PM PDT

    I've been developing a program using C# in VS code. I've only ever compiled it using csc and then running the executable it spits out. Other than file I/O I'm not using any other files to compile. Now that I want to add a GUI to the program, System.Drawing and System.Windows.Form are not being used correctly and I am being told that

    The type or namespace name 'Form' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)

    I know this is a simple fix in regular Visual Studio but I still want to do as much as possible in VS code.

    This is the first rather large program I have done using C# and everything I look up refers to dotnet terminal commands which I have not been using. Additionally, using dotnet new made a directory with a boatload of files that did not seem necessary. Running dotnet publish also made an executable that would not run. Am I complicating things too much by staying in VS code? Is there anyway for me to salvage work I have done up to this point? Thanks a ton in advance!

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

    I am working on a project related to SSH key management. I have a question regarding what steps does an organization takes to ensure that an employee who is leaving the company no longer has access to any of the company servers(on cloud)?

    Posted: 21 May 2020 10:04 AM PDT

    How to pass a variable from a c++ program to a python program?

    Posted: 21 May 2020 11:31 AM PDT

    I have a unique scenario where I need to pass a variable from a c++ program to a python program. Basically the c++ program sets a variable and then needs to send that variable to my python server (both the c++ code and python server live on the same raspberry pi) so my python server can then relay that message to all of its python clients. Is there an easy/best way to do this?

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

    What is the best programming language for me?

    Posted: 21 May 2020 02:59 PM PDT

    Hello programming gurus, I was wondering what is the best programming language for me since I am a starting programmer myself, learning python3 atm.

    I am a really basic python programmer, recently learned how to make a calculator and that kind of noob stuff.

    Back to the question, I am really in to doing cyber security and but I really dont know where to start, what coding language to learn.

    Read a lot in the internet but too many different opinions. Maybe you guys can help me? :)

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

    Given network address translation, what does a subnet mask mean?

    Posted: 21 May 2020 02:45 PM PDT

    My understanding is: a subnet mask distinguishes the host and network bits in an IPv4 address.

    Given I'm hiding behind network address translation in my home, what does the subnet mask mean? Will it always be 192.168/16 (mask 255.255.0.0)?

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

    Is this what it means to have a website "in the cloud"?

    Posted: 21 May 2020 02:06 PM PDT

    Should mention: complete newbie in networking.

    Using dig, we see it uses cloudflare nameservers.

    $ dig thepiratebay.org ; <<>> DiG 9.14.8 <<>> thepiratebay.org ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1122 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 5 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;thepiratebay.org. IN A ;; ANSWER SECTION: thepiratebay.org. 300 IN A 162.159.136.6 thepiratebay.org. 300 IN A 162.159.137.6 ;; AUTHORITY SECTION: tHEPirAtEbay.org. 82106 IN NS sevki.ns.cloudflare.com. tHEPirAtEbay.org. 82106 IN NS deb.ns.cloudflare.com. ;; ADDITIONAL SECTION: deb.ns.cloudflare.com. 79504 IN A 173.245.58.92 deb.ns.cloudflare.com. 79504 IN AAAA 2606:4700:50::adf5:3a5c sevki.ns.cloudflare.com. 82106 IN A 162.159.44.164 sevki.ns.cloudflare.com. 82106 IN AAAA 2606:4700:58::a29f:2ca4 ;; Query time: 5 msec ;; SERVER: 18.0.71.151#53(18.0.71.151) ;; WHEN: Thu May 21 16:53:20 EDT 2020 ;; MSG SIZE rcvd: 233 

    It's a cloudflare ip address.

    $ whois 162.159.136.6 # # ARIN WHOIS data and services are subject to the Terms of Use # available at: https://www.arin.net/resources/registry/whois/tou/ # # If you see inaccuracies in the results, please report at # https://www.arin.net/resources/registry/whois/inaccuracy_reporting/ # # Copyright 1997-2020, American Registry for Internet Numbers, Ltd. # NetRange: 162.158.0.0 - 162.159.255.255 CIDR: 162.158.0.0/15 NetName: CLOUDFLARENET NetHandle: NET-162-158-0-0-1 Parent: NET162 (NET-162-0-0-0-0) NetType: Direct Assignment OriginAS: AS13335 Organization: Cloudflare, Inc. (CLOUD14) RegDate: 2013-05-23 Updated: 2017-02-17 Comment: All Cloudflare abuse reporting can be done via https://www.cloudflare.com/abuse Ref: https://rdap.arin.net/registry/ip/162.158.0.0 ... 

    Finally, if you actually type in the ip address, 162.159.136.6, into the browser, you get the message: "You've requested an IP address that is part of the Cloudflare network. A valid Host header must be supplied to reach the desired website."

    I have a few further questions.

    • Is using Cloudflare a way to avoid being taken down? They can't just taken down that one ip address.
    • Can you use the same ip address for multiple domains (once you're in cloudflare land, you dispatch the data to customers' servers)
    submitted by /u/extremeaxe5
    [link] [comments]

    Do functions actually have to CALL themselves to be considered recursive?

    Posted: 21 May 2020 06:12 AM PDT

    From https://en.wikipedia.org/wiki/Recursion_(computer_science)

    recursion solves such recursive problems by using functions that call themselves from within their own code.

    Consider the following functions eagerRandom and lazyRandom:

    class Example { public static Sequence<Double> eagerRandom() { return new EagerSequence<Double>(Math.random(), eagerRandom()); } // ^^^^^^^^^^^^^ public static Sequence<Double> lazyRandom() { return new LazySequence(Math.random(), Example::lazyRandom); } // ^^^^^^^^^^^^^^^^^^^ } 

    Clearly, eagerRandom is a recursive function, because it contains the recursive call eagerRandom(). It also crashes, because an infinite number of eagerRandom activation frames eventually blow the call stack :)

    lazyRandom contains the method reference Example::lazyRandom, but it doesn't actually CALL itself. There is never more than one lazyRandom activation frame on the call stack at any given time. Would lazyRandom still be considered recursive?

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

    Long and int variables return different answer

    Posted: 21 May 2020 09:18 AM PDT

    I was adding all varisbkes in and array and when i made the sum a long and integer variables they each returned a different answer

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

    Electron, PixiJS, and Content Security Policy

    Posted: 21 May 2020 12:59 PM PDT

    Wanting to learn PixiJS after having had a ton of fun over the past year playing Adventure Land (an open ended javascript programming mmorpg that uses Electron and PixiJS), looking to dive deeper.

    Using Visual Studio Code and installed both electron and pixi.js packages via npm into the project. In attempt to run the most basic proof of concept, the app fails to run throwing the following warning:

    Uncaught Error: Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support. at ShaderSystem.systemCheck (ShaderSystem.js:61) at new ShaderSystem (ShaderSystem.js:29) at Renderer.addSystem (Renderer.js:289) at new Renderer (Renderer.js:166) at Function.create (Renderer.js:47) at autoDetectRenderer (autoDetectRenderer.js:36) at new Application (Application.js:67) at game.js:1 

    There is a package available (@pixi/unsafe-eval) that provides a workaround, but from what I can tell it would sacrifice a lot of performance and possible features that I want to learn. Further, with respect to the security policy, it appears that that disallowing eval() statements is to protect against the security threat of getting data from untrusted sources and being run. All my data is going to be local, so as far as I understand, it is not a concern.

    Further, this article (https://content-security-policy.com/examples/electron/) seems to imply developers are responsible for their own security and that no such policy exists leaving me wondering, "why am I getting this error?"

    The examples in the official PixiJS documentation are not using Electron, so not getting help there.

    Any insight into to solving this problem so I can work the examples provided, but with Electron, would be greatly appreciated.

    Package,json:

    ... "main": "main.js", "scripts": { "start": "electron ." ... 

    main.js:

    const { app, BrowserWindow } = require('electron') function createWindow() { // Create the browser window. const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } }) // and load the index.html of the app. win.loadFile('index.html') // Open the DevTools. win.webContents.openDevTools() } // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. app.whenReady().then(createWindow) // Quit when all windows are closed. app.on('window-all-closed', () => { // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit() } }) app.on('activate', () => { // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (BrowserWindow.getAllWindows().length === 0) { createWindow() } }) // In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here. 

    index.html:

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Pixi!</title> <!-- https://electronjs.org/docs/tutorial/security#csp-meta-tag --> <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> </head> <body> <script src="./node_modules/pixi.js/dist/pixi.js"></script> <script type="module" src="game.js"></script> </body> </html> 

    game.js:

    const app = new PIXI.Application(); document.body.appendChild(app.view); const texture = PIXI.Texture.from('./animation.jpg'); const tilingSprite = new PIXI.extras.TilingSprite( texture, app.renderer.width, app.renderer.height ); app.stage.addChild(tilingSprite); let count = 0; app.ticker.add(() => { count += 0.0005; tilingSprite.tileScale.x = 2 + Math.sin(count); tilingSprite.tileScale.y = 2 + Math.cos(count); tilingSprite.tilePosition.x += 1; tilingSprite.tilePosition.y += 1; }); 
    submitted by /u/adelie42
    [link] [comments]

    Quick question about utilizing hash tables in interview/leetcode questions

    Posted: 21 May 2020 09:03 AM PDT

    Apologies if this is a silly question, but is my understanding correct that for the majority of Leetcode questions you're not really using a hash table but really just objects?

    Like, when you use a 'hash table' in a Leetcode question you're not really hashing anything with a hash function.

    Instead, the main thing you're using is the key:value property associated with objects that allows for O(1) access, insert and deletion.

    Just wondering if the line of thinking is correct.

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

    No comments:

    Post a Comment