curious1

1

votes
1

answer
478

views

JQuery: extract content from ajax-read html page

I use Ajax to get info from within another page, but not display this page. Here is the code $.ajax({ url: 'another-page.html', dataType: 'html', success: function (data) { //how to get the html title contained in data? //how to get an element with ID contained in data? } }); I feel this should have...
curious1
1

votes
4

answer
1.8k

views

Razor, asp.net, C#: how to validate a form field that is required and allows HTML snippets?

I am using Razor do a single proof-of-concept cshtml page, no controller. I use ASP.NET 4.5. This page has a form. Its action points to this page too. So when the form is submitted, it goes to the same page. The form has a field called 'description'. It is a required field, but allow users to enter...
curious1
1

votes
1

answer
847

views

cshtml file and database connection pool for MS SQL Server

I am doing a single CSHTML page for demo purpose. The page opens a connection to the backend MS SQL database in the following way: var db = Database.Open('connection_string'); I am curious about the following scenario: Suppose this page gets a lot of requests. I come from the Java world and I unders...
curious1
1

votes
1

answer
84

views

JPA: the better way of getting the first object in a list of ordered objects?

I need to retrieve the most recently updated object. Currently I am able to retrieve it by first doing something similar to the following: em.createQuery('select m from MyObject m order by m.updateTime').setFirstResult(0).setMaxResults(1).getResultList() and then getting the only object if the resul...
curious1
1

votes
1

answer
576

views

Are Java Locale IDs different for each country?

By looking at Spanish-related locale IDs at Oracle http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html Spanish Argentina es_AR Spanish Bolivia es_BO Spanish Chile es_CL Spanish Colombia es_CO Spanish Costa Rica es_CR Spanish Dominican Republic es_DO Spanish Ecuador es_...
curious1
1

votes
2

answer
336

views

Spring MVC: how to make site language selection remembered across browsers?

I am using Spring MVC for a website with two languages: English and Chinese. I have the following in the Spring context I am able to see the language of the website changes if I select another language through a dropdown in the HTML interface. Suppose I am viewing the website when its language is C...
curious1
1

votes
1

answer
1.1k

views

MaxMind: loading GeoIP2 mmdb into memory for fast read

I am using MaxMind's GeoIP2 to get the geo information for an IP address. In my Java web application, the DatabaseReader reader = new DatabaseReader.Builder(new File('C:\GeoLite2-City.mmdb').withCache(new CHMCache()).build(); I am hoping to load the entire file into memory for efficient/fast read....
curious1
1

votes
1

answer
206

views

How to decide the right coordinates in the middle of a PDF page?

I am new to iText and I looked at its many examples. The thing I have hard time to figure it out is the rectangle. On the page http://developers.itextpdf.com/examples/form-examples-itext5/multiline-fields there are many examples with hard-coded values for Rectangle objects. For example: Rectangle r...
curious1
1

votes
2

answer
4.7k

views

Spring 3 MVC: form backing object has to be in session? How can I avoid this?

I read a few tutorials about forms and submission in Spring 3 MVC. All these examples indicate that storing the backing object in the session the following way: @SessionAttributes({'command'}) I used old versions of Spring in which there is a formBacking method if a controller inherits SimpleFormCon...
curious1
1

votes
1

answer
1.4k

views

Java image captcha solution like this one?

I tried different Java-related captcha solutions such as JCaptcha, SimpleCaptcha, etc. I am not satisfied. I could miss something. What I really like is something very similar to this one in terms of generated characters and look and feel. Does anyone know of a Java solution generating an image VER...
curious1
1

votes
1

answer
212

views

How to draw a smooth line for a polynomial fuction?

I am using Highcharts 4.2.3 for my web project. I need to draw a line for the following function: y = 0.784·x4 - 8.662·x3 + 32.38·x2 - 46.761·x + 27.26 Currently, my way of doing this is to create a large number (for example: 500) of points of (x,y) and then plot it in the chart. I would like to...
curious1
1

votes
2

answer
663

views

Hibernate's Criteria query makes Tomcat become not responive after a few request services

I am running a Spring + Hibernate web application on Tomcat 7.0.35 (Spring 3.1, Hibernate 3.6.1, JPA 2.0). This app has a page that gets data from the database via Hibernate's Criteria (I know I dont have to). The service tier simply calls the data tier. Here is the code: Criteria criteria = session...
curious1
1

votes
1

answer
879

views

qTip2: how to make a tooltip move to left when a link is close to the right side of the browser?

I am using qTip 2.0.1 for displaying tooltips. I make the tooltip show up in the bottom right of a link. The issue is that when the link is close to the right side of the browser, the tooltip box looks squeezed and ugly. Can I configure qTip to make it auto-adjust its tooltip position to bottom-lef...
curious1
1

votes
1

answer
303

views

How to load localized messages in a subclass of SimpleUrlAuthenticationFailureHandler?

I am doing a Spring web application and I am using spring security 3.1. I need to create a subclass of SimpleUrlAuthenticationFailureHandler. And I need to load localized strings in the inherited method public void onAuthenticationFailure(javax.servlet.http.HttpServletRequest request, javax.servlet....
curious1
1

votes
2

answer
537

views

How to position image caption over and within a responsive image?

I have the following html: Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip. The size of the image wi...
curious1
1

votes
2

answer
1.8k

views

Elasticsearch: how to disable scoring on a field?

I am new to Elasticsearch and please forgive me if the answer is obvious. Here is what I have for the mapping of the field in question: 'condition' : { 'type' : 'string', 'store' : 'no', 'index': 'not_analyzed', 'omit_norms' : 'true' } I need search on this field, but I need 100% string match (no st...
curious1
1

votes
1

answer
294

views

Highcharts: what is the difference between event.target and event.currentTarget

I am new to Highcharts. I have the following for a column chart: xAxis: { .... events: { afterSetExtremes: function(event) { //do some work here. //event has a property called target //event has another property called currentTarget } } ... } I notice that event has two properties that seem to be i...
curious1
1

votes
1

answer
1.7k

views

Highcharts: too much space for bottom legend

I am new to Highcharts, but I feel it is so powerful and like it very much. I am doing a multiple series chart. Here is what I have for the legend: legend: { enabled: true, verticalAlign: 'bottom', align:'center', } But I got too much space above and below the legend. See the picture. How can I redu...
curious1
1

votes
1

answer
742

views

IIS module and C#: how to modify the page content before sending it to client

I am new to the IIS module and C# area. I need to modify the content of static HTML files in a specific directory of a website before the website sends the page content to client. The modification includes adding the banner, footer, etc. Based on my research, I should be able to achieve my goal thr...
curious1
1

votes
2

answer
36

views

Java web: how to set a value that accessible all user sessions?

I am doing a web site with Spring MVC. I am hoping to build a feature for the admin. As an admin, I would like set a value, which is accessible to all user sessions. As you know, I can set a value in session, but it is only available to me. I am hoping to set a value accessible to all others in the...
curious1
1

votes
3

answer
289

views

How can I know which nodes in a cluster are actual master nodes?

I use ES 2.2.0. and have a cluster of nodes. I would like to know which node or nodes are actual master ones. How can I do that? I tried the following ways: curl http://my_computer:9200/_cluster/state?pretty curl http://my_computer:9200/_nodes?pretty and I was unable to find which node is master.
curious1
3

votes
1

answer
4.2k

views

Elasticsearch 2.0: _id is not configurable

ES 2.0 is just released. Out of curiosity, I tested my mapping file that has been working for ES 1.7.3 against ES 2.0. I got the following error: { 'error': { 'root_cause': [ { 'type': 'mapper_parsing_exception', 'reason': '_id is not configurable' } ], 'type': 'mapper_parsing_exception', 'reason':...
curious1
1

votes
2

answer
2.2k

views

.Net MVC 5.2.3: how to create a disabled option out of SelectListItem?

I am trying to create a dropdown list with a few options disabled so that they are not selectable. Here is my code: var places = new SelectList(new List { new SelectListItem { Selected = false, Text = 'Virgin Islands', Value = 'Virgin Islands'}, new SelectListItem { Selected = false, Text = '', Val...
curious1
1

votes
2

answer
1.6k

views

Is it a good practice to check referer in the server-side form submission handler?

I am doing a Java web site. I hope to make the web site safer. In my web site, all the forms are supposed (by design) to be opened in a page through a GET link from my website. I hope to check whether the referer is my web site in my server-side form submission handler. The idea is to avoid taking...
curious1
1

votes
3

answer
59

views

How to make a non-background image display in the center of a smaller div

I have the following HTML: Here is the jsfiddle: https://jsfiddle.net/mddc/j2vw29c6/12/ The image is 600px in width. It cannot be a background image. So the image's center in the width direction is not displayed in the center (width direction) of the parent div. Note that the image cannot be respons...
curious1
1

votes
4

answer
6.5k

views

Bootstrap datepicker: RTL is not working

I am using a Bootstrap datepicker for a web project. Here is the datepicker: https://github.com/eternicode/bootstrap-datepicker According to the documentation (at the page bottom of the above link), I should use rtl:true for RTL languages. I tried that, but it was not working. Basically, it has no e...
curious1
18

votes
1

answer
9.6k

views

Elasticsearch: how can I filter on a boolean field

I am new to Elasticsearch. I have a mapping which has a boolean field. I need to filter on this field, and I am not sure which filter to use. Based on my research, I probably should use term filter. Is this correct? To me, the term filter seems to be designed for string fields. Thanks!
curious1
18

votes
1

answer
9.7k

views

Spring form checkbox tag: why generate a hidden element?

I am using Spring MVC for a web application. On a form, I have When the page is rendered, the following HTML is generated Does anyone know the purpose of the hidden tag? What would happen if the hidden input tag is removed? Thanks!
curious1
1

votes
1

answer
145

views

Build a website: should I use a number or random unique string as ID in URLs?

Hi I am building an Internet website with Java and Spring framework. I believe my question is not technology or framework related. I need to have links in user interface so that visitors can click and to see records. These links have the format of http://mysite.com?id=number-id-or-random-unique-stri...
curious1
1

votes
1

answer
602

views

Why Java uses en_AU (English, Australia) for language codes but other technologies uses en-AU (dash, not underscore)?

I am puzzled by this situation. In Java, language codes use, if needed, underscores such as in en_AU. But I see in other places and packages (such as JQuery UI), people use dashes as in en-au. I am interested in know why there is this difference. Thanks and regards.
curious1
5

votes
4

answer
168

views

How do I find the numbers that are not listed or missing?

I'll have a list of numbers, each on its own line (say 0 -100). How do I find the numbers that are not listed or missing?
curious1
1

votes
1

answer
3.6k

views

Error when installing “Maven Integration for Eclipse (Juno and newer)” in Eclipse Kepler

I just downloaded and installed Eclipse Kepler (Java EE version). Then I was hoping to install Maven Integration for Eclipse (Juno and newer) from Eclipse Marketplace. I kept getting the error message 'There is nothing to update'. Anyone knows what went wrong and fix? I am not sure this question is...
curious1
1

votes
2

answer
1.9k

views

(Spring) web application: show a form-save-success message without saving it in session?

I am doing a Spring web application with many forms. A common practice when a form is successfully saved is saving a success message in session and then redirecting the user to the same or new link where the success message is displayed. In Spring web, this can be done like the following: request.ge...
curious1
2

votes
1

answer
130

views

Google analytics:setup of website tracking to get click count on a link

I read this piece online: Tracking Site Activity https://developers.google.com/analytics/devguides/collection/gajs/asyncTracking According to this article, the tracking code should look like: var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function()...
curious1
1

votes
2

answer
3k

views

JQuery UI: remove Bootstrap tooltip on a draggable clone when drag starts?

I am using JQuery UI for drag and drop in my project. On the draggable element, I have Bootstrap (3.x) tooltip. Moving the mouse over the draggable shows the tooltip. I hope to remove/hide tooltip on the draggable clone when drag starts. I goolged and tested, but to no success. Here is jsfiddle s...
curious1
2

votes
4

answer
7.5k

views

Elasticsearch: send JSON query string via Java client?

I am new to Elasticsearch. I read Elasticsearch's Java client APIs and am able to build query and send it to the Elasticsearch server via the transport client. Because my query is quite complex with multi-level filters and I notice that it is cumbersome to build a query via the Java client. I feel...
curious1
1

votes
4

answer
38

views

How to make image centered in a larger container without having extra space beneath it?

I have a div with its width being 460px. The div's background is black. It contains an image with its width being 400px. I need to center the image in the div without having the extra space beneath the image. I can remove the space by making the image display as block, but it makes the image display...
curious1
1

votes
1

answer
295

views

Elasticsearch: how does match query work?

I am new to Elasticsearch and am confused by how match query works. I have this mapping: { 'product': { 'properties': { 'condition' : { 'type' : 'string', 'store' : 'yes', 'index': 'analyzed'} } } } I bulk imported the following documents { 'index': {'_index': 'myindex', '_type': 'product', '_id': '...
curious1
3

votes
1

answer
3.5k

views

How to set up two machines for a cluster with two nodes on each machine

I have two dedicated machines for ES (2.2.0). The two machines have the same specs. Each runs on a Windows Server 2012 R2 and has 128GB memory. Regarding ES, I plan to have TWO nodes on each machine for the cluster. I am looking at elasticsearch.yml to see how to configure each node to form a cluste...
curious1
1

votes
2

answer
2.6k

views

Highcharts: how to get the data points in the zoomed window?

I am new to Highcharts. I have a line chart. Here is the categories: ['9/7/14', '9/8/14', '9/9/14', '9/10/14', '9/11/14', '9/12/14', '9/13/14', '9/14/14', '9/15/14', '9/16/14', '9/17/14', '9/18/14', '9/19/14', '9/20/14', ...] Here is the data series: [1, 4, 0, 2, 1, 1, 1, 5, 3, 1, 0, 0, 6, 8, ... ]...
curious1

View additional