Programming

What is network security?

  1. What do we mean by network architecture? 
  2. What are the most widely used architectures in computer networks?
  3. What is a protocol and why is it needed?
  4. What is a network protocol and what does it contain?
  5. What are the significance and the role of a protocol in network architecture?

Network architecture encompasses the design and layout of a computer network, including both physical and logical components and how they interact with one another. The most commonly employed architectures in computer networks are client-server and peer-to-peer. The client-server architecture includes one or more central servers that provide services to multiple clients, while in a peer-to-peer architecture each device on the network functions as both a client and server. Protocols are a set of guidelines and rules that regulate communication between devices on a network, which are necessary to ensure devices can communicate effectively and efficiently and prevent conflicts and errors. Network protocols include rules and guidelines for transmitting data over a network, including the format of the data, how it’s broken into packets, and the routing of packets through the network. Protocols play a vital role in network architecture, as they are the foundation of network communication and without them, data would not be able to flow between devices. They permit devices to communicate with each other, regardless of hardware or software and ensure that data is transmitted accurately and efficiently. Additionally, a good protocol allows for easy scalability and troubleshooting of the network. In conclusion, protocols are necessary for smooth communication and coordination within a network, without them it would be impossible to transmit data between devices, they are the backbone of network communication, ensuring accurate and efficient data transmission and enabling communication between devices regardless of hardware or software.

How to mass delete comments in WordPress

0

METHOD 1:

To mass delete comments in the WordPress admin panel, follow these steps:

  1. Log in to the WordPress admin panel and go to the “Comments” section.

  2. On the comments page, you will see a list of all the comments on your site. You can select multiple comments by clicking the checkbox next to each comment you want to delete.

  3. Once you have selected the comments you want to delete, scroll to the top or bottom of the comments list and look for the “Bulk Actions” dropdown menu.

  4. Select “Move to Trash” from the dropdown menu. This will delete the selected comments from the site.

  5. To permanently delete the comments, go to the trash section and select the comments you want to delete permanently and click on “Empty trash” or you can also select all the comments and delete it once.

Note that deleting comments permanently will remove them from the site permanently and it will not be recoverable.

Additionally, in case you have thousands of comments and you want to delete all of them, you can use a plugin such as “Delete All Comments” or “Bulk Delete” to delete comments in bulk. These plugins will enable you to select and delete comments based on different criteria, such as date, author, and more.

WordPress also has an inbuilt feature to approve, unapprove, mark as spam, move to trash and delete comments in bulk. It can be found by clicking on the checkbox on the top of the comment list, which will give you option to perform bulk actions on selected comments.

It’s always a good practice to take a backup of your website before making any major changes.

METHOD 2:

You can also go to plugins -> Add new plugin and search the WP Bulk Delete plugin and use that to delete more than the allowed page comments at once.

The most important trait for a Software Engineer

When you are dealing with other people in life, you need to treat them how you expect to be treated. Projecting a positive attitude will most of the time reflect it back at you. However, the world can present you challenges, and you have to handle them graciously, especially if you’re a team leader (Carpenter, Bauer, & Erdogan, 2010).

As a software engineer, you build the roadmap for other software developers to follow when constructing a software product. While a balanced combination of all five personality traits: Openness, Conscientiousness, Extraversion, Agreeableness, and Neuroticism is essential (2MinutePsychology, 2013), it is smart to adjust the dimension to suit based on the situation.

An essential personality trait as a software engineer would be openness. Being open with your team covers most of the spectrum. When you are engineering software, most of the time, you don’t have the complete picture instantly. On the one hand, this situation would require you to be open to receiving ideas, criticism, and suggestions. On the other hand, you will need to be transparent with your team about problems, evaluation, and cost (Iqbal, Aldaihani, Shah, 2019). Any software that does not establish this two-way route in openness will face many hurdles when dealing with his developers. While a software engineer might see the bigger picture, the developer sees the details and is the first in the line of offense (Iqbal, Aldaihani, Shah, 2019). Therefore, feedback from and to your developers is critical.

Openness can also streamline motivation, innovation, and trust. When you are honest, the team of developers wants to help you achieve the final goal because the benefits are clear on the table to everyone. Openness can also be a pillar for innovation, which is at the center of programming. The power of openness to achieve imagination and interest for your team can catalyze to produce the best product (Carpenter, Bauer, & Erdogan, 2010).

A smart team leader generally or a software engineer specifically can be at the center of innovation for their firm (Iqbal, Aldaihani, Shah, 2019). Through a routine practice of openness, the daily tasks at hand can make the workplace an enjoyable and pleasant bond based on trust and mutual respect.

Reference

Carpenter, M., Bauer, T., & Erdogan, B. (2010). Management Principles, v. 1.1. https://2012books.lardbucket.org/books/management-principles-v1.1/index.html.

2MinutePsychology. (2013, September 16). The big five personality model [Video]. YouTube.

Waude, A. (2017, May 8). Five-Factor Model Of Personality. Retrieved April 19, 2020, from https://www.psychologistworld.com/personality/five-factor-model-big-five-personality#references

Iqbal, A., Aldaihani, A., Shah, A. (2019, October 12) International Journal of Innovative Technology and Exploring Engineering ISSN: 2278-3075, Volume-8 Issue-(IJITEE) Retrieved April 19, 2020, from https://www.ijitee.org/wp-content/uploads/papers/v8i12/J97550881019.pdf

Searching through all columns in datagridview

0

Assuming you are searching for the name John, the following procedure will search all existing columns regardless

Dim x As Integer = 0
 While x < DataGridView1.Rows.Count
 Dim y As Integer = 0
 While y < DataGridView1.Rows(x).Cells.Count
 Dim c As DataGridViewCell = DataGridView1.Rows(x).Cells(y)
 If Not c.Value Is DBNull.Value Or Nothing Then
 If CType(c.Value, String) = "John" Then
 MessageBox.Show("Found!")
 End If
 End If
 System.Math.Min(System.Threading.Interlocked.Increment(y), y - 1)
 End While
 System.Math.Min(System.Threading.Interlocked.Increment(x), x - 1)
 End While
 MessageBox.Show("Search complete!")
 End Sub

Filtering a datagridview

0

assuming you have a datagridview that has data in it.

you want to avoid recalling sql from the database & just want to filter the datagrid.

you can do the following, What you need (1 datagridview (data), 1 button (search), 1 textbox (string to search), 1 variable to precise the criteria your searching for)

Dim findcrit as string
Dim dt As DataTable = Ds_Pos.Employees
 Dim dv As New DataView(dt)
 
 Dim _RowFilter As String = ""
 Dim _FieldType = dt.Columns(findcrit).DataType.ToString
 
 Select Case _FieldType
 Case "System.Int32"
 _RowFilter = "convert(" & findcrit & ", 'System.String') like '" & Me.TextBox1.Text & "'"
 Case "System.Int64"
 _RowFilter = "convert(" & findcrit & ", 'System.String') like '" & Me.TextBox1.Text & "'"
 Case "System.Double"
 _RowFilter = "convert(" & findcrit & ", 'System.String') like '" & Me.TextBox1.Text & "'"
 Case "System.String"
 _RowFilter = findcrit & " like '" & TextBox1.Text & "*'"
 End Select
 dv.RowFilter = _RowFilter
 EmployeesDataGridView.DataSource = dv

The cases are to cast the type of variable from any type to string because you can only use the method on string data types.

the idea is to move the content to a data table then filter then return it back to the datatable.

using c# and vb in the same web project

0

Can you have both c# and visual basic in the same web site project?

Definitely! It simply wouldn’t make sense from a new project standpoint, code reviews, coding standards, continuity, project maintenance, etc.

however, people still want it.  to-date i never really tried (and that’s been my answer).  I was presented with a usable scenario of why you may need (not want, need) to do this, so I finally tried it.  the answer: yes…kinda…sometimes.

let’s assume we have a web site structure like this:

we have the App_Code folder and a .cs and a .vb file in the same projects (separated into sub-folders).  note that the project sees them as folders (yellow folder icon) in the special folder.  each class within there basically has a “hello world” function only, like this in the c# file:


public string SayHelloCS()
    {
      return "Hello from CS";
  }

and the visual basic file has a similar function emitting "Hello from VB."

now, if you run default.aspx in this structure, this is what you will see:

The files ‘/WebSite5/App_Code/VBCode/Class2.vb’ and ‘/WebSite5/App_Code/CSCode/Class1.cs’ use a different language, which is not allowed since they need to be compiled together.

interesting?  probably not, but it makes sense…so how do we overcome.  we use a configuration option called .  here’s what we need to add to our <compilation> node in our web.config:


<compilation debug="false">
          <codeSubDirectories>
            <add directoryName="VBCode"/>
            <add directoryName="CSCode"/>
          </codeSubDirectories>
       </compilation>

once we add those codeSubDirectory nodes, let’s “look” at what the project structure looks like now:

as you can see the code folders are now “special” in the eyes of visual studio.  now if we browse default.aspx we will see:

Hello world from CS. Hello world from VB


       

Custom error pages using .htaccess

0

We’ve all seen the dreaded Error 404 message – the result of broken links and mistyped URLs. You’ve probably been on some websites where the error pages are customised with their own logo and message, and I’m sure you’ll agree that it looks far more professional than the standard one.

In this article we’ll show you how to use Apache’s .htaccess file to make your own customised error 404 pages.

Create a new text file on your computer, and call it “htaccess.txt”. Enter the following lines:

<Files .htaccess>

order allow,deny

deny from all

</Files>

Now you need to create the 404 page. Make a new web page called “error404.htm” and enter “This is my 404 page”. Enter it a few dozen times, as Internet Explorer won’t display it unless the file is over 512 bytes.

Once it’s done, login to your webspace with your FTP client, and create a new folder called “errordocs”. Upload the file “error404.htm” to this directory. Upload “htaccess.txt” to the root of your webspace and rename it to “.htaccess” — there’s no .txt at the end, no name in front, just “.htaccess”. If the file seems to vanish don’t worry, some FTP clients don’t display it — the file’s still there.



ErrorDocument 404 /errordocs/error404.htm

The first part stops people viewing your .htaccess file. The second part tells Apache to redirect any 404 errors to the file “error404.htm”.

You do not have sufficient permissions to access this page” after WordPress upgrade

1

If you’ve done a wordpress upgrade which included either copying another wp database or changing the current one’s table prefix (as well as changing the $table_prefix PHP variable in your config file,) you will most likely be met with this warning when you try to log in:

You do not have sufficient permissions to access this page.

The reason for this is that everything in wordpress that accesses info in the db does so from PHP using the $table_prefix variable, and when you first installed your blog, a couple of options are set in the database that include that value, which makes it not really so dynamic! 😉

After rooting through my db, I found 5 or 6 values that still had the old table prefix in – mostly in the `usermeta` table, but also one in the `options` table. To make sure I got them all, I ran these simple SQL statements in phpMyAdmin to update all the values:

_usermeta table and _options table

Split Command Sample Code (VB NET)

0

Preparations : 1 Textbox and 1 Button

Code :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
    Dim strInput As Array 'make array variable
 
    Dim strResult1 As String 'text variable
 
    Dim strResult2 As String 'another text variable
 
    Try
 
    strInput = Split(TextBox1.Text, " ")
 
    'split the textbox if there is space.
 
    'you can also use chr(32) to replace " "
 
    strResult1 = strInput(0) 'split first text
 
    strResult2 = strInput(1) 'split second text
 
    MsgBox(strResult1 + strResult2)
 
    'combine first and second text with no space
 
    Catch ex As Exception
 
    End Try
 
    End Sub

Test the code, type space character between 2 words :

What we have done here?

Explanation :

  1. We have 2 words with a space character (“jenni” and “fer”)
  2. We split those words using “Split” command into array, the process is identified with space character, so we had 2 lines.
  3. We combine those words back together in one line, but this time with no space character in it.

Getting IP Address (VB NET 2008)

0

Note: if you’re not a beginner and just want to look for the code, you may skip these 1-6 steps and go straight to the sample code.

1) Let’s start with new project “Windows forms application”

2) Put one TextBox and a Button in the Form

3) Add reference to our project by clicking : Project –> Add Reference

4) Scroll down and select  “System.Net” as our reference. Click OK to proceed.

5) Open the Coding Window or you can just simply double click on the Button1, or you can also use F7 for shortcut.

6) Type “Imports System.Net” in General as shown in the picture below

7) Now the code part, on your Button1_Click event add this code as shown in the picture below

8) Run your program or press F5

Go to Top