What's the best way to trim std::string?

What's the best way to trim std::string?

I'm currently using the following code to right-trim all the std::strings in my programs:std::string s;s.erase(s.find_last_not_of(" \n\r\t")+1);It works fine, but I wonder if there are some end-cases where it might fail?Of course, answers w

How to set focus on input field?

How to set focus on input field?

What is the 'Angular way' to set focus on input field in AngularJS?More specific requirements:When a Modal is opened, set focus on a predefined inside this Modal.Everytime becomes visible (e.g. by clicking some button), set

What does a “Cannot find symbol” compilation error mean?

What does a “Cannot find symbol” compilation error mean?

Please explain the following about the "Cannot find symbol" error:What does this error mean?What things can cause this error?How does the programmer go about fixing this error?This question is designed to be a comprehensive question about "

Extending AdapterView

Extending AdapterView

i'm trying to make (for learning purposes) my own implementation of a simple AdapterView where items comes from an basic Adapter (ImageAdapter from sdk samples).Actual code is like this: public class MyAdapterView extends AdapterView

Prevent saving files with certain names in Vim

Prevent saving files with certain names in Vim

I type really fast and realize that sometimes I accidentally save a file with the name of ; or : (I type :wq and sometimes a typo is introduced).Is there any way to write a macro that rejects saving files matching certain names? 1:A sim

How to put an image next to each other

How to put an image next to each other

I'm trying to put these two 'hyperlinked' icons next to each other but I can't seem to do that. As you can see, the twitter icon falls to the next line.. (they are both hyperlinked to their respective website)HTML CSS.nav3 {

Inner left-floating div's do not expand the container div vertically

Inner left-floating div's do not expand the container div vertically

I have a container div with the following attributes:#cat_container{margin:0;padding:5px;border:1px solid red;min-height:200px;}Inside there are multiple left floating div's. The problem is that they don't force the containing div to expand

overflow-x: visible; doesn't work with overflow-y: auto; any workaround? [duplicate]

overflow-x: visible; doesn't work with overflow-y: auto; any workaround? [duplicate]

This question already has an answer here: CSS overflow-x: visible; and overflow-y: hidden; causing scrollbar issue 5 answers i am trying.item { width

How much should I worry about the Intel C++ compiler emitting suboptimal code for AMD?

How much should I worry about the Intel C++ compiler emitting suboptimal code for AMD?

We've always been an Intel shop. All the developers use Intel machines, recommended platform for end users is Intel, and if end users want to run on AMD it's their lookout. Maybe the test department had an AMD machine somewhere to check w

Custom hadoop key and value : How to write CompareTo() Method

Custom hadoop key and value : How to write CompareTo() Method

I need to emit a 2D double array as key and value from mapper. There are questions posted in Stack Overflow, but they are not answered.I am doing some of the matrix multiplication in a given dataset, and after that I need to emit the value

Cannot Type EditText in ExpandableListView Child

Cannot Type EditText in ExpandableListView Child

i am using expandableList and each child has its edittext to enter a number... when the child is pressed, the edittext shows. if it is not, the edittext stays invisible.. but when i tap on the edittext, the keyboard shows in number (because

Set div height to 100% of parent

Set div height to 100% of parent

I want the following layout for my web page:| header || navigation | details || | |Where the navigation pane (content dynamically generated) contains hundreds of elements. I want a vertical scroll bar to be

Jquery autocomplete start from first character

Jquery autocomplete start from first character

I think this is asked by someone before but I can't get it to work with my script.When I start typing in the input field and for example I start with the letter A I get every Label that contains the letter A.I only want the Labels that Star

Make .NET WebBrowser not to share cookies with IE or other Instances

Make .NET WebBrowser not to share cookies with IE or other Instances

Since WebBrowser in C# shares cookies with all other instances of WebBrowsers including IE I would like for a WebBrowser to have it's own cookie container that doesn't share any cookies that was created previously in IE or other instances.

How to highlight the grid view item on select?

How to highlight the grid view item on select?

I am creating a Grid view layout with image and text.I want multi-select of item which is working fine but i want to highlight the grid items which is selected.Here is my code:public class FragMent1 extends Fragment{ BaseAdapter MyAd

C++ function decorator

C++ function decorator

I am looking for a way to decorate functions or lambdas in C++. The goal is to do something before and after the function call. As I've seen the closest thing to use is std::function but it needs to have the types of its arguments.class Fun

Android service not launched by JUnit test

Android service not launched by JUnit test

I have this test class to test a remote service:public class CoreServiceBasicTest extends ServiceTestCase implements ServiceConnection { /** Tag for logging */ private final static String TAG = CoreServiceBasicTest.class.getName();

Can I apply CSS(3) filters ONLY on image sections?

Can I apply CSS(3) filters ONLY on image sections?

I have a full screen background image.bg { left: 0; min-height: 100%; min-width: 100%; position: fixed; top: 0; z-index: -1; }and want to apply a CSS3 filter, personally I would like to use a blur effect, at the same

How to auto-scroll to input field in Android when the soft keyboard overlaps them on showing?

How to auto-scroll to input field in Android when the soft keyboard overlaps them on showing?

I am developing a hybrid app using Worklight, and I am experiencing the following issue:When the user clicks on an input field, the soft keyboard that pops up hides the input field when the latter is relatively low on the screen. The page i

Header and footer with fixed position while content is scrollable?

Header and footer with fixed position while content is scrollable?

I'm trying to make a website where header and footer have fixed position while content scrolls in the middle. some contentI created what I thought would work but it doesn't. Here's jsFiddle with the whole thing.As you can see, part of conte

Alternative to boost::shared_ptr in an embedded environment

Alternative to boost::shared_ptr in an embedded environment

I'm using C++ in an embedded linux environment which has GCC version 2.95.I just can't extract boost::shared_ptr files with bcp, it is just too heavy.What I'd like would be a simple smart pointer implementation of boost::shared_ptr but with

OAuth 2.0 access token has expired, and a refresh token is not available

OAuth 2.0 access token has expired, and a refresh token is not available

I have a web based application which use Google OAuth2.0 as the login framework. It works nicely previously until yesterday. The applcation couldn't get the refresh token after the access token expired. Besides that, the "Request for permis

java.lang.ClassNotFoundException: org.hibernate.engine.SessionFactoryImplementor

java.lang.ClassNotFoundException: org.hibernate.engine.SessionFactoryImplementor

i am trying to migrate to hibernate 4.1.0.Final with spring 3.1.1.RELEASEand following is my configuration for hibernate: hibernate.dialect=org.hibernate.dialect.MySQLDialect hiberna

C++ ~ 1M look-ups in unordered_map with string key works much slower than .NET code

C++ ~ 1M look-ups in unordered_map with string key works much slower than .NET code

I have .NET and C++ implementations of a perf test function that does 854,750 lookups in a dictionary using string keys from a pool of 6838 keys. I wrote these functions to investigate a perf bottleneck in a real app. .NET implementation is

Android twitter tweet with image [duplicate]

Android twitter tweet with image [duplicate]

Possible Duplicate: Can we post image on twitter using twitter API in Android? I am working in an android application and I want to tweet a message and a picture to twitter. I am able to tweet only tweets to twitter by the code :String to