Saturday, 14 September 2013

Android kill service from a service and prevent it to reopen

Android kill service from a service and prevent it to reopen

Im developing an application and I need to block some apps from one service.
¿How can I kill those applications services and prevent them to restart
when my service is running?
Thank you very much :)

selectbox display the same div

selectbox display the same div

I want selecbox to show div.
no matter what I choose in the selectbox I want to display the same div
I took this code:
$('#Field16').bind('change',function(){
$('.box').hide();
$('#'+$(this).val()).show();
});
What do I need to change?
Thanks

javascript to achive the same result as css ellipsis

javascript to achive the same result as css ellipsis

due to some reason I cant use the css method
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
width: 100px;
the above make my user define text in a li if reached 100px, it will add
'...', can it be achieve using jquery?

GIT internal server error

GIT internal server error

I keep getting this error from the git server of my project at
http://code.google.com/p/mdpm
remote: Error: internal server error
error: RPC failed; result=18, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date
What is it? I can't push anything

How to set charset of gradle

How to set charset of gradle

I use gradle for my android application.But when I build it,I got some
error like"error:need';'".And I aslo get some strange words where I use
unEnglish words.So I guess the reason of it maybe the charset.So how could
I set charset=utf-8 of gradle?

Friday, 13 September 2013

How to elegantly return an object that is default-initialized?

How to elegantly return an object that is default-initialized?

I have a class like below:
class VeryVeryVeryLongTypeName
{
bool is_ok;
VeryVeryVeryLongTypeName() : is_ok(false) {}
};
VeryVeryVeryLongTypeName f()
{
VeryVeryVeryLongTypeName v;
... // Doing something
if (condition_1 is true)
{
return v;
}
else
{
return VeryVeryVeryLongTypeName();
}
... // Doing something
if (condition_2 is true)
{
return v;
}
else
{
return VeryVeryVeryLongTypeName();
}
}
I think the statement return VeryVeryVeryLongTypeName(); is very tedious
and ugly, so, my question is:
How to elegantly return an object that is default-initialized?
or in other words:
Is it a good idea to add a feature into the C++ standard to make the
following statement is legal?
return default; // instead of return VeryVeryVeryLongTypeName();

Raname an item on listview

Raname an item on listview

I have a listview and a rename button, if I want to rename an item on the
listview I just click the rename button and it would look like this
I would be able to type the new name. I know that I can just double click
the item and then rename it, but I want to use a button.
How can I also create an event after it renamed the item? if it renamed
the file successfully, e.g.
if (*renamed was successful*) then ShowMessage('You successfully renamed
this item !');