TinyURL widget - shorten your URL's for free!

Enter a long URL to make tiny:

Tuesday, July 28, 2015

How you know your Free or Open Source Software Project is doomed to FAIL

Wednesday, July 15, 2015

Fix your drone; fix landing gear.

Ok so I bought a Horizon hobby Blade 180QX quadcopter and flew it for a few days  before  I smashed it.

The landing gear is too weak for the height this quadcopter falls from.  The major complaint I have is that without cross bracing it buckles if the quadcopter lands sideways and bends in the skids as shown in photo below.

To fix it. You can replace it which is a $5 part.  But then that doesn't change the outcome.
 You want landing gear to absorb the shock but not fold up easily. You will have more down time and less flying with weak original landing gear.

 Notice how bent in the gear are from original to new ones. I went to Michaels here in Chandler Arizona and bought 2 foot 1/8 th inch dowells and some loctite.  I cut two braces and glued them to a new landing gear.  Dry and then install to underchassis.
 Scissors work fine to score and snap dowells and clean the edges.
 Gelled loctite works fast so you can set both and movertical on.
 There the cross braves are added to mske landing transfer more force without snapping the gear.



Monday, May 25, 2015

How to point to a statically compiled variable aiming at dynamic heap object with double indirection and get the value not the address: use a surrogate local variable



typedef struct list_t
{
    //! \var OpenGL-friendly current item count as large integer
    GLuint item_count;   
    //! \var OpenGL-friendly current size_t of total list.
    GLsizei current_max_size;
    //! \var growable - the type of list: growing or not ; in most cases we want growing
    char growable;
    //! \var items  generic variable items without type
    void **items;
    //! \var names variable "items without type"s' names
    char **names;   
}list_t;


void * generic_create_object()
{
    int ** p = malloc (sizeof(int **));
   
    return p;
}
     
Say you statically create a local variable  at compile time

    list_t  test_list;

then make dynamic variables on the heap and aim them into the static structure
 int ** c = generic_create_object();   
        list_add_item(&test_list, c, name);

 How does one get the pointed to value in test_list.items[i]? Not the address?

If you call test_list.items[i] you will get the address.



Simple. make a temp variable in the right syntax and equivalence operation it.

 int ** ptr = test_list.items[i];

printf("list index:%d addr:%u value: %u\n", i, &(test_list.items[i]), **(ptr)  );

Now the pointed to pointed to value will appear properly and the dereference   next to the address will get the right address value.

You can do it by making a temp variable in a local loop like


    int i = 0;
    for (i = 0; i < test_list.item_count;  i ++ )
    {
        int ** ptr = test_list.items[i];
        printf("list index:%d addr:%u value: %u\n", i, &(test_list.items[i]), **(ptr)  );
        if ((i > 5) && (**ptr != 13))
            return -1; // failed to have the right value
    }
and then point at it properly to get the value not the reference. It will be a stack register type cast in the proper variable. It can then be optimized and the compiler will probably remove it.


Complete code:

/***\file test-list.c   *********************************************************
                          
 H.File   $Header:  $
    
 Date Started: -2015

 Date:     $Date:  $
 *
 Author:  $Name:   $

 Purpose:  The list "object" for object-oriented C programming.

 Version:  $Id: doublerow.h,v 1.2 2007/08/24 14:27:29 cvsuser Exp $

 Revision: $Revision:  $
 *
 *
 Log:   $Log:   $
***************************************************************************/

 /*
 * For information on the open science consortium, go to
 *
 * openscienceiscool.blogspot.ca/2014/12/open-science-consortium-beginning.html
 *
 * */

#include "list.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

// This test program is for the underlying list items that are used by the object data ..
// The goal is to understand how this works and then how the second tier functions use it.
/*!
 * typedef struct list_t
{
    //! \var OpenGL-friendly current item count as large integer
    GLuint item_count;   
    //! \var OpenGL-friendly current size_t of total list.
    GLsizei current_max_size;
    //! \var growable - the type of list: growing or not ; in most cases we want growing
    char growable;
    //! \var items  generic variable items without type
    void **items;
    //! \var names variable "items without type"s' names
    char **names;   
}list_t;
 * */

void * generic_create_object()
{
    int ** p = malloc (sizeof(int **));
   
    return p;
}

#define DE
int main (void)
{
    list_t  test_list;
   
    char * name;
   
    int *     pointer;
    int *     pointer2;   
    int      a = 5;
    int     bb = 13;
   
    pointer = &a;
    pointer2 = &bb;   
    name = malloc (sizeof(char)*20);
   
    strcpy( name, "TEST\n");
       
    // makes a list of 10 items  to start that is growable            
    list_make(&test_list, 10, '1');
   
    int ** b = generic_create_object();
    int ** c = generic_create_object();   
    int ** d = generic_create_object();   
   
    *b = pointer;
   
     *c = *d = pointer2;
   
    // add items to the list.
    list_add_item(&test_list, b, name);
    list_add_item(&test_list, b, name);   
    list_add_item(&test_list, b, name);       
    list_add_item(&test_list, c, name);       
    list_add_item(&test_list, c, name);       
    list_add_item(&test_list, d, name);       
    list_add_item(&test_list, d, name);       
    list_add_item(&test_list, d, name);       
    list_add_item(&test_list, d, name);       
    list_add_item(&test_list, d, name);       
    // test the grow function
    list_add_item(&test_list, d, name);           
   
                       
    printf( "number of max items count: %d \n", test_list.current_max_size);   
    // show all the indices
    list_print_indices(&test_list);
    //
    printf( "number of list items count: %d \n", test_list.item_count);
    //    simple print out
    list_print_items(&test_list);
   
    // print out all values
    int i = 0;
    for (i = 0; i < test_list.item_count;  i ++ )
    {
        int ** ptr = test_list.items[i];
        printf("list index:%d addr:%u value: %u\n", i, &(test_list.items[i]), **(ptr)  );
        if ((i > 5) && (**ptr != 13))
            return -1; // failed to have the right value
    }
   
   
    // testing the delete functions
    list_delete_all(&test_list);
    // succeed and return 0 success other wise failed beforehand with a 1
    return 0;
}




Wednesday, April 8, 2015

ERROR: Mimetype entry missing or not the first in archive EPUB


When you extract files from an EPUB, fix them and update the archive, that changes the ordering inside.

When you try to submit a revised EPUB, you will get this error:

ERROR: Mimetype entry missing or not the first in archive

To fix it, extract all content and make a new archive with an UNCOMPRESSED mimetype file FIRST like so in Linux/Unix/Apple:

zip -X0 book.epub mimetype

then remove the mimetype from the contents and add the rest like this:

zip -X8Dur book.epub *

That should refresh the order and compress all the other files.

Monday, April 6, 2015

Blogger can show animated GIF of about 12MB

This Animated GIF is about 12 MB.


Correct Video Sequence Names in OpenShot

I used this post to make this animated GIF:



And this longer one



My previous posts dealt with how to make an animated GIF.

I use openshot to convert a video sequence into a image sequence.

There is a problem with the default naming sequence for openshot.  If you leave it as default it uses the printf number format:

%d

which then puts  __1.png

besides    _100.png

in the sequence.


It is set in the export menu






Instead, increase the number format to have say 4 digits which will be zeros preceding the number like this

%4d

instead of

%d

It is using good ol C printf format so this will make the right sequence like so:








Saturday, April 4, 2015

How to make Animated GIFs Part 2

Ok;


This summarizes the work in past posts, I have made an animated GIF from Call of Duty: Advanced Warfare and I used this post:

http://techdiagnosys.blogspot.ca/2015/04/bash-shell-scripting-read-all-files-in.html


to remove every nth file from a series of PNG files and then I used ImageMagick to convert them into an animated GIF with a reasonable loop speed.

I use this post to convert:

http://techdiagnosys.blogspot.ca/2015/04/how-to-make-animated-gif-using-image.html

I could iterate the .png file reduction by every 3, 4 or 5 files recursively until down to the right size.

I know that blogger can upload files up to 45MB animated GIFs since that's what this one above is.

I hope this helps you and most likely me when I forget how to do this.