Posts by Reginaldo Rigo • 3,638 points
193 posts
-
3
votes3
answers4491
viewsA: How to check if the program is already running in C#
public partial class App : System.Windows.Application { public bool IsProcessOpen(string name) { foreach (Process clsProcess in Process.GetProcesses()) { if (clsProcess.ProcessName.Contains(name)) {…
c#answered Reginaldo Rigo 3,638 -
3
votes2
answers2415
viewsQ: How to get your Android device ID with Telephonymanager#getDeviceId()?
I’m using this code to catch the ID of the device Android. TelephonyManager telephonyManager = (TelephonyManager) getActivity().getBaseContext().getSystemService(Context.TELEPHONY_SERVICE); id =…
androidasked Reginaldo Rigo 3,638 -
2
votes1
answer93
viewsA: Select conditional that takes value from another table
select case CAIXA_9L when ( round(sum((Caixa_9L / 1000)),1) = 0 ) then ( select outrocampo from asterico ) /* não pode retornar mais de um registro esse subselect */ else ( round(sum((Caixa_9L /…
-
1
votes2
answers1649
viewsA: Optimize a data transfer from one table to another SQL SERVER
Here’s a possibility: Create a bat file with the following content. Change the variables for your environment. @ECHO OFF SET banco=DATABASENAME SET pasta_destino=C:\ARQUIVOS SET servidor=SERVERNAME…
-
1
votes1
answer340
viewsA: Oracle End of file when running
Two more to go ; Check like this: DECLARE -- LOCAL VARIABLES HERE I INTEGER; BEGIN FOR NCM IN (SELECT * FROM NCM_NCM) LOOP UPDATE ADMPRODU A SET A.CCNCMPRODU = NCM.NCM_NOVO WHERE A.CCNCMPRODU =…
-
2
votes1
answer1197
viewsA: Delete Duplicate Records by Group BY
Do something like this: delete from #tarifasad where ndo in ( select ndo from ( SELECT AD.[vch_od], MK.NDMarket, MK.TypeMercado, MK.NDOrigin as Praça, TR.Analyst, -- DTB.Season, -- DTB.EvDef,…
-
1
votes3
answers1527
viewsA: Connect 2 tables with same id
To join the two tables, do so: SELECT A.NOME, B.COMISSAO FROM TBL_USUARIO A LEFT JOIN TBL_COMISSAO B ON A.ID = B.ID
-
1
votes2
answers13773
viewsA: SQL query in VBA Excel
Because the command DoCmd.RunSQL does not serve to make SELECT it should be used to make DELETE, INSERT, UPDATE or SELECT INTO To make selects do something like this: sSQL = "SELECT [controle$].NOME…
-
3
votes1
answer45
viewsA: How to use Shadows?
It could be so: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle">…
androidanswered Reginaldo Rigo 3,638 -
1
votes3
answers430
viewsA: How to know if a binary sum of unsigneds has overflowed?
The commands "JO" (jump on overflow) or "JNO" (jump on not overflow) make it possible to take this test and follow as appropriate.
-
2
votes2
answers4807
viewsA: How to use gradient in any component of Android?
Create a gradient layout in res/drawable <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient…
-
6
votes3
answers3192
viewsA: What is the difference between Full Text Search and LIKE?
LIKE is used for string searching in any string fields. This field can be char, varchar, text, etc. Whenever we search the database using the operator LIKE, it loads each row of the database for…
-
0
votes1
answer51
viewsA: Sqlite shared between android Flavors
You need both applications to use the same id. Add this line to both manifesto: android:sharedUserId="com.android.xyz" Another option is through Custom Content Provider.…
-
3
votes1
answer512
viewsA: Stop playing sound when exiting the app
Thus: import android.media.MediaPlayer; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity {…
androidanswered Reginaldo Rigo 3,638 -
1
votes1
answer27
viewsA: Reversing the process of a function
Do something like this: v_posicao_onde_estou : Integer v_para_onde_estou_indo : Integer v_quantide_de_slides : Integer; function qual_slide : Integer { if ( v_posicao_onde_estou < 0 )…
-
0
votes2
answers1159
viewsA: Oracle reference the type of a column equal to the type of another column
CREATE TABLE TESTE ( ID INTEGER, CAMPO_T VACHAR(20)) In Procedure or Trigger you would do this: DECLARE v_texto TESTE.CAMPO_T%TYPE; Even if you change the size of the field in the table your trial…
-
0
votes3
answers5094
viewsA: How to download a file from a URL using C#
using (var client = new WebClient()) { client.DownloadFile("http://meurepositorio.com/file/imagens/a.jpg", "a.mpeg"); client.DownloadProgressChanged +=…
-
0
votes4
answers163
viewsA: Deserialize Json and place values in views
Receives a JSON similar to this: { "itens":[ { "titulo":"Titulo 0001", "texto":"Lorem ipsum dolor sit amet, consectetur ", "imagem":"http://seurepositorio/p/imagem1.png" }, { "titulo":"Titulo 0002",…
-
3
votes1
answer1101
viewsA: incremental vs differential backup in SQL Server
As you said you do a full backup on Sunday, let’s take it from this scenario. When you take an incremental backup on Tuesday, it will have the data that were changed on Monday and you do another on…
-
1
votes1
answer148
viewsA: How to suppress Oracle input window without using set define off
SET ESCAPE '\' CREATE TABLE TABELA ( C1 VARCHAR(10), C2 VARCHAR(10)) INSERT INTO TABELA VALUES ( 'CAR\&LOS', 'ANDOR\&INHA') …
-
0
votes1
answer175
viewsA: Send Activity parameters to a calculation class
Creating the class: public class MinhaClasse { Context context; ProgressDialog progressDialog; String nomedoarquivo; String servidorremoto; Handler handler; public MnhaClasse(Context context, String…
-
4
votes1
answer9606
viewsA: String or binary data would be truncated
This error occurs when you try to insert a higher value in a field than was set to it at the time of its creation. For example: CREATE TABLE TESTE ( id int, descr varchar(5)) If I try to insert 6…
-
1
votes2
answers684
viewsA: How to read string from a specific word?
How about this? $a = '79811/out.php=www.youtube.com=?video1'; $b = 'www'; echo substr( $a, strpos($a, $b);
-
1
votes1
answer913
viewsA: INSERT in two tables based on SELECT
DECLARE @campo VARCHAR(30) , @campo2 VARCHAR(30) , @campo3 VARCHAR(60) -- Cursor para percorrer os nomes dos objetos DECLARE itens CURSOR FOR SELECT campo, campo2,…
-
1
votes1
answer156
viewsA: How to troubleshoot "3183" error importing a bank into SQLSERVER 2012
Yes this corrupted. You must lose something. To continue restoration even after error use RECOVER DATABASE ... WITH CONTINUE_AFTER_ERROR The bank will be in SUSPECT after restoration and you can try…
-
3
votes1
answer143
viewsA: chained ifs, correct use
This is more suitable, more readable and faster. switch (q) { //se o valor estiver no range 1 case ((q >= Vl1) && (q <= Vl2)): ... break; //se o valor estiver no range 2 case ((q >=…
javascriptanswered Reginaldo Rigo 3,638 -
3
votes1
answer205
viewsA: More efficient way to compare two variables type List
Use Except var firstNotSecond = list1.Except(list2).ToList(); var secondNotFirst = list2.Except(list1).ToList(); This method is quite fast. return !firstNotSecond.Any() &&…
-
2
votes2
answers135
viewsA: How to sort a select by bringing results of 2 in 2
Since it is the administrator who informs the priority, I thought it could 'group' by schedule. The priority field has been divided into two, there is a priority separated by 'first hour', 'second…
-
6
votes2
answers498
viewsA: Writeln Locking in Delphi Seattle
Commented on the code found. procedure TForm1.FormCreate(Sender: TObject); var F : TextFile; mArquivo,s : String; i: integer; begin {$i+} mArquivo := 'C:\Users\Rodrigo\Desktop\teste.txt';…
-
0
votes1
answer795
viewsA: Somatorio Jasper iReport
To know the total number of records use the $V{REPORT_COUNT} and set the evaluation to "Report". To occur only at the end of the report.
-
2
votes3
answers100
viewsA: Search first name in mysql field before MYSQL space
select date(nomedacoluna) from minhatabela more details on mysql date()…
mysqlanswered Reginaldo Rigo 3,638 -
9
votes1
answer792
viewsQ: Force Android GPS to update reading
I recently added my application to collect functionality the latitute and longitude points of the GPS at which the device is located. To do so I added the lines to Androidmanifest.xml:…
androidasked Reginaldo Rigo 3,638 -
2
votes5
answers1923
viewsA: Is it possible to update the first 100 lines in sql(server)?
Clause-less ORDER BY the definition of TOP doesn’t make much sense. You need an order to know what is 'up' and 'down' Although the accepted server is not guaranteed which records will be affected.…
-
1
votes1
answer85
viewsA: Capture music running in another person’s app
The example below shows how to receive notifications from the running media on Spotify. For this to work you need to enable your class to receive such notifications and this is done via…
-
0
votes4
answers1358
viewsA: How to return the date and time closest to that informed by the user
With this select I can select the nearest location of that truck at any given time. SELECT LOCAL, min( abs( UNIX_TIMESTAMP(DATA_HORA) - UNIX_TIMESTAMP(STR_TO_DATE('29-01-2017 05:00', '%d-%m-%Y…
-
1
votes2
answers377
viewsA: How to find the second largest number
It could be so: SELECT MAX( SAL ) FROM CAD WHERE SAL < ( SELECT MAX( SAL ) FROM CAD )
-
2
votes1
answer186
viewsA: Save Usage Preferences - Android
Creates the Sharedpreferences object SharedPreferences pref = getApplicationContext().getSharedPreferences("MinhasPreferencias", MODE_PRIVATE); Editor editor = pref.edit(); Saving the data in pairs…
-
2
votes3
answers953
viewsA: Read txt line and include ";"
I created a routine in Delphi exclusive to this file. Uses System.Character; procedure TForm1.Button1Click(Sender: TObject); Var str : string; linhacsv : string; oldFile, NewFile : TextFile; n :…
-
2
votes1
answer39
viewsA: Select deleted a record and searching for others with the same code
Thus: SELECT * FROM tabela_produto WHERE cd_produto != 2 AND cd_categoria = (select cd_categoria from tabela_produto where cd_produto = 2 )
-
1
votes1
answer478
viewsA: Oracle plsql email attachment file will empty
Take this example: DECLARE v_From VARCHAR2(80) := '[email protected]'; v_Recipient VARCHAR2(80) := '[email protected]'; v_Subject VARCHAR2(80) := 'test subject'; v_Mail_Host VARCHAR2(30) :=…
-
9
votes3
answers813
viewsA: What is the difference between methods for obtaining a context?
getApplicationContext() how the name is associated to the context of the application and will be the same while the application lasts. Already getBasecontext() associated with the activity and will…
-
8
votes2
answers3503
viewsA: How can I count fields that are NULL?
Thus: SELECT COUNT(*) AS QTD FROM AtivacaoGuincho WHERE DataFim is null Since Marlon brought up the subject of line accounting I can improve on a little more that answer and get into a subject that…
-
0
votes4
answers898
viewsA: SQL Count Parole
Look at it this way: select count(*), valor from treatment_output group by valor
sqlanswered Reginaldo Rigo 3,638 -
0
votes2
answers334
viewsA: Check Consistency of a SQL Server backup in C#
using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; using System; class A { public static void Main() { // Connect to the local, default instance of SQL Server.…
-
0
votes1
answer65
viewsA: Fragment Android
Look at it this way: Login fragment = new Login(); FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_container,…
android-fragmentanswered Reginaldo Rigo 3,638 -
3
votes3
answers6900
viewsA: What’s the difference between Return and break in a switch case?
Sorry to diverge from the 'almost wrong''. The answer in the OS says that the RETURN immediately returns to the point from which it was called while the break just exits the loop without returning -…
-
0
votes1
answer80
viewsA: Grouping of lines Group By
You could do something like this: SELECT * FROM ( SELECT distinct CAPA.COD_HOLDING, CAPA.COD_MATRIZ, CAPA.COD_FILIAL, CAPA.ID_NF_ENTRADA, CAPA.NUM_NF, CAPA.DT_ENTRADA, CAPA.DT_EMISSAO,…
-
0
votes1
answer2260
viewsA: Android Open an app from another by link and with passing parameters
To pass parameters to the new application, you create a new Intent and pass the parameters map Intent appIntent = new Intent(this, NewActivityClassName.class);…
-
0
votes2
answers993
viewsA: Show SQLITE data between dates - Android Studio (think be between)
That’s how it works: SELECT * FROM tabela WHERE datapesquisada BETWEEN '2017-01-01' AND '2017-12-31';
-
1
votes3
answers124
viewsA: Return only the time in Select
Thus: SELECT TO_CHAR(datahora,'HH24') AS HORA FROM tabela
oracle11ganswered Reginaldo Rigo 3,638