This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

Today, you have to find a path through a maze. To know if a coordinate is a wall or an open space, you will have to do a calculation like this :

0 0
0 294

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

In today's challenge, you have to execute instructions that control how bots are handling microchips.

The input contain instructions that can be something like this :

2 1
0 338

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

Today's challenge is about decompressing input that is compressed in an experimental format.
In the format, markers indicate how much time a number of characters need to be repeated.

For example :

2 3
0 564

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : goto to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The input in today's challenge consists of an encrypted name, a dash, a sectorID, a dash and a checksum between brackets.
A name is real if the checksum is equal to the five most common letters in the encypted name.

3 1
0 418

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : goto to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The challenge of day 5 is to calculate a password of 8 characters by finding the MD5 hash of the input and an increasing integer index.
The password is constructed by taking the 6th character of the first 8 hashes that start with 5 zeroes (in hex representation).

2 1
0 388

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The challenge of today has nothing to do with real two-factor authentication ! (sorry if you came to this article by searching the real thing)

1 1
0 251

Advent of Code is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : look at article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

In this challenge, you need to find a password using instructions to move on a keypad.
Instructions can be U(p), D(own), L(eft) and R(ight).

You start at button 5 on a keypad like

3 0
0 331

Advent of Code is a series of 25 small programming challenges, it's an ideal way for beginners to start learning a computer language, and for advanced people to sharpen their programming skills.

There are small and bigger puzzles, which you can solve typically in half an hour to a few hours. (Looking at the leaderboard, the top aces can do them in less than 10 minutes.)

Advent of Code is created by Eric Wastl, you can find all info on https://adventofcode.com/.

7 0
1 1.3K
Article
· Mar 28, 2017 2m read
Map, Reduce and Filter Collections

Inspired by the article "Declarative development in Caché" that's still trending on the dev com. The OP explored a functional style of iterating over a collection. A comment today suggested "Caché would need syntax support for anonymous functions".

With Macros you can kind of get anonymous like syntax using dot notation.

This is not production code, but it does work. First the macros...

2 15
0 664

A feature I recently used in working on ISC internal applications is the ability to send emails on behalf of someone. This is useful when generating system notifications from an application when you want some of them to show up as being from a specific person, perhaps posting comments on a work ticket.

In my case I was updating our facilities work order system for tracking requests. Normally all notification emails are sent from the same noreply email address. I wanted to change that so comments added from the original requester would show up as being from them and stand out.

7 2
0 965
Article
· Mar 2, 2017 1m read
Trusting the code you import

As more people join Developer Community, and with increasing efforts to promote code sharing, I'd like to draw fresh attention to this post I wrote a year ago. It spotlights a feature within the class compiler which is both useful and dangerous. When importing code (e.g. from an XML export of classes received from someone), it's worth considering the risks.

Even if that post doesn't seem relevant to you at the moment you may wish to note it for the future. A handy way of doing this is to click the star icon at the end of it.

2 1
0 275
This is the second part of my long post about package managers in operating systems and language distributions. Now, hopefully, we have managed to convince you that convenient package manager and rich 3rd party code repository is one key factor in establishing of a vibrant and fast growing ecosystem. (Another possible reason for ecosystem success is the consistent language design, but it will be topic for another day.)
6 23
1 1.3K

Points to remember before you start:

  1. It is not possible in a COS (Caché Object Script) job/process context to have multiple Named Pipes. It is a one Named Pipe per job/process limited line of communication.
  1. Named Pipes, in Caché, like most pipes on most operating systems are Unidirectional. That means you open them for either Read or Write, but not both.
3 0
0 665

Many mobile applications that enable users to get information about road fines and pay them, send notifications about newly added fines. This functionality can be efficiently implemented using push notifications sent to users’ devices.

Our application was not an exception. The server side is based on the Ensemble platform that offers integrated support of push notifications starting from version 2015.1.

1 0
0 551
Article
· Feb 17, 2016 3m read
Listing files in folder

Question:

How do I get a list of files residing in a certain folder/directory, according to some wildcard/filter.

For example all '*.txt' files in 'C:\Temp'.

Answer:

In CACHE –

You can use the %Library.File's FileSet class query.

Here's some sample code using it (also attached):

6 2
0 3.7K

Here you have an easy way to write and execute COS code from your unix scripts. This way one does not need to write routines or even open Studio or Atelier. It can be an option for simple and small actions for instance things like installation tasks or compiling.

See sample bash script (compile.sh) to compile classes:

6 2
0 857

Checking if Directory or File Exists:

Outlined below is an example of how to check if a directory exists:

Set directoryName="c:\temp\nosuchdir"

/* Check for existence of a directory - Return Value:  0 - directory does not exist;  1 - directory does exist  */

Set directoryExists=##class(%File).DirectoryExists(directoryName)

If ('directoryExists)  // do the processing for when a directory does not exist


Outlined below is an example of how to check if a file exists:

3 1
0 2.8K