Monthly Archives: August 2015

radgrid

var grid = $find(“<%=RadGrid1.ClientID %>“);
var ctrl_hiddenfield = $telerik.findControl(grid.get_element(),”hiddenfield_name”);

http://docs.telerik.com/devtools/aspnet-ajax/controls/listbox/client-side-programming/overview

libtar and its api

libtar is small but effective library, although it has some bugs when dealing with long path.

The Steps are following:
download libtar-1.2.11 and uncompress it, the main path is /path/libtar-1.2.11

build with command “./configure && make”, if you want to debug, add “-g” for gcc to build.

make “test” folder “/path/libtar-1.2.11/test”. find header file and libtar.a file

put 1.c in “/path/libtar-1.2.11/test”

so finally, the build command will be “g++ 1.c -o 1 ../lib/libtar.a -I ../bin/libtar-1.2.11/include”

some important code, for example, char* subfile1 = “./sub1/1.txt”
this is for file under sub folder.

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
 #include <tar.h>  
 #include <libtar.h>  
 #include <iostream>                                                             
 #include <fcntl.h>    
 
 using namespace std;                               
 
 int main(){                                                        
     // tar                         
     if(1){                                                          
         TAR* tar_handle;
         char* tar_fname = "test.tar";
         tar_open(&amp;tar_handle, tar_fname, NULL,  O_WRONLY | O_CREAT,  0644,  TAR_GNU);
         char* subfile1 = "./sub1/1.txt";
         tar_append_file(tar_handle, subfile1,  subfile1);
         char* subfile2 = "test1.c";
         tar_append_file(tar_handle, subfile2,  subfile2);
         tar_close(tar_handle);
     }
 
     // untar
     if(0){
         TAR* tar_handle;
         char* tar_fname = "test.tar";
         tar_open(&amp;tar_handle, tar_fname, NULL,  O_RDONLY,  0644,  TAR_GNU);
         char* savefold = "temp";
         tar_extract_all(tar_handle, "temp");
         tar_close(tar_handle);
     }
 
     return 0;
 }

example of jquery bxslider

Here is a full example of how to use bxslider to show image slider.

bxslider is also very good at fade in/out transition in div

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
<html>
  <title></title>
  <head>
    <!-- jQuery library (served from Google) -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<!-- bxSlider Javascript file -->
<script src="jquery.bxslider.min.js"></script>
<!-- bxSlider CSS file -->
<link href="jquery.bxslider.css" rel="stylesheet" />
 
<script language="javascript">
$(document).ready(function(){
$('.bxslider').bxSlider({
  mode: 'fade',
  captions: true
});
});
</script>
  </head>
 
  <body>
    <ul class="bxslider">
  <li><img src="pic1.jpg" /></li>
  <li><img src="pic2.jpg" /></li>
  <li><img src="pic3.jpg" /></li>
</ul>
  </body>
</html>