Mar 31, 2012

Diamonds in a pile of shit vs shit warped with a fancy golden paper

Neverthe lesss tThere is different types of bullshit:

pure shit in a systematic way ( ISO of of the protein milk factories)

part of the data without of anallysis ( data without analysis.., whats the usua care, what is the intervention.., money wasted for nothing)

bla bla bla for nothing ( how to lie with statistics

---
my self : put the diamonds link them with shit


Mar 22, 2012

Copy a pdf table into excel

In the last couple of weeks, I was searching for some evidence in the literature related to resource usage in telemonitoring. And part of this job consisted on copy pasting table from PDF(I recommend using Foxit reader instead of Adobe reader ) to word. And believe me it’s not that as easy as you might think. In some cases, MS word can do most the work by converting the text into a table ( option 1), but in some cases the formatting of the original data is so distorted that even word cannot sort it. That why, I have written the following VBA code (option 2) to be added to excel (It could be useful in certain circumstances, and easily tweaked according to the original data).


Option 1 : use word convert text to table option :


Option 2
: Add this vba script replacing the space by comma ( from the end of the line)

Function TestingRev(inputStr As String) As String

Dim nbCol As Integer
nbCol = 4

Dim revInputStr As String
revInputStr = StrReverse(inputStr)

Dim ret As String

ret = Replace(revInputStr, " ", ";", 1, nbCol - 1)

TestingRev = StrReverse(ret)

End Function

- Copy paste the result in notepad and save it as *.csv file
- Open the csv file in excel and save it as

Feb 25, 2012

Il faut vraiment changer les elections presidentielles

video des election des souris:










Dans son article " Les fautes faite par les politiciens (Mistakes Politicians Make)" , Professeur en politique a l’université de Princeton, défend l' hypothèse que la cause principale pour laquelle les politicians commaient et continuerons a commettre les meme erreurs les uns comme les autres c'est la pression pour les réélections. Même si dans son articles ils n'abordent pas le problème des lobby d'argent qui sont essentielle pour touts les candidats. Je partage son avis que tous les politicitiens se sent obliges de prendre des mesure populistes et le court terme pour assurer leur reecltion.
J'ai toujours admiré le fonctionnent du régime chinois (le fonctionnement et non pas le régime) ou tout les présidents sont des cadres / ingénieurs pragmatiques qui sont élues pour des objectifs et non pas pour des slogans et il savent qu'a la fin de leur mandats ils seront évaluer selon ces objectives; par exemple ils se soucis que a la croissance qu'a des problèmes électoraux et n’hésite pas a prendre des mesures non populaires si ces mesures leur permette accomplir leur objectifs. Imaginer la réaction, si un président occidentale déclare un jour qu il étudie la possibilité d'appliquer la politique du fils unique dans son pays, juste le fait d'annoncer une telle idée serait équivalant a un suicide politique pour lui et son parti aussi.

J'aimerais conclure par un petit passage sur le crise grecque qui ma marqué:
Depuis le premier plan de « sauvetage », la dette grecque est pourtant passée de 263 milliards en 2008 à 355 milliards en 2011. Le PIB s’est effondré de 233 milliards à 218 milliards. Le chômage a explosé de 8% à 18%. La récession est massive, et avec un taux d’intérêt officiel à 32%, il va de soi que la Grèce ne peut absolument plus se financer sur les marchés financiers. L’Euro tue la Grèce, mais la Grèce doit coûte que coûte demeurer dans l’Euro !


puis ce que je crains que la même situation peut se reproduire dans d'autre pays notamment le notre si on continue a elire nos presidents, senateurs et deputes de la meme facont

Feb 3, 2012

Dynamic programing and the knapsack problem.

As I always forget the structure of a dynamic algorithm, this note is a reminder of the key idea behind the dynamic knapsack programming.

The knapsack problem is when we consider a large set of object having different size and value, knowing that the knapsack have a fixed size (S) the objective is to pack the subset that give the highest value ( to simplify the problem , lets say it Thief that have to choose which valuables to put in his bag)

Let vi be the value of the object i and si the size of the object i.

1- The first key idea is that the items are sorted by efficiency with is the price of an item divided by its size , in a decreasing order (most efficient to the worst efficient).

P1/s1 >= p2/s2 >= p3/s3 .......

2- The second key idea is related to space of solution, where the set of object to be considered is incremented gradually, following the order of the efficiency of objects. So N1={obj1} , N2={obj1 , obj2} .....

3- And the main idea to solve the sub knapsack problem of the size Z <= S and considering the sub space of solution Ni we need 2 values:

· The max benefit that we can get from the knapsack Z considering the for the subset Ni-1

· The max benefit that we can get from the knapsack (Z-si) considering the for the subset Ni-1

Therefore, if the max benefit from the knapsack Z-si added to the value pi is higher than knapsack Z for the solution space compose from the subset Ni-1, then the solution would be to add the item i to the set of object selection in the knapsack Z-si. If not the solution for the intermediate knapsack Z / Ni would be the solution knapsack Z / Ni-1.


......

Jan 16, 2012

Comments on TED videos

I usually check ted videos but as I have a weak memory with name it's not easy give the link to somebody else , so I decided that for each talk that I consider important to add a link with a small discription:

Wirless devices , patch to monitor , vitals signs , sleep, BR, .... He is part of the Wireless medical institue.


Jun 13, 2011

Configure Visual studio C++ 2008 express edition with IBM Ilog Cplex and Concert libraries

I posted a couple of days ago , a Makefile for C++ project using IBM-ILOG cplex solver and the Concert library. So I thought I should do the same thing for the windows guy. First you ll need a Visual studio, i recommend VS 2008 C++ express edition, why speeding your money on a non worthy C++ editor, ( I ll try to configure netbeans on windows to bypass the VS )
First you need to create an empty C++ application

1 - Then you go to your project Menu and choose properties.




2 - In the configuration manager, change the configuration from debug mode to Release ( If you are going to use concert ; you have to program without debugging as it uses macros incompatible with the debug flags that the compilor add to your code), that the price that you have to pay with concert it's a double eddged sword. You write less code, but if you have an error you have to start guessing and trust me you could loose a lot of your time guessing and trying to figure out what went wrong.





3- You need to change compiler flags ( aka C/C++ in the configuration settings)

In order to use any C++ library you need the library itself .lib and the Header files (*.h or *.hpp). The lib 's header files indicate the compiler to the content of the lib file( a sort of Table of content). So when you compile your code, the compiler only check if the function you are calling figures in the header files and that you are using the proper argument to make the call. After the compilation of your cpp files into object files , the assembler / linker will link your compiled code (*.o) with acttuel function in the lib and produce the executable.

In our case we need to tell the compiler the path to the header files for cplex and concert libs .So you will need to add the path in the Additional Include Directories. you can use the small button on the path line to choose via explorer the directories. ( there is two include folders that you need: the cplex include folder and another include folder in the concert folder )




4-Disable the debug information format ( It could be that it's not required any more)




5 -Add IL_STD to the preprocessor definition ; it's the equivilant of -D in gcc , you can a define IL_STD at begining of your main file; i didn't check the files in the cplex include directory to see exactly what is the effect of this option . And also It could be that its not used any more




6-I don't remmeber why, but I usually choose MT as a Runtime library and in the next section I choose the library in the in stat mta ( I could be wrong , may be you can check if there is any impact on the speed of the execution )




7 - After the compilation you need to assamble your code. The linker wil assemble all the .o files into an executable and will need the libraries that you are calling to make the final excutable. You need to add to the Additional Dependencies in Input section of the linker , the exact location of you cplex library and concert + winsoc32 lib

In my case I had to add the following line :
wsock32.lib
C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\lib\x86_windows_vs2008\stat_mta\cplex122.lib
C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\lib\x86_windows_vs2008\stat_mta\ilocplex.lib
C:\ILOG\CPLEX_Studio_AcademicResearch122\concert\lib\x86_windows_vs2008\stat_mta\concert.lib



Tip Use ( use the windows explorer aka my computer ) , browse to the folder in question then right click on folder hiearchy satuts bar and copy the path


Jun 12, 2011

Use the send mail to send the results from the server

I was trying to find a way to send the results of the calculation done on a server to my email
I found this code this code on this post from ambikeh: http://www.unix.com/302072420-post2.html for more info on the send command http://linux.about.com/od/commands/l/blcmdl8_sendmai.htm

But i need to say that i didn t have time to test it

( cat << ! FROM : $FROM To : $TO Subject : ${SUB} Cc : ${CC} ! cat << ! HOPE THIS WORKS Test123 This sample E-mail message with the Unix sendmail utility. ! #uuencode ${1} ${1} ! ) | /usr/lib/sendmail -vt