Posts by Leonardo Otto • 2,328 points
52 posts
-
0
votes1
answer392
viewsQ: Android does not resolve Firebase dependencies
I am having error in solving the dependencies of Gradle: I try to compile and get the following error: Error:FAILURE: Build failed with an exception. * What went wrong: A problem occurred…
-
3
votes1
answer392
viewsA: Android does not resolve Firebase dependencies
The version 9.0.0 of packages com.google.android.gms:* and com.google.firebase:* are launched directly into the SDK. Soon it is necessary to update your version to the latest available. In Android…
-
2
votes1
answer1406
viewsA: Add formatting to an app description in Google Play
Experimentally, I discovered that you can use: Simple Line Breaks are ignored; Double Line Breaks open a new paragraph; Simple Line Breaks can be forced to finish the line with two spaces (similar…
-
0
votes1
answer663
viewsQ: Error when compiling Android Studio project with Gradle
I’m having a problem compiling my Gradle project. I have the following answer from the compiler: Error:Gradle: Execution failed for task ':mobile:processBroadcastHomologDebugResources'. >…
-
1
votes1
answer663
viewsA: Error when compiling Android Studio project with Gradle
I found a problem with my layout, although compiling does not report any useful information. I have the following layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"…
-
1
votes1
answer68
viewsQ: Error when running Scalatra test on Intellij
I’m trying to run the following test of scalatra within the intellij: class Test extends ScalatraFlatSpec with Matchers { addServlet(classOf[MainServlet], "/*") "Home Page" should "show hello" in {…
-
2
votes1
answer68
viewsA: Error when running Scalatra test on Intellij
I got this same error when I was running as a test java and not as a test of scala. Not always the intellij hits the right type of test. If this is the case to correct change: To: And the test will…
-
1
votes1
answer610
viewsA: Allow the user to run the program step by step
There are two answers to what you want. The simple answer consists of preparing the environment so that you show how to run the algorithm step by step but not implement a fully functional code…
javaanswered Leonardo Otto 2,328 -
2
votes1
answer50
viewsQ: Intellij 14 and Scala Plugin. Error when locating standard methods
I upgraded my Intellij IDEA to version 14 and now it is no longer recognizing some methods within my Scala program. The IDE can’t even find the simplest of methods: println("Hello world") What to…
-
2
votes1
answer50
viewsA: Intellij 14 and Scala Plugin. Error when locating standard methods
There is a bug in this version as reported here and here. A possible solution is to invalidate caches within the IDE at: File > Invalidate Caches…
-
1
votes1
answer246
viewsQ: How I read an Assets file as a string
How do I read as string an Android text file that is inside the Assets folder?
androidasked Leonardo Otto 2,328 -
1
votes1
answer246
viewsA: How I read an Assets file as a string
getAssets().open() will return a InputStream. Read it using the standard Java input and output API (I/O). As in the following example: StringBuilder buf=new StringBuilder(); InputStream…
androidanswered Leonardo Otto 2,328 -
1
votes1
answer1512
viewsA: Synchronize Bitbucket with Web Server
Yes it is possible. What you need is to clone your bitbucket project from the web server. Here you find how to clone inside the server using git. Briefly: git clone…
-
10
votes1
answer1064
viewsA: Unit tests on Android
There are several options depending on what you want to do. You can divide your tests into two types: Unitary Functional And you have two options of where to run them: Dalvik (Inside the apparatus)…
-
1
votes1
answer62
viewsA: Capture Linux logon event using Java
In linux you can create a script that runs every time the user logs in. You can find a description here. Then you create a script that runs your java program. But purely in java you won’t be able to…
-
-1
votes1
answer317
viewsQ: Webview - Classnotfoundexception
I’m creating the following canvas on android <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"…
-
1
votes1
answer317
viewsA: Webview - Classnotfoundexception
You need to rewrite Webview for Webview. Thus: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"…
-
4
votes2
answers307
viewsA: End of Java Scanner input
A possible solution would be thus: import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner s = new Scanner(System.in); int sum = 0; while (s.hasNextLine()) {…
-
1
votes1
answer400
viewsA: Overwrite Primary Hibernate Key Generator
You can remove the generator from the entity. @Entity public class Entidade{ @Id //@GeneratedValue <-- Remover private Long id; ... Another simpler solution would be to change the class to…
-
1
votes1
answer177
viewsA: Android Webview Destroy
You need to remove Webview from your view. Example: webViewPlaceholder.removeView(myWebView); myWebView.removeAllViews(); myWebView.destroy(); ONLY in English Here is a simple example: <?xml…
-
2
votes1
answer254
viewsA: Is there such a thing as nhibernate Fluent for java Hibernate?
In the hibernate mappings can already be done using annotations. As in the example: package model; import javax.persistence.*; @Entity @Table(name="PESSOA") public class Pessoa { private int id;…
-
-1
votes4
answers2972
viewsA: Convert data to Timezone
As in the ONLY in English The best way to convert is by using the team in milliseconds, UTC. The Object Javascript Date and java.util.Date support conversion using milliseconds.…
-
0
votes2
answers7840
viewsQ: How to redirect using Angularjs
I’m using the Angularjs, and need to redirect to another page within my controller. How do I do this? Follow the code of my controller: meuController.controller('Controller', function ($scope) {…
-
-1
votes2
answers7840
viewsA: How to redirect using Angularjs
To do this you need to modify your function to receive the parameter $location. After that use this parameter to redirect Example: meuController.controller('Controller', function…
-
39
votes7
answers13788
viewsA: How to represent money in Javascript?
Before analyzing your requirements I will add some settings: Interoperability Interoperability is the ability of a system (computerised or otherwise) to communicate transparent form (or nearest)…
-
8
votes3
answers8791
viewsA: What is the difference between checked (checked) and unchecked (unchecked) exceptions?
What is an exception? According to the famous book. We consider hardware-detectable errors as incorrect disk reading and unconventional situations, such as an end of file as exceptions. We further…
-
2
votes2
answers375
viewsA: Doubt with inheritance in Java method
This reply this great. If you want a solution for the implementation: public class RelatorioHorariosDTO implements BaseRelatorioDTO<RespostaHorariosDTO> { private static final long…
-
2
votes2
answers3052
viewsA: How to work with Postgresql array data types using Hibernate
I believe that this English OS response is just what you need. A translation would be: I tried some versions based on Type Array intruded by JDBC4: How can I set a String[] Parameter to a Native…
-
10
votes3
answers860
viewsA: Extracting Numbers from a String
You can do it like this: public class Test { public static void main(String[] args) { String s = "01 - 02 - 03 - 04 - 45 - 86"; String[] sp = s.split(" - "); int n[] = new int[sp.length]; for (int i…
-
10
votes3
answers18905
viewsA: Algorithm for betting creation on Lotofácil
I’d do it this way. Solution 1 Create a list of 25 numbered positions from 1 to 25 I’d do a lot of shuffling on the list I’d take the first 15 elements I would check if I already have these 15…
-
2
votes3
answers1665
viewsA: Test automation on web pages
Here has a complete list of test automation tools. Selenium is an excellent tool and I recommend trying to fix your problem by following a few steps as indicated Here. From what I saw you have to…
-
4
votes2
answers338
viewsA: Handle price in stock control
As recommended by Martin Fowler in his book Patterns of Enterprise Application Architecture you must use: An integer type with the amount (1000 = R$ 10.00) The currency type (Real or Dollars ). You…
javaanswered Leonardo Otto 2,328 -
3
votes3
answers2284
viewsA: Doubts binary search
The efficiencies would be: n. log(n) to order log(n) to search when ordered binarysearch n to look for disorderly Let’s say we have 10K elements To sort and seek: 10K.log(10K)+log(10K) = 44K de…
-
4
votes3
answers1461
viewsA: How to update Textview from Asynctask?
The official documentation of Android is here Asynchronous Task is defined as a computation that runs on a Background Thread and that the result is published in the Interface Thread (UI Thread). On…
-
7
votes1
answer231
viewsA: Async Task and/or Application
The class Aplication is like a Singleton, is one for each application Android. But it was not designed to perform background tasks, but rather to store information on the application. As it says in…
androidanswered Leonardo Otto 2,328 -
5
votes2
answers3548
viewsA: How to check if a directory exists in Java?
You can create Path from a String just use the class methods Paths (plural), for example: Path p1 = Paths.get("/tmp/foo"); Path p2 = Paths.get(args[0]); Path p3 =…
javaanswered Leonardo Otto 2,328 -
1
votes1
answer276
viewsA: Problem with class org.hibernate.Validator.Invalidvalue when upgrading from Hibernate 3.X to 4.X
Hibernate Validator has been updated in version 4 of Hibernate. Add to your dependencies: <dependency> <groupId>org.hibernate</groupId> <version>4.0.2.GA</version>…
-
1
votes1
answer591
viewsQ: How to get the parameters of a Url on Android
In the android I have the following URL String url = "http://domain.com/page?parameter1=value1¶meter2=value2"; I’d like to take the parameters of this URL how do I do it in a simple way?…
-
3
votes1
answer591
viewsA: How to get the parameters of a Url on Android
To do this you can use the class URLEncodedUtils which is a utilitarian class of android for URL's Do it this way: String url = "http://domain.com/page?parameter1=value1¶meter2=value2";…
-
1
votes1
answer746
viewsA: Observer Design Pattern on Android
I believe it’s the same as java. public class Cliente { } public interface ClienteObservable { public void update(); } public class Banco { private List<ClienteObservable> observables = new…
-
6
votes2
answers360
viewsA: Theoretical doubt - Interface, unique responsibility
The principle of sole responsibility is part of the principles SOLID created by Robert C. Martin as a design guide to follow in your code but not as a must. Removed from the documentation of the…
-
4
votes1
answer1963
viewsA: Automatic posts on facebook
Before anything you need to create a key for your app Here. Then go to the Apps tab, Create New App After the app created you can catch the APP ID here: After that, you can use the share button on…
-
2
votes1
answer255
viewsA: Java file does not receive parameters from Inputstream
According to the documentation the function readline of Datainputstrem this discontinued as can be seen here Try switching to: BufferedReader d = new BufferedReader(server.getInputStreamReader());…
-
3
votes1
answer1494
viewsQ: How to run javascript in Android webview
I have a Activity with the following layout: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"…
-
6
votes1
answer1494
viewsA: How to run javascript in Android webview
By default in Webview javascript is disabled. For enabled you need to change Webview settings as follows: @Override protected void onCreate(Bundle savedInstanceState) {…
-
2
votes1
answer1054
viewsQ: How to implement back in Android Webview
I have an Android Activity with only one webview inside. For example: <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent"/>…
androidasked Leonardo Otto 2,328 -
1
votes1
answer1054
viewsA: How to implement back in Android Webview
You need to overwrite the event of coming back from your Activity and implement the coming back from the webview if it can come back. For example: @Override public void onBackPressed() { if…
androidanswered Leonardo Otto 2,328 -
2
votes1
answer135
viewsQ: Android map Version 2 with supporte library
I’m using the Android maps v2 api. I have in my Activity the following statement <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.MapFragment"…
-
2
votes1
answer135
viewsA: Android map Version 2 with supporte library
To use the compatibility api you need to make two changes to your code. In xml, add the compatibility api map class: <fragment android:id="@+id/map"…
-
1
votes2
answers2344
viewsA: How to create a robot using Java requests?
You can automate tasks within the computer using some tools. I know these two very good tools for automating tasks, although they use their own languages. autohotkey Autoit ( recommend ) If you need…