Posts by ramaral • 44,197 points
1,060 posts
-
2
votes2
answers1314
viewsA: How to change the color of a Datagrid line in C#?
This code snippet changes the color of the Row selected from Datagrid myDataGrid to red. int selectedIndex = myDataGrid.SelectedIndex; //Guarda a Row selecionada DataGridRow row =…
-
2
votes1
answer42
viewsA: How to implement generic data in this case?
You in the interface statement also have to indicate T public interface AdminDao<T> extends Dao<T, Integer> { ... }
-
1
votes1
answer237
viewsA: Error while using Dateformat.Parse
This type of error is frequent when using conversion functions whose behavior depends on the Locale(language/country combination). The class Simpledateformat, when built with the builder who accepts…
-
3
votes2
answers2761
viewsA: Do not display null value (01/01/0001) of a Datetime in a Datagridview
Answer given before OP indicates you are using Windowsforms. Solution for WPF. Use a Valueconverter to convert Datetime in string. When making the conversion if the value of the Datetime is…
-
5
votes2
answers2136
viewsA: How to use a Bundle with an uncivilized type?
So that a Bundle can pass not primitive types they must implement the interface Serializable or Parcelable. The implementation of Serializable is simpler but, no android, can create performance…
-
4
votes2
answers511
viewsA: Filters or Sort, which should be the first when creating an index in the database
I view index creation as something that requires a "trial and error". However there are basic rules to follow: 1 - Indexes do not add performance in small tables. 2 - Many indexes may decrease…
-
5
votes1
answer54
viewsA: Insert NIB into database
The error is due to the fact that you are using a numerical type that has no dimension to contain that number. Moreover, although the NIB consists only of numeric characters, it cannot be…
-
4
votes1
answer608
viewsA: When you have a reference in Fragment through getActivity() should I use an interface?
A Fragment must be implemented in a way that is self-sufficient, must be able to function/achieve its objective on its own. Following this principle the Fragment can be used by any Activity. This is…
-
6
votes1
answer836
viewsA: Mapping one-to-Many entity with Fluent API
In addition to mapping the relationship one-to-Many it is necessary to map the key fields, since they do not follow the convention of the Entity Framework. This would not be necessary if these were…
-
3
votes1
answer127
viewsA: Interface implementation error in WCF
You define in the interface that the method BuscarPessoas must return the type pessoa but in the implementation is to return List<pessoa> You must change the interface to: public interface…
-
3
votes1
answer78
viewsQ: When do I have to unsubscribe (unsubscribe) events?
One question on the same subject has a reply what it says: You don’t have to desubscribe from an Event when the instance that is subscribing has the same Scope as the instance that is being…
-
6
votes2
answers694
viewsA: How to pick a phrase value in String
You can use the method split class String. If the phrase is in a string with the name Message: String[] partes = Mensagem.split(":"); partes[0]; // terá: Sucesso! Usuario salvo. Id partes[1].trim();…
-
5
votes1
answer388
viewsA: Problem with android conversion
Use the class Simpledateformat public String trocaFormatoData(String data) { String formatoDeEntrada = "MMM dd, yyyy h:mm:ss AM"; String formatoDeSaida = "dd/MM/yyyy"; SimpleDateFormat…
-
1
votes1
answer421
viewsA: Context error in Fragment
The builder of VivzAdapter asks for a Context. When you create the instance this way: VivzAdapter adapter = new VivzAdapter(this, titulos, images, descricoes); this is a Context when Menu extends…
-
1
votes1
answer192
viewsA: setVisibility for an Imageview of a Grid
You say you’re wearing one GridView but the code refers to a listView. I will assume that it is only a variable name error. To View that was clicked is passed to onItemLongClick in the variable view…
-
0
votes1
answer184
viewsA: Call Button does not work
I don’t understand why this line: this.inflatedView = inflater.inflate(R.layout.pizzaria_1, container,false);. Delete it and move the line: View android = inflater.inflate(R.layout.pizzaria_1,…
-
6
votes1
answer3992
viewsA: How to perform a method in a given time?
Use a BroadcastReceiver along with AlarmManager. In the method onReceiveof BroadcastReceiver have the scheduled task executed. public class ExecutarTarefaProgramadaReceiver extends BroadcastReceiver…
-
1
votes2
answers735
viewsA: How to call a method when clicking a notification?
You can use a Broadcastreceiver to do this. Define your Pendingintent of the notification as follows: Intent notificationIntent = new Intent("CHAMAR_METODO_X"); PendingIntent btLocationPendingIntent…
-
8
votes1
answer407
viewsA: Photo taken by my app does not appear in Gallery
This is because the Gallery is only updated, by the Android OS, from time to time. So that the Gallery be updated immediately you need to call the method scanFile class MediaScannerConnection.…
-
4
votes2
answers173
viewsA: Is having two dbContext for the same Connection string considered bad practice?
Have only one Dbcontext may be a bad practice if the entities it contains have no relationship between them. Following the approach DDD - Domain-driven design, when we are dealing with many…
-
3
votes1
answer1387
viewsA: Insert into two tables in Android Sqlite
To obtain the id of the last inserted record use the value returned by the function SQLiteDatabase.insert() long id = myDb.insert(...); To make several Inserts in a single transaction:…
-
46
votes1
answer1896
viewsA: What’s the difference between "@id" and "@+id"?
@+id/nome serves to associate a name to the component, it creates an entry in the R class. @id/nome only identifies/references the component, for example in a Relativelayout when one wants to…
-
3
votes1
answer149
viewsA: Prevent animation from repeating when changing the orientation of the device
Where the guideline is amended Activity is recreated: the method onCreateis called. A simple way for you to check your Activity was recreated is to check whether the Bundle passed to the method…
-
3
votes3
answers1128
viewsA: Entity Framework - Update nested lists
This is the approach I use when I want to update composite entities: I define an interface IObjectWithStatethat all classes of my model implement: public interface IObjectWithState { ObjectState…
-
5
votes2
answers2031
viewsA: How to take the position of an individual user in a rank, if in the database I only have your score?
A solution making 2 query s and a subtraction. First calculate the number of Separate Scores: SELECT COUNT(DISTINCT Pontuacao) FROM rank; Then see how many have less Score than the user: SELECT…
-
8
votes1
answer660
viewsA: Communication between Fragment and Activity
This is the way I usually do. In the class of DialogFragment declare an interface defining the methods that the Activity, what he calls the Fragment, should be implemented to be notified of what is…
-
7
votes1
answer334
viewsQ: Sqlserver English Error Messages - (Localdb) v11.0
I’m developing an app with Entity Framework 6 using the approach Code-First. I want to configure Sqlserver (Localdb) v11.0 to display error messages in English without using SQL Server Management…
-
3
votes1
answer262
viewsA: Application closing in user interaction after being summarized
I think your problem lies in the way you manage "Activity Lifecycle". Do the following: Pass the code you have on onStop for onPause @Override protected void onPause() { super.onPause(); if…
-
2
votes1
answer293
viewsA: Update if value does not exist
This should do what you intend: UPDATE Conta SET NrBanco = '001' WHERE (SELECT COUNT(*) FROM Bancos AS B WHERE B.Codigo = Conta.NrBanco) = 0 Since I can’t test, run the SELECT next to confirm if it…
-
2
votes2
answers1261
viewsA: How to get all records from a mixed table generated by class inheritance when using Entityframework 6?
If LazyLoading is enabled, which is the case by default. var items = repository.Pessoas.OrderBy(x => x.Nome); Returns all table records Pessoas ordered by name. The only thing needed to gain…
-
1
votes1
answer80
viewsA: Problem with Datepickerdialog
This information has nothing to do with the version of the SDK, but with the use of the method showDialog which considers itself outdated. Starting with version 3.0 (SDK 11) a new way to use…
-
1
votes1
answer299
viewsA: How do I leave specific items in my dynamic listbox disabled?
You need to define a ValueConverter convert its quantity(float) to bool so that it can be used with the Isenabled(bool property). class QuantidadeToBoolConverter : IValueConverter { public object…
-
3
votes3
answers7392
viewsA: Create an object from another class
I think the problem is in how you declare the Address in the second constructor you should use the variable privada endereco and not declare another. private String nome; private Endereco endereco;…
-
2
votes1
answer130
viewsA: How to access the View that triggered one of the events of a Textwatcher?
What you seek is value s passed to the function. If you change s the TextView will show this change. Please note that any changes you make to s, the method afterTextChanged will be calling again,…
-
2
votes1
answer1855
viewsA: Calling new Activity via an Imageview
I think the problem is that you pass null in the method setClass. Replace your code with this: Intent intent = new Intent(Main.this, PrincipalActivity.class); startActivity(intent); Substitute…
-
3
votes3
answers1461
viewsA: How to update Textview from Asynctask?
When a AsyncTask runs through 4 times: onPreExecute() - Runs in the thread UI and before the task is run. doInBackground(Params...) - It is executed in the background thread shortly after…
-
44
votes5
answers41630
viewsA: Mysql Limit Equivalent in SQL Server
If you are using Sqlserver 2012 you can use OFFSET and FETCH SELECT * FROM Tabela ORDER BY coluna1 OFFSET 50 ROWS FETCH NEXT 100 ROWS ONLY Note: OFFSET and FETCH may only be used in conjunction with…
-
7
votes2
answers7686
viewsA: How the android:Ems attribute works (Textview)
ems is a unit of length defined in relation to the source used. 1em represents the length of the letter m. When, for example, in a TextView the attribute is defined android:ems="15" you are limiting…
-
2
votes1
answer474
viewsA: Is there an alternative way to use foreign keys in Myisam tables?
Foreign keys in Mysql are used to verify and ensure the referential integrity, not to do join between tables. The only alternative is to be you do the job that is done by the database to ensure the…
-
3
votes3
answers1091
viewsA: Is it possible to attach an Android res/drawable file to an email using Javamail?
You cannot directly access the path or file because the resources are compiled together with the application. What you can do is create a Bitmap from the resource. Resources resources=…
-
5
votes2
answers4310
viewsA: How to prevent a property from being mapped to an entity in the Entity Framework?
The Entity Framework has two ways to change the way the database is configured, Annotations or EF Fluent API. The first consists of annotating the properties of the classes that define your data,…
-
3
votes3
answers6724
viewsA: How to set the size of layout buttons in version 2.2
Use android:layout_weight to proportionally define the space that occupies each button. <?xml version="1.0" encoding="utf-8"?> <LinearLayout…
-
1
votes1
answer418
viewsA: Simple settings menu with Checkboxpreference Android
Change Prefs.java to register a OnSharedPreferenceChangeListener. package br.com.pedro.menu; import br.com.pedro.school.R; import android.content.Context; import android.media.AudioManager; import…
-
1
votes3
answers2797
viewsA: How do I use Actionbaractivity in an application that runs on android 2.2 or higher?
You can use this Theme has to define the android:targetSdkVersion minimum for Level 11 API. However it is advisable that android:targetSdkVersion always point to the latest API.…
-
2
votes2
answers241
viewsA: How to know if the keyboard (Keyboard) is visible?
There is no direct method to achieve this. What we can do is check whether the height of our layout was amended. For this, we declare a method that will be executed when our Layouthas changed its…
-
0
votes5
answers411
viewsA: How to avoid a comparison by brute force?
I think the right way is class A implement a interface. Each class will implement the interface according to the type of data it contains. The code that uses these classes will not need to know…
-
5
votes6
answers53653
viewsA: How to change PATH in Windows
Follow these steps (Windows 7): Knob Iniciar Right mouse button on Computador On the left side of the screen that appeared to choose Definições avançadas do sistema Choose Variáveis de ambiente…
-
1
votes5
answers620
viewsA: How to select records that have a relationship with all values in a list?
I can’t be sure if this is correct because I have no way to test. SELECT DISTINCT cp_pessoa.id, cp_pessoa.nome FROM cp_pessoa LEFT JOIN cp_habilidade_freelancer ON…
-
5
votes2
answers982
viewsA: Is it possible to perform an assignment and comparison in if clauses in Java?
You don’t show what condition you want to test on if, let’s call it condicao: if ((linha = leitor.readLine()) == condicao) { saida += "\n"; } The code above will first assign the linha the value of…
-
4
votes2
answers200
viewsA: For loop does not start with Array
I think the problem lies in the statement of the: for(alvo = 0; alvo >= lastEnemy; alvo++) I think it should be: for(alvo = 0; alvo <= lastEnemy; alvo++) or: for(alvo = 0; alvo < lastEnemy;…