I ran into some problems with my code and I don't know how to fix it. So my problem:
On a View of my application, there is a filepath displayed like this:
/resume/attachment/12/yaml_error_complete.yml
But I only want the filename as Output, means:
yaml_error_complete.yml
How can i achieve this? I tried with several options like string.slice! etc, but it doesn't work, since the number after "attachment" is increased by 1 for every single upload. At beginning I thought about to simply remove 2 chars, don't matter what they are. But then i ran into another problem that happens when the 100 file is uploaded. In this case i would have to remove 3 chars instead of 2, and i'm again at the beginning of my problem.
May someone of you can help me?
Thanks a lot!
I assume that you need to retrieve the file of a path.
for ex if your file name is "/resume/attachment/12/yaml_error_complete.yml"
Then try this one
"/resume/attachment/12/yaml_error_complete.yml".split('/').last
If I understand your question right, then, maybe it should help you:
a = "/resume/attachment/12/yaml_error_complete.yml"
a.split('/').last
#=> "yaml_error_complete.yml"
In addition to the sulution with split('/') you could do the following
File.basename("/resume/attachment/12/yaml_error_complete.yml")
Related
Thanks in advance for your assistance here. I really appreciate it!!
I have built a script using the template here: https://developers.google.com/workspace/solutions/mail-merge
...And it's awesome. Working perfectly and solving a big problem for me!!
I have 2 problems I need to fix, and I need your help, please!!
Problem 1: Can I use a column (or cell reference) as a default "subjectLine" rather than it be user input each time the script is run?
Problem 2: Once Problem 1 (above) is solved, I'd like to trigger the script to automatically run every 15 minutes, continuously.
Any tips/scripts/pointers would be awesome. I am quite new to coding so have tried to dig up how to replace the user input piece of code with a default value for the subject line, but I can't figure it out. And only once this is done, can I then start to try and get code working for the second problem - so I'm stuck on both counts.
Thanks again!! Kind regards, Tom
i would like to know how i could cut and mix strings, im making a player fusion script for my game, but i dont know how i can make their name be togheter, like, if player 1 name is LordNoob and player 2 name is Keyboard then it would mix their names to one like Lordoard or KeyNoob something like that.
Ive searching a few things on the roblox wiki but i didnt found nothing, i saw string patterns but i dont know if it would help me.
If anyone could tell me what i could do it would be a cool help. thank you.
I've tried making a function for you which works okay, having the flaws that Paul mentioned
function mixStrings(string1,string2)
return string.upper(string.sub(string1,1,1)) .. string.lower( string.sub( string.sub(string1,1,math.floor(string.len(string1)/2)) ,2,string.len(string.sub(string1,1,math.floor(string.len(string1)/2)))) .. string.sub(string2,math.ceil(string.len(string2)/2),string.len(string2)) )
end
print(mixStrings("Keyboard","Calculator"))
print(mixStrings("Narwhal","Shark"))
print(mixStrings("America","Europe"))
print(mixStrings("Spoon","Fork"))
Running the above script resulted in the following when I tested it:
Keybulator
Narark
Amerope
Spork
(Btw the function will always make a string with a capitalized first letter and the rest will be lowercase, so it probably won't be useful if you're aiming to make something like KeyNoob)
So, I recently got Please, don't touch anything. I went through all the endings, and totally didn't look online for a few. Now, I want to unlock all the achievements and stuff, and I really don't feel like restarting my game many, many times to get "Perfectionist." I went and extracted the save file. I have moved it over to text edit, and I have no clue what they used to encode it. Here it is:
Save
endings="2D0100001900000000000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000000000000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F000000000000000000000000"
settings
volume="1.000000"
language
language="UK"
achieviements
perfect_buttons="2742.000000"
red_button_all="-40.000000"
ach_list="2D0100000A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
restarts="103.000000"
all_buttons="2693.000000"
Please let me know what I can do to mess around with this save file. Thanks!
I was just going through this, so here is what I figured out.
All you have to edit is 'endings' value in savedata.ini file
it looked like this after the first ending:
2D0100001900000000000000000000000000F03F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
and like this after the second ending:
2D0100001900000000000000000000000000F03F00000000000000000000F03F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
first 16 characters are still same, then every 24 characters are for game missions, not sure if zeros count or are just separators:)
2D01000019000000
00000000000000000000F03F
00000000000000000000F03F
000000000000000000000000
000000000000000000000000
...
edit that so there is F03F every 24 characters except the last four characters
2D0100001900000000000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F00000000000000000000F03F000000000000000000000000
you can copy/paste this as endings value and try to run the game. Only the last ending needs to be done and you can get perfectionist achievment ;) (delete save file first, run game once and finish at least one ending so the file is complete)
Simple question, new to iOS and Objective-C, not understand why it's not doing the full link.
NSLog(#"http://iam.colum.edu/portfolio/api/course/%#", setCourseNumber, "?json=True");
output: http://iam.colum.edu/portfolio/api/course/32-2400
Not going to go into what the coursenumber is, no point, the question is that my output is not including the "?json=True" part of the link. I know it must be something small that I am not including, I just am new to Objective-C and can't figure it out. Thank you in advance.
This:
NSLog(#"http://iam.colum.edu/portfolio/api/course/%#", setCourseNumber, "?json=True");
Could be this:
NSLog(#"http://iam.colum.edu/portfolio/api/course/%#?json=True", setCourseNumber);
Looks like Logan beat me too it.
Here's some more information from Apple's documentation on formatting string objects.
Here's a list of string formats. Things like %#, %d, etc.
Because you have two arguments, but using only one:
NSLog(#"http://iam.colum.edu/portfolio/api/course/%#", setCourseNumber, "?json=True");
setCourseNumber is first attribute - %#
"?json=True" is second attribute - ?
So you can modify it like this:
NSLog(#"http://iam.colum.edu/portfolio/api/course/%#%#", setCourseNumber, "?json=True")
Or use
NSLog(#"http://iam.colum.edu/portfolio/api/course/%#?json=True", setCourseNumber)
No matter, where argument is situated - in the middle or in the end.
In org-mode, I have defined a figure+caption like this:
#+CAPTION: My great figure
#+LABEL: fig:myfigure
[[myfigure.png]]
How do I write "See figure [myfigure]"? I've found the following syntax:
See figure \ref{fig:myfigure}
but this looks ugly in the source file. In particular, you cannot use it for actually jumping to the figure.
You actually don't need '#+NAME', it works fine if you use '#+LABEL', which won't break your short-caption for list of figures.
Orgmode does now offer a 'jumpable', enumerated or link with name of your choice in the exported (latex, html) text if you link with:
see figure [[fig:myfigure]].
or
see figure [[fig:myfigure][figurenameintext]].
I would have added this as a comment, but I don't have the reputation yet.
--
In response to your comment (still can't comment): you do need the '#+NAME' for it to jump within the .org source file; as mentioned in the manual, and i also just confirmed that works. Not sure about the short-captions in the latest version.
With a very recent org-mode, you can use #+name:, see:
http://thread.gmane.org/gmane.emacs.orgmode/62644/focus=62646
#+CAPTION: My great figure
#+LABEL: fig:myfigure
#+name: fig:myfigure
[[test.png]]
See figure [[fig:myfigure][test]].
This works for me to jump from the link , but has no effect when exporting, I'm afraid...