Thursday 21 November 2019

Error While Launching the activity

Android Studio

Error While Launching the activity



The solution:

The only one best Answer is to run uninstall command from adb and install the app again 

cd to 
C:\Users\YourUser\AppData\Local\Android\sdk\platform-tools>

run the following command 

adb uninstall applicationId 

applicationId: from gradle module file 

Saturday 21 September 2019

How to export one table or sheet to multiple tables or sheets

If you have one excel sheet or table and you want to export it to multiple sheets or tables use the following steps:

  1. Specify the column -tablesNamesColumn- you want its data to be the names of the tables/sheets 
  2. import the main sheet to MSSQL 
  3. Select distinct values from the tablesNamesColumn
  4. Create a table and name it "TablesNames":                                                                                       CREATE TABLE [dbo].[TablesNames](
           [id] [int] IDENTITY(1,1) PRIMARY KEY,
           [Table_Name] [nvarchar](255) NOT NULL,
    )   
  5. insert the tables names in the table which contains the tables names                                               insert into TablesNames
    SELECT distinct tablesNamesColumn  
    FROM [AllSheets]
  6. Now you need to loop inside the tables names and create tables in the same format         
    DECLARE @LoopCounter INT , @MaxTablesNamesId INT,
            @TableName NVARCHAR(100)
    SELECT @LoopCounter = 0 , @MaxTablesNamesId = count(*)
    FROM TablesNames

    WHILE ( @LoopCounter IS NOT NULL
            AND  @LoopCounter <= @MaxTablesNamesId)
    BEGIN
       SELECT @TableName = Table_Name FROM TablesNames
       WHERE id = @LoopCounter
      -- PRINT @TableName 
       SELECT @LoopCounter  = min(id) FROM TablesNames
       WHERE id > @LoopCounter
      
    declare @q nvarchar(max) = '
    drop table ['+@TableName+'];
    SELECT * INTO  ['+@TableName+']
    FROM [delme]
    WHERE Institution = N'''+ @TableName +''';' 
    exec (@q)
    END
  7. Use the following steps to export the data to Excel 97-2003 file, because I tried Excel 2010 and 2016, the only one works fine is 97-2003  

Sunday 7 July 2019

sql logic in select statement, substitute value instead of value

select IIF (coalesce(IsRequiredDocReceived,0)=0 and coalesce(IsRefused,0)=0 and coalesce(IsApologized,0)=0 , 1,0) as isAllowEdit
FROM            ScholarshipSysApplicantApplications
where userid=1


coalesce: to substitute value instead of value if it is null
sql if value is null set value of another column

Wednesday 12 June 2019

Oracle Update Table from Table

update SCHOOLS
set (SCHOOLS.LOWEST_CLASS, SCHOOLS.HIGHEST_CLASS) = (select  AAAA_DIRECT.lowest_class, AAAA_DIRECT.HIGHEST_CLASS
from AAAA_DIRECT
where SCHOOLS.ID = AAAA_DIRECT.STDID)