Questions Tagged with #Jndi

The Java Naming and Directory Interface (JNDI) is a Java API for a directory service that allows Java software clients to discover and look up data and objects via a name.

Configure hibernate to connect to database via JNDI Datasource

Hi all I'm using Hibernate+Struts2+Tomcat6+Mysql as my J2EE framework. I've been using hibernate's built-in connection pooling mechanism but it turned out to be problematic where mysql closes it's con..

How do I connect to a Websphere Datasource with a given JNDI name?

I'm using Websphere Portal 7.0 and creating a portlet with RAD 8.0. My portlet is trying to make a db2 connection to a remote server. I wrote a java program locally to do a basic JDBC connection to th..

Cannot create JDBC driver of class ' ' for connect URL 'null' : I do not understand this exception

Why does it say null URL and gives a empty ' ' class in the exception when I have provided the database URL? I am trying to connect to a derby database via a servlet while using Tomcat. When the servl..

What does java:comp/env/ do?

I just spent too much time of my day trying to figure out some errors when hooking up some JNDI factory bean. The problem turned out to be that instead of this... <bean id="someId" class="org.spri..

How to use JNDI DataSource provided by Tomcat in Spring?

It is said that in the Spring javadoc article about DriverManagerDataSource class, that this class is very simple and that it is recommended to use a JNDI DataSource provided by the container. Suc..

How do a LDAP search/authenticate against this LDAP in Java

I am playing with LDAP and Java search. Here's my LDIF export with a simple organization version: 1 dn: dc=example,dc=com objectClass: organization objectClass: dcObject objectClass: top dc: example..

javax.naming.NameNotFoundException

I am running an example of ejb using JBoss5 Container. I am using an example from here(Part one). In the example I deployed bean in JBoss and an application in Tomcat(to acces the bean from JBoss). I..

The meaning of NoInitialContextException error

I am writing a client for my EJB and when trying to execute it, I get the following exception : javax.naming.NoInitialContextException: Need to specify class name in environment or system proper..

How to create JNDI context in Spring Boot with Embedded Tomcat Container

import org.apache.catalina.Context; import org.apache.catalina.deploy.ContextResource; import org.apache.catalina.startup.Tomcat; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;..

How to lookup JNDI resources on WebLogic?

I deployed a legacy application on WebLogic 11g. The application has the following code: Context context = new InitialContext(); dataSource = (javax.sql.DataSource) context.lookup("java:myDataSourc..

Name [jdbc/mydb] is not bound in this Context

I see this question was raised several times already and I went through all of them. But I am still unable to fix my problem. Could anyone help me pinpoint what I am doing wrong? I get the following..

What does "javax.naming.NoInitialContextException" mean?

As the title suggests, what does "javax.naming.NoInitialContextException" mean in non technical terms? And what are some general suggestions to fix it? EDIT (From the console): javax.naming.NoInitia..

What is JNDI? What is its basic use? When is it used?

What is JNDI? What is its basic use? When is it used? ..

CSS vertical alignment of inline/inline-block elements

I'm trying to get several inline and inline-block components aligned vertically in a div. How come the span in this example insists on being pushed down? I've tried both vertical-align:middle; and ver..

Redirecting to previous page after login? PHP

I've been searching for a solution but it's seem I can't get it right, no matter what I try. After successful login, the user should be redirected to the page he came from, let's say he's been brow..

What is System, out, println in System.out.println() in Java

Possible Duplicate: What's the meaning of System.out.println in Java? I was looking for the answer of what System, out and println are in System.out.println() in the Java. I searched an..

How can I scroll a web page using selenium webdriver in python?

I am currently using selenium webdriver to parse through facebook user friends page and extract all ids from the AJAX script. But I need to scroll down to get all the friends. How can I scroll down in..

Outline effect to text

Are there any ways in CSS to give outlines to text with different colors ? I want to highlight some parts of my text to make it more intuitive - like the names, links, etc. Changing the link colors et..

What are Aggregates and PODs and how/why are they special?

This FAQ is about Aggregates and PODs and covers the following material: What are Aggregates? What are PODs (Plain Old Data)? How are they related? How and why are they special? What changes for..

Getting or changing CSS class property with Javascript using DOM style

My objective is to change the background color of a columns in a table without addressing each data entry individually by Id or Name. I know there are several ways to do this, and I've tried 3 to be e..

How can I connect to Android with ADB over TCP?

I am attempting to debug an application on a Motorola Droid, but I am having some difficulty connecting to the device via USB. My development server is a Windows 7 64-bit VM running in Hyper-V, and so..

Can I check if Bootstrap Modal Shown / Hidden?

Can I check if Bootstrap Modal currently Shown / Hidden Programatically? Like bool a = if("#myModal").shown(); ? I need true/false..

Using the "animated circle" in an ImageView while loading stuff

I am currently using in my application a listview that need maybe one second to be displayed. What I currently do is using the @id/android:empty property of the listview to create a "loading" text. ..

Uncaught syntaxerror: unexpected identifier?

I can't seem to correct the error the console is talking about can anyone help me. My code is below. I created a web form that saves the data to local storage and displays it on screen then deletes al..

How to write data to a JSON file using Javascript

For example, I have a .JSON file that has the following: [{"honda": "accord", "color": "red"},{"ford": "focus", "color": "black"}] What would be the javascript code to push another object {"nissan"..

How to style the UL list to a single line

I want to render this list in a single line. List item1 List item2 Should be shown as *List item2 *List item2 What CSS style to use?..

clearInterval() not working

Possible Duplicate: JS - How to clear interval after using setInterval() I have a function that changes the font-family of some text every 500 ms using setInterval (I made it just to practi..

Creating SVG elements dynamically with javascript inside HTML

I want to create a rectangle inside an HTML page, then write some text on that rectangle. I also need that text to be a hyperlink. This is what I did but it is not working: <!DOCTYPE html> ..

How do you clone a Git repository into a specific folder?

Executing the command git clone [email protected]:whatever creates a directory in my current folder named whatever, and drops the contents of the Git repository into that folder: /httpdocs/whatever/publ..

Twitter Bootstrap vs jQuery UI?

I've been using jQuery UI for some basic page enhancements. Button and input styling and modal dialog boxes. Now I've come across Bootstrap and it looks pretty good. Has anyone any experience of goi..

Display a loading bar before the entire page is loaded

I would like to display a loading bar before the entire page is loaded. For now, I'm just using a small delay: $(document).ready(function(){ $('#page').fadeIn(2000); }); The page already uses jQu..

Arguments to main in C

I don't know what to do! I have a great understanding of C basics. Structures, file IO, strings, etc. Everything but CLA. For some reason I cant grasp the concept. Any suggestions, help, or advice. PS..

How to hide/show more text within a certain length (like youtube)

I want to have a text to only be a certain amount of characters/length and after that length, I want to put a link to reveal the full length of the text. The link will be (more...). And once the use..

Sum the digits of a number

If I want to find the sum of the digits of a number, i.e.: Input: 932 Output: 14, which is (9 + 3 + 2) What is the fastest way of doing this? I instinctively did: sum(int(digit) for digit in str(num..

Storing Python dictionaries

I'm used to bringing data in and out of Python using CSV files, but there are obvious challenges to this. Are there simple ways to store a dictionary (or sets of dictionaries) in a JSON or pickle file..

Add an index (numeric ID) column to large data frame

I have a read large csv file into a data frame. Data in the csv file are from multiple web sites representing user information. For example here is the structure of the data frame. user_id, number_of..

Split string with PowerShell and do something with each token

I want to split each line of a pipe on spaces, and then print each token on its own line. I realise that I can get this result using: (cat someFileInsteadOfAPipe).split(" ") But I want more flexib..

Removing ul indentation with CSS

I cannot seem to remove the indent from my unordered list when long lines in my list wrap around. Here is what my list looks like: Windows users can use putty Mac users can use the Terminal.app Linu..

CSS Background Image Not Displaying

I have an HTML file with a subdirectory called img with an image called debut_dark.png. In my CSS file, I have: body { background: url(/img/debut_dark.png) repeat 0 0; } The HTML file has the ..

How to get the path of current worksheet in VBA?

I wrote a macro as an add-in, and I need to get the path of the current worksheet on which it is being executed. How do I do this? How do I get the file path (just the directory)?..

Is there a better way to refresh WebView?

Ok. I have looked EVERYWHERE and my little brain just can't understand a better way to refresh an activity. Any suggestions that I can understand would be great. :) Here is the java code: package c..

curl POST format for CURLOPT_POSTFIELDS

When I use curl via POST and set CURLOPT_POSTFIELD do I have to urlencode or any special format? for example: If I want to post 2 fields, first and last: first=John&last=Smith what is the exac..

Finding the max value of an attribute in an array of objects

I'm looking for a really quick, clean and efficient way to get the max "y" value in the following JSON slice: [ { "x": "8/11/2009", "y": 0.026572007 }, { "x": "8/12/2009", "y": ..

There is already an object named in the database

Update-Database failed from Package Manager Console. I've used Entity Framework 6.x and code-first approach. Error is "There is already an object named 'AboutUs' in the database." How can I solve th..

Set value of input instead of sendKeys() - Selenium WebDriver nodejs

I have a long string to test and sendKeys() takes too long. When I tried to set the value of the text the program crashes. I know the Selenium sendKeys() is the best way to test the actual user input,..

How can I add to a List's first position?

I just have a List<> and I would like to add an item to this list but at the first position. List.add() add the item at the last.. How can I do that?.. Thanks for help!..

Get current time in milliseconds using C++ and Boost

In my thread (using boost::thread) I need to retrieve the current time in ms or less and to convert into ms: Actually, reading here I've found this: tick = boost::posix_time::second_clock::local_tim..

How to make a div 100% height of the browser window

I have a layout with two columns - a left div and a right div. The right div has a grey background-color, and I need it to expand vertically depending on the height of the user's browser window. Righ..

li:before{ content: "¦"; } How to Encode this Special Character as a Bullit in an Email Stationery?

After proudly coloring my liststyle bullet without any image url or span tags, via: ul{ list-style: none; padding:0; margin:0; } li{ padding-left: 1em; text-indent: -1em; } li:before { content: ..

How to link an input button to a file select window?

Possible Duplicate: Jquery trigger file input I'm working on a form which allows users to upload images to a website. So far I have got a drag and drop solution working in Chrome and Safari..

How to call asynchronous method from synchronous method in C#?

I have a public async void Foo() method that I want to call from synchronous method. So far all I have seen from MSDN documentation is calling async methods via async methods, but my whole program is ..

Synchronously waiting for an async operation, and why does Wait() freeze the program here

Preface: I'm looking for an explanation, not just a solution. I already know the solution. Despite having spent several days studying MSDN articles about the Task-based Asynchronous Pattern (TAP), as..

Pass table as parameter into sql server UDF

I'd like to pass a table as a parameter into a scaler UDF. I'd also prefer to restrict the parameter to tables with only one column. (optional) Is this possible? EDIT I don't want to pass a table..

HTML/CSS--Creating a banner/header

I've got a horizontal image as a GIF and JPG. It is something I made with Paint--a text logo with an image on a solid background. I am having a lot of trouble trying to get it to display as a banner/..

Updating property value in properties file without deleting other values

Content of First.properties: name=elango country=india phone=12345 I want change country from india to america. This is my code: import java.io.*; public class UpdateProperty { public static ..

SQL Server 2008 R2 can't connect to local database in Management Studio

I am using SQL Server 2008 R2 Express. I first installed SQL Server 2008 R2 Express Management Studio and then I installed SQL Server 2008 R2 Express. I have the instance SQLEXPRESS running and it is..

Can't Autowire @Repository annotated interface in Spring Boot

I'm developing a spring boot application and I'm running into an issue here. I'm trying to inject a @Repository annotated interface and it doesn't seem to work at all. I'm getting this error org.spri..

Bootstrap Carousel : Remove auto slide

I'm using Bootstrap Carousel. All I want is that the slider will only slide when a navigation or a pagination is clicked. I've tried removing $('.carousel').carousel({ interval: 6000 }); It..

Checking Value of Radio Button Group via JavaScript?

This may seem silly and downright stupid but I can't seem to figure out how to check the value of a radio button group in my HTML form via JavaScript. I have the following code: <input type="radio..

dll missing in JDBC

I am currently working with SQL in Java. Recently I got this error: com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit> WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth ..

OpenMP set_num_threads() is not working

I am writing a parallel program using OpenMP in C++. I want to control the number of threads in the program using omp_set_num_threads(), but it does not work. #include <iostream> #include <..

How to run a command as a specific user in an init script?

I'm writing an init script which is supposed to execute a single command as a user different than root. This is how I'm doing it currently: sudo -u username command This generally works as expected ..

ASP.NET MVC3 - textarea with @Html.EditorFor

I have ASP.NET MVC3 app and I have also form for add news. When VS2010 created default view I have only text inputs for string data, but I want to have textarea for news text. How I can do it with Raz..

How to change indentation mode in Atom?

I haven't been able to figure this out yet. Atom seems to use spaces as the default indentation mode. I prefer to have tabs instead though. Sublime Text has built in functionality for switching and co..

Gradle - Could not find or load main class

I'm trying to run a very simple project using Gradle and running into the following error when using the gradlew run command: could not find or load main class 'hello.HelloWorld' Here is my file st..

Python interpreter error, x takes no arguments (1 given)

I'm writing a small piece of python as a homework assignment, and I'm not getting it to run! I don't have that much Python-experience, but I know quite a lot of Java. I'm trying to implement a Partic..

Date vs DateTime

I am working on a program that requires the date of an event to get returned. I am looking for a Date, not a DateTime. Is there a datatype that returns just the date?..

PHP - Get array value with a numeric index

I have an array like: $array = array('foo' => 'bar', 33 => 'bin', 'lorem' => 'ipsum'); echo native_function($array, 0); // bar echo native_function($array, 1); // bin echo native_function($a..

How to get the root dir of the Symfony2 application?

What is the best way to get the root app directory from inside the controller? Is it possible to get it outside of the controller? Now I get it by passing it (from parameters) to the service as an ar..

How do you round a float to 2 decimal places in JRuby?

How do you round a float to 2 decimal places in JRuby(1.6.x)? number = 1.1164 number.round(2) # The above shows the following error # wrong number of arguments (1 for 0) ..

mysqldump & gzip commands to properly create a compressed file of a MySQL database using crontab

I am having problems with getting a crontab to work. I want to automate a MySQL database backup. The setup: Debian GNU/Linux 7.3 (wheezy) MySQL Server version: 5.5.33-0+wheezy1(Debian) directorie..

Storing sex (gender) in database

I want to store a user's gender in a database with as little (size/performance) cost as possible. So far, 3 scenarios come to mind Int - aligned with Enum in code (1 = Male, 2 = Female, 3 = ...) ch..

Round a double to 2 decimal places

If the value is 200.3456, it should be formatted to 200.34. If it is 200, then it should be 200.00...

Find a value anywhere in a database

Given a #, how do I discover in what table and column it could be found within? I don't care if it's fast, it just needs to work...

I just discovered why all ASP.Net websites are slow, and I am trying to work out what to do about it

I just discovered that every request in an ASP.Net web application gets a Session lock at the beginning of a request, and then releases it at the end of the request! In case the implications of this ..

How to add new line into txt file

I'd like to add new line with text to my date.txt file, but instead of adding it into existing date.txt, app is creating new date.txt file.. TextWriter tw = new StreamWriter("date.txt"); // write a ..

Best way to get all selected checkboxes VALUES in jQuery

I am looking to get all checkboxes' VALUE which have been selected through jQuery...

how to attach url link to an image?

I am creating an website. It contains videos of different places. Now my problem is i need integrate an image on that with url link. when user taps on that link it has to go to that link. Even user do..

How to install Xcode Command Line Tools

How do I get the command-line build tools installed with the current Xcode/Mac OS X v10.8 (Mountain Lion) or later? Unlike Xcode there is no installer, it's just a bundle. It looks like all the comm..

List of tuples to dictionary

Here's how I'm currently converting a list of tuples to dictionary in Python: l = [('a',1),('b',2)] h = {} [h.update({k:v}) for k,v in l] > [None, None] h > {'a': 1, 'b': 2} Is there a better..

how to implement regions/code collapse in javascript

How can you implement regions a.k.a. code collapse for JavaScript in Visual Studio? If there are hundreds of lines in javascript, it'll be more understandable using code folding with regions as in vb..

Sql Server string to date conversion

I want to convert a string like this: '10/15/2008 10:06:32 PM' into the equivalent DATETIME value in Sql Server. In Oracle, I would say this: TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS..

No module named pkg_resources

I'm deploying a Django app to a dev server and am hitting this error when I run pip install -r requirements.txt: Traceback (most recent call last): File "/var/www/mydir/virtualenvs/dev/bin/pip", li..

How to write JUnit test with Spring Autowire?

Here are the files that I use: component.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchem..

System.BadImageFormatException: Could not load file or assembly (from installutil.exe)

I am trying to install a Windows service using InstallUtil.exe and am getting the error message System.BadImageFormatException: Could not load file or assembly '{xxx.exe}' or one of its dependenci..

When to catch java.lang.Error?

In what situations should one catch java.lang.Error on an application?..

How can the error 'Client found response content type of 'text/html'.. be interpreted

I'm using C# and connecting to a WebService via an auto-generated C# proxy object. The method I'm calling can be long running, and sometimes times out. I get different errors back, sometimes I get a S..

What does "request for member '*******' in something not a structure or union" mean?

Is there an easy explanation for what this error means? request for member '*******' in something not a structure or union I've encountered it several times in the time that I've been learning C, b..

How do I set environment variables from Java?

How do I set environment variables from Java? I see that I can do this for subprocesses using ProcessBuilder. I have several subprocesses to start, though, so I'd rather modify the current process's ..

MySQL DISTINCT on a GROUP_CONCAT()

I am doing SELECT GROUP_CONCAT(categories SEPARATOR ' ') FROM table. Sample data below: categories ---------- test1 test2 test3 test4 test1 test3 test1 test3 However, I am getting test1 test2 test3..

SQL Server: Get data for only the past year

I am writing a query in which I have to get the data for only the last year. What is the best way to do this? SELECT ... FROM ... WHERE date > '8/27/2007 12:00:00 AM' ..

How does one use glide to download an image into a bitmap?

Downloading a URL into an ImageView is very easy using Glide: Glide .with(context) .load(getIntent().getData()) .placeholder(R.drawable.ic_loading) .centerCrop() .into(imageView); I'..

Python: How to convert datetime format?

Possible Duplicate: How to convert a time to a string I have a variable as shown in the below code. a = "2011-06-09" Using python, how to convert it to the following format? "Jun 09,201..

Could someone explain this for me - for (int i = 0; i < 8; i++)

Could someone explain in the simplest terms, as if you are talking to an idiot (because you are), what this code is actually saying/doing for (int i = 0; i < 8; i++) ..

What are "res" and "req" parameters in Express functions?

In the following Express function: app.get('/user/:id', function(req, res){ res.send('user' + req.params.id); }); What are req and res? What do they stand for, what do they mean, and what do th..

How npm start runs a server on port 8000

I recently used a angular-seed folder from github for angular application development. In some previous angularjs tutorial there was a script folder and a server.js file in the angular-seed folder whi..

Accessing Object Memory Address

When you call the object.__repr__() method in Python you get something like this back: <__main__.Test object at 0x2aba1c0cf890> Is there any way to get a hold of the memory address if you..

How can I read and manipulate CSV file data in C++?

Pretty self-explanatory, I tried google and got a lot of the dreaded expertsexchange, I searched here as well to no avail. An online tutorial or example would be best. Thanks guys...

IF function with 3 conditions

I'm looking to create a formula with 3 conditions. It is currently only working with 2 conditions. Here's what I'm looking for: E9 has a number If the number is 21+ then I want it to show Text 1 I..

What's the fastest way to convert String to Number in JavaScript?

Any number, it's number. String looks like a number, it's number. Everything else, it goes NaN. 'a' => NaN '1' => 1 1 => 1 ..

Set timeout for webClient.DownloadFile()

I'm using webClient.DownloadFile() to download a file can I set a timeout for this so that it won't take so long if it can't access the file?..

Infinite Recursion with Jackson JSON and Hibernate JPA issue

When trying to convert a JPA object that has a bi-directional association into JSON, I keep getting org.codehaus.jackson.map.JsonMappingException: Infinite recursion (StackOverflowError) All I fou..

VBA procedure to import csv file into access

i need procedure in VBA to import data into access from csv excel file without some records,, as header and footer. Example,,, i have table in csv file, which contains some sentence which not belon..

How to upload multiple files using PHP, jQuery and AJAX

I have designed a simple form which allows the user to upload files to the server. Initially the form contains one 'browse' button. If the user wants to upload multiple files, he needs to click on the..

What Are The Best Width Ranges for Media Queries

What are the best width ranges for detecting media queries in a responsive design? I would like to cover all Desktop/Laptop monitors( with one orientation) in 4 media queries but I do not know if it ..

LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression

I'm migrating some stuff from one mysql server to a sql server but i can't figure out how to make this code work: using (var context = new Context()) { ... foreach (var item in collection) ..

Encoding an image file with base64

I want to encode an image into a string using the base64 module. I've ran into a problem though. How do I specify the image I want to be encoded? I tried using the directory to the image, but that sim..

Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister

I am actually new to hibernate and tried to set up 2 classes. Account and Person. Now all i try to do is create a one to one bidirectional dependency using annotations. Here are some details and code ..

How to view data saved in android database(SQLite)?

I am able to view the database from eclipse(from file explorer), but I want to view the whole detail, I mean the data that I have inserted, which I am unable. And my complete Android installation has..

IIS sc-win32-status codes

[Background] I have a code of 64 in my iis logs which I think are client disconnects whilst uploading large files. I also get some ComExceptions with the same status code which I have gathered are pr..

VBA using ubound on a multidimensional array

Ubound can return the max index value of an array, but in a multidimensional array, how would I specify WHICH dimension I want the max index of? For example Dim arr(1 to 4, 1 to 3) As Variant In t..

How to print a list of symbols exported from a dynamic library

So I've been trying to get dynamic libraries to work in my XCode project under Mac OS X. So far no joy. I am able to load the dylib file, but when I call dlsym to get the function pointer, it returns..

How to make a great R reproducible example

When discussing performance with colleagues, teaching, sending a bug report or searching for guidance on mailing lists and here on Stack Overflow, a reproducible example is often asked and always..

Error: getaddrinfo ENOTFOUND in nodejs for get call

I am running a web server on node the code for which is given below var restify = require('restify'); var server = restify.createServer(); var quotes = [ { author : 'Audrey Hepburn', text : "Noth..

Fetch frame count with ffmpeg

Does anyone know how to fetch the number of total frames from a video file using ffmpeg? The render output of ffmpeg shows the current frame and I need the frame count to calculate the progress in per..

C# Encoding a text string with line breaks

in C# I have a string I am writing to the outputstream of the response. After I save this document and open it in Notepad++ or WordPad I get nicely formatted line breaks where they are intended, when..

Initializing data.frames()

Is there a quick way to initialize an empty data frame? If you know what the dimensions will be? For example: Suppose I would like a blank data frame that has 100 rows and 10: x <- data.frame(1:..

How to get the day name from a selected date?

I have this : Datetime.Now(); or 23/10/2009 I want this : Friday For local date-time (GMT-5) and using Gregorian calendar...

Convert Bitmap to File

I understand that using BitmapFactory can convert a File to a Bitmap, but is there any way to convert a Bitmap image to a File?..

How to use WPF Background Worker

In my application I need to perform a series of initialization steps, these take 7-8 seconds to complete during which my UI becomes unresponsive. To resolve this I perform the initialization in a sepa..

Returning JSON from a PHP Script

I want to return JSON from a PHP script. Do I just echo the result? Do I have to set the Content-Type header?..

Jquery Setting Value of Input Field

I have an input field and i am trying to set its value using its class <form:input path="userName" id="userName" title="Choose A Unique UserName" readonly="${userNameStatus}" class="formData"/>..

"Expected an indented block" error?

I can't understand why python gives an "Expected indentation block" error? """ This module prints all the items within a list""" def print_lol(the_list): """ The following for loop iterates over ever..

How to print float to n decimal places including trailing 0s?

I need to print or convert a float number to 15 decimal place string even if the result has many trailing 0s eg: 1.6 becomes 1.6000000000000000 I tried round(6.2,15) but it returns 6.200000000000000..

Apache POI Excel - how to configure columns to be expanded?

I am using Apache POI API to generate excel spreadsheet to output some data. The problem I am facing is when the spreadsheet is created and opened, columns are not expanded so that some long text lik..

document.getelementbyId will return null if element is not defined?

In my code, I see this: if (document.getElementById('xx') !=null) { //do stuff } if xx element is not defined, will this evaluate to true or false? Should I write: if (document.getElementByI..

Set order of columns in pandas dataframe

Is there a way to reorder columns in pandas dataframe based on my personal preference (i.e. not alphabetically or numerically sorted, but more like following certain conventions)? Simple example: fr..

Can I write into the console in a unit test? If yes, why doesn't the console window open?

I have a test project in Visual Studio. I use Microsoft.VisualStudio.TestTools.UnitTesting. I add this line in one of my unit tests: Console.WriteLine("Some foo was very angry with boo"); Co..

How to calculate the angle between a line and the horizontal axis?

In a programming language (Python, C#, etc) I need to determine how to calculate the angle between a line and the horizontal axis? I think an image describes best what I want: Given (P1x,P1y) and ..

How to update data in one table from corresponding data in another table in SQL Server 2005

I have two tables in different databases on the same database server. Both the databases have the same structure, but different data. Database1 (Test1) is the latest, and database2 (Test2) is an old ..

Set field value with reflection

I'm working with one project which is not opensource and I need to modify one or more its classes. In one class is following collection: private Map<Integer, TTP> ttp = new HashMap<>(); ..

How to read from stdin line by line in Node

I'm looking to process a text file with node using a command line call like: node app.js < input.txt Each line of the file needs to be processed individually, but once processed the input line ca..

Can I make 'git diff' only the line numbers AND changed file names?

This question calls for "line numbers", if you do not care about line numbers in the output see this question and answer. Basically, I don't want to see the changed content, just the file names and..

How to set cookie value with AJAX request?

I want to set a cookie value on an AJAX request but the code below doesn't work. $.ajax({ type: "GET", url: "http://example.com", cache: false, setCookies: "lkfh89asdhjahska7al44..

AngularJS: Can't I set a variable value on ng-click?

I have a modal that uses ng-show="prefs" to determine visibility. My desire is to use the close button in the modal to set $scope.prefs to false and to use an anchor tag to set the value to true. How..

Cannot find either column "dbo" or the user-defined function or aggregate "dbo.Splitfn", or the name is ambiguous

Hai guys, I ve used the following split function, CREATE FUNCTION dbo.Splitfn(@String varchar(8000), @Delimiter char(1)) returns @temptable TABLE (items varchar(8000)) as begin..

How can I send an inner <div> to the bottom of its parent <div>?

The div inside another div picture and code below. Because there will be text and images of the parent div. And red div will be the last element of the parent div. <div style="width: 200px; heig..

Tablix: Repeat header rows on each page not working - Report Builder 3.0

I have a tablix with lots of rows that span over multiple pages. I have set the Tablix property Repeat header rows on each page but this does not work. I read somewhere that this is a known bug in Rep..

How to send a simple email from a Windows batch file?

I'm running Windows 2003 Service Pack 2. I have a batch file that runs on demand. I want to have an email sent every time the batch file runs. The email is simple, just a sentence indicating that the ..

Is Constructor Overriding Possible?

What i know is, the compiler writes a default no argument constructor in the byte code. But if we write it ourselves, that constructor is called automatically. Is this phenomena a constructor overridi..

IPython Notebook save location

I just started IPython Notebook, and I tried to use "Save" to save my progress. However, instead of saving the *.ipynb in my current working directory, it is saved in my python/Scripts folder. Would t..

What is the difference between declarations, providers, and import in NgModule?

I am trying to understand Angular (sometimes called Angular2+), then I came across @Module: Imports Declarations Providers Following Angular Quick Start..

How to get list of dates between two dates in mysql select query

I want list of dates lies between two dates by select query. For example: If i give '2012-02-10' and '2012-02-15' I need the result. date ---------- 2012-02-10 2012-02-11 2012-02-12 2012-02-1..

Reading file line by line (with space) in Unix Shell scripting - Issue

I want to read a file line by line in Unix shell scripting. Line can contain leading and trailing spaces and i want to read those spaces also in the line. I tried with "while read line" but read comma..

Handling JSON Post Request in Go

So I have the following, which seems incredibly hacky, and I've been thinking to myself that Go has better designed libraries than this, but I can't find an example of Go handling a POST request of JS..

Head and tail in one line

Is there a pythonic way to unpack a list in the first element and the "tail" in a single command? For example: >> head, tail = **some_magic applied to** [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] >..

pip cannot install anything

> pip install yolk Downloading/unpacking yolk Cannot fetch index base URL https://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement yolk No distributions at all ..

How to change default Anaconda python environment

I've installed Anaconda and created two extra environments: py3k (which holds Python 3.3) and py34 (which holds Python 3.4). Besides those, I have a default environment named 'root' which the Anaconda..

Can Rails Routing Helpers (i.e. mymodel_path(model)) be Used in Models?

Say I have a Rails Model called Thing. Thing has a url attribute that can optionally be set to a URL somewhere on the Internet. In view code, I need logic that does the following: <% if thing.url...

PostgreSQL - SQL state: 42601 syntax error

I would like to know how to use a dynamic query inside a function. I've tried lots of ways, however, when I try to compile my function a message SQL 42601 is displayed. The code that I use: CREATE O..

Close pre-existing figures in matplotlib when running from eclipse

My question is simple: I have a python script that generates figures using matplotlib. Every time i run it it generates new windows with figures. How can I have the script close windows that were open..

How to get all files under a specific directory in MATLAB?

I need to get all those files under D:\dic and loop over them to further process individually. Does MATLAB support this kind of operations? It can be done in other scripts like PHP,Python.....

PHP form - on submit stay on same page

I have a PHP form that is located on file contact.html. The form is processed from file processForm.php. When a user fills out the form and clicks on submit, processForm.php sends the email and dir..

Is it possible to add an HTML link in the body of a MAILTO link

I have not had to mess with mailto links much. However I now need to add a link in the body of a mailto if it is possible. Is there a way to add a link or to change the email opened to an html ema..

How do you create a UIImage View Programmatically - Swift

I'm trying to create a UIImage View programmatically, I have a new view and I tried doing this let imageName = "yourImage.png" yourview.backgroundColor = UIColor.colorWithPatternImage(UIImage(named:i..

Using boolean values in C

C doesn't have any built-in boolean types. What's the best way to use them in C?..

INSERT INTO...SELECT for all MySQL columns

I'm trying to move old data from: this_table >> this_table_archive copying all columns over. I've tried this, but it doesn't work: INSERT INTO this_table_archive (*) VALUES (SELECT * FROM t..

How to find which columns contain any NaN value in Pandas dataframe

Given a pandas dataframe containing possible NaN values scattered here and there: Question: How do I determine which columns contain NaN values? In particular, can I get a list of the column names co..

Pycharm: run only part of my Python file

Is it possible to run only a part of a program in PyCharm? In other editors there is something like a cell which I can run, but I can't find such an option in PyCharm? If this function doesn't exist..

JavaScript code for getting the selected value from a combo box

Can any one give me a sample code that gets the selected value from an existing combo box? I have this code but its not doing anything: function check () { var e = document.getElementById("tick..

How do I force my .NET application to run as administrator?

Once my program is installed on a client machine, how do I force my program to run as an administrator on Windows 7?..

Submit form without reloading page

I have a function built in JavaScript that I want to be executed after a form submit is hit. It basically changes the look of the page completely. But I need a variable from the search box to still go..

Insert new column into table in sqlite?

I have a table with columns name, qty, rate. Now I need to add a new column COLNew in between the name and qty columns. How do I add a new column in between two columns?..

Uncaught TypeError: Cannot set property 'value' of null

I'm trying to pass the entered text to the controller using an ajax request. But i'm getting athe error "Uncaught TypeError: Cannot set property 'value' of null " when I tried to execute JS file.. H..

Check if a value is an object in JavaScript

How do you check if a value is an object in JavaScript?..

TypeScript sorting an array

I've been trying to figure out a very strange issue I ran into with typescript. It was treating an inline Boolean expression as whatever the first value's type was instead of the complete expression. ..

What do &lt; and &gt; stand for?

I know that the entities &lt; and &gt; are used for < and >, but I am curious what these names stand for. Does &lt; stand for something like "Left tag" or is it just a code?..

Modifying a subset of rows in a pandas dataframe

Assume I have a pandas DataFrame with two columns, A and B. I'd like to modify this DataFrame (or create a copy) so that B is always NaN whenever A is 0. How would I achieve that? I tried the followi..

ReadFile in Base64 Nodejs

I'm trying to read an image from client side encoded in base64. How to read with nodejs? My code: // add to buffer base64 image var encondedImage = new Buffer(image.name, 'base64'); fs.readFile(enc..

DataTable: Hide the Show Entries dropdown but keep the Search box

Is it possible to hide the Show Entries dropdown but keep the Search box in DataTable? I want to always display 10 rows with pagination at the bottom along with search box but do not want to display t..

find . -type f -exec chmod 644 {} ;

why doesn't this work I am trying to change all files to 644 abd all -d to 755: find . -type f -exec chmod 644 {} ; i get: find: missing argument to `-exec' thanks..

How to get current url in view in asp.net core 1.0

In previous versions of asp.net, we could use @Request.Url.AbsoluteUri But it seems it's changed. How can we do that in asp.net core 1.0?..

mongo - couldn't connect to server 127.0.0.1:27017

I am coming from riak and redis where I never had an issue with this services starting, or to interact. This is a pervasive problem with mongo and am rather clueless. Restarting does not help.I am n..

Javascript: set label text

I'm trying to implement a generic function for a form with several fields in the following format. <label id="LblTextCount"></label> <textarea name="text" onKeyPress="checkLength(this,..

How to remove a build from itunes connect?

I want to delete one of my app builds from new itunes connect site. But I couldn't find a delete/remove button. Any ideas? ..

Good Patterns For VBA Error Handling

What are some good patterns for error handling in VBA? In particular, what should I do in this situation: ... some code ... ... some code where an error might occur ... ... some code ... ... some ot..

jQuery add blank option to top of list and make selected to existing dropdown

So I have a dropdown list <select id="theSelectId"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mer..

How to detect READ_COMMITTED_SNAPSHOT is enabled?

In MS SQL Server is there a way to detect whether a database has had its isolation level set via the T-SQL command ALTER DATABASE <database> SET READ_COMMITTED_SNAPSHOT ON; I cannot find a simp..

how do I use an enum value on a switch statement in C++

I would like to use an enum value for a switch statement. Is it possible to use the enum values enclosed in "{}" as choices for the switch()"? I know that switch() needs an integer value in order to d..

print arraylist element?

how do i print the element "e" in arraylist "list" out? ArrayList<Dog> list = new ArrayList<Dog>(); Dog e = new Dog(); list.add(e); System.out.println(list); ..

How to get the width of a react element

Im trying to create a range input that displays a tooltip right above the slider thumb. I went through some vanilla JS examples online and it seems that I need to have the width of the element to aco..

What is the difference between fastcgi and fpm?

I am trying to install php with fpm on macports. I read somewhere that fpm means FastCGI process manager. Does that mean fastcgi and fpm are same? If they are same, then why do we have two different m..

JQuery confirm dialog

Possible Duplicate: Yes or No confirm box using jQuery I see a lot of examples here about replacements for jQuerys standard confirm dialog but don't understand any of them. If I want to ..

Can I catch multiple Java exceptions in the same catch clause?

In Java, I want to do something like this: try { ... } catch (/* code to catch IllegalArgumentException, SecurityException, IllegalAccessException, and NoSuchFieldException at t..

Iterating over JSON object in C#

I am using JSON.NET in C# to parse a response from the Klout API. My response is like this: [ { "id": "5241585099662481339", "displayName": "Music", "name": "music", "slug": "music..

How to view the list of compile errors in IntelliJ?

I am looking for a way to view all compile errors in IntelliJ, similar to how they are displayed in Eclipse. I tried searching here and Google but have not really found a solution. I really like Int..

Checking if any elements in one list are in another

I'm trying to compare two lists and simply print a message if any value from the first list is in the second list. def listCompare(): list1 = [1, 2, 3, 4, 5] list2 = [5, 6, 7, 8, 9] if list1 in..

How to get the correct range to set the value to a cell?

I want to set text or number in Google Sheet from script. I want to set Hello or number 9 in cell F2. I found this code so far: SpreadsheetApp.getActiveRange().setValue('hello'); but that doesn..

How to change text and background color?

I want every character to be a different color. for example, cout << "Hello world" << endl; H would be red e would be blue l would be orange and so on. I know this can be done, I ju..

Run react-native application on iOS device directly from command line?

Is it possible to run react-native application on an iOS device directly from the command line like we do on simulator with react-native run ios --simulator "iPhone 5s"?..

Can CSS detect the number of children an element has?

I'm probably answering my own question, but I'm extremely curious. I know that CSS can select individual children of a parent, but is there support to style the children of a container, if its parent..

The project description file (.project) for my project is missing

I am using Eclipse PDT 3.5 on Vista (32 bit). It works, though eclipse needs admin rights to execute. This annoys me, but I accept it. But: every now and then (I am not sure, it may even be everytime..

Counting the occurrences / frequency of array elements

In Javascript, I'm trying to take an initial array of number values and count the elements inside it. Ideally, the result would be two new arrays, the first specifying each unique element, and the sec..

How do I fix a NoSuchMethodError?

I'm getting a NoSuchMethodError error when running my Java program. What's wrong and how do I fix it?..

What is the unix command to see how much disk space there is and how much is remaining?

I'm looking for the equivalent of right clicking on the drive in windows and seeing the disk space used and remaining info...

Is it possible to change the speed of HTML's <marquee> tag?

When one marquee leaves the screen then after a short time gap it enters from another side. Is there any way to reduce this time?..

Is there an equivalent to e.PageX position for 'touchstart' event as there is for click event?

I'm trying to get the X position with jQuery of a touchstart event, used with the live function? I.e. $('#box').live('touchstart', function(e) { var xPos = e.PageX; } ); Now, this does work with '..

Installing RubyGems in Windows

I'm new to ruby. I tried to install Ruby Gems on my PC by following the steps given in the site http://rubygems.org/pages/download. I downloaded the package from the mentioned site, changed the direct..

How to trigger the onclick event of a marker on a Google Maps V3?

How do I trigger the onclick event of a marker on a Google Maps from outside the map? I use version 3 of the API. I've seen many tutorials for version 2, but can't find this for version 3. I have a ..

How to state in requirements.txt a direct github source

I've installed a library using the command pip install git+git://github.com/mozilla/elasticutils.git which installs it directly from a Github repository. This works fine and I want to have that depe..

How do I perform a JAVA callback between classes?

I am coming from JavaScript, in which callbacks are pretty easy. I am trying to implement them into JAVA, without success. I have a Parent class: import java.net.Socket; import java.util.concurrent...

How to get ip address of a server on Centos 7 in bash

Previously I used the following command in bash to find the main ip of my server ipaddr=$(/sbin/ifconfig|grep inet|head -1|sed 's/\:/ /'|awk '{print $3}' | grep -v '127.0.0.1') But in centos7 it no..

SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance

I am trying to build an ASP.NET MVC 5 Web Application which has a MyDatabase.mdf file in the App_Data folder. I have SQL Server 2014 Express installed with a LocalDb instance. I can edit the database ..

How can I zoom an HTML element in Firefox and Opera?

How can I zoom an HTML element in Firefox and Opera? The zoom property is working in IE, Google Chrome and Safari, but it’s not working in Firefox and Opera. Is there any method for adding this pr..

How to Get a Sublist in C#

I have a List<String> and i need to take a sublist out of this list. Is there any methods of List available for this in .NET 3.5?..

how to pass this element to javascript onclick function and add a class to that clicked element

I had an html navigation code as below _x000D_ _x000D_ function Data(string) { //1. get some data from server according to month year etc., //2. unactive all the remaining li's and make the curren..

how to bold words within a paragraph in HTML/CSS?

I am a beginner in web programming and have some very simple questions. I'm trying to bold several words in one paragraph but I don't know how to do that using HTML/CSS. I've figured out how to bold ..

What is the equivalent of Java's System.out.println() in Javascript?

I am writing some tests for Javascript code and I need to dump some messages during the compile process when errors are encountered. Is there any equivalent to Java's System.out.println() in Javascri..

Bootstrap dropdown sub menu missing

Bootstrap 3 is still at RC, but I was just trying to implement it. I couldn't figure out how to put a sub menu class. Even there is no class in css and even the new docs don't say anything about it I..

CR LF notepad++ removal

I am using notepad++ , after end of line when i press enter CR LF is printed . I tried a lot but not able to remove it . Please help me to change the setting so that I can restore it back and there wo..

executing shell command in background from script

how can I execute a shell command in the background from within a bash script, if the command is in a string? For example: #!/bin/bash cmd="nohup mycommand"; other_cmd="nohup othercommand"; "$cmd &..

How to delete a column from a table in MySQL

Given the table created using: CREATE TABLE tbl_Country ( CountryId INT NOT NULL AUTO_INCREMENT, IsDeleted bit, PRIMARY KEY (CountryId) ) How can I delete the column IsDeleted?..

Installing Bower on Ubuntu

I'm trying to install Bower on XUbuntu 13.10, following the instructions on the Bower home page, after doing sudo apt-get install npm and sudo npm install -g bower I get the following after issuing bo..