Check if SortedList Contains a Specific Key in C#

AmitDiwan
Updated on 16-Dec-2019 07:40:32

145 Views

To check whether a SortedList object contains a specific key in C#, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       SortedList list = new SortedList ();       list.Add("A", "Books");       list.Add("B", "Electronics");       list.Add("C", "Appliances");       list.Add("D", "Pet Supplies");       list.Add("E", "Clothing");       list.Add("F", "Footwear");       Console.WriteLine("Value associated with key E = "+list["E"]);       list["E"] = "HDD";       Console.WriteLine("Value associated with key E [Updated] = "+list["E"]);   ... Read More

Difference between SAP Crystal Reports and CR for Visual Studio

Monica Mona
Updated on 16-Dec-2019 07:40:22

2K+ Views

Crystal Reports for Visual Studio 2010 comes free and you can develop as many reports and can host runtime engine without any cost. Now Crystal Reports has been excluded from Visual Studio by default and you need to download it free from SAP site.You can use the following link for downloading CRforVS: http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0.exeSystem RequirementsDetailsProduct PrerequisitesMicrosoft Visual Studio 2010Processor1.6 GHz or fasterMemory1GB (32-bit) or 1.1GB (64-bit) availableOperating systemsWindows 2003, Windows Vista PlatformSupportWindowsOnce you install this, you can still create a new Crystal Report Design in Visual Studio by navigating to the below path:Solution Explorer -> Right click on the Project name ... Read More

Using SSO Logon Tickets in SAPUI5

karthikeya Boyini
Updated on 16-Dec-2019 07:37:21

371 Views

When your proxy has SSO token, you should use SET-COOKIE header to pass SSO token to the client.Exampleset-cookie: MYSAPSSO2=DFOKJLDM.....AJLBhHcvA%3d%3e; path=/; domain=xxxxx.sap.comIt should be passed to client browser from proxy and domain name has to be changed to the proxy as shown below:set-cookie: MYSAPSSO2=DFOKJLDM.....AJLBhHcvA%3d%3e; path=/; domain=PROXYDOMAIN.comWhen next time your browser calls to the proxy, this will include session cookie in the request header like below. The proxy will read that Cookie from HTTP request header to make calls.Cookie: MYSAPSSO2=DFOKJLDM.....AJLBhHcvA%3d%3e;

Convert String Varchar to Timestamp Format in MySQL

AmitDiwan
Updated on 16-Dec-2019 07:37:06

4K+ Views

To convert string to timestamp format, use STR_TO_DATE() along with DATE_FORMAT(). Let us first create a table −mysql> create table DemoTable1602    -> (    -> ReportingDate varchar(40)    -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1602 values('Wed Oct 02 16:10:45 IST 2019'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1602 values('Fri May 31 13:00:10 IST 2019'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1602 values('Mon Dec 31 14:20:00 IST 2018'); Query OK, 1 row affected (0.23 sec)Display all records from ... Read More

MySQL: Update Column to NULL for Blank Values

AmitDiwan
Updated on 16-Dec-2019 07:35:34

3K+ Views

For this, you can use IF() along with UPDATE command. Let us first create a table −mysql> create table DemoTable1601    -> (    -> FirstName varchar(20) ,    -> LastName varchar(20)    -> ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1601 values('John', 'Doe'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1601 values('Adam', ''); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1601 values('David', 'Miller'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1601 values('Chris', ''); Query OK, 1 row affected ... Read More

Check If List Contains Elements Matching Specified Conditions in C#

AmitDiwan
Updated on 16-Dec-2019 07:34:49

453 Views

To check whether a List contains the elements that match the specified conditions in C#, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    private static bool demo(int i) {       return ((i % 3) == 0);    }    public static void Main(String[] args) {       List list = new List();       list.Add(255);       list.Add(315);       list.Add(410);       list.Add(500);       list.Add(600);       list.Add(710);       list.Add(800);       list.Add(1000);       Console.WriteLine("List elements...");   ... Read More

Formatting Date in SAP System

Ramu Prasad
Updated on 16-Dec-2019 07:34:34

164 Views

You will need to apply new culture to the existing thread as shown below:ExampleDateTime now = DateTime.Now; Console.WriteLine(now); CultureInfo sapCulture = new CultureInfo("en-US", true); sapCulture.DateTimeFormat.ShortDatePattern = "ddMMyyyy"; //sapCulture.DateTimeFormat.FullDateTimePattern =    sapCulture.DateTimeFormat.ShortDatePattern + " HH-mm-ss"; sapCulture.DateTimeFormat.LongTimePattern = "HH-mm-ss"; //sapCulture.DateTimeFormat.ShortTimePattern = "HH-mm-ss"; System.Threading.Thread.CurrentThread.CurrentCulture = sapCulture; //System.Threading.Thread.CurrentThread.CurrentUICulture = sapCulture; Console.WriteLine(now);

MySQL Select by Month

AmitDiwan
Updated on 16-Dec-2019 07:30:45

449 Views

To select by month, use MONTH() function. Let us first create a table −mysql> create table DemoTable1599    -> (    -> Shippingdate datetime    -> ); Query OK, 0 rows affected (0.78 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1599 values('2019-10-21'); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable1599 values('2018-12-12'); Query OK, 1 row affected (0.35 sec) mysql> insert into DemoTable1599 values('2015-11-21'); Query OK, 1 row affected (0.34 sec) mysql> insert into DemoTable1599 values('2017-12-31'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1599 values('2018-12-26'); Query OK, 1 row affected ... Read More

Synchronize Access to the Stack in C#

AmitDiwan
Updated on 16-Dec-2019 07:30:01

131 Views

To get synchronize access to the Stack, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Stack stack = new Stack();       stack.Push(100);       stack.Push(200);       stack.Push(300);       stack.Push(400);       stack.Push(500);       Console.WriteLine("Stack...");       foreach(Object ob in stack) {          Console.WriteLine(ob);       }       Console.WriteLine("Count of elements = "+stack.Count);             Console.WriteLine("Synchronize access...");       lock(stack.SyncRoot) {       ... Read More

Using UNIQUE for VARCHAR Columns with Conditions in MySQL

AmitDiwan
Updated on 16-Dec-2019 07:28:14

217 Views

For this, you can use UNIQUE constraint on one or more columns −alter table yourTablleName add unique(yourColumnName1, yourColumnName2, ...N);Let us first create a table −mysql> create table DemoTable1598    -> (    -> EmployeeId int,    -> EmployeeName varchar(20),    -> EmployeeCountryName varchar(20)    -> ); Query OK, 0 rows affected (0.52 sec)Here is the query to implement UNIQUE on varchar columns −mysql> alter table DemoTable1598 add unique(EmployeeName, EmployeeCountryName); Query OK, 0 rows affected (0.55 sec) Records: 0  Duplicates: 0  Warnings: 0Insert some records in the table using insert command −mysql> insert into DemoTable1598 values(101, 'Adam', 'AUS'); Query OK, 1 ... Read More

Advertisements