The Open Questions Page

Want us to answer one of your questions?  Post it here as a comment and we’ll try to answer as soon as possible.

Thanks for reading

~ab

11 Responses to “The Open Questions Page”

  1. Bill Says:

    So ab, you must have heard about the new Google phone – Android. Even though it’s not available yet there are some people who have them – Google employees. I like the idea that you can buy the phone over the internet and sign up for service with any provider. I’m up for renewal with my provider to get a new phone at a discount if I sign a 2 year contract. How will Google compete? Any thoughts yet?

    Bill

  2. Jason Says:

    So I am an aspiring blogger these days and I was wondering if you could recommend a plugin or two for compiling site visit statistics?

  3. Steve R Says:

    Didn’t get a reply about newlines in CLGemail, so decided to do it myself. Here’s the result:

    Imports System
    Imports System.Net.Mail

    Public Module Module1
    ‘Original CLGmail was posted on justanaskterisk.com
    ‘ modified 2/2010 by SR to allow choice of separator characters
    ‘ and newlines in the body of the message and add some
    ‘ error checking and recovery
    ‘ invoke as
    ‘ CLGmail +username+password+server+port+emaildest+Subject+body
    ‘ where the “+” used to separate the fields in the command
    ‘ line is any command-line legal character (such as +#^)
    ‘ that won’t occur in any field except the body (where it will be
    ‘ replaced by a newline (LF or CR/LF).
    Sub Main()
    ‘get instance of system.net.mail.smtpClient (which does the work
    ‘ of sending the encoded email)
    Dim SmtpMail As New System.Net.Mail.SmtpClient

    ‘set up variables before use
    ‘give initial null values to make compiler happy
    Dim username As String = “” ‘including the @domain.com (e.g. user@gmail.com)
    Dim password As String = “” ‘case sensitive
    Dim emaildest As String = “” ‘message receipient’s address
    Dim Subj As String = “” ‘Subject of Mail
    Dim Body As String = “” ‘Message
    Dim Server As String = “” ‘Server Name; smtp.gmail.com for gmail
    Dim Port As String ‘ normally 587 for Gmail
    Dim commandparts() As String = {“”, “”} ‘array to hold command line parts

    ‘set up defaults
    Dim splitchar As String = “,”
    Dim thiscommand As String = Command() ‘default to command line parameters
    Dim lastcommandpart As Integer = 2
    If thiscommand.Length < 5 Then
    thiscommand = "+SMTP command not provided yet"
    End If

    'Enclosed within Try-Catch block to process errors
    Try
    'we need 7 parameters to send mail (#0 to #6)
    Do Until lastcommandpart = 6
    'allow user to abort if parameters not available
    If thiscommand.Length < 5 Then
    Throw New System.Exception("SMTPmail bad parameters")
    End If
    'make first char of data string the split character
    splitchar = Left(thiscommand, 1)
    thiscommand = Mid(thiscommand, 2)
    'we know lf can't be in command line, so use it to ignore body for now
    thiscommand = Replace(thiscommand, splitchar, vbLf, 1, 6)
    commandparts = thiscommand.Split(vbLf)
    lastcommandpart = commandparts.GetUpperBound(0)
    ' if number of parts 6, allow user to fix
    If lastcommandpart 6 Then
    thiscommand = InputBox(“Expected 6 parts but found ” & CStr(lastcommandpart) & vbCrLf & “SMTP string?(lf-splitchar,0user,1paswd,2server,3port,4to,5sub,6body”, thiscommand)
    End If
    Loop
    ‘put command parts into individual variables for clarity of reading
    username = commandparts(0)
    password = commandparts(1)
    Server = commandparts(2)
    Port = commandparts(3)
    emaildest = commandparts(4)
    Subj = commandparts(5)
    Body = commandparts(6)
    ‘split body into lines if required
    Body = Body.Replace(splitchar, vbCrLf)

    ‘Set the SMTP object’s properties
    Dim mycredentials As New Net.NetworkCredential(username, password)
    SmtpMail.Host = Server
    SmtpMail.EnableSsl = True
    SmtpMail.Port = Port
    SmtpMail.UseDefaultCredentials = False
    SmtpMail.Credentials = mycredentials

    ‘send the message
    SmtpMail.Send(username, emaildest, Subj, Body)
    ‘ if it works, we’re all done
    Catch ex As Exception
    ‘if there was an error, tell calling program about it
    MsgBox(“Delivery Failure: ” & ex.Source & ex.Message)
    MsgBox(“SMPTP data was:” _
    & vbCrLf & “username ” & username _
    & vbCrLf & “password ” & password _
    & vbCrLf & “Host(server) ” & SmtpMail.Host _
    & vbCrLf & ” Port ” & SmtpMail.Port _
    & vbCrLf & “emaildest ” & emaildest _
    & vbCrLf & “subject ” & Subj _
    & vbCrLf & “body ” & Body)
    End Try
    End Sub
    End Module

  4. ab Says:

    Sweet. Thanks for sharing. I’d be happy to update the real one with yours (as soon as I get a chance to test). Would you like to contribute to it officially?

    ~ab

  5. ab Says:

    Hi Jason,
    I’d be happy to recommend WP plugins for stats. For just the basics, I use WP.com stats (created originally for wp.com). For advanced stats, I use Google Analytics (I know it’s not a plugin but it’s amazing) combined with Headspace, a SEO plugin. Headspace puts my google analytics code in all the right places. I have also dabbled with StatPress, which I find a bit confusing but very powerful.

    Hope that helps!
    ~ab

  6. Hugo Says:

    Hello,
    it’s possible to use CLgCAL as standalone in command line?
    like:
    c:\CLgCAL.exe user pass subject

    is possibel, please, could you explain me how to do it? I think i’m doing something wrong because its always crashing. Not sure what i’m doing wrong.
    If i use win+G shourtcut, on the pop up text, I type the event and everything works fine, if I use ms-dos and CLgCAL.exe alone, it’s not working, maybe i’m passing the wrong parameters.
    can you give me an exemple please.

    Thanks!

  7. ab Says:

    Hi Hugo,
    The format is CLgCAL.exe username _ password _ statusupdate. To be honest, I can’t remember why I added the extra spaces (” _ ” rather than “_”) but once you put it in this format, you should be able to use the command line without issues. I hope this solves your problem, let me know if it works!

    ~ab

  8. Hugo Says:

    Hello,
    that worked perfect!
    Is the .exe open source? If yes, can you share the source please?
    If not, no problem, i understand.

    Thanks for your help!

  9. ab Says:

    Sure Hugo – here is the source. It’s super easy and this is really all you need.

    Imports System
    Imports System.IO
    Imports System.Collections
    Imports System.ComponentModel
    Imports Google.GData.Client
    Imports Google.GData.Extensions
    Imports Google.GData.Calendar
    Module main
    Public Sub Main()
    Dim vars() As String
    Dim myService = New CalendarService("Cal")
    Dim myEntry = New EventEntry()
    Dim postUri = New Uri("http://www.google.com/calendar/feeds/default/private/full")
    vars = Command.Split("_")
    Dim username As String = vars(0)
    Dim password As String = vars(1)
    Dim quickadd As String = vars(2)
    myService.setUserCredentials(username, password)
    myEntry.QuickAdd = True
    myEntry.Content.Content = quickadd

    myService.Insert(postUri, myEntry)
    End Sub
    End Module

  10. Dave Says:

    Hi there, I’ve recently gotten into a variation of todo.txt called “task” (see here: http://taskwarrior.org/projects/show/taskwarrior/) a command line task application which keeps all your tasks in one text file including project headings, tags etc.., syncing across computers with dropbox. I have a cell phone with sms and email ability and would love to be able to send a one-line entry to my text file while I’m away from a computer, e.g. “t add get bigger pump pro: pond +home”. I’m not smart enough to install/use fetchmail, and was envisioning appending a text line via email or sms to some sort of online text file, then pulling out all the lines with a script and sending them to a terminal (using autokey – I’m on Ubuntu, otherwise I’d use autohotkey) to enter them into the todo.txt file once I was back at my computer.

    How would you approach such a task?

  11. ab Says:

    Hi Dave,
    As I understand your question – you want to email or text in a task and then have it updated on your linux txt file. You say you would use Autohotkey, but can’t because of linux?

    Have you tried python? If I were to attempt this, I’d probably write a python script to check a gmail account, grab the most recent email, take the subject line and append it to my text file…

    Ignoring the “do this every X seconds/minutes” part of the code, the basic idea would be something like:

    import imaplib
    import re
    import string

    account = "justanasterisk"
    password = "password"
    m = imaplib.IMAP4_SSL('imap.gmail.com', 993)
    m.login(account,password)
    #login to the mailbox
    m.select('INBOX')

    #now that you have the inbox selected, get the first message's header:
    val = m.fetch(startstr, '(BODY[HEADER] FLAGS)')
    header = val[1][0][1]
    subre = re.compile(r'Subject:.*\r')
    subre2 = subre.search(header)
    subject = subre2.group()
    #now that you have the subject, append that to your text file
    myfile = open("todo.txt", 'w')
    #this line is probably wrong:
    myfile.write(subject) #CHECK THIS BEFORE YOU TRY IT...

    Let me know if you actually try this, I’d be curious to see if it works :)

    Good luck!
    ~ab

Tell us what you think!




Get Adobe Flash playerPlugin by wpburn.com wordpress themes