Questions

Convert floating point number to a certain precision, and then copy to string

I have a floating point number, say `135.12345678910`. I want to concatenate that value to a string, but only want `135.123456789`. With print, I can easily do this by doing something like: ``` print...

25 May at 22:44

Mockito: InvalidUseOfMatchersException

I have a command line tool that performs a DNS check. If the DNS check succeeds, the command proceeds with further tasks. I am trying to write unit tests for this using Mockito. Here's my code: ``` p...

14 Mar at 22:23

How to capture no file for fs.readFileSync()?

Within node.js [readFile()](http://nodejs.org/api/fs.html#fs_fs_readfile_filename_encoding_callback) shows how to capture an error, however there is no comment for the [readFileSync()](http://nodejs.o...

22 Jan at 06:37

How can I transform string to UTF-8 in C#?

I have a string that I receive from a third party app and I would like to display it correctly in any language using C# on my Windows Surface. Due to incorrect encoding, a piece of my string looks l...

Unable to access JSON property with "-" dash

I am unable to retrieve a value from a json object when the string has a dash character: ``` { "profile-id":1234, "user_id":6789 } ``` If I try to reference the parsed `jsonObj.profile-id` it retur...

13 Dec at 22:31

How to automatically crop and center an image

Given any arbitrary image, I want to crop a square from the center of the image and display it within a given square. This question is similar to this: [CSS Display an Image Resized and Cropped](http...

23 May at 11:54

How to cancel a Task in await?

I'm playing with these Windows 8 WinRT tasks, and I'm trying to cancel a task using the method below, and it works to some point. The CancelNotification method DOES get called, which makes you think t...

13 Apr at 02:41

GUI Tool for PostgreSQL

I am new to database and I want to know if there any for just like for ?

12 Oct at 12:49

DROP IF EXISTS VS DROP?

Can someone tell me if there is any difference between ``` DROP IF EXISTS [TABLE_NAME] ``` ``` DROP [TABLE_NAME] ``` I am asking this because I am using JDBC template in my MVC web application....

27 Sep at 13:58

Apache redirect to another port

I've struggled with this for some time and am definitely doing something wrong. I have Apache server and a JBoss server on the same machine. I'd like to redirect traffic for `mydomain.example` to JBos...

17 Jun at 17:7

Tool for comparing 2 binary files in Windows

I need a tool to compare 2 binaries. The files are quite large. Some freeware or trial tools I found on the Internet are not convenient to use for large files. Can you recommend me some tools?

2 Oct at 12:27

What is the difference between server side cookie and client side cookie?

What is the difference between creating cookies on the server and on the client? Are these called server side cookies and client side cookies? Is there a way to create cookies that can only be read on...

11 Sep at 16:3

How to get config parameters in Symfony2 Twig Templates

I have a Symfony2 Twig template. I want to output the value of a config parameter in this twig template (a version number). Therefore I defined the config parameter like this: ``` parameters: app...

22 Nov at 04:36

Calculate the center point of multiple latitude/longitude coordinate pairs

Given a set of latitude and longitude points, how can I calculate the latitude and longitude of the center point of that set (aka a point that would center a view on all points)? EDIT: Python soluti...

4 May at 16:9

Telling gcc directly to link a library statically

It feels strange to me to use `-Wl,-Bstatic` in order to tell `gcc` which libraries I want to link with statically. After all I'm telling `gcc` directly all other information about linking with libra...

Error inflating class fragment

I get the Error ``` Unable to start activity ComponentInfo{de.androidbuch.activiti/de.androidbuch.activiti.task.Activity}: android.view.InflateException: Binary XML file line #11: Error inflating c...

Setting table row height

I have this code: ``` <table class="topics" > <tr> <td style="white-space: nowrap; padding: 0 5px 0 0; color:#3A5572; font-weight: bold;">Test</td> <td style="padding: 0 4px 0 0;...

4 Mar at 19:57

How to get a substring of text?

I have text with length ~700. How do I get only ~30 of its first characters?

5 Apr at 05:39

What's the difference between session.persist() and session.save() in Hibernate?

Can anyone tell me what's the advantage of `persist()` vs `save()` in Hibernate?

1 Sep at 23:9

How do I configure the proxy settings so that Eclipse can download new plugins?

I am working with Eclipse 3.7, on an Windows XP environment behind a web proxy. I want to install the [Groovy plugin](http://groovy.codehaus.org/Eclipse+Plugin) on a Eclipse Indigo (). I added the [...

19 Jan at 14:30

How to completely remove borders from HTML table

My goal is to make an HTML page that is similar to a "photo frame". In other words, I want to make a blank page that is surrounded by 4 pictures. This is my code: ``` <table> <tr> <td cl...

Input placeholders for Internet Explorer

HTML5 introduced the `placeholder` attribute on `input` elements, which allows to display a greyed-out default text. Sadly the Internet Explorer, including IE 9 does not support it. There already ar...

How to check whether an object has certain method/property?

Using dynamic pattern perhaps? You can call any method/property using the dynamic keyword, right? How to check whether the method exist before calling myDynamicObject.DoStuff(), for example?

13 Aug at 14:7

How to get the size of a string in Python?

For example, I get a string: ``` str = "please answer my question" ``` I want to write it to a file. But I need to know the size of the string before writing the string to the file. What function ...

21 Jan at 19:35

Are there any Java method ordering conventions?

I've got a large-ish class (40 or so methods) that is part of a package I will be submitting as course-work. Currently, the methods are pretty jumbled up in terms of utility public/private etc. and I ...

24 Jan at 18:32