text:
Q: Create drop down on the fly I have looked all over for an answer to this, but cant seem to find a definitive answer.
I want to be able to display a dropdown, populated from MySQL with PHP and have next to it a '+' or something that will, when clicked on, create another dropdown with the same data as the first.
In this way, the user can add as many dropdowns as they want.  There will be around 25 items in each dropdown.  I'm open to JS,JQuery etc. - just need to get it done!
I'd appreciate any and all help.
Rob
Edit
Had a night sleep - so let's try again!
Based on @adeno code I cam up with this:
?>

<!doctype html>
<html lang="en">
 <head>
 <title>Document</title>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

</head>

<body>

<form action = 'testselectprocess.php' method='POST'>

<div>
<select id='test' name='test0'>
    <option name='first' value = '1'>option 1</option>
    <option name='second' value = '2'>option 2</option>
    <option name='third' value = '3'> option 3</option>
</select>
<select id='counting' name='count0'>
    <option name='first' value = '1'>1</option>
    <option name='second' value = '2'>2</option>
    <option name='third' value = '3'>3</option>
</select>
</div>

<button  type='button' class="more">Add another...</button>

<script>
var c=0;
$('.more').on('click', function() {
//alert(c);
$(this).before( $(this).prev().clone());
$('#test').attr('name', 'test'+ c)
$('#counting').attr('name', 'count'+ c)
c++;
});

</script>

<input type="submit" value="Add this." name="what">

</form>

 </body>
</html>

Trouble is - after the first 'Add another...' press, the id numbers don't increment. Looking at it with IEs DOM explorer the id increments once only.  Wish I knew how to cut and paste in the DOM explorer but I only seem to be able to copy one element.

A: Depends on the markup, but in principle it's pretty straight forward,  you create a button that when clicked clones the select and inserts the clone
$('.more').on('click', function() {
    $(this).before( $(this).prev().clone() )
});

FIDDLE


text:
Q: Offspring Generation From More than Two than Two Chromosomes I am writing a GA in Python for camera placement optimization to get the highest possible coverage. The GA is working fine for two cameras. I am doing the following when I need to generate offspring/child -
# each chromosome has 6 genes, [camera name, x location, y location, z location, x angle, and y angle]
mom = "CamA_X1_Y1_Z1_xangle1_yangle1"
dad = "CamB_X2_Y2_Z2_xangle2_yangle2"

child_1 = "CamA_X1_Y2_Z1_xangle2_yangle1"
child_2 = "CamB_X2_Y1_Z2_xangle1_yangle2"

I am taking one gene from one chromosome followed by another gene from the next chromosome. The process is reversed for the second child.
The issue is I am having more than two (3/4) chromosome (camera). In that case what should be the proper process of generating the child?

A: It seems this is related to multi-parent crossover.  There are many ways you can go about this, but here are two:

*

*Randomly select the child's gene from the pool of parents (for 3 parents, there is a ⅓ chance the child will inherit each gene)

*Generate every permutation and select the top k to move on

Randomly selecting will be the best for time and memory, while generating the permutations will likely yield better results.  It looks like there would be 125 (5^3) permutations.

A: You have to pick two parents from a pool of n parents.  Presumably each parent has a score with which to compare success.  Pick 2 or 3 potential parents at random with the best scoring of the set going forward to be an actual parent.  Then repeat to select the second parent.
This is Tournament selection with a probability of 1.0 for the best chromosome in the tournament.  High scoring chromosomes have a better chance of being a parent than low-scoring ones, though the low-scoring chromosomes have a non-zero chance of having offspring.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Pivot table vs formulas Google sheets Just a quick question
Is it better to use pivot tables?
I would really appreciate if you can tell me why I should I usen them or why should I not.
Thanks!

A: for example:
=QUERY(A2:C; "select A,sum(C) where A is not null group by A pivot B")


text:
Q: Overwrite duplicate row from static INSERT statement I will be inserting rows using an INSERT statement where the values are static and not already in the database. Something like:
INSERT INTO MY_TABLE (ID, NAME) VALUES(123, 'Herbert')

If MY_TABLE already has a row with ID equal to 123 but the NAME is Herbie, how can I keep the new data in the INSERT statement (123, Herbert) and discard what's already in MY_TABLE (123, Herbie)?
I know about the SQL Server IGNORE_DUP_KEY setting, but I think that ignores the data in the INSERT statement and keeps the data that's already in the table. I want the reverse.
Update
To clarify, I don't want to change the INSERT statement. I want to keep it the same. I want to do the work on the server side somehow. Basically IGNORE_DUP_KEY is what I want, except its keeping the wrong data.
Update 2
I think what I am trying to do is different than the duplicate question mentioned. I don't want to change the INSERT statement at all. I want to handle it on the backend either with a SQL Server setting that I don't know about, or perhaps by creating a trigger.

A: Ok, I think I've got something that works. It's just a basic INSTEAD OF INSERT trigger that deletes the row on the table if it already exists and then inserts the new row. This trigger is run every time a row is inserted into the table.
CREATE TRIGGER TR_MY_TABLE_IN ON MY_TABLE
INSTEAD OF INSERT
AS
BEGIN
    SET NOCOUNT ON;

    DELETE FROM MY_TABLE WHERE ID IN (SELECT ID FROM INSERTED)
    INSERT INTO MY_TABLE SELECT * FROM INSERTED

END

A: As I see it, you have 2 choices.
First you can delete from the table where the ID = your ID coming in.  This can be done without having to worry if the ID already exists since deleting a record that doesn't exist does not produce an error in SQL.  If you insist on only using an Insert statement, then this is your option.
Add
Delete MY_TABLE where ID = 123
INSERT INTO MY_TABLE (ID, NAME) VALUES(123, 'Herbert')

Second, you can add a "check" to see if the ID already exists and have an Insert statement and an Update statement depending on whether the ID exists already.
If(select ID from MY_TABLE where ID = 123)
    Update MY_TABLE
     Set NAME = 'Herbert'
    Where ID = 123
ELSE
    INSERT INTO MY_TABLE (ID, NAME) VALUES(123, 'Herbert')


text:
Q: Standard SQL String to Date I have a string date formatted as 20190101 that I'm trying to convert to 2019-01-01. How would I do this in standard? I know in legacy I could simply do date('20190101'), but not sure how to do this in standard.
Thank you

A: Use PARSE_DATE():
select PARSE_DATE('%Y%m%d', '20190101')

A: Easy:
SELECT PARSE_DATE('%Y%m%d',  '20190101')

Format elements for date is here:
https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#supported-format-elements-for-date


text: Q: What's the most efficient way to write a video shader that uses many previous input frames? I'm writing a video effect in iOS using Metal that requires pixel data of the current frame as well as many previous frames of the original input video. Is there a common pattern or best practice for how to achieve this type of shader that makes the most efficient use of memory and the GPU?


text:
Q: How to Generate Random Covariance Matrix from Wishart Distrubtion I need to generate an n x n, positive-definite covariance matrix for a project. Drawing from the Wishart distribution was recommended. How do I generate a random covariance matrix in R, ideally also using the Wishart Distribution. I've tried rwishart() to get values, but need more help. Thanks

A: Please see the function documentation by running ?rWishart.
As you can read, you need to supply the number of samples n you want (i.e. n random matrices), the degrees of freedom df, and the parameter Sigma to the function. In addition, you also need to decide on the dimension of the wanted random matrix.
# Set parameters
n <- 1  # Number of matrices
p <- 5  # Dimension
df <- 10  # Degrees of freedom
Sigma <- toeplitz((p:1)/p)  # the matrix parameter of the distribution

# Draw n Wishart distributed matrices
rwish <- drop(rWishart(n, df, Sigma))
print(rwish)

The function generates a 1 x p x p array (effectively a matrix) but we drop the unneeded dimension.
You can generate a wishart distributed matrix "manually" by
library("mvtnorm")
rgaus <- rmvnorm(n = df, mean = rep(0, p), sigma = Sigma)
rwish2 <- crossprod(rgaus) # crossprod is the same as "t(rgaus) %*% rgaus"

which should help you understand better what the Wishart distribution actually is. It is the distribution of the so-called scatter matrix df samples from a zero-mean multivariate normal distribution with variance Sigma.


text:
Q: Cannot find control with name: 'email' in angular created formgroup emailGroup email and comfirm email group method is showing 'The declaration was marked as deprecated here.' as shown in the image
enter image description here
this.employeeForm = this.fb.group({
      fullName: ['', [Validators.required, Validators.minLength(2), Validators.maxLength(10)]],
      contactPreference: ['email'],
      emailGroup: this.fb.group({
        email: ['', [Validators.required, CustomValidators.emailDomain('dell.com')]],
        confirmEmail: ['', [Validators.required]],
      }, { validator: matchEmails }),
      phone: [''],
      skills: this.fb.group({
        skillName: ['', Validators.required],
        experienceInYears: ['', Validators.required],
        proficiency: ['', Validators.required]
      }),
    });

                Email

                    <input id="email" type="text" (blur)="logValidationErrors()" class="form-control"
                        formControlName="email">

                        {{formErrors.email}}

                    Confirm Email

                    <input id="confirmEmail" type="text" class="form-control" (blur)="logValidationErrors()"
                        formControlName="email">

                        {{formErrors.confirmEmail ? formErrors.confirmEmail
                        : formErrors.emailGroup}}

A: It should be validators instead of validator
 this.employeeForm = this.fb.group({
      fullName: ['', [Validators.required, Validators.minLength(2), Validators.maxLength(10)]],
      contactPreference: ['email'],
      emailGroup: this.fb.group({
        email: ['', [Validators.required, CustomValidators.emailDomain('dell.com')]],
        confirmEmail: ['', [Validators.required]],
      }, { validators: matchEmails }),
      phone: [''],
      skills: this.fb.group({
        skillName: ['', Validators.required],
        experienceInYears: ['', Validators.required],
        proficiency: ['', Validators.required]
      }),
    });

Then in html you should wrap email control inside emilGoup formGroup

        Email

          <input
            id="email"
            type="text"
            (blur)="logValidationErrors()"
            class="form-control"
            formControlName="email"
          />

            {{ formErrors.email }}

          Confirm Email

          <input
            id="confirmEmail"
            type="text"
            class="form-control"
            (blur)="logValidationErrors()"
            formControlName="email"
          />

            {{
              formErrors.confirmEmail
                ? formErrors.confirmEmail
                : formErrors.emailGroup
            }}


text:
Q: How to Read the last word of file and append "," if not there. UNIX I want to read last word of all txt files and if "," is not present then append it with ","
I know how to append
for file in *.txt; do
echo ',' >> "$file"
done

But before this code need to put if conndition and execute this only ',' is not  after the last of  the file.
eg. A text file abcd.txt has following data
hello how are you hope you are good
Now i have to chech wheather ","(comma) is present at the end of file or not
here " good" is the last line and if "," is not then append ","
i.e hello how are you hope you are good,
Same this check for all files and append "," if not present.
Please help

A: As @Alex H. pointed out, you could use tail to check the last character.
Based on the test, you can modify the file with sed:
for file in *.txt; do
    if [ "$(tail -c 2 "$file")" != "," ]; then
        sed '$s/$/,/' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
    fi
done

*

*[ "$(tail -c 2 "$file")" != "," ] - Tests that final character is not already ,.  As @Yushi points out in his comment, the last character of the file will be $ (end of line character) so we need tail -c 2 to check for the character preceding it.

*sed '$s/$/,/' "$file" - Adds a , character to the end of the last line.

*> "$file.tmp" && mv "$file.tmp" "$file" - Just makes sure the file is modified and saved to its original name.
If on GNU/Linux, you can use the much shorter sed -i '$s/$/,/' "$file" to accomplish the same thing.  -i is the GNU sed option to modify the file "inplace" by creating a temporary file to replace the original (in the background).

A: Use tail to get the last characters of a file :
tail -c 1 filename

then catch its output and compare it with ","


text:
Q: Qt6 migration - UIC generated code fails to compile (connect slots) - updated I'm trying to port my project from Qt5 to Qt6.
My problem is that UIC generated code looks like this:
QObject::connect(SelectHome, &QToolButton::clicked, toQPSQLSettingUI, qOverload<>(&QWidget::selectHome));

MSVC2019 compilations fails with:
ui_toqpsqlsettingui.h(74,101): error C2039: 'selectHome': is not a member of 'QWidget'
C:\Qt\6.0.4\msvc2019_64\include\QtWidgets\qcompleter.h(57): message : see declaration of 'QWidget'
C:\Users\I542264\source\repos\tora\src\ui_toqpsqlsettingui.h(74,1): error C2065: 'selectHome': undeclared identifier

See the target is method is QWidget::selectHome, so IMHO MSVC is right: QWidget does not have method selectHome. But target should be sub-class method toQPSQLSettingUI::selectHome

Complete source is here. Initially created for Qt2, migrated to Qt3=>Qt4=>Q5.
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>toQPSQLSettingUI</class>
 <widget class="QWidget" name="toQPSQLSettingUI">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>600</width>
    <height>517</height>
   </rect>
  </property>
  <property name="sizePolicy">
   <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
    <horstretch>0</horstretch>
    <verstretch>0</verstretch>
   </sizepolicy>
  </property>
  <property name="minimumSize">
   <size>
    <width>600</width>
    <height>0</height>
   </size>
  </property>
  <property name="windowTitle">
   <string>Form1</string>
  </property>
  <layout class="QGridLayout">
   <property name="margin">
    <number>11</number>
   </property>
   <property name="spacing">
    <number>6</number>
   </property>
   <item row="0" column="1" colspan="2">
    <widget class="QLineEdit" name="PGSQL_HOME"/>
   </item>
   <item row="0" column="0">
    <widget class="QLabel" name="TextLabel6_2_2_2">
     <property name="toolTip">
      <string>The default dateformat to use when querying the database.</string>
     </property>
     <property name="text">
      <string>PgSQL home</string>
     </property>
     <property name="wordWrap">
      <bool>false</bool>
     </property>
     <property name="buddy">
      <cstring>PGSQL_HOME</cstring>
     </property>
    </widget>
   </item>
   <item row="1" column="0">
    <spacer name="verticalSpacer">
     <property name="orientation">
      <enum>Qt::Vertical</enum>
     </property>
     <property name="sizeHint" stdset="0">
      <size>
       <width>20</width>
       <height>40</height>
      </size>
     </property>
    </spacer>
   </item>
   <item row="0" column="3">
    <widget class="QToolButton" name="SelectHome">
     <property name="text">
      <string>...</string>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <tabstops>
  <tabstop>PGSQL_HOME</tabstop>
 </tabstops>
 <resources/>
 <connections>
  <connection>
   <sender>SelectHome</sender>
   <signal>clicked()</signal>
   <receiver>toQPSQLSettingUI</receiver>
   <slot>selectHome()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>606</x>
     <y>20</y>
    </hint>
    <hint type="destinationlabel">
     <x>314</x>
     <y>258</y>
    </hint>
   </hints>
  </connection>
 </connections>
 <slots>
  <signal>signal1()</signal>
 </slots>
</ui>


text:
Q: Getting an NSDate via NSDateFormatter from a string of unknown format I know there are many NSDateFormatter questions on here, so if I duplicate, I'm sorry. I just couldn't find anything that was quite what Im asking.
From all the questions here on SO, I have come to the conclusion that -[NSDateFormatter dateFromString:] will always return NULL if your formatter object doesn't have the correct date format. How do you get a date from a string if you don't know the format? I'm trying to get a date from a UITextField.
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setLocale:[NSLocale currentLocale]];
[formatter setLenient:YES];
NSDate *tempDate = [formatter dateFromString:self.birthdayTxtfld.text];
self.currentCustomer.birthday = ([self.birthdayTxtfld.text isEqualToString:@""]) ? NULL : tempDate;
[formatter release];

tempDate is always NULL.

A: I think your taking the wrong approach. I would on the other hand restrict and format the UITextField so the user has to enter the date in a specific format. Or just use a date picker. There are just way too may different inputs the user could give you.
Or you can read through this: NSDate
Another option is to create a list of accepted date formats:
#define DATEFORMATS @[@"MM/dd/yyyy", @"MM/dd/yy",...
Then Have a method that you pass the date string to and check if you can format it:
+ (NSDateFormatter*)getDateFormat:(NSString*)dateString {

    NSArray *dateFormats = DATEFORMATS;
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    NSDate *date = nil;
    for (NSString *dateFormat in dateFormats) {
        [formatter setDateFormat:dateFormat];
        date = [formatter dateFromString:dateString];
        if (date) {
            return formatter;
        }
    }
    return nil;
}

If you get nil its not a date or its in a format you don't support. Otherwise you will have the correct format you need. You can switch this around to return the date instead of the format. I have it this way because I needed the format not the date for a project.

A: While I'm in agreement with @Jaybit that you probably need to ditch the text box and use a better input, the answer to this specific question lies in some crafty string parsing.  Whenever you are doing string parsing, RegEx is your friend.  Web developers end up having to do this crap all the time.  This example is in JavaScript, but the RegEx ought to be portable enough that it works in ObjC:
http://www.codingoptimist.com/2009/07/using-javascript-and-regex-to-parse.html
You can do this with RegExKit or NSRegularExpression


text:
Q: How to create ArcPy script that checks for duplicates and warns if adding one? I am new to GIS(Arcpy)/Python programming , but I have experience in other languages. I have a question regarding the possibility to create a tool/script that does the following
-- Check a specific attribute field and see if there are any Duplicates (Our problem is that our DOC_ID field is supposed to be a unique value but some interns are accidently pasting/writing the same DOC_ID from a previous edit and saving it.
*The checking for duplicates is not that important as I have create a seconday field to check the data within the DOC_ID field to find duplicates*
-- Is it possible for the tool / script to be continuous. What i mean for this is that if a user accidently inputs a DOC_ID that is already within the list ... some kind of error or warning message would pop up saying that the "DOC_ID has already been used".
  ^(This is the main feature that I am trying to create or solve.)

If this is not possible, are there any other paths that I should consider.
(Validation Rules , etcetc)
This is not a big problem currently. There are only around 100-200 duplicate entries so far. We are trying to avoid the problem the best we can early once we start to implement more and more entries.

A: You might be interested in the ArcGIS for Local Government Attribute Assistant add-in. It's a customizable editor extension that you could use to manage your unique ID field. It would need to be set up on each editor's machine.

The Attribute Assistant uses a series of predefined methods to automatically populate attributes when updating or adding new features to the geodatabase. For example, one method populates the full road name on each road centerline and site address feature from a valid list of road names contained in a master street name table. Other methods help you maintain the integrity of your address data by populating a unique identifier, last editor, and last update date on each feature.
Component                        Description
------------------------------------------------------------------------------------------
Attribute Assistant toolbar      Contains the tools to update the attributes of selected
                                 features based on the rules defined in the Generate ID
                                 table and Dynamic Value table

Generate ID table                Used to generate unique identifiers for features

Dynamic Value table              Contains rules defining how attributes are updated


text:
Q: Server.MapPath giving inconsistent output In my C# Application, inside Application_Start function of Global.asax (D:\inetpub\wwwroot\projectApp\Global.asax), I used Server.MapPath with path as "config\config.cfg".
String absPath = Server.MapPath("config\config.cfg");

It was working correctly, but intermittent, instead of mapping it to

D:\inetpub\wwwroot\projectApp\config\config.cfg,

it maps it to either

D:\inetpub\wwwroot\projectApp\A\config\config.cfg, or,
  D:\inetpub\wwwroot\projectApp\B\config\config.cfg, or,
  D:\inetpub\wwwroot\projectApp\C\config\config.cfg,

where A, B, C, are API paths and we use <machine name>/projectApp/<A/B/C>
to call them. Why is it happening so?
I changed it to,
String absPath = Server.MapPath(@"~/config/config.cfg");

It seems to be working fine right now. But, can it cause issues later?


text:
Q: Subquery to join column's in same table? here this is my database structure :  # problem is to retrieval of pref_country
OrderLead :
 id   lead   order  time   #lead is foreign key to leaddeatail
 1    10     34     null
 2    14     34     null
 3    17     37     null

leaddetail :                           # all pref_country foreign key to Country
 id   name  pref_country_1   pref_country_2   pref_country_3
 4    rosh         3              4                   null
 10   amit         4              2                   3
 14   xxx          2             null                 null

Country :
 id   name
 2    India
 3    USA
 4    UK

now i want all information preferably by sub queries like:
orderleadid   lead_name    lead_pref_country  orderlead_time # where order = 34
1             amit         Uk,India,USA       null
2             xxx          India              null

i want query like(subquery) : # here for id and contry
SELECT id,(SELECT group_concat(P.country separator ",") from Country as P, leaddetail as LD where LD.id = orderlead.lead and LD.pref_contry_1 = P.id ) as pref country from orderlead where order = 34;

A: SELECT
  OrderLead.id AS orderleadid,
  leaddetail.name AS lead_name,
  CONCAT(IFNULL(c1.id,''), IF(c2.id IS NULL,'', CONCAT(',',c2.name)), IF(c3.id IS NULL,'', CONCAT(',',c3.name))) AS lead_pref_country,
  OrderLead.time AS orderlead_time
FROM OrderLead
  INNER JOIN leaddetail ON leaddetail.id=OrderLead.lead
  LEFT JOIN Country AS c1 ON c1.id=leaddetail.pref_country_1
  LEFT JOIN Country AS c2 ON c2.id=leaddetail.pref_country_2
  LEFT JOIN Country AS c3 ON c3.id=leaddetail.pref_country_3
-- e.g. WHERE OrderLead.order = 34
-- e.g. WHERE (c1.name='India' OR c2.name='India' OR c3.name='India')


text:
Q: Place a Div(s) with Absolute Position on top of an Image so that it won't move on resize. Is there a way to force animated elements to stay positioned on top of another image?
PROBLEM:
When you resize the browser all of the Animated Elements slide Horizontally and/or Vertically.

Notice the pink square div [as well as the others] move when I resize the screen, I want it to stay in the same place and NOT MOVE.

I've tried to use absolute position on the div, but that doesn't stop
  them from moving around on resize. What can I do to keep the elements in a certain spot on the picture?

Please use my fiddle to demonstrate  your solution
HTML:

CSS:
.toprow{top:0;}

.bottomrow{top:0; margin-top:15%;}

.bubble {
   height: 100px;
  width: 100px;
  position:absolute;
  opacity:0;
}

#animation div:nth-of-type(1) {

    -webkit-animation: fadein 6s ease-in-out -8s infinite alternate;
    -moz-animation: fadein 6s ease-in-out -8s infinite alternate;
    animation:fadein 6s ease-in-out -8s infinite alternate;
}
#animation div:nth-of-type(2) {

    -webkit-animation: fadein 6s ease-in-out 8s infinite alternate;
    -moz-animation: fadein 6s ease-in-out 8s infinite alternate;
    animation: fadein 6s ease-in-out 8s infinite alternate;

}
#animation div:nth-of-type(3) {

    -webkit-animation: fadein 6s ease-in-out 16s infinite alternate;
    -moz-animation: fadein 6s ease-in-out 16s infinite alternate;
    animation: fadein 6s ease-in-out 16s infinite alternate;

}

#animation div:nth-of-type(4) {

    -webkit-animation: fadein 6s ease-in-out 24s infinite alternate;
    -moz-animation: fadein 6s ease-in-out 24s infinite alternate;
    animation:fadein 6s ease-in-out 24s infinite alternate;
}
#animation div:nth-of-type(5) {

    -webkit-animation: fadein 6s ease-in-out -16s infinite alternate;
    -moz-animation: fadein 6s ease-in-out -16s infinite alternate;
    animation: fadein 6s ease-in-out -16s infinite alternate;

}
#animation div:nth-of-type(6) {

    -webkit-animation: fadein 6s ease-in-out 40s infinite alternate;
    -moz-animation: fadein 6s ease-in-out 40s infinite alternate;
    animation: fadein 6s ease-in-out 40s infinite alternate;

}

#animation div:nth-of-type(7) {

    -webkit-animation: fadein 6s ease-in-out -24s infinite alternate;
    -moz-animation: fadein 6s ease-in-out -24s infinite alternate;
    animation:fadein 6s ease-in-out -24s infinite alternate;

}
#animation div:nth-of-type(8) {

    -webkit-animation: fadein 6s ease-in-out 32s infinite alternate;
    -moz-animation: fadein 6s ease-in-out 32s infinite alternate;
    animation: fadein 6s ease-in-out 32s infinite alternate;
}

@-webkit-keyframes fadein {
    0% {
        opacity: 0;
    }
    66% {
        opacity: 0;
    }
    76% {
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}
@-moz-keyframes fadein {
    0% {
        opacity: 0;
    }
    66% {
        opacity: 0;
    }
    76% {
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}
@keyframes fadein {
    0% {
        opacity: 0;
    }
    66% {
        opacity: 0;
    }
    76% {
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}

.toprow{top:25%; }
.bottomrow{top:0%; }

.bubble:nth-child(1)
{
    background: #ff0; left:10%;
}

.bubble:nth-child(2)
{
    background: #333; left:30%;

}

.bubble:nth-child(3)
{
    background: #f90; left:60%;

}
.bubble:nth-child(4)
{
    background: #e43; left:80%;

}
.bubble:nth-child(5)
{
    background: #e38; left:10%;

}

.bubble:nth-child(6)
{
    background: #338;left:30%;

}
.bubble:nth-child(7)
{
    background: #fdd; left:60%;

}
.bubble:nth-child(8)
{
    background: #53d; left:80%;

}
}

@media(max-width:630px)
{
  #animation {display:none!important;}
  .buildingsolo {display:none !important;}
   .buildingtotal {display:block !important; top:0!important;}
}

A: Wrap each image in a div with position:relative;

You can also try:
#wrapper {  position:relative; display:inline-block; margin:0 auto;  }

EDIT
Make sure the wrapper is the same width as the image, else it will not  work:


text:
Q: Is it possible for $_SERVER['HTTP_USER_AGENT'] to not be set? I've just been looking through a website's error_log and one of the error's that has been logged a few times is:
[21-Jun-2011 12:24:03] PHP Notice:  Undefined index:  HTTP_USER_AGENT in /home/ukevents/public_html/lib/toro.php on line 130
The line this pertains to in toro.php is:
private function ipad_request() {
    return strstr($_SERVER['HTTP_USER_AGENT'], 'iPad');
}

Is it possible for $_SERVER['HTTP_USER_AGENT'] to not be set by a HTTP request?

A: Yes. Any browser or user-agent can choose not to send the User-Agent header. If they do not send that header, $_SERVER['HTTP_USER_AGENT'] won't be set.
Use isset() to ensure that $_SERVER['HTTP_USER_AGENT'] is set.
private function ipad_request() {
  if(!isset($_SERVER['HTTP_USER_AGENT'])) return false;

  return strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') !== false;
}

A: Yes, it's possible, but it never happens for a regular request.
All browsers do send a browser string in the request, so any request that arrives without one comes from some other program. Even all well-behaving bots send a browser string, so you don't have to be concerned about not showing up in search engines either.

A: Yes, it's possible, this a HTTP header sent (or not sent) by client, and you should not rely on it. From php manual:

Contents of the User-Agent: header from the current request, if there is one

So the correct code would be:
private function ipad_request() {
    return isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'iPad');
}

A: PHP docs says:
'HTTP_USER_AGENT'
    Contents of the User-Agent: header from the current request, if there is one.
(relevant part italicised) so it would appear it might not always be set.

A: An example where HTTP_USER_AGENT is undefined is if the request coming from GoDaddy's 404 page handler for your site where you have set the handler to be one of your pages.


text:
Q: Display multiple category name wordpress Looking to display all category names for wordpress posts on a specific post.
So if a post is in "web design, seo and social media" i want these category names to display on the post - and NOT all the other categories such as "app design" which it is not related too.

    <?php $category = get_the_category();
    echo $category[0]->cat_name;
    echo " / ";
    echo $category[1]->cat_name;
    echo " / ";
    echo $category[2]->cat_name;
    ?>

this works currently but if there is only 1 category then i get extra / on the end of the displayed text.
Can someone else with a loop that works better?

A: $categories = get_the_category();
$cat_id     = $categories[0]->term_id;

foreach ( $categories as $i => $category ) {
    echo 'term_id ) ) . '" >' . esc_html( $category->name ).'';
    if ( $i < $count - 1 )
        echo $separator;
}

Hope it will help you.

A: Your code show undefines the $count variable but when I use this code it shows some categories.
  <?php
                  $categories = get_the_category();
                  $cat_id     = $categories[0]->term_id;

                  foreach ( $categories as $i => $category ) {
                      echo 'term_id ) ) . '" >' . esc_html( $category->name ).'';
                      if ( $i < 'count - 1' )
                          echo $separator;
                  }

               ?>


text:
Q: How to deal with loss of "Create Snapshot" in Xcode 7.0? To my great disappointment, I've found that Xcode 7 no longer has the "Create Snapshot" command for creating a good backup copy of a project for recovery purposes. In fact, it doesn't have a "Restore Snapshot" command, either, so all of the many, many project Snapshot files that I've taken can apparently no longer be read and used(!).
I understand that Git and Xcode Snapshots are "totally separate" things (git vs xcode snapshot), so apparently I can't use Git to develop a Git-based equivalent to the old Xcode 'Snapshot' capability or to read old 'Snapshot' files?
Is there any solution to bring back a 'Snapshot'-like capability and read my old 'Snapshot' files, or do I just have to give up and rely on the Git commands under Xcode's ">Source Control" menu?

A: As a workaround, you still can, indeed, fallback to the command-line, and do a git archive.
That will create a compressed image of a snapshot of your project.


text:
Q: How do I replicate the Record Button in iOS I want to replicate the record button with the glowing red middle from the iOS camera app.  Is it available via some framework? Has someone already implemented it?

A: Inside a button you and add UIImageView as a subview and animate when you want it to glow.
To do animation using UIImageView please follow this article. It has source code and sample project implementation.
http://appsamuck.com/day2.html


text:
Q: jQuery autocomplete нужно чтобы при клике на вариант не заполнял строку поиска Итак мы начинаем вводить что-либо в строку поиска, jQuery подбирает варианты. Я кликаю на один из вариантов и данный вариант подставляется в сроку поиска.
В моей же реализации каждый вариант поиска имеет ссылку. То есть при клике я сразу перехожу по ссылке, и мне не нужно чтобы jQuery подставлял вариант выбора в строку поиска. Как это можно сделать.
Код:
$(document).ready(function () {
    $("#filter").autocomplete({
        source: function (request, response) {
            $.ajax({
                url: "/webapp-1.0-SNAPSHOT/searchProgress",
                data: {
                    filter: request.term
                },
                method: "GET",
                success: function (data) {
                    response($.map(data, function (account) {
                        return {
                            value: account.firstName,
                            url: "/webapp-1.0-SNAPSHOT/id" + account.id,
                            label: account.firstName + ' ' + account.secondName,
                            imgsrc: account.photo
                        };
                    }));
                }

            });

        },
        select: function (event, ui) {
            window.location = ui.item.url;
        },
        minLength: 2,

    }).data( "ui-autocomplete" )._renderItem = function( ul, item ) {
        return $( "

" )
            .data( "ui-autocomplete-item", item )
            .append( "" + " " + item.label+ "" )
            .appendTo( ul );
    };
});


text:
Q: How can I add example code to a private method's documentation? When documenting module internal functions, I'd like to put some example code in it:
// in private module foo

/// This functions does something etc.
/// Example:
/// ```
/// use mylib::foo::my_func;
/// assert_eq!(my_func(2), 3);
/// ```
fn my_func(x: i32) -> i32 {
    3
}

Running cargo test does not work because foo is private (and should be) so I get a lot of failing tests.
I read about putting ignore tags on the code snippet, however this does not seem to be a good solution, as I'd prefer having the code checked.
What is the proper way to handle such a situation?


text:
Q: Mocha: Test pass after summary of all tests in suite This is one of mine test classes

const fs = require('fs');
const chai = require('chai');
const config = require('../config');
const request = require('supertest')(config.url);
const assert = chai.assert;
require('mocha');

var log4js = require('log4js');
var logger = log4js.getLogger('08_order');
log4js.configure({
  appenders: {
    out:{ type: 'console' },
    app:{ type: 'file', filename: 'logs/log.log' }
  },
  categories: {
    default: { appenders: [ 'out', 'app' ], level: 'info' }
  }
})

var dineInOrderDetails=[];
var deliveryOrderDetails=[];

describe('order', function() {
  this.timeout(10000);

   it('should submit simple product order for dine in', function(done) {
    request
      .post('/rest/v2/order/submit')
      .set(config.headers)
      .set('Authorization', 'Bearer ' + auth_token)
      //.set('Accept', 'application/json')
      .send(
        {
          "restaurantId":dineInRestaurantId,
          "deliveryAddress":{
             "city":dineInRestaurantCity,
             "street":dineInRestaurantStreet,
             "houseNumber":dineInRestaurantStreetNo,
             "lat":dineInRestaurantGeoLat,
             "lng":dineInRestaurantGeoLng,
             "inDeliveryZone":true

          },
          "deliveryType":"DINE_IN",
          "deliveryTime":"14:24",
          "paymentType":"CARD_DEL",
          "customer":{
             "phoneNumber":"530323370",
             "firstName":"Imie",
             "emailAddress":"x@x.pl",
             "customerName":"Imie"
          },
          "agreements":{
             "acceptTerms":true,
             "acceptDataProcessingAgreement":true
          },
          "basket":{
             "basketLines":[
                {
                   "uuid":"uuid",
                   "quantity":2,
                   "product":{
                      "id": randomAvailableSimpleProductIdForDineIn
                   }
                }
             ]
          }
       }
      )
      .end(function(err,res){
        logger.info(config.logToConsole(res.request.url,res.request._data));
        assert.equal(res.status,200);
        assert.containsAllKeys(res.body,['uuid','totalGross','totalAmount','orderNo','orderStatus','deliveryTime']);
        logger.info('uuid: ',res.body.uuid);
        dineInOrderDetails[0]=res.body.uuid;
        dineInOrderDetails[1]=res.body.totalGross;
        dineInOrderDetails[2]=res.body.totalAmount;
        done(err);
      });
   });

   it('should return details of last order', function(done) {
    tempUrl="/rest/v1/user/orders/"+dineInOrderDetails[0];
    request
      .get(tempUrl)
      .set(config.headers)
      .set('Authorization', 'Bearer ' + auth_token)
      .end(function(err,res){
        logger.info(config.logToConsole(res.request.url,res.request._data));
        assert.equal(res.status,200);
        assert.equal(res.body.order.uuid, dineInOrderDetails[0]);
        assert.equal(res.body.order.totalGross, dineInOrderDetails[1]);
        assert.equal(res.body.order.totalAmount, dineInOrderDetails[2]);
        done(err);
      });
   });

   it('should return recent orders', function(done) {
    request
      .get("/rest/v1/user/orders")
      .set(config.headers)
      .set('Authorization', 'Bearer ' + auth_token)
      .end(function(err,res){
        logger.info(config.logToConsole(res.request.url));
        assert.equal(res.status,200);
        assert.isArray(res.body.orders);
        assert.containsAllKeys(res.body.orders[0],'uuid','totalGross','totalAmount','cellPhone','deliveryTime','currency','addedAtDate',
          'isClaim','isFavourite','status','orderNumber','restaurant','zipCode');
        done(err);
      });
   });

//done(err);
});

Test are running locally with docker, also i use mailhog to receive sms and mails.
In most cases if i run tests, first test: 'should submit simple product order for dine in' is waiting for 10 sec timeout, then fail, in console i receive fail summary:

2) order
         should submit simple product order for dine in:
       Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
  (C:\dockerApi\test\08_order.js)

and after fail summary in console i receive info that this case is passed with properly sent body. Why i receive pass info after finishing all tests?
Do you have problem like this?


text:
Q: Eventual consistency data orchestration in microservices RabbitMq broker I have the following flow in microservices:

*

*New data is created in Service "A".

*Service "A" creates event message to inform other services about changes.

*Services "B" and "C" that subscribe to the created event message (from service "A") updates their replicated data.

Same data across multiple services is eventually consistent. I'm using RabbitMq as message broker between services (using another broker is highly undesirable).
Lets say my services had been running for a while, data between them is consistent, all new changes are replicated and eventually consistent. All of a sudden I have a requirement to add new service (lets call it "D").
Newly introduced Service "D" also needs to replicate data coming from service "A". Service "D" needs all historic data, since other services ware already running for a while, and service "A" only broadcasts new changes.
Problem: My current solution creates event messages only for new data changes.
What would be the correct solution to populate newly added service with historic data?

A: Ended up choosing streams.
All of the events are persisted in stream. Each clients tracks its progress of messages read. Newly introduced clients read from the start of the stream thus allowing them to access all historic data.


text:
Q: How to update Android Studio in Linux I'm on Linux Mint KDE and want to update Android Studio. When I update PHPStorm (also a JetBrains product) the directory always has the version number so there is no overwriting. Android Studio does not. Do I just overwrite the old directory? Or delete it first? Or what?

A: Usually you can simply use the built in update function found in
Help -> Check for Update...
If it is not a small patch, but a larger update (happens from time to time) you need to download a new archive.  For me it was always safe to remove (or rename) the old installation folder first since all your configuration settings are stored in
~/.AndroidStudio
anyways and Android Studio will automatically reuse these (or ask you if it shall migrate them).
I am using Android Studio for 2 years now and that was always working for me.
BTW: I use IntelliJ IDEA as well and it also has the version number in the installation folder.


text:
Q: Visual studio hybrid app CTP4 debugging error I've just updated Visual Studio 2013 from Update 3 to Update 4 and Visual studio hybrid app from CTP2 to CTP3. Compilation works just fine but debugging doesn't work.
The application start on the Android emulator, but debugging with HTML DOM doesn't work. I'm getting an error message:
Unable to attach, Cannot load sattelite assemblies containing cultured resources.

(the original message is in French -- it says: Impossible de s'attacher. Impossible de trouver ou de charger un assembly satellite attendu, contenant les ressources de secours ultimes pour une culture donnée -- I'm not sure, if I translated it correctly to English).
I'm getting this message since the update. I've already tried to reinstall Visual Studio and Cordova, but nothing changed. The error is present on other computer too.
Anyone has the same problem and knows the solution?

A: I had the same problem.
I switch the language from german to english in both Windows and VS. But that don't solved the problem.
Than I found this queston/answer . So I downloaded vs2013mda_0.3.exe again and did a repair.
For me it solved the problem.


text:
Q: Quiero crear un botón que muestre los números de teléfono que ya se muestran en una tabla Estoy buscando una manera sencilla de que al realizar click en el botón AVISO, este muestre en un mensaje tipo echo el numero de teléfono que se encuentra en el mismo registro de dicha tabla.
Envio parte del codigo que corresponde con esa tabla.

introducir el código aquí

  <?php
    $telefono=$_POST['id'];
     echo "El número seleccionado es:   $telefono";
    $users->rowsToTableWizardSelect('users', $users->getUsersWizard($_POST['quantity'], true));
      ?>


text:
Q: Xamarin Round Label Custom renderer not working I created a custom renderer to create circle behind a label just like badge.
CircleView.cs (PCL)
public partial class CircleView : BoxView
    {
        public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(double), typeof(CircleView), 0.0);

        public double CornerRadius
        {
            get { return (double)GetValue(CornerRadiusProperty); }
            set { SetValue(CornerRadiusProperty, value); }
        }

        public CircleView()
        {
            InitializeComponent();
        }
    }

CircleViewRenderer.cs (Android)
[assembly: ExportRenderer(typeof(CircleView), typeof(CircleViewRenderer))]
namespace TestApp.Droid
{
    public class CircleViewRenderer : BoxRenderer
    {
        private float _cornerRadius;
        private RectF _bounds;
        private Path _path;
        protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e)
        {
            base.OnElementChanged(e);

            if (Element == null)
            {
                return;
            }
            var element = (CircleView)Element;

            _cornerRadius = TypedValue.ApplyDimension(ComplexUnitType.Dip, (float)element.CornerRadius, Context.Resources.DisplayMetrics);

        }

        protected override void OnSizeChanged(int w, int h, int oldw, int oldh)
        {
            base.OnSizeChanged(w, h, oldw, oldh);
            if (w != oldw && h != oldh)
            {
                _bounds = new RectF(0, 0, w, h);
            }

            _path = new Path();
            _path.Reset();
            _path.AddRoundRect(_bounds, _cornerRadius, _cornerRadius, Path.Direction.Cw);
            _path.Close();
        }

        public override void Draw(Canvas canvas)
        {
            canvas.Save();
            canvas.ClipPath(_path);
            base.Draw(canvas);
            canvas.Restore();
        }
    }
}

CircleViewRenderer.cs (iOS)
[assembly: ExportRenderer(typeof(CircleView), typeof(CircleViewRenderer))]
namespace TestApp.iOS
{
    public class CircleViewRenderer : BoxRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e)
        {
            base.OnElementChanged(e);

            if (Element == null)
                return;

            Layer.MasksToBounds = true;
            Layer.CornerRadius = (float)((CircleView)Element).CornerRadius / 2.0f;
        }

    }
}

In Xaml i tried like this:
<Grid>
<customRenderer:CircleView x:Name="BadgeCircle" HeightRequest="16" WidthRequest="16" CornerRadius="16" VerticalOptions="Center" HorizontalOptions="Center" /><Label x:Name="BadgeLabel" TextColor="White" VerticalOptions="Center" HorizontalOptions="Center" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" FontSize="10"/>
</Grid>

But its not showing anything. Initializing error was showing on CircleView so i commented InitializeComponent();
What am i missing here?

A: I think you can use a Frame. It should have CornerRadius property.
Otherwise I use this
XFShapeView
this is how you can use it
var box = new ShapeView
{
    ShapeType = ShapeType.Box,
    HeightRequest = 75,
    WidthRequest = 75,
    Color = Color.Navy,
    HorizontalOptions = LayoutOptions.Center,
    CornerRadius = 5,
    BorderColor = Color.Red,
    BorderWidth = 1f,
    Content = new Label
    {
        Text = "Touch me!",
        FontSize = Device.GetNamedSize(NamedSize.Micro, typeof (Label)),
        TextColor = Color.White,
        HorizontalOptions = LayoutOptions.Fill,
        VerticalOptions = LayoutOptions.Fill,
        VerticalTextAlignment = TextAlignment.Center,
        HorizontalTextAlignment = TextAlignment.Center,
    },
};

ShapeType can be
public enum ShapeType
    {
        /// <summary>
        /// A 4-sides shape (square/rectangle) - can have rounded corners
        /// </summary>
        Box,
        /// <summary>
        /// A circle shape with a radius equals to the minimum value between height & width
        /// </summary>
        Circle,
        /// <summary>
        /// A star shape for which you can define the number of points and the radius ratio
        /// </summary>
        Star,
        /// <summary>
        /// A triangle shape - the appearance depends on the height/width ratio
        /// </summary>
        Triangle,
        /// <summary>
        /// An oval shape - the appearance depends on the height/width ratio
        /// </summary>
        Oval,
        /// <summary>
        /// A diamond shape - 4-sides - the same you can find in a card deck - the appearance depends on the height/width ratio
        /// </summary>
        Diamond,
        /// <summary>
        /// A heart shape - the appearance depends on the minimum value between height & width
        /// </summary>
        Heart,
        /// <summary>
        /// A progress circle shape acting like a progress bar with a radius equals to the minimum value between height & width
        /// </summary>
        ProgressCircle,
        /// <summary>
        /// A custom path shape defined by a list of points
        /// </summary>
        Path

A:
Snip from my xamarin proj
Working example:
<Frame
    CornerRadius="15"
    Padding="0"
    BackgroundColor="AntiqueWhite"
    Margin="15,10,15,10"
    HasShadow="False"
>
    <Label Margin="5"
        HorizontalOptions="Center"
        BackgroundColor="Transparent"
        Text="My rounded label" />
</Frame>

Things to note are CornerRadius of the frame and the margin and transparent background of the label itself. The width of the 'label' could be set as it is here or managed with the container of your choice. I did not want to complicate the answer with more code.
HTH


text:
Q: How to center an element (search form)? Here's the code. How to center a search form? This form should be always at the center of the screen no matter what screen resolution is.
I tried margin: 0 auto; but it doesn't work.
Thank You.

.search-p--i {
  color: #333;
  font-weight: normal;
  font-size: 20px;
  text-align: center;
  margin-bottom: 30px;
}
.search-p_wrap {
  text-align: center;
}
.search-form button {
  font-weight: bold;
  color: #fff;
  background: blue;
  border: 0;
  -webkit-border-radius: 28px;
  -moz-border-radius: 28px;
  border-radius: 28px;
  padding: 10px 15px 10px 15px;
  font-size: 14px;
}
.search-form input {
  width: 240px;
  height: 40px;
  padding: 0px 5px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4x;
  border: 1px solid #ccc;
}

Discover

    Hi!

  <form class="search-form">
    <input type="text" placeholder="Enter" required>
    <button type="submit">Search</button>
  </form>

A: Aligning text
Just add text-align: center to form and it is centered on all screen sizes.

text-align: center
This property describes how inline-level content of a block container is aligned.

form {
  text-align: center; /* Add */
}

.search-p--i {
  color: #333;
  font-weight: normal;
  font-size: 20px;
  text-align: center;
  margin-bottom: 30px;
}
.search-p_wrap {
  text-align: center;
}
.search-form button {
  font-weight: bold;
  color: #fff;
  background: blue;
  border: 0;
  -webkit-border-radius: 28px;
  -moz-border-radius: 28px;
  border-radius: 28px;
  padding: 10px 15px 10px 15px;
  font-size: 14px;
}
.search-form input {
  width: 240px;
  height: 40px;
  padding: 0px 5px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4x;
  border: 1px solid #ccc;
}

Discover

    Hi!

  <form class="search-form">
    <input type="text" placeholder="Enter" required>
    <button type="submit">Search</button>
  </form>

Flexbox solution(Modern):

align-items: center
Items are centered in the cross-axis

Note that in the example we are using flex-direction: column. otherwise just use justify-content: center for flex-direction: row

.search-p {
  display: flex;
  flex-direction: column; /* Cross axis alignment; simply said vertical stacking/positioning */
  align-items: center; /* Center cross-axis */
}
.search-p--i {
  color: #333;
  font-weight: normal;
  font-size: 20px;
  text-align: center;
  margin-bottom: 30px;
}
.search-p_wrap {
  text-align: center;
}
.search-form button {
  font-weight: bold;
  color: #fff;
  background: blue;
  border: 0;
  -webkit-border-radius: 28px;
  -moz-border-radius: 28px;
  border-radius: 28px;
  padding: 10px 15px 10px 15px;
  font-size: 14px;
}
.search-form input {
  width: 240px;
  height: 40px;
  padding: 0px 5px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4x;
  border: 1px solid #ccc;
}

Discover

    Hi!

  <form class="search-form">
    <input type="text" placeholder="Enter" required>
    <button type="submit">Search</button>
  </form>

A: I like to use the new Flexbox layout to place something in the center, a good guide is here: https://css-tricks.com/snippets/css/a-guide-to-flexbox/ Although it's rather new, but it's already supported in majority browsers and it's looking to become the new standard in the next year or so.

/* added new code */
.search-p {
    display: flex;
    flex-flow: column;
    justify-content: center;
    align-items: center;
}

.search-p--i {
  color: #333;
  font-weight: normal;
  font-size: 20px;
  text-align: center;
  margin-bottom: 30px;
}
.search-p_wrap {
  text-align: center;
}
.search-form button {
  font-weight: bold;
  color: #fff;
  background: blue;
  border: 0;
  -webkit-border-radius: 28px;
  -moz-border-radius: 28px;
  border-radius: 28px;
  padding: 10px 15px 10px 15px;
  font-size: 14px;
}
.search-form input {
  width: 240px;
  height: 40px;
  padding: 0px 5px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4x;
  border: 1px solid #ccc;
}

Discover

    Hi!

  <form class="search-form">
    <input type="text" placeholder="Enter" required>
    <button type="submit">Search</button>
  </form>

A: CSS and form validation have nothing to do with each other, one is simply styling - the other is data checking which is handled either client-side by JS (bad idea without server validation) and / or server side by  (always do this) so there will be no problem. (reacted on comment).
Some other problems might surface tho since text-align: center only works when elements are display: inline-block - float: left; float: right; display: block; will all break this center.
What I would suggest doing is adding a wrapper that will center the search in the form through means of margin: 0 auto - which is a much more solid way to center elements than text-align: center which as it says is meant for text (even tho I have also abused this property many many many times over).

.search-p--i {
  color: #333;
  font-weight: normal;
  font-size: 20px;
  text-align: center;
  margin-bottom: 30px;
}
.search-p_wrap {
  text-align: center;
}

/* Added a selector here */
.search-form .search-form-field-wrap {
  display: block; /* optional - divs are block by default. */
  width: 80%; /* or anything else */
  margin: 0 auto; /* you're gonna want to use this for centering block elements */
}

.search-form button {
  font-weight: bold;
  color: #fff;
  background: blue;
  border: 0;
  -webkit-border-radius: 28px;
  -moz-border-radius: 28px;
  border-radius: 28px;
  padding: 10px 15px 10px 15px;
  font-size: 14px;
}
.search-form input {
  width: 240px;
  height: 40px;
  padding: 0px 5px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4x;
  border: 1px solid #ccc;
}
form {
  text-align: center;
}

Discover

    Hi!

  <form class="search-form">

      <input type="text" placeholder="Enter" required>
      <button type="submit">Search</button>

  </form>


text:
Q: json.net does not serialize properties from derived class I'm using JSON.NET 6.0.1. When I use the SerializeObject method to serialize an object of my derived class, it serializes properties from base class only.  Here is the code snippet:
string v = JsonConvert.SerializeObject(
                service,
                Formatting.Indented,
                new JsonSerializerSettings()
                {
                    TypeNameHandling = TypeNameHandling.All
                });

base class:
[DataContract]
public abstract partial class DataEntity : IDataEntity, INotifyPropertyChanging, INotifyPropertyChanged
{
    ...
}

derived class:
[Table(Name = "dbo.mytable")]
public sealed class mytable : DataEntity
{
    ...
}

Am I missing something?

A: Adding the attribute [JsonObject(MemberSerialization.OptOut)] to your derived class will include all its public members to be serialized.
[Table(Name = "dbo.mytable")]
[JsonObject(MemberSerialization.OptOut)]
public sealed class mytable : DataEntity
{
    ...
}

Alternatively, if you only want certain properties of your derived class to be serialized you can add the attribute [JsonProperty] to each one (This would be equivalent of adding [DataMember] to each property along with [DataContract] on the class).

A: Yes, you are missing the [DataContract] attribute on the derived class.  You also need to add [DataMember] to any properties or fields that you want serialized, if you haven't already added them.  Json.Net was changed in version 5.0 release 1 (April 2013) such that the [DataContract] attribute is not inherited.
Note that if you remove all instances of [DataContract] and [DataMemeber] from your classes, Json.Net behaves differently: in that case, the default behavior is for Json.Net to serialize all public properties, both in the base and derived classes.

A: JsonConvert.SerializeObject was only return {} for me. I found that I needed to add a new constructor to the class before it serialized properly.


text:
Q: SEO File Source Comes from where when AJAX is in the mix? Suppose I went through the trouble to make some nice html5 such as that which can be found on the MDN:

Forest elephants

Introduction

In this section, we discuss the lesser known forest elephants.

Habitat

Forest elephants do not live in trees but among them.

advertising block

(c) 2010 The Example company

This can be easily interpreted and a nice outline can be generated.
My question now is, suppose your site has many such articles as the one above, but it serves them via AJAX and HTML injection.  So the source when viewed in many browsers shows just a bunch of JavaScript or links to JavaScript, etc. and not this beautiful source.
Does that hide it and make all the SEO efforts for not?
I know the source can be properly viewed in a debugging tool such as firebug, but is that how the source is going to be read for SEO efforts?
In that case is it better to just have page reloads and includes?

A: Your best bet is to do this on the server side. Depending on your technology, there's a number of ways you could generate pages. In C#/.NET you would use URL Routing. In PHP I'm not sure the best option for making URLS. Basically, the server uses the data to generate pages that don't really exist on the server like mydomain/forest-elephants
Regardless, you will want to dump the actual contents to html to your 'virtual' pages using the backend. If you are dependent on an HTTP service for your data, you will have to use a server side URL Stream or equivalent to write your HTML for you. The backend could use a template to format your pages and even import your javascript code.
This is not something you're gonna just plop out in a few hours.


text:
Q: Wordpress Theme issues So i currently developing some Wordpress Theme nothing special. I ran into a problem another day. The problem goes like this, when I add the following code to the header.php
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/reset.css" type="text/css">
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css">

everything works fine, but when i make the following chages
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/reset.css" type="text/css">
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/style.css" type="text/css">

i get an error that the template missing.

A: The correct way to include stylesheet files is with the enqueue_style function.
go to your theme's functions.php file and search for: function themename_enqueue_style()
function themename_enqueue_style() {

    /* Past the wp_enqueue_style() below in this function */
    wp_enqueue_style( 'reset-style', get_template_directory_uri() . '/css/reset.css', false);

}
/* Don't forget Add_action below the function */
add_action( 'wp_enqueue_scripts', 'themename_scripts_styles' );

A: In a standard WordPress installation, the two statements would refer to different locations.
<?php bloginfo('stylesheet_url'); ?>

would return "yoursite.com/wp-content/themes/active_theme/style.css".
<?php bloginfo('stylesheet_directory'); ?>/css/style.css

would be "yoursite.com/wp-content/themes/active_theme/css/style.css".

A: you can also try this:
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/reset.css" type="text/css">
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/style.css" type="text/css">


text:
Q: Macro to Forward Mails in outlook based on sender list in Excel I have a list of senders in Excel (Column A). Based on the mails received from these senders in Outlook, they should be auto forwarded to recipients mentioned in Column B. Since there are more than 500 mails and various senders, it is not possible to create rules in MS Outlook.
I do not have any experience in coding.

A: You can handle incoming emails in Outlook by handling the NewMailEx event of the Application class which is fired when a new message arrives in the Inbox and before client rule processing occurs. This event fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem. The EntryIDsCollection string contains the Entry ID that corresponds to that item. Use the Entry ID string to call the NameSpace.GetItemFromID method and process the item. So, you can forward items automatically without using rules.
Also you can automate Outlook from Excel to send emails to the senders listed in the workbook. See Mail from Excel with Outlook (Windows) for code samples.


text:
Q: finding reverse of a binary for a giving number using c edit:
am trying to create a program that accept a number, shows its binary number and show the reverse of that binary. But i didnt know how to do it in a good way or ever in any way ~ so hopfully i can get help
this is my code:
    /*
 * C Program to Convert a Number Decimal System to Binary System using Recursion
 */
#include <stdio.h>

int convert(int);

int main()
{
    int dec, bin,reverse_bin,i;

    printf("Enter a decimal number: ");
    scanf("%d", &dec);
    bin = convert(dec);
    printf("The binary equivalent of %d is %d.\n", dec, bin);
    for (i = 1; i < 9; i++)
    {
         reverse_bin =  bin << 1;

    }

         printf("The reverse binary of 10 is = %d \n",reverse_bin);
    return 0;
}

int convert(int dec)
{
    if (dec == 0)
    {
        return 0;
    }
    else
    {
        return (dec % 2 + 10 * convert(dec / 2));

    }
}

A: Your convert() function returns an integer that when presented as a decimal contains only 1 and 0 digits; that's a transform, not a conversion. It is a bad idea, mathematically flawed and limited to just 9 digits when an int requires 32.
The fact of the matter is that an int already is binary, and converting its bits directly to a string (forward or reverse) is simpler, and makes a lot more sense:
#include <stdio.h>
#include <limits.h>

#define INT_BITS (sizeof(int) * CHAR_BIT)
char* binary( char* buffer, int i ) ;
char* binary_reverse( char* buffer, int i ) ;

int main()
{
    int dec ;
    char binary_str[INT_BITS + 1] ;

    printf("Enter a decimal number: ");
    scanf("%d", &dec);

    printf("The binary of %d is %s.\n", dec, binary( binary_str, dec) ) ;
    printf("The reverse binary of %d is %s.\n", dec, binary_reverse( binary_str, dec) );

    return 0;
}

char* binary( char* buffer, int i )
{
    int b = 0;
    for( b = 0; b < INT_BITS; b++ )
    {
        unsigned mask = 1u << (INT_BITS - b - 1) ;
        buffer[b] = (i & mask) == 0 ? '0' : '1' ;
    }
    buffer[b] = '\0' ;

    return buffer ;
}

char* binary_reverse( char* buffer, int i )
{
    int b = 0;
    for( b = 0; b < INT_BITS; b++ )
    {
        unsigned mask = 1u << b ;
        buffer[b] = (i & mask) == 0 ? '0' : '1' ;
    }
    buffer[b] = '\0' ;

    return buffer ;
}

Note that the only difference between binary() and binary_reverse() is the calculation of mask.

A: What makes your question hard is that it probably depends on the word length of your computer.  Simply put, does 0001 reverse to 1000 or 10000000 or 100000000000000000000000000000?  Well, let's just say it reverses to 1.  :)
If you agree to that, then the following should work:
int rb(int dec) {
  int ret=0;
  while (dec) {
     if (dec & 1) {
        ret<<=1;
        ret |=1;
        }
     else {
        ret<<=1;
        }
     dec>>=1;
     }
  return ret;
}

Oh, was there a goal to do it recursively?


text:
Q: Keras Error - expected block5_pool to have 4 dimensions, but got array with shape (6, 1)? i am trying to use VGG16 pretrained in Keras, but i keep getting this error:

ValueError: Error when checking target: expected block5_pool to have 4 dimensions, but got array with shape (6, 1)

What is the error mean?

Error when checking target: expected block5_pool to have 4 dimensions,
  but got array with shape (6, 1)

This the my actual code:
from keras import applications
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, ZeroPadding2D
from keras.layers import Activation, Dropout, Flatten, Dense
from keras import backend as K

# dimensions of our images.
img_width, img_height = 224, 224

train_data_dir = 'database/train'
validation_data_dir = 'database/validation'
nb_train_samples = 2000
nb_validation_samples = 26
epochs = 50
batch_size = 20

if K.image_data_format() == 'channels_first':
    input_shape = (3, img_width, img_height)
else:
    input_shape = (img_width, img_height, 3)

model = applications.VGG16(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
print('VGG-16 Model loaded.')

top_model = Sequential()
top_model.add(ZeroPadding2D((1,1),input_shape=input_shape))
top_model.add(Conv2D(64, (3, 3), activation='relu'))
top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(64, (3, 3), activation='relu'))
top_model.add(MaxPooling2D(pool_size=(2,2), strides=(2,2)))

top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(128, (3, 3), activation='relu'))
top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(128, (3, 3), activation='relu'))
top_model.add(MaxPooling2D((2,2), strides=(2,2)))

top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(256, (3, 3), activation='relu'))
top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(256, (3, 3), activation='relu'))
top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(256, (3, 3), activation='relu'))
top_model.add(MaxPooling2D((2,2), strides=(2,2)))

top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(512, (3, 3), activation='relu'))
top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(512, (3, 3), activation='relu'))
top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(512, (3, 3), activation='relu'))
top_model.add(MaxPooling2D((2,2), strides=(2,2)))

top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(512, (3, 3), activation='relu'))
top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(512, (3, 3), activation='relu'))
top_model.add(ZeroPadding2D((1,1)))
top_model.add(Conv2D(512, (3, 3), activation='relu'))
top_model.add(MaxPooling2D((2,2), strides=(2,2)))
top_model.add(Flatten())

top_model.add(Dense(4096, activation='relu'))
top_model.add(Dropout(0.5))
top_model.add(Dense(12))
top_model.add(Activation('softmax'))

# note that it is necessary to start with a fully-trained
# classifier, including the top classifier,
# in order to successfully do fine-tuning
# top_model.load_weights('./vgg16_face_weights.h5')

# add the model on top of the convolutional base
model.add_update(top_model)

# set the first 25 layers (up to the last conv block)
# to non-trainable (weights will not be updated)
for layer in model.layers[:25]:
    layer.trainable = False

model.compile(loss='sparse_categorical_crossentropy', optimizer='rmsprop', metrics=['accuracy'])

# this is the augmentation configuration we will use for training
train_datagen = ImageDataGenerator(
    rescale=1. / 255,
    shear_range=0.2,
    zoom_range=0.2,
    horizontal_flip=True)

# this is the augmentation configuration we will use for testing:
# only rescaling
test_datagen = ImageDataGenerator(rescale=1. / 255)

train_generator = train_datagen.flow_from_directory(
    train_data_dir,
    target_size=(img_width, img_height),
    batch_size=batch_size,
    class_mode='binary')

validation_generator = test_datagen.flow_from_directory(
    validation_data_dir,
    target_size=(img_width, img_height),
    batch_size=batch_size,
    class_mode='binary')

model.fit_generator(
    train_generator,
    steps_per_epoch=nb_train_samples // batch_size,
    epochs=epochs,
    validation_data=validation_generator,
    validation_steps=nb_validation_samples // batch_size)

model.save_weights('first_try.h5')

The terminal run:
VGG-16 Model loaded.
Found 46 images belonging to 12 classes.
Found 26 images belonging to 12 classes.
Epoch 1/50
Traceback (most recent call last):
  File "C:/Users/w024029h/PycharmProjects/keras_pretrained/pretrained.py", line 113, in <module>
    validation_steps=nb_validation_samples // batch_size)
  File "C:\Users\w024029h\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\w024029h\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 2230, in fit_generator
    class_weight=class_weight)
  File "C:\Users\w024029h\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 1877, in train_on_batch
    class_weight=class_weight)
  File "C:\Users\w024029h\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 1480, in _standardize_user_data
    exception_prefix='target')
  File "C:\Users\w024029h\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 113, in _standardize_input_data
    'with shape ' + str(data_shape))
ValueError: Error when checking target: expected block5_pool to have 4 dimensions, but got array with shape (6, 1)

A: I had this same error before. I resolved it by changing the class_mode on the data generators from 'binary' to None
According to the keras docs, setting the class_mode to 'binary' will return a 1-D array.
By changing the class_mode=None, no labels are returned and the generator will only yield batches of image data. This is what you are expecting with your model and this works well with the fit_generator() method. However, when using class_mode None, the data still needs to reside in a subdirectory of directory for it to work correctly.
This page was useful to me
^look at flow_from_directory()
Hope this helps!


text:
Q: Difference between delimited and undelimited continuations I guess the difference between delimited and undelimited continuations is like the difference between call and jump.
If we invoke delimited continuation it will return to the caller once it finishes. If we invoke undelimited continuation it works like goto and never returns to the caller.
Does it make sense? Am I missing something?

A: Continuations as a language feature (as opposed to continuations as a programming pattern) are reifications of (parts of) the control context ("the stack"). As Don said, undelimited continuations represent the whole context, whereas delimited continuations only represent part of it.
Typically, capturing an undelimited continuation (eg, with call/cc) doesn't change the control context; the control context is only changed when the continuation is invoked (ie, reflected onto the stack).
Typically, capturing a delimited continuation (eg, with shift) immediately aborts the segment of the control context up to the nearest delimiter (eg, reset) and reifies that as what seems to be a plain old function (although it might be implemented as stack trickery rather than however normal functions are implemented).
BTW, continuations are sometimes called "first-class jumps", but that doesn't mean they have any more to do with the jmp instruction than a normal function call does.

A: You're a bit off track. Continuations, of either flavor, have nothing much to do with goto (jumps). They have everything to do with the stack, however.

Classic Continuations
Remember regular continuations capture the notion of a control stack as a first class values. Stacks may be named, passed around as arguments, and values may be applied to them, yielding a change in control flow, with a simple API based on function application via callCC.
Delimited Continuations
What do delimited continuations add to the mix?
Recall that regular continuations capture the entire call stack up to a certain point. What if we could put markers in that say exactly how much of the control stack to capture in the continuation? A sort of "delimit"ing of the control stack.
That's the idea, and now you have super-cool delimited continuations: delimit, capture and manipulate arbitrary portions of a program, as a value. Perfect for resumption and incremental processing, and other tricky forms of control flow.
References

*

*Regular, "undelimited" continuations.

*Delimited continuations.

*Oleg's papers on delimited control

*PFPL, ch33.

Notes
Some corrections from Oleg Kiselyov, received off-list:

*

*Continuations and jumps are deeply related, the first discoveries of continuations were in the context of trying to understand the semantics of jumps, or goto. Landin's J operator was introduced precisely for that purpose; J is the precursor of call/cc. See An Introduction to Landin's
"A Generalization of Jumps and Labels"

*Further reading on undelimited, "regular" continuations, in "Undelimited continuations are co-values rather than functions", and their foundations.


text:
Q: Creating a 4D view on 2D array to divide it into cells of fixed size I have a 2D array t in numpy:
>>> t = numpy.array(range(81)).reshape((9,9))
>>> t
array([[ 0,  1,  2,  3,  4,  5,  6,  7,  8],
       [ 9, 10, 11, 12, 13, 14, 15, 16, 17],
       [18, 19, 20, 21, 22, 23, 24, 25, 26],
       [27, 28, 29, 30, 31, 32, 33, 34, 35],
       [36, 37, 38, 39, 40, 41, 42, 43, 44],
       [45, 46, 47, 48, 49, 50, 51, 52, 53],
       [54, 55, 56, 57, 58, 59, 60, 61, 62],
       [63, 64, 65, 66, 67, 68, 69, 70, 71],
       [72, 73, 74, 75, 76, 77, 78, 79, 80]])

It is indexed by two numbers: row and column index.
>>> t[2,3]
21
>>> t.shape
(9, 9)
>>> t.strides
(72, 8)

What I want to do is to divide the array into rectangular cells of fixed size, 3×3 for example. I'd like to avoid memory copying. The way I try to achieve this is creating a view onto t with correspondent shape and strides ((3,3,3,3) and (216,24,72,8) respectively). This way the first two indexes of the view would mean the position of 3×3 cell in the larger grid and the last two would mean the position of element inside the cell. For example, t[0,1,:,:] would return
array([[ 3,  4,  5],
       [12, 13, 14],
       [21, 22, 23]])

So my question is — how to create the described view? Am I missing a simpler method? Can this be done elegantly with slicing syntax?

A: Edit: A way that does not require you to figure out the strides yourself is
numpy.rollaxis(t.reshape(3, 3, 3, 3), 2, 1)

[end of edit]
Another way to achieve this is to use numpy.lib.stride_tricks.as_strided:
>>> t = numpy.arange(81.).reshape((9,9))
>>> numpy.lib.stride_tricks.as_strided(t, shape=(3,3,3,3), strides=(216,24,72,8))
array([[[[  0.,   1.,   2.],
         [  9.,  10.,  11.],
         [ 18.,  19.,  20.]],

        [[  3.,   4.,   5.],
         [ 12.,  13.,  14.],
         [ 21.,  22.,  23.]],

        [[  6.,   7.,   8.],
         [ 15.,  16.,  17.],
         [ 24.,  25.,  26.]]],

       [[[ 27.,  28.,  29.],
         [ 36.,  37.,  38.],
         [ 45.,  46.,  47.]],

        [[ 30.,  31.,  32.],
         [ 39.,  40.,  41.],
         [ 48.,  49.,  50.]],

        [[ 33.,  34.,  35.],
         [ 42.,  43.,  44.],
         [ 51.,  52.,  53.]]],

       [[[ 54.,  55.,  56.],
         [ 63.,  64.,  65.],
         [ 72.,  73.,  74.]],

        [[ 57.,  58.,  59.],
         [ 66.,  67.,  68.],
         [ 75.,  76.,  77.]],

        [[ 60.,  61.,  62.],
         [ 69.,  70.,  71.],
         [ 78.,  79.,  80.]]]])

Note that the strides you provided are correct only for float arrays (itemsize == 8), while the example t in your post is an int array (which might or might no have itemsize == 8).

A: You can do:
t = np.arange(81).reshape(9,9)
t.shape = (3, 3, 3, 3)
t = t.transpose((0, 2, 1, 3))

>>> print t.strides
(108, 12, 36, 4)

>>> print t
[[[[ 0  1  2]
   [ 9 10 11]
   [18 19 20]]

  [[ 3  4  5]
   [12 13 14]
   [21 22 23]]

  [[ 6  7  8]
   [15 16 17]
   [24 25 26]]]

 [[[27 28 29]
   [36 37 38]
   [45 46 47]]

  [[30 31 32]
   [39 40 41]
   [48 49 50]]

  [[33 34 35]
   [42 43 44]
   [51 52 53]]]

 [[[54 55 56]
   [63 64 65]
   [72 73 74]]

  [[57 58 59]
   [66 67 68]
   [75 76 77]]

  [[60 61 62]
   [69 70 71]
   [78 79 80]]]]

transpose will return a view whenever possible, that way you don't have to worry about knowing the data type.


text:
Q: Does kernel trick correspond to real higher dimensions? I've read that the SVM kernel tricks corresponds to viewing the data in a higher dimension. I can see that the expansion of the kernel looks like a cross-product of many different terms.
However, it seems the coefficients between all these terms are constraint. For example for the inhomogeneous polynomial kernel (of fixed dimension) there is only one parameter that can adjust between low-order and high-order terms in the representing hilbert space(?).
Have I missed a point or is it only quasi high-dimensional? Is there any easy way to describe which kind of boundaries the inhomogeneous polynomial kernel can describe? Or is it just some suitable function which can only be justified by cross-validation?


text:
Q: Get All Tasks In Outlook WinForms I will accept C# code as well. Will just convert it to VB.NET.
I'm having trouble retrieving tasks from outlook.

I have an application that writes a task to outlook.

The application can also mark a task as completed... but this is where my problem comes in.

What I want to achieve at the end is to mark a task as completed in my application and then it should also be marked as completed in outlook.

This is the code I have tried so far to retrieve the tasks, but now I dont know how to iterate through them to be able to mark a specific task as completed:
Dim namespce As Outlook.NameSpace
Dim tasks As Outlook.Items
Dim oApp = New Outlook.Application

namespce = oApp.GetNamespace("MAPI")
tasks = namespce.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks).Items

For Each task As Object In tasks
    'From here on I dont know any more
Next

A: C# code:
foreach(Outlook.TaskItem task in tasks)
{
   bool isCompleeted = //Check if your task is compleeted in your application you could use EntryID property to identify a task
   if(isCompleeted == true && task.Status != OlTaskStatus.olTaskComplete)
   {
       task.MarkComplete();
       task.Save();
   }
}


text:
Q: How to create pairs from the table I have a Hive table wherein data looks like this -

Each customer has corresponding accounts and the objective is to make intra-customer pair.
Pairs are based on whether the accounts have same year of birth or their first 3 characters of name are same.
Eg - Sam and Samuel.
The output looks like this -

Ideally same account pair like AA, XX etc should not get created.
Also a pair AC and CA are both same hence only one entry of such pairs is needed. A pair can be formed on Name as well Year of Birth key but here also only one entry is required (can be anyone).
How should I approach this problem.
Test data for check -
create table customer_account(
customer INT NOT NULL,
accounts VARCHAR(100) NOT NULL,
name VARCHAR(40) NOT NULL,
yob DATE,
);

INSERT INTO
customer_account(customer,accounts,name,yob)
VALUES
(1,"A","John",2001),
(1,"X","Tom",1996),
(1,"C","Harry",2001),
(2,"D","Sam",1994),
(2,"F","Samuel",1995),
(3,"Z","Jake",)1994,
(3,"G","Drake",1998),
(3,"H","Arnold",1993),
(3,"K","Yang",1990)
;

A: You should be able to use substrings for your join in the HIVE language.  The logic should be sound though you may need to tune it for your needs a bit.
What you're trying to do is a unary (or self) join.  Below is an example of a type of query that can be passed.  You're essentially joining with an OR condition and testing that condition with a case statement to get the "Pair_Key". I used an inner join assuming you want only instances where matches occur.
SELECT
     t1.customer as Customer1,
     t2.customer as Customer2,
     t1.Accounts as Accounts1,
     t2.Accounts as Accounts2,
     CONCAT(t1.Accounts, t2.Accounts) as Pair_No,
     t1.Name as Name1,
     t2.Name as Name2,
     t1.YOB as YOB1,
     t2.YOB as YOB2,
     CASE
     WHEN t1.YOB = t2.YOB THEN 'YOB'
     WHEN SUBSTR(t1.Name, 3) = SUBSTR(t2.Name, 3) THEN 'Name'
     else 'Issue'
     END as Pair_Key
FROM (SELECT * FROM Table1) as t1
inner join (SELECT * FROM Table1) as t2 --instance 2 of the same table
on (SUBSTR(t1.Name, 3) = SUBSTR(t2.Name, 3) OR t1.YOB = t2.YOB)

Without test data or more details of how far along you are, this is a start.
If the customer number needs to be the same simply adjust to:
on (t1.Customer = t2.Customer) and (SUBSTR(t1.Name, 3) = SUBSTR(t2.Name, 3) OR t1.YOB = t2.YOB)

A: This does what you describe:
select t1.*, t2.name, t2.yob
from t t1 join
     t t2
     on t2.customer = t1.customer and
        (t2.yob = t1.yob or
         substr(t2.name, 1, 3) = substr(t1.name, 1, 3)
        ) and
        t2.account > t1.account;

There is no need to fetch customer twice.  If you want "identical" pairs, then change the last condition to >=.


text:
Q: Is it possible to produce circular (round) shaped radar chart in Chart.js? When I plot a standard Chart.js radar chart, the axis is a polygon shape (not round). For example:

Is it possible to make the axis round shaped, like this?:

A: Since Version 3, the scale option has been deprecated.
So to make the radar chart with circle gridlines, you have to pass the following option:
scales: {
  r: {
    grid: {
      circular: true,
    },
  },
},

const ctx = document.getElementById('radar-chart');

const data = {
  labels: [
    'Eating',
    'Drinking',
    'Sleeping',
    'Designing',
    'Coding',
    'Cycling',
    'Running'
  ],
  datasets: [{
    label: 'My First Dataset',
    data: [65, 59, 90, 81, 56, 55, 40],
    fill: true,
    backgroundColor: 'rgba(255, 99, 132, 0.2)',
    borderColor: 'rgb(255, 99, 132)',
    pointBackgroundColor: 'rgb(255, 99, 132)',
    pointBorderColor: '#fff',
    pointHoverBackgroundColor: '#fff',
    pointHoverBorderColor: 'rgb(255, 99, 132)'
  }, {
    label: 'My Second Dataset',
    data: [28, 48, 40, 19, 96, 27, 100],
    fill: true,
    backgroundColor: 'rgba(54, 162, 235, 0.2)',
    borderColor: 'rgb(54, 162, 235)',
    pointBackgroundColor: 'rgb(54, 162, 235)',
    pointBorderColor: '#fff',
    pointHoverBackgroundColor: '#fff',
    pointHoverBorderColor: 'rgb(54, 162, 235)'
  }]
};

const config = {
  type: 'radar',
  data: data,
  options: {
    scales: {
      r: {
        grid: {
          circular: true,
        },
      },
    },
    elements: {
      line: {
        borderWidth: 3
      }
    }
  },
};

const radarChart = new Chart(ctx, config);
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.2.1/chart.min.js"></script>
<canvas id="radar-chart"></canvas>

A: You have to change line tension:
data:{
        labels: ['visionary', 'determination', 'extraversion', 'agreeableness', 'emotionality'],
        datasets: [{
          data: [
            34, 45, 67, 89, 22
          ],
          label: 'me',
          lineTension: 0.5,
          borderColor: '#00ffff',
          backgroundColor: '#00ffff',

    }

Then your radar charts will be rounded just as you showed in the desired fashion

A: Edit [2021-10-27]: Chart.js v3 has removed scale option in favor of options.scales.r. Here's an updated way of making the radar grid circular.

const red = "rgb(255, 99, 132)";
const color = Chart.helpers.color;
const config = {
  type: 'radar',
  data: {
    labels: [['Eating', 'Dinner'], ['Drinking', 'Water'], 'Sleeping', ['Designing', 'Graphics'], 'Coding', 'Cycling', 'Running'],
    datasets: [{
      label: 'My dataset',
      backgroundColor: color(red).alpha(0.2).rgbString(),
      borderColor: red,
      pointBackgroundColor: red,
      data: [
        80,
        90,
        60,
        65,
        78,
        97,
        55
      ]
    }]
  },
  options: {
    scales: { // <-- Note change in options from scale to scales
        r: {
          grid: {
             circular: true
          },
          beginAtZero: true
        }
    }
  }
};

window.onload = function () {
  window.myRadar = new Chart(document.getElementById('chart'), config);
};
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.6.0/chart.min.js"></script>
<canvas id="chart"></canvas>

Edit: Kudos to @timclutton for pointing to the axes styling section of the docs, which lists the circular property for the radar chart.
Original answer: After some digging it turned out that it is in fact possible. The trick is to add scale: { gridLines: { circular: true } } to options of the chart. Please see the snippet below. Note. As of 19 Jul 2019 I couldn't find this information in the official docs. So, it's either not documented yet or this feature might be changed / removed in future.

const red = "rgb(255, 99, 132)";
const color = Chart.helpers.color;
const config = {
  type: 'radar',
  data: {
    labels: [['Eating', 'Dinner'], ['Drinking', 'Water'], 'Sleeping', ['Designing', 'Graphics'], 'Coding', 'Cycling', 'Running'],
    datasets: [{
      label: 'My dataset',
      backgroundColor: color(red).alpha(0.2).rgbString(),
      borderColor: red,
      pointBackgroundColor: red,
      data: [
        80,
        90,
        60,
        65,
        78,
        97,
        55
      ]
    }]
  },
  options: {
    scale: {
      gridLines: {
        circular: true
      },
      ticks: {
        beginAtZero: true
      },
    }
  }
};

window.onload = function () {
  window.myRadar = new Chart(document.getElementById('chart'), config);
};
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0/dist/Chart.min.js"></script>
<canvas id="chart"></canvas>

A: Perhaps not exactly what you are looking for; Chart.js documents a Polar area chart on it's samples page:

A quick example:

new Chart(document.getElementById("chart"), {
  type: "polarArea",
  data: {
    labels: ["a", "b", "c"],
    datasets: [{
      data: [10, 20, 30]
    }]
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js"></script>
<canvas id="chart"></canvas>


text:
Q: past simple vs. past perfect Here is a paragraph from a school English textbook for high school students in Taiwan.

Apart from its natural splendor, Kyoto has so much more to feast one's
eyes on. Having previously been the capital of Japan for over a
thousand years, the city boasts a large number of historic shrines and
temples.

According to the textbook, the second sentence is reduced from the adverbial clause:

Because the city had previously been the capital of Japan for
over a thousand years, it boasts a large number....

I wonder whether the full form of the clause should be in the simple past:

Because the city was previously the capital of Japan for over a
thousand years, it boasts a large number...

In the first and second paragraph, no information regarding other capitals of Japan before or after Kyoto is mentioned, so I wonder why the textbook says the second sentence is originally in the past perfect tense. I think the past simple should suffice.

A: I agree with you, and I think the textbook is wrong.  We would say "Kyoto was", because it's an event in the past, without any other time reference in the sentence.
"Kyoto had been" implies that it was in the past before another event in the past, and we don't see any other reference to an event in the past.  Had been would only be used in a sentence like "When Commodore Perry came to Japan, Kyoto had been the capital of Japan for over one thousand years."


text:
Q: Android How to Debug on PowerUp? I am getting exceptions on device Powerup. My app starts on receiving boot intent.  I would welcome any and all suggestions about how to debug on Powerup?  When I just powerup the debugger is not attached by default.  I am on sdk 2.1 and eclipse using adb debugger.  Thanks.
Also if the debugger does not attach where exactly would I find the error message from the crash on the device?  Which log file?  Where exactly should I look for this?

A: I would recommend to take a look at this question. There it is explained how you can set a DefaultExceptionHandler that catches all uncatched exceptions in your application and then writes it to a file or send it to a server.
In your case, both solution are applicable.. If you write it to a file you can check this file after booting. If you send it to a server or email you the you just have to assure that the exception handler waits until network connection is available.


text:
Q: Regex to exclude some directories inside one directory Hi I am reading directories inside one directory. It has names like abcModule and abcRelationModule, xyzModule
I have this regex modules/*/graphql-schema but it is considering abcModule, abcRelationModule, xyzModule.
I want to exclude abcRelationModule, which have RelationModule at the end.

A: Try this Regex:
modules\/(?![^\/]*RelationModule)[^\/]*\/graphql-schema

Click for Demo
See the JAVA code here
Explanation:

*

*modules\/ - matches modules/ literally

*(?![^\/]*RelationModule) - negative lookahead to check if the the text RelationModule is present anywhere before the occurrence of next / in the directory

*[^\/]* - matches 0+ occurrences of any character except /

*\/graphql-schema - matches /graphql-schema literally

If you do not want RelationModule anywhere in the directory, you can simply use ^(?!.*RelationModule).+$


text:
Q: Any photon colliders in the past? People have been thinking about a photon-photon collider (see this and this) as an add-on or to supplement the ILC, the next generation linear collider.
My question is, have there been any photon-photon colliders running in the past*, including those running below the $e^+ e^-$ threshold to study non-linear effects in photon scattering?
*Virtual/Weissäcker-Williams/Equivalent photon-photon colliders don't count.

A: It was done at SLAC in 1996. See Positron Production
in Multiphoton Light-by-Light Scattering. The paper was in Physics Review Letters.
For some background reading, there's plenty of arXiv papers with photon-photon interaction in the title. Also see Kirk McDonald's website for a wealth of information. He's a SLAC guy. For example, check out the 1998 PhysicsToday article gamma rays create matter just by plowing into laser light.
The photon-photon collisions weren't as "pure" as what the Imperial physicists are trying to do, but it was still gamma-gamma pair production.


text:
Q: Prevent valgrind from tracing any java child processes created with execvp I have a C program in which I make an execvp call out to java like so:
execvp(path_to_java, args);

Where path_to_java="/usr/java/latest/jre/bin/java" and args contains a link to the jar I'm running. I know it is working - I just want to profile the C portion.
I'm trying to run memcheck on it with this command in an attempt to avoid profiling the java child process, while profiling all of the other child processes:
valgrind --leak-check=yes --trace-children=yes --trace-children-skip=*java* myprog >>& LOGFILE

However, among other problems, I see the following in the LOGFILE:
valgrind: No match.

I tried --trace-children-skip=java as well, which didn't cause the "No match" error, but it failed entirely to prevent valgrind from stepping into the java subprocesses.
The reason why I am doing this is that I don't care to profile the java subprocesses, especially because valgrind and the JVM don't play nice. For instance:
==4873== 32,744 bytes in 1 blocks are possibly lost in loss record 946 of 986
==4873==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==4873==    by 0x5A455E8: os::malloc(unsigned long, unsigned short, unsigned cha
r*) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x54D7D32: ChunkPool::allocate(unsigned long, AllocFailStrategy::
AllocFailEnum) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x54D7950: Arena::grow(unsigned long, AllocFailStrategy::AllocFai
lEnum) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x56BDCFE: constMethodKlass::allocate(int, int, int, int, int, bo
ol, Thread*) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x5A3EDF9: oopFactory::new_method(int, AccessFlags, int, int, int
, int, bool, Thread*) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x563BD38: ClassFileParser::parse_method(constantPoolHandle, bool
, AccessFlags*, typeArrayHandle*, typeArrayHandle*, typeArrayHandle*, Thread*) (
in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x563C81B: ClassFileParser::parse_methods(constantPoolHandle, bool, AccessFlags*, bool*, objArrayOopDesc**, objArrayOopDesc**, objArrayOopDesc**, Thread*) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x563F8B0: ClassFileParser::parseClassFile(Symbol*, Handle, Handle, KlassHandle, GrowableArray<Handle>*, TempNewSymbol&, bool, Thread*) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x5643BF2: ClassLoader::load_classfile(Symbol*, Thread*) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x5B4FC86: SystemDictionary::load_instance_class(Symbol*, Handle, Thread*) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)
==4873==    by 0x5B50490: SystemDictionary::resolve_instance_class_or_null(Symbol*, Handle, Handle, Thread*) (in /usr/java/jdk1.7.0_45/jre/lib/amd64/server/libjvm.so)

Owch. What am I doing wrong?

A: Did you put the *java* pattern into quotes in your command line? Eg. like this:
valgrind --leak-check=yes --trace-children=yes --trace-children-skip="*java*" myprog >>& LOGFILE
Otherwise the asterisks will be interpreted by the shell, which will cause the valgrind: No match. message.


text:
Q: spring rest web service @requestparam to method custom class (NOT string) I'm using this tutorial https://spring.io/guides/gs/rest-service/
I want to pass to web service API method parameter other then String:
@RestController
public class ApiClass {

   @RequestMapping("/service")
   public int service(@RequestParam(value="paramIn") CustomClass paramIn) {
      if (paramIn.value != 0) return 1;
      else return 0;
  }

}

But when I try it I get this error:

HTTP Status 500 - Failed to convert value of type 'java.lang.String' to required type 'CustomClass'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [CustomClass]: no matching editors or conversion strategy found`

Thnaks,

A: Usual way to do this is to use POST or PUT method and annotate the the custom object with @RequestBody. For example:
 @RequestMapping(value = "/service",
                 method = RequestMethod.POST,
                 consumes = MediaType.APPLICATION_JSON_VALUE)
 public int service(@RequestBody CustomClass paramIn) {

     // do something with the paramIn

 }

If you POST a JSON representation of your CustomClass instance to endpoint /service Spring will deserialize it and pass it as an argument to your controller.


text:
Q: asp.net c# membership: how to do a GetUsersInRoles (multiple roles)H I want do a "GetUsersInRoles", i.e. I want to find all MembershipUser's having at least one of the roles in a set of roles, but I can't seem to get my head around this one.
I've got GetUsersInRole, Membership.GetAllUsers(), Linq,... but how?
Any feedback is greatly appreciated
Tommy

A: Here's a Linq version, it returns a MembershipUserCollection just like the similar Membership methods (FindUsersByEmail, FindUsersByName). It's not very pretty since it relies on the ForEach side effect:
    public static MembershipUserCollection FindUsersByRole(string[] roles)
    {
        MembershipUserCollection msc = new MembershipUserCollection();

        roles.Select(role => Roles.GetUsersInRole(role))
        .Aggregate((a, b) => a.Union(b).ToArray())
        .Distinct()
        .Select( user => Membership.GetUser(user))
        .ToList().ForEach( user => msc.Add(user));

        return msc;
    }

Alternatively if a list of MembershipUser will do:
    public static List<MembershipUser> FindUsersByRole(string[] roles)
    {
        var userList = roles.Select(role => Roles.GetUsersInRole(role))
                            .Aggregate((a, b) => a.Union(b).ToArray())
                            .Distinct()
                            .Select( user => Membership.GetUser(user))
                            .ToList();
        return userList;
    }

And finally if you just need the user names you can skip one select:
    public static List<string> FindUsersByRole(string[] roles)
    {
        var userList = roles.Select(role => Roles.GetUsersInRole(role))
                            .Aggregate((a, b) => a.Union(b).ToArray())
                            .Distinct()
                            .ToList();
        return userList;
    }

A: There is not such method as GetUsersInRoles but you will have to use GetUsersInRole and loop through your required roles.
Bit complicated but here is one way:
string[] roles = {"role1", "role2" };
        string[] tempusers = new string[]{};
        List<string> users = new List<string>();
        foreach (string role in roles)
        {
            string[] usersInRole = Roles.GetUsersInRole(role);
            users =  tempusers.Union(usersInRole).ToList();
            tempusers = users.ToArray();
        }
        foreach (string user in users) { Response.Write(user + "<br/>"); }

A: Really ASP.Net membership provider seems to be built with the thought of a user being tied to a single role. however we've had similar setups on projects we've worked on. its a little awkward but try something like this which worked for us:
 List<string> roleset_to_find = new List<string>() {"RoleA","RoleB"};

 List<string> membersFound = new List<string>();

 foreach (string role in roleset_to_find)
 {
      membersFound.AddRange(Roles.GetUsersInRole(role));
 }