Ray Tawil

Ray Tawil

This user hasn't shared any profile information

Home page: http://www.raytawil.com

Posts by Ray Tawil
Greek Polis

The Greek Poleis


Archaic Greece was the period that witnessed the rise of the polis states. Archaic Greece thrived during the era around 800-480 BC (Brand, n.d.). The founding of these city-states was a breakthrough for human civilization. A study of all the occurrences of the word polis in the Archaic and Classical sources showed that there are some 11,000 which shows the importance and relevance of this new way of life (Hansen, 2006). This period brought people into a well-structured community and away from poverty living in small rural villages as nomadic groups.  

A new form of Government: During Greek dark ages people lived scattered in small farming villages (History.com Editors, 2010). The Archaic period brought two revolutionary forms of government, the Oligarchy in Sparta and the Democracy in Athens. Sparta was predominantly an Oligarchy where the military men in a democratic vote appointed the Ephors to supervise the kings and legislative branch of the government. Sparta had a complicated form of government that consisted of predominantly Oligarchy, Democracy, Monarchy and Tyranny (Hornblower, 2019). 

On the other hand, Athenian democracy was separated into three parts: The Assembly, The Council, and The Courts. Athens was the first city-state to have a proper and effective form of democracy. It was very straight forward, mostly every Athenian citizen had a vote, the majority ruled (Brand, n.d.). There was abuse by wealthy aristocrats and noblemen but Athenian democracy was far from perfect with characteristics like slavery, gender bias, and control by rich aristocrats. 

Community-based life: The community became more important than any individual. The loyalty to a polis central government was cherished as a central value of life. The new world they lived in within the city-state was regarded as a form of life improving factor. In Sparta it is evident with practices like the Syssitia where Spartan men were eligible to join exclusive dining, men competed ferociously to get into a group (Brand, n.d.). 

The people make up the polis: In contradiction with any prior civilization in Archaic Greece, the people were more important than temples, structures, and stones. People were the essence of the existence of the polis. This is evident during the evacuation of Athens “Themistocles organized the naval resistance and the evacuation of the city of Athens itself” (Brand, n.d.) it showed that Athens itself was not important as a polis that can be rebuilt but rather the people that lived in it. 

Economic powerhouse: The polis city-state was an economic powerhouse promoting a marketplace for trade and agriculture (Hansen, 2006). The olive oil and pottery industries were booming and served as an export market to pay for the large amounts of grain that were used to feed the Athenian growing population (Brand, n.d.). Democratic Athens attracted immigrants that enriched the city intellectually and in trade. “They worked as merchants, craftsmen and in other lucrative trades such as philosophers who served as private tutors to the sons of wealthy Athenians” (Brand, n.d.). 

In conclusion, Greece during the Archaic period did not always have the same shape and size polis. Poleis changed over time in shape, size, and location. Governance was also another aspect that had a progressive momentum at times and a controlled Monarchy in others (Brand, n.d.). Wars internally among Greeks and with external powers like the Persians were certainly the most important factor that shaped the change in the structure and governance of the city-state. 


Brand, P. J. (n.d.). Athens & Sparta: Democracy vs. Dictatorship [PDF]. 

History.com Editors. (2010, March 05). Ancient Greece. Retrieved June 23, 2019, from https://www.history.com/topics/ancient-history/ancient-greece  

Hornblower, S. (2019, June 20). Ancient Greek civilization. Retrieved June 23, 2019, from https://www.britannica.com/place/ancient-Greece  

Hansen, M. H. (2006). Polis: An introduction to the ancient Greek city-state. Retrieved from https://ebookcentral.proquest.com  

Searching through all columns in datagridview


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
 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


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


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">
            <add directoryName="VBCode"/>
            <add directoryName="CSCode"/>

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


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


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


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)


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
    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)


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

Progress Bar Sample Code (VB NET 2008)


Picture Info:


(A) Progress Bar, Properties :

Name = ProgressBar1

Minimum (value) = 0

Maximum (value) = 100

(B) Button, Properties :

Name = Button1

Text = Button1

(C) Timer, Properties:

Name = Timer1

Enabled = False

Interval = 100

Kode (F7) :


Public Class Form1
Private Sub Timer1_Tick(ByVal sender As  System.Object, ByVal e As  System.EventArgs)Handles Timer1.Tick
Static TikTok As Integer
TikTok = TikTok + 1
ProgressBar1.Value = TikTok
If ProgressBar1.Value = ProgressBar1.Maximum  Then
Timer1.Enabled  = False 'deactivate Timer1
TikTok  = 0 'set static value back to 0
End If
End Sub
Private  Sub Button1_Click(ByVal sender As System.Object, ByVal e As  System.EventArgs)Handles Button1.Click
Timer1.Enabled = True 'activate Timer1
Timer1.Interval = 100 'set interval to 100
ProgressBar1.Value = 0 'set ProgressBar value  to 0
End Sub
End Class

Access Database Connection (OLEDB) – VB NET 2008


Here, I will show you how to make a connection to MS Access 2007 database with VB NET 2008 using wizard. If you’re looking for the sample using code, then this is not what you’re looking for.

1) Start with NEW windows form projec. When new project has been created, click the “Data Source” tab and choose “Add New Data Source”

2) Choose “Database” and then click OK

3) Click “New Connection”

4) on Default, the connection is set to SQL, to make database connection using Access then you need to change it as in the picture below.

5) Select “Microsoft Access Database File” then click OK.

6) The Data Source has been changed to “Microsoft Access Database File (OLEDB)”. Now you need to load your database file to the project. To do this, click “Browse” and point to your database file then click OK to proceed. After all set up, you can click on “Test Connection” to check the connection status. Once you ready, continue to next step by clicking OK button. (see picture below)

7) You might see this pop up message, just click YES to copy your database file into project folder. From here, just click on “NEXT” button until you reach the part as seen in the picture in STEP 8

8) Make sure the “Tables” is checked and click “Finish” to proceed to the next step.

9) Now back to Data Sources window, left click Birthday Table and choose “Details” (see picture below)

10) Final step in this tutorial. While holding mouse left click on the icon beside  “ID_Name”, drag and drop it to the form. Do the same way for “ID_Birthdate”.

Finally, your form might look like this picture below. To navigate through the records in your database, use navigation button on top of the form. You can also execute : Add and Remove command.  Press F5 to run the program. (Tips: to see larger picture size, right click on pictures and choose “view image”)

Ray Tawil's RSS Feed
Go to Top