Skip to main content

Posts

Showing posts from November, 2020

grep cool new technique with special character

grep suck with some special characters like this "1-Piston Calipers;" grep -Fn => -F make input search pattern as fixed string. grep -Fn --text treat input file as text, so avoid binary matches result. Example result: 1-Piston Calipers; Oversized�Caliper... https://stackoverflow.com/questions/23512852/grep-binary-file-matches-how-to-get-normal-grep-output https://stackoverflow.com/questions/12387685/grep-for-special-characters-in-unix https://stackoverflow.com/questions/32564046/php-detect-the-character-encoding-of-the-file-system

MySQL Cross Table Update

 https://electrictoolbox.com/cross-table-update/ MySQL UPDATE cross table Cross Table Update with MySQL Using MySQL version 4.0 or higher you can update a table by joining two or more tables together; note that the examples shown in this article are not possible with MySQL 3.23 or earlier. By joining two tables together you can update one table based on fields in associated records in another table. Let's say for example you have a product table which stores information about products and a productPrice table which has pricing information and you want to update the prices based on when the product was created (in the examples below you want to discount all your older stuff to 80% of the current price). In MySQL you can do this in one of two ways. The first is do do a join using commas, like so: UPDATE product p, productPrice pp SET pp.price = pp.price * 0.8 WHERE p.productId = pp.productId AND p.dateCreated < '2004-01-01' The second way is to use inner join syntax as sho

Damn missing Bit Torrent

 https://webtorrent.io/intro < form > < label for = "torrentId" > Download from a magnet link: </ label > < input name = "torrentId" , placeholder = "magnet:" value = "magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent" > < button type = "submit" > Download </ button > </ form > https://www.theverge.com/2020/7/31/21348963/google-chrome-os-windows-apps-chromebooks-features-i

Cool information about MySQL Merge - What are the advantages and disadvantages of MERGE tables?

 http://www.mysqlab.net/knowledge/kb/detail/topic/merge/id/5123 MySQL知识库 :: merge What are the advantages and disadvantages of MERGE tables? Discussion MERGE tables can help you solve the following problems: Easily manage a set of log tables. For example, you can put data from different months into separate tables, compress some of them with myisampack, and then create a MERGE table to use them as one. Obtain more speed. You can split a big read-only table based on some criteria, and then put individual tables on different disks. A MERGE table on this could be much faster than using the big table. You can also use a RAID table to get the same kind of benefits. Do more efficient searches. If you know exactly what you are looking for, you can search in just one of the split tables for some queries and use a MERGE table for others. You can even have many different MERGE tables that use overlapping sets of tables. Do more efficient repairs. It's easier to repair the individual tables t

Working Effectively with Legacy Codes - notes

 Robert C. Martin Series This series is directed at software developers, team-leaders, business analysts, and managers who want to increase their skills and proficiency to the level of a Master Craftsman. The series contains books that guide software professionals in the principles, patterns, and practices of programming, software project management, requirements gathering, design, analysis, testing, and others. https://stackoverflow.com/questions/748503/how-do-you-introduce-unit-testing-into-a-large-legacy-c-c-codebase https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/december/generation-test-automated-unit-tests-for-legacy-code-with-pex https://www.weeklydevtips.com/episodes/015 https://dzone.com/articles/introduction-test-driven But using Test-Driven Development for legacy code is a little different from using TDD in a green-fields context. The general approach is identical: Write a test to reproduce the error (test bar red) Write code to fix the error (test bar green) and

Working with Legacy code - Lag Time

 Lag Time Changes often take a long time for another very common reason: lag time. Lag time is the amount of time that passes between a change that you make and the moment that you get real feedback about the change. At the time of this writing, the Mars rover Spirit is crawling across the surface of Mars taking pictures. It takes about seven minutes for signals to get from Earth to Mars. Luckily, Spirit has some onboard guidance software that helps it move around on its own. Imagine what it would be like to drive it manually from Earth. You operate the controls and find out 14 minutes later how far the rover moved. Then you decide what you want to do next, do it, and wait another 14 minutes to find out what happened. It seems ridiculously inefficient, right? Yet, when you think about it, that is exactly the way most of us work right now when we develop software. We make some changes, start a build, and then find out what happened later. Unfortunately, we don’t have software that knows