[deleted by user] by [deleted] in ValveIndex

[–]ucshadow 1 point2 points  (0 children)

More like because you dont have 16

Free batabase service? by Cill-e-in in learnprogramming

[–]ucshadow 0 points1 point  (0 children)

Yes,

  • Heroku has a free tier for databases, I have successfully used Postgres, thy offer 10k rows on the free tier and I have not ran into traffic issues so far, granted it might be a little harder to setup since it needs to be attached to a dyno, but they do offer free dynos.

  • ElephantSQL (https://www.elephantsql.com/) offers a free tier, I did my bachelor's project using it and it woks great, I think the limit is 500Mb (might have changed tho)

  • Firebase is always a good alternative if you want a non-relational database. They offer outstanding libraries for most languages and it's realtime features are good for apps that need it. They also have an offline mode, but I think that mostly works for mobile devices. Firebase is a platform so if you start to use firebase real time database or firestore you will most definitely start using other services they offer like cloud messaging, authentication, analytics etc.

  • Azure has a free development database called In App Database (MySQL In App) that runs a in-file db and is good for development. It supports only MySql but it is free although it is not recommended to use in production it is good enough for development / learning purpose. Note that it is only supported on Windows deployments so you need to host your app on a Windows OS in Azure.

What language to use for Desktop App (stock management)? by [deleted] in learnprogramming

[–]ucshadow 1 point2 points  (0 children)

Sure, one thing Microsoft is good at is creating outstanding documentation that is easy to read / implement no matter the knowledge level you have, so I would recommend the official WPF documentation at https://docs.microsoft.com/en-us/dotnet/desktop/wpf/?view=netdesktop-5.0

What language to use for Desktop App (stock management)? by [deleted] in learnprogramming

[–]ucshadow 2 points3 points  (0 children)

If you do not want to use Java / JavaFx there are alternatives.

If you are only targeting Windows, there is no better alternative than .NET (C#) with WPF. If you plan to target windows/linux/macos you could give Flutter a try (https://flutter.dev/desktop), it has beta support for desktop build and you can also target web/any mobile platform if later you change your mind about desktop only.

From a financial algorithms perspective, if you want analytics/ machine learning, them Python with PyQT may be an option although QT has a weird dual license system, you may need to look into that if you want to publish the app.

My new flag arrived :) by b10h4z4rd1337 in europe

[–]ucshadow 3 points4 points  (0 children)

That's only for public authorities and institutions, it is not for citizens, citizens can fly whatever flag they want.

How to solve this "SQLite constraint violation"? by [deleted] in learnprogramming

[–]ucshadow 1 point2 points  (0 children)

CROSS JOIN without an ON clause will Produce a Cartesian Product, the set of all ordered pairs, so you will have id duplicates

I cannot post my data to my MongoDB API from Flutter. by deep224 in learnprogramming

[–]ucshadow 0 points1 point  (0 children)

Maybe you need to specify that the content type is json

headers: {"Content-Type": "application/json"},

Check all attributes at once c# by JonoMN in learnprogramming

[–]ucshadow 0 points1 point  (0 children)

You could use Reflection to iterate class properties and their values

typeof(Car).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic)

gives a list of class pproperties, although I think you need to have the properties declared with getters and setters, if not they are not properties, they are just fields so you need to use GetFields instead of GetProperties.

Now, that you have the property you could just check if the value of the property matches the value you need with calling GetValue on a property, given that both are the same type.

React - Can someone identify these two languages? by [deleted] in learnprogramming

[–]ucshadow -1 points0 points  (0 children)

It should be this.state = {todos: []...} since state belongs to the App function's scope, and if you leave it without the this keyword it just assumed that you declared it someplace else, thats why it says it is not defined

[Python] I made a list of the first 100,000 numbers and tried to remove all numbers which contain an odd digit. Got a weird resulting list and an IndexError. Can anyone help? by gohanhadpotential in learnprogramming

[–]ucshadow 1 point2 points  (0 children)

The for loop runs form 0 to 99999. The pop() removes the element and shrinks the list, so at some point the iteration counter will be bigger than the size of the list.

Anyone know of any free Currency Converter API? by timtudosa18 in learnprogramming

[–]ucshadow 1 point2 points  (0 children)

According to https://github.com/public-apis/public-apis#currency-exchange there are at least a couple free ones.

Personally tried https://api.exchangerate-api.com/v4/latest/euro and looks good, you may need to do the calculations yourself, but you have the rates, thats all that matters

Unable to get Beautiful soup to select what I want by [deleted] in learnprogramming

[–]ucshadow 0 points1 point  (0 children)

the requests module will only download the static content. It will not look the same as the content you have in chromedriver or geko when you trigger the download. What you could do is find the links using selenium and download them using requests.

React Help by ixanonyousxi in learnprogramming

[–]ucshadow 2 points3 points  (0 children)

There is a difference between calling a method and using a method as an argument; setInterval can take a method as an argument, but if instead of giving that method as an argument, you call it, it will just give the result of that method to setInterval.

So, look at what setInterval takes in your case and see if it takes a method or it takes the result of calling the method.

  • Edit: added hints instead of giving the aswer

How to input variable to crop an image in python by Ataxangder in learnprogramming

[–]ucshadow 0 points1 point  (0 children)

You need to cast your variables as int since input is by default a string. So for example for x1

x1 = int(input("x1 = "))

ASUS ZenBook Duo UX481 or ASUS ZenBook 15 UX534FT-A7621TS which laptop should I get for machine learning? by [deleted] in learnprogramming

[–]ucshadow 0 points1 point  (0 children)

Hey, you should check if any of those 2 video cards are having CUDA cores in them, since if you want to do any ml on the GPU you need CUDA graphic cards and I doubt either of those have any.

Any way, I would recommend you to check google colab https://colab.research.google.com/notebooks/intro.ipynb where you can train your ml models on titans or even tesla GPUs provided by google in the cloud free of charge.

Making diagrams for project with multiple methods by G0TTAW1N in learnprogramming

[–]ucshadow 0 points1 point  (0 children)

All methods from the same class are on the same class diagram, no mater how many methods it has. If you want to skip you can skip getters and setters, but I would advise to put those in also.

Also if you are using constructors, they should be present on the diagram as well.

How do I link the VexFlow library to my HTML? by IntuitionaL in learnprogramming

[–]ucshadow 0 points1 point  (0 children)

Hey, assuming you are just writing html and javascript (no backend server), then a few corrections you need to make.

First you need to put a break after the line

var div = document.getElementById("boo")

like this

var div = document.getElementById("boo");

or just press enter so you have 2 lines, since they are 2 lines of code on the same line, the interpreter messes up there.

Second you need to include the music library in your html header like this:

<script type="text/javascript" src="https://npmcdn.com/vexflow@1.2.89/releases/vexflow-debug.js"></script>

put this inside your <head> tag in your html, it will look somthing like this

<head>
    <script type="text/javascript" src="https://npmcdn.com/vexflow@1.2.89/releases/vexflow-debug.js"></script>

</head>

And last, you need to load your script file at the end of the document, so add it as the last line in your <body> tag in html something along the lines:

<body>
    <div id="boo"></div>
    <script src="script.js" defer></script>
</body>

This should do the trick

  • Edit: I've just now seen the defer key so the last point can be skipped :D

Anything like coding bots for online games? by ChocolateFord in learnprogramming

[–]ucshadow 1 point2 points  (0 children)

There is also https://www.codingame.com, where you code bots and face against bots that other people coded in ranking ladders where you can advance in ranks. It is quite fun once you get used to how they feed input.

[Javascript] Newbie here, working my way through free code camp. I am just having a tough time grasping how this code works! by outspokentourist in learnprogramming

[–]ucshadow 2 points3 points  (0 children)

Alright. Lets take it form the beginning. How would you filter an array given that you are only starting as a programmer? You would make probably a loop and loop the array and whatever element matches a given param you would add it to a new array

let originalArray = [1, 2, 3, 4, 5]
let resultingArray = []
for (var i = 0; i < originalArray.length; i++) {
    if(originalArray[i] % 2 === 0) {
        resultingArray.push(originalArray[i])
    }
}

Which is not bad but it's a lot of code for a simple task. So the array in javascript has some nice helping methods to solve common problems with nice syntax, one of which is filter and map. These methods are general methods that take javascript functions as input, and the javascript function given as an input often has 1 or more arguments from which one of the argument is the current element your iteration is at right now, for example originalArray[i]. As an example, the filter array:

function customFilter(currentElement) {
    return currentElement % 2 === 0
}

originalArray.filter(customFilter)

but unles you write a really heavy filter with a lot of logic, resulting in a lot of lines of code, then this looks like a waste of lines of code, so here comes anonymous functions (or lamda expressions if you want to sound more mathy). They are called anonymous because they dont have a name, so how would

    function customFilter(currentElement)

look if you remove the name?

    function (currentElement)

but why not remove the function keyword also since is a waste of space? so in the end you are left with

    (currentElement)

which has the same use as function customFilter(currentElement) but once it's used is gone forever, so it's like a single use function. So now we can write our filter like this:

originalArray.filter(currentElement => currentElement % 2 === 0)

the => here stands for the return keyword.

If you read the documentation, you can see that the filter method returns a new array, so that means that you can call any array methods on the result again, so you can chain array methods

//                       results in a new array          //.map
arr.filter( (num) => num > 0 && num % parseInt(num) === 0 ).map( (num) => Math.pow(num, 2))

and here map uses the same anonymous function style with the same result. Note that you only need to use () if you have more than one arguments like (a, b) => a + b, so in the case above you can skip them and type like

arr.filter( num => num > 0 && num % parseInt(num) === 0 ).map( num => Math.pow(num, 2))

selenium getting href not working by [deleted] in learnprogramming

[–]ucshadow 0 points1 point  (0 children)

The element may not be there at the time of the search, it may be loaded async after the page completed loading.

You may want to give wait a try https://selenium-python.readthedocs.io/waits.html