We are back in Business!!!

Apple Changed our account info!!! Only after 49 days.

Written in Stone

I should have known it would take over a month to change a name and address. Silly me.

Now we are just waiting on one little simple green check mark.

Setup Complete?

Lets hope we don’t go the way of the iQuit guys. Here is their article on the little green check mark.

Aymusoft Project #1 – 69 days in the Making, 49 Days in the waiting.

It’s On!!!

What?!!? I don’t know but it is on. We are at almost at 2 months since the account migration started and apple can’t get somthing trival done. The Rep on the phone said she does not want to promise anything, but I should call back Friday. Well I am gonna call back today (Friday). It probably won’t be a very happy call. So Apple you got about 8 hours to get your act together. Please Do not make start a new company and pay $100 just to release my companies first app.

Here is my new counter.

Aymusoft Project #1 – 68 days in the Making, 48 Days in the waiting.

I rather fight 100 Pissed Off Dragons with my team…

I rather fight 100 pissed off dragons with my team’s hands tied behind our backs then let some one I don’t know do something trival when this product depends on it.

courage

We are now at one month and the folks at apple can’t get there act together enough to change a name and address field.

COME ON APPLE!!!

I was not gonna blog about this but I will now.

avoid really dumb OpenGL texture leaks

When you allocate memory for OpenGL textures, something to the tune of glGenTextures(1,&texture);, don’t don’t DON’T forget to free that memory with a glDeleteTextures(1,&texture);. Forgetting to do this tiny little call will result in memory leaks all over the place. Please, spare yourself the sleeplessness.

yes, virginia, you CAN do regular expressions in C/C++

You say you want a regular expression?  Well, you know, you don’t have to install Perl.

There’s a few ways you can go about using regular expressions in your C / C++ code.

  1. The POSIX C regex library.  This presumes of course you are running on a Unix-ish system, e.g. Linux, Mac OSX, iPhone, BSD, etc.
    #include <regex.h>
    regex_t re;
    const char* re_string = "m[Aa]t?ch.*";
    if(regcomp(&re, re_string, REG_NOSUB) != 0){
      std::cerr << "Invalid regular expression" << std::endl;
      return;
    }
    if(regexec(&re, "mAchzzzzaaaa!!!!oneone", (size_t)0, NULL, 0) == 0)
      std::cout << "Found a match!" << std::endl;
    
  2. The Boost Regex POSIX-like API.  This is a C wrapper to the Boost Regex library, which allows you to use the library with POSIX regex calls.
    #include <boost/regex.h>
    // otherwise use just as you would the POSIX lib
  3. The Boost Regex C++ API, straight no chaser.
    #include <boost/regex.hpp>
    boost::regex re("m[Aa]t?ch.*");
    if(boost::regex_match("mAchzzzzaaaa!!!!oneone", re))
      std::cout << "Found a match!" << std::end;

This is but a taste of what’s available.  Peep the POSIX regex API and the Boost Regex Documentation.  Note, Boost Regex is one of only a handful of the Boost packages that needs to be explicitly built and linked with your code.

get info on a file without opening it from C/C++

If you need to get info about a file without opening it, you can use <sys/stat.h> to do so.

I needed a way to test the existence of a file. Version 1 called fopen and tested for NULL, but this also meant some nasty ifs and fclose logic.

Here’s the better way:


#include <iostream>
#include <cerrno>
#include <sys/stat.h>
struct stat fileInfo;
const char* filename = "myFile";
if(stat(filename, &fileInfo) != 0){ //error
  if(errno == ENOENT){
    std::cerr << "File " << myFile << " doesn't exist" << std::endl;
  else{ //any other error
    std::cerr << "Error getting info on file " << filename << ": "
              << strerror(errno) << std::endl;
  }
}

File existence is but one of the few things you check for.  Just be careful what you check for though, as many of the attributes in struct stat are Unix only.

See stat()’s documentation for more details.

‘auto-release pool’ type behavior in C++ with shared_ptr

With boost’s shared_ptr and standard contaniers, ‘auto-release pool’ (as seen in much Obj-C code) type structures can created in C++.


#include <boost/shared_ptr.hpp>
using boost::shared_ptr;
#include <vector>
class A{...};
typedef shared_ptr<A> A_ptr;
...
vector<A_ptr> vec_of_a;
for(int i = 0; i < 10; i++){
  A_ptr p(new A());
  vec_of_a.push_back(p);
}
...
// do stuff with vector
...
vec_of_a.clear(); //automagically calls delete on all A_ptrs in vector

To avoid having to call vector::clear(), you can make the vector itself a boost::shared_ptr or boost::scoped_ptr; this will cause the vector itself to be automatically reclaimed, along with its contents.

See Boost’s Smart Pointer Documentation for more info.