tag:blogger.com,1999:blog-65048442024-03-13T12:05:27.184-07:00My StuffMy Techiestuff.L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.comBlogger457125tag:blogger.com,1999:blog-6504844.post-48318485447192249542022-02-05T23:08:00.003-08:002022-02-05T23:08:37.871-08:00Solution to Weak Sound from Maono USB/XLR HD300T Microphone<p> I bought a USB/XLR Dynamic Microphone "Maono HD-300T" from <a href="https://www.amazon.com/gp/product/B08XXGSLPK/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1">Amazon</a> a few months ago and was disappointed with its low or quiet sound made by my Windows 11 when connected through its USB connection. I tested the microphone through its XLR connection to my Yamaha Audio mixer, no phantom power is needed (as this is a dynamic microphone), but I had to set the preamp gain all the way to its max to get a decent volume.</p><p>The volume setting was set to 100%, but I had no luck making it better. I was thinking perhaps it required a special USB driver, but nope, it simply used the stock Windows driver (Maono's official website doesn't mention anything about a special driver for this particular model).</p><p>At one point I gave up on using it for my video conferences and meetings and back to just using the built-in microphone on my webcam (Logitech HD 920). Last week I found an idea to test the microphone using my PC analog microphone input. I found and bought an XLR-to-3.5mm TRS which is perfect to connect the microphone to my PC. The good thing with built-in audio from motherboard is that Windows support boost gain to +30 dB, so I was able to make the microphone work properly.</p><p>Not being satisfied with that one solution, I googled around and found somebody mentioned about Equalizer APO and its accompanying UI interface, Peace Equalizer APO. Got them installed and ran, I then connected my Microphone to one of my PC's USB. After playing around on how to use it (It's a lot of parameter controls and kind of confusing, at least for beginners), I managed to boost the gain of the microphone to + 3- dB. Hooray!</p><p>Below is my settings (I saved it as "My Microphone mono" settings. It is based on the "Microphone mono" preset configuration.):</p><p><br /></p><p>Set the preamp to gain around +20 dB. As can be seen, I turn on "Prevent Clipping" down below, so even if set it to the max (+30 dB gain), we shouldn't get the audio clipped. The downside to crank it up to the max is we'd also get louder noise.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgLKohn7w9FcYwXQJs-HJ1ZxOK-4AO6V_k2cxuxKhdPooCa6soI_Sl2eD37Yls0NrsircnbBlsumGBVold7OFoMw0zhLY7SURzuQddHMqI1Ik6bkSwQVuqzXKOZ3zngX8Ei-d7eCvG5Z0_X2Z3pgvXqwwZ_drU49Ljq5sckjalmGppq-2lStg=s1091" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="840" data-original-width="1091" height="493" src="https://blogger.googleusercontent.com/img/a/AVvXsEgLKohn7w9FcYwXQJs-HJ1ZxOK-4AO6V_k2cxuxKhdPooCa6soI_Sl2eD37Yls0NrsircnbBlsumGBVold7OFoMw0zhLY7SURzuQddHMqI1Ik6bkSwQVuqzXKOZ3zngX8Ei-d7eCvG5Z0_X2Z3pgvXqwwZ_drU49Ljq5sckjalmGppq-2lStg=w640-h493" width="640" /></a></div><div><br /></div><div><br /></div><br /><p><br /></p><p><br /></p><p><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgIyCIcUwixWREXG0ttySM0FSEML-j-YBsmVKGGaKbiXmrbQNaa83YVW9YQ44eOQeF1dU_Ats3-n_nMIq-YY0xWDAIMch2yh8wa21p09lEAQwlSPKBbwVnpP9EMFCeCnxHJ0dSPbXki99QKOiwJ2WeBsYym9x4jbiEaPZF6lbWjbkxKojS-iw=s582" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="582" data-original-width="465" src="https://blogger.googleusercontent.com/img/a/AVvXsEgIyCIcUwixWREXG0ttySM0FSEML-j-YBsmVKGGaKbiXmrbQNaa83YVW9YQ44eOQeF1dU_Ats3-n_nMIq-YY0xWDAIMch2yh8wa21p09lEAQwlSPKBbwVnpP9EMFCeCnxHJ0dSPbXki99QKOiwJ2WeBsYym9x4jbiEaPZF6lbWjbkxKojS-iw=s16000" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">I configure the audio to live play back to its headphone connector (so I can hear my own voice for monitoring purposes):</div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjPqFVa4idjDCPY7OZY9Q1qnQakg01Qf7p3RbPOyK_G4zY6K5zQgMDYab0MSwGqcmPQcP83-WfnyScI7shgTCB3ChtwHCqSocAoEQfsDPiEod9uzBr_Xw_Mgy8_a3jVH31_Z1L6yM-bSq_1bpaOivfvJF7j5zu3dP2ulk40Qn2t-nKbeae9jw=s582" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="582" data-original-width="465" src="https://blogger.googleusercontent.com/img/a/AVvXsEjPqFVa4idjDCPY7OZY9Q1qnQakg01Qf7p3RbPOyK_G4zY6K5zQgMDYab0MSwGqcmPQcP83-WfnyScI7shgTCB3ChtwHCqSocAoEQfsDPiEod9uzBr_Xw_Mgy8_a3jVH31_Z1L6yM-bSq_1bpaOivfvJF7j5zu3dP2ulk40Qn2t-nKbeae9jw=s16000" /></a></div><div><br /></div>The level is always set to 100% in this pane:<div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEj6MUpYkG2cc7LDRpX1fvmevzt8RoHHdhy5OHxvAqblsyKWruSri08BOru54H34p9aXzwOWDvIU32CVdPWjcQVSctrjI_oaWjf_bDhOigtJScHAH5HKyxuLZAiS1K-DO7yuHM8008prCaXW38cELnOOsI4_JNjfxorLjDNoLu0AtZBg7xpOOA=s582" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="582" data-original-width="465" src="https://blogger.googleusercontent.com/img/a/AVvXsEj6MUpYkG2cc7LDRpX1fvmevzt8RoHHdhy5OHxvAqblsyKWruSri08BOru54H34p9aXzwOWDvIU32CVdPWjcQVSctrjI_oaWjf_bDhOigtJScHAH5HKyxuLZAiS1K-DO7yuHM8008prCaXW38cELnOOsI4_JNjfxorLjDNoLu0AtZBg7xpOOA=s16000" /></a></div><br /></div>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-86002032591069427322021-12-18T00:57:00.003-08:002022-01-16T11:42:25.502-08:002.5 Gbps Ethernet slowing down<p> I was having issues again with the unexpected slowness of my internet access. This time turns out due to failure in ethernet auto-negotiation. My PC's ethernet interface is 2.5 Gbps, as well MoCA adapter that is connected to it. It was working fine, until yesterday, where I got only 90's Mbps on SpeedTest.</p><p>There is cool PowerShell command to display the link speed: Get-NetAdapter.</p><p>We can create a DOS shell wrapper, so invoking this from a regular DOS prompt would work.</p><p>For example, I put this command in a file called "getnet.ps1". I created another DOS script called "getnet.cmd" with the content of it just calling getps1.ps1:</p><p><br /></p><p>In getnet.ps1:</p><p><span style="font-family: courier;">Get-NetAdapter</span></p><p><br /></p><p>In getnet.cmd:</p><p><span style="font-family: courier;">call getnet.ps1</span></p><p><br /></p><p>For example:</p><p>C:\Users\anon\bin>type getnet.cmd</p><p>call getnet.ps1</p><p><br /></p><p><span style="font-family: courier; font-size: x-small;">C:\Users\lshih\bin>getnet</span></p><p><span style="font-family: courier; font-size: x-small;"><br /></span></p><p><span style="font-family: courier; font-size: x-small;">C:\Users\lshih\bin>call getnet.ps1</span></p><p><span style="font-family: courier; font-size: x-small;"><br /></span></p><p><span style="font-family: courier; font-size: x-small;">Name InterfaceDescription ifIndex Status MacAddress LinkSpeed</span></p><p><span style="font-family: courier; font-size: x-small;">---- -------------------- ------- ------ ---------- ---------</span></p><p><span style="font-family: courier; font-size: x-small;">Bluetooth Network Conn... Bluetooth Device (Personal Area Netw... 27 Disconnected 38-FC-98-13-E9-2A 3 Mbps</span></p><p><span style="font-family: courier; font-size: x-small;">2.5 GigE LAN Realtek Gaming 2.5GbE Family Contr...#2 21 Up 04-42-1A-0C-2C-C4 2.5 Gbps</span></p><p><span style="font-family: courier; font-size: x-small;">vEthernet (2.5 GigE LAN) Hyper-V Virtual Ethernet Adapter 16 Up 00-15-5D-76-F1-69 10 Gbps</span></p><p><span style="font-family: courier; font-size: x-small;">vEthernet (1 GigE LAN) Hyper-V Virtual Ethernet Adapter #3 52 Up 00-15-5D-D2-5B-EB 10 Gbps</span></p><p><span style="font-family: courier; font-size: x-small;">1 GigE LAN Intel(R) I211 Gigabit Network Conn...#2 14 Up 04-42-1A-0C-2C-C3 1 Gbps</span></p><p><span style="font-family: courier; font-size: x-small;">vEthernet (VirtualBox ... Hyper-V Virtual Ethernet Adapter #2 40 Up 00-15-5D-F1-53-24 10 Gbps</span></p><p><span style="font-family: courier; font-size: x-small;">VirtualBox Host-Only N... VirtualBox Host-Only Ethernet Adapter 7 Up 0A-00-27-00-00-07 1 Gbps</span></p><p><span style="font-family: courier; font-size: x-small;">vEthernet (WSL) Hyper-V Virtual Ethernet Adapter #4 75 Up 00-15-5D-9C-4E-D0 10 Gbps</span></p><div><br /></div>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-68335317802357592882021-12-17T11:56:00.003-08:002021-12-17T11:56:37.687-08:00Chinese Hackers are now the top of the list<p> My gateway router has a cool security feature called Intrusive Threat Prevention (ITS). When I checked the statistics from where most of the attacks occurred to my gateway, majority the attacks come from China.</p><p><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjYV3v4DFor9svWiY_vq9c2I6XLulhlEam7EGLpHynCD5LrCv1jI02_-xmlmjJs2gp6_JOg8naLeIN0I_su5ryFHAOuv0N1b5asEDVdUrJHnU813tBakRQ2PWXwWKQph6g3CX48ckpal6rjUO6FzimT-dZ0yU1T5HmlSUEErcO2nF5ATl4E0Q=s1401" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1072" data-original-width="1401" height="490" src="https://blogger.googleusercontent.com/img/a/AVvXsEjYV3v4DFor9svWiY_vq9c2I6XLulhlEam7EGLpHynCD5LrCv1jI02_-xmlmjJs2gp6_JOg8naLeIN0I_su5ryFHAOuv0N1b5asEDVdUrJHnU813tBakRQ2PWXwWKQph6g3CX48ckpal6rjUO6FzimT-dZ0yU1T5HmlSUEErcO2nF5ATl4E0Q=w640-h490" width="640" /></a></div><br /><p><br /></p>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-72718906501330290862021-12-10T22:53:00.001-08:002021-12-10T23:23:06.908-08:00What is the maximum Transmit Power sent by 5G Iphone?<p> I have been wondering so far how much power a 5G phone, like iPhone 12, can transmit to RAN (Radio Access Network), a.k.a. a base station.</p><p>According to the table in standard document ETSI TS 138 101-1, section 6.2.1 for "UE maximum output power", the maximum power for class 2 is 26 dBm (0.398 Watt) and for class 3 is 23 dBm (0.199 Watt). Class 2 UE (User Element) only transmits at certain frequency bands only, namely n41, n77, n78, and n79, while class 3 transmits in all spectrums.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjFQOzTsNf1li8nFBbDof2nwMw_0sKL3ClRk3PWcaqnHmTW_nLPZm6SMkFAqVMNYkEvPn1mk--YNGDZVEvU3tH2ArYajOBnuMfv3BslaoKNYUIhisnZ1yCVDt8EH2P-mWuf9yR7Ry9Zz4lBEuTMDZxv6VMkAXGKGXFQy1etoc78iD2gsHOlgA=s737" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="737" data-original-width="645" src="https://blogger.googleusercontent.com/img/a/AVvXsEjFQOzTsNf1li8nFBbDof2nwMw_0sKL3ClRk3PWcaqnHmTW_nLPZm6SMkFAqVMNYkEvPn1mk--YNGDZVEvU3tH2ArYajOBnuMfv3BslaoKNYUIhisnZ1yCVDt8EH2P-mWuf9yR7Ry9Zz4lBEuTMDZxv6VMkAXGKGXFQy1etoc78iD2gsHOlgA=s16000" /></a></div><div><br /></div>As stated, the period of measurement shall be at least one sub-frame (sfn, 1ms). <div><br /></div><div>The above maximum value is rarely reached unless the signal reception by UE or BS (Base station) is too weak.<br /><p>To understand what are those NR bands, see <a href="https://en.wikipedia.org/wiki/5G_NR_frequency_bands">5G NR frequency bands - Wikipedia</a></p><p><br /></p><p><br /></p></div>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-57751453948142149452021-11-30T14:39:00.001-08:002022-06-01T14:05:34.078-07:00Enabling Older Key Algorithms in SSH<p>Supposedly the server we want to access is at address 192.168.1.11 and it only supports older key hash algorithms. Add those algorithms in ~/.ssh/config, such as:</p><p><br /></p><div style="text-align: left;"><span style="font-family: courier;"> Host 192.168.1.11<br /></span><span style="font-family: courier;"> KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1<br /></span><span style="font-family: courier;"> </span><span style="font-family: courier;">PubkeyAcceptedAlgorithms +ssh-rsa<br /></span><span style="font-family: courier;"> HostkeyAlgorithms +ssh-rsa</span></div><p><span style="font-family: courier;"><br /></span></p><div><br /></div>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-17287989445894766102021-11-29T23:24:00.001-08:002021-12-10T22:59:44.923-08:00Some tools to display EXIF data<p> exifprobe</p><p>exiftags</p><p>exiftran</p><p>exiv2</p><p>fim</p><p>mediainfo (my favorite)</p><p><br /></p><p>To install some of those, just install the following:</p><p>forensics-all</p><p>forensics-extra</p><p><br /></p>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-36047201687348674122021-11-27T14:23:00.001-08:002021-11-27T14:23:09.290-08:00Storage Format for USB Hard Disk<p> I recently bought a 5 TB USB3 hard disk to back up my data (mostly my photo and video files. I had a data disaster recently, so I bought the EaseUS disaster backup data recovery tool, but it required a huge amount of data to restore).</p><p>Out of the box, without paying attention to the factory default format it has (extFAT), the 5 TB space has only about 0.6 TB space left. I doubt I had that much-used data (as the source of the recovered data is from a 1 TB hard drive). After doing some investigation (the detail is down below), I found out that the allocation unit size (AUS) of the removable hard disk is pretty big, I think it is too big to storage average files. So I am in the process of backing up the data to my other hard drive (NTFS, 4k AUS), before I can reformat the drive to have a smaller AUS.</p><p>Meanwhile, I am not decided whether to stick with extFAT or change it to NTFS. I don't really care about portability to other OSes, especially Apple products (sorry MacOS!), as I am pretty much a Windows (plus Linux) user. Yes, I am all aware that so far Linux supports R/W to NTFS in userspace only (the kernel driver only supports read and some limited write access, but that requires some enabling). But, the good news is that, according to the recent news, a company called Paragon is willing to make its full-blown proprietary NTFS driver (which fully supports NTFS features) to the Linux community. The effort is planned to be available starting in Kernel 5.15. This will really boost the performance and features of NTFS in Linux.[1]</p><p>To have 256K AUS seems too expensive. According to [3] for Test 3 and 4 (Read & Write, 1 GB of data file), extFAT is slightly faster, but for smaller files (Test 1 and 2, 1 GB file size), NTFS prevails. For duplication or deletion (Test 8 and 9), NTFS is more than 1.60 faster than FAT32 and 1.3 faster than extFAT).</p><p>Some useful information:</p><p>For 2 TB to 16 TB hard drive, 4 KB AUS is enough for an NTFS-formatted hard drive.[2]</p><p><br /></p><p>Disk Partition Information:</p><p><br /></p><p><span style="font-family: courier;">C:\Windows\System32>diskpart</span></p><div><span style="font-family: courier;"><br /></span></div><span style="font-family: courier;">Microsoft DiskPart version 10.0.22000.1<br />Copyright (C) Microsoft Corporation.<br /><br />On computer: ASUS-ROGSTRIX-X</span><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"><div>DISKPART> list disk</div><div><br /></div><div> Disk ### Status Size Free Dyn Gpt</div><div> -------- ------------- ------- ------- --- ---</div><div> Disk 0 Online 3726 GB 1024 KB * *</div><div> Disk 1 Online 698 GB 0 B * *</div><div> Disk 2 Online 298 GB 1024 KB * *</div><div> Disk 3 Online 931 GB 3072 KB *</div><div> Disk 4 Online 4657 GB 0 B *</div><div> Disk 5 Online 14 GB 0 B</div><div><br /></div><div><div>DISKPART> list volume</div><div><br /></div><div> Volume ### Ltr Label Fs Type Size Status Info</div><div> ---------- --- ----------- ----- ---------- ------- --------- --------</div><div> Volume 0 X BACKUP_DISK NTFS Simple 3726 GB Healthy</div><div> Volume 1 Z SpannedDisk NTFS Spanned 996 GB Healthy</div><div> Volume 2 System Rese NTFS Partition 549 MB Healthy</div><div> Volume 3 C NTFS Partition 929 GB Healthy Boot</div><div> Volume 4 NTFS Partition 544 MB Healthy</div><div> Volume 5 FAT32 Partition 299 MB Healthy System</div><div> Volume 6 NTFS Partition 609 MB Healthy Hidden</div><div> Volume 7 I One Touch exFAT Partition 4657 GB Healthy</div><div> Volume 8 EFI FAT32 Partition 200 MB Healthy Hidden</div><div> Volume 9 E Win10Pro NTFS Removable 14 GB Healthy</div></div><div><div><br /></div><div>DISKPART> select disk 4</div><div><br /></div><div>Disk 4 is now the selected disk.</div></div><div><br /></div><div><div>DISKPART> list partition</div><div><br /></div><div> Partition ### Type Size Offset</div><div> ------------- ---------------- ------- -------</div><div> Partition 1 System 200 MB 20 KB</div><div> Partition 2 Primary 4657 GB 201 MB</div></div></span><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"><div>select partition 2</div><div><br /></div><div>Partition 2 is now the selected partition.</div><div><br /></div><div><br /></div><div>DISKPART> filesystems</div><div><br /></div><div>Current File System</div><div><br /></div><div> Type : <span style="background-color: #fcff01;">exFAT</span></div><div> Allocation Unit Size : <span style="background-color: #fcff01;"><b>256K</b></span></div><div> Flags : 00000000</div><div><br /></div><div>File Systems Supported for Formatting</div><div><br /></div><div> Type : NTFS (Default)</div><div> Allocation Unit Sizes: 4096 (Default), 8192, 16K, 32K, 64K, 128K, 256K, 512K, 1024K, 2048K</div><div><br /></div><div> Type : exFAT</div><div> Allocation Unit Sizes: 512K, 1024K, 2048K (Default), 4096K, 8192K, 16384K, 32768K</div><div><br /></div><div>DISKPART></div><div><br /></div><div><br /></div><div><br /></div></span><div><br /></div><div><br /></div><p>Ref:</p><p>[1] <a href="https://www.zdnet.com/article/linux-boosts-microsoft-ntfs-support-as-linus-torvalds-complains-about-github-merges/">Linux boosts Microsoft NTFS support as Linus Torvalds complains about GitHub merges | ZDNet</a></p><p>[2] <a href="https://support.microsoft.com/en-gb/topic/default-cluster-size-for-ntfs-fat-and-exfat-9772e6f1-e31a-00d7-e18f-73169155af95">Default cluster size for NTFS, FAT, and exFAT (microsoft.com)</a></p><p>[3] <a href="https://www.flexense.com/fat32_exfat_ntfs_usb3_performance_comparison.html">Flexense - Data Management Software - FAT32 vs. exFAT vs. NTFS USB3 Performance Comparison</a></p></div></div>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-66061727014108483072021-11-18T16:40:00.004-08:002021-12-17T12:04:15.275-08:00Xfinity Superfast still slow<p>I recently upgraded my Internet connection plan with Xfinity from Internet 200 Mbps plus TV to 900 Mbps Superfast plan (with TV plan dropped. Who cares with TV these days?). It was a good deal plan, as I now pay less with a lot faster nominal Internet speed.</p><p>In the beginning, after waiting an hour as told by the customer service, I saw the upstream speed improved to 20+ Mbps, but the upstream speed did not increase (stayed at around 140 Mbps). A few calls/chats with the customer service representatives (they sent a few update signals) and modem and router reboots nothing improved.</p><p>After the last call to them, they decided to send a technician to visit the next day. I had tried almost everything (except setting the router's settings to factory defaults). My home network setup is little bit complicated, with the AP router and DOCSIS 3.1 modem sitting in a mounted rack in the walking closet. </p><p>The coaxial cable from ISP is split through a 1-to-8 Moca-Ready splitter (5-2300 MHz, -11 dB drop between Out and In), because I need to connect the TV in the living room through MoCA as well as some bedrooms and home office. In the beginning, I thought the chocking was due to interference with MoCA (as the DOCSIS cable modem shared the same coax medium with MoCA modems). Not sure whether I still need to change that splitter (-11 dB drop is a little too much, not counting the bandwidth is only up to 2300, not 2400 or 2500 MHz. But when I checked the MoCA specs, the frequency span for MoCA 2.5 is from 1002 to 1675 MHz.)</p><p>Out of my patience (I use the Internet on a daily basis as part of Work From Home with Citrix connection, hence requires constant and speedy internet link), I decided to simplify the connection by removing the set-top box (which soon I'd return as I'd no longer have TV service), so the cable modem was wired directly to the ISP (not through splitter). This did not resolve the data rate, although it improved the SNR in the modem.</p><p>Out of my frustration, I factory reset my Synology Router Rt2600a and redid the speed test. And...voila! I got 700+ Mbps. Yes, it's still far from 900 Mbps as promised, but at least it's 4x faster than what I got before. Turned out, the "Threat Prevention" add-on feature in Synology Router was the culprit. It was CPU-intensive processing, which shouldn't be performed by a normal CPU, probably by a special or dedicated CPU doing this kind of inspection and prevention.</p><p>I still really need to have an intrusion prevention feature as it has been securing my home network heavily from hackers and spam. Perhaps it is time to shop for a dedicated intrusion prevention device.</p>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-18119430713275489662021-10-19T14:40:00.004-07:002021-10-19T14:40:22.439-07:00Upgrading Dell T-3500<h2 style="text-align: left;">Existing System Config</h2><p>System:<span style="white-space: pre;"> </span>Dell Precision WorkStation T3500 (all builds)</p><p>Motherboard:<span style="white-space: pre;"> </span>Dell 09KPNV</p><p>Memory:<span style="white-space: pre;"> </span>5.6 GB free of 12 GB (6x2GB) @ 1.3 GHz DIMM DDR3-1333 (PC3-10600)</p><p>Display:<span style="white-space: pre;"> </span>1920 x 1080 - 32 Bit colors, 1680 x 1050 - 32 Bit colors,</p><p>OS:<span style="white-space: pre;"> </span>Windows 10</p><p>BIOS Date:<span style="white-space: pre;"> </span>20130528</p><p>CPU:<span style="white-space: pre;"> </span>Intel Xeon W3550 (QC, 8 threads @3.06 GHz)</p><p>Disk:<span style="white-space: pre;"> </span>Seagate Barracuda 7200.12 1TB</p><p>VGA:<span style="white-space: pre;"> </span>Dual NVidia Quadro NVS 420</p><p><br /></p><p><br /></p><h2 style="text-align: left;">Upgradeables</h2><p>Here is the list parts upgrades.</p><p><br /></p><p></p><ul style="text-align: left;"><li>For GTX 1070 6-pin to 8-pin PCI Express Power Converter Cable for Video Card </li></ul><p></p><p></p><ol style="text-align: left;"><ol><li>Video Card EVGA GeForce GTX 1070 SC GAMING ACX 3.0 Black Edition, 08G-P4-5173-KR</li><li>Video Card NVIDIA Founders Edition GeForce GTX 970 </li></ol></ol><p></p><p><br /></p><p></p><ul style="text-align: left;"><li>For GTX 970 6 pin PCIe to dual 6+2 pin PCIe splitter Cable for Video Card</li></ul><p></p><p></p><ol style="text-align: left;"><ol><li><span> </span>Video Card GIGABYTE GeForce GTX 1050Ti OC Low Profile 4GB, GBTGV-N105TOC-4GL</li><li>Hynix HMT125U6DFR8C-H9 Memory DDR3 1333MHz ( 2GB 2Rx8 DDR3 PC3-10600U )</li><li>Kingston KP223C-ELD Memory DDR3 1333MHz ( 2GB 2Rx8 DDR3 PC3-10600U )</li><li>Samsung 256GB 850 Pro Solid State Drive</li><li>Dell 0R494D R494D Caddy Tray 2.5" - 3.5"</li><li>Seagate 2TB 2.5" Laptop Internal Hard Drive</li></ol></ol><p></p><p><br /></p><p><br /></p><h3 style="text-align: left;">Power Supply</h3><p></p><ul style="text-align: left;"><li>EVGA - BR Series 700W ATX12V /EPS12V 80 Plus Power</li><li>EVGA 700BR 100-BR-0700-K1 fits and works fine</li></ul><p></p><p><br /></p><p><br /></p><h3 style="text-align: left;">CPU:</h3><p></p><ul style="text-align: left;"><li>Xeon QC X5667 3.06Ghz 12MB 6.40GTs 95W Processor | 3.46Ghz Max Turbo Frequency (SLBVA)</li><li>Xeon QC W5580 3.20Ghz 8MB 6.40GTs 130W Processor | 3.46Ghz Max Turbo Frequency (SLBF2)</li><li>Xeon QC W5590 3.33Ghz 8MB 6.40GTs 130W Processor | 3.6Ghz Max Turbo Frequency (SLBGE)</li><li>Xeon 6C X5670 2.93GHz 12MB 6.4 GT/s LGA1366 Six Core CPU Processor (SLBV7)</li><li>Xeon QC X5677 3.46Ghz 12MB 6.40GTs 130W Processor | 3.73Ghz Max Turbo Frequency (SLBV9)</li><li>Xeon QC X5687 3.6Ghz 12MB 6.40GTs 130W Processor | 3.86Ghz Max Turbo Frequency (SLBVY)</li><li>Xeon 6C X5680 3.33Ghz 12MB 6.40GTs 130W Processor | 3.60Ghz Max Turbo Frequency (SLBV5)</li><li>Xeon 6C W3690 3.46Ghz 12MB 6.40GTs 130W Processor | 3.73Ghz Max Turbo Frequency (SLBW2) </li><li>Xeon 6C X5690 3.46Ghz 12MB 6.40GTs 130W Processor | 3.73Ghz Max Turbo Frequency (SLBVX) </li></ul><p></p><p><br /></p><p><br /></p><h3 style="text-align: left;">RAM:</h3><p>DO NOT mix E or U modules (E modules tend to run faster). </p><p>T3500 doesn't support registered modules (R modules!), and there is 6 Slots on the motherboard.</p><p>Max speed: 1333 MHz (PC10600)</p><p><br /></p><p>Memory PN’s:</p><p></p><ul style="text-align: left;"><li>Hynix HMT125U6DFR8C-H9 Memory DDR3 1333MHz ( 2GB 2Rx8 DDR3 PC3-10600U )</li><li>Kingston KP223C-ELD Memory DDR3 1333MHz ( 2GB 2Rx8 DDR3 PC3-10600U )</li><li>2GB PC10600U 2Rx8 Non-ECC Unregistered (P223C)</li><li>2GB PC10600E 1Rx8 ECC Unregistered (DM0KY)</li><li>2GB PC12800E 1Rx8 ECC Unregisterd (YY90K)</li><li>4GB PC10600U 2Rx8 Non-ECC Unregistered (P328H)</li><li>4GB PC10600E 2Rx8 ECC Unregistered (T192H)</li><li>4GB PC12800E 2Rx8 PC3L ECC Unregistered (6DWFJ)</li><li>8GB PC12800E 2RX8 PC3 ECC Unregistered (MT18JSF1G72AZ-1G6E1ZF) <--- </li><li>8GB PC12800E 2Rx2 PC3L ECC Unregistered (HMT41GU7AFR8A-PB)</li></ul><p></p><p><br /></p><p>Recommended Memory configurations:</p><p></p><ul style="text-align: left;"><li>6 x 2GB PC10600E or 12800E Modules (12GB)</li><li>3 x 4GB PC10600E or 12800E Modules (12GB)</li><li>4 x 4GB PC10600E or 12800E Modules (16GB)</li><li>6 x 4GB PC10600E or 12800E Modules (24GB)</li></ul><p></p><p><br /></p><p></p><ul style="text-align: left;"><li>12 GB = 6*2GB SIM DDR3 PC10600 <==== original configuration</li><li>24 GB = 3*8GB SIMM DDR3 modules</li><li>32 GB = 4*8GB SIMM DDR3 modules</li><li>40 GB = 5*8GB SIMM DDR3 modules</li><li>48 GB = 6 * 8GB SIMM DDR3 modules (Max size!)</li></ul><p></p><p><br /></p><h3 style="text-align: left;">GPU</h3><div>With the standard included Power-supply:</div><p></p><ul style="text-align: left;"><li>NVIDIA GTX1050 TI 4GB Graphics Card</li><li>EVGA NVIDIA GTX1660 Ti 6GB Graphics Card</li></ul><p></p><p><br /></p><p>With Upgraded 700W EVG 700B Power Supply:</p><p style="text-align: left;"></p><ul style="text-align: left;"><li>EVGA NVIDIA GTX1070 8GB SC Graphics Card</li><li>EVGA NVIDIA GTX1070TI 8GB Graphics Card</li><li>EVGA NVIDIA GTX1080 SC 8GB Graphics Card</li><li>EVGA NVIDIA GTX1080 TI 11GB SC2 ICX Technology Graphics Card</li><li>EVGA NVIDIA RTX 2060 6GB Graphics Card</li><li>EVGA NVIDIA RTX 2060 Super 8GB Graphics Card</li><li>EVGA NVIDIA RTX 2070 8GB Graphics Card</li><li>EVGA NVIDIA RTX 2070 Super Graphics Card</li></ul><p></p><p><br /></p><p><br /></p><h3 style="text-align: left;">SSD</h3><p>The motherboard doesn't support NVME protocol, so we cannot boot O/S from it that requires UEFI, which you're not going to find on any eight year old PC system. But NVME SSD can be used to store data after booting (e.g, just to store video game data).</p><p>NVME.2 SSD Adapter *Required to Install NVME.2*</p><p>Recommended NVME.2 SSDs:</p><p></p><ul style="text-align: left;"><li>Samsung 960 EVO Series – 500GB NVMe – M.2 Internal SSD (MZ-V6E500BW)</li><li>Samsung 960 EVO Series – 1TB PCIe NVMe – M.2 Internal SSD (MZ-V6E1T0BW)</li><li>SAMSUNG (MZ-V7S1T0B/AM) 970 EVO Plus SSD 1TB - M.2 (w/ M key)</li><li>SAMSUNG (MZ-V8V1T0B/AM) 980 SSD 1TB - M.2 NVMe Interface Internal Solid State Drive with V-NAND Technology</li></ul><p></p><p><br /></p><h3 style="text-align: left;">Misc:</h3><p><br /></p><p>- Heatsink compound Arctic Silver</p><p><br /></p><p>M.2 is a form factor:</p><p></p><ul style="text-align: left;"><li>2240 (40 mm height)</li><li>2260 (60 mm height)</li><li>2280 (80 mm height)</li></ul><p></p><p><br /></p><p>NVME SSD vs SATA SSD:</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;">SATA III Hard Drive<span style="white-space: pre;"> </span>SATA III SSD<span style="white-space: pre;"> <span> </span><span> </span></span>NVMe SSD</p></blockquote><p></p><ul style="text-align: left;"><li>~100 MB/s Read<span style="white-space: pre;"> </span>530 MB/s Read<span style="white-space: pre;"> </span>3,500 MB/s Read</li><li>~100 MB/s Write<span style="white-space: pre;"> </span>500 MB/s Write<span style="white-space: pre;"> </span>3,000 MB/s Write</li></ul><p></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-47498779904649556242021-05-09T15:28:00.007-07:002021-11-03T22:19:24.287-07:00Make Citrix work in Linux<ol style="background-color: white; border: 0px; box-sizing: inherit; color: #242729; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; list-style-image: initial; list-style-position: initial; margin: 0px 0px 0px 30px; padding: 0px; vertical-align: baseline;"><li style="border: 0px; box-sizing: inherit; font-stretch: inherit; font-style: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin-bottom: var(--s-prose-spacing-condensed); margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-wrap: break-word; padding: 0px; vertical-align: baseline;"><code style="background-color: var(--black-075); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: inherit; color: var(--black-800); font-size: 15px; font-stretch: inherit; font-style: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 2px 4px; vertical-align: baseline;"><span face="Arial, Helvetica Neue, Helvetica, sans-serif">export</span></code><code style="background-color: var(--black-075); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 2px 4px; vertical-align: baseline; white-space: pre-wrap;">ICAROOT=/opt/Citrix/ICAClient</code></li><li style="border: 0px; box-sizing: inherit; font-stretch: inherit; font-style: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin-bottom: var(--s-prose-spacing-condensed); margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-wrap: break-word; padding: 0px; vertical-align: baseline;"><code style="background-color: var(--black-075); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: inherit; color: var(--black-800); font-size: 15px; font-stretch: inherit; font-style: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 2px 4px; vertical-align: baseline;"><span face="Arial, Helvetica Neue, Helvetica, sans-serif">Copy files in</span></code><code style="background-color: var(--black-075); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 2px 4px; vertical-align: baseline; white-space: pre-wrap;">/usr/share/ca-certificates/mozilla/* to </code>$ICAROOT/keystore/cacerts</li><li style="border: 0px; box-sizing: inherit; font-family: inherit; font-size: 15px; font-stretch: inherit; font-style: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin-bottom: var(--s-prose-spacing-condensed); margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-wrap: break-word; padding: 0px; vertical-align: baseline;"><p style="border: 0px; box-sizing: inherit; clear: both; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin-bottom: var(--s-prose-spacing-condensed); margin-left: 0px; margin-right: 0px; margin-top: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: inherit; font-style: inherit; font-variant-caps: inherit; font-variant-ligatures: inherit; font-weight: inherit;">Rehash the certificate by the following command: $ICAROOT/util/ctx_rehash</span></p></li><li style="border: 0px; box-sizing: inherit; font-family: inherit; font-size: 15px; font-stretch: inherit; font-style: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; overflow-wrap: break-word; padding: 0px; vertical-align: baseline;">Reopen Citrix Receiver. </li></ol>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-29302413208367298162021-02-21T21:03:00.002-08:002021-02-21T21:03:11.041-08:00Logitech Speakerphone with Linux Mint<p> My Logitech USB Speakarphone has stopped working since I did something wrong (which I don't remember). Various troubleshooting and zillions of searches on the Internet did not fix the issue, until today.</p><p>The issue was the device did not make any sound at all. Checking via ALSA and Kernel log said everything was fine as shown below:</p><p><span style="font-family: courier; font-size: x-small;">$ lsusb</span></p><p><span style="font-family: courier; font-size: x-small;">...</span></p><p><span style="font-family: courier; font-size: x-small;">Bus 002 Device 011: ID 046d:0a06 Logitech, Inc. </span></p><p><span style="font-family: courier; font-size: x-small;">Bus 002 Device 009: ID 046d:c51c Logitech, Inc. </span></p><div><span style="font-family: courier; font-size: x-small;">...</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><p><span style="font-family: courier; font-size: x-small;">$ inxi -A</span></p><p><span style="font-family: courier; font-size: x-small;">Audio: Device-1: Intel 82801I HD Audio driver: snd_hda_intel </span></p><p><span style="font-family: courier; font-size: x-small;"> Device-2: ViXS Systems XCode 2100 Series driver: N/A </span></p><p><span style="font-family: courier; font-size: x-small;"> Device-3: AMD Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] driver: snd_hda_intel </span></p><p><span style="font-family: courier; font-size: x-small;"> <span style="background-color: #fcff01;">Device-4: Logitech type: USB driver: snd-usb-audio </span></span></p><p><span style="font-family: courier; font-size: x-small;"> Sound Server: ALSA v: k4.15.0-135-generic </span></p><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><div><span style="font-family: courier; font-size: x-small;">$ dmesg | ack -i Logitech</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.347659] usb 2-7.3.1: Manufacturer: Logitech</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.351947] input: Logitech VoIP USB Dual RF Receiver as /devices/pci0000:00/0000:00:1d.7/usb2/2-7/2-7.3/2-7.3.1/2-7.3.1:1.0/0003:046D:C51C.0002/input/input5</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.408172] hid-generic 0003:046D:C51C.0002: input,hidraw1: USB HID v1.11 Keyboard [Logitech VoIP USB Dual RF Receiver] on usb-0000:00:1d.7-7.3.1/input0</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.412142] input: Logitech VoIP USB Dual RF Receiver as /devices/pci0000:00/0000:00:1d.7/usb2/2-7/2-7.3/2-7.3.1/2-7.3.1:1.1/0003:046D:C51C.0003/input/input6</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.472241] hid-generic 0003:046D:C51C.0003: input,hiddev1,hidraw2: USB HID v1.11 Mouse [Logitech VoIP USB Dual RF Receiver] on usb-0000:00:1d.7-7.3.1/input1</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.744033] usb 2-7.3.2: Product: Logitech EasyCall Speakerphone</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.744035] usb 2-7.3.2: Manufacturer: Logitech</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.936663] usb 2-7.7.2: Manufacturer: Logitech</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.944780] input: Logitech USB Laser Mouse as /devices/pci0000:00/0000:00:1d.7/usb2/2-7/2-7.7/2-7.7.2/2-7.7.2:1.0/0003:046D:C069.0006/input/input9</span></div><div><span style="font-family: courier; font-size: x-small;">[ 4.944928] hid-generic 0003:046D:C069.0006: input,hidraw5: USB HID v1.10 Mouse [Logitech USB Laser Mouse] on usb-0000:00:1d.7-7.7.2/input0</span></div></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><div><span style="font-family: courier; font-size: x-small;">$ aplay -l</span></div><div><span style="font-family: courier; font-size: x-small;">**** List of PLAYBACK Hardware Devices ****</span></div><div><span style="font-family: courier; font-size: x-small;">card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevices: 8/8</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevice #0: subdevice #0</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevice #1: subdevice #1</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevice #2: subdevice #2</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevice #3: subdevice #3</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevice #4: subdevice #4</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevice #5: subdevice #5</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevice #6: subdevice #6</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevice #7: subdevice #7</span></div><div><span style="font-family: courier; font-size: x-small;">...</span></div><div><span style="font-family: courier; font-size: x-small;">...</span></div><div><span style="font-family: courier; font-size: x-small;">card 3: Speakerphone [Logitech EasyCall Speakerphone], device 0: USB Audio [USB Audio]</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevices: 0/1</span></div><div><span style="font-family: courier; font-size: x-small;"> Subdevice #0: subdevice #0</span></div></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><div><span style="font-family: courier; font-size: x-small;">$ cat /proc/asound/modules </span></div><div><span style="font-family: courier; font-size: x-small;"> 0 snd_aloop</span></div><div><span style="font-family: courier; font-size: x-small;"> 1 snd_hda_intel</span></div><div><span style="font-family: courier; font-size: x-small;"> 2 snd_hda_intel</span></div><div><span style="font-family: courier; font-size: x-small;"> 3 snd_usb_audio</span></div></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><div><span style="font-family: courier; font-size: x-small;">$ cat /proc/asound/cards </span></div><div><span style="font-family: courier; font-size: x-small;"> 0 [Loopback ]: Loopback - Loopback</span></div><div><span style="font-family: courier; font-size: x-small;"> Loopback 1</span></div><div><span style="font-family: courier; font-size: x-small;"> 1 [Intel ]: HDA-Intel - HDA Intel</span></div><div><span style="font-family: courier; font-size: x-small;"> HDA Intel at 0xfe7f4000 irq 32</span></div><div><span style="font-family: courier; font-size: x-small;"> 2 [HDMI ]: HDA-Intel - HDA ATI HDMI</span></div><div><span style="font-family: courier; font-size: x-small;"> HDA ATI HDMI at 0xfebfc000 irq 33</span></div><div><span style="font-family: courier; font-size: x-small;"> 3 [Speakerphone ]: USB-Audio - Logitech EasyCall Speakerphone</span></div><div><span style="font-family: courier; font-size: x-small;"> Logitech Logitech EasyCall Speakerphone at usb-0000:00:1d.7-7.3.2, full speed</span></div></div><div><br /></div><div><br /></div><div>Tried to see from Pulse Audio control, it did not show the USB speakerphone device at all.</div><div><br /></div><div>Turned out it was due to the presence of <span style="color: #2b00fe;"><b>/etc/asound.conf</b></span>. After I renamed it to something else, my audio started to work!</div>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-7042671477754515082021-02-19T17:49:00.007-08:002021-02-19T17:49:50.057-08:00Rename files with Regex rule<p> In Linux, there is very powerful tool to rename files based on pattern we specify. The pattern follows Perl-like regular expression.</p><p><br /></p><p>For example, if I have files as follow:</p><span style="font-family: courier; font-size: x-small;"><br /><br />01_-_bohemian_rhapsody_-_queen_-_greatest_hits_cd1.mp3<br /><br /> 05_-_bicycle_race_-_queen_-_greatest_hits_cd1.mp3<br /><br />"07_-_it's_a_hard_life_-_queen_-_greatest_hits_cd2.mp3"<br /><br /> 09_-_who_wants_to_live_forever_-_queen_-_greatest_hits_cd2.mp3<br /><br /> 11_-_the_miracle_-_queen_-_greatest_hits_cd2.mp3<br /><br /> 15_-_friends_will_be_friends_-_queen_-_greatest_hits_cd2.mp3<br /><br /> 16_-_the_show_must_go_on_-_queen_-_greatest_hits_cd2.mp3<br /><br /> 16_-_we_will_rock_you_-_queen_-_greatest_hits_cd1.mp3<br /><br /> 17_-_we_are_the_champions_-_queen_-_greatest_hits_cd1.mp3</span><p><br /></p><p>and I want to rename them by replacing the "_-_" part to be just "-". The single command to do that is:</p><p><br /></p><span style="font-family: courier; font-size: x-small;"><br /><br />$ <b>rename -n -v 's/_-_/-/g' *</b><br /><br />rename(01_-_bohemian_rhapsody_-_queen_-_greatest_hits_cd1.mp3, 01-bohemian_rhapsody-queen-greatest_hits_cd1.mp3)<br /><br />rename(05_-_bicycle_race_-_queen_-_greatest_hits_cd1.mp3, 05-bicycle_race-queen-greatest_hits_cd1.mp3)<br /><br />rename(07_-_it's_a_hard_life_-_queen_-_greatest_hits_cd2.mp3, 07-it's_a_hard_life-queen-greatest_hits_cd2.mp3)<br /><br />rename(09_-_who_wants_to_live_forever_-_queen_-_greatest_hits_cd2.mp3, 09-who_wants_to_live_forever-queen-greatest_hits_cd2.mp3)<br /><br />rename(11_-_the_miracle_-_queen_-_greatest_hits_cd2.mp3, 11-the_miracle-queen-greatest_hits_cd2.mp3)<br /><br />rename(15_-_friends_will_be_friends_-_queen_-_greatest_hits_cd2.mp3, 15-friends_will_be_friends-queen-greatest_hits_cd2.mp3)<br /><br />rename(16_-_the_show_must_go_on_-_queen_-_greatest_hits_cd2.mp3, 16-the_show_must_go_on-queen-greatest_hits_cd2.mp3)<br /><br />rename(16_-_we_will_rock_you_-_queen_-_greatest_hits_cd1.mp3, 16-we_will_rock_you-queen-greatest_hits_cd1.mp3)<br /><br />rename(17_-_we_are_the_champions_-_queen_-_greatest_hits_cd1.mp3, 17-we_are_the_champions-queen-greatest_hits_cd1.mp3)</span><p><br /></p><p>(the argument "-n" above is to tell rename not to actually perform renaming, but just to display what it would do). I use "/g" in the regular expression to tell it to rename all occurrences of "_-_" throughout the file name, not just for the first time it encounters it.</p>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-9608142898838568192021-02-19T17:31:00.002-08:002021-02-19T17:39:54.817-08:00Linux script to display Some information of MP3 files<p> The following bash script utilizes mediainfo command line to retrieve various metadata inside an MP3 (or any media file, in fact):</p><p><br /></p><pre style="color: #333333; line-height: 16.25px; margin-bottom: 0px; margin-top: 0px;"><span style="color: #888888;">#!/bin/sh</span>
<span style="color: #996633;">i</span>=0
<span style="color: #008800; font-weight: bold;">for </span>f in <span style="background-color: #fff0f0;">"$@"</span>
<span style="color: #008800; font-weight: bold;">do</span>
<span style="color: #008800; font-weight: bold;"> </span><span style="color: #996633;">i</span>=<span style="color: #008800; font-weight: bold;">$((</span>i+1<span style="color: #008800; font-weight: bold;">))</span>
<span style="color: #007020;">printf</span> <span style="background-color: #fff0f0;">"%d,"</span> <span style="color: #996633;">$i</span>
mediainfo --Inform=<span style="background-color: #fff0f0;">"General;%CompleteName%,%Format%,%OverallBitRate_Mode%,%BitRate%,%FileSize/String4%"</span> <span style="background-color: #fff0f0;">"${f}"</span>
<span style="color: #008800; font-weight: bold;">done</span></pre><pre style="color: #333333; line-height: 16.25px; margin-bottom: 0px; margin-top: 0px;"><span style="color: #008800; font-weight: bold;"><br /></span></pre><pre style="color: #333333; line-height: 16.25px; margin-bottom: 0px; margin-top: 0px;"><span style="color: #008800; font-weight: bold;"><br /></span></pre><pre style="color: #333333; line-height: 16.25px; margin-bottom: 0px; margin-top: 0px;"><br /></pre><pre style="color: #333333; line-height: 16.25px; margin-bottom: 0px; margin-top: 0px;"><br /></pre><pre style="color: #333333; line-height: 16.25px; margin-bottom: 0px; margin-top: 0px;"><br /></pre>
For example (I put the above into a script named 'bitrate.sh'):<div><br /></div><span style="font-family: courier; font-size: x-small;">$ bitrate.sh *.mp3<br />1,01_-_bohemian_rhapsody_-_queen_-_greatest_hits_cd1.mp3,MPEG Audio,CBR,256000,10.94 MiB<br />2,05_-_bicycle_race_-_queen_-_greatest_hits_cd1.mp3,MPEG Audio,CBR,256000,5.612 MiB<br />3,07_-_it's_a_hard_life_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,7.620 MiB<br />4,09_-_who_wants_to_live_forever_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,9.075 MiB<br />5,11_-_the_miracle_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,9.002 MiB<br />6,15_-_friends_will_be_friends_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,7.599 MiB<br />7,16_-_the_show_must_go_on_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,8.048 MiB<br />8,16_-_we_will_rock_you_-_queen_-_greatest_hits_cd1.mp3,MPEG Audio,CBR,256000,3.741 MiB<br />9,17_-_we_are_the_champions_-_queen_-_greatest_hits_cd1.mp3,MPEG Audio,CBR,256000,5.542 MiB</span><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: inherit;">The output is in CSV, suitable to be imported as a table in spreadsheet.</span></div>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0Oregon, USA43.8041334 -120.554201215.493899563821152 -155.7104512 72.11436723617885 -85.3979512tag:blogger.com,1999:blog-6504844.post-91796406335433469642020-12-20T23:09:00.001-08:002020-12-20T23:09:47.456-08:00Plex Server inaccessible with LG TV nor Ipone<p> I recently had access issue to my Plex server (running on Linux). It was fine sometime ago, but lately everytime I tried to access it from my LG TV or my phone, they said the server was offline. I'd followed various instructions and troubleshooting I found on the Internet with no luck. Here is the list of steps I did:</p><p></p><ul style="text-align: left;"><li>Ensure no VPN running on all devices and server</li><li>Select "Preferred" for secure connection</li><li>Added my private subnet in the "List of IP addresses and networks that are allowed without auth"</li><li>Upgrade the Plex server to the latest</li><li>Restart the server (e.g., "<i>sudo service plexmediaserver restart</i>")</li><li>Verify I am able to access the server through its IP (e.g, http://192.168.1.103:32400)</li><li>Enable DLNA server</li><li>Revert the Plex on TV to last publicly available version</li><li>Power down TV, wait 2 minutes and turn it back on</li></ul><p></p><p>Turned out it was due to IPv6 connection was enabled on the Plex server! Once I disabled it, now I could watch my movies or stream my music to other devices. My LG TV apparently did not support IPv6 yet.</p>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-11585216228926613212020-11-14T20:50:00.001-08:002020-11-14T20:50:12.061-08:00My Indentation configuration<p> The content of $HOME/.indent.pro:</p><p><br /></p><p>-as</p><p>-lp</p><p>-bad</p><p>-bap</p><p>-bbb</p><p>-bbo</p><p>-bli0</p><p>-nbc -c33 -cd33 -ncdb -nce -ci4 -cli0</p><p>-c4</p><p>-ncdw</p><p>-cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i8 -ip0 -l75 -lp -npcs</p><p>-nprs -npsl -saf -sai -saw -nsc -nsob -nss</p><p>-v</p>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-13756780632041607442020-07-05T23:19:00.003-07:002020-11-14T20:52:14.124-08:00Refoss Smart Wi-Fi Garage Door OpenerI bought an "add-on" device that will enable my garage door opener accessible via WiFi, as well as other automated processes as part of my home automation project last year. I bought it on Amazon: <a href="https://www.amazon.com/Refoss-Garage-Control-Compatible-Assistant/dp/B07PM59X4J/ref=cm_cr_arp_d_product_top?ie=UTF8&th=1">https://www.amazon.com/Refoss-Garage-Control-Compatible-Assistant/dp/B07PM59X4J/ref=cm_cr_arp_d_product_top?ie=UTF8&th=1</a><div><br /></div><div>It had been working perfectly since I installed it last year, but since the last few days ago it has stopped. I thought it must be something with the networking, so I followed the procedure instructed on the manual to configure it as a new device added to the eHomeLife on my iPhone, but with no luck. The manual says, if the WiFi LED blinks rapidly, the device has been correctly set to access our home network. But, I have not been able to connect my app to the device.</div><div><br /></div><div>Curious to see what was going on, I logged on to my AP router and could see the device had been assigned a valid IP address (192.168.1.55) and I could even ping it. That's all. I then did nmap to the device to see what ports were open. I could only see the following:</div><div><br /></div><div><p style="text-align: left;"><font face="courier" size="2">nmap -O -sO 192.168.1.55<br />WARNING: Disabling OS Scan (-O) as it is incompatible with the IPProto Scan (-sO)<br />Starting Nmap 7.80 ( https://nmap.org ) at 2020-07-05 21:44 Pacific Daylight Time<br />Nmap scan report for 192.168.1.55<br />Host is up (0.021s latency).<br />Not shown: 252 closed protocols<br />PROTOCOL STATE SERVICE<br />1 open icmp<br />6 open tcp<br />17 open udp<br />41 open|filtered ipv6<br />MAC Address: 48:E1:E9:51:07:50 (<span style="background-color: #fce8b2;"><b>Chengdu Meross</b></span> Technology)</font></p></div><div>Actually, if I press the WiFi button for more than 5 seconds to make it goes to configuration mode and then use the SSID of the device (it becomes an "AP" device temporarily), then open a browser to access it (at IP address 10.10.10.1, because my phone's IP was assigned 10.10.10.2), I could see basic web interface to set WIFI as well as to upgrade firmware.</div><div><br /></div><div>Googling for "Meross" or "Refoss" firmware couldn't give anything. The company's website also doesn't give any link or information about any firmware upgrade. Also, What's the difference between "Meross" and "Refoss"? Is Refoss is a knock-off of Meross? Both are Chinese companies.</div><div><br /></div><div>Honestly, I am now tempted to develop a similar by myself, probably using ESP32 (as using Raspberry-Pi for such thing is too much for such thing, not to consider more power-hungry).</div>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-89888306273371272772020-07-02T22:57:00.002-07:002020-12-01T09:23:00.845-08:00Mac Hash Table<font face="courier" size="2"><br /></font><div><div><table style="color: #333333; font-family: Verdana, Helvetica, Arial, sans-serif;"><tbody><tr><td><pre style="line-height: 16.25px; margin-bottom: 0px; margin-top: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115</pre></td><td><pre style="line-height: 16.25px; margin-bottom: 0px; margin-top: 0px;"><span style="color: #557799;">#include <stdio.h></span>
<span style="color: #557799;">#include <stdint.h></span>
<span style="color: #557799;">#include <string.h></span>
<span style="color: #557799;">#include <stdlib.h></span>
<span style="color: #008800; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">unsigned</span> <span style="color: #333399; font-weight: bold;">char</span> PseudoRandomHash[<span style="color: #0000dd; font-weight: bold;">256</span>] = {
<span style="color: #0000dd; font-weight: bold;">1</span>, <span style="color: #0000dd; font-weight: bold;">87</span>, <span style="color: #0000dd; font-weight: bold;">49</span>, <span style="color: #0000dd; font-weight: bold;">12</span>, <span style="color: #0000dd; font-weight: bold;">176</span>, <span style="color: #0000dd; font-weight: bold;">178</span>, <span style="color: #0000dd; font-weight: bold;">102</span>, <span style="color: #0000dd; font-weight: bold;">166</span>, <span style="color: #0000dd; font-weight: bold;">121</span>, <span style="color: #0000dd; font-weight: bold;">193</span>, <span style="color: #0000dd; font-weight: bold;">6</span>, <span style="color: #0000dd; font-weight: bold;">84</span>, <span style="color: #0000dd; font-weight: bold;">249</span>, <span style="color: #0000dd; font-weight: bold;">230</span>, <span style="color: #0000dd; font-weight: bold;">44</span>, <span style="color: #0000dd; font-weight: bold;">163</span>,
<span style="color: #0000dd; font-weight: bold;">14</span>, <span style="color: #0000dd; font-weight: bold;">197</span>, <span style="color: #0000dd; font-weight: bold;">213</span>, <span style="color: #0000dd; font-weight: bold;">181</span>, <span style="color: #0000dd; font-weight: bold;">161</span>, <span style="color: #0000dd; font-weight: bold;">85</span>, <span style="color: #0000dd; font-weight: bold;">218</span>, <span style="color: #0000dd; font-weight: bold;">80</span>, <span style="color: #0000dd; font-weight: bold;">64</span>, <span style="color: #0000dd; font-weight: bold;">239</span>, <span style="color: #0000dd; font-weight: bold;">24</span>, <span style="color: #0000dd; font-weight: bold;">226</span>, <span style="color: #0000dd; font-weight: bold;">236</span>, <span style="color: #0000dd; font-weight: bold;">142</span>, <span style="color: #0000dd; font-weight: bold;">38</span>, <span style="color: #0000dd; font-weight: bold;">200</span>,
<span style="color: #0000dd; font-weight: bold;">110</span>, <span style="color: #0000dd; font-weight: bold;">177</span>, <span style="color: #0000dd; font-weight: bold;">104</span>, <span style="color: #0000dd; font-weight: bold;">103</span>, <span style="color: #0000dd; font-weight: bold;">141</span>, <span style="color: #0000dd; font-weight: bold;">253</span>, <span style="color: #0000dd; font-weight: bold;">255</span>, <span style="color: #0000dd; font-weight: bold;">50</span>, <span style="color: #0000dd; font-weight: bold;">77</span>, <span style="color: #0000dd; font-weight: bold;">101</span>, <span style="color: #0000dd; font-weight: bold;">81</span>, <span style="color: #0000dd; font-weight: bold;">18</span>, <span style="color: #0000dd; font-weight: bold;">45</span>, <span style="color: #0000dd; font-weight: bold;">96</span>, <span style="color: #0000dd; font-weight: bold;">31</span>, <span style="color: #0000dd; font-weight: bold;">222</span>,
<span style="color: #0000dd; font-weight: bold;">25</span>, <span style="color: #0000dd; font-weight: bold;">107</span>, <span style="color: #0000dd; font-weight: bold;">190</span>, <span style="color: #0000dd; font-weight: bold;">70</span>, <span style="color: #0000dd; font-weight: bold;">86</span>, <span style="color: #0000dd; font-weight: bold;">237</span>, <span style="color: #0000dd; font-weight: bold;">240</span>, <span style="color: #0000dd; font-weight: bold;">34</span>, <span style="color: #0000dd; font-weight: bold;">72</span>, <span style="color: #0000dd; font-weight: bold;">242</span>, <span style="color: #0000dd; font-weight: bold;">20</span>, <span style="color: #0000dd; font-weight: bold;">214</span>, <span style="color: #0000dd; font-weight: bold;">244</span>, <span style="color: #0000dd; font-weight: bold;">227</span>, <span style="color: #0000dd; font-weight: bold;">149</span>, <span style="color: #0000dd; font-weight: bold;">235</span>,
<span style="color: #0000dd; font-weight: bold;">97</span>, <span style="color: #0000dd; font-weight: bold;">234</span>, <span style="color: #0000dd; font-weight: bold;">57</span>, <span style="color: #0000dd; font-weight: bold;">22</span>, <span style="color: #0000dd; font-weight: bold;">60</span>, <span style="color: #0000dd; font-weight: bold;">250</span>, <span style="color: #0000dd; font-weight: bold;">82</span>, <span style="color: #0000dd; font-weight: bold;">175</span>, <span style="color: #0000dd; font-weight: bold;">208</span>, <span style="color: #0000dd; font-weight: bold;">5</span>, <span style="color: #0000dd; font-weight: bold;">127</span>, <span style="color: #0000dd; font-weight: bold;">199</span>, <span style="color: #0000dd; font-weight: bold;">111</span>, <span style="color: #0000dd; font-weight: bold;">62</span>, <span style="color: #0000dd; font-weight: bold;">135</span>, <span style="color: #0000dd; font-weight: bold;">248</span>,
<span style="color: #0000dd; font-weight: bold;">174</span>, <span style="color: #0000dd; font-weight: bold;">169</span>, <span style="color: #0000dd; font-weight: bold;">211</span>, <span style="color: #0000dd; font-weight: bold;">58</span>, <span style="color: #0000dd; font-weight: bold;">66</span>, <span style="color: #0000dd; font-weight: bold;">154</span>, <span style="color: #0000dd; font-weight: bold;">106</span>, <span style="color: #0000dd; font-weight: bold;">195</span>, <span style="color: #0000dd; font-weight: bold;">245</span>, <span style="color: #0000dd; font-weight: bold;">171</span>, <span style="color: #0000dd; font-weight: bold;">17</span>, <span style="color: #0000dd; font-weight: bold;">187</span>, <span style="color: #0000dd; font-weight: bold;">182</span>, <span style="color: #0000dd; font-weight: bold;">179</span>, <span style="color: #0000dd; font-weight: bold;">0</span>, <span style="color: #0000dd; font-weight: bold;">243</span>,
<span style="color: #0000dd; font-weight: bold;">132</span>, <span style="color: #0000dd; font-weight: bold;">56</span>, <span style="color: #0000dd; font-weight: bold;">148</span>, <span style="color: #0000dd; font-weight: bold;">75</span>, <span style="color: #0000dd; font-weight: bold;">128</span>, <span style="color: #0000dd; font-weight: bold;">133</span>, <span style="color: #0000dd; font-weight: bold;">158</span>, <span style="color: #0000dd; font-weight: bold;">100</span>, <span style="color: #0000dd; font-weight: bold;">130</span>, <span style="color: #0000dd; font-weight: bold;">126</span>, <span style="color: #0000dd; font-weight: bold;">91</span>, <span style="color: #0000dd; font-weight: bold;">13</span>, <span style="color: #0000dd; font-weight: bold;">153</span>, <span style="color: #0000dd; font-weight: bold;">246</span>, <span style="color: #0000dd; font-weight: bold;">216</span>, <span style="color: #0000dd; font-weight: bold;">219</span>,
<span style="color: #0000dd; font-weight: bold;">119</span>, <span style="color: #0000dd; font-weight: bold;">68</span>, <span style="color: #0000dd; font-weight: bold;">223</span>, <span style="color: #0000dd; font-weight: bold;">78</span>, <span style="color: #0000dd; font-weight: bold;">83</span>, <span style="color: #0000dd; font-weight: bold;">88</span>, <span style="color: #0000dd; font-weight: bold;">201</span>, <span style="color: #0000dd; font-weight: bold;">99</span>, <span style="color: #0000dd; font-weight: bold;">122</span>, <span style="color: #0000dd; font-weight: bold;">11</span>, <span style="color: #0000dd; font-weight: bold;">92</span>, <span style="color: #0000dd; font-weight: bold;">32</span>, <span style="color: #0000dd; font-weight: bold;">136</span>, <span style="color: #0000dd; font-weight: bold;">114</span>, <span style="color: #0000dd; font-weight: bold;">52</span>, <span style="color: #0000dd; font-weight: bold;">10</span>,
<span style="color: #0000dd; font-weight: bold;">138</span>, <span style="color: #0000dd; font-weight: bold;">30</span>, <span style="color: #0000dd; font-weight: bold;">48</span>, <span style="color: #0000dd; font-weight: bold;">183</span>, <span style="color: #0000dd; font-weight: bold;">156</span>, <span style="color: #0000dd; font-weight: bold;">35</span>, <span style="color: #0000dd; font-weight: bold;">61</span>, <span style="color: #0000dd; font-weight: bold;">26</span>, <span style="color: #0000dd; font-weight: bold;">143</span>, <span style="color: #0000dd; font-weight: bold;">74</span>, <span style="color: #0000dd; font-weight: bold;">251</span>, <span style="color: #0000dd; font-weight: bold;">94</span>, <span style="color: #0000dd; font-weight: bold;">129</span>, <span style="color: #0000dd; font-weight: bold;">162</span>, <span style="color: #0000dd; font-weight: bold;">63</span>, <span style="color: #0000dd; font-weight: bold;">152</span>,
<span style="color: #0000dd; font-weight: bold;">170</span>, <span style="color: #0000dd; font-weight: bold;">7</span>, <span style="color: #0000dd; font-weight: bold;">115</span>, <span style="color: #0000dd; font-weight: bold;">167</span>, <span style="color: #0000dd; font-weight: bold;">241</span>, <span style="color: #0000dd; font-weight: bold;">206</span>, <span style="color: #0000dd; font-weight: bold;">3</span>, <span style="color: #0000dd; font-weight: bold;">150</span>, <span style="color: #0000dd; font-weight: bold;">55</span>, <span style="color: #0000dd; font-weight: bold;">59</span>, <span style="color: #0000dd; font-weight: bold;">151</span>, <span style="color: #0000dd; font-weight: bold;">220</span>, <span style="color: #0000dd; font-weight: bold;">90</span>, <span style="color: #0000dd; font-weight: bold;">53</span>, <span style="color: #0000dd; font-weight: bold;">23</span>, <span style="color: #0000dd; font-weight: bold;">131</span>,
<span style="color: #0000dd; font-weight: bold;">125</span>, <span style="color: #0000dd; font-weight: bold;">173</span>, <span style="color: #0000dd; font-weight: bold;">15</span>, <span style="color: #0000dd; font-weight: bold;">238</span>, <span style="color: #0000dd; font-weight: bold;">79</span>, <span style="color: #0000dd; font-weight: bold;">95</span>, <span style="color: #0000dd; font-weight: bold;">89</span>, <span style="color: #0000dd; font-weight: bold;">16</span>, <span style="color: #0000dd; font-weight: bold;">105</span>, <span style="color: #0000dd; font-weight: bold;">137</span>, <span style="color: #0000dd; font-weight: bold;">225</span>, <span style="color: #0000dd; font-weight: bold;">224</span>, <span style="color: #0000dd; font-weight: bold;">217</span>, <span style="color: #0000dd; font-weight: bold;">160</span>, <span style="color: #0000dd; font-weight: bold;">37</span>, <span style="color: #0000dd; font-weight: bold;">123</span>,
<span style="color: #0000dd; font-weight: bold;">118</span>, <span style="color: #0000dd; font-weight: bold;">73</span>, <span style="color: #0000dd; font-weight: bold;">2</span>, <span style="color: #0000dd; font-weight: bold;">157</span>, <span style="color: #0000dd; font-weight: bold;">46</span>, <span style="color: #0000dd; font-weight: bold;">116</span>, <span style="color: #0000dd; font-weight: bold;">9</span>, <span style="color: #0000dd; font-weight: bold;">145</span>, <span style="color: #0000dd; font-weight: bold;">134</span>, <span style="color: #0000dd; font-weight: bold;">228</span>, <span style="color: #0000dd; font-weight: bold;">207</span>, <span style="color: #0000dd; font-weight: bold;">212</span>, <span style="color: #0000dd; font-weight: bold;">202</span>, <span style="color: #0000dd; font-weight: bold;">215</span>, <span style="color: #0000dd; font-weight: bold;">69</span>, <span style="color: #0000dd; font-weight: bold;">229</span>,
<span style="color: #0000dd; font-weight: bold;">27</span>, <span style="color: #0000dd; font-weight: bold;">188</span>, <span style="color: #0000dd; font-weight: bold;">67</span>, <span style="color: #0000dd; font-weight: bold;">124</span>, <span style="color: #0000dd; font-weight: bold;">168</span>, <span style="color: #0000dd; font-weight: bold;">252</span>, <span style="color: #0000dd; font-weight: bold;">42</span>, <span style="color: #0000dd; font-weight: bold;">4</span>, <span style="color: #0000dd; font-weight: bold;">29</span>, <span style="color: #0000dd; font-weight: bold;">108</span>, <span style="color: #0000dd; font-weight: bold;">21</span>, <span style="color: #0000dd; font-weight: bold;">247</span>, <span style="color: #0000dd; font-weight: bold;">19</span>, <span style="color: #0000dd; font-weight: bold;">205</span>, <span style="color: #0000dd; font-weight: bold;">39</span>, <span style="color: #0000dd; font-weight: bold;">203</span>,
<span style="color: #0000dd; font-weight: bold;">233</span>, <span style="color: #0000dd; font-weight: bold;">40</span>, <span style="color: #0000dd; font-weight: bold;">186</span>, <span style="color: #0000dd; font-weight: bold;">147</span>, <span style="color: #0000dd; font-weight: bold;">198</span>, <span style="color: #0000dd; font-weight: bold;">192</span>, <span style="color: #0000dd; font-weight: bold;">155</span>, <span style="color: #0000dd; font-weight: bold;">33</span>, <span style="color: #0000dd; font-weight: bold;">164</span>, <span style="color: #0000dd; font-weight: bold;">191</span>, <span style="color: #0000dd; font-weight: bold;">98</span>, <span style="color: #0000dd; font-weight: bold;">204</span>, <span style="color: #0000dd; font-weight: bold;">165</span>, <span style="color: #0000dd; font-weight: bold;">180</span>, <span style="color: #0000dd; font-weight: bold;">117</span>, <span style="color: #0000dd; font-weight: bold;">76</span>,
<span style="color: #0000dd; font-weight: bold;">140</span>, <span style="color: #0000dd; font-weight: bold;">36</span>, <span style="color: #0000dd; font-weight: bold;">210</span>, <span style="color: #0000dd; font-weight: bold;">172</span>, <span style="color: #0000dd; font-weight: bold;">41</span>, <span style="color: #0000dd; font-weight: bold;">54</span>, <span style="color: #0000dd; font-weight: bold;">159</span>, <span style="color: #0000dd; font-weight: bold;">8</span>, <span style="color: #0000dd; font-weight: bold;">185</span>, <span style="color: #0000dd; font-weight: bold;">232</span>, <span style="color: #0000dd; font-weight: bold;">113</span>, <span style="color: #0000dd; font-weight: bold;">196</span>, <span style="color: #0000dd; font-weight: bold;">231</span>, <span style="color: #0000dd; font-weight: bold;">47</span>, <span style="color: #0000dd; font-weight: bold;">146</span>, <span style="color: #0000dd; font-weight: bold;">120</span>,
<span style="color: #0000dd; font-weight: bold;">51</span>, <span style="color: #0000dd; font-weight: bold;">65</span>, <span style="color: #0000dd; font-weight: bold;">28</span>, <span style="color: #0000dd; font-weight: bold;">144</span>, <span style="color: #0000dd; font-weight: bold;">254</span>, <span style="color: #0000dd; font-weight: bold;">221</span>, <span style="color: #0000dd; font-weight: bold;">93</span>, <span style="color: #0000dd; font-weight: bold;">189</span>, <span style="color: #0000dd; font-weight: bold;">194</span>, <span style="color: #0000dd; font-weight: bold;">139</span>, <span style="color: #0000dd; font-weight: bold;">112</span>, <span style="color: #0000dd; font-weight: bold;">43</span>, <span style="color: #0000dd; font-weight: bold;">71</span>, <span style="color: #0000dd; font-weight: bold;">109</span>, <span style="color: #0000dd; font-weight: bold;">184</span>, <span style="color: #0000dd; font-weight: bold;">209</span>};
<span style="color: #557799;">#define N 256</span>
<span style="color: #333399; font-weight: bold;">int</span> <span style="color: #0066bb; font-weight: bold;">PearsonHash</span>(<span style="color: #333399; font-weight: bold;">uint64_t</span> macAddr)
{
<span style="color: #333399; font-weight: bold;">int</span> i;
<span style="color: #333399; font-weight: bold;">uint8_t</span> h[<span style="color: #008800; font-weight: bold;">sizeof</span>(<span style="color: #333399; font-weight: bold;">uint64_t</span>)];
<span style="color: #333399; font-weight: bold;">int</span> result;
bzero(h, <span style="color: #008800; font-weight: bold;">sizeof</span>(h));
<span style="color: #008800; font-weight: bold;">for</span>(i=<span style="color: #0000dd; font-weight: bold;">1</span>; i<<span style="color: #008800; font-weight: bold;">sizeof</span>(h); i++)
{
<span style="color: #333399; font-weight: bold;">uint8_t</span> byte = (<span style="color: #333399; font-weight: bold;">uint8_t</span>)(macAddr & <span style="color: #005588; font-weight: bold;">0xff</span>);
h[i] = PseudoRandomHash[(h[i-<span style="color: #0000dd; font-weight: bold;">1</span>] ^ byte) & <span style="color: #005588; font-weight: bold;">0xFF</span>];
macAddr >>= <span style="color: #0000dd; font-weight: bold;">8</span>;
result = h[i];
}
<span style="color: #008800; font-weight: bold;">return</span> result;
}
<span style="color: #008800; font-weight: bold;">typedef</span> <span style="color: #008800; font-weight: bold;">struct</span>
{
<span style="color: #333399; font-weight: bold;">uint64_t</span> macAddr;
<span style="color: #333399; font-weight: bold;">int</span> aid;
} RecordT;
RecordT* <span style="color: #0066bb; font-weight: bold;">buildHashTable</span>(<span style="color: #333399; font-weight: bold;">int</span> sz)
{
RecordT *p = calloc(sz, <span style="color: #008800; font-weight: bold;">sizeof</span>(RecordT));
<span style="color: #008800; font-weight: bold;">return</span> p;
}
<span style="color: #333399; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">addRecord</span>(RecordT* table, RecordT* rec)
{
<span style="color: #333399; font-weight: bold;">int</span> slot = PearsonHash(rec->macAddr);
table[slot].macAddr = rec->macAddr;
table[slot].aid = rec->aid;
}
RecordT* <span style="color: #0066bb; font-weight: bold;">findRecord</span>(RecordT *table, <span style="color: #333399; font-weight: bold;">uint64_t</span> mac)
{
<span style="color: #333399; font-weight: bold;">int</span> slot = PearsonHash(mac);
<span style="color: #008800; font-weight: bold;">return</span> &table[slot];
}
<span style="color: #333399; font-weight: bold;">int</span> <span style="color: #0066bb; font-weight: bold;">main</span>()
{
<span style="color: #333399; font-weight: bold;">int</span> i;
<span style="color: #333399; font-weight: bold;">int</span> n;
<span style="color: #008800; font-weight: bold;">const</span> <span style="color: #333399; font-weight: bold;">uint64_t</span> MacBase = <span style="color: #005588; font-weight: bold;">0x000011BABEBEEF00ULL</span>;
<span style="color: #333399; font-weight: bold;">uint64_t</span> macTable[N];
<span style="color: #008800; font-weight: bold;">for</span>(i=<span style="color: #0000dd; font-weight: bold;">0</span>; i<N; i++)
{
printf(<span style="background-color: #fff0f0;">" %03u "</span>, PseudoRandomHash[i]);
<span style="color: #008800; font-weight: bold;">if</span> ((i+<span style="color: #0000dd; font-weight: bold;">1</span>)%<span style="color: #0000dd; font-weight: bold;">16</span> == <span style="color: #0000dd; font-weight: bold;">0</span>)
printf(<span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>);
}
RecordT *hashTable = buildHashTable(N);
<span style="color: #008800; font-weight: bold;">for</span>(i=<span style="color: #0000dd; font-weight: bold;">0</span>; i<N; i++)
{
<span style="color: #333399; font-weight: bold;">uint64_t</span> mac;
macTable[i] = mac = MacBase + i;
}
<span style="color: #008800; font-weight: bold;">for</span>(i=<span style="color: #0000dd; font-weight: bold;">0</span>; i<N; ++i)
{
RecordT rec;
rec.macAddr = macTable[i];
rec.aid = N-i;
addRecord(hashTable, &rec);
}
<span style="color: #008800; font-weight: bold;">for</span>(i=<span style="color: #0000dd; font-weight: bold;">0</span>; i<N; i++)
{
printf(<span style="background-color: #fff0f0;">"%d</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\t</span><span style="background-color: #fff0f0;"> %08lX: </span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\t</span><span style="background-color: #fff0f0;">Slot=%u</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>, i, macTable[i], PearsonHash(macTable[i]));
}
<span style="color: #008800; font-weight: bold;">for</span>(<span style="color: #333399; font-weight: bold;">int</span> k=<span style="color: #0000dd; font-weight: bold;">0</span>; k<N; ++k)
{
<span style="color: #333399; font-weight: bold;">uint64_t</span> mac = macTable[k];
RecordT *p = findRecord(hashTable, mac);
printf(<span style="background-color: #fff0f0;">"mac[%d]=%08lX </span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\t</span><span style="background-color: #fff0f0;">rec(%08lX,%d)</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>, k, macTable[k], p->macAddr, p->aid);
}
free(hashTable);
} </pre></td></tr></tbody></table></div></div>L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-36006229848402624552020-06-17T18:13:00.004-07:002020-07-06T10:27:44.592-07:00Raspberry PI 3 Model B Rev 1.2 Power Wattage<div dir="ltr" style="text-align: left;" trbidi="on">
My order of USB power meter arrived a few days ago, but only today I could put it into use by plugging it in between the power supply adapter and my RPI.<br />
<br />
The way I test the max power consumed is by creating a small C program to do infinite loop such as:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">int main()</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">{</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> while (1) {}</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: inherit;">I executed it in four separate processes (open four terminals, and run the program in each one). This way I could exhaust the whole four cores in the CPU. I also GUI desktop on the machine (LXDE).</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Here what is shown by "top":</span><br />
<span style="font-family: inherit;"><br /></span>
<img alt="" src="data:image/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nmPBPnIihWNIyFCeIgKnJpW27ZAuTpfDqXI5n7H3XXmao3Re4x5z1UZuPZZ1Z0DuQ/jSGctj9VW6jY1GjKP7pN1HB6c9df7HKGds/3FZh4TnssdYHY+pzzHzGqs/6SBHYOD0GPj/SVo69L7wIhYAAAAASUVORK5CYII=" /><br />
<br />
<br />
My USB power meter shows 1.17 WH, meaning in each hour it consumes 2.37 Watt or 0.00237 KWh. If the price per kWh charged by Utility company is 12.01 cent ($0.1201/KWH), in a day I'd pay 0.00237 KWh* $0.1201/KWh * 24 hours = $0.006831288 or about $0.0068 per day. In a month I'd pay about $0.2 minimum.<br />
<br />
After I killed all those four infinite loop processes, the wattage did not drop. Instead I saw it climbed to almost 2 Watt-hour. I think over time it probably would drop back to around 2 W (idling time).</div>
L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-81745230206024603462020-03-23T13:30:00.001-07:002020-03-23T13:31:32.641-07:00What Coronavirus Symptoms Look Like, Day By Day<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.youtube.com/embed/OOJqHPfG7pA</div>
L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-7402575079743911172020-01-26T11:43:00.001-08:002020-01-26T11:58:43.057-08:00Windows Application Development on Linux<div dir="ltr" style="text-align: left;" trbidi="on">
Make sure you have installed MinGW on Linux:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt install mingw-w64 gdb-mingw-w64</span><br />
<br />
Optionally, for testing purpose, install also WINE:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">wine-stable wine-development wine64 wine64-development</span><br />
<br />
FYI, with my recent mingw32 installation, the location for needed DLL files are in :<br />
<br />
<b>/usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">ll /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/*.dll</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">-rwxr-xr-x 1 root root 482339 Mar 12 2018 /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libatomic-1.dll*</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">-rwxr-xr-x 1 root root 1190750 Mar 12 2018 /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libgcc_s_seh-1.dll*</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">-rwxr-xr-x 1 root root 1523015 Mar 12 2018 /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libgomp-1.dll*</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">-rwxr-xr-x 1 root root 1393636 Mar 12 2018 /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libquadmath-0.dll*</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">-rwxr-xr-x 1 root root 387526 Mar 12 2018 /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libssp-0.dll*</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">-rwxr-xr-x 1 root root 16229690 Mar 12 2018 /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libstdc++-6.dll*</span><br />
<div>
<br /></div>
<div>
(this path should be added into PATH to make wine able to run our compiled EXE)</div>
<br />
<br />
Example of Makefile:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">APP=MyGUI</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">CC=x86_64-w64-mingw32-g++</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">WRC=x86_64-w64-mingw32-windres</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">$(APP).exe : $(APP).o $(APP).res</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>$(CC) -mwindows $(APP).o $(APP).res -o $@</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">$(APP).o: $(APP).c</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>$(CC) -mwindows -c -o $@ $<</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">$(APP).res : resource.rc resource.h</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>$(WRC) $< -O coff -o $@</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">clean:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>rm *.res *.o $(APP).exe</span><br />
<br />
<br />
<br />
The Source code:<br />
<br />
<br />
<br />
<pre style="background: #ffffff; color: black;"><span style="color: dimgrey;">/*-------------------------------------------------*/</span>
<span style="color: dimgrey;">/* MyGUI.c - gui hello world */</span>
<span style="color: dimgrey;">/* build: gcc -mwindows MyGUI.c -o MyGUI.exe */</span>
<span style="color: dimgrey;">/*-------------------------------------------------*/</span>
<span style="color: #004a43;">#</span><span style="color: #004a43;">include </span><span style="color: maroon;"><</span><span style="color: #40015a;">windows.h</span><span style="color: maroon;">></span>
<span style="color: maroon; font-weight: bold;">char</span> glpszText<span style="color: #808030;">[</span><span style="color: #008c00;">1024</span><span style="color: #808030;">]</span><span style="color: purple;">;</span>
<span style="color: #603000;">LRESULT</span> <span style="color: #603000;">CALLBACK</span> WndProc<span style="color: #808030;">(</span><span style="color: #603000;">HWND</span><span style="color: #808030;">,</span> <span style="color: #603000;">UINT</span><span style="color: #808030;">,</span> <span style="color: #603000;">WPARAM</span><span style="color: #808030;">,</span> <span style="color: #603000;">LPARAM</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: #3f5fbf;">/******************************************************************************</span>
<span style="color: #3f5fbf;">* Main entry</span>
<span style="color: #3f5fbf;">******************************************************************************/</span>
<span style="color: maroon; font-weight: bold;">int</span> APIENTRY <span style="color: #400000;">WinMain</span><span style="color: #808030;">(</span><span style="color: #603000;">HINSTANCE</span> hInstance<span style="color: #808030;">,</span>
<span style="color: #603000;">HINSTANCE</span> hPrevInstance<span style="color: #808030;">,</span>
<span style="color: #603000;">LPSTR</span> lpCmdLine<span style="color: #808030;">,</span>
<span style="color: maroon; font-weight: bold;">int</span> nCmdShow<span style="color: #808030;">)</span>
<span style="color: purple;">{</span>
<span style="color: #400000;">wsprintf</span><span style="color: #808030;">(</span>glpszText<span style="color: #808030;">,</span>
<span style="color: maroon;">"</span><span style="color: #0000e6;">Hello World</span><span style="color: #0f69ff;">\n</span><span style="color: #0000e6;">GetCommandLine(): [</span><span style="color: #007997;">%s</span><span style="color: #0000e6;">]</span><span style="color: #0f69ff;">\n</span><span style="color: maroon;">"</span>
<span style="color: maroon;">"</span><span style="color: #0000e6;">WinMain lpCmdLine: [</span><span style="color: #007997;">%s</span><span style="color: #0000e6;">]</span><span style="color: #0f69ff;">\n</span><span style="color: maroon;">"</span><span style="color: #808030;">,</span>
lpCmdLine<span style="color: #808030;">,</span> <span style="color: #400000;">GetCommandLine</span><span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: #603000;">WNDCLASSEX</span> wcex<span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>cbSize <span style="color: #808030;">=</span> <span style="color: maroon; font-weight: bold;">sizeof</span><span style="color: #808030;">(</span>wcex<span style="color: #808030;">)</span><span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>style <span style="color: #808030;">=</span> CS_HREDRAW <span style="color: #808030;">|</span> CS_VREDRAW<span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>lpfnWndProc <span style="color: #808030;">=</span> WndProc<span style="color: purple;">;</span> <span style="color: dimgrey;">/* set the callback */</span>
wcex<span style="color: #808030;">.</span>cbClsExtra <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>cbWndExtra <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>hInstance <span style="color: #808030;">=</span> hInstance<span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>hIcon <span style="color: #808030;">=</span> <span style="color: #400000;">LoadIcon</span><span style="color: #808030;">(</span><span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> IDI_APPLICATION<span style="color: #808030;">)</span><span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>hCursor <span style="color: #808030;">=</span> <span style="color: #400000;">LoadCursor</span><span style="color: #808030;">(</span><span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> IDC_ARROW<span style="color: #808030;">)</span><span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>hbrBackground <span style="color: #808030;">=</span> <span style="color: #808030;">(</span><span style="color: #603000;">HBRUSH</span><span style="color: #808030;">)</span><span style="color: #808030;">(</span>COLOR_WINDOW<span style="color: #808030;">+</span><span style="color: #008c00;">1</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>lpszMenuName <span style="color: #808030;">=</span> <span style="color: #7d0045;">NULL</span><span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>lpszClassName <span style="color: #808030;">=</span> <span style="color: maroon;">"</span><span style="color: #0000e6;">MYGUI</span><span style="color: maroon;">"</span><span style="color: purple;">;</span>
wcex<span style="color: #808030;">.</span>hIconSm <span style="color: #808030;">=</span> <span style="color: #7d0045;">NULL</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">if</span> <span style="color: #808030;">(</span><span style="color: #808030;">!</span><span style="color: #400000;">RegisterClassEx</span><span style="color: #808030;">(</span><span style="color: #808030;">&</span>wcex<span style="color: #808030;">)</span><span style="color: #808030;">)</span>
<span style="color: maroon; font-weight: bold;">return</span> FALSE<span style="color: purple;">;</span>
<span style="color: #603000;">HWND</span> hWnd<span style="color: purple;">;</span>
hWnd <span style="color: #808030;">=</span> <span style="color: #400000;">CreateWindow</span><span style="color: #808030;">(</span><span style="color: maroon;">"</span><span style="color: #0000e6;">MYGUI</span><span style="color: maroon;">"</span><span style="color: #808030;">,</span> <span style="color: maroon;">"</span><span style="color: #0000e6;">MyGUI</span><span style="color: maroon;">"</span><span style="color: #808030;">,</span> <span style="color: #7d0045;">WS_OVERLAPPEDWINDOW</span><span style="color: #808030;">,</span>
CW_USEDEFAULT<span style="color: #808030;">,</span> CW_USEDEFAULT<span style="color: #808030;">,</span> CW_USEDEFAULT<span style="color: #808030;">,</span>
CW_USEDEFAULT<span style="color: #808030;">,</span> <span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> <span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> hInstance<span style="color: #808030;">,</span> <span style="color: #7d0045;">NULL</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">if</span> <span style="color: #808030;">(</span><span style="color: #808030;">!</span>hWnd<span style="color: #808030;">)</span>
<span style="color: maroon; font-weight: bold;">return</span> FALSE<span style="color: purple;">;</span>
<span style="color: #400000;">ShowWindow</span><span style="color: #808030;">(</span>hWnd<span style="color: #808030;">,</span> nCmdShow<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: #400000;">UpdateWindow</span><span style="color: #808030;">(</span>hWnd<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: #603000;">MSG</span> msg<span style="color: purple;">;</span>
<span style="color: dimgrey;">/* main loop */</span>
<span style="color: maroon; font-weight: bold;">while</span> <span style="color: #808030;">(</span><span style="color: #400000;">GetMessage</span><span style="color: #808030;">(</span><span style="color: #808030;">&</span>msg<span style="color: #808030;">,</span> <span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> <span style="color: #008c00;">0</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span>
<span style="color: purple;">{</span>
<span style="color: dimgrey;">/* we can intercept keystrokes here too if we want */</span>
<span style="color: #400000;">TranslateMessage</span><span style="color: #808030;">(</span><span style="color: #808030;">&</span>msg<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: #400000;">DispatchMessage</span><span style="color: #808030;">(</span><span style="color: #808030;">&</span>msg<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: purple;">}</span>
<span style="color: maroon; font-weight: bold;">return</span> msg<span style="color: #808030;">.</span>wParam<span style="color: purple;">;</span>
<span style="color: purple;">}</span>
<span style="color: #3f5fbf;">/******************************************************************************</span>
<span style="color: #3f5fbf;">* Main callback</span>
<span style="color: #3f5fbf;">******************************************************************************/</span>
<span style="color: #603000;">LRESULT</span> <span style="color: #603000;">CALLBACK</span> WndProc<span style="color: #808030;">(</span><span style="color: #603000;">HWND</span> hWnd<span style="color: #808030;">,</span> <span style="color: #603000;">UINT</span> message<span style="color: #808030;">,</span> <span style="color: #603000;">WPARAM</span> wParam<span style="color: #808030;">,</span> <span style="color: #603000;">LPARAM</span> lParam<span style="color: #808030;">)</span>
<span style="color: purple;">{</span>
<span style="color: #603000;">PAINTSTRUCT</span> ps<span style="color: purple;">;</span>
<span style="color: #603000;">HDC</span> hdc<span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">switch</span> <span style="color: #808030;">(</span>message<span style="color: #808030;">)</span>
<span style="color: purple;">{</span>
<span style="color: maroon; font-weight: bold;">case </span><span style="color: #7d0045;">WM_PAINT</span><span style="color: #e34adc;">:</span>
hdc <span style="color: #808030;">=</span> <span style="color: #400000;">BeginPaint</span><span style="color: #808030;">(</span>hWnd<span style="color: #808030;">,</span> <span style="color: #808030;">&</span>ps<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: #603000;">RECT</span> rt<span style="color: purple;">;</span>
<span style="color: #400000;">GetClientRect</span><span style="color: #808030;">(</span>hWnd<span style="color: #808030;">,</span> <span style="color: #808030;">&</span>rt<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: #400000;">DrawText</span><span style="color: #808030;">(</span>hdc<span style="color: #808030;">,</span> glpszText<span style="color: #808030;">,</span> <span style="color: #603000;">strlen</span><span style="color: #808030;">(</span>glpszText<span style="color: #808030;">)</span><span style="color: #808030;">,</span> <span style="color: #808030;">&</span>rt<span style="color: #808030;">,</span> DT_TOP <span style="color: #808030;">|</span> DT_LEFT<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: #400000;">EndPaint</span><span style="color: #808030;">(</span>hWnd<span style="color: #808030;">,</span> <span style="color: #808030;">&</span>ps<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">break</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">case </span><span style="color: #7d0045;">WM_DESTROY</span><span style="color: #e34adc;">:</span>
<span style="color: #400000;">PostQuitMessage</span><span style="color: #808030;">(</span><span style="color: #008c00;">0</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">break</span><span style="color: purple;">;</span>
<span style="color: #e34adc;"> </span><span style="color: maroon; font-weight: bold;">default</span><span style="color: #e34adc;">:</span>
<span style="color: dimgrey;">/* for everything else unhandled, do this */</span>
<span style="color: maroon; font-weight: bold;">return</span> <span style="color: #400000;">DefWindowProc</span><span style="color: #808030;">(</span>hWnd<span style="color: #808030;">,</span> message<span style="color: #808030;">,</span> wParam<span style="color: #808030;">,</span> lParam<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: purple;">}</span>
<span style="color: maroon; font-weight: bold;">return</span> <span style="color: #008c00;">0</span><span style="color: purple;">;</span>
<span style="color: purple;">}</span>
</pre>
<br />
<br />
To run:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">wine64 MyGUI.exe</span><br />
<br />
If we find issue that WINE could not find some MinGW's *.dll, create soft links in WINE's system directory to the MinGW's dll:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">pushd ~/.wine/drive_c/windows/system</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cp -s /usr/lib/gcc/i686-w64-mingw32/7.3-win32/*.dll .</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">popd</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: inherit;">To debug the EXE:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">i686-w64-mingw32-gdb <EXE code></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<br /></div>
L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-82773973755900950282020-01-09T17:01:00.000-08:002020-01-09T17:01:24.234-08:00To list (dir command) file names sorted by their name's length<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Suppose we want to list certain files (or all files in a directory), but sorted ascending by their filename's length.<br />
<br />
The following small script meets the purpose:<br />
<br />
First, create a PowerShell script, say, dirnamesize.ps1 with its content as below:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">param (</span><br />
<span style="font-family: Courier New, Courier, monospace;"> [string]$dirpath = "."</span><br />
<span style="font-family: Courier New, Courier, monospace;">)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">gci $dirpath | select-object name, @{Name="Nlength";Expression={$_.Name.Length}} | sort-object Nlength</span><br />
<br />
<br />
Second, create a normal DOS shell file to call that PowerShell (so we don't need to open PowerShell), say, dirnamesize.cmd with the content:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">set DIRPATH=%*</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: "Courier New", Courier, monospace;">@if "%DIRPATH%"=="" (</span><br />
<span style="font-family: Courier New, Courier, monospace;"> powershell dirnamesize.ps1</span><br />
<span style="font-family: Courier New, Courier, monospace;">) else (</span><br />
<span style="font-family: Courier New, Courier, monospace;"> powershell dirnamesize.ps1 -dirpath %DIRPATH%</span><br />
<span style="font-family: Courier New, Courier, monospace;">)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<br />
Example:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">C:\Windows>dirname *.xml</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">Name Nlength</span><br />
<span style="font-family: Courier New, Courier, monospace;">---- -------</span><br />
<span style="font-family: Courier New, Courier, monospace;">Education.xml 13</span><br />
<span style="font-family: Courier New, Courier, monospace;">ServerRdsh.xml 14</span><br />
<span style="font-family: Courier New, Courier, monospace;">Enterprise.xml 14</span><br />
<span style="font-family: Courier New, Courier, monospace;">Professional.xml 16</span><br />
<span style="font-family: Courier New, Courier, monospace;">ProfessionalEducation.xml 25</span><br />
<span style="font-family: Courier New, Courier, monospace;">ProfessionalWorkstation.xml 27</span><br />
<div>
<br /></div>
<br /></div>
L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-25224684442089215072019-12-29T00:29:00.000-08:002019-12-29T00:38:46.548-08:00Example of Intrusive Singly Linked List<pre style='color:#000000;background:#ffffff;'><span style='color:#004a43; '>#</span><span style='color:#004a43; '>include </span><span style='color:#800000; '><</span><span style='color:#40015a; '>stdio.h</span><span style='color:#800000; '>></span>
<span style='color:#004a43; '>#</span><span style='color:#004a43; '>include </span><span style='color:#800000; '><</span><span style='color:#40015a; '>stdlib.h</span><span style='color:#800000; '>></span>
<span style='color:#004a43; '>#</span><span style='color:#004a43; '>include </span><span style='color:#800000; '><</span><span style='color:#40015a; '>stddef.h</span><span style='color:#800000; '>></span>
<span style='color:#800000; font-weight:bold; '>typedef</span> <span style='color:#800000; font-weight:bold; '>struct</span> list_item <span style='color:#800080; '>{</span>
<span style='color:#800000; font-weight:bold; '>int</span> val<span style='color:#800080; '>;</span>
<span style='color:#800000; font-weight:bold; '>void</span> <span style='color:#808030; '>*</span>next<span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span> list_item<span style='color:#800080; '>;</span>
<span style='color:#800000; font-weight:bold; '>typedef</span> <span style='color:#800000; font-weight:bold; '>struct</span> List <span style='color:#800080; '>{</span>
list_item <span style='color:#808030; '>*</span>head<span style='color:#800080; '>;</span>
list_item <span style='color:#808030; '>*</span>prev<span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span> List<span style='color:#800080; '>;</span>
list_item <span style='color:#808030; '>*</span>create_list_item<span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>int</span> val<span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
list_item <span style='color:#808030; '>*</span>p <span style='color:#808030; '>=</span> <span style='color:#808030; '>(</span>list_item <span style='color:#808030; '>*</span><span style='color:#808030; '>)</span><span style='color:#603000; '>malloc</span><span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>sizeof</span><span style='color:#808030; '>(</span>list_item<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span>p<span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
p<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>val <span style='color:#808030; '>=</span> val<span style='color:#800080; '>;</span>
p<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>next <span style='color:#808030; '>=</span> <span style='color:#7d0045; '>NULL</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
<span style='color:#800000; font-weight:bold; '>return</span> p<span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
<span style='color:#800000; font-weight:bold; '>void</span> add_list_item_into_node<span style='color:#808030; '>(</span>List <span style='color:#808030; '>*</span><span style='color:#603000; '>list</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>int</span> val<span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
list_item <span style='color:#808030; '>*</span>newlist_item <span style='color:#808030; '>=</span> create_list_item<span style='color:#808030; '>(</span>val<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800000; font-weight:bold; '>if</span> <span style='color:#808030; '>(</span><span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>prev <span style='color:#808030; '>!</span><span style='color:#808030; '>=</span> <span style='color:#7d0045; '>NULL</span><span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
<span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>prev<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>next <span style='color:#808030; '>=</span> newlist_item<span style='color:#800080; '>;</span>
<span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>prev <span style='color:#808030; '>=</span> newlist_item<span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
<span style='color:#800000; font-weight:bold; '>else</span>
<span style='color:#800080; '>{</span>
<span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>head <span style='color:#808030; '>=</span> newlist_item<span style='color:#800080; '>;</span>
<span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>prev <span style='color:#808030; '>=</span> newlist_item<span style='color:#800080; '>;</span>
<span style='color:#603000; '>printf</span><span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>FIRST! head==prev ? </span><span style='color:#007997; '>%d</span><span style='color:#0000e6; '>, </span><span style='color:#007997; '>%p</span><span style='color:#0f69ff; '>\n</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> <span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>head<span style='color:#808030; '>=</span><span style='color:#808030; '>=</span><span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>prev<span style='color:#808030; '>,</span> <span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>head<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
<span style='color:#603000; '>printf</span><span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#007997; '>%p</span><span style='color:#0000e6; '> added; head=</span><span style='color:#007997; '>%p</span><span style='color:#0000e6; '>, prev=</span><span style='color:#007997; '>%p</span><span style='color:#0f69ff; '>\n</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> newlist_item<span style='color:#808030; '>,</span> <span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>head<span style='color:#808030; '>,</span> <span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>prev<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
<span style='color:#800000; font-weight:bold; '>void</span> init_list<span style='color:#808030; '>(</span>List <span style='color:#808030; '>*</span>l<span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
l<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>head <span style='color:#808030; '>=</span> l<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>prev <span style='color:#808030; '>=</span> <span style='color:#7d0045; '>NULL</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
<span style='color:#800000; font-weight:bold; '>void</span> clear_list<span style='color:#808030; '>(</span>List <span style='color:#808030; '>*</span>l<span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
list_item <span style='color:#808030; '>*</span>p <span style='color:#808030; '>=</span> l<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>head<span style='color:#800080; '>;</span>
<span style='color:#800000; font-weight:bold; '>while</span> <span style='color:#808030; '>(</span>p <span style='color:#808030; '>!</span><span style='color:#808030; '>=</span> <span style='color:#7d0045; '>NULL</span><span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
list_item <span style='color:#808030; '>*</span>pn <span style='color:#808030; '>=</span> <span style='color:#808030; '>(</span>list_item <span style='color:#808030; '>*</span><span style='color:#808030; '>)</span>p<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>next<span style='color:#800080; '>;</span>
<span style='color:#603000; '>printf</span><span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>Freeing </span><span style='color:#007997; '>%p</span><span style='color:#0000e6; '>, next p is=</span><span style='color:#007997; '>%p</span><span style='color:#0f69ff; '>\n</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> p<span style='color:#808030; '>,</span> pn<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#603000; '>free</span><span style='color:#808030; '>(</span>p<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
p <span style='color:#808030; '>=</span> pn<span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
l<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>head <span style='color:#808030; '>=</span> l<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>prev <span style='color:#808030; '>=</span> <span style='color:#7d0045; '>NULL</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
<span style='color:#800000; font-weight:bold; '>typedef</span> <span style='color:#800000; font-weight:bold; '>void</span> <span style='color:#808030; '>(</span><span style='color:#808030; '>*</span>callback_t<span style='color:#808030; '>)</span><span style='color:#808030; '>(</span>list_item <span style='color:#808030; '>*</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800000; font-weight:bold; '>void</span> print<span style='color:#808030; '>(</span>list_item <span style='color:#808030; '>*</span>p<span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
<span style='color:#603000; '>printf</span><span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>p=</span><span style='color:#007997; '>%p</span><span style='color:#0000e6; '>: val=</span><span style='color:#007997; '>%d</span><span style='color:#0f69ff; '>\n</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> p<span style='color:#808030; '>,</span> p<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>val<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
<span style='color:#800000; font-weight:bold; '>void</span> iterate<span style='color:#808030; '>(</span>List <span style='color:#808030; '>*</span><span style='color:#603000; '>list</span><span style='color:#808030; '>,</span> callback_t cbk<span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
list_item <span style='color:#808030; '>*</span>p <span style='color:#808030; '>=</span> <span style='color:#603000; '>list</span><span style='color:#808030; '>-</span><span style='color:#808030; '>></span>head<span style='color:#800080; '>;</span>
<span style='color:#800000; font-weight:bold; '>while</span> <span style='color:#808030; '>(</span>p<span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
cbk<span style='color:#808030; '>(</span>p<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
p <span style='color:#808030; '>=</span> p<span style='color:#808030; '>-</span><span style='color:#808030; '>></span>next<span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
<span style='color:#800080; '>}</span>
<span style='color:#800000; font-weight:bold; '>int</span> <span style='color:#400000; '>main</span><span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
List mylist<span style='color:#800080; '>;</span>
init_list<span style='color:#808030; '>(</span><span style='color:#808030; '>&</span>mylist<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800000; font-weight:bold; '>for</span><span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>int</span> i<span style='color:#808030; '>=</span><span style='color:#008c00; '>0</span><span style='color:#800080; '>;</span> i<span style='color:#808030; '><</span><span style='color:#008c00; '>10</span><span style='color:#800080; '>;</span> <span style='color:#808030; '>+</span><span style='color:#808030; '>+</span>i<span style='color:#808030; '>)</span>
<span style='color:#800080; '>{</span>
add_list_item_into_node<span style='color:#808030; '>(</span><span style='color:#808030; '>&</span>mylist<span style='color:#808030; '>,</span> i<span style='color:#808030; '>*</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
iterate<span style='color:#808030; '>(</span><span style='color:#808030; '>&</span>mylist<span style='color:#808030; '>,</span> print<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#696969; '>// cleanup; starting from head</span>
<span style='color:#603000; '>printf</span><span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>Cleaning up!</span><span style='color:#0f69ff; '>\n</span><span style='color:#800000; '>"</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
clear_list<span style='color:#808030; '>(</span><span style='color:#808030; '>&</span>mylist<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
iterate<span style='color:#808030; '>(</span><span style='color:#808030; '>&</span>mylist<span style='color:#808030; '>,</span> print<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#603000; '>printf</span><span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>head = </span><span style='color:#007997; '>%p</span><span style='color:#0000e6; '>, prev=</span><span style='color:#007997; '>%p</span><span style='color:#0f69ff; '>\n</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> mylist<span style='color:#808030; '>.</span>head<span style='color:#808030; '>,</span> mylist<span style='color:#808030; '>.</span>prev<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
</pre>
<!--Created using ToHtml.com on 2019-12-29 08:38:29 UTC -->L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-57156035349441287962019-09-20T11:53:00.000-07:002019-09-20T12:05:15.684-07:00Unique Pointer (Smart Pointer)<div dir="ltr" style="text-align: left;" trbidi="on">
The following example shows how to use unique_ptr which semantically 'moves' the data during assignment:<br />
<br />
<br />
<pre style="background: #ffffff; color: black;"><span style="color: #004a43;">#</span><span style="color: #004a43;">include </span><span style="color: maroon;"><</span><span style="color: #40015a;">iostream</span><span style="color: maroon;">></span>
<span style="color: #004a43;">#</span><span style="color: #004a43;">include </span><span style="color: maroon;"><</span><span style="color: #40015a;">memory</span><span style="color: maroon;">></span>
<span style="color: maroon; font-weight: bold;">using</span> <span style="color: maroon; font-weight: bold;">namespace</span> <span style="color: #666616;">std</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">class</span> MyClass
<span style="color: purple;">{</span>
<span style="color: maroon; font-weight: bold;">public</span><span style="color: #e34adc;">:</span>
<span style="color: #004a43;">#</span><span style="color: #004a43;">if</span><span style="color: #004a43;"> COMPILE_ERROR</span>
MyClass
<span style="color: #808030;">(</span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">unique_ptr</span><span style="color: purple;"><</span><span style="color: maroon; font-weight: bold;">int</span><span style="color: purple;">></span> <span style="color: maroon; font-weight: bold;">const</span> <span style="color: #808030;">&</span> pOpt <span style="color: #808030;">=</span> <span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">unique_ptr</span><span style="color: purple;"><</span><span style="color: maroon; font-weight: bold;">int</span><span style="color: purple;">></span><span style="color: #808030;">(</span><span style="color: maroon; font-weight: bold;">nullptr</span><span style="color: #808030;">)</span>
<span style="color: #808030;">)</span> <span style="color: purple;">:</span> m_ptr<span style="color: #808030;">(</span><span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">move</span><span style="color: #808030;">(</span>pOpt<span style="color: #808030;">)</span><span style="color: #808030;">)</span>
<span style="color: purple;">{</span>
<span style="color: purple;">}</span>
<span style="color: #004a43;">#</span><span style="color: #004a43;">else</span>
<span style="color: maroon; font-weight: bold;">explicit</span> MyClass
<span style="color: #808030;">(</span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">unique_ptr</span><span style="color: purple;"><</span><span style="color: maroon; font-weight: bold;">int</span><span style="color: purple;">></span> pOpt <span style="color: #808030;">=</span> <span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">unique_ptr</span><span style="color: purple;"><</span><span style="color: maroon; font-weight: bold;">int</span><span style="color: purple;">></span><span style="color: #808030;">(</span><span style="color: maroon; font-weight: bold;">nullptr</span><span style="color: #808030;">)</span>
<span style="color: #808030;">)</span> <span style="color: purple;">:</span> m_ptr<span style="color: #808030;">(</span><span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">move</span><span style="color: #808030;">(</span>pOpt<span style="color: #808030;">)</span><span style="color: #808030;">)</span>
<span style="color: purple;">{</span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">cout</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> __FUNCTION__ <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: maroon;">"</span><span style="color: #0000e6;">() : m_ptr=</span><span style="color: maroon;">"</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> m_ptr<span style="color: #808030;">.</span>get<span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">endl</span><span style="color: purple;">;</span>
<span style="color: purple;">}</span>
MyClass<span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #808030;">=</span> <span style="color: maroon; font-weight: bold;">delete</span><span style="color: purple;">;</span>
<span style="color: #004a43;">#</span><span style="color: #004a43;">endif</span>
<span style="color: maroon; font-weight: bold;">friend</span> <span style="color: #603000;">ostream</span><span style="color: #808030;">&</span> <span style="color: maroon; font-weight: bold;">operator</span><span style="color: #808030;"><</span><span style="color: #808030;"><</span><span style="color: #808030;">(</span><span style="color: #603000;">ostream</span><span style="color: #808030;">&</span> os<span style="color: #808030;">,</span> <span style="color: maroon; font-weight: bold;">const</span> MyClass<span style="color: #808030;">&</span> c<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">private</span><span style="color: #e34adc;">:</span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">unique_ptr</span><span style="color: purple;"><</span><span style="color: maroon; font-weight: bold;">int</span><span style="color: purple;">></span> m_ptr<span style="color: purple;">;</span>
<span style="color: purple;">}</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">template</span><span style="color: purple;"><</span><span style="color: maroon; font-weight: bold;">typename</span> T<span style="color: purple;">></span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">unique_ptr</span><span style="color: purple;"><</span>T<span style="color: purple;">></span><span style="color: #808030;">&</span> pass_through<span style="color: #808030;">(</span><span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">unique_ptr</span><span style="color: purple;"><</span>T<span style="color: purple;">></span><span style="color: #808030;">&</span> p<span style="color: #808030;">)</span>
<span style="color: purple;">{</span>
<span style="color: maroon; font-weight: bold;">if</span> <span style="color: #808030;">(</span>p <span style="color: #808030;">!</span><span style="color: #808030;">=</span> <span style="color: maroon; font-weight: bold;">nullptr</span><span style="color: #808030;">)</span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">cout</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: #808030;">*</span>p <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">endl</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">else</span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">cout</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: maroon;">"</span><span style="color: #0000e6;">nullptr</span><span style="color: maroon;">"</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">endl</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">return</span> p<span style="color: purple;">;</span>
<span style="color: purple;">}</span>
<span style="color: #603000;">ostream</span><span style="color: #808030;">&</span> <span style="color: maroon; font-weight: bold;">operator</span><span style="color: #808030;"><</span><span style="color: #808030;"><</span><span style="color: #808030;">(</span><span style="color: #603000;">ostream</span><span style="color: #808030;">&</span> os<span style="color: #808030;">,</span> <span style="color: maroon; font-weight: bold;">const</span> MyClass<span style="color: #808030;">&</span> c<span style="color: #808030;">)</span>
<span style="color: purple;">{</span>
<span style="color: maroon; font-weight: bold;">if</span> <span style="color: #808030;">(</span>c<span style="color: #808030;">.</span>m_ptr <span style="color: #808030;">!</span><span style="color: #808030;">=</span> <span style="color: maroon; font-weight: bold;">nullptr</span><span style="color: #808030;">)</span>
<span style="color: maroon; font-weight: bold;">return</span> os <span style="color: #808030;"><</span><span style="color: #808030;"><</span> __FUNCTION__ <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: maroon;">"</span><span style="color: #0000e6;">(): </span><span style="color: maroon;">"</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: #808030;">*</span>c<span style="color: #808030;">.</span>m_ptr<span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">else</span>
<span style="color: maroon; font-weight: bold;">return</span> os <span style="color: #808030;"><</span><span style="color: #808030;"><</span> __FUNCTION__ <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: maroon;">"</span><span style="color: #0000e6;">(): nullptr</span><span style="color: maroon;">"</span><span style="color: purple;">;</span>
<span style="color: purple;">}</span>
<span style="color: maroon; font-weight: bold;">int</span> <span style="color: #400000;">main</span><span style="color: #808030;">(</span><span style="color: #808030;">)</span>
<span style="color: purple;">{</span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">unique_ptr</span><span style="color: purple;"><</span><span style="color: maroon; font-weight: bold;">int</span><span style="color: purple;">></span> pInt<span style="color: #808030;">(</span><span style="color: maroon; font-weight: bold;">new</span> <span style="color: maroon; font-weight: bold;">int</span><span style="color: #808030;">(</span><span style="color: #008c00;">15</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
MyClass data<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
MyClass data2<span style="color: #808030;">(</span><span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">move</span><span style="color: #808030;">(</span>pInt<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
pass_through<span style="color: #808030;">(</span>pInt<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">cout</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: maroon;">"</span><span style="color: #0000e6;">data = </span><span style="color: maroon;">"</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> data <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">endl</span><span style="color: purple;">;</span>
<span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">cout</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: maroon;">"</span><span style="color: #0000e6;">data2 = </span><span style="color: maroon;">"</span> <span style="color: #808030;"><</span><span style="color: #808030;"><</span> data2 <span style="color: #808030;"><</span><span style="color: #808030;"><</span> <span style="color: #666616;">std</span><span style="color: purple;">::</span><span style="color: #603000;">endl</span><span style="color: purple;">;</span>
<span style="color: purple;">}</span>
</pre>
<!--Created using ToHtml.com on 2019-09-20 19:04:21 UTC -->
<br />
<div>
<span style="color: #212529; font-family: monospace;"><span style="font-size: 11.7px; white-space: pre;">MyClass() : m_ptr=0x7430d0</span></span></div>
<span style="color: #212529; font-family: monospace;">
</span>
<br />
<div>
<span style="color: #212529; font-family: monospace;"><span style="font-size: 11.7px; white-space: pre;">nullptr</span></span></div>
<span style="color: #212529; font-family: monospace;">
</span>
<br />
<div>
<span style="color: #212529; font-family: monospace;"><span style="font-size: 11.7px; white-space: pre;">data = 1</span></span></div>
<span style="color: #212529; font-family: monospace;">
</span>
<br />
<div>
<span style="color: #212529; font-family: monospace;"><span style="font-size: 11.7px; white-space: pre;">data2 = operator<<(): 15</span></span></div>
<span style="color: #212529; font-family: monospace;">
</span>
<br />
<div style="font-size: 11.7px; white-space: pre;">
<span style="color: #212529; font-family: monospace;"><br /></span></div>
<span style="color: #212529; font-family: monospace;">
</span>
<br />
<div>
<span style="color: #212529; font-family: monospace;"><span style="font-size: 11.7px; white-space: pre;"><br /></span></span></div>
</div>
L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-86634343561167963202019-03-13T20:39:00.002-07:002019-03-13T20:39:37.762-07:00Callback via C++ template<div dir="ltr" style="text-align: left;" trbidi="on">
The following code would make a callback via template:<br /><br /><br /><table style="color: #333333; font-family: Verdana, Helvetica, Arial, sans-serif;"><tbody>
<tr><td><pre style="line-height: 16.25px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19</pre>
</td><td><pre style="line-height: 16.25px;"><span style="color: #557799;">#include <iostream></span>
<span style="color: #008800; font-weight: bold;">template</span> <<span style="color: #008800; font-weight: bold;">typename</span> F>
<span style="color: #333399; font-weight: bold;">void</span> call(F func)
{
func();
}
<span style="color: #333399; font-weight: bold;">void</span> print()
{
std::cout << __FUNCTION__ << <span style="background-color: #fff0f0;">"()"</span> << std::endl;
}
<span style="color: #333399; font-weight: bold;">int</span> main()
{
call(print);
}</pre>
</td></tr>
</tbody></table>
</div>
L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0tag:blogger.com,1999:blog-6504844.post-73934622024917759062019-03-10T11:47:00.001-07:002019-03-10T12:09:19.290-07:00Debugging Issues related to GLib<div dir="ltr" style="text-align: left;" trbidi="on">
Got this problem when running my compiled wxformbuilder:<br />
<br />
<br />
<blockquote class="tr_bq">
<span style="background-color: #f3f3f3;"><span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;">***MEMORY-ERROR***: wxformbuilder[19377]: GSlice: assertion failed: aligned_memory == (gpointer) addr</span></span><span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></span><span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;">Aborted (core dumped)</span></span></span></blockquote>
<br />
<div>
The workaround is to embed G_SLICE=always-malloc when invoking the command-line, e.g:<br />
<br />
<span style="background-color: #f3f3f3; font-family: "courier new" , "courier" , monospace;">G_SLICE=always-malloc ./wxformbuilder </span><br />
<span style="background-color: #f3f3f3; font-family: "courier new" , "courier" , monospace;"><br /></span>
According to the GLib documentation:</div>
<div>
<br /></div>
<blockquote class="tr_bq">
<span style="background-color: #fff2cc;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: x-small;"><b><u>always-malloc:</u></b></span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: x-small;">This will cause all slices allocated through g_slice_alloc() and released by g_slice_free1() to be actually allocated via direct calls to g_malloc() and g_free(). This is most useful for memory checkers and similar programs that use Boehm GC alike algorithms to produce more accurate results. It can also be in conjunction with debugging features of the system's malloc() implementation such as glibc's MALLOC_CHECK_=2 to debug erroneous slice allocation code, although debug-blocks is usually a better suited debugging tool.</span></span></blockquote>
<div>
<br />
To debug the issue, valgrind is our friend in this case.<br />
<br />
For example, when running it with valgrind it shows a lot of memory leaks (apparently some issues in wxWidgets):<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><br /><br /><span style="background-color: #f3f3f3;">valgrind ./wxformbuilder <br /><br />==18887== Memcheck, a memory error detector<br /><br />==18887== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.<br /><br />==18887== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info<br /><br />==18887== Command: ./wxformbuilder<br /><br />==18887== <br /><br /><b>==18887== Invalid free() / delete / delete[] / realloc()</b><br />==18887== at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br /><br />==18887== by 0x6EAE3D0: wxLocale::GetSystemEncodingName() (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAEA2A: wxLocale::GetSystemEncoding() (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F06C18: wxCSConv::SetEncoding(wxFontEncoding) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0D2E3: wxCSConv::wxCSConv(wxFontEncoding) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br /><b>==18887== by 0x6F0D398: wxGet_wxConvLocalPtr() (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)</b><br /><br />==18887== by 0x6DD07CE: _GLOBAL__sub_I_strconv.cpp (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x4010732: call_init (dl-init.c:72)<br /><br />==18887== by 0x4010732: _dl_init (dl-init.c:119)<br /><br />==18887== by 0x40010C9: ??? (in /lib/x86_64-linux-gnu/ld-2.27.so)<br /><br />==18887== Address 0x4029fe0 is in a rwx anonymous segment<br /><br />==18887== <br /><br />==18887== Invalid read of size 16<br /><br />==18887== at 0x7E8798D: __wcsnlen_sse4_1 (strlen.S:117)<br /><br />==18887== by 0x7E74EC1: wcsrtombs (wcsrtombs.c:104)<br /><br />==18887== by 0x6F8B13F: wxWC2MB(char*, wchar_t const*, unsigned long) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F07CD5: wxMBConv::FromWChar(char*, unsigned long, wchar_t const*, unsigned long) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F14F78: wxString::AsChar(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0C2F9: wxCSConv::DoCreate() const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0D2EB: wxCSConv::wxCSConv(wxFontEncoding) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0D398: wxGet_wxConvLocalPtr() (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6DD07CE: _GLOBAL__sub_I_strconv.cpp (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x4010732: call_init (dl-init.c:72)<br /><br />==18887== by 0x4010732: _dl_init (dl-init.c:119)<br /><br />==18887== by 0x40010C9: ??? (in /lib/x86_64-linux-gnu/ld-2.27.so)<br /><br />==18887== Address 0x14d47b30 is 8 bytes after a block of size 24 alloc'd<br /><br />==18887== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br /><br />==18887== by 0x6F07DB7: wxMBConv::FromWChar(char*, unsigned long, wchar_t const*, unsigned long) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F14F78: wxString::AsChar(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0C2F9: wxCSConv::DoCreate() const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0D2EB: wxCSConv::wxCSConv(wxFontEncoding) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0D398: wxGet_wxConvLocalPtr() (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6DD07CE: _GLOBAL__sub_I_strconv.cpp (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x4010732: call_init (dl-init.c:72)<br /><br />==18887== by 0x4010732: _dl_init (dl-init.c:119)<br /><br />==18887== by 0x40010C9: ??? (in /lib/x86_64-linux-gnu/ld-2.27.so)<br /><br />==18887== <br /><br />==18887== Invalid read of size 16<br /><br />==18887== at 0x7E87992: __wcsnlen_sse4_1 (strlen.S:117)<br /><br />==18887== by 0x7E74EC1: wcsrtombs (wcsrtombs.c:104)<br /><br />==18887== by 0x6F8B13F: wxWC2MB(char*, wchar_t const*, unsigned long) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F07CD5: wxMBConv::FromWChar(char*, unsigned long, wchar_t const*, unsigned long) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F14F78: wxString::AsChar(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0C2F9: wxCSConv::DoCreate() const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0D2EB: wxCSConv::wxCSConv(wxFontEncoding) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0D398: wxGet_wxConvLocalPtr() (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6DD07CE: _GLOBAL__sub_I_strconv.cpp (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x4010732: call_init (dl-init.c:72)<br /><br />==18887== by 0x4010732: _dl_init (dl-init.c:119)<br /><br />==18887== by 0x40010C9: ??? (in /lib/x86_64-linux-gnu/ld-2.27.so)<br /><br />==18887== Address 0x14d47b40 is 16 bytes after a block of size 32 in arena "client"<br /><br />==18887== <br /><br />==18887== Conditional jump or move depends on uninitialised value(s)<br /><br />==18887== at 0x7E87A61: __wcsnlen_sse4_1 (strlen.S:161)<br /><br />==18887== by 0x7E74EC1: wcsrtombs (wcsrtombs.c:104)<br /><br />==18887== by 0x6F8B13F: wxWC2MB(char*, wchar_t const*, unsigned long) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F07CD5: wxMBConv::FromWChar(char*, unsigned long, wchar_t const*, unsigned long) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F14F78: wxString::AsChar(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0C2F9: wxCSConv::DoCreate() const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0D2EB: wxCSConv::wxCSConv(wxFontEncoding) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F0D398: wxGet_wxConvLocalPtr() (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6DD07CE: _GLOBAL__sub_I_strconv.cpp (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x4010732: call_init (dl-init.c:72)<br /><br />==18887== by 0x4010732: _dl_init (dl-init.c:119)<br /><br />==18887== by 0x40010C9: ??? (in /lib/x86_64-linux-gnu/ld-2.27.so)<br /><br />==18887== <br /><br /><b>==18887== Invalid free() / delete / delete[] / realloc()</b><br /><br />==18887== at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br /><br />==18887== by 0x6EAE3D0: wxLocale::GetSystemEncodingName() (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x629CE5E: wxApp::Initialize(int&, wchar_t**) (in /usr/local/lib/libwx_gtk3u_core-3.1.so.3.0.0)<br /><br />==18887== by 0x6EABB9C: wxEntryStart(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5A9: wxInitialize(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5FA: wxEntry(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x1E8D57: main (maingui.cpp:83)<br /><br />==18887== Address 0x4029fc0 is in a rwx anonymous segment<br /><br />==18887== <br /><br />==18887== Invalid read of size 16<br /><br />==18887== at 0x7E87AC2: __wcsnlen_sse4_1 (strlen.S:194)<br /><br />==18887== by 0x7E74EC1: wcsrtombs (wcsrtombs.c:104)<br /><br />==18887== by 0x6F8B13F: wxWC2MB(char*, wchar_t const*, unsigned long) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F07CD5: wxMBConv::FromWChar(char*, unsigned long, wchar_t const*, unsigned long) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F14F78: wxString::AsChar(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6E763C4: wxString::AsCharBuf(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x7016906: wxSetEnv(wxString const&, wxString const&) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x629D359: wxApp::Initialize(int&, wchar_t**) (in /usr/local/lib/libwx_gtk3u_core-3.1.so.3.0.0)<br /><br />==18887== by 0x6EABB9C: wxEntryStart(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5A9: wxInitialize(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5FA: wxEntry(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x1E8D57: main (maingui.cpp:83)<br /><br />==18887== Address 0x14e00f20 is 0 bytes after a block of size 80 alloc'd<br /><br />==18887== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br /><br />==18887== by 0x6F07DB7: wxMBConv::FromWChar(char*, unsigned long, wchar_t const*, unsigned long) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F14F78: wxString::AsChar(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6E763C4: wxString::AsCharBuf(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x7016906: wxSetEnv(wxString const&, wxString const&) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x629D359: wxApp::Initialize(int&, wchar_t**) (in /usr/local/lib/libwx_gtk3u_core-3.1.so.3.0.0)<br /><br />==18887== by 0x6EABB9C: wxEntryStart(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5A9: wxInitialize(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5FA: wxEntry(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x1E8D57: main (maingui.cpp:83)<br /><br />==18887== <br /><br />==18887== Invalid read of size 16<br /><br />==18887== at 0x7E87AC7: __wcsnlen_sse4_1 (strlen.S:194)<br /><br />==18887== by 0x7E74EC1: wcsrtombs (wcsrtombs.c:104)<br /><br />==18887== by 0x6F8B13F: wxWC2MB(char*, wchar_t const*, unsigned long) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F07CD5: wxMBConv::FromWChar(char*, unsigned long, wchar_t const*, unsigned long) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F14F78: wxString::AsChar(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6E763C4: wxString::AsCharBuf(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x7016906: wxSetEnv(wxString const&, wxString const&) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x629D359: wxApp::Initialize(int&, wchar_t**) (in /usr/local/lib/libwx_gtk3u_core-3.1.so.3.0.0)<br /><br />==18887== by 0x6EABB9C: wxEntryStart(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5A9: wxInitialize(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5FA: wxEntry(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x1E8D57: main (maingui.cpp:83)<br /><br />==18887== Address 0x14e00f30 is 16 bytes after a block of size 80 alloc'd<br /><br />==18887== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br /><br />==18887== by 0x6F07DB7: wxMBConv::FromWChar(char*, unsigned long, wchar_t const*, unsigned long) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6F14F78: wxString::AsChar(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6E763C4: wxString::AsCharBuf(wxMBConv const&) const (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x7016906: wxSetEnv(wxString const&, wxString const&) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x629D359: wxApp::Initialize(int&, wchar_t**) (in /usr/local/lib/libwx_gtk3u_core-3.1.so.3.0.0)<br /><br />==18887== by 0x6EABB9C: wxEntryStart(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5A9: wxInitialize(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x6EAC5FA: wxEntry(int&, wchar_t**) (in /usr/local/lib/libwx_baseu-3.1.so.3.0.0)<br /><br />==18887== by 0x1E8D57: main (maingui.cpp:83)<br /><br />==18887== <br /><br />==18887== Invalid free() / delete / delete[] / realloc()<br /><br />==18887== at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br /><br />==18887== by 0xA95DAFB: _XFreeDisplayStructure (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)<br /><br />==18887== by 0xA94AE7E: XCloseDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)<br /><br />==18887== by 0x12331FC8: atspi_get_a11y_bus (in /usr/lib/x86_64-linux-gnu/libatspi.so.0.0.1)<br /><br />==18887== by 0xD2DEE89: atk_bridge_adaptor_init (in /usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0.0.0)<br /><br />==18887== by 0x85D3B03: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2200.30)<br /><br />==18887== by 0x8774498: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2200.30)<br /><br />==18887== by 0x915410C: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== by 0x916705D: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== by 0x916F714: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== by 0x917012E: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== by 0x91585C3: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== Address 0x4029f00 is in a rwx anonymous segment<br /><br />==18887== <br /><br />==18887== Invalid free() / delete / delete[] / realloc()<br /><br />==18887== at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br /><br />==18887== by 0xA95DD09: _XFreeDisplayStructure (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)<br /><br />==18887== by 0xA94AE7E: XCloseDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)<br /><br />==18887== by 0x12331FC8: atspi_get_a11y_bus (in /usr/lib/x86_64-linux-gnu/libatspi.so.0.0.1)<br /><br />==18887== by 0xD2DEE89: atk_bridge_adaptor_init (in /usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0.0.0)<br /><br />==18887== by 0x85D3B03: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2200.30)<br /><br />==18887== by 0x8774498: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2200.30)<br /><br />==18887== by 0x915410C: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== by 0x916705D: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== by 0x916F714: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== by 0x917012E: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== by 0x91585C3: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.3)<br /><br />==18887== Address 0x4029f10 is in a rwx anonymous segment</span></span></div>
<div>
<span style="background-color: #f3f3f3; font-family: "courier new" , "courier" , monospace; font-size: xx-small;">...</span></div>
<div>
<span style="background-color: #f3f3f3; font-family: "courier new" , "courier" , monospace; font-size: xx-small;">...</span></div>
<div>
<span style="background-color: #f3f3f3;"><span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"></span></span><br />
<div>
<span style="background-color: #f3f3f3; font-family: "courier new" , "courier" , monospace; font-size: xx-small;">==20545== More than 1000 different errors detected. I'm not reporting any more.</span></div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: #f3f3f3;"> </span><div>
<span style="background-color: #f3f3f3;">==20545== Final error counts will be inaccurate. Go fix your program!</span></div>
<div>
<span style="background-color: #f3f3f3;">==20545== Rerun with --error-limit=no to disable this cutoff. Note</span></div>
<div>
<span style="background-color: #f3f3f3;">==20545== that errors may occur in your program without prior warning from</span></div>
<div>
<span style="background-color: #f3f3f3;">==20545== Valgrind, because errors are no longer being displayed.</span></div>
<div>
<span style="background-color: #f3f3f3;">==20545== </span></div>
<div>
<br /></div>
</span></div>
Debugging with GDB gives:<div>
<br /></div>
<div>
<span style="background-color: #f3f3f3; font-family: Courier New, Courier, monospace; font-size: xx-small;">$ gdb /usr/local/bin/wxformbuilder<br />GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git<br />Copyright (C) 2018 Free Software Foundation, Inc.<br />License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html><br />This is free software: you are free to change and redistribute it.<br />There is NO WARRANTY, to the extent permitted by law. Type "show copying"<br />and "show warranty" for details.<br />This GDB was configured as "x86_64-linux-gnu".<br />Type "show configuration" for configuration details.<br />For bug reporting instructions, please see:<br /><http://www.gnu.org/software/gdb/bugs/>.<br />Find the GDB manual and other documentation resources online at:<br /><http://www.gnu.org/software/gdb/documentation/>.<br />For help, type "help".<br />Type "apropos word" to search for commands related to "word"...<br />Reading symbols from /usr/local/bin/wxformbuilder...done.<br />(gdb) go<br />Command requires an argument.<br />(gdb) run<br />Starting program: /usr/local/bin/wxformbuilder<br />[Thread debugging using libthread_db enabled]<br />Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".<br />***MEMORY-ERROR***: wxformbuilder[22214]: GSlice: assertion failed: aligned_memory == (gpointer) addr<br />Program received signal SIGABRT, Aborted.<br />__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51<br />51<span style="white-space: pre;"> </span>../sysdeps/unix/sysv/linux/raise.c: No such file or directory.<br />(gdb) bt<br />#0 0x00007ffff4aa7e97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51<br />#1 0x00007ffff4aa9801 in __GI_abort () at abort.c:79<br />#2 0x00007ffff23496b4 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0<br />#3 0x00007ffff234a0db in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0<br />#4 0x00007ffff234ad1e in g_slice_alloc () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0<br />#5 0x00007ffff234ad99 in g_slice_alloc0 () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0<br />#6 0x00007ffff38ad925 in g_type_create_instance () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0<br />#7 0x00007ffff388e748 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0<br />#8 0x00007ffff388fee5 in g_object_new_with_properties () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0<br />#9 0x00007ffff3890961 in g_object_new () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0<br />#10 0x00007ffff3b3dbda in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0<br />#11 0x00007ffff3b2de3d in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0<br />#12 0x00007ffff3b02d5d in gdk_display_manager_open_display () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0<br />#13 0x00007ffff3ff267a in gtk_init_check () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0<br /><b>#14 0x00007ffff64324ae in wxApp::Initialize(int&, wchar_t**) () at /usr/local/lib/libwx_gtk3u_core-3.1.so.3</b><br />#15 0x00007ffff5a53b9d in wxEntryStart(int&, wchar_t**) () at /usr/local/lib/libwx_baseu-3.1.so.3<br />#16 0x00007ffff5a545aa in wxInitialize(int&, wchar_t**) () at /usr/local/lib/libwx_baseu-3.1.so.3<br />#17 0x00007ffff5a545fb in wxEntry(int&, wchar_t**) () at /usr/local/lib/libwx_baseu-3.1.so.3<br />#18 0x0000555555634d58 in main(int, char**) (argc=1, argv=0x7fffffffded8) at ../src/maingui.cpp:83</span></div>
<div>
<br /></div>
</div>
L.M. Lutfi Sh.http://www.blogger.com/profile/07163015487982507289noreply@blogger.com0