Re: Yahoo Finance Scraper

2023-12-17 Thread Witold Baryluk via Digitalmars-d-announce

On Thursday, 14 December 2023 at 00:31:34 UTC, Selim Ozel wrote:

https://forum.dlang.org/post/temmuvdikcuffkymi...@forum.dlang.org

Hello again. This scraper worked for me since 2020 but 
apparently Yahoo decided to change some of the API and it 
stopped working a while back. Last week I worked on updating it 
and it seems to work again. I haven't done a great job at 
testing the code so be careful with it but it seems to work for 
me. I can probably add a few more things if anyone's interested 
in it.


https://github.com/SelimOzel/YahooFinanceD

Best,
Selim


```
user@debian:~$ dub run yahoofinanced:example-csv
 Warning Package 'yahoofinanced:example-csv' was neither 
found locally nor online.

user@debian:~$ dub run yahoofinanced:example-dataframe
 Warning Package 'yahoofinanced:example-dataframe' was 
neither found locally nor online.

user@debian:~$
```

I think README fails to mention that you need to clone the repo, 
and do it from the repo directory.



On a good noite, it looks like it works with gdc compiler out of 
the box. Nice.


Minor issues:

```
user@debian:~/YahooFinanceD$ dub run yahoofinanced:example-csv
 Building package yahoofinanced:example-csv in 
/home/user/YahooFinanceD/
Starting Performing "debug" build using /usr/bin/gdc for 
x86_64.
Building yahoofinanced:example-csv 1.1.1: building 
configuration [application]

 Running example-csv
Retrieveing MSFT between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/MSFT?period1=1544598000=1591772400=1d=divs=true

Retrieveing AAPL between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/AAPL?period1=1544598000=1591772400=1d=divs=true

Retrieveing AMZN between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/AMZN?period1=1544598000=1591772400=1d=divs=true

Retrieveing GM between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/GM?period1=1544598000=1591772400=1d=divs=true

Retrieveing F between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/F?period1=1544598000=1591772400=1d=divs=true

Retrieveing FCAU between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/FCAU?period1=1544598000=1591772400=1d=history=true

HTTP request returned status code 404 ()
user@debian:~/YahooFinanceD$
```

Maybe ignore 404 errors, and continue with the code. My guess the 
`FCAU` is no longer listed.




Re: DMD Beta 2.105.0

2023-07-17 Thread Witold Baryluk via Digitalmars-d-announce

On Sunday, 16 July 2023 at 17:26:03 UTC, Iain Buclaw wrote:
Glad to announce the first beta for the 2.105.0 release, ♥ to 
the 34 contributors.




Thanks for the beta Iain.


Functions can no longer have enum storage class


This looks like a breaking change that can affect people. There 
should be a deprecation (6-12 months) period to give people 
notice to fix their code, without immediately breaking code.


https://github.com/dlang/dmd/pull/15405 and 
https://issues.dlang.org/show_bug.cgi?id=13063 show there was no 
discussion on deprecation, despite authors knowing that there is 
code in the wild using this.


It does not affect me, but in light in recent discussions, it 
again gives a bad picture of D and maintainability of code 
developed in D.


Re: GDC documentation is online and 13.x development updates.

2022-12-15 Thread Witold Baryluk via Digitalmars-d-announce

On Tuesday, 6 December 2022 at 12:13:59 UTC, Iain Buclaw wrote:

Hi,

There is now (long overdue) expanded documentation of the 
user-facing features of GDC online on GCC's documentation site.


[...]



Nice.

GDC expanded documentation looks really good, and covers 
everything I could think of, that was previously scattered in 
many places. Also it is great to see it in PDF format.



Thanks Iain!


Re: D demangler for C++

2022-11-28 Thread Witold Baryluk via Digitalmars-d-announce

On Monday, 28 November 2022 at 12:48:15 UTC, max haughton wrote:
On Sunday, 27 November 2022 at 23:12:35 UTC, Witold Baryluk 
wrote:

https://github.com/baryluk/d-demangle-cpp

D programming language (dlang) symbol name demangler for C++

[...]


Wouldn't some of those tools already have one via libiberty?

https://github.com/gcc-mirror/gcc/blob/master/libiberty/d-demangle.c


`libiberty` has way more things than just D demangler. And some 
projects might not be comfortable with its licensing. And 
libiberty uses autoconf / automake, which is just gross for most 
people.


The idea is to have something simpler, portable (zero conf), just 
for this task, so it is as easy as possible to integrate and have 
flexible licensing.


Many of the tools do not use libiberty, but just call 
`abi::__cxa_demangle` for example. Take a look for for a 
heaptrack tool: 
https://github.com/KDE/heaptrack/blob/master/src/interpret/heaptrack_interpret.cpp#L40-L56


You are free to use `libiberty` if you want.

My demangler is just another option.


D demangler for C++

2022-11-27 Thread Witold Baryluk via Digitalmars-d-announce

https://github.com/baryluk/d-demangle-cpp

D programming language (dlang) symbol name demangler for C++

```cpp
std::cout << 
demangle_d::demangle("_D3std5stdio__T8writeflnTaTiZQoFNfxAaiZv") 
<< std::endl;
// Will print: void std.stdio.writefln!(char, int)(const char[], 
int) @safe

```

Goals

* Easy of integration into any C++ codebase
* Flexible
* Code simplicity following the spec closely in shape

Status: Alpha.



The principal motivation was to have a clean-room, from scratch 
implementation, that can be easily used in various contexts. The 
code base is simple, and can be easily ported to other languages, 
and environment (i.e. kernel space).


Once this is polished down, I will be pushing this demangler to 
be integrated into few 3rd party code bases, for example Valgrind 
/ massif, heapcheak, pprof, tcmalloc, Linux perf, etc.




Re: GCC 12.1 Released (D v2.100-rc.1)

2022-05-07 Thread Witold Baryluk via Digitalmars-d-announce

On Friday, 6 May 2022 at 11:57:47 UTC, Iain Buclaw wrote:

Hi,

I am proud to announce another major GCC release, 12.1.



Thank you so much Ian on your hard and dedicated work on GDC. It 
is my goto default compiler for D on Debian Linux. (I use ldc and 
sometimes dmd sporadically, but only for testing compatibility).


Glad to have newer GCC backend, frontend up to date with DMD, all 
the Phobos work, and various architectures supports landing!


Update the compilers on the GDC compiler explorer site to 
version 12, and other continued maintenance on the testing 
infrastructure, the costs of which are now covered by the kind 
sponsors of GDC. If you are interested in helping support the 
on-going development of GDC, you can do so by making a donation 
to the D Language Foundation.


Good you mentioned that! I was not aware of the sponsorship 
program, and now that I know, I gladly will chip in (well, just 
did it moments ago). For testing infrastructure, I would suggest 
tracking compilation speed and memory usage and output binary 
size of GDC on amd64 and aarch64 at least (to detect compiler 
getting slower, or due to growth of Phobos / druntime), and 
having a public website showing this data. Something like this 
maybe https://fast.vlang.io/



Cheers.



Re: dmt: Python-like indentation in D programming language

2022-04-23 Thread Witold Baryluk via Digitalmars-d-announce

On Friday, 1 April 2022 at 12:39:15 UTC, Marcone wrote:
Your dmt.d not compile for exe in Windows with last version of 
dmd 2.099.0


dmt.d(71): Deprecation: Usage of the `body` keyword is 
deprecated. Use `do` instead.
dmt.d(125): Deprecation: Usage of the `body` keyword is 
deprecated. Use `do` instead.
dmt.d(206): Deprecation: Usage of the `body` keyword is 
deprecated. Use `do` instead.
dmt.d(234): Deprecation: Usage of the `body` keyword is 
deprecated. Use `do` instead.
dmt.d(212): Error: `pure` function `dmt.check_if_can_indent` 
cannot call impure function `dmt.strcmp_first2`
dmt.d(212): Error: `@nogc` function `dmt.check_if_can_indent` 
cannot call non-@nogc function `dmt.strcmp_first2`


Thanks for the report. Please next time open a github issue for 
such things, so I can spot them and fix quickly.



The Error part was fixed in 
https://github.com/baryluk/dmt/commit/748de1d6726c0dbe97ba098b094588b4f13d7045


Something changed in the semantic analysis, that caused 
`strcmp_first2` to not be inffered correctly. Adding explicit 
attributes solves that.


I am aware of `Deprecation: Usage of the body keyword is 
deprecated. Use do instead.`. This is intentional because gdc in 
some older Linux distributions (including Debian stable) do not 
recognize `do`, but they do `body`. Once the newer versions of 
`gdc` trickle to more distros (and Debian stable), I will switch 
it to use `do` and remove use of `body`. The deprecation warning 
is harmless otherwise.





Re: dmt: Python-like indentation in D programming language

2021-11-19 Thread Witold Baryluk via Digitalmars-d-announce

On Friday, 19 November 2021 at 10:03:00 UTC, bauss wrote:


Isn't def redundant in this since D already declares types then 
you can assume if it's not enum, template, mixin template, 
class, struct or union then it must be a function if it also 
end with (...):


Like:

```d
int foo():
return 10
```

You'd never be in doubt that foo was a function or that:

```d
template Foo(T):
alias Foo = T
```

Foo in this case was a template.


Technically yes, but I do not have full proper parser or grammar,
to do the conversion in all possible cases.

The main issue is with the context:

`type name ` ... can be also a start of a variable with a lambda, 
even if it ends with `:`:


```d
auto x = delegate(int y):
   return y * y
```

The return type itself can be a complex template instantiation.

`F!() foo():`

Same with argument types, they might be templates (or maybe even 
mixins?).


Plus it does not necessarily ends with `(...):`, for example it 
can have attributes:


`... (...) pure nothrow @bar:`

Plus of course all the other things like `static`, `public`, 
`extern(...)`, ... at the front.


So yes, `dmt` is not perfect, but for now it still allows to use 
full feature set of D, and use simple rules for achieving these 
goals.


If the tool gains some popularity, there is certainly a possibly 
of adding a proper grammar and parser, and making `def` on 
functions optional. Proper parser will also help in few other 
places, like multi line signature definitions, comments in the 
middle of the multi line definition, enum definitions and array 
literals.




BTW.

I forgot to add to my initial post, that `dmt` generates the 
`#line` directives, making compile errors and warning from `dmd`, 
`gdc` and `ldc` point back exactly to the proper input `.dt` file 
and original line number in it.


And you can pass multiple file to `dmt` tool, including mix of 
`.dt` and non-`.dt` files (i.e. `.d`, `.o`) to link them all 
together by the compiler in expected fashion.




Great project tho!


Thanks.




Re: dmt: Python-like indentation in D programming language

2021-11-17 Thread Witold Baryluk via Digitalmars-d-announce

On Wednesday, 17 November 2021 at 08:28:07 UTC, mw wrote:


To be frank, by just Python syntax alone I wasn't sure how many 
people want to try it.


There are good reasons for it.

1) It enforces indentations, so code is harder to screw up. Also 
because you need to indent, it often is easier to spot too deep 
nesting, and fix it, instead of hiding it.


2) From my experience with porting few small programs (50-1000 
lines) to `dmt`, the resulting code is shorter than original D 
code, by about 15% on average. This is mostly due to closing `}` 
being removed:


3) It might be of interest to people who know Python, but do not 
know C, C++ or Java.


I'm wondering if it can translate existing Python code (e.g 
with a bit py3 type annotations) to D code, then it may attract 
much more users.


No. And not planned. Sparkling some `auto` here and there 
manually, makes it quite possible tho. I did port on Python 
program to `dmt` rather quickly. But of course if you use 
standard library, things are harder.


Cheers.



dmt: Python-like indentation in D programming language

2021-11-16 Thread Witold Baryluk via Digitalmars-d-announce

Hi,

`dmt` is an old project of mine from around year 2006. I ported 
it recently from D1 to D2, and added some extra features and 
support for extra keywords, and fixed few bugs here and there.


`dmt` is a converter (offline or auto-invoking compiler after 
conversion) from Python-like indention style to curly braces for 
D programming language.


https://github.com/baryluk/dmt

It is fun and easy to use, and maybe it would be of interested to 
you.


`example.dt`:

```d
def int f(int b):
int y = 0
foreach (i; 0..5):
  y += i * (i+b)
return y

struct A:
private:
int a
public:
int b_ = 5
def auto b() @property:
return b_

def void main():
import std
writefln!"%s %s"(f(5), A())
```

```shell
$ DMD=ldc2 dmt -run example.dt
ldc2 -run example.d
80 A(0, 5)
$
```

All D programming language features are supported (including 
exception handling, if/else, switch/case/break, inline asm, 
attribute sections, goto). Converted code is human readable.


You can check more examples in the README.md and in `tests/` 
directory.


`dmt` is not yet self hosting, but that is probably the next 
step. :)


Enjoy.



Re: Til, a command language written in D

2021-05-14 Thread Witold Baryluk via Digitalmars-d-announce

On Friday, 14 May 2021 at 22:10:38 UTC, Cléber Zavadniak wrote:

Hey, folks, how you doing?


Good. Hope you are doing good too.



[Til](https://github.com/til-lang/) is now mature enough, IMHO, 
to the point I'm spending more time writing documentation and 
"spreading the word" than coding that much. I published two 
packages on Dub (the language itself and a module) and created 
a [Github-Pages-Website](https://til-lang.github.io/til/), 
already.




Nice. Pretty clean syntax, and the implementation.

I am not a fan of Tcl, but the Erlang influences are definitively 
cool.

I like sub processes and the piping.

Do you have some example of running external processes / commands.
with `Til`? Composing pipes between external processes, and
also between internal ones (maybe by some adapter that splits
pipe data by lines?).

A good alternative to bash is always welcome ;D