Searching with words one character long (MySQL)

Question: I have a table Books in my MySQL database which has the columns Title (varchar(255)) and Edition (varchar(20)). Example values for these are "Introduction to Microeconomics" and "4".
I want to let users search for Books based on Title and Edition. So, for example they could enter "Microeconomics 4" and it would get the proper result. My question is how I should set this up on the database side.
I've been told that FULLTEXT search is generally a good way to do things like this. However, because the edition is sometimes just a single character ("4"), full text search would have to be setup to look at individual characters (ft_min_word_len = 1).. This, I've heard, is very inefficient.
So, how should I setup searches of this database?
UPDATE: I'm aware the CONCAT/LIKE could be used here.. My question is whether it would be too slow.  My Books database has hundreds of thousands of books and a lot of users are going to be searching it..
Answer: here are the steps for solution
1) read the search string from user.
2) make the string in to parts according to space(" ") between the words.
3) use following query for getting the result
SELECT * FROM books WHERE Title LIKE '%part[0]%' AND Edition LIKE '%part[1]%';
here part[0] and part[1] are separated words from the given word
the PHP code for the above could be
<?php
     $string_array=explode(" ",$string); //$string is the value we are searching
     $select_query="SELECT * FROM books WHERE Title LIKE '%".$string_array[0]."%' AND Edition LIKE '%".$string_array[1]."%';";
     $result=mysql_fetch_array(mysql_query($select_query));
?>

for $string_array[0] it could be extended to get all the parts except last one which can be applied for the case "Introduction to Microeconomics 4"
Comment: The problem with splitting on words is that titles have spaces, so you can't know if it's an edition or a title.

Of course, the LIKE method could be used by doing a CONCAT() on Title and Edition in the LIKE comparison.

My question is basically-- would this go to slow?  I hear that people use FULLTEXT because LIKE is so slow.  There are hundreds of thousands of books in my db, and a lot of people will be using the database.
Answer: For your application, where you're interested in just title and edition, I suspect that using a FULLTEXT index with MATCH/AGAINST and reducing the ft_min_word_len to 1 would not have that much impact performance-wise (if you were data was more verbose or user written content, then I might hesitate).
The easiest way to check is to change the value, REPAIR the table to account for the new ft_min_word_len and rebuild the index, and do some simple benchmarking.
Having said that, for your application, I might consider looking into Sphinx. It's definitely going to be magnitudes faster, and your content is relatively static, so a delay between re-indexing (Sphinx's main drawback IMO) isn't an issue.  Plus, with careful usage of the wordforms and exceptions, you could map things like 4/four/fourth/IV all to the same token for improved searching.


Converting from HttpURLConnection TO Retrofit2 Issues

Question: I'm upgrading some legacy Android / Java code that pulls in data from a server. The legacy code uses HttpURLConnection and pulls in a inputStream and converts it to a GZipInputStream. The result is then converted to a JSONObject. Then the data is parsed manually. This all works fine, meaning valid json is returned as it starts with '{'
I'm trying to updgrade this code using Retrofit2 and the GsonConverterFactory so I can auto map the json to Classes.
I'm getting an error:  Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
This tells me that the data is coming in as a string and not a JSON object.
NOTE: I'm sending the same headers and query parameters for both my legacy code and new Retrofit implementation --- but different result -- can't figure out why.
Comment: This tells you that it expects a `JSONObject` but instead it finds a String. So use the String.class when you use `Gson.from();`
Comment: I'm not using gson  manually. I'm using the GsonConverterFactory
Answer: The issue was that the server was expecting all of my query parameters to be in one field and the field named "Object" and in a json format i.e: Object={"field1":"fieldOneValue","field2":"fieldTwoValue"} AND had to be Url Uncoded Format:
<code>@FormUrlEncoded
@POST("testing/myapi.api")
Observable<MyClass> getMyApiData(@Url String url,  @Field("Object") String object);
</code>


Can I add child constructor while parent doesn't have one?

Question: The parent doesn't have constructor. In the child, I want to hook up some function with actions outside the class, so I need a constructor. Can I just add one in the child?
Comment: yep.  try it.  it works.
Comment: "with actions outside the class, so I need a constructor" --- uhm, what?
Answer: Yes you can.
If parent has one you may add in child with parent:: __construct();.
If the parent class does not have one, no need to use this code in child. just add __construct() method.


jquery lightbox save image

Question: I am using lightbox from http://lokeshdhakar.com/projects/lightbox2/.
it did works but the images cannot be saved..when right click it only allow to save the html link... how to enable user to save the displayed image?
html
<!DOCTYPE html>

        <meta charset="utf-8">
        <title>Lightbox</title>
        <link rel="stylesheet" href="css/lightbox.css">

js
/**
 * Lightbox v2.7.1
 * by Lokesh Dhakar - http://lokeshdhakar.com/projects/lightbox2/
 *
 * @license http://creativecommons.org/licenses/by/2.5/
 * - Free for use in both personal and commercial projects
 * - Attribution requires leaving author name, author link, and the license info intact
 */

(function() {
  // Use local alias
  var $ = jQuery;

  var LightboxOptions = (function() {
    function LightboxOptions() {
      this.fadeDuration                = 500;
      this.fitImagesInViewport         = true;
      this.resizeDuration              = 700;
      this.positionFromTop             = 50;
      this.showImageNumberLabel        = true;
      this.alwaysShowNavOnTouchDevices = false;
      this.wrapAround                  = false;
    }

    // Change to localize to non-english language
    LightboxOptions.prototype.albumLabel = function(curImageNum, albumSize) {
      return "Image " + curImageNum + " of " + albumSize;
    };

    return LightboxOptions;
  })();

  var Lightbox = (function() {
    function Lightbox(options) {
      this.options           = options;
      this.album             = [];
      this.currentImageIndex = void 0;
      this.init();
    }

    Lightbox.prototype.init = function() {
      this.enable();
      this.build();
    };

    // Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes
    // that contain 'lightbox'. When these are clicked, start lightbox.
    Lightbox.prototype.enable = function() {
      var self = this;
      $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) {
        self.start($(event.currentTarget));
        return false;
      });
    };

    // Build html for the lightbox and the overlay.
    // Attach event handlers to the new DOM elements. click click click
    Lightbox.prototype.build = function() {
      var self = this;
      $("

").appendTo($('body'));

      // Cache jQuery objects
      this.$lightbox       = $('#lightbox');
      this.$overlay        = $('#lightboxOverlay');
      this.$outerContainer = this.$lightbox.find('.lb-outerContainer');
      this.$container      = this.$lightbox.find('.lb-container');

      // Store css values for future lookup
      this.containerTopPadding = parseInt(this.$container.css('padding-top'), 10);
      this.containerRightPadding = parseInt(this.$container.css('padding-right'), 10);
      this.containerBottomPadding = parseInt(this.$container.css('padding-bottom'), 10);
      this.containerLeftPadding = parseInt(this.$container.css('padding-left'), 10);

      // Attach event handlers to the newly minted DOM elements
      this.$overlay.hide().on('click', function() {
        self.end();
        return false;
      });

      this.$lightbox.hide().on('click', function(event) {
        if ($(event.target).attr('id') === 'lightbox') {
          self.end();
        }
        return false;
      });

      this.$outerContainer.on('click', function(event) {
        if ($(event.target).attr('id') === 'lightbox') {
          self.end();
        }
        return false;
      });

      this.$lightbox.find('.lb-prev').on('click', function() {
        if (self.currentImageIndex === 0) {
          self.changeImage(self.album.length - 1);
        } else {
          self.changeImage(self.currentImageIndex - 1);
        }
        return false;
      });

      this.$lightbox.find('.lb-next').on('click', function() {
        if (self.currentImageIndex === self.album.length - 1) {
          self.changeImage(0);
        } else {
          self.changeImage(self.currentImageIndex + 1);
        }
        return false;
      });

      this.$lightbox.find('.lb-loader, .lb-close').on('click', function() {
        self.end();
        return false;
      });
    };

    // Show overlay and lightbox. If the image is part of a set, add siblings to album array.
    Lightbox.prototype.start = function($link) {
      var self    = this;
      var $window = $(window);

      $window.on('resize', $.proxy(this.sizeOverlay, this));

      $('select, object, embed').css({
        visibility: "hidden"
      });

      this.sizeOverlay();

      this.album = [];
      var imageNumber = 0;

      function addToAlbum($link) {
        self.album.push({
          link: $link.attr('href'),
          title: $link.attr('data-title') || $link.attr('title')
        });
      }

      // Support both data-lightbox attribute and rel attribute implementations
      var dataLightboxValue = $link.attr('data-lightbox');
      var $links;

      if (dataLightboxValue) {
        $links = $($link.prop("tagName") + '[data-lightbox="' + dataLightboxValue + '"]');
        for (var i = 0; i < $links.length; i = ++i) {
          addToAlbum($($links[i]));
          if ($links[i] === $link[0]) {
            imageNumber = i;
          }
        }
      } else {
        if ($link.attr('rel') === 'lightbox') {
          // If image is not part of a set
          addToAlbum($link);
        } else {
          // If image is part of a set
          $links = $($link.prop("tagName") + '[rel="' + $link.attr('rel') + '"]');
          for (var j = 0; j < $links.length; j = ++j) {
            addToAlbum($($links[j]));
            if ($links[j] === $link[0]) {
              imageNumber = j;
            }
          }
        }
      }

      // Position Lightbox
      var top  = $window.scrollTop() + this.options.positionFromTop;
      var left = $window.scrollLeft();
      this.$lightbox.css({
        top: top + 'px',
        left: left + 'px'
      }).fadeIn(this.options.fadeDuration);

      this.changeImage(imageNumber);
    };

    // Hide most UI elements in preparation for the animated resizing of the lightbox.
    Lightbox.prototype.changeImage = function(imageNumber) {
      var self = this;

      this.disableKeyboardNav();
      var $image = this.$lightbox.find('.lb-image');

      this.$overlay.fadeIn(this.options.fadeDuration);

      $('.lb-loader').fadeIn('slow');
      this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();

      this.$outerContainer.addClass('animating');

      // When image to show is preloaded, we send the width and height to sizeContainer()
      var preloader = new Image();
      preloader.onload = function() {
        var $preloader, imageHeight, imageWidth, maxImageHeight, maxImageWidth, windowHeight, windowWidth;
        $image.attr('src', self.album[imageNumber].link);

        $preloader = $(preloader);

        $image.width(preloader.width);
        $image.height(preloader.height);

        if (self.options.fitImagesInViewport) {
          // Fit image inside the viewport.
          // Take into account the border around the image and an additional 10px gutter on each side.

          windowWidth    = $(window).width();
          windowHeight   = $(window).height();
          maxImageWidth  = windowWidth - self.containerLeftPadding - self.containerRightPadding - 20;
          maxImageHeight = windowHeight - self.containerTopPadding - self.containerBottomPadding - 120;

          // Is there a fitting issue?
          if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {
            if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {
              imageWidth  = maxImageWidth;
              imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);
              $image.width(imageWidth);
              $image.height(imageHeight);
            } else {
              imageHeight = maxImageHeight;
              imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);
              $image.width(imageWidth);
              $image.height(imageHeight);
            }
          }
        }
        self.sizeContainer($image.width(), $image.height());
      };

      preloader.src          = this.album[imageNumber].link;
      this.currentImageIndex = imageNumber;
    };

    // Stretch overlay to fit the viewport
    Lightbox.prototype.sizeOverlay = function() {
      this.$overlay
        .width($(window).width())
        .height($(document).height());
    };

    // Animate the size of the lightbox to fit the image we are showing
    Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) {
      var self = this;

      var oldWidth  = this.$outerContainer.outerWidth();
      var oldHeight = this.$outerContainer.outerHeight();
      var newWidth  = imageWidth + this.containerLeftPadding + this.containerRightPadding;
      var newHeight = imageHeight + this.containerTopPadding + this.containerBottomPadding;

      function postResize() {
        self.$lightbox.find('.lb-dataContainer').width(newWidth);
        self.$lightbox.find('.lb-prevLink').height(newHeight);
        self.$lightbox.find('.lb-nextLink').height(newHeight);
        self.showImage();
      }

      if (oldWidth !== newWidth || oldHeight !== newHeight) {
        this.$outerContainer.animate({
          width: newWidth,
          height: newHeight
        }, this.options.resizeDuration, 'swing', function() {
          postResize();
        });
      } else {
        postResize();
      }
    };

    // Display the image and it's details and begin preload neighboring images.
    Lightbox.prototype.showImage = function() {
      this.$lightbox.find('.lb-loader').hide();
      this.$lightbox.find('.lb-image').fadeIn('slow');

      this.updateNav();
      this.updateDetails();
      this.preloadNeighboringImages();
      this.enableKeyboardNav();
    };

    // Display previous and next navigation if appropriate.
    Lightbox.prototype.updateNav = function() {
      // Check to see if the browser supports touch events. If so, we take the conservative approach
      // and assume that mouse hover events are not supported and always show prev/next navigation
      // arrows in image sets.
      var alwaysShowNav = false;
      try {
        document.createEvent("TouchEvent");
        alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices)? true: false;
      } catch (e) {}

      this.$lightbox.find('.lb-nav').show();

      if (this.album.length > 1) {
        if (this.options.wrapAround) {
          if (alwaysShowNav) {
            this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1');
          }
          this.$lightbox.find('.lb-prev, .lb-next').show();
        } else {
          if (this.currentImageIndex > 0) {
            this.$lightbox.find('.lb-prev').show();
            if (alwaysShowNav) {
              this.$lightbox.find('.lb-prev').css('opacity', '1');
            }
          }
          if (this.currentImageIndex < this.album.length - 1) {
            this.$lightbox.find('.lb-next').show();
            if (alwaysShowNav) {
              this.$lightbox.find('.lb-next').css('opacity', '1');
            }
          }
        }
      }
    };

    // Display caption, image number, and closing button.
    Lightbox.prototype.updateDetails = function() {
      var self = this;

      // Enable anchor clicks in the injected caption html.
      // Thanks Nate Wright for the fix. @https://github.com/NateWr
      if (typeof this.album[this.currentImageIndex].title !== 'undefined' && this.album[this.currentImageIndex].title !== "") {
        this.$lightbox.find('.lb-caption')
          .html(this.album[this.currentImageIndex].title)
          .fadeIn('fast')
          .find('a').on('click', function(event){
            location.href = $(this).attr('href');
          });
      }

      if (this.album.length > 1 && this.options.showImageNumberLabel) {
        this.$lightbox.find('.lb-number').text(this.options.albumLabel(this.currentImageIndex + 1, this.album.length)).fadeIn('fast');
      } else {
        this.$lightbox.find('.lb-number').hide();
      }

      this.$outerContainer.removeClass('animating');

      this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function() {
        return self.sizeOverlay();
      });
    };

    // Preload previous and next images in set.
    Lightbox.prototype.preloadNeighboringImages = function() {
      if (this.album.length > this.currentImageIndex + 1) {
        var preloadNext = new Image();
        preloadNext.src = this.album[this.currentImageIndex + 1].link;
      }
      if (this.currentImageIndex > 0) {
        var preloadPrev = new Image();
        preloadPrev.src = this.album[this.currentImageIndex - 1].link;
      }
    };

    Lightbox.prototype.enableKeyboardNav = function() {
      $(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));
    };

    Lightbox.prototype.disableKeyboardNav = function() {
      $(document).off('.keyboard');
    };

    Lightbox.prototype.keyboardAction = function(event) {
      var KEYCODE_ESC        = 27;
      var KEYCODE_LEFTARROW  = 37;
      var KEYCODE_RIGHTARROW = 39;

      var keycode = event.keyCode;
      var key     = String.fromCharCode(keycode).toLowerCase();
      if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
        this.end();
      } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
        if (this.currentImageIndex !== 0) {
          this.changeImage(this.currentImageIndex - 1);
        } else if (this.options.wrapAround && this.album.length > 1) {
          this.changeImage(this.album.length - 1);
        }
      } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
        if (this.currentImageIndex !== this.album.length - 1) {
          this.changeImage(this.currentImageIndex + 1);
        } else if (this.options.wrapAround && this.album.length > 1) {
          this.changeImage(0);
        }
      }
    };

    // Closing time. :-(
    Lightbox.prototype.end = function() {
      this.disableKeyboardNav();
      $(window).off("resize", this.sizeOverlay);
      this.$lightbox.fadeOut(this.options.fadeDuration);
      this.$overlay.fadeOut(this.options.fadeDuration);
      $('select, object, embed').css({
        visibility: "visible"
      });
    };

    return Lightbox;

  })();

  $(function() {
    var options  = new LightboxOptions();
    var lightbox = new Lightbox(options);
  });

}).call(this);

Can anyone help ?
Answer: Enable save image from lightbox plugin:
You can set the light box navigator parent div to position relative by overriding that class not going straight to edit the plugin css, not recommend to do that.
.lb-container .lb-nav {
    position: relative;
}

It's sad that the plugin doesn't provide more option than what it provided, user expected more option than that.
Answer: If you want to save image directly using browser then you will lost next/previous image functionality.
For that you need to remove/comment one line from light box style sheet like below:

.lb-nav {
    height: 100%;
    left: 0;
    /*position: absolute;*/
    top: 0;
    width: 100%;
    z-index: 10;
}
Answer: I am using Lightbox v2.8.1 but if you modify the lightbox.css adding the following code to the bottom it will allow you to right click and select "Save picture as ...".
The area that can right clicked is the area not defined by .lb-prev and .lb-next.  the width % parameter may have to be adjusted.  The default width was 34% and 64% leaving a narrow band on the left side that could be right clicked.  A good value I found was 34%.
    .lb-nav {
       pointer-events: none;
    }

    .lb-prev, .lb-next {
       pointer-events: auto;
    }

jquery lightbox save image


Determining properties of a relation on the set of all propositions.

Question: Let $P$ denote the set of all propositions.
Define a relation $R$ on $P$ by $φRψ$ if and only if $φ ⇔ ¬ψ$
Determine the properties of the above relation;
reflexivity, Symmetry, antisymmetry, transivity
Answer: Let $P$ denote the set of all propositions.
Define a relation $R$ on $P$ by $φRψ$ if and only if $φ⇔¬ψ$
Determining properties:
Reflexive:
$φ \not⇔ ¬ψ \Rightarrow φ\not$R$ φ  $
Therefore it is not reflexive.
Symmetric:
$φRψ \rightarrow ψRφ $
Assume that $φRψ$
$φ⇔ ¬ψ$
$\Rightarrow ¬φ⇔ ¬¬ψ$
$\Rightarrow ψ⇔ ¬φ$
$\Rightarrow ψRφ$ it is therefore symmetric.
Antisymmetry:
$φ:(p\land q)$
$(p\land q)⇔¬¬(p\land q) = φRψ$
$ψ:(p\land q)$
$¬(p\land q)⇔¬(p\land q) = ψRφ$
However $(p\land q)\not⇔¬(p\land q)$ So it is not antisymmetric
Transitivity:
$φ:(p\land q)$
$ψ:¬(p\land q)$
$(φRψ)\land(ψRφ) \rightarrow φRφ? $
$φ\not$R$φ$ So it is not transitive.


Disable Null Textboxes inside While Loop

Question: I have a while loop with fetching records from my database... each record will be displayed inside the while loop... some of this texboxes may contain a value of may be null
Code:
    while ($imps_row1 = sqlsrv_fetch_array($stmt_line_util3,SQLSRV_FETCH_ASSOC))
    {
    echo "
";
    echo "<input type='checkbox' name='op[]'>	";
    echo "<input type='text' readonly name='pid[]' class='txtDis3' value='".$imps_row1['pid_code']."'/>	";
    echo "<input type='text' readonly  class='txtDis1' value='".$imps_row1['path']."' name='path[]'>	";
    echo "<input type='text' readonly  class='txtDis1' value='".$imps_row1['id_code']."' name='cmisg[]'>	";
    echo "<input type='text' readonly class='txtDis1' value='".$imps_row1['description']."' >	";
    echo "<input type='text'  class='txtDis' name='txt1[]' value='".$imps_row1['qualified_borrower']."'>	";
    echo "<input type='text'  class='txtDis' name='txt2[]' value='".$imps_row1['allowed_borrower']."'>	";
    echo "
";
    }

How can i disable textboxes containing null values using jQuery/Javascript..
I used this jquery code but nothing happened
$(function(){
$('input[type="text"]').each(function(){
  if ($(this).val() === '') {
  $(this).attr('disabled', 'disabled');
  }
  });
  });

Answer: You don't need a loop, just this (Example)
$(document).ready(function(){
    $('input[type="text"][value=""]').prop('disabled', 1);
});

All textbox that has value='' will be disabled.


Using Entity Framework how can I retrieve a collection from a table?

Question: Here are the tables:

I need to retrieve a collection of Student objects, so I can access their names, last names, etc.
I'm kind of stuck so any help is very welcome, I'm always trying to learn and apply new things to make them stick. :)
So far, I've tried this:
private void cmbGradeParalelo_SelectedIndexChanged(object sender, EventArgs e)
{
    int gradeParaleloId = Convert.ToInt32(cmbGradeParalelo.SelectedValue);

    using (StudentRepository studentRepo = new StudentRepository())
    {
        studentRepo.FindAllStudents().Where(s => s.GradeStudents
    }
}

.GradeStudents is an EntityCollection<GradeStudent> so I think I can query the data using Linq, but I don't know how. I've never done something like this. :)
Thank you for your time!
Answer: Yes, you can query with Linq.  There is one beginner caveat, though, that being the need for Include:
Context.Students
       .Include("GradeStudents")
       .Include("GradeStudents.GradeParalelo")
       .First<Student>(s => s.StudentId == 1)
       .GradeStudents

etc.
If you provide a little more information on what you are trying to do, I might be more help.
Note also that if your join table (GradeStudents) did not have extra columns, it would be an Assocation, and you would have access to GradeParalelo directly from Student.
Answer: You may find one of these tutorials helpful, depending on whether you're using MVC or Web Forms
MVC / Code First
http://www.asp.net/entity-framework/tutorials/reading-related-data-with-the-entity-framework-in-an-asp-net-mvc-application
Web Forms / Database First
http://www.asp.net/entity-framework/tutorials/the-entity-framework-and-aspnet-–-getting-started-part-4
Answer: if your tying to get all Students with at least one GradeParalelo then that would work
studentRepo.FindAllStudents()
    .Where(s => s.GradeStudents.Any(gs => gs.GradeParaleloId == gradeParaleloId));


How to set button always in bottom layout android

Question: I have a register layout, i want to set button always in bottom, but when i click one of textfield, buttons are not under the last element / textfield, but is above textfield. I intend to make it relative, if the keyboard does not appear, it will appear like in the picture, there is a space between the text field and a button, but when the keyboard appears, I intend to eliminate the space.

this is my layout xml :

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/login_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <include layout="@layout/padding" />

        <EditText
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textEmailAddress"
            android:ems="10"
            android:id="@+id/editText"
            android:layout_gravity="center_horizontal"
            android:hint="Email Address"/>

        <EditText
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:ems="10"
            android:id="@+id/editText2"
            android:layout_gravity="center_horizontal"
            android:hint="Password"/>

        <EditText
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="text"
            android:ems="10"
            android:id="@+id/editText3"
            android:layout_gravity="center_horizontal"
            android:hint="First Name"/>

        <EditText
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="text"
            android:ems="10"
            android:id="@+id/editText4"
            android:layout_gravity="center_horizontal"
            android:hint="Last Name"/>

        <EditText
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="phone"
            android:ems="10"
            android:id="@+id/editText5"
            android:layout_gravity="center_horizontal"
            android:hint="Phone"/>

    </LinearLayout>

    <TextView
        android:id="@+id/forgottext"
        android:layout_below="@+id/login_layout"
        android:layout_marginRight="20dp"
        android:layout_marginTop="20dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Forgot?"
        android:autoLink="web"
        android:layout_alignParentRight="true"/>

    <com.gc.materialdesign.views.ButtonRectangle
        android:id="@+id/login_bt"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:text="Sign Up"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:background="@color/material_deep_teal_500"
        android:layout_weight="1"
        android:layout_gravity="bottom"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"/>

</RelativeLayout>

Comment: Use Linear Layout instead RL.      ///......//////  and set  android:windowSoftInputMode="stateHidden|adjustPan" in your manifest
Comment: thank, but i need to scroll, but this is usefull, so i just add adjustResize|stateHidden. thanks :)
Answer: Make a LinearLayout with two Layouts (1. Layout with all your editViews, 2. Button). Give the main LinearLayout
android:layout_weight="1"

and inner Layout
android:layout_weight="1"

Both inners should be match_parent, then your button always will be on the bottom (even if the keyBoard is displayed)


IntelliJ Idea IDE Community Version ideaIC-2020.1.4 as well as ideaIC-2020.2.3 are not opening in Mac OS version Big Sur 11.0.1

Question: IntelliJ Idea IDE Community Version ideaIC-2020.1.4 as well as ideaIC-2020.2.3 are not opening in Mac OS version Big Sur 11.0.1
The exact graphical error looks like this.
[![The application "IntellJ IDEA CE.app" can't be opened. 255][1]][1]
Upon trying to open it using command line utility iTerm, here is how it looks
deepu@deepusmacbookpro ~ $ /Applications/IntelliJ\ IDEA\ CE.app/Contents/MacOS/idea
2020-11-25 19:53:10.193 idea[15880:147234] allVms required 1.8*,1.8+
2020-11-25 19:53:10.196 idea[15880:147241] Current Directory: /Users/deepu
2020-11-25 19:53:10.196 idea[15880:147241] Value of IDEA_VM_OPTIONS is (null)
2020-11-25 19:53:10.196 idea[15880:147241] Processing VMOptions file at /Users/deepu/Library/Application Support/JetBrains/IdeaIC2020.1/idea.vmoptions
2020-11-25 19:53:10.196 idea[15880:147241] Done
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Invalid initial heap size: -Xms128m -Xmx4000m
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Invalid initial heap size: -Xms128m -Xmx4000m
2020-11-25 19:53:10.203 idea[15880:147241] JNI_CreateJavaVM (/Applications/IntelliJ IDEA CE.app/Contents/jbr) failed: 4294967290
deepu@deepusmacbookpro ~ $

What could be the issue here?
why is this heap size: -Xms128m -Xmx4000m invalid ?
Answer: Upon checking the vmoptions file in the path /Users/deepu/Library/Application Support/JetBrains/IdeaIC2020.1/idea.vmoptions, and editing to remove duplicate definition of Xms and Xms parameters in the same line, the issue seems to be resolved.
IntelliJ community version 2020.2.3 is functional again on MacOS BigSur 11.0.1


Network card rtl8723e not accepted anymore in ubuntu

Question: A time ago I bought a new laptop but I had a lot of problems with it.
First there was the problem with ubuntu who hadn't a driver for the network card. After a long search I found the solution here: Wireless card Realtek RTL8723AE-BT is not recognized. The solution with the dropbox link worked, but not for long.
Not long after that I had problems with the card in windows AND ubuntu (and I still have them sometimes). Sometimes the card just does not work. I have looked for a solution and let people from the IT-service in our school look but nobody of us could find a solution.
After that, I upgraded the kernel of ubuntu, which has the next problem because the driver only supported until kernel 3.3. But in the same article that I've mentioned before, someone gave a second link for kernel 3.5. But from that time, everytime I restart my computer the driver isn't working automatically. I had to enable it as an LKM with modprobe.
It worked for a while, but suddenly it stopped working. It doesn't work anymore to use modprobe to enable it and I've tried restarting, reinstalling the drivers, ... I installed almost everythink I could think of and what I could find on the internet.
Do anyone have a solution for this? It's so irritating... Thanks!
EDIT: Now working again (for a time...)
Answer: I#ve had similar problems.
I usually rebuilt the drivers from the Realtek file "rtl_92ce_92se_92de_8723ae_linux_mac80211_0006.0514.2012" when updating to a new kernel manually, using the commands:
<code>sudo su
make clean
make
sudo make install
sudo modprobe rtl8723e
</code>
With Kernel 3.2.0-38 this didn't work anymore. I got error:

Error inserting rtl8723e (/lib/modules/3.2.0-38-generic/kernel/drivers/net/wireless/rtlwifi/rtl8723e/rtl8723e.ko): Invalid argument

In my case, uninstalling the "linux-backports-modules" (linux-backports-modules-cw-3.6-precise-generic) solved the poblem! :-)
Hope 4 you too!?
Greez from Germany,
Helmut
Comment: Thanks for your reply! Suddenly it worked again. I had found a newer version of the driver. The only problem was that it didn't start automatically anymore each time I rebooted. So I have solved it by loading the kernel module with /etc/modules. This helped me! Now it works most of the time!
Comment: Ok! Ir worked! I removed rtl8723 module from modprobe and disabled networking
 by doing sudo modprobe -r rtl8723e
and restarted. It just worked! :X


Gunicorn ImportError: No module name app only when directory name is site

Question: Trying to get gunicorn runing with a hello world app.
This is my project directory structure
Project
  |_ config
  |  |_ ___init__.py
  |  |_ settings.py
  |
  |_ instance
  |  |_settings.py_production
  |
  |_ site
  |  |_ __init__.py
  |  |_ app.py
  |
  |_ .env
  |_ docker-compose.yml
  |_ Dockerfile
  |_ requirements.txt

I am running this in a docker container but when I go into the container in interactive mode the same behaviour occurs.
When the directory is named site and  I run the command gunicorn -b 0.0.0.0:8000 --access-logfile - "site.app:create_app()" I get an error ImportError: No module name app.  However if I name the directory foo, snakeeyes or blah I do not recieve an error and the app runs as expected.  Is there a reason for this?  Can directories not be named site?  Are there any other restreicted direcory names in python?
Comment: You shouldn't call your module the same as any module which is a part of the Python standard library as depending on the ordering of the module import path, you will get the wrong one.
Answer: site is part of the standard library in python. I assume, but am not positive, that you are experiencing a conflict.
site is not a reserved word in python . You can check out this SO post if you're interested in the standard keywords: Is the list of Python reserved words and builtins available in a library?
I think you might be able to test whether this is a conflict by suppressing the automatic import of the library as directed by the documentation:
This module is automatically imported during initialization. The automatic import can be suppressed using the interpreter's -S option.

Comment: running `gunicorn -S -b 0.0.0.0:8000 --access-logfile - "pickle.app:create_app()"` threw an error saying the -S wasn't a valid option.  I did however take a look at the list here https://docs.python.org/3/contents.html under improved modules where site is located.  I renamed everything to another module `pickle` and got the same `ImportError: No module named app` result. I beleve this is the correct answer.
Comment: Gunicorn isn't an interpreter of python. The documentation is referring to the actual call to python. So, something like `python -S`.  If you wanted to try that experiment you would need to figure out how to pass command line arguments to the python interpreter through gunicorn.


Twitter Bootstrap button toggle - How to make on/off state color contrast more obvious

Question: I am using the button toggle feature of Twitter Bootstrap.  Everything works perfectly.  The problem is the color difference between the toggle's on/off state is too similar.  It is hard to see the difference between on and off states.
Ideally I'd like to make the color contrast more pronounced between on/off states, or change the color entirely between states (e.g. blue = off, red = on).
<button type='button' class='btn' data-toggle='button' value='ABC'></button>

Thanks.
Answer: Recently also met this problem.
found a quick solution
bootstrap-3.1.1
in line 209 from bootstrap.js
Change
if (changed) this.$element.toggleClass('active')

to
if (changed) this.$element.toggleClass('btn-success')

Comment: Great workaround buddy, but it is a good practice not to change the native source code of bootstrap. Anyways, if it's a bearable problem it's a great solution.
Thanks!
Answer: I realized I could change the class using JQuery.  Now off-state is white, on-state is green.
 $(document).ready(function() {

 $('.keyContactToggle').click(function (e) {

   var UserID = $(this).attr('value');

 if ( ($(this).is('.btn')) && ($(this).is('.keyContactToggle')) && !($(this).is('.btn-success')) ) {

   $(this).addClass('btn-success');

 } else {

   $(this).removeClass('btn-success');

 }

});

});


Is it possible to turn the noise or music off?

Question: When playing super mario party I went to play "Mario Party" mode and every time it is my turn to use the dice, a noise comes from the joy-con (i think) is there anyway to turn the music/sound that plays when it's your turn?
It may not be a problem to people, but it's kinda annoying to me becouse I prefere to play games without noise, it's not the vibrate I am talking about, I mean the sound/music.
I play it docked/on tv and the tv volume is all the way down.
Comment: What system are you playing on? You say "joy-con (I think)." Could this actually be a Wii remote and nunchuck?
Answer: I don't think it's possible to disable the sounds that come from the joycon without disabling vibration in general. Looking at Nintendo's tech specs for the Joy-Cons, there's no mention of speakers at all. Going online and searching for "joycon speaker", I can see that other games use the "HD Rumble" feature to essentially produce sound via haptic feedback, which is very likely what is happening here.
Probably the closest you could get is disabling vibration in general, and Nintendo does provide instructions for that.


JQuery DatePicker not updating model field in MVC

Question: Following is the code extract:
<code>@Html.TextBoxFor(m => m.CreatedSearchStartDate,

            new { @Value=Model.CreatedSearchStartDate.Value.ToString("dd/MM/yyyy"),

                @selectedDate =Model.CreatedSearchStartDate.Value.ToString("dd/MM/yyyy"),

                @class="dateInput", @id="CreatedSearchStartDate" }

            )
</code>
Following is relevant JQuery code
<code> $("#CreatedSearchStartDate").each(function () {

    var a = $(this).datepicker(

        {

            dateFormat: "dd/mm/yy",

            defaultDate: new Date($(this).val())

        })

});
</code>
The view is showing datepicker control, and it is functioning well. Also, the text box gets updated for underlying value (which I could check using Firebug). The only problem is that the underlying field in the model is not updated. Whereas, there are some other fields also in this model, which gets updated properly.
What could be the possible reason?
Comment: can we see the model definition?  Is the textbox inside the form attribute?  why do you use the .each construct to setup only one date picker.  Setting up many would make more sense on the dateInput class like such:  $(".dateInput").each(function () {
Answer: I have a feeling this is a culture problem.  I haven't experienced this problem myself, but I know others have.  If there is a difference between the "culture settings" for your view compared to your application it can cause validation errors.  Also it sounds like you need to make sure you are using post on your form submit for culture to be applied correctly.  Check out these other posts and see if any of them help:
ASP.Net MVC model binding - how to change date format?
Custom DateTime model binder in Asp.net MVC
Comment: Thanks for all your responses and valuable tips.

I have further identified the problem is with the date format. If the date selected is OK as per US format then it successfully gets reflected in model, otherwise it sets null in model.

For example, if user selects "05/01/2013" it gets bind, and if selects "31/01/2013" it sets null.

Any idea what could be the reason?

The date format in datepicker is already set to "dd/mm/yy"
Comment: Make sure you have the [HttpPost] annotation on the controller method that gets called when your form submits.  If that still doesn't work, please post the code from your controller.
Comment: Yes, its there.. The issue was that I was missing setting up culture in web.config. Once I set up Culture and UICulutre, it started working
Comment: great glad you got it working.  You should post what you did as the answer.


Is there a way to access grouped columns after groupby()?

Question: I'm doing a project and there's something I'm curious about pandas groupby(). After I grouped columns with groupby(). I just want to access alphabet column. Can I do it after grouped two columns?
macsx = new_dataset.groupby(['alphabet', 'subject'], as_index=False)['maccs']
net = macsx.apply(lambda _df : _df.iloc[0:20]).reset_index(drop=True)

net

My dataset looks like this
This is the output of the code
I want the output of my code to look like this:
A
A
A
A
.
.
.
Ş
Ş
Ş

If explained more clearly after applying the function to the grouped data set I just want to separate columns again. Now alphabet column can have 1000 rows like maccs column. I am asking if there is a way to do this?
Thank you for now.
Comment: Could you please post a minimal dataframe with a few rows and relevant columns as text along with the expected output so that it is easier to recreate the problem. It is not very clear what you are trying to do
Comment: There is too much of your code that is outside the scope of what is posted to help. But there are a handful of issues already present, such as the 'dataset' which is being passed to the method.
Comment: `I want to access one of grouped columns.` - Not real clear what you are trying to do. Can you add a *fake* DataFrame to your [mre] maybe trhe second example in [Splitting an object into groups](https://pandas.pydata.org/docs/user_guide/groupby.html#splitting-an-object-into-groups) then group it and explain what you want to do?  [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples)
Comment: Thanks for your suggestions. I edited my question hope it will be understandable now. I shared photos but they are displayed as a link.
Comment: @Boskosnitch Thank you. I edited my question again. I reduced code part to my main question.
Answer: So from what I can gather, you don't need to be using a groupby, but just sort_values.
instead of;
macsx = new_dataset.groupby(['alphabet', 'subject'], as_index=False)['maccs']

try;
macsx = new_dataset.sort_values(by=['alphabet', 'subject'])['maccs']


How can I locate the entrance of a wasp nest, and prevent wasps from entering?

Question: While I was out gardening, I saw a wasp fly through a small hole beside my basement window and into my basement. Then later, I saw five more enter through two other holes (two in part of my AC, three in my fireplace exhaust area.)
The exhaust area looks like this, but with four small holes in the metal plates where it attaches to the wall. That's where the wasps go in.

I taped up the basement hole as a temporary stop-gap. My questions are:

What should I use as a permanent seal?
Should I seal all the wasp entrance holes?

More importantly, what do they want and how do I get rid of them? I assume there's something in the house (food or a nest) that they're after. I can't find it, and don't know how to look for it.
I would like prevention (no more wasps coming) over protection (spraying all the entrance holes with bug killer) if possible.
Comment: @baka - the problem with carpenter bees is they can do a great deal of damage to your home. And the longer you leave them there, they will multiply and spread to other spots.
Comment: is it actually in your basement, or did it just go into the hole?   if it just went into the hole, it's probably a carpenter bee.   they're good pollinators, and you may not want them dead.
Comment: I'm not sure @baka, I'm pretty sure I saw it go into the basement.
Comment: I suspect wasps.
Answer: It MAY have been a carpenter bee. They look like big bumble bees, and are good to pollinate plants. However they will do a great deal of damage with the galleries they build, gradually eating away a lot of wood. Don't let them get a foothold or you will truly see a great deal of damage done.
A carpenter bee will drill a hole that is perfectly circular. They like cedar, and go for places like fascia boards and soffits. Then they turn, and will drill galleries just under the surface of the wood.
A symptom of carpenter bees is that you have woodpeckers hammering on your house. They will find the galleries, and can hear the echo as they tap against a hollow spot.
If it looked like a wasp, then it still has a nest there. A wasp will not just wander into a hole. It has a reason to go in there.
No matter what it is, I would suggest dusting the hole with an insecticide. (Delta Dust seems to work well for me. I use a bulb to inject the dust into a hole. Carpenter bees are not aggressive, but then stand well back, in case these are more aggressive wasps or hornets.)
If you find carpenter bees tumbling from the nest, wait until they are all dead. The last nest I got rid of had 15 (LARGE) bees in it. I had to repeatedly dust it until they all were dead. Then you need to clean out the galleries (I use a Rotozip tool for this) and fill them with caulk or Bondo, as otherwise the bees will just re-inhabit next year. And if you just fill the entrance hole, a hungry woodpecker may still find that nest.
Once you manage to eradicate the nest, yearly spraying will prevent them from building new nests. They will just find other places to live, NOT in your home.
Comment: Now I'm really confused. There is precisely a circular (though not perfectly circular) hole in the wood. I saw another one enter through a different hole in a metal box connecting my AC; it looked like a wasp, not a bee. How can I locate the nest? What do I do about the holes?
Comment: Ok. So if there is a perfectly circular hole, it is carpenter bees in there. But there is also a wasp nest, which you may or may not choose to do something about. Wasps are common. The carpenter bee nest is best dealt with as I describe. We had an pest control person come in once for carpenter bees, and that was a waste of money. Carpenter bees are not aggressive, but they are hungry buggers. As I said, dust the nest to get them out. Once empty, I use a rotozip tool to open up the nest. It is shallow. Then fill with a paintable caulk or bondo.
Comment: Again, how do I find the nests? I've looked inside and out, and I don't see anything. It may be inside my fireplace exhaust, that's where the wasps are going.
Comment: It looks like this image, but with four holes in the corners where it sticks to the wall, where the wasps go: http://www.nachi.org/forum/attachments/f20/40411d1290912115-gas-fireplace-exterior-wall-exhaust-100_1831.jpg
Comment: That will be a wasp nest in there, probably a paper wasp. They will find a dry spot out of the rain. If you can get some wasp spray into it, do that. If not, then just leave it alone. It depends on how much you want them gone. It won't be a large nest.
Answer: Get a product like HotShot for killing wasps.  Foam up the mouth of the nest.  It will likely finish the job.
Comment: @ashes999 - "I don't think there is a nest" - yeah, right. A wasp is not flying directly up to a hole, then going in without a nest being there. Closing your eyes will not make it disappear.
Comment: "I don't think there IS a nest." = then I'd suggest using a shoe.
Comment: I don't think there IS a nest.
Comment: Then get something to patch it closed.  Otherwise it is a temptation for other nasty bugs to take up residence.
Comment: @woodchips it may have been a bee. I did not get a good look at it.
Comment: @woodchips I've never seen any sign of a nest. If there is one, how would I know? No buzzing noises, no occurrances of any bees/wasps whatever they are.
Comment: @ashes999 - if it was a bee, then are you sure it was not a carpenter bee? Is the hole perfectly circular, about 1/2 inch in diameter? They look like a big bumblebee. You will also frequently see one of them hovering around the nest if it is.
Comment: I'm sure it was a wasp. Five of them, in fact. How do I find the nest?
Answer: (I would have made this as a comment but I don't think I CAN comment)
Regarding where the nest might be - how thick is the wall? If there is more than just that brick layer then the nest might be inside the wall. It might not be very big. They can make a nest anywhere they can get to.
I would say that if there are wasps (or bees, or whatever), and multiple of them, going into small holes, then there would be a nest of some description. If they were searching for food they'd be doing it out in the open. The way you describe it, it sounds like they know where they're going, so they're probably going home.
There are many types of wasps, so could you describe it at all? This may help identify it and thus what kind of nest it might be making, if any.
If you seal the holes with some kind of filler (anything really that won't wash away) then the wasps won't be able to get in or out and the ones in the nest (if there is one) will eventually die of hunger. Assuming they are in the wall and there isn't a way out into the basement, in which case that might not be so good.
Comment: If you ever want to make it a comment, before you have access, just keep it short (500 characters or so) and hit the flag link to get the mods attention. They can move it for you.
Answer: This year both yellow jackets, paper wasps and bald faced hornets have been horrible at my farm. We recently found a great way to get rid of them without hurting the good Bee's. It takes 2 paper or plastic cups, bee attracting liquid. And a small amount of hamburger (or other raw ground meat) and last some advantage flee and tic powder. Make a medium meatball and mix the flee and tic killer into the meatball. Poke holes in 1 cup put the meatball in that. Put some attractant in the other cup (I used the cotton ball that came with the attractant it only takes a little bit) put the cup with the holes in the cup with the attractant. Place where animals won't get it. I put a wire mesh around mine so the bees can fly in but the dogs and cats cant get it. After 4 days we had no bees, we have close to a dozen traps around the farm and were emptying them several times a week. The bees take the poisoned meat to there nest and it kills them, we will be doing this later in the fall as they said fall and spring will wipe out nests for good. Hope this helps on getting rid of bad bees it has worked for us.
Answer: seal the holes with the expandable foam. The wasps nest are made of paper and are not a problem to leave them in  your wall.


Determining the Jordan Canonical Form $18\times 18$ matrix

Question:
Let A be an $18\times 18$ matrix over $\mathbb{C}$ with characteristic polynomial equal to
  $$
(x-1)^6(x-2)^6(x-3)^6
$$
  and a minimal polynomial equal to
  $$
(x-1)^4(x-2)^4(x-3)^3.
$$
  Assume $(A-I)$ has nullity $2$, $(A-2I)$ has nullity 3, and $(A-3I)^2$ has nullity 4. Find the Jordan canonical form of A.

For $\lambda=1$, I figure the largest block is a $4\times 4$ (since the multiplicity of the root is $4$ in the minimal polynomial), and since the nullity is $2$, that there are $2$ blocks in total, thus forcing the other block to be $2\times2$.
For $\lambda=2$, I figure the largest block is a $4\times4$, there are 3 blocks, thus making the others $1\times 1$ matrices.
For $\lambda=3$, The largest block is a $3\times 3$ matrix. However, I am not sure how the nullity of $(A-3I)^2$ determines the nullity of $(A-3I)$.
Any insight into this problem would be extremely valuable as I am trying to teach myself this process.
Comment: The restriction of $(A-\lambda I)^k$ to a Jordan block of size $n\times n$ (belonging to $\lambda$) has nullity $\min\{k,n\}$. So for example, if the sizes of the $\lambda=3$ blocks were $3+1+1+1=6$, then the nullity of $(A-3I)^2$ would be
$$\min\{3,2\}+3\min\{3,1\}=2+3\cdot1=5,$$ which is too much. Check out the other cases. I think that only one works.
Comment: Oh, and if you have problems trusting that rule, here's how I would go about proving it: a Jordan block of size $n\times n$ has those $n-1$ ones off the diagonal. Every time you multiply it with itself (with the diagonal entries nulled), those ones move one position NorthEast, so one of the drops out. So after raising to power $k$, you have $\max\{n-k,0\}$ ones remaining. That's then also the rank of this block in $(A-\lambda I)^k$. The nullity is then $n$ minus the rank.
Comment: I would say the question I have from this arrises from the use of the formula. Are you saying the nullity is $\sum min(k,n)$ over all blocks? If so, since the multiplicity of $\lambda=3$ is 3, that guarantees a 3x3 block, correct? Then we can either have 3+3, 3+2+1, or 3+1+1+1. Using your formula, then we have min(2,3)+min(2,3), min(2,3)+min(2,2)+min(2,1), min(2,3)+3min(2,1); none of which sum to 6. Do you mean min(k,n) or do you mean something else?
Comment: Weren't you given that the nullity of $(A-3I)^2$ is four? And $\min(3,2)+\min(3,2)=4$, so...
Comment: @JyrkiLahtonen Please consider converting your comments into an answer, so that this question gets removed from the [unanswered tab](http://meta.math.stackexchange.com/q/3138). If you do so, it is helpful to post it to [this chat room](http://chat.stackexchange.com/rooms/9141) to make people aware of it (and attract some upvotes). For further reading upon the issue of too many unanswered questions, see [here](http://meta.stackexchange.com/q/143113), [here](http://meta.math.stackexchange.com/q/1148) or [here](http://meta.math.stackexchange.com/a/9868).
Comment: Done, @Julian. Lord Farin asked me to do one of oldies, in June actually, as I had commented there also. I dare not show my face in your worthy chat room until I have decided what to do with that one :-). In that case my comment was more like an idea for a sketch/hunch. I never verified that the plan for a proof works. That's why I put it on hold...
Answer: The followig auxiliary result is needed to settle this question. Let us consider an $n\times n$ Jordan block
$$
B=\left(\begin{array}{ccccc}
\lambda&1&0&\cdots&0\\
0&\lambda&1&\cdots&0\\
\vdots&\ddots&\ddots&\ddots&\vdots\\
0&\cdots&0&\lambda&1\\
0&\cdots&\cdots&0&\lambda
\end{array}\right).
$$
If $0\le k\le n$, then we see that $(B-\lambda I)^k$ has a diagonal of length $n-k$
filled with $1$s. Therefore its rank is $n-k$, and thus its nullity is equal to $k$. If $k>n$, then the nullity of this block is, of course $n$. We can summarize this by saying that the nullity of $(B-\lambda I)^k$ is $\min\{n,k\}$.
The OP can use this to handle the case $\lambda=3$. Assume that the Jordan blocks
associated to this eigenvalue have size $n_1\ge n_2\ge\cdots\ge n_m$. The characteristic polynomial tells us that $n_1+n_2+\cdots+n_m=6.$ For its part the minimal polynomial tells us that $n_1=3$. We are left with three possibilities:
A) $m=2,n_1=n_2=3$, B) $m=3, n_1=3,n_2=2,n_3=1$, C) $m=4, n_1=3, n_2=n_3=n_4=1$.
Applying the above observation to all those Jordan blocks we see that the nullity of $(A-3\lambda I)^2$ is
$$
\sum_{j=1}^m\min\{n_j,2\},
$$
which adds up to $2+2=4$ in case A, $2+2+1=5$ in case B, and $2+1+1+1=5$ in case C. Thus we are left with case A as the only possibility, and can conclude that the matrix $A$ has two $3\times3$ Jordan blocks beloging to $\lambda=3$.


Populate HashMap with Predefined Values in Android Application Causing Application to Crash

Question: I am new to the mobile development world and I am currently trying to create an application that allows someone to look up an acronym and see what it means as well as add an acronym to the library if it is nonexistent. To do this, I was trying to use a HashMap. I noticed that my application would create a new instance of the HashMap every time it was opened so some values needed to be predefined. I followed the recommendation given in this answer but now my application crashes every time it is opened.
Also, in the process of trying to troubleshoot, my startActivity has stopped working. It tells me "cannot resolve method 'startActivity(android.content.Intent)'" when I hover over startActivity and "cannot resolve constructor 'Intent(com.private.CSRenA.acronymlookup.Search, java.lang.Class)'" so now all of my java files have stopped working.
Here is my code:
    package com.private.CSRenA.acronymlookup;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.EditText;

import java.util.HashMap;

public class Search extends AppCompatActivity {
    public EditText mEdit;
    public HashMap<String,String> acros = new HashMap<String,String>(){{
        //add all currently known thingies.
        acros.put("ASAP","As Soon As Possible");

    }};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        mEdit = (EditText)findViewById(R.id.acroterm);
        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setImageResource(R.drawable.ic_search);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if(acros.containsKey(mEdit.getText().toString())){
                    startActivity(new Intent(Search.this, ValidAcronym.class));
                }
                else{
                    startActivity(new Intent(Search.this, InvalidAcronym.class));
                }

            }
        });
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    public HashMap<String,String> getMap(){
        return acros;
    }

    public void addAcro(String i, String s) {
        if(!acros.containsKey(i)){
            acros.put(i,s);
        }
        else{
            startActivity(new Intent(Search.this, AlreadyExists.class));
        }

    }

}

Please help if you can! I'm completely lost with what I'm doing wrong.
NOTE: Package name has been changed to protect my identity and profession.
Comment: Note: I have read through all similar questions and none of the answers were able to help.
Answer: I assume your app crashes due to a NullPointerException. Try splitting the creation up as follows:
public HashMap<String,String> acros = new HashMap<>();

And inside onCreate():
acros.put("ASAP","As Soon As Possible");

Regarding startActivity()-problems. If you really have renamed your package to ...private..., you need to remove the private portion because private is a Java keyword and must not be used in package names.
Comment: This fixed my issue! I found out the startActivity issue was due to my syntax. I broke it into two separate statements and the error went away.
Answer: Changing
public HashMap<String,String> acros = new HashMap<String,String>(){{
    //add all currently known thingies.
    acros.put("ASAP","As Soon As Possible");

}};

to
public HashMap<String,String> acros = new HashMap<String,String>(){{
    //add all currently known thingies.
   put("ASAP","As Soon As Possible");

}};

Should fix your crash
Comment: Thank you! I knew I probably made a small error as I'm really good at doing that.


C# Listview LabelEdit

Question: I want to edit a column of a listview in my winform's application and I do it by Setting LabelEdit = true and writing the below code in KeyDown event
if (e.KeyData == Keys.F2 && lvwColumns.SelectedItems.Count > 0)
                lvwColumns.SelectedItems[0].BeginEdit();

After editing the label, how can I validate the entered value?  If the value is null or empty, I'd like to prevent it from saving.
Answer: It sounds like you are looking for the ListView.AfterLabelEdit Event.
private void lvwColumns_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
{
   if (string.IsNullOrWhitespace(e.Label))
   {
         e.CancelEdit = true;
         MessageBox.Show ("Please enter a valid value.");
         return;
   }
}

Answer: Use this AfterLabelEdit MSDN:
Sample on form:
    public Form1()
    {
        InitializeComponent();

        lvwColumns.LabelEdit = true;

        lvwColumns.AfterLabelEdit += lvwColumns_AfterLabelEdit;
    }

    private void lvwColumns_AfterLabelEdit(object sender, LabelEditEventArgs e)
    {
        if (String.IsNullOrWhiteSpace(e.Label))
            e.CancelEdit = true;
    }

C# Listview LabelEdit


Hibernate/Lucene search: Wildcard query

Question: I am trying to implement a wildcard query, but I am stuck...  Can anyone help me?
If the user is search for instance for AB, I want to return all results matching something like the regular expression "A[/.-'+&, ]{0,1}B[/.-'+&, ]{0,1}".  I know regular expressions can't be used, but I just want to indicate the expected result.
So, searching for "AB" should return results like: "ABC x", "abc x", "Abcdefg", "A.b.c.", "A-B-C", "A B C d", "Table".
I created a model using this analyser:
@Indexed
@AnalyzerDef(name = "abAnalyzer", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class), filters =
{
    @TokenFilterDef(factory = StandardFilterFactory.class),
    @TokenFilterDef(factory = LowerCaseFilterFactory.class),
    @TokenFilterDef(factory = StopFilterFactory.class, params =
    {
        @Parameter(name = "ignoreCase", value = "true")
    })
})
public class Foo
{
    ...
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
    @Analyzer(definition = "abAnalyzer")
    private String name;

    ...
}

I implemented a query like you can see below.  I get all expected results, except the the result like "A.b.c".  What am I doing wrong?  Where did I misunderstood things?
public List<Foo> getResults(final String searchName)
{
    Session session = this.sessionFactory.openSession();
    FullTextSession fullTextSession = Search.getFullTextSession(session);
    Transaction tx = fullTextSession.beginTransaction();

    BooleanQuery bQuery = new BooleanQuery();
    Analyzer analyzer = fullTextSession.getSearchFactory().getAnalyzer("abAnalyzer");

    QueryParser qp = new QueryParser(Version.LUCENE_36, "name", analyzer);
    String cleanedText = qp.parse(searchName).toString("name");
    String[] tokenized = cleanedText.split(""); // split on each character

    QueryBuilder qBuilder = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(Foo.class).get();

    org.apache.lucene.search.Query query = qBuilder.keyword().wildcard().onField("name").matching("*" + cleanedText + "*").createQuery();
    bQuery.add(query, BooleanClause.Occur.SHOULD);

    query = qBuilder.keyword().wildcard().onField("name").matching("*" + createSearchString(cleanedText) + "*").createQuery();
    bQuery.add(query, BooleanClause.Occur.SHOULD);

    org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(bQuery, Company.class);
    return hibQuery.list();
}

....

private String createSearchString(final String name)
{
    StringBuilder searchName = new StringBuilder("");
    for (int i = 0; i < name.length(); i++)
    {
        if (searchName.length() > 0)
        {
            searchName.append("?");
        }
        searchName.append(name.charAt(i));
    }

    return searchName.toString();
}

I based my code on these resources:

http://docs.jboss.org/hibernate/search/4.2/reference/en-US/html_single/#search-query-querydsl
http://www.genericarticles.com/mediawiki/index.php?title=Setting_Up_Hibernate_Search_Project#Wildcard_queries
How to search fields with wildcard and spaces in Hibernate Search
Answer: I think I found a solution...  The Lucene index is generated based on lowercase strings and "special" characters are removed in the index.
So, I changed my model to:
@Indexed
@AnalyzerDef(name = "abAnalyzer", charFilters =
{
    @CharFilterDef(factory = PatternReplaceCharFilterFactory.class, params =
    {
        @Parameter(name = "pattern", value = Company.PATTERN),
        @Parameter(name = "replacement", value = Company.REPLACEMENT_PATTERN)
    })
 }, tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class), filters =
{
    @TokenFilterDef(factory = StandardFilterFactory.class), @TokenFilterDef(factory = LowerCaseFilterFactory.class),
})
public class Foo
{
    public static final String PATTERN = "(A-Z)*[\\/\\.\\-'+&, ](A-Z)*";
    public static final String REPLACEMENT_PATTERN = "$1$2";

    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
    @Analyzer(definition = "abAnalyzer")
    private String name;

    ....
}

And for querying I implemented this:
public List<Foo> getResults(final String searchName)
{
    List<Foo> result = new ArrayList<>();

    // remove "special chars from searchName"
    String searchName = name.replaceAll(Company.PATTERN, Company.REPLACEMENT_PATTERN);

    Session session = this.sessionFactory.openSession();
    try
    {
        FullTextSession fullTextSession = Search.getFullTextSession(session);
        Transaction tx = fullTextSession.beginTransaction();
        Analyzer analyzer = fullTextSession.getSearchFactory().getAnalyzer("abAnalyzer");

        QueryParser qp = new QueryParser(Version.LUCENE_36, "name", analyzer);
        String cleanedText = qp.parse(searchName).toString("name");

        BooleanQuery bQuery = new BooleanQuery();
        bQuery.add(new WildcardQuery(new Term("name", "*" + cleanedText + "*")), BooleanClause.Occur.SHOULD);

        org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(bQuery, Company.class);

        result = hibQuery.list();
        tx.commit();
    }
    catch (Exception e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    finally
    {
        session.close();
    }

    return result;
}

Hibernate/Lucene search: Wildcard query


is DoIP mandatory to use UDS over Ethernet?

Question: Is DoIP mandatory to use UDS over Ethernet for ECU Flash Programming for example or it can be done without DoIp
What's the main purpose of DoIp if the UDS can be used without it ? is it used mainly for rooting purpose by Gateway?
Answer: DoIP (ISO 13400-2) is the de-facto standard Transport Layer for UDS on Ethernet (IEEE 802.3). In theory another Transport Layer which supports Ethernet as underlying Physical Layer would be possible to define, but this would be against standardization and won't be compatible anymore to off-the-shelf software.
UDS defines the Application Layer, but you will need also a Transport Layer - this can be:

ISO-TP (ISO 15765-2) in case of CAN (UDS on CAN; ISO 14229-3)
DoIP (ISO 13400-2) in case of Ethernet (UDS on IP; ISO 14229-5)

Using "only UDS" without a Transport Layer is not possible.
The main purpose of DoIP is:

vehicle network integration (IP address assignment)
vehicle announcement and vehicle discovery
vehicle basic status information retrieval (e.g. diagnostic power mode)
connection establishment (e.g. concurrent communication attempts), connection maintenance and vehicle gateway control
data routing to and from the vehicle's sub-components
error handling (e.g. physical network disconnect)

ISO 13400-2:2012 Road vehicles - Diagnostic communication over Internet Protocol (DoIP) -- Part 2: Transport protocol and network layer services
Answer: Not necessary to deploy the DoIP for UDS. DoIP is a transport layer protocol however DoIp provides a structured way to approach the vehicle and announce the vehicle's capabilities by considering different security aspects. But if this is the only protocol that transports the UDS then the answer is no. The same information can be transport over IP with IEEE1722ACF format over UDP or TCP. DoIP has more benefits than tunneling only UDS messages over ethernet.


HTML - embed webpage on local network

Question: I'm trying to embed a webpage that is running on a local host into a webpage that is running on a server in my network. The server runs a Typo3 installation.
I tried embedding the local page using an iFrame, which works great as long as I open the page from the local network. But if I try to load the webpage from the internet, loading the local page fails (obviously), as it tries to load a page under 10.0.0.X.
The local webpage is a webserver on it's own (DVB Recording Service Webserver), so there is no simple html document that I could embed. Is there any way to embed that webpage?
Thanks in advance,
Wolfram
Answer: In my opinion, you have 2 options:

You have to give your local web site a public static IP to make the iframe work in Internet.
In case you do not have a static IP, use a service like DynDNS or No-IP to bind your local web server with a public domain and use this domain in your iframe.
Comment: I'm using No-IP for my Typo3 Webserver. Binding the second webserver to a public domain is unfortunately not possible, and not what I want either.
Comment: Unfortunately, the iframe will be called from the client computer, so if you want your content can be embedded and published, you have to public your second webserver or as least your desired url.

HTML - embed webpage on local network


How to fix a toilet which continuously runs

Question: Yesterday I saw the water of my toilet kept running. The gap at the arrow did not close.
May I know what should I buy to fix it?
Comment: Not related to the toilet flapper problem - it's hard to tell in the picture, but does the white tube pour water into the black tube? If it doesn't, it should. This is what refills the bowl between flushes. If the water level in the bowl is always low then adjusting the white tube will help.
Comment: you need a toilet repair kit, a flapper with some widgets to ensure a fit. should be cheapish.
Answer: Simplest thing to check:  is the chain from the white rod down to the flapper valve tangled and thus too short to let the flapper valve fully down onto its seat?
Answer: First, clean the base of your toilet tank and, with a soft cloth, the underside of the existing flapper.  Don't worry, that's clean water.
Second, if after cleaning you don't get a good seal, then what you want is a "toilet flapper".
Such as this example.
Comment: Take the old one with you to the hardware store. These some in many designs and sizes.


Insert a record in sql database using vb.net datatable and datarow features

Question: I am trying to insert a record in sql database using vb.net dataadapter, datatable, and datarow features. I use the following code but it gives me an error:
Object reference not set to an instance of an object
Imports System.Data.SqlClient
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim cn As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=drpractice;Integrated Security=True")
        Dim da As New SqlDataAdapter
        Dim ds As New DataSet

        Try
            cn.Open()
            da.SelectCommand = New SqlCommand("SELECT * FROM [emp_tbl]", cn)
            da.Fill(ds)
            Dim dt As New DataTable
            dt = ds.Tables("emp_tbl")

            'Error in this line(Object reference not set to an  instance of an object)'
            Dim dr As DataRow = dt.NewRow()

            dr.Item("emp_id") = TextBox1.Text.Trim
            dr.Item("emp_name") = TextBox2.Text.Trim
            dr.Item("salary") = TextBox3.Text.Trim
            dr.Item("age") = TextBox4.Text.Trim
            dr.Item("emp_group") = TextBox5.Text.Trim
            dt.Rows.Add(dr)
            da.Update(ds)
            MsgBox("Record Successfully Inserted")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class

Comment: I recommend looking into LINQ to SQL or Entity Framework
Comment: check "dt" ................ Whether 'ds.Tables("emp_tbl")' this has contains a rows ?
Comment: If table is empty how do I insert a record using datatable an datarow?
Comment: If table is empty its possible to add new rows......... Check whether columns are displaying for that table or not , if no then there is a problem in your query(or database).
Comment: can you plz expalin the code for doing that
Comment: Is there data in the table?  You can try `dt = ds.Tables(0)` to see if that works as well.
Comment: Hey @andy can you plz tell me how to check whether columns are displaying for that table or not?
Comment: Focus the "ds.Tables("emp_tbl")" you will get all the columns............ or in watch window you can check "ds.Tables("emp_tbl").Columns"
Comment: You don't need to pull all the data first, and you don't need to 'New' dt.
Answer: check this out : Dim dr As DataRow = new dt.NewRow()
Comment: I checked it out.  It doesn't compile.
Answer: You have done everything good but change the following line:
da.Update(ds)

As following:
Dim ESCBuilder As SqlCommandBuilder = New SqlCommandBuilder(da)
    da.UpdateCommand = ESCBuilder.GetUpdateCommand()
    da.Update(ds)

Comment: This is and official update command but remember it work only when you have the primary key on the target table. If you don't have PK, the update commanndbuilders update command will not work
Comment: How do you propose reliably updating a table without a primaty key?
Comment: @Nick.McDermaid maybe a Guid but not primary key. In that case you're sure you can update with a plain sql statement. Anyways a table without a PK is not a good idea :)
Answer: Based on the feedback here and elsewhere, the following code worked for me:
    TestDataSet.GetChanges()
    testTableAdapter.Fill(TestDataSet.log_test)
    log_testDataGridView.Refresh()

What I needed to do was, create a new row, and go get the next value for the Primary Key(VARCHAR, NOT INT, because revisions got an "R" appended to the PK...not my rule...the rule of the company).
I wanted to put the refresh as close to the getting of the PK, which I had last after assigning values to the new datarow so it would get the latest Max +1.
So, I put the above code just before looking up the PK, and after assigning values to the datarow, other than PK. The code above caused the datarow to blank out. So, I put the above code just prior to the creation of the new DataRow.
For my code, this caused the code to get the latest data from the SQL table, then add the new datarow, and finally determine the last PK. Because the data used to populate the datarow is off my form, and there is no caclulations, the code runs fast enough for my needs. I suspect, if the connection to my database was slow, and/or, the number of people running the same process were substantial, I would have errors, such as duplicate PKs.
My answer to that would be to assign the datarow field values to variables, run the refresh, then assign the variables to the fields and save immediately.
Perhaps another way would be to get the new PK, then save an empty record, and then fill the record, except that enough of the fields in my table are REQUIRED so I might as well not try creating a blank record first.
Answer: Imports System.Data.SqlClient
Public Class Form4
    Dim con As New SqlConnection
    Dim cmd As New SqlCommand
    Dim str As String
    Dim count As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        con = New SqlConnection("server=SHREE-PC;database=Hospital;INTEGRATED SECURITY=SSPI;")
        con.Open()
      '  cmd = New SqlCommand("select * from Doctor", con)
        str = "insert into Doctor values('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "' )"
        cmd = New SqlCommand(str, con)
        count = cmd.ExecuteNonQuery()
        MessageBox.Show(count & " Record inserted")

       con.close()
    End Sub

Imports System.Data.SqlClient
Public Class Form4
    Dim con As New SqlConnection
    Dim cmd As New SqlCommand
    Dim str As String
    Dim count As Integer
   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
     con = New SqlConnection("server=SHREE-PC;database=Hospital;INTEGRATED SECURITY=SSPI;")
        con.Open()
        cmd = New SqlCommand("select * from Patient", con)
        cmd = New SqlCommand("Delete from Patient where Name ='" & TextBox1.Text & "'", con)
        cmd = New SqlCommand("Delete from Patient where Address='" & TextBox2.Text & "'", con)
        cmd = New SqlCommand("Delete from Patient where Dieses='" & TextBox3.Text & "'", con)
        cmd = New SqlCommand("Delete from Patient where Patient_no=" & TextBox4.Text & "", con)
'you can take any row in your program
        count = cmd.ExecuteNonQuery()
        MessageBox.Show("Record Deleted")
    End Sub


How do I use a "Mustek BearPaw" scanner?

Question: I own a Mustek BearPaw 2448CU Pro II scanner. How do I use it with Ubuntu?
Answer: Open Simple Scan software and connect your scanner, it will detect the scanner and you will able to scan the documents. If the software not detecting the scanner you need to install the driver for it.
Here is the link for downloading driver for "SANE Mustek USB2 backend (driver) for Mustek BearPaw 2448 TA Pro USB scanner"
http://www.meier-geinitz.de/sane/mustek_usb2-backend/
Comment: Thanks, but `simple scan` dont find the scanner and drivers I cant find nowhere.. Maybe you know where is the drivers?
Comment: Try the above mentioned drivers.
Comment: I've tried to install it.. It was not success.. :(


How can I get the height of a ListView item?

Question: I have ListView and I need to determine item height.
Answer: You can use the GetItemRect() method:
int itemHeight = yourListView.GetItemRect(itemIndex).Height;

Answer: I am not 100% sure but this might help:
int itemHeight = listView.Items[itemIndex].GetBounds(ItemBoundsPortion.Entire).Height;

Answer: I had the same question however there is one issue - until the listview is drawn the values aren't set. And you may want to be able to set the sizes before you add any items (if for example I want to dry a listview that can display 5 entries but will start off empty).
Therefore my workaround was to run the following code, which forces the control to be rendered but without displaying it, in the application's initialisation section and save the values as global variables for later use. And, to get around listviews with different font sizes, to only store the difference between the height and the font height:
Dim lvwTemp As New ListView
lvwTemp.View = View.Details
lvwTemp.Columns.Add("test")
lvwTemp.Items.Add("test")
Dim zTempBitmap As New Bitmap(100, 100)
lvwTemp.DrawToBitmap(zTempBitmap, New Rectangle(0, 0, 100, 100))
zTempBitmap.Dispose()
gintListviewHeaderHeightMinusFontSize = lvwTemp.Items(0).GetBounds(ItemBoundsPortion.Entire).Top - lvwTemp.Font.Height
gintListviewItemHeightMinusFontSize = lvwTemp.Items(0).GetBounds(ItemBoundsPortion.Entire).Height - lvwTemp.Font.Height

Comment: This allows you to get column header height and item height very easily - nice!


how to cut concrete beams/sleepers

Question: I have long (60cm/23") concrete beams that I want to cut to size to build a small garden wall.
They are 15cm/6" high. I know there exist heavy cutter tooling to cut through (concrete) tiles, but it seems to me that won't do for these large stones.
So, what do you recommend for cutting these into rather accurate sizes?
thanks for any suggestions offered.
Comment: Beam = usually something that is structural/supporting something = DO NOT CUT IT without talking to an engineer. Structural concrete beams can have high-tensioned cables internally.
Comment: Do you know whether the beams have reinforcing rods in them or not?
Comment: are you looking to cross cut them? You described them as 23"long X 6" high, but how thick are they?  What axis do you want to cut?
Comment: they are 6" high and same size thick. they are not supporting anything (yet), I am going to use them to create a (low) wall in my garden.
Comment: ok  a 6x6 is way too big to try to cut with a angle grinder.  You will need a big powerful worm saw and a few diamond blades.
Comment: Also, you can rent gas powered saws for that purpose. they are extremely powerful, use all safety practices, be careful.
Answer: There is no easy way to cur concrete I am afraid. I always dreaded and tried avoiding at all costs cutting concrete in any form.. but when you have to then I always used a large grinder..

The problem is (and why i dread cutting concrete) is the discs take a massive hammering and they dissipate while cutting the concrete. I found using disc for cutting masonry very good because they are not too thick (2mm to 3mm are good but need to be reinforced! unlike like stone cutting discs which are 5mm to 7mm) which help cut through faster.
You need to prepare yourself for this.

Large amounts of dust! it will get in your hair, in your nose blow all over the place.

So I advise wearing a dust mask and wide glasses that cover the entire area of your eyes! Make sure you are far away from valuable objects like cars(some stones might fly out the grinder damages nearby objects) far away from your washing . Keep other people and pets  far away.
These are fine..

but these are very good

Strain and friction on the disc could cause the disc to rupture

That is why buying reinforced discs is very important! Many times during cutting discs have failed sometimes right at the start sometimes midway. Make sure the grinder guard is protecting you and the exit path is between your legs. stand quite wide apart but also sturdy. This is also why its dangerous to stand anywhere near it as when a disc ruptures it can fly sideways.
This type of rupture is very rare and years of building I only saw this once.

Usually you might experience the disc splitting layers and small parts will break off.

Noise

These grinders on their own are loud and cutting into concrete is just unbearable. You might want ear plugs and also warn any neighbours or something. Also because you cannot hear any thing I would suggest having somebody in a safe area that can turn the main power off in case he needs to tell you something or warn you. Do not do this on your own.

Doing 1 or 2 poles is ok but if you have many..

Make sure to rest inbetween several as vibrations and feedback take a massive toll on your arm muscles. You always need to hold the grinder sturdy in case it mis behaves and jumps upwards or something else.

Secure your items

Make sure the item you are cutting are secured properly. They should not move at all. If friction changes like you hit a rebar within the the concrete (grinding some metal with a masonry disc is fine! it only eats the disc slightly faster and makes loads of sparks) then its better the grinder vibrates rathen then the item flying and hitting you in the legs.
You can rent grinders for pretty cheap.
Good luck.
And remember to keep safe.
Comment: wow thanks for the elaborate reply. Using a grinder might be a good idea. I intend to cut as few as possible.
Answer: If you are planning on making cuts deeper than 1 to 2 inches, I would recommend using a worm gear driven circular saw with a 7 1/4" or 8 1/2" diamond plated blade. Some models actually use larger blades. This type of saw is similar to a regular circular saw, but operates at a lower RPM and has far more power. The other advantage of this type of saw is that it lies flat on the concrete as you cut, gives nice straight cuts, and is much easier and safer to use than a grinder. Cutting thick concrete may require taking several passes, cutting an inch of depth at a time. Also water can be flowed on the cut to keep down dust and cool the blade. Hand held grinders are not designed for wet cutting, but heavy duty worm saws are. The most common brand is Milwaukee and can be rented at most tool rental stores. http://www.milwaukeetool.com/tools/saws-corded/corded-circular-saws
Comment: cool thanks. I'll check my local DIY shop if they have one of those.
Comment: Never knew you could use those type of saws for cutting into concrete..
Comment: There are versions of these type saws specifically designed for cutting even deeper concrete and stone. Some with up to 12 inch wheels. Check out Rigid Industrial tools. Definitely a big boy toy. lol.

how to cut concrete beams/sleepers


Would adding fiber glass insulation between a window and a standart plastic insulation cover help insulate the windows further

Question: I have a corner room in our house, in the summer it traps heat and in the Winter (like right now) it lets it all out. In the summer my room is regularly between 3 to 10 Celsius hotter than the rest of the house, and in the Winter it is usually the reverse, hovering around a 5 degree difference. I have three windows, one single one and two that serve to make a large double window. They are those idiotic non sensicle windows that open outwards and have to be hand cranked. All of them are broken, they cannot open, unless forced open (and I mean forced) and I hate having to get a ladder and climbing up two stories to forcefully close them, so they never open, and I have given up on any airflow and just use an air-purifier year round with just makes the room feel colder in the winter. I have currently put up plastic sheets around my Windows, and since the large window is facing the street and everyone can see into my room very well, especially at night, I just covered it with a large sheet (I tore down the stupid blinds that came with the house in a fit of rage over how idiotic and stupid and half broken they were). I can't fix the rest of this house (most studs range from 14" to 17" apart because the guy who built this place was an absolute fool) so I was wondering, since I have a bunch of this left over fiber glass insulation form when I worked on our basement, and I block my windows anyways, would putting it between the plastic which if it comes off, would only be to refresh the tape, and the Window itself, somehow help insulate it further? And even if it does help, is it safe to do in the place I spend probably around 90% of my time in, even with an air filter.
Edit: I live about 30 minutes south of Boston, MA. In the summer it gets fairly hot, average of about 26c (up to 35c, that is around the highest I've personally experienced during a heat wave) and is very humid (upwards of 90%) and in the Winter it gets very cold, below freezing usually and extremely dry.
Answer: Insulating the inside of your windows will have at least one direct consequence: the effective R-value of the overall window will be increased.  That is, less heat will radiate through the window.  This will have a warming effect during the heating season (ie, when it's cold outside) and a cooling effect during the cooling season (ie, when it's warm outside).  The magnitude of this effect can only be roughly estimated so you probably won't really know how much of an improvement this is without trying it.
This will result in a secondary consequence.  The window itself (mainly the glass) will be closer to the outside temperature than the inside temperature.
During the heating season, this means it will be cold (how cold depends on your climate, of course; it shouldn't get colder than it is outside).  If you live anywhere but a dry climate, this probably means it will be below the condensation point and water from the house will condense on the glass (then run down to the sill).  Chances are, over a long enough period of time, this will result in water damage to the window and nearby wall.  If it is cold enough where you live, some of this water may freeze which could result in more immediate damage from the expansion-contraction cycle.
Conversely, you will also be constructing a miniature greenhouse.  When the sun shines on the window from the outside, it will heat up the air  space between the inside glass and the insulation.  There's no extra energy coming from the sun in this case but you're concentrating it into a smaller mass (the air in the gap).  If ambient temperatures in your climate are high enough or the window is situated to get a lot of full sun, and depending on the construction materials of the window, temperature in this air space could get high enough to damage the window.  This doesn't seem extremely likely but it might be possible given just the right circumstances.
Now, set thoughts of R-value aside.  A common problem around windows is air sealing.  That is, they make a room cold when it's cold outside not because of heat radiating through them but because of cold air blowing in through holes (or warm air blowing out).  These effects can be just as important as those due to low R-value windows.  Fiberglass insulation will do essentially nothing to improve this situation.  Air blows right through fiberglass.  The plastic sheets you put up over the window may already have dealt with this part of the problem, depending on how well you've managed to seal around the window with those.
If you really don't plan to use the window as a window, your best bet is probably to rip it out and replace it with an insulated wall.  Or perhaps with some higher-quality windows and some drapes that you can be happy with.
Comment: +1 to Jean-Paul for recognizing heat loss in walls is primarily due to infiltration (air blowing in around windows and doors) rather than heat radiating out through the glass in windows. Also, heat rises, So insulating the ceiling (attic) is more effective than insulating the walls. Stopping air infiltration by caulking around windows and doors is THE most cost effective thing you can do. If you don't think you have infiltration, put a smoky match
Comment: I added this as an edit to my question but here is the climate info, since it seems to be very relevant to my question: I live about 30 minutes south of Boston, MA. In the summer it gets fairly hot, average of about 26c (up to 35c, that is around the highest I've personally experienced during a heat wave) and is very humid (upwards of 90%) and in the Winter it gets very cold, below freezing usually and extremely dry. Thank you very much for your answer.
Comment: Move a smoky match around the perimeter of your windows and doors when the wind is blowing. You'll see that smoke dance in the air. All that "outside air" that blows in needs to be heated (or cooled depending on the season.)
Comment: Sorry for the double post, but I was running out of character. As for your suggestion of ripping them out/replacing them: Ideally I would like to replace them with working windows, but our financial situation simply does not allow for that, there for I must manage the best I can with what I have. Though it seems like there may not be much of a reason to add fiber glass, since it's probably the air leakage. I used to have water dripping inside the room from above the Window when the roof froze. We redid the roof and the gutters and it fixed that problem, but it didn't seal the window any better


How to make a dynamic breadcrumb CakePHP?

Question: How to make a dynamic breadtsrumb CakePHP ?
For example, I have a url
http://site.com/post/first/add
To breadcrumb automatically generated in such Layouts
Home > post > first > add
Answer: Using the HTML Helper:
<code>echo $this->Html->getCrumbs(' > ','Home');
</code>
Other examples:
<code>$this->Html->addCrumb('Users', '/users');
$this->Html->addCrumb('Add User', '/users/add');
</code>
More info: http://book.cakephp.org/1.3/view/1653/Creating-breadcrumb-trails-with-HtmlHelper
Regards!
Answer: try this link.it will solve you issue
http://www.codetweet.com/php-2/breadcrumb-helper-class-in-cakephp/


Actions position on cards

Question: Is there a best practice or a guideline saying that actions on cards should be located on the bottom of the card for touchable screens ?
Are there actions types that should be located on the top of the card ?
Thank you for your replies !
Nicolas
Answer: Yes. Material Design suggests that "supplemental actions within the card are... typically placed at the bottom of the card [on mobile]".
The reason for having actions at the bottom is that you scan from the top to the bottom, gathering information about the content. When you get to the bottom you have all the information you need to decide which action to take. If it was at the top you would see the actions first, and would therefore need to reposition your gaze back to the top.
Actions are ideally placed to the right of the card because this is area falls within the majority of right-handed users - i.e. the majority of users' - most easy-to-reach-with-thumb area.
Given this reasoning it feels like it might make sense to place actions at the top of the card if it is preceded by enough information to make a decision. For example, if the card has a title in the top left and it is a section name used elsewhere in the system it might make sense to have a link to "See more", or to drill down in the top right.

Actions position on cards


Re-raise and re-catch error immediately in python

Question: I have some exception handling code in python where two exceptions can be raised, the first one being a "superset" of the second one.
I.e. the following code summarizes what I need to do (and works fine)
try:
    normal_execution_path()
except FirstError:
    handle_first_error()
    handle_second_error()
except SecondError:
    handle_second_error()

But it requires me to abstract everything into independent functions for the code to remain clean and readable. I was hopping for some simpler syntax like:
try:
    normal_execution_path()
except FirstError:
    handle_first_error()
    raise SecondError
except SecondError:
    handle_second_error()

But this does not seem to work (SecondError does not get re-catched if it is raised inside this block). Is there anything doable in that direction though ?
Comment: You can't unless you specify an additional handler. Branching on if the error is an instance of `FirstError` or `SecondError` seems better here.
Answer: If you wish to manually throw the second error to be handled, you can use nested try-catch blocks like these:
try:
    normal_execution_path()
except FirstError:
    try:
        handle_first_error()
        raise SecondError
    except SecondError:
        handle_second_error()
except SecondError:
        handle_second_error()

Answer: Perhaps it is worth reviewing the code architecture. But for your particular case:
Create a generic class that handles this type of error. To inherit from it for the first and second error cases. Create a handler for this type of error. In the handler, check the first or second special case and process it with a waterfall.
class SupersetException(Exception):
    pass

class FirstError(SupersetException):
    pass

class SecondError(SupersetException):
    pass

def normal_execution_path():
    raise SecondError

def handle_superset_ex(state):
    # Our waterfall
    # We determine from whom the moment to start processing the exception.
    if type(state) is FirstError:
        handle_first_error()
    # If not the first, the handler above will be skipped
    handle_second_error()

try:
    normal_execution_path()
except SupersetException as state:
    handle_superset_ex(state)

Then just develop the idea.


Inbuild Pipeline arguments

Question: I wanted to know how to get list of in-built pipeline arguments in Data Fusion Pipeline ?
I am not able to find them anywhere on the documentation as well as on the internet.
Comment: What do you mean with in-built arguments? Can you provide an example?
Comment: Built-in arguments which are already there with the pipeline by default like one in know 'logicalStartTime'.
Comment: logicalStartTime is the only argument added by the system. Even for that, I would recommend using the macro (https://docs.cdap.io/cdap/6.2.1/en/developer-manual/pipelines/creating-pipelines.html#H4916) instead of accessing it directly, as it has additional features for formatting the time or doing simple math on it.
Comment: @SUDHIRGARG does Albert comment answers your question?
Comment: Thanks for the answer Albert, That answers my question
Answer: As discussed, logicalStartTime is the only argument added by the system.
To get some parameter even those added by the system its recommended using macros that allow placeholders for properties that are unknown at configure time but are known and provided at runtime. For logicalStartTime we have the pre-defined macro named Logical Start Time Function that can be used like below:
${logicalStartTime([timeFormat[,offset [,timezone])}

Where:

timeFormat: Time format string, in the format of a Java SimpleDateFormat
offset: An offset of time before the actual logical start time
timezone: Timezone to be used for the logical start time

The documentations shows us an example:

For example, suppose the logical start time of a pipeline run is
2016-01-01T00:00:00 and this macro is provided:
${logicalStartTime(yyyy-MM-dd'T'HH-mm-ss,1d-4h+30m)}
The format is
yyyy-MM-dd'T'HH-mm-ss and the offset is 1d-4h+30m before the logical
start time. This means the macro will be replaced with
2015-12-31T03:30:00, since the offset translates to 20.5 hours. The
entire macro evaluates to 20.5 hours before midnight of January 1,
2016.

Inbuild Pipeline arguments