Should I say that searching google for something you don't know what is it, going only with syntax is hard? Coming from C# world construct "=>" is lamda, in ReactJS world is "arrow function", doh. Yeah, make sense of course, more than lamda...
Bits in rain
Welcome...
...All those moments will be lost in time, like tears in rain....- soliloquy from Blade Runner
Bits and bytes do get lost, awash in the rain of data flow that is Internet. They slip away from us, never to found again... some of them will be captured here, many more will not... like tears in rain... |
Friday, December 21, 2018
Monday, October 29, 2018
Ruby: blank vs empty vs any vs nil vs...
Sometimes having too many good things is not really good for you. So many ways to test for existence of the object or array that it's confusing.
Here is a short version:
- nil?
Works on any object and checks is it nil or not.
It returns true only for nil value.
- empty?
It does work on strings, hashes and arrays, and enumerators in general.
It returns true if there are not elements in the array.
It does not handle nil values, you have to check is object is nil and is object is empty.
a.nil? && a.empty?
- blank?
It is Rails construct, not part of Ruby.
It is a shortcut for false, empty of whitespace string.
- present?
Opposite of blank, part of Rails framework.
- any?
It works on arrays, hashes and sets.
It checks is there is anything in the collection that can evaluate to true?
It returns true if array has no elements except when it has nil values only.
Here is a short version:
- nil?
Works on any object and checks is it nil or not.
It returns true only for nil value.
- empty?
It does work on strings, hashes and arrays, and enumerators in general.
It returns true if there are not elements in the array.
It does not handle nil values, you have to check is object is nil and is object is empty.
a.nil? && a.empty?
- blank?
It is Rails construct, not part of Ruby.
It is a shortcut for false, empty of whitespace string.
- present?
Opposite of blank, part of Rails framework.
- any?
It works on arrays, hashes and sets.
It checks is there is anything in the collection that can evaluate to true?
It returns true if array has no elements except when it has nil values only.
Thursday, October 18, 2018
After a long time....
It's been very busy year. I've changed the stack and now I am working in Ruby/Rails/ReactJS world.
To say that things are different is understatement! From working on Mac to using whole new ecosystem of tools and acronyms to feeling of being a noob ... It's not being easy!
However, light is starting to shine from the end of the tunnel and I do feel better, enough to start thinking about my blog again. There is evens that I can start sharing again, so let's go back to having fun while learning again!
To say that things are different is understatement! From working on Mac to using whole new ecosystem of tools and acronyms to feeling of being a noob ... It's not being easy!
However, light is starting to shine from the end of the tunnel and I do feel better, enough to start thinking about my blog again. There is evens that I can start sharing again, so let's go back to having fun while learning again!
Thursday, March 16, 2017
Orphaned sql users
If you restore database,there are scenarios when our user gets orphaned.
USE myDb
EXEC sp_change_users_login 'Report'
If you do have orphaned users, you can restore them if they exist but they are not linked to actual logins.
EXEC sp_change_users_login 'Auto_Fix', 'user'
USE myDb
EXEC sp_change_users_login 'Report'
If you do have orphaned users, you can restore them if they exist but they are not linked to actual logins.
EXEC sp_change_users_login 'Auto_Fix', 'user'
Tuesday, January 17, 2017
How to share local disc when RDP
Most of the time, copy-paste works seamlessly, until data amount or file is too big to copy. In that case, sharing local disk is perfect solution,
Wrinkle I encountered was that I had .RDP shortcuts already defined (from Azure) and bringing up properties didn't show me actual remote connection properties. But right click and Edit option did bring options for rdp and allowed me to add local disk to the connection.
Connection is not permanent - if you stay connected to the machine for a long time, disk can disappear after a while, and should be defined again.
- Click Start, point to All Programs (or Programs), point to Accessories, point to Communications, and then click Remote Desktop Connection.
- Click Options, and then click the Local Resources tab.
- Define your disk as local disk for the connection.
- Connect - it will be available in File Explorer as local disk.
Wrinkle I encountered was that I had .RDP shortcuts already defined (from Azure) and bringing up properties didn't show me actual remote connection properties. But right click and Edit option did bring options for rdp and allowed me to add local disk to the connection.
Connection is not permanent - if you stay connected to the machine for a long time, disk can disappear after a while, and should be defined again.
Windows 8 and .NET Framework 3.5
I had an interesting problem - brand new Windows 8.1 with .NET framework 4.5 installed was not able to connect o windows update to download Framework 3.5. Reason for old framework - SQL Server 2014 requires it.
After lots of googling, and experimenting, I've finally found option to do silent install, meant for situations where you don't have internet connection, and that worked:
After lots of googling, and experimenting, I've finally found option to do silent install, meant for situations where you don't have internet connection, and that worked:
LimitAccess switch is the key to signal Windows to use local dvd (or local ISO in my case) and not connect to internet for that.
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:d:\sources\sxs
Wednesday, March 23, 2016
Notepad++ and xml
Notepad++ is a veritable well of usefulness. Everyday I am finding new nice features.
Today, it's ability to collapse all nodes in xml document via keyboard shortcut.
To collapse all nodes:
ALT-0
To expand all nodes:
ALT-SHIFT-0
To expand certain level only:
ALT-SHIFT-2 (for level 2)
To collapse on certain level only:
ALT-1
Of course, you do need to install XML plugin to manipulate XML documents, then you can format it and validate and do all kinds of useful things with it.
Today, it's ability to collapse all nodes in xml document via keyboard shortcut.
To collapse all nodes:
ALT-0
To expand all nodes:
ALT-SHIFT-0
To expand certain level only:
ALT-SHIFT-2 (for level 2)
To collapse on certain level only:
ALT-1
Of course, you do need to install XML plugin to manipulate XML documents, then you can format it and validate and do all kinds of useful things with it.
Subscribe to:
Posts (Atom)