text:
Q: Copying an XML document with Xslt without any changes to the XML I am trying to copying an XML into an identical XML
I am using the following XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
  <xsl:output indent="yes" method="xml"/>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

If the Input XML is:
<CatalogRequest>
    <RequestFileHeader>
      <ClientCode>340000</ClientCode>
      <CreateTime>2012-04-11T14:57:03.357</CreateTime>
    </RequestFileHeader>
</CatalogRequest>

I get the following as result:
<?xml version="1.0" encoding="Windows-1252"?>
<ROOT>
<CatalogRequest>
    <RequestFileHeader>
      <ClientCode>340000</ClientCode>
      <CreateTime>2012-04-11T14:57:03.357</CreateTime>
    </RequestFileHeader>
</CatalogRequest>
</ROOT>

Any idea on how to keep the same XML without the <ROOT> node added to it.
This is being called as follows:
Dim Xct As New XslCompiledTransform
Xct.Load(New XmlTextReader(New StreamReader(xsltFileName)))
Dim xal As New XsltArgumentList
Dim helper As New XsltHelper
xal.AddExtensionObject("urn:XsltHelper", helper)
Dim memStream As New MemoryStream
Dim streamWriter As New StreamWriter(memStream, Text.Encoding.GetEncoding(1252))
Xct.Transform(doc, xal, streamWriter)

A: My best guess is that your calling code is automatically wrapping the XML you supply with a ROOT node.
I meant you to add this to your existing XSLT
<xsl:template match="ROOT">
    <xsl:apply-templates select="@* | node()"/>
</xsl:template>

Giving you this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" exclude-result-prefixes="msxsl">
   <xsl:output indent="yes" method="xml" />
   <xsl:template match="@*|node()">
      <xsl:copy>
         <xsl:apply-templates select="@*|node()" />
      </xsl:copy>
   </xsl:template>
   <xsl:template match="ROOT">
      <xsl:apply-templates select="@* | node()" />
   </xsl:template>
</xsl:stylesheet>

I am not promising this will work - it's a guess


text:
Q: Sent Mail in PHP throw 504 Gateway Time-out I'm on Ubuntu VM.
I have this PHP
<?php

# --------------------------------------------------------------------------------
# Goal    : send an email
# Run     : curl 45.55.88.57/code/mail.php  | php

$to      = 'email@gmail.com';
$subject = '';
$message = 'hello';
$headers = 'From: john@gmail.com' . "\r\n" .
    'Reply-To: john@gmail.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

I ran this :
curl 45.55.88.57/code/mail.php  | php

I get this
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   176  100   176    0     0      2      0  0:01:28  0:01:00  0:00:28    45

<title>504 Gateway Time-out</title>

504 Gateway Time-out

nginx

Is my code is wrong, or is something wrong with my VM?
I don't get any emails.

A: dont forget to set your gmail setting.
follow this tutorial for setting google smtp.

A: I did have this issue a couple of times and if you are in your home developing your ISP maybe blocking the port 25.
I saw that you are on the US, for example xfinity, att and others are blocking the port 25. This text is copied from their web-page Xfinity
From Xfinity page
Why is Port 25 for Email Submission Not Supported?
Email is used for important communications and Comcast wants to ensure that these
communications are as secure and as private as possible. As such,
Comcast does not support port 25 for the transmission of email by our
residential Internet customers. Much of the current use of port 25 is by
computers that have been infected by malware and are sending spam
without the knowledge of the users of those computers.

ATT is doing the same, if you google you can find a lot of forum posts on the matter.
How to test
Do a telnet against different mail servers. Ex.
telnet gmail.com 25
telnet yahoo.com 25
telnet hotmail.com 25

This will test if your outbound connection is being block. Some ISP just drop the traffic and you will get a time out error, other can route the traffic to nowhere and you will get the gateway time out. This is the usual approach to eliminate DoD attacks and over saturate the routers CPU.
You should also test your inbound connection, almost all mail servers now connect back to test if your domain is valid and match your ip address if not it is going to get drop or send to junk or spam folder.
Try to telnet from the outside to your ip address. Also if you are using NAT or PAT you should also have the appropriate port mappings to your internal ip address.
For this test you can use an external server or just an online service like an nmap port scanner.
https://hackertarget.com/nmap-online-port-scanner/

If not a home user/server and telnet out was working or the presumption of port 25 being block is not true.
I will check this:
1. DNS resolve nslookup google.com and save ipv4 and ipv6 addreses
2. check IPv4 and ipv6 configurations
   + Disable ipv6 (This can also make gateway timeouts because not reaching ipv6 host and since smtp have a high timeout, gateway expires before)
3. telnet out to ipv4 address
Hope it helps.

A: In your vm, just run a test php file with following code on your vm
<?php
  echo phpinfo();
?>

If you still get the same error, then it is a result of some server layer before your vm.
But if you see a different output, then you must see the PHP configuration info.
In the configuration, look for "Loaded configuration file", which will give you the exact path of your php.ini configuration file.
In php.ini, check your mail settings (http://php.net/manual/en/mail.configuration.php#ini.smtp), as mentioned by Tuckbros.
Make sure you have sendmail installed on your server and configured the 'sendmail_path' config in php.ini correctly.

A: You could use PHPMailer.
It's very easy to use.
https://github.com/PHPMailer/PHPMailer

This is the standard code for sending a email: (i copied it)
$mail->SMTPDebug = 2;                                 // Enable verbose debug output
$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'user@example.com';                 // SMTP username
$mail->Password = 'secret';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to

//Recipients
$mail->setFrom('from@example.com', 'Mailer');
$mail->addAddress('joe@example.net', 'Joe User');     // Add a recipient
$mail->addAddress('ellen@example.com');               // Name is optional
$mail->addReplyTo('info@example.com', 'Information');
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');

//Attachments
$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name

//Content
$mail->isHTML(true);                                  // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body    = 'This is the HTML message body in bold!';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

$mail->send();

More information:
https://github.com/PHPMailer/PHPMailer/wiki/Tutorial
https://www.youtube.com/watch?v=YtNraQxUTM0
https://www.sitepoint.com/sending-emails-php-phpmailer/
Let me know if this works.
PS. If you want to find out, why your mail isn't in your gmail inbox:
Your HTTP headers of your mail() isn't secure. If your headers aren't secure, there could be a chance of header injection.
More information:
https://mediatemple.net/community/products/dv/204643950/understanding-an-email-header
https://www.gracefulsecurity.com/http-header-injection/

A: You can follow the steps for using free SMTP server from Google
STEP 1:

Allow access for less secure apps

STEP 2:  Do not use 2 factor authentication to access your Google account.
STEP 3:  Set up POP

*

*
On your computer, open Gmail. In the top right, click Settings

*
Settings. Click Settings. Click the Forwarding and POP/IMAP tab. In

*
the "POP download" section, select Enable POP for all mail or Enable

*
POP for mail that arrives from now on. At the bottom of the page,

*
click Save Changes.

STEP 3: Make changes on your email client for Outgoing Mail (SMTP) Server

smtp.gmail.com
  Requires SSL: Yes
  Requires TLS: Yes (if available)
  Requires Authentication: Yes
  Port for TLS/STARTTLS: 587

*** If you use Gmail with your work or school account, check with your administrator for the correct SMTP configuration.
You can follow the link : Gmail messages on other email clients using POP

A: You probably do not have any MTA (Mail Transfer Agent) running. The problem can be solved in several ways. If you want to use the e-mail address from an external server, it is easiest to install and configure some mta, for example very simple msmtp.

redpajama_set_name: RedPajamaStackExchange


text:
Q: When changing the element/node style.display, the dom is missing some elements I have a large DOM with a pre element containing thousands of span nodes with X different name attributes. Upon a user action, I'm changing the style(style.display) X-1 name attributes to none. The node count of unchanged name attribute is over 1000. But after performing this operation, the page is displaying only a couple of hundreds of unchanged instead of all.
Note: I don't see any issue when node count is low.

  function filters() {
    var nameElement = document.getElementsByName('filterType');
    let selectedFiltersList = [];
    if (nameElement.length > 0) {
      for (let i = 0; i < nameElement.length; i++) {
        if (nameElement[i].checked) {
          selectedFiltersList.push(nameElement[i].defaultValue);
        }
      }
    }
    if (selectedFiltersList.length > 0) {
    const allFilters = ["Warning", "Error", "State"];
    const unSelectedFilters = allFilters.filter(
      val => !selectedFiltersList.includes(val),
    );

    unSelectedFilters.forEach(name => {
      let nameArray = document.getElementsByName(name);
      if (
        nameArray &&
        nameArray.length > 0 &&
        nameArray[0].style.display !== 'none'
      ) {
        nameArray.forEach(elem => (elem.style.display = 'none'));
      }
    });
    }
    }
<!DOCTYPE html>

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

        <input type="checkbox" name="filterType" value="Warning" />
        Warning
        <input type="checkbox" name="filterType" value="Severe" />
        Severe
        <input type="checkbox" name="filterType" value="State" /> State

    X State        ===> hello state

X Warn        ===> hello warn

X Error        ===>  hello error

....(// thousands of span elements like above)

A: As @Mike Kamermans already commented: you should work with a class (here hide) to make targeted spans invisible. The name-attribute cannot be assigned to spans but you can use data-name instead.
Your markuo structure is still somewhat "unorthodox". I expect you will not be using s in a
 in the finished version of the page, but the principle can be demonstrated here nonetheless.
in flt I collect the values of all checked boxes. I then loop (forEach) over all #data spans and toggle() their class hide by checking if their dataset.name can be found in flt: if they cannot be found I "hide" the element, otherwise I remove the class "hide" again.

function filters() {
  let flt=[...document.querySelectorAll('[name=filterType]:checked')].map(f=>f.value);
  [...document.querySelectorAll('#data span')].forEach(s=>
    s.classList.toggle('hide',!flt.includes(s.dataset.name)));
}
.hide {display:none}
<!DOCTYPE html>

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

        <input type="checkbox" name="filterType" value="Warning" checked/>
        Warning
        <input type="checkbox" name="filterType" value="Severe" checked/>
        Severe
        <input type="checkbox" name="filterType" value="State" checked/> State

X State        ===> hello state

X Warn        ===> hello warn

X Error        ===>  hello error

....(// thousands of span elements like above)

( I adjusted some of your span-(data-)names so they correspond with the three checkbox
values. )


text:
Q: I'm using a compatible active DisplayPort to DVI adapter with EyeFinity, why does my monitor still flicker? I specifically chose an active DisplayPort <-> DVI adapter for use with EyeFinity right out of my graphic card vendor's list of confirmed compatible adapters.
Yet the screen fails horribly, it blinks on and off constantly, sometimes the graphics go screwy and the appropriate resolutions won't be available. Sometimes the resolution will be available but I'll discover it's only with interlaced refresh rates and bounces up and down. I have to switch the resolution back and forth, again and again, to get it to work correctly, and then it fails again and the process must be repeated the moment the monitor is turned off or I reboot. It's maddening.
What is wrong? Is my GFX card supplying insufficient voltage? (Firmware tweaks allegedly help some people, but my card's isn't modifiable.) Could the adapter be defective? Is it not "active" enough for my card and I need an expensive powered adapter? Is this endemic to DisplayPort in general?

A: Check the manufacturer's website for firmware updates.
It's worth checking if your active DisplayPort adapter has any firmware updates. Yes, I said firmware updates! Despite looking like only a simple cable, it has flashable firmware! If only I knew this a year ago.
For me my manufacturer's website had all of the relevant details, my part number, a description of the problem, and the exact fix. I would have found it ages ago had I even thought to look for such a thing.


text:
Q: Youtube API - uploading large file using vb.net I am trying to upload a large (4MB+) file to youtube using the API in VB.NET.
Smaller files upload fine, but anything larger than about 4MB gives an error which (I think) is actually related to a timeout: The request was aborted: The request was canceled.
I have read and re-read the API doco, googled, etc looking for an example in VB.NET, but nothing seems to be out there for vb.net
A few coders have hit the same problem and the responses have all been around c# or Java - neither of which I am familiar with.
I tried different combinations of the settings.timeout and settings.maximum, but it does not seem to make a difference
Current code is:
Sub UploadYouTube(ByVal sSourceFile As String, ByVal sTitle As String, ByVal sMediaCategory As String, ByVal sDesc As String)
        Dim uSettings As YouTubeRequestSettings, uRequest As YouTubeRequest, newVideo As Video, CreatedVideo As Video, VideoId As String
        Dim vContentType As String = "video"
        Try
            uSettings = New YouTubeRequestSettings(, , , )
        uRequest = New YouTubeRequest(uSettings)

        newVideo = New Video()
        newVideo.Title = sTitle '"Test";
        newVideo.Tags.Add(New MediaCategory("Education", YouTubeNameTable.CategorySchema))
        newVideo.Description = sDesc        '"Testing Testing Testing"
        newVideo.YouTubeEntry.Private = False
        uRequest.Settings.Timeout = 60 * 60 * 1000
        uRequest.Settings.Maximum = 2000000000

        ' Determine the content type
        If sSourceFile.EndsWith(".mov") Then
            vContentType = "video/quicktime"
        ElseIf sSourceFile.EndsWith(".avi") Or sSourceFile.EndsWith(".mpg") Or sSourceFile.EndsWith(".mpeg") Then
            vContentType = "video/mpeg"
        ElseIf sSourceFile.EndsWith(".wmv") Then
            vContentType = "video/x-ms-wmv"
        ElseIf sSourceFile.EndsWith(".m4v") Then
            vContentType = "video/m4v"
        ElseIf sSourceFile.EndsWith(".mp4") Then
            vContentType = "video/mp4"
        ElseIf sSourceFile.EndsWith(".3gp") Then
            vContentType = "video/3gpp"
        End If
        newVideo.YouTubeEntry.MediaSource = New MediaFileSource(sSourceFile, vContentType)

        CreatedVideo = uRequest.Upload(newVideo)
        VideoId = CreatedVideo.VideoId
        ' Save the video Id to the database!
    Catch ex As Exception
        debug.print("Error. MainModule.Main. " & ex.Message, 5)
    End Try
End Sub

Any help is greatly appreciated
Tony

A: Python example : https://github.com/Mathieu69/Pitivi_Gargamel/blob/upload_merger/pitivi/uploader.py did that 3 months ago, hope it helps.

A: I tried to solve the timeout problem by using a backgroundworker.  It works, sort of.  It doesn't appear to actually be working in the background.  I would think the RunWorkerAsync would start, move on to the next command, and postback.  Instead it just hangs for a few minutes like it's uploading the whole 75MB file, then posts back successful.  If I take away the backgroundworker and just execute the upload however, it fails like yours did.  Here's my code that kind of works.
Sub up_load(s As Object, e As EventArgs)
    Dim worker As BackgroundWorker = New BackgroundWorker

    worker.WorkerReportsProgress = True
    worker.WorkerSupportsCancellation = True
    AddHandler (worker.DoWork), AddressOf begin_upload
    worker.RunWorkerAsync()
    lblmsg.Text = "Successfully initiated upload"
End Sub

Sub begin_upload(s As Object, e As DoWorkEventArgs)

    Dim request As New YouTubeRequest(settings)
    Dim vidupload As New Video()

    vidupload.Title = "My Big Test Movie"
    vidupload.Tags.Add(New MediaCategory("Nonprofit", YouTubeNameTable.CategorySchema))
    vidupload.Keywords = "church, jesus"
    vidupload.Description = "See the entire video"
    vidupload.YouTubeEntry.Private = False
    vidupload.YouTubeEntry.setYouTubeExtension("location", "Downers Grove, IL")
    vidupload.YouTubeEntry.MediaSource = New MediaFileSource("c:\users\greg\test3.asf", "video/x-ms-wmv")

    Dim createdVideo As Video = Request.Upload(vidupload)
End Sub


text:
Q: Images caching size I've uploaded 3 images in admin thumbnail, small image and base image. None of the images I've uploaded is 400x400.
images here in the grid
I need the small-image to be cached at 155x155
Why are my images being cached at 400x400 ?
How can I stop the cache setting to 400x400 ?
It slows down my page speed so much, please help.

A: Go to the admin panel -> System -> Configuration -> ADVANCED -> Developer -> Debug -> Template Path Hints and select Yes (before this you have to change Current Configuration Scope to your website). Don't forget to fill in your IP in Developer Client Restrictions. After this refresh your cache. Then open your product list and see which template is used (most probably it's something like this: template/catalog/product/list.phtml). In this file search for resize (most probably it will be resize(400)) and change it to resize(155).

A: i tried the template path hints but no path given,
I found this
<?php // Product Image ?>
            <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(155); ?>" width="155" height="155" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

as you can see the image is already set to resize 155
any other ideas would be much appreicated.


text:
Q: Why do the derivatives of a function lead towards the extremum of the function? Is there some theorem in mathematics that formalizes the idea that "for some function, at a given point, moving in the negative direction of the gradient leads you to some (local) extremum point"? For example, in the gradient descent algorithm, what exactly justifies the general directions we follow when searching for the optimum point?
Recently, I read about Fermat's Theorem on Stationary Points, which says that if the point (a,b) is a local extremum for some function f then the derivative of f at the point (a,b) is 0. Is there some extension of this theorem that states (the obvious idea) that moving in the negative direction of the gradient leads you to this (local) extremum point? Or is this idea so basic and intuitive that no proof is required?

A: Of course, there is a theorem proving that any $f\in\mathcal{C}^2$ with positive definite Hessian, for which the gradient descent method converges to some point, automatically converges (linearly) to the local minimum of $f$. The proof is for example in D.G.Luenberger, Y.Ye., Linear and Nonlinear Programming, 3.Auflage, Springer, 2008, Bd.116.


text:
Q: java linux terminal -cp auto-complete I'm working with a java library which needs two files 'library.jar' and 'library-extensions.jar'. Whenever I try to include both of them separated by a colon (e.g. -cp "library.jar:library-extensions.jar") and try to use auto-complete on the second jar file, it substitutes the first argument for the second one.
i.e.
I have something like this:
java -cp "library.jar:l

I press 'Tab' to auto-complete the second argument and it changes to:
java -cp "l

Is there anything I can do to enable proper auto-complete on additional arguments?
I'm using terminal on Ubuntu 14.04.

A: You are using double quotes (") which is causing you problem.
Remove double quotes & auto-complete will work easily :)


text:
Q: How to mention attribute(?attr) inside ternary operator in android data binding? It's boolean data
  <variable
                name="isSelected"
                type="boolean" />

This is how I tried to change background color of view based on selection, In my case I should change textviews colour, background colours and icon colours based on selection.
This is what I tried but I am getting error in Android studio.
        android:backgroundTint="@{isSelected ? ?attr/colorPrimaryVariant : ?attr/colorPrimary}"

It's an error
<expr> expected, got '?'

A: I'm not sure that it is still relevant. I faced the same issue and found the solution.

*

*You should import your R class

<import type="com.example.test.R" />

*Now, you can use theme attribute in the expression

"@{isSelected ? R.attr.colorPrimaryVariant : R.attr.colorPrimary}"

*It also requires creating BindingAdapter because without it will crash

Something like this:
@BindingAdapter("backgroundAttr")
fun setBackgroundAttr(view: View, @AttrRes color: Int) {
    view.setBackgroundColor(MaterialColors.getColor(view, color)
}

*So in XML, it will look like this

app:backgroundAttr="@{isSelected ? R.attr.colorPrimaryVariant : R.attr.colorPrimary}"


text:
Q: How to right-align text in a SWT Table cell? I have a SWT table which wrapped by the JFace TableViewer, but this problem also applies to org.eclipse.swt.widgets.Table.
When I use a StyledCellLabelProvider, the text is always left aligned, even when I use
colA.getColumn().setAlignment(SWT.RIGHT);

Here is the label provider and setup:
TableViewerColumn colA = new TableViewerColumn(measureTable, SWT.NONE);
colA.setLabelProvider(new StyledCellLabelProvider() {
    @Override
    public void update(ViewerCell cell) {
        ModelItem item = (ModelItem) cell.getElement();
        cell.setFont(FONT_REGISTRY.get(MY_SPECIAL_FONT));
        cell.setText(item.getText());
        super.update(cell);
    }
});

Any sort of workaround would be great. For e.g, nesting a widget inside the table and right aligning the text in the widget somehow.
Platform: Windows 7

A: You found a bug in StyledCellLabelProvider. It will not occur with any other CellLabelProvider.
StyledCellLabelProvider uses "owner draw" for drawing the Table cells. That means, the cell content is not drawn natively by the OS. It is drawn in an SWT.PaintItem event by the Table "owner".
StyledCellLabelProvider does not respect the alignment of the TableColumn. You can see the source here, the method getTextLayoutForInfo(.) is of interest.
A workaround could be to copy that class, fix the bug by adding
TableColumn col = ((Table)viewer.getControl()).getColumn(cell.getColumnIndex());
layout.setAlignment(col.getAlignment());

in the method getTextLayoutForInfo(.) (I didn't test this fix, but if it doesn't work, you should get the idea, and be able to make it work)
You should also add a bug report: Eclipse Bugzilla


text:
Q: Changing format of a clone date picker value I have a cloned input value from the jQuery date picker and I am trying to change the format in the cloned element only.
Shown Field :
<input id="thedate" type="text" class="datepicker-input--checkin datepicker"
     value="1/1/2017" />
<input id="thesubmit" type="button" value="Submit" />

$(function() {
    var $button = $('.datepicker-input--checkin').clone();
    $('.package').html($button);
    $(".datepicker").datepicker({
    });
});

Fiddle:

A: In case you want the formatted date you can bind the  changeDate event on datepicker and can format the value in the binded method.
$(".datepicker").datepicker().on('changeDate', dateChangeListener);
function dateChangeListener(event) {
var formattedDate = event.format('dd.mm.yy');
$(".datepicker").val(formattedDate);

}


text:
Q: How to make the content in this div in one line?

    Valid Check:

      <input type = "text" >

This message is positive

I want these contents to get in line but any edits to display in the css that I do is not working. the problem is mainly with .systemMessage, it shows up in the next line under input. Below is a screenshot for reference

A:

label {
margin-left: 3%
}

   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css">

      <title>Bright!</title>

   <link rel="stylesheet" href="style.css">

            Valid Check:

               <input type = "text" >

 This message is positive

A: Use display:inline to show contents in one line


text:
Q: Instance created from shared snapshot gives Server refused our key error I have created an instance from a shared snapshot from other aws account,following steps were done by me,
1.Share snapshot from other account.
2.copy it to my account.
3.create a volume from it volumeold ID- vol-594axxxx
4.launch a new instance ID- i-497cxxxx using centos from aws market place with volumenew ID- vol-704axxxx
5.detach the volumenew from instance.
6.attach volumeold to instance and start the instance.
After doing all this my machine is working proper I am able to launch my applications on it.
Now, I can't log in with SSH. Whenever I try, it gives an error message: "Server refused your key."

A: Use Userify to create corrected user accounts.

*

*Shut down your instance.

*Right click and choose "View/edit UserData script"

*Paste either the CloudInit or Shell Script deployments for Userify

*Paste your SSH Public key into your Userify Account

*Boot your instance

*Grant yourself root access by clicking "root" in Userify

*Wait 30 seconds and then log in and fix the problem.

The userdata script will install the Userify agent (shim) on your instance and create your user account (sudo-capable) so you can fix the issue. You'll also be able to update these user accounts anytime, remotely, or even remove them when you're not using them.
Note: if your user account that is already on the instance has the same username that you're using in Userify, Userify will not edit it or fix it since it's already on the instance and Userify leaves user accounts alone that it didn't create.
To fix this, you just need to log in with a temporary username instead. If you prefer to fix it so that Userify manages all of your accounts from now on, just log in (using the temporary user account) and delete your current user account. Once the current user account is gone, Userify will automatically create any missing accounts with the correct username.


text:
Q: How to automate the build process so that on each Publish/Unpublish/update/delete content in Contenful will not need a gatsby build? Usually we have to execute gatsby build or gatsby develop in order to reflect the changes (made in the content at Contentful site), into our Gatsby site.
That can never be an acceptable solution, specially when there are multiple content writer, add or modifies content using the same Contentful account.
How to automate the build process so that every time someone Publish or Unpublish or Delete a content in the Contenful site; the Gatsby build will automatically happen and content on Gatsby site will automatically gets updated?

A: What you are looking for is called webhook which essentially is what you described, an action (create, update or delete) that triggers another action (i.e: gatsby build) by exposing endpoints.
Its implementation will strictly rely on the hosting platform but as you mention Contentful they expose a bunch of options for different platforms (Heroku, Netlify, CircleCI, etc).
More documentation of Contentful webhooks can be found at https://www.contentful.com/developers/docs/concepts/webhooks/

A: How to automate the build process so that everytime someone Publish/Unpublish content in the contenful site; the gatsby build will automatically happens and content on Gatsby site will automatically updated?
Ans:
Make a CI pipeline to your Gatsby codebase on GitLab and establish a connection with Webhook on Contetful site.
-> How it works behind the scene:
1. A webhook gets executed by calling an endpoint in GitLab, which then
2. Triggers a GitLab CI pipeline, and the
3. GitLab CI builds our static website in Gatsby, and
4. Gastby application gets the updated content from the Contentful Delivery API.

-> Steps to achieve this purpose:
Step1: Setup a trigger URL in GitLab CI pipeline
i. Go to your gitLab repo [gitlab.com/<OrganizationName>/<RepositoryName>/tree/<BranchName>]
ii. Add the .gitlab-ci.yml file

.gitlab-ci.yml
image: node:latest
cache:
    paths:
      - .cache/
      - ./node_modules
      - public/
pages:
    script:
      - npm install
      - ./node_modules/.bin/gatsby build --prefix.paths
    artifacts:
        paths:
         - public
        only:
         -gitlab-ci

Step2: Setup the Webhook URL
i. In the same gitlab page Click on "Settings"(link on the bottom of the left menu) -> CI/CD -> Pipeline Triggers -> Expand -> Enter Description as lets say 'Ips Gatsby Build' -> Add Trigger
ii. Now note the "Token" and the url[under the "User Webhook" s.a. https://gitlab.com/api/v4/projects/20273592/<BranchName>/trigger/pipeline?token=<Token>]

Step3: Setup the Gitlab Webhook in the Contentful
i. Go to Contentful CMS site -> Settings -> Webhook -> Add Webhook -> Insert the details as below
    a. Name:  Ips Gitlab CI Trigger
    b. URL:   POST  the URL from Step1
    c. Triggers: Select Specific triggering events
            Event publish unpublish
    d. Filters: EnvId(sys.environment.sys.id) equals master
    e. Content Type: application/x-www-form-uriencoded; charset=utf-8
    f. Payload: Use default Payload
    Now click on Save

Step4: Test the "Build Automation" workflow


text:
Q: How to insert Integer value in DB - PHP I have using PHP for inserting integer value in Database.
Iam using like this
$postcode = $_POST['postcode'];
$mysql_user_resultset = mysqli_query($con, "INSERT into user (postcode) VALUES ($postcode)");

I have several field in DB. like name, username, etc. all are defined as varchar, but postcode only defined as int. If not enter the value for postcode, it doesn't insert into database

A: You could simply cast your variable into int:
$postcode = (int) $_POST['postcode'];
$mysql_user_resultset = mysqli_query($con, "INSERT into user (postcode) VALUES ($postcode)");

Note that you're not using any precautions regarding SQL injections, I would suggest you to bind your parameters before query them, using PDO class.

A: Convert $_POST['postcode'] to int, using
$postcode = (int)$_POST['postcode'];

A: Use PDO or sprintf for formatting mysql query:
sprintf example:
$mysql_user_resultset = mysqli_query($con, sprintf(
  "INSERT into user (postcode) VALUES (%d)",
$_POST['postcode']));

PDO example:
$st = $db->prepare("INSERT into vendors user (postcode) VALUES (:postcode)");
$st->bindParam(':postcode', $_POST['postcode'], PDO::PARAM_INT);
$mysql_user_resultset = $st->execute();


text:
Q: Errors in compiling boost:thread in Windows Eclipse C++ plugin I can get other boost libraries to work in Eclipse C++ plugin, but have problem in boost thread. What's the problem?
#include <boost/thread/thread.hpp>
#include <iostream>
using namespace std;

void hello()
{
   cout<<"hello world!"<<endl;
}

int main()
{
    boost::thread thrd(&hello);
    cout<<"Just a test!"<<endl;

    return 0;
}

Error messages:
** Rebuild of configuration Debug for project Hello **
 Internal Builder is used for build               **
g++ -IC:\boost_1_47_0 -O0 -g3 -Wall -c -fmessage-length=0 -osrc\hello.o ..\src\hello.cpp
In file included from C:\boost_1_47_0/boost/thread/win32/thread_data.hpp:12,
                 from C:\boost_1_47_0/boost/thread/thread.hpp:15,
                 from ..\src\hello.cpp:1:
C:\boost_1_47_0/boost/thread/win32/thread_heap_alloc.hpp:59: warning: inline function 'void* boost::detail::allocate_raw_heap_memory(unsigned int)' declared as  dllimport: attribute ignored
C:\boost_1_47_0/boost/thread/win32/thread_heap_alloc.hpp:69: warning: inline function 'void boost::detail::free_raw_heap_memory(void*)' declared as  dllimport: attribute ignored
g++ -LC:\boost_1_47_0\stage\lib -oHello.exe src\hello.o -lboost_filesystem-mgw46-mt-d-1_47 -lboost_regex-mgw46-mt-1_47 -lboost_system-mgw46-mt-1_47 -lboost_thread-mgw46-mt-1_47 -lboost_date_time-mgw46-mt-1_47
src\hello.o: In function `main':
C:\Users\cmin\workspace\Hello\Debug/../src/hello.cpp:15: undefined reference to `_imp___ZN5boost6threadD1Ev'
C:\Users\cmin\workspace\Hello\Debug/../src/hello.cpp:15: undefined reference to `_imp___ZN5boost6threadD1Ev'
src\hello.o: In function `thread<void (*)()>':
C:/boost_1_47_0/boost/thread/detail/thread.hpp:204: undefined reference to `_imp___ZN5boost6thread12start_threadEv'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1044  ms.


text:
Q: Self-destructing application Along the lines of "This tape will self-destruct in five seconds. Good luck, Jim"...
Would it be possible for an application to delete itself (or it's executable wrapper form) once a preset time of use or other condition has been reached?
Alternatively, what other approaches could be used to make the application useless?
The aim here is to have a beta expire, inviting users to get a more up-to-date version.

A: It is possible.  To get around the lock on the JAR file, your application may need to spawn a background process that waits until the JVM has exited before deleting stuff.
However, this isn't bomb-proof.  Someone could install the application and then make the installed files and directories read-only so that your application can't delete itself.  The user (or their administrator) via the OS'es access control system has the final say on what files are created and deleted.

A: If you control where testers download your application, you could use an automated build system (e.g. Jenkins) that you could create a new beta versions every night that has a hard-coded expiry date:
private static final Date EXPIRY_DATE = <90 days in the future from build date>;

the above date is automatically inserted by the build process
if (EXPIRY_DATE.before(new Date()) {
    System.out.println("Get a new beta version, please");
    System.exit(1);
}

Mix that with signed and sealed jars, to put obstacles in the way of decompiling the bytecode and providing an alternative implementation that doesn't include that code, you can hand out a time-expiring beta of the code.
The automated build system could be configured to automatically upload the beta version to the server hosting the download version.

A: Since Windows locks the JAR file while it is running, you cannot delete it from your own Java code hence you need a Batch file:
private static void selfDestructWindowsJARFile() throws Exception
{
    String resourceName = "self-destruct.bat";
    File scriptFile = File.createTempFile(FilenameUtils.getBaseName(resourceName), "." + FilenameUtils.getExtension(resourceName));

    try (FileWriter fileWriter = new FileWriter(scriptFile);
         PrintWriter printWriter = new PrintWriter(fileWriter))
    {
        printWriter.println("taskkill /F /IM \"java.exe\"");
        printWriter.println("DEL /F \"" + ProgramDirectoryUtilities.getCurrentJARFilePath() + "\"");
        printWriter.println("start /b \"\" cmd /c del \"%~f0\"&exit /b");
    }

    Desktop.getDesktop().open(scriptFile);
}

public static void selfDestructJARFile() throws Exception
{
    if (SystemUtils.IS_OS_WINDOWS)
    {
        selfDestructWindowsJARFile();
    } else
    {
        // Unix does not lock the JAR file so we can just delete it
        File directoryFilePath = ProgramDirectoryUtilities.getCurrentJARFilePath();
        Files.delete(directoryFilePath.toPath());
    }

    System.exit(0);
}

ProgramDirectoryUtilities class:
public class ProgramDirectoryUtilities
{
    private static String getJarName()
    {
        return new File(ProgramDirectoryUtilities.class.getProtectionDomain()
                .getCodeSource()
                .getLocation()
                .getPath())
                .getName();
    }

    public static boolean isRunningFromJAR()
    {
        String jarName = getJarName();
        return jarName.contains(".jar");
    }

    public static String getProgramDirectory()
    {
        if (isRunningFromJAR())
        {
            return getCurrentJARDirectory();
        } else
        {
            return getCurrentProjectDirectory();
        }
    }

    private static String getCurrentProjectDirectory()
    {
        return new File("").getAbsolutePath();
    }

    public static String getCurrentJARDirectory()
    {
        try
        {
            return getCurrentJARFilePath().getParent();
        } catch (URISyntaxException exception)
        {
            exception.printStackTrace();
        }

        throw new IllegalStateException("Unexpected null JAR path");
    }

    public static File getCurrentJARFilePath() throws URISyntaxException
    {
        return new File(ProgramDirectoryUtilities.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
    }
}

Solution inspired by this question.

Here is a better method for Windows:
private static void selfDestructWindowsJARFile() throws Exception
{
    String currentJARFilePath = ProgramDirectoryUtilities.getCurrentJARFilePath().toString();
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("cmd /c ping localhost -n 2 > nul && del \"" + currentJARFilePath + "\"");
}

Here is the original answer.

A: it is pretty possible i guess. maybe you can delete the jar like this and make sure the application vanishes given that you have the rights.
File jar = new File(".\\app.jar");
jar.deleteOnExit();
System.exit(0);

also using something like Nullsoft Scriptable Install System which enables you to write your own installed/uninstaller should help.


text:
Q: How does Knuth's second algorithm to calculate permutations work? I have started reading the Art of Computer Programming Volume 1 by Knuth. The first half of the book is basic concepts in maths. On page 45 there is an algorithm to obtain the next (amount of) permutations of 231.
From
2 3 1 1/2    2 3 1 3/2    2 3 1 5/2    2 3 1 7/2

he goes to
3 4 2 1      3 4 1 2      2 4 1 3      2 3 1 4

by "renaming" as can be seen here:

I have no idea how he accomplishes this and there is no further explanation. Can someone explain more about this?

A: Apparently,

*

*You are given a permutation $(a_1,a_2,\cdots, a_{n-1})$ of length $n-1$, such as $(2,3,1)$.

*Spawn $n$ $n$-tuples of the form $(a_1,a_2,\cdots, a_{n-1},k)$ for $k=1,2,\ldots,n$. I say "tuple" instead of "permutation" because it can happen that $a_i=k$ for some $i$; i.e. these tuples are not yet permutations. For the given example, we get $(2,3,1,1),(2,3,1,2),(2,3,1,3),(2,3,1,4)$.

*For each tuple $(a_1,a_2,\cdots, a_{n-1},\color{red}{k})$, let $b_1<b_2<\cdots<b_{n-1}$ be the members of $\{1,2,\ldots,n\}\setminus\{\color{red}{k}\}$. That is, $b_i=i$ when $i<k$ and $b_i=i+1$ when $i>k$. Now, generate a permutation $(b_{a_1},b_{a_2},\ldots,b_{a_{n-1}},k)$. For example, given the tuple $(\color{blue}{2},\color{blue}{3},\color{blue}{1},\color{red}{1})$ in the previous step, the set of the other numbers than $\color{red}{1}$ are $\{1,2,3,4\}\setminus\{\color{red}{1}\}=\{\color{green}{2},\color{green}{3},\color{green}{4}\}$. If we put the numbers $\color{green}{2},\color{green}{3},\color{green}{4}$ in the order of $\color{blue}{2}$nd, $\color{blue}{3}$rd and $\color{blue}{1}$st, we get $\color{green}{3},\color{green}{4},\color{green}{2}$. So, the permutation we get is $(\color{green}{3},\color{green}{4},\color{green}{2},\color{red}{1})$.


text:
Q: How do I kill a screen if I know the name of it? I have a screen named 'foo' that I started using the command
screen -S foo -d -m  my_command_goes_here.

I want to put this in cron, and restart it nightly by killing the screen.  The reason I'm using a screen is my command starts up several other procs and this will ensure they all exit.
So... what is the command to kill sceen 'foo'?
Thanks!

A: Try using this:
screen -S foo -X kill
I would be cautious tho, depending on what you're running and the state that it's in, this may not kill the processes running in screen, and maybe cause file system instability if it has any files open (i don't know for sure, i'm just assuming)

A: screen -S foo -X quit
From the man page:
-X  Send the specified command to a running screen session.
...
quit    Kill all windows and terminate screen.


text:
Q: "Device driver software was unsuccessfuly installed" message with DVD drive I have a Asus DRW-24B1LT DVD drive in Windows 7 64bit. The drive used to work fine for months and it stopped working suddenly and its driver letter is gone. In the device manager, there's a yellow exclamation mark beside the model name.  I did several tries to uninstall the driver and do a scan for hardware changes and I get a message "Device driver software was unsuccessfully installed". When I do an update driver, it says the driver is current. I tried a different Sata port, but it's the same problem.
Asus's site has only a firmware to download. No driver. The DVD drive was installed by me. It didn't come with the system.
How to I troubleshoot this and get the drive to work properly again? Is there a tool to completely remove the drivers and do a "cleanup"?

A: See here to delete the driver package

To uninstall a device

Open Device Manager.

Double-click the type of device that you want to uninstall.

Right-click the specific device you want, and then click Uninstall.
You can also double-click the device, and then on the Driver tab, click
Uninstall.

In the Confirm Device Removal page, select Delete the driver software for
this device if you also want to remove the device driver package from the
driver store.

The Delete the driver software for this device option removes the package
from the driver store. It does not remove the currently installed driver
for any other operational devices that use the same driver. If you remove
the driver from the store, and the device is connected to the computer
again, Windows must search for a copy of the driver package in the standard
search locations, including possibly prompting the user for media.
This option is the equivalent of running the command:
pnputil -d -f <package.inf>.
For more information, see Remove a Driver Package from the Driver Store.

Click OK to complete the uninstall process.

When the uninstall process is complete, unplug the device from the computer.

If you are prompted to restart the computer, the removal is not completed
and the device might continue to function until the computer is restarted.


text:
Q: Show that there's no such algorithm
Show that there's no such algorithm, $A$ which gets a sentence, $\varphi$ (a formula without free-variables) and returns $\varphi'$ such that: $\varphi$ is satisfiable iff $\varphi'$ is valid (meaning, it is true for every structure, $M$).

I was hinted I need to look at $\lnot \varphi'$ (where $\varphi'$ is valid iff $\lnot \varphi'$ isn't satisfiable) and to run some checks simultaneously and so getting a contradiction to the thesis claims that there's no algorithm to check satisfiability of some sentence.
I'd be glad for help.
Thanks.

A: HINT: by the Completeness Theorem, there's an algorithm $B$ such that $B(\psi)$ halts iff $\psi$ is valid (exercise). Now suppose you had such an $A$. Then consider what happens if I run $B(\neg\varphi)$ and $B(\varphi')$ in parallel - do you see why this lets me compute whether $\varphi$ is satisfiable?


text:
Q: Play Radio Stream - shoutcast v2 - MediaPlayer and PrepareAsync - not working I'm trying to write a player, that will play the audio stream - shoutcast v2 (I tried all formats to play a stream - .pls, .m3u, .mp3 and clean http://example.com:port).
The following code running in the emulator, works for phone ZTE (Android 4.1.2) but it does not work, eg. A Sony Xperia M (Android 4.3) and did not know why.
The code has already been written in various ways and still have not solved the problem.
P.S. One app from the Play Store also does not work, play (MaxItalo Player) but another (eg. RadioParty) reproduces the stream.
My code (part of the code):
private class PlayM extends AsyncTask<Void,Void,Void>
    {
        @Override
        protected void onPreExecute() {
            dialog.show();
            mPlayer = new MediaPlayer();
            mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
        }

        @Override
        protected Void doInBackground(Void... params) {
            try {
                mPlayer.setDataSource(getApplicationContext(), Uri.parse(url));
                mPlayer.prepareAsync();
            } catch (IllegalArgumentException e1) {
                errorToast.setText("IllegalArgumentException "+e1);
                errorToast.show();
            } catch (IllegalStateException e2) {
                errorToast.setText("IllegalStateException "+e2);
                errorToast.show();
            } catch (IOException e3) {
                errorToast.setText("IOException "+e3);
                errorToast.show();
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer player) {
                    dialog.hide();
                    player.start();
                }
            });
        }

    }

    public void clickPlay(View v) {
        if(mPlayer==null) {
            new PlayM().execute();
        }
    }


text:
Q: How to make Streamlit reloads every 5 seconds? I have to reload a Streamlit chart every 5 seconds, in order to visualize the new data in a XLSX report.
How to achieve this?
import streamlit as st
import pandas as pd
import os

mainDir = os.path.dirname(__file__)
filePath = os.path.join(mainDir, "sources\\test.xlsx")
df = pd.read_excel(filePath)

option1 = 'Product'
option2 = 'Quantity'

df = df[[option1, option2]].set_index(option1)

st.write('Product Quantity')
st.area_chart(df)

A: Streamlit recognizes every time your source code changes. So, based on this premise, one way to achieving this is to create an empty "dummy.py" file, which will be imported by the main script and updated every 5 seconds by another script running simultaneously:

*

*create an empty "dummy.py" file inside the same folder of your main script;

*create a script called "refresher.py" in the same folder;

*

*now put the following While loop inside your "refresher.py" file, in order to update the "dummy.py" with a random number (commented) every 5 seconds:
from random import randint
import time
import os

def refresher(seconds):
    while True:
        mainDir = os.path.dirname(__file__)
        filePath = os.path.join(mainDir, 'dummy.py')
        with open(filePath, 'w') as f:
            f.write(f'# {randint(0, 10000)}')
        time.sleep(seconds)

refresher(5)

*add the following line to the script with your Streamlit chart code: """   from dummy import *   """

*run the "refresher.py" script;

*run the Streamlit script with your chart;

*Streamlit from now on will recognize any modifications in the "dummy.py file" as a modification in the source code;

*Once the web page is fully loaded, it will alert you the source file was changed. Click on " Alway rerun" and that's it.


text:
Q: MS SQL Server Full Text search with JPA and EclipseLink MSSQL 2008
EclipseLink 2.3.0
JPA 2.0
I am trying to make an JPQL query to use a fulltext search function of an MSSQL.
as we know that FUNC addictional EclipseLink function doesn't work [1] as it expects the return value, while MSSQL freetext [2] is not actually a function but some magic predicate looking like a function [3], I am trying to use the next powerful function mentioned in [4], SQL
i tried this
and SQL('freetext(?, ?)', d.title, :title)

and this
and SQL('freetext(?, :title)', d.title)

and that combinations with  =1 endings
and SQL('freetext(?, ?)', d.title, :title) = 1

without any success. it says something like
line 5, column 7: unexpected token [(].
Internal Exception: NoViableAltException(83@[()* loopback of 383:9: (d= DOT right= attribute )])] with root cause
NoViableAltException(83@[() loopback of 383:9: (d= DOT right= attribute )*])
where the line 5, column 7 is around the first open parenthesis after SQL keyword.
i am trying to avoid the native SQL as I want to use the advantage of not writing joins with many one-to-many related classes.
what is the correct way to use SQL special function?
[1] How to use MySQL's full text search from JPA
[2] http://msdn.microsoft.com/en-us/library/ms176078(v=sql.105).aspx
[3] Hibernate + MSSQL + Fulltext Search via Contains
[4] http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/Support_for_Native_Database_Functions#SQL

A: The SQL operator in EclipseLink is new in EclipseLink 2.4.  You need to use the EclipseLink 2.4 milestone or nightly build for this.
If you cannot use 2.4, you can use a native SQL query.
http://www.eclipse.org/eclipselink/downloads/milestones.php


text:
Q: How to specify different layer sizes in Pytorch LSTM/GRU/RNN so I know how to work with LSTMs in general with Pytorch. But it bugs me, that you can only specify ONE hidden_size for all your layers in the LSTM. Like this:
lstm = nn.LSTM(input_size=26, hidden_size=128, num_layers=3, dropout=dropout_chance, batch_first=True)

So for all three layers, the size will be 128. But is there really no way to say, for example, that the first layer should be 128, the second 32 and the third 128?
If I missed something in the documentation or you know a work-around, please let me know, thank ya!

A: Actually, it depends on the shape of your input and you can see How to decide input and hidden layer dimension to torch.nn.RNN?. Also, you have to understand what is the input and the output because there are different ways to deal with the input and the output. In the  A Beginner's Guide on Recurrent Neural Networks with PyTorch, you can see how the input data is taken in by the model.

Your model can be
lstm = nn.LSTM(input_size=26, hidden_size=128, num_layers=3, dropout=dropout_chance, batch_first=True)
lstm2 = nn.LSTM(input_size=26, hidden_size=32, num_layers=3, dropout=dropout_chance, batch_first=True)
lstm3 = nn.LSTM(input_size=26, hidden_size=128, num_layers=3, dropout=dropout_chance, batch_first=True)

For multi-layer see this model.
# sequence classification model
class M1(nn.Module):
    def __init__(self):
        super(M1, self).__init__()

        self.recurrent_layer  = nn.LSTM(hidden_size = 100, input_size = 75, num_layers = 5)
        self.recurrent_layer1  = nn.LSTM(hidden_size = 200, input_size = 100, num_layers = 5)
        self.recurrent_layer2  = nn.LSTM(hidden_size = 300, input_size = 200, num_layers = 5)
        self.project_layer     = nn.Linear(300, 200)
        self.project_layer1    = nn.Linear(200, 100)
        self.project_layer2    = nn.Linear(100, 10)

    # the size of input is [batch_size, seq_len(15), input_dim(75)]
    # the size of logits is [batch_size, num_class]
    def forward(self, input, h_t_1=None, c_t_1=None):
        # the size of rnn_outputs is [batch_size, seq_len, rnn_size]
        # self.recurrent_layer.flatten_parameters()
        rnn_outputs, (hn, cn) = self.recurrent_layer(input)
        rnn_outputs, (hn, cn) = self.recurrent_layer1(rnn_outputs)
        rnn_outputs, (hn, cn) = self.recurrent_layer2(rnn_outputs)
        # classify the last step of rnn_outpus
        # the size of logits is [batch_size, num_class]
        logits = self.project_layer(rnn_outputs[:,-1])
        logits = self.project_layer1(logits)
        logits = self.project_layer2(logits)
        return logits


text:
Q: H-Bridge only low output voltage; IRLZ-34N I want to create a LED driver with the help of an H-Bridge. I have some experience with the IRLZ-34N and already created some simple inverter driver boards with it.
But this circuit is giving me a really hard time.
When I supply one side of the Bridge, there is only a voltage of 5V between the output.
From my understanding, the 5V provided by the Arduino should be enough to switch the MOSFET fully. I also tried it open with only a multimeter as a load. GND of Arduino is connected to the GND of the circuit.
I don't have dedicated protection diodes as I figured I don't have an inductive load and the IRLZ-34N has an integrated protection diode
What do I miss?
Thank you in advance!
Schematic:

A: It's because you're using an N-channel FET as a high side switch. You need a gate voltage a few volts higher than VPP to turn Q1 or Q3 on fully.


text:
Q: Splitting a range into an even number of n groups I'm trying to setup threads with an even number of API pages to query for each thread. Example below has 9 pages that I want to call in total, and I want to split into 2 threads: first thread would ideally query pages 1-4, and the second thread would query pages 5-9. But I'm having some trouble getting it to evenly and properly distribute. The following works for threads = 2 and an even number of pages, but not for odd number of pages because I call the variables as range(page_start, page_end) and want the 9th page:
import math
pages = 9
page_end = 1
threads = 2

for thread in range(1,1 + threads):
    page_start = page_end
    page_end = page_start + math.floor(pages/threads)

    print(page_start, page_end)

# Output is

# 1 5
# 5 9

# when it should be the following
# 1 5
# 5 10

Every time I fix this, it breaks when pages is set to an even number.


text:
Q: how to extract .bin through shell, I downloaded the attachment in .zip file but gets converted to .bin file I downloaded the attachment in .zip file ( through gmail ) but when i checked through shell it gets converted to .bin file. I checked in /storage/downloads it is in .bin format. How to open it ? I want to extract my files. Can I change the extension ?

A: first, check the file type with
file
if the above reports that it is "Zip archive data",
then you can use unzip
Second, depends on the file command output


text:
Q: Best practice for validating a URL with Spring-MVC? I am using Spring MVC for my web application.
I need to validate that the URL the user inputs is valid and was wondering if there is something in Spring that can do the basic checks for me (for example starts with http/https, has domain name etc).
ValidationUtils only contains very basic checks and I know I can write a regular expression in the validate() method however prefer to avoid it inm case someone has already done it :)
Thanks

A: In the past, I have always utilized Hibernate Validator. Simply annotate the appropriate field in your form bean with a @URL constraint.
If you've never used the ORM part of Hibernate before, don't let that scare you. The Validator portion is not dependent on the ORM stuff, and integrating it into Spring is very straightforward.
If for some reason you can't use Hibernate Validator... or you just want to stick with what you're comfortable with, a good place for regex's is RegExLib.com; several patterns that can match a URI are listed there.

A: Ended up using UrlValidator from apache commons.

A: I know this question is quite old, but I just need the same and I think I'll go with the PropertyEditors in SpringFramework.
More precisely there is URLEditor, which you can use to convert a String representation to an actual URL object.
Here is a link to the respective documentation:
http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#beans-beans-conversion
http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/beans/propertyeditors/URLEditor.html
In my case, I think about using the following code within a Spring Validator to check whether a String entered by a user is a valid URL or not:
try {
    PropertyEditor urlEditor = new URLEditor();
    urlEditor.setAsText(field.getValue());
} catch (IllegalArgumentException ex) {
    errors.rejectValue("nameOfTheFieldToBeValidated", "url_is_invalid");
}

However, as for now, I'm unsure whether it is possible to configure which protocol is going to be accepted as valid (i.e. URLEditor seems to also accept URLs starting with "classpath:")

A: Use a spring interceptor:
http://java.dzone.com/articles/using-spring-interceptors-your


text:
Q: Store image in Hbase loss of Meta data and Exif Uploading an image to hbase using Java program, after retrieving the image I found there is difference in file size eventually increased and most of Exif and Meta data loss
(GPS location data, camera details, etc..)
Code :
public ArrayList<Object> uploadImagesToHbase(MultipartFile uploadedFileRef){
    byte[] bytes =uploadedFileRef.getBytes();
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    ImageIO.write(image, "jpg", outputStream);
    HBaseAdmin admin = new HBaseAdmin(configuration);
    HTable table = new HTable(configuration, "sample");
    Put image = new Put(Bytes.toBytes("1"));
    image.add(Bytes.toBytes("DataColumn"), Bytes.toBytes(DataQualifier), bytes);
    table.put(image);

How to store and retrieve a  Image with out any change / loss?

A: Please try using SerializationUtils from Apache Commons Lang.
Below are methods
static Object   clone(Serializable object)  //Deep clone an Object using serialization.
static Object   deserialize(byte[] objectData) //Deserializes a single Object from an array of bytes.
static Object   deserialize(InputStream inputStream)  //Deserializes an Object from the specified stream.
static byte[]   serialize(Serializable obj) //Serializes an Object to a byte array for storage/serialization.
static void serialize(Serializable obj, OutputStream outputStream) //Serializes an Object to the specified stream.

While storing in to hbase you can store byte[] which was returned from serialize.
While getting the Object you can type cast to corresponding object for ex: File object and can get it back.

A: Most likely you are just over-complicating things. :-)
The reason why you are losing the Exif and other metadata, is that the ImageIO convenience methods ImageIO.read(...) and ImageIO.write(...) does not preserve metadata. The good news is, they are not needed.
As you seem to already have the image data from the MultipartFile, you should simply store that data (the byte array) in the database, and you will store exactly what the user uploaded. No difference in file size, and metadata will be untouched.
Your code above doesn't compile for me, and I'm no HBase expert, so I just leave that out (as you have already been able to store an image, to see the size/quality difference and metadata loss, I assume you know how to do that :-) ). But here's the basics:
public ArrayList<Object> uploadImagesToHbase(MultipartFile uploadedFileRef) {
    byte[] bytes = uploadedFileRef.getBytes();

    // Store the above "bytes" byte array in HBase *as is* (no ImageIO)
}


text:
Q: Sending formdata from front-end to back end using Axios i am trying to send an https request from my front-end(react js) to my back-end (nodejs) using axios.This https request has a csv file converted in formData.My code for sending teh request  is this:
let formData = new FormData();
formData.append('file', this.state.selectedFiles);     //selectedFiles is input from a ui form

  const {data : QueryResult} = await axios({
              method: 'post',
              url: "https://localhost:3000/...",formData,
              headers: {'x-observatory-auth': localStorage.getItem("token")},
              });
             }

I process this in back end using :
function AddSessions(req,res){
      let stream = fs.createReadStream("./upload_folder/upload_file.csv");
      let csvData = [];

      let csvStream = fastcsv
          .parse()
          .on('error', function(error) {
              res.status(400).send("Incorrect Data format.Please enter a csv file");
              return
          })
          .on("data", function(data) {
            csvData.push(data);
          })
          .on("end", function() {
              // remove the first line: header
              csvData.shift();

              let insert_query = "INSERT IGNORE  INTO Sessions(SessionID, StationID,PointID, Username, VehicleID, connectionTime,"+
              " doneCharginTime, Timezone ,KwhDelivered ,Protocol,Payment )  VALUES ?";
              db.query(insert_query, [csvData], (err, db_res) => {
                  if (err) {
                      res.status(400).send("Incorrect Data format for  Sessions or File is too big(larger than 1GB)")
                      console.log(err)}
                  else{
                      let count_query = "SELECT Count(*) as count FROM Sessions";
                      db.query(count_query, (err1, result) => {
                          if (err1) res.send(err1.message)
                          else {
                              res.status(200).send({SessionsInUploadedFile :db_res.affectedRows +  db_res.warningCount , SessionsImported : db_res.affectedRows, TotalSessionsInDatabase :result[0].count});

                        }
                    })
                }
            });

        }

        );
    stream.pipe(csvStream);
  }
}
module.exports = AddSessions

The error i get is :
 code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1",
  sqlState: '42000',
  index: 0,
  sql: 'INSERT IGNORE  INTO Sessions(SessionID, StationID,PointID, Username, VehicleID, connectionTime, doneCharginTime, Timezone ,KwhDelivered ,Protocol,Payment )  VALUES '

and i can't seem to understand what i am doing wrong.
Note that using postman this request can be done fine.I've been stuck in this for way too long and i can;t find a solution so any help would be very welcome.
Thanks in advance.


text:
Q: How to change visibility of a particular layer category in PyQGIS? I've got one layer with its symbol MARKER, categorized by an expression in 4 colors. The colors depends on a value of a column. So from the TOC, I'm able to click and enable/disable, as they were different layers, and show one category a time.
From python script, I want to do the same, with a loop: show/hide in the map the different existing categories one each time (for printing separated the 4 jpg),
I tried to show the active layers, and categories aren't not showing as a proper layer. So, I thought that the proper layer was a group tree, but when I ask for QgsLayerTreeGroup always show no group.
How can I obtain categories for changing their visibility in the map?
root = QgsProject.instance().layerTreeRoot()
for child in root.children():
    if isinstance(child, QgsLayerTreeGroup):
       print "- group: " + child.name()
        if child.name() == "rara": #to check subgroups within test group
            print "rara"
            for subChild in child.children():
                print "child"
                if isinstance(subChild, QgsLayerTreeGroup):
                    subChild.name()
    else:
        print "no group: " + root.name()

A: Assuming layer is your QgsVectorLayer, you can access layer legend nodes in this way:
from PyQt4.QtCore import Qt
ltl = QgsProject.instance().layerTreeRoot().findLayer( layer.id() )
ltm = iface.layerTreeView().model()
legendNodes = ltm.layerLegendNodes( ltl )

Now you can make a particular category invisible (e.g., 'cat_A'):
legendNode = [ln for ln in legendNodes if ln.data( Qt.DisplayRole ) == 'cat_A']
if legendNode:
    legendNode[0].setData( Qt.Unchecked, Qt.CheckStateRole )

Alternatively, you could do the following to achieve the same result:
ltm = iface.layerTreeView().model()
lsi = layer.rendererV2().legendSymbolItemsV2()
ruleKey = [l.ruleKey() for l in lsi if l.label() == "cat_A"]
if ruleKey:
    ltm.findLegendNode( layer.id(), ruleKey[0] ).setData( Qt.Unchecked, Qt.CheckStateRole )


text:
Q: How to get the range of the first line in a string? I would like to change the formatting of the first line of text in an NSTextView (give it a different font size and weight to make it look like a headline). Therefore, I need the range of the first line. One way to go is this:
guard let firstLineString = textView.string.components(separatedBy: .newlines).first else {
    return
}
let range = NSRange(location: 0, length: firstLineString.count)

However, I might be working with quite long texts so it appears to be inefficient to first split the entire string into line components when all I need is the first line component. Thus, it seems to make sense to use the firstIndex(where:) method:
let firstNewLineIndex = textView.string.firstIndex { character -> Bool in
    return CharacterSet.newlines.contains(character)
}
// Then: Create an NSRange from 0 up to firstNewLineIndex.

This doesn't work and I get an error:

Cannot convert value of type '(Unicode.Scalar) -> Bool' to expected argument type 'Character'

because the contains method accepts not a Character but a Unicode.Scalar as a parameter (which doesn't really make sense to me because then it should be called a UnicodeScalarSet and not a CharacterSet, but nevermind...).
My question is:
How can I implement this in an efficient way, without first slicing the whole string?
(It doesn't necessarily have to use the firstIndex(where:) method, but appears to be the way to go.)

A: A String.Index range for the first line in string can be obtained with
let range = string.lineRange(for: ..<string.startIndex)

If you need that as an NSRange then
let nsRange = NSRange(range, in: string)

does the trick.

A: You can use rangeOfCharacter, which returns the Range<String.Index> of the first character from a set in your string:
extension StringProtocol where Index == String.Index {
    var partialRangeOfFirstLine: PartialRangeUpTo<String.Index> {
        return ..<(rangeOfCharacter(from: .newlines)?.lowerBound ?? endIndex)
    }
    var rangeOfFirstLine: Range<Index> {
        return startIndex..<partialRangeOfFirstLine.upperBound
    }
    var firstLine: SubSequence {
        return self[partialRangeOfFirstLine]
    }
}

You can use it like so:
var str = """
    some string
    with new lines
"""
var attributedString = NSMutableAttributedString(string: str)
let firstLine = NSAttributedString(string: String(str.firstLine))
// change firstLine as you wish

let range = NSRange(str.rangeOfFirstLine, in: str)
attributedString.replaceCharacters(in: range, with: firstLine)


text:
Q: Compute all the elements that have order 2 under the action of $G$ Given $f = x^3 - 3x + 1$, I want to find the set of all elements of the splitting field of $f$ over $\mathbb{Q}$ such that the orbit under the action of G has at most 2 elements where $G$ is the group of automorphisms of $E$.  This set of elements should be an extension of $\mathbb{Q}$.
I have already shown that such a set is a subfield of the splitting field in a previous problem.  I attempted to find $Gal_\mathbb{Q}(f)$ and I got that it has 3 distinct real nonrational roots and has discriminant 81, which is a square and is therefore isomorphic to $\mathbb{Z}_3$.  Now I don't know how to find the subfield of elements whose order under the action of $G$ is at most 2.  Any suggestions?

A: Obviouly the elements whose orbit is $1$ is $\mathbb{Q}$, as this elements are precisely the fixed field of $G$, which is $\mathbb{Q}$, as the extension is Galois.
Now we consider element whose orbit is of size $2$. Let $\alpha \in E$ and assume that the orbit of $\alpha$ under action of $G = \text{Gal}(E/\mathbb{Q})$ is of size  $2$. Let $\alpha_1$ be the other element in the orbit. Then we have that $\sigma(\alpha) = \alpha_1$ for some $\sigma \in G$. We'll prove that $g(x) = (x-\alpha)(x-\alpha_1)$ is the minimal polynomial of $\alpha$ over $\mathbb{Q}$. This is true as $g$ is fixed by $G$ (can you see why?) and so $g \in \mathbb{Q}[x]$ and the irreducibility follows trivialy, as we can't have $\alpha \in \mathbb{Q}$. (In fact $\sigma(\alpha)$ is a root of the minimal polynomial of $\alpha$ over $\mathbb{Q}$, so we conclude that $\deg \min(\alpha,\mathbb{Q}) \ge 2$ and as $\min(\alpha,\mathbb{Q}) \mid g$ we get  $\min(\alpha,\mathbb{Q}) = g$)
Now consider the subfield $L = \mathbb{Q}(\alpha)$. We have that $[L:\mathbb{Q}] = \deg g = 2$. However then we have that:
$$3 = [E:\mathbb{Q}] = [E:L][L:\mathbb{Q}]= 2[E:L]$$
But this leads to an obvious contradiction. Hence there are no elements whose orbit under the action of $G$ is of size exactly $2$. From here we deduce that the field of such elements is $\mathbb{Q}$

In fact we know that $\sqrt{\Delta}$ is an element whose orbit is at most $2$, as the only possibilty for mapping it is to $-\sqrt{\Delta}$ and itself. So we know that $\mathbb{Q}(\sqrt{\Delta})$ is a subfield of the wanted field. In fact one can prove that this is exactly the wanted subfield.
Let $L$ be the wanted field then we prove that $[L:\mathbb{Q}] \le 2$. Indeed if it wasn't then there exists a primitive element $\alpha$ who has at least three conjugates in the splitting field of $f$. (This elements might not be in $L$, but are certainly in $E$, as the extension is Galois). However the Galois group acts trasitively on the roots of an ireducible polynomial and so we have that the orbit of $\alpha$ has at least three element, which is a contradiction. Therefore we can conclude that $[L:\mathbb{Q}] \le 2$ and as $\mathbb{Q}(\sqrt{\Delta}) \subseteq L$ we have that $\mathbb{Q}(\sqrt{\Delta}) = L$
However note that this doesn't work when the polynomial is of degree more than $3$. For example take $x^4+1$. Then it's splitting field is $E=\mathbb{Q}(\sqrt{2},i)$. Now $\sqrt{2}$ and $i$ both have an orbit of $2$ under the action of the $\text{Gal}(E/\mathbb{Q})$, but $\sqrt{2} + i$ has an orbit of $4$ elements, so those elements don't constitute a field. In deed if that was the case then $\mathbb{Q}(\sqrt{2}), \mathbb{Q}(i) \subseteq L$, which means that $L=E$, which is impossible.


text:
Q: Windows insists associating .py files with the wrong version of Python I have both Python 2.7 and Python 3.3 installed on my machine (I'm on Windows 8).
I would like .py files to be opened with Python 3.3 by default. The only Python path in the PATH environment variable is the 3.3 one. Still, when opening .py files I see they're being interpreted by Python 2.7, even when I explicitly open them with the Python 3.3 exe ("Open with" and choosing the 3.3 exe). I've also tried changing the Python.exe version using "Set Associations" in Windows' control panel. I'm not sure it has changed anything. No matter what I do, the output of the following program is 2.7.3:
import sys
print(sys.version)

How do I force Windows 8 to open .py files with Python 3.3?

A: Changing the shebang (#! python3)  may help you, but you will have a problem: if your python script has parameters, they will be cut off when you run command
somepythonfile.py  your_parameters
You will get  py.exe running with just "somepythonfile.py" and NO parameters, believe me.
The method which worked for me is next:  run the app http://www.nirsoft.net/utils/file_types_manager.html  - this is a file association manager.   Fix the association for python files to be
"C:\Windows\py.exe" "%1" %*
instead of
"C:\Windows\py.exe" "%1"
Or, alternatively, set
"C:\Python34\pythonw.exe" "%1" %*
explicitly - to match the desired version and omit the shebang line.

A: It seems that windows is not checking the whole path of the executable!
Try to rename the python.exe of version 2 (respectively 3) to some temp name. Then associate with this name. And change everything back.
FYI you could check the file association with:
C:\Users\shadowed>assoc .py
.py=Python.File

C:\Users\shadowed>ftype Python.File
Python.File="C:\Python27\python.exe" "%1" %*

A: Try to add #!python3 to the very first line. Python 3.3 introduced Python Launcher for Windows that associates .py with c:\windows\py.exe. It launches the highest Python 2 by default.See https://stackoverflow.com/a/17245543/1346705

A: If you want to change the IDLE used when right clicking you can go into the registry and find the key:
HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE\command

You should see something like:
"C:\Python27\pythonw.exe" "C:\Python27\Lib\idlelib\idle.pyw" -e "%1"

Change all the 27 to 33 if you installed your pythons in the default area. If not just change the path to where your 3.3 implementation is stored.
To change the default command line python you should do the same with the path in your PATH environment variable.

A: Have you tried uninstalling Python 2.7 temporarily? That might fix the file association. I am uncertain, as I am not familiar with Windows 8 beyond what little I learned of it when I tried it on someone else's computer. I'm not even sure it would work on Windows 7, but it is worth a shot if you ask me.
I also recommend using the tag for the specific version of Windows you are using, rather than the standard "windows" tag. In this case, I might use both, since file associations don't change much between versions of Windows. At least use the correct tag (windows-8), at any rate. Then you will get more answers from people looking for that tag.


text:
Q: use all values in a list as arguments (scheme)     (define a_list (list 2 3 4))
    (define (add x y z)
      (+ x y z))
    (add a_list)

Obviously this doesn't work, but what is the correct way to do this? What I want to do is to use a random amount of variables in a list as arguments in a procedure call. The amount of variables in the list must of course match the amount of parameters the procedure has, but don't think about that, as that is not what I'm wondering about.

A: This is what the apply function is for:
(apply add a_list)


text:
Q: How to create a map using LeafLet Im looking to create a map that can be interactive.
The best option that I found is leaflet, the thing is I don't find any resource explaining how to create my own map.
Im looking to create an indoor map where user can see all the building
How could I achieve that ?

A: You can try to use this tutorial from MapBox to get started.
You will need to create your own GeoJSON data for the stores and fountains that you want to display, and you can use this website to generate the GeoJSON file.

A: The first question is what do you mean by interactive? Do you just mean basic pan and zoom, or do you need to let users click the map to get information on features?
If you have an image of the mall layout, and want a simple interactive map image with pan and zoom, check out these two tutorials for using Leaflet as a kind of zoom image tool:
http://kempe.net/blog/2014/06/14/leaflet-pan-zoom-image.html
http://blog.thematicmapping.org/2013/06/showing-zoomify-images-with-leaflet.html
If your image is large and you want to create a pyramid of image tiles, check out gdal2tiles.py
For more complex interactivity in a map with pixel coordinates (as opposed to real-world coordinate reference system), check out the following discussion on SO (a bit old but may get you started).


text:
Q: Date only comparison c# I must be going crazy, but I'm comparing 2 DateTime object's Date parts... and for some reason this is returning false?? I'm really stumped...
DateTime Issue
Either I'm doing something horribly wrong or i'm missing something massive... I've made sure these are both DateTime objects, and they are both 16/09/2020.
That's pretty much all I've tried so far. I didn't think there's another way or that this wouldn't have worked..
Full line is:
bool isequal = CActivity.Instance.SignInOuts[0].Date == signInOut.Date;

SignInOut is SignInOut signInOut = new SignInOut(); where I'm assigning the date, and CActivity.Instance.SignInOuts is defined here:
public class SignInOut
{
    public DateTime Date { get; set; }
    public TimeSpan SignInTime { get; set; }
    public TimeSpan SignOutTime { get; set; }
}

A: You are referencing a property called Date, that is a DateTime.  You want to compare the property on the DateTime, so do:
bool isequal = CActivity.Instance.SignInOuts[0].Date.Date == signInOut.Date.Date;

A: DateTime and TimeSpan are both the same size: 8 bytes.  From a storage and simplicity standpoint, I don't think there's much reason to store a point in time as DateTime + TimeSpan when you could just use a DateTime.  Thus, you could store the same information more clearly with only two properties...
public class SignInOut
{
    public DateTime SignInTime { get; set; }
    public DateTime SignOutTime { get; set; }
}

Not only would that eliminate the awkward usage of signInOut.Date.Date (because SignInOut.Date, counter to its name, evidently has a non-zero TimeOfDay component) and simplify the class/calculations by storing the date/time pairs directly, it would also support the scenario where the sign-in and sign-out didn't take place on the same day (better than signInOut.SignOutTime.Ticks being > TimeSpan.TicksPerDay).
You would still have to write something like...
bool isequal = CActivity.Instance.SignInOuts[0].SignInTime.Date == signInOut.SignInTime.Date;

...to do a date-only comparison, but it makes the oversight that caused this question a lot less likely.


text:
Q: With embedded jetty, do you still need to install jetty on the server? When you deploy a web app (servlets) with embedded jetty, do you still need to install jetty on the server?
How do you start/stop jetty when it is embedded?  You also have to consider when the server reboots.
Just confused on the deployment aspect of it.

A:
When you deploy a web app (servlets) with embedded jetty, do you still need to install jetty on the server?

No there is nothing to install. The server should be contained with your application.

How do you start/stop jetty when it is embedded? You also have to consider when the server reboots

You have to stop or start you application. You can kill the process. Doing ctrl + c should kill the application. Read more about this mode at jetty's website.

A: If Jetty is embedded then the application starts the server itself so you don't need to install it on the server. You start Jetty by starting the application, this may vary from application to application. You certainly should install the application as service on the server so it will be automatically started when the servers reboots.
Take for example Jenkins which utilizes an embedded server but can also be deployed to a servlet container. Nexus uses the same strategy.


text:
Q: Visual Studio 2015 added files not being added to source control automatically in release branch We have noticed in Visual Studio 2015 since Update 3 that any files or projects that get added to our solution no longer get picked up by source control (TFS) automatically:
Image of solution explorer showing missing "+" sign
When we right click the Person.cs file and select "Add files to Source Control" we get the following dialog:
Image of source control dialog when trying to add file
I have seen some folks talk about using the .tfignore file to override this behavior but I have had no success at all with this approach.
Any help that can be provided would be great.

A: This is a known behavior and only occurs at Visual Studio 2015 Update 3 for a branch with "Release" name. Using Visual Studio 2015 Update 2, everything is ok.
Folders called Release and their contents is automatically excluded from TFS (along with Debug and lots of file types). Just as your folks  suggested,  you could also override this for particular folders by creating a .tfignore file,  detail info please refer this link: Customize which files are ignored by version control

Customize which files are ignored by version control
By default certain types of files (for example, .dll files) are
  ignored by version control. As a result:
When you add ignored files to folders that are mapped in a local
  workspace, they do not appear in the Pending Changes page in Team
  Explorer.
When you try to add ignored files using the Add to Source Control
  dialog box (for example by dragging them into Source Control
  Explorer), they automatically appear in the Excluded items tab.
You can configure which kinds of files are ignored by placing text
  file called .tfignore in the folder where you want rules to apply. The
  effects of the .tfignore file are recursive. However, you can create
  .tfignore files in sub-folders to override the effects of a .tfignore
  file in a parent folder.

The related .tfignore file rules may help you:

.tfignore file rules
! negates a filespec (files that match the pattern are not ignored)
For example:
Do not ignore .dll files in this folder nor in any of its sub-folders !*.dll


text:
Q: Is the automorphism group of free group of rank two relatively hyperbolic? By Behrstock, Drutu and Mosher [BDM], we know that the (outer) automorphism groups $\mathrm{Aut}(F_n)$ and $\mathrm{Out}(F_n)$ of free group of rank $n$ are not relatively hyperbolic if $n \geq 3$ (Theorem 9.2 of [BDM]). If $n = 2$, then $\mathrm{Out}(F_2)$ is isomorphic to $\mathrm{GL}(2,Z)$ so that it is virtually free. I hope to know what happens to $\mathrm{Aut}(F_2)$.
Since the left transvection and right transvection commute, $\mathrm{Aut}(F_2)$ contains a free abelian subgroup of rank two which implies that it is not hyperbolic. Then, is it relatively hyperbolic? Or is it not relatively hyperbolic?

A: Here is more direct and elementary argument.
Lemma: $\mathrm{Aut}(W_3)$ and $\mathrm{Aut}(\mathbb{F}_2)$ are isomorphic, where $W_3$ denotes the free product $\mathbb{Z}_2 \ast \mathbb{Z}_2 \ast \mathbb{Z}_2$.
Sketch of proof. Let $F \leq W_3$ denote the kernel of the morphism $W_3 \twoheadrightarrow \mathbb{Z}_2$ sending all the generators $a,b,c$ to $1$. In other words, $F$ coincides with the elements that can be written as reduced words of even lengths. Because $F$ is a characteristic subgroup freely generated by $\{ab,bc\}$, we find a morphism $\mathrm{Aut}(W_3) \to \mathrm{Aut}(\mathbb{F}_2)$. It can be checked that it is an isomorphism. $\square$
I found this statement in Varghese's article The automorphism group of the universal Coxeter group. In the sequel, I work with $\mathrm{Aut}(W_3)$ instead of $\mathrm{Aut}(\mathbb{F}_2)$, but it is just because I am more confortable with it. As the isomorphism above is completely explicit, you can translate everything in $\mathrm{Aut}(\mathbb{F}_2)$ if you want.
Proposition: $\mathrm{Aut}(W_3)$ is not hyperbolic relative to proper subgroups.
Proof. Fix a basis $\{a,b,c\}$ of $W_3$. For every $g \in W_3$, let $\iota_g$ denote the inner automorphism given by the conjugation by $g$. Also, set
$$\kappa_1 : \left\{ \begin{array}{ccc} a & \mapsto & a \\ b & \mapsto & b \\ c & \mapsto & c^{ab} \end{array} \right. \text{ and } \kappa_2 : \left\{ \begin{array}{ccc} a & \mapsto & a^{cb} \\ b & \mapsto & b \\ c & \mapsto & c \end{array} \right..$$
They are partial conjugations with infinite-order images in $\mathrm{Out}(W_3)$. (I use the notation $g^h=hgh^{-1}$.) Finally, set
$$\varphi := \iota_{ab} \circ \kappa_1, \ \psi := \iota_b \circ \varphi \circ \iota_b, \text{ and } \xi := \iota_{cb} \circ \kappa_2.$$
The key observation is that $\varphi$ (resp. $\psi$, $\xi$) fixes $ab$ and $bcb$ (resp. $ab$ and $c$, $bc$ and $bab$). As a consequence, the subgroups
$$\begin{array}{l} A:= \langle \iota_{ab}, \iota_{bcb}, \varphi \rangle \\ B:= \langle \iota_{ab}, \iota_c, \psi \rangle \\ C:=\langle \iota_{bc}, \iota_{bab}, \xi \rangle \end{array}$$
split as direct products between a(n infinite) virtually free group (namely, the part in the inner subgroup) and an infinite cyclic group. This implies that, if we assume that $\mathrm{Aut}(W_3)$ is hyperbolic relative to some collection of subgroups $\mathcal{P}$, then there exist $I,J,K \in \mathcal{P}$ such that $A \subset I$, $B \subset J$, and $C \subset K$. Now, we can conclude because $\mathcal{P}$ must be an almost malnormal collection of subgroups. Indeed:

*

*Because $I \cap J \supset \langle \iota_{ab} \rangle$, necessarily $I=J$.

*This implies that $J \supset \langle \iota_{ab}, \iota_{bcb}, \iota_c \rangle \supset \langle \iota_{(bc)^2} \rangle$, hence $J \cap K \supset \langle \iota_{(bc)^2} \rangle$, and finally $J=K$.

*Thus, $I=J=K$ contains $\langle \iota_{ab} , \iota_{bcb}, \iota_{c}, \iota_{bc}, \iota_{bab} \rangle= \mathrm{Inn}(W_3)$.

*Finally, from the fact that $\mathrm{Inn}(W_3)$ is a normal subgroup in $\mathrm{Aut}(W_3)$, we conclude that $I= \mathrm{Aut}(W_3)$.

Thus, we have proved that $\mathcal{P}$ must contain a subgroup that is not proper. $\square$

A: The group $\mathrm{Aut}(F_2)$ is not relatively hyperbolic.  This is contained in (the proof of) Theorem 8.1 of Behrstock-Drutu-Mosher.
We first pass to $\mathrm{Aut}^+(F_2)$, the preimage of $\mathrm{SL}(2, \mathbb{Z})$.  By Remark 7.2 of Behrstock-Drutu-Mosher it is enough to consider this index two subgroup.
Let $S$ be a copy of the two-torus. Let $Z = \{x, y\} \subset S$ be a pair of points.  We now define two mapping class groups.  There is $\Gamma = \mathrm{MCG}(S, Z)$ where $Z$ is fixed setwise.  This is the usual mapping class group of (isotopy classes of) orientation preserving homeomorphisms.  The pure mapping classes are those that fix the elements of $Z$ pointwise.  We denote this index two subgroup by $\Gamma' = \mathrm{PMCG}(S, Z)$.
The point-erasing map (where we erase $y$, say) gives a homomorphism
$$
\beta : \Gamma' \to \mathrm{MCG}(S, \{x\}) \cong \mathrm{MCG}(S) \cong \mathrm{SL}(2, \mathbb{Z})
$$
The kernel of $\beta$ is isomorphic to $\pi_1(S - \{x\}, y) \cong F_2$. This gives the Birman short exact sequence
$$
1 \to F_2 \to \Gamma' \to \mathrm{SL}(2, \mathbb{Z}) \to 1
$$
It also (with a bit of work) gives an isomorphism between $\Gamma'$ and $\mathrm{Aut}^+(F_2)$.
We now appeal to (the proof of) Theorem 8.1 of Behrstock-Drutu-Mosher. They show that $\Gamma'$ is thick of order one, and thus not relatively hyperbolic. The proof uses the connectedness of the curve complex (Harvey) and the fact that axes of pseudo-Anosov maps are Morse (Behrstock's thesis).


text:
Q: How to recover lost commit in git? I am new to git/github and have started using it recently.
I have a project in git that has a few commits, however , I forced a push into git using git push -f origin master and now, i have lost all previous commits and only have one that was pushed recently.
How do i retrieve restore my project to previous state in git?
Things that I have done:
git reflog (This doesn't give me previous commit details)

213bcde HEAD@{0}: revert: Revert "V3 files" cb24c10 HEAD@{1}: reset:
  moving to HEAD cb24c10 HEAD@{2}: reset: moving to
  cb24c103e6c0400760a20098a2baceb0601bb858 cb24c10 HEAD@{3}: checkout:
  moving from master to master cb24c10
  HEAD@{4}: commit (initial): V3> files

I need to get to a commit beyond cb24c10 head@{4}: commit (initial): V3 files
git revert HEAD --no-edit
git show
 This shows details only of the current commit SHA
git fsck --no-reflogs
This provides me a dangling blob and I am not sure if this is a reference to my old commit

Checking object directories: 100% (256/256), done. dangling blob
  e6a2438a4750e9cda68ce2d916c1b8a65dcc5384

Please can someone assist in letting me know next steps to restore my project to previous state.
Unfortunately, I haven't closed my terminal window and I can have the SHA of previous commit b0b7eba. How do I restore to this state?
git push -f origin master
Delta compression using up to 4 threads.
Writing objects: 100% (507/507), 13.55 MiB | 7.17 MiB/s, done.
Total 507 (delta 109), reused 0 (delta 0)
remote: Resolving deltas: 100% (109/109), done.
To https:http://.filename.git
 + b0b7eba...cb24c10 master -> master (forced update)

A: UPDATE PER NEW INFO IN THE QUESITON
Given the original commit SHA1 of b0b7eba at least lets us try some things.
For starters,
git checkout b0b7eba

As noted below, if this is a newer clone, the command will fail.  But if it doesn't fail, you're in great shape.
git branch -f master
git push -f

If it fails (and if you don't have an older repo to try with), we're again back to github; but at least we know what to tell github we want.  Again I have to plead ignorance about the specific steps to use (since I don't really do much github), but you should be able to navigate to the specific commit (which almost surely will still exist there) and then either...

*

*tag it, then pull, then checkout the tag, then branch -f master, then push -f

*create a branch on it, ...

*just move the master branch to it via the web API

ORIGINAL REPLY
So one thing to know: if you don't have a local repo that was created before the force push, this isn't going to be easy.
You mention trying reflogs, but it sounds like you're saying they don't go back far enough.  Now maybe that's because the older reflogs have expired, but unless you've configured things in an unusual way I doubt it.  So I wonder if you've been trying to fix this using a clone that was created after the force push; because the thing is, the reflog is local to only a single clone of the repo.  So any clone created after the force push can't possibly have a useful reflog entry.  If you have the clone that was used for the force push, that's the best thing to use.
Similarly, you mention finding a single dangling blob.  A blob is content for an individual file; the object type you want to find is COMMIT.  The fact that no dangling commits are shown again suggests that the clone was created after the force push (because at that point the commits you want were unreachable and would not be included in the pack used to initialize new clones).
(Still, if you're curious about the object you can do
git cat-file -p e6a2438a4

and see what it is.)
A force push is a history rewrite, and revert can't help with that.  (It only undoes changes within a commit as understood in current history.)
Your best bet is to go into the repo from which the force push was done and check its reflog.  If that's a no-go, you're at the mercy of github's API (which I don't know as much about); it seems there might be useful advice here: https://objectpartners.com/2014/02/11/recovering-a-commit-from-githubs-reflog/


text:
Q: how to fetch data from sqlite by name I just started learning of android and come to section of Database and I inserted same record in it but now I want to fetch data from database only by name and display it in textview.
Help me
Thank You in advance

A: Please follow developer document.
https://developer.android.com/training/basics/data-storage/databases.html
SQLiteDatabase db = mDbHelper.getReadableDatabase();

  // Define a projection that specifies which columns from the database
  // you will actually use after this query.
String[] projection = {
FeedEntry._ID,
FeedEntry.COLUMN_NAME_TITLE,
FeedEntry.COLUMN_NAME_SUBTITLE
};

// Filter results WHERE "title" = 'My Title'
String selection = FeedEntry.COLUMN_NAME_TITLE + " = ?";
String[] selectionArgs = { "My Title" };

// How you want the results sorted in the resulting Cursor
String sortOrder =
FeedEntry.COLUMN_NAME_SUBTITLE + " DESC";

Cursor cursor = db.query(
FeedEntry.TABLE_NAME,                     // The table to query
projection,                               // The columns to return
selection,                                // The columns for the WHERE clause
selectionArgs,                            // The values for the WHERE clause
null,                                     // don't group the rows
null,                                     // don't filter by row groups
sortOrder                                 // The sort order
);

A: You access data by using a query which returns a Cursor.
A Cursor is like a spreadsheet table that contains columns and rows.
You tell the query what columns you want and imply the rows that will be returned via an optional WHERE statement.
The simplest of queries is base upon the SQL SELECT * FROM <table>;. This will select all columns (i.e. * means all columns) from the table as specified by <table> ( where  would be replaced by a valid table name).
If you want specific columns then ***`` should be replaced with a comma delimited list e.g.SELECT name, address FROM would return a **Cursor** containing all the rows from the table with only the **name** and **address** columns from the table specified by`.
If you want to filter the rows returned then you can add a WHERE clause. e.g. SELECT name,address FROM <table> WHERE name = 'Fred', would return a Cursor containing only the rows that have Fred as the name column with only the name and address columns.
You cannot just type the SQL statments you need to either use the SQLiteDatabase rawQuery or query methods if you need to return a cursor.
Using rawQuery
rawQuery takes two parameters, the first being the SQL as a string, the second optional arguments (not covered here, so null will be used).
To obtain a Cursor with columns name and address and with only rows that have Fred you could use, assuming the table is called mytable :-
`Cursor mycursor = db.rawQuery("SELECT name,address FROM mytable WHERE name = 'Fred'";);`

where db is an instance of an SQLiteDatabase object.
However, rawQuery is not recommended as it is open SQL injection. rather it is recommended only for situations where it has to be used.
Using query
query has a number of overload variations as can be found here SQLiteDatabase.
For this example query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy) will be used.

*

*String table, is the name of the table to be queried.

*String[] columns, is an array of column names.

*String selection is the where clause (null for no where clause).

*String[] selectionArgs is an array of arguments that replace the ? placeholder.

*The rest of the parameters will be null as these are features that are not being utilised.

As such the code could be :-
        String tablename = "mytable";
        String[] columns = {"name", "address"};
        String whereclause = "name=?"; //note use of placeholder ?
        String[] whereargs = {"Fred"};
        Cursor mycursor = db.query(tablename,
                columns,
                whereclause,
                whereargs,
                null,null,null
        );

where db is an instance of an SQLiteDatabase object.
Accessing the Cursor
mycursor contains the data or perhaps not if there isn't a column with the name Fred.
The number of rows in the cursor can be obtained by using:-
    int rowsincursor = mycursor.getCount();
Note! A returned Cursor will not be null. (a very common mistake)
To access the data you have to move through the Cursor. Initially the Cursor is before the first row. If you only expect or want the only/first row then you can use the Cursor moveToFirst method.
See Cursor for more move... methods etc
Once the Cursor is appropriately positioned you can use Cursor get methods to get the data. e.g. getString(int columnindex) will return the data as a String. columnindex is a 0 based offset of the column to be accessed. Using the Cursor's getColumnIndex(String columnname) can be used to eliminate errors made by miscalculating offsets.
As such the following could be used to set a TextView (note intentionally over cautious)
        if (mycursor.getCCount() > 0) {
            if (mycursor.moveToFirst()) {
                mytextview.setText(mycursor.getString(mycursor.getColumnIndex("name")));
            }
        }
        mycursor.close() // You should always close a cursor when done with it.