The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,262 other subscribers

Archive for December 4th, 2017

Delphi tip of the day: {$WARN UNSUPPORTED_CONSTRUCT ERROR} to get rid of W1025 when using an undeclared attribute

Posted by jpluimers on 2017/12/04

Delphi tip of the day:

{$WARN UNSUPPORTED_CONSTRUCT ERROR}

It will throw a compiler error when you use an attribute that isn’t defined as the above [WayBackturns a warning into an error as normally [WayBackUNSUPPORTED_CONSTRUCT is only a warning.

Which means that this code now fails:

type
  TmyClass = class
    [djhgfskdhgks]
    procedure One;
  end;

Thanks [WayBack] +Agustin Ortu for posting this tip!

I wish I had known this when I found the G+ post leading to On turning “W1025 Unsupported language feature: ‘customattribute’” into a compiler error.

–jeroen

via:

related:

Posted in Delphi, Development, Software Development | 2 Comments »

coinmon: In case you don’t want to install 61 packages [1] :)

Posted by jpluimers on 2017/12/04

via: [WayBack] Hacker News – coinmon: In case you don’t want to install 61 packages [1] :) and [WayBack] The curl + jq based approach to check Bitcoin prices looks a bit more attractive than using a node.js package with 61 dependencies, doesn’t it? Source:… – ThisIsWhyICode – Google+

Function to call curl from bash:

    $ coinmon() {
    >     curl "https://api.coinmarketcap.com/v1/ticker/?convert=$1" | jq ".[0] .price_$1"
    > }

    $ coinmon eur
    "6988.4723188"

Or in Python (from the same HackerNew thread): [Archive.is] https://www.pastery.net/jnscrh/

#!/usr/bin/env python3

from urllib.request import urlopen
from decimal import Decimal
import json

def print_coin(coin):
    print("{} ticker:".format(coin["name"]))
    print("Price: {:,} EUR".format(Decimal(coin["price_eur"])))
    print("Market cap: {:,} EUR".format(Decimal(coin["market_cap_eur"])))
    print()


r = urlopen("https://api.coinmarketcap.com/v1/ticker/?convert=eur")
coins = json.loads(r.read().decode("utf8"))

for coin in coins:
    if coin["id"] in ("bitcoin", "ethereum", "ripple", "monero"):
        print_coin(coin)

–jeroe

Posted in Development, JavaScript/ECMAScript, Node.js, Software Development | Leave a Comment »