ABCDEFGHI
1
TimestampTitleMessage
2
1/15/2023 15:53:23calculate draw frameprivate long mStartTime1 = 0;
private long mEndTime1 = 0;
private long mProTimeSum = 0;
private long mFrameCounter1 = 0;
private void drawFrame() {
if (!mIsPrepareOpengl) return;

mFrameCounter1++;
mStartTime1 = System.currentTimeMillis();


//opengl make curent, draw frame


mEndTime1 = System.currentTimeMillis();
mProTimeSum += mEndTime1 - mStartTime1;
if (mFrameCounter1 % 100 == 0){
Log.i(TAG, "---processing time avg (ms)= " + mProTimeSum * 1.0f / (mFrameCounter1));
}

countFPS();
}
3
1/14/2023 16:49:16count FPSprivate long mStartTime = 0;
private long mEndTime = 0;
private long mFrameCounter = 0;
private void countFPS(){
if (mFrameCounter == 0){
mStartTime = System.currentTimeMillis();
}else if (mFrameCounter == 1000){
mEndTime = System.currentTimeMillis();
Log.i(TAG, "---FPS = " + 1000.0f / (mEndTime - mStartTime) * 1000);
mFrameCounter = -1;
}
mFrameCounter++;
}
4
1/8/2023 23:04:35
SurfaceTexture + Mediacodec InputSurface
●SurfaceTexture + Mediacodec InputSurface
https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/media/common/src/android/media/cts/TextureRender.java
https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/media/common/src/android/media/cts/InputSurface.java
5
1/6/2023 0:08:05@echo off

for %%f in (*.png *.jpg *.bmp) do (
magick.exe compare -metric ae "D:\98_Tools\ImageMagick\images_compare\girl1.jpg" "%%f" null: >> test.csv
echo , %%f
)
6
1/5/2023 20:15:03@echo off

for %%f in (*.*) do (
echo Image %%f
magick.exe compare -metric ae D:\04_Tools\imagemagick\images_cmp\black240x180.png %%f null:
echo
)
7
12/22/2022 16:31:26
●Android opengl es
https://github.com/ehsan/opengles-book-samples/tree/master/Android

https://github.com/PhilLab/Android-MediaCodec-Examples/blob/master/EncodeAndMuxTest.java

https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/media/encoder/src/android/media/encoder/cts/SurfaceEncodeTimestampTest.java;l=377?q=drawframe&ss=android%2Fplatform%2Fsuperproject&start=11

https://android.googlesource.com/platform/frameworks/base/+/master/opengl/java/android/opengl/GLUtils.java

https://www.programcreek.com/java-api-examples/?class=android.opengl.GLES20&method=glTexImage2D


VideoEncodeRender image bitmap:
https://www.programcreek.com/java-api-examples/?code=MannaYang%2FAudioVideoCodec%2FAudioVideoCodec-master%2Fapp%2Fsrc%2Fmain%2Fjava%2Fcom%2Fmanna%2Fcodec%2Fcodec%2FVideoEncodeRender.java


Example display image bitmap kotlin
https://medium.com/mindful-engineering/opengl-es-render-a-2d-texture-in-android-app-bd49d569f580

https://www.programmingmat.jp/android_lab/gles20_texture.html


https://stackoverflow.com/questions/24470134/render-bitmap-frames-to-surface-for-encoding


GL/EGLでMediaCodec Input SurfaceにRenderした画がEncodeされない
https://qiita.com/fezrestia/items/3d15732d520e26e87bb5


Draw bitmap texture on EGLSurface for encoding with android MediaCodec
https://stackoverflow.com/questions/26318768/draw-bitmap-texture-on-eglsurface-for-encoding-with-android-mediacodec
8
12/20/2022 20:57:22opengl es
●Android opengl es
https://github.com/ehsan/opengles-book-samples/tree/master/Android

https://github.com/PhilLab/Android-MediaCodec-Examples/blob/master/EncodeAndMuxTest.java

https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/media/encoder/src/android/media/encoder/cts/SurfaceEncodeTimestampTest.java;l=377?q=drawframe&ss=android%2Fplatform%2Fsuperproject&start=11

https://android.googlesource.com/platform/frameworks/base/+/master/opengl/java/android/opengl/GLUtils.java

https://www.programcreek.com/java-api-examples/?class=android.opengl.GLES20&method=glTexImage2D


VideoEncodeRender image bitmap:
https://www.programcreek.com/java-api-examples/?code=MannaYang%2FAudioVideoCodec%2FAudioVideoCodec-master%2Fapp%2Fsrc%2Fmain%2Fjava%2Fcom%2Fmanna%2Fcodec%2Fcodec%2FVideoEncodeRender.java


Example display image bitmap kotlin
https://medium.com/mindful-engineering/opengl-es-render-a-2d-texture-in-android-app-bd49d569f580

https://www.programmingmat.jp/android_lab/gles20_texture.html
9
12/19/2022 23:59:33glTexImage2Dhttps://www.programcreek.com/java-api-examples/?class=android.opengl.GLES20&method=glTexImage2D
10
12/19/2022 23:52:27GLUtils.javahttps://android.googlesource.com/platform/frameworks/base/+/master/opengl/java/android/opengl/GLUtils.java
11
12/19/2022 22:37:38opengl es new example
https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/media/encoder/src/android/media/encoder/cts/SurfaceEncodeTimestampTest.java;l=377?q=drawframe&ss=android%2Fplatform%2Fsuperproject&start=11
12
12/19/2022 19:30:15opengl es android


●draw bitmmap to surface use canvas
AnimationActivity.java#mAndroidSurface



android.graphics.Canvas android_canvas = mAndroidSurface.lockHardwareCanvas();

int w = android_canvas.getWidth(),
h = android_canvas.getHeight();

android.graphics.Bitmap bm =
android.graphics.Bitmap.createBitmap(w, h,
android.graphics.Bitmap.Config.ARGB_8888,
true);
Surface surface = new Surface(bm);
renderFrame(surface.getCanvas(),
(double)(java.lang.System.currentTimeMillis() - time_base) / 1000,
w, h);
surface.flushAndSubmit();
surface.release();

android_canvas.drawBitmap(bm, 0, 0, new android.graphics.Paint());

mAndroidSurface.unlockCanvasAndPost(android_canvas);



●draw bitmmap to surface use opengl es2.0
https://chromium.googlesource.com/external/github.com/google-ar/arcore-android-sdk/+/refs/tags/v1.10.0/samples/hello_ar_java/app/src/main/java/com/google/ar/core/examples/java/common/rendering/BackgroundRenderer.java


Draw 2d image ByteBuffers
https://github.com/ehsan/opengles-book-samples/blob/master/Android/Ch9_Simple_Texture2D/src/com/openglesbook/simpletexture2d/SimpleTexture2DRenderer.java



●Android opengl es
https://github.com/ehsan/opengles-book-samples/tree/master/Android

https://github.com/PhilLab/Android-MediaCodec-Examples/blob/master/EncodeAndMuxTest.java
13
12/16/2022 18:04:45HardwareBuffer

■HardwareBuffer
https://robot9.me/hardwarebuffer-multi-process-rendering/
https://stackoverflow.com/questions/72602718/android-ndk-inter-process-transfers-of-ahardwarebuffer-via-binder

#HardwareBuffer to Bitmap
https://blog.csdn.net/u011246018/article/details/119852833

#Compare AHardwareBuffer with other
https://blog.csdn.net/goodnight1994/article/details/127442301?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EYuanLiJiHua%7EPosition-2-127442301-blog-119852833.pc_relevant_multi_platform_whitelistv3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EYuanLiJiHua%7EPosition-2-127442301-blog-119852833.pc_relevant_multi_platform_whitelistv3&utm_relevant_index=3




●accessing-hardwarebuffer-from-imagereader
https://stackoverflow.com/questions/61152730/accessing-hardwarebuffer-from-imagereader

14
12/16/2022 18:02:09yuv#play yuv
vlc.exe --demux rawvideo --rawvid-fps 30 --rawvid-width 1920 --rawvid-height 1080 --rawvid-chroma I420 input.yuv

#or
ffplay -v info -f rawvideo -pixel_format nv12 -video_size 1920x1080 input.yuv

#YUV→MP4
ffmpeg -f rawvideo -pixel_format nv12 -s:v 1920x1080 -r 30 -i input.yuv -c:v libx264 output.mp4
15
12/12/2022 19:07:35Qoshttps://qiita.com/harachan/items/a2200b21102f66948ba7
https://atmarkit.itmedia.co.jp/ait/articles/0803/18/news147_3.html
16
12/12/2022 19:04:46Qoshttps://wiki.archlinux.org/title/Advanced_traffic_control#Example_of_ingress_traffic_shaping_with_SNAT
https://docs.nvidia.com/networking/display/FREEBSDv370/Quality+of+Service
https://erg.abdn.ac.uk/users/gorry/course/inet-pages/udp.html
https://tldp.org/HOWTO/html_single/Traffic-Control-tcng-HTB-HOWTO/
https://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.qdisc.classful.html
17
12/12/2022 18:49:55Qoshttps://labs.gree.jp/blog/2014/10/11288/
18
11/20/2022 23:19:29android performance
19
11/20/2022 21:00:38Android memoryhttps://viblo.asia/p/android-app-performance-part2-analyze-and-optimizing-memory-Zzb7vDgKGjKd
20
11/9/2022 9:00:03ffmpeg●Convert sequence of images -> video
#ffmpeg -i "cap%4d.png" -c:v libx264 -crf 0 -r 30 "output_fps30.mp4"

ffmpeg -r 30 -f image2 -i "cap%4d.png" "output_fps30.mp4"

with:
-r : fps

●Convert video -> sequence of images
ffmpeg -i input.mp4 -vf fps=30 out%4d.png


●Trim video
ffmpeg -i input.mp4 -ss 00:00:25 -t 00:10:00 -c:v copy -c:a copy output1.mp4


●YUV→MP4に交換
ffmpeg -f rawvideo -s:v 636x476 -r 30 -i "input.yuv" -c:v libx264 "output.mp4"
21
11/3/2022 0:01:22create public file directorypublic static File commonDocumentDirPath(String FolderName)
{
File dir = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
{
dir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + "/" + FolderName);
// dir = new File("/storage/emulated/0/Documents2s");
}
else
{
dir = new File(Environment.getExternalStorageDirectory() + "/" + FolderName);
}

// Make sure the path directory exists.
if (!dir.exists())
{
// Make it, if it doesn't exit
boolean success = dir.mkdirs();
if (!success)
{
dir = null;
}
}
return dir;
}
22
9/4/2022 23:35:03SSH screen commandhttps://vtcri.kayako.com/article/199-using-screen-in-linux-to-keep-ssh-sessions-running
23
8/31/2022 17:42:01eeindex.php/apps/files/?dir=
&fileid
24
7/18/2022 23:56:23YUV planarhttps://www.fanyamin.com/blog/yuv-image-format.html
25
5/10/2022 16:00:49ddmemcpy -> memcpy_s
stoi
atoi
atof
strlen
strcpy_s
strncmp
sprintf_s
GetPrivateProfileString
26
4/12/2022 22:06:57Json remove keyvoid testjson2()
{
var raw = File.ReadAllText("database.json");
var o = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(raw);

Console.WriteLine($"Before=\n{o.ToString()}\n\n\n");


o.Property("key2").Remove();
Console.WriteLine($"After=\n{o.ToString()}");
}
27
3/29/2022 9:30:38list up file infoOpen powershell and run command

$(get-item .\*.exe).VersionInfo | FL >exeinfo.txt
$(get-item .\*.dll).VersionInfo | FL >dllinfo.txt
28
2/18/2022 17:32:32create .lib from dll::When you have a DLL library you want to use in your C++ code,
::you may do it dynamically by using LoadLibrary and GetProcAddress functions from WinAPI,
::but it's more convenient to do it statically.
::But it's not enough to just #include signatures of library functions and use them in your project.
::You also need to link with some LIB file, even if the file is not a real static library with compiled code,
::but only a few-kilobyte-long list of imported functions. I believe that's just another flaw of C++ language,
::because other languages like for example C# don't need this even when importing functions from native DLL libraries.
::
::If you have some SDK prepared for Visual C++ or compile the library by yourself, you also get the LIB file next to DLL.
::But if you have only the library, that article shows following steps to generate matching LIB:
::
::1. From Start menu run "Visual Studio Command Prompt".
::
::2. Execute command:
::
::dumpbin /exports DLL_FILE.dll > DEF_FILE.def
::This command prints some information about given DLL library in textual form to its standard output.
::We redirect it to a text file with DEF extension. But to make it real DEF file, we need to edit it.
::
::3. Open DEF_FILE.def in some text editor and edit it to contain only the names of exported functions in form of:
::
::EXPORTS
::function_1_name
::function_2_name
::function_3_name
::...
::4. From the Visual Studio Command Prompt, execute another command:
::
::lib /def:DEF_FILE.def /out:LIB_FILE.lib /machine:x86
::And there you have it! The so much required LIB file generated from DLL library.
::You only need signatures of these functions with proper parameters and return values declared
::in some H header file and you can successfully use your DLL by linking with LIB file created by yourself :)
29
2/3/2022 23:18:17Labsat3http://www.labsat.co.uk/downloads/product-info/Telnet%20Manual.pdf
30
1/13/2022 14:46:14radioFM:
AM:
DAB(BAND III):
DAB(BAND L):
DABETI(BAND III):
DABETI(BAND L):
HD-FM:
HD-AM:
XM:
31
1/12/2022 14:03:14Averna Signal TesterAverna Signal Tester
32
12/21/2021 20:34:04BCM89810https://docs.broadcom.com/doc/12358277
33
12/21/2021 20:31:30Automotive ethernet1.
https://github.com/0xAA/B618s-22d-OSS/blob/abe4a5a806cb06213f0c0c359894df64489dd153/kernel/drivers/net/phy/bcm89810.c

2.
https://www.nxp.com/docs/en/user-guide/UM11602.pdf

34
12/17/2021 21:37:10Embbedded DLL to exe c#all what to do is install costure.fody from NuGet
35
11/27/2021 14:56:38wpf datagrid get click rowprivate void Expander_Expanded(object sender, RoutedEventArgs e)
{
Button expandCollapseButton = (Button)sender;
Console.WriteLine($"Clicked noIndex = {expandCollapseButton.Tag}");

int noIndex = int.Parse(expandCollapseButton.Tag.ToString());

dgvData[noIndex - 1].SwitchRowDetalsExpand();

//Button expandCollapseButton = (Button)sender;
//DataGridRow selectedRow = DataGridRow.GetRowContainingElement(expandCollapseButton);
//if (null != expandCollapseButton && "+" == expandCollapseButton.Content.ToString())
//{
// selectedRow.DetailsVisibility = Visibility.Visible;
// expandCollapseButton.Content = "-";
//}
//else
//{
// selectedRow.DetailsVisibility = Visibility.Collapsed;
// expandCollapseButton.Content = "+";
//}


//for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual)
//if (vis is DataGridRow row)
//{
// Console.WriteLine($"Clicked in = {row.GetIndex()}");

// //row.DetailsVisibility = row.DetailsVisibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
// break;
//}
}
36
11/27/2021 14:54:30wpf Task update UIprivate void Button_Click(object sender, RoutedEventArgs e)
{

Task.Run(() => CalculateMyOperation(mySource));

}

private void CalculateMyOperation(List<int> values)
{
foreach (var i in values)
{
var currentProgress = i;
Dispatcher.BeginInvoke(new Action(() =>
{
//myLabel.Content = "Updating..." + currentProgress;
tb_colIndex.Text = i.ToString();
}), DispatcherPriority.Background);
}

}
37
11/27/2021 13:50:01Wpf datagrid select rowdgvitems[lastSelectedRow].IsSelected = true;
lastSelectedRow++;
dgvitems[lastSelectedRow].IsSelected = true;
object item = dgvUser.Items[lastSelectedRow];
dgvUser.ScrollIntoView(item);
var row123 = (DataGridRow)dgvUser.ItemContainerGenerator.ContainerFromIndex(lastSelectedRow);
row123.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
38
11/18/2021 22:09:47wpf datagrid set tooltip to cell<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="ToolTip" Value="{Binding Name}" />
</Style>
</DataGridTextColumn.CellStyle>
39
11/18/2021 22:05:50wpf datagrid header alignment <DataGridComboBoxColumn.HeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<!--<Setter Property="HorizontalAlignment" Value="Center"/>-->
</Style>
</DataGridComboBoxColumn.HeaderStyle>
40
11/18/2021 22:03:15
wpf datagrid show/hiden row base on datatriger
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsHidden}" Value="true">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
41
7/6/2021 23:32:10get number from stringstring resultString = Regex.Match(line.Trim(), @"\d+").Value;
42
7/6/2021 23:31:53get line from multiline string string test = "0: ON\n 1: OFF \n2 : AAA";
using (var reader = new StringReader(test))
{
for (string line = reader.ReadLine(); line != null; line = reader.ReadLine())
{
// Do something with the line

Console.WriteLine(line.Trim());
}
}
43
44
1/15/2023 17:15:26surfacetextureStruct: VirtualDisplay > Surface(SurfaceTexture) > Opengl > MediaCodec encoder

createEncoder()
encoderInputSurface = MediaCodec#createInputSurface()

render = createRender(encoderInputSurface)
surfaceTexture = new SurfaceTexture(false) -> first run call SurfaceTexture#attachToGLContext(texName)
inputSurface = new Surface(surfaceTexture)


virtualDisplay = DisplayManager#createVirtualDisplay()
virtualDisplay#setSurface(inputSurface)
45
1/15/2023 23:43:55magick comapre batch script@echo off

for %%f in (*.png *.jpg *.bmp) do (
call :magick_cmp "%%f"
)

:magick_cmp
FOR /F %%A in ('magick.exe compare -metric AE girl1.jpg %1 null: 2^>^&1') DO set pixelDiff=%%A
echo %pixelDiff%, %1
46
2/9/2023 22:46:38dockerhttps://viblo.asia/p/tim-hieu-ve-dockerfile-va-tao-docker-image-V3m5WWag5O7
47
2/10/2023 17:03:44docker
●install
https://docs.docker.com/engine/install/ubuntu/


●pull image
docker pull microsoft/azure-cli

●show images
sudo docker image ls

●show container
sudo docker container ls

●create from Dockerfile
sudo docker build -t <image name> <location of Dockerfile>

Ex:
sudo docker build -t simpli_image .


●run image
sudo docker run hello-world
sudo docker run -it microsoft/azure-cli bash

To try something more ambitious, you can run an Ubuntu container with:
$ sudo docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/


★reset all, clear all image
sudo docker system prune -a

★Remove build cache
docker builder prune
48
2/15/2023 22:54:18Java Code Rulehttps://source.android.com/docs/setup/contribute/code-style
49
2/16/2023 21:22:18Unit testhttps://gpcoder.com/5486-tong-hop-cac-bai-viet-ve-unit-test-trong-java/
50
2/16/2023 22:14:56androidTesthttps://proandroiddev.com/a-guide-to-test-pyramid-in-android-part-1-8b3b42d0a150
51
2/17/2023 18:41:28sss
@RunWith(PowerMockRunner.class)
field = Whitebox.getField(testClass.class, "mtestpara");
Mockito.when(getValue()).thenReturn(1);
Method method = testClass.class.getDeclaredMethod("ssss", View.class);
method.setAccessible(true);
method.invoke(testTarget, view);
52
2/22/2023 18:34:32LOCAL_OVERRIDES_PACKAGESLOCAL_OVERRIDES_PACKAGES
53
10/2/2023 1:18:09QT Traininghttps://drive.google.com/drive/folders/1Ssc7VWmV1wtZQgGmUiI1XhUgHvamXk8z
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100