-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathatom.xml
More file actions
759 lines (585 loc) · 43.6 KB
/
atom.xml
File metadata and controls
759 lines (585 loc) · 43.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Relax -Crazy]]></title>
<link href="http://Tanu91.github.io/atom.xml" rel="self"/>
<link href="http://Tanu91.github.io/"/>
<updated>2014-09-29T00:23:11+05:30</updated>
<id>http://Tanu91.github.io/</id>
<author>
<name><![CDATA[Tanu]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Analyze URL for NER Using Python]]></title>
<link href="http://Tanu91.github.io/blog/2014/09/28/analyze-url-for-ner-using-python/"/>
<updated>2014-09-28T23:41:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2014/09/28/analyze-url-for-ner-using-python</id>
<content type="html"><![CDATA[<p>The amount of natural language text that is available is increasing day by day.The Complexity of Natural Language makes it difficult to access information in text. So, guys dive in to Text Processing.</p>
<p>Named Entity Recognition is one of the important sub-task of Text Processing to classify elements in text into pre-defined categories such as the names of persons, organizations, locations etc. Here I will share a code snippet for Entity Extraction using TextRazor API in Python.</p>
<p>Pre-requisities:</p>
<pre><code>a. Python 2.7
b. Get a free API key from https://www.textrazor.com
c. Install Python SDK for TextRazor. Download zip and run setup.py from https: //github.com/TextRazor/textrazor-python
</code></pre>
<figure class='code'><figcaption><span>Named Entity Recognition -ner.py </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
</pre></td><td class='code'><pre><code class='py'><span class='line'><span class="kn">from</span> <span class="nn">textrazor</span> <span class="kn">import</span> <span class="n">TextRazor</span>
</span><span class='line'><span class="c">#Text Razor API Details</span>
</span><span class='line'>
</span><span class='line'><span class="n">client</span> <span class="o">=</span> <span class="n">TextRazor</span><span class="p">(</span><span class="s">"<Text Razor API KEY>"</span><span class="p">,</span> <span class="n">extractors</span><span class="o">=</span><span class="p">[</span><span class="s">"entities"</span><span class="p">],</span><span class="n">do_encryption</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</span><span class='line'><span class="n">client</span><span class="o">.</span><span class="n">set_do_cleanup_HTML</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="c">#Resolving Entities via two dictionaries</span>
</span><span class='line'>
</span><span class='line'><span class="n">client</span><span class="o">.</span><span class="n">set_entity_dbpedia_type_filters</span><span class="p">([</span><span class="s">'Person'</span><span class="p">,</span><span class="s">'Company'</span><span class="p">,</span><span class="s">'Place'</span><span class="p">,</span><span class="s">'Organisation'</span><span class="p">])</span>
</span><span class='line'><span class="n">client</span><span class="o">.</span><span class="n">set_entity_freebase_type_filters</span><span class="p">([</span><span class="s">'/people/person'</span><span class="p">,</span><span class="s">'/location/location'</span><span class="p">,</span><span class="s">'/government/politician'</span><span class="p">,</span><span class="s">'/book/periodical'</span><span class="p">,</span><span class="s">'/business/job_title'</span><span class="p">])</span>
</span><span class='line'>
</span><span class='line'><span class="c">#Sort Entities</span>
</span><span class='line'><span class="n">response</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">analyze_url</span><span class="p">(</span><span class="o"><</span><span class="n">Type</span><span class="o">-</span><span class="ow">in</span> <span class="n">URL</span> <span class="n">here</span> <span class="n">to</span> <span class="n">be</span> <span class="n">analyzed</span><span class="o">></span><span class="p">)</span>
</span><span class='line'><span class="n">entities</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">entities</span><span class="p">())</span>
</span><span class='line'><span class="n">sorted_entities</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">entities</span><span class="p">(),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">entity</span><span class="p">:</span> <span class="n">entity</span><span class="o">.</span><span class="n">starting_position</span><span class="p">)</span>
</span><span class='line'><span class="n">seen</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span>
</span><span class='line'>
</span><span class='line'><span class="k">for</span> <span class="n">entity</span> <span class="ow">in</span> <span class="n">entities</span><span class="p">:</span>
</span><span class='line'> <span class="k">if</span> <span class="n">entity</span><span class="o">.</span><span class="n">id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">seen</span><span class="p">:</span>
</span><span class='line'> <span class="k">print</span> <span class="n">entity</span><span class="o">.</span><span class="n">id</span><span class="p">,</span><span class="n">entity</span><span class="o">.</span><span class="n">freebase_types</span><span class="p">,</span><span class="n">entity</span><span class="o">.</span><span class="n">dbpedia_types</span><span class="p">,</span><span class="n">entity</span><span class="o">.</span><span class="n">relevance_score</span><span class="p">,</span><span class="n">entity</span><span class="o">.</span><span class="n">confidence_score</span>
</span><span class='line'> <span class="n">seen</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">entity</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>
<p>For any queries Contact – tanu<dot>mittal<at>iic<dot>ac<dot>in</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Form Validation Using Java-Script]]></title>
<link href="http://Tanu91.github.io/blog/2013/07/23/form-validation-using-java-script/"/>
<updated>2013-07-23T00:26:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/07/23/form-validation-using-java-script</id>
<content type="html"><![CDATA[<p>In order to validate a field, you just associate a set of validation descriptors for each input field in the form.
Each field in the form can have zero one or more validations. For example, you can have an input field that should not be empty, should be less than 25 chars and should be alpha-numeric.</p>
<p>Steps to embed the form validation script:–</p>
<p>1.Include gen_validatorv4.js in your html file just before closing the HEAD tag</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'><script src="gen_validatorv4.js" type="text/javascript"></script>
</span><span class='line'> </head></span></code></pre></td></tr></table></div></figure>
<p>2.Just after defining your form, create a Validator() object passing the name of the form</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'><form id='myform' action="">
</span><span class='line'> <!----Your input fields go here -->
</span><span class='line'> </form>
</span><span class='line'> <script type="text/javascript">
</span><span class='line'> var frmvalidator = new Validator("myform"); //where myform is the name/id of your form</span></code></pre></td></tr></table></div></figure>
<p>3.Now, add the validations required. The format of the addValidation() function is:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>frmvalidator.addValidation(Field Name, Validation Descriptor, Error String);</span></code></pre></td></tr></table></div></figure>
<p> For e.g , Adding validation to FirstNanme as a reuired field and limiting maximum length to 40.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>frmvalidator.addValidation("FirstName","req","Please enter your First Name");
</span><span class='line'> frmvalidator.addValidation("FirstName","maxlen=40","Max length for FirstName is 40");</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Pagiantion using PHP]]></title>
<link href="http://Tanu91.github.io/blog/2013/07/16/pagiantion-using-php/"/>
<updated>2013-07-16T20:58:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/07/16/pagiantion-using-php</id>
<content type="html"><![CDATA[<p>Script used for pagianation</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
</pre></td><td class='code'><pre><code class=''><span class='line'><?php
</span><span class='line'>include 'connect.php'; # Include your Database connection script
</span><span class='line'>$per_page = 10; # No. of rows to be displyed per page
</span><span class='line'>$pages_query= mysql_query("SELECT COUNT(*) FROM Table_Name"); # Count the total number of rows In table
</span><span class='line'>$pages=ceil(mysql_result($pages_query,0)/$per_page);
</span><span class='line'>$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1; #to set default page as 1
</span><span class='line'>$start = ($page - 1) * $per_page; # Resolving for next rows to be displayed per page
</span><span class='line'>$query = mysql_query("SELECT Column_Names from Table_name LIMIT $start, $per_page"); # limit the number of rows to be displyed per-page
</span><span class='line'>while ($row = mysql_fetch_assoc($query)) {
</span><span class='line'> echo "$row['column_name']; # echo values
</span><span class='line'> echo "<br>";
</span><span class='line'> }
</span><span class='line'>if($pages>=1 && $page<=$pages){
</span><span class='line'>for($x=1; $x<=$pages ;$x++){
</span><span class='line'>echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a> </strong>' : '<a href="?page='.$x.'">'.$x.'</a> '; # Visualize current link strong
</span><span class='line'> }
</span><span class='line'>}
</span><span class='line'>?></span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Python script to remove Non-alphabetic characters from excel & populate into Database]]></title>
<link href="http://Tanu91.github.io/blog/2013/07/05/python-script-to-remove-non-alphabetic-characters-from-excel-and-populate-into-database/"/>
<updated>2013-07-05T21:12:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/07/05/python-script-to-remove-non-alphabetic-characters-from-excel-and-populate-into-database</id>
<content type="html"><![CDATA[<p>This Python script removes Non-alphabetic characters. For e.g “Lorem ipsum(1224)” is converted to “Lorem ipsum” and populated into DataBase</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>import xlrd
</span><span class='line'>import MySQLdb
</span><span class='line'>import re
</span><span class='line'># Open the workbook and define the worksheet
</span><span class='line'>book= xlrd.open_workbook("Worksheet_name.xls")
</span><span class='line'>sheet = book.sheet_by_name("Sheet_Name")
</span><span class='line'>
</span><span class='line'># Establish a MySQL connection
</span><span class='line'>database = MySQLdb.connect (host="localhost", user = User_name"", passwd = "Password", db = "Database_name")
</span><span class='line'>
</span><span class='line'># Get the cursor, which is used to traverse the database, line by line
</span><span class='line'>cursor = database.cursor()
</span><span class='line'>
</span><span class='line'># Create the INSERT INTO sql query
</span><span class='line'>
</span><span class='line'>
</span><span class='line'>query = """INSERT INTO Table_name VALUES (%s,%s)"""
</span><span class='line'>
</span><span class='line'># Create a For loop to iterate through each row in the XLS file,
</span><span class='line'>for r in range(1, sheet.nrows):
</span><span class='line'>
</span><span class='line'> Column_name1=re.sub("\d+","",sheet.cell(r,0).value).strip(")") #removes numeric charcters and special charcters ; "()" here
</span><span class='line'> Column_name1=Column_name1[:-1]
</span><span class='line'> Column_name2=re.sub("\d+","",sheet.cell(r,1).value).strip(")")
</span><span class='line'> Column_name2=Column_name2[:-1]
</span><span class='line'>
</span><span class='line'> # Assign values from each row
</span><span class='line'> values =(Column_name1,Column_name2)
</span><span class='line'> # Execute sql Query
</span><span class='line'> try:
</span><span class='line'>
</span><span class='line'> cursor.execute(query,values)
</span><span class='line'> except:
</span><span class='line'> pass
</span><span class='line'>
</span><span class='line'>
</span><span class='line'>
</span><span class='line'># Close the cursor
</span><span class='line'>cursor.close()
</span><span class='line'>
</span><span class='line'># Commit the transaction
</span><span class='line'>database.commit()
</span><span class='line'>
</span><span class='line'># Close the database connection
</span><span class='line'>database.close()
</span><span class='line'>
</span><span class='line'># Print results
</span><span class='line'>print ""
</span><span class='line'>print "All Done! Bye, for now."
</span><span class='line'>print ""</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Prezi Documentation-NAVIK]]></title>
<link href="http://Tanu91.github.io/blog/2013/06/21/prezi-documentation-navik/"/>
<updated>2013-06-21T15:25:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/06/21/prezi-documentation-navik</id>
<content type="html"><![CDATA[<p><html>
<body></p>
<iframe src="http://prezi.com/embed/awceusuypdtg/?bgcolor=ffffff&lock_to_path=0&autoplay=0&autohide_ctrls=0&features=undefined&disabled_features=undefined" width="550" height="400" frameBorder="0"></iframe>
<p></html>
</body></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Enabling RSS feeds to Your Blog]]></title>
<link href="http://Tanu91.github.io/blog/2013/06/19/enabling-rss-feeds-to-your-blog/"/>
<updated>2013-06-19T16:38:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/06/19/enabling-rss-feeds-to-your-blog</id>
<content type="html"><![CDATA[<p> Google Chrome users can use “ <a href="https://chrome.google.com/webstore/detail/rss-subscription-extensio/nlbjncdgjeocebhnmkbbbdekmmmcbfjdextension">https://chrome.google.com/webstore/detail/rss-subscription-extensio/nlbjncdgjeocebhnmkbbbdekmmmcbfjdextension</a>” , while those who favor Firefox can use “<a href="https://addons.mozilla.org/en-US/firefox/addon/rss-icon-in-awesombar/?src=search">https://addons.mozilla.org/en-US/firefox/addon/rss-icon-in-awesombar/?src=search</a>” to add one-click subscriptions to websites.</p>
<p>This will Add a RSS icon <img src="http://www.poochplan.com/wp-content/uploads/2011/11/rss-icon_small_53151.jpg" width="50" height="50"></p>
<p>Open Your Blog Hompage i.e. Username.github.io</p>
<p>Click on RSS icon In the Address Bar.</p>
<p>This will Open a New page “ <a href="http://Username.github.io/atom.xml">http://Username.github.io/atom.xml</a> ”</p>
<p>The generated link in Address Bar is Your RSS feed URL.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Amazing Anecdote]]></title>
<link href="http://Tanu91.github.io/blog/2013/06/17/amazing-anecdote/"/>
<updated>2013-06-17T15:54:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/06/17/amazing-anecdote</id>
<content type="html"><![CDATA[<p>Here is an Amazing Anecdote, to understand few Qualities :</p>
<p>During a robbery in Guangzhou, China, the bank robber shouted to everyone in the bank: “Don’t move. The money belongs to the State. Your life belongs to you.”</p>
<p>Everyone in the bank laid down quietly. This is called “Mind Changing Concept” Changing the conventional way of thinking</p>
<p>When a lady lay on the table provocatively, the robber shouted at her: “Please be civilized! This is a robbery and not a rape!”</p>
<p>This is called “Being Professional” Focus only on what you are trained to do!</p>
<p>When the bank robbers returned home, the younger robber (MBA-trained) told the older robber (who has only completed Year 6 in primary school): “Big brother, let’s count how much we got.”</p>
<p>The older robber rebutted and said: “You are very stupid. There is so much money it will take us a long time to count. Tonight, the TV news will tell us how much we robbed from the bank!”</p>
<p>This is called “Experience.” Nowadays, experience is more important than paper qualifications!</p>
<p>After the robbers had left, the bank manager told the bank supervisor to call the police quickly. But the supervisor said to him: “Wait! Let us take out $10 million from the bank for ourselves and add it to the $70 million
that we have previously embezzled from the bank”.</p>
<p>This is called “Swim with the tide.” Converting an unfavorable situation to your advantage!</p>
<p>The supervisor says: “It will be good if there is a robbery every month.”</p>
<p>This is called “Killing Boredom.” Personal Happiness is more important than your job.</p>
<p>The next day, the TV news reported that $100 million was taken from the bank. The robbers counted and counted and counted, but they could only count $20 million. The robbers were very angry and complained: “We risked our lives and only took $20 million. The bank manager took $80 million with a snap of his fingers. It looks like it is better to be educated than to be a thief!”</p>
<p>This is called “Knowledge is worth as much as gold!”
The bank manager was smiling and happy because his losses in the share market are now covered by this robbery.</p>
<p>This is called “Seizing the opportunity.” Daring to take risks!!</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Downloading PDF using python]]></title>
<link href="http://Tanu91.github.io/blog/2013/06/14/downloading-pdf-using-python/"/>
<updated>2013-06-14T19:54:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/06/14/downloading-pdf-using-python</id>
<content type="html"><![CDATA[<p>Python Script to Download PDF files Using gspread library retrieving data from spreadsheet and requests for downloading it as a zip file. First you need to install python packages “gspread” and “requests”.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>import requests
</span><span class='line'>import gspread
</span><span class='line'>gc = gspread.login('Username@gmail.com','Password')
</span><span class='line'>spreadsheet = gc.open_by_url("Url of Spreadsheet")
</span><span class='line'>worksheet = spreadsheet.sheet1
</span><span class='line'>
</span><span class='line'>cell = worksheet.cell(2, 2)
</span><span class='line'>value = cell.value
</span><span class='line'>print(value)
</span><span class='line'>print "downloading with requests"
</span><span class='line'>r = requests.get(value)
</span><span class='line'>with open("code.zip", "wb") as code:
</span><span class='line'> code.write(r.content)</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Downloading PDF Files Using Python]]></title>
<link href="http://Tanu91.github.io/blog/2013/06/14/downloading-pdf-files-using-python/"/>
<updated>2013-06-14T11:35:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/06/14/downloading-pdf-files-using-python</id>
<content type="html"><![CDATA[<p>Python Script to Download PDF files Using gspread library retrieving data from spreadsheet and requests for downloading it as a zip file.
First you need to install python packages “gspread” and “requests”.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>import requests
</span><span class='line'>import gspread
</span><span class='line'>gc = gspread.login('Username@gmail.com','Password')
</span><span class='line'>spreadsheet = gc.open_by_url("URL of Spreadsheet")
</span><span class='line'>worksheet = spreadsheet.sheet1
</span><span class='line'>cell = worksheet.cell(2, 2)
</span><span class='line'>value = cell.values
</span><span class='line'>print(value)
</span><span class='line'>print "downloading with requests"
</span><span class='line'>r = requests.get(value)
</span><span class='line'>with open("code.zip", "wb") as code:
</span><span class='line'> code.write(r.content)</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Setting Up Octopress-BLOGGING FRAMEWORK]]></title>
<link href="http://Tanu91.github.io/blog/2013/05/31/relax-crazy/"/>
<updated>2013-05-31T14:50:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/05/31/relax-crazy</id>
<content type="html"><![CDATA[<p><A HREF="http://www.copyscape.com/plagiarism-tool/"><IMG SRC="http://banners.copyscape.com/images/cs-re-3d-120x60.gif" ALT="Protected by Copyscape Web Plagiarism Tool" TITLE="Protected by Copyscape Plagiarism Checker - Do not copy content from this page." WIDTH="120" HEIGHT="60" BORDER="0"></A>
<img class="left" src="http://cdn.tutsplus.com/webdesign.tutsplus.com/authors/ian-yates/octopress-header.png" width="150" height="250"></p>
<p> You should be comfortable running shell commands and familiar with the basics of GIT.
GIT is a distributed Version Control System(VCS). This allows non-linear development of projects and can handle large amount of data effectively by storing it on Local Server.</p>
<p>Step 1: Install Git</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ sudo apt-get install git</span></code></pre></td></tr></table></div></figure>
<p> sudo –> for administrative previlages.</p>
<p>apt-get-> Package Installer, puts stuff from repositries and install them.</p>
<p>Now it’s time to configure your settings. To do this you need to open an app called Terminal.</p>
<ul>
<li>USERNAME :–
First you need to tell git your name, so that it can properly label the commits you make.</li>
</ul>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ git config --global user.name "Your Name Here"
</span><span class='line'> # Sets the default name for git to use when you commit</span></code></pre></td></tr></table></div></figure>
<ul>
<li>E-Mail :–
Git saves your email address into the commits you make. We use the email address to associate your commits with your GitHub account.</li>
</ul>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ git config --global user.email "your_email@example.com"
</span><span class='line'> # Sets the default email for git to use when you commit</span></code></pre></td></tr></table></div></figure>
<ul>
<li>To see all settings :–</li>
</ul>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ git config --list</span></code></pre></td></tr></table></div></figure>
<p>Step 2: Install RVM</p>
<p>RVM is Ruby Version Manager.It allows us to install and manage different versions and implementations of ruby on one computer including ability to manage different sets of Ruby gems on each.Thus, allowing to test our application with different versions of ruby setups.</p>
<p>Run the following command from your terminal.Be sure to follow any subsequent instructions as guided by the installation process.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ curl -L https://get.rvm.io | bash -s stable --ruby</span></code></pre></td></tr></table></div></figure>
<p>The above command will install both RVM and the latest version of Ruby.
curl is a client to get document/file or send to server using any of supported protocols.</p>
<p>If the above command produces an error, run following command from ypur terminal to achieve the same.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh # You, will be asked to choose option (Enter your choice as 1)</span></code></pre></td></tr></table></div></figure>
<p>Step 3: Install Ruby 1.9.3</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ rvm install 1.9.3
</span><span class='line'> $ rvm use 1.9.3
</span><span class='line'> $ rvm rubygems latest</span></code></pre></td></tr></table></div></figure>
<p>Gems contain package information along with files to install RubyGems.It is a package manager which became part of the standard library in Ruby 1.9. It allows developers to search,install and build gems, among other features. All of this is done by using the gem command-line utility.</p>
<ul>
<li>Run ruby – -version to be sure you’re using Ruby 1.9.3. If you’re having trouble, run the following command on your terminal to set your default version of ruby-1.9.3</li>
</ul>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ rvm --default use ruby-1.9.3-p429</span></code></pre></td></tr></table></div></figure>
<p>If ruby —version doesn’t say you’re using Ruby 1.9.3, revisit your RVM installation.</p>
<p>Step 4: Setup Octopress</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ git clone git://github.com/imathis/octopress.git octopress</span></code></pre></td></tr></table></div></figure>
<p>The above command replaces octopress with username.github.com.</p>
<ul>
<li>Next we need to change current working directory to octopress.</li>
</ul>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ cd octopress # You'll be asked if you trust the .rvmrc file (say yes).
</span><span class='line'> ruby --version # Should report Ruby 1.9.3</span></code></pre></td></tr></table></div></figure>
<ul>
<li>Next, install dependencies.</li>
</ul>
<p>Using Bundler to manage your gem’s dependencies is also pretty easy.Bundler is a program for managing gem dependencies in your Ruby projects. With Bundler you can specify which gems your program needs.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ gem install bundler</span></code></pre></td></tr></table></div></figure>
<p>This should be the only gem you need to install yourself should all your programs’ dependencies be managed by Bundler.</p>
<ul>
<li>Now,Install the dependencies specified in your Gemfile</li>
</ul>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ bundle install</span></code></pre></td></tr></table></div></figure>
<ul>
<li>Install the default Octopress theme.</li>
</ul>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$rake install</span></code></pre></td></tr></table></div></figure>
<p>Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax. A rake file is a collection of tasks, when you call rake with an argument (in this case install) that’s the task that get’s executed.</p>
<p>Step 5: Deploying with Github User/Organization Pages</p>
<ul>
<li><p>Creating Github User/Organization Pages</p>
<ul>
<li><p>Create a new Github repository and name the repository with your username.github.com or organization.github.com.</p></li>
<li><p>Switch over to new repository created in previous step. Click on Settings Tab , scroll down to Github pages and click on “Automatic Page generator” button. <img src="https://github-images.s3.amazonaws.com/help/repo-actions-settings.png" width="150" height="150"><img class="right" src="https://github-images.s3.amazonaws.com/blog/2012/page-generator-picker.png" width="250" height="250"></p></li>
<li><p>Author your content in the Markdown editor.</p></li>
<li><p>Click the Continue To Layouts button.</p></li>
<li><p>Preview your content in our themes.</p></li>
<li><p>When you find a theme that you like, click Publish</p></li>
</ul>
</li>
<li><p>Generating SSH – keys</p></li>
</ul>
<p>We can use SSH keys to establish a secure connection between your computer and GitHub.
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ssh-keygen -t rsa -C "your_email@example.com"
</span><span class='line'> # Creates a new ssh key, using the provided email as a label
</span><span class='line'> # Generating public/private rsa key pair.
</span><span class='line'> # Enter file in which to save the key (/home/you/.ssh/id_rsa):</span></code></pre></td></tr></table></div></figure>
<p>Now you need to enter a passphrase.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>Enter passphrase (empty for no passphrase): [Type a passphrase]
</span><span class='line'> # Enter same passphrase again: [Type passphrase again]</span></code></pre></td></tr></table></div></figure>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>Your identification has been saved in /home/you/.ssh/id_rsa.
</span><span class='line'> # Your public key has been saved in /home/you/.ssh/id_rsa.pub.
</span><span class='line'> # The key fingerprint is:
</span><span class='line'> # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com</span></code></pre></td></tr></table></div></figure>
<ul>
<li><p>Add your SSH -key to GitHub</p>
<ul>
<li><p>Go to your Account Settings. <img src="https://github-images.s3.amazonaws.com/help/userbar-account-settings.png" width="150" height="200"></p></li>
<li><p>Click “SSH Keys” in the left sidebar. <img src="https://github-images.s3.amazonaws.com/help/settings-sidebar-ssh-keys.png" width="150" height="200"></p></li>
<li>Click “Add SSH key”</li>
<li>Paste your key into the “Key” field. <img src="https://github-images.s3.amazonaws.com/help/ssh-key-paste.png" width="200" height="200"></li>
<li>Click “Add key”.</li>
<li>Confirm the action by entering your GitHub password.</li>
</ul>
</li>
</ul>
<p>To make sure everything is working you’ll now SSH to GitHub. When you do this, you will be asked to authenticate this action using your password, which for this purpose is the passphrase you created earlier.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ssh -T git@github.com
</span><span class='line'> # Attempts to ssh to github</span></code></pre></td></tr></table></div></figure>
<p>You may see this warning:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># The authenticity of host 'github.com (207.97.227.239)' can't be established.
</span><span class='line'> # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
</span><span class='line'> # Are you sure you want to continue connecting (yes/no)?</span></code></pre></td></tr></table></div></figure>
<p>Don’t worry, this is supposed to happen. Verify that the fingerprint matches the one here and type “yes”.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># Hi username! You've successfully authenticated, but GitHub does not
</span><span class='line'> # provide shell access.</span></code></pre></td></tr></table></div></figure>
<p>If that username is correct, you’ve successfully set up your SSH key. Don’t worry about the shell access thing, you don’t want that anyway.
If Not correct ,To Add Authenticity and again check Authenticity.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>ssh-add</span></code></pre></td></tr></table></div></figure>
<ul>
<li>Github Pages for users and organizations uses the master branch like the public directory on a web server, serving up the files at your Pages . As a result, you’ll want to work on the source for your blog in the source branch and commit the generated content to the master branch. Octopress has a configuration task that helps you set all this up.</li>
</ul>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$rake setup_github_pages</span></code></pre></td></tr></table></div></figure>
<ul>
<li><p>This will Ask you for your Github Pages repository url.</p></li>
<li><p>Next run:
This will generate your blog, copy the generated files into _deploy/, add them to git, commit and push them up to the master branch. In a few seconds you should get an email from Github telling you that your commit has been received and will be published on your site.</p></li>
</ul>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$git init
</span><span class='line'> $rake generate
</span><span class='line'> $rake deploy
</span><span class='line'> $rake preview
</span><span class='line'> $git add .
</span><span class='line'> $git remote show origin
</span><span class='line'> $git remote show octopress
</span><span class='line'> $git remote rm octopress
</span><span class='line'> $git remote rm origin
</span><span class='line'> $git remote add origin git@github.com:your_user_name/your_user_name.github.io.git
</span><span class='line'> $git remote -v
</span><span class='line'> $git pull origin source
</span><span class='line'> $ git add .
</span><span class='line'> $git commit -m "comment"
</span><span class='line'> $git push origin source
</span><span class='line'> $rake deploy</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Creating a Github Blog Using Octopress]]></title>
<link href="http://Tanu91.github.io/blog/2013/05/30/creating-a-github-blog-using-octopress/"/>
<updated>2013-05-30T12:20:00+05:30</updated>
<id>http://Tanu91.github.io/blog/2013/05/30/creating-a-github-blog-using-octopress</id>
<content type="html"><![CDATA[<p>Does your content connect with people and encourage them to engage???</p>
<p>helloooooo world</p>
]]></content>
</entry>
</feed>