devxlogo

The Latest

Get DNS Name from an HttpRequest in C#

Use the GetLeftPart method on the HttpRequest’s URI with Authority as the UriPartial’s value to retrieve the DNS Name. string dnsName = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); Related Posts Apple Buys FoundationDBMicrosoft, OpenAI, Nvidia

Java Collections Performance, MAP

Improve Java performance with MAP. Add Contains keys Next Data StructureHashMap O(1) O(1) O(h/n) Hash TableEnumMap O(1) O(1) O(1) ArrayLinkedHashMap O(1) O(1) O(1) Hash Table+Linked ListTreeMap O(log n) O(log n)

New Way to Iterate a List in Java 8

We can see that the method println is referred by System.out using :: import java.util.*;public class NewForEach { public static void main(String args[]) { List empNames = new ArrayList(); empNames.add(“Andrew”);

Tip: Count the Number of Active ASP.NET Sessions

During testing or monitoring, there is a constant need to monitor the number of sessions created, so as to better correlate the performance metrics collected. The Performance Monitor tool is

Get a User that has Deleted Rows with SQL

Getting a user that has deleted rows with SQL is a multi-part process. First you have to search the transaction log file for information on deleted rows. SELECT [Transaction ID],

How to save a shortcut icon to a webpage from Chrome

Chrome provides a nice tool, to save the page you are on as a shortcut to desktop. Select the tab that you want to save on your desktop as a shortcut, and go to Tools Menu. Choose More Tools – Add to desktop option.  A new shortcut will be created on the desktop with the link to the page you were browsing. Related Posts Top Java Development Companies in IndiaChina’s tiankeng reveal ancient, unique ecosystemsAccess Dilemma: Techopedia’s Security RoadblockCreate Real Time Charts and Maps with Project EONRetrieving remainder of two numbers

How to edit restricting sections of a word document

Word allows you to restrict certain sections in the document from formatting or editing.  To enable this on a section of text, choose the “Restrict Editing” option that is under the Developer Menu – Protect Section. You will see the ???Restrict Editing??? toolbar appear to your right. You can choose and set Formatting and/or Editing restrictions.  You need to add a password to apply a restriction and also to remove the restriction.  Related Posts AWS Reports Record-Breaking Revenue of $2.9 BillionThe DevOps ParadoxTop 5 Internal Developer Portals of 2024 ListSurvey: AWS Is Top Destination for Those Switching CloudsSwiss fintech

How to find which tabs are playing music/sound in Chrome browser

When we open multiple tabs, and there is music/sound from one of the tabs it is tough to figure out which tab is emitting the sound in Chrome.  An easy way is to look for the tab name/title in the open Chrome tabs. Chrome displays a volume icon just before the tab name/title if the tab is playing music/sound. You can thus quickly locate the tab and take further action. Related Posts 8 Fun Games Like Cards Against Humanity to PlayQuick Way to Print Only Certain Rows of an Excel SpreadsheetBuild Composable UI Components for Large Scale ApplicationsQuickly

Change the orientation of a page in Word.

Did you ever find a need to change the orientation of a word document?  If yes, you can quickly do that by navigating to the ???Page Layout??? menu and choose the Landscape/Potrait orientation option.  Related Posts Medical AI Struggles with New PatientsManage Your Data Pipelines with Ease Using Code-free Copy for Azure Data FactoryUsing the Hover Effect on an HTML ElementHow Long

Java Collections Performance, SET

Java collections – performance (Time Complexity) A set is a collection that contains no duplicate elements. Add Next Contains Data StructureHashSet O(1) O(h/n) O(1) Hash TableEnumSet O(1) O(1) O(1) Bit

Making a File Read-only Using Java

Files have multiple properties and they are interesting to use. In fact, your own file system can be developed using them. Create a file named PATH.txt and try this program

Serialize an Object to a JSON String

Newtomsonft.json has helper methods that help to serialize objects to JSON. See below for a code snippet that uses the library and helps convert an object to JSON format. public

Java Collections Performance, LISTS

Java collections – performance (Time Complexity) A list is an ordered collection of elements. Add Remove Get Contains Data StructureArrayList O(1) O(n) O(1) O(n) ArrayCopyonWriteArrayList O(n) O(n) O(1) O(n) ArrayLinkedList

Java BlockingQueue

BlockingQueue in Java is more advanced Queue. It performs all functionalities of a Queue in addition to certain qualities. It waits for the Queue to be non empty before retrieving an element using take() method and holds on for a placeholder to be available before it can add an element to the Queue using the put() method. BlockingQueue is an Interface and can be used as below. We are trying to initialize an ArrayBlockingQueue with size of 5. BlockingQueue intQueue = new ArrayBlockingQueue(5); intQueue.put() will add the data and wait for a space if it is full. intQueue.take() will remove the element at the head of the Queue. Related Posts Cisco: Cloud Computing Will Generate 8.6 ZB of Traffic by 2016F#, CoffeeScript Climb in Popularity RankingsIKEA Launches Smart Sensors for Home MonitoringHow

Duplicate–do not use–Floodfill objects using C#

In order to flood fill drawn objects, you can make use of the next sample: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace FloodFill {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }         Bitmap bm;         Graphics g;         private bool SameColor(Color c1, Color c2)         {             return ((c1.A == c2.A) && (c1.B == c2.B) && (c1.G == c2.G) && (c1.R == c2.R));         }         private void tobien1(Bitmap bm, Point p, Color Color, Color LineColor)         {             Stack S = new Stack();             S.Push(p);             while (S.Count != 0)             {                 p = S.Pop();

Using SendKeys in C#

SendKeys is very powerful. You can use SendKeys to send a different keycode from the one that was pressed. For example: private void TextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode

Using String.join to Concatenate Strings

String.join is an easy-to-use utility method in String class. public class StringJoin{ public static void main(String args[]){ //The first argument (refered as joinString) is used to join the subsequent argument(s)