Atli's Profile User Rating: *****

Reputation: 3635 Guru
Group:
Moderators
Active Posts:
6,206 (4.4 per day)
Joined:
08-June 10
Profile Views:
74,010
Last Active:
User is offline Yesterday, 02:09 PM
Currently:
Offline

Previous Fields

Country:
IS
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Mitsubishi
Dream Kudos:
275
Expert In:
PHP, Databases, Web Development
Icon   Atli has not set their status

Posts I've Made

  1. In Topic: best javascript editor?

    Posted 16 Apr 2014

    In the context of a Javascript IDE, rather than a PHP IDE, I would recommend PHPStorm's smaller sibling instead: WebStorm. It's basically the same IDE without the PHP support, and it comes at half the price of PHPStorm.
  2. In Topic: display the largest and smallest numbers in a series of 10 inputs

    Posted 15 Apr 2014

    See if you can complete these three individual steps, on their own.

    1. Declare a variable with an integer value.

    2. Assign a different integer value to that same variable.

    3. Use an if statement to test if that same variable is smaller than another number.

    If you can complete these three things, you're more or less there.
  3. In Topic: SQL Query by distance

    Posted 15 Apr 2014

    View Postbaavgai, on 15 April 2014 - 03:25 PM, said:

    For true distance:
    ABS((latitude - $searched_result_lat) * (latitude - $searched_result_lat) - (longitude - $searched_result_lng) * (longitude - $searched_result_lng)) <= ($radius * $radius)
    
    

    For the record, this is the same thing I do with the SQRT and POW functions, just written out differently.
  4. In Topic: SQL Query by distance

    Posted 15 Apr 2014

    Trying to do calculation like that in the order by clause doesn't really make much sense.

    Your handling of the distance filter is also a little bit over simplistic. I mean, if you are really talking about finding spots within a radius of a target, then a 9x9 position won't be within a 10 unit radius of point zero. If you just check each of the to values against 10, then it'll give you a false positive.

    You would need to calculate the real distance, which is a simple formula. MySQL provides mathematical functions you can use to execute that in your SELECT query.

    Also note that SELECT queries can include artificial columns in their result set; columns that you yourself define, such as the results of mathematical formulas. For example, applying the formula for calculating distances could be done line this:
    SELECT 
        id, name, 
        SQRT(
            POW(:target_y - longitude, 2) + 
            POW(:target_x - latitude, 2)
        ) AS distance
    FROM tbl
    
    

    Where :target_y and :target_x are placeholders you would use in a prepared statement. If you aren't using prepared statements now, you should be!

    The distance column this creates could then be used in WHERE and ORDER BY clauses to filter and sort the results as required.
    WHERE distance < :radius
    ORDER BY distance
    
    
  5. In Topic: Uploading Storing an Image inside a MySQL

    Posted 12 Apr 2014

    Does get.php then return the image as expected when you execute it manually?

    One thing that jumps out at me is that your img src tag isn't quoted. Technically that's OK for simple values, but when you've got more complex values (like an URL) you should really quote them.
    // Bad
    <img src=get.php?id=123>
    
    // Good
    <img src="get.php?id=123">
    
    // Ideal
    // (The alt attribute is a required attribute for img elements)
    <img src="get.php?id=123" alt="Image name or description">
    
    

My Information

Member Title:
D.I.C Lover
Age:
27 years old
Birthday:
September 5, 1986
Gender:
Location:
Iceland
Full Name:
Atli Ţór Jónsson
Years Programming:
11
Programming Languages:
Mainly: PHP, SQL (MySQL, MSSQL, PostgreSQL), Web Development, (HTML, CSS, Javascript, jQuery).

Additionally: C#, VB.NET, Java, Node.js, ActionScript 3, LUA, C/C++, Python.

Contact Information

E-mail:
Private
Yahoo:
Yahoo  atli.jonsson@ymail.com
Twitter:
Atli_Thor

Comments

  • (2 Pages)
  • +
  • 1
  • 2
  1. Photo

    Anuraj23 Icon

    24 Nov 2012 - 00:43
    hi
  2. Photo

    Atli Icon

    21 Sep 2012 - 03:19
    Hey lyster. Please post questions like that in the forums. That's what they're there for.
  3. Photo

    lyster Icon

    21 Sep 2012 - 00:40
    i just can't figure out what are the possible tables,,i want to know normalization well..u_u
  4. Photo

    lyster Icon

    21 Sep 2012 - 00:34
    hi there mr. atli..i hope you could give me some advices and idea on how to make an erd on my mini mortuary_system,thanks god bless you..
    by the way im a student of a state college here in the philippines.
  5. Photo

    kimimimi Icon

    26 Aug 2012 - 00:37
    please help me
  6. Photo

    xenoslash Icon

    19 Jul 2012 - 23:35
    You are quite possibly the most helpful member of the community. I wish I could +1 you more than once for every long (and useful!) post you make.
  7. Photo

    Maryam.m Icon

    23 Jun 2012 - 10:52
    hey i understood what should i do!!!
    i'm so happy :D :D
    tnx
  8. Photo

    polyosis Icon

    11 Jun 2012 - 16:49
    I would like to thank you on your advice with my site path and installation problems, you are most kind my friend.
  9. Photo

    Atli Icon

    14 Apr 2012 - 05:22
    Yea it seems to like you, Dimitri ;)
  10. Photo

    DimitriV Icon

    08 Apr 2012 - 19:20
    Your avatar… it blinked at me.
  11. Photo

    Atli Icon

    06 Nov 2011 - 19:49
    Hehe. Thanks guys :)
  12. Photo

    Dogstopper Icon

    06 Nov 2011 - 19:19
    Lookin' a little blue there. Cheer up man! You're a mod! Congratz!
  13. Photo

    codeprada Icon

    06 Nov 2011 - 18:34
    It's about time. Congrats on reaching blue status.
  14. Photo

    n00l3 Icon

    05 Sep 2011 - 12:59
    Happy birthday! :D
  15. Photo

    cupidvogel Icon

    03 Sep 2011 - 23:06
    I can't seem to like your reply to my jQuery post an hour ago (fantastic explanation it was), because the Javascript in my browser is somewhat malfunctioning. I will like it later, ok?
  • (2 Pages)
  • +
  • 1
  • 2