Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 2, 2013, 02:12 AM   #1
yoblanco
macrumors newbie
 
Join Date: Dec 2011
Where can I ask for some program?

That's the question. Is there any webpage along the internet where you can ask for some program? (It's pretty simple, I know how to do it with MATLAB in less than 4 minutes)
The perfect solution would be an .html document which let's you paste some text and then processes it.
But Applescript, or even Automator could work.

In short, if you could tell me a website where I can ask for a little program in .html, Applescript or Automator, I would really appreciate it

Thank you!

PS: the text contains "words" with three numbers separated by commas, colons or dots (e.g., 13.16.30, for the example A.B.C). On other place I need to input a different (global) number (D). And then the "application" or script should take that text, and that number, select the words with that pattern A.B.C or A:B:C, and for each of those words, give you links like:

Code:
www.web.com/someplace/inside/placeA/index.php?option1=B&option2=C&option3=D
where the number D is global (so should have a place to input it, different fron the whole text).

PS2: in MATLAB I know how to do it if the text contains only those kind of words. So if it's difficult to "select" them from a whole text, you could think that the text contains only those words.

Last edited by yoblanco; Jul 2, 2013 at 03:02 AM.
yoblanco is offline   0 Reply With Quote
Old Jul 2, 2013, 04:30 AM   #2
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Just use sed if all you want is a find & replace with a regex pattern (which is what it seems you want to me.)
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Jul 2, 2013, 06:08 AM   #3
yoblanco
Thread Starter
macrumors newbie
 
Join Date: Dec 2011
Thanks for the fast answer.

The reason why I would really like it to be an .html (or something that runs from any web browser) is that I need it everywhere and on different machines. And if I get that, then put it in Dropbox and use it wherever I want.
But I know nothing about .html or some "web language", even less about forums about that subject. And that's basically what I'm asking.

In second place, if the html solution doesn't come up, then I think some applescript would work.

Thank you for the answer, and that could really work in a machine with sed installed, but not everywhere :S
yoblanco is offline   0 Reply With Quote
Old Jul 2, 2013, 11:57 AM   #4
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by yoblanco View Post
Thanks for the fast answer.

The reason why I would really like it to be an .html (or something that runs from any web browser) is that I need it everywhere and on different machines. And if I get that, then put it in Dropbox and use it wherever I want.
But I know nothing about .html or some "web language", even less about forums about that subject. And that's basically what I'm asking.

In second place, if the html solution doesn't come up, then I think some applescript would work.

Thank you for the answer, and that could really work in a machine with sed installed, but not everywhere :S
sed is a part of every OS X, Unix, and Linux distribution (I think.) For Windows, you can install sed as part of many different packages, as mentioned here:

http://stackoverflow.com/questions/1...ty-for-cmd-exe

Don't reinvent the wheel. If you're not a programmer, then here's something you need to know about them: good programmers are lazy. If a good solution already exists and they can't make a better one in a reasonable timeframe (IE, in less time than it would take to just use the existing solution), they use it. sed is likely better than anything anyone else is going to come up with anytime soon. So use it.
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Jul 2, 2013, 01:19 PM   #5
960design
macrumors 6502a
 
Join Date: Apr 2012
Location: Destin, FL
Sure there are tons of programmers for hire.
__________________
TI-99/4A, tape cassette, 12" B&W Zenith
960design is offline   0 Reply With Quote
Old Jul 2, 2013, 02:22 PM   #6
yoblanco
Thread Starter
macrumors newbie
 
Join Date: Dec 2011
@ArtOfWarfare It's okey, I will look into sed. I wrote "man sed" in my terminal and gave me nothing. That's why I wrote about installing it. I have done it again just now and it works... I don't know what I wrote before.

@960design considering that I'm a begginer in MATLAB and took me 6 minutes to do it, I hope that in a place where people know how html works it could be done for free.

By the way, the main question remains. Any html forum or community where this small request could fit and be done? If not, any AppleScript one?

The problem with the applescript is that I should be in a Mac and that it couldn't be done automatically in a new computer. The optimal solution is an html file (which I would put in Dropbox) and then, in any machine with internet, open that webpage, paste a text, write the number D, click a button and have a bunch of links.

----------

@ArtOfWarfare It's okey, I will look into sed. I wrote "man sed" in my terminal and gave me nothing. That's why I wrote about installing it. I have done it again just now and it works... I don't know what I wrote before.

@960design considering that I'm a begginer in MATLAB and took me 6 minutes to do it, I hope that in a place where people know how html works it could be done for free.

By the way, the main question remains. Any html forum or community where this small request could fit and be done? If not, any AppleScript one?

The problem with the applescript is that I should be in a Mac and that it couldn't be done automatically in a new computer. The optimal solution is an html file (which I would put in Dropbox) and then, in any machine with internet, open that webpage, paste a text, write the number D, click a button and have a bunch of links.
yoblanco is offline   0 Reply With Quote
Old Jul 2, 2013, 05:46 PM   #7
Jamesbot
macrumors member
 
Join Date: Jun 2009
Maybe you should try the gang over at stack overflow.

They love questions like this over there
Jamesbot is offline   0 Reply With Quote
Old Jul 2, 2013, 05:52 PM   #8
yoblanco
Thread Starter
macrumors newbie
 
Join Date: Dec 2011
Mmm... I don't really think this fits there (it's not a question since I know nothing, it's more like a request). I have been for some time in that (nice) place, and the reason to come here to ask is that I think this question is not really appropriate there.

Thank you.
yoblanco is offline   0 Reply With Quote
Old Jul 2, 2013, 09:06 PM   #9
chown33
macrumors 603
 
Join Date: Aug 2009
I had some free time this afternoon, so I cobbled together something from parts of older projects I have.

It's in 3 parts (HTML, CSS, JavaScript) because that's how the original parts were written.

I make no claims that any of the parts are optimal, exemplary, instructive, or comprehensible to anyone at any skill level. For better or for worse, it's the way the original parts were written.

There may still be some cruft in any or all parts.

FWIW, JavaScript is a reasonably capable language for doing string processing. It's worth learning it for those features alone, so when similar situations arise (and I suspect they will), one has the skills to modify this, or to toss it out and write something better.

The awk language is probably more capable than JavaScript when it comes to solving problems like this. Except for the "It has to run everywhere" constraint, this could probably be done as an awk one-liner. FWIW, awk is a much simpler and smaller (more focused) language than JavaScript.

Released into the public domain. Do what you will with any or all of it.
Attached Files
File Type: zip app-in-3-parts.zip (3.5 KB, 7 views)
chown33 is offline   1 Reply With Quote
Old Jul 3, 2013, 06:11 AM   #10
yoblanco
Thread Starter
macrumors newbie
 
Join Date: Dec 2011
That's perfect. I wasn't really expecting anything here, but to get an address of a forum. But instead I got it. Thank you.

It needs some tweaks, but I can NOW go to StackOverflow, just to ask small questions.

Thank you!

EDIT: Well I say what the problem is here so may be you can solve it.
The links are right, but the ideal is to have clickable links (and even better if they automatically open in a NEW TAB).
And just to say, if all the fonts were Lucida that could be great

Last edited by yoblanco; Jul 3, 2013 at 12:58 PM.
yoblanco is offline   0 Reply With Quote
Old Jul 3, 2013, 01:33 PM   #11
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by yoblanco View Post
The links are right, but the ideal is to have clickable links (and even better if they automatically open in a NEW TAB).
I'm not quite sure what you want.

Do you want the list of clickable links in a new tab? Or do you want each link in the list of clickable links to open a new tab when clicked? Or maybe both?


Please provide a complete list of what you want. Adding features piecemeal makes it harder to estimate the amount of work, and takes longer to create because adding things you don't want still requires writing code.

Describe the complete process you want a user to experience. That is, step through the user experience. Example of current behavior:
  1. User enters a value for D.
  2. User enters or pastes in a series of lines containing triplets.
  3. User presses "Process" button.
  4. The textarea below the "Process" button is cleared, and the contents is replaced by a series of lines with the replacement strings given in the first post.
So change step 4 (or any other steps) so it describes exactly what should happen. If there are additional steps in the user experience, such as clicking newly produced links, be sure to describe exactly what happens for those.

http://www.mikeash.com/getting_answers.html


Quote:
And just to say, if all the fonts were Lucida that could be great
Open the app.css file in a text editor (TextEdit.app will work; TextWrangler (google for free download) would be better). Then delete this line:
Code:
  font-family:monospace;
Save the file, then reload the html page in your browser.

You can make additional changes to the CSS file to alter the styling. Any decent reference or tutorial on CSS should provide info. The CSS I used is pretty basic stuff.

If you use TextEdit.app to edit the CSS file, make sure it's being saved as plain text, not rich text. That's one reason for using TextWrangler; it's primarily for editing plain text.
chown33 is offline   0 Reply With Quote
Old Jul 3, 2013, 02:19 PM   #12
yoblanco
Thread Starter
macrumors newbie
 
Join Date: Dec 2011
I want clickable links. And, the perfect thing would be that when I click on them they open a new tab (in front), I explain later.

And thanks for the monospace tip, I will edit the .CSS (with TextMate, which is the editor I'm familiar with).

Here it is the workflow.
  1. User collects info from a source, and writes down the triplets on a .txt file (or in a mail or wherever). And calculates the D number. This has nothing to do with the program, but just to add info.
  2. User enters a value for D.
  3. User enters or pastes in a series of lines containing triplets.
  4. User presses "Process" button.
  5. The textarea below the "Process" button is cleared, and the contents is replaced by a series of lines with the replacement strings given in the first post.
  6. The user visit each of those links and do a small business there.
  7. And it's over. The next time, with new data, the user goes through another list of triplets and a different number D.

The idea of this programs is to make it easy to visit each of those links. Instead of clicking and writing on a webpage, you write those triplets, calculate the D number, click process and there you have the links automatically.
The next (and, I think, last) step is to make those links clickable. As the user has to go into all of them, to save more time, the point 6. of the list could be expanded (and detailed) like this
  1. User clicks on first link.
  2. New tab is opened and automatically placed on screen (I mean, the tab should be opened in front).
  3. User do a small business there.
  4. User presses CMD + W to close that tab and go back to the list of links (the "app").
  5. And then the second link, and all the same for all the rest of generated links.

I hope I made myself clear.
Thank you really much for your attention.
yoblanco is offline   0 Reply With Quote
Old Jul 3, 2013, 04:30 PM   #13
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by yoblanco View Post
  1. User collects info from a source, and writes down the triplets on a .txt file (or in a mail or wherever). And calculates the D number. This has nothing to do with the program, but just to add info.
  2. User enters a value for D.
  3. User enters or pastes in a series of lines containing triplets.
  4. User presses "Process" button.
  5. The textarea below the "Process" button is cleared, and the contents is replaced by a series of lines with the replacement strings given in the first post.
  6. The user visit each of those links and do a small business there.
  7. And it's over. The next time, with new data, the user goes through another list of triplets and a different number D.
If the area below the "Process" button contains links, then it won't contain a textarea. Those are two completely different things.


What should each clickable link look like?

A link consists of text content and an href. The text content appears in blue and is underlined (by default) to indicate it's a clickable link. The href is the target URL of the link. Examples:Exactly what should appear as the text content of each link?


And for my own curiousity, please explain why your 6-minute MATLAB solution is unsatisfactory. Is it because you don't have MATLAB everywhere? Some other reason?
chown33 is offline   0 Reply With Quote
Old Jul 3, 2013, 04:43 PM   #14
yoblanco
Thread Starter
macrumors newbie
 
Join Date: Dec 2011
Doesn't matter if the text content and the href are the same.
But I think it's better to have the text content as the triplets.

And, yes, as you say, then it isn't a "textarea".

MATLAB is unsatisfactory because I don't have it anywhere, and, even at home, I need to open MATLAB to process a .txt file. With an .html, I just need to open it in the browser (which is almost always open), and it isn't necessary a .txt (can be a copied text).

Last edited by yoblanco; Jul 3, 2013 at 04:50 PM.
yoblanco is offline   0 Reply With Quote
Old Jul 3, 2013, 08:14 PM   #15
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by yoblanco View Post
Doesn't matter if the text content and the href are the same.
But I think it's better to have the text content as the triplets.
New version attached.

The "open in new tab" feature is not guaranteed to work in every browser. There is a standardized way to request it in CSS3, but that may or may not be implemented by any given browser. There are also non-standardized ways that appear in different browsers. See the "app.js" source for links to discussion on this issue on stackoverflow.com.

Stackoverflow links:
http://stackoverflow.com/questions/1...ink-in-new-tab
http://stackoverflow.com/questions/6...not-new-window

The CSS3 way (Working Draft version):
http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/

Still in the public domain. Do what you will with any or all of it.
Attached Files
File Type: zip appv2-in-3-parts.zip (4.3 KB, 6 views)
chown33 is offline   0 Reply With Quote
Old Jul 4, 2013, 03:35 AM   #16
yoblanco
Thread Starter
macrumors newbie
 
Join Date: Dec 2011
That's it. I guess there's nothing more. I've been trying it and works ideally (with my MATLAB solution I just got an .html with the links, with the same href as the text content, and with no spacing...). This is beautiful, well organized, and, of course, useful. If I find something more I will tell you.

Thank you very much!
yoblanco is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Do you know of a program that I can use for this? churchmunkey Mac Applications and Mac App Store 1 Jul 12, 2013 08:23 AM
A 3D program I can appreciate exupery Design and Graphics 16 Jun 3, 2013 04:25 AM
Need a program to do this... ? resmypc OS X 1 Jan 30, 2013 06:42 AM
Which program should I use.... arncowife Mac Applications and Mac App Store 4 Jun 20, 2012 06:00 PM

Forum Jump

All times are GMT -5. The time now is 08:38 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC