Tag Archives: Programming

Python Editors and Auto Completion

Just tested an editor called “PyCharm”, recommended for its auto-completion feature, and discovered it can’t complete “m= hashlib.sha1()” (it offers hashlib but not sha1)

In fact, it couldn’t auto-complete urllib.open either. Neither can IDLE(Python’s built-in editor).

Looking at https://wiki.python.org/moin/PythonEditors there are tons of editors, am I supposed to try every one of them? LOL

Edit: PyCharm actually completes sha1 from m= hashlib.sha1, but not m.Something(update, digest, etc)

Leave a comment

Filed under Uncategorized

Schizophrenia Roots(Logic)

(From forum.schizophrenia.com)

Suppose that I were to write a program that decided whether something was X, that program would return YES or NO. That program is what computer scientists call a decision function.


So I ask my friends Bob and Joe to also make programs to identify data

Joe makes Is_Picture_A_Rose(Picture) and Bob makes Is_Picture_A_Dog(Picture)

So we have a “parallel process of creating analysis functions”.

However we can’t just add the results statistical significance, for example, I have 10 pictures, 3 of them are flowers and 2 flowers are roses.

I can’t get impressed with getting a positive for roses(20%) if I already got a positive for flowers(making the chance 66%).

That means we need a “process of determining which tests affect which tests”.

I think schizophrenia is caused by the two processes not working well together, you have too many tests for too little knowledge of their interoperability, hence you get lots of false positives(people look like other people, places like other places).

The medicine probably works by slowing down the first process(creation of analysis tools). You could increase the second processes effectivity by being exposed to:
diverse data(not getting obsessed with a single subject/place)
high quality dreaming(ear plugs, country side, nothing happening in the vicinity of the room, long time of dreaming)

The relation between finding patterns and the immune system could explain why schizophrenics also have false positives(signs of infection) in their blood.

If we could find a drug that increased the dreaming phase of sleeping or somehow helped the second process I wrote about we could get closer to a “cure”.

Leave a comment

Filed under Uncategorized

Too much focus

I think what might be hindering my ability to publish a popular product is that I end up being too perfectionist.

For instance, I wanted to make a program that showed an image downloaded from an URL.

Now, instead of just showing it, I decided that I needed to store it so that I didn’t download it every time. Then I realized that two images with the same name would end up overwriting each other so I added a number N if the image of number N-1 already existed, then I realized that adding a number would hinder the user from using that file(because the extension gets modified)… you can see? It’s not that I’m doing things that are not needed, a decent program does everything I just stated, but given that I have only one employee(myself) I should focus on that later.

This is a generalization of that “design first” principle. Do the FUN stuff first. Do the rest later. There is a trade-off, obviously, if you do the FUN stuff first you end up without backwards compatibility. A small price to pay perhaps?

Leave a comment

Filed under Uncategorized

Creating an AxWindowsMediaPlayer programmatically

below Public Class Form1:

Dim AxWindowsMediaPlayer1 As New AxWMPLib.AxWindowsMediaPlayer


Inside Form1_Load:



Leave a comment

Filed under Uncategorized

How to draw a hexagram

    Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

        Dim myPen1 As New Pen(New SolidBrush(Color.FromArgb(255, 0, 0, 0)), 10)

        Dim Tri1Point1 As New Point((Me.Width / 2) – Me.Height / 6, (Me.Height / 3) + (Me.Height / 18))
        Dim Tri1Point2 As New Point((Me.Width / 2) + Me.Height / 6, (Me.Height / 3) + (Me.Height / 18))
        Dim Tri1Point3 As New Point((Me.Width / 2), ((Me.Height / 3) * 2) + (Me.Height / 18))

        e.Graphics.DrawPolygon(myPen1, {Tri1Point1, Tri1Point2, Tri1Point3})

        Dim Tri2Point1 As New Point((Me.Width / 2) – Me.Height / 6, ((Me.Height / 3) * 2) – (Me.Height / 18))
        Dim Tri2Point2 As New Point((Me.Width / 2) + Me.Height / 6, ((Me.Height / 3) * 2) – (Me.Height / 18))
        Dim Tri2Point3 As New Point((Me.Width / 2), (Me.Height / 3) – (Me.Height / 18))

        e.Graphics.DrawPolygon(myPen1, {Tri2Point1, Tri2Point2, Tri2Point3})

    End Sub

The code above is Public Domain


Leave a comment

Filed under Uncategorized

VB rocks

When it comes down to GUI and cryptography, but sucks in everything else. I have a huge program and I’m not close to finishing my header-adding program, I would have already finished with few lines in python. Given that most users won’t need to add headers(only “webmasters”) I will move to python for this part. The worst part is that I don’t even know whether VB.net strings are binary-safe. That would easy my life somewhat.

Leave a comment

Filed under Uncategorized

PHP(ish) function for visual studio 2010

Explode function in VB:


Private Function phpishExplode(ByVal del As String, ByVal s1 As String)
Dim returnValue As New ArrayList

Dim lastMatchIndex As Integer = 0
For i As Integer = 0 To s1.Count – del.Length
Dim match As Boolean = True
For i2 As Integer = 0 To del.Length – 1

If s1(i + i2) <> del(i2) Then
match = False
Exit For
End If

If match = True Then
returnValue.Add(s1.Substring(lastMatchIndex, i – lastMatchIndex))
lastMatchIndex = i + del.Length

End If
returnValue.Add(s1.Substring(lastMatchIndex, s1.Length – lastMatchIndex))

Return returnValue
End Function

Leave a comment

Filed under Uncategorized