• Breaking News

    Saturday, January 11, 2020

    Binding Database Id to input field names Ask Programming

    Binding Database Id to input field names Ask Programming


    Binding Database Id to input field names

    Posted: 11 Jan 2020 08:03 PM PST

    I was finding answers for this question for a while, and couldn't find it. Hope you'll can help :)

    I found out binding input fields name to integer values are not a good practice, but I don't know how else I can do this.

    I have to generate dynamic input fields to submit user's medical test results. To associate these inputs with the test ids, I have put the key of the inputs as the ids of the test data table.

    my current database design

    Test Data

    | id | test_id | test_data | |----|---------|-----------| | 1 | 1 | aaa | | 2 | 1 | bbb | 

    Test Results

    | id | client_test_id | test_data_id | result | |----|----------------|--------------|--------| | 1 | 1 | 1 | 120 | | 2 | 1 | 2 | 230 | 

    Is there another way I can get results of the test data input fields without implementing it this way?

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

    Do you guys also spend hours on stupid mistakes ?

    Posted: 10 Jan 2020 10:40 PM PST

    Like, syntax fuckups or wrong variables ?

    I spend hours regularly on bugs I believe to be "something" when in reality it's a small overlook that I stumble across by accident when I'm near suicide.

    I think that is because I never had formal training and don't really understand some of the thing I use like Spring or Hibernate. I know what they do but not "How"... I hate these black boxes.

    So, does it happen to other, real, developers ?

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

    Dynamic angular app hosted on github pages?

    Posted: 11 Jan 2020 09:40 PM PST

    Is there a way to host my angular app? I am working on a 'blog-reddit like' angular project where I had hoped to be able to post stuff just as one would in twitter/mastodon/facebook/reddit/blogging. I had also thought of using that as a way to publicly present my other projects as I would not need to show my source code and just the final/concept app. I did look into firebase and such but I would like to have more control over it and be more privacy-controlled. I am not really sure how one hosts their dynamic webpage.

    In short I would like to be able to:

    1. Host my webpage so that when visitors scroll the virtual/infinite scrolling feature works fine.
    2. Have some controlled database where my posts and media stays and is only shown depending on what fits on the user's page.
    3. Be able to control who visits (if possible).

    Sorry if this sounds ridiculous.

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

    Can someone explain to me how to approximate Ideal Lambertian Diffusion?

    Posted: 11 Jan 2020 12:52 PM PST

    https://raytracing.github.io/books/RayTracingInOneWeekend.html#wherenext? at the diffuse materials second (#8) - the author somehow randomizes points on the sphere, and this somehow gives the impression of it having shadows and all that. I have it coded it, but don't fully understand how this comes to be. Could someone explain this?

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

    The Bad Side of Variables

    Posted: 11 Jan 2020 08:06 PM PST

    Hello guys, so I and my friend decided to create a blog and shares random stuff about programming in general. I've made a new blog post about variables. Please visit our site and leave comments on how we can improve it. Many thanks !

    https://www.sekolahcode.com/the-bad-side-of-variables/

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

    Need help with bringing up only the four digits numbers from a range given by the user.(in C language)

    Posted: 11 Jan 2020 11:57 AM PST

    Hey guys, i have an assigment in which i need to have the user input a range(like 1-10000).From the given range i need to find all the four digit numbers, then remove the second digit from left to right.Then i need to find all the numbers that divide by 11 from the three digit range.So far i know how to make the program find out all numers that divide by 11 in a the given range.The thing that confuses me is limiting the range to only the 4 digit numbers and then removing the second digit from that range.I tried searching online for some similar problems but i find nothing useful and my uni teacher is even less useful.Any tips/ideas are appreciated.Im really stuck right now trying to find some info but i cannot sadly, so any help is gonna help tremendously.

    submitted by /u/21Kombainer
    [link] [comments]

    Database for Geometric TimeSeries

    Posted: 11 Jan 2020 12:17 PM PST

    So I have this device that sends each half an hour it's location (latitude and longitude) and a couple of other numerical values.

    I don't have much experience in building databases and I would like to know what is the best type of database and how should I organize the data if I want to make API queries based on range for the latitude and longitude?

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

    Are Code Kata's effective for improving your coding performance?

    Posted: 11 Jan 2020 03:53 PM PST

    Career shift into programming?

    Posted: 11 Jan 2020 02:00 AM PST

    Hey Reddit!

    I'm currently an ESL teacher abroad but I hate my job and after years of umming and ahhing I've decided to make a career shift.

    I got into programming a little in school - some very basic python stuff essentially, and today I mod games so I have a basic familiarity with lua and databases.

    So I've got some questions that I hope someone can give some info on!

    1. Should I take a formal qualification? Or are online courses / workshops enough to get a job? I already have a bachelor of english - I guess I wouldn't rule out a second bachelor but I'd prefer not to.

    2. What kind of jobs could I realistically aim for, and what languages would be best to start? I'm guessing Javascript is quite useful for both web development and software applications, so a good starting point. I think I'd prefer software development to web development, but I wouldn't rule it out if it's a high demand job.

    Thanks for any help guys

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

    How can I resume to a specific part in my programm without restarting the whole .exe again? C++ Debugging

    Posted: 11 Jan 2020 08:04 AM PST

    Let's say I have a code where I read 2Gbytes of a txt file. Reading takes about 5seconds.

    After reading it is executing function peter().

    I now want to change some parts in my code and restart at the function peter() again without needing to load the whole damn txt file again.

    Im using Visual studio community 2019.

    I can't phrase my question good so google is giving me bullshit.

    Any brother out here who can give me the keyword Im searching for.

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

    Script / soft to manage folder images ?

    Posted: 11 Jan 2020 07:08 AM PST

    Hello people, maybe this post is irrelevant (don't hesitate to indicate me a better forum for that kind of questions) but I was wondering if any of you could advice me a good script / software to manage folders images ?
    For the details, as a professional animator / rigger I have many folders containing illustrations of the inside file that I want to set automatically as folder image. Simple task, but google couldn't help me this time.
    They're all called "preview" but sometimes the folder image change on its on and I have to reset it all manually and I'm enough. If any of you have a solution I'd be grateful !

    submitted by /u/Jimmy-JimJim
    [link] [comments]

    Returning a function [Python] [OOP]

    Posted: 11 Jan 2020 10:25 AM PST

    I want to have lots of methods for solving the same problem but in a different way and I want to specify which method I want to use the moment I create an instance of myClass

    What I want is to do something like this: instance = myClass(method="Whetever I choose") instance.method() 

    And myClass would be something like this

    myClass(): def __init__(self, method): self.method=method def method(self): if(method == "method1"): return method1() elif(method == "method2"): return method2() etc... ..... def method1(self): return sth def method2(self): return sth 

    Is this the best way to solve this problem?
    I'm currently struggling with OOP and everything I do seems to me as if it's not the best way of structuring my code.

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

    Having problems with coding responsive table in mobile site format

    Posted: 11 Jan 2020 09:59 AM PST

    I need to make a website (for school) with responsive table that for both desktop and smarthpones, and I got the website small enough but the responsive table is too wide and sticks out so I wanted to ask how to adjust to fit in the site. I have a 5x5 table but I think it's best to put it under eachother instead of having it wide.

    Very new to coding but do I need to put the code here as well?

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

    Fullstack web development library

    Posted: 11 Jan 2020 09:04 AM PST

    I am seeking for a library with the following features.

    1. User functionality coming out of the box with possibilities for customization.
    2. Ability to define schemas that generate the database and the API.
    3. The schemas can generate API's with support for file uploads.
    4. The schemas support locations, and location based searches (geographical) out of the box.
    5. The schemas also generate search API endpoints for the objects they represent.
    6. The schemas also generate search API endpoints with full text search support for any language.
    7. Internationalization is enforced, the schemas objects they represent can be represented and displayed in "any" language.
    8. SEO is generated automatically.
    9. The web application works offline, service workers, and caching so that it's totally functional offline to a given scope.
    10. The web application is installable (manifests) are generated automatically.
    11. The application is real time.
    12. The server uses caching to speed up requests.
    13. The server API security is generated automatically.
    14. Other custom clients can connect to the API.

    Overall I only need to worry about the UI; and the schemas.

    It can be written in any technology, I suspect such a thing must be written in angular/react/vue/etc... for the client side, commercial or not.

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

    [HTML JS] Putting a script file in the header prevents me from accessing the body and DOM. Why does everyone ever put scripts in the head, when you limit the functionality by not putting it in body?

    Posted: 11 Jan 2020 04:45 AM PST

    I just spent 3 hours figuring out why my code doesn't work. I remembered I had some trouble with jquery, and chronology and hierarchy matters, so I went out on a limb and supposed that body doesn't even get created at that point, so you can't access it. And what do you know, it worked.

    But that kinda sucks.

    I literally generate all my html with createelement and appendchild, so it was essential that body exists.

    I don't know. I wrote so much javascript, and I never had this problem. But thne again, I never generated HTML dynamically.

    Can you tell me some reasons why someone would elect to put javascript in the head, and why would someone put it two lines lower in the body? ( I guess I know one possible scenario for the latter).

    And the most important question:

    what should I do? And what are upsides and downsides of either approach?

    Tnx!

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

    Is APIs overused?

    Posted: 11 Jan 2020 06:56 AM PST

    Hey been working professionally for about two years now and we currently have around 15 apis for various projects.

    I do see the benefit at most times. Like being able to send and get data from a single point. Failures and data quality will always be the same. And if you have to use it for other future projects you are up and running.

    However. Some projects I have usually only need a handful of things from the API and most of the times I just feel limited by the queries. I just rather find it easier to make my own requests in the application directly against the DB. That way I can write my own queries and get exactly what I want.

    What more reasons are there to use APIs instead of direct DB queries?

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

    TreeView - Removing expand/collapse icon when there are no children

    Posted: 11 Jan 2020 06:37 AM PST

    I'm building a TreeView in `react` with the Treeview component from Material UI: https://material-ui.com/components/tree-view/

    I have created the component below which fetches data when a node is expanded. Furthermore, the tree is build so each node that have children also is a tree of MyTreeItem
    , but I have one question:

    When I reach a point where there are no more children, I want to remove/hide the expand/collapse icon. How can i achieve this?

    import TreeView from "@material-ui/lab/TreeView"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; import ChevronRightIcon from "@material-ui/icons/ChevronRight"; import TreeItem from "@material-ui/lab/TreeItem"; const { useState, useCallback } = React; export default function MyTreeItem(props) { const [childNodes, setChildNodes] = useState(null); const [expanded, setExpanded] = React.useState([]); function fetchChildNodes(id) { return new Promise(resolve => { setTimeout(() => { resolve({ children: [ { id: "2", name: "Calendar" }, { id: "3", name: "Settings" }, { id: "4", name: "Music" } ] }); }, 1000); }); } const handleChange = (event, nodes) => { const expandingNodes = nodes.filter(x => !expanded.includes(x)); setExpanded(nodes); if (expandingNodes[0]) { const childId = expandingNodes[0]; fetchChildNodes(childId).then( result => result.children ? setChildNodes( result.children.map(node => ( <MyTreeItem key={node.uuid} {...node} action={props.action} /> )) ) : console.log("No children") // How do I remeove the expand/collapse icon? ); } }; return ( <TreeView defaultCollapseIcon={<ExpandMoreIcon />} defaultExpandIcon={<ChevronRightIcon />} expanded={expanded} onNodeToggle={handleChange} > {/*The node below should act as the root node for now */} <TreeItem nodeId={props.id} label={props.name}> {childNodes || [<div key="stub" />]} </TreeItem> </TreeView> ); } const rootElement = document.getElementById("root"); ReactDOM.render(<MyTreeItem id="1" name="Applications" />, rootElement); 
    submitted by /u/nielsjens123
    [link] [comments]

    Is there is any Python module that works like PHP mail function ?

    Posted: 11 Jan 2020 04:31 AM PST

    I've been wondering if there is any Python module that does the same job as PHP mail function which uses the SMTP that does not require any authentication

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

    Is Python a better beginner language than a curly-braced language?

    Posted: 11 Jan 2020 04:28 AM PST

    This question comes off of the back of another one asked on r/AskReddit. Someone asked what a good beginner programming language was, and everyone in the comments suggested either Python or VB - which was surprising to me.

    It's been about 6 years since I was a beginner and in that time I've done about 5 years of C#, 3 of Java, 1 of TS/JS, a few bits in C/C++, and a tiiiiny bit of Python.

    IMO, all these languages are good for different things, and the one you should choose depends on what you want to do, but what should a beginner use?

    Maybe it's just my ignorance - but as far as I know Python isn't really used too much in industry-standard greenfield projects? Would a C#/Java/TS/JS not be a good starting language because they're common in industry? I also remember struggling with indentation issues and the bugs it caused me while I was learning.

    I say that C/C++ is a bad choice because the errors can be tricky to deal with, and it takes a lot of code to make a little happen.

    I also believe that statically typed languages are better in general, let alone for beginners. Sure giving types for variables might be tricky for beginners, but so are type-based runtime errors. This is why I would say that both Python and JS are poor beginner choices. I know that between Node and Electron, JS can be run pretty much anywhere which makes it a great choice for development in general, but the lack of types bumps it down the list for me as a language to start programming with. While I'm a big fan of TS, I feel it's too complex for beginners.

    So this is why I would (and did) suggest C# or Java, but am I wrong? Is Python a better choice, and why/how?

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

    Basic PHP Image generation front-end

    Posted: 11 Jan 2020 04:22 AM PST

    hey - i'm trying to throw together a basic PHP script to create images using the GD library, for a non-techy client who usually strays off-brand when let near photoshop. Im not a developer but keen to learn. I've run through a few examples and managed to get some bits working, but i'm pretty stuck trying to build a front-end.

    I have the actual image generation script working fine, and i have a few different templates in separate php files.
    Here is one example:
    https://olipassey.me.uk/xmas.php - The live php script that just outputs an image

    https://gist.github.com/OliPassey/e364e966b9476089e748344a5d2a5d37 - The code behind the above link

    https://gist.github.com/OliPassey/947574ea0ac6f2dba21fb1bb706190cb - The awfully basic front-end html.

    The HTML is more a visual reference for what i'd like to achieve rather than the first steps of a working design, i may have made huge mistakes already or just be approaching this from the wrong angle / a very 1990's way.

    I have previously used some JS to power the drop-down selector, which i intend to just look at a folder of images and let the user select one to be used as the featured image. I can't remember the library i used for this but i suspect it can be achieved fairly simply from reading here: https://stackoverflow.com/questions/45535408/how-to-create-dropdown-menu-which-displays-all-files-in-a-directory-html5-javasc

    Have been looking at implementing the example here https://www.php.net/manual/en/language.variables.external.php but previously didn't get it actually working.

    If someone could point me in the direction of some further relevant reading / examples or any other advice would be hugely appreciated. If this would be best achieved in a completely different way / language im open to all suggestions.

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

    Feasibility of creating a browser extension to detect and Mark twitter bots

    Posted: 11 Jan 2020 03:29 AM PST

    Can a Dev design a browser extension where when a user is reading twitter it would scan the age of each account in the post and with other stuff like post content and use machine learning or something to superimpose a number next to each post saying the likelyhood a particular post came from a bot account?

    Apologize for the long sentence

    submitted by /u/20j2015
    [link] [comments]

    any good up to date resources on publishing a nuget package that targets multiple frameworks?

    Posted: 11 Jan 2020 12:27 AM PST

    I was wondering if anyone has any good resources on how to target multiple frameworks when trying to publish a package to nuget? Or a simple library that is doing it ? The library in question is for parsing a query language syntax on top of json, the only major dependency is Newtonsoft.json. Trying to target at least .net45x and core 2. Most popular libs that i've looked at are generating it via a complex makefile or .ps1 but they are doing a lot more complex dependency resolution.

    Additionally these are my system calls.

    using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Linq; 

    This is my .csproj

    <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <!-- TODO <TargetFrameworks>net47;netstandard1.3;netstandard2.0</TargetFrameworks> --> <TargetFramework>netstandard2.0</TargetFramework> <IncludeSymbols>true</IncludeSymbols> <SymbolPackageFormat>snupkg</SymbolPackageFormat> </PropertyGroup> <ItemGroup> <PackageReference Include="Newtonsoft.Json" Version="12.0.1"/> </ItemGroup> </Project> 

    And this is my .nuspec

    <?xml version="1.0"?> <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> <metadata> <id>mypackage</id> <version>0.0.x-beta</version> <authors>me</authors> <owners>me</owners> <projectUrl>https://github.com/me/mypackage</projectUrl> <license type="expression">MIT</license> <requireLicenseAcceptance>false</requireLicenseAcceptance> <!-- <releaseNotes>Bug fixes and performance improvements</releaseNotes> --> <dependencies> <dependency id="Newtonsoft.Json" version="[12.0.1,13.0)" /> </dependencies> <description>my pkg</description> <tags>tags</tags> </metadata> </package> 
    submitted by /u/defnotashton
    [link] [comments]

    Python Syntax question

    Posted: 11 Jan 2020 12:12 AM PST

    What does

    for a in history[::-1]

    Mean, never seen that syntax and isnt googleable apparently

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

    No comments:

    Post a Comment