Jump to content

leodaniel

Member
  • Content count

    347
  • Joined

  • Last visited

Awards


This user doesn't have any awards

1 Follower

About leodaniel

  • Title
    Member

System

  • CPU
    i7 4930k @ 3.4GHz
  • Motherboard
    ASUS Rampage IV Gene
  • RAM
    4x 8 Gb Kingston HyperX 1866Mhz
  • GPU
    NVIDIA GTX 780 (Reference Design)
  • Case
    FractalDesign R4 Mini
  • Storage
    2x 120Gb Samsung Evo - 2x 4TB Caviar Black - 2x 2TB BackupDrive
  • PSU
    Corsair AX760i
  • Display(s)
    2x DELL U2713HM
  • Cooling
    H80i
  • Keyboard
    Apple Wireless KeyBoard
  • Mouse
    Logitech MX Master
  • Sound
    Focusrite Scarlett 2i2
  • Operating System
    CentOS 7 & Windows Professional 10

Contact Methods

  • Twitter
    https://twitter.com/leodaniel

Profile Information

  • Gender
    Male
  • Location
    Switzerland
  • Biography
    Business Management Student @ University St. Gallen (Switzerland), WebDeveloper / Designer (PHP / Javascript / HTML5 / CSS3)
  • Occupation
    Business Management Student @ University St. Gallen

Recent Profile Visitors

523 profile views
  1. PHP help with $values

    Always whats more human (you and me ) readable. Name your variables appropriately (having var1-var15 is bad, its hard to understand what they each represent), always step by step so that it's easy to understand. Just try to make it simple. Imagine you would have to look at your script again in 10 years... how long would you take to understand it (goal is to shorten this time). I think it's important to always code with that in mind. In the 2. code example it's really hard to understand what the code does, what the variables are. It takes quit some time to understand what it does.
  2. PHP help with $values

    So yes this is possible: <?php $v1 = 10; $v2 = 5; echo $result = ($v1 / $v2); // output: 2 var_dump($result); // output: int(2) The question is more, should you write this? I would argue for no. I think it's more readable to first only create the value $result and then echo it separately. I think it's more readable and in the end this should be your goal. The computer will always understand messy code, but humans tend to have more problem with that. Think of it like this, you should alway write code for humans first, not for computers. If you stumble across your code in a year, which would you find easier to understand (or anyone else)? I would go with that. Even if it's one line longer <?php $var1 = 10; $var2 = 5; $result = ( $var1 / $var2 ); echo $result;
  3. The efficiency of such a car (hydrogen) is just way below an electric car. Then the second problem: You have tu build an infrastructure for Hydrogen stations (including storage, delivery and production) compared to an already existing electric grid, really expensive. Then you need to produce the hydrogen in the first place, which is either resource intensive (hydrolysis) or comes from natural gaz. So in total, really expensive but not impossible. Tho bringing the price of Fuel cells down and building a solid infrastructure is a big challenge.
  4. Clearly EVs are the way to go. They provide a chance to be greener in the future. As stated by many, today an EV is not better (ecologically) at time buying. BUT it gets better compared to an Gasoline one with EVERY km driven. Depending on your electricity mix, the required kms vary a lot. In average an EV will produce around 90 Gramm CO2 per KM over its whole lifespan (with the average EU electricity mix). This is a saving of 55% compared to the average diesel car. I think there is a lot of misconception about the true impact, or stress EVs will cause on the electric grid. It's not that from one day to the other, all cars will be electric. It's more like a slow revolution (it's like when gasoline cars first came up, there wasn't an infrastructure of gaz stations already available). And of course the grid is more than capable of handling a lot more EVs in it's current state. Also it's worth mentioning that a lot of EVs are charged when demand is low because of the cheap energy. But of course it needs improvements in the future tho (--> smart grid). Also, EVs won't resolve climate warming, but they at least play a role in doing so. But it should not be forgotten, that moving a car will always cost energy, no matter what. So yes, EVs play a role, but we need (as a society) to take steps, which will hurt us to reduce climate change (ex. eating less meat, consuming less energy, less flying, ...). Source about EVs: https://www.transportenvironment.org/publications/electric-vehicle-life-cycle-analysis-and-raw-material-availability
  5. ESP8266 HTTPClient Post & Read page Laravel

    You should not echo in any route! Return a response object (or string, array) <?php Route::get('/',function(){ return 'My Response'; /* Will get converted to a json response! */ return ['key'=>'value']; return response()->json(['key'=>'value']) /* Return a response object with a status code (200 here) */ return response('content',200); /* Use A view */ return view('template',['data']); });
  6. Why PC, Why Apple, Why PS4 Why Android?

    Except it is. There are different numbers to compare here. Sales, actively used devices and total number of devices. If you consider that, there market share of android is smaller, recent estimates are around 70% or less. Depending on the sales figures, the AppStore made twice as much in sales compared to the Google play store (year 2016, from statista). So I think it makes sense to prioritise app development on iOS (especially if you have limited resources) as the ROI will most probably just be higher...
  7. Why PC, Why Apple, Why PS4 Why Android?

    I would say from a business perspective it makes more sense to prioritise development for iOS (if we are talking about Mobile Software) as the Apple Users are just more likely to pay / spend more on apps. Thats the only reason I see why some apps are just better for iOS (or released first on iOS). You just simply make more money (even if iOS has a smaller marketshare than Android, this shifts if you look at the sales figures of the AppStore vs GooglePlay store)
  8. Help With Website

    Try google forms or something like that, or pay a webdev
  9. How to stop users from editing a dropdown value

    Because I don't want any further Execution if the validation fails... why? Because in my opinion you should never correct any user input... the input either comes in the desired form or you reject it and don't execute your code... in my opinion you expect the values to have a certain form and so it should throw an exception if they don't The good thing about Exceptions is that they immediately stop further execution and kick off the error handling (up the call stack until they are catched)
  10. How to stop users from editing a dropdown value

    I disagree, I prefer using Try Catch block for validation because it breaks and moves to the catch statement. So you can handle more complex validations in specific methods and still have it clean. On the other hand, if else relies on you pretending when an exception has occurred. For one single validation I agree, If else is fine, but if you use more complex and bigger validations I would go with try catch...
  11. How to stop users from editing a dropdown value

    You are looking for input validation, as the frontend can always be manipulated and all requests can be forged. As a rule of thumb: never trust user data, never correct user data! So yes, frontend validation should be done but only to help a (normal) user correcting his input, never assume under any circumstance, that the data from the user can be trusted So in your case, a very simple solution: <?php /* For Try Catch Block */ class ValidationException extends \Exception {} try{ /* Validation */ $dropdown_input = $_POST['awesome_dropdown']; $possible_values = ['Value1','Value2']; if( ! in_array($dropdown_input,possible_values) ){ throw new ValidationException('Dropdown value incorrect'); } } catch(ValidationException $exception){ /* Something is not valid! */ die($exception->getMessage()); } /* Your Input is now Valid! */ // ...
  12. Need help with a slight Css&HTML

    You have a typo: <div clas="Widget"></div> <!-- clas !== class --> <div class="Widget"></div>
  13. Is this encryption method secure?

    The current system (Certificate Authority) relies on the weakest CA. Basically you have to blindly trust the Certificates Authorities in the first place. So if a CA gets hacked it would be possible to issue some bogus certificates, worse, the private key of the CA could be stolen and used to create certificates. There where some cases of bogus certificates in the past, if I remember correctly there was a bigger one with blackberry involved in some point... maybe just google if you want to know more about that. There are currently s lot of CAs (1000+) so the safety of TLS really comes down to the weakest member in this chain!
  14. Login Form Change Colors

    Use Javascript to make a request and check the email... I would consider this as not best practice, because an attaquer can verify if the email is valid... I would always only return that the combination of email and password didn't match /* Remove Success and error classes */ document.getElementById('email').classList.remove('error','success'); /* I will use the Axios Library */ axios.post('/verify_email',{ email:'from the input' }) .then(function (response) { //console.log(response); //Server Responded with an HTTP Status 200 // Add a Class to the element document.getElementById('email').classList.add('success'); }) .catch(function (error) { // console.log(error); document.getElementById('email').classList.add('error'); }); If it's just about validating the email format, I think this regex will cover you needs... I used it in an older project, I m not up to date if it covers the email format requirements up to 100%... but it should be fine function validateEmail(email){ let regex = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/; return regex.test(email); } document.getElementById('email').addEventListener('change',function(e){ /* Reset */ e.target.classList.remove('error','success'); if(validateEmail(e.target.value)){ e.target.classList.add('success'); } else{ e.target.classList.add('error'); } });
  15. I personally use WebStorm from JetBrains (Javascript IDE). It has support for HTML, CSS (SASS)... the for real-time updates I usually use Browser-Sync... For what I use it, its one of the best IDEs IMO... It's also depending on what you want to do with it... maybe it's better just using a really basic Code Editor with syntax highlighting in the beginning (thats what I personally used back then, IMO it helped me a lot to learn things by heart really quickly and gave me a deeper understanding of how things work)...
×