krypted.com

Tiny Deathstars of Foulness

In SQL, the DROP Statement is used to remove databases, tables, and indexes. The syntax to remove a table is:

DROP TABLE nameoftable

Wow. That’s really, really easy. I mean, you can delete craploads of data that way! It can’t be! You can also delete a database. To do so, use the DROP statement again, but this time, instead of dropping a table, let’s remove the database:

DROP DATABASE nameofdatabase

Aaaaaand, you can drop an index, which on MySQL is done using an ALTER statement, followed by TABLE, then the table name that has an index needing to drop:

ALTER TABLE nameoftable DROP INDEX nameofindex

You can also delete the data inside the table, rather than the table. This leaves the schema in tact so that you can start writing data to the database again:

TRUNCATE TABLE nameoftable

And viola, you’re deleting data like a fool!

exploits_of_a_mom

February 11th, 2016

Posted In: SQL

Tags: , , , , , , , , ,

Leave a Comment

Sometimes you’re looking for IDs, prices, zip codes and the like in a range. You can use the BETWEEN operator to select integers, text, or dates within a range of items. The syntax when using the BETWEEN operator would look similar to the following:

<code>SELECT column(s)
FROM table
WHERE column_name BETWEEN value AND value;</code>

In this article, we’ll use the same “Customers” table from our first articles:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

The following SQL statement selects all Sites with an ID BETWEEN 2 and 4:

<code>SELECT * FROM Customers
WHERE ID BETWEEN 2 AND 4;</code>

Or look for the ones that are not between those:

<code>SELECT * FROM Customers
WHERE ID NOT BETWEEN 2 AND 4;</code>

One of the best aspects of BETWEEN is the ability to specify multiples. So you can look for ID between 2 and 4 and not  3 and 4:

<code>SELECT * FROM Customers
WHERE (ID BETWEEN 2 AND 4)
AND NOT ID IN (3,4);</code>

The following SQL statement selects all Sites with a Site beginning with any of the letter BETWEEN ‘M’ and ‘Z’:

<code>SELECT * FROM Customers
WHERE Site BETWEEN ‘M’ AND ‘Z’;</code>

Or the same, using NOT BETWEEN ‘A’ and ‘L’:

<code>SELECT * FROM Customers
WHERE Site NOT BETWEEN ‘A’ AND ‘L’;</code>

If there was a Date field, the following statement would select all Sites with a Date BETWEEN ’01-01-2010′ and ’01-01-2016′:

<Code>SELECT * FROM Customers
WHERE Date BETWEEN #01/01/2010# AND #01/01/2016#;</code>

At this point, we have lots of logic we can use to further find data in large databases. We’ll also need to eventually get to joining tables, so we can take use of multiple pieces of data.

February 10th, 2016

Posted In: SQL

Tags: , , , , ,

Leave a Comment

One of the most important aspects of searching for objects is to be able to define multiple values in a search. We looked at searching using text globbing. But the IN operator goes a step and allows you to search
The IN operator allows you to specify multiple values in a WHERE clause.

SELECT column
FROM table
WHERE column IN (value,value,...);

In this article, we’ll use the same “Customers” table from our first articles:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

The following outputs all customers with a Site of “Krypted” or “JAMF”:

SELECT * FROM Customers
WHERE Site IN ('Krypted','JAMF');

When looking to use the IN operator, note that strings are quoted and separated by commas (,) inside parenthesis.

February 9th, 2016

Posted In: SQL

Tags: , , , , ,

Leave a Comment

As promised, here’s the presentation I gave this morning at the MacAD UK Conference in London. It is incredibly well put together and all the presentations thus far have just been fantastic. Congrats to the entire team at Amsys and the speakers for such a great show!

MacADUK 2016 Presentation

February 9th, 2016

Posted In: public speaking

Tags: , , , ,

Leave a Comment

Previously we looked at using wildcards in conjunction with the SQL LIKE operator. Wildcards allow you to search for data in a defined table. Think of them as text globbing for SQL. The wildcards available include the following:

  1. [list]: Define a ranges of characters for pattern matching
  2. [!charlist]: Matches only a character NOT specified within the brackets
  3. %: Require a single character/object in a pattern
  4. _: Allow any single character in a pattern

In this article, we’ll use the same “Customers” table from our first articles:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55410 US

The following SQL statement selects all customers with a City starting with “Minne”:

SELECT * FROM Customers
WHERE City LIKE 'Minne%';

The above SELECT would not locate an object that was just called Minne because the % indicates that something must be there. We could also look for something with nn but with something before and after the pattern:

SELECT * FROM Customers
WHERE City LIKE '%nn%';

Or to look for something that would contain Minneapoli:

SELECT * FROM Customers
WHERE City LIKE 'Minneapoli_';

Not that the _ is looking for a single character and that the % is looking for any string in that space. We could also look for a set of objects or omit a set of objects using brackets to define multiple items or a range. For example, let’s say we wanted to look for zip codes 55418 and 55410

SELECT * FROM Customers
WHERE Zip LIKE '[55418 55410]%';

Or 55410 through 55419, use a dash to separate the two (in ascending order):

SELECT * FROM Customers
WHERE Zip LIKE '[55410-55418]%';

Or the ones that don’t match that pattern:

SELECT * FROM Customers
WHERE Zip LIKE '[!55410-55418]%';

Overall, the globbing/pattern matching options are very basic (think DOS-like syntax) unless you use more complicated functions. But, it’s amazing what kind of stuff you can string together with simple commands, joins, and other tricks, without having to get into functions.

February 8th, 2016

Posted In: SQL

Tags: , , , , , , , ,

Leave a Comment

When I plug my iPad in, Photos opens. I want it to stop opening when I plug it in. To make it stop, write a disableHotPlug key into com.apple.ImageCapture as true:

defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true

To enable Photos opening when you plug in a device again, just delete the disableHotPlug key:

defaults -currentHost delete com.apple.ImageCapture disableHotPlug

February 7th, 2016

Posted In: iPhone, Mac OS X, Mac OS X Server, Mac Security

Tags: , , ,

Leave a Comment

Sometimes you have data in a MySQL database that you just don’t need. You can delete tables and records pretty easily. In fact, it’s almost too easy. And there’s no undo. So be careful. And backup. And then backup again. And then snapshot again, before tinkerating with anything in this article.

In this article we’ll look at using the SQL DELETE statement to delete rows in a table. To do so, we’ll follow this basic syntax, which includes a WHERE clause to narrow the scope of the DELETE by specifying which records will be removed:

DELETE FROM table
WHERE column=value;

In this article, we’ll use the same “Customers” table from our first articles:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

Let’s not run this next command, but note that you can omit the WHERE statement to remove all data from a database. To do so, you would simply delete all rows in a table without deleting the table itself. I do this a lot with test databases. It leaves the schema/table structure, attributes, and indexes will be intact:

When I’m doing this, I usually specify the wildcard (*):

DELETE * FROM table;

In the following, we’re going to go ahead and remove the Microsoft record. To do so, we’ll run the DELETE and specify the table to delete data from. Then, we’ll use the WHERE to specify that we want to remove the record where the Site is Microsoft AND the Contact is Satya Nadella:

DELETE FROM Customers
WHERE Site='Microsoft' AND Contact='Satya Nadella';

The “Customers” table then looks like this:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

February 6th, 2016

Posted In: Mac OS X, SQL

Tags: , , , , ,

Leave a Comment

There are a lot of payloads that MDM and profiles can manage in iOS. Restrictions are probably the one I get the most questions about. And most are pretty self-explanatory. Sooooo, rather than open Profile Manager every time I need to see the list, here it is:

  • Allow use of Camera
  • Allow FaceTime
  • Allow screenshots and screen recording
  • Allow AirDrop (supervised only)
  • Allow iMessage (supervised only)
  • Allow voice dialing while device is locked
  • Allow Siri
  • Allow Siri while device is locked
  • Enable Siri profanity filter (supervised only)
  • Allow user-generated content in Siri (supervised only)
  • Allow iBooks Store (supervised only)
  • Allow installing apps using Apple Configurator and iTunes
  • Allow installing apps using App Store (supervised only)
  • Allow automatic app downloads (supervised only)
  • Allow removing apps (supervised only)
  • Allow in-app purchase
  • Require iTunes Store password for all purchases
  • Allow iCloud backup
  • Allow iCloud documents & data
  • Allow iCloud Keychain
  • Allow managed apps to store data in iCloud
  • Allow backup of enterprise books
  • Allow notes and highlights sync for enterprise books
  • Allow iCloud Photo Sharing
  • Allow My Photo Stream (disallowing can cause data loss)
  • Allow automatic sync while roaming
  • Force encrypted backups
  • Force limited ad tracking
  • Allow Erase All Content and Settings (supervised only)
  • Allow users to accept untrusted TLS certificates
  • Allow automatic updates to certificate trust settings
  • Allow trusting new enterprise app authors
  • Allow installing configuration profiles (supervised only)
  • Allow modifying account settings (supervised only)
  • Allow modifying device name (supervised only)
  • Allow modifying Find My Friends settings (supervised only)
  • Allow modifying passcode (supervised only)
  • Allow modifying Touch ID fingerprints (supervised only)
  • Allow modifying restrictions (supervised only)
  • Allow modifying Wallpaper (supervised only)
  • Allow pairing with non-Configurator hosts (supervised only)
  • Allow documents from managed sources in unmanaged destinations
  • Allow documents from unmanaged sources in managed destinations
  • Treat AirDrop as unmanaged destination
  • Allow Handoff
  • Allow Spotlight Suggestions
  • Allow Touch ID to unlock device
  • Force Apple Watch wrist detection
  • Allow pairing with Apple Watch (supervised only)
  • Require passcode on first AirPlay pairing
  • Allow predictive keyboard (supervised only)
  • Allow keyboard shortcuts
  • Allow auto correction (supervised only)
  • Allow spell check (supervised only)
  • Allow Define (supervised only)
  • Allow Wallet notifications in Lock screen
  • Show Control Center in Lock screen
  • Show Today view in Lock screen

February 5th, 2016

Posted In: iPhone

Tags: , , , , ,

Leave a Comment

The title of this one ended up a bit more FUDy than I’d prefer, but the content’s mostly what I provided.

With the rise of SMB-friendly backup solutions like CrashPlan, Carbonite, Mozy, and Backblaze, small businesses will choose to back up their systems with alternatives to expensive tape libraries, software to drive those libraries, and countless hours spent restoring files. As more cloud-based security attacks happen, businesses will realize that having a solid backup is one of the most important aspects to device security.

Read more: http://www.virtual-strategy.com/2016/02/03/executive-viewpoint-2016-prediction-bushel-major-security-breaches-will-change-how-small-?page=0,1#ixzz3zGet80fK

Oh, and in case anyone (Mosen/Dials) is bothered by the fact that I’m reblogging articles I do above and beyond what I do on Krypted, it’s my way of keeping track of all my other writings. And no, while I do write for Huff Post now, I don’t smoke weed (like ever). But thanks for your perspectives, I’ll try and up my game since you feel my contributions to the community were not enough while I was writing three books on Mac management (two are now shipping, the third will be shortly)… 😉

Oh, and I was serious about doing a long-term podcast. Now that my after-hours schedule is freeing up, I’m game to get on that! <3

February 5th, 2016

Posted In: Articles and Books, Bushel

Tags: , , , ,

Leave a Comment

Previously we looked at finding data in a SQL database and The UPDATE statement is used to update records in a table. You can also use the UPDATE statement to update existing records in a table. When using the SQL UPDATE statement, we’ll also use the WHERE clause, as we used previously to constrain output of a SELECT statement. The WHERE locates the record(s) to be updated with syntax as follows:

UPDATE table
SET column=value,column=value,...
WHERE column=value;

The WHERE clause indicates the record(s) to update. I’ve forgotten to put it in in the past and updated every record of a database. That’s bad (unless you mean to do it). So let’s run a SELECT on our sample database from earlier, so we can see the “Customers” table from our first article:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

Now, let’s update the Address of the Apple record. To update the Address “spaceship” with the contents of “1 Infinite Loop” we’ll UPDATE the Customers table and SET the Address to equal

UPDATE Customers
SET Address='1 Infinite Loop'
WHERE Site='Apple';

The selection from the “Customers” table will now look like this:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook 1 Infinite Loop Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

You can also update multiple records by separating each item with a comma. For example, let’s say we wanted to update the Microsoft record to get the address correct:

UPDATE Customers
SET Address='One Microsoft Way',Zip="98052-7329"
WHERE Site='Microsoft';

Note that in the above example, I quoted Zip as I didn’t use an actual integer.

The selection from the “Customers” table will now look like this:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook 1 Infinite Loop Cupertino 95014 US
3 Microsoft Satya Nadella One Microsoft Way Redmond 98052-7329 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

February 4th, 2016

Posted In: SQL

Tags: , , , , ,

Leave a Comment

Next Page »