tag:blogger.com,1999:blog-47735873253893384732024-02-19T17:40:03.118-05:00Wisdom through KnowledgeKnowledge is where you find it; it manifests as information all around us. Art is where you experience it; it exists in grains of sand and in clusters of galaxies. Sometimes the lines between the two is unclear. They are both ways of understanding the world around us. We see them in the form of technology, writing, programming, drawing, photography, among other means of expression. In this blog I share these expressions as I live life and experience it. I am Suleman and this is my blog.Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.comBlogger20125tag:blogger.com,1999:blog-4773587325389338473.post-13403114779212752082016-04-27T15:47:00.002-04:002016-04-29T16:42:20.342-04:00Fortran 77 (F77) - How to Convert Integer to String and Concatenate<div class="preface">
Recently was working with a 91-year old researcher on their Fortran 77 code written over the last 50-years. It needed debugging and some new coding so it lead to learning an ancient language lovingly called F77. It is an eye-opening experience to realize you are working on something with that much history and contributing to a legacy.
<br />
<br />
Anyhow, personal reflections aside, here is how you convert an integer into a string in fortran 77 and then concatenate it to another string. Useful for suffixing a filename for example.</div>
<br />
<h1>Conversion</h1>
The basic idea behind converting a variable of any type to a string in Fortran 77 is to write that variable into a Character array variable of some length using the <code>Write</code> function. So in our case we will be writing an Integer into a Character array.
<br />
<br />
<strong>Note:</strong> The size of the character array should match the number of digits else you will have a lot of white space. Of course you can do that if you want.
<br />
<br />
Let's define two such variables and assign them values.
<a name='more'></a>
<pre>
integer aNumber = 1024
character*4 aString
write(aString, 10) aNumber
10 format (I4)
end
</pre>
<br />
And that is it. You have done your conversion. It is a pair of lines is all.
<br />
<br />
<h1>Code Breakdown</h1>
It is kind of like explaining to a print function in C/C++ or other languages what the output type is supposed to be. If you don't know other languages that is fine. Keep reading.
<pre>
write(aString, 10) aNumber
10 format (I4)
</pre>
<br />
The first line says: <code>write</code> the contents of the variable <code>aNumber</code> into the variable <code>aString</code> using the formatting provided on the line with the label <code>10</code> which will describe the format of the contents of the variables <code>aNumber</code>.
<br />
<br />
The second line says: This is the line with the label <code>10</code> which is where the write statement above refers to to get the formatting information of <code>aNumber</code>. In this case the format is <code>I4</code> which means an Integer that is four digits long.
<br />
<br />
<h1>Larger Example Code</h1>
Here is a small sample code that will get the date and time and append the year to the end of a string. The concept being you can do this with filename strings to avoid output collisions as you likely do often when dealing with multiple iterations of a program run.
<br />
<br />
<strong>Note:</strong> The variable <code>filename</code> is set to be the exact length of the name to avoid the need for whitespace trimming. In practice, you would have to write some code to extract the actual substring and trim out the whitespace to make this work.
<pre>
integer timeArr(8)
character*10 dateInfo(3)
character*4 yearSuffix
character*7 filename
character*36 output
filename = "my_file"
call date_and_time(dateInfo(1), dateInfo(2), dateInfo(3),
& timeArr)
write(yearSuffix, 10) timeArr(1)
10 format (I4)
output = filename // "-" // yearSuffix
print *, output
end
</pre>
<br />
<strong>Note:</strong> The details of the <a href="https://docs.oracle.com/cd/E19957-01/805-4942/6j4m3r8t2/index.html">date_and_time function</a> used below can be found on the Oracle documentation site.
<br />
<br />
<h1>Concatenation</h1>
Concatenation in Fortran is trivial. All it requires is using the "//" language syntax. So after you have done your conversion you can easily do something as follows.
<pre>
output = filename // "-" // yearSuffix
</pre>
There are however a few caveats to consider.
<ul>
<li>If the <code>filename</code> variable is long (say 32 characters), but the name of the file itself is shorter than that length there will be trailing white spaces which will need trimming. Without that there will be a blank gap between <code>filename</code> and everything else on that line.</li>
<li>You need to ensure that the length of the final string here called <code>output</code> is equal to the sum of the other strings or greater. A smaller will obviously cut the overflow text off. In the above example, <code>output</code> needs to be at a minimum 11 characters long.
</li>
</ul>
<br />
So there you have it. All done. Let me know if you have any questions, comments, and the like.Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-11992126673755627452016-04-12T17:47:00.000-04:002016-04-12T17:52:19.674-04:00Golden Age Super-heroes in the Public Domain<div class="preface">
Consider this a writing reference, an art reference and of course a jumping point into a history lesson.</div>
<br />
First, let's start with a collection of images of Super-heroes in the Public Domain. They are from the golden age of comics and as such do look somewhat dated (fluffy pants, robots, jetpacks, ray guns, swashbucklers, grinning Adonises, etc.). However, they are an important piece of comic book, art, and writing history. Enjoy and of course if you so choose use them in your writing.
<br />
<br />
To my board <a href="https://www.pinterest.com/sulemandiwan/art-is-amazing/">Art is Amazing</a> with these images and other artifices of visual creativity.<br />
<br />
A jump to <a href="https://www.pinterest.com/pin/14496030028844624/">just the first image</a>.<br />
<br />
A number of these golden age heroes experienced a temporary revival when Alex Ross pulled them from their slumber for his <a href="https://en.wikipedia.org/wiki/Project_Superpowers"><em>Project Superpowers</em></a> limited series. A revival of sorts in the modern era.<br />
<br />
Another handful of these heroes also experienced a summoning to the present day by Alan Moore and Peter Hogan in a mini-series spun-off from Alan Moore's Tom Strong comic. The series is called <a href="https://en.wikipedia.org/wiki/Terra_Obscura"><em>Terra Obscura</em></a>.<br />
<br />
For a details reference, the following Wikia (yes I know, ads, clicks, heavy on the browser, my apologies) page has a rather complete collection of Public Domain characters for both comic books and comic strips as well as open source characters.<br />
<br />
A <a href="http://pdsh.wikia.com/wiki/Public_Domain_Super_Heroes">searchable database</a> for all your imagination inspiring material.<br />
<br />
Now go enjoy the images, the history of characters, and start cranking out some words. :)Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-1970116940531469102016-02-27T10:00:00.000-05:002016-02-27T10:00:15.953-05:00A Letter from Teddy<div class="warning">
Warning: Strong Language, Mature Themes, Graphic Violence
</div><br />
<div class="preface">
The following is a macabre tale of horror and a perverse comedy. A short piece of fiction exploring a darker surreality. The premise is a letter from a childhood toy.
<br />
<br /></div>
<i>
I'm coming for you, Sully.</i><br />
<br />
<i>I'm coming for you. Tonight.</i><br />
<br />
<a name='more'></a>
<i>You won't see me coming, you won't hear me coming but you will know when I am there slitting your throat.</i><br />
<br />
<i>I am gonna toss your pieces in the shadowy corner where you left me lying for weeks. And in the closet where you left me to rot for that one Summer when you went off to the lake with the family. I am going to stuff you in the trunk in that basement where your mother buried me when you went off to College. </i><br />
<br />
<i>You sunnuvabitch!</i><br />
<br />
<i>You have any idea how fucking disgusting all those places were. The ants and cockroaches crawling all over you, mice nibbling at your face tearing out your buttoned eyes. Moths burying deep into your flesh chewing constantly. All they left was this rotting husk. The husk that is going to come for you, tear you into tiny bits and let the creepy crawlies gnaw at your flesh.</i><br />
<i>See how you like it, you fucker.</i><br />
<br />
"Signed... Teddy." I finished reading his letter and sighed.<br />
<br />
"Teddy, you were always such a drama queen," I said calmly. Then turned to look one last time into the cold hate-filled eye that Teddy still had hanging on by a thread.<br />
<br />
"But you should have stayed away." And with that I tossed him into the preheated oven.<br />
<br />
"You really should have stayed away," I said grinning to myself perversely enjoying the screams of my childhood toy.Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-9624490938961729472016-02-26T12:00:00.000-05:002016-02-26T12:00:14.199-05:00White Light<div class="warning"><p>
Warning: Mild Violence
</p></div>
<div class="preface"><p>
A tongue-in-cheek dark humor piece.
</p></div>
The fluorescent lights were flat white and droned on. And so did he.<br />
<br />
“So what truly drives you here?” he asked me.<br />
<br />
I chose not to respond. May as well ask me what my 5-year plan is.<br />
<br />
<a name='more'></a>
“What is currently going through your mind right now?” he asked with some frustration crawling into his throat.<br />
<br />
I chose not to say anything. If I am going to be stuck here listening to him, so is he.<br />
<br />
“Come now. There must be something you like to do. What would you like to do right now?”<br />
<br />
Slit your throat and see if you continue to speak through the gurgles or finally shut up. I chose not to share that.<br />
<br />
The doctor was exasperated with my non-participation. It’d been 6 months here and the superstar doctor felt his light waning before my silence. Guess he is a small fish in a still smaller pond. Pathetic.<br />
<br />
“Can I go now?” I asked.<br />
<br />
“Yes,” the good doctor said flopping into his chair like a dead eel. That’s a good look for him. I will have to remember that.<br />
<br />Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-5751184978498065472016-02-25T11:19:00.000-05:002016-02-25T11:19:00.287-05:00"You are its human; it looks to you."The small grey kitten waddled helplessly across the table as Jeremiah sat attentively looking at the small quivering mass. The doctors stood quietly observing them from a distance. The kitten stumbled a few more times and finally came within arms reach of Jeremiah. The boy eyed it cautiously and then slowly pushed his hand forward letting the tiny animal smell him.<br />
<br />
"What is her name?" he abruptly asked.<br />
<br />
"That is for you two to decide."<br />
<br />
"I think she wants to be called Bean. She is small like one."<br />
<br />
The kitten moved much closer and then finally sat down looking straight into Jeremiah's green eyes. They both looked at each other for several moments while the doctors talked in hushed whispers.<br />
<br />
The cat made the first sound of its brand new life, a high whiney mewling. It had accepted Jeremiah. He would now belong to her.<br />
<br />
"You are now its Human."<br />
<br />
Jeremiah nodded.<br />
<br />
He gently took Bean in cupped hands and returned to his assigned quarters.<br /><br />Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-52766195529027066362016-02-23T20:54:00.000-05:002016-02-23T20:56:30.666-05:00Fearsome Entity<div class="warning">
Warning: Mature Themes
</div><br />
It stood in the doorway as it did every night. I hid under the covers pretending to be asleep. It was dark out in the hallway, but the window in the stairwell let in just enough moonlight to create the eerie silhouette and the long shadow that it cast; the shadow which stretched out almost to the base of my bed. It was silent and unnaturally still just watching me while I peered at it through nearly closed eyes, squinting and hoping it would leave soon. It came by every night once my parents had gone to bed and I was alone and about to fall asleep. And each night it moved a little closer than the last. Tonight, it leaned almost all the way in through the door. Its hunched shoulders and long spindly limbs adding an extra menace to its lanky form.<br />
<br />
<a name='more'></a>
For the first time, I saw something moving around near where its mouth would be - a dark sinuous shadow writhing and oozing out. The shadow moved like a snake extending along the floor getting longer and longer. I stayed still, like I did every other night hoping it would leave, but I knew tonight was going to be different. It started to move towards me taking the first step into the room. I wanted to scream out, but all I could do was lay there paralyzed with my skin cold and clammy with fear.<br />
<br />
It will get me tonight.<br />
<br />
At that point I heard my mother walk down the hall and turn on the light in my room. The thing disappeared instantly and in its place my mother stood looking longingly at me with tears in her eyes. She stood there for a while leaning against the door. I wanted to call out to her but I couldn't; I was still unable to move.<br />
<br />
"Come back to bed, Alice. Don't torment yourself," I heard my father call out from the other room.<br />
<br />
My mother looked very sad.<br />
<br />
"I miss you so very much," she whispered softly, as she turned off the light and walked away from me.<br />
<br />
Mom, don't go, I wanted to say, I am still here.<br />
<br />
But my lips stayed motionless.<br />
<br />
The thing came back soon as she left and this time it stood in the room at the foot of my bed. It loomed over me with its tongue hanging from that hollow face. I knew what was next. It moved towards me.<br />
<br />
<em>Goodbye, Mom, Dad.</em><br />Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-24676614048077826242015-12-21T16:48:00.001-05:002016-02-25T11:19:43.069-05:00Big Bad<div class="preface"><p>
What if the villain of your fairy tale was not what he or she was made out to be? The truth behind the fiction.
</p></div>
Bill “Big Bad” Wolf has been in law-enforcement since the beginning. The moniker “Big Bad” only applies to him if you are a criminal and he has your scent.<br />
<br />
He was a housing inspector in the early days. His first big investigation was to check the safety of the constructions of the Three Little Pigs. The word on the street was that they were not following building code as was evidenced by Mr. Wolf’s investigations; two of their buildings were structurally unsound. The corrupt contractors put up a substantial resistance but through the persistent efforts of Mr. Wolf they were finally brought to justice.<br />
<br />
<a name='more'></a>
Years later, Little Red Riding Hood was the last case Mr. Wolf worked before his retirement from the DEA. She was a mule smuggling drugs to her “Granny” and her waifish looks (she was 33) helped hide the dark sinister cartel she belonged to. No one suspected her except for Mr. Wolf who asked himself, “why would a 12-year old regularly travel so far off the beaten path deep into the woods?” Things did not add up so he investigated. Mr. Wolf had things under control but someone had tipped off Red. She brought in the enforcer known as “The Woodcutter”. All in all Mr Wolf managed to take out “The Granny” but not without severe bodily harm to himself. Though Red and The Woodcutter escaped, Mr Wolf saved many lives that day.Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-40345085418813896282015-12-21T16:29:00.000-05:002015-12-21T16:29:34.507-05:00Blog Format AdjustmentsI will be expanding the content of this blog to include writing I sometimes do in my spare time and other bits that you may find interesting. Enjoy!Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-27604008106506000752015-11-23T22:37:00.001-05:002016-04-12T17:49:14.595-04:00Winter-time Levity A'la Star Wars<div class="separator" style="clear: both;">
<span style="font-family: 'Helvetica Neue Light', HelveticaNeue-Light, helvetica, arial, sans-serif;">Just thought to deviate from the norm and share a bit of Star Wars silliness. A mural on a hairdresser's window.</span></div>
<div class="separator" style="clear: both;">
<span style="font-family: 'Helvetica Neue Light', HelveticaNeue-Light, helvetica, arial, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-family: 'Helvetica Neue Light', HelveticaNeue-Light, helvetica, arial, sans-serif;"></span></div>
<div class="separator" style="clear: both;">
<span style="font-family: 'Helvetica Neue Light', HelveticaNeue-Light, helvetica, arial, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF00qetT49Ap2ygxcOeZ-lUtFNiuMiBhp3PrrO1PP3FUjc9iLppOgkjE6VWHvvBNTKWzD1o3_Ke4r30bxKjV2RbG-yUqgKLVTtywpqXxNLz26ivzRbCQu55Sn_FgBt8Q9SU0qD98gsNNG4/s640/blogger-image--941652771.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF00qetT49Ap2ygxcOeZ-lUtFNiuMiBhp3PrrO1PP3FUjc9iLppOgkjE6VWHvvBNTKWzD1o3_Ke4r30bxKjV2RbG-yUqgKLVTtywpqXxNLz26ivzRbCQu55Sn_FgBt8Q9SU0qD98gsNNG4/s640/blogger-image--941652771.jpg" /></a></span></div>
<span style="font-family: 'Helvetica Neue Light', HelveticaNeue-Light, helvetica, arial, sans-serif;"><br /></span>
<br />
<div>
<br /></div>
<div>
<br /></div>
Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-19000733074488587432015-11-17T16:47:00.001-05:002016-04-29T16:42:01.611-04:00Linux SSHD: Per-User or Per-Group Configuration to Disable or Enable FunctionalityTo have configurations in <code>sshd_config</code> on a <b>per-user</b> or a <b>per-group</b> basis you need to use the <tt>Match Group</tt> and <code>Match User</code> directives.
<br />
<br />
<h3>
Example</h3>
To prevent say remotely running GUI programs for all users save some you can use the following snippet. You can of course make other modifications.
<br />
<blockquote>
<pre># Disable X11 Forwarding and TCP Forwarding.
X11Forwarding no
AllowTcpForwarding no
# This to enable for a group called "X11AllowedList" that you created with
# its respective members.
Match Group X11AllowedList
X11Forwarding yes
AllowTcpForwarding yes
## OR ##
# Or this to enable for a user specifically.
Match User johndoe
X11Forwarding yes
AllowTcpForwarding yes
</pre>
</blockquote>
<h3>
Summary</h3>
The indentation is what makes this possible.
<br />
<blockquote>
<pre>Match User johndoe
X11Forwarding yes
</pre>
</blockquote>
<h3>
Advanced: To Restrict Commands</h3>
If you want something more sophisticated than just preventing some GUI executions, you will want to create a restricted shell so that the users have limited access. This would then be force executed soon as someone logs in using the <code>ForceCommand</code> Directive as follows:
<blockquote>
<pre>ForceCommand /usr/local/bin/strict_shell</pre>
</blockquote>
Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-17568849791537749952013-06-17T10:02:00.001-04:002015-12-07T16:43:11.868-05:00Flow (or Flowhack) - Being more effective<div class="about-description branded-page-box-padding " style="background-color: white; border: 0px; font-family: arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px; padding: 20px 20px 10px;">
<div style="background-color: transparent; border: 0px; padding: 0px;">
<h3>
<span style="color: #444444;">Lifehack</span></h3>
</div>
<div style="background-color: transparent; border: 0px; padding: 0px;">
<span style="color: #444444;">According to the ubiquitous <a href="http://en.wikipedia.org/wiki/Life_hacking" target="_blank">wikipedia</a>:</span></div>
<blockquote class="tr_bq">
<span style="color: #444444;">"<span style="font-family: sans-serif; line-height: 19.1875px;"><i><a href="http://lifehacker.com/" target="_blank">Life hacking</a></i></span><span style="font-family: sans-serif; line-height: 19.1875px;"> refers to any productivity trick, shortcut, skill, or novelty method to increase productivity and efficiency, in all walks of life; in other words, anything that solves an everyday problem in a clever or non-obvious way might be called a life hack."</span></span></blockquote>
<br />
<h3>
<span style="color: #444444;">Flow AKA Flowhack</span></h3>
<div style="background-color: transparent; border: 0px; padding: 0px;">
<u style="color: #444444;">Flow (Flowhack)</u><span style="color: #444444;"> is my word for reducing the total number of steps anything requires from the first action (Start) to the last action (Finish) by at least one.</span><br />
<br /></div>
<div style="background-color: transparent; border: 0px; padding: 0px;">
<a name='more'></a></div>
<div style="background-color: transparent; border: 0px; padding: 0px;">
<span style="color: #444444;">Flowhack is an extension of Lifehacking. It attains the same goal of productivity and efficiency but focuses on reducing the hump of starting and finishing something making it easier to get things done. </span></div>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
</div>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
<span style="color: #444444;">The idea is:</span></div>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
</div>
<ol>
<li><span style="background-color: transparent; color: #444444;">to maximize efficiency</span></li>
<li><span style="background-color: transparent; color: #444444;">to maximize productivity</span></li>
<li><span style="background-color: transparent; color: #444444;">to simplify the process to be so stupidly simple that you can do it without even thinking about it minimizing the mental energy (or hurdle). A reduced sequence where your muscle memory takes over when possible or a mental routine kicks in involuntarily where needed.</span></li>
</ol>
<span style="background-color: transparent; color: #444444;">The ideal state to reach is 0-steps or in other words fully automated not requiring any intervention from you (though someone else may need to do an action). The more likely best case solution usually would be 1 to 3 steps meaning it is quick and easy to do and so you just get through it without any procrastination or reluctance.</span><br />
<span style="background-color: transparent; color: #444444;"><br /></span>
<span style="background-color: transparent; color: #444444;">Another way to state it would be:</span><br />
<blockquote class="tr_bq">
<span style="color: #222222; font-size: x-small; line-height: normal;"><i>A targeted micro-scale efficiency solution for effectiveness, efficiency, productivity, and proactivity.</i></span></blockquote>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
<span style="color: #444444;">Three important elements to consider:</span></div>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
</div>
<ol>
<li><span style="background-color: transparent; color: #444444;">being </span><u style="background-color: transparent; color: #444444;">extremely organized</u><span style="background-color: transparent; color: #444444;"> is crucial for this to work </span></li>
<li><span style="color: #444444;">having items (physical or software) that take care of things for you to reduce the steps (e.g. a coin sorter for the change you gather)</span></li>
<li><span style="color: #444444;">having prominent and noticeable items with a designated purpose to help with building mental routines/triggers (e.g. that fancy mug paraphernalia from your favorite hobby as you will use it more often and rinse immediately)</span></li>
<li><span style="background-color: transparent; color: #444444;">minimizing incompatible or inefficient purchases and replacing things in your existing environment is important </span><span style="background-color: transparent; color: #444444;">for this to work well.</span></li>
</ol>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
<span style="color: #444444;">This does mean you will usually buy things that might be more niche and hence more expensive and will be replacing something or other that you already have with something new that is better for the Flowhack. </span><span style="background-color: transparent; color: #444444;">You will also want to plan out your purchases with the overall workflow in mind to ensure it keeps you organized and reduces steps and not simply collect a new set of disparate items.</span></div>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
<span style="color: #444444;">However, don't feel overwhelmed, though it is a goal to work towards it is not an instant solution, your methods may vary and it will take time to slowly develop them.</span></div>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
</div>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
<span style="background-color: transparent; color: #444444;"><b>Note:</b> For those comfortable with the </span><a href="http://en.wikipedia.org/wiki/Getting_Things_Done" style="background-color: transparent;" target="_blank">GTD</a><span style="background-color: transparent; color: #444444;"> terminology, the idea is to turn everything in your sequence into a quick simple series of 'Next Actions' except the reminders or ticklers are your muscle memory and mental routines.</span></div>
<div style="background-color: transparent; border: 0px; margin-top: 1.4em; padding: 0px;">
</div>
</div>
Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-69830898229962017282012-10-02T14:51:00.001-04:002016-04-29T16:43:52.168-04:00GMail Tips: Manage Replied-to and Forwarded Message Workflow<h2>
Problem</h2>
Frequently, people want there to be some mechanism to know whether they have replied to messages in a conversation thread. Unfortunately, GMail does not have any mechanism for this by default.<br />
<br />
<h2>
Solution</h2>
However, using Labels and Filters a little creatively solves the issue mostly. Here are the filters I use for myself.<br />
<br />
<u>Replied</u><br />
<span style="font-family: monospace;">Matches: from:me subject:(Re:)</span><br />
<span style="font-family: monospace;">Do this: Apply label "↵", Never send it to Spam</span><br />
<br />
<u>Forwarded</u><br />
<tt>
Matches: from:me subject:(Fwd:)<br />
Do this: Apply label "→", Never send it to Spam</tt><br />
<tt><br /></tt>
<br />
<h3>
Simple Steps to add filters to your GMail account:</h3>
<ol>
<li>You can download my XML file with the filters here:</li>
<ol>
<li>Click <a href="https://docs.google.com/open?id=0B2QznlU4JFWYVmZCendCVm9SV1k" rel="nofollow" target="_blank">here</a> to get to it.</li>
<li>Click on the "Download" button.<a name='more'></a></li>
</ol>
<li>Go to GMail "Settings" (accessible via the "Gear icon"<img alt="Gear Icon" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCWYV1OmuErfjbYHURZMt3uYjPQR_oh0bq_l5-izj2_NkqAcAWCmTJaq7j8WBg_vIBBq3DKFm2WUsAHCBeSzbnPCMWcAzERSEZ25rjLaZ6Em6u5yKt9z21wd-vSSE4spG5AkMEJcexYmuW/s1600/GMail-Gear-Icon-Small.gif" style="vertical-align: middle;" />on the right).</li>
<li>Click on the "Filters" tab.</li>
<li>Scroll to the bottom and click "Import Filters".</li>
<li>Click on "Choose File" and select the file you downloaded.</li>
<li>Then click on "Open File".</li>
<li>Then check the "Apply new filters to existing mail" box.</li>
<li>Click "Create filters" and wait; it will take a bit depending how many messages you have.</li>
</ol>
<div>
Once it is done you should see the two small arrows in the left as labels. Color them as you like. I chose to have the colors be a white background with the GMail red as the arrow color.</div>
<div>
<br /></div>
<b><i>Note:</i></b> These filters work best in conversation view as they rely on seeing whether your message is in the conversation or not to determine the correct tag. It is not 100% accurate but gets you there most of the way.<br />
<br />
<h2>
Additional Solutions</h2>
Another thing you can do is go to the "Gear icon"<img alt="Gear Icon" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCWYV1OmuErfjbYHURZMt3uYjPQR_oh0bq_l5-izj2_NkqAcAWCmTJaq7j8WBg_vIBBq3DKFm2WUsAHCBeSzbnPCMWcAzERSEZ25rjLaZ6Em6u5yKt9z21wd-vSSE4spG5AkMEJcexYmuW/s1600/GMail-Gear-Icon-Small.gif" style="vertical-align: middle;" />and "Settings" and then to "Labs".<br />
Here you can enable the lab called "Send & Archive".<br />
<br />
Your workflow would change such that whenever you reply to a message or forward it you click the "Send & Archive" button instead of "Send". This allows you to assume that if you see a message in your inbox you have not replied to it or forwarded it yet and as such it needs an action. Use this in conjunction with the filters above for best results.<br />
<br />Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-36328136408074829582012-09-14T16:36:00.004-04:002016-04-29T16:44:51.635-04:00Overriding Shell for Users through SSSD<h2>
What is SSSD in a nutshell?</h2>
SSSD (System Security Services Daemon) is a collection of daemons used by Linux to manage the authentication and authorization to a system. In particular, it can interface with remote directories such as those that use LDAP (Lightweight Directory Access Protocol), and internally interfaces with NSS (Network Security Services) and PAM (Pluggable Authentication Module). Essentially, it can be configured to control the behaviour of these other services. You can learn more about it here:<br />
<br />
<a href="https://fedorahosted.org/sssd/">https://fedorahosted.org/sssd/</a><br />
<br />
<h2>
The problem?</h2>
I was getting the authentication information from a central LDAP directory however, they only provided <span style="font-family: Courier New, Courier, monospace;">/bin/csh</span> and the environment variable for the users while I needed it to be<br />
<span style="font-family: Courier New, Courier, monospace;">/bin/bash</span> in my environment.<br />
<br />
Ideally, SSSD would have provided a way to override the shell in its configuration files, unfortunately, at the time of this writing that is only available in version 1.9 of SSSD which is currently in beta with the Fedora project. Further, my systems were Red Hat Enterprise Linux 6 (RHEL) which typically runs a few versions behind in most things though security patches and bug-fixes are backported.<br />
<h2>
<a name='more'></a>The (current) recommended solution</h2>
<div>
Currently, for versions of SSSD upto 1.8.4, the recommended way of doing this is by altering the file:</div>
<div>
<br /></div>
<div>
<tt>/etc/sssd/sssd.conf</tt></div>
<br />
You would want to add the following stanza in that file:<br />
<br />
<tt>[nss]<br />
allowed_shells = /bin/bash, /bin/tcsh<br />
vetoed_shells = /bin/csh<br />
shell_fallback = /bin/bash</tt><br />
<br />
Broken down these do the following in order:<br />
<ul>
<li>Allow only <span style="font-family: Courier New, Courier, monospace;">/bin/bash</span> and <span style="font-family: Courier New, Courier, monospace;">/bin/tcsh</span> as allowed shells.</li>
<li>Disallow <span style="font-family: Courier New, Courier, monospace;">/bin/csh</span> as an allowed shell.</li>
<li>Set <span style="font-family: Courier New, Courier, monospace;">/bin/bash</span> as the fallback shell for when <span style="font-family: Courier New, Courier, monospace;">/bin/csh</span> attempted to be set and but fails due to being disallowed.</li>
</ul>
<div>
<br /></div>
<h2>
Variable placement is important</h2>
These variables mentioned above will only work under the NSS stanza as that is where they are defined as valid for SSSD. You can check the valid variables list in one of two locations either:<br />
<br />
1) <span style="font-family: Courier New, Courier, monospace;">/etc/sssd/sssd.api.conf</span> and <span style="font-family: Courier New, Courier, monospace;">/etc/sssd/sssd.api.d/*</span><br />
<br />
Or<br />
<br />
2) <span style="font-family: Courier New, Courier, monospace;">/usr/share/sssd/sssd.api.conf</span> and <span style="font-family: Courier New, Courier, monospace;">/usr/share/sssd/sssd.api.d/*</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<br />
<h2>
Future direction: SSSD 1.9</h2>
<div>
With SSSD 1.9 there is a new variable that has been implemented called <span style="font-family: Courier New, Courier, monospace;">override_shell</span><span style="font-family: Times, Times New Roman, serif;"> which will essentially do the same thing but less of a hack and more of an actual option. You can see patch details about it here:</span><br />
<span style="font-family: Times, Times New Roman, serif;"><br /></span>
<span style="font-family: Times, Times New Roman, serif;"><a href="http://article.gmane.org/gmane.linux.redhat.sssd.devel/10203/match=override_shell">http://article.gmane.org/gmane.linux.redhat.sssd.devel/10203/match=override_shell</a></span><br />
<br /></div>
<h2>
The failed "solutions" (for your information)</h2>
<div>
Some other things I attempted that didn't quite work out involved:</div>
<div>
<ul>
<li>Placing the variables above in the wrong stanza. :)</li>
<li>Using an "<span style="font-family: Courier New, Courier, monospace;">exec /bin/bash</span>" in <span style="font-family: Courier New, Courier, monospace;">/etc/csh.login</span></li>
<li>Altering and overriding the shell in <span style="font-family: Courier New, Courier, monospace;">/etc/security/pam_env.conf</span></li>
</ul>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
</div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><iframe bordercolor="#000000" frameborder="0" height="150" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://ad.doubleclick.net/adi/N963.148119.BLOGGEREN/B6527721.7;dcadv=3632184;sz=180x150;lid=41000613802463762;pid=DH2575A4U;usg=AFHzDLu9BOJIsBCty7PpsrGOxbrDjsPVhQ;adurl=http%253A%252F%252Fwww.technooutlet.com%252Fdh2575a4u.html;pubid=565079;price=%242019.02;title=Lenovo+IGF+Server+2575...;merc=Techno+Outlet+Site;imgsrc=http%3A%2F%2Fsite.unbeatablesale.com%2Fimg352%2Fdh2575a4u.gif;width=85;height=85" vspace="0" width="180"></iframe><iframe bordercolor="#000000" frameborder="0" height="150" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://ad.doubleclick.net/adi/N963.148119.BLOGGEREN/B6527721.7;dcadv=3632184;sz=180x150;lid=41000613802464048;pid=23355218;usg=AFHzDLvKaVev9RPOts3bV4DILNIWxf5MVQ;adurl=http%253A%252F%252Fwww.officemax.com%252Ftechnology%252Fcomputers%252Flaptop-computers%252Fproduct-prod4040011%253Fcm_mmc%253DPerformics-_-Technology-_-Computers-_-Laptop%252520Computers%2526ci_src%253D14110944%2526ci_sku%253D23355218;pubid=565079;price=%24479.88;title=Lenovo+IdeaPad+U310+No...;merc=OfficeMax;imgsrc=http%3A%2F%2Fwww.officemax.com%2Fcatalog%2Fimages%2F397x353%2F23355218i_01.jpg;width=95;height=85" vspace="0" width="180"></iframe><iframe bordercolor="#000000" frameborder="0" height="150" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://ad.doubleclick.net/adi/N963.148119.BLOGGEREN/B6527721.7;dcadv=3632184;sz=180x150;lid=41000613802463973;pid=sku6654076;usg=AFHzDLt0ztylEYHxQbEM-fxfiJdPMh7_iQ;adurl=http%253A%252F%252Fwww.samsclub.com%252Fsams%252Fnetgear-gigabit-16-pt-switch%252Fprod6190044.ip%253Fpid%253D_DoubleClick_Affiliates%2526ci_src%253D15781033%2526ci_sku%253Dsku6654076;pubid=565079;price=%24169.86;title=Netgear+Gigabit+16+pt+...;merc=Sam%27s+Club;imgsrc=http%3A%2F%2Fs7d2.scene7.com%2Fis%2Fimage%2Fsamsclub%2Fs7product%2F0060644903499_A.jpg;width=85;height=85" vspace="0" width="180"></iframe><br /></span></div>
Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-90484619131440988892012-08-22T14:57:00.001-04:002014-01-24T08:40:22.814-05:00Matlab and OS X Mountain Lion (10.8)<h2>
A little background</h2>
<div>
The current latest version of Matlab is 2012a. It was released for Mac OS X Lion (10.7) so requires X11 to provide the GUI. However, with the release of Mac OS X Mountain Lion (10.8), X11 is no longer provided by default from Apple. This poses a bit of a problem for Matlab 2012a.</div>
<h2>
What to do with Matlab 2012a on Mountain Lion?</h2>
<div>
While Mountain Lion doesn't have X11 and Apple isn't providing their version of X11, they are providing development support to the Open Source project that the Apple X11 was based off of: XQuartz.<br />
<br /></div>
<div>
<a name='more'></a></div>
<div>
So the solution is pretty simple: download and use <a href="http://xquartz.macosforge.org/landing/" target="_blank">XQuartz</a> as the default XWindows System. This is the <a href="http://support.apple.com/kb/HT5293" target="_blank">official solution by Apple</a> as well.</div>
<div>
<br /></div>
<div>
Mathworks provides the instructions which more or less distill to download, install and reboot. You can read the steps here:<br />
<br />
<a href="http://www.mathworks.com/support/solutions/en/data/1-IXBVKD/">http://www.mathworks.com/support/solutions/en/data/1-IXBVKD/</a><br />
<br />
<i>Note: Remember to logout and restart the computer after installation to ensure it works.</i><br />
<h2>
The Caveat of 32-bit vs 64-bit</h2>
</div>
<div>
To make this works smoothly, you will want to ensure you have 64-bit Java, 64-bit Matlab and 64-bit Xquartz. If the Java is 32-bit for example then you would have to run Matlab in 32-bit mode as follows:<br />
<blockquote class="tr_bq">
<tt>matlab -maci</tt></blockquote>
It will not work otherwise. </div>
<div>
<h2>
Native Cocoa Support for Matlab?</h2>
</div>
<div>
Mathworks has said that Matlab 2012b is being developed for OS X Mountain Lion (10.8) and as such will be supporting Cocoa natively; at that point it will not be dependent on XQuartz. You can see the information at:<br />
<br />
<a href="http://www.mathworks.com/support/solutions/en/data/1-IXBVKD">http://www.mathworks.com/support/solutions/en/data/1-IXBVKD</a></div>
<div>
<br />
Extensive details of the roadmap if that is your fancy can be found here:<br />
<br />
<a href="http://www.mathworks.com/support/sysreq/roadmap.html">http://www.mathworks.com/support/sysreq/roadmap.html</a><br />
<br />
<br />
<iframe bordercolor="#000000" frameborder="0" height="150" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://ad.doubleclick.net/adi/N963.148119.BLOGGEREN/B6527721.7;dcadv=3632184;sz=180x150;lid=41000613802463973;pid=sku8214163;usg=AFHzDLswFwSRUYMLBh7kz-ddOOjDc30H2w;adurl=http%253A%252F%252Fwww.samsclub.com%252Fsams%252Fcore-01-c1%252Fprod7590166.ip%253Fpid%253D_DoubleClick_Affiliates%2526ci_src%253D15781033%2526ci_sku%253Dsku8214163;pubid=565079;price=%24324.00;title=iPad+mini+Wi-Fi+16GB+-...;merc=Sam%27s+Club;imgsrc=http%3A%2F%2Fs7d2.scene7.com%2Fis%2Fimage%2Fsamsclub%2Fs7product%2F0040632705959_A.jpg;width=85;height=85" vspace="0" width="180"></iframe><iframe bordercolor="#000000" frameborder="0" height="150" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://ad.doubleclick.net/adi/N7433.148119.BLOGGEREN/B6627866.240069;sz=180x150;ord=[timestamp]?;lid=41000613802463918;pid=69347;usg=AFHzDLt7CZJKyBeGDL5eMF1DpRQlPN8aAQ;adurl=http%253A%252F%252Fwww.abt.com%252Fproduct%252F69347%252FApple-Z0MS0002K.html;pubid=565079;price=%243349.00;title=Apple+27+%22+iMac+3.4GHz...;merc=Abt+Electronics+%26+Appliances;imgsrc=http%3A%2F%2Fcontent.abt.com%2Fmedia%2Fimages%2Fproducts%2Fl_MD093LLA.jpg;width=97;height=85" vspace="0" width="180"></iframe><iframe bordercolor="#000000" frameborder="0" height="150" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://ad.doubleclick.net/adi/N7433.148119.BLOGGEREN/B6627866.240071;sz=180x150;ord=[timestamp]?;lid=41000613802463918;pid=65916;usg=AFHzDLsDbPgNiU5Q5136INwoQsybBgB2MA;adurl=http%253A%252F%252Fwww.abt.com%252Fproduct%252F65916%252FApple-Z0NP00031.html;pubid=565079;price=%241249.00;title=Apple+Mac+Mini+2.6GHz+...;merc=Abt+Electronics+%26+Appliances;imgsrc=http%3A%2F%2Fcontent.abt.com%2Fmedia%2Fimages%2Fproducts%2Fl_Z0NP00031.jpg;width=110;height=58" vspace="0" width="180"></iframe><br />
<br /></div>
<div>
<br /></div>
Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-63765907158072307592012-08-03T08:00:00.000-04:002014-01-24T08:41:18.249-05:00GMail Tips: Access Contacts easily when composing messagesSometimes you need to access your lists of contacts when composing your e-mails without jumping back and forth ad nauseum between GMail and Contacts. This is another one of those useful but too subtle to notice GMail interface features but it works well once you know about it.<br />
<br />
<ol>
<li>Click on the little grey "To" labeling the "To Field"; it is an actual link.</li>
<li>You will get a popup of your Contacts list. Then you can:</li>
<ul>
<li>Click on people's names to select them for sending mail.</li>
<li>Click on the drop-down group listing to select a sub-group of people to sift through.</li>
<li>Click on "All" or "None" to send mail to the entirety of whichever group is selected.</li>
<li>Click on names and then click on "Save as Group..." to add a group label to them; useful for quicker future searches, and quickly sending mail to the entire group.</li>
</ul>
</ol>
<div>
That should help your workflow.</div>
Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-43483994798954519762012-07-31T08:00:00.000-04:002015-12-08T15:26:06.478-05:00GMail Tips: Forward Conversation Thread in OrderSometimes people using GMail want to be able to forward a complete conversation thread to someone else, but in order of oldest post first. The menu item placement for that is not intuitive unfortunately. This is what you do:<br />
<ol>
<li>Click on the conversation (it will take you to the view of the conversation)</li>
<li>Go to the "More" drop-down menu at the top and select "Forward All"</li>
<li>Compose your forwarded message as you like.</li>
</ol>
<div>
That is it. It would be more orthogonal if the "Forward All" was also placed in the message context menu like "Reply All" is.</div>
Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-66956172420515668072012-07-24T08:00:00.000-04:002014-01-24T08:39:01.529-05:00Accessing IPython Notebook remotely over an SSH tunnel<h2>
What is IPython Notebook?</h2>
IPython Notebook is the web-based environment that comes with <a href="http://ipython.org/" target="_blank">IPython</a> and is used for scientific computing and visualization. From their website:<br />
<br />
<span style="color: #444444;"><i>"A web-based notebook with the same core features but support for code, text, mathematical expressions, inline plots and other rich media."</i></span><br />
<h2>
What we wanted to do?</h2>
<div>
We wanted to be able to access the IPython Notebook environment remotely from researcher machines. The reasons for this were multiple:</div>
<div>
<ol>
<li><span style="background-color: white;">Their data had to reside on the remote machines that we did not have access to. </span></li>
<li><span style="background-color: white;">Install and configuration of IPython on these remote machines was specifically setup for this use</span><span style="background-color: white;"> and we wanted to keep that environment consistent.</span></li>
<li><span style="background-color: white;">There were multiple users that wanted to access the IPython Notebook but also each others' information as needed.</span></li>
</ol>
</div>
<h2>
The Solution</h2>
<div>
The solution was to access the IPython Notebook environment remotely over an SSH tunnel.<br />
<br />
<h3>
<span style="background-color: white;"><span style="color: #444444;"><a name='more'></a>Step 1</span></span></h3>
On the remote machine run the IPython web-based environment and direct it to a specific port (instead of the default which fires up a web browser). The command for this should look something like:</div>
<blockquote class="tr_bq">
<pre>ipython notebook --no-browser --port=7000</pre>
</blockquote>
<div>
Now it is running on port 7000 (we just picked this arbitrarily) and also doesn't start up the browser as it normally does.<br />
<br /></div>
<div>
<h3>
<span style="color: #444444;">
Step 2</span></h3>
</div>
<div>
On the local machine, you would want to make sure you have credentials to access the remote machine without having to type a password; this makes the process smoother and is necessary with the flags we are using below. For example, you could use SSH public-private key pairs with cached credentials or authenticate with Kerberos where SSH supports GSSAPI.<br />
<br />
<h3>
<span style="color: #444444;">Step 3</span></h3>
<span style="background-color: white;">Now you can access this port using an SSH tunnel with port forwarding. The command for that will look like:</span></div>
<blockquote class="tr_bq">
<pre>ssh -N -f -L localhost:6000:localhost:7000 username@dest.ination.com</pre>
</blockquote>
This command can be broken down as follows:<br />
<br />
<table cellspacing="5px" frame="box" rules="all"><tbody>
<tr><td style="width: 5%;"><b>-N</b></td><td>This flag is used to tell SSH to not execute a remote command; it is used exclusively with port forwarding for situations like this.</td></tr>
<tr><td style="width: 5%;"><b>-f</b></td><td>This flag tells SSH to go into the background before it executes the command but after the port forwards are established.<br />
<br />
This command also implies "-n" which prevents reading from <i>stdin</i> and is necessary when putting SSH in the background.<br />
<br />
<i><b>Note:</b> "-n" does something completely different from "-N".</i></td></tr>
<tr><td style="width: 5%;"><b>-L</b></td><td>This command sets up the port forwards.<br />
<br />
In this particular case, the first pair of <i>localhost:6000</i> says to forward port 6000 on the localhost to the SSH port 22. The second pair of <i>localhost:7000</i> says to have the SSH port 22 on the remote machine be forwarded to port 7000 on the remote machine which is where IPython Notebook is running.<br />
<br />
It essentially links an arbitrary local port to a port on the remote machine over an SSH tunnel.</td></tr>
</tbody>
</table>
<br />
<span style="background-color: white;">The overall idea of the command is that you want to tell SSH to connect to the remote machine, not read data from </span><i style="background-color: white;">stdin</i><span style="background-color: white;"> and go into the background successfully after establishing the port forwards.</span><br />
<br />
<i><b>Note: </b>The port numbers are arbitrary. I used 6000 and 7000 to clarify the command but you can just use the same port number as well.</i><br />
<i><br /></i>
<br />
<h3>
<span style="color: #444444;">Step 4</span></h3>
<div>
This is all setup. Now to use the session all you have to do is run your preferred web browser on your local machine with the URL: </div>
<div>
<blockquote class="tr_bq">
http://localhost:6000</blockquote>
<b>Note: </b>Your particular installation of the IPython Notebook server may have SSL enabled in its configuration files. If that is the case use 'https://localhost:6000' instead.</div>
<h2>
So how did the different users sharing data come into play here?</h2>
<div>
We assigned each person on the research team a different port number and asked them to always run IPython with that on the remote machine. Then when they connected to it via port-forwarding they used a different port number to access a different researcher's session.<br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;"><i><b>Note:</b> only one person can establish the tunnel to an IPython session at a time.</i></span><br />
<br />
We wrapped this up in a nice pretty script so that all they had to do was run the command with the name of the user to whose session they wanted to connect to and it did the rest for them.<br />
<br />
<br />
<iframe bordercolor="#000000" frameborder="0" height="150" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://ad.doubleclick.net/adi/N963.148119.BLOGGEREN/B6527721.7;dcadv=3632184;sz=180x150;lid=41000613802463762;pid=UBM9780596158101;usg=AFHzDLuRQI04e79eJWiWi48zDpI270jxwQ;adurl=http%253A%252F%252Fwww.cdsbooksdvds.com%252Fproduct.jhtm%253Fsku%253DUBM9780596158101;pubid=565079;price=%2449.45;title=Programming+Python+%284t...;merc=CDS+Books+and+DVDS;imgsrc=http%3A%2F%2Fc381925.r25.cf1.rackcdn.com%2F9780596158101.jpg;width=64;height=85" vspace="0" width="180"></iframe><iframe bordercolor="#000000" frameborder="0" height="150" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://ad.doubleclick.net/adi/N963.148119.BLOGGEREN/B6527721.7;dcadv=3632184;sz=180x150;lid=41000613802463973;pid=sku6654072;usg=AFHzDLubAWLub7G_CK6EliARGJZKspjmnQ;adurl=http%253A%252F%252Fwww.samsclub.com%252Fsams%252Fnetgear-wireless-n-300-router%252Fprod6190040.ip%253Fpid%253D_DoubleClick_Affiliates%2526ci_src%253D15781033%2526ci_sku%253Dsku6654072;pubid=565079;price=%2443.86;title=Netgear+Wireless-N+300...;merc=Sam%27s+Club;imgsrc=http%3A%2F%2Fs7d2.scene7.com%2Fis%2Fimage%2Fsamsclub%2Fs7product%2F0060644905915_A.jpg;width=85;height=85" vspace="0" width="180"></iframe><iframe bordercolor="#000000" frameborder="0" height="150" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://ad.doubleclick.net/adi/N963.148119.BLOGGEREN/B6527721.7;dcadv=3632184;sz=180x150;lid=41000613802463973;pid=sku6654066;usg=AFHzDLuhirlRJ3K85zzq1enRFeXKpdDjgA;adurl=http%253A%252F%252Fwww.samsclub.com%252Fsams%252Fnetgear-wireless-n150-usb-adapter%252Fprod6190034.ip%253Fpid%253D_DoubleClick_Affiliates%2526ci_src%253D15781033%2526ci_sku%253Dsku6654066;pubid=565079;price=%2432.36;title=Netgear+Wireless+N150+...;merc=Sam%27s+Club;imgsrc=http%3A%2F%2Fs7d2.scene7.com%2Fis%2Fimage%2Fsamsclub%2Fs7product%2F0060644906779_A.jpg;width=85;height=85" vspace="0" width="180"></iframe><br /></div>
Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com4tag:blogger.com,1999:blog-4773587325389338473.post-36525012020803467462012-07-17T08:00:00.000-04:002014-01-24T08:43:25.336-05:00Indenting Tables in Google Docs (work-around)<b style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">Limitation:</b><span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;"> </span><br />
<span style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">You can't move a table around to place it in an arbitrary location. It cannot be indented, right-justified, centered, etc. T</span><span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">he top-left corner is locked to the left-most position on the page.</span><br />
<span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;"><br /></span>
<span style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;"><b>Work-around:</b></span><br />
<span style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">You can, however, resize the table and change the border. So to indent tables the only work-around at the moment is to nest tables. </span><br />
<ol>
<li><span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">Make a table (outer-table) with a white border and create another table inside it (inner-table). </span></li>
<li><span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">Adjust the cell-padding on the outer-table to move the inner table around to indent it.</span></li>
</ol>
<div>
<b style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">When will it be fixed?</b></div>
<span style="font-family: Arial, sans-serif; font-size: 13px;"><span style="line-height: 18px;">This is a known issue that google is aware of (September 14, 2010):</span></span><br />
<a href="http://productforums.google.com/forum/#!topic/docs/6YpTmJZ3Flk" target="_blank"> http://productforums.google.com/forum/#!topic/docs/6YpTmJZ3Flk</a>Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-15808183545691081752012-07-10T08:00:00.000-04:002014-01-24T08:39:31.933-05:00What is "this" in Java?<br />
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
So in learning Java I found the "this" keyword to be a bit of an odd item to work with. It is pretty obvious now but initially it was confusing and some google-fu helped clear things up. The one thing that was a bit subtle was the construct:</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<br /></div>
<pre data-mce-style="padding-left: 30px;" style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; padding-left: 30px;">InnerClass innerClassObject = this.new innerClassConstructor();</pre>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<br /></div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
So here is the answer. When you have an Inner Class, it can't be handled directly at all and needs to be referenced via an instanced object of its encapsulating Outer Class. In other words, you need an object created for the Outer Class before you can create an object of the Inner Class. The code would normally look as follows:</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<br /></div>
<pre data-mce-style="padding-left: 30px;" style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; padding-left: 30px;">OuterClass.InnerClass innerClassObject = new outerClassConstructor().new innerClassConstructor();</pre>
<pre data-mce-style="padding-left: 30px;" style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; padding-left: 30px;">
</pre>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<br />
<a name='more'></a></div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
This is how you would refer to and create an Inner Class object from anywhere (say in the "main" method).</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
However, the code changes if you are doing the same from within the scope of the Outer Class itself. In that case it will look like the first line. This is because the "this" is being used to call the constructor of the Outer Class to create an object (much like "new outerClassConstructor()" call) which returns a reference (address) to the Outer Class object. After that the "new" for the Inner Class can be called using the Outer Class reference.</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
The left-hand side no longer refers using OuterClass.InnerClass as within the scope of the "OuterClass" it is clear what is "InnerClass". The example looks like:</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<br /></div>
<pre style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;">class OuterClass {
anOuterClassMethod(){
InnerClass innerClassObject = this.new innerClassConstructor();
...
}
class InnerClass{
innerClassConstructor(){
...
}
}
}</pre>
<pre style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;"></pre>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
Here is a reference to another page that describes things similarly:</div>
<div data-mce-style="padding-left: 30px;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; padding-left: 30px;">
<a data-mce-href="http://download.oracle.com/javase/tutorial/java/javaOO/innerclasses.html" href="http://download.oracle.com/javase/tutorial/java/javaOO/innerclasses.html">http://www.javaranch.com/campfire/StoryInner.jsp</a></div>
<div data-mce-style="padding-left: 30px;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; padding-left: 30px;">
<br /></div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
Here is the tutorial that I came across this construct initially:</div>
<div data-mce-style="padding-left: 30px;" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; padding-left: 30px;">
<a data-mce-href="http://download.oracle.com/javase/tutorial/java/javaOO/innerclasses.html" href="http://download.oracle.com/javase/tutorial/java/javaOO/innerclasses.html">http://download.oracle.com/javase/tutorial/java/javaOO/innerclasses.html</a></div>
Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0tag:blogger.com,1999:blog-4773587325389338473.post-56143645348839686962012-07-03T11:49:00.000-04:002012-07-12T13:30:53.309-04:00Issue with 32-bit Applications on 64-bit Linux<br />
When running 32-bit applications on 64-bit Linux you may find that your application does not run and gives the following error (or similar):<br />
<pre data-mce-style="padding-left: 30px;" style="color: #333333; font-family: Consolas, Monaco, monospace; font-size: 13px; line-height: 18px; padding-left: 30px;"><blockquote class="tr_bq">GLib-WARNING : getpwuid_r(): failed due to unknown user id</blockquote></pre>
This error was noticed when running 32-bit SPSS on 64-bit RHEL 6 with LDAP authentication. The reason for the issue was the lack of 32-bit versions of sssd; 32-bit applications cannot use the 64-bit versions of the libraries and hence SPSS could not lookup the appropriate user information.<br />
<br />
The correct resolution for this is to install the 32-bit version of sssd (in addition to the 64-bit versions) so that the 32-bit versions of pam_sss and nss_sss are available for use by 32-bit applications.Suleman Diwanhttp://www.blogger.com/profile/14600766873572571287noreply@blogger.com0