Friday, October 14, 2016

Apache Proxy Rewriting

We should use both mod_rewrite and mod_proxy, they'll be working in concert.

  ProxyPass http://www.example.com:8080/
  ProxyPassReverse http://www.example.com:8080/

Friday, May 22, 2015

Wrapping up list items into multiple columns

I have a scenario like, a list items should be split into multiple columns while dispalying.

HTML:
'

    '    
  • A

  • '    
  • B

  • '    
  • C

  • '    
  • D

  • '    
  • E

  • '    
  • F

  • '    
  • G

  • '    
  • H

  • '    
  • I

  • '    
  • J

  • '    
  • K

  • '    
  • L

  • '    
  • M

  • '    
  • N

  • '    
  • O

  • '    
  • P

  • '    
  • Q

  • '    
  • R


  • '


      CSS:
      body {
          padding: 25px;
          font-family: 'helvetica neue', helvetica, arial, sans-serif;
          color: #3B3B3E;
      }

      li {
          background: #EFEFEF;
          text-align: center;
          width: 60px;
          padding: 10px 0;
          margin: 5px;
      }

      Java Script:
      $(document).ready(function(){
          Array.prototype.chunk = function(chunk_size){
              var array = this,
                  new_array = [],
                  chunk_size = chunk_size,
                  i,
                  length;
              
              for(i = 0, length = array.length; i < length; i += chunk_size){
                  new_array.push(array.slice(i, i + chunk_size));
              }
              return new_array;
          }
          
          function buildColumns(list, row_limit) {
              var list_items = $(list).children('li').map(function(){return this;}).get(),
                  row_limit = row_limit,
                  columnized_list_items = list_items.chunk(row_limit);
              
              $(columnized_list_items).each(function(i){
                  if (i != 0){
                      var item_width = $(this).outerWidth(),
                          item_height = $(this).outerHeight(),
                          top_margin = -((item_height * row_limit) + (parseInt($(this).css('margin-top')) * row_limit)),
                          left_margin = (item_width * i) + (parseInt($(this).css('margin-left')) * (i + 1));
                      
                      $(this[0]).css('margin-top', top_margin);
                      $(this).css('margin-left', left_margin);
                  }
                  $(this).addClass('col-'+(i+1));

              });
          }
          
          buildColumns('ul#grid-test', 5);
      });

      Wednesday, August 6, 2014

      Search through Complex JSON object in JS

      //return an array of objects according to key, value, or key and value matching
      function getObjects(obj, key, val) {
      var objects = [];
      for (var i in obj) {
      if (!obj.hasOwnProperty(i)) continue;
      if (typeof obj[i] == 'object') {
      objects = objects.concat(getObjects(obj[i], key, val));
      } else
      //if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not)
      if (i == key && obj[i] == val || i == key && val == '') { //
      objects.push(obj);
      } else if (obj[i] == val && key == ''){
      //only add if the object is not already in the array
      if (objects.lastIndexOf(obj) == -1){
      objects.push(obj);
      }
      }
      }
      return objects;
      }
       
      //return an array of values that match on a certain key
      function getValues(obj, key) {
      var objects = [];
      for (var i in obj) {
      if (!obj.hasOwnProperty(i)) continue;
      if (typeof obj[i] == 'object') {
      objects = objects.concat(getValues(obj[i], key));
      } else if (i == key) {
      objects.push(obj[i]);
      }
      }
      return objects;
      }
       
      //return an array of keys that match on a certain value
      function getKeys(obj, val) {
      var objects = [];
      for (var i in obj) {
      if (!obj.hasOwnProperty(i)) continue;
      if (typeof obj[i] == 'object') {
      objects = objects.concat(getKeys(obj[i], val));
      } else if (obj[i] == val) {
      objects.push(i);
      }
      }
      return objects;
      }
       
       
      var json = '{"glossary":{"title":"example glossary","GlossDiv":{"title":"S","GlossList":{"GlossEntry":{"ID":"SGML","SortAs":"SGML","GlossTerm":"Standard Generalized Markup Language","Acronym":"SGML","Abbrev":"ISO 8879:1986","GlossDef":{"para":"A meta-markup language, used to create markup languages such as DocBook.","ID":"44","str":"SGML","GlossSeeAlso":["GML","XML"]},"GlossSee":"markup"}}}}}';
       
      var js = JSON.parse(json);
       
      //example of grabbing objects that match some key and value in JSON
      console.log(getObjects(js,'ID','SGML'));
      //returns 1 object where a key names ID has the value SGML
       
      //example of grabbing objects that match some key in JSON
      console.log(getObjects(js,'ID',''));
      //returns 2 objects since keys with name ID are found in 2 objects
       
      //example of grabbing obejcts that match some value in JSON
      console.log(getObjects(js,'','SGML'));
      //returns 2 object since 2 obects have keys with the value SGML
       
      //example of grabbing objects that match some key in JSON
      console.log(getObjects(js,'ID',''));
      //returns 2 objects since keys with name ID are found in 2 objects
       
      //example of grabbing values from any key passed in JSON
      console.log(getValues(js,'ID'));
      //returns array ["SGML", "44"]
       
      //example of grabbing keys by searching via values in JSON
      console.log(getKeys(js,'SGML'));
      //returns array ["ID", "SortAs", "Acronym", "str"]

      Tuesday, April 22, 2014

      Configuring MOD_Proxy in Apache (Linux)

      To solve the cross-origen integration problem in Apache Server, then we need the following configuration settings in httpd.conf file.

      ProxyRequests Off
      ProxyPreserveHost Off

      If any request URL containts "/rest" sub-string then it will be replaced with http://15.0.0.1:8888/ and it will forwards the control to that http://15.0.0.1:8888/

      ProxyPass http://15.0.0.1:8888/
      ProxyPassReverse http://15.0.0.1:8888/

      If any request URL containts "/tokens" sub-string then it will be replaced with http://15.0.0.1:9999/v2.0/tokens and it will forwards the control to that http://15.0.0.1:9999/v2.0/tokens


      ProxyPass http://15.0.0.1:9999/v2.0/tokens
      ProxyPassReverse http://15.0.0.1:9999/v2.0/tokens

      Monday, August 5, 2013

      కౌరవులు, వారి పేర్లు

      కౌరవులు, వారి పేర్లు

      నూరుగు కౌరవులు వారి పేర్లు
      1.ధుర్యోధనుడు
      2. దుశ్శాసనుడు
      3. దుర్దర్షుడు
      4. దుర్ముఖుడు
      5. జలసంధుడు
      6. సహుడు
      7. సముడు
      8. విందుడు
      9. అనువిందుడు
      10. దుర్భహుడు
      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. దుస్సల అను చివరి కూతురు

      Thursday, April 4, 2013

      PhoneGap - Develop Mobile Apps for iPhone, Android, Windows and Java Enabled Mobiles


      • PhoneGap is a mobile development framework produced by Nitobi, purchased by Adobe Systems. 
      • PhoneGap is a free and open source framework that allows you to create mobile apps using standardized web APIs for the platforms you care about. 
      • It enables software programmers to build applications for mobile devices using JavaScript, HTML5 and CSS3, instead of device-specific languages such as Objective-C.
      • The software underlying PhoneGap is Apache Cordova
      • The software was previously called just "PhoneGap", then "Apache Callback".
      PhoneGap currently supports development for the operating systems Apple iOS, Google Android, LG webOS, Microsoft Windows Phone, Nokia Symbian OS,[26] RIM BlackBerry and Tizen. Support for recent versions, such as BlackBerry 5 and 6 and Windows Phone 7, is being implemented now.[27][28] Bada (the operating system used by the Samsung Wave S8500) support is "coming soon".[29] The table below is a list of supported features for each operating system.[30]
      FeatureiPhone /iPhone 3GiPhone 3GS and newerAndroid robot.svg
      Android 1.0 – 4.2
      Windows PhoneBlackberry Logo.svg
      4.6–4.7
      Blackberry Logo.svg
      5.x–6.0+
      Bada operating system.png
      Bada
      SymbianwebOSTizen logo dark.png
      Tizen
      AccelerometerYesYesYesYesN/AYesYesYesYesYes
      CameraYesYesYesYesN/AYesYesYesYesYes
      CompassN/AYesYesYesN/AN/AYesN/AYesYes
      ContactsYesYesYesYesN/AYesYesYesN/AN/A
      FileYesYesYesYesN/AYesN/AN/AN/AN/A
      GeolocationYesYesYesYesYesYesYesYesYesYes
      MediaYesYesYesYesN/AN/AN/AN/AN/AYes
      NetworkYesYesYesYesYesYesYesYesYesYes
      Notification (alert)YesYesYesYesYesYesYesYesYesYes
      Notification (sound)YesYesYesYesYesYesYesYesYesYes
      Notification (vibration)YesYesYesYesYesYesYesYesYesN/A
      StorageYesYesYesYesN/AYesN/AYesYesYes
      Barcode scannerYesYesYesN/AYesYesN/AN/AN/AN/A


      [edit]

      Thursday, January 17, 2013

      Evolution Of Android: From Angel Cake To Ice Cream Sandwich


      The Android OS is currently dominating the smartphone market. Its share in tablet space has also been noteworthy. Have you ever wondered, how it all started? Contrary to assumptions, this OS was the product of a lesser known startup called Android Inc. This small company was then bought by Google for pursuing its smartphone ambitions. The search giant has since added many products and ideas to the platform, and befriended the OHA (Open Handset Alliance) alongside brands such as LG, HTC, T-Mobile, Samsung, Motorola, and Intel. The first consumer friendly iteration of the OS was called Angel Cake. Interestingly, Google has named all the versions in an alphabetic order.


      Android 1.0 (Angel Cake)
      The first version of the open source software was released back in 2008. The OS along with its launch device, HTC Hero (also known as T-Mobile G1) was received very positively by the reviewers. The platform grabbed eye-balls of the developer community in no time. After that, the only way Android could go, was up.
       
      Evolution Of Android: From Angel Cake To Ice Cream Sandwich

      Android 1.1 (Battenberg)
      In Feb 2009, version 1.1 was released. Although it took almost a year to materialise, it wasn't a major update. The Battenberg, only ironed out existing bugs and allowed users to save attached documents. In addition to that, the software was also optimised to run smoother. It was after this update that the development of this open-source software picked up speed.


      Android 1.5 (Cupcake)
      Launched in April 2009, Cupcake offered video recording capabilities, widget support, and animated transition effects. The OS also got the A2DP profile, which enables stereo Bluetooth support. The onscreen keyboard recieved text prediction, and the users could now upload content directly to sites such as YouTube and Picasa.
       
      Evolution Of Android: From Angel Cake To Ice Cream Sandwich

      Android 1.6 (Donut)
      The third and last software update of 2009, Donut, came in out September. It brought many improvements to the Android Market. It also introduced the Mark All option in the gallery. Additionally, screens with 800x480 were also supported by the platform. Apart from that, the OS also made way for voice search functionality.


      Android 2.0 \ 2.1 (Eclair)
      Eclair came with a revamped UI and support for animated wallpapers. Camera features including digital zoom, macro, and white balance were added. The browser got a facelift and HTML5 support. Additionally, Bluetooth support was bumped up to version 2.1.



      Android 2.2 (Froyo)
      Released in the summer of 2010, Froyo (short for FROzen YOghurt) was a huge improvement over its predecessor in terms of performance. The users could now finally install the apps on a memory card. Additionally, support for 720p screens, USB and Wi-Fi tethering made it to Android. With the Adobe Flash 10.1 integration, devices running on this OS could handle web videos through the browser.
       
      Evolution Of Android: From Angel Cake To Ice Cream Sandwich

      Android 2.3 (Gingerbread)
      Gingerbread landed by the end of 2010. This version of the Android offered the support for relatively large screen-sizes, gyroscopes, and even barometers. It also brought native internet telephony and video chat capabilities. Google also introduced the much-hyped NFC (Near Field Communications) feature along with improved power management.
       
      Evolution Of Android: From Angel Cake To Ice Cream Sandwich

      Android 3.0 (Honeycomb)
      For the first time Google released a software that was totally focused on tablets. This version, released in 2011, came up with a fresh UI that depended more on software buttons. It also introduced hardware acceleration to the platform. On the multimedia front, the OS could support FLAC files. Moreover, it supported external input devices such as keyboards and mice.


       
      Evolution Of Android: From Angel Cake To Ice Cream Sandwich

      Android 4.0 (Ice Cream Sandwich 4.0)
      In 2011, Google took a U-turn from its earlier vision of having two different versions of Android, one for tablets and other for the smartphones. The latest Android 4.0 is designed to play nice with both  phones as well as slates. This update is claimed to be the most enhanced version of the platform with full support for multi-core CPUs.
       
      Evolution Of Android: From Angel Cake To Ice Cream Sandwich