text:
Q: Sort lines in file with highest value of specified pattern In a log file which contains some performance info, I would like to sort lines in decreasing order depending from elapsed time(real-time) written in each line. For example:
Operation1 cpu-time = 10 real-time = 4 malloc = 1006
Operation2 cpu-time = 12 real-time = 5 malloc = 1002
// other info1 (without time or memory measurments)
Operation3 cpu-time = 9 real-time = 10 malloc = 1003
// other info2 (without time or memory measurments)

And the output should be like this (sorted in decreasing order of real-time) :
Operation3 cpu-time = 9 real-time = 10 malloc = 1003
Operation2 cpu-time = 12 real-time = 5 malloc = 1002
Operation1 cpu-time = 10 real-time = 4 malloc = 1006
// other info1 (without time or memory measurments)
// other info2 (without time or memory measurments)

Note that unnecessary lines shifted to the end of file

A: Use sort:
sort -rn -k7,7

n - number sort
r - reverse
-k7,7 - use 7th field only for sorting (fields are by default separated with spaces)


text:
Q: TXT entries from gmail overrides my gitlab pages TXT I'm trying to verify a Gitlab pages domain
So, in my DNS provider, I add a TXT register like:
_gitlab-pages-verification-code.mysite.example TXT gitlab-pages-verification-code=08206beaab9ad1079993f245f1419a22

but I already have
@ 3600 IN TXT "v=spf1 mx include:_spf.google.com ?all"

that seems to override all my TXT entries.
When I do
 dig +short txt mysite.example

I will not see the TXT entry as long as I don't delete the google entry.
How should I do that? I also read that I can't delete Google entry because it will periodically check it.
Any ideas?
EDIT:
I added
instructions changed, and now letsencrypt ask me that:
Please deploy a DNS TXT record under the name
_acme-challenge.mysite.io with the following value:

gcnw0KaBOs8lMALx9YvIYsq8ZCWyxCLieMfqxxxxx

Before continuing, verify the record is deployed.

so, I removed @ TXT even if not necessary... and added the TXT entry:
@ 10800 IN A 35.185.44.232
imap 10800 IN CNAME access.mail.gandi.net.
pop 10800 IN CNAME access.mail.gandi.net.
smtp 10800 IN CNAME relay.mail.gandi.net.
webmail 10800 IN CNAME webmail.gandi.net.
www 10800 IN CNAME mysite.io.
@ 10800 IN MX 50 fb.mail.gandi.net.
@ 10800 IN MX 10 spool.mail.gandi.net.
_acme-challenge.mysite.io 300 IN TXT "gcnw0KaBOs8lMALx9YvIYsq8ZCWyxCLieMxxxxxxx"

I waited a whole night, and when I execute:
dig +short txt _acme-challenge.mysite.io

It doesn't give me anything.
PD: Sorry about not being a programming question, what is the place where I should  post ?

A: Do dig _gitlab-pages-verification-code.mysite.example TXT and you will see your TXT record for Gitlab verification.
When you do dig mysite.example TXT it returns only TXT records on the mysite.example record, not all TXT records in your zone.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Interpreting results of sequence mining with SPADE Please help to interpret the results of SPADE frequent sequence mining algorithm (http://www.inside-r.org/packages/cran/arulesSequences/docs/cspade)
With support = 0.05:
s1 <- cspade(x, parameter = list(support = 0.05), control = list(verbose = TRUE))

I get, for example, these sequences:
4          <{C},{V}> 0.15644023
5            <{C,V}> 0.73127376

Looks like these are the same sequences, aren't they? How <{C},{V}> semantically differes from <{C,V}> ? Any real life examples?
From Spade paper (M. J. Zaki. (2001). SPADE: An Efficient Algorithm for Mining Frequent Sequences. Machine Learning Journal, 42, 31--60):
"An input-sequence C is said to contain another sequence A, if A is a
subsequence of the input-sequence C. The support or frequency of a sequence is the the total number of input-sequences in the database D that contain A."
Then, for example, if:
            sequence    support
1              <{C}> 1.00000000

Does it mean that sequence <{C}> is contained in all sequences in database D, correct?
Complete output that I get from my data:
> as(s1, "data.frame")
            sequence    support
1              <{C}> 1.00000000
2              <{L}> 0.20468120
3              <{V}> 0.73127376
4          <{C},{V}> 0.15644023
5            <{C,V}> 0.73127376
6            <{L,V}> 0.07882027
7          <{V},{V}> 0.13343431
8        <{C,V},{V}> 0.13343431
9      <{C},{C},{V}> 0.05558572
10         <{C,L,V}> 0.07882027
11       <{V},{C,V}> 0.13343431
12       <{C},{C,V}> 0.15644023
13     <{C,V},{C,V}> 0.13343431
14   <{C},{C},{C,V}> 0.05558572
15         <{C},{L}> 0.05738619
16           <{C,L}> 0.20468120
17       <{C},{C,L}> 0.05738619
18         <{C},{C}> 0.22128547
19         <{L},{C}> 0.06233031
20         <{V},{C}> 0.16921494
21     <{V},{V},{C}> 0.05047012
22     <{V},{C},{C}> 0.06233031
23       <{C,V},{C}> 0.16921494
24     <{C},{V},{C}> 0.05781487
25   <{C,V},{V},{C}> 0.05047012
26   <{V},{C,V},{C}> 0.05047012
27   <{C},{C,V},{C}> 0.05781487
28 <{C,V},{C,V},{C}> 0.05047012
29       <{C,L},{C}> 0.06233031
30     <{C},{C},{C}> 0.07882027
31   <{C,V},{C},{C}> 0.06233031
> summary(s1)
set of 31 sequences with

most frequent items:
      C       V       L (Other)
     27      22       8       8

most frequent elements:
    {C}     {V}   {C,V}     {L}   {C,L} (Other)
     21      12      12       3       3       2

element (sequence) size distribution:
sizes
 1  2  3
 7 13 11

sequence length distribution:
lengths
 1  2  3  4  5
 3  9 12  6  1

summary of quality measures:
    support
 Min.   :0.05047
 1st Qu.:0.05760
 Median :0.07882
 Mean   :0.17121
 3rd Qu.:0.16283
 Max.   :1.00000

includes transaction ID lists: FALSE

mining info:
 data ntransactions nsequences support
    x         61000      34991    0.05
>

A: When using SPADE algorithm, remember that you are also dealing with temporal data (i.e. you can know the order or time of occurrence of the item).

Looks like these are the same sequences, aren't they? How <{C},{V}>
  semantically differs from <{C,V}> ? Any real life examples?

In your example, <{C}, {V}> means that item C occurred first, and then item V; <{C, V}> means than item C and V occurred at the same time.

Then, for example, if:
            sequence    support
1              <{C}> 1.00000000

Does it mean that sequence <{C}> is contained in all sequences in
  database D, correct?

An item with support value of 1 means that it happened (in a market basket analysis example) in ALL transactions.
Hope this helps.

A:
Looks like these are the same sequences, aren't they? How <{C},{V}>
  semantically differes from <{C,V}> ? Any real life examples?

As user2552108 pointed, {C,V} implies that C and V occurred at the same time. In practice this can be used to encode multi-dimensional sequential data. For example, suppose that C was Canada and V was Vancouver. Now this could have been something like:
[{C,V,M,peanut,butter,maple_syrup}, ... , {}]
In this case, your frequent item-set can not only have single length sets like say {C}, {V}, {U}, {W}, or {X}, but also sets with length > 1 (the sets that appeared simultaneously - at the same time).
For this reason, the element in transactions/sequences are defined as sets and not single elements.

Does it mean that sequence <{C}> is contained in all sequences in
  database D, correct?

That's correct!


text:
Q: rails use postgresql jsonb to log user activity? I try to use jsonb data format(new feature in postgresql), to log user(interactive with devise) actives, like pageview...search string...
versions:
Rails 4.2.6
Postgresql 9.5
my model:
class CreateUserLogs < ActiveRecord::Migration
    def self.up
      create_table :user_logs, :id => false do |t|
        t.integer :user_id
        t.jsonb :data, default: '{}'
      end
      add_index :user_logs, :user_id   end
    def self.down
      drop_table :user_logs
    end
end

my log service object:
class UserLogger

  def initialize(current_user)
    @user_id = current_user.present? ? current_user.id : 0
  end

  def insert_log_data(request_ip, controller_name, action_name, object)
    user_log = UserLog.create!({
      user_id: @user_id,
      data: {
        ip_address: request_ip,
        controller_name: controller_name,
        action_name: action_name,
        id: object.id,
        created_at: Time.now.to_s(:db)
      }
    })
  end
end

My target is simple analyze log data for all user and each one.
to get something like top 3 articles user like...etc.
postgresql jsonb is noSQL, a good choice for log data.
I try impressionist gem, but when data grow bigger, the efficacy will fall.
should I put the User_ID in the jsonb data type too?  or another better way?(I already use Google Analytics, but it can't track activity by each user. I need customized data.)
But if I want to group and order data, Maybe impressionist is a better choice?


text:
Q: Few Quick Questions About iOS Programming in Xcode 1) For the interface .h file, should I import classes (#import "Person.h") or should I use @class (@class Person)?  And I should always use import in the .m, right?
2) Can I get rid of the following methods if I don't use autorotate?
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

3) Do I need to separate IVariables from properties when declaring them in the interface?  I see both ways being done.
Edit:
What about these methods?
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

A: *

*@class is usually enough in your header file. See this question.

*All of those methods are performing their default behaviors, so you can remove them regardless of whether you use autorotation. You would want to keep them if you need to add additional behavior. (Using super means to call the superclass implementation — i.e., the implementation that would be used if you hadn't defined this method. So if you are only calling super and not doing anything else, there's no point.)

*It's fine to leave them out, but I think this only works after iOS 4. See this question.

A: *

*You can use @class for types, but if your class subclasses something you need to import the latter. Likewise for protocols. You will probably need to import the class, e.g. #import "Person.h", at the top of the implementation file. A good rule I can offer: If the compiler chokes here, import!

*Yes. As jtbandes points out, the call goes through to super which has a default implementation.

*You don't need the iVar declarations if there's a property to go with them, I do without because I don't want to clutter my interface. I think this works since Objective-C 2.0, not since iOS4.0. (I've used this on iOS3.0 for example). Also, omitting iVars helps prevent zombies and maintain the correct retain count - it encourages you to use the right setter. But some times it's good to use iVars with no property and a "@private" declaration if your object needs to store some data but you don't want to expose it. An example I often come across is UITableViewController, which might hold an array to populate it's rows.


text:
Q: Showing data in input using ajax in laravel I am using ajax to get some data from db. Now I can get the data at the backend. But the only problem is I just cannot show that in the input below. I also write some code but that's not working. Here is my code. The ajax part is working but not the javascrpit. Help me if you can :)
Code
<script type="text/javascript">

jQuery(document).ready(function () {
    jQuery('select[name="class_id"]').on('change',function() {
        var ClassID = jQuery(this).val();
        if (ClassID) {
            jQuery.ajax({
                url : '/ajaxFee/' + ClassID,
                type : "GET",
                dataType : "json",
                success: function(data) {
                    console.log(data);
                    jQuery('input[name="class_fee"]').empty();
                    jQuery.each(data, function(key,value) {
                        $('input[name="class_fee"]').append(
                          '<option value="' + key + '">' + value + '</option>'
                        );
                    });
                }
            });
        } else {
            $('input[name="class_fee"]').empty();
        }
    });
});

</script>

A: Maybe the mistake is much simpler than you think :)
Change this:
$('input[name="class_fee"]').append('<option value="'+ key +'">'+ value +'</option>');

to this:
$('select[name="class_fee"]').empty();
$('select[name="class_fee"]').append('<option value="'+ key +'">'+ value +'</option>');

You want to append options to a select element, not to an input. And change all the references.
-- EDIT
You should have an element in your page like this:
<select name="class_fee"></select>

You cannot append option to an input element.

A: I am assuming your getting 'fee' for selected class and data length is 1
Replace
$('input[name="class_fee"]').append('<option value="'+ key +'">'+ value +'</option>');

to
$('input[name="class_fee"]').val(value)


text:
Q: Convert String [] to timestamp how to convert string [] temp to Timestamp:
    String[] temp = line.split(",");
            for (int i = 1; i < temp.length; i++) {

                    objekt.setTimestamp(timestamp);}

if i use
Timestamp ts= Timestamp.valueOf(temp[0]);
objekt.setTimestamp(ts);}

i get this exceptionTimestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
if i use this
SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
                java.util.Date parsedDate = dateFormat.parse(temp[0]);
                java.sql.Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());

i get
" java.text.ParseException: Unparseable date: "06/11/2013 22:00"
thank you everyone for suggestions, i can read the timestamp but i must to read this format month-day-year: 06/18/2013 21:00:00, and with SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); i get 2013-06-18 18:00:00, if i change MM or dd or yyyy hier "MM/dd/yyyy HH:mm" i can't even get the month first then date and year

A: Your date format must actually match the text being provided. '/' and '-' do not match.
For the string you have provided, it appear the format might be "MM/dd/yyyy HH:mm".
It could also be "dd/MM/yyyy HH:mm", as it is not clear whether that date is June 11 or November 6.

A: Use the below code:
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");

Assuming that 06 in the string Unparseable date: "06/11/2013 22:00" correponds to month

A: On your 2nd code block where you got java.text.ParseException: Unparseable date: "06/11/2013 22:00, your SimpleDateFormat pattern is wrong as your String is "06/11/2013 22:00", So you have to use pattern :
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");

For more details, see java.text.SimpleDateFormat

A: You can do something like this :
Timestamp ts= null;
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
String[] temp = {..,..}; // it's string time array
        for (int i = 1; i < temp.length; i++) {
            Date convertedDate = dateFormat.parse(temp[i]);
            ts = new Timestamp(convertedDate.getTime());
            System.out.println(ts);
         }


text:
Q: Using RegEx to Insert Character before Matches I know I can use RegEx to replace all occurrences of 'a', 'b', or 'c' with a blackslash character in a string like this:
string result = Regex.Replace(input, "[abc]", "\\");

But how can I replace each occurrence with a backslash followed by the character that matched?

A: No need to use any MatchEvaluator, Regex.Replace offers dedicated means to access the whole match value in the replacement pattern: $&. See Substituting the Entire Match:

The $& substitution includes the entire match in the replacement string. Often, it is used to add a substring to the beginning or end of the matched string. For example, the ($&) replacement pattern adds parentheses to the beginning and end of each match. If there is no match, the $& substitution has no effect.

Use
var result = Regex.Replace(input, @"[abc]", @"\$&");

C# demo:
var s = "abcd";
var result = Regex.Replace(s, @"[abc]", @"\$&");
Console.WriteLine(result);
// => \a\b\cd

A: You can transform each Match using a MatchEvaluator delegate and this overload of Replace...
Regex.Replace(input, @"[abc]", m => string.Format(@"\{0}", m.Value))


text:
Q: Android : Saving and Restoring Activity data when switching Portrait and Landscape I am try to save my roll no and name in main activity but when my screen is rotated the activity data has been lose ,
finally i fixed it , below i adding source code

A: consider any layout , here i am using this layout structure

In activity_xml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="20dp"
    tools:context=".MainActivity">
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:id="@+id/rollnoID"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginTop="10dp"
            android:text="Rollno : "
            android:textSize="25dp" />

        <EditText
            android:hint="Roll Number"
            android:id="@+id/rollnoID_edit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginTop="10dp"
            android:ems="8"
            android:inputType="number"
            android:text=""
            android:textSize="25dp" />
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:id="@+id/nameID"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginTop="10dp"
            android:text="Name : "
            android:textSize="25dp" />
        <EditText
            android:hint="Student Name"
            android:id="@+id/nameID_edit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginTop="10dp"
            android:ems="8"
            android:inputType="textCapWords"
            android:text=""
            android:textSize="25dp" />
    </LinearLayout>
    <Button
        android:onClick="saveData"
        android:id="@+id/saveButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="save this Data"
        android:textSize="20sp" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="20dp"
        android:padding="20dp"
        android:orientation="vertical">
        <TextView
            android:gravity="center"
            android:hint="~RollNo~"
            android:textColor="@color/colorPrimary"
            android:id="@+id/display_rollno"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="30sp" />
        <TextView
            android:layout_marginTop="20dp"
            android:id="@+id/display_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:hint="~Name~"
            android:textColor="@color/colorPrimary"
            android:textSize="30sp" />
    </LinearLayout>
</LinearLayout>

In MainActivity :
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    private static final String KEY_ROLL = "rollno_key";
    private static final String KEY_NAME = "name_key";

    int rollno;
    String name;

    EditText roll_et , name_et;
    TextView roll_tv , name_tv;
    Button saveButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        roll_et = (EditText) findViewById(R.id.rollnoID_edit);
        name_et = (EditText) findViewById(R.id.nameID_edit);

        roll_tv = (TextView) findViewById(R.id.display_rollno);
        name_tv = (TextView) findViewById(R.id.display_name);

        if (savedInstanceState != null){
            String save_RollNO = savedInstanceState.getString(KEY_ROLL);
            roll_tv.setText(save_RollNO);

            String save_Name = savedInstanceState.getString(KEY_NAME);
            name_tv.setText(save_Name);
        } else {
            Toast.makeText(getApplicationContext(),"Entry your data",Toast.LENGTH_SHORT).show();
        }

    }

    @Override
    public void onSaveInstanceState(Bundle saveData) {
        saveData.putString(KEY_ROLL , roll_et.getText().toString());
        saveData.putString(KEY_NAME , name_et.getText().toString());
        super.onSaveInstanceState(saveData);
    }

    public void saveData(View v){
        roll_tv.setText(roll_et.getText().toString().trim());
        name_tv.setText(name_et.getText().toString().trim());
    }
}


text:
Q: Django rest nested serializer validation by id I have following django-rest serializers:
class FileSerializer(serializers.ModelSerializer):
    class Meta:
        model = FileModel
        fields = ('id', '_file')

class SomeSerializer(serializers.ModelSerializer):
    files = FileSerializer(many=True, required= False)
    class Meta:
        model = SomeModel
        fields = ('id', 'files')

And models
 class File(models.Model):
      some_obj = models.ForeignKey('SomeObj',related_name='files', blank=True, null=True)
      _file = models.FileField(upload_to=get_file_path)

The problem comes, when I create SomeSerializer with existing File objects
s = SomeSerializer(data = {'files': [{'id' : 1}]})
s.is_valid()
s.errors

Returns
False
{'_file': [u'No file was submitted.']}

How to solve this? Thanks.

A: Well, the message is pretty obvious. You don't provide "_file" to the serializer. This should fix:
s = SomeSerializer(data = {'files': [{'id' : 1, '_file': <somedata>}]})

A: _file field is missing, then if it's not required, set required to False:
class FileSerializer(serializers.ModelSerializer):
    _file = serializer.FileField(required=False)

    class Meta:
        model = FileModel
        fields = ('id', '_file')


text:
Q: What should I do to execute php scripts on my own web server? I want to create own web server to accept HTTP requests and send response to client.
I have idea to call PHP scripts by CLI interface but then PHP scripts executed in CLI mode. What I need do for call scripts by my own server (not in CLI mode)? Because in CLI mode some PHP abilities is disabled. Maybe I need to write own PHP SAPI?
Please help me to start.
Thanks

A: No, you don't need to write your own PHP SAPI, as there has already been one written specifically for interfacing with a web server. It's called FastCGI.
It's important to note that PHP is both extensible and embedded by design. So, while some SAPIs like the Apache 2.0 Handler (a.k.a mod_php) might be embedded in the httpd server directly, it is not typically necessary to do so in order to have the web server talk to PHP.
The difference is you still need some process to manage the underlying PHP interpreter and deal with things like recycling workers or managing the number worker processes available for the webserver to talk to. For example, php-fpm does this quite nicely and many people use php-fpm to manage the PHP workers and just tie that to their webservers like nginx or httpd via the fastcgi protocol. The PHP workers forked by php-fpm listen on a fastcgi socket and the webserver can freely send and receive information from and to PHP.


text:
Q: New command: vertical spacing Right now I use \\[0.5em] to get vertical spacing.
But writing this every time is quite tiring, so I want to write a command that gives the same output simply by writing \\ and wrote
\renewcommand{\\}{\\[0.5em]}

But it doesn't work. When using \\ I get the same as before.

A: \renewcommand{\\}{\\[0.5em]}

if used would put TeX into an infinite loop however many latex environments redefine \\ (center, tabular, tabbing, flushright all have different definitions of \\)  So within these environments your definition will be ignored. This makes globally redefining \\ tricky (and ill-advised:-).
You could use
\newcommand\N{\\[.5em]}

and use \N if you want a definition, however you should almost never need
 \\ outside of alignments, and within alignments you can usually arrange the default spacing so that you rarely need the optional argument.


text:
Q: Find any line in VI that has something other than ATCG I have a file of genomic data that is approximately 5 million lines long and should have only the characters A, T, C, and G in it. The problem is, I know how large the file should be, but it's slightly larger than that. Which means, something went wrong in an analysis, or there are lines that contain something other than genomic data.
Is there a way to find any line that has something other than an A, T, C, or G? Due to the nature of the file, any other letter, spaces, numbers, symbols shouldn't be present. I've gone through searching symbol by symbol, so I was hoping there would be an easier way.

A: First of all, you definitely do not want to open the file in an editor (it's much too large to edit that way).
Instead, if you just want to identify whether the file contains anything other than A, T, C and G, you may do that with
grep '[^ATCG]' filename

This would return all lines that contain anything other than those four characters.
If you would want to delete these characters from the file, you may do so with
tr -c -d 'ATCG\n' <filename >newfilename

(if this is the correct way to "correct" the file or not, I don't know)
This would remove all characters in the file that are not one of the four, and it would also retain newlines (\n).  The edited file would be written to newfilename.
If it's a systematic error that has added something to the file, then this could possibly be corrected by sed or awk, but we don't yet know what your data looks like.

If you have the file open in vi or vim, then the command
/[^ATCG]

will find the next character in the editing buffer that is not a A, T, C or G.
And :%s/[^ATCG]//g will remove them all.

A: I focused on the title

Find any line in VI that has something other than ATCG

And I tested this from VI editor so called "last line mode".
:%!tr -c -d 'ATCG\n
: enters command-line mode, % matches whole file as a range, ! filters that range through an external command tr -c -d 'ATCG\n that happens to be the same as @Kusalananda wrote :).


text:
Q: Swift - How to use dequeueReusableCellWithIdentifier with two cell types? (identifiers) I am trying to build a table view for events, like so:

I have two cell prototypes:

*

*An event cell with identifier "event"

*A separator cell with identifier "seperator"

Also, I have this class to represent a date:
class Event{

    var name:String = ""
    var date:NSDate? = nil
}

And this is the table controller:
class EventsController: UITableViewController {

    //...

    var eventsToday = [Event]()
    var eventsTomorrow = [Event]()
    var eventsNextWeek = [Event]()

    override func viewDidLoad() {
        super.viewDidLoad()

        //...

        self.fetchEvents()//Fetch events from server and put each event in the right property (today, tomorrow, next week)

        //...
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        let event = tableView.dequeueReusableCellWithIdentifier("event", forIndexPath: indexPath) as EventTableViewCell
        let seperator = tableView.dequeueReusableCellWithIdentifier("seperator", forIndexPath: indexPath) as SeperatorTableViewCell

        //...

        return cell
    }
}

I have all the information I need at hand, but I can't figure out the right way to put it all together. The mechanics behind the dequeue func are unclear to me regrading multiple cell types.
I know the question's scope might seem a little too broad, but some lines of code to point out the right direction will be much appreciated. Also I think it will benefit a lot of users since I didn't found any Swift examples of this.
Thanks in advance!

A: The basic approach is that you must implement numberOfRowsInSection and cellForRowAtIndexPath (and if your table has multiple sections, numberOfSectionsInTableView, too). But each call to the cellForRowAtIndexPath will create only one cell, so you have to do this programmatically, looking at the indexPath to determine what type of cell it is. For example, to implement it like you suggested, it might look like:
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return eventsToday.count + eventsTomorrow.count + eventsNextWeek.count + 3 // sum of the three array counts, plus 3 (one for each header)
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    var index = indexPath.row

    // see if we're the "today" header

    if index == 0 {
        let separator = tableView.dequeueReusableCellWithIdentifier("separator", forIndexPath: indexPath) as SeparatorTableViewCell

        // configure "today" header cell

        return separator
    }

    // if not, adjust index and now see if we're one of the `eventsToday` items

    index--

    if index < eventsToday.count {
        let eventCell = tableView.dequeueReusableCellWithIdentifier("event", forIndexPath: indexPath) as EventTableViewCell
        let event = eventsToday[index]

        // configure "today" `eventCell` cell using `event`

        return eventCell
    }

    // if not, adjust index and see if we're the "tomorrow" header

    index -= eventsToday.count

    if index == 0 {
        let separator = tableView.dequeueReusableCellWithIdentifier("separator", forIndexPath: indexPath) as SeparatorTableViewCell

        // configure "tomorrow" header cell

        return separator
    }

    // if not, adjust index and now see if we're one of the `eventsTomorrow` items

    index--

    if index < eventsTomorrow.count {
        let eventCell = tableView.dequeueReusableCellWithIdentifier("event", forIndexPath: indexPath) as EventTableViewCell
        let event = eventsTomorrow[index]

        // configure "tomorrow" `eventCell` cell using `event`

        return eventCell
    }

    // if not, adjust index and see if we're the "next week" header

    index -= eventsTomorrow.count

    if index == 0 {
        let separator = tableView.dequeueReusableCellWithIdentifier("separator", forIndexPath: indexPath) as SeparatorTableViewCell

        // configure "next week" header cell

        return separator
    }

    // if not, adjust index and now see if we're one of the `eventsToday` items

    index--

    assert (index < eventsNextWeek.count, "Whoops; something wrong; `indexPath.row` is too large")

    let eventCell = tableView.dequeueReusableCellWithIdentifier("event", forIndexPath: indexPath) as EventTableViewCell
    let event = eventsNextWeek[index]

    // configure "next week" `eventCell` cell using `event`

    return eventCell
}

Having said that, I really don't like that logic. I'd rather represent the "today", "tomorrow" and "next week" separator cells as headers, and use the section logic that table views have.
For example, rather than representing your table as a single table with 8 rows in it, you could implement that as a table with three sections, with 2, 1, and 2 items in each, respectively. That would look like:
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 3
}

override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
    switch section {
    case 0:
        return "Today"
    case 1:
        return "Tomorrow"
    case 2:
        return "Next week"
    default:
        return nil
    }
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    switch section {
    case 0:
        return eventsToday.count
    case 1:
        return eventsTomorrow.count
    case 2:
        return eventsNextWeek.count
    default:
        return 0
    }
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let eventCell = tableView.dequeueReusableCellWithIdentifier("event", forIndexPath: indexPath) as EventTableViewCell

    var event: Event!

    switch indexPath.section {
    case 0:
        event = eventsToday[indexPath.row]
    case 1:
        event = eventsTomorrow[indexPath.row]
    case 2:
        event = eventsNextWeek[indexPath.row]
    default:
        event = nil
    }

    // populate eventCell on the basis of `event` here

    return eventCell
}

The multiple section approach maps more logically from the table view to your underlying model, so I'd to adopt that pattern, but you have both approaches and you can decide.


text:
Q: Can't see a data on datatable -DataTables warning: table id=tableData you may feel this question may be duplicate but none of those questions/solutions solved my problem,
1)I am using liferay 6.2 and serverResource method to fetch a data from a server and populating the data on data table plugin and making AUI ajax call from client.
2)I did alert the received GSON object, everything looks ok but I can't see data on the data table and the object is as per the docs but getting 404 error also on the console.
please refer the view.jsp and function getFormDataFromServer()
 <%@page import="com.liferay.portal.kernel.search.Document"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://alloy.liferay.com/tld/aui" prefix="aui" %>
<%@page import="javax.portlet.ResourceURL"%>
<%@page import="javax.portlet.*" %>
<portlet:defineObjects />
<portlet:resourceURL var="serveResource">
</portlet:resourceURL>

<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">

<%--<link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet">
 --%>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/dataTables.bootstrap.min.css"></link>

<%--  --%>

<%--
string from server=${initial_value}
  --%>
<button  class="btn btn-success btn-md"  id="getTableData" onclick="getFormDataFromServer()" >View Data</button>

<form id="taskform">

    Enter the details of a task

    Name:
    <input type="text" class="form-control" name="<portlet:namespace/>task"/>

    description:
    <input type="text" class="form-control" name="<portlet:namespace/>desc"/>

    User:
    <input type="text" class="form-control" name="<portlet:namespace/>user"/>

    Start Date:
    <input type="date" class="form-control" name="<portlet:namespace/>startdate"/>

    End Date:
    <input type="date" class="form-control" name="<portlet:namespace/>enddate"/>

    <button class="btn btn-primary btn-md" onclick="sendFormData()" id="btnSubmit">Submit</button>

</form>

how to resolve this error:DataTables warning: table id=tableData - Ajax error. For more information about this error, please see http://datatables.net/tn/7
this the docs : link
I can't see what is wrong, help me to find it.
GSON object data:
[{"name":"testtaskname","description":"estst","user":"testuser","start_date":"2019-05-28","end_date":"2019-05-28","created_on":"2019-05-28","id":1},{"name":"testtaskname","description":"sdf","user":"sdf","start_date":"2019-05-28","end_date":"2019-05-28","created_on":"2019-05-28","id":2},{"name":"testtaskname","description":"fs","user":"testuser","start_date":"2019-05-28","end_date":"2019-05-28","created_on":"2019-05-28","id":3},{"name":"testtaskname","description":"df","user":"testuser","start_date":"2019-05-28","end_date":"2019-05-28","created_on":"2019-05-28","id":4},{"name":"add task","description":"updating the database","user":"thippu","start_date":"2019-05-28","end_date":"2019-05-28","created_on":"2019-05-28","id":5},{"name":"creating the datatable","description":"using bootstrap\u0027s","user":"thippu","start_date":"0032-11-06","end_date":"0033-11-07","created_on":"2019-05-28","id":6},{"name":"task10","description":"check","user":"thippu","start_date":"0032-11-06","end_date":"0033-11-07","created_on":"2019-05-28","id":7},{"name":"task11","description":"check","user":"thippu","start_date":"2019-05-27","end_date":"2019-05-28","created_on":"2019-05-28","id":8},{"name":"task12","description":"check","user":"thippu","start_date":"2019-05-27","end_date":"2019-05-28","created_on":"2019-05-28","id":9},{"name":"task13","description":"check","user":"thippu","start_date":"2019-03-13","end_date":"2019-05-17","created_on":"2019-05-28","id":10},{"name":"creating the datatable","description":"updating the database","user":"testuser","start_date":"2019-06-18","end_date":"2019-06-21","created_on":"2019-06-01","id":11},{"name":"abc task","description":"checking the servlet","user":"user","start_date":"2019-06-01","end_date":"2019-06-01","created_on":"2019-06-01","id":12},{"name":"task demo","description":"description of task is checking the code is reaching or not to server","user":"thippu","start_date":"2019-06-01","end_date":"2019-06-01","created_on":"2019-06-01","id":13},{"name":"task demo2","description":"checking the action value","user":"thippu","start_date":"2019-06-01","end_date":"2019-06-01","created_on":"2019-06-01","id":14},{"name":"task demo","description":"checking the data","user":"thippu","start_date":"2019-06-01","end_date":"2019-06-01","created_on":"2019-06-01","id":15},{"name":"task demo","description":"ggj","user":"thippu","start_date":"2019-06-01","end_date":"2019-06-01","created_on":"2019-06-01","id":16},{"name":"demo project","description":"description","user":"thippu","start_date":"2019-06-03","end_date":"2019-06-03","created_on":"2019-06-03","id":17}]

A: I changed the some code to the jquery part and it worked fine,
below is the solution:
In function getFormDataFromServer()
on success method change to:
                        {

                            var tbldata=this.get('responseData');
                            tbldata=JSON.parse(tbldata);
                            console.log(tbldata);

                            var obj={"data":tbldata,"columns":[{"data":"id"},{"data":"name"},{"data":"start_date"},{"data":"end_date"},{"data":"created_on"},{"data":"description"},{"data":"user"}]};

                            $("#tableData").DataTable(obj);
                        },


text:
Q: ActiveRecord::RecordNotFound in StudentsController#new Couldn't find Student with 'id'=all i just started working with ruby
trying to create a online form
it started showing the above error
could anyone help me with this
my code students_controller.rb
 class StudentsController < ApplicationController
 def new
@student = Student.new
@students = Student.find(:all)
end

def create
@student = Student.new(student_params)
if @student.save
    redirect_to new_student_path
end
end
def student_params
allow = [:firstname, :lastname]
params.require(:student).permit(allow)

end

end

my code for new.html
Enter new student information

<%= form_for @student do |f| -%>
 Firstname: <%= f.text_field :firstname %>

 Lastname:  <%= f.text_field :lastname %>

<%= f.submit %>
<% end -%>

Display all students' information
<% if !@students.blank? %>
<% for item in @students %>
   <%= item.firstname %> <%= item.lastname %>

<% end %>
<% else %>
<% end %>

my routes
Rails.application.routes.draw do
resources :students

A: Use
@students = Student.all
instead of
@students = Student.find(:all)


text:
Q: React + Typescript: props from `cloneElement` only I have a React component <MyComponent> that takes props of type Props:
interface Props {
    name: string;
    age: number;
    greeting: () => string;
}

export const MyComponent = ({ name, age, greeting }: Props): ReactElement => {
   ...
}

However, MyComponent is always a child of WrapperComponent, which is where greeting is passed in:
export const WrapperComponent = ({children}) => {
    const thisGreeting = (): void => { console.log('Hello!'); }
    return (
        <div className="wrapper">
            {
                Children.map((child) => cloneElement(child, {greeting: thisGreeting}))
            }
        </div>
    );
}

I'm currently composing WrapperComponent and MyComponent like this:
<WrapperComponent>
    <MyComponent
        name="me"
        age={99}
    />
</WrapperComponent>

This throws an error, because MyComponent is missing greeting, but I know that it'll be there eventually. greeting is dependent on the specific instance of WrapperComponent, which is why it's set up this way.

*

*This feels like a bit of an anti-pattern, since MyComponent can't (currently) be used outside WrapperComponent - is there a better way?

*If not (anti-pattern and/or a better way) is there a way to convince typescript that greeting will get there eventually?

A: You could declare the greeting prop as optional in the Props interface. And set a default arg value for it.
interface Props {
    name: string;
    age: number;
    greeting?: () => string;
}

export const MyComponent = ({ name, age, greeting = () => "" }: Props): ReactElement => {
   ...
}```


text:
Q: removing part of a value from variable using sed I have the following value from a variable .
manager&org.apache.catalina.filters.CSRF_NONCE=314C54E5671790D592A37C2C4A6B9AAF
I need to modify the above variable to remove &amp from it. SO , the variable should like this
manager&;org.apache.catalina.filters.CSRF_NONCE=314C54E5671790D592A37C2C4A6B9AAF
Please suggest

A: sed 's/&/\&;/g' <<<"yourString"

The above line should help.
example:
kent$  sed 's/&/\&;/g'<<< "foo&bar&blah"
foo&;bar&;blah

A: I put your variable in a file and was able to do what you wanted with sed.  The trick to make sure you do not remove any other references to just amp is to include the & as part of the substitution.
$ cat /tmp/file
manager&org.apache.catalina.filters.CSRF_NONCE=314C54E5671790D592A37C2C4A6B9AAF

$ cat /tmp/file | sed 's/\&amp/\&/g'
manager&;org.apache.catalina.filters.CSRF_NONCE=314C54E5671790D592A37C2C4A6B9AAF

A: In bash, you can use Parameter Expansion - Pattern substitution to remove a substring:
VAR='manager&org.apache.catalina.filters.CSRF_NONCE=314C54E5671790D592A37C2C4A6B9AAF'
echo ${VAR/&amp}


text:
Q: Why does fluorescence emission detector pick up second order wavelengths with first order scan, even though they have different angles? my question in more detail and with an example: Let's say I have a 980nm laser and I use that laser to excite my fluorescent solution in cuvette. My scan range is from 300 to 800nm. If, for example I want to detect emission at 490nm, and I don't use any filters, I get a second order diffraction from laser scatter.
I know that when 980nm laser light hits difraction grating in monochromator, I have the first order 980nm, and second order 490nm diffraction which overlap at the same angle. For this example purposes let's say I have an angle of 29 degrees. But if I scan my emission for 490nm, the first diffraction angle of that wavelength is 14 degrees.
So why isn't it possible to adjust the angle, (of diffraction grating or any mirrors) so only the first diffraction of 490nm light goes out?
I do understand that 980nm first order light angle is the same as 490nm second order angle, but why can't just the first order 490nm angle be recorded?
Or maybe the detector combines all orders of the same wavelength? If so, how?
EDIT: THIS MUST BE IT. The diffraction is grating is turned to such angle that the 490nm light from all of the orders can be seen trough emission slit, that would explain how 980nm laser scattering reaches the detector (trough second order diffraction of 490nm). But even then, isn't it possible to not alow other diffraction orders to not pass, so we don't have to use filters, etc ?
EDIT2: But then again if diffraction grating is on such angle that it receives both first and second diffraction of 490nm, doesns't that just mean it basically covers all spectrum? (Angle between first order 490nm and 980nm)
Does not make any sense, anyone ?
https://terpconnect.umd.edu/~toh/models/matlab/whitegratingBBLarge.png
This is an image to help me illustrate the problem. As you can see if I scan for 400nm light, the only second order diffraction I can encounter is 200nm. How does my 800nm (just an example) laser scatter can interfere with that? It's in completely different place. I get a scatter peak when scanning 400nm emission from laser. (Or 490nm emission scan and 980nm laser, just using 400nm for illustrative purposes)
Regards,
L.K.


text:
Q: Replacing a word in a file with Ansible I was trying to replace one string in a file. For example:
$PASSWORD="oldpassword"

with:
$PASSWORD="newpassword"

Here is the Ansible task which should do this:
- name: change password with lineinfile
  lineinfile:
    dest: test.txt
    regexp: '^$PASSWORD='
    line: '^$PASSWORD="newpassword"'
    state: present
    backrefs: yes

Unfortunately I can't find the reason why it isn't working. I cannot replace it with the new string.
I was also trying without backrefs and the string was added instead of replaced.
Please advise.
Thank you.

A: From Regular expression operations:

$: Matches the end of the string or just before the newline at the end of
  the string

So, escape $ with backslash.
  - lineinfile:
      dest: /tmp/test.txt
      regexp: '^\$PASSWORD='
      line: '$PASSWORD="newpassword"'
      state: present

Also you don't need to use the backrefs parameter with your example, because your regular expression doesn't have backreferences.


text:
Q: Manually Paging in uiscrollview I have a scrollview with lets say ten subviews in it. All are shown at the same time. I want to page between each subview.
One idea is to set the frame size equal to a single subview and turn the paging on. But then it will receive the touch only within that frame. I want the user should be able to scroll it from any where in that scrollview.
For Example:
| sub1    sub2     sub3    sub4    sub5    sub6    sub7    sub8    sub9    sub10 |
I want the user to scroll it from any where in this scrollview, and page between these subviews.
Any Idea?

A: I think what you want is this.

A: make a frame that is the size of the subviews (frame) and then set these:
scrollview.pagingEnables = YES;
scrollview.contentSize = CGSizeMake(frame.size.width*numberofsubviews,  frame.size.height);

The UIScrollView should handle everything else from there on out.
The link that Toro sent you will help a great deal, I wouldn't avoid that if I were you
This link will help as well PhotoScroller


text:
Q: What causes this delayed recoil when a bullet hits a Prince Rupert's drop? I was watching this video on YouTube, which showed several slow-motion shots of bullets impacting Prince Rupert's drops. One thing I noticed is that there's a noticeable delay between when the bullet strikes the drop, and when the drop recoils backwards.
It's most noticeable in the first shot, which starts at about 1m48s and lasts until about 1m55s.
I took a few screen shots to illustrate my point. These were taken at equalish (done by hand) intervals. I added the purple line. Note that the rightmost edge of the drop stays roughly flush to the line for frames 1-5, but then moves a few pixels in frame 6. It's even more striking in the video: the drop seems to hold almost still, and then suddenly lurch backwards.

One thing I did notice: the tip of the drop breaks off (without shattering the whole drop, as explained at 2m16s) just before the drop moves backwards. I'm guessing it has something to do with a shock wave traveling through the drop, reaching the tip, and then... something? If that's the case, then why does the drop move back as soon as the tip breaks? I would expect it to be further delayed by the time it takes for the shock wave to move back up.
What exactly is going on here?

A: There is no delay:

*

*The slow-motion video is being played at a non-constant frame rate.

That becomes clear in the way the swirl of fumes from the gun accelerate at around 1:51 in the video.

 Old take (wrong)
 The hit made the glass drop rotate as well as recoil.
 That's especially noticeable from the way the strings holding the drop become increasingly less tight from frame to frame.
The key point, as you guessed, is the tip breaking off. Energy is released and the tip shoots downwards and to the left: conservation of moment leads to the remaining of the drop being pushed upwards and to the right, and to the bend in the drop crossing your magenta line.

A: I can't really say what exactly it is, I'd need to experiment a bit first, but I have a few suggestions:
First thing to consider is that rigid bodies are never perfectly rigid, at least not on an atomic level. A decent approximation for a rigid body (or a crystal if you will) is atoms being in a grid, held together by interatomic forces. The atoms will never be perfectly still and in place, but vibrate as if held together by springs. (Approximating the interatomic forces by a harmonic oscillator for a solid body is actually a popular concept.)
What does it mean for our case? Well, imagine pushing a relaxed spring. First the spring will contract a bit due to its inertia, but then move as a whole (and start expanding back and then oscillating while moving in the direction of the push.) Same thing is to be expected here: The distances between the atoms first contract, "absorbing" the shock if you will, and only then the object as a whole will start to move. So this is one cause of the delay.
Secondly, you observed an accelerated motion. Accelerated motion always means that there is a force acting on the object. Always. But the acceleration only is apparent after the bullet and the drop are not in contact anymore. Sure, while they were in contact, the force came from the bulled, which changed the drop's momentum ( it's motion ) according to
$\vec{F} = d\vec{p}/dt $ . But after they lose contact, there can be no more transfer in momentum, yet the drop seems to accelerate. So how can this be?
Again, accelerated motion always means that there is a force acting on the object. So we need another source for the force. Maybe one we can't see?
My best guess is that the acceleration comes from the hot air and gas coming out of the pistol/gun (couldn't find the technical term for this gas leaving the gun), which partly are slower than the bullet itself (some appear to be faster, see around 1:46 in the video you linked). You can also see some black smoke passing the drop around 1:52, just around the time when the main acceleration seems to start.


text:
Q: How to open SDCARD of android using phonegap Hi all i was trying to upload a pdf file to my php server script i pdf file is there on android mobile it will be on sd card only so i want to open sd card of android device using phonegap via javascript.

A: U can easily do that its very easy

    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccessUpload, fail);

    function onFileSystemSuccessUpload(fileSystem) {
     // get directory entry through root and access all the folders
             var directoryReader = fileSystem.root.createReader();

    // Get a list of all the entries in the directory
    directoryReader.readEntries(successReader,fail);

          }

      function successReader(entries) {
        var i;
        for (i=0; i<entries.length; i++) {
           //alert(entries[i].name);
           if(entries[i].isDirectory==true)
           {
             var directoryReaderIn = entries[i].createReader();
            directoryReaderIn.readEntries(successReader,fail);

           }

            if(entries[i].isFile==true)
             {
          entries[i].file(uploadFile, fail);
           }
        }
    };

 function uploadFile(file) {
var target=""; //the url to upload on server
     var ft = new FileTransfer(),path = "file://"+ file.fullPath,name = file.name;
                ft.upload(path, target, win, fail, { fileName: name });
               // var ft = new FileTransfer();
              //ft.upload(file.fullPath, target, win, fail, options);

            function win(r) {
                alert("Code = " + r.responseCode);
               alert("Response = " + r.response);
                alert("Sent = " + r.bytesSent);
            }

            function fail(error) {
                alert("An error has occurred: Code = " + error.code);
            }
}

A: use this
navigator.camera.getPicture(successFn, errorFn, { quality: 50,
    destinationType: navigator.camera.DestinationType.FILE_URI,
    sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
    mediaType: navigator.camera.MediaType.ALLMEDIA  });

this opens up options where u can choose files and selecting one will give u the name and path of the file in the successFn


text:
Q: Droppable not working with cloned element I have a drag and drop system and it's all working fine. I have multiple divs that are droppable and multiple divs that are draggable.
Then i implemented a clone system to the droppable area, so my droppable divs can all be cloned, and that's working fine too.
The problem it's when i try to drag elements to the cloned draggable areas.
The draggable divs don't detect the cloned droppable areas as a droppable area, i only can drag the elements to the original dropp areas.
Do i need to update something to let the draggable divs to know that there's new elements that are droppable?
---EDIT---
To everyone with the same problem, you need to destroy the droppable before the clone.
So in your clone function, just put this
$(".drop").droppable( "destroy" );

and then clone, and after that you call the droppable function again.

A: Are you using jQuery UI in your set up? You should try to change the class name of your draggable divs once they've been moved. Try using:
$( "#draggable" ).addClass( "newClassName" );

Once you've done that set up your droppable to accept that item. Sounds like jQuery UI think's your item has already been dropped.
 $( "#droppable" ).droppable({
      accept: ".newClassName",

A: To achieve what you are looking for you can reinitialise the newly created droppables by calling an update function on the drop event. I came to this using the example you provided. Try it out.
$(document).ready(function () {
             $(".duplicatedrop").click(
            function () {
            $(".drop").clone(true, true).appendTo(".drop");
            }
        );

    $(function() {
        $( ".drag" ).draggable({
            revert: true,
            cursor: 'move'
        });
    });

    updateDroppables();

    function updateDroppables(){
        $( ".drop" ).droppable({
            accept: ".drag",
            drop: function(event, ui) {
                $(this).find( "p" ).html( "Dropped!" );
                var clone = $(this).clone();
                clone.appendTo('body');
                updateDroppables();
            }
        });
    };
});


text:
Q: Classic Asp Date Hey, been looking for a while but I can't seem to find any info on how to handle date in classic asp.
For now, I need a way to calculate the number of days passed in the current year. I was thinking about a simple function that would take the current date, then make another date with (day = 1, month = 1, year(now)). And finally get the datediff(day) for these two. Easy enough, but I can't figure out how to do this. Help is appreciated!

A: Perhaps this example can help you? https://web.archive.org/web/20211020135923/https://www.4guysfromrolla.com/webtech/110398-1.shtml

A: DateDiff("d",DateSerial(Year(Now),1,1),Date)


text:
Q: What is a software prefetcher (processor setting)? Configuring the CPU(s) of a DELL Server (via iDrac) I have run accross the term software prefetcher.

I have an idea that prefetching is to "fetch" in advance data from the memory in to the CPUs' cache(s). I understand that this can be realized via Hardware. I do not understand the "software" here. What would switching enabled/disabled for the "Software Prefetcher" change?

A: I would suggest reading the manual for your server model. For example, according to this article:
https://www.dell.com/support/kbdoc/en-uk/000176921/bios-characterization-for-hpc-with-intel-cascade-lake-processors?lwp=rt

Software Prefetcher: [...] when set enabled, the processor will prefetch extra cache line for every memory request.


text:
Q: What are the criteria for re-combining? After you launch half your mass, it seems that you can't immediately re-combine your separate masses into one bigger cell.
Is this based on some amount of time, or some other criteria? Exactly what do I have to do before I can re-combine back into one big mass?

A: The time to recombine is based on the size of the offshoots. When the cell is split, every individual cell has a timer storing how long until they are able to recombine. There may be a component that if you have cells much smaller than your largest cell the timers for the small cells are reduced.
Edit:
So having looked through the source code at the link @BitCoder provided, I had it partially correct. The server has a base recombine time, currently 30 seconds. When a new cell is created (either via the player splitting, or running into a virus), the server sets the recombine time to be:

30 sec + (.02 * mass))

In summary: the recombine time of each cell is thirty seconds plus one additional second for every 50 mass the cell has when it is created.


text:
Q: How to get live variable updates on a statusbar in C++ with Qt's signals and slots? I am using a proprietary driver API in my C++ / Qt application. There is an object named "status" which is essentially an integer value, that can be used to monitor errors. A value of 0 indicates all is fine, a negative value is a specific error. I would like to program a statusbar (using Qt's QStatusBar) which will give me live updates with the "status" current value as I execute parts of the code. A simplified example of what I currently have:
DriverInterfaceClass.h
#ifndef DRIVERINTERFACECLASS_H
#define DRIVERINTERFACECLASS_H

#include <QObject>
#include "multicam.h"

class DriverInterfaceClass : public QObject
{
    Q_OBJECT
public:
    DriverInterfaceClass(QObject *parent = nullptr);
    ~DriverInterfaceClass();

private:
    void setStatus(int value);

private:
    MCSTATUS status;

signals:
    void statusChanged(const QString& status, int timeout);
};

#endif // DRIVERINTERFACECLASS_H

DriverInterfaceClass.cpp
#include "driverinterfaceclass.h"

DriverInterfaceClass::DriverInterfaceClass(QObject *parent)
    : QObject(parent)
{
    setStatus(McOpenDriver(NULL));
    status = McSetParamStr(MC_CONFIGURATION, MC_ErrorLog, "error.log");
}

DriverInterfaceClass::~DriverInterfaceClass()
{
    setStatus(McCloseDriver());
}

void DriverInterfaceClass::setStatus(int value)
{
    status = value;
    QString statusStr = QString::number(status);
    emit statusChanged(statusStr, 0);
}

MainWindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "driverinterfaceclass.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
    DriverInterfaceClass *driver;
};
#endif // MAINWINDOW_H

MainWindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    driver = new DriverInterfaceClass(this);
    connect(driver, &DriverInterfaceClass::statusChanged, ui->statusbar, &QStatusBar::showMessage);
}

MainWindow::~MainWindow()
{
    delete ui;
}

I have a problem figuring out how to update the statusbar with the value of the "status" variable. I am not getting any messages in my statusbar with this code. Perhaps I am missing something in the way I initialize my variable?

A: Cause
The statusChanged signal suffers from an unperceived existence. In other words, the driver object screams - STATUS CHAAAAAAANGED!!!!, but no one hears it. Here is why.
Your code is executed in the following order:
driver = new DriverInterfaceClass(this);

Then, as part of the constructor:
setStatus(McOpenDriver(NULL));
status = McSetParamStr(MC_CONFIGURATION, MC_ErrorLog, "error.log");

Only then is the connect statement executed:
connect(driver, &DriverInterfaceClass::statusChanged, ui->statusbar, &QStatusBar::showMessage);

Obviously, the signal is emited by setStatus BEFORE it is connected to the slot of ui->statusbar.
Note: You also set the value of status directly, without calling setStatus, i.e. status = McSetParamStr(..., thus the signal is not emited at all. However, calling setStatus instead would not help, because of the same reason as above.
Moving connect before new would cause a compiler error, because you cannot connect to something, which does not exist.
Solution
Do not emit signals from constructors. Do it when an event occurs.

A: To satisfy your invariant "emit signal whenever status is set" you need to use setStatus(McSetParamInt(... whatever)); method, don't modify status = xxx; directly (apart from the body of setStatus method). Then just change your setter function a bit to also emit the information about desired message to be displayed on the QStatusBar:
void DriverInterfaceClass::setStatus(int value)
{
    if (status != value)
    {
        status = value;
        emit statusChanged(myStatusValueToString(status));
    }
}

where signal decl should be:
signals:
    void statusChanged(const QString& msg);

and your myStatusValueToString just a simple mapping:
QString myStatusValueToString(int status)
{
  if (status == 0) return "OK";
  ... etc ...
}

The connection should look like:
QObject::connect(driver, &DriverInterfaceClass::statusChanged, statusBar, &QStatusBar::showMessage);


text:
Q: How to integrate private GitHub repo with Bluemix devOps service I am trying to build Continuous integration process for deploying blockchain applications into Bluemix  using devOps service.
Currently, this is the setup i have :

*

*Application code resided in private GitHub repo.

*We manually git clone the private repo and deploy the app using the Cloud Foundry "cf push" command.

Here is need to automate the app deployment process whenever there is new changes pushed to my private Github repo. Is there any way we can access the private GitHub repo using the bluemix devOps service and deploy code automatically ?

A: You should be able to accomplish this using the IBM Bluemix DevOps services. I just did it using my own private GitHub repository.

To set it up I just made a new Simple Cloud Foundry toolchain using the third-party GitHub integration. It prompted me for access to both my private and public GitHub repos.
After setting that up, Bluemix created a delivery pipeline which subsequently builds and deploys my app to Bluemix on each git commit:


text:
Q: What is "being out of job for a personal reason" called? After I finished my study, I had to chose not to do any job because I had to take care of my parent. The period took 3 years. And then I was back free to have a job. What is that period called.
On the Internet I found Personal leave, carer's leave, compassionate leave, family leave and career break. Which one is more appropriate for me to put in my resume for those 3 years?

A: Presuming you want to put the best face on things, compassionate leave and family leave seem best of the alternatives you listed, even though as noted in a comment you were not actually on a "leave".
Career break as described in Wikipedia seems neutral and applicable, although three years is a longer term than that entry mentions.
If you were an actor, the euphemism resting would apply.  If you were previously employed and returned to the same employer, sabbatical might be appropriate.  Other terms for gaps include hiatus and interregnum, the latter more applicable if you are a government or royalty.  Or you could say you were slacking, but some regard that as not good on a resume.

A: As in this article:

1999   Washington Post (Electronic ed.) 18 June   In a world where
  everyone has sick days, personal leave and mental health breaks,
  12 years of perfect attendance is a rare feat.

Personal leave if frequently referenced in AmE to absences from work due to 'personal' reasons, which you may or may choose not to elaborate on.


text:
Q: How to get all flash messages in Codeigniter? I have a number of fields that have numerous validations from codeigniter validations. but now its showing one single validation error flash that is truly validated message
Here is my controller block code
public function customer_upd()
{
    extract($_POST);
    $err = '';

    $date1 = $_POST['cust_upd_bd'];
    $date2 = $_POST['cust_upd_dom'];

    if($date2 != "") {
        $datediff = (strtotime($date2) - strtotime($date1));
        $res = floor($datediff / (60 * 60 * 24));
        if ($res == " ") {
            $err .= "Please Enter a Date";
        } elseif ($res < 365) {
            $err .= "Child marriage is prohibited";
        }
        if ($err != '') {
            $_SESSION['dateerror'] = $err;
            redirect('customer/edit/'.$_POST['ctmr_upd_id']);
        }
    }
    $original_value1 = $this->db->query("SELECT customer_email FROM customer WHERE id = ".$_POST['ctmr_upd_id'])->row()->customer_email ;
    if($_POST['cust_upd_email'] != $original_value1) {
        $this->session->set_flashdata('add_failed','Email id must be unique & valid email address.');
        $is_unique =  '|is_unique[customer.customer_email]';
    } else {
        $is_unique =  '';
    }
    $original_value2 = $this->db->query("SELECT customer_mobile FROM customer WHERE id = ".$_POST['ctmr_upd_id'])->row()->customer_mobile ;
    if($_POST['cust_upd_mobile'] != $original_value2) {
        $this->session->set_flashdata('add_failed','Mobile no must be unique & exact 10 digit numeric length. ');
        $is_phoneunique =  '|is_unique[customer.customer_mobile]';
    } else {
        $is_phoneunique =  '';
    }
    $this->form_validation->set_rules('cust_upd_email', 'Email', 'required|valid_email|trim'.$is_unique);
    $this->form_validation->set_rules('cust_upd_mobile', 'Mobile', 'required|exact_length[10]|is_natural|trim'.$is_phoneunique);

    $this->form_validation->set_rules('cust_upd_name', 'Customer name', 'trim|required|min_length[3]|callback_customAlpha');
    $this->session->set_flashdata('cust','The Customer field must be at least 3 characters in length. ');
    $this->form_validation->set_rules('cust_upd_bd', 'Date of birth', 'regex_match[(0[1-9]|1[0-9]|2[0-9]|3(0|1))-(0[1-9]|1[0-2])-\d{4}]');
    $this->form_validation->set_rules('cust_upd_dom', 'Date of marriage', 'regex_match[(0[1-9]|1[0-9]|2[0-9]|3(0|1))-(0[1-9]|1[0-2])-\d{4}]');
    if ($this->form_validation->run() ) {
        $userdata = $this->session->userdata();
        $userId = $userdata['id'];
        if (!$userId):
            redirect(site_url());
        endif;

        extract($_POST);
        print_r($_POST); exit;
        $data = array(
            'customer_name' => ucwords($_POST['cust_upd_name']),
            'birth_date' => $_POST['cust_upd_bd'],
            'anniversery_date' => $_POST['cust_upd_dom'],
            'customer_mobile' => $_POST['cust_upd_mobile'],
            'customer_email' => $_POST['cust_upd_email'],
            'status' => $_POST['cust_upd_status'],
            'address' => $_POST['ctmr_address'],
            'cat_type' => $_POST['file_cat']
        );
        $userdata = $this->session->userdata();
        $userId = $userdata['id'];
        $this->db->where('user_id', $userId);
        $this->db->where('id', $_POST['file_cat']);
        $this->db->where('cat_status', 'Enable');
        $get_file = $this->db->get('category');
        $res_file = $get_file->num_rows();

        if($res_file >0){
            $userdata = $this->session->userdata();
            $userId = $userdata['id'];
            $this->db->where('user_id', $userId);
            $this->db->where('id', $_POST['ctmr_upd_id']);
            $ctmr_upd = $this->db->update('customer', $data);
        } else {
            $this->session->set_flashdata('edit_failed','Something went wrong.');
            redirect('customer/edit/'.$_POST['ctmr_upd_id']);
        }
        redirect(site_url() . '/customer');
    } else {
        redirect('customer/edit/'.$_POST['ctmr_upd_id']);
    }
}

And here is my view code

            <?php if($error = $this->session->flashdata('add_failed')): ?>

                            <?php echo $error; ?>

            <?php endif; ?>
            <?php if($error1 = $this->session->flashdata('edit_failed')): ?>

                            <?php echo $error1; ?>

            <?php endif; ?>
            <?php if($error2 = $this->session->flashdata('cust')): ?>

                            <?php echo $error2; ?>

            <?php endif; ?>
            <?php if($_SESSION['dateerror']){
                echo '
'.$_SESSION['dateerror'].'
';
                unset($_SESSION['dateerror']);
            }
            ?>

And here is a snap

Whenever i tries to submit with their validate data, its showing this above error flash message.
i tried many times but unable to achieve any success.
Please guide me and tell me where am i going wrong?

A: Use below mentioned code to retrieve all flashdata.
$this->session->flashdata();

It will return array with all flashdata, simply omit the key parameter.
Let me know if it not works.


text:
Q: How to Use Multiple IF Conditions in C# I want to store multiple values in different SESSIONS for that I have multiple If conditions in VB Code that works fine
If roleRow.Item("Code").ToString() = "101" Then 'Admin Settings
    If roleRow.Item("Active") = True Then Session("101") = True Else Session("101") = False
End If
If roleRow.Item("Code").ToString() = "102" Then 'Summaries / Reports
    If roleRow.Item("Active") = True Then Session("102") = True Else Session("102") = False
End If
If roleRow.Item("Code").ToString() = "103" Then 'Invoices List
    If roleRow.Item("Active") = True Then Session("103") = True Else Session("103") = False
End If

but the same code structure doesn't work in C#.
It evaluates only the first IF condition and rest conditions it shows the same value as first IF condition. Any suggestions how to solve this?
private void UserPermissions_Read()
{
    BOL.Master.UsersRoles aDA = new BOL.Master.UsersRoles();
    DAL.Master.UsersRoles.UsersRolesDataTable aDT = new
    DAL.Master.UsersRoles.UsersRolesDataTable();
    aDT = aDA.Read("1", 1, "", 1, "", "", "", "");
    DataRow dRow;
    if (aDT.Rows.Count > 0)
    {
        dRow = aDT.Rows[0];
        if (dRow["Code"].ToString() == "101" && (Boolean)dRow["Active"] == true)
        {
            Session["101"] = true;
        }
        else
        {
            Session["101"] = false;
        }
        if (dRow["Code"].ToString() == "102" && (Boolean)dRow["Active"] == true)
        {
            Session["102"] = true;
        }
        else
        {
            Session["102"] = false;
        }
    }
    else
    {
        Session["101"] = false;
        Session["102"] = false;
        Session["103"] = false;
    }
}

A: It's not perfectly clear what you're trying to accomplish, but I suggest you think more about the problem then about "translating".
Is this closer to what you really want to accomplish?
//First I'll create an array of every value to be inspected and iterate through it....
foreach (var c in new[] {"104", "105", "106"})
{
    //Then I'll check the current value (considering the value of dRow["Active"]...
    Session[c] = ( ((bool)dRow["Active"]) && (dRow["Code"].ToString() == c) )  //Thanks to @jjwillmc observation
}

If you prefer to use only IFs, the VB code translate as follows:
If roleRow.Item("Code").ToString() = "101" Then 'Admin Settings
    If roleRow.Item("Active") = True Then Session("101") = True Else Session("101") = False
End If
If roleRow.Item("Code").ToString() = "102" Then 'Summaries / Reports
    If roleRow.Item("Active") = True Then Session("102") = True Else Session("102") = False
End If
If roleRow.Item("Code").ToString() = "103" Then 'Invoices List
    If roleRow.Item("Active") = True Then Session("103") = True Else Session("103") = False
End If

turns into:
if (roleRow.Item("Code").ToString() == "101") //Admin Settings
{
    if (roleRow.Item("Active"))
      Session["101"] = true;
    else
      Session["101"] = False;
    //Or simply: Session["101"] = (roleRow.Item("Active"));
}
if (roleRow.Item("Code").ToString() == "102") //Summaries / Reports
{
    if (roleRow.Item("Active"))
      Session["102"] = true;
    else
      Session["102"] = false;
    //Or simply: Session["102"] = (roleRow.Item("Active"));
}
if (roleRow.Item("Code").ToString() == "103") //Invoices List
{
    if (roleRow.Item("Active"))
      Session["103"] = true;
    else
      Session["103"] = false;
    //Or simply: Session["103"] = (roleRow.Item("Active"));
}

hope it helps.

A: Done....was missing For Loop inside the code...this way it is reading each line and putting for each line value in different SESSION......also before this line
DataRow dRow;       you have to declare each SESSION = False as default value....
DataRow dRow;
            if (aDT.Rows.Count > 0)
            {
                for (var i = 0; i <= aDT.Rows.Count -1; i++)
                {
                    dRow = aDT.Rows[i];

                    if (dRow["Code"].ToString() == "101" && (Boolean)dRow["Active"] == true)
                    {
                        Session["101"] = true;
                    }

                    else if (dRow["Code"].ToString() == "102" && (Boolean)dRow["Active"] == true)
                    {
                        Session["102"] = true;
                    }

                    else if (dRow["Code"].ToString() == "103" && (Boolean)dRow["Active"] == true)
                    {
                        Session["103"] = true;
                    }


text:
Q: Delete Settings in setup.ts if I use it in pageSetup.ts (TYPO3)? I have an Extension, for basic Settings.
Here I have TypoScript Files (in all three files are more settings, but for clarity I just put only one sample inside):
Configuration/TypoScript/constants.ts
plugin.tx_rmbase {
    settings {
        # cat=plugin.tx_rmbase/01_SiteSettings/a; type=string; label=Site Claim
        siteClaim = proudly presents by MonTea
    }
}

I want to use this in my Fluid-Template (not for an Action - just for the Backendlayouts). I have no Controller in this Extension.
In the Configuration/TypoScript/setup.ts I have the following:
plugin.tx_rmbase {
    settings {
        siteClaim = {$plugin.tx_rmbase.settings.siteClaim}
    }
}

In my other Extensions - that works without any additional Configurations - simply with e.g. {settings.siteClaim} in the Fluid Templates, and with e.g. $this->settings['siteClaim'] in the Controller.
I found a way to use it in my Fluidtemplate by editing my Resources/Private/TypoScript/pageSetup.ts like this:
page = PAGE
page {
    10 = FLUIDTEMPLATE
    10 {
        settings {
            # Settings for Usage in Frontend
            siteClaim = {$plugin.tx_rmbase.settings.siteClaim}
        }
    }
}

But if I doesn't need the Settings from setup.ts, because that doesn't work, I could delete that Settings-part in setup.ts ???
Is there a reason, why I shouldn't - or can I do it?
Edit
Update: Does someone knows, why the setup.ts-Part doesn't work in my BE-Layout-Template?

A: Be aware that you are working in another context. This will affect the visibility of your fluid variable. Especially you have no access to that data in PHP.
Otherwise you can delete all typoscript you know to be unused. This also will speed up the rendering of your site as the parsing of typoscript will be simplified. (for this small part it will not be noticable, but bigger parts may be worth)


text:
Q: Are normal deformations of an embedding open in the $C^{\infty}$-space of embeddings of a compact smooth manifold` Let $M$ be a compact smooth manifold (closed, for simplicity), $n\in\mathbb{N}$ and equip the space of embeddings $Emb(M,\mathbb{R^n})$ wih the Whitney-$C^{\infty}$-topology. (The weak and the strong one are the same as $M$ is assumed to be compact.) Fix an embedding $j\in Emb(M,\mathbb{R}^n)$ and a tubular neighbourhood of the embedded $j(M)\subseteq\mathbb{R}^n$.

Are small normal deformations of $j$ open in $Emb(M,\mathbb{R}^n)$?

To be more precise: Equip the normal sections $\Gamma(N(j(M))$ with the Whitney-$C^{\infty}$ topology and let $U\subset\Gamma(N(j(M))$ be the open (!) set of all sections $s$ such that the induced normal deformation $\{m+s(m)|m\in j(M)\}$ of $M$ lies in the tubular neighbourhood. Every such section $s\in U$ gives me an embedding $[m\mapsto j(m)+s(j(m)]\in Emb(M,\mathbb{R}^n)$. Do these embeddings form an open subset of $Emb(M,\mathbb{R}^n)$?
Some naive thoughts:
Consider a unit circle in the plane. Every open subset of the standard embedding of the circle should contain a small rotation of the circle, which does not come from a normal deformation of the circle. This suggests that the claim is false, but  I believe to remember that I saw a flavor of this kind ("small normal deformations of embeddings are open") somewhere, although I cannot figure out where it was.

A: Not to leave this question open:
The question as posed is wrong by the example I gave. However the example I gave is in some sense the maximum which can go wrong. More precisely small normal deformations as defined in the question are open if one factors out diffeomorphisms of $M$, e.g. they are open in $Emb(M,\mathbb{R}^n)/Diff(M)$ as Igor Khavkine kindly pointed out to me.
A proof of the new claim can be constructed along the lines of the proof of Theorem 44.1 in 'Kriegl, Michor: The convenient setting of global analysis', which shows that $$Diff(M)\rightarrow Emb(M,\mathbb{R}^n)\rightarrow Emb(M,\mathbb{R}^n)/Diff(M)$$ is a fiber bundle. The local sections are exactly the normal deformations I considered. I am grateful to Oldřich Spáčil who gave me the hint digging into the proof referenced.


text:
Q: Microsoft Solver Foundation gives wrong answer for a simple ILP I want to solve a binary Linear Problem in C# using Microsoft Solver Foundation. I don't know why I get wrong answer. The Objective Value should be 41.1 but I get 213. The value of 5 variables should be 1 and the other ones should be 0. But I get many many variables with wrong values.
The sum of each row of the matrix should be <= 1. That are my constraints, and as you see in Constraint_arr I get the right constraints.
Thanks for any help.

Define decision variables:
        SolverContext context = SolverContext.GetContext();
        Model model = context.CreateModel();
        Decision[,] x = new Decision[name_column.Length, 7];

        for (int i = 0; i < name_column.Length; i++)
        {
            for (int j = 0; j < 7; j++)
            {
                x[i, j] = new Decision(Domain.IntegerRange(0,1), "x" + i + j);
            }
        }

        for (int i = 0; i < name_column.Length; i++)
        {
            for (int j = 0; j < 7; j++)
            {
                model.AddDecisions(x[i, j]);
            }
        }

Create Constraint and add it to model:
Term[] Constraint_arr = new Term[name_column.Length];
        Term tempC;
        int jj;
        for (int i = 0; i < name_column.Length; i++)
        {
            tempC = 0;
            for (jj= 0; jj < 7; jj++)
            {
                if(vars_Matrix[i,jj] == 1)
                {
                    tempC += x[i,jj];
                }
            }
            Constraint_arr[i] = tempC;
            model.AddConstraints("constraint" + i, Constraint_arr[i] <= 1);
        }

Create Objective Function:
        Term objective_Func = 0;
        Term tempZ;
        for (int i = 0; i < name_column.Length; i++)
        {
            tempZ = 0;
            for (int j = 0; j < 7; j++)
            {
                tempZ += x[i, j] * ratio[i];
            }
            objective_Func+= tempZ;
        }

        model.AddGoal("Goal", GoalKind.Maximize, objective_Func);

print the answer:
        Solution solution = context.Solve(new SimplexDirective());

        Report report = solution.GetReport();

        for (int i = 0; i < name_column.Length; i++)
        {
            for (int j = 0; j < 7; j++)
            {
                Console.Write(x[i, j]);
            }
            Console.WriteLine();
        }

        Console.Write("{0}", report);
        Console.ReadLine();

A: The following MiniZinc model arrives at 14 as maximum value for the objective:
set of int: rows = 1..5;
set of int: cols = 1..7;
array[rows, cols] of 0..1: vars_Matrix = [|0, 0, 1, 0, 1, 1, 1
                                          |0, 0, 1, 1, 0, 1, 1
                                          |0, 0, 1, 0, 0, 0, 0
                                          |0, 0, 1, 1, 0, 1, 1
                                          |0, 0, 0, 0, 1, 0, 0|];

array[cols] of var 0..1: c;
var int: obj;

%  constraint
%      obj = sum(i in rows)(
%              sum(j in cols) (
%                c[i] * vars_Matrix[i, j]
%              )
%            );

constraint
  obj = sum([ sum([ c[i] * vars_Matrix[i, j] | j in cols ]) | i in rows ]);

solve maximize(obj);

Output
c = array1d(1..7, [1, 1, 1, 1, 1, 1, 1]);
obj = 14;

The same result is obtained from the following Z3py model:
    from z3 import *

    s = Optimize()

    Rows = range(5);
    Cols = range(7);
    vars_Matrix = [[0, 0, 1, 0, 1, 1, 1],
                   [0, 0, 1, 1, 0, 1, 1],
                   [0, 0, 1, 0, 0, 0, 0],
                   [0, 0, 1, 1, 0, 1, 1],
                   [0, 0, 0, 0, 1, 0, 0]]

    c = [Int("c" + str(i+1)) for i in Rows]
    obj = Int("obj")

    for i in Rows:
        s.add(c[i] >= 0, c[i] <= 1)

    s.add(obj == Sum( [ Sum( [ c[i] * vars_Matrix[i][j] for j in Cols ] ) for i in Rows ] ))

    s.maximize(obj)

    if sat == s.check():
        print(s.model())
    else:
        print("No solution. Sorry!")


text:
Q: How to select element relative to 'this' in javascript I have the following:

      <textarea rows="4" cols="50" id="send_message" placeholder="Enter text ...">  </textarea>
      OK
      Cancel

I want to bind the click method to the 'div' element , and when one of the child 'a' elements is clicked do separate things. I am trying to distinguish between them using the button text, but the following is not working:
$(function(){

$('#message').click(function(){

if($(this + ">a").is(":contains(OK)")) {

        console.log("OK!!");

How can I fix this?

A: Okay there are two ways of doing this:
.find(selector)
 if(this).find("a").is(":contains(OK)")) {

    console.log("OK!!");

OR
$(selector,context)
 if("a",this).is(":contains(OK)")) {

    console.log("OK!!");

A: In javascript, this is essentially the context of the current function. In jQuery event callbacks,  this is set to be the source element of the event - not the selector string, which is what you are treating it as.
Instead, you want to do a test like: if($("a", this).is(":contains(OK)")) {
This works because the second parameter to the jQuery selector is the context to search in, so you are only searching for the a tags under the source element of the click.

A: Binding the click element to the Div, then checking the text string of the A tags will make both events happen on every click. You want to bind 2 separate click events on each A tag. Add an ID to each A tag, then try this code
$('#okLinkID').click(function(){
  console.log("OK!!");
});

$('#cancelLinkID').click(function(){
  console.log("Cancel!!");
});

A: //Attaches only one listener to the #message div and listens for any 'a' element within it to be clicked.
$('a','#message').on('click',function(){
    var $this = $(this),
        btnText = $this.text();
    console.log(btnText);
});

http://jsfiddle.net/YA7Ds/


text:
Q: Is it possible to get the Android ADK working on an ASUS Eee Pad Transformer running 3.1? I am running the ADK demo app tweaked for Android 3.1, using the ASUS Eee Pad Transformer tablet and an ADK board, built as described in Get Started With Android ADK (LINUX).
I seem to be having the same symptoms as described in Stack Overflow question How can I get the ADK DemoKit example working on a Google I/O Galaxy Tab 10.1?.  It could be the transformer does not support the ADK yet (as per the Galaxy tab), but is it possible to get the Transformer working somehow?

A: With the changes in the other question I get a compiled version of the demo app and can run the app but when I connect the tablet to the shield nothings happens, it's like the cable which comes with the tablet isn't valid for use with that.

A: I emailed Asus technical support about whether or not the Transformer supports the ADK. This is the response I got:
Dear Valued Customer,
Thank you for contacting ASUS Customer Service. The USB ports on TF101 system only supports the external storage devices like flash drive or HDD with USB cable, File system needs to be FAT/FAT32/NTFS. CD/DVD ROM drivers are currently not supported. Sorry for the inconvenience.
Thank you,
Jason
ASUS Customer Service.


text:
Q: No se permite EditItem para esta vista? estoy creando un datagrid en mi proyecto de wpf y quiero que los usuarios sean capaces de escribir directamente en el datagrid, he puesto entre sus propiedade el IsreadOnly en falso y can user add rows en true, cuando le doy start a la aplicación me sale la fila en blanco pero cuando doy click en ella para escribir me sale un error  No se permite EditItem para esta vista.Les dejo el código, si alguien me pudiera ayudar.
<Grid Margin="20">
        <DataGrid x:Name="DataGridXAMAL1"
                  VerticalAlignment="Top"
                  SelectionChanged="DataGridXAMAL1_SelectionChanged"
                  CanUserReorderColumns="False"
                  IsReadOnly="False"
                  AlternatingRowBackground="LightGray"
                  AutoGenerateColumns="False"
                  HorizontalAlignment="Center"
                  VerticalScrollBarVisibility="Auto"
                  HorizontalScrollBarVisibility="Auto"
                  CanUserAddRows="True"
                  CanUserDeleteRows="True"
                  MinRowHeight="40">
            <DataGrid.Resources>
                <Style TargetType="{x:Type DataGridColumnHeader}">
                    <Setter Property="Background" Value="Teal"/>
                    <Setter Property="FontWeight" Value="SemiBold"/>
                    <Setter Property="BorderThickness" Value="0,0,1,2"/>
                    <Setter Property="BorderBrush" Value="White"/>
                    <Setter Property="Height" Value="40"/>
                    <Setter Property="FontSize" Value="16"/>
                    <Setter Property="FontFamily" Value="Corbel"/>
                    <Setter Property="HorizontalContentAlignment" Value="Center"/>
                    <Setter Property="Foreground" Value="White"/>
                </Style>
            </DataGrid.Resources>
            <DataGridTextColumn></DataGridTextColumn>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Etapa" Binding="{Binding Periods}"  Width="*" MinWidth="100" IsReadOnly="False"/>
                <DataGridTextColumn Header="Inicio" Binding="{Binding Start1}" MinWidth="100" IsReadOnly="False"/>
                <DataGridTextColumn Header="Terminacion" Binding="{Binding Finish}" MinWidth="100" IsReadOnly="False"/>
                <DataGridTextColumn Header="Tareas" Binding="{Binding Homework}" MinWidth="100" IsReadOnly="False"/>
                <DataGridTextColumn Header="Instituciones" Binding="{Binding Institutions}" MinWidth="100" IsReadOnly="False"/>
                <DataGridTextColumn Header="Recursos " Binding="{Binding Financial}" MinWidth="100" IsReadOnly="False"/>
                <DataGridTextColumn Header="Materiales" Binding="{Binding Material}" MinWidth="100" IsReadOnly="False"/>
                <DataGridTextColumn Header="Resultado" Binding="{Binding Results}" MinWidth="100" IsReadOnly="False"/>
                <DataGridTextColumn Header="Salidas" Binding="{Binding Out}" MinWidth="100" CanUserResize="False" IsReadOnly="False"/>
            </DataGrid.Columns>
        </DataGrid>
        <TextBox x:Name="Financial" HorizontalAlignment="Center" Height="32" Margin="229,315,451,0"  Text="Recursos" VerticalAlignment="Top" Width="120" Foreground="Gray" FontSize="15" TextAlignment="Center"  AcceptsReturn="True" MouseEnter="Financial_OnMouseEnter" MouseLeave="Financial_OnMouseLeave"/>
        <TextBox x:Name="AppResults" HorizontalAlignment="Center" Height="32"   VerticalAlignment="Top" Width="120"  Margin="596,314,84,0" Text="Resultado"  TextAlignment="Center"  Foreground="Gray" FontSize="15"  AcceptsReturn="True" MouseEnter="AppResults_OnMouseEnter" MouseLeave="AppResults_OnMouseLeave"/>
        <TextBox x:Name="AppHomework" HorizontalAlignment="Center" Height="32" VerticalAlignment="Top" Width="120"  Margin="596,251,84,0" Text="Tareas"  TextAlignment="Center"   Foreground="Gray" FontSize="15"  AcceptsReturn="True" MouseEnter="AppHomework_OnMouseEnter" MouseLeave="AppHomework_OnMouseLeave"/>
        <TextBox x:Name="AppPeriod" HorizontalAlignment="Center" Height="32"  VerticalAlignment="Top" Width="120"  Margin="32,249,648,0" Text="Etapa" TextAlignment="Center"  Foreground="Gray" FontSize="15"  AcceptsReturn="True" MouseEnter="AppPeriod_OnMouseEnter" MouseLeave="AppPeriod_OnMouseLeave"/>
        <TextBox x:Name="Institutions" HorizontalAlignment="Center" Height="32"   VerticalAlignment="Top" Width="120"  Margin="32,314,648,0"  Text="Instituciones"  TextAlignment="Center"  Foreground="Gray" FontSize="15"  AcceptsReturn="True" MouseEnter="Institutions_OnMouseEnter" MouseLeave="Institutions_OnMouseLeave"/>
        <TextBox x:Name="AppOut" HorizontalAlignment="Center" Height="32" Margin="342,377,338,0"  Text="Salidas" VerticalAlignment="Top" Width="120" TextAlignment="Center"  Foreground="Gray" FontSize="15"   AcceptsReturn="True" MouseEnter="AppOut_OnMouseEnter" MouseLeave="AppOut_OnMouseLeave"/>
        <TextBox x:Name="AppFinish1"  HorizontalAlignment="Center" Height="32" VerticalAlignment="Top" Width="120" Margin="416,250,264,0" Text="Actividades"  TextAlignment="Center"  Foreground="Gray" FontSize="15"  AcceptsReturn="True" MouseEnter="AppFinish1_OnMouseEnter" MouseLeave="AppFinish1_OnMouseLeave"/>
        <TextBox x:Name="AppStart1" HorizontalAlignment="Center" Height="32"  VerticalAlignment="Top" Width="120" Grid.Column="0" Margin="229,249,451,0"  Text="Inicio"  TextAlignment="Center"  Foreground="Gray" FontSize="15"  AcceptsReturn="True" MouseEnter="AppStart1_OnMouseEnter" MouseLeave="AppStart1_OnMouseLeave"/>
        <TextBox x:Name="Material" HorizontalAlignment="Center" Height="32" Margin="416,314,264,0"  Text="Materiales" VerticalAlignment="Top" Width="120" FontSize="15" Foreground="Gray" TextAlignment="Center"  AcceptsReturn="True" MouseEnter="Material_OnMouseEnter"  MouseLeave="Material_OnMouseLeave"/>
        <Button Content="Insertar" HorizontalAlignment="Left" Margin="999,247,0,0" VerticalAlignment="Top" Width="129" Click="BtnAddPeriod_Cliked" Background="Gray" BorderBrush="{x:Null}" FontFamily="Corbel" FontSize="18"/>
        <Button Content="Borrar" HorizontalAlignment="Left" Margin="999,377,0,0" VerticalAlignment="Top" Width="129" Click="BtnDeletePeriod_Click" RenderTransformOrigin="0.947,0" Background="Gray" BorderBrush="{x:Null}" FontFamily="Corbel" FontSize="18"/>
        <Button Content="Modificar" HorizontalAlignment="Left" Margin="999,312,0,0" VerticalAlignment="Top" Width="129" Click="BtnModificarPeriod_Click" Background="Gray" BorderBrush="{x:Null}" FontFamily="Corbel" FontSize="18"/>
        <Button Content="Guardar" HorizontalAlignment="Left" Margin="1157,312,0,0" VerticalAlignment="Top" Width="129" Background="Gray" BorderBrush="{x:Null}" FontFamily="Corbel" FontSize="18"/>
        <Button Content="Cargar" HorizontalAlignment="Left" Margin="1157,375,0,0" VerticalAlignment="Top" Width="129" Background="Gray" BorderBrush="{x:Null}" FontFamily="Corbel" FontSize="18"/>
        <Button Content="Limpiar Tabla" HorizontalAlignment="Left" Margin="1157,247,0,0" VerticalAlignment="Top" Width="129" Background="Gray" BorderBrush="{x:Null}" FontFamily="Corbel" FontSize="18" Click="Button_Click"/>

    </Grid>

// método para añadir elementos al datagrid
private void BtnAddPeriod_Cliked(object sender, RoutedEventArgs e)
        {
            Period tempPeriod = new Period
            {

                Periods = AppPeriod.Text,
               Start1 = AppStart1.Text,
                Finish = AppFinish1.Text,
               Homework = AppHomework.Text,
              Financial = Financial.Text,
               Material = Material.Text,
              Results = AppResults.Text,
              Out = AppOut.Text,
              Institutions = Institutions.Text
          };

          DataGridXAMAL1.Items.Add(tempPeriod);
}


text:
Q: How to classify nested xml tags in aws glue while capturing the attributes I have the following xml sample:
<ParentTag xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="68067108" ClientID="1" DocumentCreationDate="2018-04-10T00:00:05" DocumentVersion="9" EventClassID="1987" STBLogCreationDate="2018-04-09T11:38:59" SampleID="496" xsi:noNamespaceSchemaLocation="/opt/web/ams_proxy/webapps/ams_proxy/WEB-INF/amsXmlSchema_DTVPA_Version9.xsd">
    <Event EventTime="2018-04-09T11:41:02">
        <LiveViewEvent>
            <Channel channelObjectId="3062323">
                <Stream streamId="40" streamType="Video"/>
                <Stream streamId="41" streamType="Audio"/>
                <Stream streamId="65535" streamType="Data"/>
            </Channel>
        </LiveViewEvent>
    </Event>
</ParentTag>

I need the id in ParentTag, the EventTime and the LiveViewEvent data (channelObject, video, audio and data). I got to the point of getting the data in the LiveViewEvent (as a struct) and the EventTime, but it seems to skip the attributes in ParentTag.
Perhaps I should also mention that there are other types of events (than LiveViewEvent with different data but I don't need them.
Any help is highly appreciated.
Thank you,

A: I think the only way is to create a classifier  in the AWS Glue console with Row tag as "ParentTag" and then you will be able select the necessary data using struct and array data type.


text:
Q: How to shift a linked list's data? (in C) My question is simple and answers too rare. I know how to add or remove a node but how do you copy one previous node's data to the following node? Basically with an array the easiest way to shift it is to copy to the last element the previous element and move up the array like so:
for (i = number_of_elements ; i > 0; i--)
    tab[i] = tab[i-1];

Otherwise you would copy each element to the next and have the same data for each element which we don't want.
Then I can assign to tab[0] a new value.
But how to do that with a linked list? I know how to add a node to the beginning of the list:
struct node *node (struct node *head, int data)
{
    struct node *new_node = malloc(sizeof(struct node));

    new_node->data = data;
    new_node->next = head;
   // new_node->prev = ??

    return new_node;
}

which I assign to my list pointer so that it adds to the left. But I can't go up a linked list. Since the pointer next leads to the next node. Do I have to add a prev pointer to each node? But to what should it point? Thank you for helping in any way or for your rebuke because I just can't think properly.
edit: My idea then is to do simply as follows:
for (current = head; current!= NULL; current=current -> next) ;

and from there:
for( ; current!= head; current = current -> prev)
    current ->data = current -> prev -> data;
return head;

A: Something like this?
void Shift(node* Head) {
    type PrevData = Head->Data;
    Head = Head->Next;
    while (Head) {
        type Temp = Head->Data;
        Head->Data = PrevData;
        PrevData = Temp;
        Head = Head->Next;
    }
}