我刚刚完成了 Julia 的最低限度基础知识,为了更好地理解结构,我尝试解决一些简单的问题。
如果我有一个自定义结构 say ,则创建一个sayHttpRequest数组。HttpRequest ArrayssampleArr
HttpRequest Array我的要求是动态更新sampleArr[index].
在尝试时append!出现以下错误
ERROR: LoadError: MethodError: no method matching length(::HttpRequest)
以下代码可以用作我想要做的事情的示例
#!/usr/bin/env julia
struct HttpRequest
httpMethod
httpHost
httpBlah
end
reqA = HttpRequest("GET", "1.1.1.1", "yada")
reqB = HttpRequest("PUT", "1.1.1.1", "blah")
reqC = HttpRequest("GET", "2.3.2.3", "boka")
reqD = HttpRequest("POST", "8.1.8.1", "juka")
reqE = HttpRequest("PUT", "4.4.4.4", "kula")
sampleArrLen = 10
sampleArr = Array{Array, 1}(undef,sampleArrLen)
sampleArr[5] = [reqA]
append!(sampleArr[5], reqB)
Run Code Online (Sandbox Code Playgroud) 带有Ruby 1.8.7和1.9.2的CentOS 64位服务器
{{没有RVM,需要它没有RVM ......目前所有的Ruby1.9.2二进制文件都是ruby19,同样可以访问,因此没有gem-path或任何类型的任何映射}}}
安装gem'mysql2'时出错...
我安装了所有依赖项,并且都是64位版本 ...
所有错误都属于{./client.h:13:错误:重新定义typedef'rb_unblock_function_t'}
{#warning rubysig.h是否过时}可能是一个原因吗?
控制台捕获:
#gem19 install mysql2 -v 0.2.7 -- --with-mysql-dir=/usr/bin --with-mysql-config=/usr/bin/mysql_config --with-mysql-include=/usr/include/mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/bin/ruby19 extconf.rb --with-mysql-dir=/usr/bin --with-mysql-config=/usr/bin/mysql_config --with-mysql-include=/usr/include/mysql
checking for rb_thread_blocking_region()... no
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
gcc -I. -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_MYSQL_H …Run Code Online (Sandbox Code Playgroud)