sql server 2008 r2 - Referencing a calculated column in the where clause SQL - Stack Overflow | https://stackoverflow.com/
There is no way to use a calculated column as a WHERE condition. Either repeat the expression, use a derived table, or whatever.
dba  sql  mysql  sortof  solution 
How to add levenshtein function in mysql? - Stack Overflow | https://stackoverflow.com/
NB: ENDIF / ENDWHILE needs to be "END IF" / "END WHILE" in MySQL 5.x.

<code class="language-sql">DELIMITER $$

CREATE FUNCTION levenshtein( s1 varchar(255), s2 varchar(255) ) returns int deterministic
DECLARE s1_len,
cost int;
declare s1_char char;
-- max strlen=255
declare cv0,
cv1 varbinary(256);
set s1_len = char_length(s1),
s2_len = char_length(s2),
cv1 = 0x00,
j = 1,
i = 1,
c = 0;
if s1 = s2 THEN
elseif s1_len = 0 THEN
RETURN s2_len;
elseif s2_len = 0 THEN
RETURN s1_len;
WHILE j <= s2_len do
SET cv1 = concat(cv1, unhex(hex(j))),
j = j + 1;
endWHILE;WHILE i <= s1_len do
SET s1_char = substring(s1, i, 1),
c = i,
cv0 = unhex(hex(i)),
j = 1;WHILE j <= s2_len do
SET c = c + 1;IF s1_char = Substring(s2, j, 1) then
SET cost = 0;
SET cost = 1;ENDIF;SET c_temp = conv(hex(substring(cv1, j, 1)), 16, 10) + cost;IF c > c_temp then
SET c = c_temp;ENDIF;SET c_temp = conv(hex(substring(cv1, j+1, 1)), 16, 10) + 1;IF c > c_temp then
SET c = c_temp;ENDIF;SET cv0 = concat(cv0, unhex(hex(c))),
j = j + 1;ENDWHILE;SET cv1 = cv0,

DELIMITER ;</code>
dba  mysql  database  stringmatching  editdistance  sql  solution 
The GITS Blog » Using custom functions with SQLAlchemy and SQLite | http://ginstrom.com/
I think this is too old to work with current (1.2.x) versions of SQLAlchemy. I don't see any documentation for connection.create_function.
sqlalchemy  customfunction  dba  database  maybesolution 
permissions - MySQL error 1449: The user specified as a definer does not exist - Stack Overflow | https://stackoverflow.com/
In my case, the mysql.proc table had definers from some other database, probably because I'd imported a SQL dump where I'd accidentally included stored procedures in addition to just the *one* table I wanted.

This fixes that.
How to change the definer for views

Run this SQL to generate the necessary ALTER statements

<code class="language-sql">SELECT CONCAT("ALTER DEFINER=`youruser`@`host` VIEW ",
table_name, " AS ", view_definition, ";")
FROM information_schema.views
WHERE table_schema='your-database-name';</code>
sql  mysql  dba  storedprocedures  errormessage  solution 
2 days ago
security - Active directory list of users and "member of" from trusted domain - Server Fault | https://serverfault.com/
Your Dsquery syntax is missing the domain root LDAP path. It should look like:
<code class="language-batch">dsquery group "DC=contoso,DC=com" -name "group name" | dsget group -members -expand > C:\Users.txt</code>
ad  ldap  windows  sysadmin  dsquery  commandline  maybesolution 
6 days ago
1848 Daguerreotypes Bring Middle America’s Past to Life | WIRED | https://www.wired.com/
Fontayne and Porter were definitely skilled, but no one knew just how amazing their images were until three years ago, when conservators at George Eastman House in Rochester, New York, began restoration work on the deteriorating plates. Magnifying glasses didn’t exhaust their detail; neither did an ultrasharp macro lens. Finally, the conservators deployed a stereo microscope. What they saw astonished them: The details — down to window curtains and wheel spokes — remained crisp even at 30X magnification. The panorama could be blown up to 170 by 20 feet without losing clarity; a digicam would have to record 140,000 megapixels per shot to match that. Under the microscope, the plates revealed a vanished world, the earliest known record of an urbanizing America.
photography  daguerreotype  cincinnati  history 
6 days ago
python - Dealing with duplicate primary keys on insert in SQLAlchemy (declarative style) - Stack Overflow
You should handle every IntegrityError the same way: roll back the transaction, and optionally try again. Some databases won't even let you do anything more than that after an IntegrityError. You could also acquire a lock on the table, or a finer-grained lock if the database allows it, at the beginning of the two conflicting transactions.

Using the with statement to explicitly begin a transaction, and automatically commit (or rollback on any exception):
<code class="language-python">from schema import Session
from schema.models import Bike

session = Session()
with session.begin():
pk = 123 # primary key
bike = session.query(Bike).filter_by(bike_id=pk).first()
if not bike: # no bike in DB
new_bike = Bike(pk, "shiny", "bike")
sql  sqlalchemy  mysql  dba 
7 days ago
Securely erase free space from Terminal | Macworld | https://www.macworld.com/
There’s just one last bit of information you need to know to erase the free space on a drive from the command line. In Unix, all devices appear as part of the file system tree, and in OS X, they’re all listed in the /dev directory. So if I wanted to use diskutil to erase the free space on my mwfiles volume, using the single-pass method, the final command would look like this:

<code class="language-bash">diskutil secureErase freespace 1 /dev/disk3s4</code>
mac  osx  security  diskwipe  commandline  solution 
8 days ago
python - how to load virtualenv using environmental module file (tcl script)? - Stack Overflow | https://stackoverflow.com/
I don't think the semicolon is "essential" as the poster notes. You can also 'source /path/to/script.sh' and the changes to the environment seem to be preserved.

<code class="language-tcl">if { [ module-info mode load ] } {
puts stdout "/programs/program-env/bin/activate;"
} elseif { [ module-info mode remove ] } {
puts stdout "deactivate;"
environmentmodules  modules  modulefile  tcl  solution  sysadmin 
9 days ago
Cipher | Microsoft Docs | https://docs.microsoft.com/
Displays or alters the encryption of folders and files on NTFS volumes. Used without parameters, cipher displays the encryption state of the current folder and any files it contains.

Via: http://www.thewindowsclub.com/cipher-command-line-tool-windows
windows  secureerase  ntfs  filesystem  security  utility  commandline  reference  sysadmin 
9 days ago
We can't sign in to your account | https://support.microsoft.com/
The solution in my case was to delete a registry setting under \HKLM\CurrentVersion\Software\Microsoft\Windows\NT\UserProfiles (I think).
windows  win10  errormessage  userprofile 
9 days ago
Siri Is Apple's Broken Promise | https://gizmodo.com/
In exchange for surrendering control and submitting to that heftier price tag, I expect Apple products to simply work. That's all. If you use Apple products, I suspect you made a similar bargain.
siri  apple  ai  brokenpromises 
9 days ago
hashing - Is there a built-in checksum utility on Windows 7? - Super User
CertUtil is a pre-installed Windows utility that can be used to generate hash checksums:

<code>certUtil -hashfile pathToFileToCheck [HashAlgorithm]
HashAlgorithm choices: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512</code>

So for example, the following generates an MD5 checksum for the file C:\TEMP\MyDataFile.img:

<code>CertUtil -hashfile C:\TEMP\MyDataFile.img MD5</code>

To get output similar to *Nix systems you can add some PowerShell magic:

<code style="language-powershell">$(CertUtil -hashfile C:\TEMP\MyDataFile.img MD5)[1] -replace " ",""</code>
windows  hashing  checksum  hash  md5  sha1  commandline  utility  software  solution 
13 days ago
python - PyInstaller cannot find libpython2.7.so when making binary? - Stack Overflow | https://stackoverflow.com/
As @abarnert already said, the problem seems to be a static compilation of python. To solve this issue is needed to recompile python but adding the flag --enable-shared this time:
<code class="language-bash">
[root@machine ~]# ./configure --prefix=/usr/local --enable-shared
[root@machine ~]# make && make altinstall

May want to also do LDFLAGS="-Wl,-rpath /path/to/your/new/python/lib"
python  fromsource  errormessage  solution 
14 days ago
configure - How to ignore local python when building python from source - Stack Overflow | https://stackoverflow.com/
This looks to be a misfeature of the setup.py script always including /usr/local in the search path when make builds the target sharedmods.

You'll have to manually frob the setup.py, so do the...
<code class="language-python">./configure --enable-shared --prefix=/app/vendor/python-dev</code>

...first, then edit setup.py, find lines 442, 443, and 444 which should look like this...
<code class="language-python">
if not cross_compiling:
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')</code>

...and comment those out
python  fromsource  solution  sharedlibrary  linker  errormessage 
14 days ago
Python Click command doesn't recognize options - Stack Overflow | https://stackoverflow.com/

The issue is that click.Option() expects the first argument to a list and is not like the decorator version @click.option().

<code class="language-python">params=[click.Option(['--force'], default=False)]</code>

Wrapping the command option in a list solved the problem.
python  click  errormessage  solution 
14 days ago
MySQL Bugs: #5159: Views: Comments are not preserved | https://bugs.mysql.com/
This feature request is 18 years old now. People still express interest about this and other related feature requests. You may not consider it vital, but please don't understimate what Bruno Aquino Filardi Filho wrote: self documenting database is really important.
mysql  sql  views  documentation  comments  featurerequest  bug  watchthisspace 
14 days ago
« earlier      
acf addon addressbook advice alternativeto android animation annoyance apache api app apple applescript art article audio authentication automation backupandrecovery bash bestpractices bioinformatics blog browser bug by:20gnd c calendar centos chrome cli cloudstorage collaboration comic commandline compiler configfile console cplusplus crossplatform cs css culture dammitbrain database dba debian debugging design devel disasterrecovery documentation driver dropbox ebook eclipse editor education email employment encryption errormessage essential extension eyecandy favorite filemanagement filesystem film firefox flask framework freeware from:twitter funny git github gmail gnome google graphics gui hacking hardware history hosting howto html html5 humor icons ide imageprocessing inspiration installation interesting ios iphone java javascript jquery keyboard language latex ldap learning library linux list lists mac markdown math matlab maybesolution mediawiki mobile movein mozilla music mysql mystuff needshelp networking newbie news nonfree opensource osx packagemanagement pdf perl photography php plugin politics printing privacy productivity programming projectstowatch python rails reference research ruby samplecode science scm script scripting searchandindex searchengine security service shell shellscripting socialmedia software solution ssh storage syntaxhighlighting sysadmin systemmonitoring terminal testing textprocessing thefuture theme thewaythingswere thunderbird tipsandtricks todo toolchain troubleshooting tutorial twitter ubuntu ui unix utility versioncontrol via:ifttt video vim visualization watchthisspace web webapp webapps webdesign webdevel webmaster wiki win7 windows wishlist wordpress work writing x11

Copy this bookmark: