Accéder au contenu principal

The power of Perl, give us the 5 things missing to really help.

 My DpkgSearch.pl aim to really answer to my inspection. I want to see presence of de-installed file and are existing. Belong to an omission, the application is almost what I required to use to but... It did not use the Package Status akin to be "install" and "deinstall" a comparison between dpkg --get-selections did confirm it marshall all the install and de-install file. 


The proof:

 

       
maxiste@ubuntu-devlpt:~/Documents/perl$ dpkg --get-selections | grep "deinstall" | wc -l
49
maxiste@ubuntu-devlpt:~/Documents/perl$ dpkg --get-selections | grep "install" | grep -v "deinstall" | wc -l
3055
echo $(( 3055 + 49 ))
3104

###
### Now with the application : 
###

maxiste@ubuntu-devlpt:~/Documents/perl$ DSMD5Process=perl DSPkgStatus=deinstall  DSDisplay=package  DSSearch="^[a-zA-Z0-9]" DSIsRegExp=True DSLimit=0 ./DpkgSearch.pl | wc -l
3104
maxiste@ubuntu-devlpt:~/Documents/perl$ DSMD5Process=perl DSPkgStatus=install  DSDisplay=package  DSSearch="^[a-zA-Z0-9]" DSIsRegExp=True DSLimit=0 ./DpkgSearch.pl | wc -l
3104
       
 

 Ok, it's not even make comparison between a "install" state and "deinstall" state.

 

So after looking at the code. I found why and in 5 things easy addable, make perl great to easily enhance this programmation. But where 

2 Choices:

  1. Is it inside sub or function start()
  2. Is is inside sub or function ShowByItem() 

 

As inside start: 

At the foreach statement.

 

       

	foreach my $line ( @lines )
	{
		$IsShowTime="False" ;
		chomp($line); 
		if ( $MaxValuePrint > 0 )
		{
			if ( $IntCountMax <= ( $MaxValuePrint - 1 ) )
			{
				$IsShowTime="True" ;
			}
			$IntCountMax=$IntCountMax+$intStepAdd ; 
		}
		else
		{
			$IsShowTime="True" ;
		}
		if ( $IsShowTime =~ /True/ )
		{
			$intStepAdd=ShowByItem($line , 0 ) ;
           #^^^^^^^^^The entry is here and we can supply all the 
           #         stuff to make the filtering of install and 
           #         deinstall package. But how many line to add
           #         and probably adding twice whichs elements ?
		}
	}

       
 

 or

inside  ShowByItem()

 

       

sub ShowByItem
{
	my $RegExpMode=$ENV{"DSIsRegExp"} ; 
	my $RegExpSearch=$ENV{"DSSearch"} ; 
	### to add to allow Package status to be considered.
	my $PackageStatus=$ENV{"DSPkgStatus"} ; ### This one to add
	
	my $StringMatching ;
	my $intCountLine=0 ; 
	my $StrLine=$_[0] ;
	my $intPosField=$_[1] ; 
	$StringMatching=per_line_matches( $StrLine , $intPosField );
	### to add to allow Package status to be considered.
	### It's the official location where a line contain 
	### "PACKAGE\t\tSTATUS\n" format
	my $StrPackageStatus=per_line_matches( $StrLine , 1 ); ### This one to add
	
	if ( $StrPackageStatus eq $PackageStatus ) ### This one to add
	{
		if ( $RegExpMode =~ /True/ )
		{
			if( $StringMatching =~ /$RegExpSearch/ )
			{
				$intCountLine=TypeShow( $StrLine , $intPosField ) ; 
			}
			else
			{
				$intCountLine=0 ; 
			}
		}
		else
		{
		 if( $RegExpSearch ne "" )
		 {
			if( $StringMatching eq $RegExpSearch )
			{
				### At this level the Counting take or not the count, depending 
				### the number of match item being consider with variable DSLimit. 
				### Based on type of DSDisplay['package'] or DSDisplay['file']
				### It query the number of line for DSLimit by package will certify 
				### to analyse more package than DSLimit. But in file showing
				### we are not showing the package and only the file list.
				### in a case DSLimit=10 .  
				### These can take more than 10 lines per package but not exceding 
				### the limit of 10 for showing 10 package, so $intCountLine will 
				### always serve to count package but does not lime by the time 
				### all the file being show.
				$intCountLine=TypeShow( $StrLine , $intPosField ) ; 
			}
		 }
		 else
		 {
			$intCountLine=TypeShow( $StrLine , $intPosField ) ; ;
		 }
		}
	}
	else ### This one to add
	{
		$intCountLine=0 ; ### This one to add
	}
	return $intCountLine;
}

       
 

 Underneath the fact is 5 things to add to make it possible. I give you one more hint and it's triviality and the reason we are showing and we are not showing everything look like an "If" condition that simply require it's counter-part and in 5 - One "if" and One "else" it require 3 others to ad and make the application view the difference between install and de-install. 

like to note the behavior of the application at this function level. To return a number of line which is at least 1 or 0. Between showing something that fit inside the filter and 0, show nothing .

 In the important thing you have:

  1. To create a variable and it's environment from prompt predefined-variable
  2. Get the value of the actual package and create the if for it.

 

So in point 1 

my $PackageStatus=$ENV{"DSPkgStatus"} ;

In point 2

my $StrPackageStatus=per_line_matches( $StrLine , 1 ); 

The if

if ( $StrPackageStatus eq $PackageStatus ) 

 All the code inside the brace of this if, the else in gift.

	else ### This one to add
	{
		$intCountLine=0 ; ### This one to add
	}

 

 But those will getting from the github in Fnct.D won't even notice that problems.

And raise another point. Since we doubt having package in possible conflicts they are keep in dpkg database and still exist inside an configuration elsewhere ? Does it weight keeping them away but present. Sparing a size calculation to generate a size by package that include a size for de-installed package can eventually be an option since Perl is really handy. 

 

I am showing information, because the other edge of this application is the will to store some search request and will not do all the digest or getting the information being re-executed again for the same query. Unless there is an update . But using an application in my Ubuntu installed via snap, the DB browser for sqlite is also possible to develop database with perl and directly with sqlite and doing my first table and the code for perl I fall in a question of validation for DpkgSearch and fall into this little error. 

Table creation :

CREATE TABLE "PackageInformation" (
	"PkID"	INTEGER NOT NULL UNIQUE,
	"PackageName"	TEXT NOT NULL,
	"PackageStatus"	TEXT NOT NULL,
	PRIMARY KEY("PkID" AUTOINCREMENT)
);
     
 

 Being the first table it's important to not PackageStatus will be an only one introduction and in some it's true, if you have package being in the de-install statement inside dpkg it will enter into an insert with PackageStatus and "deinstall" and it have to be like this.  

It's more important to say it be never being touch too to infirm in a table that do require to get a notice of it's state, it should exist a package that start into the mode of "install" into "deinstall" and will require to really make another PkID with this package-name and having PackageStatus being "deinstall". Because it answer installation need. And changing and PkId relation and it's content make the relation being false if you simply update the same package information with new data. 

Because subsequent table will have correspondence. The Md5 table list depend of file and the digest but package too. And will depend of a valid installed package. 

While there is no chance to have file in a list all empty, the presence of package-id, id by-file, the File table will also match from a PkId of PackageInformation but not those from the Md5 table.  


Posts les plus consultés de ce blog

Les Juges de la cour Sûprème qualifient les tarifs de Trump illégaux, prochaine étape rendre ma communication ACN avec Trump disponible.

 C`est un gros titre et pourtant la prochaine étapes est bel et bien de parler des tarifs illégaux de Donald Trump. N'étant pas visé par l'Acier, bois et aluminium il reste les terres rares et les semi-conducteurs qui sont au cœur de la réalité informatique, la mémoire les disques dure à base de semi-conducteur et mieux encore ce que cache le terme "I'm covering it", dans une discussion avec Donald Trump et l'état des terres rares dans la vie des médias. Il y a la fibre optique hybride de Vidéotron qui contient, Oxide de gallium sour forme de vitre tel la tourmalines et sont pouvoir ionisant et le substrat samarium sur dopage d'étain ou zinc et autres métaux qui ne recouvre pas l'Or. Cette technologie européenne couvrant la technologie DOCSIS. J'étais au centre d'un artifice de support technique multi protocole et favorisé avec Bell, "A.C.N" Canada était un lien avec les Américains de Wasington, mais laissait toutes les technologies d...

I am developper and Network Administrator and I respond to does Won’t Teach to theirs Kids to Code.

 And not yet music composer. But I made A.T.R. with Netracker in the 1990, and i am satisfied to say it's also programming while as simple reality to result it's whats sound producing from this MIDI translation of music sample into note. It's not because it take 20 years to achieve another part of a dream consist to understand code being sound plugin where some L.A.D.S.P.A. teach me howto drive the information and eventually re-create the plugin that turn the electricity down but from plugins activity. But I can say, my case involving having and partner that did the homework job in database to complete code where in a script alike Perl and I did learn from my same example I am showing online and about to expose because the first part is done. In fact it's having the plenty design and the code for 25 year in head since I did this homework in 1999-2000. The worst, I can give demonstration of a complex problem in users need, to have a system that does everything, and some ...

And Madness around !

 Like Pauline Marois we do share problematic interaction with recidivist activities of well known descendant of 'Mad House' resident of Taylor effort ... The one who provide the money to Tesla to make itself great as well, and itself so fortunate to turn into madness, Taylor story at Bareau will eventually tell more but historical truth is the mean. Recidivist of quasi lethal action where expert confirm illness into mental illness are falling apart and sometime forgeted. That's also the family story to let forget and people pretend to make apart. But it's expert case against civil-hand signature to retrieve them temporary. In case of harassing people for specific reason like for Pauline Marois case for hate against women at the power. So you do get the point why a WOMEN WITH ALL THE MONEY AT THE POWER can only bring another recidivist doing the same. I do stay in medical problem avoiding myself seiing myself as LBGTQ2+ because it madness initiated fault of my father bel...