Posts by Reginaldo Rigo • 3,638 points
193 posts
-
1
votes1
answer150
viewsA: To display the day of the week of any date in the last 1,000 years
That’s how it works: select to_char(to_date('18-04-1972','dd-MM-yyyy'),'day') day from DUAL;…
-
3
votes3
answers324
viewsA: "Translate" query from Mysql to SQL Server 2012
Assuming jobname is the key of the Schedule table IF EXISTS (SELECT * FROM [schedule ] WHERE jobname = 'sqldump') UPDATE [schedule ] SET last_exec_date = GETDATE() WHERE jobname = 'sqldump' ELSE…
-
0
votes1
answer37
viewsA: Selecting gaps in database
Even before posting the question I found out where I was wrong. I posted because it might be useful for someone else. I needed to turn my column into number to select the data correctly. It works.…
-
-1
votes1
answer37
viewsQ: Selecting gaps in database
I’m trying to build a select that will locate the missing items from a database. This is super unusual, 'select' the items that don’t exist. Let’s say I have a table called TBL795 with the column…
-
2
votes1
answer282
viewsA: Identify status of a program with java
You can try it: try { String line; Process p = Runtime.getRuntime().exec (System.getenv("windir") +"\\system32\\"+"calc.exe"); BufferedReader input = new BufferedReader(new…
javaanswered Reginaldo Rigo 3,638 -
5
votes3
answers818
viewsA: How can I set the address as the street and neighborhood corresponding to latitude and longitude?
Geocoder geocoder; List<Address> addresses; geocoder = new Geocoder(this, Locale.getDefault()); try { addresses = geocoder.getFromLocation(latitude, longitude, 1); // Here 1 represent max…
-
0
votes3
answers737
viewsA: Field comparison problem with date and time
Yes Check that SELECT CASE WHEN CAST( '2016-11-23 05:35:33.690' AS DATE ) = '2016-11-23' THEN 'TRUE' ELSE 'FALSE' END returns true and SELECT CASE WHEN '2016-11-23 05:35:33.690' = '2016-11-23' THEN…
sql-serveranswered Reginaldo Rigo 3,638 -
0
votes3
answers212
viewsA: Capture the WHERE clause of an SQL query
select = 'select * from tabela where campo = 1 and and campo2 = 2' print (select[select.find('where'):]) # com o where incluso or print (select[select.find('where') + 5:]) # ou para excluir a…
-
1
votes2
answers126
viewsA: Swift Way to display variables
Look at it this way: str = NSString(format: "%@ o seu IMC é %.2f, Peso Abaixo", nome, imc) as String
-
1
votes1
answer1825
viewsA: Trigger to update another table
Thus: CREATE TRIGGER socioup AFTER UPDATE ON socios FOR EACH ROW BEGIN UPDATE empresas SET updated_at = NOW() WHERE empresa_id = new.empresa_id; END
-
2
votes1
answer990
viewsA: Lines with alternating colors
Place a rectangle with the transparent color you want occupying the entire line and add the following rule in the Printwhenexpression event: $V{report_COUNT}%2 == 1 ou $V{report_COUNT}%2 == 0 I…
-
2
votes4
answers8334
viewsA: How to list all tables in a Sqlite database?
Let’s say your db is called MEUDB. You can run the following command: SELECT name FROM meudb.sqlite_master WHERE type='table';
-
3
votes2
answers4792
viewsA: Check if it already exists in the table before entering record
Using the ID number you can use the following: REPLACE INTO relacao VALUES ( 1, 'Pedro', 'Laura' ) If there is no id 1 it will enter the record and if it exists it will update.…
-
1
votes2
answers943
viewsA: Adding Hours greater 24 h
Tiago, you need a function that transforms the string in seconds, kind of: function GetSeconds(ATimeString: string): Integer; var Hour, Min, Sec, MSec: Word; begin DecodeTime(StrToTime(ATimeString),…
-
1
votes2
answers129
viewsA: Search frequency in Mysql tables
A solution. SELECT COUNT(*), TABELA, idPiloto FROM ( SELECT 'TAB1' AS TABELA, idPiloto FROM TABELA1 UNION SELECT 'TAB2' AS TABELA, idPiloto FROM TABELA2 UNION ..... SELECT 'TAB6' AS TABELA, idPiloto…
-
0
votes1
answer153
viewsA: Has "Pure virtual Function called" error occurred using Delphi 2009? How to resolve?
According to Embarcadero this error occurs when the program makes a called to a virtual function whose body cannot be found, by object account is in an invalid state due to Vmts not initialized,…
delphianswered Reginaldo Rigo 3,638 -
1
votes1
answer342
viewsA: Sqlite filter as date return error with strftime function
Do so: SELECT L.*, C.DESCRICAO AS CATEGORIA , CASE WHEN L.TIPO_LANCAMENTOS = 'C' THEN 0 ELSE 1 END AS ICONE FROM LANCAMENTOS L JOIN CATEGORIAS C ON(C.CODIGO = L.COD_CATEGORIA) WHERE…
-
0
votes1
answer1878
viewsA: Validate date less than current date
Do so: public static boolean comparaDatas(String psDate1, String psDate2) throws ParseException{ SimpleDateFormat dateFormat = new SimpleDateFormat ("dd/MM/yyyy"); Date date1 =…
-
2
votes2
answers584
viewsA: Make a General Sum with all fields
As it has two types of products and select is grouped by types of product it is natural that it displays the result in this way. I don’t have FIREBIRD to test and I’m posting a tested response on…
-
1
votes1
answer57
viewsA: Compare android time slot
You can do it like this: public static final String inputFormat = "HH:mm"; private Date date; private Date dateCompareOne; private Date dateCompareTwo; private String horarioabertura = "8:45";…
-
1
votes1
answer645
viewsA: SUM STRING AS DATE - Oracle
To add these STRINGS you can turn them into seconds like this: As an example I am adding the first and second line of your question. SELECT ( SUBSTR( '42:12:57', 1, 2 ) * 3600 ) + ( SUBSTR(…
-
1
votes1
answer392
viewsA: Index size of a mysql database
Look at this: select database_name, table_name, index_name, stat_value*@@innodb_page_size from mysql.innodb_index_stats where stat_name='size'; This is also interesting: SELECT…
-
0
votes3
answers7469
viewsA: Connect to oracle database by command line after installation
CONNECT system/[email protected] https://docs.oracle.com/cd/B25329_01/doc/admin.102/b25107/connecting.htm…
oracleanswered Reginaldo Rigo 3,638 -
1
votes4
answers594
viewsA: Return value in SQL Server query
SELECT CASE TIPOUSUARIO WHEN 'A' THEN 2 ELSE 9 END FROM UP WHERE ...FILTRO....
-
0
votes2
answers54
viewsA: Conversion of SQL Server types
Alter CONVERT(DECIMAL(5,2), ( SUM(th.PlacasLidas)/SUM(th.Trafego) ) * 100) AS [IndiceOCR] for something like this: CONVERT(DECIMAL(15,2), ( SUM(th.PlacasLidas)/SUM(th.Trafego) ) * 100) AS…
-
1
votes3
answers664
viewsA: Request within a defined time interval
A timer is easier to implement: private final Timer myTimer = new Timer(); public class myClass { @Override public void onResume() { ... myTimer.scheduleAtFixedRate(new myTask(), 0, (long)…
-
1
votes1
answer71
viewsA: Problems with onKey event
Strip the event setOnKeyListener and implements the event setOnFocusChangeListener in that way: txtProduto.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void…
androidanswered Reginaldo Rigo 3,638 -
1
votes2
answers416
viewsA: List always returns only the first row of the sqlite database
Look at it this way: public List<Foto> todasFotos(){ List<Foto> listaFotos = new ArrayList<Foto>(); SQLiteDatabase db = getReadableDatabase(); String sqlTodasFotos = "SELECT * FROM…
-
1
votes1
answer369
viewsA: Search substring in column
It works: The numbers in column A shall be greater than or equal to their list in column D The formula in the cell And takes the word you inserted in cell B2 and looks for in the row of column D, if…
excelanswered Reginaldo Rigo 3,638 -
1
votes1
answer89
viewsA: Increment of version number
I add a field on the screen that I want to show the version and feed that field as follows: Date buildDate = new Date(BuildConfig.TIMESTAMP); idversion.setText("Versão: " + buildDate.toString()); Of…
-
3
votes2
answers65
viewsA: How to mount this SQL
Thus: SELECT COUNT(*) AS QTDE, C.NOME FROM CLIENTE A LEFT JOIN REGIONAL_MUNICIPIO B LEFT JOIN REGIONAL C ON C.ID = B.ID_REGIONAL ON A.ID_MUNICIPIO = B.ID_MUNICIPIO GROUP BY C.NOME…
-
0
votes1
answer406
viewsQ: How to order records correctly using DISTINCT
In my table I have the column DESCRICAO and the DATA_DE_CADASTRO of the items. In my Android application I would like to display the last 10 records that were recorded. There are a number of…
sqliteasked Reginaldo Rigo 3,638 -
1
votes1
answer23
viewsA: Is there any way to decrease or streamline this VIEW ? MSSQL, own software using ASP.NET
Load the query in Microsoft SQL Server Managment and click the icon The program analyzes for you, tells you where your bottlenecks are and suggests creation of indexes if necessary.…
-
1
votes1
answer75
viewsA: Insert or replace does not work
To execute the command INSERT OR REPLACE INTO we should use db.execSQL( comando ) and not db.rawQuery( comando, null ); like this in the code.
-
1
votes1
answer75
viewsQ: Insert or replace does not work
The command INSERT OR REPLACE INTO SYSVAL ( CDDEVICE, DTVALINI, DTVALFIM, SALDO, REALTIME, VALIDADO ) VALUES( '34322910071833580','31-08-2016', '31-08-2016','10','63714560','S') works smoothly on…
-
2
votes1
answer252
viewsA: Compound update
A simple way: where pes_numero in ( a,b,c,d,e ) or where pes_numero in ( select matricula from tabela_matricula where condicao )…
-
1
votes1
answer325
viewsA: Save second line of a command in Prompt
Run the command at the MS-Dos prompt normally by adding > arquivo at the end of the command for the system to save the output in that file, so: wmic path softwareLicensingService get…
windowsanswered Reginaldo Rigo 3,638 -
1
votes1
answer242
viewsA: Lose value in getIntent()
Try it like this: Bundle extras = getIntent().getExtras(); if(extras == null) { id_sessao = null; } else { id_sessao = extras.getString("ID_SESSAO"); }
android android-activity intent broadcastreceiver android-alarmmanageranswered Reginaldo Rigo 3,638 -
0
votes1
answer843
viewsA: How to open a file when clicked on a java application?
When opening the application you have to check if parameters have not been passed to your program. import java.io.File; public class SeuPrograma { public static void main(String[] args) {…
javaanswered Reginaldo Rigo 3,638 -
0
votes1
answer722
viewsA: how do I sum all the numbers in each row and column?
Look at it this way: Dim totalpares Dim totalimpares Dim maioresquedez totalpares = 0 totalimpares = 0 maioresquedez = 0 For n = 1 To 10 For Z = 1 To 10 Cells(Z, n) = Int(100 * Rnd()) k = Cells(Z,…
vbaanswered Reginaldo Rigo 3,638 -
1
votes1
answer221
viewsQ: How to reset Inputstream
I have a Webservice that saves the photo in a folder of the server that was sent by the Android application through the following code: ... int read = 0; byte[] bytes = new byte[1024]; OutputStream…
javaasked Reginaldo Rigo 3,638 -
0
votes1
answer166
viewsA: Function to return the binary value of an image
You cannot use Dynamic SQL or call a precedent from within a function. https://stackoverflow.com/questions/15180561/getting-an-error-when-executing-a-dynamic-sql-within-a-function-sql-server…
-
9
votes2
answers6254
viewsA: What is data persistence?
Data in memory gets lost as soon as the program finishes. For this data not to be lost it is necessary that they are written in a physical device. Therefore: data persistence in computing refers to…
-
0
votes3
answers974
viewsA: Service done in Delphi "kill yourself" or give Stop
Look at this: uses WinSvc; // // start service // // return TRUE if successful // // sMachine: // machine name, ie: \SERVER // empty = local machine // // sService // service name, ie: Alerter //…
delphianswered Reginaldo Rigo 3,638 -
0
votes3
answers974
viewsA: Service done in Delphi "kill yourself" or give Stop
To kill the process by being out of it. function StopProcess(ExeFileName: string) : Integer; const PROCESS_TERMINATE = $0001; var ContinueLoop: BOOL; FSnapshotHandle: THandle; FProcessEntry32:…
delphianswered Reginaldo Rigo 3,638 -
1
votes2
answers235
viewsA: How to create an application without a title bar?
Change this part of your Androidmanifest ... <application android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true"…
-
-1
votes2
answers2248
viewsA: Latitude and Longitude Calculation - Approximation
I got some latitude and longitude here on Google Maps. -23.575546 -46.665508 Mount the URL with this data: http://maps.googleapis.com/maps/api/geocode/json?latlng=-23.57546,-46.66508&sensor=true…
-
0
votes2
answers3829
viewsA: Take AUTO_INCREMENT value from a table
use like this: select coalesce( max( id ), 0) + 1 from tabela
-
0
votes2
answers2106
viewsA: Filter date by hour intervals to the last possible time within the same day
Look at it this way: SELECT * FROM TESTE SELECT COUNT(*), MIN( DATA ) FROM TESTE GROUP BY ( DAY( DATA ) * 100000000 ) + ( MONTH( DATA ) * 1000000 ) + YEAR(DATA ) That’s not what was expected,…
-
0
votes1
answer1799
viewsA: Duplicate records in SQL - Oracle
When we have we want only one line without caring about the content we use MIN or MAX and group what is equal. SELECT ch.idchamado AS idchamado, MIN( su.nome ) AS nomesupervisor, e.nome,…