Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

content management

For general discussion related FlowStone

content management

Postby tester » Thu Oct 03, 2013 8:03 pm

I just noticed, that the old modules I use - will not fit here. Guess this is ruby'ish part.

I'm looking for some content management tool, that allows to split and join data according to separators.

Let say that I have something like this:

a,b,c,d,e|x,y,z,v|q,w,e,r,t,y
p,f,g,h|3,5,6,2|b,6,4,k

So I have line separators, comma separators and column separators, and string (textual+numeric) data.

Loading from the text file - how to split these data according to various separators?
Saving file - how to mix it again according the same separators?
Are there limits on how long a single line can be?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: content management

Postby billv » Thu Oct 03, 2013 8:22 pm

tester wrote:I'm looking for some content management tool, that allows to split and join data according to separators.

You may have missed this one from nubeat7....
Works great and does what you need..
http://www.dsprobotics.com/support/viewtopic.php?f=3&t=1592#p7069
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: content management

Postby tester » Thu Oct 03, 2013 8:34 pm

I'm totally split between two very different topics, so I'm missing everything I can... :mrgreen:
Thanks!
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: content management

Postby Nubeat7 » Thu Oct 03, 2013 9:40 pm

match whatever you want,
http://www.tutorialspoint.com/ruby/ruby ... ssions.htm

maybe also 'scan' instead of 'split', could be of interest, or 'join_with_prefix':

http://stackoverflow.com/questions/8033 ... h-a-prefix

also interesting:

http://drewolson.wordpress.com/2007/03/ ... ree-bonus/
Last edited by Nubeat7 on Thu Oct 03, 2013 9:43 pm, edited 1 time in total.
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: content management

Postby trogluddite » Thu Oct 03, 2013 9:42 pm

Also worth noting, you don't have to use the RegEx's for the 'split' method - you can use any string (even whole words) as the split points...
Code: Select all
@my_string.split(",")


There are also a few strings that have special behaviour...

Split the string at ANY whitespace - that's; space, continuous runs of spaces, tab or new-lines.
Code: Select all
@my_string.split(" ")  # A single space sharacter.


Character codes...
Code: Select all
@my_string.split("\t")

You can specify many special characters using this 'backslash' notation - a backslash followed by a single character. The string must be inside double quotes for this to work ( " ", NOT ' ' ). The most useful are...
"\t" = TAB
"\v" = Vertical tab.
"\n" = New-line
"\r" = Carriage return
"\0xNN" = NN is a hex number, gives you the corresponding ACSII character

To reliably split lines...
Code: Select all
@my_string.split()

There are different standards for terminating lines - sometimes 'newline', sometimes 'return', sometimes both - depending on where the string came from. Using 'split' with no separator value ensures that all possibilities are taken care of.

@Nubeat - nice tutorial links. Cheers!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: content management

Postby RJHollins » Fri Oct 04, 2013 7:13 am

Great stuff Guys !!

This stuff about RUBY is so helpful. I've been trying to use it more and more, spending most of the time hitting Google ... but there are plenty of times I've had to come back to the FS forum to really help.

I would be so good to have an FS database of RUBY stuff that could be searched out. It would probably be a nitemare to organize, but would be invaluable.

Nonetheless ... these posts help a lot ! :D
8-)
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: content management

Postby trogluddite » Fri Oct 04, 2013 2:23 pm

Oh yes - just spotted that you asked how to join them back together.
Very simple...
Code: Select all
@my_string = @my_array.join(",")

The separator string (e.g. ","), works mostly like the examples for the .split method shown earlier - except for when you want to join lines.
'.join()' with no argument, just joins everything end to end with no separator. To join whole lines, you need to use the 'backslash' codes. I've found, that for best compatibility with FS text displays etc. it's best to use 'return' AND 'new-line'...
Code: Select all
@my_string = @my_array.join("\r\n")


In any case, the array doesn't have to contain only strings - numbers etc. will automatically get converted.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: content management

Postby tester » Fri Oct 04, 2013 10:12 pm

Trog - could you put your thoughts into copy/paste modules to play with? I have no idea what/how to deal with it.

Meanwhile I will try to get my thoughts on what exactly I need to get.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: content management

Postby trogluddite » Sat Oct 05, 2013 1:44 pm

Copy/paste of knob/switch etc. control values, yes?
So, I'm thinking something like - copying all settings from one oscillator to another one, and that kind of thing.

This is something, I think, to consider for my "meta project"...

Maybe it seems that I have many unfinished project posted here lately - Knob, XML parsing, Graphics classes, Table displays etc. But I am working steadily to bring all of these together to make a coherent system - one "Master" module to handle MIDI parameters, undo/redo, copy/paste, 'linked' controls, user preference files etc. - and a simple module that can drop into any control design to enable the features.

Sharing data between Ruby blocks is the key to this - and the MIDI learn from those knobs I posted a few days ago is a breakthough, I think; finally a robust design for such data sharing - previous things I built had too many chances of Ruby errors. That is crucial because I think this system needs to work without the user ever needing to edit any Ruby code - it must be as simple as the VST parameter/manager to use, just a couple of modules and handful of wireless links.

That is still a long way off, so in the meantime, as far as copy/paste goes, I have done it before in one of my old SM projects. In practice, it was a lot of "wiring" and duplicate parts, but in principle quite simple...
Copy = take current value and store into a sample-and-hold prim' (the 'clipboard')
Paste = read out the S&H into the destination.
It's effective enough, but laborious to set up - separate 'clipboards' for each module type (e.g. oscillator, filter, envelope etc.)
I have also used another method - using a small text file in place of the many S&H primitives. This is the best way IMHO - because the clipboard is on the HDD, settings can be copied between different plugin instances and projects.

I will look and see if there is anything from those old designs that I can post as a practical example.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: content management

Postby tester » Sat Oct 05, 2013 1:52 pm

I mean - I read fractions of your ruby code, but have no idea where to paste them and what else to modify in order to make the ruby module work.

Playing with dozens of green connections in visual modular mode - at least the amount of choices is limited, this is how I see it; I often find solutions there even if I don't know how I did it. Playing with ruby content - "hmm... you are screaming, I don't know - did I just cut your leg?", I have no vague idea what is going on.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Next

Return to General

Who is online

Users browsing this forum: No registered users and 73 guests