Huascar Sanchez Posts2023-02-04T21:05:56+00:00http://huascarsanchez.com/Curriculum Vitae2017-02-01T00:00:00+00:00http://huascarsanchez.com/posts/notes/cv<div class="shifted">
<div class="section">
<div class="entry">
<div class="item">
<span class="deemph">(Last updated on Dec. 2016)</span>
</div>
</div>
</div>
</div>
<h1 id="huascar-sanchez">Huascar Sanchez</h1>
<p>WIP</p>
Read to Understand (RTU) Task2016-02-22T00:00:00+00:00http://huascarsanchez.com/experiments/multistaging/rtu-guidelines<p>Please follow all of the instructions below:</p>
<h1 id="prereqs">PREREQS</h1>
<p>Make sure you have</p>
<ol>
<li>Google Chrome latest version installed on your computer.</li>
<li>Uninstalled any previously installed version of Violette from Chrome.</li>
</ol>
<h1 id="guidelines-for-the-read-to-understand">GUIDELINES FOR THE READ TO UNDERSTAND</h1>
<h2 id="goal">GOAL</h2>
<p>Gain understanding in (without multi staging to understand)</p>
<ul>
<li>Control flow: what is the sequence of execution?</li>
<li>State: what is the content of a data object?</li>
<li>Operations: what does the code compute?</li>
<li>Data flow: where does a data object get updated?</li>
<li>Function: what is the overall functionality?</li>
</ul>
<h2 id="guidelines">GUIDELINES</h2>
<ol>
<li>Inspect each code example (one at a time).</li>
<li>Spend your time wisely, don’t go outside the code example’s Q&A page.</li>
<li>Gain understanding in the asked abstractions; e.g., control flow, etc.</li>
</ol>
<h1 id="the-task">THE TASK</h1>
<p>There will be 3 Java code examples (Accepted Answers) to review and understand.
These examples were extracted from StackOverflow. Your task is to use the Read
to Understand (RTU) comprehension technique to dig into each of the Java code
examples. This technique involves reading the source code of the given code
examples. After 30 minutes, per Java code example, you will be asked to answer
a number of questions about the reviewed piece of code.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Please record the time spent reviewing the Java code example.
Please submit this information as the answer for "How long did you
spend reviewing and understanding the Java code example?",
which is found in the online questionnaire you will be
completing after finishing the whole task.
</code></pre></div></div>
<p>For each example, there will be two links. First link will take you to a page
containing a StackOverflow’s accepted answer. This answer contains some Java code.
Second link will take you to an online questionnaire where you’ll answer a number
of program comprehension questions about the reviewed piece of code.</p>
<p>After you’ve finished reviewing and understanding the Java code example, please
comeback to the experiment page. Then, click on the Java code example’s second
link to answer the program comprehension questionnaire.</p>
<p>After answering the questionnaire, close its page and then comeback to the experiment
page. Once there, click on the next Java code example to review.</p>
<p>Lastly, after reviewing all code examples and answering their questionnaires, please answer
our <a href="http://bit.ly/1KPyrlW" target="_blank">debriefing questionnaire</a>.</p>
<h1 id="task-expectations">TASK EXPECTATIONS</h1>
<p>We expect the following throughout the task:</p>
<p><strong>1.</strong> We expect you to review and understand a total of <strong>3</strong> Java code examples,
in the <strong>order provided</strong> in this page.</p>
<p><strong>2.</strong> We expect the whole task be done within <strong>2 hrs</strong>; including the
the time spent reviewing this page.</p>
<p><strong>3.</strong> We expect the subjects to use only the resources available on the
question-answer page to complete the task; i.e., no external resources like
Wikipedia should be used.</p>
<h1 id="lets-get-started">LET’S GET STARTED</h1>
<p>So without further ado, please click on the first link of Code Example 1 below to start the task:</p>
<p><strong>1.</strong> Code Example 1 (<a href="http://bit.ly/1Mt3TEL" target="_blank">code</a>, <a href="http://bit.ly/1BLdRe4" target="_blank">program comprehension questionnaire</a>) <br />
<strong>2.</strong> Code Example 2 (<a href="http://bit.ly/1Kd9oYF" target="_blank">code</a>, <a href="http://bit.ly/1FV2Drr" target="_blank">program comprehension questionnaire</a>) <br />
<strong>3.</strong> Code Example 3 (<a href="http://bit.ly/1Kd9xeJ" target="_blank">code</a>, <a href="http://bit.ly/1KNTkhw" target="_blank">program comprehension questionnaire</a>)</p>
Multistaging to Understand (MTU) Task2015-12-05T00:00:00+00:00http://huascarsanchez.com/experiments/multistaging/mtu-guidelines<p>Please follow all of the instructions below:</p>
<h1 id="prereqs">PREREQS</h1>
<p>Make sure you have</p>
<ol>
<li>Google Chrome latest version installed on your computer.</li>
<li>Uninstalled any previously installed Violette from Chrome.</li>
<li>Installed <a href="http://bit.ly/1IsfPG8" target="_blank">Violette-multi-staging-mode</a> on Chrome<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>.</li>
</ol>
<h1 id="guidelines-for-the-multi-staging-to-understand">GUIDELINES FOR THE MULTI STAGING TO UNDERSTAND</h1>
<h2 id="goal">GOAL</h2>
<p>Gain understanding in</p>
<ul>
<li>Control flow: what is the sequence of execution?</li>
<li>State: what is the content of a data object?</li>
<li>Operations: what does the code compute?</li>
<li>Data flow: where does a data object get updated?</li>
<li>Function: what is the overall functionality?</li>
</ul>
<h2 id="guidelines">GUIDELINES</h2>
<ol>
<li>Inspect each code example (one at a time).</li>
<li>Spend your time wisely, don’t go outside the Q&A page.</li>
<li>Click on the <em>stage</em> button<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">2</a></sup> to generate an ordered set of stages<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">3</a></sup>; e.g., 0:stage-name, 1:stage-name, …, N:stage-name</li>
<li>Review the name of the stages in the order they appeared.</li>
<li>Iteratively click on any of the generated code stages to introduce a subset of the given Java code example’s behavior. E.g., Click stages in any order. <br />
4.1 Open any hidden code blocks as you go along, and then try to understand its enclosed elements.</li>
<li>Review the introduced subset of behavior to make sure you understand what it is actually doing.</li>
</ol>
<h1 id="the-task">THE TASK</h1>
<p>There will be 3 Java code examples (Accepted Answers) to review and understand.
These examples were extracted from StackOverflow. Your task is to use the
Multistaging to Understand (MTU) comprehension technique to dig into each of the
Java code examples. This technique involves a few steps. Given a series of code stages
(extracted from a code example), you will non-sequentially inspect a few of these
stages, mentally abstract their functionality, and then use that knowledge to understand
the example’s intended function. After 30 minutes, per Java code example, you will be
asked to answer a number of questions about the reviewed piece of code.</p>
<p>For each example, there will be two links. First link will take you to a page
containing a StackOverflow’s accepted answer. This answer contains some Java code.
Second link will take you to an online questionnaire where you’ll answer a number
of program comprehension questions about the reviewed piece of code.</p>
<p>After you’ve finished reviewing and understanding the Java code example, please
click on the <em>Bring it to Desktop</em> button and then provide a brief description of the
(1) goal behind this code example and (2) the reason for using it. Then, please
press the _enter_key to record your answer.</p>
<p>Please comeback to the experiment page after bringing the Java code example onto
your desktop. Then, click on the Java code example’s second link to answer the
program comprehension questionnaire.</p>
<p>After answering the program comprehension questionnaire, close its page and then
comeback to the experiment page. Once there, click on the next Java code example
to review.</p>
<p>Lastly, after reviewing all code examples and answering their questionnaires, please answer
our <a href="http://bit.ly/1KPyrlW" target="_blank">debriefing questionnaire</a>.</p>
<h1 id="task-expectations">TASK EXPECTATIONS</h1>
<p>We expect the following throughout the task:</p>
<p><strong>1.</strong> We expect you to review and understand a total of <strong>3</strong> Java code examples,
in the <strong>order provided</strong> in this page.</p>
<p><strong>2.</strong> We expect the whole task be done within <strong>2 hrs</strong>; including the
the time spent reviewing this page.</p>
<p><strong>3.</strong> We expect the subjects to use only the resources available on the
question-answer page to complete the task; i.e., no external resources like
Wikipedia should be used.</p>
<h1 id="lets-get-started">LET’S GET STARTED</h1>
<p>Before starting, please watch the following video. This video introduces violette and
the multi-staging functionality and UI.</p>
<iframe width="532" height="400" src="https://www.youtube.com/embed/wNBjNcqbDdI" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>
<!-- <a href="https://www.youtube.com/watch?v=wNBjNcqbDdI" target="_blank">Multi staging Quicksort</a>-->
<p>So without further ado, please click on the first link of Code Example 1 below to start the task:</p>
<p><strong>1.</strong> Code Example 1 (<a href="http://bit.ly/1Mt3TEL" target="_blank">code</a>, <a href="http://bit.ly/1BLdRe4" target="_blank">program comprehension questionnaire</a>) <br />
<strong>2.</strong> Code Example 2 (<a href="http://bit.ly/1Kd9oYF" target="_blank">code</a>, <a href="http://bit.ly/1FV2Drr" target="_blank">program comprehension questionnaire</a>) <br />
<strong>3.</strong> Code Example 3 (<a href="http://bit.ly/1Kd9xeJ" target="_blank">code</a>, <a href="http://bit.ly/1KNTkhw" target="_blank">program comprehension questionnaire</a>)</p>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:1" role="doc-endnote">
<p>Open Google Chrome and on the Url bar type <code class="language-plaintext highlighter-rouge">chrome://extensions</code>. Look for <code class="language-plaintext highlighter-rouge">violette-staging-no-summarization.crx</code>. Get the file and then drop it on the Chrome extension area. Press the <code class="language-plaintext highlighter-rouge">Add</code> button and you’re done. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:3" role="doc-endnote">
<p>This button is located on the top right corner of Violette. Each stage is represented as <strong>named</strong> button. Stages are presented in ascending order; i.e., starting from <code class="language-plaintext highlighter-rouge">0</code> to <code class="language-plaintext highlighter-rouge">n</code> where <code class="language-plaintext highlighter-rouge">n</code> is the maximum number of stages that can be extracted from the code example. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:4" role="doc-endnote">
<p>If after clicking on the stage button you get an error (red box) from the server, then please refresh the Web page and retry to stage the example. <a href="#fnref:4" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>
Data2015-12-05T00:00:00+00:00http://huascarsanchez.com/experiments/multistaging/data-stuff<h3 id="data-set">Data set</h3>
<p>We collected 50,000 Q\&A pages containing Java code examples, accumulated over a 4 year span. Our data set is available at <a href="http://goo.gl/6IbfVi" target="_blank">stackoverflow-corpus</a>.</p>
<p>We sorted this data set into 3 size categories: short (~50 LOC), medium (~135 LOC), and long (~200 LOC). Then, we randomly selected the examples from each size category.</p>
<h3 id="mturtu-answers">MTU/RTU answers</h3>
<p>The answers to the open ended program comprehension questions are available at <a href="https://goo.gl/O37YVF" target="_blank">program-comprehension-answers</a>.</p>
Source Code Curation Tooling for the Code Forager2015-10-25T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/abstract<h2 id="abstract">Abstract</h2>
<p>The Web has changed the dynamics of programming. We are in an era where reusing code from the Web is frequently the norm, not the exception. In this era, programmers use question and answer (Q&A) sites like StackOverflow to pose coding questions and receive coding answers. Programmers using these sites often engage in a complex code foraging process of understanding and adapting the code snippets they encounter to determine their fitness for use. While search still dominates modern code retrieval, search alone offers little support for validating search results for fitness of use. This is, in large part, due to the inherently questionable quality of online source code. Most online source code is not guaranteed to be good, to work properly, or to be trustworthy. This dissertation focuses on this challenge by introducing Source Code Curation, along with a set of tools that implements it. Source Code Curation is a blend of filtering, refinement, and validation activities. Source Code Curation can help programmers determine what source code is more likely to be useful, and what’s not. Specifically, it can help them both address the inherently questionable quality of online source code upfront, and complete their source code understanding tasks quickly and accurately.</p>
Codepacking2015-04-04T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/tools/codepacking<h2 id="codepacking">Codepacking</h2>
<p><em>Codepacking</em> is a technique for automatically resolving incomplete code snippets. Its ultimate goal is not about achieving program correctness but approximating program completeness. <em>Codepacking</em> produces an Abstract Syntax Tree (<em>AST</em>) of a partial program that <em>Vesperin</em> can manipulate.</p>
<p><em>Codepacking</em> consists of four steps:</p>
<ol>
<li>Surrounds code example with the appropriate body declarations (class, method, or both), if needed.</li>
<li>It cross references missing type information of existing ill-typed expressions with a repository of pre-acquired API information and then suggests their well-typed corrections.</li>
<li>It uses Vesperin’s code transformation utilities to add the suggested corrections to the example’s code.</li>
<li>It produces the desired AST.</li>
</ol>
<p>Codepacking’s code is still private. However, once it becomes public, it
will be available <a href="https://github.com/vesperin/" target="_blank">here</a>.</p>
My book is out!2015-03-05T00:00:00+00:00http://huascarsanchez.com/posts/notes/book<h2 id="software-patterns-knowledge-maps-and-domain-analysis">Software Patterns, Knowledge Maps, and Domain Analysis</h2>
<p>My book is about domain analysis and software patterns. Briefly, it shows how
to build software systems as systems of patterns, called Knowledge Maps.</p>
<p>It is now in the global markets. Its publication date was December 2014. Please
check it out:</p>
<ol>
<li>
<p>At <a href="http://tinyurl.com/SoftwarePatterns"><strong>Amazon</strong></a>.</p>
</li>
<li>
<p>At <a href="http://www.crcpress.com/product/isbn/9781466571433"><strong>CRC Press</strong></a>.</p>
</li>
<li>
<p>At <a href="http://www.taylorandfrancis.com/books/details/9781466571433/"><strong>Taylor & Francis</strong></a>.</p>
</li>
</ol>
<figure>
<img style="border: 1px solid #e5e5e5;" src="http://www.huascarsanchez.com/static/K16540.jpg" alt="Software Patterns, Knowledge Maps, and Domain Analysis" height="684" width="432" />
<figcaption style="padding-left: 2cm;">Figure 1. Front cover of my book</figcaption>
</figure>
<p>The citation (in BibTex) of this book is presented as follows:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>@book{hsanchez,
author = {M. E. Fayad, H. A. Sanchez, S. G .K. Hegde,
A. Basia, and A. Vakil.},
title = {Software Patterns, Knowledge Maps, and
Domain Analysis},
publisher = {Auerbach Publications},
year = 2014,
address = {Boca Raton, Florida},
isbn = {978-1466571433}
}
</code></pre></div></div>
Violette with Multi Staging and Code Summarization2015-03-04T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/tools/violette-sum-multistage<p>To evaluate <strong>Violette</strong>’s functionality, I have put together the following
<strong>experiment</strong>. Please follow all of the instructions below:</p>
<h1 id="prereqs">PREREQS</h1>
<p>Make sure you have</p>
<ol>
<li>Google Chrome latest version installed on your computer.</li>
<li>Uninstalled any previously installed Violette from Chrome.</li>
<li>Installed <a href="https://www.dropbox.com/s/b9148o15se0u8wa/violette-staging.crx?dl=0" target="_blank">Violette-staging-mode</a> on Chrome<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>.</li>
</ol>
<h1 id="the-task">THE TASK</h1>
<ol>
<li>
<p>You, the subject, must click on a linked code example below.
This link will take you to a page containing a StackOverflow’s accepted answer.
This answer contains some Java code.</p>
</li>
<li>
<p>Once you are on that page, your goal is to review and understand the Java
code example.</p>
<p>If the links takes you to an answer without any Java code, feel free to
comeback to experiment page and then refresh it. This action will give you
a new linked code example.</p>
<p>For this task, you will be using both <strong>Violette</strong>’s multi-staging
functionality<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup> and code summarization via automated code folding.</p>
<p>The multi staging functionality is activated by clicking on the <code class="language-plaintext highlighter-rouge">stage</code> button.
Each stage is represented as named button.</p>
<p>Code summarization functionality is activated when clicking on any of the
produced stages. This functionality will identify the location of a few code
blocks in the stage and then it will automatically fold them.</p>
<p>Please record on a piece of paper those examples that did not have any Java
code inside. Please submit this information as part of a survey you will
completing after finishing the experiment.</p>
</li>
<li>
<p>After you’ve finished reviewing and understanding the code example, please
click on the <em>Bring it to Destop</em> button and the provide a description of the
goal behind this code example and the reason for using it. Including, fitness of
purpose, abstractions, usage protocols, etc.</p>
<p>If you’ve previously received a key or username from me,
then include it in the description of the code example;
e.g., username: the code does ….</p>
</li>
<li>
<p>Lastly, bringing the code example to your desktop, please comeback this page
and then complete the following <a href="http://goo.gl/vzqmzG">survey</a>.</p>
</li>
</ol>
<h1 id="task-expectations">TASK EXPECTATIONS</h1>
<p>We expect the following throughout the task:</p>
<p><strong>1.</strong> We expect you to review and understand a total of <strong>10</strong> Java code examples
generated by this page.</p>
<p><strong>2.</strong> We expect the whole task be done within <strong>1 hr and 30 minutes</strong>.</p>
<p><strong>3.</strong> We expect the subjects to use only the resources available on the
question-answer page to complete the task; i.e., no external resources like
Wikipedia.</p>
<h1 id="lets-get-started">LET’S GET STARTED</h1>
<p>So without further ado, please click on the link below to start the task:</p>
<div id="example">
</div>
<p>Thank you for participating in this experiment. Now, we need your feedback. Please take a few minutes to complete our <a href="http://goo.gl/vzqmzG">survey</a>.</p>
<script>
function shuffle(array) {
var currentIndex = array.length
, temporaryValue
, randomIndex
;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
$(document).ready(function(){
// use this https://github.com/marcuswestin/store.js
// http://jsfiddle.net/hHLXr/12/
// http://okta6.ideone.com/gfx2/js/ideone-index.js
// http://html5demos.com/contenteditable
var cached = JSON.parse(window.localStorage.getItem('cached'));
var shuffled = shuffle(cached.items);
var selected = shuffled[0] || null;
if(selected != null){
var replace = $("<div/>", {'class':'file-editor', 'html': 'A. ', 'style': 'font-weight: bold;'});
var link = $('<a>', {
'text': selected.title,
'href': selected.href,
'target': selected.target,
'style': 'cursor: pointer;'
});
replace.append(link);
$("#example").replaceWith(replace);
}
});
</script>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:1" role="doc-endnote">
<p>Open Google Chrome and on the Url bar type <code class="language-plaintext highlighter-rouge">chrome://extensions</code>. Look for <code class="language-plaintext highlighter-rouge">vesper-web.crx</code>. Get the file and then drop it on the Chrome extension area. Press the <code class="language-plaintext highlighter-rouge">Add</code> button and you’re done. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:2" role="doc-endnote">
<p>Multi staged code examples are divided into a series of intermediate phases, presenting lower-level modules (supporting modules) before higher-level modules (main modules). <a href="#fnref:2" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>
Multistager2015-02-15T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/tools/multistager<h2 id="code-multistager-multistaging-to-understand">Code Multistager, Multistaging to Understand</h2>
<p>The idea behind Multistaging to Understand (MTU) is that given a series of code stages (extracted from a code example), programmers non-sequentially inspect a few of these stages, mentally abstract their functionality, and then use that knowledge to understand the example’s intended function. The following slides walks the reader through what MTU is and what’s behind it:</p>
<script async="" class="speakerdeck-embed" data-id="98cd712192ab4210b967f33631701a1d" data-ratio="1.33333333333333" src="//speakerdeck.com/assets/embed.js"></script>
<p>The code of our Code examples multistager is still private. However, once it
becomes public, it will be available <a href="https://github.com/vesperin/" target="_blank">here</a>.</p>
<p>If you want to get access to this code, please send me an <a href="mailto:hsanchez@cs.ucsc.edu">email</a>.</p>
Multi Staging to Understand Task2015-01-28T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/tools/violette-multistage<p>Please follow all of the instructions below:</p>
<h1 id="prereqs">PREREQS</h1>
<p>Make sure you have</p>
<ol>
<li>Google Chrome latest version installed on your computer.</li>
<li>Uninstalled any previously installed Violette from Chrome.</li>
<li>Installed <a href="http://bit.ly/1IsfPG8" target="_blank">Violette-multi-staging-mode</a> on Chrome<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>.</li>
</ol>
<h1 id="guidelines-for-the-multi-staging-to-understand">GUIDELINES FOR THE MULTI STAGING TO UNDERSTAND</h1>
<h2 id="goal">GOAL</h2>
<p>Gain understanding in</p>
<ul>
<li>Control flow: what is the sequence of execution?</li>
<li>State: what is the content of a data object?</li>
<li>Operations: what does the code compute?</li>
<li>Data flow: where does a data object get updated?</li>
<li>Function: what is the overall functionality?</li>
</ul>
<h2 id="guidelines-for-multi-staging">GUIDELINES FOR MULTI STAGING<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup></h2>
<ol>
<li>Spend your time wisely, don’t go outside the Q&A page.</li>
<li>Click on the <em>stage</em> button<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup> to generate an ordered set of stages<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">4</a></sup>; e.g., 0:stage-name, 1:stage-name, …, N:stage-name</li>
<li>Review the name of the stages in the order they appeared.</li>
<li>Iteratively click on any of the generated code stages to introduce a subset of the given Java code example’s behavior. E.g., Click stages in any order. <br />
4.1 Open any hidden code blocks as you go along, and then try to understand its enclosed elements.</li>
<li>Review the introduced subset of behavior to make sure you understand what it is actually doing.</li>
</ol>
<h1 id="the-task">THE TASK</h1>
<p>There will be 3 Java code examples (Accepted Answers) to review and understand. Use the appointed
comprehension technique (either Read to Understand or Multi staging to Understand)
to dig into each of the Java code examples. After 30 minutes, per Java code example,
you will be asked to answer a number of questions about the reviewed piece of code.</p>
<p>For each example, there will be two links. First link will take you to a page
containing a StackOverflow’s accepted answer. This answer contains some Java code.
Second link will take you to an online questionnaire where you’ll answer a number
of questions about the reviewed piece of code.</p>
<p>After you’ve finished reviewing and understanding the Java code example, please
click on the <em>Bring it to Desktop</em> button and then provide a brief description of the
goal behind this code example and the reason for using it. Then press the <em>enter</em>
key.</p>
<p>After bringing the Java code example to your desktop, please comeback to the
experiment page. Then, click on the Java code example’s second link to answer the
questionnaire.</p>
<p>After answering the questionnaire, close its page and then comeback to the experiment
page. Once there, click on the next Java code example to review.</p>
<p>Lastly, after reviewing all code examples and answering their questionnaires, please answer
our <a href="http://bit.ly/1KPyrlW" target="_blank">debriefing questionnaire</a>.</p>
<h1 id="task-expectations">TASK EXPECTATIONS</h1>
<p>We expect the following throughout the task:</p>
<p><strong>1.</strong> We expect you to review and understand a total of <strong>3</strong> Java code examples,
in the <strong>order provided</strong> in this page.</p>
<p><strong>2.</strong> We expect the whole task be done within <strong>2 hrs</strong>; including the
the time spent reviewing this page.</p>
<p><strong>3.</strong> We expect the subjects to use only the resources available on the
question-answer page to complete the task; i.e., no external resources like
Wikipedia should be used.</p>
<h1 id="lets-get-started">LET’S GET STARTED</h1>
<p>Before starting, please watch the following video. This video introduces violette and
the multi-staging functionality and UI.</p>
<iframe width="532" height="400" src="https://www.youtube.com/embed/wNBjNcqbDdI" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>
<!-- <a href="https://www.youtube.com/watch?v=wNBjNcqbDdI" target="_blank">Multi staging Quicksort</a>-->
<p>So without further ado, please click on the first link of Code Example 1 below to start the task:</p>
<p><strong>1.</strong> Code Example 1 (<a href="http://bit.ly/1Mt3TEL" target="_blank">src</a>, <a href="http://bit.ly/1BLdRe4" target="_blank">q&a</a>) <br />
<strong>2.</strong> Code Example 2 (<a href="http://bit.ly/1Kd9oYF" target="_blank">src</a>, <a href="http://bit.ly/1FV2Drr" target="_blank">q&a</a>) <br />
<strong>3.</strong> Code Example 3 (<a href="http://bit.ly/1Kd9xeJ" target="_blank">src</a>, <a href="http://bit.ly/1KNTkhw" target="_blank">q&a</a>)</p>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:1" role="doc-endnote">
<p>Open Google Chrome and on the Url bar type <code class="language-plaintext highlighter-rouge">chrome://extensions</code>. Look for <code class="language-plaintext highlighter-rouge">violette-staging-no-summarization.crx</code>. Get the file and then drop it on the Chrome extension area. Press the <code class="language-plaintext highlighter-rouge">Add</code> button and you’re done. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:2" role="doc-endnote">
<p>Multi staged code examples are divided into an ordered set of code stages, such that each code stage builds upon, and in relation to, preceding code stages. Each code stage is a code fragment that captures a subset of the given Java code example’s behavior. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:3" role="doc-endnote">
<p>This button is located on the top right corner of Violette. Each stage is represented as <strong>named</strong> button. Stages are presented in ascending order; i.e., starting from <code class="language-plaintext highlighter-rouge">0</code> to <code class="language-plaintext highlighter-rouge">n</code> where <code class="language-plaintext highlighter-rouge">n</code> is the maximum number of stages that can be extracted from the code example. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:4" role="doc-endnote">
<p>If after clicking on the stage button you get an error (red box) from the server, then please refresh the Web page and re-try to stage the example. <a href="#fnref:4" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>
Read to Understand Task2015-01-27T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/tools/evaluate-answer<p>Please follow all of the instructions below:</p>
<h1 id="prereqs">PREREQS</h1>
<p>Make sure you have</p>
<ol>
<li>Google Chrome latest version installed on your computer.</li>
<li>Uninstalled any previously installed version of Violette from Chrome.</li>
</ol>
<h1 id="guidelines-for-the-read-to-understand">GUIDELINES FOR THE READ TO UNDERSTAND</h1>
<h2 id="goal">GOAL</h2>
<p>Gain understanding in (without multi staging to understand)</p>
<ul>
<li>Control flow: what is the sequence of execution?</li>
<li>State: what is the content of a data object?</li>
<li>Operations: what does the code compute?</li>
<li>Data flow: where does a data object get updated?</li>
<li>Function: what is the overall functionality?</li>
</ul>
<h2 id="guidelines">GUIDELINES</h2>
<ol>
<li>Spend your time wisely, don’t go outside the Q&A page.</li>
<li>Gain understanding in the asked abstractions; e.g., control flow, etc.</li>
</ol>
<h1 id="the-task">THE TASK</h1>
<p>There will be 3 Java code examples (Accepted Answers) to review and understand. Use the appointed
comprehension technique (either Read to Understand or Multi staging to Understand)
to dig into each of the Java code examples. After 30 minutes, per Java code example,
you will be asked to answer a number of questions about the reviewed piece of code.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Please record the time spent reviewing the Java code example.
Please submit this information as the answer for "How long did you
spend reviewing and understanding the Java code example?",
which is found in the online questionnaire you will be
completing after finishing the whole task.
</code></pre></div></div>
<p>For each example, there will be two links. First link will take you to a page
containing a StackOverflow’s accepted answer. This answer contains some Java code.
Second link will take you to an online questionnaire where you’ll answer a number
of questions about the reviewed piece of code.</p>
<p>After you’ve finished reviewing and understanding the Java code example, please
comeback to the experiment page. Then, click on the Java code example’s second
link to answer the questionnaire.</p>
<p>After answering the questionnaire, close its page and then comeback to the experiment
page. Once there, click on the next Java code example to review.</p>
<p>Lastly, after reviewing all code examples and answering their questionnaires, please answer
our <a href="http://bit.ly/1KPyrlW" target="_blank">debriefing questionnaire</a>.</p>
<h1 id="task-expectations">TASK EXPECTATIONS</h1>
<p>We expect the following throughout the task:</p>
<p><strong>1.</strong> We expect you to review and understand a total of <strong>3</strong> Java code examples,
in the <strong>order provided</strong> in this page.</p>
<p><strong>2.</strong> We expect the whole task be done within <strong>2 hrs</strong>; including the
the time spent reviewing this page.</p>
<p><strong>3.</strong> We expect the subjects to use only the resources available on the
question-answer page to complete the task; i.e., no external resources like
Wikipedia should be used.</p>
<h1 id="lets-get-started">LET’S GET STARTED</h1>
<p>So without further ado, please click on the first link of Code Example 1 below to start the task:</p>
<p><strong>1.</strong> Code Example 1 (<a href="http://bit.ly/1Mt3TEL" target="_blank">src</a>, <a href="http://bit.ly/1BLdRe4" target="_blank">q&a</a>) <br />
<strong>2.</strong> Code Example 2 (<a href="http://bit.ly/1Kd9oYF" target="_blank">src</a>, <a href="http://bit.ly/1FV2Drr" target="_blank">q&a</a>) <br />
<strong>3.</strong> Code Example 3 (<a href="http://bit.ly/1Kd9xeJ" target="_blank">src</a>, <a href="http://bit.ly/1KNTkhw" target="_blank">q&a</a>)</p>
Stircup2015-01-01T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/tools/stircup<h2 id="stircup-search-application-for-stackoverflow-code-examples">Stircup: Search application for (StackOverflow) Code examples</h2>
<p>A brief introduction to get started with Stircup.</p>
<p>Its easy to get started with it. You use it by first entering a query, and then pressing the <strong>Search</strong> button below. Behind the scenes, the application fetches a few batches of code examples from StackOverflow ranked by significance to a query, ignores those ones that don’t match some user given criteria, and then displays the top k most relevant ones.</p>
<p>The criteria we are using include: code examples contain only Java code, at least 5 lines of code. The final result is a list of k most relevant (and or typical if the sorting by typicality checkbox is checked) code examples.</p>
<p>The first time you use it, the results get cached on your browser. After that, every time you search, this is done on your computer.</p>
<div id="columns">
<div id="left-col">
<h4>
<span class="searcher">
<input id="topk" style="width: 20px;" type="text" placeholder="10..." value="10" onkeypress="return event.charCode >= 48 && event.charCode <= 57" />
<input id="query" style="width: 150px;" type="text" placeholder="Search..." />
<button class="octicon-button dark" id="search">SEARCH</button>
</span>
</h4>
<div id="logger"></div>
<div id="stopper" class="hide">
Had enough? <a href="#" id="stop">Stop it!</a>
</div>
</div>
</div>
<div id="right-col">
<h4><strong>Code examples</strong><span class="searcher">
<input type="checkbox" id="sorting" value="typical" /><span class="typicality">sorted by typicality</span>
</span>
</h4>
<div id="displayer"></div>
</div>
<div id="clear"></div>
<p>Thank you for trying this app.</p>
Violette2014-07-22T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/tools/violette<h2 id="code-modification-ideas-in-place">Code modification ideas in-place</h2>
<p><strong>Violette</strong> is Vesperin’s companion Chrome extension.</p>
<p>When installed, Violette detects Java code blocks on StackOverflow and then transforms them into a form that allows developers to actually edit and change the code in the web page of the Q&A system (in-place).</p>
<p>This in-place editing is done either manually via direct editing or semi-automatically via Vesperin’s built-in operations (available via the <em>Kiwi</em> API).</p>
<p>Out of the box, Violette supports the following operations.</p>
<ol>
<li>Programming language detection using heuristics.</li>
<li>Code transformations and refactorings.</li>
<li>Content annotation via notes.</li>
<li>Lightweight drafts management.</li>
<li>Syntax correctness verification.</li>
<li>Code examples multi staging</li>
<li>Code examples summarization</li>
<li>Preview mode.</li>
</ol>
<p>Violette’s latest version is available <a href="https://www.dropbox.com/s/kb2slpdnpsuhjkl/violette-full.crx?dl=0" target="_blank">here</a>.</p>
<p>Violette’s source code is available <a href="https://github.com/vesperin/violette" target="_blank">here</a>.</p>
<h2 id="additional-information">Additional information</h2>
<p>All the curated code snippets will be available, as tweets, on Twitter. If you want to see them, please follow <a href="https://twitter.com/codedetour">@codedetour</a>.</p>
Kiwi2014-07-22T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/tools/kiwi<h2 id="curation-and-parsing-services">Curation and Parsing services</h2>
<p>The Kiwi API was implemented in Scala. It consists of two logical services: Curation and Parsing.</p>
<p>The Curation service manages Vesperin’s curation operations, such as basic code transformations and refactorings, code presentation, and publication (published on Twitter). The Parsing service manages the access to a Java parsing API, built on top of Eclipse JDT<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>.</p>
<p>All requests are, by default, provided as JSON. There is no authentication required to make Curation and Parsing API calls.</p>
<p>Kiwi HTTP layer uses the Spray<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup> framework to build a REST/HTTP-based integration layer. This layer is responsible for serving HTTP requests. It has the following HTTP endpoints as an API:</p>
<ol>
<li>POST /kiwi/eval? {curation command}</li>
<li>PUT /kiwi/eval? {persist code command}</li>
<li>GET /kiwi/find?q={query text}</li>
<li>GET /kiwi/render?id={code id}</li>
</ol>
<p>Here is an example of a curation command (e.g., Rename method):</p>
<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="p">{</span><span class="dl">"</span><span class="s2">rename</span><span class="dl">"</span><span class="p">:</span> <span class="p">{</span>
<span class="dl">"</span><span class="s2">what</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">method</span><span class="dl">"</span><span class="p">,</span>
<span class="dl">"</span><span class="s2">where</span><span class="dl">"</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span>
<span class="dl">"</span><span class="s2">source</span><span class="dl">"</span><span class="p">:</span> <span class="p">{</span>
<span class="dl">"</span><span class="s2">name</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">...</span><span class="dl">"</span><span class="p">,</span>
<span class="dl">"</span><span class="s2">description</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">...</span><span class="dl">"</span><span class="p">,</span>
<span class="dl">"</span><span class="s2">content</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">...</span><span class="dl">"</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span></code></pre></figure>
<p>Kiwi’s source code is still private. However, once it
becomes public, it will be available <a href="http://bit.ly/1fNMuMk" target="_blank">here</a>.</p>
<p>If you want to get access to this code, please send me an <a href="mailto:hsanchez@cs.ucsc.edu">email</a>.</p>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:1" role="doc-endnote">
<p>http://www.eclipse.org/jdt/ <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:2" role="doc-endnote">
<p>http://spray.io/ <a href="#fnref:2" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>
Vesper2014-06-22T00:00:00+00:00http://huascarsanchez.com/posts/thesiswork/tools/vesper<h2 id="vesper-code-transformation-utilities">Vesper: Code transformation utilities</h2>
<p><em>Vesper</em> is <em>Vesperin</em>’s curation library for parsing, manipulating, and reconstructing Java code. <em>Vesper</em> is built atop Eclipse’s JDT Java Parser and <em>AST/DOM</em> transformation utilities. This mechanism allows Vesperin to work with partial and non-compiling programs, not just complete ones.</p>
<p>The following code shows how one can start using the Vesper library.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>import static edu.ucsc.refactor.ChangeRequest.forIssue;
import static edu.ucsc.refactor.ChangeRequest.reformatSource;
final Source code = new Source(...);
// using your own configuration:
// refactorer = Vesper.createRefactorer(new MyConfiguration());
// using default configuration
final Refactorer refactorer = Vesper.createRefactorer();
final Map<String, Parameter> userInput = ...;
// I. Ask the Refactorer to recommend changes for you
// print the reason for the change
final Introspector introspector = Vesper.createIntrospector();
final Set<Issue> issues = introspector.detectIssues(code);
final List<Change> changes = Recommender.recommendChanges(
refactorer,
code,
issues
);
for(Change each : changes){
System.out.println(each.getCause().getName());
}
// perform a single recommended change
final Commit applied = refactor.apply(changes.get(0));
System.out.println(applied.more());
// or handle All recommended changes
List<Change> recommended = Recommender.recommendChanges(
refactorer,
code,
issues
);
while(!recommended.isEmpty()){
final Commit applied = refactor.apply(recommended.get(0));
System.out.println(applied.more());
final Introspector introspector = Vesper.createIntrospector();
final Set badStuff = introspector.detectIssues(code);
recommended = Recommender.recommendChanges(
refactorer,
code,
badStuff
); // get an updated list of changes
}
// II. Dealing with random edits started by the user
// reformat Source's content
Change reformat = refactorer.createChange(reformatSource(code));
final Commit applied = refactor.apply(reformat);
System.out.println(applied.more());
</code></pre></div></div>
<p>Vesper’s code is available <a href="https://github.com/vesperin/vesper" target="_blank">here</a>.</p>
Smalls chunks of text in small chunks of time2013-10-08T00:00:00+00:00http://huascarsanchez.com/posts/notes/writing-in-small-chunks<p>I have a hard time sitting still and on track. I get easily derailed by many things, such as social media, news, a wandering mind, worries, etc.</p>
<p>Consequently, I’ve tailored my writing routine around this restlessness.</p>
<p>I live by my <a href="http://handsmemory.com">timers</a>, writing in chunks until time is up. Then I take a few breaks. I used these time periods to quell any distractions.</p>
<p>I give myself 30 minutes to write.</p>
<p>I follow the <a href="http://bit.ly/15wpZ7">chunking method</a>. This method makes reading and understanding faster and easier.</p>
<p>I do my best to maintain this routine since it improves my focus and concentration.</p>
<p>It also helps me convey information more efficiently. I don’t get burned out. And there is no chance for social media to derail me.</p>
<p>I also apply this method when writing code; e.g. writing small chunks of functionality in small chunks of time.</p>
Cyberbullying detection in social networks2012-04-29T00:00:00+00:00http://huascarsanchez.com/posts/notes/twitter-bullying-detection-report<p>According to Google Analytics and to other sources, my data mining (ISM 245 class) project titled “Twitter Bullying Detection” is getting some attention. An earlier version of the project report was hosted on the co-author of the project’s <a href="http://users.soe.ucsc.edu/~shreyask/index.html">website</a>. This version
is good in terms of communicating the project’s main idea and motivation. However, I think it is always important to have the latest version available. Therefore, I decided to post this latest version <a href="http://dl.dropbox.com/u/11902217/huascarsanchez_and_shreyaskumar-twitterbullyingdection-fnl.pdf">here</a>.</p>
<p>Please feel free to contact me if you have any questions about the content of
that report. Thanks.</p>
Removing duplicate App icons in Launchpad (OS X 10.6+)2012-04-20T00:00:00+00:00http://huascarsanchez.com/posts/notes/remove-duplicate-appicons-from-launchpad<p>If there are multiple icon instances of one application in your Mac’s Launchpad,
then here is how to get rid of those duplicate instances:</p>
<ul>
<li>Delete, or you simply drag and drop the application from Launchpad to
the trash. Lion OS will automatically remove all the icons in Launchpad related
to that App.</li>
<li>Then, simply drag and drop the App from the trash back to the applications
folder. You will notice now there is only one icon for that App in your Launchpad.</li>
</ul>
<p>I am hoping Apple will solve this problem soon.</p>
<p><strong>Update</strong></p>
<p>OS X 10.6 or later does not have this problem anymore.</p>
Hello World!2011-11-05T00:00:00+00:00http://huascarsanchez.com/posts/notes/helloworld
<p>Here is the first post on huascarsanchez.com - my new website. My first blog post is the famous Hello World! message. Tell me, what’s better than the famous Hello World! message to introduce a new blog? ;-)</p>
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">#!/usr/bin/ruby</span>
<span class="c1"># Hello world ruby program</span>
<span class="nb">puts</span> <span class="s2">"Hello World!"</span><span class="p">;</span>
</code></pre></div></div>