Skip to main content.
September 29th, 2008

Mini Searches with Answers

These are links associated with recent searches I’ve done. They’re not difficult enough to warrant to their own posts but still super useful.

How to show loading spinner in jQuery? - Stack Overflow
$('#message').load('index.php?pg=ajaxFlashcard', null, showResponse);
showLoad();

function showResponse() { hideLoad(); … }

py2exe - generate single executable file - Stack Overflow
PyInstaller will create a single .exe file with no dependencies; use the –onefile option. It does this by packing all the needed shared libs into the executable, and unpacking them before it runs

rawdog
Ready made Python RSS aggregator

MySQL max index length prefix
index length prefixes can be up to 1000 bytes long (767 bytes for InnoDB tables) for indexes with blob or text fields.

Make Python Scripts Droppable in Windows « mindless technology
Drag a file onto a Python script icon and let that script recognize the file.

Clone Digger | Overview |
Clone Digger aimed to detect similar code in Python and Java programs. The synonyms for the term "similar code" are "clone" and "duplicate code".

Tags: , , , , , , , , , , , , ,

Posted by Greg Pinero (Primary Searcher) as Uncategorized at 5:00 AM UTC

No Comments »

September 17th, 2008

Mini Searches with Answers

These are links associated with recent searches I’ve done. They’re not difficult enough to warrant to their own posts but still super useful.

Firebug Lite
Use firebug in any browser?

Program-Nix: Python hacks: stopping gnome-screensaver while watching videos

Free backup program for Windows
Jody likes it

strerror(errno) : strerror « string.h « C / ANSI-C
How to debug a file not opening in C.

#include <stdio.h>
#include <string.h>
#include <errno.h>

int main ()
{
FILE * pFile;
pFile = fopen ("unexist.ent","r");
if (pFile == NULL)
printf ("Error opening file unexist.ent: %s\n",strerror(errno));
return 0;
}

epubtools -  Epub Tools
epub.py : a simple python script that will take a TXT file and convert it into an .epub file for using on an iPhone ebook reader.

Disqus API Client in Python - Webmonkey

Tags: , , , , , , , , , , , , , , , , ,

Posted by Greg Pinero (Primary Searcher) as Uncategorized at 4:59 AM UTC

No Comments »

September 6th, 2008

How to Open Large Files in C

I was using some code like this to open a 2.4GB file in my 32 bit Ubuntu installation:

#include <stdio.h>
#include <string.h>

int main ()
{
  FILE * pFile;
  pFile = fopen ("unexist.ent","r");
  if (pFile == NULL)
    printf ("Error opening file unexist.ent\n";
  return 0;
}

But I kept getting a null pointer back.

The first step I did was try to get a more detailed error message. It turns out there’s an errno standard lib that gives you error messages about files. I implemented the changes recommended by this page:

#include <stdio.h>
#include <string.h>
#include <errno.h>

int main ()
{
  FILE * pFile;
  pFile = fopen ("unexist.ent","r");
  if (pFile == NULL)
    printf ("Error opening file unexist.ent: %s\n",strerror(errno));
  return 0;
}

And I got this message:
Value too large for defined data type

So thanks to advice from the C irc chat room, I switched to using fopen64, and everything worked!

#include <stdio.h>
#include <string.h>
#include <errno.h>

int main ()
{
  FILE * pFile;
  pFile =fopen64("unexist.ent","r");
  if (pFile == NULL)
    printf ("Error opening file unexist.ent: %s\n",strerror(errno));
  return 0;
}

Posted by Greg Pinero (Primary Searcher) as Other at 4:54 PM UTC

No Comments »