Thursday, 14 November 2024

SQL DateTime functions

 Return Current date in SQL

SELECT GETDATE();



Return the current UTC date and time:

SELECT GETUTCDATE();



Get the month of date

SELECT month('2017/08/13 09:08') AS DayOfMonth;


Get the Year of Date

SELECT YEAR('2024/11/24 09:08') AS Year;


Get Month Name 

SELECT DATENAME(month, GETDATE()) AS monthname;



Find the Weekdays as today

SELECT DATENAME(WEEKDAY, GETDATE()) AS DatePartString;



Add a year to date & return the date: 

SELECT DATEADD(year, 1, '2024/09/25') AS YearAdd;



Subtract 2 months from  date & return the date:

SELECT DATEADD(month, -2, '2024/09/25') AS MonthSub;



Get the difference of month 

SELECT DATEPART(day, DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+2,0)))



Get the End of month date

SELECT DAY(EOMONTH(GETDATE()))



Get only todays date and month

select convert(varchar(5),getdate(),110)




Wednesday, 23 October 2024

Adobe ROBOHelp

1. What is Robo Help?

RoboHelp is a popular Help Authoring Tool (HAT) from Adobe.

It contains, Knowledge Base article, help contents, e Learning sources.

RoboHelp created by Gen Kiyooka and released by Blue Sky Software in 1992. It is acquired by Adobe in 2005.


2. RoboHelp Layout Support

RoboHelp can output to different formats using the following Single Source Layouts (SSLs)

  • Responsive HTML5
  • eBook
  • Microsoft HTML Help
  • JavaHelp
  • Oracle Help
  • Eclipse Help

3. Workspace Overview


4. 
Creating a Project



5. Creating Topics
  • Topic creating the content for such as Text, Video and Images. You can see all the project contents on below path.
  • Click on the Contents and than Assets.

6.  Add New Contents
You can add new contents by clicking to the  + icons.


7. Publishing contents


You can see the output  In browser



















Tuesday, 22 October 2024

Create first Github Action

 What is Git hub action?

It use for continues integration and continues deployment,  There are certain criteria it need to full fill and do the quality check before this deployment of code that can be happen by github actions.




Github Action Terminology
Workflow : it  is an Yml file, it contains:
  • Events
  • Job
  • Runners
  • Steps
  • Actions



Github Action Events

  • Events are trigger for workflow, common events like some one pushes the code into the repository.
  • When the events occurs, it will run all the jobs mentioned into the workflow.












Thursday, 3 March 2022

Redirecting Custom error in .Net Core

When we where working on .net mvc or aspx we  where configuring into the web.config file as default error page, like below.

 

<system.web>

    <customErrors mode="On">

      <error statusCode="404" redirect="/PageNotFound?" />

      <error statusCode="302" redirect="/unauthorised" />

    </customErrors>

</system.web>

 

But in .Net core we dont have web.config file to configure default error page.

In this case we need to configure it in startup.cs file.

 

Wednesday, 16 September 2020

Displaying the multiple rows data in single Row in SQL

 You have a scenario to show the multiple rows data into the  single rows like below.


In Above image you can see how the  multiple rows of above tables data is transformed into horzotally and make all the records into one row.
Just take the example of 1 data and taking it is making the horizontally as respect to the TIN wise.

where for TIN 1000 having the four different records but belongs to the one costumer only.

So first provide the row number to all the records like below.

SELECT SetId, AppCode, AppEventId, EventId,ValueData,phone,[Address], ROW_NUMBER()  OVER( PARTITION BY  AppCode  ORDER BY AppCode

) RowNumber

INTo #mineTable

FROM  dbo.valueDataCheck

In Above Code there we created a new temp table which will maintain the row number with other records and you can see in below line how we provide numbers to all the records

select * from #mineTable



Now main code how we will convert the row to horizontally like given in screen.

SELECT SetId, AppCode as TIN, AppEventId, EventId

  ,max(CASE WHEN RowNumber = 1 THEN ValueData END) AS val1

  ,max(CASE WHEN RowNumber = 2 THEN ValueData END) AS val2

  ,max(CASE WHEN RowNumber = 3 THEN ValueData END) AS val3

   --,max(CASE WHEN RowNumber = 4 THEN ValueData END) AS val4

   ,max(CASE WHEN RowNumber = 1 THEN phone END) AS phonenumber1

  ,max(CASE WHEN RowNumber = 2 THEN phone END) AS phonenumber2

  ,max(CASE WHEN RowNumber = 3 THEN phone END) AS phonenumber3

  -- ,max(CASE WHEN RowNumber = 4 THEN phone END) AS phonenumber4

   ,max(CASE WHEN RowNumber = 1 THEN [Address] END) AS add1

  ,max(CASE WHEN RowNumber = 2 THEN [Address] END) AS add2

  ,max(CASE WHEN RowNumber = 3 THEN [Address] END) AS add3

 -- ,max(CASE WHEN RowNumber = 4 THEN [Address] END) AS add4

 

   FROM #mineTable

   GROUP BY SetId,AppCode,AppEventId,EventId

  

   DROP TABLE #mineTable



It will help you to get the all the records horizontally . Dont forget to drop tables.


Deploying MVC in website in Big Rocks getting Security Error

 Once you deploy your website into big rocks you are getting the /Security Error.,


I faced the similar issue like below




Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SecurityException: Request failed.]
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +165
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100
   System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +272
   System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, RuntimeAssembly asm, SecurityAction action) +55
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +70
   System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +39
   System.Type.GetType(String typeName) +50
   System.CodeDom.Compiler.CompilerInfo.get_IsCodeDomProviderTypeValid() +10
   System.Web.Compilation.CompilationUtil.GetRecompilationHash(CompilationSection ps) +2090
   System.Web.Configuration.CompilationSection.get_RecompilationHash() +107
   System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDateInternal(Int64 cachedHash) +465
   System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDate(Int64 cachedHash) +51
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +132
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521

--------------------------------------------------

It is happning even you are providing the trust level as full like below.

<system.Web>
...
    <trust level="Full"/>
...
</system.Web>
-----------------------------------------------

And fix for that is

You need to contact the  big rocks supporting team as your site need the  configuration of 4.7 , as it is build in MVC 5.0 + version so just check with them and they will give CAS access to full. Even if you do setting in PLSK it wont work they will provide it to you.