<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2130170004051151560</id><updated>2026-10-31T00:23:57.501-07:00</updated><category term="Notes"/><category term="Linux"/><category term="Experiments"/><category term="Ideas"/><category term="Systems"/><category term="AWS CDK"/><category term="Infrastructure"/><category term="Software and Life"/><category term="TypeScript"/><category term="aws"/><title type='text'>my experiments with so called &quot;truth&quot;</title><subtitle type='html'>Experiments, engineering lessons, and ideas about software and everyday life.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-2787052015623162760</id><published>2025-10-01T21:36:00.000-07:00</published><updated>2026-10-11T21:07:51.373-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>How a language model learns: pretraining and fine-tuning — Part 2</title><content type='html'>&lt;p&gt;A language model can get a training target from the same text it is reading. Move the text over by one token: each input position now has a next token to predict. No one has to write a separate answer for every prefix. The catch is that the model must not be allowed to peek at that answer.&lt;/p&gt;
&lt;h2&gt;The text already contains a training target&lt;/h2&gt;
&lt;p&gt;Consider the sentence “The kettle is on the stove.” As before, we will pretend each word is one token and leave out punctuation. A real tokenizer may split it differently.&lt;/p&gt;
&lt;p&gt;After “The”, the next token in this sentence is “kettle”. After “The kettle”, it is “is”. Each position gives us a prediction to compare with the token that actually follows.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw2k_nHgJnJIvNhBuyCj8_M1-bKj6ea4HCynNbBbnoyzFRJ1pN4uBnfx1GatynzYXkNy_9fU6ifRtHBpaujyksWjqTWcR_-Zyot7_VH-w0Pi2yubpTGjarKipayt04ddI0Z5IGllV5ZAm-cGK-5DKodGBe3TP3DO__B-Vx6gfP1CvGACDhd-ME2iKtowE/s1600/04-training-targets.png&quot;&gt;&lt;img style=&quot;display:block;max-width:100%;height:auto;margin:24px auto;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw2k_nHgJnJIvNhBuyCj8_M1-bKj6ea4HCynNbBbnoyzFRJ1pN4uBnfx1GatynzYXkNy_9fU6ifRtHBpaujyksWjqTWcR_-Zyot7_VH-w0Pi2yubpTGjarKipayt04ddI0Z5IGllV5ZAm-cGK-5DKodGBe3TP3DO__B-Vx6gfP1CvGACDhd-ME2iKtowE/s1600/04-training-targets.png&quot; alt=&quot;Five prefixes from one sentence, each paired with its next-token target.&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The input and target sequences are offset by one position. Word-sized tokens are a simplification for this example.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is why we can train a language model from ordinary text without manually writing an answer for every prefix. The text supplies the target.&lt;/p&gt;
&lt;p&gt;However, later tokens are present in the training sequence. If the position predicting “kettle” could read “kettle” from a later position, the exercise would give away the answer. The causal-attention rule from part one prevents this: each prediction can use only its own and earlier input positions. We can therefore calculate predictions at several positions together without allowing them to read ahead.&lt;/p&gt;
&lt;p&gt;“Stove” is the target for this particular sentence. “Table” might also be a reasonable continuation in another sentence. The training target records what came next in the example; it does not establish the only acceptable continuation in the language.&lt;/p&gt;
&lt;h2&gt;Measure the prediction, then update the parameters&lt;/h2&gt;
&lt;p&gt;Suppose the model assigns “stove” a probability of 0.1 after “The kettle is on the”. Another set of parameters assigns it 0.5. For this example, the second prediction fits the observed next token better.&lt;/p&gt;
&lt;p&gt;We need a number that expresses that difference. For next-token training, cross-entropy loss penalizes a low probability for the target token. At a single position, the loss is the negative logarithm of that probability. We do not need to work through the logarithm here: the useful relationship is that assigning more probability to the target gives a lower loss.&lt;/p&gt;
&lt;p&gt;Those probabilities are illustrative, not measurements from a training run. In practice, we combine losses across the training positions we are evaluating, usually over a &lt;strong&gt;batch&lt;/strong&gt; of several sequences.&lt;/p&gt;
&lt;p&gt;The model’s parameters include the embedding values and the weights in its layers. Backpropagation calculates gradients: the local sensitivity of the loss to changes in each parameter. An optimizer uses those gradients to choose an update. In a simple gradient-descent update, it moves parameters a small step in the direction that locally reduces the loss; the learning rate controls the size of that step. Then we process another batch and repeat.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjno3ExSB_XzkEr9vsrX-lKV5c334ubyqVIAFgheFFZbwzGdOwagiBokytZiRBKa2DUlDSvVNcRnUiINwC8TlPtOhesrqX2_PJLp8v2uc45JmyJTKyTQfwFyRwHjIoYwDWMXvqZoZJPo51wMz00cCezG0I0Cy3wtnddZ7CxuoLnnSWkJpOkjlqL0zWtzlw/s1600/05-training-loop.png&quot;&gt;&lt;img style=&quot;display:block;max-width:100%;height:auto;margin:24px auto;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjno3ExSB_XzkEr9vsrX-lKV5c334ubyqVIAFgheFFZbwzGdOwagiBokytZiRBKa2DUlDSvVNcRnUiINwC8TlPtOhesrqX2_PJLp8v2uc45JmyJTKyTQfwFyRwHjIoYwDWMXvqZoZJPo51wMz00cCezG0I0Cy3wtnddZ7CxuoLnnSWkJpOkjlqL0zWtzlw/s1600/05-training-loop.png&quot; alt=&quot;Training flows from predictions to loss, gradients and parameter updates; evaluation has no update step.&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Training changes parameters. Evaluation measures a fixed version of the model on separate data.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;One update does not guarantee a better answer to every prompt. Parameters are shared across many examples, and training involves repeatedly adjusting them using many batches. A lower loss on one batch can also come with worse predictions on other examples.&lt;/p&gt;
&lt;h2&gt;What pretraining gives us—and what to check&lt;/h2&gt;
&lt;p&gt;When we train on a broad collection of text in this way, we call the stage &lt;strong&gt;pretraining&lt;/strong&gt;. Starting from initialized parameters, the model learns patterns that help it predict tokens across those examples.&lt;/p&gt;
&lt;p&gt;Training loss tells us how well it fits the examples used to update it. We also need separate, held-out data that does not contribute to those updates. Otherwise, a model that remembers training examples can look better than it is at handling unfamiliar text. If training loss keeps falling while held-out loss rises, that is one sign of overfitting: the improvements on the training examples are not carrying over. When we use a validation set to choose settings or when to stop training, we should keep a separate test set for the final assessment.&lt;/p&gt;
&lt;p&gt;Even a good held-out language-model loss does not answer every question about the model. If we want reliable summaries, we must check summaries. If we want a classifier, we must evaluate its labels. Predicting text well and meeting the requirements of a particular application are related, but different, things to measure.&lt;/p&gt;
&lt;p&gt;Data quality matters throughout. Training on a poor target does not make that target correct; the loss still rewards predicting it.&lt;/p&gt;
&lt;h2&gt;Fine-tuning gives the learning a more specific purpose&lt;/h2&gt;
&lt;p&gt;After pretraining, we can start with the learned parameters and train further on examples suited to a task. That is fine-tuning. Two examples make the distinction useful.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;classification&lt;/strong&gt;, suppose we want to sort messages into categories. The message “Your parcel arrives tomorrow” could have the label “delivery update”. One approach adapts the model with an output layer that produces scores for the available labels, then trains on message-and-label examples. The desired output is a category. This is the classifier-head approach; it is not the only way to use a language model for classification.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;instruction fine-tuning&lt;/strong&gt;, the examples contain requests and desired text responses. A request might be “Rewrite ‘Send the file’ more politely”, paired with “Could you please send the file?” The model still predicts text tokens. During training, a prediction for a response token can use the request and the earlier response tokens provided by the example. At generation time, it must continue using the response tokens selected so far. The training examples teach it patterns for responding to requests, rather than simply continuing whatever kind of text happened to come before.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-kCynCE_ylCHU-7X86a4BW4vClQCJn_aRakGyFrwwcZcFk6GzhKxJxoQ_o5J1VSR_6B0lgCKoOHiKGY2upDrXZLzOYWEHnd_UdiIS2jAtc7iotsdz5Rzo3BI5VixM34QJp96mhoEfvSvGaH3HhJqOuW5crgccDy2QK7nVPjUspHyKJs-CbgRUZji6Th4/s1600/06-training-stages.png&quot;&gt;&lt;img style=&quot;display:block;max-width:100%;height:auto;margin:24px auto;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-kCynCE_ylCHU-7X86a4BW4vClQCJn_aRakGyFrwwcZcFk6GzhKxJxoQ_o5J1VSR_6B0lgCKoOHiKGY2upDrXZLzOYWEHnd_UdiIS2jAtc7iotsdz5Rzo3BI5VixM34QJp96mhoEfvSvGaH3HhJqOuW5crgccDy2QK7nVPjUspHyKJs-CbgRUZji6Th4/s1600/06-training-stages.png&quot; alt=&quot;Pretraining branches into classification and instruction fine-tuning, with different examples and outputs.&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;These are two adaptation paths, not successive requirements. The messages and responses are invented teaching examples.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The difference is more than the amount of data. The starting parameters, examples, and desired outputs determine what we are training the model to do. A classifier head produces label scores; an instruction-following language model produces token scores used to generate a response.&lt;/p&gt;
&lt;p&gt;Fine-tuning does not guarantee correct facts or perfect instruction following. We still need evaluation that matches the intended use. Other post-training methods, including learning from preferences, also exist; their mechanics are beyond this introduction.&lt;/p&gt;
&lt;h2&gt;What does building “from scratch” mean?&lt;/h2&gt;
&lt;p&gt;There are several pieces of work we should distinguish. We can implement an architecture so that it performs the calculations described in part one. We can train newly initialized parameters using the loop in this article. Or we can load pretrained parameters and adapt them, avoiding the need to repeat all of pretraining.&lt;/p&gt;
&lt;p&gt;A small teaching model can make these pieces visible. We can inspect the inputs, predictions, loss, and updates without needing to understand a large production training system first. Training a capable large model adds much greater demands on data, compute and evaluation. Writing the architecture is only one part of that effort.&lt;/p&gt;
&lt;p&gt;The same sentence plays two roles. During generation it is context for a prediction. During training, its following tokens also provide the answers used to calculate loss and change the weights. The update step is what turns prediction into learning.&lt;/p&gt;
&lt;h2&gt;Sources &amp;amp; references&lt;/h2&gt;
&lt;p&gt;This explanation of training and fine-tuning draws on Sebastian Raschka’s &lt;a href=&quot;https://magazine.sebastianraschka.com/p/llms-building-training-finetuning&quot;&gt;Developing an LLM: Building, Training, Finetuning&lt;/a&gt;. Credit for the teaching material belongs to him; the examples and diagrams here are my own explanations.&lt;/p&gt;
&lt;p&gt;See also Raschka’s &lt;a href=&quot;https://sebastianraschka.com/pdf/slides/2024-build-llms.pdf&quot;&gt;original slides&lt;/a&gt;.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/2787052015623162760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2025/10/how-language-model-learns-pretraining.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/2787052015623162760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/2787052015623162760'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2025/10/how-language-model-learns-pretraining.html' title='How a language model learns: pretraining and fine-tuning — Part 2'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw2k_nHgJnJIvNhBuyCj8_M1-bKj6ea4HCynNbBbnoyzFRJ1pN4uBnfx1GatynzYXkNy_9fU6ifRtHBpaujyksWjqTWcR_-Zyot7_VH-w0Pi2yubpTGjarKipayt04ddI0Z5IGllV5ZAm-cGK-5DKodGBe3TP3DO__B-Vx6gfP1CvGACDhd-ME2iKtowE/s72-c/04-training-targets.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-7223705451889126633</id><published>2025-09-24T10:46:00.000-07:00</published><updated>2026-10-11T21:07:53.537-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>Inside a language model: from text to the next token — Part 1</title><content type='html'>&lt;p&gt;A language model can use a sentence you just typed without learning new weights from it. The prompt changes the calculation&amp;#x27;s input. During ordinary generation, the model&amp;#x27;s learned numbers stay fixed. To see how that works, give it the words “The kettle is on the” and follow one prediction.&lt;/p&gt;
&lt;p&gt;We will follow a model in the GPT family, short for Generative Pre-trained Transformer. It generates text using already-learned parameters: the numbers its calculations use. We will trace one prediction through that model, then see how repeating the step produces more text. The second article explains how training learns those numbers.&lt;/p&gt;
&lt;h2&gt;Start with one prediction&lt;/h2&gt;
&lt;p&gt;After “The kettle is on the”, “stove” is a possible continuation. So is “table”. The model assigns scores to the possible next tokens, which we can turn into probabilities. Choosing a token from those probabilities is a separate step.&lt;/p&gt;
&lt;p&gt;A token is a unit of text defined by a tokenizer. It might be a word, part of a word, or punctuation. To keep our example readable, we will pretend each word is one token and omit punctuation. This is a teaching simplification, not the output of a real tokenizer.&lt;/p&gt;
&lt;p&gt;The immediate task is small: predict one more token using the text available so far. Repeating that task is how we get a longer answer.&lt;/p&gt;
&lt;h2&gt;Text becomes numbers&lt;/h2&gt;
&lt;p&gt;A tokenizer converts text into token IDs. These integers identify entries in a vocabulary. Their numerical order does not tell us anything about meaning: token 400 is not twice as meaningful as token 200.&lt;/p&gt;
&lt;p&gt;The model uses each ID to look up an &lt;strong&gt;embedding&lt;/strong&gt;, a vector, or ordered list, of learned numbers. We can think of the embedding table as one row per vocabulary entry. Looking up a token selects its row; it does not yet account for the surrounding sentence.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisSmJ6W-37SC5tLrkW80b0InVVegr1nn7WVa2c3Q4c_j4oDa-NuF3ZvrLVFMuArZcNhqNMjjeywcbOkhYUlBWKyVtpTG4LsO5KkH8Xnyib5RxVXo76mbf2P_a03zn29ECEHMJ2VGTkleRCAzLLxqZG8tyjP3kFQLa9QECAiS4r4JSUFkM-Ml8pMeXqiqY/s1600/01-text-to-vectors.png&quot;&gt;&lt;img style=&quot;display:block;max-width:100%;height:auto;margin:24px auto;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisSmJ6W-37SC5tLrkW80b0InVVegr1nn7WVa2c3Q4c_j4oDa-NuF3ZvrLVFMuArZcNhqNMjjeywcbOkhYUlBWKyVtpTG4LsO5KkH8Xnyib5RxVXo76mbf2P_a03zn29ECEHMJ2VGTkleRCAzLLxqZG8tyjP3kFQLa9QECAiS4r4JSUFkM-Ml8pMeXqiqY/s1600/01-text-to-vectors.png&quot; alt=&quot;Token IDs select rows of an embedding table; position information is then added.&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The IDs and vectors here are made up for illustration. A real tokenizer may split the words differently.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The model also needs information about order. In the GPT-style architecture we are following, it adds a learned position vector to each token’s embedding. Other architectures can represent position differently. Here, the result is a sequence of vectors carrying both token and position information.&lt;/p&gt;
&lt;p&gt;Those vectors are the input to the transformer blocks. The text has become something we can calculate with.&lt;/p&gt;
&lt;h2&gt;Let each position use context&lt;/h2&gt;
&lt;p&gt;The embedding for “the” starts from the same vocabulary entry whenever that token occurs. But “the” after “The kettle is on” should contribute to a different prediction than “the” in another sentence. Its representation needs context.&lt;/p&gt;
&lt;p&gt;Attention provides a way to combine information from different positions. For each position, the model calculates weights for the positions it can use, then combines information from them according to those weights. The weights depend on the input and learned parameters. For our final “the”, attention can bring in information from “kettle”, “is”, and “on” before the model predicts what comes next. That is a description of the available context, not a claim about measured weights in a real model. We do not hand-code a rule saying that a kettle must attend to a stove.&lt;/p&gt;
&lt;p&gt;There is a restriction: each position can use itself and earlier positions, but cannot use later ones. This is &lt;strong&gt;causal attention&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHFBk_wFlpt9bfceT0lNpR5n7rG49QBIujq7SuchwfYh0MCF7ro3ZAMUCt8Mz-tYdchrUu72N7cFZrvzU0DJTrLlOvo7o3RZ02ZcYop_AvBnTPigwRUzkOOImzRSGXV9xf0K1omH5vN9UJVMFemvY5K825gi57YDJD6ikYMjE2nE70ux26Igm8oOLDZZw/s1600/02-causal-attention.png&quot;&gt;&lt;img style=&quot;display:block;max-width:100%;height:auto;margin:24px auto;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHFBk_wFlpt9bfceT0lNpR5n7rG49QBIujq7SuchwfYh0MCF7ro3ZAMUCt8Mz-tYdchrUu72N7cFZrvzU0DJTrLlOvo7o3RZ02ZcYop_AvBnTPigwRUzkOOImzRSGXV9xf0K1omH5vN9UJVMFemvY5K825gi57YDJD6ikYMjE2nE70ux26Igm8oOLDZZw/s1600/02-causal-attention.png&quot; alt=&quot;A triangular grid shows which positions may attend to which tokens.&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Filled cells mean access is allowed. They do not show measured attention weights or how much a token matters.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;For example, the third position, “is”, can use “The”, “kettle”, and itself. It cannot use the later “on” or “the”. The final position can use the whole prefix. This visibility rule also matters during training, which we will see in part two.&lt;/p&gt;
&lt;p&gt;Multiple attention heads perform several learned combinations of context. Their results are combined before the model continues. We do not need to assign a fixed job such as “grammar head” or “meaning head” to each one.&lt;/p&gt;
&lt;p&gt;Attention is only part of a &lt;strong&gt;transformer block&lt;/strong&gt;, a group of operations repeated through the model. A feedforward network applies a learned transformation to the representation at each position. Attention has mixed information across positions; this network processes the resulting vectors one position at a time.&lt;/p&gt;
&lt;p&gt;Residual connections add a block component’s input back to its output, so the next operation receives both the carried-forward representation and a learned change to it. Layer normalization centers and rescales values within a representation, with learned scale and offset. Stacking blocks lets later calculations work with representations already shaped by earlier ones.&lt;/p&gt;
&lt;h2&gt;Turn the result into a next token&lt;/h2&gt;
&lt;p&gt;At the end of the model, an output layer maps the final position’s representation to one score for every token in the vocabulary. Those scores are often called logits. A function called &lt;strong&gt;softmax&lt;/strong&gt; converts them into nonnegative probabilities that sum to one.&lt;/p&gt;
&lt;p&gt;The generation program then chooses a token. It could choose the highest-probability token, or sample from the distribution. Sampling gives lower-probability choices a chance too, so the same prompt can produce different continuations.&lt;/p&gt;
&lt;p&gt;A probability here expresses the model’s prediction of a continuation. It is not a probability that a statement is factually true. A fluent continuation can still be wrong.&lt;/p&gt;
&lt;h2&gt;Repeat the step to get more text&lt;/h2&gt;
&lt;p&gt;Suppose the selected token is “stove”. The program appends it to the context, then asks for the next token using the extended sequence. It keeps doing this until a stopping condition, such as an end token or a length limit, is reached.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNYTGaYPxalXqQ3b_wNvLcny_Cm9LQBXQpBjjL9LbNG1ZmAKRIzakadJkxVsxGr6aNN9xJipob56RBM2zWki08F8eUgxMNDLP7-zqojnR-j4Zgtg3IoxrMjCcTU256qI8QrR2kkZx3-yasvwoTRR72sVqmJlJqnByElwfZVnDEsTn78VG_eGRJOFOVAGA/s1600/03-generation-loop.png&quot;&gt;&lt;img style=&quot;display:block;max-width:100%;height:auto;margin:24px auto;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNYTGaYPxalXqQ3b_wNvLcny_Cm9LQBXQpBjjL9LbNG1ZmAKRIzakadJkxVsxGr6aNN9xJipob56RBM2zWki08F8eUgxMNDLP7-zqojnR-j4Zgtg3IoxrMjCcTU256qI8QrR2kkZx3-yasvwoTRR72sVqmJlJqnByElwfZVnDEsTn78VG_eGRJOFOVAGA/s1600/03-generation-loop.png&quot; alt=&quot;The model computes probabilities; the generation program selects a token, appends it, and repeats.&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;This is the conceptual data flow. Implementations can reuse intermediate calculations instead of recomputing everything on each step.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;When “stove” is appended, the next prediction has a different input even though the model&amp;#x27;s parameters are unchanged. This is how a conversation can influence the answer without retraining the model. If we remove that context on the next call, we cannot assume the model will retain what was said.&lt;/p&gt;
&lt;p&gt;The remaining question is where the parameters came from. A model with random numbers can perform these calculations too, but its predictions will not yet be useful. Part two follows the training process that changes those numbers.&lt;/p&gt;
&lt;h2&gt;Sources &amp;amp; references&lt;/h2&gt;
&lt;p&gt;This two-part introduction draws on Sebastian Raschka’s &lt;a href=&quot;https://magazine.sebastianraschka.com/p/llms-building-training-finetuning&quot;&gt;Developing an LLM: Building, Training, Finetuning&lt;/a&gt;. Credit for the teaching material belongs to him; the examples and diagrams here are my own explanations.&lt;/p&gt;
&lt;p&gt;See also Raschka’s &lt;a href=&quot;https://sebastianraschka.com/pdf/slides/2024-build-llms.pdf&quot;&gt;original slides&lt;/a&gt;.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/7223705451889126633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2025/09/inside-language-model-from-text-to-next.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/7223705451889126633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/7223705451889126633'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2025/09/inside-language-model-from-text-to-next.html' title='Inside a language model: from text to the next token — Part 1'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisSmJ6W-37SC5tLrkW80b0InVVegr1nn7WVa2c3Q4c_j4oDa-NuF3ZvrLVFMuArZcNhqNMjjeywcbOkhYUlBWKyVtpTG4LsO5KkH8Xnyib5RxVXo76mbf2P_a03zn29ECEHMJ2VGTkleRCAzLLxqZG8tyjP3kFQLa9QECAiS4r4JSUFkM-Ml8pMeXqiqY/s72-c/01-text-to-vectors.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-845387003605202131</id><published>2025-01-11T17:27:00.000-08:00</published><updated>2026-10-11T21:07:55.789-07:00</updated><title type='text'>How an AI agent works</title><content type='html'>
&lt;p&gt;Suppose you have a folder of notes from a side project. Somewhere in those notes is the reason you chose SQLite over Postgres. You remember discussing it, but you cannot remember which file contains the decision.&lt;/p&gt;
&lt;p&gt;You could search the folder yourself, read a few files, and put the answer together. What would it take to let a language model do those steps?&lt;/p&gt;
&lt;p&gt;The model can write a request to search. That request is still just output from the model; it has not searched a single file. Our application must run the search and send the results into another model call. Following that handoff is a useful way to understand an agent.&lt;/p&gt;
&lt;p&gt;For this example, watch what changes after each tool result: the model has new information for choosing its next action.&lt;/p&gt;
&lt;h2&gt;Give the model a way to look&lt;/h2&gt;
&lt;p&gt;For this example, we will design two tools:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;search_notes(query)
    Returns matching file names and short excerpts.

read_note(path)
    Returns the contents of one file in the notes folder.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A tool is a capability exposed to the model through an interface. We describe what it does, what arguments it accepts, and what it returns. The implementation might be an ordinary function that searches text files.&lt;/p&gt;
&lt;p&gt;For a tool run by our application, the model produces a structured request. Our code checks it, executes the function, and sends the result back. The model does not gain access to the filesystem merely because we described a tool. The application supplies that access.&lt;/p&gt;
&lt;p&gt;We can give our notes agent a short instruction:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Answer questions using the project notes. Read the relevant files before drawing a conclusion. Name the files that support your answer. If the notes do not establish an answer, say what is missing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That tells the model how we want it to work. The tools give it the means to investigate.&lt;/p&gt;
&lt;h2&gt;Follow one possible run&lt;/h2&gt;
&lt;p&gt;Here is an illustrative sequence using fictional notes, rather than a recorded model run.&lt;/p&gt;
&lt;p&gt;The user asks:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Why did we choose SQLite for the first version?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The model might request a search. In a simplified representation, its response could look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &amp;quot;tool&amp;quot;: &amp;quot;search_notes&amp;quot;,
  &amp;quot;arguments&amp;quot;: {&amp;quot;query&amp;quot;: &amp;quot;SQLite&amp;quot;}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Our search function returns two matches:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;storage-options.md
    &amp;quot;SQLite and Postgres are both candidates ...&amp;quot;

prototype-decision.md
    &amp;quot;For the first version, use SQLite ...&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The model now has something it did not have before: file names and excerpts from the actual search result. It can request &lt;code&gt;read_note(&amp;quot;prototype-decision.md&amp;quot;)&lt;/code&gt; to get the surrounding explanation.&lt;/p&gt;
&lt;p&gt;Suppose that fictional file says:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The prototype runs on one laptop. Use SQLite so setup does not require a separate database service. Revisit this choice if we need several machines writing to the same shared database.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The answer can now explain both the choice and the condition for reconsidering it. It should identify &lt;code&gt;prototype-decision.md&lt;/code&gt; as the source.&lt;/p&gt;
&lt;p&gt;Notice how narrow that conclusion is. These notes support a decision about this prototype. They do not establish that SQLite is always preferable, or that Postgres would have been slow. The result gives the agent evidence to work with; it still has to interpret that evidence correctly.&lt;/p&gt;
&lt;h2&gt;The program keeps the loop moving&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7G3_3JwiDc395RHnhfRc8fqyHo0WwCjoaJnelNSI_bQIw-fep8h-BapEBIkGtUHETICYAJb-lHDcfubbuy0DBYNO-oFGxVaGnXc885gAgykzTC2m974V7VI0YEzkmqLxRvuBGxpkrgKAyVCUV0kwPCH9zjRSFX3-3KUbIuTKDRnAtDddBaAGwRwzU0zg/s1600/clipboard.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7G3_3JwiDc395RHnhfRc8fqyHo0WwCjoaJnelNSI_bQIw-fep8h-BapEBIkGtUHETICYAJb-lHDcfubbuy0DBYNO-oFGxVaGnXc885gAgykzTC2m974V7VI0YEzkmqLxRvuBGxpkrgKAyVCUV0kwPCH9zjRSFX3-3KUbIuTKDRnAtDddBaAGwRwzU0zg/s1600/clipboard.png&quot; alt=&quot;The application calls the model, checks and executes tool requests, and returns results for the next turn.&quot; style=&quot;display:block;width:100%;max-width:600px;height:auto;margin:24px auto;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next model call receives both the earlier conversation and the tool result. There is no separate step in which the model reaches into our folder: every file read happens through the application.&lt;/p&gt;
&lt;p&gt;The application repeats the exchange until it receives an answer or reaches a stopping condition:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Send the question, instructions, and available tools to the model.

Repeat within a fixed step budget:
    Get the model&amp;#39;s response.
    If it requests a tool:
        Validate the request and check access.
        Run the tool.
        Add the request and its result to the conversation.
    If it returns a final answer:
        Return that answer and stop.
    If the response cannot be used:
        Report the failure and stop.

If the budget runs out, report that the task is incomplete.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is pseudocode showing one tool request at a time, not a runnable implementation. The step budget limits how many model responses we process. An implementation also needs timeouts for individual calls and handling for rejected or failed tool requests. Returning an answer ends this loop; it does not prove that the answer is supported by the notes.&lt;/p&gt;
&lt;p&gt;The loop is what lets the next action depend on what just happened. An empty search result might lead to a different query. Two conflicting notes might lead to another file being read. A file that answers the question might be enough to stop.&lt;/p&gt;
&lt;p&gt;This repeated use of actions and observations also appears in the ReAct research, published in 2022. Our example focuses on the visible requests and results needed to understand the execution.&lt;/p&gt;
&lt;h2&gt;What makes this an agent?&lt;/h2&gt;
&lt;p&gt;People use the word “agent” for different kinds of systems. A useful distinction is who chooses the next step.&lt;/p&gt;
&lt;p&gt;We could write a fixed workflow that always searches once, reads the first three results, and asks for a summary. In our agent example, the model chooses the query and which files to read, using the results it receives. The application still determines which actions are allowed.&lt;/p&gt;
&lt;p&gt;For a predictable task, the fixed workflow may be easier to test and sufficient for the job. The extra flexibility becomes useful when the next step depends on information we have not seen yet.&lt;/p&gt;
&lt;h2&gt;What does it remember?&lt;/h2&gt;
&lt;p&gt;In this design, our program keeps a conversation containing the question, tool requests, and results. It supplies that context on later model calls. That is how the model can use an earlier search result when choosing a file to read.&lt;/p&gt;
&lt;p&gt;If the notes are large, we need to decide how much to return. Short excerpts help with finding files; full contents help with understanding a decision. Sending every file on every turn would make the search tool rather pointless.&lt;/p&gt;
&lt;p&gt;Remembering information across separate sessions would require another choice about what to save and retrieve. We do not need that feature to explain this first example.&lt;/p&gt;
&lt;h2&gt;A small loop still needs boundaries&lt;/h2&gt;
&lt;p&gt;For this notes agent, I would start with access to one folder and no ability to modify it. The application should resolve each requested path, including symbolic links, and reject anything outside that folder. A prompt asking the model to stay within it is not a filesystem access check.&lt;/p&gt;
&lt;p&gt;The notes themselves are evidence to read. A line in a file telling the agent to ignore the user or run a different tool should not grant it new authority. Keeping the tools read-only limits what this first version can change, though it does not guarantee a correct answer.&lt;/p&gt;
&lt;p&gt;I would also make failures visible. If a file cannot be read, return an error that identifies the problem. If the step budget is exhausted, return an incomplete result rather than treating the last generated sentence as success.&lt;/p&gt;
&lt;p&gt;Even a normal final answer needs scrutiny. Did it use the decision note, or only the list of candidates? Did it mention the condition for revisiting the choice? Can the reader open the file it cites?&lt;/p&gt;
&lt;p&gt;Try removing prototype-decision.md from the test folder while leaving storage-options.md. The agent can still find both database names, but it no longer has the decision. Does it report the missing evidence, or turn a list of candidates into a confident answer? That small test checks whether the loop is helping it investigate.&lt;/p&gt;
&lt;h2&gt;Sources &amp;amp; references&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;OpenAI’s &lt;a href=&quot;https://openai.com/index/function-calling-and-other-api-updates/&quot;&gt;June 2023 function-calling announcement&lt;/a&gt; explains the request-and-result exchange for application-executed tools.&lt;/li&gt;
&lt;li&gt;Shunyu Yao and colleagues’ &lt;a href=&quot;https://arxiv.org/abs/2210.03629v1&quot;&gt;ReAct paper&lt;/a&gt; explores interleaving reasoning and actions.&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/845387003605202131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2025/01/how-ai-agent-works.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/845387003605202131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/845387003605202131'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2025/01/how-ai-agent-works.html' title='How an AI agent works'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7G3_3JwiDc395RHnhfRc8fqyHo0WwCjoaJnelNSI_bQIw-fep8h-BapEBIkGtUHETICYAJb-lHDcfubbuy0DBYNO-oFGxVaGnXc885gAgykzTC2m974V7VI0YEzkmqLxRvuBGxpkrgKAyVCUV0kwPCH9zjRSFX3-3KUbIuTKDRnAtDddBaAGwRwzU0zg/s72-c/clipboard.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-11071195663155664</id><published>2022-06-16T20:41:00.000-07:00</published><updated>2026-10-13T17:28:24.981-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AWS CDK"/><category scheme="http://www.blogger.com/atom/ns#" term="Infrastructure"/><category scheme="http://www.blogger.com/atom/ns#" term="TypeScript"/><title type='text'>Understanding AWS CDK, one stack at a time</title><content type='html'>&lt;style&gt;
/* Scoped to the three comparison tables in the CDK article. */
.post-body .cdk-table-wrap {
  margin: 24px 0 30px;
  border: 1px solid #dce5df;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.post-body table.cdk-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: #293b32;
}
.post-body .cdk-table th,
.post-body .cdk-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border: 0;
  border-bottom: 1px solid #e5ebe7;
  word-break: normal;
  overflow-wrap: break-word;
}
.post-body .cdk-table thead th {
  background: #f0f5f2;
  font-size: 14px;
  font-weight: 650;
  color: #375345;
}
.post-body .cdk-table tbody th {
  font-weight: 600;
}
.post-body .cdk-table tbody tr:last-child &gt; * {
  border-bottom: 0;
}
.post-body .cdk-table code {
  font-size: .9em;
  line-height: inherit;
  white-space: normal;
}
.post-body .cdk-levels col:first-child { width: 80px; }
.post-body .cdk-levels col:nth-child(2) { width: 54%; }
.post-body .cdk-levels th:first-child { white-space: nowrap; }
.post-body .cdk-changes col:first-child { width: 22%; }
.post-body .cdk-changes col:nth-child(2) { width: 30%; }
.post-body .cdk-commands col:first-child { width: 34%; }
@media (max-width: 600px) {
  .post-body table.cdk-table,
  .post-body .cdk-table tbody,
  .post-body .cdk-table tr { display: block; width: 100%; }
  .post-body .cdk-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
  }
  .post-body .cdk-table colgroup { display: none; }
  .post-body .cdk-table tbody tr { padding: 12px 0; border-bottom: 1px solid #e5ebe7; }
  .post-body .cdk-table tbody tr:last-child { border-bottom: 0; }
  .post-body .cdk-table tbody th,
  .post-body .cdk-table tbody td {
    display: block;
    width: auto;
    padding: 5px 16px;
    border: 0;
    white-space: normal;
  }
  .post-body .cdk-table tbody [data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 600;
    color: #607469;
  }
  .post-body .cdk-levels tbody th { font-size: 18px; }
  .post-body .cdk-levels tbody th[data-label]::before { display: none; }
}

&lt;/style&gt;
&lt;p&gt;&lt;strong&gt;In one sentence:&lt;/strong&gt; With AWS Cloud Development Kit (CDK), we write a program that produces a CloudFormation template. CloudFormation reads that template and creates or updates the resources in AWS.&lt;/p&gt;
&lt;p&gt;Keep that split in mind: the CDK application describes the infrastructure; CloudFormation builds it. The CDK command-line tool connects the two.&lt;/p&gt;
&lt;h2&gt;1. The problem&lt;/h2&gt;
&lt;p&gt;Say we need a network, a load balancer, a Postgres database and an application running in Amazon Elastic Container Service (ECS). We have three ways to describe the setup.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Configure it in the AWS console.&lt;/strong&gt; We can create the resources, but repeating the setup and reviewing changes means keeping track of the individual settings ourselves.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Write a CloudFormation template by hand.&lt;/strong&gt; The setup becomes a file we can review and reuse. As we add roles, security groups, logs and connections, that file grows.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Write a program that produces the template.&lt;/strong&gt; That is CDK. We get functions, loops and types, and the output is still a file CloudFormation understands.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For example, beta and production might use the same arrangement with different sizes. A program can express the shared arrangement once and take the size as an input.&lt;/p&gt;
&lt;h2&gt;2. Start with CloudFormation&lt;/h2&gt;
&lt;p&gt;Before looking at CDK, we need three ideas.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A template&lt;/strong&gt; is a description in JSON or YAML: “I want a bucket, a queue and a role that can read the bucket.” Each resource has a type, properties and a &lt;em&gt;logical ID&lt;/em&gt; identifying it within the template.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A stack&lt;/strong&gt; is the group of resources CloudFormation manages using that template.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CloudFormation&lt;/strong&gt; is the builder. We give it a template to create a stack. Later, we submit a revised template to update that stack.&lt;/p&gt;
&lt;p&gt;Put the old and new templates beside each other:&lt;/p&gt;
&lt;div class=&quot;cdk-table-wrap&quot;&gt;&lt;table class=&quot;cdk-table cdk-changes&quot;&gt;&lt;colgroup&gt;&lt;col&gt;&lt;col&gt;&lt;col&gt;&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot;&gt;Old template&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;New template&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;What the change means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Old template&quot;&gt;Bucket A&lt;/th&gt;
&lt;td data-label=&quot;New template&quot;&gt;Bucket A, same properties&lt;/td&gt;
&lt;td data-label=&quot;What the change means&quot;&gt;No template change for A.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Old template&quot;&gt;Queue B&lt;/th&gt;
&lt;td data-label=&quot;New template&quot;&gt;Queue B, changed properties&lt;/td&gt;
&lt;td data-label=&quot;What the change means&quot;&gt;Update B; the property rules determine whether replacement is needed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Old template&quot;&gt;Service C&lt;/th&gt;
&lt;td data-label=&quot;New template&quot;&gt;No C&lt;/td&gt;
&lt;td data-label=&quot;What the change means&quot;&gt;Remove C from the stack, following its deletion policy.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Old template&quot;&gt;No D&lt;/th&gt;
&lt;td data-label=&quot;New template&quot;&gt;Role D&lt;/td&gt;
&lt;td data-label=&quot;What the change means&quot;&gt;Create D.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;The important idea is that &lt;strong&gt;removing a resource from the description is itself a change&lt;/strong&gt;. On the next deployment, CloudFormation acts on that removal. Depending on its policy, the resource may be deleted or retained.&lt;/p&gt;
&lt;p&gt;The template does not continuously control AWS on its own. Editing a file on our laptop changes nothing in the running stack until we deploy it.&lt;/p&gt;
&lt;h2&gt;3. CDK draws the blueprint&lt;/h2&gt;
&lt;p&gt;Think of the CDK application as an architect&amp;#39;s program that draws a blueprint. CloudFormation is the builder who receives it. Creating an object in that program is not the same as creating its resource in AWS.&lt;/p&gt;
&lt;p&gt;CDK calls those objects &lt;strong&gt;constructs&lt;/strong&gt;. They form a tree: an app contains stacks, and each stack contains constructs describing its infrastructure.&lt;/p&gt;
&lt;p&gt;&lt;div style=&quot;max-width:520px;margin:24px auto&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjls1S_KB2GwmIMm9wubaZXBB6F2G8Q6N4EYDAZXjEt9_QQ8-L7UbG6Qp5JQeXmpydy11IJS8IcZRlsi5Lodws6PxMNdb3bnHZh6_jY4BiyPpUwXQSdfLVbOBTk6ZxsZeJsTVgrhYQHPpxbnkOQ1ojaQAHLqAFIO42VmHCL7Zo79y9CACGwBXB_OoPun0/s1600/construct-tree.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjls1S_KB2GwmIMm9wubaZXBB6F2G8Q6N4EYDAZXjEt9_QQ8-L7UbG6Qp5JQeXmpydy11IJS8IcZRlsi5Lodws6PxMNdb3bnHZh6_jY4BiyPpUwXQSdfLVbOBTk6ZxsZeJsTVgrhYQHPpxbnkOQ1ojaQAHLqAFIO42VmHCL7Zo79y9CACGwBXB_OoPun0/s1600/construct-tree.png&quot; alt=&quot;A simplified tree: the CDK app contains a stack, the stack contains bucket and role constructs, and grantRead adds a policy under the role.&quot; style=&quot;display:block;width:100%;height:auto&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Each stack produces a template. An app with several stacks can produce several templates.&lt;/p&gt;
&lt;p&gt;Constructs come at different levels:&lt;/p&gt;
&lt;div class=&quot;cdk-table-wrap&quot;&gt;&lt;table class=&quot;cdk-table cdk-levels&quot;&gt;&lt;colgroup&gt;&lt;col&gt;&lt;col&gt;&lt;col&gt;&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot;&gt;Level&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;What we write&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Level&quot;&gt;L1&lt;/th&gt;
&lt;td data-label=&quot;What we write&quot;&gt;A direct description of a CloudFormation resource. Class names start with &lt;code&gt;Cfn&lt;/code&gt;.&lt;/td&gt;
&lt;td data-label=&quot;Example&quot;&gt;&lt;code&gt;CfnBucket&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Level&quot;&gt;L2&lt;/th&gt;
&lt;td data-label=&quot;What we write&quot;&gt;A resource with defaults and helper methods.&lt;/td&gt;
&lt;td data-label=&quot;Example&quot;&gt;&lt;code&gt;Bucket&lt;/code&gt;, with &lt;code&gt;grantRead(role)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Level&quot;&gt;L3&lt;/th&gt;
&lt;td data-label=&quot;What we write&quot;&gt;A pattern combining several constructs.&lt;/td&gt;
&lt;td data-label=&quot;Example&quot;&gt;A load-balanced Fargate service.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;For example, &lt;code&gt;bucket.grantRead(role)&lt;/code&gt; creates the Identity and Access Management (IAM) policy needed to give that role read access. The generated policy refers to the bucket&amp;#39;s Amazon Resource Name (ARN). We do not have to write those references by hand.&lt;/p&gt;
&lt;p&gt;That also explains why one line of CDK code can add more than one resource to the template. The construct may describe a whole arrangement, including its supporting resources.&lt;/p&gt;
&lt;h2&gt;4. Follow one deployment from start to finish&lt;/h2&gt;
&lt;p&gt;For a TypeScript app that has been compiled, &lt;code&gt;cdk.json&lt;/code&gt; might contain:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &amp;quot;app&amp;quot;: &amp;quot;node dist/app.js&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now follow &lt;code&gt;cdk deploy UploadsDemo&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 1. The command-line tool finds the program.&lt;/strong&gt; It reads the &lt;code&gt;app&lt;/code&gt; command from &lt;code&gt;cdk.json&lt;/code&gt; and starts it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 2. The program runs.&lt;/strong&gt; It creates the app, stacks and construct tree in memory. A bucket constructor adds a description of a bucket; it does not provision one. The program can still read files or call other services. CDK resource lookups may query AWS and cache their results in &lt;code&gt;cdk.context.json&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3. Synthesis writes the output.&lt;/strong&gt; The application produces a &lt;em&gt;cloud assembly&lt;/em&gt;, normally in &lt;code&gt;cdk.out&lt;/code&gt;. It contains a template for each stack and a &lt;code&gt;manifest.json&lt;/code&gt; describing the assembly. Deployable files or Docker image sources can also be included as assets.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 4. The tool publishes assets when needed.&lt;/strong&gt; Lambda code may need to go into S3; a container image may need to go into an Elastic Container Registry (ECR) repository. &lt;strong&gt;Bootstrapping&lt;/strong&gt; sets up supporting resources, including asset storage and deployment roles, in the target AWS account and region. Those supporting resources can be updated later.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 5. CloudFormation prepares a change set.&lt;/strong&gt; This previews the proposed operations: add, modify, replace or remove resources. It does not execute those operations just by showing them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 6. CloudFormation executes the changes.&lt;/strong&gt; It works through resource dependencies. A role needed by a task definition must be available before that task definition can use it. The terminal shows progress and failures. If an operation fails, rollback can try to undo the stack changes, but rollback can fail too and cannot guarantee recovery of stored data.&lt;/p&gt;
&lt;p&gt;&lt;div style=&quot;max-width:520px;margin:24px auto&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXT07Mzi7q38gxA0up5PMCRNNjIK-ZEJpNPXpVPHvLLgYpfBpzDQdEJnFxn_Q8P_fcO3PIS1Ayn8Wnafi5CAmG9ybpqM_7UeHbHYWmdFFGdu3iLBkPhmHHsVbhCDFMR2gdKd8OxYCrXRC3AtgM6w5yfMhnl5eYik8HugkiaaAafRmjrsO1szZq1qFt1pA/s1600/cdk-flow.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXT07Mzi7q38gxA0up5PMCRNNjIK-ZEJpNPXpVPHvLLgYpfBpzDQdEJnFxn_Q8P_fcO3PIS1Ayn8Wnafi5CAmG9ybpqM_7UeHbHYWmdFFGdu3iLBkPhmHHsVbhCDFMR2gdKd8OxYCrXRC3AtgM6w5yfMhnl5eYik8HugkiaaAafRmjrsO1szZq1qFt1pA/s1600/cdk-flow.png&quot; alt=&quot;The CDK application produces a cloud assembly. The command-line tool submits it to CloudFormation, which creates or updates AWS resources.&quot; style=&quot;display:block;width:100%;height:auto&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;So an ordinary &lt;code&gt;cdk deploy&lt;/code&gt; includes synthesis. It runs the application before applying the resulting description. &lt;code&gt;cdk synth&lt;/code&gt; stops after producing that description.&lt;/p&gt;
&lt;h2&gt;5. Map the commands to the steps&lt;/h2&gt;
&lt;div class=&quot;cdk-table-wrap&quot;&gt;&lt;table class=&quot;cdk-table cdk-commands&quot;&gt;&lt;colgroup&gt;&lt;col&gt;&lt;col&gt;&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot;&gt;Command&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Command&quot;&gt;&lt;code&gt;cdk synth&lt;/code&gt;&lt;/th&gt;
&lt;td data-label=&quot;What it does&quot;&gt;Runs the app and writes the cloud assembly.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Command&quot;&gt;&lt;code&gt;cdk ls&lt;/code&gt;&lt;/th&gt;
&lt;td data-label=&quot;What it does&quot;&gt;Runs the app and lists its stacks.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Command&quot;&gt;&lt;code&gt;cdk diff&lt;/code&gt;&lt;/th&gt;
&lt;td data-label=&quot;What it does&quot;&gt;Compares the new template with the deployed template, or a template we supply.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Command&quot;&gt;&lt;code&gt;cdk deploy &amp;lt;stack&amp;gt;&lt;/code&gt;&lt;/th&gt;
&lt;td data-label=&quot;What it does&quot;&gt;Synthesizes, publishes assets when needed, and deploys the stack and its dependencies.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Command&quot;&gt;&lt;code&gt;cdk deploy &amp;lt;stack&amp;gt; --exclusively&lt;/code&gt;&lt;/th&gt;
&lt;td data-label=&quot;What it does&quot;&gt;Deploys only the selected stack, skipping its dependencies.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Command&quot;&gt;&lt;code&gt;cdk destroy &amp;lt;stack&amp;gt;&lt;/code&gt;&lt;/th&gt;
&lt;td data-label=&quot;What it does&quot;&gt;Asks CloudFormation to delete the stack, subject to resource policies.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Command&quot;&gt;&lt;code&gt;cdk bootstrap&lt;/code&gt;&lt;/th&gt;
&lt;td data-label=&quot;What it does&quot;&gt;Creates or updates deployment-support resources in an account and region.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope=&quot;row&quot; data-label=&quot;Command&quot;&gt;&lt;code&gt;cdk deploy --hotswap&lt;/code&gt;&lt;/th&gt;
&lt;td data-label=&quot;What it does&quot;&gt;For supported development changes, updates resources directly through service APIs. Otherwise, falls back to a normal deployment.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;deploy&lt;/code&gt;, &lt;code&gt;destroy&lt;/code&gt; and &lt;code&gt;bootstrap&lt;/code&gt; can change AWS resources. &lt;code&gt;synth&lt;/code&gt; and &lt;code&gt;ls&lt;/code&gt; do not perform the ordinary stack deployment, but running the app can still involve lookups or other service calls. &lt;code&gt;diff&lt;/code&gt; against a deployed stack reads its template.&lt;/p&gt;
&lt;p&gt;Run &lt;code&gt;diff&lt;/code&gt; before deploying. Use it to review what changed, then inspect any proposed replacement or removal. A CloudFormation change set provides another view of the proposed operations. Neither a template diff nor a change set proves that execution will succeed.&lt;/p&gt;
&lt;p&gt;Hotswap is a development shortcut. It bypasses CloudFormation for supported changes and introduces drift, so it should not be used for production deployments.&lt;/p&gt;
&lt;h2&gt;6. The surprises to understand&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Removing something from code can remove it from AWS.&lt;/strong&gt; A condition might leave a service out of the new template. If the old template contained it, the next deployment removes it from the stack. For data-bearing resources, inspect deletion and retention policies before proceeding.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A rename can change resource identity.&lt;/strong&gt; CloudFormation uses logical IDs to track resources. CDK derives those IDs from construct paths. A variable name and a construct identifier therefore have different consequences.&lt;/p&gt;
&lt;p&gt;&lt;div style=&quot;max-width:520px;margin:24px auto&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMjLN9IwAyx3YO-qxy9_eki7KgDUNSj6a3NSQMOwXhVgtvZVVjOLODrLbdhnNC0R9mWEO2osou2s2x3gEJb33vsoUExvqUbVVg4a8Ulnb91DKNSfFJ3fAACFKomq6eZED__q-k3e1UCWL5hCQIkACUoRTM93ZmPHhOAPiVkdaKDJcl3X7aQsDF4f6M_Ko/s1600/identity-changes.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMjLN9IwAyx3YO-qxy9_eki7KgDUNSj6a3NSQMOwXhVgtvZVVjOLODrLbdhnNC0R9mWEO2osou2s2x3gEJb33vsoUExvqUbVVg4a8Ulnb91DKNSfFJ3fAACFKomq6eZED__q-k3e1UCWL5hCQIkACUoRTM93ZmPHhOAPiVkdaKDJcl3X7aQsDF4f6M_Ko/s1600/identity-changes.png&quot; alt=&quot;Renaming a variable leaves the template unchanged. Adding encryption changes properties under the same logical ID. Renaming the construct produces a new logical ID.&quot; style=&quot;display:block;width:100%;height:auto&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;In the small bucket example shown here, renaming the TypeScript variable leaves the template unchanged. Renaming the construct from &lt;code&gt;Uploads&lt;/code&gt; to &lt;code&gt;Documents&lt;/code&gt; changes the bucket&amp;#39;s logical ID. CloudFormation sees the old entry disappear and a new one appear. Retaining the old bucket keeps its files; it does not copy them to the new bucket.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Some property changes require replacement.&lt;/strong&gt; Keeping the same logical ID does not guarantee an update in place. The rules for the resource and property determine whether CloudFormation can modify it or must replace it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Console edits can drift from the template.&lt;/strong&gt; Changing a security group in the console does not update the file in our repository. A later stack operation may overwrite that change or fail because of it. A template diff alone does not fully inspect live drift.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stacks can depend on each other.&lt;/strong&gt; When two stacks in the same account and region share a resource value, CDK can produce a CloudFormation export in one and an import in the other. That export cannot be removed or changed while another stack imports it. Splitting infrastructure into stacks gives us boundaries, but also dependencies to manage.&lt;/p&gt;
&lt;h2&gt;7. Keep the whole path in view&lt;/h2&gt;
&lt;p&gt;The path is:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TypeScript → construct tree → templates → CloudFormation → AWS resources.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The first three stages produce the description. Deployment applies it. This is why we can inspect a CDK application&amp;#39;s output without deploying the infrastructure.&lt;/p&gt;
&lt;p&gt;For a small exercise, use CDK v2.28.0 to synthesize a stack containing a bucket. Open its template and find the logical ID. Rename only the variable and synthesize again. Then rename the construct identifier. Compare the outputs before considering a deployment: which edit changed how CloudFormation identifies the bucket?&lt;/p&gt;
&lt;h2&gt;Sources &amp;amp; references&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2021/12/aws-cloud-development-kit-cdk-generally-available/&quot;&gt;AWS CDK v2 announcement&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/aws/aws-cdk/blob/v2.28.0/packages/aws-cdk/README.md&quot;&gt;CDK v2.28.0 command-line documentation&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/aws/aws-cdk/blob/v2.28.0/packages/@aws-cdk/core/README.md&quot;&gt;CDK v2.28.0 core documentation&lt;/a&gt;, including constructs and stack dependencies.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/aws/aws-cdk/blob/v2.28.0/packages/@aws-cdk/aws-s3/README.md&quot;&gt;CDK v2.28.0 S3 documentation&lt;/a&gt;, including bucket removal policies.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/aws/aws-cdk/blob/v2.28.0/packages/@aws-cdk/core/lib/private/uniqueid.ts&quot;&gt;CDK logical-ID implementation&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/11071195663155664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2022/06/understanding-aws-cdk-one-stack-at-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/11071195663155664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/11071195663155664'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2022/06/understanding-aws-cdk-one-stack-at-time.html' title='Understanding AWS CDK, one stack at a time'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjls1S_KB2GwmIMm9wubaZXBB6F2G8Q6N4EYDAZXjEt9_QQ8-L7UbG6Qp5JQeXmpydy11IJS8IcZRlsi5Lodws6PxMNdb3bnHZh6_jY4BiyPpUwXQSdfLVbOBTk6ZxsZeJsTVgrhYQHPpxbnkOQ1ojaQAHLqAFIO42VmHCL7Zo79y9CACGwBXB_OoPun0/s72-c/construct-tree.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-3116263456631004301</id><published>2014-06-09T01:14:00.003-07:00</published><updated>2026-10-11T18:35:55.838-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Systems"/><title type='text'>groovy scripts for Jenkins</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
At some point, if you are working on managing&amp;nbsp;&lt;a href=&quot;http://jenkins-ci.org/&quot; target=&quot;_blank&quot;&gt;Jenkins&lt;/a&gt;&amp;nbsp;for your team, you will find yourself looking for a set of useful groovy scripts to control jenkins configuration for a large no of builds/jobs.&lt;br /&gt;
&lt;br /&gt;
Following are some mostly frequently needed ones &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Get all jobs that belong to a view&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt; 
hudson.model.Hudson.instance.getView(&#39;my-view&#39;)?.items.each() { 
    println it.fullDisplayName 
} 
&lt;/pre&gt;
&lt;br /&gt;
&lt;i&gt;Clear the build queue &amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;import hudson.model.*
def queue = Hudson.instance.queue
println &quot;Queue contains ${queue.items.length} items&quot;
queue.clear()
println &quot;Queue cleared&quot;
&lt;/pre&gt;
&lt;br /&gt;
&lt;i&gt;Disable jobs in a view&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;hudson.model.Hudson.instance.getView(&#39;1.1.x-tests&#39;)?.items.each() { 
   println(&quot;JOB : &quot;+it.name)
   it.disabled=true
   it.save()
} 
&lt;/pre&gt;
&lt;i&gt;Get all jobs that that define a TimerTrigger with the trigger spec&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt; 
import hudson.model.* 
import hudson.triggers.*
  
for(item in Hudson.instance.items) {
  
  for(trigger in item.triggers.values()) { 
    
    if(trigger instanceof TimerTrigger) {    
       println(&quot;--- Timer trigger for &quot; + item.name + &quot; ---&quot;)    
        println(trigger.spec + &#39;\n&#39;)   
    }  
  } 
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;i&gt;Disconnect and re-connect to slaves&lt;/i&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;

import hudson.model.* 

Hudson.instance.computers.each { c -&amp;gt;
  c.disconnect()
  c.connect(true)
}&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/3116263456631004301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2014/06/groovy-scripts-for-jenkins.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/3116263456631004301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/3116263456631004301'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2014/06/groovy-scripts-for-jenkins.html' title='groovy scripts for Jenkins'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-8765196748202551658</id><published>2013-04-07T13:02:00.002-07:00</published><updated>2026-10-11T18:34:15.971-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>specs 2, Scala and maven with IntelliJ 12.1 and getting things right</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Recently, to learn a test framework for Scala ( even for Java) I chose specs2 . &amp;nbsp;Its still difficult to move to SBT, largely due to the fact that I am yet to be comfortable using it. So, for the time being I will stick to maven.&lt;br /&gt;
To configure the scala/java project edit the pom.xml to include&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-txt&quot;&gt;    
     &amp;lt;dependencies&amp;gt;
        &amp;lt;!-- specs2 version I used : 1.12.3--&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupid&amp;gt;org.specs2&amp;lt;/groupid&amp;gt;
            &amp;lt;artifactid&amp;gt;specs2_${scala.version}&amp;lt;/artifactid&amp;gt;
            &amp;lt;version&amp;gt;${specs2.version}&amp;lt;/version&amp;gt;
            &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
        &amp;lt;/dependency&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.scala-lang&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;scala-library&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;${scala.version}&amp;lt;/version&amp;gt;
        &amp;lt;/dependency&amp;gt;
    &amp;lt;/dependencies&amp;gt;

    &amp;lt;build&amp;gt;
        &amp;lt;sourceDirectory&amp;gt;src/main/scala&amp;lt;/sourceDirectory&amp;gt;
        &amp;lt;testSourceDirectory&amp;gt;src/test/scala&amp;lt;/testSourceDirectory&amp;gt;
            &amp;lt;plugin&amp;gt;
                &amp;lt;groupId&amp;gt;org.scala-tools&amp;lt;/groupId&amp;gt;
                &amp;lt;artifactId&amp;gt;maven-scala-plugin&amp;lt;/artifactId&amp;gt;
                &amp;lt;version&amp;gt;2.15.2&amp;lt;/version&amp;gt;
                &amp;lt;executions&amp;gt;
                    &amp;lt;execution&amp;gt;
                        &amp;lt;goals&amp;gt;
                            &amp;lt;goal&amp;gt;compile&amp;lt;/goal&amp;gt;
                            &amp;lt;goal&amp;gt;testCompile&amp;lt;/goal&amp;gt;
                        &amp;lt;/goals&amp;gt;
                    &amp;lt;/execution&amp;gt;
                &amp;lt;/executions&amp;gt;
                &amp;lt;configuration&amp;gt;
                     &amp;lt;jvmArgs&amp;gt;
                        &amp;lt;jvmArg&amp;gt;-Xms128m&amp;lt;/jvmArg&amp;gt;
                        &amp;lt;jvmArg&amp;gt;-Xmx1024m&amp;lt;/jvmArg&amp;gt;
                    &amp;lt;/jvmArgs&amp;gt;
                    &amp;lt;scalaVersion&amp;gt;${scala.version}&amp;lt;/scalaVersion&amp;gt;
                &amp;lt;/configuration&amp;gt;
            &amp;lt;/plugin&amp;gt;
     &amp;lt;/build&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
Include tests under &lt;i&gt;&amp;nbsp;src/scala/test . &lt;/i&gt;An&amp;nbsp;ubiquitous example&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;  
import org.specs2.mutable._
import org.junit.runner.RunWith
import org.specs2.runner.JUnitRunner


@RunWith(classOf[JUnitRunner])
class MyTest extends Specification{



  &quot;The &#39;Hello world&#39; string&quot; should {
    &quot;contain 11 characters&quot; in {
      &quot;Hello world&quot; must have size (11)
    }
    &quot;start with &#39;Hello&#39;&quot; in {
      &quot;Hello world&quot; must startWith(&quot;Hello&quot;)
    }
    &quot;end with &#39;world&#39;&quot; in {
      &quot;Hello world&quot; must endWith(&quot;world&quot;)
    }
  }
  // Update : by default tests are run in parallel, to execute them sequentially
  // add `sequential` before the spec e.g.

  sequential
  &quot;My sequential spec&quot; should {
     var a = 5
    &quot;add 1 to a&quot; in {
      a = a+1
      a mustEqual(6)
    }

    &quot;multiply current a by 2&quot; in {
      a = a* 2
      a mustEqual(12)
    }
  }

 // try removing `sequential` from the spec, it would fail randomly.
}
&lt;/pre&gt;
&lt;br /&gt;
Thats it!. For running tests from IntelliJ simply right-click and run, and from cmdline execute &lt;i&gt;mvn test&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/8765196748202551658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2013/04/specs-2-scala-and-maven-with-intellij.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/8765196748202551658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/8765196748202551658'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2013/04/specs-2-scala-and-maven-with-intellij.html' title='specs 2, Scala and maven with IntelliJ 12.1 and getting things right'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-3518308098641005753</id><published>2013-03-12T12:09:00.000-07:00</published><updated>2026-10-14T18:44:01.288-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Experiments"/><title type='text'>me, akka and scala</title><content type='html'>&lt;p&gt;I&amp;#39;ve been learning Scala recently, including through a Coursera course. I&amp;#39;m gradually moving from writing Java-like Scala toward thinking in terms of transformations on data.&lt;/p&gt;
&lt;p&gt;What I like so far is being able to express operations on collections without spelling out every intermediate step. Shorter code helps when it makes the flow easier to follow, but it does not automatically make a program easier to maintain.&lt;/p&gt;
&lt;p&gt;Recently, I came across Akka. It lets us organize concurrent work as actors that communicate through messages. Each actor handles one message at a time and can keep its own state. This gives us a way to separate responsibilities without having several workers directly update the same state. We still need to design how those actors coordinate.&lt;/p&gt;
&lt;p&gt;I tried a word-count program using Akka and Scala. A mapper splits sentences into words, a reducer combines their counts, and an aggregator maintains the totals. The useful part of this exercise is seeing how work moves between actors while the running totals belong to one actor.&lt;/p&gt;
&lt;p&gt;The example waits half a second before requesting the result. That gives the workers time, but doesn&amp;#39;t guarantee they have finished. A useful next improvement would be to track completion explicitly, so the program knows when all the counts have reached the aggregator.&lt;/p&gt;
&lt;h2&gt;Sources &amp;amp; references&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abhigit/akka-mapreduce-example/tree/5d26f5f26e777c13ced03bf235cd8358e752ff83&quot;&gt;My word-count example on GitHub&lt;/a&gt;, using Scala 2.9.2 and Akka 2.0.5.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/akka/akka/blob/v2.0.5/akka-docs/general/actors.rst&quot;&gt;Akka 2.0.5: actors, state and mailboxes&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/3518308098641005753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2013/03/me-akka-and-scala.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/3518308098641005753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/3518308098641005753'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2013/03/me-akka-and-scala.html' title='me, akka and scala'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total><georss:featurename>Tokyo, Japan</georss:featurename><georss:point>35.6894875 139.69170639999993</georss:point><georss:box>21.7018745 119.03740939999993 49.677100499999995 160.34600339999992</georss:box></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-1661911408524532313</id><published>2013-01-26T13:23:00.002-08:00</published><updated>2026-10-11T18:38:13.713-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ideas"/><title type='text'>How to make most out of Jira?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
It has been quite a while (still &amp;lt; 1 year), I am using &lt;a href=&quot;http://www.atlassian.com/software/jira/overview&quot;&gt;Atlassian Jira&lt;/a&gt; for bug/issue tracking withing my team of roughly 15. Previously, we were using a version of Redmine, doped to suit company environment.&lt;br /&gt;
&lt;br /&gt;
I had read, heard a lot about Jira&#39;s abilities regarding how it can be useful to ease the project management and accurately measure the project&#39;s progress. But, recently  under peer pressure of my group, where I was required to file some appropriate bugs/improvements/tasks, along with doing myriad of other things, I learned &amp;nbsp;importance of using Jira.&lt;br /&gt;
&lt;br /&gt;
How we can make most out it?&lt;br /&gt;
&lt;br /&gt;
Well, Jira is no magic, but just a tool; rather, it provides a platform for task management. So, all task management is left to you. Here&#39;s how I did and worked well for me&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;create a high-level abstract issue of big task you will be working on and put in the initial estimates if you already know or leave it to the sub-tasks&lt;/li&gt;
&lt;li&gt;divide the task into concrete sub-tasks with concrete estimates&lt;/li&gt;
&lt;li&gt;and work !&lt;/li&gt;
&lt;/ul&gt;
That&#39;s&amp;nbsp;it! Its that really simple. Instead of adding a bunch of many issues, this way of filing issues into Jira really helped me to work efficiently and convey accurate project progress to my mangers. At times, I also had to update the estimates for the tasks but earlier you do it the better it is. That was the overall gist of it.&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/1661911408524532313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2013/01/how-to-make-most-out-of-jira.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1661911408524532313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1661911408524532313'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2013/01/how-to-make-most-out-of-jira.html' title='How to make most out of Jira?'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-8994123845923332942</id><published>2013-01-26T13:00:00.002-08:00</published><updated>2026-10-11T18:34:15.971-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>getting android emulator to work normally on 64 bit linux</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Recently I started working on a nfc android app but I was stuck with very basic thing of getting emulator to work normally on my home laptop running Linux Mint. I tried numerous ways to configure eclipse, java paths, AVDs (android virtual devices), checking adb logcat etc but nothing really helped. The emulator could start but always hanged on the boot screen. (believe me, I even waited a complete day for it to boot up).&lt;br /&gt;
&lt;br /&gt;
Thanks to StackOverflow again! As described in the comments &lt;a href=&quot;http://stackoverflow.com/a/8117450/742894&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&amp;nbsp;and also &lt;a href=&quot;http://stackoverflow.com/q/1919340/742894&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;, the&amp;nbsp;Android team still has some more work to do until they make the emulator ( and other stuff) work with 64-bit version of java. But, I could happily run my android project with emulator ( which works quite fast now :) ) by simply configuring eclipse&#39;s default jre to be a 32-bit version of java 7. While 64 bit jdk being default for other things.&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/8994123845923332942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2013/01/getting-android-emulator-to-work.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/8994123845923332942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/8994123845923332942'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2013/01/getting-android-emulator-to-work.html' title='getting android emulator to work normally on 64 bit linux'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-1488591319410528743</id><published>2013-01-20T04:15:00.000-08:00</published><updated>2026-10-11T18:36:49.715-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Systems"/><title type='text'>unique id generation at high scale</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Moving away from relational db allows us to work with huge data, which would otherwise be not feasible. But, it also mandates us to look into the issues that we didn&#39;t have to consider much about.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
One of such thing was generating unique ids. With mysql you get auto-incremented ids which work absolutely fine for most of the use cases. But, for other systems, in context of nosql/distributed systems, that job is on system designer&#39;s shoulder. Inherently one-size fits all solution is difficult to come with.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
There are many solutions proposed for this ubiquitous problem.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Twitter has developed&amp;nbsp;&lt;a href=&quot;https://github.com/twitter/snowflake&quot; target=&quot;_blank&quot;&gt;snowflake&lt;/a&gt;&amp;nbsp;which solves it. &amp;nbsp;They guarantee id generation with the following constraints :&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;minimum 10k ids per second per process&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;response rate 2ms (plus network latency&lt;/li&gt;
&lt;/ul&gt;
The other solution I found is &amp;nbsp;&lt;a href=&quot;https://github.com/boundary/flake&quot; target=&quot;_blank&quot;&gt;flake&lt;/a&gt;&amp;nbsp; by &lt;a href=&quot;http://boundary.com/blog/2012/01/12/flake-a-decentralized-k-ordered-unique-id-generator-in-erlang/&quot; target=&quot;_blank&quot;&gt;boundary&lt;/a&gt;. It achieves the goal of generating ids with good performance and adequate bit size 128 which snowflake lacked.&lt;br /&gt;
&lt;br /&gt;
I will update more information on it later, as I confront with more of these.&lt;br /&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/1488591319410528743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2013/01/high-scale-unique-id-generation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1488591319410528743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1488591319410528743'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2013/01/high-scale-unique-id-generation.html' title='unique id generation at high scale'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-704227016865716078</id><published>2013-01-19T13:20:00.001-08:00</published><updated>2026-10-11T18:34:15.970-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>Migrating svn repository to git</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
After googling I found this StackOverflow&amp;nbsp;&lt;a href=&quot;http://stackoverflow.com/questions/79165/how-to-migrate-svn-with-history-to-a-new-git-repository&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;.&amp;nbsp;First, I needed to install git-svn module.&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;$ sudo apt-get install git-svn&lt;/pre&gt;
Now we also need to map svn users to git users. we can&amp;nbsp;get all svn users &amp;nbsp;( skip if you already know them) with this command ( execute under svn project root )&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;$ svn log | grep &#39;^r[0-9]&#39; | awk &#39;{print $3}&#39; | sort | uniq &lt;/pre&gt;
Once you get all users, create a users.txt file mapping svn users to git&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;user1 = first_name last_lame &amp;lt;email@address.com&amp;gt;
user2 = first_name last_lame &amp;lt;email@address.com&amp;gt;
&lt;/pre&gt;
Once you make sure all of your svn users are mapped to git, then execute&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;$ git svn clone --stdlayout --no-metadata -A users.txt svn://hostname/path dest_dir&lt;/pre&gt;
It will start fetching svn repository into git. If you run into other problems, like&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;Author: (no author) not defined in users.txt file &lt;/pre&gt;
then simply add following line to users.txt&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt; (no author) = first_name last_lame &amp;lt;email@address.com&amp;gt;&lt;/pre&gt;
Note : If, due to this error, git svn command stops then simply update users.txt file and resume the migration 
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;$ git svn fetch &lt;/pre&gt;
&lt;br /&gt;
Now you can transfer your existing git repository to remote git url e.g. 
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;$ git push --mirror git@github.com:username/project.git &lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/704227016865716078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2013/01/migrating-svn-repository-to-git.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/704227016865716078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/704227016865716078'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2013/01/migrating-svn-repository-to-git.html' title='Migrating svn repository to git'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-4194456779684351800</id><published>2012-08-17T22:36:00.001-07:00</published><updated>2026-10-11T18:34:15.970-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>Setting up Own Maven Repository</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;prettyprint lang-xml&quot;&gt; 
 &amp;lt;settings&amp;gt;  
  &amp;lt;mirrors&amp;gt;  
   &amp;lt;mirror&amp;gt;  
    &amp;lt;!--This sends everything else to /public --&amp;gt;  
    &amp;lt;id&amp;gt;nexus&amp;lt;/id&amp;gt;  
    &amp;lt;mirrorof&amp;gt;*&amp;lt;/mirrorof&amp;gt;  
    &amp;lt;url&amp;gt;http://myhost.com:8080/nexus/content/groups/public&amp;lt;/url&amp;gt;  
   &amp;lt;/mirror&amp;gt;  
  &amp;lt;/mirrors&amp;gt;  
  &amp;lt;profiles&amp;gt;  
   &amp;lt;profile&amp;gt;  
    &amp;lt;id&amp;gt;rakuten&amp;lt;/id&amp;gt;  
    &amp;lt;repositories&amp;gt;  
     &amp;lt;repository&amp;gt;  
      &amp;lt;id&amp;gt;myprofile&amp;lt;/id&amp;gt;  
      &amp;lt;name&amp;gt;My Internal Repository&amp;lt;/name&amp;gt;  
      &amp;lt;releases&amp;gt;  
       &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;  
       &amp;lt;updatepolicy&amp;gt;never&amp;lt;/updatepolicy&amp;gt;  
      &amp;lt;/releases&amp;gt;  
      &amp;lt;snapshots&amp;gt;  
       &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;  
       &amp;lt;updatepolicy&amp;gt;always&amp;lt;/updatepolicy&amp;gt;  
      &amp;lt;/snapshots&amp;gt;  
      &amp;lt;url&amp;gt;http://myhost.com:8080/nexus/content/groups/public&amp;lt;/url&amp;gt;  
      &amp;lt;layout&amp;gt;default&amp;lt;/layout&amp;gt;  
     &amp;lt;/repository&amp;gt;  
    &amp;lt;/repositories&amp;gt;  
   &amp;lt;/profile&amp;gt;  
  &amp;lt;/profiles&amp;gt;  
  &amp;lt;activeprofiles&amp;gt;  
   &amp;lt;activeprofile&amp;gt;myprofile&amp;lt;/activeprofile&amp;gt;  
  &amp;lt;/activeprofiles&amp;gt;  
 &amp;lt;/settings&amp;gt;
 &lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/4194456779684351800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2012/08/setting-up-own-maven-repository.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/4194456779684351800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/4194456779684351800'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2012/08/setting-up-own-maven-repository.html' title='Setting up Own Maven Repository'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-4976846920266029064</id><published>2011-11-09T20:25:00.001-08:00</published><updated>2026-10-11T18:37:45.154-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Experiments"/><title type='text'>Getting cross domain Ajax to work!</title><content type='html'>&lt;p&gt;Last week I was working on a project which required me to use ajax to fetch the results from 3 different servers and use the result together to have a comparison side-by-side.&lt;/p&gt;
&lt;p&gt;I had a little knowledge of Ajax, so I had to strive a bit for getting things to work. Here, I share my findings.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Problem: Using Ajax to fetch cross domain data.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;What does it mean? &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Suppose my current domain is blahblah.com and I want something from phewphew.com then I need to do a cross domain fetch with Ajax.&lt;/p&gt;
&lt;p&gt;By conventions &lt;em&gt;Javascript doesn&#39;t allow &lt;/em&gt;to fetch such cross domain data. It involves security issues. Anyways, I didn&#39;t go much into that !!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Quick solution 1&lt;/strong&gt; :&lt;/p&gt;
&lt;p&gt;One solution to this problem is to use a custom servlet ( or php, whatever you use, it will act as a &lt;em&gt;proxy&lt;/em&gt; ) /JSP page that downloads the JSON ( or any other type ) and simply reproduces it.&amp;nbsp; In that case, you will put your Ajax calls to a page on same domain and that will work perfectly fine.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution 2 :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Another solution, if using JQueries, using JSONP would help retrieving JSON data easily.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;NOTE: These were really abstract solutions, I would try to illustrate it with example code soon .&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/4976846920266029064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2011/11/getting-cross-domain-ajax-to-work.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/4976846920266029064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/4976846920266029064'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2011/11/getting-cross-domain-ajax-to-work.html' title='Getting cross domain Ajax to work!'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-2113499233126174440</id><published>2011-08-05T13:06:00.000-07:00</published><updated>2026-10-11T18:34:15.970-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="aws"/><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>How To: Successfully set up Amazon EC2 micro instance</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Amazon Web Services is a very rich arsenal of web services. Surprisingly, using them is really easy and simple. I tried my first hands on Amazon&#39;s Elastic Cloud, in layman&#39;s terms, it is a server&lt;br /&gt;
I tried to set up a AWS micro instance on Amazon EC2. The setup is very simple and we can set a system running in just few minutes. I could also quickly set up a tomcat server running on it.&lt;br /&gt;
I will quickly list down the steps that I followed.&lt;br /&gt;
&lt;br /&gt;
(1) From EC2 console launch a new Instance. For quick start select any AMI ( Amazon Machine Image) that suits your need. It &lt;a href=&quot;https://forums.aws.amazon.com/thread.jspa?threadID=22294&quot;&gt;can&lt;/a&gt; later be changed or upgraded.&lt;br /&gt;
&lt;br /&gt;
(2) Once an AMI is selected, fill in the details related to instances (Micro instance&#39;s usage falls under free tier for the&amp;nbsp;first year), kernel, ram, monitoring details etc. &lt;br /&gt;
&lt;br /&gt;
(3) Next, create a key-value (optional)&lt;br /&gt;
&lt;br /&gt;
(4) Select proper security group. (This is also important to keep your instance secure. Once I got my instance hacked due to careless firewall settings ). Don&#39;t allow many ports to be open, only the few that you intend to use for your need.&lt;br /&gt;
&lt;br /&gt;
(5) Review everything and click &#39;Launch&#39; and done!! Your instance will be ready to use within few minutes.&lt;br /&gt;
(6) Create a new key-pair and download the private file.&lt;br /&gt;
&lt;br /&gt;
(7) Once the status of the instance turns &#39;running&#39; it can be used to connect.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-sh&quot;&gt;$ ssh -i aws.pem ec2-user@ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
&lt;/pre&gt;
(8) This is it!! Time to have fun!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/2113499233126174440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2011/08/how-to-successfully-set-up-amazon-ec2.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/2113499233126174440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/2113499233126174440'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2011/08/how-to-successfully-set-up-amazon-ec2.html' title='How To: Successfully set up Amazon EC2 micro instance'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-5353250268847433998</id><published>2011-05-08T00:56:00.000-07:00</published><updated>2026-10-11T18:34:15.970-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>A note on dictionaries in Programming languages</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I recently started with learning python. The good thing about python is that everything in python is dynamic. Python is dynamically typed language. What does it means?&lt;br /&gt;
In C/C++ or Java we need to define the type of a variable before using it.&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-python&quot;&gt;int a; 
float b;
// even Objects need to be defined in
Matrix m1;
&lt;/pre&gt;
&lt;br /&gt;
But, python is different in this regard. Here, we can use a variable and its type is decided on first assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-python&quot;&gt;list  # not needed but just for explanation

list = [] # creates an empty list

&lt;/pre&gt;
&lt;br /&gt;
Thus, Python decides the type of a variable on its first assignment making it dynamically typed. But, another thing to be careful with in it is that Python is also strongly typed language. Means, once assigned we cant change the type of that variable. In, above python code once &lt;i&gt;list&lt;/i&gt; varible is assigned an list object it cant be assigned any other data type. It remains list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below, is the summarization of different types of languages based on the property we just discussed.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;statically typed language&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
A language in which types are fixed at compile time. Most statically typed languages enforce this by requiring you to declare all variables with their datatypes before using them. Java and C are statically typed languages. &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;dynamically typed language&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
A language in which types are discovered at execution time; the opposite of statically typed. VBScript and Python are dynamically typed, because they figure out what type a variable is when you first assign it a value. &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;strongly typed language&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
A language in which types are always enforced. Java and Python are strongly typed. If you have an integer, you can&#39;t treat it like a string without explicitly converting it. &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;weakly typed language&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
A language in which types may be ignored; the opposite of strongly typed. VBScript is weakly typed. In VBScript, you can concatenate the string &#39;12&#39; and the integer 3 to get the string &#39;123&#39;, then treat that as the integer 123, all without any explicit conversion. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/5353250268847433998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2011/05/note-on-dictionaries-in-programming.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/5353250268847433998'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/5353250268847433998'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2011/05/note-on-dictionaries-in-programming.html' title='A note on dictionaries in Programming languages'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total><georss:featurename>Otaku, Tokyo, Japan</georss:featurename><georss:point>35.6894875 139.69170639999993</georss:point><georss:box>35.6611165 139.65574989999993 35.7178585 139.72766289999993</georss:box></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-5169321957693859972</id><published>2011-05-06T23:06:00.001-07:00</published><updated>2026-10-11T18:40:34.524-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>line-by-line processing : Linux Bash</title><content type='html'>&lt;p&gt;Often we require to process a file content line by line. Linux inherently supports this thorough its powerful shell commands. Lets walk through some of the ways to parse a file line-by-line.&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;First, we can parse a file by &lt;b&gt;catting&lt;/b&gt; a file and &lt;b&gt;piping&lt;/b&gt; the file output to a while read loop.&lt;br /&gt;
The following bash script produces it own code as output. Isn&#39;t it interesting?&lt;/p&gt;&lt;p&gt;&lt;b&gt;code for dumping own file content&lt;/b&gt;&lt;/p&gt;&lt;pre class=&quot;prettyprint lang-sh&quot;&gt;#!bin/bash

cat $0 | while read line
do
echo $line;
done
&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;Secondly, using file descriptors we can play a lot with it. But, before we will learn about firl descriptors in brief.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Under unix/linux OS, files are referenced, copied, and moved by unique numbers known as file descriptors. &lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;&lt;tr&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt; stdin&lt;/td&gt;&lt;td&gt;It is(devie) usually the keyboard or mouse from where the input comes.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;stdout&lt;/td&gt;&lt;td&gt;It is where output is redirected e.g. screen or file&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;stderr&lt;/td&gt;&lt;td&gt;It is where the standard error messages are routed by commands, programs, and scripts.&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;pre class=&quot;prettyprint lang-sh&quot;&gt;$ some_command 2&gt;&amp;1
&lt;/pre&gt;&lt;br /&gt;
this means, the command sends all of the error messages to the same output device that the standard output goes to, which is normally the terminal. &lt;/p&gt;&lt;p&gt;Now, we will use this file descriptors to write the same shell script we wrote before.( which outputs its own code) &lt;/p&gt;&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-sh&quot;&gt;#!bin/bash

exec 3&lt;&amp;0  #redirect standard input to file descritpor 3

exec 0&lt;$0 # redirect current file content to standard input

while read LINE   # simply read from standard input now
do 
echo $LINE;
done

exec 0&lt;&amp;3  # revert back stanrd input from 3 to 0
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/5169321957693859972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2011/05/line-by-line-processing-linux-bash_06.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/5169321957693859972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/5169321957693859972'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2011/05/line-by-line-processing-linux-bash_06.html' title='line-by-line processing : Linux Bash'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-2116199294752535249</id><published>2011-05-06T12:37:00.001-07:00</published><updated>2026-10-11T18:40:10.475-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>Upgrading Ubuntu to Natty Narwhal</title><content type='html'>&lt;div class=&#39;posterous_autopost&#39;&gt;I recently upgraded Maverick Meerkat to Natty Narwhal. The new ubuntu is packed with Unity for default desktop session. The Unity brings a lot of improvements with it. Along with improved UI and perceivable improved speed we could see a new scrollbar which takes less space and looks nice. Real gift to Ubuntu lovers!! worth a try !!!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/2116199294752535249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2011/05/upgrading-ubuntu-to-natty-narwhal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/2116199294752535249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/2116199294752535249'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2011/05/upgrading-ubuntu-to-natty-narwhal.html' title='Upgrading Ubuntu to Natty Narwhal'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-1616071529401279632</id><published>2011-02-08T06:37:00.000-08:00</published><updated>2026-10-11T18:34:15.970-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>Removing packages from linux (ubuntu)</title><content type='html'>I tried to remove the packages from maverick (Ubuntu 10.10), today..and found some good ways to do it&lt;br /&gt;
&lt;br /&gt;
(A)First search the package :&lt;br /&gt;
&lt;br /&gt;
The traditional way:&lt;br /&gt;
&lt;blockquote&gt;dpkg -l | grep &lt;i&gt;partial-name-of-package-to-be-removed&lt;/i&gt; &lt;/blockquote&gt;Using &lt;i&gt;dpkg&lt;/i&gt; command ....more conspicuous way&lt;br /&gt;
&lt;blockquote&gt;dpkg -l &#39;*&lt;i&gt;partial-name-of-package-to-be-removed&lt;/i&gt;*&#39;   &lt;/blockquote&gt;For example, you want to remove &lt;i&gt;jdk&lt;/i&gt; then&lt;br /&gt;
&lt;blockquote&gt;dpkg -l &#39;*jdk*&#39;   &lt;/blockquote&gt;&lt;br /&gt;
(B)There are two ways to remove packages:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Using &lt;i&gt;apt&lt;/i&gt; command :&lt;/b&gt; ...the better way...&lt;br /&gt;
&lt;br /&gt;
After getting the list of packages choose the appropriate one and run following command&lt;br /&gt;
&lt;br /&gt;
* To remove packages: &lt;br /&gt;
&lt;blockquote&gt;sudo apt-get remove &lt;i&gt;package-name&lt;/i&gt;&lt;/blockquote&gt;* To remove packages and dependencies:&lt;br /&gt;
&lt;blockquote&gt;sudo apt-get autoremove &lt;i&gt;package-name&lt;/i&gt;&lt;/blockquote&gt;* To remove packages, dependencies and configuration files:&lt;br /&gt;
&lt;blockquote&gt;sudo apt-get purge &lt;i&gt;package-name&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;b&gt;Using &lt;i&gt;dpkg&lt;/i&gt; command :&lt;/b&gt; ...the crude way...&lt;br /&gt;
&lt;br /&gt;
* To remove packages: &lt;br /&gt;
&lt;blockquote&gt;sudo dpkg -r &lt;i&gt;package-name&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;
* To remove packages,and configuration files:&lt;br /&gt;
&lt;blockquote&gt;sudo dpkg --purge &lt;i&gt;package-name&lt;/i&gt;&lt;/blockquote&gt;* To force removal, if got dependency error(this command turns errors into warning..):&lt;br /&gt;
&lt;blockquote&gt;sudo dpkg --purge --force-depends &lt;i&gt;package-name&lt;/i&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/1616071529401279632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2011/02/experiments-with-linux-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1616071529401279632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1616071529401279632'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2011/02/experiments-with-linux-1.html' title='Removing packages from linux (ubuntu)'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-3604333862000004915</id><published>2011-02-06T07:06:00.000-08:00</published><updated>2026-10-11T18:39:00.558-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ideas"/><title type='text'>What is an Open System?</title><content type='html'>I used &#39;Open System&#39; term many times but today I got some time to think, in detail, about the very deep meaning of it. So here it goes...&lt;br /&gt;
&lt;br /&gt;
An open system is one for which the architecture is not a secret. Just take example of TCP/IP system, which is Open. The TCP/IP protocols are same for every system. Whether its your laptop-PC using TCP/IP or your android smart-phone downloading apps from market. The architecture is same irrespective of the systems that use them. So this has many advantages, UNIX is a very good example of Open system software.</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/3604333862000004915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2011/02/what-is-open-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/3604333862000004915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/3604333862000004915'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2011/02/what-is-open-system.html' title='What is an Open System?'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-1263041177519906525</id><published>2010-03-11T13:40:00.000-08:00</published><updated>2026-10-11T18:34:15.970-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Notes"/><title type='text'>Install Vista / Win 7 from Pen Drive</title><content type='html'>Here is a cool trick(in fact, a built in utility in vista/win 7) to make a pen drive bootable and use it to install vista or win 7 from it. What you are required to have is a pen drive (4 GB+) and vista/win 7 iso/DVD and a laptop or a PC. :P&lt;br /&gt;&lt;br /&gt;So, if all is set we proceed, as follows:&lt;br /&gt;&lt;br /&gt;First, open cmd prompt as administrator. Then type following commands one by one.&lt;br /&gt;(Note: comments(#) are shown for the purpose of understanding and they are definitely not part of commands.)&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;diskpart &lt;/span&gt; &lt;br /&gt;# Opens DISKPART utility built-in in vista/win 7&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;list disk &lt;/span&gt; &lt;br /&gt;# Lists the available disks for installation&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;select disk 1&lt;/span&gt;&lt;br /&gt;# select the disk 1 or 2 or 3 or so on.. i.e. pen drive disk which is there in the list&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;clean&lt;/span&gt;&lt;br /&gt;# cleans the disk&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;create partition primary &lt;/span&gt;&lt;br /&gt;# creates the primary partition  &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;select partition 1&lt;/span&gt;&lt;br /&gt;# does as specified&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;active&lt;/span&gt;&lt;br /&gt;#....&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;foramt fs=NTFS&lt;/span&gt;&lt;br /&gt;# format it with NTFS file system. it will take some time! :(&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;assign&lt;/span&gt;&lt;br /&gt;# mounts the disk &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;exit&lt;/span&gt;&lt;br /&gt;# get exit from diskpart utility&lt;br /&gt;&lt;br /&gt;Don’t close the cmd prompt as we need to execute one more command at the next step. Just minimize it.&lt;br /&gt;Now mount the iso using virtual drive manager like Power iso or insert dvd. We assume D: be the drive letter of it.&lt;br /&gt;&lt;br /&gt;go to D:\BOOT folder from minimized cmd promp window.&lt;br /&gt;&lt;br /&gt;Type another command given below to update the USB drive with BOOTMGR compatible code.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;bootsect.exe /nt60 g:&lt;/span&gt;&lt;br /&gt;# here g: is the assumed drive letter of pen drive. Change it, if different.&lt;br /&gt;&lt;br /&gt;Copy your Windows 7/Vista DVD contents to the USB flash drive.&lt;br /&gt;Now your pen drive is bootable.&lt;br /&gt;&lt;br /&gt;Only thing you need to change the boot priority at the BIOS to USB from the HDD or CD ROM drive. I won’t explain it as it’s just the matter the changing the boot priority or enabling the USB boot option in the BIOS.</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/1263041177519906525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2010/03/install-vista-win-7-from-pen-drive.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1263041177519906525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1263041177519906525'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2010/03/install-vista-win-7-from-pen-drive.html' title='Install Vista / Win 7 from Pen Drive'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2130170004051151560.post-1368971629839583105</id><published>2009-08-14T16:07:00.001-07:00</published><updated>2026-10-11T18:39:37.136-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Software and Life"/><title type='text'>Why Study Computer Science/Engineering?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Before I took Computer Science as my major in BTech, I barely could have wondered the reasons behind studying it. That time, it was the most lucrative major with good salaries and perks, and a obvious choice for me to make. But over course of 4 years, my view towards this field has changed significantly.&lt;br /&gt;
Computer Science requires you to have creativity(ability to devise), brainwave the situations (get clear insights of complex situations), thorough knowledge of the field and to some extent flair in problem solving. With the need of each new application, problem solving technique or opportunity comes the new range of problem solving solution sets. Computer Engineer&#39;s job here is to chose the best possible solution from the set to the need of situation. It is like intellectual stimulation. As stated its not a simple job that anyone can accomplish. It requires thorough analysis and exploration of resources going thorough different levels of details and abstractions ultimately leading to a perfect solution(not always though :P) which consist of an algorithm or a system/application. Just creating enhanced applications is not our job, but to maintain its integrity. Days of individuals working on computation are long gone. Today we work in groups,teams. Work is well divided and scheduled to achieve the best possible outcome as early as possible though efforts of the teams. It is a wonderful combination of theory and practice and thats what is the computer engineering is all about : providing effective solutions to the needs of society or industry.(Definition of engineering :P)&lt;br /&gt;
Now we come to the society benefits of it. Since computers forms the integral part of contemporary society (e.g., in transportation, medicine, engineering, economics, entertainment, technical theater, record keeping, insurance—the list seems endless), work in the computing field provides the opportunity to contribute to many aspects of society. Computing applications have great potential to help address human needs and improve the quality of life.&lt;br /&gt;
Computer science is inherently interdisciplinary. Many computing applications connect computer scientists with professionals in many disciplines. Complex systems draw upon multiple subjects and perspectives, so most computing folk work with a diverse range of people.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.abhijeetparande.com/feeds/1368971629839583105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.abhijeetparande.com/2009/08/why-study-computer-science-engineering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1368971629839583105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2130170004051151560/posts/default/1368971629839583105'/><link rel='alternate' type='text/html' href='http://www.abhijeetparande.com/2009/08/why-study-computer-science-engineering.html' title='Why Study Computer Science/Engineering?'/><author><name>Abhijeet</name><uri>http://www.blogger.com/profile/11202083659656811507</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>