text:
Q: Drawing free resolutions of Stanley-Reisner ideal I want to write LaTex code of the free resolution given in figure below. Is there any one who can assist me?

A: This is for the arrow in the middle, you should be able to make all the rest in the same fashion.
\documentclass{article}

%% needed packages
\usepackage{amsmath,mathtools}
\usepackage{blkarray}

%% abstract structures
\newsavebox{\smallblockbox}
\newenvironment{smallblockarray}
 {\begin{lrbox}{\smallblockbox}
  \scriptsize$\begin{blockarray}}
 {\end{blockarray}$\end{lrbox}%
  \raisebox{-1ex}[\dimexpr\height-2ex][\dimexpr\depth-1ex]{\usebox{\smallblockbox}}}

\newcommand{\module}[2]{%
  \underset{\mathclap{\begin{smallmatrix}\\#2\end{smallmatrix}}}{#1}%
}

\begin{document}

\[
\module{S_4}{00011\\11001\\10101\\11110}
\xleftarrow{
  \begin{smallblockarray}{rcccc}
  & abce & abde & acde & abcde \\
  \begin{block}{r[cccc]}
  de & 0 & -1 & -1 & -1 \\
  abc & 1 & 1 & 0 & 0 \\
  ace & -1 & 0 & 1 & 0 \\
  abcde & 0 & 0 & 0 & 1 \\
  \end{block}
  \end{smallblockarray}
}
\module{S_4}{11101\\11011\\10111\\11111}
\]

\end{document}


text:
Q: How to set min-height for bootstrap container I have some issues with the container in bootstrap. My goal is to have a container which is only as high as the content. For example:

In the example above, the container should be only as high as the image. However, even though I set min-height for the container via CSS to 0px, my browser automatically integrates a min-height of 594px in the element style. The source code in the browser looks like this:

But in the HTML file the style element is not defined. This occurs with Chrome as well as IE. Hence, the CSS code (min-height: 0px;) is being ignored.
CSS:
.container {
   padding-right: 15px;
   padding-left: 15px;
   margin-right: auto;
   margin-left: auto;
   max-width: 900px;
   overflow:hidden;
   min-height:0px;
}

Has anyone an idea on how I can fix this issue?

A: Two things are happening here.

*

*You are not using the container class properly.

*You are trying to override Bootstrap's CSS for the container class

Bootstrap uses a grid system and the .container class is defined in its own CSS.  The grid has to exist within a container class DIV.  The container DIV is just an indication to Bootstrap that the grid within has that parent.  Therefore, you cannot set the height of a container.
What you want to do is the following:

Here you can find more info on the Bootstrap grid system.
That being said, if you absolutely MUST override the Bootstrap CSS then I would try using the "!important" clause to my CSS definition as such...
.container {
   padding-right: 15px;
   padding-left: 15px;
   margin-right: auto;
   margin-left: auto;
   max-width: 900px;
   overflow:hidden;
   min-height:0px !important;
}

But I have always found that the "!important" clause just makes for messy CSS.

A: Usually, if you are using bootstrap you can do this to set a min-height of 100%.

this will also solve the footer not sticking at the bottom.
you can also do this from CSS with the following class
.stickDamnFooter{min-height: 100vh;}

if this class does not stick your footer just add position: fixed; to that same css class and you will not have this issue in a lifetime. Cheers.

A: Have you tried height: auto;  on your .container div?
Here is a fiddle, if you change img height, container height will adjust to it.
EDIT
So if you "can't" change the inline min-height, you can overwrite the inline style with an !important parameter. It's not the cleanest way, but it solves your problem.
add to your .containerclass this line
min-height:0px !important;
I've updated my fiddle to give you an example.

redpajama_set_name: RedPajamaStackExchange


text:
Q: File Upload in MVC3 I am implementing Multiple file upload in MVC3, I have implemented it successfully, now I have to insert values in database as well,In my Model class, I have a List, SO i was having problem in inserting in Database is that its inserting multiple entries, I have fixed this issue, now issue is arising that only first image is inserting in database.Below is my code
 public ActionResult CreateCard(FlashCardsModel model, IEnumerable<HttpPostedFileBase> files)
        {
            string path = "";
            string upath = ConfigurationManager.AppSettings["imgpath"];
            long SetId = 0;
            for (int i = 0; i < model.GroupIds[0].Split(',').Length; i++)
            {
                model.Visibleto = Convert.ToInt32(model.Privacy);
                var groupid = Convert.ToInt64(model.GroupIds[0].Split(',')[i]);
                SetId = Repository1.CreateSet(model.Title, model.Description, model.Visibleto, Convert.ToInt64(Session["uid"].ToString()), groupid);
                if (SetId != 0)
                {
                    foreach (var item in model.CardContent)
                    {
                        foreach (var file in files)
                        {
                            if (file != null && file.ContentLength > 0)
                            {
                                if (file.ContentLength > 0)
                                {
                                    var fileName = Path.GetFileName(file.FileName);
                                    if (IsImage(file.FileName.ToString()))
                                    {
                                        fileName = "FlashCard_Image_" + Session["uid"].ToString() + "_" + fileName;
                                        path = Path.Combine(Server.MapPath(upath), fileName);
                                        file.SaveAs(path);

                                        item.ImagePath = fileName;
                                        if (item.Answer != null && item.Term != null)
                                        {
                                            var savecontent = Repository1.AddCardContent(item.Term, item.Answer, item.ImagePath, SetId);
                                            break;//It breaks the loop but when it comes to foreach (var file in files) its taking first image each time
                                        }
                                    }
                                    else
                                    {
                                        TempData["Errors"] = "Only JPEG,GIF and PNG images are allowed";
                                        return View("CreateFlashCardSet", model);
                                    }
                                }
                            }

                        }
                    }
                }
            }

            TempData["Success"] = "Card Created Successfully";
            return View("CreateFlashCardSet", model);
        }

It breaking the loop but after breaking, when it comes to foreach (var file in files) its taking first image each time. How to handle this issue

A: First of all, I think you having wrong approach to save the data in database. You do not need to loop the list of files to save in database as you can send the files in XML format string to sql server and then in sql server you can insert the data using a single query. Suppose you have generated XML string like this in   c#:
string files=   "<files>
  <file>
     file1 path
  </file>
  <file>
     file2 path
  </file>
  <file>
      file3 path
  </file>
     .
     .
     .
   <file>
      file4 path
  </file>
</files>";

now in store procedure first declare an XML variable to hold this xml string and then write instert query like this:
@FileId int,
@FileNamesXML xml

      INSERT INTO tablename(FileId, FileName ) SELECT @FileId,FileList.value('.[1]', 'varchar(500)') AS FileNames
FROM @FileNamesXML.nodes('//FileNames/FileName') AS R(FileList)

With the above solution you can insert the whole list of files with just a single query without looping the list on server side.
Hope this will help you.


text:
Q: How does Port Number really work in TCP? https://serverfault.com/questions/296603/understanding-ports-how-do-multiple-browser-tabs-communicate-at-the-same-time
how can an application use port 80/HTTP without conflicting with browsers?
How do multiple clients connect simultaneously to one port, say 80, on a server?
I have read the above questions but it seems the answers are inconsistent.
I want to know what exactly defines a socket connection, is it:
(sockid, source ip, source port, dest ip, dest port)
or only:
(source ip, source port, dest ip, dest port)
Can two different processes (e.g, two different browsers) communicate with a web server on the same source port?  (the dest port would be the same by default)
What will happen in the case of different tabs in the same browser?
Also, as mentioned in one of the answers, a single web page can connect to multiple servers (e.g., ad servers) simultaneously. When connecting to multiple servers simultaneously, does the web browser (e.g., Chrome, Firefox) connect to each server using the same port, or does it use a different port for each server?

A: I know this is late, but since the thread is still on the internet, and because it's a common question with very few authoritative answers on the web, it deserves a more complete and concise explanation for those who may stumble into it, even at this late date.

*

*You open a browser to pull up a web site, let's say google.com. In the process of specifying the web site your computer will arbitrarily pick a port number to use as its "source port." The number will be above 49152 which is the beginning of the "Dynamic, Private, or ephemeral ports" but below 65535 which is the highest port number available. The chosen port number is associated with that browser "instance."

*Just for fun, you open a new tab on the browser and also type "google.com" on the url line. Your goal is to have two instances of google.com running because you're looking for different things. Your computer then chooses a second port number for that session, different from the "source" port it used for the first session. You could, in fact, do this many, many times, and each session will have a unique "source" port associated with each instance.

*Your packet goes out to google.com, and the destination port number in every instance will be port 80. Web servers "listen" on port 80 for incoming connection requests. For each session with google.com you've opened, the destination port, from the perspective of your computer, will always be port 80, but for each instance of connection to google.com on your browser or browsers, the source port will uniquely identify one specific tab on one browser instance, uniquely. This is how they are differentiated on your computer.

*google.com gets your first request. Its reply will specify port 80 as its source port. Here's where it gets interesting. Each query google.com received from you will be treated as a "socket," which is a combination of your IP address, and the specific port number associated with the process that contacted google.com. So, for instance we'll say your IP address is 165.40.30.12, and the source port number your computer used as its source port for four instances of communications with google.com (let's say four different tabs all opening google.com) were 61235, 62421, 58392, and 53925. These four "sockets" would then be 165.40.30.12:61235, 165.40.30.12:62421, 165.40.30.12:58392, and 165.40.30.12:53925. Each combination of "IP address:source port number" is unique, and google.com will treat each instance as unique. google.com responds to, and communicates with the "socket," that is, the combination of IP address and port.

*Your computer gets its responses from google.com, and sorts them out by what it receives as its destination "socket" which it parses out by port numbers, assigning the response from google.com to the appropriate browser window or tab, as appropriate. No problem from your end of things as you see the correct response in the correct window every time.

*"But," you're thinking, "what if someone else accidentally uses the same port number - let's say 61235 - as I've used for my source number? Doesn't this confuse google.com?" Not at all, because google.com is tracking "sockets" which are a combination of IP address and port number. Someone else, naturally, and we sincerely hope, is using a different IP address from the one you're using, let's say 152.126.11.27, and the combination of IP address and port number are unique - 152.126.11.27:61235 - differentiated by their different IP addresses, even though the port numbers are the same.

*It doesn't matter if google.com gets 1000 queries from 1000 users, all using port 80 as their destination port number (the port google.com is listening to for incoming communications) because each of those 1000 users will all have unique IP addresses. google.com tracks its clients by their unique - and they always have to be unique, don't they? - socket numbers consisting of their IP address and "source" port number. Even if every one of those 1000 clients somehow managed to use the same "source" port number (unlikely to the max), they would still have differing IP addresses, making their source "socket" unique among all of the others.

*This is all rather simple when you see it explained this way. It makes it clear that a web server can always listen on one port (80) and still differentiate from the various clients. It doesn't simply look at the IP address it received in the query - you'd think they should all be unique at first blush until you realize you could have more than one web page opened on that web server - but at the source port number, which in combination, make every query unique. I hope this is pretty clear. It's an elegant system when you think about it, yet simple once you understand it.

A: Taking your questions in turn:
A connection is defined by:
{ protocol, local IP, local port, remote IP, remote port }
(It's better to say local and remote rather than source and destination, because the local port is the source when you send, but the destination when you receive.)
The sockid is just a descriptor in the user process that maps to the connection in the kernel, just as a file descriptor maps to a file on disk that has been opened.
Two different processes cannot bind to the same local port. However, it's possible for two processes to use the same connection -- a socket descriptor can be inherited from a parent process to a child process, or the descriptor may be passed between processes using interprocess communications. The two processes would be using the same ports because they're actually sharing the same connection.
While the protocol allows use of the same local port when connecting to different remote servers or ports, most TCP stacks will not allow this. The API for binding a local port is the same whether you're using it for an outgoing connection or listening for an incoming connection, and the intention isn't specified until AFTER the port is bound. Since only one socket can listen on a particular port, the API simply refuses to allow multiple sockets to bind to a port (there's a special exception to this, but it's not relevant to this discussion). As a result, all outgoing connections will use different local ports. So when the browser opens multiple connections (either to the same or different web servers) they will have different local ports.

A:
I have read the above question on respective forum but I guess people
  there also do not agree with each other.

I see no disagreement in any of those concerning the matters you mention.

I want to know what exactly defines a socket Connection
( sockid , source ip , source port , dext ip , dest port )
or only
( source ip , source port , dext ip , dest port )

The latter. The former is a figment of imagination. It isn't mentioned in any of the threads you cite.

What I want to ask is that can two different processes like two
  different Browsers communicate with a web server on same source
  port.(Dest port would be same by default).

Not if they are at the same source IP. It would violate the identity definition stated above.

What in case of Different tabs in same browser.

Yes, because of connection pooling. If you are talking about separate connections, the answer is still no.

Also as mentioned in one of the answers a single web page tries to
  connect to many different servers like ad servers etc. So does Chrome
  or firefox for that matter connect with the same port to different
  servers or use a single port.

You are going to have to explain this. What is the difference between 'the same port' and 'a single port'? Not a real question.


text:
Q: HTTP ERROR 500 in PHP but syntax is correct I have the following code and a program is trying to access it but I get a 500 error. I checked the syntax and everything else was working perfectly fine.
One important thing to note is that a moved servers, and that's when I noticed this started happening but I cannot pint point on the issue.
Please note that I have changed business name, phone numbers, and emails for privacy.
<?php

require_once('PHPMailer-
master/class.phpmailer.php');

/**
* This section ensures that Twilio gets a response.
*/
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';

$dial_call_status = $_REQUEST['DialCallStatus'];
if($dial_call_status == "completed" || $dial_call_status == "answered"){

$email = new PHPMailer();
$email->From = 'info@somedomain.com';
$email->FromName = 'Business Name';
$email->Subject = "New number calling from
{$_REQUEST['From']}";
$email->Body = "The call comes from the following city {$_REQUEST['FromCity']}, {$_REQUEST['FromState']}. Mp3 attached.";
$email->AddAddress( 'user1@somedomain.com' , 'Mar');
$email->AddAddress( 'user2@somedomain.com' , 'Rol');
$email->AddAddress( 'user3@somedomain.com' , 'Vic');

$recordingUrl = @$_REQUEST['RecordingUrl'];
$duration = @$_REQUEST['Duration'];
$durationRecording = @$_REQUEST['RecordingDuration'];
$callerId = @$_REQUEST['From'].'.mp3';
$attachment_data = file_get_contents($recordingUrl);

$email->addStringAttachment($attachment_data,$callerId, 'base64',
'audio/mpeg3');

if ($durationRecording < 1.0) {
exit;
} else {
return $email->Send();
}

}else{
?>
<Response>
<Sms from="+1555555555" to="+18188888884">Mar didn't answer the call.</Sms>
<Sms from="+1555555555" to="+18188888886">Vic, someone is calling you.</Sms>
<Pause length="4"/>
<Dial timeout="8" record="true"
action="mail1.php">
    <Number url="whisper.xml">+18188888886</Number>
 </Dial>
 </Response>
 <?php
 }
 ?>

I also checked the syntax using
php -l mail.php

and it returned
no syntax errors detected in mail.php


text:
Q: Adding a route for a controller action I am implementing a like system in my rails app using David Celis gem called Recommendable. I've gotten everything to work in the console but I can't get the right routes and I'm getting the "No route matches [GET] "/categories/1/posts/1/like" error.
I have the following in my models:
class Category < ActiveRecord::Base
  has_many :posts, :dependent => :destroy
  extend FriendlyId
  friendly_id :name, use: :slugged
end

class Post < ActiveRecord::Base
  belongs_to :category
end

In my Post Controller I have:
class PostsController < ApplicationController
  before_filter :authenticate_user!
  before_filter :get_category
  def like
    @post = Post.find(params[:id])
    respond_to do |format|
      if current_user.like @post
      else
         flash[:error] = "Something went wrong! Please try again."
         redirect_to show_post_path(@category, @post)
      end
    end
  end
end

In my routes I have:
resources :categories do
    resources :posts do
      put :like, :on => :member
    end
end
match 'categories/:category_id/posts/:id', :to => 'posts#show', :as => 'show_post'

Can someone please point at my errors? I can get the PUT to work but I dont know where the GET error is coming from as I am trying to redirect back to the post if an error occurs when the user like's a certain post. Thank you in advance.
EDIT:
In my view I have:
- title "#{@post.class}"
%p#notice= notice

%p
  %b Title:
  = @post.title
%p
  %b Description:
  = @post.description
%p
  %b Likes:
  = @post.liked_by.count

= link_to 'Edit', edit_category_post_path(@post)
\|
= link_to 'Back', category_posts_path
\|
= link_to 'Like', like_category_post_path(@post)

A: Your route expects a PUT request, while you're issuing a GET request.
You'll need to either access your route via a button_to with :method => :put so that your app is issuing PUT requests (the correct solution), or change your route to use GET requests (the wrong way to make requests which modify state):
      get :like, :on => :member

A: Replace:
= link_to 'Like', like_category_post_path(@post)

with:
= link_to 'Like', like_category_post_path(@category, @post), method: :put

Or, as I like it:
= link_to 'Like', [@category, @post], method: :put

I think your like has to be:
def like
  @post = Post.find(params[:id])
  respond_to do |format|
    format.html do
      if current_user.like @post
        flash[:notice] = "It's ok, you liked it!"
        redirect_to :back
      else
         flash[:error] = "Something went wrong! Please try again."
         redirect_to show_post_path(@category, @post)
      end
    end
  end
end


text:
Q: This java mosquito keeps biting me- NoClassDefFoundError. Spray ! Spray ! Spray ! ..& Nothing happens I am trying to use a bunch of JAVA apps and I keep hitting this wall. I looked up and followed pretty much everything out there that could cure it. But this is a JAVA super bug mosquito. Pl tell what is happening
    C:\Users\Administrator>java -version
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

C:\Users\Administrator>where java
C:\Program Files\Java\jdk1.8.0_45\bin\java.exe

C:\Users\Administrator>echo %java_home%
C:\Program Files\Java\jdk1.8.0_45

C:\Users\Administrator>echo %path%
C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\WINDOWS LIVE;C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT SHARED\WINDOWS LIVE;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\
2\WINDOWSPOWERSHELL\V1.0\;;C:\PROGRAM FILES (X86)\INTEL\OPENCL SDK\2.0\BIN\X86;C:\PROGRAM FILES (X86)\INTEL\OPENCL SDK\2.0\BIN\X64;C:\PROGRAM FILES (X86)\COMMON
M FILES (X86)\WINDOWS LIVE\SHARED;C:\PROGRAM FILES (X86)\WINSCP\;C:\PROGRAMDATA\CHOCOLATEY\BIN;c:\Program Files\WIDCOMM\Bluetooth Software\;c:\Program Files\WID
ram Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Java\jdk1.8.0_45\bin

C:\Users\Administrator>echo %classpath%
C:\Program Files\Java\jdk1.8.0_45\lib

I also have JRE installed but I removed it from the PATH ( i.e. the bin dir of JRE as also that of Oracle's ) to make sure there is JUST one exe for Java.
I get this error in spite of that.
I am on windows 7

A: The problem was rt.jar needed for the java.lang.Object wasn't there in the lib dir.
My 32 bit JRE was working. Just 64 quit.  Transplanting RT.jar from x86 to x64 from lib did not work so I uninstalled and reinstalled JDK ( with JRE ) and it ran well.
The rt.jar got prolly removed by Trend AntiVirus scan


text:
Q: How should I set the value for my model using a select control when the bound model is a different type from my select option? I've been using AngularJS for a long time and have recently been diving into the new Angular and .NET Core.  With my new endeavor, I began learning the vast changes in Entity Framework Core.  One of the most impactful changes relates to many-to-many relationships.  Previously, you had the ability to hide the join table which aligned nicely with AngularJS, because the navigation property on the ngModel could be the same type as the option value.  Now that this is no longer a thing, we must find a means of converting from one entity to another.  Here's my models:
Transaction.cs
public class Transaction
{
    public int Id { get; set; }

    public DateTime Date { get; set; }

    public string AccountNumber { get; set; }

    public string Key { get; set; }

    public decimal Amount { get; set; }

    public string Description { get; set; }

    public virtual IList<CategoryTransaction> CategoryTransactions { get; set; }
}

Category.cs
public class Category
{
    public int Id { get; set; }

    public string Name { get; set; }

    public virtual IList<CategoryTransaction> CategoryTransactions { get; set; }
}

CategoryTransaction.cs
public class CategoryTransaction
{
    public int CategoryId { get; set; }

    public int TransactionId { get; set; }

    public virtual Category Category { get; set; }

    public virtual Transaction Transaction { get; set; }
}

I'm using TypeScript and have defined my models and my markup form looks like this:
<form>
  <mat-form-field>
    <mat-select [compareWith]="compareFn" placeholder="Categories" [(ngModel)]="testTransaction.categoryTransactions" multiple name="foo">
      <mat-option *ngFor="let category of categoryList" [value]="category">{{ category.name }}</mat-option>
    </mat-select>
  </mat-form-field>
</form>

and here is my compareFn:
compareFn(category: Category, categoryTransaction: CategoryTransaction) {
    return categoryTransaction && category ? categoryTransaction.categoryId === category.id : false;
}

I got here and started thinking: "How am I going to convert from Category to CategoryTransaction?  I was looking around for ways to sorta "hook into" the model setter event and create a CategoryTransaction object using the selected Category, but I haven't been able to find a means of hooking in.  Then I saw in a post that you could use JSON in the value attribute.  So I altered my markup and compare function to this:
<form>
  <mat-form-field>
    <mat-select [compareWith]="compareFn2" placeholder="Categories" [(ngModel)]="testTransaction.categoryTransactions" multiple name="foo">
      <mat-option *ngFor="let category of categoryList" [value]="{ categoryId: category.id, transactionId: 1 }">{{ category.name }}</mat-option>
    </mat-select>
  </mat-form-field>
</form>

and
compareFn2(c1: CategoryTransaction, c2: CategoryTransaction) {
    return c1 && c2 ? c1.categoryId === c2.categoryId : false;
}

It works, but I don't like it.  It feels messy/hackish and doesn't seem to fit into the "Angular Way" where we're working with objects.  I don't think the view should be where we convert values.  What I imagined I would be doing would be "new-ing up" a CategoryTransaction and setting the value or implementing some value converter.  Since I would be converting/setting the value in TypeScript, if my model changes, the TypeScript compiler would hopefully complain if I missed it.
So this seems like a common scenario (many-to-many) that people must've encountered with EF Core + Angular, but I'm having issues finding a good example.  Has anyone found a good way to handle this scenario or perhaps has a good example for overriding the ngModel value using a select control?
I'm using .NET Core 2.1, Angular 7.0.4, Material 7.0.4, and EF Core Sql Server 2.1.4.

A: Using the <mat-select> I decided to subscribe to the selectionChange event and see what it would provide me.
<form>
  <mat-form-field>
    <mat-select [compareWith]="compareFn" placeholder="Categories" [(ngModel)]="testTransaction.categoryTransactions" multiple name="foo" (selectionChange)="categoryChange($event, testTransaction)">
      <mat-option *ngFor="let category of categoryList" [value]="category">{{ category.name }}</mat-option>
    </mat-select>
  </mat-form-field>
</form>

I passed it the $event argument and the Transaction object.
// Respond to when the selection changes
categoryChange(event: MatSelectChange, transaction: Transaction) {
    // Rather than trying to manually detect what changed, just clear out all the options
    transaction.categoryTransactions = [];
    // Iterate through all the selected options
    for (var i: number = 0; i < event.value.length; i++) {
      // Add a new CategoryTransaction for each selected Category
      transaction.categoryTransactions.push({
        transactionId: transaction.id,
        categoryId: event.value[i].id
      });
    }
}

The $event object parameter passes all the selected Category objects and the Transaction parameter is the object that holds all the join table entries.  I was afraid that by changing the transaction.categoryTransactions which is bound to the ngModel I might be stuck in an infinite loop of the selectionChange event firing, but to my relief, that didn't turn out to be the case.


text:
Q: How do I check if a word is in sentence on C For example:
str = "I have a meeting"
word = "meet"
should give 0 since there is no such word
I tried strstr(str, word) but it checks for substring, so it gives 1 for this example

A: I assume that words are sequences of characters separated by blank characters.
You can use the function strstr but you need also to check that blanks precede and follow the found substring or that the returned pointer points to the beginning of the sentence or the found substring forms the tail of the sentence.
Here is a demonstration program that shows how such a function can be defined.
#include <stdio.h>
#include <string.h>
#include <ctype.h>

char * is_word_present( const char *sentence, const char *word )
{
    const char *p = NULL;

    size_t n = strlen( word );

    if ( n != 0 )
    {
        p = sentence;

        while ( ( p = strstr( p, word ) ) != NULL )
        {
            if ( ( p == sentence || isblank( ( unsigned char )p[-1] ) ) &&
                 ( p[n] == '\0'  || isblank( ( unsigned char )p[n]  ) ) )
            {
                break;
            }
            else
            {
                p += n;
            }
        }
    }

    return ( char * )p;
}

int main( void )
{
    char *p = is_word_present( "I have a meeting", "meet" );

    if ( p )
    {
        puts( "The word is present in the sentence" );
    }
    else
    {
        puts( "The word is not present in the sentence" );
    }

    p = is_word_present( "I meet you every day", "meet" );

    if ( p )
    {
        puts( "The word is present in the sentence" );
    }
    else
    {
        puts( "The word is not present in the sentence" );
    }

    return 0;
}

The program output is
The word is not present in the sentence
The word is present in the sentence


text:
Q: How to Increment a number in JS or jQuery? I need to increment a few different numbers in the same HTML ID every 24 hours.
So if one number is at 1 and the other is at 20 regardless of what the number it is must be incremented by 1.
As you can see I just need a way to increment any number in the HTML ID by +1 instead of changing the number to 1.
Here is my code

    Flower are on day (1)

    Fruiting Plants are on day (20)

JS
function theDate() {
    var initialDate = new Date(2017, 0, 19); // Dec 1st 2012
    var now = Date.now();
    var difference = now - initialDate;
    var millisecondsPerDay = 24 * 60 * 60 * 1000;
    var daysSince = Math.floor(difference / millisecondsPerDay);
    console.log(daysSince);
    function dateUpdate() {
        if(daysSince >=1) {
            console.log("True");

            // THIS IS WHERE I WANT CODE TO GO

        } else {
            console.log("false");
        }
    }
}

theDate();

A: Firstly you need class, Not id.
In a html page id can't be duplicate.
And increase the value of every elements using class.
// The .each() method is unnecessary here:
$( ".datePlus" ).each(function() {
  $( this ).html( parseInt($( this ).html()) + 1);
});

When this code will run, it will increase value by one in every element.

A: You can add +1 with this for loop of jquery

for(var i = 1;i<7;i++)
{
  $("#demo").append(i+"
");//just for testing
}

A: First, change id="datePlus" to class="datePlus".
Then use this function:
function theDate() {
    var initialDate = new Date(2017, 0, 19);
    var now = Date.now();
    var difference = now - initialDate;
    var millisecondsPerDay = 24 * 60 * 60 * 1000;
    var daysSince = Math.floor(difference / millisecondsPerDay);

    if(daysSince > 0) {
        $(".datePlus").each(function(){
            var $this = $(this);
            var number = parseInt($this.text());
            number = isNaN(number)? daysSince: number + daysSince;
            $this.text(number);
        });
    }
}

A: First, change the id pColor at one of your  elements, as ID must be unique identifiers. for example:

Flower are on day (1)

Fruiting Plants are on day (20)

then, you can take the specified elements:
 var number1 = $( "span#datePlus" ).text();
 number1 = parseInt(number1);
 var number2 = $("span#datePlus2").text();
 number2 = parseInt(number2);
 number1++;
 number2++;
 $("span#datePlus").text(number1);
 $("span#datePlus2").text(number2);


text:
Q: Kotlin - getPendingIntent with multiple flags syntax I'm trying to notify simple notification as in Java code
what is the syntax for this line in kotlin?
stackBuilder.getPendingIntent(0, PendingIntent.FLAG_ONE_SHOT | Intent.FLAG_ACTIVITY_NEW_TASK);

in kotlin, I can't use '|' for 2 flags, only like this:
stackBuilder.getPendingIntent(0,PendingIntent.FLAG_ONE_SHOT)

A: You can find the available bitwise operations in the official docs here. These are all infix functions that are spelled out in Kotlin instead of using special symbols.
In your case, you can do the following:
stackBuilder.getPendingIntent(0, PendingIntent.FLAG_ONE_SHOT or Intent.FLAG_ACTIVITY_NEW_TASK);


text:
Q: Libraries to Minimize differences between IE & Firefox are there any libraries out there to minimize the differences of the behavior between IE and firefox... or there is someways to achieve that....
if not then what things in HTML & CSS & JavaScript & jQuery i should be looking put for that can cause cross browser compatibility issues... my concerns are Firefox and IE

A: What kind of differences are you trying to avoid? If these are differences in CSS rendering, then there's little you can do if some instruction is interpreted differently by different browsers. As for difference in DOM objects etc, then jQuery or PrototypeJS should hide most of differences in DOM.

A: There's this:
http://code.google.com/p/ie7-js/
, which fixes some stuff in IE. Between that and using jQuery properly and being somewhat careful, I do not have many issues with IE.


text:
Q: I Can't style the size of my icons in Sencha Architect with html and css I was wondering why I can't seem to increase the size of my icon.
This is my config html:

in my stylesheet I'm doing this:
.fa-hand-o-up{
   color: white;
   font-size: 50px;
}

The color works but the font-size doesn't, can someone help me?

A: Try this

A: Try adding replace font-size: 50px line of your CSS by font-size: 50px !important

A: To increase Font Awesome icon size you can use "fa-2x", "fa-3x",... classes:

Font Awesome

A: Try this:
.fa.fa-hand-o-up {
  font-size: 50px !important;
}


text:
Q: How to apply a CSS3 grayscale filter on an entire webpage IE11 I'm trying to apply a CSS3 filter on an entire page, but somehow it is not working on IE11 (probably also IE10).
I went through this :
.grayscale {
    /* Firefox 10+, Firefox on Android */
    filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
    /* IE6-9 */
    filter: gray;
    /* Chrome 19+, Safari 6+, Safari 6+ iOS */
    -webkit-filter: grayscale(100%);
}

but it is not applying on every item of the page itself.
Plausibles solutions I found (but complex to integrate in the project) :

Create a specific SASS mixin, in order to add a specific theme to every color that applies on the website
@mixin theme-item($properties, $theming-properties) {
    & {
        @for $j from 1 through length($properties) {
            #{nth($properties, $j)} : nth($theming-properties, $j);
        }
    }
    .grayscale & {
        @for $j from 1 through length($properties) {
            #{nth($properties, $j)} : grayscale(nth($theming-properties, $j));
        }
    }
}

that is working like this for instance
li{
    @include theme-item(background, $white);
}

and results as
li {
    background: #fff;
}
.grayscale li {
    background: #fff;
}

Apply jQuery function that changes every CSS property that could have an hexadecimal color and change it in grayscale
var hexGrayscale = function(hex) {
    var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
    if(rgb) {
        rgb = {
            r: parseInt(rgb[1], 16),
            g: parseInt(rgb[2], 16),
            b: parseInt(rgb[3], 16)
        };
        var mono = parseInt((0.2125 * rgb.r) + (0.7154 * rgb.g) + (0.0721 * rgb.b), 10);
        return "#" + ((1 << 24) + (mono << 16) + (mono << 8) + mono).toString(16).slice(1);
    }
};

$('body *').each(function() {
    if($(this).css('background-color').length){
        $(this).css('background-color', hexGrayscale($(this).css('background-color')));
    }
    // ...and so on
});`

Quick and dirty, but less complex than changing everything in CSS(Sass)
Is there another workaround to make it without make this complex and dirty changes?


text:
Q: Recommended Setup for BigData Application I am currently working on a long term project that will need to support:

*

*Lots of fast Read/Write operations via RESTful Services

*An Analytics Engine continually reading and making sense of data

It is vital that the performance of the Analytics Engine not be affected by the volume of Reads/Writes coming from the API calls.
Because of that, I'm thinking that I may have to use a "front-end" database and some sort of "back-end" data warehouse. I would also need to have something like Elastic Search or Solr indexing the data stored in the data warehouse.
The Questions:

*

*Is this a Recommended Setup? What would the alternative be?

If so...

*I'm considering either Hive or Pig for the data-warehousing, and Elastic Search or Solr as a Search Engine. Which combination is known to work better together?

And finally...

*I'm seriously considering Cassandra as the "fron-end" database. What is the relation between Cassandra and Hadoop, and when/why should they be put to work together instead of having just Cassandra?

Please note, my intention is NOT to start a debate about which of these is better, but to understand how can they be put to work better more efficiently. If it makes any difference, the main code is being written in Scala and Java.
I truly appreciate your help. I'm basically learning as I go and all comments will be very helpful.
Thank you.

A: First let's talk about Cassandra
This is a NoSQL database with eventual consistency which basically means for you that different nodes into a Cassandra cluster may have different 'snapshots' of data in the case that there is an inter cluster communication/availability problem. The data eventually will be consistent however.
Since you consider it as a 'frontend' database what you need to understand is how you will model your data. Cassandra can take advantage of indexes however you still need to defined upfront your access pattern.
Normally there is no relation between Cassandra and Hadoop (except that both are written in Java) however the Datastax distribution (enterprise version) has Hadoop support directly from Cassandra.
As a general workflow you will read/write most current data (let's say - last 24 hours) from your 'small' database that enough performance (Cassandra has excellent support for it) and you would move anything older than X (older than 24 hours) to a 'long term storage' such as Hadoop where you can run all sort of Map Reduce etc.
In regards to the text search it really depends what you need - Elastic Search is sort of competition to Solr and reverse. You can see yourself how they compare here http://solr-vs-elasticsearch.com/

A: As for your third question,
I think Cassandra is more like a database to save data.
Hadoop is responsible to provide a compution model to let you analyze your large data in
Cassandra.
So it is very helpful to combine Cassandra with Hadoop.
Also have other ways you can consider, such as combine with mongo and hadoop,
for mongo has support mongo-connector between hadoop and it's data.
Also if you have some search requirements , you can also use solr,  directly generated index from mongo.


text:
Q: Virt-manager filesystem passthrough not working I'm new to the ubuntu/linux environment so I don't have a lot of knowledge before hand.
I'm currently trying to set up a filesystem passthrough between my host (Ubuntu 22.04 LTS) and my vm (Ubuntu 16.04 LTS). I tried setting it up by following a youtube link but when i tried to add a file to it the other party can not open the file (i.e when i add a text document from my vm, the host cannot open the file). how the filesystem passthrough is currently showing
This is the filesystem code that I am running on my vm:
<filesystem type="mount" accessmode="mapped">
  <source dir="/home/kkuma30/VIRTUAL_BOX"/>
  <target dir="/hostshare"/>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x09" function="0x0"/>
</filesystem>

One thing to note is in my virtual machine manager, there is no way to choose how to the type or mode in the filesystem passthrough. filesystem passthrough setting
Is there anyway to fix this? I am trying to emulate Ubuntu 16.04 to run FVCOM


text:
Q: AppleScript: How to extract section from string (based on defined characters)? Example:
set theText to "I ate an apple at 11:54 pm without the skin."
I would like theTime to be a string that contains the text: 11:54
So, I would like the opening text item delimiter to be at_ and the closing text item delimiter to be either _pm or _am, depending on which period exists in the string. (Note - Every instance of an underscore in this post is meant to represent a space because I am unable to represent a space in the Stack Exchange code formatting.)
The contents of theText will vary greatly. For example, it might be:
set theText to "I ate two navel oranges at 6:30 am with a glass of water."
But the time format will always remain constant. The time will always be preceded with an "at " and that "at " will always be the first instance of an "at " in the string. Similarly, the time will necessarily be followed by either " am" or " pm".

A: You can do it with pure AppleScript, even though the shell script method presented above is very nice:
set theText to "I ate an apple at 11:54 pm without the skin."
set the_colon_location to offset of ":" in theText
-- now we know where the colon is.
-- The Time is going to be on either side of it.
set the_starting_point to the_colon_location - 2
set the_ending_point to the_colon_location + 5
set the_time_string to characters the_starting_point thru the_ending_point of theText as string
-- in case the hour is not two digits, the first character will be a space
if character 1 of the_time_string is " " then
    set the_time_string to characters 2 thru -1 of the_time_string as string
end if
return the_time_string

A: Running the following AppleScript code in AppleScript Editor:
set theText to "I ate an apple at 11:54 pm without the skin."
set theTime to do shell script "awk -F ' at | am | pm ' '{print $2}'<<<" & quoted form of theText
log "The time was: " & theTime

set theText to "I ate two navel oranges at 6:30 am with a glass of water."
set theTime to do shell script "awk -F ' at | am | pm ' '{print $2}'<<<" & quoted form of theText
log "The time was: " & theTime

Produces the following output in the AppleScript Editor's Event Log:
tell current application
    do shell script "awk -F ' at | am | pm ' '{print $2}'<<<'I ate an apple at 11:54 pm without the skin.'"
        --> "11:54"
    (*The time was: 11:54*)
    do shell script "awk -F ' at | am | pm ' '{print $2}'<<<'I ate two navel oranges at 6:30 am with a glass of water.'"
        --> "6:30"
    (*The time was: 6:30*)
end tell

In the above examples I've defined the field separators (delimiters) in awk using the -F option as ' at | am | pm ' which equates to " at ", " am " and " pm " and it prints '{print $2}' what's between the field separators.
Note: The use of the log command is not necessary to the coding for the answer and is being used just to show what the value of theTime contains for the Event Log output aside from what's shown after -->, which is the result as normally shown in the Event Log.

Update: I wrote my original answer based on a literal interpretation in that when said, "So, I would like the opening text item delimiter to be at_ and the closing text item delimiter to be either _pm or _am", what was wanted was to literally use those as the delimiters. However, since a different solution using pure AppleScript code, in a separate answer, was presented, let me present a one-line AppleScript code solution that does the same thing the 8 lines of pure AppleScript code does and by focusing on the colon, but as as part of a RegEx representation of the time in hours and minutes.
set theTime to do shell script "awk 'match($0,/[0-9]{1,2}:[0-5][0-9]/) {print substr($0,RSTART,RLENGTH)}'<<<" & quoted form of theText

Running the following AppleScript code in AppleScript Editor:
set theText to "I ate an apple at 11:54 pm without the skin."
set theTime to do shell script "awk 'match($0,/[0-9]{1,2}:[0-5][0-9]/) {print substr($0,RSTART,RLENGTH)}'<<<" & quoted form of theText

set theText to "I ate two navel oranges at 6:30 am with a glass of water."
set theTime to do shell script "awk 'match($0,/[0-9]{1,2}:[0-5][0-9]/) {print substr($0,RSTART,RLENGTH)}'<<<" & quoted form of theText

Produces the following output in the AppleScript Editor's Event Log:
tell current application
    do shell script "awk 'match($0,/[0-9]{1,2}:[0-5][0-9]/) {print substr($0,RSTART,RLENGTH)}'<<<'I ate an apple at 11:54 pm without the skin.'"
            --> "11:54"
    do shell script "awk 'match($0,/[0-9]{1,2}:[0-5][0-9]/) {print substr($0,RSTART,RLENGTH)}'<<<'I ate two navel oranges at 6:30 am with a glass of water.'"
            --> "6:30"
end tell

As you can see, whether or not there are one to two numbers preceding the colon the RegEx matches and the awk program returns the desired match, of which being the time.
Personally, I'd choose to use this particular method over my original answer, as it's a better method under the circumstances, and or over the pure AppleScript code as I can't justify writing 8 lines of pure AppleScript code when a single line of regular AppleScript code produces the same results as the 8 lines do!


text:
Q: CodeIgniter select and display result in view I have the following simple code:
The model:
function get_last_ten_entries()
{
    $this->db->get('property');
}

controller:
public function load_recent()
{
    $data['info'] = $this->propertymodel->get_last_ten_entries();
    $this->load->view('load_property', $data);
}

view:
<?
echo $data['id'];
?>

This is not working. Am sure i am doing something wrong because the error shown says

A PHP Error was encountered
Severity: Notice
Message: Undefined variable: data
Filename: views/load_property.php
Line Number: 2

Property is a table in the database in which there is a field called id. what's going wrong?
Thank you all

A: To fix the error, you'll need to use $info in your view, rather than $data as your array indexes in your controller correspond to variables in your view.
$this->db->get('property') returns all rows in the table property, but your function name suggests that you are trying to get the last 10 entries. I suggest you read CodeIgniter's Active Record documentation for more information. You also need to return your query.
You need to generate results from you query. CodeIgniter's Query Results documentation provides useful information on how to use the results of your query. What you're trying to achieve is a bit vague but you code could look something like this:
Model
function get_last_ten_entries()
{
    return $this->db->get('property');  //Perform query (you'll need to update to select what you actually want from you database)
}

Controller
public function load_recent()
{
    $data['last_entries'] = $this->propertymodel->get_last_ten_entries();
    $this->load->view('load_property', $data);
}

View
foreach ($last_entries->result_array() as $entry)
{
   echo $entry['id'];
}

Or, if you rather use an object, instead of an array:
foreach ($last_entries->result() as $entry)
{
   echo $entry->id;
}

A: first of all, your function in model dosen't return anything. try this:
function get_last_ten_entries()
{
    $result = $this->db->get('property');
    return $result->result_array();
}

when you fix that, you will have variable $info available in your view because Codeigniter evaluates given array to distinct variables on load->view( $view, $givenarray);
example
$data['variable1'] = 'first var';
$data['array'] = array('id' => 1, 'name' => 'myname' );
$this->load-view('view', $data);

would let you use variables in view file as following
echo $variable1; // echoes 'first var';
echo $array['name']; // echoes myname


text:
Q: Eclipse, Github and Jenkins Integration Is there a way to trigger a Jenkins' job to build through Eclipse. For example, when creating new branch from imported Github project in Eclipse after this created branch was pushed and committed to the Github repository a Jenkins' job will automatically build.
So far I already tried Mylyn with Hudson/Jenkins connector, could you suggest more?


text:
Q: output shell command in php I would like to run a shell command that runs a process for a very long time, and outputs text while it is executing.  This command is run using nohup in the background.
I would like to launch this command in php using shell_exec, but I would like to know the best way to capture the output of this command while it is executing so that my php shows output while it is executing and does not wait indefinitely until the process terminates to show the output.
Example:
shell_exec(nohup ./program.sh &)


text:
Q: Adding a row to an SQL CE database? I've been trying to add a row to my SQL CE & nothing works I've tried many things I found here at SO or in other websites by googling but to no avail.
Below if the code I have at the moment.
It compiles and executes with no problem, but nothing is added to the table and no exception is thrown.
Could anyone please provide a solution for this ?
string conString = Properties.Settings.Default.TestConnectionString;

            using (SqlCeConnection connect = new SqlCeConnection(conString))
            {
                connect.Open();

                string text = "UsernameTest";
                string pass = "PasswordTest";

                using (SqlCeCommand command = new SqlCeCommand("insert into MyTable values (@Username, @Password)", connect))
                {
                    command.Parameters.AddWithValue("@Username", text);
                    command.Parameters.AddWithValue("@Password", pass);
                    command.ExecuteNonQuery();
                }
            }

Please do not comment about storing a password in plain text, this was just a test.


text:
Q: Is there a way to find out which wonders have already been built in Civilization 6? I'm playing Civilization 6 and I would like to see a list of completed world wonders.

A: In the Antarctic Late Summer Patch, March 2019, Firaxis added a Search functionality into the game. In the development videos it was stated that this functionality was being included within the base game as well, so purchasing Gathering Storm should not be required. Using this feature you should be able to search for a term like "Wonder" and in theory it will allow you to cycle through the ones that have been created. Worst case you could search for them by name.
This strategy was mentioned by Carl during the video as a practice that you could do prior to committing hammers to producing a wonder, you could check to see if someone else had already started it.
Also I think this might only apply to tiles that you have had previous visibility to, but I would have to double check that mechanic to be certain.


text:
Q: Optimizing VBA / Excel Macro Code (Finding Duplicates in Large Sheet) I haven't really ever coded in VBA or anything of the sort except short little things in VB done years ago. This is my attempt at writing some code that will search through a excel sheet database of client accounts and search for possible duplicate accounts. Sadly, on the machine that I need to run this on, it can only handle about 3,500 entries without crashing Excel. I contribute this to both my code being horribly unoptimized as-well as the machine being slow.
What can be done to optimize the following code, and what best practices in VBA should I use in the future?
'Essentially, this loops through each row in the sheet
'For each row, it loops through every row after it, searching for duplicates of itself (skipping over a rows that have previously been marked as duplicates)
'Duplicates are defined by entries that meet a 'threshhold' of similarity
'The threshhold is defined as the number '5', first and last names are each two points, address and email address are one point
'That means that in order for an entry to meet the thresshold, the first and last name must be the same, and it must also have either the same address or email
'When duplicates are found, the duplicate column is marked as 'Yes' for that row, and the first occurence column is marked with a number defining the row number where the account first appeared

Sub Main():
    Dim lNameCol, fNameCol, addressCol, emailCol, duplicateCol, fOccurenceCol As String

    'Defines the column letters for the various data fields
    lNameCol = "A"
    fNameCol = "B"
    addressCol = "C"
    emailCol = "D"
    duplicateCol = "E"   'The column where a entry/row will be marked as being a duplicate
    fOccurenceCol = "F"  'The column that contains the row number where a duplicate accounts first occurence was found

    Call Duplicates(lNameCol, fNameCol, addressCol, emailCol, duplicateCol, fOccurenceCol)
End Sub

'Gets number of rows in currently active sheet
Function RowCount():
    Application.ActiveSheet.UsedRange
    RowCount = Worksheets("Sheet1").UsedRange.Rows.Count
End Function

'Finds and labels duplicates
Sub Duplicates(ByVal lNameCol As String, ByVal fNameCol As String, ByVal addressCol As String, ByVal emailCol As String, ByVal duplicateCol As String, ByVal fOccurenceCol As String)
    Dim lRowCount As Integer
    lRowCount = RowCount()

    'Loops through each row in the sheet
    For i = 1 To lRowCount

        Dim duplicate, lastName, firstName, email, address As String

        'Sets these variables' values corresponding cell value in row 'i'
        'UCase capitilizes things to make entries case-insensitive
        duplicate = UCase(Range(duplicateCol & i).Value)
        lastName = UCase(Range(lNameCol & i).Value)
        firstName = UCase(Range(fNameCol & i).Value)
        email = UCase(Range(emailCol & i).Value)
        address = UCase(Range(addressCol & i).Value)

        'Checks to make sure row has not already been marked a duplicate, if it hasn't it continues
        If (StrComp(duplicate = "YES", vbTextCompare) = 1) Then

            'Loops through every row after the current row (row 'i')
            For n = (i + 1) To lRowCount

                'duplicateThreshold is an integer that defines the threshhold of similarity that rows need to have in order to be labeled a duplicate
                Dim duplicateThreshhold As Integer
                Dim lastName2, firstName2, email2, address2 As String

                duplicateThreshhold = 0

                'These are the entry variables for account entry at row 'n' being compared to the account entry at row 'i'
                lastName2 = UCase(Range(lNameCol & n).Value)
                firstName2 = UCase(Range(fNameCol & n).Value)
                email2 = UCase(Range(emailCol & n).Value)
                address2 = UCase(Range(addressCol & n).Value)

                'Adds 2 points to threshhold if first name is the same
                If lastName = lastName2 Then
                    duplicateThreshhold = duplicateThreshhold + 2

                End If

                'Adds 2 points to threshold if last name is the same
                If firstName = firstName2 Then
                    duplicateThreshhold = duplicateThreshhold + 2
                End If

                'The remaining two fields give 1 point each to the thresshold
                'As long as the sum of the points given by first and last name is always greater than half of the threshhold, first and last name will always be required

                If email = email2 Or address = address2 Then
                    duplicateThreshhold = duplicateThreshhold + 1
                End If

                If duplicateThreshhold > 4 Then
                   'Labels duplicate entries as duplicates
                    Range(duplicateCol & i).Value = "Yes"
                    Range(duplicateCol & n).Value = "Yes"

                   'Labels duplicate entries with the first occurence of that entry
                    Range(fOccurenceCol & i).Value = i 'Labels first occurence account's row number
                    Range(fOccurenceCol & n).Value = i

                End If

            Next
        End If
    Next

End Sub

A: Okay, so this is one of those problems that stuck in the back of my head, so I had to solve it (thanks a lot @RJGordon!). I ended up solving it two different ways - the first with nested loops and the second with hashed dictionaries. The second is a cleaner and faster algorithm, but I'll present both for thoroughness sake.
Nested Loops
As @JohnColeman pointed out, this method makes sense logically but scales terribly. It was easy enough to provide a list of all the duplicate rows for each record and has the advantage of tagging the first rows in the dataset. (The second solution below does not tag the initial record with the duplicates below, but you can solve for that as well if needed.)
Option Explicit

Sub test()
    MarkDuplicates ActiveSheet, 1, 2, 3, 4, 5, 6
End Sub

Sub MarkDuplicates(sh As Worksheet, lNameCol As Long, _
                   fNameCol As Long, addressCol As Long, _
                   emailCol As Long, duplicateCol As Long, _
                   fOccuranceCol As Long)
    Dim lastRow As Long
    Dim lastCol As Long
    Dim acctRange As Range
    Dim acctData As Variant
    Dim checkRow As Long
    Dim otherRow As Long
    Dim dupScore As Integer
    Dim dupList As String

    '--- determine the range of data and copy to a memory-based array
    lastRow = sh.Cells(sh.Rows.Count, "A").End(xlUp).Row
    lastCol = sh.Cells(1, sh.Columns.Count).End(xlToLeft).Column
    Set acctRange = sh.Range("A1").Resize(lastRow, lastCol)
    acctData = acctRange

    '--- nested loop to check each row against every other row
    For checkRow = 2 To lastRow
        dupList = ""
        For otherRow = 2 To lastRow
            dupScore = 0
            If otherRow <> checkRow Then
                If acctData(checkRow, lNameCol) = acctData(otherRow, lNameCol) Then
                    dupScore = dupScore + 2
                End If
                If acctData(checkRow, fNameCol) = acctData(otherRow, fNameCol) Then
                    dupScore = dupScore + 2
                End If
                If acctData(checkRow, addressCol) = acctData(otherRow, addressCol) Then
                    dupScore = dupScore + 1
                End If
                If acctData(checkRow, emailCol) = acctData(otherRow, emailCol) Then
                    dupScore = dupScore + 1
                End If
                If dupScore > 4 Then
                    dupList = dupList & otherRow & ","
                End If
            End If
        Next otherRow
        If Len(dupList) > 0 Then
            dupList = Left(dupList, Len(dupList) - 1)
            acctData(checkRow, duplicateCol) = "Yes"
            acctData(checkRow, fOccuranceCol) = dupList
        Else
            acctData(checkRow, duplicateCol) = ""
            acctData(checkRow, fOccuranceCol) = ""
        End If
    Next checkRow

    '--- copy the array back to the worksheet
    acctRange = acctData

    Set sh = Nothing
End Sub

Using Dictionaries
And I do mean dictionaries (plural). Because your duplicate score threshold can be reached with three different combinations of fields, your dictionary hash must test each combination. The dictionary key (hash) I've chosen is a concatenated string of the fields that, when tested, would indicate a duplicate record. This solution shows only a single loop with three dictionaries. If you wanted a list of all duplicate records found, then rewrite the code to create all three dictionaries in a single loop, then use a separate (not nested) loop to each record against each dictionary key and keep a running list of the dupes. (I kept it to a single loop for efficiency.)
Creating a single dictionary with a longer key (e.g. lastName+firstName+address+email) will cause you to have key collisions for records with duplicate ALL those fields, but you'll still have to find a way to test the other combinations. Someone far smarter than me may come up with a simpler way.
Option Explicit

Sub test()
    MarkDuplicates ActiveSheet, 1, 2, 3, 4, 5, 6
End Sub

Sub MarkDuplicates(sh As Worksheet, lNameCol As Long, _
                   fNameCol As Long, addressCol As Long, _
                   emailCol As Long, duplicateCol As Long, _
                   fOccuranceCol As Long)
    Dim lastRow As Long
    Dim lastCol As Long
    Dim acctRange As Range
    Dim acctData As Variant
    Dim acctDict1 As Dictionary
    Dim acctDict2 As Dictionary
    Dim acctDict3 As Dictionary
    Dim acctKey As String
    Dim checkRow As Long
    Dim otherRow As Long
    Dim dupScore As Integer
    Dim dupList As String

    '--- determine the range of data and copy to a memory-based array
    lastRow = sh.Cells(sh.Rows.Count, "A").End(xlUp).Row
    lastCol = sh.Cells(1, sh.Columns.Count).End(xlToLeft).Column
    Set acctRange = sh.Range("A1").Resize(lastRow, lastCol)
    acctData = acctRange

    Set acctDict1 = New Dictionary
    Set acctDict2 = New Dictionary
    Set acctDict3 = New Dictionary

    '--- build the initial dictionary
    '    for the key to trip as duplicate, there are three possible
    '    combinations to check, so we make three dictionaries and
    '    create keys as combinations of the fields
    For checkRow = 2 To lastRow
        '--- clear previous flags
        acctData(checkRow, duplicateCol) = ""
        acctData(checkRow, fOccuranceCol) = ""

        '--- dupe is lastname + firstname
        acctKey = acctData(checkRow, lNameCol) & acctData(checkRow, fNameCol)
        If Not acctDict1.Exists(acctKey) Then
            acctDict1.Add acctKey, checkRow
        ElseIf acctData(checkRow, duplicateCol) <> "Yes" Then
            acctData(checkRow, duplicateCol) = "Yes1"
            acctData(checkRow, fOccuranceCol) = acctDict1.Item(acctKey)
        End If

        '--- dupe is lastname + address + email
        acctKey = acctData(checkRow, lNameCol) & acctData(checkRow, addressCol) & _
                  acctData(checkRow, emailCol)
        If Not acctDict2.Exists(acctKey) Then
            acctDict2.Add acctKey, checkRow
        ElseIf acctData(checkRow, duplicateCol) <> "Yes" Then
            acctData(checkRow, duplicateCol) = "Yes2"
            acctData(checkRow, fOccuranceCol) = acctDict2.Item(acctKey)
        End If

        '--- dupe is firstname + address + email
        acctKey = acctData(checkRow, fNameCol) & acctData(checkRow, addressCol) & _
                  acctData(checkRow, emailCol)
        If Not acctDict3.Exists(acctKey) Then
            acctDict3.Add acctKey, checkRow
        ElseIf acctData(checkRow, duplicateCol) <> "Yes" Then
            acctData(checkRow, duplicateCol) = "Yes3"
            acctData(checkRow, fOccuranceCol) = acctDict3.Item(acctKey)
        End If
    Next checkRow

    '--- copy the array back to the worksheet
    acctRange = acctData

    Set sh = Nothing
End Sub


text:
Q: Seeking simple coding example for Axis webcam using Vapix I should probably ask at the official Axis developer forum, but it seems that several have tried that with no success.
Searching through Stack Overflow, I find a few references to Axis cameras and the Vapix API which is a fairly simple-looking HTTP interface - for instance this question - so hopefully someone reading this site will be able to help.
The interface looks quite straightforward, but when I execute a GET using JQuery I always end up getting 401 not authorized.
I can't find anything in the available documentation to cover authorization - do I login once, or must I supply user name & password params on each request? (I tried that & it still 401ed)
It seems that the simplest might be if someone can post a few lines of code doing something simple with an Axis (211W) webcam using the Vapix API and I can extrapolate form there.
Anyone? ...

A: You should have a look at the API VAPIX doc as it is quite exhaustive.
For example in bash, you can curl the API to get parameter values  :
COMMAND="http://$IP:$PORT/axis-cgi/admin/param.cgi?action=list&group=$PARAMETER_TO_GET"
VALUE=$(curl --silent --user "$USER:$PASS" "$COMMAND" | cut -d"=" -f2)

You can also transpose this to JQuery or whatever you need.
You only may have to adapt a bit the request, for example using this url format:
http://user:password@cam_ip:cam_port/your_command

Looking at the code of the camera http server, you'll retrieve this principle in javascript as well.
Note: Path depends on your model and firmware. (/admin is deprecated)

A: You probably need to set the user settings to allow anonymous viewer login and ptz control. On my camera (axis q6034-E) this is in the setup menu under"system options"


text:
Q: Viewport size in javascript I know this has been asked a million times, and there a million answers that are all the same and all wrong. I've been struggling to get the viewport size in javascript, in such a way that it works everywhere.
I've gotten as far as getting it to work on every browser, except Safari on iOS. I've tested with iOS 10,11,12 on several iPhones. This is a version of the most robust method I've come across thus far:
function getViewportSize() {
    return {
        width: Math.max(document.documentElement.clientWidth, window.innerWidth || 0),
        height: Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
    };
}

However, document.documentElement.clientHeight and window.innerHeight on iOS both return the height of the document, not the height of the viewport. So if the document is longer, they'll return that. They do (both) return the viewport height as long as the page is shorter than the viewport. In a nutshell, both appear to do Max(viewport height, document height).
I've created a pen that will display every width/height property on every object that is somewhat sensible: https://codepen.io/thany-madeinjapan/pen/xBQwNX Just add more text and you'll see the two properties mentioned will happily grow with the document, i.e. they do not reflect the viewport height. The width has the same problem - disable wordwrapping to see it happening. The question is: what is the definitive method of getting the viewport width/height?


text:
Q: JobTask for file monitor in a folder I am working on C#.Net Windows Service Application which will send a pdf file to a printer.  Pdf files are received from a third party fax service. As soon as fax drops the pdf files, we
need to take a print out.
How to achieve by tracking the recent pdf file and sending them to the printer.

A: Use FileSystemWatcher to monitor the folder.
public void Main()
{
    FileSystemWatcher watcher = new FileSystemWatcher();
    watcher.Path = @"C:\MyPath";
    watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
           | NotifyFilters.FileName | NotifyFilters.DirectoryName;
    watcher.Filter = "*.pdf";

    watcher.Created += new FileSystemEventHandler(OnCreated);
}

private static void OnCreated(object source, FileSystemEventArgs e)
{
    //Do something
}


text:
Q: Differnce between scorm 2004 2nd and 3rd edition I am in need of a detailed difference between scorm 2004 2nd and 3rd. Can anybody point me to some good references?

A: Here is a good reference on the evolution of SCORM.
SCORM 2004 3rd Edition is mostly a tightening of 2nd Edition to clarify some ambiguities that were discovered as people started using SCORM 2004. The big addition is some requirements around the user interface that the LMS must provide. Overall, 3rd Edition is much stabler than 2nd Edition (and 4th Edition is stabler still).
ADL published a comprehensive listing of the changes between 2nd and 3rd Editions as an "Impact Summary" document. It contains 41 pages detailing every last change between the two Editions. Enjoy!


text:
Q: Why is this not creating a properties file? I am trying to make a properties file in Java. Sadly, when I startup Minecraft (As this is a mod in Forge) the file is not created. I will be so thankful to anyone who helps me. Here is the code:
package mymod.properties;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

public class WriteToProperties {

public static void main(String[] args) {

    Properties prop = new Properties();
    try {
        prop.setProperty("Test", "Yay");

        prop.store(new FileOutputStream("Test.properties"), null);

    } catch (IOException ex) {
        ex.printStackTrace();
    }

}

}

A: Basically what you want is initialize(event.getSuggestedConfigurationFile());
Forge basically wishes to hand you the default settings to you. I also suggest you structure things logically, so it's nice, clean and accessible later on, and easier to manage.
I use this as a config loader
package tschallacka.magiccookies.init;

import java.io.File;

import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import tschallacka.magiccookies.MagicCookies;
import tschallacka.magiccookies.api.ModHooks;
import tschallacka.magiccookies.api.Preferences;

public class ConfigLoader {
    public static Configuration config;
    public static final String CATEGORY_GENERAL = "GeneralSettings";
    public static final String CATEGORY_SERVER = "ServerPerformance";
    public static void init(FMLPreInitializationEvent event) {
        ModHooks.MODID = MagicCookies.MODID;
        ModHooks.MODNAME = MagicCookies.MODNAME;
        ModHooks.VERSION = MagicCookies.VERSION;
        try {
            initialize(event.getSuggestedConfigurationFile());
        }
        catch (Exception e) {
            MagicCookies.log.error("MagicCookie failed to load preferences. Reverting to default");
        }
        finally {
            if (config != null) {
                save();
            }
        }
    }
    private static void initialize(final File file) {
        config = new Configuration(file);
        config.addCustomCategoryComment(CATEGORY_GENERAL, "General Settings");
        config.addCustomCategoryComment(CATEGORY_SERVER, "Server  performance settings");
        Preferences.magicCookieIsLoaded = true;
        config.load();
        syncConfigurable();
    }
    private static void save() {
        config.save();
    }
    private static void syncConfigurable() {

        final Property awesomeMod = config.get(Configuration.CATEGORY_GENERAL, "awesome_mod", Preferences.awesomeMod);
        awesomeMod.comment = "Set this to yes if you think this mod is awesome, maybe it will at some time unlock a special thing.... or not... but that's only for people who think this is an wesome Mod ;-)";
        Preferences.awesomeMod = awesomeMod.getString();

        final Property numberOfBlocksPlacingPerTickByStripper = config.get(CATEGORY_SERVER,"number_of_blocks_placing_per_tick_by_stripper",Preferences.numberOfBlocksPlacingPerTickByStripper);
        numberOfBlocksPlacingPerTickByStripper.comment = "This affects how many blocks will be placed per tick by the creative stripper tool per tick. The stripper tool will only place blocks if ticks are take less than 50ms. If you experience lag lower this number, if you don't experience lag and want faster copy pasting, make this number higher. For an awesome slowmo build of your caste set this to 1 ;-). Set to 0 to render everything in one go per chunk";
        Preferences.numberOfBlocksPlacingPerTickByStripper = numberOfBlocksPlacingPerTickByStripper.getInt();

        final Property averageTickTimeCalculationSpan = config.get(CATEGORY_SERVER,"number_of_ticks_used_for_average_time_per_tick_calculation",Preferences.averageTickTimeCalculationSpan);
        averageTickTimeCalculationSpan.comment = "This number is the number of tick execution times are added together to calculation an average. The higher number means less lag by some things like the strippers, but can also lead to longer execution times for the strippers. Basically if your server is always running behind on server ticks set this value to 1, to at least get some work done when your server is running under 50ms tickspeed";
        Preferences.averageTickTimeCalculationSpan = averageTickTimeCalculationSpan.getInt();

        final Property acceptableTickduration = config.get(CATEGORY_SERVER,"acceptable_tick_duration",Preferences.acceptableTickduration);
        acceptableTickduration.comment = "Define here what you see as acceptable tick speed where MagicCookies can do some of its magic. If average tick speed or current tick speed is higher than this value it won't perform some tasks to help manage server load.";
        Preferences.acceptableTickduration = (long)acceptableTickduration.getDouble();
    }
}

The value holder Preferences class.
This is purely so I can do Preferences.valuename everywhere.
package tschallacka.magiccookies.api;
/**
 * Here the preferences of MagicCookies will be stored
 * and kept after the config's are loaded.
 * @author Tschallacka
 *
 */
public class Preferences {
    public static boolean magicCookieIsLoaded = false;
    public static String awesomeMod = "Well?";
    public static boolean isLoadedThaumcraft = false;
    public static int numberOfBlocksPlacingPerTickByStripper = 0;
    public static int averageTickTimeCalculationSpan = 60;
    public static long acceptableTickduration = 50l;
    public static int darkShrineFrequency = 0;
    public static boolean darkShrineSpawnLogging = true;
    public static boolean entropyTempleSpawnLogging = true;
    public static int entropySize = 30;
}

In your main mod file:
@EventHandler
public void preInit(FMLPreInitializationEvent e) {
    MagicCookies.log.warn("Preinit starting");
    MinecraftForge.EVENT_BUS.register((Object)MagicCookies.instance);
    ConfigLoader.init(e);
}

And after that you can just fetch all your preferences from the Preferences class

A: This file was created in root of your project. If you want some specific path to save, create folder in root of your project like props and change path in FileOutputStream constructor to "props\\Test.properties"


text:
Q: What is a react way to do this? I have a pretty basic scenario where I have bunch of selectable/clickable elements and want to highlight the last selected/clicked. Here is my jquerish version of it where I add particular css class to the selected element and remove that class from its siblings. Is there any better way to do this with React ?
function Controls(props) {

    const getSiblings = (element) => {
        let siblings = [];
        if (!element.parentNode) {
            return siblings;
        }

        let sibling  = element.parentNode.firstChild;
        while (sibling) {
           if (sibling.nodeType === 1 && sibling !== element) {
               siblings.push(sibling);
           }
           sibling = sibling.nextSibling;
        }
        return siblings;
    };

    const handleClick = (event) => {
        event.target.classList.add("symbol-preview-selected");
        let siblings = getSiblings(event.target);
        siblings.map((e) => {
            e.classList.remove("symbol-preview-selected")
        });
    };

    return(

                Color:

                    {[...Array(10).keys()].map((i) => <div className={`symbol-preview symbol-`+i} onClick={handleClick} key={i.toString()}/>)}

    );
}

A: Put the clicked element index into state instead.
function Controls(props) {
    const [selectedIndex, setSelectedIndex] = useState(-1);
    const makeHandleClick = i => () => {
        setSelectedIndex(i);
    };
    return (

                Color:

                    {[...Array(10).keys()].map((i) => (

                    ))}

    );
}


text:
Q: Why is my Python test case failing in this coding challenge? Here is the problem:

Given a string, return the count of the number of times that a
  substring length 2 appears in the string and also as the last 2 chars
  of the string, so "hixxxhi" yields 1 (we won't count the end
  substring).
last2('hixxhi') → 1 last2('xaxxaxaxx') → 1 last2('axxxaaxx') → 2

My Solution::
def last2(str):
  excl_last2 = str[:-2];
  list_excl_last2=[];

  for i in range(len(excl_last2)-1):
    list_excl_last2.append(excl_last2[i:i+2]);
  count = 0;
  for i in list_excl_last2:
    if str[-2:] == i:
      count = count + 1;
  return count;

It passes for all test cases except the one which is if str = 'xxxx'. My program returns 1. The expected output is 2. Why does this happen?

A: You're removing the last two characters from the string before you scan it for matches. So excl_last2 = 'xx' in that test case, and there's only one match there.
You should just remove the last character, not the last two characters.
BTW, you shouldn't use the names of standard functions as your variable names. str and count are standard built-in functions
You can do the counting in the first loop, rather than constructing a list of substrings.
def last2(string):
  excl_last1 = string[:-1];
  last2 = string[-2:]
  ct = 0
  for i in range(len(excl_last2)-1):
    if excl_last2[i:i+2] == last2:
      ct += 1
  return ct

A: def last2(str):
  last2chars = str[len(str)-2:];
  count=0;
  for i in range(len(str)-2):
    if str[i:i+2]==last2chars:
      count = count + 1;
  return count;

The above code passed all test cases. Thanks to Barmar for his logical
explanation for the failing test case; as per suggestion I modified it, now it seems to pass all test cases.


text:
Q: Phonegap IOS8 Open Setting(Location) page I read that on IOS8 you can now open Setting page via this code.
 - (void)openSettings
    {
        BOOL canOpenSettings = (&UIApplicationOpenSettingsURLString != NULL);
        if (canOpenSettings) {
            NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
            [[UIApplication sharedApplication] openURL:url];
        }
    }

I am just wondering if there is any way to do it in Phonegap via those code?


text:
Q: sql_srv query using in AngularJS So, here I have a regular php query to database:
$sql="SELECT LastName, FirstName FROM Students";
$result=sqlsrv_query($conn, $sql);

What do i have to do to be able to use the result of query in AngularJS?

        {{ x.LastName }}
        {{ x.FirstName }}

A: Got an answer after consulting a friend of mine:
First, I had to store the result of query in array, like this:
$json=array();
do {
        while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
        $json[] = $row;
        }
} while ( sqlsrv_next_result($result) );

Then, I had to encode array as a JSON (thus the name of array):
$encoded=json_encode($json, true);

After that, a controller script was needed:

And then I was free to use it in Angular way:

             {{ x.LastName }}
             {{ x.FirstName }}


text:
Q: CakePHP: how to fetch data from the database based on created time I am making a facebook like website. For that I want to implement "long polling" to dynamically update users wall with new posts.
Here is a pseudo code for what I have planned
//when user first open my website
loadPostsNormally();
var lastTime = current_time;
function update(){
$.getJSON('/some_other_page_which_will_fetch_the_contents_created_after_lastTime_and_encode_it_to_json/'+lastTime,function(){
lastTime = current_time;
showNewPostsOnWall();
}

setInterval(update,2000);

Now the problem is with my page some_other_page_which_will_fetch_the_contents_created_after_lastTime_and_encode_it_to_json
public function some_other_page_which_will_fetch_the_contents_created_after_lastTime_and_encode_it_to_json($timestamp){
    //fetch_all_data_created_after_this_timestamp_but_how ??
}

I want to fetch from my Post model and the time in my 'created' field of posts table is like 2014-11-19 22:34:09
Sorry for using a very layman language to describe the problem. I used that because I have not yet started it and I'm only making a plan to approach that problem in my head.

A: o just fetch data , it's simple just use conditions :
$results = $this->Model->find('all',array(
                            'conditions'=>array('Model.date_creation >'=>  '2014-11-20'),
                            'recursive'=>1)
                    );

A: How to fetch data based on a time interval?
So you have the $start and the $end.
$start = '1800-01-01 00:00:00' //Januuary 1, 1800 or whatever you choose
$end = date('Y-m-d H:i:s'); // Now

SELECT *
FROM `Posts` p
WHERE (
p.data_created
BETWEEN $start
AND $end
)

Sweet! Now you can fetch all day long.


text:
Q: Tricky Differential Equations Questions I am self studying differential equations, and ran into some problems I have never seen before.
The majority of problems I have solved have come int the form of $Ay''-by'+C = 0$. I clearly understand how to solve these, and arrive at the general solutions.
However, I am now encountering a problem like
$2t^2y''-5ty'+6y = 0$ where they give a solution $y(t) = t^\frac32)$.
Does this now mean I have to work backwards from before since we already have a solution given to us?
Likewise, how does the general form look different in the case when
$2t^2y'' - 5ty' + 6t = t^2 - 1$. I know this revolves around methods of undetermined coefficients, and have guessed $Ax^2+Bx+C$ and have differentiating it twice over for y'' and once over for y', but I still haven't organized my work together to arrive at a general solution.
Thank you

A: Hint: The differential equation
$$2t^2y''-5ty'+6y = 0$$
or
$$4t^2y''-10ty'+12y = 0$$
known as Euler differential equation, which can be solved with substitution $x=\ln2t$. In this case when the right side is zero, the differential equation
$$(at)^2y''+paty'+qy = 0$$
is homogeneous and with $x=\ln at$ is converted to
$$y''+\left(\dfrac{p}{a}-1\right)y'+\dfrac{p}{a^2}y = 0$$
then with characteristic equation
$$\lambda^2+\left(\dfrac{p}{a}-1\right)\lambda+\dfrac{p}{a^2}=0$$
we may find it's general solution.

Edit:
After substitution $x=\ln 2t$, your equation is
$$y''-\dfrac72y'+3y=2e^{2x}-2\tag{*}$$
from characteristic equation, the general solution is
$$y_g=C_1e^{2x}+C_2e^{\frac32x}$$
and while the right side of equation (*) has item $e^{2x}$ which is one of the general solutions, then let $y=Axe^{2x}+B$ to find particular solution with undetermined coefficient method. After $A$ and $B$ were found, put $x=\ln 2t$ and return main independent variable. One may find further examples here.

A: I think that it's informative to look at degrees, considering $t$ as raising the degree with one and $\frac{d}{dt}$ as lowering the degree with one. For all the terms in your differential equation you have as many $t$ factors as applications of $\frac{d}{dt}$ and the degree therefore remains unchanged. Even more important is that the degree changes in the same way for every term. This means that if the solution in some way can be written as a sum $y(t) = \sum_{\alpha \in A} c_\alpha t^\alpha$ then the differential equation works on each term separately. In this case you get $2t^2 y'' - 5ty' + 6y = \sum_{\alpha \in A} (2\alpha(\alpha-1)-5\alpha+6) c_\alpha t^\alpha.$ so for the differential equation to be satisfied you must have $(2\alpha(\alpha-1)-5\alpha+6) c_\alpha = 0,$ i.e. $2(\alpha-2)(\alpha-\frac32)c_\alpha=0.$ Thus $c_\alpha$ can only be nonzero for $\alpha=2$ and $\alpha=\frac32.$

A: This is an alternative route, but I think it is better to follow the answer by user 108128.  Rewrite the differential equation as
$$y''(t)-\frac{5}{2t}\,y'(t)+\frac{3}{t^2}\,y(t)=f(t)\,,$$
where $f$ is a source function.  (Note that $f\equiv 0$ in the homogeneous case, and $$f(t)=\frac{t^2-1}{2t^2}=\frac{1}{2}\left(1-\frac{1}{t^2}\right)$$ for the nonhomogeneous equation in question.)  Observe that $$\frac{\text{d}}{\text{d}t}\,\left(y'(t)-\frac{2}{t}\,y(t)\right)-\frac{1}{2t}\,\left(y'(t)-\frac{2}{t}\,y(t)\right)=f(t)\,.$$
Consequently,
$$\frac{\text{d}}{\text{d}t}\,\frac{1}{\sqrt{t}}\,\left(y'(t)-\frac{2}{t}\,y(t)\right)=\frac{1}{\sqrt{t}}\,f(t)\,.$$
Ergo,
$$y'(t)-\frac{2}{t}\,y(t)=\sqrt{t}\,F(t)\,,$$
where $\displaystyle F(t):=\int\,\frac{1}{\sqrt{t}}\,f(t)\,\text{d}t$.  Finally, we write
$$\frac{\text{d}}{\text{d}t}\,\left(\frac{1}{t^2}\,y(t)\right)=t^{-\frac{3}{2}}\,F(t)\,,$$
so that
$$y(t)=t^2\,\int\,t^{-\frac{3}{2}}\,F(t)\,\text{d}t\,.$$

To solve the homogeneous solution (i.e., with $f\equiv 0$, we have $F(t)=-\frac{1}{2}\,A$ for some constant $A$.  That is, $$y(t)=t^2\,\int\,\left(-\frac{1}{2}\,A\right)\,t^{-\frac{3}{2}}\,\text{d}t=t^2\,\left(A\,t^{-\frac{1}{2}}+B\right)=A\,t^{\frac{3}{2}}+B\,t^2\,,$$ for some constant $B$.  For the nonhomogeneous solution with $f(t)=\displaystyle\frac{1}{2}\,\left(1-\frac{1}{t^2}\right)$, we get $$F(t)=\int\,\frac{1}{2}\left(t^{-\frac{1}{2}}-t^{-\frac{5}{2}}\right)\,\text{d}t=t^{\frac{1}{2}}+\frac{1}{3}\,t^{-\frac{3}{2}}-\frac12\,a\,,$$ where $a$ is a constant.  That is,  $$y(t)=t^2\,\int\,t^{-\frac{3}{2}}\,\left(t^{\frac{1}{2}}+\frac{1}{3}\,t^{-\frac{3}{2}}-\frac12\,a\right)\,\text{d}t=t^2\,\left(\ln(t)-\frac{1}{6}t^{-2}+a\,t^{-\frac{1}{2}}+b\right)\,,$$ for some constant $b$.  Thus,  $$y(t)=t^2\,\ln(t)-\frac{1}{6}+a\,t^{\frac{3}{2}}+b\,t^2\,.$$

P.S.  You can also rewrite the differential equation as
$$\frac{\text{d}}{\text{d}t}\,\left(y'(t)-\frac{3}{2t}\,y(t)\right)-\frac{1}{t}\,\left(y'(t)-\frac{3}{2t}\,y(t)\right)=f(t)\,.$$
This leads to
$$y(t)=t^{\frac32}\,\int\,t^{-\frac{1}{2}}\,\tilde{F}(t)\,\text{d}t\,,$$
where $$\tilde{F}(t):=\int\,\frac{1}{t}\,f(t)\,\text{d}t\,.$$


text:
Q: How to pass service data into initial state in Redux I've got a service which works with my Products data in a shopping cart app.
What I want is to pass some data which is generated by the getProducts() method into initial state of my Redux part of the app.
My service:
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Http, HttpModule, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';

import 'rxjs/add/operator/map';

@Injectable()
export class ProductsService {

  private products = new BehaviorSubject<any>([]);

  product = this.products.asObservable();
  dataUrl = "./assets/products.json";

  constructor( private _http: Http ) { }

  getProducts(): Observable<any>{
    return this._http.get(this.dataUrl)
    .map((res: Response) => res.json());
  }

  updateProducts(product){
    this.products.next(product);
  }

}

My store:
import { IProduct } from './product';
import { ADD_PRODUCT, REMOVE_PRODUCT, REMOVE_ALL_PRODUCTS } from './actions';
import { ProductsService } from './service/products.service';

export class IAppState {
    products: IProduct[];
}

export const INITIAL_STATE: IAppState = {
    constructror(private _prods: ProductsService){ }
    products = this._prods.getProducts()
}

export function rootReducer(state, action){
    switch(action.type){
        case ADD_PRODUCT:
            action.product.id = state.products.length + 1;
            action.product.isAdded = true;
            console.log(state.products)
            return Object.assign({}, state, {
                products: state.products.concat(Object.assign({}, action.product))
            })

        case REMOVE_PRODUCT:
            action.product.isAdded = false;
            return Object.assign({}, state, {
                products: state.products.filter(p => p.id !== action.id)
            })

        case REMOVE_ALL_PRODUCTS:
            return Object.assign({}, state, {
                products:[]
            })
    }
    return state;
}

But compiler tells there's an error (Unexpected token) in
constructror(private _prods: ProductsService){ }

So how to pass the data from my service to the initial state correctly?

A: try this:
import {provideStore, INITIAL_STATE} from "@ngrx/store";

bootstrap(App, [
    provideStore({counter}),
    provide(INITIAL_STATE, {
      deps: [MyCounterService],
      useFactory(counterService){
       return {counter: service.getCounterValue()};
      }])
     });


text:
Q: listing same content on diffrent pages in MODX I am trying to add a small "3 box news segment". I wanted it, to be visible on multiple pages. Normally I would just use chunks but the thing is that I want to be able to modify "3 box segment" content and preferably with a ritch text. Any Ideas how to accomplish that?

A: You can use getResources to grab the content from 3 hidden resources this way you still keep your chunks for the segment layouts and your actual content is in the resources [which you can update with the rich text editor].

A: Instead of getResources you could also use getResourceField to get the value of a field or template variable on for example the homepage. This allows one place to manage it, and you can just reference it with getResourceField when you want it to show elsewhere.


text:
Q: Filtering ManyToMany Field in Django not working as expected I'm using the Django docs here as well as some previous StackOverflow questions to figure this out but I can't seem to get it working. My goal is to be able to filter models based on a ManyToManyField. I followed the Mozilla Django tutorial to get this far but it didn't filter by ManyToManyField (in my case, category), so I wanted to add that.
models.py
from django.conf import settings
from django.db import models
from django.utils import timezone

class Category(models.Model):
    name = models.CharField(max_length=200, help_text='Enter a category')

    def __str__(self):
        return self.name

class BakingPost(models.Model):
    author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    title = models.CharField(max_length=200)
    description = models.TextField(max_length=1000)
    created_date = models.DateTimeField(default=timezone.now)
    published_date = models.DateTimeField(blank=True, null=True)
    notes = models.TextField(max_length=1000, blank=True, null=True)
    ingredients = models.TextField(max_length=1000, blank=True, null=True)
    instructions = models.TextField(max_length=1000, blank=True, null=True)
    category = models.ManyToManyField(Category, help_text='Select a category')

    def publish(self):
        self.published_date = timezone.now()
        self.save()

    def __str__(self):
        return self.title

    def display_category(self):
        return ', '.join(category.name for category in self.category.all())

    display_category.short_description = "Category"

admin.py
from django.contrib import admin
from .models import BakingPost, Category

# admin.site.register(BakingPost)
# admin.site.register(Category)

@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    pass

@admin.register(BakingPost)
class BakingPostAdmin(admin.ModelAdmin):
    list_display = ('title', 'author', 'created_date', 'published_date', 'display_category')
    list_filter = ('created_date', 'published_date')  # i want to be able to filter by category here too

    def formfield_for_manytomany(self, db_field, request, **kwargs):
        if db_field.name == "category":
            kwargs["queryset"] = Category.objects.filter(name=request.user)
        return super().formfield_for_manytomany(db_field, request, **kwargs)

Without formfield_for_manytomany right above, editing a BakingPost in the admin section of Django works fine.

When I implement those 4 lines, all my values for the Category field disappear when trying to edit a BakingPost and it doesn't even give me a filter box.

A: The pattern you may be trying to follow (eg Django filter many to many field in admin?) is for trying to limit what choices of category are valid to assign in the admin when editing a BakingPost. If you're trying to add the many-to-many field to the admin's "what BakingPosts am I looking at" controls, that's different. To do that, you should just be able to add category to your admin's list_filter field, since in supports m2m fields by default.


text:
Q: How to detect if image is touched How can you detect if an image is touched in Xcode? I have looked at Apple documentation and it is really confusing...
I saw:
if (CGRectContainsPoint([imageView frame], location))

but my image still won't move. I tried using touchesBegan + touchesMoved, and set the image's userInteractionIsEnabled to YES, but it still won't detect it :(

EDIT: Thank you all so much for your great suggestions! In the end, I really wanted to make it as simple as possible, and I knew that my code should work, so I kept fiddling with it, and after a good night's sleep, I realized it was a fairly simple solution:
In my touchesMoved:
    UITouch *touch = [[event allTouches] anyObject];
    CGPoint location = [touch locationInView:touch.view];

    CGRect shapeRect = [imageView frame];
    CGRect dropSquareRect = [dropSquare frame];

    CGPoint touchLocation = CGPointMake(location.x, location.y);

    if (CGRectContainsPoint(shapeRect, touchLocation))
    {
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:.3];
        [imageView setCenter:touchLocation];
        [UIView commitAnimations];
    }

    if (CGRectIntersectsRect(shapeRect, dropSquareRect))
    {
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:.3];
        [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
        self.imageView.alpha = 0;
        self.imageView.center = CGPointMake(dropSquare.center.x, dropSquare.center.y);
        self.imageView.transform = CGAffineTransformMakeScale(0.8, 0.8);
        [UIView commitAnimations];

A: You could add a UIPanGesureRecognizer to the UIImageView that's holding the UIImage. This will allow you to detect when the user is panning on the image and move the images translation accordingly. The reference to the documentation is here.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPanGestureRecognizer_Class/Reference/Reference.html
It's nice using the gesture recognizers since it keeps the consistency with the rest of the OS as far as panning goes.
Hope this helps.

A: You need the touchesBegan method e.g.
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
CGPoint myPoint = [touch locationInView:self];
   if (CGRectContainsPoint([imageView frame], location)){
    // code here
   }
}

I just read that you tried it, although I am not sure why it doesn't work. Try using the tap gesture as suggested below.

A: You can try this
Suppose you have an
IBOutlet UIImageView *touchImageVIew;
Let touchImageVIew height and width are 50,25;

- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
    // Retrieve the touch point

    CGPoint pt = [[touches anyObject] locationInView:touchImageVIew];

    if (pt.x>=0 && pt.x<=50 && pt.y>=0 && pt.y<=25) {
        NSLog(@"image touched");
    }

    else
{
NSLog(@"image not touched");
}
}

Adjust height,width and  name   according to your requirement.

A: You Can use this:
Do Following setting in view did load:
UISwipeGestureRecognizer *rightRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(rightSwipeHandle:)];
rightRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
[rightRecognizer setNumberOfTouchesRequired:1];
[mainSlideShowImageScrollView addGestureRecognizer:rightRecognizer];
[rightRecognizer release];
UISwipeGestureRecognizer *leftRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(leftSwipeHandle:)];
leftRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
[leftRecognizer setNumberOfTouchesRequired:1];
[mainSlideShowImageScrollView addGestureRecognizer:leftRecognizer];
[leftRecognizer release];

Then Use following methods:
- (void)rightSwipeHandle:(UISwipeGestureRecognizer*)gestureRecognizer
   {
      //Do moving
   }

- (void)leftSwipeHandle:(UISwipeGestureRecognizer*)gestureRecognizer
  {
      // do moving
  }

A: If you are not so particular in using UIImageView, try using a custom button with your image in it and use the action methods, touchDown and touchDraggedOut for moving the image.

A: you could consider using  UITapGestureRecognizer  with UIImageView to detect the touches.
And also not forget to set userInteractionIsEnabled to YES.
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self              action:@selector(imageTapped:)];
myImageView.userInteractionIsEnabled = YES;
[myImageView addGestureRecognizer:tap];
[tap release];

Implement imageTapped: method.
- (void )imageTapped:(UITapGestureRecognizer *) gestureRecognizer
   {

   }


text:
Q: Avoid killing the parent with fork() Is there any way to avoid killing the parent process using the fork library, just like this code, but without killing the parent and leaving it doing its thing until it ends?
use fork::{daemon, Fork};
use std::process::Command;

fn main() {
    if let Ok(Fork::Child) = daemon(false, false) {
        Command::new("/usr/bin/firefox")
            .output()
            .expect("failed to execute process");
    }
}