The Joel Test

bron: click here.

The Joel Test: 12 Steps to Better Code

Have you ever heard of SEMA? It’s a fairly esoteric system for measuring how good a software team is. No, wait! Don’t follow that link! It will take you about six years just to understand that stuff. So I’ve come up with my own, highly irresponsible, sloppy test to rate the quality of a software team. The great part about it is that it takes about 3 minutes. With all the time you save, you can go to medical school.

The Joel Test

  1. Do you use source control?
  2. Can you make a build in one step?
  3. Do you make daily builds?
  4. Do you have a bug database?
  5. Do you fix bugs before writing new code?
  6. Do you have an up-to-date schedule?
  7. Do you have a spec?
  8. Do programmers have quiet working conditions?
  9. Do you use the best tools money can buy?
  10. Do you have testers?
  11. Do new candidates write code during their interview?
  12. Do you do hallway usability testing?

Continue reading The Joel Test

Error Creating Window Handle

Brain-BulbIt starts with “Can not create Window Handle”… and continuous random crashes. You find out your app reaches the max of 10000 user objects. (Just check the task manager, you’ll see I’m right.)

So, you’ve been using your own usercontrols on a flowlayoutpanel; you add, you remove, you clear… however the user objects count keeps growing and something is leaking somewhere…

You find that .controls.clear() does not work, you have to dispose() of all the objects first. Okay, do that, but it still doesn’t work.
So what’s the trick?
Simply remove first, before the dispose, and do this one at a time.

Just use the following routine:
ClearFlowLayoutPanel(myFlowLayoutPanel)
instead of
myFlowLayoutPanel.Controls.Clear()

Public Sub ClearFlowLayoutPanel(cFlowLayoutPanel As FlowLayoutPanel)
 Do While (cFlowLayoutPanel.Controls.Count > 0)
  Using controltoremove = cFlowLayoutPanel.Controls(0)
   cFlowLayoutPanel.Controls.Remove(controltoremove)
   controltoremove.Dispose()
  End Using
 Loop
 GC.Collect()
 GC.WaitForPendingFinalizers()
 cFlowLayoutPanel.Controls.Clear()
End Sub

Good Luck! …or ask My Brain.

sources or more info:
https://blogs.technet.microsoft.com/markrussinovich/2010/02/24/pushing-the-limits-of-windows-user-and-gdi-objects-part-1/
http://stackoverflow.com/questions/1378668/clearing-controls-from-flowlayoutpanel-not-calling-destructors/

 

Display all PHP Errors and Warnings

ctrl-ZVXWhen debugging PHP I find myself searching again and again for this little piece of code to display the PHP errors. So here it is for future reference…
If you wish to see all the PHP errors and warnings in your script, simply include the following bit of code:

error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1’);

Now, continue to beat your head against the keyboard while you hunt down that missing semicolon or closing parenthesis. Need help, contact My Brain.

VB.Net create mdb with a password

f_3dh_partyWhen developing an application with visual basic, you may want to store data. So you create a database during runtime, for example with the following piece of code, as many websites show on various forums:

Dim strMDBPath As String = "C:\SomePath\MyTestDB.mdb"
Dim cat As New ADOX.Catalog()
 cat.Create(Convert.ToString("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=") & strMDBPath)
 cat = Nothing

Next you wish to protect your data, so only your application can open the database. You google again, and find the following solution:

Dim cn As OleDbConnection = New OleDbConnection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strMDBPath & ";Mode=Share Deny Read|Share Deny Write;"
cn.Open()
Dim cmdpw As OleDbCommand = New OleDbCommand
cmdpw.Connection = cn
cmdpw.CommandText = "ALTER DATABASE PASSWORD [MYNEWPASSWORD] null"
cmdpw.ExecuteNonQuery()
cn.Close()

Unfortunately, now you are stuck with an error you can not solve:
You attempted to open a database that is already opened by user ‘Admin’ on machine ‘YOURPCNAME’. Try again when the database is available.
Creating the database seems to keep the connection open and you cannot close it to execute the password change on an exclusive connection.

The answer and solution is simple: Set the password in the connection string in the first piece of code when creating the database! The attempt to ALTER DATABASE PASSWORD is no longer needed and you can forget about that…
So:

Dim strMDBPath As String = "C:\SomePath\MyTestDB.mdb"
Dim cat As New ADOX.Catalog()
cat.Create(Convert.ToString("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=MYNEWPASSWORD;Data Source=") & strMDBPath)
cat = Nothing

Enjoy this free advice from My Brain!

Phonegap Build changes

dislikeNice. The ever-developing world of IT… or, “how to create more work for each other”.

My Brain develops Apps using a framework called Phonegap. Quick development, easy coding, simple configuration. Until you need to update an exisiting app and you are suddenly faced with the changes that were implemented since the last build…
This time the App did not want to access the Internet anymore… at all! So, Google to the rescue, finding this document with some good clues. I needed #10, which starts out perfectly phrased: “This is sooo new and obnoxious, one can only have pitty on returning developers.” …
bloemetje

Being a developer you have to love puzzles!

Continue reading Phonegap Build changes