nuttycoder.com Report : Visit Site


  • Server:nginx/1.10.3 (Ubuntu...

    The main IP address: 46.101.200.180,Your server Germany,Frankfurt am Main ISP:Digital Ocean Inc.  TLD:com CountryCode:DE

    The description :home 作者 | authors 关于 | about rss feed « previous lua相关问题整理(4) – 让lua的eval函数支持赋值语句 by benny chen @ 10:11 pm - sunday november 28 2010 上一篇文章提到了在lua中实现类似于javascript中的eval函数,遗憾是该eval函数不支持赋值语句,原因是lua的赋值运算符...

    This report updates in 24-Jul-2018

Created Date:2009-09-17
Changed Date:2017-09-17

Technical data of the nuttycoder.com


Geo IP provides you such as latitude, longitude and ISP (Internet Service Provider) etc. informations. Our GeoIP service found where is host nuttycoder.com. Currently, hosted in Germany and its service provider is Digital Ocean Inc. .

Latitude: 50.115520477295
Longitude: 8.6841697692871
Country: Germany (DE)
City: Frankfurt am Main
Region: Hessen
ISP: Digital Ocean Inc.

HTTP Header Analysis


HTTP Header information is a part of HTTP protocol that a user's browser sends to called nginx/1.10.3 (Ubuntu) containing the details of what the browser wants and will accept back from the web server.

Content-Encoding:gzip
Transfer-Encoding:chunked
Vary:Accept-Encoding
Server:nginx/1.10.3 (Ubuntu)
Connection:keep-alive
Link:; rel="https://api.w.org/"
Date:Mon, 23 Jul 2018 21:04:33 GMT
Content-Type:text/html; charset=UTF-8

DNS

soa:ns-cloud-c1.googledomains.com. dns-admin.google.com. 9 21600 3600 1209600 300
ns:ns-cloud-c1.googledomains.com.
ns-cloud-c2.googledomains.com.
ns-cloud-c3.googledomains.com.
ns-cloud-c4.googledomains.com.
ipv4:IP:46.101.200.180
ASN:14061
OWNER:DIGITALOCEAN-ASN - DigitalOcean, LLC, US
Country:NL

HtmlToText

home 作者 | authors 关于 | about rss feed « previous lua相关问题整理(4) – 让lua的eval函数支持赋值语句 by benny chen @ 10:11 pm - sunday november 28 2010 上一篇文章提到了在lua中实现类似于javascript中的eval函数,遗憾是该eval函数不支持赋值语句,原因是lua的赋值运算符是不支持返回值。所以如果要让该eval函数也支持赋值语句,就需要一个额外的工作,让它鉴别一个语句是不是赋值语句,如果是,则return的是被赋值后变量的值。为此,我写了一个isassignmentexpression函数,比较粗糙,不过够用了,基本思想是检测语句中第一个出现的”=“操作符,且该”=“不能在一对引号当中。 -- lua code function isassignmentexpression( str ) local i = 1; local curchar; local quotestype = "none" -- none, single or double local isescaping = false curchar = string.sub( str, 1, 1 ) while ( curchar ~= "" ) do if ( curchar == "'" and isescaping == false and quotestype ~= "double" ) then if ( quotestype == "single" ) then quotestype = "none" elseif ( quotestype == "none" ) then quotestype = "single" end end if ( curchar == "\"" and isescaping == false and quotestype ~= "single" ) then if ( quotestype == "double" ) then quotestype = "none" elseif ( quotestype == "none" ) then quotestype = "double" end end if ( curchar == "\\" and isescaping == false ) then isescaping = true else isescaping = false end if ( curchar == "=" and quotestype == "none" ) then if ( string.sub( str, i+1, i+1 ) ~= "=" ) then return true, string.sub( str, 1, i - 1 ) else return false end end i = i + 1 curchar = string.sub( str, i, i ) end return false end function eval( str ) local bassign local var bassign, var = isassignmentexpression( str ) if ( bassign ) then print( "assignment, var=" .. var ) loadstring( str )() return loadstring( "return " .. var )() else return loadstring( "return " .. str )() end end -- 以下是一组测试 print( eval( "3+4" ) ) -- 7 function multiply( a, b ) return a*b end print( eval( "multiply( 3, 4 )" ) ) -- 12 print( eval( "i" ) ) -- nil print( eval( "i = 1" ) ) -- assignment, var=i -- 1 print( eval( "i = i + 1" ) ) -- assignment, var=i -- 2 print( eval( "i" ) ) -- 2 print( eval( "i+1" ) ) -- 3 print( eval( "i, j = 4, 5" ) ) -- assignment, var=i, j -- 4 5 print( eval( "i = {}" ) ) -- assignment, var=i -- table: 003cd818 print( eval( "i[ \"0\" ] = 0" ) ) -- assignment, var=i[ "0" ] -- 0 print( eval( "i[ \"\\\"0=\" ] = 1" ) ) -- assignment, var=i[ "\"0=" ] -- 1 print( eval( "i.name=\"hello\"" ) ) -- assignment, var=i.name -- hello print( eval( "i[0], i.name = 4" ) ) -- assignment, var=i[0], i.name -- 4 nil print( eval( "i == 10" ) ) -- false posted in: lua by benny chen 10 comments eval , lua , 赋值语句 lua相关问题整理(3) by benny chen @ 10:11 pm - sunday november 28 2010 在注册给lua的c函数中为lua提供默认参数 使用lual_optstring, lual_optnumber, lual_optinteger等lua api,如下示例,函数有一个默认字符串参数,默认值为””,这样在lua中调用whatever的时候,whatever()或者whatever( “whatever”)均可。(oh…whatever…随便…都行…) // c code int whatever( lua_state *l ) { string str = lual_optstring( l, 1, "" ); //...omitted code... } lua_register( l, "whatever", whatever ); 建立lua字符串到c enum的映射 使用lual_checkoption这个lua api,它可以把从lua传来的string转换为相应的c string array中的index,从而可以建立lua字符串和c enum的映射。以下是个简单的示例: // c code enum playertype { player_type_undefined = -1, player_type_king = 0, // 主公 player_type_insurgent, // 反贼 player_type_loyal, // 忠臣 player_type_treacherous, //内奸-_^ num_player_type // just a sentinel }; const char * const playertypelist[num_player_type + 1] = { "king", "insurgent", "loyal", "treacherous", null }; static int testplayertype( lua_state *l ) { playertype type = static_cast< playertype >( lual_checkoption( l, 1, "insurgent", playertypelist ) ); std::cout << "type index is " << type << " - " << playertypelist[type] << std::endl; return 0; } lua_register( l, "setplayertype", setplayertype ) 首先enum playertype定义了一组角色类型,来自人人都爱的三国杀:-)。 接着playertypelist定义了一个字符串数组,给lua使用。注意需要保证enum和字符串数组的对应,比如playertypelist[player_type_king]是“king”,同时,playertypelist必须以null结尾。 在定义给lua的函数testplayertype中,就可以用lual_checkoption将lua传来的字符串参数转换为相应enum的值。lual_checkoption还支持默认参数,比如在上面例子中,将第三个参数设为“insurgent”,如果lua中没有提供任何参数,则playertype就为与“insurgent”相对应的player_type_insurgent。 以下是一组测试及结果: --lua code testplayertype( "king" ) -- type index is 0 - king testplayertype() -- type index is 1 - insurgent testplayertype( "whatever" ) -- bad argument #1 to 'testplayertype' (invalid option 'whatever') 在lua中实现eval函数 众所周知,javascript中有一个著名的eval函数,它用于把一个字符串当作一段js代码去执行,在lua中没有提供类似的函数,但稍微包装下lua的库函数loadstring即可实现,以下是代码。 --lua code function eval( str ) local func = loadstring( "return " ..str ); return func() end 这样已经可以了,不过相比于js的eval函数,功能稍微差一些,因为它不支持赋值语句,这是lua语言天然的原因,因为lua的赋值运算符没有返回值,在其他语言中常见传递赋值的“i=j=1”(先赋值j=1,然后将(j=1)的返回值j赋值给i),在lua中是不允许的。所以当eval执行的是赋值运算(比如i=1)的时候,return i=1就会出错。 下面是一些测试例子: --lua code print( eval( "3+4" ) ) -- ok, 打印7 function multiply( a, b ) return a*b end print( eval( "multiply( 3, 4 )" ) ) -- ok,打印12 print( eval( "i = 1" ) ) -- 错误, attempt to call a nil value i = 1 print( eval( "i" ) ) -- ok,打印1 print( eval( "i = i + 1" ) ) -- 错误, attempt to call a nil value 实现lual_checkbool 不知道为什么lua的api没有提供lual_checkbook函数,不过很容易实现: // c code bool lual_checkbool( lua_state *luavm, int numarg ) { bool b = false; if ( lua_type( l, numarg ) == lua_tboolean ) { b = lua_toboolean( l, numarg ); } else { lual_typerror( l, numarg, lua_typename( l, lua_tboolean ) ) } return b; } posted in: lua by benny chen 1 comment enum , eval , lua , lual_checkbool , 默认参数 lua相关问题整理(2) – 如何在c中为lua提供同步调用接口 by benny chen @ 12:11 pm - monday november 08 2010 这个问题的具体描述是——c注册给lua一个函数,但lua调用该c函数并不能立即获得结果(比如需要访问远程服务器获取值),如何能让lua停止并等待,直到获取到结果后,才继续执行接下来的脚本。 举个例子,比如说有一个c函数login,我们试图通过调用该函数以执行用户的登录操作并获取验证结果。首先看下面这段c代码: // c code int login( lua_state *l ) { string user = lual_checkstring( l, 1 ); string password = lual_checkstring( l, 2 ); // 该函数将user和password发送到服务器后立即返回, // 绝不要在此处阻塞,这将严重影响效率 sendauthenticationinfo( user, password ); return 0; } // 注册给lua lua_register( l, "login", login ); 可以看到,因为该函数需要访问远程的登录服务器,在系统中一般都采取异步操作(让系统阻塞等待结果是不可接受的)。但是这样lua开发人员调用login函数时,也只能异步等待结果,下面是lua中处理登录操作的代码。 -- lua code -- 当用户点击“登陆”按钮后,执行该函数 function onclickloginbtn() local user = ... local password = ... login( user, password ) -- 只是发送login命令 end --当获取login结果后的回调函数 function ongetloginresult( bpass ) if bpass == true then print( "authentication succeeded." ) ...omitted code... else print( "authentication failed." ) ...omitted code... end end 这段lua代码很好理解,首先onclickloginbtn是一个按钮事件处理函数,当用户点击了”登录“按钮后,会触发该函数。该函数首先从界面上获取用户输入的user和password,然后调用了上面c中所定义的login函数。正如前面的c代码所写的,login函数不会马上得到认证结果,所以执行后马上退出。另一个函数是ongetloginresult,这个lua函数需要当c系统中获取到认证结果后被回调执行,以真正执行login的后续操作。所以,我们还需要在c中添加回调的代码。 // c code // 当服务器端返回认证结果后 bool loginresult = ... lua_getglobal( l, "ongetloginresult" ); lua_pushboolean( l, loginresult ); lua_call( l, 1, 0 ); 在这里,我们在c中hardcode了回调ongetloginresult的代码,这很丑陋,不过可以避免,比如可以给前面注册给lua的login函数增加一个参数callbackfunctionname,以让lua显式的告诉系统当获取登录结果后的回调函数名称。 再次回到本文一开始所提出的问题,尽管在系统中的异步调用不可避免,但我们希望在lua中能够有同步机制,即lua脚本在得到验证结果后才允许被继续执行,如何才能做到这一点呢。 lua有一个非常棒的coroutine机制,在lua代码中可以通过协同程序来进行多线程,可以使用coroutine.yield和coroutine.resume来对协同程序进行挂起和恢复。需要达到上面所提出的目标,只需在系统中使用与coroutine.yield和coroutine.resume相对应的lua c api——lua_yield和lua_resume即可。如下所示,login函数有些小改变: // c code int login( lua_state *l ) { string user = lual_checkstring( l, 1 ); string password = lual_checkstring( l, 2 ); sendauthenticationinfo( user, password ); return lua_yield( l, 0 ); } // 注册给lua lua_register( l, "login", login ); 可以看到,与前面的区别只有login函数的最后一句,调用了lua_yield后再返回,而不是return 0,这样就可以达到阻塞lua脚本的目的。事实是,lua_yield是一个比较特殊的函数,它只能作为注册的c函数的返回值使用,否则调用失败。 当系统获得服务器端的登陆验证结果后,通过lua_resume即可恢复之前被阻塞的lua。 // c code // 当服务器端返回认证结果后 bool loginresult = ... lua_pushboolean( l, loginresult ); lua_resume( l, 1 ); 上面的代码是当你的系统中只有一个lua虚拟机的情形,如果使用了多个lua虚拟机,事情稍微有一点点复杂,login函数还需要将当前调用的lua_state存储下来,以便lua_resume的时候,可以知道恢复的是哪一个被阻塞的虚拟机。 ok,当c中有这样的实现后,lua程序人员将会为此而高兴,因为lua代码变得如此简洁。 -- lua code -- 当用户点击“登陆”按钮后,执行该函数 function onclickloginbtn() local user = ... local password = ... if login( user, password ) == true then print( "authentication succeeded." ) ...omitted code... else print( "authentication failed." ) ...omitted code... end end 系统or平台开发人员应当尽可能的为用户考虑,正如上面第二种解决方法所追求的那样。 posted in: lua , 游戏开发 | game programming by benny chen 4 comment

URL analysis for nuttycoder.com




Whois Information


Whois is a protocol that is access to registering information. You can reach when the website was registered, when it will be expire, what is contact details of the site with the following informations. In a nutshell, it includes these informations;

Domain Name: NUTTYCODER.COM
Registry Domain ID: 1569408922_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.google.com
Registrar URL: http://domains.google.com
Updated Date: 2017-09-17T19:16:41Z
Creation Date: 2009-09-17T19:15:43Z
Registry Expiry Date: 2018-09-17T19:15:43Z
Registrar: Google Inc.
Registrar IANA ID: 895
Registrar Abuse Contact Email: [email protected]
Registrar Abuse Contact Phone: +1.8772376466
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Name Server: NS-CLOUD-C1.GOOGLEDOMAINS.COM
Name Server: NS-CLOUD-C2.GOOGLEDOMAINS.COM
Name Server: NS-CLOUD-C3.GOOGLEDOMAINS.COM
Name Server: NS-CLOUD-C4.GOOGLEDOMAINS.COM
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois database: 2017-11-18T17:14:46Z <<<

For more information on Whois status codes, please visit https://icann.org/epp

NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.

TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.

  REGISTRAR Google Inc.

SERVERS

  SERVER com.whois-servers.net

  ARGS domain =nuttycoder.com

  PORT 43

  TYPE domain

DOMAIN

  NAME nuttycoder.com

  CHANGED 2017-09-17

  CREATED 2009-09-17

STATUS
clientTransferProhibited https://icann.org/epp#clientTransferProhibited

NSERVER

  NS-CLOUD-C1.GOOGLEDOMAINS.COM 216.239.32.108

  NS-CLOUD-C2.GOOGLEDOMAINS.COM 216.239.34.108

  NS-CLOUD-C3.GOOGLEDOMAINS.COM 216.239.36.108

  NS-CLOUD-C4.GOOGLEDOMAINS.COM 216.239.38.108

  REGISTERED yes

Go to top

Mistakes


The following list shows you to spelling mistakes possible of the internet users for the website searched .

  • www.unuttycoder.com
  • www.7nuttycoder.com
  • www.hnuttycoder.com
  • www.knuttycoder.com
  • www.jnuttycoder.com
  • www.inuttycoder.com
  • www.8nuttycoder.com
  • www.ynuttycoder.com
  • www.nuttycoderebc.com
  • www.nuttycoderebc.com
  • www.nuttycoder3bc.com
  • www.nuttycoderwbc.com
  • www.nuttycodersbc.com
  • www.nuttycoder#bc.com
  • www.nuttycoderdbc.com
  • www.nuttycoderfbc.com
  • www.nuttycoder&bc.com
  • www.nuttycoderrbc.com
  • www.urlw4ebc.com
  • www.nuttycoder4bc.com
  • www.nuttycoderc.com
  • www.nuttycoderbc.com
  • www.nuttycodervc.com
  • www.nuttycodervbc.com
  • www.nuttycodervc.com
  • www.nuttycoder c.com
  • www.nuttycoder bc.com
  • www.nuttycoder c.com
  • www.nuttycodergc.com
  • www.nuttycodergbc.com
  • www.nuttycodergc.com
  • www.nuttycoderjc.com
  • www.nuttycoderjbc.com
  • www.nuttycoderjc.com
  • www.nuttycodernc.com
  • www.nuttycodernbc.com
  • www.nuttycodernc.com
  • www.nuttycoderhc.com
  • www.nuttycoderhbc.com
  • www.nuttycoderhc.com
  • www.nuttycoder.com
  • www.nuttycoderc.com
  • www.nuttycoderx.com
  • www.nuttycoderxc.com
  • www.nuttycoderx.com
  • www.nuttycoderf.com
  • www.nuttycoderfc.com
  • www.nuttycoderf.com
  • www.nuttycoderv.com
  • www.nuttycodervc.com
  • www.nuttycoderv.com
  • www.nuttycoderd.com
  • www.nuttycoderdc.com
  • www.nuttycoderd.com
  • www.nuttycodercb.com
  • www.nuttycodercom
  • www.nuttycoder..com
  • www.nuttycoder/com
  • www.nuttycoder/.com
  • www.nuttycoder./com
  • www.nuttycoderncom
  • www.nuttycodern.com
  • www.nuttycoder.ncom
  • www.nuttycoder;com
  • www.nuttycoder;.com
  • www.nuttycoder.;com
  • www.nuttycoderlcom
  • www.nuttycoderl.com
  • www.nuttycoder.lcom
  • www.nuttycoder com
  • www.nuttycoder .com
  • www.nuttycoder. com
  • www.nuttycoder,com
  • www.nuttycoder,.com
  • www.nuttycoder.,com
  • www.nuttycodermcom
  • www.nuttycoderm.com
  • www.nuttycoder.mcom
  • www.nuttycoder.ccom
  • www.nuttycoder.om
  • www.nuttycoder.ccom
  • www.nuttycoder.xom
  • www.nuttycoder.xcom
  • www.nuttycoder.cxom
  • www.nuttycoder.fom
  • www.nuttycoder.fcom
  • www.nuttycoder.cfom
  • www.nuttycoder.vom
  • www.nuttycoder.vcom
  • www.nuttycoder.cvom
  • www.nuttycoder.dom
  • www.nuttycoder.dcom
  • www.nuttycoder.cdom
  • www.nuttycoderc.om
  • www.nuttycoder.cm
  • www.nuttycoder.coom
  • www.nuttycoder.cpm
  • www.nuttycoder.cpom
  • www.nuttycoder.copm
  • www.nuttycoder.cim
  • www.nuttycoder.ciom
  • www.nuttycoder.coim
  • www.nuttycoder.ckm
  • www.nuttycoder.ckom
  • www.nuttycoder.cokm
  • www.nuttycoder.clm
  • www.nuttycoder.clom
  • www.nuttycoder.colm
  • www.nuttycoder.c0m
  • www.nuttycoder.c0om
  • www.nuttycoder.co0m
  • www.nuttycoder.c:m
  • www.nuttycoder.c:om
  • www.nuttycoder.co:m
  • www.nuttycoder.c9m
  • www.nuttycoder.c9om
  • www.nuttycoder.co9m
  • www.nuttycoder.ocm
  • www.nuttycoder.co
  • nuttycoder.comm
  • www.nuttycoder.con
  • www.nuttycoder.conm
  • nuttycoder.comn
  • www.nuttycoder.col
  • www.nuttycoder.colm
  • nuttycoder.coml
  • www.nuttycoder.co
  • www.nuttycoder.co m
  • nuttycoder.com
  • www.nuttycoder.cok
  • www.nuttycoder.cokm
  • nuttycoder.comk
  • www.nuttycoder.co,
  • www.nuttycoder.co,m
  • nuttycoder.com,
  • www.nuttycoder.coj
  • www.nuttycoder.cojm
  • nuttycoder.comj
  • www.nuttycoder.cmo
Show All Mistakes Hide All Mistakes