!dumpheap -min for strings does not work as expected [duplicate] - windbg

The documentation said it's used for limit the size of the output object, but based on my test, it's not what I expected:
0:000> !dumpheap -mt 000007fee12406a8 -max 400 -min 399
Address MT Size
000000000d1dc1f8 000007fee12406a8 936
000000000d62bed8 000007fee12406a8 1016
000000000d630d00 000007fee12406a8 984
000000000d633aa8 000007fee12406a8 984
000000000d65f368 000007fee12406a8 952
000000000d685ff0 000007fee12406a8 952
000000000d6b2150 000007fee12406a8 952
So how to understand the -min and -max options?

WinDbg's default number format is hexadecimal. 0x400 is 1024 and 0x399 is 921, that explains the output. If you want decimal numbers, use the 0n prefix, e.g. 0n400 and 0n399.

Related

Why are these two IMAP Search results different from one another?

I'm using imaplib, and trying to fetch emails with a certain subject header value.
My code:
res, tmp = self.mail.uid('search', None, 'HEADER Subject "SUBJECT_HERE"')
print(tmp)
print(res)
print("test 2 goes:")
rr, tt = self.mail.search(None, 'HEADER Subject "SUBJECT_HERE"')
print(tt)
print(rr)
Result:
[b'225 232 323 324 346 366 382 419 420 425 450 463 517 607 670 751 833
911 1043 1129 1133 1134 1287 1350 1799 1854 1957 1960 1962 1991 2005
2040 2071 2110 2119 2121 2153 2158 2182 2188 2189 2228 2230 2239 2249
2334 2335 2372 2378 2396 2435 2497 2567 2568 2573 2574 2575 2632 2633
2634 2648 2649 2709 2785 2819 2821 2828 2829 2868 2885 2895 2902 2906
2920 2993 2997 2998 3000 3001 3009'] OK test 2 goes:
[b'220 227 318 319 340 360 376 413 414 419 444 457 511 601 664 745 827
905 1037 1123 1127 1128 1281 1344 1793 1848 1951 1954 1956 1985 1999
2034 2065 2104 2113 2115 2147 2152 2176 2182 2183 2222 2224 2233 2243
2328 2329 2366 2372 2390 2429 2491 2561 2562 2567 2568 2569 2625 2626
2627 2641 2642 2702 2778 2812 2814 2821 2822 2861 2878 2888 2895 2899
2913 2986 2990 2991 2993 2994 3002'] OK
I thought that those two commands result in the same results.
But as shown above, those two fetch different emails.
What is the difference??
One (SEARCH) returns message sequence numbers (MSN), which are numbered from 1 to N and change as messages are added and deleted. A message that is number 5 now could be number 4 tomorrow if you delete a message before it.
The other (UID SEARCH) returns UIDs, which do not change as messages are deleted. They're two completely different set of identifiers. A message with UID 5 will remain UID 5 until it is deleted it (or moved, etc.).
The UID will never reused in that incarnation of a folder. If the folder is deleted and recreated, or the mail server is rebuilt, the folder's UIDVALIDITY should change so you can detect that your cache is no longer valid.

RMarkdown: Creating two side-by-side heatmaps with full figure borders using the pheatmap package

I am writing my first report in RMarkdown and struggling with specific figure alignments.
I have some data that I am manipulating into a format friendly for the package pheatmap such that it produces heatmap HTML output. The code that produces one of these looks like:
cleaned_mayo<- cleaned_mayo[which(cleaned_mayo$Source=="MayoBrainBank_Dickson"),]
# Segregate data
ad<- cleaned_mayo[which(cleaned_mayo$Diagnosis== "AD"),-c(1:13)]
control<- cleaned_mayo[which(cleaned_mayo$Diagnosis== "Control"),-c(1:13)]
# Average data across patients and assign diagnoses
ad<- as.data.frame(t(apply(ad,2, mean)))
control<- as.data.frame(t(apply(control,2, mean)))
ad$Diagnosis<- "AD"
control$Diagnosis<- "Control"
# Combine
avg_heat<- rbind(ad, control)
# Rearrange columns
avg_heat<- avg_heat[,c(32, 1:31)]
# Mean shift all expression values
avg_heat[,2:32]<- apply(avg_heat[,2:32], 2, function(x){x-mean(x)})
#################################
# CREATE HEAT MAP
#################################
# Plot average heat map
pheatmap(t(avg_heat[,2:32]), cluster_col= F, labels_col= c("AD", "Control"),gaps_col = c(1), labels_row = colnames(avg_heat)[2:32],
main= "Mayo Differential Expression for Genes of Interest: Averaged Across \n Patients within a Diagnosis",
show_colnames = T)
Where the numeric columns of cleaned_mayo look like:
C1QA C1QC C1QB LAPTM5 CTSS FCER1G PLEK CSF1R CD74 LY86 AIF1 FGD2 TREM2 PTK2B LYN UNC93B1 CTSC NCKAP1L TMEM119 ALOX5AP LCP1
1924_TCX 1101 1392 1687 1380 380 279 198 1889 6286 127 252 771 338 5795 409 494 337 352 476 170 441
1926_TCX 881 770 950 1064 239 130 132 1241 3188 76 137 434 212 5634 327 419 292 217 464 124 373
1935_TCX 3636 4106 5196 5206 1226 583 476 5588 27650 384 1139 1086 756 14219 1269 869 868 1378 1270 428 1216
1925_TCX 3050 4392 5357 3585 788 472 350 4662 11811 340 865 1051 468 13446 638 420 1047 850 756 616 1008
1963_TCX 3169 2874 4182 2737 828 551 208 2560 10103 204 719 585 499 9158 546 335 598 593 606 418 707
7098_TCX 1354 1803 2369 2134 634 354 245 1829 8322 227 593 371 411 10637 504 294 750 458 367 490 779
ITGAM LPCAT2 LGALS9 GRN MAN2B1 TYROBP CD37 LAIR1 CTSZ CYTH4
1924_TCX 376 649 699 1605 618 392 328 628 1774 484
1926_TCX 225 381 473 1444 597 242 290 321 1110 303
1935_TCX 737 1887 998 2563 856 949 713 1060 2670 569
1925_TCX 634 1323 575 1661 594 562 421 1197 1796 595
1963_TCX 508 696 429 1030 355 556 365 585 1591 360
7098_TCX 418 1011 318 1574 354 353 179 471 1471 321
All of this code is wrapped around the following header in the RMarkdown environment: {r heatmaps, echo=FALSE, results="asis", message=FALSE}.
What I would like to achieve is the two heatmaps side-by-side with black boxes around each individual heat map (i.e. containing the title and legend of the heatmap as well).
If anyone could tell me how to do this, or either one individually it would be greatly appreciated.
Thanks!

Connecting points in qqplot in MATLAB

I am trying to plot a qqplot graph for different data samples. I am able to draw it for individual data samples. How can I draw a qqplot graph for multiple data samples? Also, I want to connect all the points with a line and color for each data set to differentiate them. How can I achieve this in MATLAB?
I am getting the output as below:
I am trying to get the output in the below format(qqlplot for 4 samples).
I am loading the data from csv file into matlab.
Next, drawing the graph using the function qqplot(1mb);
Data Set1:(variable size: 1mb)
379
398
474
541
656
673
684
712
749
751
770
782
788
829
837
864
886
919
935
946
991
993
995
1000
DataSet2: (variable size: 512kb)
313
406
443
534
558
561
613
645
649
699
705
732
737
748
752
755
766
774
780
795
796
802
806
823
842
846
872
873
889
904
915
936
966
983
993

How to understand the -min/-max options of !dumpheap in WinDBG SOS

The documentation said it's used for limit the size of the output object, but based on my test, it's not what I expected:
0:000> !dumpheap -mt 000007fee12406a8 -max 400 -min 399
Address MT Size
000000000d1dc1f8 000007fee12406a8 936
000000000d62bed8 000007fee12406a8 1016
000000000d630d00 000007fee12406a8 984
000000000d633aa8 000007fee12406a8 984
000000000d65f368 000007fee12406a8 952
000000000d685ff0 000007fee12406a8 952
000000000d6b2150 000007fee12406a8 952
So how to understand the -min and -max options?
WinDbg's default number format is hexadecimal. 0x400 is 1024 and 0x399 is 921, that explains the output. If you want decimal numbers, use the 0n prefix, e.g. 0n400 and 0n399.

Multidimensional scaling matrix error

I'm trying to use multidimensional scaling in Matlab. The goal is to convert a similarity matrix to scatter plot (in order to use k-means).
I've got the following test set:
London Stockholm Lisboa Madrid Paris Amsterdam Berlin Prague Rome Dublin
0 569 667 530 141 140 357 396 570 190
569 0 1212 1043 617 446 325 423 787 648
667 1212 0 201 596 768 923 882 714 714
530 1043 201 0 431 608 740 690 516 622
141 617 596 431 0 177 340 337 436 320
140 446 768 608 177 0 218 272 519 302
357 325 923 740 340 218 0 114 472 514
396 423 882 690 337 272 114 0 364 573
569 787 714 516 436 519 472 364 0 755
190 648 714 622 320 302 514 573 755 0
I got this dataset from the book Modern Multidimensional Scaling (Borg & Groenen, 2005). Tested it in SPSS using the PROXSCAL MDS method and I get the same result as stated in the book.
But I need to use MDS in Matlab in order to speed up the process. The tutorial on the site: http://www.mathworks.nl/help/stats/multidimensional-scaling.html#briu08r-4 looks the same as what I'm using above. When I change the data set as what is displayed above and run the code I get the following error: "Not a valid dissimilarity or distance matrix.".
I'm not sure what I'm doing wrong, and if classical MDS is the right choice. I also miss the possibility to say that I want the result in three dimensions (this will be needed in a later stage).
Your matrix is not symetric, check the indices (9,1) and (1,9). To quickly find asymetric indices use [x,y]=find(~(D'==D))