My Sites


Sunday, June 28, 2015

GIT essentials

git remote show origin
git remote set-url origin git://new.url.here

Bower essentials

npm install -g bower
bower install 
bower install jquery 
bower init
 
  

Linux Hard Disk Partitioning


Mobile First With Bootstrap 3

Device compatibility
<meta name="viewport" content="width=device-width, initial-scale=1.0">

Language and character encode
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


<div class="container">
    <div class="row">
        <div class="col-xs-6">col-xs-6</div>
        <div class="col-xs-6">col-xs-6</div>
    </div>

</div>

Fonts
https://www.myfonts.com/topwebfonts/
https://www.google.com/fonts

https://www.youtube.com/watch?v=vUn9sBStMLA

Wednesday, June 17, 2015

Everyday jQuery

http://api.jquery.com/val/
$( document ).ready(function() {

});


$( "#myDiv" ).css( "border", "3px solid red" );

$("#txtEmail").val()

$("#txtEmail").val("something")


$('#some_id').on('change', function() {

  alert( this.value ); // or $(this).val()

});


var thisvalue = $(this).find("option:selected").text();

$("input[type='checkbox']").val();  or $('#check_id').val();


$( "#target" ).click(function() {
      alert( "Handler for .click() called." );
});

https://www.youtube.com/watch?v=G-POtu9J-m4&index=12&list=PLoYCgNOIyGAB_8_iq1cL8MVeun7cB6eNc
http://api.jquery.com/on/

$( "#dataTable tbody tr" ).on( "click", function() {
console.log( $( this ).text() );
});

$( "li" ).each(function( index ) {

  console.log( index + ": " + $( this ).text() );

});

Date object has list of dates
$.each(data.dates, function(index, element) {
    alert(element.timeStamp);
});


var markers = [{ "position": "128.3657142857143", "markerPosition": "7" },

               { "position": "235.1944023323615", "markerPosition": "19" },

               { "position": "42.5978231292517", "markerPosition": "-3" }];


$.ajax({

    type: "POST",

    url: "/webservices/PodcastService.asmx/CreateMarkers",

    // The key needs to match your method's input parameter (case-sensitive).

    data: JSON.stringify({ Markers: markers }),

    contentType: "application/json; charset=utf-8",

    dataType: "json",

    success: function(data){

           alert(data);

           $('#target').html(data.msg);

},

    failure: function(errMsg) {

        alert(errMsg);

    }

});


var  formData = "name=ravi&age=31";  //Name value Pair    or

var formData = {name:"ravi",age:"31"}; //Array



$.ajax({

    url : "AJAX_POST_URL",

    type: "POST",

    data : formData,

    success: function(data, textStatus, jqXHR)

    {  },

    error: function (jqXHR, textStatus, errorThrown)    {}

});


http://hayageek.com/jquery-ajax-post/


<input type="checkbox" name="checkboxname" value="check2"> check2
<input type="radio" name="r" value="radio1"> radio1


$(".tdBody").html(" ");
$( ".tdBody" ).append( "<input type=\"text\"/>" );
$('#editBtn').hide();






Tuesday, June 9, 2015

Android Material Design | User Delight | ViewPage slide

https://github.com/florent37/MaterialViewPager

http://stackoverflow.com/questions/18298590/first-time-user-guide-through-android-library

https://github.com/ongakuer/CircleIndicator

https://github.com/TaurusXi/GuideBackgroundColorAnimation

http://developer.android.com/training/animation/screen-slide.html

http://stackoverflow.com/questions/26954217/how-to-implement-first-launch-tutorial-like-android-lollipop-apps-like-sheets

https://android-arsenal.com/tag/111

Monday, June 8, 2015

Run a Junit Test suite with maven and Jenkins - Notes

maven project hierarchy
----------------------------------------
src/main/java
src/test/java

PortelloTestSuite.java

@RunWith(Suite.class)
@Suite.SuiteClasses({
   AuthenticateControllerTest.class,
   ClientControllerTest.class  })
public class PortelloTestSuite {}

AuthenticateControllerTest.java
    @Test
    public void authenticateTest() {
       assertEquals(200, response);  }

pom.xml
----------- 
<profiles>
        <profile>
            <id>Unit Test</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.18.1</version>
                        <configuration>
                            <includes>
                                <include>**/*PortelloTestSuite.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>


<dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <type>jar</type>
            <scope>test</scope>
            <optional>true</optional>
</dependency>

Maven Run / Build Shell Command on Jenkins
------------------------------------------------------------
mvn test
 



Wednesday, June 3, 2015

Encode Decode fix

    String decodedURL= URLDecoder.decode(uri.toString());

How to extract word from string?

String str = "blabla http://www.mywebsite.com blabla";
String regex = "((https?:\\/\\/)?(www.)?(([a-zA-Z0-9-]){2,}\\.){1,4}([a-zA-Z]){2,6}(\\/([a-zA-Z-_/.0-9#:+?%=&;,]*)?)?)";
Matcher m = Pattern.compile(regex).matcher(str);
if (m.find()) {
    String url = m.group(); //value "http://www.mywebsite.com"
}
 
  try {
 sc2 = new Scanner(new File("src/main/resources/text.txt"));
                   while (sc2.hasNextLine()) {
            String line = sc2.nextLine();
            String clientString = StringUtils.substringBetween(line, "(", ")");
            System.out.println( i+ " "+clientString);
            i++;
      }      
} catch (FileNotFoundException e) {
 } 
 
 <dependency>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-lang3</artifactId>
   <version>3.4</version>
 </dependency>