[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby questions

Jeff M.

1/8/2008 7:01:00 PM

Hello, peeps. I'm dipping my feet into Ruby waters (from Smalltalk).
Just have some questions that I hope someone doesn't mind answering.
I'm on OS X 10.5.

I see that Ruby 1.9 is out and Leopard shipped with 1.8.6. I also
heard that 1.9 would introduce a new VM that would be significantly
faster than 1.8. Is that the case? If so, is there a standard way of
getting 1.9 on OS X or am I kinda stuck waiting for Apple to "do their
thing"?

I'm primarily playing around with GLUT and OpenGL in Ruby for fun.
This required getting ruby-opengl through gems (note: I think the idea
of gems is slick!). However, if I ever wanted to distribute my code or
a program, is there a proper way of distributing everything needed
with it? Is there a way of generating native executables or at least
combining the ruby executable with the source so that 2 years from now
my program still runs the same even though I have version 3.8 of ruby?

Perhaps I've missed this in documentation, but am I able to extend a
class without subclassing? Something akin to "loose methods" in
Smalltalk?

Anyway, thanks for taking the time to read/answer any of these. I
appreciate it.

Jeff M.
27 Answers

Jan Dvorak

1/8/2008 7:16:00 PM

0

On Tuesday 08 January 2008 20:05:03 Jeff M. wrote:
> I'm primarily playing around with GLUT and OpenGL in Ruby for fun.
> This required getting ruby-opengl through gems (note: I think the idea
> of gems is slick!). However, if I ever wanted to distribute my code or
> a program, is there a proper way of distributing everything needed
> with it? Is there a way of generating native executables or at least
> combining the ruby executable with the source so that 2 years from now
> my program still runs the same even though I have version 3.8 of ruby?

Try rubyscript2exe for this, it builds binary with your script, ruby
interpreter and required extensions and libraries inside.

Jan

James Gray

1/8/2008 7:27:00 PM

0

On Jan 8, 2008, at 1:05 PM, Jeff M. wrote:

> Hello, peeps. I'm dipping my feet into Ruby waters (from Smalltalk).

Hello and welcome to Ruby.

> I see that Ruby 1.9 is out and Leopard shipped with 1.8.6. I also
> heard that 1.9 would introduce a new VM that would be significantly
> faster than 1.8. Is that the case?

It is faster in many cases, slightly slower in a few, and similar
speed in some others.

> If so, is there a standard way of getting 1.9 on OS X or am I kinda
> stuck waiting for Apple to "do their thing"?

The important thing to know is that Ruby 1.9 is currently a
"development release." It has known problems. The core team is
sorting those out, but it's going to take a little time to firm up.
Thus, as a new user, I recommend you stick with 1.8.6 for now to avoid
running into any of these issues.

To answer your question though: you do not have to wait for Apple to
upgrade Ruby for you, no. Many of us keep our own build (in /usr/
local) and update it as we desire.

> However, if I ever wanted to distribute my code or
> a program, is there a proper way of distributing everything needed
> with it?

Short answer: yes.

Longer answer: how you handle this depends on how you distribute your
software. Gems can have dependencies, for example. There are also
some all-in-one-executable solutions.

> Perhaps I've missed this in documentation, but am I able to extend a
> class without subclassing? Something akin to "loose methods" in
> Smalltalk?

Sure. Ruby has open classes, so we can add methods to them at any time:

$ irb
>> class String
>> def to_rot13
>> tr 'a-zA-Z', 'n-za-mN-ZA-M'
>> end
>> end
=> nil
>> "James Edward Gray II".to_rot13
=> "Wnzrf Rqjneq Tenl VV"

Hope that helps.

James Edward Gray II

Joe

1/9/2008 1:20:00 AM

0

On Jan 8, 2008 2:05 PM, Jeff M. <massung@gmail.com> wrote:
> Hello, peeps. I'm dipping my feet into Ruby waters (from Smalltalk).
> Just have some questions that I hope someone doesn't mind answering.
> I'm on OS X 10.5.
>
> I see that Ruby 1.9 is out and Leopard shipped with 1.8.6. I also
> heard that 1.9 would introduce a new VM that would be significantly
> faster than 1.8. Is that the case? If so, is there a standard way of
> getting 1.9 on OS X or am I kinda stuck waiting for Apple to "do their
> thing"?
>
> I'm primarily playing around with GLUT and OpenGL in Ruby for fun.
> This required getting ruby-opengl through gems (note: I think the idea
> of gems is slick!). However, if I ever wanted to distribute my code or
> a program, is there a proper way of distributing everything needed
> with it? Is there a way of generating native executables or at least
> combining the ruby executable with the source so that 2 years from now
> my program still runs the same even though I have version 3.8 of ruby?

rubyscript2exe is windows only.
there is a package to make it a tar, but the user will still have to
install the gems you depend on if I understand it correctly.

Honestly, the best way I've seen to distribute a ruby app to actual
users that I've seen is JRuby. Compile your program to java bytecode
and you can distribute it in a jar.

The last time this came up some people talked about starkits in tcl,
and suggested something like that for ruby, but it didn't really go
anywhere.

I believe one of the goals in rubinius is to have something similar to
jar for ruby, but i could be wrong about that.
>
> Perhaps I've missed this in documentation, but am I able to extend a
> class without subclassing? Something akin to "loose methods" in
> Smalltalk?
>
> Anyway, thanks for taking the time to read/answer any of these. I
> appreciate it.
>
> Jeff M.
>
>

Joel VanderWerf

1/9/2008 2:31:00 AM

0

Joe wrote:
> rubyscript2exe is windows only.

Works fine on linux.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Joe

1/9/2008 2:58:00 AM

0

sorry, my mistake. The name of it always makes me think windows only.
It can run on all platforms, but it's not a cross platform solution.
The exe generated is only for the platform it's running on.

On Jan 8, 2008 9:30 PM, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:
> Joe wrote:
> > rubyscript2exe is windows only.
>
> Works fine on linux.
>
> --
> vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
>
>

Jan Dvorak

1/9/2008 3:41:00 AM

0

On Wednesday 09 January 2008 03:58:17 Joe wrote:
> Honestly, the best way I've seen to distribute a ruby app to actual
> users that I've seen is JRuby. Compile your program to java bytecode
> and you can distribute it in a jar.
What about extensions ? (ruby-opengl in this case)

> sorry, my mistake. The name of it always makes me think windows only.
> It can run on all platforms, but it's not a cross platform solution.
> The exe generated is only for the platform it's running on.

Technically speaking this is not cross-platform solution either, as the
bytecode runs only on the Java platform. For distribution you're just trading
dependency on ruby interpreter for dependency on java bytecode interpreter.

Tools like rubyscript2exe will get you OS-dependent binary, but it is
self-sustained and will run without any other dependencies.

Jan

Joe

1/9/2008 3:54:00 AM

0

On Jan 8, 2008 10:41 PM, Jan Dvorak <jan.dvorak@kraxnet.cz> wrote:
> On Wednesday 09 January 2008 03:58:17 Joe wrote:
> > Honestly, the best way I've seen to distribute a ruby app to actual
> > users that I've seen is JRuby. Compile your program to java bytecode
> > and you can distribute it in a jar.
> What about extensions ? (ruby-opengl in this case)

Java OpenGL extensions are available. I don't mean to push JRuby so
hard, but when looking for a good distribution mechanism a while back
it's the best i could find. It'd also work on platforms I don't own.
I don't have a mac, but I'd like software i write to be able to run on
it. I don't expect my users to use the command line to start the
program. I guess other people have different requirements.

>
> > sorry, my mistake. The name of it always makes me think windows only.
> > It can run on all platforms, but it's not a cross platform solution.
> > The exe generated is only for the platform it's running on.
>
> Technically speaking this is not cross-platform solution either, as the
> bytecode runs only on the Java platform. For distribution you're just trading
> dependency on ruby interpreter for dependency on java bytecode interpreter.
>
> Tools like rubyscript2exe will get you OS-dependent binary, but it is
> self-sustained and will run without any other dependencies.

I guess I should have said OS independent. I'd like for something in
ruby to be similar to the jar, but it hasn't seem to emerged yet.

>
> Jan
>
>

rst0wxyz

2/16/2014 3:37:00 PM

0

On Sunday, February 16, 2014 5:24:57 AM UTC-8, Pokok'e Joged wrote:
> Resty Wyse <rst0wxyz@gmail.com> wrote in news:842eaa41-d935-4c46-bfe4-
> a4badc86a10b@googlegroups.com:
> > The Dalai Lama is a Liar
> > https://www.youtube.com/watch?v=Y...
> you ARE the biggest LIAR of all resty !!

You live in a lie as you are, and still don't realize it.
wake up. The world is going China's way. Get on the bandwagon before it's too late.

Satish

2/16/2014 4:10:00 PM

0

On Sunday, February 16, 2014 7:36:45 AM UTC-8, Resty Wyse wrote:
> On Sunday, February 16, 2014 5:24:57 AM UTC-8, Pokok'e Joged wrote:
>
> > Resty Wyse <rst0wxyz@gmail.com> wrote in news:842eaa41-d935-4c46-bfe4-
>
> > a4badc86a10b@googlegroups.com:
>
> > > The Dalai Lama is a Liar
>
> > > https://www.youtube.com/watch?v=Y...
>
> > you ARE the biggest LIAR of all resty !!
>
>
>
> You live in a lie as you are, and still don't realize it.
>
> wake up. The world is going China's way. Get on the bandwagon before it's too late.


The CCP Mandarins are dragging PRC down the same slippery slope that was forced upon Japan by the Tojo regime and for the same reason - its unabashed expansionism.


Beijing regime's lust for raw materials has fueled its colonial agenda. In this, it is behaving exactly as the Tojo regime had during the WW II era.

The Pacific nations are all aware that imperialist China has come to believe like rstx that "Today, it's all about military power, the only thing counts." In 1979, the CCP dictatorship under Deng Xiaoping's helmsmanship caused the death of nearly 150,000 human soldiers just to "teach Vietnam a lesson". It is another matter that a significant proportion of the dead were Chinese soldiers. But that mattered very little to lull the blood-lust of the CCP dictatorship in Beijing.


In fact, China's small neighbors thank USA for the fact that China hasn't dared since 1979 to launch a bloody invasion to teach any of its small neighbors a lesson. As far as the Pacific nations are concerned, it is the USA that is providing a shield against the blood lust of the CCP dictatorship.


As far as the Pacific countries (Japan, Korea, Taiwan, the Philippines, Vietnam, Brunei, Malaysia, Indonesia, Australia, New Zealand etc.) are concerned, it is the CCP dictatorship in Beijing that is the greatest menace to world peace.



The Munich agreement gave in to Nazi regime's demand for Sudetenland. But this only whetted the Nazi regime's addiction to aggrandizement. The Nazi regime went on to lay claims on Austria and then to Poland and then to Russia and France and then to the whole world.

The Beijing bandit regime's imperialist agenda is expanding exponentially. Now it is disputing Japan's sovereignty over Okinawa on the basis of Okinawa's tributary relationship with China some 500 years ago. The CCP dictatorship in Beijing is becoming as much a menace to world peace as the Tojo regime and the Hitler regime were in their days:

**************



http://english.pravda.ru/world/asia/17-07-2012/121658-china_territorial...

China has territorial claims to nearly 20 countries

17.07.2012

Chinese leader Mao Zedong not only built a strong country but also outlined a global goal: "We must conquer the globe where we will create a powerful state." Today, China has territorial claims to all its neighbors. Naturally, the U.S. is dreaming of becoming a mediator in resolving disputes in the region. But it seems that Beijing absolutely does not care about their opinion.

Burma, Laos, Northern India, Vietnam, Nepal, Bhutan, Thailand, Malaysia, Singapore, the Ryukyu Islands, 300 islands of the South China, East China and Yellow Seas, as well as Kyrgyzstan, Mongolia, Taiwan, South Kazakhstan, the Afghan province of Bahdashan, Transbaikalia and the Far East to South Okhotsk - here is the complete list of areas that, according to Zedong, were lost due to the fall of the Qing empire. All of these countries and regions combined exceed the territory of modern China. Not all complaints are voiced by the Government of China in the international arena, but within the country the imperialist ambitions have not been lost, but rather, are actively promoted.

The PRC authorities talk out loud only about the areas that, at least theoretically, can be taken away from Japan and Korea. Tokyo is regularly frustrated not only because of the travel of the Russian leaders to the Kuril Islands, but also about the Chinese ships freely entering the disputed Senkaku Islands waters. Beijing believes that the Islands are called Diaoyu, and they belonged to China, but the malicious Japanese tricked the U.S. into giving them to Japan because after World War II the uninhabited archipelago was in the US jurisdiction.

Significant reserves of natural gas were found on the islands. For the growing industry of China and stagnant Japan it is more than a serious argument in favor of the struggle for the archipelago, no matter what it is called. Not to mention the fish that is found there in large quantities. To date, the only agreement the parties have reached in the negotiations is on the joint development of oil fields. In addition, if the Japanese behave more or less decently, the Chinese are regularly caught for illegal fishing in the area.

Any territorial dispute, but rather, its resolution, is a serious precedent.. If China's claim in respect of at least one territory from the list of the "lost" is satisfied, the Chinese machine would be unstoppable. Despite the fact that the Chinese are very pleased to partner with Russia and have always supported Russia in the UN Security Council, in person, on the sidelines, its diplomats supposedly jokingly hint to their Russian colleagues: you must understand that soon you will have to share the Far East? China has more than a billion people, while Russia's vast territory barely has 150 million.

These dangerous trends - demographic, and as a result, geopolitical - must sound scary to the Russian government, but so far it seems that it is happy with the fact that Beijing makes territorial claims only to Seoul and Tokyo. In 2005 Russia had already given China a bounty in the form of 337 square kilometers of land in the area of Big Island (upper Argun River in the Chita region) and two sites in the vicinity of the islands Tarabarov and Big Ussuri near the confluence of the Amur and Ussuri.

However, none of the leaders of the military departments of ASEAN that includes all debating countries agree to recognize, for example, the fact that Diaoyu belongs to Japan. Instead, the defense ministers of Vietnam, Indonesia, Australia, Thailand and Singapore urged the Japanese authorities to proceed with caution and within the framework of the international law. These countries certainly do not need a resolution to the dispute because in that case their territory will be separated from China only by perseverance of the latter.

They are silent about the "Iodo island" (the Chinese version is Suenchzhao. - Ed) in the East China Sea. The sneaky Chinese took the principle of dividing the Arctic as an example and now claim that the underwater ridge of this tiny piece of land is under close control of the Chinese. Since the Iodo is closer to Korea, in 2003 the Koreans built an uninhabitable marine research station there. From the standpoint of the international law, this rock in general should not be the subject of a debate.

In any case, the controversy continues, Japan and South Korea remain to be supported by their all-time ally - the United States. For the US, the unification of Southeast Asian Nations is a chance to save their own economy, because in that case the World Trade Center will move there, where currently there are no transnational corporations in the amount sufficient for the U.S.

The success of the White House in the region does not depend on the strength that America loves to show any chance it has, but rather, diplomacy, as the countries of ASEAN and Asia-Pacific region do not trust each other or anyone outside the regional boundaries. However, Washington is trusted here because of the support of Seoul and Tokyo. However, China has already pushed Japan out of the ranks of the largest economies in the world, and the structure of the region is no longer formed on spatial basis.

Therefore, territorial claims of China, and not Russia, India or, for example, Australia are so important for Washington. Beijing is the only capital of the world, ready to use force in the struggle for the sake of expansion. During the last ten years, while America was blowing up its financial bubble, China has not only developed the industry, but also equipped its area of interest with military equipment. China has placed 38 new diesel and nuclear submarines in the region, purchased four destroyers of class "Modern" from Russia and built another dozen on its own, and has launched a network of ground-based ballistic missiles to destroy naval targets.

Only one other country has done this before - the Soviet Union during the "Cold War". It is no wonder that the Americans are very concerned with the regular quarrels between China and its major allies. Construction of a naval base on Hainan Island does not add confidence to the U.S. The proximity to the Malacca Strait poses a threat to the smooth supply of Washington's main allies in the region - Japan, South Korea and Taiwan - this is the way the US sees the situation. The American senators have already decided that such behavior is a threat to Beijing's regional peace and stability, economic development and even "food security". The international community is well aware what usually follows such wording.

Ilona Raskolnikova

Pravda.Ru

*******************

http://www.washingtontimes.com/news/2011/oct/26/inside-china-436801701/?page=all...


Threat against 'little countries'
By Miles Yu
mmilesyu@gmail.com


China's official communist newspaper, the Global Times, published a chilling editorial warning several "little countries" that are disputing China's maritime claims in the South China Sea, notably the Philippines and Vietnam, to "get ready to hear the sound of gunfire."


Headlined "China Cannot Resort Only to Negotiations Over Maritime Conflicts, We Must Kill One to Deter One Hundred If Necessary," the editorial published Tuesday asked, in a tone of condescension, where these "little neighboring countries" got the nerve to challenge China. It called such challenges an "opportunistic strategic offensive launched by little countries against a big country."


The newspaper further threatened that the game these countries play against China would not be easy to win because "China possesses the force to end such game anytime."


The report said any fear of a naval war is unnecessary because the Chinese public had been psychologically getting used to such a naval conflagration in recent years.


According to the newspaper, the root cause of China's trouble with these "little countries" is the United States. "At present various disputants behave with imperial swagger [against China]," the commentary said, "as if with the support from the United States, they all had the force and capabilities to subjugate China."


The newspaper used the phrase "bodies of waters in East Asia" to include areas other than the South China Sea where China has territorial disputes -- a clear reference to South Korea and Japan.


Since April 2010, China began deliberately sending regular fishing fleets accompanied by official government escort ships to disputed areas of the Spratly's Island, Senkaku islands, the Korean littoral area and other murky waters.


These China fishing and escort ships routinely clash with other nations' naval patrol ships, including incidents with the Philippine navy, the South Korean navy and the Japanese coastal patrol vessels just within the past week, dramatically escalating tensions with several "little countries."


Underground Great Wall


The U.S. government this week announced that it had dismantled and destroyed the last and the largest Cold War-era nuclear weapon, the B53 gravity bomb, in Amarillo, Texas.


Meanwhile, China is increasing its stockpile of nuclear weapons under the rubric of a mammoth project called the Underground Great Wall that includes a 3,000-mile-long subterranean tunnel system used to store and operate the many thousands of China's nuclear-carrying missiles. The system is under the direct supervision of China's strategic missile forces known as the Second Artillery Corps.


First reported by the Chinese state television in March 2008 and confirmed by the Chinese military a year later, the Underground Great Wall runs several hundred feet below the ground, said James Holmes of the U.S. Naval War College.


Mr. Holmes wrote in the Japanese-based electronic journal the Diplomat in August that "the very scale of the underground network opens up new vistas for Chinese nuclear strategy."


On Tuesday, the Wall Street Journal quoted former Pentagon nuclear weapons specialist Philip Karber as fundamentally challenging the West's conventional assumption about the size of China's nuclear stockpile, officially estimated to include several hundred warheads.


Mr. Karber said gauging the size of China's nuclear arsenal is difficult, but the Wall Street Journal article urged an immediate reconsideration of the underestimated arsenal because "the alternative is for China, steeped in a 2,500 year military tradition of concealment, deception and surprise, to announce -- at a time and in a manner of its choosing -- its supremacy in a field that we have foolishly abandoned to our dreams."

soc.culture.china, soc.culture.indian, soc.culture.malaysia, soc.culture.filipino, soc.culture.vietnamese
Anti-terrorism law proposed


China announced Monday that it would enact a sweeping law to combat what the communist state would define as "terrorists" or "terrorist acts." These acts include creating public disorder and social panic, causing public property damage and threatening government agencies. The law would target international organizations and all others that abet and finance such "terrorists" and "terrorist acts."


Human rights activists and thousands of netizens immediately reacted with anger and protest. Li Tiantian, a Shanghai-based human rights lawyer, was quoted by overseas Chinese news media as saying: "This law aims to protect the power structure of the state, to guarantee the security, stability and power of the government. It is the same as calling all actions jeopardizing the regime's rule terrorism, deserving suppression."

*************

Pokok'e Joged

2/16/2014 9:34:00 PM

0

Resty Wyse <rst0wxyz@gmail.com> wrote in
news:53608927-5942-47b6-83e5-0f024256bcf4@googlegroups.com:

> You live in a lie as you are, and still don't realize it.
> wake up. The world is going China's way. Get on the bandwagon
> before it's too late.

such an erotic fantasy you got there