Categories
discuss

An Android Virtual Device that failed to load

Note: this question is very similar to another question posed much earlier by another person, but does not solve my problem. (not the same question here)

Situation: I just installed Eclipse/ADK/Android SDK, etc. and made sure to download/install Android 2.2, 4.2.2, & 4.4.2 from the SDK Manager.

I am now trying to create an Android Virtual Device akin to the Google Nexus 5, which uses 4.4.2. Using 512 MB of RAM

Problem arises when I finish “creating” it, the AVD fails to load. I can dismiss this error, but I actually can’t run anything on that AVD – it’s just a black screen… not even the simple Hello World!

AVD crashes when loading.

When I try to launch an application, I get the following error:

Android Launch! adb is running normally. 

Performing com.XXX.myapp001.StartingPoint activity launch

Automatic Target Mode: Preferred AVD 'AVD_for_Nexus_5_by_Google' is available on emulator 'emulator-5554' 

Uploading TheNewBoston.apk onto device 'emulator-5554' Installing TheNewBoston.apk... 

Installation error: Unknown failure 

Please check logcat output for more details. 

Launch canceled! 

Thank you.

Answer

Forgot to re-post this answer that I put in the comments section of my original post chain.

solution: was HAX allocation. Solution can be found in the following video.

Categories
discuss

What’s a proper way to turn off genymotion emulator?

Funny thing – I’ve always been shutting it down by closing emulator’s window (X in upper-right corner, yes).

Now I somehow got interested if nothing is corrupted in emulator during that.

Surprisingly, nothing could be googled about that.

Answer

I have the same problem (Windows 8.1, GenyMotion 2.1.1), and I sent an email to GenyMotion. Their answer:
Genymotion
Support (Genymobile)

Mar 28 15:00

Bonjour Yves,

Il n’est effectivement pas possible pour le moment d’arrêter un terminal virtuel 4.4.2 “proprement”. Ceci est dû à un bug, que nous traiterons au plus vite.
En ce qui concerne de besoin de redémarrer Genymotion, le contournement est simple: il vous suffit de fermer la fenêtre Genymotion.
Vous serez averti dès que ce bug sera résolu!

Cordialement,

Damien
Genymotion Support Team

Translation (Google translation):

It is actually not possible at this time to stop a virtual terminal 4.4.2 “properly”. This is due to a bug, which we treat as soon as possible.
As regards the need to restart Genymotion, the workaround is simple: simply close the window Genymotion.
You will be notified as soon as this bug will be solved!

My own solution: click on the red cross, use Task Manager or Process Explorer, and kill Process Tree “player.exe”.

Hope this aids

Yves Ruin

Categories
discuss

How update Sails.js to newest version?

How can I update my Sails.js framework (installed on OSX) to newest version using terminal/command line?

Answer

npm update [-g] [<name> [<name> ...]]

This command will update all the packages listed to the latest version (specified by the tag config). It will also install missing packages.

If the -g flag is specified, this command will update globally installed packages.

So for you, I guess that would be: npm update sails or sudo npm -g update sails depending on how and where you installed it.

Categories
discuss

How can localized messages in Thymeleaf be processed using SpEL

I am a beginner with ThymeLeaf and have not used SpEL too much except for @PreAuthorize annotations, so please be so kind to help me out.

I am using ThymeLeaf (version 2.1.2) together with Spring (4.0.2.RELEASE) and the thymeleaf-spring4 package which (as far as I understood it) replaces the default OGNL scripting with SpEL.

What I want to achieve is simply that a localized string is capitalized via #strings.capitalize function. Here is what I tried so far:

<h1 th:text="#{retrievable.key}">Text to be replaced</h1>

Works perfectly and gives the expected result.

Now when I tried this:

<h1 th:text="${#strings.capitalize(#{retrievable.key})}">Text to be replaced</h1>

I got the following exception (root cause, rest omitted for clarity):

org.springframework.expression.spel.SpelParseException:
EL1043E:(pos 21): Unexpected token.  Expected 'identifier' but was 'lcurly({)'

Ok, fine. Just for fun, I omitted the curly brackets and got what I expected: the <h1> was empty.

So now I thought that it might necessary to preprocess the retrieval of the message for retrievable.key so that it is already evaluated when #strings.capitalize is evaluated. Though this seemed bot either counterintuitive and illogical to me, as this would break all programming rules, I tried that approach. It did not work either: using

${#strings.capitalize(__#retrievable.key__)}

lead to

org.thymeleaf.exceptions.TemplateProcessingException:
Could not parse as expression: "#retrievable.key"

and using

${#strings.capitalize(__#{retrievable.key}__)}

led to (you guessed it) <h1></h1>.

I know that the actual problem can be solved with CSS or JavaScript, but it’s not necessarily about uppercasing or capitalizing, but on processing of localized strings and this is an example.

So what am I missing here?

Solution provided by Thymeleaf Forum

Zemi of the ThymeLeaf Forum provided the following, elegant solution:

<h1 th:text="${#strings.capitalize('__#{retrievable.key}__')}">Text to be replaced</h1>

Please notice the single quotes. Preprocessing seems to really mean preprocessing in Thymeleaf.

I have accepted the first working answer, however.

Answer

The following worked for me

<body th:with="message=#{retrievable.key}">
    <h1 th:text="${#strings.capitalize(message)}">Text to be replaced</h1>
</body>
Categories
discuss

Display two Toast messages at once?

I would like one Toast message to display in one location and a different Toast message to display in another location simultaneously.

  1. Multiple Toast messages seem to always queue and display in order. Is it possible to show both messages at the same time?

  2. Is there a workaround that at least gives that appearance and doesn’t involve messing with the activity layout?

Edit: It seems the answer to the first question is no, it’s not possible. How about a workaround? A solution for me would include something that appears “over” the app like a Toast and doesn’t interfere with user interaction with the app (so, not an AlertDialogue or anything that calls onPause() etc.).

Answer

As Jay Patel said, it cannot be done. But there IS workaround! You can create custom Toast which can contain any View. That means you can have layout with two messages on different places inside one toast.

You can find how to do that here, or you can start directly with this snippet:

LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.custom_toast,
                           (ViewGroup) findViewById(R.id.toast_layout_root));

TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("This is a custom toast");

Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();
Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..