text:
## IP Camera Alternatives to Dahua, Hikvision, or Huawei?

Starting August 13th, 2019 the National Defense Authorization Act banned the US government from procuring cameras from Dahua, Hikvision, and Huawei.

The upside of this attention is it brought light to the fact that many security camera brands had popped up over the years with variable quality with poor to no ongoing firmware updates for discovered security issues. Mostly as a consumer it made searching for “network cameras” in Amazon or Newegg a terrible process as it was difficult to filter out quality brands from dead-end and potentially security-compromised ones. That many of these cameras were just re-labeled cameras produced by Dahua or Hikvision using SoCs by Huawei is a different matter.

However, if you’re looking for cameras not associated with Dahua, Hikvision, or Huawei, try the manufacturers/brands below. I learned about these researching into the brands I currently use like Hikvision, Reolink, TRENDnet, etc..

 Brand Amazon Search Made By or SoC Made By NDAA Compliant? Country of Origin American Dynamics Amazon Made by Tyco Security Products now Johnson Controls Yes (some cameras) Ireland Arecont Vision Amazon OEM Yes USA Avigilon Amazon Made by Motorola Yes Canada Axis Communications Amazon Soc is Axis-developed ARTPEC Yes (though SMB cameras use Huawei HiSilicon) Sweden Hanwha (i.e. Samsung WiseNet) Amazon SoC is Hanwha-developed Wisenet chips, e.g. Wisenet 5 Yes South Korea Honeywell (not Performance Series) Amazon Made by Vivotek Yes Taiwain country of origin Illustra Amazon Made By Tyco Security Products now Johnson Controls Yes (some cameras) Ireland Pelco Amazon ? Yes USA Ubiquiti Amazon Soc is Ambarella, USA Yes USA Vivotek Amazon SoC made by VATICS, spun out of Vivotek in 2007 Yes (some cameras) Taiwan

If you’re looking for a larger list of cameras and brands including those made by or with parts from Dahua, Hikvision, or Huawei, see this Google Sheets workbook here.

Categories: Uncategorized

## Hass.io Resinos Root SSH logon with Putty

If you’re running your Home Assistant installation using Hass.io, SSH interaction with Home Assistant is usually through port 22. This connects to the Docker guest image running Home Assistant within the HassOS/ResinOS hypervisor.

Interaction with the physical host (e.g. your Raspberry Pi) requires connecting to SSH port 22222 which is configured by default to only accept SSH connections with a public/private key pair. Official instructions for setting up this connection can be found here. For additional settings confirmation, continue reading.

1. Retrieve your Home Assistant’s SD card and mount it locally. Most partitions won’t be natively readable in Windows which is fine as you will only need to write to the SD card’s “boot” partition (the only one that should be readable in Windows). Assuming this is mounted as the “G:\” drive.
2. Generate a new public/private key pair with Putty Key Generator, puttygen.exe
1. Launch puttygen
2. Default parameters of “RSA” and key size of “2048” will work.
3. Enter in a key passphrase to be used whenever the private key is unlocked.
4. Click “Generate” and follow on-screen instructions to generate randomness until the key generation process is completed.
5. Click “Save private key” and save it in a location accessible wherever you will want to SSH from.
6. You can also click “save public key” to save that file in the same location as your private key, though you will not use it in that format.
7. Copy and paste the “OpenSSH authorized_keys file” section circled above into a new text file at path “G:\authorized_keys”
1. Make sure there is no “.txt” included in the file name.
2. The contents of the file should be one line and look like this:
3. ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAivEKRSB7gTs8DoY36n4tK+vUvwNHzUkZthTawQH/LRfkn/g+0LfSQilrTm1fKaW4Te0mbtF01L0LYZO5kdkaI/BaBTHWvTmO049OWYAbVSROAXgdtm/UrlcWm2Z3f1vIfPVRxHrAL2Qw3RJ/e0fUIqzgwKrEG0HWGgWbRZZhbiPEGPkvx5F78jIEAE4ZkIfOFEYGRgOdG5om3HdfBY6pytEcLgJW2hFTgrWJ+YnAal/OGhVCZlqmxX8kBlsXKXGFVzkMMVX0/p68FP0L93c1bozIt0nBiWovasglIEn8h+O3Wz93Mnt8HhcWwj5NmhKoDX4AFyr53t7lIP9tV/FydQ== rsa-key-20180820
3. “Eject” the SD card, place it back into your Hass.io device, and boot it up again.
4. Launch Putty to configure your “Hass.io Host” profile
1. Session >
1. Host Name (or IP address): {same that you use normally for Home Assistant}
2. Port: 22222
2. Connection >
1. Data >
2. SSH >
1. Private key file for authentication: {path to your private key above, e.g. “c:\users\foo\desktop\ssh_private”}
5. In Putty, go back to the Session category node and click “Save” on your profile.
1. Now click “Open”
2. You should see the following in Putty:
Authenticating with public key “rsa-key-20180819”
Passphrase for key “rsa-key-20180819”:
3. Enter your private key’s passphrase to continue.
6. At this point you are connected to your Hass.io’s Host environment. From here you can perform a different set of administrative tasks including:
1. Docker list images: docker ps
2. ResinOS logs: docker logs resin_supervisor
3. HassOS logs: docker logs hassos_supervisor
6. System log entries (e.g. after inserting a new USB device into your Raspberry Pi): dmesg

Troubleshooting the various errors you might see trying to connect from Putty:

1. Disconnected: No supported authentication methods available (server sent: publickey)
1. Solution1: You’re trying to use password authentication only. The Hass.io host is configured to only allow publickey authentication which requires saving your private key to the Hass.io’s boot partition in file “authorized_keys” and using the private key in your SSH client. Use instructions above or here to configure a key pair for use.
2. Solution2: Your Hass.io installation might still be using the ResinOS host environment and you crossed over in these instructions  which resulted in using username “root@hassio.local”.  Use “root” as your username instead.
3. Solution3: Your Hass.io installation is using HassOS and you’re trying to login with user “root”. Use “root@hassio.local” instead.
2. Unable to use key file “\\foo\bar\hassio_private_openssh.ppk” (OpenSSH SSH-2 private key (new format))
1. In PuttyGen you might have clicked Conversions > “Export OpenSSH key”, this is a different format. Use the key from Puttygen’s “Save private key” menu operation or button.

Categories: Uncategorized

## Restart Hyper-V Guests Automatically When iSCSI Volume Goes Offline

I have a couple of Hyper-V Server 2016 hosts with guest VHDX’s stored on some Synology-based iSCSI volumes. I like this setup as I don’t have to worry about maintaining reliable storage on the hosts as I’ve already invested in that with my Synology NAS and my iSCSI volumes are more than fast enough for my usage.

When I first got the guests running on the iSCSI volume I would have bi-monthly issues where the guests would go “Critical” and would refuse to boot unless I restarted the Hyper-V host. A little while later I realized my update installations and reboots of the NAS was taking the iSCSI volumes offline which Hyper-V didn’t handle well as it would get stuck “Reconnecting.” Additionally, having the iSCSI volume go out underneath running guests was a reliable way to have the guests BSOD.

Fixes for this were:

1) Reconfigure the iSCSI volumes to auto-reconnect once the Synology NAS had rebooted.

2) Use WMI event binding to handle the iScsiPrt System events for the volume going offline and then reconnecting successfully:

1. EventID=20, “Connection to the target was lost. The initiator will attempt to retry the connection.
2. EventId=34, “A connection to the target was lost, but Initiator successfully reconnected to the target. Dump data contains the target name.

Part 1 was mostly just reconfiguring the iSCSI connection again and ensuring that my iSCSI target was marked as a “favorite”. I still can’t explain why it would get stuck on “Reconnecting”. As of now, with all updates to Hyper-V 2016 and Synology installed, everything is working well.

Part 2 was trickier. I knew from looking at the Event Log that the two iScsiPrt events reliably occurred during the iSCSI outages. Searching around online turned up WMI eventing as a route to trigger an action after an event was logged and doing so with “permanent” events would mean they would survive host reboots. Here’s what I ended up with including my path names for reference:

c:\bin\iSCSI_Monitor.ps1

# See existing event filters, consumers, and bindings
# Get-WmiObject -Namespace root\Subscription -Class __EventFilter
# Get-WmiObject -Namespace root\Subscription -Class __EventConsumer
# Get-WmiObject -Namespace root\Subscription -Class __FilterToConsumerBinding

#
# Configure Down Events
#

$FilterNameDown = "iSCSI_TargetConnection_EventFilter_Down"$ExistingFilterDown = Get-WmiObject -Namespace root\Subscription -Class __EventFilter -Filter "name='$FilterNameDown'" if ($ExistingFilterDown -ne $null) {$ExistingFilterDown | Remove-WmiObject -Verbose
$ExistingFilterDown =$null
Write-Host "Deleted existing DOWN event filter."
}

$ConsumerNameDown = "iSCSI_TargetConnection_EventConsumer_Down"$ExistingCommandDown = Get-WmiObject -Namespace root\Subscription -Class CommandLineEventConsumer -Filter "name='$ConsumerNameDown'" if ($ExistingCommandDown -ne $null) {$ExistingCommandDown | Remove-WmiObject -Verbose
$ExistingCommandDown =$null
Write-Host "Deleted existing DOWN event command."
}

$ExistingBindingDown = Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding -Filter "__Path LIKE '%$ConsumerNameDown%'"
if ($ExistingBindingDown -ne$null)
{
$ExistingBindingDown | Remove-WmiObject -Verbose$ExistingBindingDown = $null Write-Host "Deleted existing DOWN event binding." }$QueryDown = "SELECT * FROM __InstanceCreationEvent WHERE TargetInstance ISA 'Win32_NTLogEvent' AND TargetInstance.LogFile='System' AND TargetInstance.SourceName='iScsiPrt' AND TargetInstance.EventCode=20"
$WMIEventFilterDown = Set-WmiInstance -Class __EventFilter -Namespace "root\Subscription" -Arguments @{Name=$FilterNameDown;EventNameSpace="root\cimv2";QueryLanguage="WQL";Query=$QueryDown} Write-Host "Created new DOWN event Filter. "$WMIEventFilterDown.Path

$CommandLineTemplateDown = "powershell.exe -command ". 'c:\bin\iSCSI_OnIscsiChange.ps1' 'Down' '%TargetInstance.Message%'""$ExecutablePath = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
$WMIEventConsumerDown = Set-WmiInstance -Class CommandLineEventConsumer -Namespace "root\subscription"  -Arguments @{Name=$ConsumerNameDown;CommandLineTemplate=$CommandLineTemplateDown;ExecutablePath=$ExecutablePath }
Write-Host "Created new DOWN event consumer."

$result = Set-WmiInstance -Class __FilterToConsumerBinding -Namespace "root\subscription" -Arguments @{Filter=$WMIEventFilterDown;Consumer=$WMIEventConsumerDown} Write-Host "Created new DOWN event binding." # # Configure Up Events #$FilterNameUp = "iSCSI_TargetConnection_EventFilter_Up"
$ExistingFilterUp = Get-WmiObject -Namespace root\Subscription -Class __EventFilter -Filter "name='$FilterNameUp'"
if ($ExistingFilterUp -ne$null)
{
$ExistingFilterUp | Remove-WmiObject -Verbose$ExistingFilterUp = $null Write-Host "Deleted existing UP event filter." }$ConsumeNameUp = "iSCSI_TargetConnection_EventConsumer_Up"
$ExistingCommandUp = Get-WmiObject -Namespace root\Subscription -Class CommandLineEventConsumer -Filter "name='$ConsumeNameUp'"
if ($ExistingCommandUp -ne$null)
{
$ExistingCommandUp | Remove-WmiObject -Verbose$ExistingCommandUp = $null Write-Host "Deleted existing UP event command." }$ExistingBindingUp = Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding -Filter "__Path LIKE '%$ConsumeNameUp%'" if ($ExistingBindingUp -ne $null) {$ExistingBindingUp | Remove-WmiObject -Verbose
$ExistingBindingUp =$null
Write-Host "Deleted existing UP event binding."
}

$QueryUp = "SELECT * FROM __InstanceCreationEvent WHERE TargetInstance ISA 'Win32_NTLogEvent' AND TargetInstance.LogFile='System' AND TargetInstance.SourceName='iScsiPrt' AND TargetInstance.EventCode=34"$WMIEventFilterUp = Set-WmiInstance -Class __EventFilter -Namespace "root\Subscription" -Arguments @{Name=$FilterNameUp;EventNameSpace="root\cimv2";QueryLanguage="WQL";Query=$QueryUp}
Write-Host "Created new UP event Filter. " $WMIEventFilterUp.Path #$CommandLineTemplateUp = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File c:\bin\iSCSI_OnIscsiChange.ps1 -state Up -eventMessage %TargetInstance.Message%'
$CommandLineTemplateUp = "powershell.exe -command ". 'c:\bin\iSCSI_OnIscsiChange.ps1' 'Up' '%TargetInstance.Message%'""$ExecutablePath = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
$WMIEventConsumerUp = Set-WmiInstance -Class CommandLineEventConsumer -Namespace "root\subscription"  -Arguments @{Name=$ConsumeNameUp;CommandLineTemplate=$CommandLineTemplateUp;ExecutablePath=$ExecutablePath }
Write-Host "Created new UP event consumer."

$result = Set-WmiInstance -Class __FilterToConsumerBinding -Namespace "root\subscription" -Arguments @{Filter=$WMIEventFilterUp;Consumer=$WMIEventConsumerUp} Write-Host "Created new UP event binding." Write-Host Done. Pay attention to the namespaces used, you mostly want “root\Subscription” but the event filter’s EventNamespace must be “root\cimv2”. Then have this file sitting on disk being referenced by the WMI EventConsumer: c:\bin\iSCSI_OnIscsiChange.ps1 $state = $args[0]$eventMessage = $args[1] Function Write-Log { [CmdletBinding()] Param( [Parameter(Mandatory=$False)] [ValidateSet("INFO","WARN","ERROR","FATAL","DEBUG")] [String] $Level = "INFO", [Parameter(Mandatory=$True)] [string] $Message, [Parameter(Mandatory=$False)] [string] $logfile )$Stamp = (Get-Date).toString("yyyy/MM/dd HH:mm:ss")
$Line = "$Stamp $Level$Message"
If($Logfile) { Write-Output$Line
Add-Content $logfile -Value$Line
}
Else {
Write-Output $Line } }$Logfile = "C:\bin\iSCSI_EventLog.log"
Write-Log DEBUG "New iSCSI state: $state"$Logfile
Write-Log DEBUG "Event message: $eventMessage"$Logfile

if ($state -eq "Down") { Write-Log INFO "iSCSI reported 'connection to target was lost', turning virtual machines off!"$Logfile
Get-VM | where {$_.State -eq 'Running'} | Tee-Object -Append -FilePath$Logfile | Stop-VM -TurnOff -Force | Tee-Object -Append -FilePath $Logfile } else { Write-Log INFO "iSCSI reported Initiator reconnected to target, turning virtual machines back on"$Logfile
Get-VM | Tee-Object -Append -FilePath $Logfile | Start-VM | Tee-Object -Append -FilePath$Logfile
}

I couldn’t get named parameters working with my CommandLineEventConsumer, just positional hence “\$args” usage above.

## Setup

1. In PowerShell, run:
1. PS C:\> .\bin\iSCSI_Monitor.ps1

## Testing Options

Consider using “-WhatIf” parameters for Start-VM and Stop-VM in iSCSI_OnIscsiChange.ps1 unless you want to actually Stop/Start your VMs.

Confirm actions in log file “C:\bin\iSCSI_EventLog.log”.

Option A: Create fake events with “eventcreate”

1. CMD> eventcreate /T INFORMATION /L SYSTEM /ID 20 /SO Test /D Test
2. Note:
1. You will need to remove the “AND TargetInstance.SourceName=’iScsiPrt’” filter conditions as the events will show up as Source “Test”

Option B: Disable/Enable the Targets from within Synology’s “iSCSI Manager” app.

This is faster than actually rebooting your Synology NAS if you’re okay with taking your iSCSI Targets offline which means also actually turning off your guest VMs.

1. Launch “iSCSI Manager” in your Synology Dashboard
2. Select your Target you wish to test taking offline, click “Disable”, then click “Yes” to acknowledge the confirmation dialog.
3. Once you’ve confirmed in the log file the event was received then click “Enable” to turn the Target back on.  State should eventually go from “online” to “connected” once your Hyper-V host connects again.
Categories: Uncategorized

## Windows Server 2016 Hyper-V “password is not correct” to Synology share

I could not get Windows Server 2016 Hyper-V (10.0.14393) in a WORKGROUP to authenticate to Synology SMB share if the Synology unit (DSM 6.1.3-15152) is set to maximum SMB version 3.  I kept getting error: “System error 86 has occurred. The specified network password is not correct.” (86 == ERROR_INVALID_PASSWORD), on the Hyper-V system.  I retried typing the username and password, many times, all with the same error even though I knew the username and password were okay because I could use the same share from a Windows 7 and a Windows 10 machine. I never saw any errors in Synology’s log or in Windows event viewer about this.

I had to go back to SMB 2.0 on Synology– in DSM, Control panel > File Services > SMB > Advanced Settings > “Maximum SMB” set to SMB2.  Then Windows Server 2016 Hyper-V Core would connect to the Synology share.

Categories: Uncategorized

## “No valid certificates were found on this smart card”

At work we use smart cards for TFA and largely for accessing company resources remotely.  I’m currently using a Gemalto .NET smart card with an OMNIKEY Cardman 6121—a SIM-sized SC plugged into a USB dongle which is more convenient than the older full-sized SC and wired Omnikey 3021 used previously.

For years this setup has been fine.  Connect to work from home, when certificates expire renew them, and when the card runs out of space delete the expired certs.

However a few months ago I started seeing the following error instead of getting prompted for my PIN:

No valid certificates were found on this smart card. Please try another smart card or contact your administrator

The same smart card still worked on my laptop and on other PCs so it wasn’t a matter of a expired certs.  But complicating matters was that my home PC’s TPM, of which I had stored virtual smart cards, had those same certs expire roughly around the same time and the error “No valid certificates” can be interpreted as (I feel) “we found certs, but none of them are valid” so I spent some extra cycles making sure all my certificates were updated and valid instead of finding the real problem.  (And between then and now I also updated the same system to Windows 10 which would explain the difference in screenshots)

After putting the problem aside for a while, I eventually noticed my working laptop was using the Gemalto mini-driver version 8.4.5.0 and the system which didn’t work was using version 8.4.8.0.  I installed the Gemalto 8.4.5.0 version from the Windows Driver Catalog but whenever I selected the driver for the card it would update back to 8.4.8.0 and because I was busy with other things at the time I didn’t really press on it.

.NET Gemalto search on the Windows Driver Catalog (to install, download a cab locally, unpack it, and right-click the .inf and select “Install”)

However when I went to enumerate the certificates on the card via command certutil –scinfo > scinfo.txt instead of getting a PIN prompt the certificates I got this error instead:

The smart card cannot perform the requested operation or the operation requires a different smart card

and the scinfo.txt output file indicated failures reading the key container when the same operation succeeded on my laptop:

--------------===========================-------------- ================ Certificate 0 ================ --- Reader: OMNIKEY CardMan 6121 0 --- Card: Axalto Cryptoflex .NET Provider = Microsoft Base Smart Card Crypto Provider Key Container = (null) [Default Container] Cannot open the AT_SIGNATURE key for reader: OMNIKEY CardMan 6121 0 …

Knowing the key container is read/written to by the mini-driver, failure to read then still hinted at some incompatibility with the particular Gemalto mini-driver version I had installed.

So I went back to Device Management (devmgmt.msc) and selected the Gemalto IDPrime .NET Smart Card node under the Smart cards node.  From there I selected “Update Driver…” > “Browse my computer for driver software” > “Let me pick from a list of device drivers on my computer” and chose the previously-installed 8.4.5.0 driver version:

Now when authenticating I can see the smart card LED blinking finally indicating activity and eventually the familiar PIN prompt:

Hooray, I can work from home again.

Categories: Uncategorized

## Contents of .pdf files not being indexed in Windows 8/8.1

August 10, 2014 1 comment

## Summary

I broke Windows Search indexing because I didn’t give the SYSTEM user full permission on the folders I wanted indexed.

## Background

We’ve been using a Fujitsu ScanSnap S1300i to scan all incoming paperwork (e.g. receipts, bills) since October 2012.  The ScanSnap includes ABBY FineReader OCR functionality (not ABBY FineReader itself but instead ScanSnap links to ABBY .dll’s to do the actual OCR task).  When the “Searchable PDF” option is used, ABBY OCR’s the .pdf and embeds the searchable text.

A collection of searchable-PDFs is only useful if something indexes them and you can search that index.  For most Windows users, the built-in Windows Search feature more than handles the task.

A few months ago I had profiled Windows boot performance to find out why initial-logon was slow only to find out Windows Search itself appeared to be aggressively reading the disk so I culled the list of indexed folders to lessen the load.  At the same time I rearranged folders to optimize disk usage and to simplify backups.  But around that time I noticed that searching on keywords that previously returned .pdf results now instead returned “No items match your search”.

If at this point I had tried searching for known PDFs in other locations (outside of my D:\Scans directory) I might have found out they were being returned.  However since the vast majority of all my PDFs are within D:\Scans I didn’t even bother checking.  Since other document types turned up in search results I assumed it was just a PDF-indexing problem.

1) Double-checked I hadn’t removed my scan folder from Indexing Options. I also tried removing and re-adding that folder.  I clicked the “delete and rebuild index” button between some changes thinking it’d make a difference.

2) Ran the Windows Search troubleshooter– Control Panel > search “windows search” and clicked “Troubleshooting: Find and fix problems with Windows Search”.  I checked the “Files don’t appear in search results” checkbox though I now suspect this is just a CEIP checkbox.  I always got “Issue not present” on each of the issues checked, including “Incorrect permissions on Windows Search directories”, ha!

3) Checked and changed the HKEY_CLASSES_ROOT\.pdf\PersistentHandler registry value per these steps from Adobe: http://helpx.adobe.com/acrobat/kb/pdf-search-breaks-110-install.html .  I spent a while on this step (and the next few) because I had installed the guilty version of Adobe Acrobat Reader before and I had even installed the Adobe PDF iFilter (v11.0.01) before I learned that Windows 8 includes PDF indexing out of the box. (It’s now uninstalled because the built-in Windows PDF indexing is just fine)

4) Reset Windows Search settings.  Setting REG_SZ value SetupCompletedSuccessfully to “0” at HKLM\SOFTWARE\Microsoft\Windows Search\ reset all “Index these locations” folders in Windows Search.  Re-adding the scan directory still didn’t help get those PDFs indexed.  While I was at it I configured Windows Search to index more aggressively since I was spending time waiting for index rebuilds.

5) Checked CLSIDs and .dll registration for .pdf indexing.  (or if “Filter Description” isn’t “Reader Search Handler” and you don’t have the Adobe PDF iFilter installed)

To do this:

a) Stop the Windows Search service.  Open services.msc, find “Windows Search” and right-click it to stop.

b) Default value at HKEY_CLASSES_ROOT\.pdf\PersistentHandler should be {1AA9BF05-9A97-48c1-BA28-D9DCE795E93C}

c) Default value at HKEY_CLASSES_ROOT\CLSID\{1AA9BF05-9A97-48c1-BA28-D9DCE795E93C}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF} should be {6C337B26-3E38-4F98-813B-FBA18BAB64F5}

d) If you’re running Windows 8x:

• Default value at HKEY_CLASSES_ROOT\CLSID\{6C337B26-3E38-4F98-813B-FBA18BAB64F5}\InProcServer32 should be %systemroot%\system32\glcndFilter.dll
• In an administrative command prompt, run: regsvr32 %systemroot%\system32\glcndFilter.dll  and confirm you get “DllRegisterServer in C:\WINDOWS\system32\glcndFilter.dll succeeded.

d) If you’re running Windows 10:

• Default value at HKEY_CLASSES_ROOT\CLSID\{6C337B26-3E38-4F98-813B-FBA18BAB64F5}\InProcServer32 should be %systemroot%\system32\Windows.Data.Pdf.dll

f) Restart the Windows Search service

g) If you made any changes to the registry values, rebuild your search index

6) Checked the contents of the Windows Search ESE database (windows.edb) to verify if this is an issue with the indexer not seeing or erroring-out on indexing of the files in question or an issue of storing the indexed values into the database.  Windows.edb is a standard ESE/JET Blue database.

I also reset Windows Search again (see step #4 above) and only configured it to have Windows index a few small directories, including a sub-folder of my much larger D:\scans directory just to keep indexed values to a minimum.

Then you:

• Stop the Windows Search service (via services.msc)
• Copy file Windows.edb found at C:\ProgramData\Microsoft\Search\Data\Applications\Windows to another location.
• Download and run ESE Database View (note: this isn’t my file and I cannot 100% attest to its safety but at least you don’t need to elevate when running it).  Open the previously copied Windows.edb file.
• From the drop-down, choose “SystemIndex_PropertyStore” and do a CTRL-F search for files which should be indexed.  If they show up then the file has been indexed if not, then the file hasn’t been indexed.
• Note: if you get “0 record(s)” after selecting the “SystemIndex_PropertyStore” table, it’s possible your windows.edb file is too large or that table is too large.  My smaller windows.edb file is 232MB, but now that I’ve got Windows indexing a much larger set of files it’s now 2.4GB.  It’s possible ESEDatabaseView cannot open ESE databases over a certain size.  Still a handy utility to know about.

7) Lastly, since I didn’t see the PDF files I wanted indexed in the windows.edb database, I compared this workstation to a known-working one where PDF indexing worked.  I compared all the above HKLM\HKCR values between the two systems– no difference.  I then compared the file security permissions between two files—one file on the working system which turned up in search results and one on my busted system which didn’t.  At the same time I checked the permissions which the SearchIndexer.exe process runs

There’s the problem—SearchIndexer.exe runs as SYSTEM and I didn’t add SYSTEM to D:\Scans’s security permissions.

I quickly granted the SYSTEM user permissions on all directories I wanted indexed and then rebuilt the search database.  Very quickly thereafter I started getting the PDFs showing up in search results.

Add SYSTEM user either via the “Edit…” dialog in the folder Properties > Security tab, or run something like the following in an elevated command prompt:

icacls "D:\Scans" /grant SYSTEM:(OI)(CI)F

Additionally, in my forum-crawling for solutions, I saw that others had success with copying files into the directory again to get indexing to work.  I suspect this might work for them because Windows doesn’t use the source file’s ACL but instead rebuilds it based off the folder which might be accessible to the SearchIndexer.exe process.

Categories: Troubleshooting, Windows 8

## Enable touch on HP 2740p with Windows 8.1

After upgrading my HP 2740p from Windows 8 to Windows 8.1 I lost touch.  The Wacom pen input still worked.  I re-installed PenTablet_533-3.exe and Wacom Digitizer Driver 3.0.7.24 – sp52863.exe (in that order) but touch wasn’t restored.

It wasn’t until I opened Window’s Control Panel, searched for Touch, launch the Touch Settings app, and run through the 16-point calibration was touch restored.

Touch Settings v3.0.7-24

Touch Settings (WTouchCPL.exe) on my system is installed to C:\Program Files\WTouch

Categories: Uncategorized Tags: ,

## Quicken 2011 Not Opening Last Quicken Data File (QDF) Used

I recently installed Windows 8 RTM onto my laptop.  Quicken 2011 R8 successfully installed and I as able to open my most recent QDF file without any issues.  However, the next time I opened Quicken, and every time after that, it presented me with the “Select your existing data file to get started” default screen rather than re-opening the last open file:

I re-opened Quicken again but with ProcMon running.  I noticed that it was successfully reading my directory of Quicken save files but in the end it was failing to open my QDF file because it was using the wrong file name.  It had truncated it to a shorter 8.3 filename and since a file doesn’t exist by that name it fails to open it:

This was a regression in behavior from running Quicken 2011 R8 in Windows 7 SP1 where I was using the same file at the same directory without any issues.

To workaround this I renamed my original QDF file from “RyanR Quicken Data.QDF” to “RyanR.QDF” so the filename was 5 characters long– less than or equal to 8.   I then re-opened Quicken, chose the renamed file, and then exited Quicken.  The next time I launched Quicken it successfully opened the last open QDF file.

From this Intuit forum thread it seems that this is a known issue with Quicken.  I just don’t know why I never saw this problem until now.

Categories: Windows 8 Tags: ,

## Wacom Devices and Photoshop Pen Pressure

9/9/2014 update: Earlier this year Wacom released updated drivers for Windows for supported PEnabled devices (the HP 2740p included) at http://us.wacom.com/en/feeldriver/.  I’ve confirmed that in Windows 8.1 and after uninstalling (and rebooting) any existing Wacom pen driver packages (e.g. “Pen Tablet” listed n Add/Remove software) and then installing ISD_DualTouch_720-10.exe (“Enhanced Tablet Driver 7.2.0-10”) enables Photoshop pen pressure support or similar in any other application that relies on Wintab driver support.

Information below is about my HP 2740p (and possibly HP 2760p) tablet running x64 Windows 7.  Suggestions here may or may not help with your particular hardware/software configuration.

My HP 2740p tablet’s great and after the HP touchscreen firmware update (3043-35D_0C6C, 4012-FOA (14 Jul 2010) – sp49201)– to fix the issue with touch not working in certain situations usually after resuming from sleep– everything works reliably.

Pen pressure generally always works with Windows apps like the pen input dialog, OneNote, or Windows Journal.  But getting pen pressure to work in Photoshop was a pain.  It entirely depends on which Wacom packages are installed, which versions of them, and what Wacom device drivers are being used.  If you get the combination incorrect, you’ll see a yellow exclamation icon in Photoshop’s brush Shape Dynamics pane and no pen pressure functionality:

(“Control by pen pressure requires the use of a pressure sensitive tablet”)

Once you get compatible driver packages and versions installed, Photoshop is happy and the feature works:

Wacom Dependencies

Using Dependency Walker to profile Photoshop, I found that Photoshop loads and executes code within the following Wacom files found at c:\windows\syswow64\, Pen_Tablet.dll and Wintab32.dll. The versions I have installed, from the Wacom_PenTablet_521-6a.exe package listed below, are: 5.2.1-6 and 1.0.4-3 respectively.

I haven’t tried it, but if those files aren’t present and you have a compatible Wacom Device device driver installed, Photoshop could fail to let you use Pen Pressure functionality.  Check for those files in your Windows install and if not install the Wacom_PenTablet_521-6a package.

Wacom Packages to Install

Search online for this Photoshop Pen Pressure issue and you’ll get a variety of helpful suggestions and links to different Wacom packages.  I wish this process was more deterministic but here’s what works for me (installed in this order):

9/9/2014 update:

Previously I was using (and used to work):

Here’s what certainly didn’t help:

• Wacom Bamboo Pen and Touch – Driver 5.2.4-6(RC) for Windows 7, Vista & XP (32 & 64 bit versions) – PenTablet_5.2.4-6.exe
• Wacom Digitizer Driver 3.0.7.20 – sp51088.exe (22 Nov 2010, w/ wisdpen.sys v3.0.4.5)
• Wacom ISD_DualTouch_701-8.exe
• Wacom Penabled Driver Driver 7.01-8 (RC) for Penabled Tablet PCs – ISD_DualTouch_701-8.exe

Wacom Device, wisdpen.sys, and Windows Update

Additionally, once you have a working version of the Wacom Digitizer Driver above installed, if it’s outdated, and you have your system’s Windows Update process set to search for driver updates online, Windows Update will notify for an update to the Wacom Device (HWID: ACPI\WACF00E):

If you install this driver update, it will update the

Wacom Device

from (driver date:12/30/2009, driver version:3.0.4.1) or (driver date:5/14/2010, driver version:3.0.4.5) and updating to (driver date: 12/20/2010, driver version: 3.1.1.2).  While that update works fine with Windows, it breaks pen pressure functionality in Photoshop.  If you want Pen Pressure in Photoshop,

don’t

install this update.
If you have installed the update already, open Device Manager (run: devmgmt.msc) and open the properties for node Human Interface Devices >

Wacom Device

.  Switch to the “Driver” tab and click “Roll Back Driver”.  After a reboot you will be back to the old version:

(Hardware Id: ACPI\WACF00E)

Wacom Driver Differences

Here’s a neat tip for searching for Windows driver updates used by Windows Update. Go to the Microsoft Update Catalog (you will need to install an ActiveX control) and search on the hardware ID you’re interested in, e.g. ACPI\WACF00E. The x64 3.1.1.2 package for “Wacom – Input – Wacom Device” updates the driver ACPI\WACF00E which is installed to c:\windows\system32\drivers\wisdpen.sys (Wacom ISD Tablet HID MiniDriver).

 Pen Pressure in Photoshop? wisdpen.sys Version wisdpen.sys Date Modified Works 3.0.4.1 1/4/2010 Works 3.0.4.5 5/14/2010 Doesn’t Work 3.1.1.2 1/4/2011

So something changed between Wacom’s wisdpen.sys v3.0.4.1 and v3.1.1.2 to break pen pressure sensitivity in Photoshop.  I tried poking around for public exports on wisdpen.sys for clues why but none exist. I also took a look at the differences pre/post update installation of the registry for the wisdpen service at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\wisdpen—no differences.  And the only difference between the 3.0.4.1 and 3.1.1.2 driver installation file, wisdpen.inf, was adding a registry value for BaudRate at the above key.

There are some interesting string differences between the two wisdpen.sys drivers themselves, like missing DefaultPenMouse/DefaultTouchMouse entries, but no smoking gun like “DisablePhotoshopPen” and nothing actionable.  At this point, unless I write my own Wacom Digitizer driver, I’m likely grasping at straws.

## Windows Phone 7 on a Samsung Focus

Notes and observations about the Samsung Focus hardware running Windows Phone 7.

# Charging

The Samsung Focus uses a certain amount of electricity in order to operate.  In order to charge, the incoming rate needs to exceed the rate being consumed by the phone.  If it doesn’t then you will problems like your Samsung Focus “charging slowly”, or “not charging.”

Not all USB ports output the same amperage.  The USB spec dictates each port output 5 volts, but amperage is only guaranteed to be available up to 100 mA.  If the phone requires ~200 mA and you plug your phone into a laptop USB port outputting 100 mA, then the battery will still be drained even though the device’s battery icon shows it’s charging.  Bus-powered hubs (USB hubs on the front-side of a desktop or most USB ports on a laptop) will generally provide 100 mA.  Root hubs and self-powered hubs should be 500 mA.  Some wall chargers will output >500 mA which while they’ll charge the phone faster could damage the phone or battery—if your phone gets hot while charging this is a good indicator it’s too much amperage as it needs to dissipate a higher amount of power.

Additionally, not all USB cables are not the same.  Some thinner cables (such as those in cheap retractable micro-USB cables) might have issues carrying amperage and will start to overheat (get warm to the touch) which will increase resistance and reduce the load (increase charging times).

You can access the battery diagnostics mode on the phone to find detailed information on battery charge percentage.  In short, bring up the phone and call “##634#”.  When the next screen comes up with the ‘-‘ button on top, enter the code “*#2*#”.  The Debug Mode for Chg/Bat will have three pages.  The first page (with examples values from my device):

• VBATT: ?
• INCHG: Incoming charge (?)
• 1: no charge
• 51-52: plugged into the USB2.0 port on backside of desktop computer
• THERM: ?
• 178
• TA (T/F): ?
• False
• USB (T/F): Whether the device is being charged via USB or not.
• BAT ID:
• 4 (no cable or not charging)
• 5 (charging via USB cable to USB 2.0 port on backside of desktop)
• MV
• VBATT_MV (mV, millivolt): Battery voltage
• On my phone, when charged to 100% and then unplugged from charger, this value went up to 4185 and then slowly dropped with some minor jumps up and down.
• VCHG_MV (mV): ?
• 65 mV when unplugged
• 4677 mV when plugged into USB2.0 port on desktop
• ICHG_MV (mV): ?
• 8 mV when unplugged (reads 0 immediately after being unplugged)
• 419 mV on my phone when charging via USB
• DEG (C): temperature of the battery
• 21 C on mine while indoors
• Bat_PER (%): percentage of battery charge
• 100 when battery is fully charged

Todo: determine electrical metrics (e.g. amps) used by Samsung Focus in various scenarios.

Todo: determine electrical metrics output by various charging devices.

# Touch

Touch can be finicky on the Focus.

• Sometimes doesn’t work when lying flat on a surface
• Remedy: picking the phone up (or just moving it?) seems to generally help. Note: if the phone is being charged, some chargers will prevent the phone’s screen from working while being charged.
• Update 4/20/2011: This should be fixed with the Samsung firmware (v2103.11.3.3) updates released in the March 2011 WP7 update. More info.
• When being charged with certain wall chargers, touch doesn’t work but resumes when unplugged
• Todo: determine specifics on which certain chargers are likely to do this
• Doesn’t like to be operated when vibrating.  This can easily happen when mounted in a car on a phone arm like below and say your car vibrates when idling with the heater on.
• Remedy: Move the car arm to a location where the mount can rest against the dash or otherwise not be vibrating out in the open.  Wrapping your hand around the phone to operate it can also temporarily fix this, but not while you’re driving..
• Screen surface has excess dirt/oil on it.  This can be registered as wayward presses and make the phone act wonky.
• Remedy: Wipe the phone screen with a clean non-scratching material– like your shirt.
Categories: Windows Phone


text:
## Thursday, March 16, 2006

### Itty Bitty Intervals. Topic: Algebra/Sets. Level: Olympiad.

Problem: (1996 Germany - #2) Suppose $S$ is a union of finitely many disjoint subintervals of $[0, 1]$ such that no two points in $S$ have distance $\frac{1}{10}$. Show that the total length of the intervals comprising $S$ is at most $\frac{1}{2}$.

Solution: Consider partitioning the interval $[0,1]$ into the pairs

$\{\alpha, \alpha+\frac{1}{10}\}$

for $\frac{k}{5} \le \alpha \le \frac{k}{5}+\frac{1}{10}$ with $0 \le k \le 4$. By the given condition, we can have at most one value from each of these pairs so at most half of the total length, and since the total length of the interval is $1$, the maximum length of $S$ is $\frac{1}{2}$. QED.

--------------------

Comment: Sort of an easy problem for a national olympiad, but a good exercise in sets and intervals. The hardest part about these problems is usually finding a way to prove it rigorously, instead of intuitively.

--------------------

Practice Problem: Prove that given $n$ real numbers in the interval $[0,1)$, there exist two such that the absolute value of their difference is at most $\frac{1}{n-1}$.

1. Proof 1: Pidgeonhole.

Proof 2: Suppose that there do not exist two such numbers. Arrange them in increasing order as the sequence a_n. The successive difference from each a_k to each a_{k+1} must be greater than 1/(n-1), and there are (n-1) such successive pairs; hence, the interval must have length greater than 1. Contradiction.

2. Yahoo Database

format: plain


text:
# Medians of a triangle are concurrent: prove using the Cantor intersection theorem

This problem is from A ProblemText in Advanced Calculus by J. M. Erdman (Chap. 16: The Heine-Borel Theorem, p. 91).

Use the Cantor intersection theorem to show that the medians of a triangle are concurrent.

This is the problem that surprised me the most in the full text. Any suggestions?

Here's the statement of the theorem we are supposed to use:

Theorem (Cantor intersection theorem). If $(A_n)$ is a nested sequence of nonempty closed bounded subsets of $\mathbb R^n$, then $\bigcap\limits_{n=1}^\infty A_n$ is nonempty. Furthermore, if $\operatorname{diam} A_n \to 0$, then $\bigcap\limits_{n=1}^\infty A_n$ is a single point.

My thoughts.

Of course, I know some standard proofs of this result (using plane geometry or vectors). But here, we are required to use the Cantor intersection theorem.

Fix an arbitrary triangle $\triangle$. I originally started out with $A_1 := \triangle$. My goal was to assume that the medians are not concurrent, and derive a contradiction. It is clear that if the medians are not concurrent, then they form a mini-triangle inside $A_1$. Should I define that triangle to be $A_2$ and proceed recursively to define $A_3, A_4, \ldots$? This idea is the only one I could think of. However, this does not seem good enough: I cannot see any contradiction arising from the conclusion that the intersection of all the $A_n$'s is nonempty (or a singleton set).

Can you suggest a better approach?

-
I’d let $A_{n+1}$ be the triangle whose vertices are the midpoints of the sides of $A_n$. It’s clear that you’ll get a single point of intersection, and similar triangles should let you show pretty easily that the vertices of the $A_n$ form three collinear sets. (That has to be the oddest use of the Cantor intersection theorem that I’ve seen, though!) –  Brian M. Scott Nov 6 '11 at 6:24
@Brian I'm clear till the single point of intersection bit (call this point $G$). Can you elaborate on the remaining part? Do I use $G$ to show that the vertices of $A_n$ "form collinear sets"? –  Srivatsan Nov 6 '11 at 6:27
@Brian I agree with your comment about the oddest use of Cantor intersection. It's as if that the author really starts off with a reasonable standard geometry (similar triangles) proof, and then injects some analysis into it... –  Srivatsan Nov 6 '11 at 6:28
@Srivatsan: I posted a solution some time ago, the last line tells you how to prove that the vertices are colinear ;) –  N. S. Nov 6 '11 at 6:32
$A_{n+2}$ is similar to $A_n$ with sides parallel to those of $A_n$. $A_{n+1}$ also has sides parallel to these, but it’s inverted. I’ve not thought it through carefully, but it appears that you can use similar triangles to show that corresponding vertices of the triangles are collinear; the three lines are of course the original medians. –  Brian M. Scott Nov 6 '11 at 6:37

## 1 Answer

Try apply the Cantor intersection theorem to the triangles made by the midpoints of the edges.

If $ABC$ is your triangle, then $A_1:=A, B_1:=B, C_1:=C$; and inductively $A_{i+1}$ is the midpoint of $B_iC_i$; $B_{i+1}$ is the midpoint of $A_iC_i$, $C_{i+1}$ is the midpoint of $A_iB_i$...

The fixed point of the Theorem should be $G$. It should follow immediately from the fact that $A_iA_{i+1}$ is median in both $A_iB_iC_i$ and $A_{i+1}B_{i+1}C_{i+1}$.

-
Thanks! This looks helpful, but I need some more explanation in the last line. Is $G$ the single point of intersection of all the triangles? And what exactly follows from that fact that $A_i A_{i+1}$ is median of both $A_iB_iC_i$ and $A_{i+1}B_{i+1}C_{i+1}$? –  Srivatsan Nov 6 '11 at 6:36
Since $A_iB_{i}$ is half of $A_{i-1}B_{i-1}$ it is easy to argue that the intersection is a single point. Lets call this point $G$. Now, the fact that $A_iA_{i+1}$ is median in both triangles, it follows by induction that the line supporting all medians $A_iA_{i+1}$ is the same... You can now argue that $G$ must be on this line.... Or you could simply apply the cantor intersection Theorem directly to the intervals $A_iA_{i+1}$ and then again to $B_iB_{i+1}$ and $C_iC_{i+1}$. Actually this last idea might be better :) –  N. S. Nov 6 '11 at 6:41
@Srivatsan The fact that $A_iA_{i+1}$ is median in both triangles follows immediately from $A_iB_{i+1}A_{i+1}C_{i+1}$ parallelogram. –  N. S. Nov 6 '11 at 6:43
+1 Thanks, @N.S. Now, it's fully clear. Your first reply was very helpful to me; perhaps you can add it into the answer. –  Srivatsan Nov 6 '11 at 6:46


text:
# Prove acyclic graph with $n-2$ edges has exactly $2$ connected components

prove that every graph $$G$$ on $$\{1,2,\cdots,n\}$$ which is acyclic and has $$n-2$$ edges has exactly $$2$$ connected components

If it was $$n-2$$ then the graph was a tree which has exactly 2 connected components. But I have no idea for $$n-2$$ edges. I was wondering what can we say about for $$n-k$$ edges where $$k

HINT: Each component of an acyclic graph is a tree. Suppose that the graph has $$m$$ components, $$C_1,\ldots,C_m$$, and for $$k=1,\ldots,m$$ let $$n_k$$ be the number of vertices in $$C_k$$, so that $$n_1+\ldots+n_m=n$$.
• If $$1\le k\le m$$, how many edges does $$C_k$$ have?
So what, in general, is the relationship between the number of components of an acyclic graph on $$n$$ vertices and its number of edges?
• Each component of an acyclic graph is a tree then isn't there should be $k-1$ edges for each $C_k?$ There should be $\frac{m(m-1)}{2}={}^mC_2$ edges altogether. @Brian M. Scott Apr 13 '21 at 23:02
• @WhyGraph_: Not $k-1$ edges: $n_k-1$ edges. That makes a total of $$\sum_{k=1}^m(n_k-1)$$ edges; now simplify that sum to get something that involves only $n$ and $m$. Apr 13 '21 at 23:06
• $$\sum_{k=1}^m(n_k-1)=\sum_{k=1}^mn_k-\sum_{k=1}^m1=n-m$$ Aha, I get it. Thanks @Brian M. Scott Apr 13 '21 at 23:09


text:
DEVELOPMENT OF AN IMPROVED THREE-DIMENSIONAL STATIC AND DYNAMIC STRUCTURAL ANALYSIS BASED ON FETI-LOCAL METHOD WITH PENALTY TERM

• KIM, SEIL (DEPARTMENT OF MECHANICAL AND AEROSPACE ENGINEERING, SEOUL NATIONAL UNIVERSITY) ;
• JOO, HYUNSHIG (DEPARTMENT OF MECHANICAL AND AEROSPACE ENGINEERING, SEOUL NATIONAL UNIVERSITY) ;
• CHO, HAESEONG (BK21 PLUS TRANSFORMATIVE TRAINING PROGRAM FOR CREATIVE MECHANICAL, INSTITUTE OF ADVANCED MACHINES AND DESIGN, SEOUL NATIONAL UNIVERSITY) ;
• SHIN, SANGJOON (DEPARTMENT OF MECHANICAL AND AEROSPACE ENGINEERING, INSTITUTE OF ADVANCED AEROSPACE TECHNOLOGY)
• Accepted : 2017.09.14
• Published : 2017.09.25

Abstract

In this paper, development of the three-dimensional structural analysis is performed by applying FETI-local method. In the FETI-local method, the penalty term is added as a preconditioner. The OPT-DKT shell element is used in the present structural analysis. Newmark-${\beta}$ method is employed to conduct the dynamic analysis. The three-dimensional FETI-local static structural analysis is conducted. The contour and the displacement of the results are compared following the different number of sub-domains. The computational time and memory usage are compared with respect to the number of CPUs used. The three-dimensional dynamic structural analysis is conducted while applying FETI-local method. The present results show appropriate scalability in terms of the computational time and memory usage. It is expected to improve the computational efficiency by combining the advantages of the original FETI method, i.e., FETI-mixed using the mixed local-global Lagrange multiplier.

Acknowledgement

Supported by : National Research Foundation of Korea(NRF)

References

1. Kwak, J. Y., Chun, T. Y., Shin, S. J., Computational Mechanics, Domain Decomposition Approach to Flexible Multibody Dynamics Simulation, Vol. 53, No. 1, pp. 147-158
2. Farhat, C., and Roux, F. X., International Journal for Numerical Methods in Engineering, A Method of Finite Element Tearing and Interconnecting and its Parallel Solution Algorithm, Vol. 32, 1991, pp. 1205-1227. https://doi.org/10.1002/nme.1620320604
3. C. Farhat, M. Lesoinne, P. Letallec, K. Pierson, D. Rixen, Int. J. Numer. Meth. Engng, FETI-DP: a dual-primal unified FETI Method- Part I: A Faster Alternative to the Two-level FETI Method, 50, pp. 1523-1554, 2001. https://doi.org/10.1002/nme.76
4. Park, K. C., Fellipa, C. A., and Gumaste, U. A., Computational Mechanics, A Localized Version of theMethod of Lagrange Multipliers and its Applications, Vol. 24, Issue 6, 2000, pp. 476-490. https://doi.org/10.1007/s004660050007
5. Bauchau, O. A, Epple, A., and Bottasso, C. L., Journal of Computational and Nonlinear Dynamics, Scaling of Constraints and Augmented Lagrangian Formulations in Multibody Dynamics Simulations, Vol. 4, 2009.
6. Bauchau, O. A., Journal of the Franklin Institute, Parallel Computation Approaches for Flexible Multibody Dynamics Simulations, Vol. 347, No. 1, 2010, pp. 53-68 https://doi.org/10.1016/j.jfranklin.2009.10.001
7. Kwak, J. Y., Chun, T. Y., and Shin, S. J., Computational Approaches for Large Scale Structural Analysis using Domain Decomposition Technique, 52nd AIAA/ASME/ASCE/AHS Structures, Structural Dynamics and Materials Conference 19th 4-7 April 2011, Denver, Colorado
8. Vondrak, V., Dostal, Z., Dobias, J., and Ptak, S., Lecture Notes in Computational Science and Engineering, Domain Decomposition Methods in Science and Engineering XVI, pp771-778
9. Kwak, J. Y., Chun, T. Y., Cho H. S., and Shin, S. J., Journal of the Korean Society for Industrial and Applied Mathmatics, Advanced Domain Decomposition Method by Local and Mixed Lagrange Multipliers, 18(2.1), 17-26, 2011
10. Hashamdar, H., Ibrahim, Z., Jameel, M., International Journal of the Physical Sciences, Finite Element Analysis of Nonlinear Structures with Newmark Method, Vol. 6(2.6), 1395-1403, 2011
11. Felippa, C. A.,Computer Methods in Applied Mechanics and Engineering, A Study of Optimal Membrane Triangles with Drilling Freedoms, Vol. 192, No. 16, 2003, pp. 2125-2168. https://doi.org/10.1016/S0045-7825(03)00253-6
12. Batoz J. L., Bathe K. J., and Ho L.W., International Journal for Numerical Methods in Engineering, A Study of Three-node Triangular Plate Bending Elements, Vol. 15, 1980, pp. 1771-1812. https://doi.org/10.1002/nme.1620151205
13. Khosravi, P., Ganesan, R., and Sedaghati, R., International Journal for Numerical Methods in Engineering, Corotational Non-linear Analysis of Thin Plate and Shells using a New Shell Element, Vol. 69, 2007, pp. 859-885. https://doi.org/10.1002/nme.1791
14. Kwak, J. Y., Cho, H., Chun, T. Y., Shin, S. J., International Journal of Aeronautical and Space Sciences, Domain Decomposition Approach Applied for Two- and Three-dimensional Problems via Direct Solution Methodology, 16(2.2), 177-189, 2015 https://doi.org/10.5139/IJASS.2015.16.2.177
15. Allman, J., International Journal for Numerical Methods in Engineering, Evaluation of the Constant Strain Triangle with Drilling Rotations, Vol. 26, 1988, pp. 2645-2655. https://doi.org/10.1002/nme.1620261205


text:
## Two Boys And A Canoe

### March 11, 2016

We have today an interview question from Google:

A group of Boy Scouts is taking a trip by canoe and needs to determine how many canoes to rent. A canoe can hold one or two boys and a total of 150 pounds. Given a list of boys’ weights, how many canoes are needed?

Your task is to write a program that determines how may canoes are needed. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2

## String Prefixes

### March 8, 2016

Two strings have a common prefix that consists of the longest prefix of the strings that is the same. For instance, the strings “I love cats” and “I love dogs” have the common prefix “I love ” (including a trailing space at the end of love, which doesn’t appear properly in some browsers).

Your task is to write a program that finds the common prefix of a list of strings (possibly more than two strings). When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2

## Wave Sorting

### March 4, 2016

A list of integers is sorted in “wave” order if alternate items are greater than their immediate neighbors (thus the other alternate items are less than their immediate neighbors). Thus, the list [4 1 7 5 6 2 3] is in wave order because 4 > 1, then 1 < 7, then 7 > 5, then 5 < 6, then 6 > 2, and finally 2 < 3. Note that the two alternate streams [4 7 6 3] and [1 5 2] need not themselves be sorted. It doesn’t matter if the first item is the high wave or the low trough between waves, though starting with a wave is traditional.

Your task is to write a program that takes a list of unique integers and sorts it into wave order. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2

## Powers Of 3

### March 1, 2016

The powers of 3 are 30 = 1, 31 = 3, 32 = 9, 33 = 27, and so on.

Your task is to write a program that determines if a number is a power of 3; you must give more than one solution. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2

## Two Amazon Interview Questions

### February 26, 2016

In the previous exercise I wrote a solution that doesn’t work, so I guess I have to try again with two more Amazon interview questions:

Create a set data structure that provides the following operations, which must all operate in constant time: insert, delete, member?, and random. The random operation should return a random element from the set.

and

Given an array, find the first element that appears an even number of times.

Your task is to answer the two interview questions. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2

## Arithmetic Sequence

### February 23, 2016

Today’s exercise is an interview question from Amazon:

Determine if a list of integers forms an arithmetic sequence. For instance, the integers 1, 2, 3, 4, 5 form an arithmetic sequence because the differences between them are all the same, but the integers 1, 2, 4,8, 16 do not form an arithmetic sequence because the differences betweent them are not all the same. The input need not be sorted, so the integers 3, 2, 5, 1, 4 also form an arithmetic sequence.

Your task is to write a function that determines if a list of integers forms an arithmetic sequence. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2

## Hacked

### February 19, 2016

I’ve been without internet connectivity for three days following a potential hacking attack against my home network:

1. The light on my router flashes continuously, indicating data transfer, even when I’m not using my computer.
2. I noticed file with extension .bin being downloaded to my Android tablet; I had not requested any such file, nor was I notified of any downloads.
3. There are numerous “connection requests” on my router log; I am not running a publicly available server, and there is no reason for anyone to be requesting a connection to my network.

I called my service provider and spoke to a supervisor. He suspects a hardware problem in the router, and is shipping a new one, which will arrive in a few days. In the meantime, I have shut down the old router. I can see how a new router might fix the first item, but not the other two.

I’ll let you know how I get on. In the meantime, I’ll appreciate any suggestions anyone has. I don’t even know if I’ve actually been hacked.

I haven’t had time to write an exercise, nor do I have a way to upload it; I’m writing this note at my office. I’ll be sure to have one next Tuesday.

## Finding God

### February 16, 2016

The first three verses of the Bible are shown below. Pick any word in the first verse, count its letters, and move forward that many words in the text. Then repeat until you reach the third verse. You will always end with God.

1 In the beginning God created the heaven and the earth.

2 And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.

3 And God said, Let there be light: and there was light.

For instance, if you start at beginning, count nine letters and move forward to the first the in the second verse. Then count forward three words to without, count forward seven words to upon, then count forward three words to the, count forward three words to another the, count forward three words to God, count forward three words to the, count forward three words to yet another the, and finally count forward three words to God. This trick was discovered by Martin Gardner.

Your task is to write a program that reads a text and checks if the trick works; you might look at the first paragraph of Alice in Wonderland, where starting within the first ten words always leads to sister, or the words of Twinkle, Twinkle Little Star, where starting anywhere within the first two lines always leads to you in the last line. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2 3

## Three String Exercises

### February 12, 2016

We have three simple exercises on strings today:

1. Write a function that determines the length of a string.
2. Write a function that finds the index of the first occurrence of a character in a string, optionally starting at a given index.
3. Write a function that creates a new string as a substring of an input string, from a given starting index to a given ending index.

Your task is to write the three exercises described above. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2

## Counting Primes

### February 9, 2016

We have studied functions for counting the prime numbers less than a given number in two previous exercises. All of them were based on Legendre’s phi function that counts the numbers less than x not stricken by sieving with the first a primes.

Today we look at a rather different method of counting the primes that is due to G. H. Hardy and Edward M. Wright. Their method is based on factorials, and their formula is

$\pi(n) = -1 + \sum_{j=3}^{n} \left( (j-2)! - j\lfloor \frac{(j-2)!}{j} \rfloor \right)$

for n > 3, where ⌊n⌋ is the greatest integer less than n. The expression inside the big parentheses is 1 when n is prime and 0 when n is composite, by Wilson’s Theorem, which states that an integer n > 1 is prime if and only if (n − 1)! ≡ −1 (mod n); the theorem was first stated by Ibn al-Haytham (c. 1000AD), but is named for John Wilson, who first published it in 1770, and it was first proved by Lagrange in 1771.

Your task is to write a program that counts primes by the Hardy-Wright method. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2


text:
# Enquiry on an inequality involving the sum of the reciprocals of primes

Let $p_k$ denote the $k-th$ prime. Do there exist some constant $A>0$ such that for every sufficiently large $k$,

$$\sum_{p\leq p_k} \frac{1}{p} > B + \log\log p_k + \frac{A}{\log p_k}$$

where $B$ is the Mertens constant?

It is known that

$$\sum_{p\leq p_k} \frac{1}{p} = B + \log\log p_k + O\left(\frac{1}{\log p_k} \right)$$

but nothing seems to be known about the sign of the implicit constant in the Landau $O$-symbol.

• No. Mertens original paper has the opposite inequality with some terms plus 4/log(n+1), which means you can compute n_0 for which A=5 works for n bigger than n_0 for the opposite inequality. Also, there is oscillation (see Diamond and Pintz) which means your inequality with any positive A fails infinitely often. Gerhard "Goes This Way And That" Paseman, 2017.05.13. – Gerhard Paseman May 13 '17 at 14:04
• @GerhardPaseman: why not posting this as an answer? – Seva May 13 '17 at 16:11
• Because I don't know if the question has a typo. If the question is meant as asked, I may post an answer. Gerhard "Isn't Sure Of The Question" Paseman, 2017.05.13. – Gerhard Paseman May 13 '17 at 23:08


text:
Journal article

Measurement of the inclusive jet cross section at the Fermilab Tevatron pp̄ collider using a cone-based jet algorithm

Abstract:

We present a measurement of the inclusive jet cross section in pp̄ collisions at s=1.96TeV based on data collected by the CDF II detector with an integrated luminosity of 1.13fb-1. The measurement was made using the cone-based midpoint jet clustering algorithm in the rapidity region of |y|<2.1. The results are consistent with next-to-leading-order perturbative QCD predictions based on recent parton distribution functions (PDFs), and are expected to provide increased precision in PDFs at hi...

Access Document

Publisher copy:
10.1103/PhysRevD.78.052006

Authors

Aaltonen, T More by this author
Adelman, J More by this author
Akimoto, T More by this author
Albrow, MG More by this author
Álvarez González, B More by this author
Journal:
Physical Review D - Particles, Fields, Gravitation and Cosmology
Volume:
78
Issue:
5
Publication date:
2008-09-29
DOI:
EISSN:
1550-2368
ISSN:
1550-7998
URN:
uuid:3aae5383-53fb-47b7-aa9f-3f3530c6c385
Source identifiers:
117369
Local pid:
pubs:117369
Language:
English


text:
Multiband dynamic processing

Started by 2 years ago12 replieslatest reply 1 year ago455 views

Hi everyone,

This is my new post in this community.

Interested in acoustics in general, I am now playing a bit with C++ playing with the code and trying to implement different filters and sound processes. I am now focusing on multiband dynamics and wonder about the process to build it. I imagine that for a 3 band filter, I have to duplicate my signal 3 times and run in parallel a low-pass, band-pass and high-pass filter, apply a compression on each channel, and then sum the 3 processed signals and the end.

My quesions are simple:

- is this approach correct?

-what kind of filter should I use for this (second order, biquad,...) Seems that there are many different ones, but I have no idea about their respective usage.

Thanks for any tip!

#Audio

[ - ]

I've not designed a multi-band compressor, but I have used them quite a bit, so take this with a certain level of skepticism.

The kind of filter you use is entirely up to you as the designer.  In addition, a biquad filter can be a second order filter.  That being said, you probably want your filters to be complementary, such that the sum of the outputs, given unity gain (no compression/makeup gain), matches the input.

One criteria you would most likely want to impose is that for a biquad band pass filter, you should have 20dB/decade roll-off above and below the center frequency, so you would probably want to use first order low/high pass filters.

I've given some thought to this in the past, and what I've thought about doing is something along these lines: take the input stream and create a copy of it, low pass filter it on one and then subtract it from the original to create the second (NOTE: this could be done with proper filter coefficients using a high-pass filter, but I believe this would be more efficient to guarantee that the sum of the two outputs equals the input, especially for higher order low-pass filters).  This process could then be repeated as many times with increasing cutoff frequencies as needed to create the subsequent bands.  From there, as you described, run your dynamics control on the different audio bands to get the desired effect.

That's my 0.02 anyway, best of luck!

[ - ]

Thanks dszabo!

I found everything I needed for the filters you mentioned here:

I put 2 filters in cascade to get a -24db/octave one as suggested.

I didn't think about the subtracting trick but this might be exactly what I need. I am still trying to implement it as I am working with vectors and the std::transform function reports some errors. But I'll get through soon.

Thanks again.

[ - ]

It looks like just subtracting the low-pass buffer from the initial track is not working. This was however the method suggested in this post:

[ - ]

I'm certain you could get satisfactory results simply by using that source code library you linked to by setting the parallel filters with the correct parameters.

The whole subtracting idea is provided without warranty, and I don't have a ton of time to try it on my end right now, but I bet you can manage without it for now.  If you start to run out of CPU, you may want to reconsider it, but until then it would probably be wise to keep it as simple as possible.  Especially if you haven't even gotten to code your dynamics control yet, that'll be the fun part!

Are you implementing this as a VST plug-in, or something like that?

[ - ]

I am just developing an offline processing exe for now to add some effects on top of an input track. I intended to use CLAM or Marsyas but the documentation is rough for me with very few examples (not a c++ programmer) and I found very difficult to build a skeleton app :(

I am not sure I can go far by my own like this but at least I am learning something on my way!

[ - ]

I stumbled on this thread while looking for ways to improve a multiband compressor my team and I are building...

Regarding the subtraction technique, it works.  However, you have to be satisfied with phase distortion where the high and low sides of the bandpass signal you are subtracting with interacts with the original signal.  The effect is not unpleasant to the ear and can yield some very cool tone effects.  I liked using it for de-essing and controlling voice inside a mix during the mastering process.

I prototyped the concept in Synthedit.  You can download a VST (Windows) here if you want to hear for yourself (the Xaq Dynamic Eq):  http://xaqmusic.com/

Cheers!

[ - ]

Right on!  I’m glad you were able to make something out of it.  I’d love to hear a demo

[ - ]

If you use a parallel filter bank, the biggest issue will be the phase relationship between the bands when you sum them together again. If you use linear phase FIR filters (with equal latency values) then all will be well. Equally, you can use use biquads if you select the correct type of filter 'shape'. Filters used for loudspeaker crossovers have similar requirements. Check out 4th order (24dB/Octave) Linkwitz-Riley.

[ - ]

Probbie,

Thanks for the filter tip.

In a DAW, we very often split an initial signal into 2 sub-branches and apply different filters. I never had any phase issue with this process. Is it different or maybe the signal is not split this way behind the scene.

As for CLAM or Marsyas, anybody has any experience/feedback?

Thanks!

[ - ]

With respect to using a DAW, an engineer is typically going to be looking at time delay and inversion on a waveform.  Similarly, the latency through your signal routing and plug-ins can create a relative delay between a split audio signal.  This can create very distinct phasing effects that you would usually try to avoid.

In DSP, filters are typically analyzed in terms of their z-transform, which has both a magnitude and phase response as a function of frequency.  A graphical EQ will (or at least should) give you the magnitude response as part of the UI.  But it does not give you the phase response.  Because the phase response of a given filter in the DAW is not necessarily known, you would want to exercise caution in assuming that just because the magnitude plots should sum to unity, that they actually sum to unity.

That being said, I personally haven't encountered issues with this.  For example, if I use the Channel Strip plug in on a pair of busses in pro tools, and set one to be a LP filter at 1kHz, and one to be a HP filter at 1kHz, both having the same roll-off, I know from experience that they will sum to unity.  The point is that this isn't explicitly the case.

The wisdom would be to make sure to have some verification that the filters you design sum to unity, either by deriving the transfer function analytically, or by testing it with an impulse.

[ - ]

Well -- I know that my reply is late/old, but I think that I have a lot of info/experience to help you with.  MY current project is a DolbyA decoder, but my current on-hold project is a multiband compressor/limiter complex, and also I have an in-progress expander project.  Each of these projects are working pretty well, and I might be able to help you with some of your potential approaches.

I am going to restrict my comments to compressor/limiter matters -- expanders (and the DolbyA decoder) are similar in some ways, but the design tradeoffs are different.

For a multi-band compressor -- I have a few hints that will help, and also I can talk about some of the decisions that you might need to make.

The two most important (initial) choices are the frequency band count/choices and how to detect the audio.  The detection scheme choice is incredibly important, and can almost make/break the project.

For the audio bands, of course, you are talking multi-band, so do you want to choose 2,3,5-6 or more bands?  I have some suggestions from experience, and lets just focus on 2 or 3 bands for now.  If you go much beyond that -- the choices have different criteria.

For 2 or 3 bands, most important is to split the bass from the treble.  So, where to split the bass?  My suggestion is make the transition between 160 and 320Hz for the bass.  This will cover most of the traditional 'bass' sound and help to keep that from modulating the middles and highs.  For three bands, it is a good thing to keep the speech frequencies together, so I wouldn't split the treble below 2.5kHz, and would rather choose 3-5kHz.  If the speech frequencies are chopped up, it can be noticeable without careful management.  So, the decision about the highest frequencies has been made:  (3-5kHz to 20.5kHz.)  Note that I put a topside on the highest frequencies -- there is a reason for that, but we might not get into that here.  Suffice to say that constraining the spectrum is a good thing.  Let's choose our bands now -- I am going to make the decision for my new 3 band:  (20-240Hz, 240-3kHz, and 3kHz-20.5kHz.)  For a 2 band: (20-240Hz, 240Hz-20.5kHz.).

How to detect the audio?  There are two general schemes: an RMS-like detector or a Linear-like detector.  For smooth sounding general purpose compressors, I suggest an RMS-like detector.  This means thus:  signal -> square -> avg/peak-detect-with-averaging -> filter -> square root -> raw signal level value.

For a linear detector (not recommended except for special purposes or slow gain control), one filters in the linear domain instead of the 'squared' domain, like this: signal -> avg/peak-detect-with-averaging -> filter -> raw signal level value.

Linear gain control makes for very responsive gain following, but it is too responsive and higher compression levels tend to give a sense of level depression -- it is really odd and should be used with care or for compander applications.

So -- RMS detection is only part of the choice for the detector.  The simplest is to use an averaging scheme for the filter.  The simplest filter is a straight RC time constant (or digital equivalent) and then further nonlinear filtering.  I use a really sophisticated (and difficult to ad-hoc explain) detector scheme that helps mitigate intermodulation effects.  Offline or in the future, I can explain the whole gamut of my set of detector and gain control C++ classes (always changing and always being improved), but a good first cut would be a 1msec attack time, and a 100msec decay time in the detection filter above.  After that, then a subsequent dynamic filter that varies in the decay time depending  upon the dwell time of the signal.  The dynamic filter can be both (or either) in the linear or dB domain.  If you use the dB domain for the larger scale gain changes, the compressor will sound very similar at 3dB or 30dB of compression.  If you use subsequent linear filtering only, then the sound will become more compressed sounding as you increase the compression depth.

Next choice:  compression ratio. COmpression ratio is usually best specified as a unitless dB/dB ratio. That can be calculated in slightly different ways depending on the kind of flexibility that you want...  In the most general case, I actually use either the C/C++ pow function or multiply in the dB domain, depending on where I do the calculation.  If you never go into the dB domain, you can just use the pow function or use explicit sqrt type opertions to effect the compression ratio.

But, how do you actually 'wire-in' the compression ratio... Well, assuming a feedforward gain control (much easier on computers than trying to do feedback gain control), you simply take the processed level, apply the nonlinear transfer function that does the compression ratio calculation, then multiply this dynamic result with the signal itself.  For inf:1 compression, you take the level calculated/processed above, mathematically invert it, and then multiply that by the audio signal. (I am not saying 'divide' for historical reasons, I always multiply.)  If you only want 2:1 compression, you take that inverted 'level', sqrt it, and then multiply by the signal.  Basically, in the general case, the signal multiplier(gain) can be caulculated by: gainval = pow(inv-level, crpower);, were crpower = (1.0 - (1.0 / cr));  Or, if you don't want to do the inversion, then you can make the pow function do all of the compression ratio work:  gainval = pow(level, -1.0 * crpower);  The -1.0 multiplier in the power function does the inversion for you.

One thing that I didn't mention is that this 'measurement' and 'gain' is done individually for each audio band.

After the signal * gain calculation is done for each channel, one can (often) just sum the results together.  There are times where a simple sum isn't the best choice, and that can be a subject for future discussion.  Basically -- think of this (put your EE hat on) -- whenever you multiply a signal by a gain and that gain is changing, what do you get?  Sidebands!!!  Because the gain change is nonlinear, the sidebands are not nice and clean, but fast gain changes can cause lots of splatter all over the place... So, in some cases, if done carefully, some post filtering can be used to improve the sound quality of a basic compressor/expander, and in fact be much better than a REAL FET compressor.  (Opto compressors have a big advantage that their gain changes are slow, which cause less intense far-away sidebands/distortion.  That is one reason why Opto compressors are so desirable.)

Lets not worry about the 2nd order matters like 'optimum quality', and just get a good/plausible compressor working -- so the post filtering can be deferrred for now.

Oh well -- hope that this helps to get you started...  I have LOTS more info and experience on these conceptually simple things (but are infinitely more subtle than one might initially guess!!)

John

[ - ]

I have some C++ code that could be relatively easily adapted to be multiband.  This compression is pretty clean (a few problems with sampling, which means that a little more careful crafting might be in order.)  However, the dynamics and sound of this compression are both pretty good (other than the HF effects whichi I mentioned.)  Might need an LPF on the gain control signal.  I have written much more complex compressors based upon this general technique -- and does model approximatly the dbx RMS approach.  Some support subroutines might need to be filled in line 'Vmax' which in my library is a 'max' routine that works with everything, including my long vector package variables.  Likewise, dB2lin and lin2dB are similar -- they work with vector & scalar operations -- however, for the purposes of this code, just normal subroutines would work fine.

Again -- not 100% complete, but the code runs as is in my C++/Audio development environment and support routines (my working environment, that I also use for my DolbyA compatible decoder and various compressors/expanders also supports mulithreading, message passing across threads, very wide ranging vector math support, automatically using the fancy vector instructions on the CPU, etc.)  I simplified the code to work without vectors, and the 'Asample' class is simply a floating point left and right signal value (item0 and item1.)  It is roughly equivalent to using --encoding=floating-point --bits=32 in sox.

dBfilterSIMPLE is pretty much a raw implementation of dbx style signal detection.  The two parameters used in the declaration of the class are the dB/sec values for attack/decay.  (Technically, it isn't quite dB/sec, but is dB/sec per dB of signal level change.)  In some cases, a fixed decay rate vs. the calculated decay might sound better.

(I am making available a compilable/runnable version of the demo also -- the technique used sounds very good for such simple code.  PLEASE IGNORE THE SIZE OF THE INFRASTRUCTURE -- the compressor itself is only perhaps 100 lines of code -- with the support stuff being much larger. With my vector library, it IS very easy to extend to multiple bands, all you need are the appopriate front-end band pass filters, and learn to use the vector math lib.  For my DolbyA decoder, I use carefully crafted IIR filters, with some dynamic characteristics that model the feedback loop.  For the compressor, a few simple IIR filters will suffice -- I suggest using simple 2nd order HPF, and then add/subtract to get the bands you want.  You can also use more formal crossover filters, but bandpass leakage for this compressor would not be fatal.

Look for the file "simplecomp.zip" in the repo below.  I could not attach the file, so unless I can figure out how, the repository has the program and source code.  It also has an ancient and broken version of the DolbyA 'compatible' decoder -- it is far, far from being accurate enough for pro use, but can improve normal consumer DolbyA material.  The more accurate (REALLY GOOD IN FACT) one will be mentioned at AES - in a talk about tape restoration.

REPOSITORY: https://spaces.hightail.com/space/tjUm4ywtDR

(SORRY FOR THE SOURCE NOT BEING EASIER TO READ/BETTER DOCUMENTED!!!  I can help intepret if someone is really all that interested.)

Using the compressor -- a --thresh=9 and a --cratio=0.50 is a good start.  --cratio=0.50 is 2:1, --cratio=0.66 is 3:1, etc.  use the program like this:

comp-win --cratio=0.50 --thresh=9 <infile.wav >outfile.wav

Program also works realtime with sox tools, like the sox command and the sox based 'play' command.

The runnable version of the compressor is a windows .exe, but will build under Linux with proper Makefile changes (I do all development on Linux) -- there is a HUGE amount of unnecessary infrastructure for the demo, but I cobbled the source together from my DolbyA decoder (removing all of the proprietary parts), and then added the simple compressor.  Note that the actual compressor class is proccomp starting at about line 642 in the audioproc.cpp source file.  The call to the class is in the "THinput" thread (which really was a part of a long string of threads in the DolbyA decoder, but on this the other threads are nulled out.)  Simply, the thread calls the class in a loop, processing the samples one by one.

For the 'RMS' filter (which is a misnomer, but this technique is an extension of what THATcorp and DBX call 'RMS') -- it is the class 'VfilterdB', and it really does all of the work.  I wrote a simple scalar version of the filter called 'dBfilterSIMPLE' which does a simpler version of what the more sophisticated VfilterdB does.  dBfilterSIMPLE is much closer to the original 'RMS' technique.

I have a rather large header file containing all kinds of attack/release and detector techniques for audio processing programs, and I left a few examples in the audioproc.cpp and smfilt.h files.  Most of the support class files have been minimized for this application. Whenever possible, my programs uses the SIMD instruction set -- refer to the top of the audioproc.cpp file for a description, and the real work of abstracting the SIMD instructions is done in varray.h.  The transcendental math work is done by a library in the vecmathlib directory.  The vecmathlib licensing allows relatively free use, and refer to the documentation in that file for how the library works.  My varray.h and vecmath.h headers do the adaptations to be able to use the vecmathlib relatively easily in my code.

I have posted this code example for easier reading without downloads/etc, but more strongly suggest trying out the binary executable in the file from the repository "simplecomp.zip."  This code example, doesn't really need much support.  For best quality, remember an LPF on the gain signal would help tremendously.

static constexpr int dBNCHANS = 2;
struct dBfilterVAL
{
float v[dBNCHANS];
};

class dBfilterSIMPLE
{
dBfilterVAL curval;

float atk, dcy;

public:
dBfilterSIMPLE(float atkA, float dcyA) :
curval(), atk(atkA), dcy(dcyA)
{
}

const dBfilterVAL&
next( dBfilterVAL in)
{

static const float deadzone = 0.0;
//        static const float deadzone = 1.0;
for (int i = 0; i < dBNCHANS; i++)
{
float ldiff = in.v[i] - curval.v[i];

{
curval.v[i] += ldiff * atk;
}
else if (ldiff < -1.0 * deadzone)
{
curval.v[i] += ldiff * dcy;
}
}

return curval;
}
};

class proccomp
{

dBfilterSIMPLE sfilt;

public:
proccomp(void) :
sfilt(20.0f / aspec.inSRATE, 20.0f / aspec.inSRATE)
{}

Asample
next(const Asample& src)
{

//
// Calculate the signal^2
//
float lvlL = src.item0() * src.item0();
float lvlR = src.item1() * src.item1();

//
// Hard threshold at sqrt(0.003) of full scale
// this threshold establishes the max gain
// the lower, the more maximum gain.
//
lvlL = Vmax(lvlL, 0.003f);
lvlR = Vmax(lvlR, 0.003f);
float dBlvlL = lin2dB(lvlL);
float dBlvlR = lin2dB(lvlR);
//
// Calculate instantaneous dB level
// using trivial dBfilterSIMPLE class and
// class IN/OUT value 'dBfilterVAL'
//

dBfilterVAL intmp, outtmp;

//
// dB version of SQRT of signal^2
//
dBlvlL *= 0.50f;
dBlvlR *= 0.50f;

//
// Add in pivot location (3.0 will work fine)
//
dBlvlL += 0.0f;
dBlvlR += 0.0f;
dBlvlL += ac.thresholdlval;
dBlvlR += ac.thresholdrval;
intmp.v[0] = dBlvlL;
intmp.v[1] = dBlvlR;

//
// Do the actual filter operation
//
outtmp = sfilt.next(intmp);

//
// Make sure that we choose the loudest channel.
// we don't want the channel gains to be different.
//
if (outtmp.v[0] > outtmp.v[1])
outtmp.v[1] = outtmp.v[0];

//
// Change the signal level into gain
// and multiply by compression ratio.
//
//static constexpr float cratio = 0.50f;
static constexpr float cratio = 0.10f;
float dBgain[dBNCHANS];
for (int i = 0; i < dBNCHANS; i++)
{
dBgain[i] = outtmp.v[i] * -1.0f;
dBgain[i] *= ac.cratio;
}

float LINgain[dBNCHANS];
for (int i = 0; i < dBNCHANS; i++)
{
LINgain[i] = dB2lin(dBgain[i]);
}

Asample rtval {src.item0() * LINgain[0], src.item1() * LINgain[1]};

//
// return gain controlled signal.
//
return rtval;
}
};


text:
Vector equilibrium problems and random matrix models

Sections

1. 5. Other

Cite this as: AimPL: Vector equilibrium problems and random matrix models, available at http://aimpl.org/vectorequilib.


text:
Ducted fan aircraft

Discussion in 'Aircraft Design / Aerodynamics / New Technology' started by jthunt, Mar 17, 2012.

Help Support HomeBuiltAirplanes Forum by donating:

Tags:
1. Oct 14, 2019

Doggzilla

Well-Known MemberHBA Supporter

Joined:
Jun 2, 2013
Messages:
1,969
414
Location:
Everywhere USA
“Us” refers to members who are grown adults and don’t try to turn everything into petty bickering. A group you are not a member of.

Testing different cruise settings is a normal part of testing and included in every Pilot Operating Handbook.

You would know that if you bothered to learn basic pilot skills instead of wasting your time making petty comments and trying to constantly start arguments in every thread.

2. Oct 15, 2019

Malish

Well-Known Member

Joined:
Oct 11, 2013
Messages:
474
778
Location:
Our airplane was NEVER designed to compete with C-172 or 182, it's a different "animal". Our aircraft "burn" 58 liters(15 gal)/hr at cruise settings of 4000rpm and 90 liters(23 gal)/hr at max(TO) power at 5000rpm. What can you expect from 400hp engine?

Vigilant1 likes this.
3. Oct 15, 2019

pictsidhe

Well-Known Member

Joined:
Jul 15, 2014
Messages:
6,989
1,931
Location:
North Carolina
There aren't any particularly good books on ducted fans.
The aerodynamics of propulsion, Kuchemann and Weber is a general treatment of jet propulsion that is probably the most useful for the duct.

4. Oct 15, 2019

Vigilant1

Joined:
Jan 24, 2011
Messages:
4,162
1,886
Location:
US
Your project is coming along very well (with a surprisingly small number of surprises!). You've been very up-front with the intent of the plane, with no unrealistic claims that a ducted fan will be more efficient than an open prop. Your plane is turning out to be what you promised--a great looking fun design that replicates many aspects of a tiny jet on a much smaller budget.

5. Oct 15, 2019

Malish

Well-Known Member

Joined:
Oct 11, 2013
Messages:
474
778
Location:
It is not realy - ducted fan design based on different theory and it's different from jet propulsion - there, in ducted fan main Principe of thrust, is MASS FLOW.

Last edited: Oct 15, 2019
6. Oct 15, 2019

Malish

Well-Known Member

Joined:
Oct 11, 2013
Messages:
474
778
Location:
At this power settings on engine(rpm's) this aircraft wouldn't fly very well. And for any reason we should use this power settings? If some one, who wants economy - let him buy C-172.

Last edited: Oct 15, 2019
delta and BJC like this.
7. Oct 15, 2019

pictsidhe

Well-Known Member

Joined:
Jul 15, 2014
Messages:
6,989
1,931
Location:
North Carolina

8. Oct 15, 2019

Doggzilla

Well-Known MemberHBA Supporter

Joined:
Jun 2, 2013
Messages:
1,969
414
Location:
Everywhere USA
Well, there is an important reason.

If you can match 150mph at 11gph it means your fans can work with most common 200hp engines without losing performance.

It opens a very large market for your fans.

If you were spending $550,000 for a new aircraft, would you buy a Cirrus or Cessna, or would you buy a ducted fan that performs just as well? Most people would choose a ducted fan. 9. Oct 16, 2019 nicknack nicknack Active Member Joined: Jul 27, 2008 Messages: 27 Likes Received: 8 Beautiful aircraft, looks great. Malish... do truly get 400hp @23gal/hr? That works out to a BSFC of 23*6/400=0.345lb/hp-hr. That’s an incredible number..and is equal to 41% efficiency on par or rivaling the best Diesel engines. Maybe actual hp is less? 10. Oct 16, 2019 Doggzilla Doggzilla Well-Known MemberHBA Supporter Joined: Jun 2, 2013 Messages: 1,969 Likes Received: 414 Location: Everywhere USA It’s a 388hp LS6. It’s likely not running at full load because it’s not pitched for maximum speed and hits max RPM without full power. I’m 110% sure of this. And also 110% sure its capable of higher performance. Last edited: Oct 16, 2019 11. Oct 16, 2019 BJC BJC Well-Known MemberHBA Supporter Joined: Oct 7, 2013 Messages: 9,749 Likes Received: 6,531 Location: 97FL, Florida, USA I’m 100% sure that there is no such thing as 110% sure. (I’ve told you a million times to stop exaggerating.) BJC cheapracer and Terrh like this. 12. Oct 16, 2019 henryk henryk Well-Known Member Joined: Mar 8, 2010 Messages: 4,734 Likes Received: 459 Location: krakow,poland =many answers... 13. Oct 16, 2019 Malish Malish Well-Known Member Joined: Oct 11, 2013 Messages: 474 Likes Received: 778 Location: Russia. City of Volgograd You're right, right now engine is NOT developing 400hp. At TO throttle position the engine have max 4750rpm(our goal to have 5000rpm at TO settings) because the fan blade design and we're working on it to change that. Right now the engine developing about 370hp at max rpm(4750) according to the table of our engine test run on the dyno. Last edited: Oct 16, 2019 14. Oct 16, 2019 henryk henryk Well-Known Member Joined: Mar 8, 2010 Messages: 4,734 Likes Received: 459 Location: krakow,poland 15. Oct 16, 2019 Malish Malish Well-Known Member Joined: Oct 11, 2013 Messages: 474 Likes Received: 778 Location: Russia. City of Volgograd 16. Oct 16, 2019 Malish Malish Well-Known Member Joined: Oct 11, 2013 Messages: 474 Likes Received: 778 Location: Russia. City of Volgograd Compere it with our PJ-II "Dreamer" take off even not developing full power yet. Is there a difference in TO performance? henryk likes this. 17. Oct 16, 2019 Malish Malish Well-Known Member Joined: Oct 11, 2013 Messages: 474 Likes Received: 778 Location: Russia. City of Volgograd No, our aircraft can't do that and there no reason even talk about. Ducted fan is NEVER will be matching the performance of open prop aircraft with same size(power) engines. And our aircraft not costing$550,000 and for someone who wants something better than Cessna, will buy it.

Last edited: Oct 16, 2019
delta, nicknack and Vigilant1 like this.
18. Oct 17, 2019

Malish

Well-Known Member

Joined:
Oct 11, 2013
Messages:
474
778
Location:
Ducted fan is not open prop - it's can't be pitched for maximum speed, like you do on propellers. Fan designed for max MASS FLOW(thrust) for power available from the engine. RPM's of the ducted fan stay the same - at static run or in the flight at any speed and this is proven on our airplane. When we push throttle for TO power before TO run - engine will rich max RPM's and they stay the same at ALL speed's, you can only reduce RPM's - to reduce power of the engine - retarding the throttle.
Today we did fly our airplane to check economy setting(that you asked for) to the engine - below 3500rpm airplane DON'T want to fly anymore without loosing altitude.

Last edited: Oct 17, 2019
19. Oct 17, 2019

Doggzilla

Well-Known MemberHBA Supporter

Joined:
Jun 2, 2013
Messages:
1,969
414
Location:
Everywhere USA
Very interesting data Malish! Thank you for testing!

You may have just solved an old mystery.

The fan settings you just tried are similar to the MAXIMUM fan disk loading used on most western ducted fans.

Ducted fans which performed extremely poorly.

I will have to build a test drone to investigate further.

20. Oct 17, 2019

Lendo

Well-Known Member

Joined:
Feb 7, 2013
Messages:
360
56
Location:
Brisbane
Malish, I like it!
Did you consider the Mazda Peripheral Ported Engine?
At 6,000 rpm is the engine is least stress with it 3:1 internal reduction the rotor itself is doing only 2,000 rpm, so at an even higher rpm say 7,000 it's still low stress. No inlet/ exhaust valves to restrict breathing, parts count are well down on a reciprocating engine. I know the Russians have used the Rotary Technology on many larger engines, but with the 2 rotor engine 200 + is very easy.
If weight was a consideration, consider replacing the Cast Iron 'End and Intermediate' housing with something lighter.
Just a suggestion!
George


text:
# GMAT & MBA Admissions Blog

If you haven't read GMAT Combinatorics 1.0, 1.1, and 1.2, you should do that before you read any further. Even if you're familiar with some of the material, you may not be familiar with my approach. Though the subtitle of this posts suggests that I'm going to discuss permutations and combinations, I'm never going to formally define either one - that's right no formulas. Just careful application of the fundamental counting principle with a couple of modifications.

### When Order Matters:

The types of combinatorics problems that you're going to encounter on the GMAT can be subdivided into three groups:

• Simple counting - A task with sub-tasks involving choices (see 1.0, 1.1, and 1.2)

• Permutations - Ordering or reordering a set or subset of things (we've already done some examples in 1.0, 1.1, and 1.2)

• Combinations - Selecting a subset of things from a larger set.

The first two are pretty much taken care of in earlier posts, though we will discuss permutations as a way to illustrate what a combination is. Permutations involve order or assignment and can be done with a simple application of the fundamental principle of counting. Combinations involved selecting a subset without regard to order, and require a simple modification of the fundamental principle of counting.

Here's are some typical applications of permutations and combinations.

Permutations:

• Selecting a president, vice president, and treasurer for a club or organization

• Casting a play

• Selecting a batting order for a baseball team

• Ranking applicants by GMAT score

• Arranging books on a shelf

Combinations:

• Selecting a subcommittee

• Picking a dodge ball team

• Selecting toppings for a pizza

• Selecting 50 MBA applicants for acceptance

• Poker Hands

So, how do we compensate for order. I'll illustrate with two examples

Example 1:

This example has two similar problems - one where order matters and one where it doesn't

(A) High School High's Spanish club is holding an election to select the President, Vice President, and Treasurer of their club. If the club has eight members, how many possible outcomes can the election have?

Solution: Here we are ordering 3 things from a set of 8 things. Each of these three things will be assigned to a particular office, so order matters and we can apply the fundamental counting principle:

$8 \times 7 \times 6 = 336$

(B) High School High's Latin club will elect a ruling triumvirate. If the Latin club has 11 members, how many possible outcomes can the election have?

Solution: Here we are selecting a subset of three people from a set of eleven people. None of the three people is assigned to a specific office, consequently many elections results are equivalent. Since there are three people in the triumvirate, each one can be listed in 6 ways - it's a simple application of the fundamental principle:

$3 \times 2 \times 1$

In order to compensate we need to divide by the number of ways the selection can be reordered:

[latex size="2"] \frac{11 \times 10 \times 9}{3 \times 2 \times 1} = 165[/latex]

A note on calculation - This might seem like a difficult computation, especially without access to a calculator, but you can save yourself a lot of work if you cancel bottom terms with top terms. The calculation I actually did looked like this:

[latex size="2"] \frac{11 \times 5 \times 3}{1} = 165[/latex]

To recap: You must divide by the number of ways your selection of elements can be rearranged when order doesn't matter.

Example 2:

Again, we'll do two similar problems - one where order matters and one where it doesn't

(A) High School High is putting on a production of Shakepeare's play Antony and Cleopatra. Four girls are auditioning for Octavia or Cleopatra. Six boys are auditioning for Octavius Ceasar, Mark Antony, or Lepidus. How many ways can these five parts be cast?

Solution: Here order matters. We're assigning two of the four girls to particular parts, and three of the six boys to particular parts. In, addition the selections are linked and the total number of castings will be the product of the castings for the boys and the castings for the girls. First we'll do the boys:

$4 \times 3 = 12$

Now the girls:

$6 \times 5\times 4 = 120$

Now the boys and the girls:

$120 \times 12 = 1440$

(B) At the strike party, the cast orders two pizzas. Due to terrible performances by Antony and Cleopatra, they only have enough money for three toppings for each pizza.  The available toppings are: italian sausage, pepperoni, ham, onion, green pepper, pineapple, mushrooms, ricotta, goat cheese, and parmesan cheese. How many different pairs of pizzas can be ordered?

Solution: Here order doesn't matter - pepperoni and mushrooms is the same as mushrooms and pepperoni. The three pizzas are linked like the castings for girls and boys above, so the total number will be the product of the ways of selecting each pizza. Each pizza can have one or two or three toppings. Because these three scenarios are mutually exclusive to total number of pizzas will be the sum of these three scenarios. Kinda complicated, so we'll take it one step at a time. One pizza - one topping plus two toppings plus three toppings:

[latex size="2"] 10 + \frac{10 \times 9}{2 \times 1} + \frac{10 \times 9 \times 8}{3 \times 2 \times 1} [/latex]

$10 + 45 + 120 = 175$

Since the second pizza will have the same number of variations, the total number of pizzas is

$175 \times 175 = 30,625$


text:
# Expand and factorise

3(n+r)(n+r-1) + (n+r)
to (n+r)(3n+3r-2)?

I forgot how to factorise, so can someone help me do this please?

CRGreathouse
Homework Helper
The n+r is already factored out. Just write everything in terms of that and you'll see.

(It's actually easier to understand by doing, in this case, than to have it explained!)

Mentallic
Homework Helper
Explain slowly you say? Maybe that can be expressed through example.

ab+ac=a(b+c)
xy+x=x(y+1)
pqr+r=r(pq+1)

If you understand how to do the opposite of factorising which is expanding, then these results would be easy to confirm.

So for 3(n+r)(n+r-1) + (n+r)
let n+r=x
So we now have 3x(x-1)+x
Factorising x out: x(3(x-1)+1)
Expand 3(x-1) and collect like terms, then substitute n+r=x back into the result.

Oh wow i get it now. Thank you!!