-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
1232 lines (757 loc) · 50 KB
/
index.html
File metadata and controls
1232 lines (757 loc) · 50 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
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Relax -Crazy</title>
<meta name="author" content="Tanu">
<meta name="description" content="Hi. I’m Tanu. Here are some thoughts of mine. Sep 28th, 2014 Analyze URL for NER Using Python The amount of natural language text that is …">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://Tanu91.github.io">
<link href="/favicon.png" rel="icon">
<link href='http://fonts.googleapis.com/css?family=Quicksand:300,400' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>
<link href="/stylesheets/bootstrap.css" rel="stylesheet">
<link href="/stylesheets/bootstrap-responsive.css" rel="stylesheet">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/stylesheets/flat-ui.css" rel="stylesheet">
<link href="/stylesheets/font-awesome.css" rel="stylesheet">
<link href="/atom.xml" rel="alternate" title="Relax -Crazy" type="application/atom+xml">
<script src="/js/jquery.js"></script>
<script src="/js/bootstrap-collapse.js"></script>
<script src="/js/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/lib/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/js/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
</head>
<body >
<div class="navbar navbar-inverse navbar-static-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="fui-menu-24"></span>
</a>
<div class="nav-collapse collapse navbar-responsive-collapse" style="height:0;">
<ul class="nav">
<li class="active"><a href="/index.html">Home</a></li>
<li ><a href="/about.html">About</a></li>
</ul>
<ul class="nav pull-right">
</ul>
</div>
</div>
</div>
</div>
<div class="container" id="main">
<div class="span12">
<div class="row-fluid">
<div id="content">
<div class="jumbotron">
<div class="container">
Hi. I’m Tanu.
<h3 class="tagline">Here are some thoughts of mine.</h3>
</div>
</div>
<div class="blog-index">
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2014-09-28T23:41:00+05:30" pubdate data-updated="true">Sep 28<span>th</span>, 2014</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2014/09/28/analyze-url-for-ner-using-python/">Analyze URL for NER Using Python</a></h1>
<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>
</div>
</div>
</article>
<hr>
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2013-07-23T00:26:00+05:30" pubdate data-updated="true">Jul 23<span>rd</span>, 2013</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2013/07/23/form-validation-using-java-script/">Form Validation Using Java-Script</a></h1>
<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>
</div>
</div>
</article>
<hr>
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2013-07-16T20:58:00+05:30" pubdate data-updated="true">Jul 16<span>th</span>, 2013</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2013/07/16/pagiantion-using-php/">Pagiantion using PHP</a></h1>
<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>
</div>
</div>
</article>
<hr>
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2013-07-05T21:12:00+05:30" pubdate data-updated="true">Jul 5<span>th</span>, 2013</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2013/07/05/python-script-to-remove-non-alphabetic-characters-from-excel-and-populate-into-database/">Python script to remove Non-alphabetic characters from excel & populate into Database</a></h1>
<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>
</div>
</div>
</article>
<hr>
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2013-06-21T15:25:00+05:30" pubdate data-updated="true">Jun 21<span>st</span>, 2013</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2013/06/21/prezi-documentation-navik/">Prezi Documentation-NAVIK</a></h1>
<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>
</div>
</div>
</article>
<hr>
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2013-06-19T16:38:00+05:30" pubdate data-updated="true">Jun 19<span>th</span>, 2013</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2013/06/19/enabling-rss-feeds-to-your-blog/">Enabling RSS feeds to Your Blog</a></h1>
<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>
</div>
</div>
</article>
<hr>
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2013-06-17T15:54:00+05:30" pubdate data-updated="true">Jun 17<span>th</span>, 2013</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2013/06/17/amazing-anecdote/">Amazing Anecdote</a></h1>
<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>
</div>
</div>
</article>
<hr>
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2013-06-14T19:54:00+05:30" pubdate data-updated="true">Jun 14<span>th</span>, 2013</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2013/06/14/downloading-pdf-using-python/">Downloading PDF using python</a></h1>
<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>
</div>
</div>
</article>
<hr>
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2013-06-14T11:35:00+05:30" pubdate data-updated="true">Jun 14<span>th</span>, 2013</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2013/06/14/downloading-pdf-files-using-python/">Downloading PDF Files Using Python</a></h1>
<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>
</div>
</div>
</article>
<hr>
<article>
<div class="row-fluid">
<div class="span2">
<h1 class="date-time">
<i class="icon-calendar-empty"></i> <time datetime="2013-05-31T14:50:00+05:30" pubdate data-updated="true">May 31<span>st</span>, 2013</time></h5>
<div class="row-fluid">
</div>
<div class="row-fluid">
</div>
</div>
<div class="span10">
<h1 class="link"><a href="/blog/2013/05/31/relax-crazy/">Setting Up Octopress-BLOGGING FRAMEWORK</a></h1>
<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>