You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Newton <da...@gmail.com> on 2011/03/14 12:22:19 UTC

[OT] Re: Just a stab in the dark

Do you really need all of scanf's functionality?

If I were approaching this I'd probably consider writing some sort of
transform between scanf functionality and an underlying
implementation; a micro-DSL, more or less.

Dave

On Mon, Mar 14, 2011 at 7:15 AM, Adam Hardy
<ah...@cyberspaceroad.com> wrote:
> Matt Meola on 14/03/11 00:04, wrote:
>>
>> On 03/12/2011 05:57 AM, Adam Hardy wrote:
>>>
>>> Hi List
>>>
>>> this is a bit OT but it's the weekend and I have a question which I am
>>> desperate to answer and my googling skills are no match for it.
>>>
>>> Does anyone know where I can get a Java implementation of scanf?
>>
>> Does java.text.MessageFormat.parse() perhaps meet at least some of your
>> needs?
>
> This might actually be a quicker way to do exactly what I need to do now, I
> mean quicker than Scanner. Thanks for the great tip.
>
> However it has 2 drawbacks in comparison with C's scanf - it doesn't take
> the same symbols and formatting in its pattern as printf, and it can't
> handle multiple occurrences of the same variable in the pattern.
>
> Regards
> Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Just a stab in the dark

Posted by Alex Lopez <al...@flordeutopia.pt>.
I think they ment DSL as in Domain Specific Language

Em 14-03-2011 14:06, Brian Thompson escreveu:
> On Mon, Mar 14, 2011 at 7:29 AM, Dave Newton<da...@gmail.com>  wrote:
>
>> On Mon, Mar 14, 2011 at 8:07 AM, Adam Hardy wrote:
>>> But for the future I am writing an app where the user can upload a file
>> of
>>> data and specify the input using that printf/scanf pattern description,
>> and
>>> output the same data into new file with a new format according to a
>> secocnd
>>> pattern. It's OHLC historical data from the financial markets, and it
>> must
>>> be in the correct format for importing into various different analysis
>>> programs.
>>
>> DSL. In fact a guy at the Clojure NYC meetup did this exact thing (for
>> financial data, in clojure) to generate all the Java APIs needed to
>> consume/write the data files.
>>
>
>
> For the sake of us poor, clueless lurkers, would you mind defining DSL in
> this context?  All I can think of is DSL as in Internet service, but I can
> tell from context that it's not the right definition.
>
> Brian
>
>
>
>>
>> Groovy or JRuby might be a better choice depending on how averse you
>> are to toenail-based languages, but this is precisely the kind of
>> thing DSLs are good for, and it's a lot easier to remember a
>> human-readable DSL than the scanf spec, and it'd be easier to add
>> domain-specific data types.
>>
>> Dave
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Just a stab in the dark

Posted by Brian Thompson <el...@gmail.com>.
On Mon, Mar 14, 2011 at 7:29 AM, Dave Newton <da...@gmail.com> wrote:

> On Mon, Mar 14, 2011 at 8:07 AM, Adam Hardy wrote:
> > But for the future I am writing an app where the user can upload a file
> of
> > data and specify the input using that printf/scanf pattern description,
> and
> > output the same data into new file with a new format according to a
> secocnd
> > pattern. It's OHLC historical data from the financial markets, and it
> must
> > be in the correct format for importing into various different analysis
> > programs.
>
> DSL. In fact a guy at the Clojure NYC meetup did this exact thing (for
> financial data, in clojure) to generate all the Java APIs needed to
> consume/write the data files.
>


For the sake of us poor, clueless lurkers, would you mind defining DSL in
this context?  All I can think of is DSL as in Internet service, but I can
tell from context that it's not the right definition.

Brian



>
> Groovy or JRuby might be a better choice depending on how averse you
> are to toenail-based languages, but this is precisely the kind of
> thing DSLs are good for, and it's a lot easier to remember a
> human-readable DSL than the scanf spec, and it'd be easier to add
> domain-specific data types.
>
> Dave
>
>

Re: [OT] Re: Just a stab in the dark

Posted by Dave Newton <da...@gmail.com>.
On Mon, Mar 14, 2011 at 8:07 AM, Adam Hardy wrote:
> But for the future I am writing an app where the user can upload a file of
> data and specify the input using that printf/scanf pattern description, and
> output the same data into new file with a new format according to a secocnd
> pattern. It's OHLC historical data from the financial markets, and it must
> be in the correct format for importing into various different analysis
> programs.

DSL. In fact a guy at the Clojure NYC meetup did this exact thing (for
financial data, in clojure) to generate all the Java APIs needed to
consume/write the data files.

Groovy or JRuby might be a better choice depending on how averse you
are to toenail-based languages, but this is precisely the kind of
thing DSLs are good for, and it's a lot easier to remember a
human-readable DSL than the scanf spec, and it'd be easier to add
domain-specific data types.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Just a stab in the dark

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
A micro-DSL ? I should know this stuff, I think my brain is going. What's DSL in 
this context?

Re: needing all of scanf: not right now I don't need it. I actually need 
anything like last week already - spent too long staring at tv scenes of 
exploding nuclear reactors and wasteland where towns used to be over the weekend.

But for the future I am writing an app where the user can upload a file of data 
and specify the input using that printf/scanf pattern description, and output 
the same data into new file with a new format according to a secocnd pattern. 
It's OHLC historical data from the financial markets, and it must be in the 
correct format for importing into various different analysis programs.



Dave Newton on 14/03/11 11:22, wrote:
> Do you really need all of scanf's functionality?
> 
> If I were approaching this I'd probably consider writing some sort of
> transform between scanf functionality and an underlying
> implementation; a micro-DSL, more or less.
> 
> Dave
> 
> On Mon, Mar 14, 2011 at 7:15 AM, Adam Hardy
> <ah...@cyberspaceroad.com> wrote:
>> Matt Meola on 14/03/11 00:04, wrote:
>>> On 03/12/2011 05:57 AM, Adam Hardy wrote:
>>>> Hi List
>>>>
>>>> this is a bit OT but it's the weekend and I have a question which I am
>>>> desperate to answer and my googling skills are no match for it.
>>>>
>>>> Does anyone know where I can get a Java implementation of scanf?
>>> Does java.text.MessageFormat.parse() perhaps meet at least some of your
>>> needs?
>> This might actually be a quicker way to do exactly what I need to do now, I
>> mean quicker than Scanner. Thanks for the great tip.
>>
>> However it has 2 drawbacks in comparison with C's scanf - it doesn't take
>> the same symbols and formatting in its pattern as printf, and it can't
>> handle multiple occurrences of the same variable in the pattern.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org