Saturday, 24 August 2013

Does operator precedence works the same way for string as for numbers?

Does operator precedence works the same way for string as for numbers?

While code golfing I stumbled on a peculiar issue
>>> print '%'+'-+'[1]+str(5)+'s'%'*'
Traceback (most recent call last):
File "<pyshell#178>", line 1, in <module>
print '%'+'-+'[1]+str(5)+'s'%'*'
TypeError: not all arguments converted during string formatting
My assumption was operator evaluation happens from left to right, but in
this particular case, it seems that even though its string operation, %
takes priority over+ and tries to evaluate 's'%'*' before the
concatenation and fails
Is this a known documented behavior, or there is something more that is
not obvious to me.

AlertDialog.Builder not stay on screen

AlertDialog.Builder not stay on screen

In my application I am showing AlertDialog.Builder
AlertDialog.Builder alert = new AlertDialog.Builder(this);
and in this aleart there is one EditText and PositiveButton.
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setMessage("Enter Text");
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PASSWORD);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
if(input.getTest().getText().toString().equalsIgnoreCase("")){
Toast.makeText(Activity.this, "Please enter some text",
Toast.LENGTH_LONG).show();
}
}
if nothing is entered then it show Please enter some text on tost and the
dialog is closed but I want the AleartDialog will not close. How this
possible?

Azure package does not include solution libraries in one of two web roles

Azure package does not include solution libraries in one of two web roles

I have a solution in Visual Studio with a bunch of library projects, two
web application projects and a cloud project. One web app has a dependancy
on all libraries and the second web app depends on the first web app only
(this app is not finished yet and will depend on part of the libraries,
eventually).
The problem is, when I publish the solution to azure, only the second web
app includes the libraries in it's bin folder, but the first app has only
external dependencies. Although when I build the solution, all the
necessary files are included.

SlidingPaneLayout does not cover the left side panel

SlidingPaneLayout does not cover the left side panel

how to understand it? why the left panel is not hidden?
My xml file:
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment android:id="@+id/headlines"
android:layout_height="match_parent"
android:name="by.zubov.task.fragments.TitlesFragment"
android:layout_width="380dp"
/>
<FrameLayout android:id="@+id/details"
android:layout_width="500dp"
android:layout_weight="1"
android:layout_height="match_parent" />
result: Image result
testing this is code on Htc One (display 540x960).

Layout Issue in Android Application for Gogole TV

Layout Issue in Android Application for Gogole TV

I have different layout folder inside for res folder :
layout
layout-large
layout-sw600dp
layout-sw800dp
layout-xlarge
Now i am going to my existing android application in Google TV emultor.
For Google TV layout compatible i have added layout-large-notouch folder,
but my application is render layout from layout-large for Google TV.
I do not want to remove layout-large and i do not want to any change in
layout-large.
Is there any for render layout for Google TV from different folder..?

Friday, 23 August 2013

what's the difference between head and branch using Git in Eclipse

what's the difference between head and branch using Git in Eclipse

I am using git inside Eclipse. Can someone please explain the difference
between HEAD and master[branch] in the drop down menu selected? I usually
choose one completely arbitrarily and so far this arbitrariness hasn't
appeared to make much difference, but I am sure that's gonna come back to
haunt me if I don't figure it out soon.

Warning "Command \@makecol has changed."

Warning "Command \@makecol has changed."

When I compile my documment I get the following warning Command \@makecol
has changed.
TexStudio points to the file footmisc.sty. Of course I've tried to install
its latest version (2011/06/06 v5.5b) but still have the problem :(
MWE:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage[bottom,hang]{footmisc}
\usepackage[T1]{fontenc}
\begin{document}
mediante DHCP\footnote{Se puede obtener más información sobre esta
utilidad en el documento anexo Guía de usuario de Xen: Instalación,
configuración y primeros pasos}
\end{document}
I've seen that by reordering the fancyhdr and footmisc sentences the
warning doesn't occur, but still not sure if with that there's no error or
it's just that fancyhdr doesn't check well.