Java/SQL – Choosing good approach for filtering entities with coordinates and additional data via /r/learnprogramming


Java/SQL – Choosing good approach for filtering entities with coordinates and additional data

Hi, I'm creating simple webapp (Spring MVC) for my engineering thesis. I persisting entities (MySQL database) with latitude, longitude and some other data. Now I need to do sorting and filtering this, and I can't find best and easy way to do this. I using Spring Data project, QueryDSL, Hibernate Search with Apache Lucene, but still I've some barriers. Eg.:

@PersistenceContext(type = PersistenceContextType.EXTENDED) EntityManager em; @Override @Transactional public List findAll(Coordinates coordinates, Predicate predicate, Pageable pageable, int maxDistance) { FullTextEntityManager fullTextSession = Search.getFullTextEntityManager(em); QueryBuilder builder = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(Place.class).get(); org.apache.lucene.search.Query luceneQuery = builder .spatial() .within(maxDistance, Unit.KM) .ofCoordinates(coordinates) .createQuery(); FullTextQuery jpaQuery = fullTextSession.createFullTextQuery(luceneQuery, Place.class); return jpaQuery.getResultList(); } 

This is Hibernate Search + Apache Lucene. It works great and I'm even get sorted entities by distance (which was my primary priority), but how I can add to this some additional criteria?

Submitted June 30, 2016 at 07:16PM by evelan94
via reddit http://ift.tt/2967XNA

[Javascript] Why doesn’t NodeList inherit from Array? via /r/learnprogramming


[Javascript] Why doesn’t NodeList inherit from Array?

I've read all over the Internet that you can't use array methods like foreach on a NodeList because NodeList doesn't inherit from Array. The only question I have is, why? Is there any reason to use a for loop on a NodeList rather than converting it into an array and using a foreach loop? Or for whatever reason, is the NodeList implementation better than an Array?

Submitted June 30, 2016 at 06:25PM by IamCarbonMan
via reddit http://ift.tt/299V5ah

Tutorial: An Introductions to ADTs (For beginners) via /r/learnprogramming


Tutorial: An Introductions to ADTs (For beginners)

Hey guys! I recently wrote a tutorial on an introduction to ADTs on my site. I've found that for a lot of beginners, the concept of "abstractness" is difficult to understand, so I tried explaining it using a metaphor. In the tutorial I also talk about Lists, Stacks, and Queues, which are incredibly useful for people even just starting to code. In the future I'll be talking about more complex applications of these ADTs such as recursion and buffering. Please let me know if you have any questions or suggestions in the comments here or on the site itself – I'll be happy to answer.

Thanks so much – here's the link:

http://ift.tt/297ZvyJ

Submitted June 30, 2016 at 06:26PM by liortulip
via reddit http://ift.tt/29h8GjG

Scrolling to a segment of my page via /r/learnprogramming


Scrolling to a segment of my page

Hey guys, I'm trying to see if someone can help me get my page to scroll to the section selected in the menu bar. I'm using this script:

$('ul').find('a').click(function(){ var $href = $(this).attr('href'); var $anchor = $('.'+$href).offset(); $('body').animate({ scrollTop: $anchor.top }); return false; }); 

Here's the page: http://ift.tt/296biQF

There are three sections: 'About', 'Portfolio' and 'Contact'

Submitted June 30, 2016 at 06:31PM by tylerprosper
via reddit http://ift.tt/299UZiU

Hey guys, I’m a student in my first programming VB class (online) and am having a bit of trouble wrapping my head around this information. via /r/learnprogramming


Hey guys, I’m a student in my first programming VB class (online) and am having a bit of trouble wrapping my head around this information.

First of all, as overwhelming and even at times frustrating, I find immense satisfaction in problem solving and building programs.

I'm at Chapter 3 in Visual Basics 7th edition (I know sad I'm already having troubles) and am trying to create a program to convert miles to kilometers and vise versa. I fully understand GUI and have it all set up. However, when trying to code for the 'convert to kilometers' button and 'convert to miles' button I cannot seem to understand how to begin the coding process. I am certainly not asking for someone to do this for me per se. But maybe to understand how to properly begin the process.

Thank you very much in advance, I hope someone can offer insight.

Submitted June 30, 2016 at 06:31PM by Meathand
via reddit http://ift.tt/29h8HUM

Writing Code with the Intent to Hand it Off? [PHP] via /r/learnprogramming


Writing Code with the Intent to Hand it Off? [PHP]

I am currently writing software with the intent of handing it off to an engineering team as soon as possible. I am writing the code with one other person.

We are writing a web service in PHP using OO design, doing our best to follow SOLID principles. We are iterating through design and development using various (surely amateurish) UML diagrams to describe the system and database. We are using namespaces to organize our files/classes.

We are writing the code with full comments pursuant to ApiGen protocol. We hope to entirely automate the generation of our documentation this way. We are not currently using any frameworks.

Are there any other considerations that we should be taking into consideration to make the foundation "production" quality? All we want is for the code to be acceptable for a team of engineers to move forward with.

The last thing we want is for a complete overhaul to have to take place in order to scale the site or our business.

Any suggestions?

Submitted June 30, 2016 at 06:39PM by xfdp
via reddit http://ift.tt/299UMw7

How to get Android Studio up and running with a downloaded APK via /r/learnprogramming


How to get Android Studio up and running with a downloaded APK

So I'm still in college, trying to figure out how all these different languages work and all and I want to try something new. I have Android Studio working and a Samsung Nexus emulator as well. The APK was downloaded here http://ift.tt/296b9g8 and what happens is after I extracted it and all to a folder, I tried moving everything in that folder into an empty project in Android Studio and running it on the emulator, but all that appears is a hello world program, leading me to believe I did not move them to the right place. Can anyone help me by telling me where the correct place to move all these files is? Thanks in advance! This is my first post go easy on me :]

Submitted June 30, 2016 at 06:40PM by PizzaLordLegacy
via reddit http://ift.tt/29h7EEB