Ruby: Reverse a string by word
Question:
Reverse a string - word by word. For example a string like "This is good day" would be written as "day good is This"
I tried it in ruby ... and it turns out it is just a one liner code ...
Cosimo Galluzzi
Acquired Stardust

Love Begins
KIROKAZE

❣ Chile in a Photography ❣

Andulka

#extradirty
2025 on Tumblr: Trends That Defined the Year
dirt enthusiast

Product Placement
Game of Thrones Daily

titsay
hello vonnie

Kaledo Art
Xuebing Du

tannertan36
Sweet Seals For You, Always

pixel skylines
styofa doing anything
Jules of Nature
seen from T1
seen from United States

seen from Singapore
seen from Malaysia
seen from Malaysia
seen from Indonesia
seen from United States
seen from Estonia
seen from United Kingdom
seen from United States
seen from United States
seen from United States
seen from United States
seen from Maldives
seen from Türkiye
seen from United Kingdom
seen from United States
seen from Canada

seen from Türkiye
seen from United States
@runandhack-blog
Ruby: Reverse a string by word
Question:
Reverse a string - word by word. For example a string like "This is good day" would be written as "day good is This"
I tried it in ruby ... and it turns out it is just a one liner code ...
Emacs for code browsing
Got tired of using ctags and cscope with emacs. I finally decided to switch to CEDET + ECB. Steps for Great code browsing in Emacs 1. Download and Install CEDET-1.0 - Download the software from below https://sourceforge.net/projects/cedet/files/cedet/cedet-1.0.1.tar.gz/download - Run the following commands cd cedet-1.0.1 emacs -Q -l cedet-build.el -f cedet-build 2. Download - Download ECB from below http://ecb.sourceforge.net/ 3. Install gtags - In ubuntu run sudo apt-get install global 4. Add the following lines in your .emacs file 5. Setup your c/c++ project. Add the lines in your .emacs file (ede-cpp-root-project "ProjectName" :name "ProjectName" :file "/home/chaos/work/oss/mysandbox/course/OS/lab/GNUmakefile" :include-path '("/" "/boot" "/conf" "/inc" "/kern" "/lib" "/user" ) :system-include-path '("/usr/include")) Explanation: :file - You can use any file in the root directory. This file isn't parsed, but it's used only as an anchor to search a files in projects. :name - Name of your project :include-path - This contains list of all folders in your root path to be included for parsing :system-include-path - This contains list of all System path which needs to be parsed 6. Activate ECB when you want to browse project.
M-x ecb-activate
Happy Coding with Emacs + CEDET + ECB ...
Detailed Tutorial : http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html
Effective Endian conversion in x86
Instead of Using the bit shift operators, we can use the assembly instruction bswap provided by x86 systems.
I am using the EAX Register for manipulation because it is the same register used for returning value. So i dont need any extra instruction to move my variable to EAX register
<![CDATA[// <![CDATA[ // ]]]]><![CDATA[>]]>
Creating a Shared Library
5 Steps to make a shared library and use it
1. Compile your code [Remember to add the Position Independent Flag -fPIC]
gcc -fPIC -c simple.c -o simple.o
2. Create a Shared Library
gcc -shared -Wl,-soname,libsimple.so.1 -o libsimple.so.1.0 simple.o
3. Create the Symbolic Links [This step is necessary only if you add the version to the -o libsimple.so.1.0. You specify libsimple.so, in that case this step is not necessary ]
ln -s libsimple.so.1 libsimple.so
4. Process the Folder for shared library. +foldername+ is the path where you placed the shared library.
ldconfig -n <foldername>
5. If the library is in non standard path then set LD_LIBRARY_PATH
In Bash: export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
Now you can use your shared library [compile your code & Run].
gcc -o test test.c -L. -lsimple
./test
My First Assembly Programming
Emacs: shortcut for compiling and running c/cpp code
I wanted to have c / c++ code compiled and run with shortcuts.
With some help from net i was able to do so by adding a elisp snippet to my .emacs file.
With the below snippet you should be able to compile the current code file using F9 and run the current code file using F8
Highlight symbol under cursor in Emacs
Hurray ... I wrote my first Elisp code ...
While browsing code I used to highlight code symbols in source insight (using shift + f8) ... I wrote a elisp snippet in emacs for the same ...
Ruby ... First Steps
Started learning Ruby. With first few pages of the book, i am very impressed with its intutiveness and extensiveness ...
For example ... Here are the different ways to print a string 10 times ...
10.times { puts "Hello world" }
(1..10).each { puts "Hello world" }
1.upto(10) { puts "Hello world" } 10.downto(1) { puts "Hello world" }
puts "Hello world" * 10
for i in 1..10 puts "Hello world" end
i=0 while i < 10 puts "hello world" i=i+1 end
Tumblr for Coder
Wanted to add few snippets of code ... But without syntax hightlighting, the snippets does not look like a code. So with some googling found a good syntax highlighter http://alexgorbatchev.com/SyntaxHighlighter/
After some trials ... Able to setup the Syntax Highlighter with Tumblr
1. Go to Customize Appearence
2. click on Edit HTML. You will see the HTML Section for the Theme being used.
3. In the HEAD Section add the following lines.
<link href="http://static.tumblr.com/6yb2bvd/9vzlwao6n/shcore.css" rel="stylesheet" type="text/css" /> <link href="http://static.tumblr.com/6yb2bvd/pK1lwaohi/shthemedefault.css" rel="stylesheet" type="text/css" /> <script src="http://static.tumblr.com/6yb2bvd/VRdlwb09n/xregexp.js" type="text/javascript"></script> <script src="http://static.tumblr.com/6yb2bvd/p0dlwao4y/shcore.js" type="text/javascript"></script> <script src="http://static.tumblr.com/6yb2bvd/fGBlwaoef/shbrushruby.js" type="text/javascript"></script>
4. After the BODY Section add these lines
<script type="text/javascript"> SyntaxHighlighter.all() </script>
5. Then in the post for doing the syntax highlighting place the code between
<pre class="brush: ruby">
Your Ruby Code Here :)
</pre>