How to use static values (parameters) from web.config file

If you have static values that you use across your .NET application, one place to store these values is the web.config file.

Let’s say you use your application’s name in several pages in your application. Instead of hard coding this value in each page, it’s easier and more efficient to store it as a parameter in the web.config file.

Example record in web.config:

<add key="APPLICATION_NAME" value="My application"/>

In order to read this value in your code-behind file, use this line:

ConfigurationManager.AppSettings["APPLICATION_NAME"].ToString()

SQL query for retrieving the last record of a group

Imagine that you have a table with multiple rows for the same entity. How to pick up the latest record for each entity?

By using the query below, you can retrieve only the latest record based on a column you specify (It’s ID column in my example).

SELECT ID, USER, AMOUNT 
FROM 
  (SELECT ID, USER, AMOUNT, rank () over (partition by USER order by ID desc) AS rnk 
  FROM ORDERS) x
WHERE x.rnk = 1

SQL Table

Solved: Alexa says “Sorry, I’m having trouble understanding you right now. Please try a little later”

Amazon’s voice-controlled personal assistant, Alexa, isn’t perfect just like us, human beings. She hadn’t been able to understand me for a few days. All she’d been saying was (in a red light):

Sorry, I’m having trouble understanding you right now. Please try a little later

Solution:

Your Wireless Network

It’s not her, it’s -probably- your wireless network. Since Alexa is a cloud service, she needs to be connected to internet. So it’s a good idea to start diagnosing your wireless network.

Even if your other devices are able to connect to internet, the problem might still be caused by your network. Check your router to see if Alexa’s IP address is blocked (This was the issue in my case).

Firmware Mismatch

Make sure you are using the latest firmware in your Alexa device. Alexa automatically checks for latest firmware every night. However, there might be a glitch that is preventing to perform daily checks.

In order to force Alexa to update herself, hit mute button and keep it muted for 30 minutes. It will start updating the firmware.

Need more help? Try Alexa’s office support page