00:01
ViperMaul has joined #ruby-lang
00:12
datanoise has joined #ruby-lang
00:18
replore has joined #ruby-lang
00:21
havenn has joined #ruby-lang
00:26
Banistergalaxy has joined #ruby-lang
00:32
Giddeon has joined #ruby-lang
00:32
srbaker has joined #ruby-lang
00:38
andrewhl has joined #ruby-lang
00:39
kvs has joined #ruby-lang
00:42
shevy has joined #ruby-lang
00:42
diegoviola has joined #ruby-lang
00:43
Psyche^ has joined #ruby-lang
00:44
moxiemk1 has joined #ruby-lang
00:45
VegetableSpoon has joined #ruby-lang
00:46
Banistergalaxy has joined #ruby-lang
00:49
ryanf has joined #ruby-lang
00:54
rdavila has joined #ruby-lang
01:00
tonesfrommars has joined #ruby-lang
01:01
batmanian has joined #ruby-lang
01:11
rdavila has joined #ruby-lang
01:12
wallerdev has joined #ruby-lang
01:14
batmanian has joined #ruby-lang
01:37
ttilley has joined #ruby-lang
01:43
singpolyma has joined #ruby-lang
01:43
bryno has joined #ruby-lang
01:43
flebel has joined #ruby-lang
01:48
workmad3 has joined #ruby-lang
02:02
wardrop_ has joined #ruby-lang
02:08
seanstickle has joined #ruby-lang
02:11
publicvoid_ has joined #ruby-lang
02:18
woollyams has joined #ruby-lang
02:27
woollyams has joined #ruby-lang
02:30
gix- has joined #ruby-lang
02:30
knu has joined #ruby-lang
02:30
tomzx_ has joined #ruby-lang
02:31
burgestrand1 has joined #ruby-lang
02:32
cantonic has joined #ruby-lang
02:33
sora_h_ has joined #ruby-lang
02:33
any-key_ has joined #ruby-lang
02:34
seanstickle_ has joined #ruby-lang
02:34
machine5 has joined #ruby-lang
02:45
FACEFOX-DOT-COM has joined #ruby-lang
02:49
woollyams has joined #ruby-lang
02:50
FACEFOX has joined #ruby-lang
02:52
machine1 has joined #ruby-lang
02:59
savage- has joined #ruby-lang
03:01
wallerdev has joined #ruby-lang
03:05
drumond19 has joined #ruby-lang
03:09
drumond19 has joined #ruby-lang
03:14
drumond19 has joined #ruby-lang
03:18
rdavila has joined #ruby-lang
03:25
dr0id has joined #ruby-lang
03:25
woollyams has joined #ruby-lang
03:25
seoaqua has joined #ruby-lang
03:25
<
seoaqua >
pls help me get rid of 'encoding error : input conversion failed due to input error, bytes 0x84 0xC2 0x27 0x20'
03:26
<
seoaqua >
this seems to be a warning ,instead an error or an exception
03:28
savage- has joined #ruby-lang
03:40
ryanf has joined #ruby-lang
03:48
chimkan_ has joined #ruby-lang
03:48
VladGh has joined #ruby-lang
03:48
freedrull has joined #ruby-lang
03:48
yeltzooo7 has joined #ruby-lang
03:48
sj26 has joined #ruby-lang
03:48
tdmackey has joined #ruby-lang
03:48
mitchty has joined #ruby-lang
03:49
cdnz has joined #ruby-lang
03:52
<
shevy >
seoaqua Encoding will forever suck
03:52
<
erikh >
that's not an answer
03:52
<
erikh >
I mean, I agree with you, but that doesn't really help him
03:54
rdavila has joined #ruby-lang
03:58
FACEFOX-DOT-COM has joined #ruby-lang
03:59
FACEFOX-DOT-COM has joined #ruby-lang
04:12
bglusman has joined #ruby-lang
04:14
ViperMaul has joined #ruby-lang
04:17
rippa has joined #ruby-lang
04:31
<
seoaqua >
i hate warnings, i cant trace back with that msg
04:31
rue_XIV has joined #ruby-lang
04:31
jmeeuwen_ has joined #ruby-lang
04:32
corundum has joined #ruby-lang
04:32
jkyle has joined #ruby-lang
04:38
wwalker_ has joined #ruby-lang
04:38
FACEFOX has joined #ruby-lang
04:38
zerokarm1left has joined #ruby-lang
04:41
jkyle_ has joined #ruby-lang
04:44
vereteran has joined #ruby-lang
04:48
tris has joined #ruby-lang
04:48
machine1 has joined #ruby-lang
04:48
gsav has joined #ruby-lang
04:52
EvilJStoker_ has joined #ruby-lang
04:54
FACEFOX-DOT-COM has joined #ruby-lang
04:54
replore has joined #ruby-lang
04:54
naquad has joined #ruby-lang
04:54
FACEFOX has joined #ruby-lang
04:55
EvilJStoker_ has joined #ruby-lang
05:00
Oloryn_lt1 has joined #ruby-lang
05:00
jordan` has joined #ruby-lang
05:00
FastJack has joined #ruby-lang
05:00
JackNorris has joined #ruby-lang
05:00
publicvoid_ has joined #ruby-lang
05:00
hrnt_ has joined #ruby-lang
05:00
yellow5 has joined #ruby-lang
05:00
Guest58702 has joined #ruby-lang
05:00
cronin101 has joined #ruby-lang
05:00
jbsan has joined #ruby-lang
05:00
yorickpeterse has joined #ruby-lang
05:00
melter has joined #ruby-lang
05:00
tla has joined #ruby-lang
05:00
whitequark has joined #ruby-lang
05:00
drbrain has joined #ruby-lang
05:00
owen1 has joined #ruby-lang
05:00
segy has joined #ruby-lang
05:00
lucas has joined #ruby-lang
05:00
shyouhei_ has joined #ruby-lang
05:00
dju has joined #ruby-lang
05:00
lzhz has joined #ruby-lang
05:01
mitchty has joined #ruby-lang
05:01
corundum has joined #ruby-lang
05:01
woollyams has joined #ruby-lang
05:02
turbolih1s has joined #ruby-lang
05:02
tomb_ has joined #ruby-lang
05:02
turboladen has joined #ruby-lang
05:02
Taranis has joined #ruby-lang
05:02
ahs3- has joined #ruby-lang
05:03
ramonmaruko has joined #ruby-lang
05:07
FACEFOX has joined #ruby-lang
05:10
gouthamvel has joined #ruby-lang
05:10
gouthamvel has quit [#ruby-lang]
05:10
machine1 has joined #ruby-lang
05:14
Bwild has joined #ruby-lang
05:17
michael_mbp has joined #ruby-lang
05:17
kyrylo has joined #ruby-lang
05:18
tamsuiboy has joined #ruby-lang
05:18
yxhuvud has joined #ruby-lang
05:21
heftig has joined #ruby-lang
05:30
ryanf has joined #ruby-lang
05:31
andrewhl has joined #ruby-lang
05:39
solars has joined #ruby-lang
05:40
ryanf has joined #ruby-lang
05:59
fvollero has joined #ruby-lang
06:04
x0F_ has joined #ruby-lang
06:07
JohnBat26 has joined #ruby-lang
06:10
zmack has joined #ruby-lang
06:10
yxhuvud has joined #ruby-lang
06:11
michael_mbp has joined #ruby-lang
06:16
workmad3 has joined #ruby-lang
06:19
WillMarshall has joined #ruby-lang
06:19
Axsuul has joined #ruby-lang
06:21
<
bnagy >
ary1.compact + ary2.compact
06:22
<
bnagy >
or just (ary1 + ary2).compact, as you like
06:22
<
WillMarshall >
bnagy: If the nils weren't sequential like that?
06:23
<
bnagy >
or [ary1,ary2].map(&:compact).flatten
06:23
<
WillMarshall >
bnagy: Imagine I needed to preserve order, but the nils were scattered around
06:23
<
bnagy >
why wouldn't order be preserved?
06:23
<
bnagy >
ohhh I see what you mean, if it were like a 2d array
06:23
<
bnagy >
ary1.zip(ary2).compact
06:24
<
bnagy >
probably need a flatten first .flatten.compact
06:24
<
bnagy >
didn't try that out
06:25
<
bnagy >
undefined for [nil,1,nil] and [nil,2,nil] - what order should that be?
06:25
<
bnagy >
with zip it will be 1,2 I think
06:26
<
WillMarshall >
bnagy: Right, with the example you give
06:26
<
WillMarshall >
I'd expect [nil, 2, nil]
06:26
<
WillMarshall >
But there'll never be overlap
06:26
<
WillMarshall >
Imagine...
06:26
<
WillMarshall >
[nil, 1, nil, 2]
06:26
<
WillMarshall >
and [4, nil, 5, nil]
06:26
<
bnagy >
[nil,1,nil].zip([nil,2,nil]).flatten.compact => [1, 2]
06:26
<
WillMarshall >
I'd expect to get [4, 1, 5, 2]
06:27
<
bnagy >
zip flatten compact should work for you
06:27
<
WillMarshall >
Got it!
06:27
<
WillMarshall >
Thanks :)
06:28
dc5ala has joined #ruby-lang
06:31
francisfish has joined #ruby-lang
06:33
Banistergalaxy has joined #ruby-lang
06:39
kitallis has joined #ruby-lang
06:41
srbaker has joined #ruby-lang
06:44
francisfish has joined #ruby-lang
06:48
<
rippa >
a.zip(b).map {|x,y| x ? x : y}
06:57
roha has joined #ruby-lang
06:58
rzys has joined #ruby-lang
07:00
dubellz has joined #ruby-lang
07:04
solars has joined #ruby-lang
07:07
dubellz has joined #ruby-lang
07:07
ryez has joined #ruby-lang
07:08
|Vargas| has joined #ruby-lang
07:14
dubellz has joined #ruby-lang
07:23
z3r00ld has joined #ruby-lang
07:26
michael_mbp has joined #ruby-lang
07:28
mangohuice has joined #ruby-lang
07:31
jxie has joined #ruby-lang
07:32
wardrop has joined #ruby-lang
07:36
slaytanic has joined #ruby-lang
07:44
mangohuice has joined #ruby-lang
07:44
toretore has joined #ruby-lang
07:50
slaytanic has joined #ruby-lang
07:50
ryez has joined #ruby-lang
07:52
jondot has joined #ruby-lang
07:53
replore has joined #ruby-lang
08:01
QaDeS has joined #ruby-lang
08:06
Fullmoon has joined #ruby-lang
08:07
banister has joined #ruby-lang
08:11
michael_mbp has joined #ruby-lang
08:11
gouthamvel has joined #ruby-lang
08:12
brianpWins has joined #ruby-lang
08:13
gouthamvel has quit [#ruby-lang]
08:16
rushed has quit [#ruby-lang]
08:17
wardrop has joined #ruby-lang
08:17
tekin_ has joined #ruby-lang
08:22
slaytanic has joined #ruby-lang
08:27
workmad3_ has joined #ruby-lang
08:29
wardrop has joined #ruby-lang
08:29
judofyr has joined #ruby-lang
08:30
WillMarshall has joined #ruby-lang
08:39
Banistergalaxy has joined #ruby-lang
08:41
zmack has joined #ruby-lang
08:57
jbsan has joined #ruby-lang
09:01
futurechimp has joined #ruby-lang
09:02
<
bnagy >
rippa: you will be punished in the next life
09:03
<
bnagy >
that's a HORRIBLE solution :)
09:03
<
bnagy >
like, there's a perfectly readable method that exists just to strip nil, and you use a ternary instead :>
09:04
<
bnagy >
wait, and it doesn't actually work
09:04
<
shevy >
down with nil!
09:04
<
shevy >
stop the tyranny!
09:04
<
bnagy >
phew I was wondering what side effect weirdness was going on :S
09:05
vmoravec has joined #ruby-lang
09:06
<
dr0id >
do you believe in after life ?
09:06
<
anildigital_work >
Somehow from my Rails app
09:06
<
anildigital_work >
client = Mysql2::Client.new(:host => "localhost", :username => "root", :password => "sekret", :database => "information_schema")
09:06
<
bnagy >
no, that's why I use buddhist examples
09:06
<
anildigital_work >
first time it runs..
09:07
<
anildigital_work >
second time it hangs for unlimited time without error.
09:07
<
dr0id >
thanks for your password anildigital_work
09:07
<
shevy >
dr0id of course not, it's a human invention
09:07
solars has joined #ruby-lang
09:07
<
judofyr >
dr0id: but it's SEKRET!
09:07
<
bnagy >
because 'next life you will be a pig' is inherently funnier than 'you will go to hell'
09:07
<
shevy >
does that word even exist?
09:07
<
shevy >
bnagy I wanna be a sloth
09:07
<
dr0id >
sup pigs :P
09:07
<
bnagy >
I'm pretty sure it's spelled 'sekrit' with an I
09:08
<
shevy >
hi masterpig dr0id
09:08
* dr0id
punches shevy
09:08
<
shevy >
reminds me of the book The Animal Farm
09:08
<
dr0id >
in the nose ...
09:08
<
shevy >
I think the books were the communists, but I already forgot
09:13
jondot has joined #ruby-lang
09:18
jondot has joined #ruby-lang
09:18
heftig has joined #ruby-lang
09:19
kitallis has joined #ruby-lang
09:23
tekin has joined #ruby-lang
09:26
z3r00ld has joined #ruby-lang
09:26
z3r00ld has quit [#ruby-lang]
09:27
gouthamvel has joined #ruby-lang
09:28
woollyams has joined #ruby-lang
09:29
gouthamvel has quit [#ruby-lang]
09:36
kitallis has joined #ruby-lang
09:37
<
erikh >
gonna have to rethink this whole thing, again, to work on celluloid
09:38
<
erikh >
not a bad thing; just time-consuming.
09:45
<
judofyr >
erikh: what'd you think about celluloid?
09:46
<
erikh >
I just implemented my own concurrency system for this project with 0mq before celluloid was released
09:46
<
erikh >
it's not as clean by a longshot, but it did work
09:46
<
erikh >
this way I get to outsource that work.
09:47
<
erikh >
damnit I think rubygems.org is down again
09:49
seoaqua has joined #ruby-lang
09:53
justinmcp has joined #ruby-lang
09:59
olesu has joined #ruby-lang
10:02
jondot has joined #ruby-lang
10:04
<
andrewvos >
judofyr: What theme is that on twitter?
10:06
<
andrewvos >
judofyr: The vim theme I mean
10:11
<
erikh >
looks like vividchalk
10:16
<
andrewvos >
erikh: Hmm will give it a try thanks. Been using solarized since it came out :/
10:17
wardrop has joined #ruby-lang
10:20
<
judofyr >
andrewvos: molokai I think
10:21
solars has joined #ruby-lang
10:23
<
erikh >
if you use macvim twilight is nice
10:23
* judofyr
uses vim in the terminal
10:23
<
andrewvos >
judofyr: Yeah it is I foudn it in your github :)
10:23
* judofyr
has dehipstered himself
10:23
<
andrewvos >
MacVim is for losers :)
10:24
<
andrewvos >
(just trolling)
10:24
<
andrewvos >
erikh: Wow that is quite nice
10:24
<
erikh >
yeah I like it a lot.
10:24
<
judofyr >
tmux is for winners \o/
10:24
<
Patterner >
feh is not a editor.
10:24
<
shevy >
emacs is the best OS.
10:24
<
andrewvos >
alias feh=vim
10:24
* judofyr
contemplates writing a new editor: feh
10:25
<
erikh >
feh is a graphics display tool
10:25
<
erikh >
but feh is also yiddish
10:25
<
erikh >
have some tmux
10:26
<
judofyr >
tmux + vimux is pretty cool
10:26
<
erikh >
dunno. never liked vim in the terminal
10:26
<
erikh >
unless i'm remote that is
10:27
<
judofyr >
erikh: I don't see any difference here really
10:27
<
judofyr >
I can just type <Leader>r and it runs the test in another window!
10:27
<
erikh >
I use conqueterm for that.
10:28
<
judofyr >
can't I write anything on the internet without you guys reading it? :(
10:28
<
erikh >
I follow injekt as well
10:28
<
judofyr >
well, how do you handle Norwegian then?
10:28
<
judofyr >
I thought so
10:29
cantonic has joined #ruby-lang
10:31
<
judofyr >
maybe I should write all my Ruby code with Norwegian variables and comments
10:32
wardrop has joined #ruby-lang
10:34
<
tobiasvl >
just with ae, oe and aa? :)
10:35
<
shevy >
they dont have
10:35
<
shevy >
I know the danes have some odd ae ~AE@ae ... character
10:36
<
tobiasvl >
same as the danes, yeah
10:36
Namenone has joined #ruby-lang
10:36
<
tobiasvl >
æÆ øØ åÅ
10:36
<
jaska >
same shit, different char
10:36
<
shevy >
one day all the umlauts will die
10:36
Sailias has joined #ruby-lang
10:36
<
Nameone >
Ruby newbie here!
10:37
<
Nameone >
Ive got a question, i want a hash where i can search either values or keys
10:37
<
manveru >
shevy: ä ü and ö you mean?
10:37
<
Nameone >
is this possible?
10:38
<
Tasser >
Nameone, you can invert a hash, but I assume you want a double-sided hash - might be somewhere in activesupport, but the ruby stdlib kinda sux for extensive data types, most is covered via hash and array
10:38
<
Nameone >
Tasser: Thanks! Im trying to make a hash full of country codes, country abbreviations and dialling codes
10:38
<
Nameone >
would you recommend 3 different hashes?
10:39
<
Tasser >
Nameone, I'm pretty sure there's a gem that does that ;-)
10:39
<
Nameone >
does what?;o
10:39
<
shevy >
manveru I cant read any of these :(
10:40
<
shevy >
I can read jaska just fine though
10:40
<
judofyr >
Nameone: you can also do {:a => 1}.key(1)
10:40
<
shevy >
I should start to learn finnish
10:40
<
judofyr >
Nameone: but it's not as fast
10:40
<
manveru >
shevy: that's because you're not using unicode :)
10:40
<
Nameone >
Cheers! ill check the gem out!
10:40
<
Nameone >
wonder if it has all three data sets in there
10:40
<
Tasser >
Nameone, probably not, but you can recycle their source :-)
10:41
<
Nameone >
Tasser: true! Thanks
10:41
<
shevy >
I like that Nameone seems so excited
10:42
<
judofyr >
shevy: now you make sounds like we're never happy in here :(
10:43
<
shevy >
normal happy
10:43
francisfish has joined #ruby-lang
10:43
<
shevy >
but not the excited! happy!
10:44
<
shevy >
cheers! let's kiss!
10:46
<
Nameone >
Haha, thanks for the mockery .
10:53
mattyoho has joined #ruby-lang
10:55
olesu has joined #ruby-lang
11:00
seanstickle has joined #ruby-lang
11:01
kvirani has joined #ruby-lang
11:02
<
erikh >
hash = { 1 => "one", 2 => "two" }; Hash[hash.values.zip(hash.keys)]
11:03
<
erikh >
be warned you're going to have issues with that.
11:04
Foxmaster has joined #ruby-lang
11:04
tjadc has joined #ruby-lang
11:07
<
manveru >
erikh: you mean hash.invert ?
11:07
<
rippa >
inverted moongoats
11:10
<
erikh >
manveru: didn't know about that one.
11:11
<
manveru >
also values/zip/keys is worse than Hash[hash.map{|k,v| [v,k] }]
11:14
leopard_me has joined #ruby-lang
11:15
<
judofyr >
but zip is so awesome!
11:16
<
Nameone >
N00b question, downloaded a gem, how do i go about running it?
11:17
<
judofyr >
Nameone: just run "gem install gem-name"
11:18
<
Nameone >
ok cool, I'm wanting to edit the gem a little
11:18
<
Nameone >
theres no way to run the commands through irb ?
11:19
<
judofyr >
Nameone: "gem unpack name.gem"
11:19
<
andrewvos >
Damn vimux is quite nice
11:19
<
andrewvos >
SO much easier
11:19
hahuang65 has joined #ruby-lang
11:19
<
andrewvos >
I don't wat to know the bloody names of my session/etc like in tslime
11:20
<
judofyr >
andrewvos: I have <Leader>r mapped to RunLastTmuxCommand (or whatever it is)
11:20
<
judofyr >
andrewvos: so I just type: RunRubyFocusedTest
11:20
<
judofyr >
then <Leader>r to iterate
11:21
<
andrewvos >
judofyr: I manually map my commands when I need them.
11:21
<
andrewvos >
judofyr: I don't have the luxury of working in one language :)
11:21
<
judofyr >
andrewvos: that's the nice thing: my mapping <Leader>r to RunLastTmuxCommand, it doesn't matter what language
11:21
<
andrewvos >
Hmm true
11:22
<
judofyr >
andrewvos: you just need to set it up once :call RunTmuxWhateverItIs("…")
11:22
<
andrewvos >
Oh ok I get it!
11:22
<
andrewvos >
Amazing
11:22
<
andrewvos >
Excellent
11:23
<
judofyr >
andrewvos: it's truly an awesome workflow
11:24
Sailias has joined #ruby-lang
11:25
<
andrewvos >
judofyr: Thanks!
11:26
<
andrewvos >
judofyr: Very cool
11:28
roha has joined #ruby-lang
11:29
rzys has joined #ruby-lang
11:44
Hakon|mbp has joined #ruby-lang
11:44
<
andrewvos >
Nameone: You need to install a gem?
11:45
<
yorickpeterse >
Nameone: paste the code in a pastebin as well, but this gives you a hint: "`require': cannot load such file -- iso_country_codes (LoadError)"
11:45
tbuehlmann has joined #ruby-lang
11:45
<
yorickpeterse >
It means it can't load the file, which can mean 1. it's a non installed gem 2. it's a non found file
11:46
<
Nameone >
damn n00b brain
11:46
<
Nameone >
you were correct, i forgot to do gem install
11:46
<
Nameone >
i did the git clone first for the source
11:48
<
Nameone >
#!/usr/bin/env ruby
11:48
<
Nameone >
require 'iso_country_codes'
11:48
<
Nameone >
code = IsoCountryCodes.find('au')
11:48
<
Nameone >
print code
11:49
<
Nameone >
if i run that .rb file in terminal, it should print no?
11:49
<
yorickpeterse >
If the gem actually works, yes
11:50
rzys has joined #ruby-lang
11:50
roha has joined #ruby-lang
11:53
<
Harzilein >
Nameone: maybe use print, otherwise your shell prompt might overwrite it
11:54
<
yorickpeterse >
Harzilein: "print code" he is :)
11:57
<
Harzilein >
"maybe use puts instead of print"
11:58
<
yorickpeterse >
Ah yeah, that would be correct :)
11:58
<
Nameone >
got it working cheers
11:58
<
Nameone >
if i want to use a gem which is on my local machine
11:59
<
Nameone >
do i do a require'/directory/gem'?
11:59
<
Harzilein >
Nameone: no
12:00
<
judofyr >
Nameone: do $LOAD_PATH << 'directory/gem/lib'
12:00
<
judofyr >
Nameone: then you can require as usual
12:00
<
Nameone >
judofyr: gem 'ruby-mysql', :path => "vendor/static_gems/ruby-mysql-2.9.3"
12:00
<
Nameone >
should work too?
12:00
<
yorickpeterse >
That is if you use bundler
12:00
<
judofyr >
Nameone: in Gmefile, yes
12:00
<
shevy >
ewwww bundler
12:01
<
yorickpeterse >
Lets not discuss that, might as well discuss Vim + Emacs and the whole load :)
12:01
<
judofyr >
Emacs sux lol
12:01
Foxmaster has joined #ruby-lang
12:01
<
shevy >
I think both suck
12:08
mssola has joined #ruby-lang
12:09
datanoise has joined #ruby-lang
12:11
jtoy has joined #ruby-lang
12:12
Fullmoon has joined #ruby-lang
12:12
jperry has joined #ruby-lang
12:15
heftig has joined #ruby-lang
12:16
francisfish has joined #ruby-lang
12:17
wardrop has joined #ruby-lang
12:19
<
Nameone >
Woo finally getting the hang of it!
12:20
<
judofyr >
Nameone: \o/
12:21
jobicoppola has joined #ruby-lang
12:24
<
Nameone >
Much appreciated for the help guys!
12:26
gd_ has joined #ruby-lang
12:27
mistym has joined #ruby-lang
12:29
<
gd_ >
I'm using rack to implement a simple mock service which recieves a lot requests/s. Now I'm facing that my windows system is running out of sockets cause they are all in TIME_WAIT state. Even if i just do def call; return Rack::Response.new.finish; end
12:29
<
gd_ >
Is there a way to get around this?
12:29
<
gd_ >
Not by tuning my systems socket layer but my code...
12:29
tomzx has joined #ruby-lang
12:30
<
heftig >
the client isn't closing the socket
12:30
<
Nameone >
gsub is being a little annoying with the + character I'm trying to replace, any idea why?
12:31
<
gd_ >
heftig: http = Net::HTTP.new(@host, @port); res = http.request_post(path, body, {'Content-Type' => "'application/soap+xml'"} )
12:31
<
Nameone >
cc2 = country_code.gsub(/+/, 'replaced ')
12:31
<
Nameone >
target of repeat operator is not specified: /+/
12:31
<
gd_ >
heftig: i thought it is closed right after the method call?!
12:33
<
heftig >
apparently not.
12:33
<
judofyr >
gd_: use the block form to automatically close
12:34
<
judofyr >
"Net::HTTP::start immediately creates a connection to an HTTP server which is kept open for the duration of the block."
12:34
<
judofyr >
"If you wish to re-use a connection across multiple HTTP requests without automatically closing it you can use ::new instead of ::start. request will automatically open a connection to the server if one is not currently open. You can manually close the connection with finish."
12:35
<
gd_ >
judofyr: :) thnx a lot
12:37
wardrop has joined #ruby-lang
12:39
<
Nameone >
or am i doing it completely wrong
12:39
loggerbot711321 has joined #ruby-lang
12:40
<
judofyr >
Nameone: /+/ doesn't make sense. /a+/ matches any number of "a". e.g. "a", "aa", "aaa", "aaaa"
12:40
<
judofyr >
Nameone: if you want a plus, you must escape it
12:41
<
Nameone >
escape it?
12:41
<
Nameone >
if the input has a plus, i want it removed
12:42
<
Nameone >
i was using an if statement before, but it seems to long winded
12:42
machine1 has joined #ruby-lang
12:42
<
Nameone >
thought it would be possible with gsub?
12:42
<
tobiasvl >
do you know what escaping is
12:42
<
Nameone >
no :( (still a n00b)
12:42
<
judofyr >
Nameone: simply place a \ in front of it as tobiasvl said :)
12:42
<
tobiasvl >
the reason it says "target of repeat operator is not specified: /+/" is that + is a special character in that context
12:43
<
tobiasvl >
so you need to tell ruby that you actually mean a literal plus sign
12:43
<
judofyr >
Nameone: in this case, you can also just use a string: .gsub("+", "")
12:43
<
tobiasvl >
yeah, that's probably easier
12:43
<
tobiasvl >
correcting myself: + is a special character when it's placed between two slashes (when it's inside a regular expression)
12:44
<
tobiasvl >
Nameone: hehe, no
12:44
<
Nameone >
=[ (feel stupid)
12:44
<
tobiasvl >
you just need "" or // around the +
12:44
<
tobiasvl >
not both
12:44
<
tobiasvl >
and you just need the \ if you're using the slashes
12:44
<
tobiasvl >
so either "+" or /\+/
12:44
<
Nameone >
correct! Thanks for taht
12:44
<
Nameone >
someone was saying to put it in an if statement, is it worth doing?
12:45
<
Nameone >
'if + is found using gsub, do this'
12:45
<
tobiasvl >
well, that depends
12:45
<
judofyr >
Nameone: if you use .gsub it will always return a copy and you can't really figure out if it matched or not
12:45
<
tobiasvl >
do you want to do anything in particular if + is found?
12:46
<
Nameone >
basically, if a user inputs +449384567 as a telephone number
12:46
<
Nameone >
i want it to get rid of the +
12:46
mstratman has joined #ruby-lang
12:46
<
Nameone >
and then use that variable in another part of my code
12:46
jtoy has joined #ruby-lang
12:47
<
judofyr >
Nameone: so if input is: "Hello +123 world +456", you want to convert it to "Hello 123 world 456" and store [123, 456] ?
12:47
<
Nameone >
They will only be inputting numbers, but along those lines yes
12:47
<
heftig >
+ is a valid part of a telephone number, you shouldn't strip that
12:47
<
Nameone >
the way the numbers are stored are without the +
12:48
<
heftig >
telephone numbers are not decimal numbers
12:48
<
Nameone >
so are strings no?
12:48
<
Nameone >
(excuse my stupidity)
12:49
<
heftig >
telephone numbers are strings with certain formatting, which is location-dependent
12:49
<
tobiasvl >
yeah, telephone numbers are strings
12:50
<
Tasser >
right, the american way to describe phone numbers with letters :-)
12:50
<
tobiasvl >
well, that's not really relevant
12:51
<
tobiasvl >
strings can consist solely of numbers, no problem
12:51
<
tobiasvl >
you wouldn't add two phone numbers, would you
12:51
nofxxxx has joined #ruby-lang
12:51
wardrop has joined #ruby-lang
12:51
grin has joined #ruby-lang
12:51
<
Tasser >
one cultural thing from america that would even be worth importing
12:52
Slackwise has joined #ruby-lang
12:54
<
Nameone >
eg isocountrycodes.find(44)
12:54
<
Nameone >
which would find the country
12:54
bglusman has joined #ruby-lang
12:54
<
tobiasvl >
aha, thats's why you asked about reversing a hash earlier?
12:54
dv310p3r has joined #ruby-lang
12:55
<
Nameone >
find the best way to do ti =[
12:55
<
Nameone >
all new to me ruby
12:55
<
judofyr >
Nameone: have you tried isocountrycodes.find(44) ?
12:55
<
tobiasvl >
i think it already supports it?
12:55
<
tobiasvl >
i'm reading the documentation now
12:56
<
Nameone >
it did work
12:56
mistym has joined #ruby-lang
12:56
<
Nameone >
however it returned the bahamas
12:56
<
Nameone >
instead of the uk
12:56
<
Nameone >
bahamas = 044
12:56
<
Nameone >
oh wait hold on
12:57
<
judofyr >
Nameone: I don't think it's the telephone prefix
12:57
<
Nameone >
yeah,i just figured
12:57
grin has joined #ruby-lang
12:57
<
Nameone >
i edited the first entry for telephone not the rest
12:58
<
Nameone >
if i add my own variable in the rb file for telephone numbers
12:58
<
Nameone >
should be simple to parse?
12:58
<
Nameone >
or will i need to recode the whole thing
12:59
sandbags has joined #ruby-lang
12:59
hynkle has joined #ruby-lang
13:02
<
Nameone >
guess i might swell go through and add all the calling codes =[
13:03
<
tobiasvl >
there might even be a gem for it though
13:04
<
tobiasvl >
you should research that before doing all the tedious work yourself
13:04
<
tobiasvl >
ah, there's a YAML file in that first link, you can just serialize that
13:07
<
Nameone >
hmm, thing is the gem already comes with its own .rb file which has all of the data
13:07
<
Nameone >
for each country on it
13:07
<
Nameone >
including abbreviations etc
13:13
imajes has joined #ruby-lang