Syndicate content

Pages with category Development

  • Once in a while, I need to get the complete list of all the variables available in a PHP piece of code.

    This is done with the get_defined_vars() PHP function. It's very simple, it returns an array of name / value pairs. You can then print that value using print_r() or var_dump().

    That's it!

  • Introduction

    These are common questions for MS-Access users:

    • How can I get the name of the currently logged on user?
    • How can I get the name of the computer the user is working on?

    Both names are available in the Kernel and we can make use of a function declaration to access those names.

    MS-Access Functions

    To determine the name of the current user:

    Private Declare Function GetUserName Lib "advapi32.dll" _
        Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    
    Public Function GetLogonName() As String
        Dim lpBuf As ...
  • What a surprise!

    Today, by mistake, I loaded a URL in gVIM instead of my browser. The mind going silly I guess since I had to type :e<space> to load, as usual...

    And to my surprised, it loaded something. Yes! It actually sent the necessary HTTP request and shown the reply in my gVIM window!

    What does this mean? Well! That means I can check out my websites directly in gVIM to see whether they worked as I expected.

    Fantastic! If you ask me... 8-)


    Well... I knew that a firewall could generate a few problems, but this one, I did not expect!

    I just could not FTP anything from my FedoraCore box. I checked the source system firewall, tweaked all sorts of options in the vsftpd.conf file to no aval.

    The error I was getting was this:

    Mon Aug 11 21:31:57 2008 [pid 12033] CONNECT: Client "192.168.2.11"
    Mon Aug 11 21:31:57 2008 [pid 12032] [alexis] OK LOGIN: Client "192.168.2.11"
    Mon Aug 11 21:31:57 2008 [pid 12034] [alexis] FAIL DOWNLOAD: Client "192.168.2.11", \
                   "{fullpath to}/ubuntu-8.04.1-server-amd64.iso", 0.00Kbyte/sec
    

    I read that permissions could be wrong. Not the case.

    The firewall has some REJECT and DROP rules. None of which would increase when I was getting the FAIL DOWNLOAD message.

    The fact was that the FedoraCore system firewall was not accepting the connection. That's why it would fail. I thus opened the firewall a bit by adding a rule like this:

    -A INPUT -i eth0 -p tcp -m tcp -s 192.168.2.1 -d 192.168.2.2 --sport 20 -j ACCEPT

    Then it finally worked.

    Note that I am using FTP in non-passive mode. This is important because I do not want to open "random" ports on my server. There is nothing to control that in vsftpd as far as I know. Which sucks. My company's FTP server will automatically change the firewall and open ports as required. Once the FTP connection ends, the port is closed in the firewall. This means the port is open only very temporarily.

    Anyway, all that to say that the message FAIL DOWNLOAD blah means nothing when it could be telling you: could not connect to client. At least that way you'd know right away what's wrong.

    Well... I knew that a firewall could generate a few problems, but this one, I did not expect!

    I just could not FTP anything from my FedoraCore box. I checked the source system firewall, tweaked all sorts of options in the vsftpd.conf file to no aval.

    The error I was getting was this:

    Mon Aug 11 21:31:57 2008 [pid 12033] CONNECT: Client "192.168.2.11"
    Mon Aug 11 21:31:57 2008 [pid 12032] [alexis] OK LOGIN: Client "192.168.2.11"
    Mon Aug 11 21:31:57 2008 [pid 12034] [alexis] FAIL DOWNLOAD: Client "192.168.2.11", \
                   "{fullpath to}/ubuntu-8.04.1-server-amd64.iso", 0.00Kbyte/sec
    

    I read that permissions could be wrong. Not the case.

    The firewall has some REJECT and DROP rules. None of which would increase when I was getting the FAIL DOWNLOAD message.

    The fact was that the FedoraCore system firewall was not accepting the connection. That's why it would fail. I thus opened the firewall a bit by adding a rule like this:

    -A INPUT -i eth0 -p tcp -m tcp -s 192.168.2.1 -d 192.168.2.2 --sport 20 -j ACCEPT

    Then it finally worked.

    Note that I am using FTP in non-passive mode. This is important because I do not want to open "random" ports on my server. There is nothing to control that in vsftpd as far as I know. Which sucks. My company's FTP server will automatically change the firewall and open ports as required. Once the FTP connection ends, the port is closed in the firewall. This means the port is open only very temporarily.

    Anyway, all that to say that the message FAIL DOWNLOAD blah means nothing when it could be telling you: could not connect to client. At least that way you'd know right away what's wrong.

    Well... I knew that a firewall could generate a few problems, but this one, I did not expect!

    I just could not FTP anything from my FedoraCore box. I checked the source system firewall, tweaked all sorts of options in the vsftpd.conf file to no aval.

    The error I was getting was this:

    Mon Aug 11 21:31:57 2008 [pid 12033] CONNECT: Client "192.168.2.11"
    Mon Aug 11 21:31:57 2008 [pid 12032] [alexis] OK LOGIN: Client "192.168.2.11"
    Mon Aug 11 21:31:57 2008 [pid 12034] [alexis] FAIL DOWNLOAD: Client "192.168.2.11", \
                   "{fullpath to}/ubuntu-8.04.1-server-amd64.iso", 0.00Kbyte/sec
    

    I read that permissions could be wrong. Not the case.

    The firewall has some REJECT and DROP rules. None of which would increase when I was getting the FAIL DOWNLOAD message.

    The fact was that the FedoraCore system firewall was not accepting the connection. That's why it would fail. I thus opened the firewall a bit by adding a rule like this:

    -A INPUT -i eth0 -p tcp -m tcp -s 192.168.2.1 -d 192.168.2.2 --sport 20 -j ACCEPT

    Then it finally worked.

    Note that I am using FTP in non-passive mode. This is important because I do not want to open "random" ports on my server. There is nothing to control that in vsftpd as far as I know. Which sucks. My company's FTP server will automatically change the firewall and open ports as required. Once the FTP connection ends, the port is closed in the firewall. This means the port is open only very temporarily.

    Anyway, all that to say that the message FAIL DOWNLOAD blah means nothing when it could be telling you: could not connect to client. At least that way you'd know right away what's wrong.

  • It is often that I want to hide a sub-folder so whenever I do an svn status I don't actually see that sub-folder in my list of files that are not available in the repository. It is otherwise quite annoying to see that folder again and again.

    The command to do so uses a property on the parent folder as follow:

  • I have been looking for a way to hide some columns in a datasheet form.

    The main reason to hide columns is to include data that you need whenever the user clicks somewhere, but that data is too technical to be shown. For instance, if you work with QODBC you have the ListID and TxnID to keep around but both look like GUID and thus are much better hidden from an every day user view.

    The reason why I'm bringing this up is simple: whenever you have a field in a form that you want to hide, you click on it, go to the Format properties of that control and select Visible: No, I use that to ...

  • A little while ago I noticed that I couldn't find documentation on how to get the modification time of a file in micro-seconds. The notorious stat() call returns st_mtime defined as a time_t in the documentation.

    Well... The fact is that the structure is really composed of a timeval structure and not a time_t (that applies to all 3 time values: modification, last access, and last status change.) So in fact you can use the name of the field without the last letter and a sub-timeval field as in:

    struct stat s;
    seconds = s.st_mtim.tv_sec; // == s.st_mtime
    microseconds = ...
  • I have a problem with a package that doesn't exactly do what I need it to do so I wanted to recompile it.

    Here are the steps to take to get the source, modify it, recompile the new version, and finally install that new version.

    WARNING

    Before you start, make sure that you make a copy of all the current settings. The installation step is not unlikely going to overwrite any existing changes.

    So... let's assume that the package was well done and thus that the author properly tested that all the necessary build development tools are specified on the corresponding line in the spec file

  • You can actually define an image or a background (with CSS) that fits the area in which is it shown.

    For a simple image use a width of 100%, then the browser computes the height for you.

      <div class="header"><img src="images/background.png" width="100%"></div>

    This code will make the image width match the width of the <div> tag. Assuming the <div> tag fits the screen width, it will show in the full width, stretching as required.

    When trying to do that with a background image in CSS, you want to use the background-size parameter ...

  • Strange thing! I could not find the list of HylaFAX status codes on the net (remember that HylaFAX is used to send facsimile.) They are listed in the faxd/STATUS.txt file for convenience, but I think they ought to be findable by Google so here they are.

    Note that each time HylaFAX sends an error, the message is included. So I guess most people don't really care that much. But it can be useful to know what's what... (when you're a programmer trying to get something done for your company...)

    All the codes are 3 digits, 000 meaning that everything worked just fine (best code ever!) The codes are very similar to the FTP codes and other Internet protocol errors (heard of 404?)

    [toc hidden:1]

  • The following is a list of points one wants to follow in order to create a log in form and the necessary code in the backend.

    Generate a secure Log In form (session id)

    Each time you create a Log In form (or any form if that matters,) you should include a hidden session identifier in it. This will help you prevent users from posting to your server without first loading the form. This alone already prevents a large number of robots from flooding your server with totally useless POST commands1

    • 1. If you know why they do that, let me know because there is really no reason to send totally ...

Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

     

Terms of Site Index

Find the page/content you are looking for with our index.