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

Hottest Snapshoot from my ThF4_LaFe Hard-State Nuclear Holdrum

This is my ThF 4 + LaFe (α-Fe) Nuclear Holdrum ( more than quantic-one ), for it's hard-state design. It's the revealed reproduction from 1980, after seeing the images with my tiny eyes from M.Villeneuve having a snapshoot from the Psychiatric hives, or vault. It was forbidden to stole because it was not yet made at this moment... To reproduce the image on the picture, they use white paint on the Xenon tube on external side of the holdrum... In fact this is PTFE thread used and it have it's property... Ionisation from PTFE thread is mildly-helper driving photo-source like filter-to-filter of a « ridicule » quater-plate effect side of using Fluor in light filtering, while in high-energy and high velocity light it en-lighting prior to filter... In This case  it's good, we are dealing with Ultra-violet led PaInSe ( also know as Hard-state gamma-ray pulse led from Praseodymium/Indium with filter to throw down wavelength to UV region...   ). I can conclude it's 5 xeno...

Oups, The AME 2012 Atomic Mass Evalutation fall in my Hand...

 I don't know what Zantagor, a real fanatic of Japanese / Chinese games told me about the Word Downloading in Japanese, but during I was looking to update data toward my Python module names NuclearMassTable from masstable having a lot of inexact information behind nndc.bnl.gov, but this PDF just fall in my hand when I was trying to seek for a document from cpc-hepnp.ihep.ac.cn , which is the type of hack-site not made to be KANJI-prone and backend still in english... The AME2012 Atomic Mass Evaluation Some content in Image.. Sorry my ImagePathDesign is not ready, but orcad give about perfect conversion and PDF2DJVU seems to work fine with... Few example about the content : Units; recalibration of α- and γ-ray energies Atomic mass determination for a particular nuclide can be generally performed by establishing an energy relation between the mass we want to deduce and that for a well known nuclide. This energy relation is then expressed in electron-volts (eV). Mass value...

My Xeon got afraid of it so it have run it out.

 Yes, there is an alternative to make Windows working. It's changing inside bios inside "CSM" section which have it and some item where left into "UEFI" and not auto-detect between "UEFI" and Legacy and does support Windows installation.    With such speed.   Belong to images it's my "DDR4 ECC" memory which are 2x 16 Gigabytes at 2133 Mhz that is actually running at 2194 Mhz, so close to processor speed which is 2.2Ghz. And it's only what is supported in overclock-ability the memory is pushed hard. Pushed at 103% of it's clock it might be the reason sometime it shut down silently or simply doing a task and shutdown. Except in Linux Min Xia installation it reboot before it end the loading of all the module. But exceptional it can last for 10 hours long formatting a Tera Byte ( out of it's 8 days of formatting ) and by using the Linux Mint installer of Xia ( which is the previous version of Linux Mint ). Apparently Virginia or W...