Posts by ramaral • 44,197 points
1,060 posts
-
2
votes1
answer123
viewsA: Problem returning a method’s value
I believe that your problem lies in the way the method reajustaSalario is declared. I suggest you do it this way: public double reajustaSalario(double valorDoReajuste){ return salarioMensal +…
-
3
votes1
answer1744
viewsA: Open Android app with link
You must create a Broadcastreceiver that intercepts the action Intent.ACTION_NEW_OUTGOING_CALL public class OutgoingCallReceiver extends BroadcastReceiver { @Override public void onReceive(Context…
-
1
votes3
answers685
viewsA: Doubt with Getdate()?
The reason why this is happening is that GetDate() returns a Datetime, beyond the date also returns the part of the Time for hours, minutes and seconds. The recorded data is all with the Time to…
-
2
votes2
answers239
viewsA: Retrieve database records by date field?
Add 18 years and 30 years to date of birth and compare to current date . SELECT nome, dt_nascimento FROM tbl_tabela1 WHERE DATE_ADD(dt_nascimento,INTERVAL 18 YEAR) <= CURDATE() AND…
-
5
votes1
answer137
viewsQ: How to use build options in Ideone?
Yesterday in answering this question wanted to test it on Ideone, while running the code I received this error: Prog. c: In Function 'main': Prog. c:12:9: error: 'for' loop initial declarations are…
-
3
votes2
answers2551
viewsA: Android - Cycle to check if a Checkbox is enabled or not
Following Wakim’s suggestion the code would be this: public class TesteActivity extends Activity { Timer timer; TimerTask timerTask; final Handler handler = new Handler(); CheckBox checkBox1;…
-
1
votes2
answers129
viewsA: Sorting Doubt - C Language
I believe that its confusion lies in the fact that the algorithm used is not very intuitive. For the comparison to be as you say the algorithm should be so: Each element of the array for (int i = 0;…
-
0
votes1
answer40
viewsA: Problem with database data update (Android)
You are creating a new instance of MessageEB, gives it the value of editText and then calls the method to update the data. However, this method requires the value of Id, value that is not "setate"…
-
3
votes3
answers121
viewsA: Select union rest between tables
Use the clause NOT EXISTS SELECT * FROM cliente WHERE NOT EXISTS(SELECT vendas.id_cliente FROM vendas WHERE vendas.id_cliente = cliente.id) If the subquery no return records is because there is no…
-
1
votes1
answer372
viewsA: Hide Tray Icon Menu
I think the problem is that you open the Menu. The menu opening should be done by Notifyicon. After building the menu you should associate it to it through the property Contextmenu. Thus making the…
-
1
votes1
answer26
viewsA: Change Cx, Cy and Circle ray Raphael.js
In the following expression X controls the position of the center and Y the radius of the arc: x1 = parseInt(Math.round(X + Y * Math.cos(Math.PI * startAngle / 180))); The same values should be used…
javascriptanswered ramaral 44,197 -
4
votes1
answer63
viewsA: How to check value in enumerator with [Flags]?
So that the method Hasflag function as expected or Enum shall simulate the representation of a byte in bits. Each element of Enum shall have a value corresponding to 2 n where n is its position in…
-
2
votes1
answer502
viewsA: How do you get a piece of an image?
You can use the method Clone class System.Drawing.Bitmap. The following example creates a Bitmap corresponding to the part defined by the rectangle whose upper left corner has as coordinates 0,0…
-
3
votes2
answers895
viewsA: Know if the date is between two columns of Mysql - Database?
You are using the function Date() which returns the part referring to the date of a Datetime field. The first query works because it’s comparing '2015-04-18' with the result of Date(inico) and…
-
2
votes2
answers1344
viewsA: How to set random images in Imagebutton
Instead of an array with the name of the images declare one with the Resource Id of the images: int[] varButtonImages = { R.drawable.button_blue, R.drawable.button_grenn, R.drawable.button_red,…
-
1
votes1
answer823
viewsA: Check if any Select output line in Mysql contains a value
If I understand correctly, I think the use of the clause EXISTS does what you want. To query would be something like that: SELECT numero FROM numeros WHERE EXISTS(SELECT numero FROM numeros WHERE…
-
4
votes3
answers30209
viewsA: SQL higher date of a record before the given date
Going by parts: Select the largest data_imp => MAX(data_Imp) When the data_imp is less than 2015-04-13 and the situation is 1 =>WHERE data_imp < '2015-04-13' AND situacao = 1 For every…
-
4
votes3
answers331
viewsA: Find which items have been marked - Help with logic
The way you are giving the values to each of the check boxes is as if each of them represents a bit. The weight of each bit is a function of its position in the binary representation: From right to…
-
3
votes4
answers16866
viewsA: How to know which DATETIME format is used in a given column of SQL Server?
The date format that Sqlserver uses by default depends on the language set. You can know what this format is using the following command: select dateformat from syslanguages where name = @@LANGUAGE…
-
4
votes1
answer122
viewsA: Why does Arrays implement Ienumerable but not Ienumerable<T>?
Array definitely implements IEnumerable<T>. Try making bool isIEnumerableGeneric = EpisodesList is IEnumerable<Episode> and you’ll see that the result is true. The reason for the…
-
3
votes1
answer1039
viewsA: How to pass the Edittext value of a Fragment to the Textview of another Fragment?
You’re struggling because you’re assigning responsibilities to Fragment Edit that shouldn’t be his. The control of Fragments associated with a Activity is the responsibility of this. Each Fragment…
-
7
votes3
answers7123
viewsA: Disable windows form maximize and minimize
Use the following properties of Form: form1.FormBorderStyle = FormBorderStyle.FixedSingle; form1.MaximizeBox = false; form1.MinimizeBox = false; form1.FormBorderStyle = FormBorderStyle.FixedSingle;…
-
1
votes1
answer414
viewsA: Problems when passing a data from an Edittext in a Fragment to a Textview in another Fragment
The problem is the way you try to get the string from Edittext. String.valueOf(editar) The method String.valueOf() returns the representation in string of the value passed as argument. It is usually…
-
1
votes1
answer75
viewsA: Query counting by date difference
I don’t know if this is what you want. The following query account, for each record in the scale, of the number of records with a date difference of more than 15 days from the record under review.…
-
2
votes1
answer49
viewsA: Form derailed after adding a Scrollviewer
Instead of using a Stackpanel and try to position the Label and Textbox through the use of Margin and Alignment, build your form using a Grid. A form, in its simplest form, is nothing more than a…
-
5
votes1
answer2751
viewsA: Notifications in a given time and on mobile phone
To run a service when the mobile phone is turned on you have to register a Broadcastreceiver to respond to action android.intent.action.BOOT_COMPLETED. In the Androidmanifest.xml register your…
-
1
votes3
answers1854
viewsA: How to return points within lightning?
What you can do is, instead of finding the dots within a circle, find the dots within a frame that has that circle inscribed. A frame whose side is equal to twice the radius being in its center the…
-
2
votes2
answers2746
viewsA: How to recover a string-array item within my Activity layout in the "xml" case?
The string-array shall be placed in the file /res/values/arrays.xml and not in /res/values/strings.xml Each element of the array should not be hard-coded array but use a reference to a string…
-
1
votes1
answer191
viewsA: How can I make this layout?
Within a Linearlayout or any other, in addition to being able to place elements such as **Textview, Imageview etc, one can also include other layout types. With this in mind you should start by…
-
1
votes2
answers187
viewsA: Doubt about using in Visual Studio
Those using appear when you create a new Project/Solution at Visualstudio. They are automatically placed by the IDE depending on the type of project you choose. To develop a desktop application you…
-
2
votes1
answer542
viewsA: How do I know if the user clicked outside of Alertdialog?
It is possible to make the Alertdialog Modal this is not possible to leave the dialog without the user choosing one of the buttons: AlertDialog.Builder builder = new AlertDialog.Builder(context);…
-
7
votes2
answers315
viewsA: Can I put an image of the internet on an Imagebutton?
I think the simplest way is this: URL imageUrl = new URL("url_da_imagem"); Bitmap imagem = BitmapFactory.decodeStream(imageUrl.openConnection().getInputStream());…
-
5
votes3
answers864
viewsA: Make primary key uplinkable
One of the requirements of Primary key is not to allow duplicates. Its function is to identify each of the records(rows) in the table. So it has to have unique values and not null values. If it is…
-
3
votes2
answers1044
viewsA: How to invert the values of the main diagonal of a 5x5 matrix?
Declare an array to store diagonal: int [] diagonal = new int[5]; Between the input and output "for" enter this code: //Guarda diagonal for(int i = 0; i<5; i++ ){ diagonal[i] = Matriz[i][i]; }…
-
14
votes2
answers40109
viewsA: Get values from one table that are not contained in another
You don’t give a lot of information but if I understand it well it should do what you want: SELECT * FROM equipamentos e WHERE e.id NOT IN (SELECT equipamentoId FROM reservas); I assume that in the…
-
1
votes1
answer388
viewsA: Change of theme of alertDialog as per Android version
According to the documentation the Theme used by Alertdialog is determined internally and privately by Android. If you create a Alertdialog using AlertDialog.Builder(context) he will be created with…
-
1
votes1
answer25
viewsA: Problems with get_blob using Cursor
There are two reasons, according to documentation, for the method getBlob() make an exception: value is null or field is not Blob Assuming that it is not null then it is because the column is…
-
5
votes2
answers243
viewsQ: Cast problem in a generic method that receives an array of Enum’s (Enum[])
I intend to make a generic method that receives a enum[] and that a string representing the items of array comma-separated. public static string ToSeparatedCommaString<T>(T[] enums) where T :…
-
6
votes1
answer1084
viewsA: How to get the coordinates of a point at a certain distance from my location?
If what you want is to calculate a Bounds having a radius (half diagonal) equal to that indicated by seekBar and that its location is in the center, do so. //Calcula o ponto à distância 'raio' do…
-
2
votes1
answer227
viewsA: Eventually java.lang.Arrayindexoutofboundsexception occurs
The error indicates that you are trying to access an array item h whose index is greater than the size of that array. The array has been set to have 3 items: Hobbits[] h = new Hobbits[3]; Items will…
-
1
votes1
answer265
viewsA: How to insert a Toolbar into Actionbardrawertoggle?
I think the reason is because I’m using support.v7.app. This in itself is no problem, the question is that the constructor of the class Actionbardrawertoggle of support.v7 is different from…
-
7
votes3
answers854
viewsA: How to cancel a cancellation?
This is one of the patterns where I see no problem in breaking. The reason is simple: the vast majority of users do not read carefully what is written in the message. Knowing this, it is my concern…
-
5
votes2
answers7215
viewsA: Create a column in Mysql that automatically divides the other two column values
From version 5.7 it is possible to create calculated columns. The (simplified) syntax is as follows: col_name data_type [GENERATED ALWAYS] AS (expression) Applied to your case would be so: CREATE…
-
2
votes1
answer1989
viewsA: Change the theme of Activity
You must be using appcompat lib. When a Activity descended from ActionBarActivity may only use the following Theme 1 -Theme.Appcompat 2 -Theme.AppCompat.Light 3 -Theme.AppCompat.Light.Darkactionbar…
-
1
votes1
answer993
viewsA: Android sqlite - Return _id logged in Listview only one value selected using Where condition
If you want to use the clause WHERE you will need to indicate it in Query: String sql = ("SELECT * FROM " + TABLE + " WHERE _id = ?"); Cursor cursor= db1.rawQuery(sql,new…
-
3
votes7
answers1131
viewsA: Too many screens or a screen with too much information?
Excuse my pragmatism but, after reading the answers so far and reading some articles on the subject, my answer can only be: Get in the "user skin" when developing/idealizing any UI. Note: Do not…
-
4
votes1
answer176
viewsA: Predicting an outcome through probability
Since the generation is random and independent of the previous ones, there is no way to predict the next sequence. What we can do is determine the probability of the next sequence being equal to an…
-
4
votes3
answers10876
viewsA: Recognize duplicate items in a list
I could just post the link to the OS.en but I find it interesting that we have the answer here. var list = new List<string> { "a", "a", "b", "b", "r", "t" }; var distinct = new…
-
2
votes1
answer1743
viewsA: Use a variable in an Activity declared in another Activity
In the Mainactivity to save the value to Sharedpreference must be doing something like this; SharedPreferences cod_final = PreferenceManager.getDefaultSharedPreferences(context);…
-
1
votes1
answer281
viewsA: ERRO; Canvas: trying to use a Recycled bitmap android.graphics.Bitmap
Keep a copy of Bitmap so that it can be used later: Instead of: Bitmap bitmap = view.getDrawingCache(); Do: Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache(true)); Source: SO AS. For what I…