• Breaking News

    Wednesday, August 22, 2018

    Can any language really be "faster"? Ask Programming

    Can any language really be "faster"? Ask Programming


    Can any language really be "faster"?

    Posted: 22 Aug 2018 01:53 PM PDT

    When comparing the "speed" of languages like C++ vs Swift aren't you really comparing the efficiency of the Compilers? I ask because I'm interested in programming for Audio, and it seems like most Audio stuff is done in C++... presumably because it is a low level language.

    But comparing Swift and C++, both are Compiled "Ahead of Time" to machine code... Yet I read that Swift is not yet as fast as C++ in many contexts. I don't see audio frameworks suitable for things like virtual instruments in Swift, and my guess is because of performance limitations.

    So is there anything inherently faster about a lower level language like C++ vs Swift? Since they both get compiled ahead of time to native machine code I imagine more efficient Swift Compilers of the future will bridge the gap? Is it because for performance critical programs it can be useful for a knowledgeable C++ developer to take more control over memory management and other things that would be done auto-magically by the compiler of a higher level language like Swift?

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

    constexpr vs const c++

    Posted: 22 Aug 2018 08:09 PM PDT

    hello, i'd like to know the difference between constexpr and const, from what i've read they are the same... but i dunno maybe i'm missing something.

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

    What actually happens in the background during a write system call?

    Posted: 22 Aug 2018 05:23 PM PDT

    I've seen weird results from profilers on IO bottlenecked code. Stuff like the profiler claiming most of the time comes from a write operation, but then if you remove that write operation (and make no other changes) the total time doesn't reduce— the profiler just points to a different call instead.

    I know that there's multiple levels of caching involved (if you're writing to a disk, it may physically have a cache in it. There may be a buffer in the kernel. If you're writing to a network stream maybe there's a physical buffer in the Ethernet card etc).

    What I want to know is what from the application perspective happens when caching is involved and the buffers are full/empty at various levels? What parts of the process can be going on in the kernel in the background while the application is executing another line of code?

    E.g could it be that a call to write returns instantly (something like kernel just logs a job to do the data transfer but doesn't actually do anything immediately?)

    Will it definitely do a memory copy at time of call (e.g kernel completely copies your buffer to it's own buffer, the write call then returns while in parallel it actually transfers to hardware?) Or can it be more magical than that and defer the memory copy until you try to modify the memory you gave to the system call?

    What if the buffers are full? Is that when the write call blocks while stuff is transferred to disk / sent out on the wire until there's room in the buffer?

    submitted by /u/inarticulate-carrot
    [link] [comments]

    Algorithm recommendation for distributing debt payments

    Posted: 22 Aug 2018 05:36 PM PDT

    I'm working on a software for poker gambling, and a feature I'm attempting to implement is one that directs a group of people to settle debts between themselves. I have code to represent players, which can buy in to a table. When they leave the table, they should enter their final chip counts, and the algorithm should decide who owes who money to efficiently settle the debts.

    Currently, I'm working with sorted arrays of users, 1 of the winning players, 1 of the losing players. It then allocates by iterating through the losers array, settling winners debts in order.

    It works fine, but I'm trying to practice my algorithmic thinking. Could this best be accomplished with any kind of algorithm? I can vaguely see this modeled as a graph problem/flow problem but I am not sure exactly how I could pull it off.

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

    Why did application development shy away from C, with the exception of the GNU/Linux community?

    Posted: 22 Aug 2018 09:15 PM PDT

    Probably one of the odder aspects of the free software movement is that so many programs are written in straight ANSI C, and continue to be so, even when languages like C++, Java, or even now JavaScript were/are at the top of their popularity for application development. What is the reason for C's remarkable longevity in application development, in this community?

    But moreover, if C written programs continue to be popular and productive for Linux users, why did application development for other platforms shy away from it?

    submitted by /u/3MuchCaffeine5Me
    [link] [comments]

    If an operating system totally crashes (in vbox) a snapshot can restore to a previous working state?

    Posted: 22 Aug 2018 04:58 PM PDT

    Im asking this because once i crashed my ubuntu virtual machine trying to change some root permissions, and i want to know if the snapshots feature works on that cases..

    submitted by /u/Don-g9
    [link] [comments]

    Just how fast is MongoDB?

    Posted: 22 Aug 2018 07:39 PM PDT

    Is it feasible to have 10,000,000 entries into the DB and then query 100,000 of them? How fast would that be?

    submitted by /u/Anonymous-Kid-Cookie
    [link] [comments]

    How was your JavaScript interview this 2018?

    Posted: 22 Aug 2018 08:30 AM PDT

    I just applied for a Senior JavaScript position and my last interview was 3 years ago. The position says expertise on JS to use React and Node. I want to know how does it look a JS interview for a senior on 2018.

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

    How would I set up a database so I can view a cvs file with 364 columns and 310 million rows?

    Posted: 22 Aug 2018 11:05 AM PDT

    I am completely out of my depth here. I have broken up the file into 310 files with 1 mil rows each (took 7 hours, each file is 1.3+gig in size) because my computer simply cannot read the original file, which is 409gigs.

    I am needing a way to view, edit, sort, and print/save changes to this huge ass file, but I don't know what the best way would be to do it? Set up a database, sorta like wordpress, and go from there?

    If anyone has any ideas, I am willing to try anything. I have currently tried TAD (Tabular Data Viewer) but due to an error on the 75millionth line, it wouldnt go any further and I was unable to edit the file to fix the error.

    Please, I need help.

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

    Need some help to "register" old census data

    Posted: 22 Aug 2018 05:19 PM PDT

    Hi,

    I am a researcher and I need to obtain some data from an old census product released in the 1990s. I have obtained a legitimate copy of the product from my state library. To use the CDs back in the day, it was necessary call the publisher, quote the serial number, and they would then issue a registration number. Entering the correct registration number unlocks the product.

    Unfortunately the product is no longer sold or supported and the publisher can no longer provide a registration number. The statistics agency has also advised that they cannot supply the data I'm looking for. It's so frustrating as this is pretty basic census data and I need it as part of my research on land use change.

    I'm looking for some help to crack this so I can access the census data contained on the CDs. Normally I wouldn't attempt this on software, but considering this was produced at public expense, is no longer supported or sold, I have a legitimate copy, and it is for research purposes, I figure it's fair game.

    I've looked at trying to bypass the registration but I don't think that's how it works... basically this registration process is occurring within a MapInfo application (MBX). Until the registration number is entered, the MapInfo data is not readable, so I'm guessing this is some form of encryption? The data tables I need are all just sitting there, but it seems without the registration number I can't open/view them. The software doesn't need an internet connection, so the mechanism to unlock must be localised.

    Would really appreciate it if someone can help me or point me in the right direction on this. I'm a complete novice and have no idea what I'm doing.

    I've also asked this question over at /r/codes, RElounge, and /r/howtohack.

    Many thanks!

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

    Knight Rider with a single for loop

    Posted: 22 Aug 2018 03:42 PM PDT

    I'm getting old, can somebody please create me a single for loop with a single "write line" for the given output?

    1,2,3,4,5,4,3,2,1

    Edit: I'm looking for something like:

    for (int i = 0; i < 10; i++)

    {

    WriteLine (magic formula);

    }

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

    How do you manage to stay consistent and motivated while teaching yourself to program?

    Posted: 22 Aug 2018 10:35 AM PDT

    PyQt5 problem creating objects while threading

    Posted: 22 Aug 2018 07:09 AM PDT

    I have a class which extends QWidgets.QWizard, which has a "downloader" class which extends QWidgets.QWidget, which contains its own WorkerThread class definition:

    class Downloader(QtWidgets.QWidget) class WorkerThread(QtCore.QRunnable): def __init__(self,function,*args,**kwargs): super().__init__() self.fn=function self.args=args self.kwargs=kwargs @QtCore.pyqtSlot() def run(self): self.fn(*self.args, **self.kwargs) def __init__(self,parent): super().__init__(parent) self.threadpool=QtCore.QThreadpool(parent=self) . . . 

    The downloader class receives a list of dictionaries representing a list of things to be downloaded and information about where and how to retrieve them via a pyqtSignal. My goal was have the slot that handles this signal to use self.threadpool to reserve a thread and run a WorkerThread object for each item on the list, rendering and scraping a webpage in the background while not blocking the main eventloop. In each WorkerThread, an off-the-record (non-caching) QWebEngineProfile is created with the default constructor and a QWebEnginePage is created using that web profile:

     def download(self,item): profile=QWebEngineWidgets.QWebEngineProfile() page=QWebEngineWidgets.QWebEnginePage(profile) . . . 

    According to the Qt Docs, the default value for the parent arg of these constructors is Q_NULLPTR i.e. the object does not have a parent, so theoretically I should be able to create these objects in the WorkerThread and use them to run scraping and downloading tasks in parallel, however, when I go to run my code, I get the following error printed in my console:

    QObject: Cannot create children for a parent that is in a different thread. 

    I totally understand why you would not want to create parent/children in different threads, however, according to the docs, profile and page shouldn't have any parents at all! I tried explicitly setting the parent=None via the kwargs of the QWebEngineProfile and QWebEnginePage's constructors, but I get the same message. What the hell is going on here? Not pictured in my code snippets is some intra-Downloader class signalling for the threads to send their results back to the main thread and a signal form the main thread of the Downloader to signal to the QWizard that all the tasks are complete and pass the results back, but these should not matter as the entire point of signals is for threads to communicate with each other. I figure I could create a single QWebEngineProfile and Page object in the main thread and use a QMutex to serialize access to it, however, I wanted to run these tasks in parallel, each with their own page.

    Edit: My installed Qt version is 5.9. The Qt docs that come up by default are for 5.11 unless you specify otherwise. There were significant changes to QThreadPool between 5.9 and 5.11

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

    Polyomino Solver (Packing Problem Solver)

    Posted: 22 Aug 2018 11:39 AM PDT

    Hello, i'm newer to programming and took a bootcamp class where I learned Python and Java and am now enrolled in a course where we are to complete a grand project and hopefully get an internship with some tech company. I have been working on a program much like this one, https://cemulate.github.io/polyomino-solver/ - that solves packing puzzles. You are given a "container" and various shapes and you are tasked with fitting those shapes perfectly into said container. I got the idea from this puzzle game from Target https://www.amazon.com/Brainwright-Cat-Stax-Perfect-Puzzle/dp/B01016ARTQ .

    I have already put a lot of time into the project and it solves 2 dimensional problems very quickly and consistently, but I have run into some struggles with 3 dimensional objects. It solves inconsistently, sometimes with a quick solution being spit out, sometimes after minutes of waiting, or sometimes after such a long wait that I kill the program before a solution is returned.

    I'm looking for advice on the project, and I find articulating my questions and ideas is hard through writing, and I was hoping to meet with a teacher at the local community college or maybe popping by a college campus and dropping on a professor, or just finding someone that has tackled this sort of problem before.

    Can someone give me a name for this sort of problem I am trying to solve? Is it more of a mathematical problem? Or is it strictly computer science? Is it game theory (I don't even know if game theory applies here)? And I was also wondering if could gauge how difficult this problem is to solve. If you have any experience in writing programs that are to "solve" games, I would love your input.

    Thanks.

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

    Python Flask UML Diagrams

    Posted: 22 Aug 2018 11:36 AM PDT

    Hi there,

    For a uni project I've created a relatively simple Flask web app that intergrates with a database using SQLAlchemy. I need to write about the architecture of the program including drawing UML diagrams but I'm pretty inexperienced with UML (read, they didn't teach it to us properly but want us to use it) and can't work out how the different diagrams can be applied to the Flask application.

    My program has a module app.py containing 2 view functions input() and results() and several other helper functions. There is then a models.py module that contains the SQLAlchemy models that map to my database and html/css files in the templates and static folders respectively.

    Firstly, can a class diagram be used to model a python module that doesn't contain an actual class? If not how is this done?

    What other diagrams would be best to demonstrate the app design, sequence/activity to show how the app functions?

    Any help is much appreciated, thanks!

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

    Compare strings using pointer instead of strcmp. Please help!

    Posted: 22 Aug 2018 07:10 AM PDT

    As the title states, I need to write a C program(Atom for Mac) that compares two strings using pointers instead of strcmp. It would be really appreciated if anyone can help me!

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

    Our developers don't understand the Java code

    Posted: 22 Aug 2018 12:26 AM PDT

    We have adopted a java project written by a senior developer that has very good reputation. The problem we are facing now is that no one can understand his code. There are layers upon layers of abstractions and most functions are heavily chained. Here is one typical example:

    return animalSpeciesService.listByCriteria(AnimalSpeciesCriteria .newBuilder(orderedHits.stream().map(Hit::getAnimalSpeciesId).collect(Collectors.toList())) .locale(locale).defaultAuth(auth).build()); 

    How should we approach this problem? Do we need to hire more experienced developers?

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

    Cant run Gulp on local project

    Posted: 22 Aug 2018 10:00 AM PDT

    First i did npm init
    in my project folder.

    Then, When i install gulp locally it gives errors:

    npm install --save-dev gulp WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN rollback Rolling back copy-descriptor@0.1.1 failed (this is probably harmless): ETXTBSY: text file is busy, unlink '/home/kmms/Desktop/windowsshare/htdocs/others/tests/gulpTest/node_modules/copy-descriptor/package.json.3172759510' npm WARN rollback Rolling back get-value@2.0.6 failed (this is probably harmless): ETXTBSY: text file is busy, unlink '/home/kmms/Desktop/windowsshare/htdocs/others/tests/gulpTest/node_modules/get-value/package.json.3192331607' npm WARN gulptest@1.0.0 No repository field. npm ERR! path /home/kmms/Desktop/windowsshare/htdocs/others/tests/gulpTest/node_modules/copy-descriptor/package.json.3172759510 npm ERR! code ETXTBSY npm ERR! errno -26 npm ERR! syscall rename npm ERR! ETXTBSY: text file is busy, rename '/home/kmms/Desktop/windowsshare/htdocs/others/tests/gulpTest/node_modules/copy-descriptor/package.json.3172759510' -> '/home/kmms/Desktop/windowsshare/htdocs/others/tests/gulpTest/node_modules/copy-descriptor/package.json' npm ERR! A complete log of this run can be found in: npm ERR! /home/kmms/.npm/_logs/2018-08-22T16_08_47_082Z-debug.log 

    Then i tried to run a task but unsuccessfully:

    gulp message [17:17:31] Local gulp not found in ~/Desktop/windowsshare/htdocs/others/tests/gulpTest [17:17:31] Try running: npm install gulp 

    My OS is Ubuntu 18.04.

    Gulp is also installed globally ( npm install -g gulp
    )

    How can i fix this?

    submitted by /u/Don-g9
    [link] [comments]

    How to do QC on spam-ware?

    Posted: 22 Aug 2018 09:14 AM PDT

    I'm just curious if anyone knows how spamware outfits do quality control on their product. My Android phone has gotten a virus that I can't seem to get rid of. It has taken over one app (persisting across resetting the phone and redownloading the app from Play Store, but it's a major vendor behind the app so it's not them), notifying me regularly that "I have a new message", which is really a link to what must be some affiliate program the spamware vendor participates in. It disables the phone's buttons. It takes over the whole screen to promote its affiliate links, and the only way out is to reboot -- several times a day.It spams the wallpaper with icons for other apps that really link to launching its affiliate links. It's a rootkit - it survives resetting the phone to default state. I'm ready to buy a new phone (need one anyway).

    Which got me to thinking: if you're developing such a thing, how do you recline in your chair and decide: "Wow! This is really annoying enough to meet our specs, my work is done!"? Do they do A/B testing with "annoying" and "super annoying" versions of their malware? Are there E2E testing suites to help craft a better virus ("should block third incoming phone call with affiliate ad")?

    submitted by /u/calligraphic-io
    [link] [comments]

    Browser cache, Server Cache and Database cache: which methodologies and frameworks/tools exists ?

    Posted: 22 Aug 2018 05:30 AM PDT

    I know that for browser caching we have web storage, indexed database api, web sql and cookies to do this job. I also know that memcached and localForage are great tools for that. But what about the server and database cache?

    submitted by /u/Don-g9
    [link] [comments]

    SSL Problems - ERR_CERT_COMMON_NAME_INVALD

    Posted: 22 Aug 2018 05:03 AM PDT

    Hello everyone,

    one of my users from France cannot access / use my small webapplication because the given error.

    I did test with various online SSL Tools and found no problems. My app does not have many users so it's hard for me to tell if more people have this problem.

    This is why I would appreciate if a third person from here could look at my homepage/certificate if something is wrong.

    https://www.btree.at/app/login/

    Any help would be much appreciate.

    Thanks.

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

    Is everything now webdevelopment?

    Posted: 21 Aug 2018 10:04 PM PDT

    Where does the line between webdevelopment and not-web-development lie?

    At the moment it seems that almost every piece of software a business might need is web development. A bank wants to build a new tool to manage loans? It likely will have a backend with an API, and a HTML/JS/CSS front end.

    A company makes a chat client? It will likely be have a backend with an HTTP API, perhaps some sockets, and a front end that may be written in JS/HTML/CSS/Electron.

    With PWS, even mobile apps are following the trend. Need an app so you can order stray cats in a timely manner? Backend with HTTP server, and front end which may be in swift/Kotlin/Java.. but also might just be a Angular6/React Progressive web app.

    The only things that appear to remain as non-web development are hardware specific coding like embedded/C++ for robotics / and low level OS programming.

    Is this an accurate view? Are we moving in a world (If we're not there already) where everything will be a webapp? Gone are the days of writing C# .exe file to manage client orders? Hello to the world where everything is a SAAS app?

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

    TokenError: Unauthorized in passport-google-oauth20 using node.js

    Posted: 22 Aug 2018 01:20 AM PDT

    When I am trying to make an authentication with passport-google-oauth20 then at the time of siginin in getting

    TokenError: Unauthorized (https://stackoverflow.com/q/51949590/8548451) .please help to fix this .

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

    No comments:

    Post a Comment