Generate three unique forms of 9 id each (2-AT,3-AL,4-ST) where average of each form is no different than 0.02 using R - loops

id score name
148942 0.3436 AT
154277 0.71 AT
154284 0.1567 AT
154285 -0.2285 AT
203757 0.6208 AT
220357 -0.9769 AT
301078 -1.1033 AT
301875 -0.1028 AT
350008 1.3953 AT
148729 0.849 AL
149437 -1.0459 AL
149865 -1.4631 AL
149873 -1.4603 AL
149886 -0.9651 AL
149891 -1.4789 AL
151287 -0.6814 AL
151297 0.868 AL
153430 -1.5035 AL
203678 -1.3231 AL
218719 -0.0516 AL
218724 0.6313 AL
301071 -0.7629 AL
301756 0.6565 AL
301763 -0.1223 AL
301793 0.0991 AL
301794 -0.9122 AL
349846 0.1579 AL
148734 0.6188 ST
148736 1.6683 ST
148738 2.524 ST
149705 0.0857 ST
156797 -0.3627 ST
156801 -0.8816 ST
156804 0.0213 ST
156809 -0.5822 ST
156810 -0.204 ST
204331 1.6335 ST
204336 -1.3621 ST
204652 0.2806 ST
218640 1.2391 ST
218644 -0.4372 ST
220315 0.1468 ST
300813 -0.5307 ST
300833 1.1446 ST
301287 -0.9228 ST
301292 0.0542 ST
316861 -0.2479 ST
348611 2.0366 ST
434201 -0.6411 ST
437229 0.5303 ST
437233 1.6062 ST

Related

how to update database with extension db1 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
I am working on updating an outdated database with extension db1, which was created in 2002. But the problem is I can access the structure of this database to create a new one to work with a program that I use it.
DATA BASE Simulatix v1.00 (c)FAROS 1995
¥L<ٍe ض IDENT ب¸ ICAO ±± LATITUDE آ½ًüآ½ً| LONGITUDE آ½ًüآ½ً| ELEV €ےh ¹ MAG VAR €ےh² SPEED LIMIT €ےک´ SPEED LIMIT ALT €ے`¶ TRANS ALT €ے8؛CYFB CY "oEحٹ€إn „‏ PFCYVQ CY 3دtE"ہيإٌ # PFDTMB DT ¼E"R!D
¸EBBR EB Wل>E~‰†C¸ ىےْ '”EDDB ED wkDEïخJD› ْ 'ˆEDDF ED ùں;Eچژ Dlےےْ 'ˆEDDH ED IE3سD5 ْ 'ˆEDDK ED H؟>EGHضC.‎ےْ 'ˆEDDL ED ڑM#Ew·تC“ ِےْ 'ˆEDDM ED ¢S5E’ت0Dخ
ْ 'ˆEDDN ED ³‍9Eي+&D ْ 'ˆEDDP ED ïض#E¼‹7Dر ْ 'ˆEDDS ED H–6EWT
Dَ ْ 'ˆEDDT ED LEEذPGDy ْ 'ˆEDDV ED خ¹DE؛#D· ْ 'ˆEDDW ED پيFEحD üےْ 'ˆEDHI ED قءHE‰ˆD ˆEDLW ED •1AE^نC¨ûےْ 'ˆEDOP ED قYHE ہ0D¦
ْ 'ˆEETN EE حج^Ef>؛D„ ? ˆEFHK EF ‰0bEڑ9»D§ ; ˆEFIV EF 3¥€E«ڑحDل` ˆEFJY EF ح jE¼‹ہDثD ˆEFOU EF |sE«*¾D/ G ˆEFPO EF ïzfE¼{£D, 1 ˆEFRO EF 3›yE3»ءD…N ˆEFTP EF «NfE‰è°D†8 ˆEFTU EF "îbEfِ¦D، 1 ˆEFVA EF wklE3;£D 1 ˆEGBB EG ´³DEjأرآEعے  EGCC EG کHE;أضےْ 'ˆEGGD EG ]¯#E5%#أnطے ¸EGGP EG D HE¼û*أQ شےْ 'ˆEGGW EG ¼‡BEحج°ءâےْ 'pEGHH EG حl>Eڑفآ$ فے  EGJJ EG ،‡8E»أقے ¸EGKK EG "خ?E«ھ6ءؤ كےْ 'pEGLL EG f
AEwwفءP âےْ 'pEGMH EG ‰ˆ#E‰ˆ،B² èے ¸EGNM EG CےIE±Dاآھضے ˆEGNX EG قFEق]ںآ2غےْ ' EGPD EG „VEDأ× خے pEGPF EG …QEق‎„أ اےْ 'pEGPH EG ذQEڑYJأ‡ ثےْ 'pEGPK EG w'PEڑ™‰أA أےْ 'pEGSS EG ڑ‘BEڑ™aA\هےْ 'pEHAM EH ¼'DEحىژCُےٌےْ '¸EHRD EH «ضBEق…Cٌےïےْ '¸EIDW EI {THE-¼أٍ ہے ˆEINN EI و،EELكؤ. °ے ˆEKAH EK SE‏HDR ¸EKBI EK ¶QEشF D÷ ےے ¸EKCH EK 3‘PEïض=D ْ XˆEKKA EK ڈSE’قD« ےے ¸EKRN EK ¼|NE´d]D4 ˆEKSP EK ˆOE~ُ
Dچ ¸EKTS EK VE”D üے ¸EKYT EK VEت¼D
¸ELLX EL R:EH!؛Cزِےْ '”ENAL EN ٍ›jEش–·CE ىے XENAN EN fىپEڑ)rD+ ْ 'XENAT EN …4ƒE`I¯D F ˆENBO EN oB|EڈzWD* XENBR EN بbEçٹœC¥ ىےْ 'XENCN EN ¼CZEحŒٍC9 ِے  ENDU EN حzپEU
‹Dü 2 XENEV EN «j€Eح,zDT ( XENFG EN مخdECRD‰
as you can see I can't open it correctly. Is there any way to open this file .db1 and update it for this year 2022??
I have this program to access DB and check the data as you can see the rows, and column.

How to split a string considering more than one blank spaces in Ruby

I'm trying to get an array with the following output:
["", "7", "02156567848", "CORTIER EP. ENGERANT ROSE JOSE MARIE", "059 NOMBRE DE LA PERSONA ES DIFERENTE"]
But using next code the result is different, because split is considering any non word character to separate the strings.
a = " 7 02156567848 CORTIER EP. ENGERANT ROSE JOSE MARIE. 059 NOMBRE DE LA PERSONA ES DIFERENTE"
b = a.split(/\W\W+/)
p b
Output:
["", "7", "02156567848", "CORTIER EP", "ENGERANT ROSE JOSE MARIE", "059 NOMBRE DE LA PERSONA ES DIFERENTE"]
Any idea how to solve this?
Thanks and regards!
Split on \s{2,} -- two or more white-space characters.
a = " 7 02156567848 CORTIER EP. ENGERANT ROSE JOSE MARIE. 059 NOMBRE DE LA PERSONA ES DIFERENTE"
a.split(/\s{2,}/)
# => ["", "7", "02156567848", "CORTIER EP. ENGERANT ROSE JOSE MARIE.", "059 NOMBRE DE LA PERSONA ES DIFERENTE"]
repl

Find SIFT features matching between two video

I extracted SIFT features from two videos to make a matching.
I need to compare each of the second video features with those stored in an array of features of the first video. I'm having trouble set the code so that when I have the correspondence I can get the frame in which the feature is present. How can I do? Can anyone show me a code example?
This is my code:
obj = VideoReader('video2.avi');
lastFrame = read(obj, inf);
numFrames = obj.NumberOfFrames;
%estrazione frame e sift
for k = 1 : 3 % numFrames / 5
disp(['Processing frame #', num2str(k)]);
this_frame = read(obj, k * 5); % leggi solo un fotogramma ogni 5 per velocizzarle la cosa
this_frame = imresize(this_frame, 0.5); % rimpiccioliamolo per questioni di efficienza!
I = single(rgb2gray(this_frame)) ;
[f,d] = vl_sift(I); % estrazione feature
features{k} = f; % salviamo le feautre e i relativi descrittori in delle celle
descriptors{k} = d;
end
save('feature_input', 'features');
save('descrittori_input', 'descriptors');
%%% un esempio di come ripescare i dati...
pippo = load('feature_input');
newfeat = pippo.features;
pippo = load('descrittori_input');
newdesc = pippo.descriptors;
for k = 1 : 3
disp(['Le feature del fotogramma', num2str(k), ' sono: ']);
f = cell2mat( newfeat(k) );
f(:, 1:10) % ne mostriamo solo un pezzetto... le posizioni delle prime 10 features
end
obj2 = VideoReader('video2u.avi');
lastFrame = read(obj2, inf);
numFrames = obj2.NumberOfFrames;
%estrazione frame e sift video2
for k2 = 1 : 3 % numFrames / 5
disp(['Processing frame #', num2str(k2)]);
this_frame2 = read(obj2, k2 * 5); % leggi solo un fotogramma ogni 5 per velocizzarle la cosa
this_frame2 = imresize(this_frame2, 0.5); % rimpiccioliamolo per questioni di efficienza!
K = single(rgb2gray(this_frame2)) ;
[f2,d2] = vl_sift(K); % estrazione feature
features2{k2} = f2; % salviamo le feautre e i relativi descrittori in delle celle
descriptors2{k2} = d2;
end
save('feature2_input', 'features2');
save('descrittori2_input', 'descriptors2');
%%% un esempio di come ripescare i dati...
pippo2 = load('feature2_input');
newfeat2 = pippo2.features2;
pippo2 = load('descrittori2_input');
newdesc2 = pippo2.descriptors2;
for k2 = 1 : 3
disp(['Le feature del fotogramma', num2str(k2), ' sono: ']);
f2 = cell2mat( newfeat2(k2) );
f2(:, 1:10) % ne mostriamo solo un pezzetto... le posizioni delle prime 10 features
end
[matches, scores] = vl_ubcmatch(d, d2, 1.5) ;
% sift points plot
subplot(1,2,1);
imshow(uint8(I));
hold on;
plot(f(1,matches(1,:)),f(2,matches(1,:)),'b*');
subplot(1,2,2);
imshow(uint8(K));
hold on;
plot(f2(1,matches(2,:)),f2(2,matches(2,:)),'r*');
figure;
%-------------
% RANSAC
X1 = f(1:2,matches(1,:)) ; X1(3,:) = 1 ;
X2 = f2(1:2,matches(2,:)) ; X2(3,:) = 1 ;
numMatches = size(matches,2) ;
for t = 1:100
% estimate homograpyh
subset = vl_colsubset(1:numMatches, 4) ;
A = [] ;
for i = subset
A = cat(1, A, kron(X1(:,i)', vl_hat(X2(:,i)))) ;
end
[U,S,V] = svd(A) ;
H{t} = reshape(V(:,9),3,3) ;
% score homography
X2_ = H{t} * X1 ;
du = X2_(1,:)./X2_(3,:) - X2(1,:)./X2(3,:) ;
dv = X2_(2,:)./X2_(3,:) - X2(2,:)./X2(3,:) ;
ok{t} = (du.*du + dv.*dv) < 6*6 ;
score(t) = sum(ok{t}) ;
end
[score, best] = max(score) ;
H = H{best};
ok = ok{best};
% sift feature matching
dh1 = max(size(K,1)-size(I,1),0) ;
dh2 = max(size(I,1)-size(K,1),0) ;
subplot(2,1,1) ;
imagesc([padarray(I,dh1,'post') padarray(K,dh2,'post')]) ;
colormap (gray);
o = size(I,2) ;
line([f(1,matches(1,:));f2(1,matches(2,:))+o], ...
[f(2,matches(1,:));f2(2,matches(2,:))]) ;
axis image off ;
subplot(2,1,2) ;
imagesc([padarray(I,dh1,'post') padarray(K,dh2,'post')]) ;
colormap (gray);
o = size(I,2) ;
line([f(1,matches(1,ok));f2(1,matches(2,ok))+o], ...
[f(2,matches(1,ok));f2(2,matches(2,ok))]) ;
title(sprintf('%d (%.2f%%) inliner matches out of %d', ...
sum(ok), ...
100*sum(ok)/numMatches, ...
numMatches)) ;
axis image off ;
drawnow ;
end
You are matching using [matches, scores] = vl_ubcmatch(d, d2, 1.5) ;. d contains only the descriptors of the latest frame. You should do something like:
for nFrames=1:3
[matches{nFrames}, scores{nFrames}] = vl_ubcmatch(descriptors{nFrames}, descriptors2{nFrames}, 1.5);
end
From here, you should be able to get the matches between the frames.

How to pair row for arrival and departure

FPL_ID AFSKEY FLIGHTNO FLIGHTYPE STAD AIRCRAFTTYPECODE TAILNO STANDCODE
1733285 4383931 UL 0314 A 2014-01-01 05:35:00.000 A343 4RADC C015
1733554 4382525 UL 0315 D 2014-01-01 08:25:00.000 A343 4RADC C015
1733385 4382929 AK 5107 A 2014-01-01 07:00:00.000 A320 9MAFB F086
1733484 4381571 AK 5212 D 2014-01-01 07:25:00.000 A320 9MAFB F086
I need help.
How to pair base on FLIGHTYPE A=Arrival and D=Departure into a single row ?
Just inner join the same table again. In the example below, f1 will contain arrivals and f2 departures.
select f1.*, f2.* -- replace with the list of columns you need
from flights f1
inner join flighs f2
on f1.FLIGHTNO = f2.FLIGHTNO
and f1.FPL_ID <> f2.FPL_ID
and f1.FLIGHTYPE = 'A' and f2.FLIGHTYPE = 'D'

How i get the similarity of phrases in C# .NET

I have a sql database with data about headers of news. Example:
id title
867 MPE consegue inverter julgamento
868 Defensoria P blica realiza licita
869 Prefeitos eleitos de todas as partes do Estado
870 Inc ndio deixa 80 pessoas desabrigadas
871 Carlos Amastha visita parlamentares
872 Defensoria P blica requer anula o
873 Marcelo Miranda diz que n o possui obriga o
874 Ex-assessor diz que Coimbra lhe deu dois cheques
I need to get each title and see if there are other news to talk about the same subject.
How i do it? My plataform is .Net and use sql server 2012.
You will probably want to put a Full-Text Index on this column and/or table. It's a complex subject, but you can start reading up on it here: http://msdn.microsoft.com/en-us/library/ms142571.aspx

Resources