问:
Url rewriting htaccess specific word
I have this

```<code>RewriteRule ^article/?$ articles.php [L]
</code>```

Currently this works both of them for these url : articles?id=100 and articles?id=100/Manage

But I would like to exclude a specific word : Manage after articles?id=100

This url will be forbidden : articles?id=100/manage

But articles?id=100 is OK

How can I change this ?

I try

```<code>RewriteRule ^article/?$/^(Manage) articles.php [L]
#or
RewriteRule ^article/?$/(Manage) articles.php [L,R=404]
</code>```

But It doesn't work.
Thx

答:
This involves more than just .htaccess file.
Your need a php function to work alone with the .htaccess

```<code>function slug($string, $spaceRepl = "-") {

  // Replace "&" char with "and"

  $string = str_replace("&", "and", $string);

  // Delete any chars but letters, numbers, spaces and _, -

  $string = preg_replace("/[^a-zA-Z0-9 _-]/", "", $string);

  // Optional: Make the string lowercase

  $string = strtolower($string);

  // Optional: Delete double spaces

  $string = preg_replace("/[ ]+/", " ", $string);

  // Replace spaces with replacement

  $string = str_replace(" ", $spaceRepl, $string);

  return $string;

}

?>
</code>```

and your htaccess
RewriteEngine On

```<code>RewriteRule ^articles/([0-9]+)/([a-zA-Z0-9_-]+) articles.php?id=$1
</code>```

Follow this tutorial http://www.simplecss3.com/tutorial/19/how-to-make-a-seo-friendly-url-using-php-and-htaccess

Title: Url rewriting htaccess specific word

Body:
I have this

RewriteRule ^article/?$ articles.php [L]

Currently this works both of them for these url : articles?id=100 and articles?id=100/Manage

But I would like to exclude a specific word : Manage after articles?id=100

This url will be forbidden : articles?id=100/manage

But articles?id=100 is OK

How can I change this ?

I try

RewriteRule ^article/?$/^(Manage) articles.php [L]
#or
RewriteRule ^article/?$/(Manage) articles.php [L,R=404]

But It doesn't work.
Thx

Body:
This involves more than just .htaccess file.
Your need a php function to work alone with the .htaccess

function slug($string, $spaceRepl = "-") {

  // Replace "&" char with "and"

  $string = str_replace("&", "and", $string);

  // Delete any chars but letters, numbers, spaces and _, -

  $string = preg_replace("/[^a-zA-Z0-9 _-]/", "", $string);

  // Optional: Make the string lowercase

  $string = strtolower($string);

  // Optional: Delete double spaces

  $string = preg_replace("/[ ]+/", " ", $string);

  // Replace spaces with replacement

  $string = str_replace(" ", $spaceRepl, $string);

  return $string;

}

?>

and your htaccess
RewriteEngine On

RewriteRule ^articles/([0-9]+)/([a-zA-Z0-9_-]+) articles.php?id=$1

Follow this tutorial http://www.simplecss3.com/tutorial/19/how-to-make-a-seo-friendly-url-using-php-and-htaccess


来源: stackexchange

问:
Java recursive Fibonacci sequence
Please explain this simple code:

```<code>public int fibonacci(int n)  {
    if(n == 0)
        return 0;
    else if(n == 1)
      return 1;
   else
      return fibonacci(n - 1) + fibonacci(n - 2);
}
</code>```

I'm confused with the last line especially because if n = 5 for example, then fibonacci(4) + fibonacci(3) would be called and so on but I don't understand how this algorithm calculates the value at index 5 by this method. Please explain with a lot of detail!

答:
A Fibbonacci sequence is one that sums the result of a number when added to the previous result starting with 1.

```<code>      so.. 1 + 1 = 2
           2 + 3 = 5
           3 + 5 = 8
           5 + 8 = 13
           8 + 13 = 21
</code>```

Once we understand what Fibbonacci is, we can begin to break down the code.

```<code>public int fibonacci(int n)  {
    if(n == 0)
        return 0;
    else if(n == 1)
      return 1;
   else
      return fibonacci(n - 1) + fibonacci(n - 2);
}
</code>```

The first if statment checks for a base case, where the loop can break out. The else if statement below that is doing the same, but it could be re-written like so...

```<code>    public int fibonacci(int n)  {
        if(n < 2)
             return n;

        return fibonacci(n - 1) + fibonacci(n - 2);
    }
</code>```

Now that a base case is establish we have to understand the call stack.Your first call to "fibonacci" will be the last to resolve on the stack (sequence of calls) as they resolve in the reverse order from which they were called. The last method called resolves first, then the last to be called before that one and so on...

So, all the calls are made first before anything is "calculated" with those results. With an input of 8 we expect an output of 21 (see table above).

fibonacci(n - 1) keeps being called until it reaches the base case, then fibonacci(n - 2) is called until it reaches the base case. When the stack starts summing the result in reverse order, the result will be like so...

```<code>1 + 1 = 1        ---- last call of the stack (hits a base case).
2 + 1 = 3        ---- Next level of the stack (resolving backwards).
2 + 3 = 5        ---- Next level of the stack (continuing to resolve).
</code>```

They keep bubbling (resolving backwards) up until the correct sum is returned to the first call in the stack and that's how you get your answer.

Having said that, this algorithm is very inefficient because it calculates the same result for each branch the code splits into. A much better approach is a "bottom up" one where no Memoization (caching) or recursion (deep call stack) is required.

Like so...

```<code>        static int BottomUpFib(int current)
        {
            if (current < 2) return current;

            int fib = 1;
            int last = 1;

            for (int i = 2; i < current; i++)
            {
                int temp = fib;
                fib += last;
                last = temp;
            }

            return fib;
        }
</code>```

ContentLicense: CC BY-SA 4.0

Title: Java recursive Fibonacci sequence

Body:
Please explain this simple code:

public int fibonacci(int n)  {
    if(n == 0)
        return 0;
    else if(n == 1)
      return 1;
   else
      return fibonacci(n - 1) + fibonacci(n - 2);
}

I'm confused with the last line especially because if n = 5 for example, then fibonacci(4) + fibonacci(3) would be called and so on but I don't understand how this algorithm calculates the value at index 5 by this method. Please explain with a lot of detail!

Body:
A Fibbonacci sequence is one that sums the result of a number when added to the previous result starting with 1.

      so.. 1 + 1 = 2
           2 + 3 = 5
           3 + 5 = 8
           5 + 8 = 13
           8 + 13 = 21

Once we understand what Fibbonacci is, we can begin to break down the code.

public int fibonacci(int n)  {
    if(n == 0)
        return 0;
    else if(n == 1)
      return 1;
   else
      return fibonacci(n - 1) + fibonacci(n - 2);
}

The first if statment checks for a base case, where the loop can break out. The else if statement below that is doing the same, but it could be re-written like so...

    public int fibonacci(int n)  {
        if(n < 2)
             return n;

        return fibonacci(n - 1) + fibonacci(n - 2);
    }

Now that a base case is establish we have to understand the call stack.Your first call to "fibonacci" will be the last to resolve on the stack (sequence of calls) as they resolve in the reverse order from which they were called. The last method called resolves first, then the last to be called before that one and so on...

So, all the calls are made first before anything is "calculated" with those results. With an input of 8 we expect an output of 21 (see table above).

fibonacci(n - 1) keeps being called until it reaches the base case, then fibonacci(n - 2) is called until it reaches the base case. When the stack starts summing the result in reverse order, the result will be like so...

1 + 1 = 1        ---- last call of the stack (hits a base case).
2 + 1 = 3        ---- Next level of the stack (resolving backwards).
2 + 3 = 5        ---- Next level of the stack (continuing to resolve).

They keep bubbling (resolving backwards) up until the correct sum is returned to the first call in the stack and that's how you get your answer.

Having said that, this algorithm is very inefficient because it calculates the same result for each branch the code splits into. A much better approach is a "bottom up" one where no Memoization (caching) or recursion (deep call stack) is required.

Like so...

        static int BottomUpFib(int current)
        {
            if (current < 2) return current;

            int fib = 1;
            int last = 1;

            for (int i = 2; i < current; i++)
            {
                int temp = fib;
                fib += last;
                last = temp;
            }

            return fib;
        }

ContentLicense: CC BY-SA 3.0


问:
LINQ .ToList() fails on single result
It could be that its late Friday evening and I want to go home, or more likely I just can't see the problem...

I have the fallowing LINQ code:

```<code>mthumbs = itm.Elements(nsr + "thumbnail") != null ?
      (from mt in itm.Elements(nsr + "thumbnail")
       select new MediaThumbnail
       {
         mediaThumbnailUrl = (string)mt.Attribute("url") ?? null,
         mediaThumbnailHeight = (string)mt.Attribute("height") ?? null,
         mediaThumbnailWidth = (string)mt.Attribute("width") ?? null,
         mediaThumbnailTime = (string)mt.Attribute("time").Value ?? null
        }).ToList() : null
</code>```

The MediaThumbnail Class looks like:

```<code>public class MediaThumbnail
{
    public string mediaThumbnailUrl { get; set; }
    public string mediaThumbnailWidth { get; set; }
    public string mediaThumbnailHeight { get; set; }
    public string mediaThumbnailTime { get; set; }
}
</code>```

and resides in the MediaOptElement class which looks like:

```<code>public class MediaOptElement
{
    public string mediaPlayer { get; set; }
    public string mediaRating { get; set; }
    public string mediaRatingScheme { get; set; }
    public string mediaTitle { get; set; }
    public string mediaTitleType { get; set; }
    public string mediaDescription { get; set; }
    public string mediaDescriptionType { get; set; }
    public string mediaKeywords { get; set; }
    public List<MediaThumbnail> mthumbs { get; set; }
    public string mediaCategory { get; set; }
    public string mediaCategoryScheme { get; set; }
    public string mediaCategoryLabel { get; set; }
    public string mediaHash { get; set; }
    public string mediaHashAlgorithm { get; set; }
    public string mediaCopyRights { get; set; }
    public string mediaCopyrightsUrl { get; set; }
    public string mediaRestrictions { get; set; }
    public string mediaRestrictionsRelation { get; set; }
    public string mediaRestrictionsType { get; set; }
    public List<MediaCredit> mediaCredit { get; set; }
}
</code>```

Some Sample XML:

```<code>   <?xml version="1.0" encoding="UTF-8" ?>
   <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
      <channel>
        <title>wdbj7.com - Sports</title>
        <link>http://www.wdbj7.com/sports/?track=rss</link>
        <description>Headlines from wdbj7.com</description>
        <language>en</language>
        <copyright>©2011, wdbj7.com</copyright>
        <lastBuildDate>Fri, 21 Jan 2011 10:47:00 -0500</lastBuildDate>
        <item>
          <title>Brookville improves to 15-0</title>
          <link>http://www.wdbj7.com/sports/wdbj7-brookville-improves-to-150-01212011,0,675989.story?track=rss</link>
          <description><p>The Brookville girls' basketball team graduated two college basketball players last year. That was the last time they lost anything.</p> <p>The Lady Bees are 14-0 on the young season and looked to add to that mark Thursday night against Seminole district rival Liberty.</p> <p>The Minettes playing at home, had just three wins on the year.  Haley Comer gets two for the home team. Liberty takes the 2-0 lead.  That is when it becomes the Katie Deacon show.</p> <p>The four-year varsity player starts it with the defense.  She gets the steal on one end and a basket on the other.</p> <p>Deacon takes her game behind the three point arc!  That beats the buzzer at the end of the first quarter!</p> <p>Deacon still not done.  She gets another steal and feeds George Mason signee Talisha Watts.<br /><br />Brookville improves to 15-0 with the 57-34 win. <br /><br /></p></description>
          <pubDate>Fri, 21 Jan 2011 10:47:00 -0500</pubDate>
          <media:thumbnail url="http://media.trb.com/media/thumbnails/story/2011-01/276990840-21074740.jpg" />
          <media:content url="http://media.trb.com/media/alternatethumbnails/story/2011-01/276990840-21074739.jpg" />
       </item>
     </channel>
  </rss>
</code>```

When I run my code, I get the following error:

```<code>   Object reference not set to an instance of an object.
</code>```

The stack trace is:

```<code>   at RssAggregator.Reader.RssReader.<>c__DisplayClass7d.<parseFeed>b__6e(XElement mt) in E:\Aggregator\VersionControl\FeedsParserLINQ\RssAggregator\Reader \RssReader.cs:line 843
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at RssAggregator.Reader.RssReader.<>c__DisplayClass7d.<parseFeed>b__57(XElement itm) in E:\Aggregator\VersionControl\FeedsParserLINQ\RssAggregator\Reader\RssReader.cs:line 667
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at RssAggregator.Reader.RssReader.parseFeed(XDocument xmlDoc) in E:\Aggregator\VersionControl\FeedsParserLINQ\RssAggregator\Reader\RssReader.cs:line 666
</code>```

I could be wrong, but I think the problem happens when the LINQ query only returns a single result.  However, I need to be able to handle cases when there might only be one media:thumbnail node or many media:thumbnail nodes. Any ideas?!  Thanks!

答:
I think the problem is in this line:

```<code>mediaThumbnailTime = (string)mt.Attribute("time").Value ?? null
</code>```

If the attribute doesn't exist, then you'll get a NullReferenceException when you attempt to use the Value attribute.  Note in your example the time attribute isn't present.

Try this:

```<code>...
using System.Linq;
using System.Xml.Linq;

var mthumbs = itm.Elements( nsr + "thumbnail" )
                 .Select( e => new MediaThumbnail
                  {
                     mediaThumbnailUrl = string.Format( "{0}", e.Attribute("url" ),
                     mediaThumbnailHeight = string.Format( "{0}",e.Attribute("height" ),
                     mediaThumbnailWidth = string.Format( "{0}",e.Attribute("width" ),
                     mediaThumbnailTime = string.Format( "{0}", e.Attribute("time" )
                  })
                 .ToList();
</code>```

ContentLicense: CC BY-SA 2.5

Title: LINQ .ToList() fails on single result

Body:
It could be that its late Friday evening and I want to go home, or more likely I just can't see the problem...

I have the fallowing LINQ code:

mthumbs = itm.Elements(nsr + "thumbnail") != null ?
      (from mt in itm.Elements(nsr + "thumbnail")
       select new MediaThumbnail
       {
         mediaThumbnailUrl = (string)mt.Attribute("url") ?? null,
         mediaThumbnailHeight = (string)mt.Attribute("height") ?? null,
         mediaThumbnailWidth = (string)mt.Attribute("width") ?? null,
         mediaThumbnailTime = (string)mt.Attribute("time").Value ?? null
        }).ToList() : null

The MediaThumbnail Class looks like:

public class MediaThumbnail
{
    public string mediaThumbnailUrl { get; set; }
    public string mediaThumbnailWidth { get; set; }
    public string mediaThumbnailHeight { get; set; }
    public string mediaThumbnailTime { get; set; }
}

and resides in the MediaOptElement class which looks like:

public class MediaOptElement
{
    public string mediaPlayer { get; set; }
    public string mediaRating { get; set; }
    public string mediaRatingScheme { get; set; }
    public string mediaTitle { get; set; }
    public string mediaTitleType { get; set; }
    public string mediaDescription { get; set; }
    public string mediaDescriptionType { get; set; }
    public string mediaKeywords { get; set; }
    public List<MediaThumbnail> mthumbs { get; set; }
    public string mediaCategory { get; set; }
    public string mediaCategoryScheme { get; set; }
    public string mediaCategoryLabel { get; set; }
    public string mediaHash { get; set; }
    public string mediaHashAlgorithm { get; set; }
    public string mediaCopyRights { get; set; }
    public string mediaCopyrightsUrl { get; set; }
    public string mediaRestrictions { get; set; }
    public string mediaRestrictionsRelation { get; set; }
    public string mediaRestrictionsType { get; set; }
    public List<MediaCredit> mediaCredit { get; set; }
}

Some Sample XML:

   <?xml version="1.0" encoding="UTF-8" ?>
   <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
      <channel>
        <title>wdbj7.com - Sports</title>
        <link>http://www.wdbj7.com/sports/?track=rss</link>
        <description>Headlines from wdbj7.com</description>
        <language>en</language>
        <copyright>©2011, wdbj7.com</copyright>
        <lastBuildDate>Fri, 21 Jan 2011 10:47:00 -0500</lastBuildDate>
        <item>
          <title>Brookville improves to 15-0</title>
          <link>http://www.wdbj7.com/sports/wdbj7-brookville-improves-to-150-01212011,0,675989.story?track=rss</link>
          <description>
The Brookville girls' basketball team graduated two college basketball players last year. That was the last time they lost anything.

The Lady Bees are 14-0 on the young season and looked to add to that mark Thursday night against Seminole district rival Liberty.

The Minettes playing at home, had just three wins on the year.  Haley Comer gets two for the home team. Liberty takes the 2-0 lead.  That is when it becomes the Katie Deacon show.

The four-year varsity player starts it with the defense.  She gets the steal on one end and a basket on the other.

Deacon takes her game behind the three point arc!  That beats the buzzer at the end of the first quarter!

Deacon still not done.  She gets another steal and feeds George Mason signee Talisha Watts.

Brookville improves to 15-0 with the 57-34 win.

</description>
          <pubDate>Fri, 21 Jan 2011 10:47:00 -0500</pubDate>
          <media:thumbnail url="http://media.trb.com/media/thumbnails/story/2011-01/276990840-21074740.jpg" />
          <media:content url="http://media.trb.com/media/alternatethumbnails/story/2011-01/276990840-21074739.jpg" />
       </item>
     </channel>
  </rss>

When I run my code, I get the following error:

   Object reference not set to an instance of an object.

The stack trace is:

   at RssAggregator.Reader.RssReader.<>c__DisplayClass7d.<parseFeed>b__6e(XElement mt) in E:\Aggregator\VersionControl\FeedsParserLINQ\RssAggregator\Reader \RssReader.cs:line 843
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at RssAggregator.Reader.RssReader.<>c__DisplayClass7d.<parseFeed>b__57(XElement itm) in E:\Aggregator\VersionControl\FeedsParserLINQ\RssAggregator\Reader\RssReader.cs:line 667
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at RssAggregator.Reader.RssReader.parseFeed(XDocument xmlDoc) in E:\Aggregator\VersionControl\FeedsParserLINQ\RssAggregator\Reader\RssReader.cs:line 666

I could be wrong, but I think the problem happens when the LINQ query only returns a single result.  However, I need to be able to handle cases when there might only be one media:thumbnail node or many media:thumbnail nodes. Any ideas?!  Thanks!

Body:
I think the problem is in this line:

mediaThumbnailTime = (string)mt.Attribute("time").Value ?? null

If the attribute doesn't exist, then you'll get a NullReferenceException when you attempt to use the Value attribute.  Note in your example the time attribute isn't present.

Try this:

...
using System.Linq;
using System.Xml.Linq;

var mthumbs = itm.Elements( nsr + "thumbnail" )
                 .Select( e => new MediaThumbnail
                  {
                     mediaThumbnailUrl = string.Format( "{0}", e.Attribute("url" ),
                     mediaThumbnailHeight = string.Format( "{0}",e.Attribute("height" ),
                     mediaThumbnailWidth = string.Format( "{0}",e.Attribute("width" ),
                     mediaThumbnailTime = string.Format( "{0}", e.Attribute("time" )
                  })
                 .ToList();


问:
XamarinForms AppCompat OnOptionsItemSelected
I have recently updated xamarin forms to 1.5.1-pre1 so that I can use the beautiful AppCompat themes. It works and looks very nice.

I do have one problem, in my old FormsApplicationActivity I used to override the OnOptionsItemSelected method to intercept when the user was clicking on the back arrow icon and do some viewmodel cleanup. Apparently this method is not being called after using the FormsAppCompatActivity.
How can I intercept the "soft" back button press (toolbar icon not hard back button) ?

I also tried to override the Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer but i can't seem to override it :(

Does anyone have a clue how I can intercept this?

答:
Have a look at the last two lines of the OnCreate() After adding them OnOptionsItemSelected was called as expected).

https://raw.githubusercontent.com/UdaraAlwis/Xamarin-Playground/master/XFNavBarBackBtnClickOverride/XFNavBarBackBtnClickOverride/XFNavBarBackBtnClickOverride.Droid/MainActivity.cs

```<code>        Toolbar toolbar = this.FindViewById<Toolbar>(Resource.Id.toolbar);

        SetSupportActionBar(toolbar);
</code>```

Body:
Have a look at the last two lines of the OnCreate() After adding them OnOptionsItemSelected was called as expected).

https://raw.githubusercontent.com/UdaraAlwis/Xamarin-Playground/master/XFNavBarBackBtnClickOverride/XFNavBarBackBtnClickOverride/XFNavBarBackBtnClickOverride.Droid/MainActivity.cs

        Toolbar toolbar = this.FindViewById<Toolbar>(Resource.Id.toolbar);

        SetSupportActionBar(toolbar);


问:
How to insert programmatically a value in a new row of a QtableView
I'm using a QtableView to display and edit data from a QsqlTableModel.
Everything's fine : data from a postgreSQL table is displayed, and user can edit it and save  modifications.

I want to add a row when uses click on a button. I use the insertRecord method from my QslTableModel.
The row is correctly added in the QTableView.

My problem is :
I want to insert a value from a query in the first cell of this new row. (to automatically populate an unique identifier).

This is my code :

```<code>def ajoutlgn(self):
    query_idNewLine = QtSql.QSqlQuery(self.db)
    if query_idNewLine.exec_('SELECT sp_idsuivi+1 FROM bdsuivis.t_suivprev_tablo ORDER BY sp_idsuivi DESC LIMIT 1'):
        while query_idNewLine.next():
            identifiant = query_idNewLine.value(0)
            #print identifiant

    record = QtSql.QSqlRecord()
    record.setValue(1,identifiant)
    self.model.insertRecord(self.model.rowCount(), record)
</code>```

The value is not inserted in the new row (but if I enter a value by hand, it works perfectly).
Nevertheless, the query is OK (as I can see with the « print identifiant » line, which returns the expected integer).

Do you see what I'm doing wrong ?

Are there other methods to insert programmatically a value in a QTableView cell?

Or do I have to use a QitemDelegate ?

Thanks for advance.

答:
Finally I found the solution :

This line creates a record, but not a record for my QsqlTableModel

```<code>    record = QtSql.QSqlRecord()
</code>```

I replaced it with this one, and it works perfectly :

```<code>    record = self.model.record()
</code>```

Body:
I'm using a QtableView to display and edit data from a QsqlTableModel.
Everything's fine : data from a postgreSQL table is displayed, and user can edit it and save  modifications.

I want to add a row when uses click on a button. I use the insertRecord method from my QslTableModel.
The row is correctly added in the QTableView.

My problem is :
I want to insert a value from a query in the first cell of this new row. (to automatically populate an unique identifier).

This is my code :

def ajoutlgn(self):
    query_idNewLine = QtSql.QSqlQuery(self.db)
    if query_idNewLine.exec_('SELECT sp_idsuivi+1 FROM bdsuivis.t_suivprev_tablo ORDER BY sp_idsuivi DESC LIMIT 1'):
        while query_idNewLine.next():
            identifiant = query_idNewLine.value(0)
            #print identifiant

    record = QtSql.QSqlRecord()
    record.setValue(1,identifiant)
    self.model.insertRecord(self.model.rowCount(), record)

The value is not inserted in the new row (but if I enter a value by hand, it works perfectly).
Nevertheless, the query is OK (as I can see with the « print identifiant » line, which returns the expected integer).

Do you see what I'm doing wrong ?

Are there other methods to insert programmatically a value in a QTableView cell?

Or do I have to use a QitemDelegate ?

Thanks for advance.

Body:
Finally I found the solution :

This line creates a record, but not a record for my QsqlTableModel

    record = QtSql.QSqlRecord()

I replaced it with this one, and it works perfectly :

    record = self.model.record()


问:
Using VBA, how can I get the immediate parent folder name from a path string?
I've been given an assignment modifying some vba script and i'm unsure of how to obtain the parent folder name given a full path string.

Here's what I have so far:

```<code>'=== Required output should be "zzz"
Dim FullFolderName As String
Dim FolderName As String
Dim FullPath As String

FullPath = "x:\xxx\yyy\zzz\somefile.txt"
Dim folderobject
Set folderobject = CreateObject("Scripting.FileSystemObject")

FullFolderName = folderobject.GetParentFolderName(ThisDrawing.FullName)
'FullFolderName ends up with "x:\xxx\yyy\zzz"
'Everything above works. Below does not. I want FolderName to = "zzz"

FolderName = String.Remove(FullFolderName.LastIndexOf("\"))
</code>```

So far it seems more complex than using .NET.  any help is appreciated.

答:
you may use instrrev</p>

```<code>FolderName = Left(FullFolderName, InStrRev(FullFolderName, "\")-1)
</code>```

Body:
I've been given an assignment modifying some vba script and i'm unsure of how to obtain the parent folder name given a full path string.

Here's what I have so far:

'=== Required output should be "zzz"
Dim FullFolderName As String
Dim FolderName As String
Dim FullPath As String

FullPath = "x:\xxx\yyy\zzz\somefile.txt"
Dim folderobject
Set folderobject = CreateObject("Scripting.FileSystemObject")

FullFolderName = folderobject.GetParentFolderName(ThisDrawing.FullName)
'FullFolderName ends up with "x:\xxx\yyy\zzz"
'Everything above works. Below does not. I want FolderName to = "zzz"

FolderName = String.Remove(FullFolderName.LastIndexOf("\"))

So far it seems more complex than using .NET.  any help is appreciated.

Body:
you may use instrrev

FolderName = Left(FullFolderName, InStrRev(FullFolderName, "\")-1)


问:
Query to tell me how many times a digit appears in a column
I'm trying to find out how many times each digit appears in a column. I have a database that stores pin numbers for parents that check their kids in and out of a preschool.

The pin numbers are stored in a CHAR(4) column; but they are all numeric.

I have tried:

```<code>SELECT COUNT(pin) AS Count
FROM adult
WHERE pin LIKE '%2%';
</code>```

Which returns these results:

```<code>+-------+
| Count |
+-------+
|   182 |
+-------+
</code>```

But that only tells me how many records have a '2', not how many times it occurs (since a record could have more than 1 '2'. It's also a very manual process to go through each digit 0-9.

I'd like something that would look more like:

```<code>+-----+-----+
|Value|Count|
+-----+-----+
|    0|  204|
|    1|  200|
|    2|  182|
.           .
.           .
.           .
|    9|  203|
+-----+-----+
</code>```

This is beyond my knowledge of SQL. Your help is very appreciated!

答:
You could try something like this; Expression just looks at the length of the string after replacing your value and then you SUM all rows to have a total / column.

```<code>SELECT
    1 AS Value
    ,SUM(LENGTH(pin) - LENGTH(replace(pin, '1',''))) AS Count
FROM <your_table>
UNION
SELECT
    2 AS Value
    ,SUM(LENGTH(pin) - LENGTH(replace(pin, '2',''))) AS Count
FROM <your_table>
UNION
SELECT
    3 AS Value
    ,SUM(LENGTH(pin) - LENGTH(replace(pin, '3',''))) AS Count
FROM <your_table>
....
.... and so on
</code>```

Or you can use a variable where you store the value and iterate values from 0 to 9

Body:
I'm trying to find out how many times each digit appears in a column. I have a database that stores pin numbers for parents that check their kids in and out of a preschool.

The pin numbers are stored in a CHAR(4) column; but they are all numeric.

I have tried:

SELECT COUNT(pin) AS Count
FROM adult
WHERE pin LIKE '%2%';

Which returns these results:

+-------+
| Count |
+-------+
|   182 |
+-------+

But that only tells me how many records have a '2', not how many times it occurs (since a record could have more than 1 '2'. It's also a very manual process to go through each digit 0-9.

I'd like something that would look more like:

+-----+-----+
|Value|Count|
+-----+-----+
|    0|  204|
|    1|  200|
|    2|  182|
.           .
.           .
.           .
|    9|  203|
+-----+-----+

This is beyond my knowledge of SQL. Your help is very appreciated!

Body:
You could try something like this; Expression just looks at the length of the string after replacing your value and then you SUM all rows to have a total / column.

SELECT
    1 AS Value
    ,SUM(LENGTH(pin) - LENGTH(replace(pin, '1',''))) AS Count
FROM <your_table>
UNION
SELECT
    2 AS Value
    ,SUM(LENGTH(pin) - LENGTH(replace(pin, '2',''))) AS Count
FROM <your_table>
UNION
SELECT
    3 AS Value
    ,SUM(LENGTH(pin) - LENGTH(replace(pin, '3',''))) AS Count
FROM <your_table>
....
.... and so on

Or you can use a variable where you store the value and iterate values from 0 to 9


问:
How to create an after_save callback on runtime
I am using ruby on rails 2.3.5 .

I have user instance. On run time depending on certain conditions I want to add an after_save callback just for this instance.

The other issue is that this after_save should take a block or a proc as parameter.

What I want is something like this. This is psuedo code.

user = User.first

proc = Proc.new do
 puts 'this is foo'
end

user.after_save proc

答:
```<code>@user = User.first

eigen = class << @user; self; end
eigen.after_save do
  puts @user.email
end

@user.save
# prints user.email

@another = User.find(100)
@another.save
# does not print user.email
</code>```


问:
Google Earth Engine: How can I perform image calculations with random values pixel by pixel?
I would like to perform some calculations on an ee.Image pixel by pixel, however, the result calculated must obey a probabilistic Gaussian distribution, so some pixels will be modified and others not. I already coded a probabilistic function but I don't know how to apply it to each pixel in GEE. Is there any way to do that?

I already tried something like the following, but the same random number is used for every pixel, and that is not what I want.

Trial 1)

```<code>var result = img.where(img.lte(32 + Math.floor((Math.random() * 10) + 1)),1);
</code>```

Trial 2)

```<code>var result = img.expression(
    '(B1 > 32 + P) ? 1', {
    'P': Math.floor((Math.random() * 10) + 1),
    'B1': img.select('B1')});
</code>```

Trial 3)

```<code>var result = img.expression(
    'P > 10 ? 1', {
    'P': MyProbabilisticFunction(),
    'B1': img.select('B1')});
</code>```

I also tried to use the following to generate a "probabilistic" image to perform my calculations but, since I have several classes in the same raster, the probability of the "event" is not quite right.

Trial 4)

```<code>var rd = ee.FeatureCollection.randomPoints(geometry,1000,Math.floor((Math.random() * 10) + 1));
var prob = rd.draw('000000',5,0).select('vis-red');
var result = img.where(prob.eq(0),1);
</code>```

答:
You can generate a random value per pixel using ee.Image.random().

That said, the rest of Earth Engine doesn't work the way you're attempting to use it.  All image functions are "vectorized"; you don't ever get to work "pixel by pixel".

Body:
I would like to perform some calculations on an ee.Image pixel by pixel, however, the result calculated must obey a probabilistic Gaussian distribution, so some pixels will be modified and others not. I already coded a probabilistic function but I don't know how to apply it to each pixel in GEE. Is there any way to do that?

I already tried something like the following, but the same random number is used for every pixel, and that is not what I want.

Trial 1)

var result = img.where(img.lte(32 + Math.floor((Math.random() * 10) + 1)),1);

Trial 2)

var result = img.expression(
    '(B1 > 32 + P) ? 1', {
    'P': Math.floor((Math.random() * 10) + 1),
    'B1': img.select('B1')});

Trial 3)

var result = img.expression(
    'P > 10 ? 1', {
    'P': MyProbabilisticFunction(),
    'B1': img.select('B1')});

I also tried to use the following to generate a "probabilistic" image to perform my calculations but, since I have several classes in the same raster, the probability of the "event" is not quite right.

Trial 4)

var rd = ee.FeatureCollection.randomPoints(geometry,1000,Math.floor((Math.random() * 10) + 1));
var prob = rd.draw('000000',5,0).select('vis-red');
var result = img.where(prob.eq(0),1);


问:
Location of the table space files?
How can I find the directory in which oracle stores it's table space files?

When I do: select * from dba_data_files; or select * from v$datafile; then I get some paths like that:

```<code>+DATA01/fu/datafile/bar_ts01_data.260.264360912
</code>```

But what means +DATA01? And where is that exactly in the file system?

答:
+DATA01/fu/datafile/bar_ts01_data.260.264360912

Yes this is correct file path. It means you use ASM disk.

After you login to OS with "grid" user [usually Oracle Grid Infrastructure installation user is named like that], run following command to browse files on ASM disk.

```<code>export ORACLE_HOME=/u01/app/11.2.0/grid --this is also usual installation dir, may differ on your case
export ORACLE_SID=+ASM
cd $ORACLE_HOME/bin
./asmcmd -p
ASMCMD>ls
+DATA01
+DATA02
ASMCMD>cd +DATA01
</code>```

Title: Location of the table space files?

Body:
How can I find the directory in which oracle stores it's table space files?

When I do: select * from dba_data_files; or select * from v$datafile; then I get some paths like that:

+DATA01/fu/datafile/bar_ts01_data.260.264360912

But what means +DATA01? And where is that exactly in the file system?

Body:
+DATA01/fu/datafile/bar_ts01_data.260.264360912

Yes this is correct file path. It means you use ASM disk.

After you login to OS with "grid" user [usually Oracle Grid Infrastructure installation user is named like that], run following command to browse files on ASM disk.

export ORACLE_HOME=/u01/app/11.2.0/grid --this is also usual installation dir, may differ on your case
export ORACLE_SID=+ASM
cd $ORACLE_HOME/bin
./asmcmd -p
ASMCMD>ls
+DATA01
+DATA02
ASMCMD>cd +DATA01


问:
Tomcat with compression enabled causes error on OS X High Sierra
We have been using Tomcat (v7) on OS X for quite some time now and never experienced any problems. However, after updating the OS to High Sierra, the web applications do not work anymore when compression is enabled in the server.xml.

Chrome constantly shows an ERR_CONTENT_DECODING_FAILED (obviously without any content displaying). When compression is switched off, everything works fine. I assume the root of the problem is Apple's upgrade of zlib in High Sierra. Everything was working fine on Sierra. The Tomcat log files look flawless -- there is no mention of any error occurring there.

Does anyone experience the same issue and managed to fix it or knows of a viable workaround without disabling compression?

Also, it would also be helpful if someone can confirm that newer versions of Tomcat do not experience this issue on High Sierra.

Thanks for your help.

答:
Fyi, OS X users, I tried installing JDK 8u162-ea from http://jdk.java.net/8/, and it did not fix the issue. I think the reason is that, unlike the Windows JDK, the OS X JDK does not bundle zlib, but rather uses the zlib that is included with OS X (/usr/lib/libz.1.dylib). This can be seen by looking at the shared libraries the java executable depends on:

```<code>$ otool -L /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/bin/java
/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/bin/java:
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 19.0.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55179.0.2)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 45.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.1.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 945.11.0)
</code>```

So I think we need a fix for this issue from Apple in the form of an
 update for High Sierra.

Body:
Fyi, OS X users, I tried installing JDK 8u162-ea from http://jdk.java.net/8/, and it did not fix the issue. I think the reason is that, unlike the Windows JDK, the OS X JDK does not bundle zlib, but rather uses the zlib that is included with OS X (/usr/lib/libz.1.dylib). This can be seen by looking at the shared libraries the java executable depends on:

$ otool -L /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/bin/java
/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/bin/java:
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 19.0.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55179.0.2)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 45.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.1.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 945.11.0)

So I think we need a fix for this issue from Apple in the form of an
 update for High Sierra.


问:
iOS 11 - UserDefaults.standard string value nil
Whilst trying to retrieve values stored in UserDefaults.standard, i'm currently finding that a string value set within the Root.plist is not being read as expected; it has a default value assigned to it from within the Xcode storyboard UI (e.g. http://www.google.com), but when it is read within the ViewController swift code it is nil.

Within the ViewController's viewDidLoad(), I am calling

```<code>    UserDefaults.standard.register(defaults: [String : Any]())
</code>```

Within the ViewController's viewWillAppear(), i then try to read the string value as follows:

```<code>    let userDefaults = UserDefaults.standard
    var defaultURL = userDefaults.string(forKey: "server_url")
</code>```

But defaultURL is nil. Not entirely sure what is going on here! Can anyone advise?

答:
You have to register concrete key(s) and value(s)</p>

```<code>UserDefaults.standard.register(defaults: ["server_url" : "http://www.google.com/"])
</code>```

Body:
Whilst trying to retrieve values stored in UserDefaults.standard, i'm currently finding that a string value set within the Root.plist is not being read as expected; it has a default value assigned to it from within the Xcode storyboard UI (e.g. http://www.google.com), but when it is read within the ViewController swift code it is nil.

Within the ViewController's viewDidLoad(), I am calling

    UserDefaults.standard.register(defaults: [String : Any]())

Within the ViewController's viewWillAppear(), i then try to read the string value as follows:

    let userDefaults = UserDefaults.standard
    var defaultURL = userDefaults.string(forKey: "server_url")

But defaultURL is nil. Not entirely sure what is going on here! Can anyone advise?

Body:
You have to register concrete key(s) and value(s)

UserDefaults.standard.register(defaults: ["server_url" : "http://www.google.com/"])


问:
Detect if a variable is a datetime object
I have a variable and I need to know if it is a datetime object.

So far I have been using the following hack in the function to detect datetime object:

```<code>if 'datetime.datetime' in str(type(variable)):
     print('yes')
</code>```

But there really should be a way to detect what type of object something is. Just like I can do:

```<code>if type(variable) is str: print 'yes'
</code>```

Is there a way to do this other than the hack of turning the name of the object type into a string and seeing if the string contains 'datetime.datetime'?

答:
I believe all the above answer will work only if date is of type datetime.datetime. What if the date object is of type datetime.time or datetime.date?

This is how I find a datetime object. It always worked for me. (Python2 & Python3):

```<code>import datetime
type(date_obj) in (datetime, datetime.date, datetime.datetime, datetime.time)
</code>```

Testing in Python2 or Python3 shell:

```<code>import datetime
d = datetime.datetime.now()  # creating a datetime.datetime object.
date = d.date()  # type(date): datetime.date
time = d.time()  # type(time): datetime.time

type(d) in (datetime, datetime.date, datetime.datetime, datetime.time)
True
type(date) in (datetime, datetime.date, datetime.datetime, datetime.time)
True
type(time) in (datetime, datetime.date, datetime.datetime, datetime.time)
True
</code>```

Body:
I have a variable and I need to know if it is a datetime object.

So far I have been using the following hack in the function to detect datetime object:

if 'datetime.datetime' in str(type(variable)):
     print('yes')

But there really should be a way to detect what type of object something is. Just like I can do:

if type(variable) is str: print 'yes'

Is there a way to do this other than the hack of turning the name of the object type into a string and seeing if the string contains 'datetime.datetime'?

Body:
I believe all the above answer will work only if date is of type datetime.datetime. What if the date object is of type datetime.time or datetime.date?

This is how I find a datetime object. It always worked for me. (Python2 & Python3):

import datetime
type(date_obj) in (datetime, datetime.date, datetime.datetime, datetime.time)

Testing in Python2 or Python3 shell:

import datetime
d = datetime.datetime.now()  # creating a datetime.datetime object.
date = d.date()  # type(date): datetime.date
time = d.time()  # type(time): datetime.time

type(d) in (datetime, datetime.date, datetime.datetime, datetime.time)
True
type(date) in (datetime, datetime.date, datetime.datetime, datetime.time)
True
type(time) in (datetime, datetime.date, datetime.datetime, datetime.time)
True


问:
Take the mean of values in a list if a duplicate is found
I have 2 lists which are associated with each other. E.g., here, 'John' is associated with '1', 'Bob' is associated with 4, and so on:

```<code>l1 = ['John', 'Bob', 'Stew', 'John']
l2 = [1, 4, 7, 3]
</code>```

My problem is with the duplicate John. Instead of adding the duplicate John, I want to take the mean of the values associated with the Johns, i.e., 1 and 3, which is (3 + 1)/2 = 2. Therefore, I would like the lists to actually be:

```<code>l1 = ['John', 'Bob', 'Stew']
l2 = [2, 4, 7]
</code>```

I have experimented with some solutions including for-loops and the "contains" function, but can't seem to piece it together. I'm not very experienced with Python, but linked lists sound like they could be used for this.

Thank you

答:
Something like this:</p>

```<code>#!/usr/bin/python
l1 = ['John', 'Bob', 'Stew', 'John']
l2 = [1, 4, 7, 3]
d={}
for i in range(0, len(l1)):
    key = l1[i]
    if d.has_key(key):
         d[key].append(l2[i])
    else:
         d[key] = [l2[i]]
r = []
for values in d.values():
    r.append((key,sum(values)/len(values)))
print r
</code>```

Body:
I have 2 lists which are associated with each other. E.g., here, 'John' is associated with '1', 'Bob' is associated with 4, and so on:

l1 = ['John', 'Bob', 'Stew', 'John']
l2 = [1, 4, 7, 3]

My problem is with the duplicate John. Instead of adding the duplicate John, I want to take the mean of the values associated with the Johns, i.e., 1 and 3, which is (3 + 1)/2 = 2. Therefore, I would like the lists to actually be:

l1 = ['John', 'Bob', 'Stew']
l2 = [2, 4, 7]

I have experimented with some solutions including for-loops and the "contains" function, but can't seem to piece it together. I'm not very experienced with Python, but linked lists sound like they could be used for this.

Thank you

Body:
Something like this:

#!/usr/bin/python
l1 = ['John', 'Bob', 'Stew', 'John']
l2 = [1, 4, 7, 3]
d={}
for i in range(0, len(l1)):
    key = l1[i]
    if d.has_key(key):
         d[key].append(l2[i])
    else:
         d[key] = [l2[i]]
r = []
for values in d.values():
    r.append((key,sum(values)/len(values)))
print r


问:
Put text and form next to photo using bootstrap
This is my HTML:

```<code><div class="row trolibelanja">
    <div class="col-md-3">
        <img src="http://2.bp.blogspot.com/-WGiyrP7xGOk/VQlHwjgporI/AAAAAAAABHI/zLGXTH0-H2w/s1600/Mie%2BAyam%2B(4).jpg" class="detailfoto">
    </div>
    <div class="col-md-4">
        <p class="detailnama">Mie Ayam Bakso</p>
        <p class="detailtoko">Toko Bu Lastri</p>
    </div>
    <div class="col-md-2">
        <p class="detailharga">Rp. 30.000</p>
    </div>
    <div class="col-md-2">
        <div class="input-group">
            <span class="input-group-btn">
            <button class="btnjumlah" type="button">-</button>
            </span>
            <input type="text" class="form-control jumlah" value="1">
            <span class="input-group-btn">
                <button class="btnjumlah" type="button">+</button>
            </span>
        </div>
    </div>
    <div class="col-md-1">
    </div>
</div>
</code>```

This is my css:

```<code>body{
    background-color: #661f61 !important;
    font-family: 'Saira Extra Condensed', sans-serif !important;
}

.container-fluid.keranjang {
    background-color: #e9e9e9;
    flex: 1;
}

.container.keranjang {

}

.row.trolibelanja {
        background-color: #e1e1e1;
    position: relative;
    padding-top: 10px;
    padding-bottom: 23px;
}

.row.trolibelanja:after{
    background-image: -webkit-linear-gradient(135deg, #6e1c64 25%, #e27f31 25%) !important;
    position: absolute;
    content: " ";
    width: 100%;
    height: 15px;
    bottom: 0;
}

.detailfoto {
    width: 100%;
    height: 110px;
    border: 6px solid white;
}

.detailnama{
    font-size: 20px;
    font-weight: bold;
}

.detailtoko{
    line-height: 20px;
    margin: -17px 0px;
}

.detailharga{
    font-size: 20px;
    font-weight: bold;
    text-align: center;
}

.input-group .jumlah {
    width: 50%;
    text-align: center;
}

.input-group .btnjumlah {
        background-color: #e27f31;
    color: white;
    border: 0;
    font-size: 20px;
    font-weight: bold;
    padding: 0px 10px;
    height: 100%;

}
</code>```

I am trying to put text and form next to photo using bootstrap, as in photo below:

enter image description here

My code result:

enter image description here

Please let me know what am I missing? I tried each combination of display that i know, but they wouldn't work. Thank you

答:
i ran your code on bootsnipp and found everything is placed side by side to each other, except for the fact that you did not add img-responsive to the image class. and that the below code is distorting your design.

```<code>    .row.trolibelanja:after{
    background-image: -webkit-linear-gradient(135deg, #6e1c64 25%, #e27f31 25%) !important;
    position: absolute;
    content: " ";
    width: 100%;
    height: 15px;
    bottom: 0;
}
</code>```

dont you what you intent designing with that, but i think you need to run a check that css code .

when i added your css to it, it distort the whole code.

first review your CSS is well written , targeting the right class.

second add img-responsive to the img class and i think you are good
to go.

Body:
This is my HTML:

Mie Ayam Bakso

Toko Bu Lastri

Rp. 30.000

            <button class="btnjumlah" type="button">-</button>

            <input type="text" class="form-control jumlah" value="1">

                <button class="btnjumlah" type="button">+</button>

This is my css:

body{
    background-color: #661f61 !important;
    font-family: 'Saira Extra Condensed', sans-serif !important;
}

.container-fluid.keranjang {
    background-color: #e9e9e9;
    flex: 1;
}

.container.keranjang {

}

.row.trolibelanja {
        background-color: #e1e1e1;
    position: relative;
    padding-top: 10px;
    padding-bottom: 23px;
}

.row.trolibelanja:after{
    background-image: -webkit-linear-gradient(135deg, #6e1c64 25%, #e27f31 25%) !important;
    position: absolute;
    content: " ";
    width: 100%;
    height: 15px;
    bottom: 0;
}

.detailfoto {
    width: 100%;
    height: 110px;
    border: 6px solid white;
}

.detailnama{
    font-size: 20px;
    font-weight: bold;
}

.detailtoko{
    line-height: 20px;
    margin: -17px 0px;
}

.detailharga{
    font-size: 20px;
    font-weight: bold;
    text-align: center;
}

.input-group .jumlah {
    width: 50%;
    text-align: center;
}

.input-group .btnjumlah {
        background-color: #e27f31;
    color: white;
    border: 0;
    font-size: 20px;
    font-weight: bold;
    padding: 0px 10px;
    height: 100%;

}

I am trying to put text and form next to photo using bootstrap, as in photo below:

enter image description here

My code result:

enter image description here

Please let me know what am I missing? I tried each combination of display that i know, but they wouldn't work. Thank you

Body:
i ran your code on bootsnipp and found everything is placed side by side to each other, except for the fact that you did not add img-responsive to the image class. and that the below code is distorting your design.

    .row.trolibelanja:after{
    background-image: -webkit-linear-gradient(135deg, #6e1c64 25%, #e27f31 25%) !important;
    position: absolute;
    content: " ";
    width: 100%;
    height: 15px;
    bottom: 0;
}

dont you what you intent designing with that, but i think you need to run a check that css code .

when i added your css to it, it distort the whole code.

first review your CSS is well written , targeting the right class.

second add img-responsive to the img class and i think you are good
to go.


问:
Problem with PHP sessions
Update Solved problem!

After examining the code, the freaking problem was I was missing the }else{} after

```<code>header ('location:referraldone.php?say=blankfields');
}
</code>```

.

I'm really lost at the moment with this session code. I don't understand why the session isn't working. Where did I go wrong? I'm trying to take the data entered in the fields to the next page when someone makes an error not filling an required field. Codes are below:

```<code><?php

if (!$_POST['cname'] | !$_POST['cphone'] | !$_POST['caddress'] | !$_POST['ccity'] | !$_POST['cstate'] | !$_POST['czip'] | !$_POST['cbirthday']) {

$rname = $_REQUEST['rname'];
$rdate = $_REQUEST['rdate'];
$ragency = $_REQUEST['ragency'];
$rphone = $_REQUEST['rphone'];
$cname = $_REQUEST['cname'];
$cphone = $_REQUEST['cphone'];
$caddress = $_REQUEST['caddress'];
$ccity = $_REQUEST['ccity'];
$cstate = $_REQUEST['cstate'];
$czip = $_REQUEST['czip'];
$cbirthday = $_REQUEST['cbirthday'];
$medmemid = $_REQUEST['medmemid'];
$medclaim = $_REQUEST['medclaim'];
$marital = $_REQUEST['marital'];
$income = $_REQUEST['income'];
$gender = $_REQUEST['gender'];
$race = $_REQUEST['race'];
$caregiver = $_REQUEST['caregiver'];
$relationship = $_REQUEST['relationship'];
$memphone = $_REQUEST['memphone'];
$physician = $_REQUEST['physician'];
$phyphone = $_REQUEST['phyphone'];

session_start();
$_SESSION['rname'] = $rname;
$_SESSION['rdate'] = $rdate;
$_SESSION['ragency'] = $ragency;
$_SESSION['rphone'] = $rphone;
$_SESSION['cname'] = $cname;
$_SESSION['cphone'] = $cphone;
$_SESSION['caddress'] = $caddress;
$_SESSION['ccity'] = $ccity;
$_SESSION['cstate'] = $cstate;
$_SESSION['czip'] = $czip;
$_SESSION['cbirthday'] = $cbirthday;
$_SESSION['medmemid'] = $medmemid;
$_SESSION['medclaim'] = $medclaim;
$_SESSION['marital'] = $marital;
$_SESSION['income'] = $income;
$_SESSION['gender'] = $gender;
$_SESSION['race'] = $race;
$_SESSION['caregiver'] = $caregiver;
$_SESSION['relationship'] = $relationship;
$_SESSION['memphone'] = $memphone;
$_SESSION['physician'] = $physician;
$_SESSION['phyphone'] = $phyphone;

header ('location:referraldone.php?say=blankfields');
}

?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <table style="text-align:left; width: 500px; left:45px; position:relative; padding:2px; border:1px solid #1A1A1A">
    <tr>
        <td colspan="2" style="vertical-align:top; text-align:center; border:1px solid #1A1A1A; background-color:#A52A2A; color:#FFFFFF;">REFERRAL FORM</td>
    </tr>
    <tr>
    <td colspan="2"><center>Choose us as your Home Care Agency!<br />We provide services 24 hours per day, 7 days a week.<br /><br />Please submit form below and your respond time<br />will be 48 hours.<br /><br /><strong>*Bold Fields Required</strong><br /><br /></td>
    </tr>
    <tr>
        <td valign="top">Reffered By:<br /><input name="rname" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Reffered Date:<br /><input name="rdate" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Reffered Agency:<br /><input name="ragency" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Phone:<br /><input name="rphone" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Client Name:</strong><br /><input name="cname" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Phone:</strong><br /><input name="cphone" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Address:</strong><br /><input name="caddress" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* City:</strong><br /><input name="ccity" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* State:</strong><br /><input name="cstate" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Zip Code:</strong><br /><input name="czip" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Birthday:</strong><br /><input name="cbirthday" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Medicaid Member ID:<br /><input name="medmemid" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Medicare Claim:<br /><input name="medclaim" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Marital Status:<br /><input name="marital" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Monthly Income:<br /><input name="income" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Gender:<br /><input name="gender" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Race:<br /><input name="race" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Caregiver Name:<br /><input name="caregiver" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Relationship:<br /><input name="relationship" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Phone:<br /><input name="memphone" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Physician:<br /><input name="physician" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Phone:<br /><input name="phyphone" type="text" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top" style="color:#C00000"><br />Please make sure all the <strong>BOLD</strong> fields are completed before submitting form.<br /><br /></td>
    </tr>
    <tr>
        <td align="right"><input type="reset" value="Clear Fields"> <input type="submit" name="send" value="Send" /></td>
    </tr>
    </table>
</form>
</code>```

Here's the error page that should take the session data and fill the fields with it, but it doesn't:

```<code><?php
$sb = "5";

$say = $_REQUEST['say'];

$rname = $_SESSION['rname'];
$rdate = $_SESSION['rdate'];
$ragency = $_SESSION['ragency'];
$rphone = $_SESSION['rphone'];
$cname = $_SESSION['cname'];
$cphone = $_SESSION['cphone'];
$caddress = $_SESSION['caddress'];
$ccity = $_SESSION['ccity'];
$cstate = $_SESSION['cstate'];
$czip = $_SESSION['czip'];
$cbirthday = $_SESSION['cbirthday'];
$medmemid = $_SESSION['medmemid'];
$medclaim = $_SESSION['medclaim'];
$marital = $_SESSION['marital'];
$income = $_SESSION['income'];
$gender = $_SESSION['gender'];
$race = $_SESSION['race'];
$caregiver = $_SESSION['caregiver'];
$relationship = $_SESSION['relationship'];
$memphone = $_SESSION['memphone'];
$physician = $_SESSION['physician'];
$phyphone = $_SESSION['phyphone'];

if(isset($say)){
    switch ($say){
        case "formsent":
        $return = "Referral Form Sent. Your respond time will be 48 hours.";
        break;
        case "blankfields":
        $return = "All <strong>Bold</strong> Fields Required";
        break;
        default:
        break;
    }
}

if (isset($_POST['send'])) {

    if (!$_POST['cname'] | !$_POST['cphone'] | !$_POST['caddress'] | !$_POST['ccity'] | !$_POST['cstate'] | !$_POST['czip'] | !$_POST['cbirthday']) {

$rname = $_REQUEST['rname'];
$rdate = $_REQUEST['rdate'];
$ragency = $_REQUEST['ragency'];
$rphone = $_REQUEST['rphone'];
$cname = $_REQUEST['cname'];
$cphone = $_REQUEST['cphone'];
$caddress = $_REQUEST['caddress'];
$ccity = $_REQUEST['ccity'];
$cstate = $_REQUEST['cstate'];
$czip = $_REQUEST['czip'];
$cbirthday = $_REQUEST['cbirthday'];
$medmemid = $_REQUEST['medmemid'];
$medclaim = $_REQUEST['medclaim'];
$marital = $_REQUEST['marital'];
$income = $_REQUEST['income'];
$gender = $_REQUEST['gender'];
$race = $_REQUEST['race'];
$caregiver = $_REQUEST['caregiver'];
$relationship = $_REQUEST['relationship'];
$memphone = $_REQUEST['memphone'];
$physician = $_REQUEST['physician'];
$phyphone = $_REQUEST['phyphone'];

session_start();
$_SESSION['rname'] = $rname;
$_SESSION['rdate'] = $rdate;
$_SESSION['ragency'] = $ragency;
$_SESSION['rphone'] = $rphone;
$_SESSION['cname'] = $cname;
$_SESSION['cphone'] = $cphone;
$_SESSION['caddress'] = $caddress;
$_SESSION['ccity'] = $ccity;
$_SESSION['cstate'] = $cstate;
$_SESSION['czip'] = $czip;
$_SESSION['cbirthday'] = $cbirthday;
$_SESSION['medmemid'] = $medmemid;
$_SESSION['medclaim'] = $medclaim;
$_SESSION['marital'] = $marital;
$_SESSION['income'] = $income;
$_SESSION['gender'] = $gender;
$_SESSION['race'] = $race;
$_SESSION['caregiver'] = $caregiver;
$_SESSION['relationship'] = $relationship;
$_SESSION['memphone'] = $memphone;
$_SESSION['physician'] = $physician;
$_SESSION['phyphone'] = $phyphone;

header ('location:referraldone.php?say=blankfields');
}
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <table style="text-align:left; width: 500px; left:45px; position:relative; padding:2px; border:1px solid #1A1A1A">
    <tr>
        <td colspan="2" style="vertical-align:top; text-align:center; border:1px solid #1A1A1A; background-color:#A52A2A; color:#FFFFFF;">REFERRAL FORM</td>
    </tr>
    <tr>
    <td colspan="2"><center>Choose us as your Home Care Agency!<br />We provide services 24 hours per day, 7 days a week.<br /><br />Please submit form below and your respond time<br />will be 48 hours.<br /><br /><strong>*Bold Fields Required</strong><br /><br /></td>
    </tr>
    <tr>
        <td valign="top">Reffered By:<br /><input name="rname" type="text" value="<?php echo $rname; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Reffered Date:<br /><input name="rdate" type="text" value="<?php echo $rdate; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Reffered Agency:<br /><input name="ragency" type="text" value="<?php echo $ragency; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Phone:<br /><input name="rphone" type="text" style=value="rphone" "width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Client Name:</strong><br /><input name="cname" type="text" value="<?php echo $cname; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Phone:</strong><br /><input name="cphone" type="text" value="<?php echo $cphone; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Address:</strong><br /><input name="caddress" type="text" value="<?php echo $caddress; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* City:</strong><br /><input name="ccity" type="text" value="<?php echo $ccity; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* State:</strong><br /><input name="cstate" type="text" value="<?php echo $cstate; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Zip Code:</strong><br /><input name="czip" type="text" value="<?php echo $czip; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br /><strong>* Birthday:</strong><br /><input name="cbirthday" type="text" value="<?php echo $cbirthday; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Medicaid Member ID:<br /><input name="medmemid" type="text" value="<?php echo $medmemid; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Medicare Claim:<br /><input name="medclaim" type="text" value="<?php echo $medclaim; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Marital Status:<br /><input name="marital" type="text" value="<?php echo $marital; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Monthly Income:<br /><input name="income" type="text" value="<?php echo $income; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Gender:<br /><input name="gender" type="text" value="<?php echo $gender; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Race:<br /><input name="race" type="text" value="<?php echo $race; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Caregiver Name:<br /><input name="caregiver" type="text" value="<?php echo $caregiver; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Relationship:<br /><input name="relationship" type="text" value="<?php echo $relationship; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Phone:<br /><input name="memphone" type="text" value="<?php echo $phone; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Physician:<br /><input name="physician" type="text" value="<?php echo $physician; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top"><br />Phone:<br /><input name="phyphone" type="text" value="<?php echo $phyphone; ?>" style="width:98%" /></td>
    </tr>
    <tr>
        <td valign="top" style="color:#C00000"><br />Please make sure all the <strong>BOLD</strong> fields are completed before submitting form.<br /><br /></td>
    </tr>
    <tr>
        <td align="right"><input type="reset" value="Clear Fields"> <input type="submit" name="send" value="Send" /></td>
    </tr>
    </table>
</form>
</code>```

答:
A few obvious problems with your code:

Your are using binary OR | instead of the boolean or || in your if clause.

Instead of manually localizing the variables, you might as well extract($_REQUEST); - This is probably bad advise, since you might not understand the security implications of your script running entirely in the global scope.

So the (better) alternative would be to manually foreach ($_REQUEST as $key=>$value) and thus fill up your $_SESSION. Do so likewise in the second script.

Remember: Foreach loops are our friends.

Likewise the html output can be accomplished in a loop, reducing the overall code size.

You might be missing a session_start, or also likely: have premature output and got a notice which you didn't tell us about.

Title: Problem with PHP sessions

Body:
Update Solved problem!

After examining the code, the freaking problem was I was missing the }else{} after

header ('location:referraldone.php?say=blankfields');
}

.

I'm really lost at the moment with this session code. I don't understand why the session isn't working. Where did I go wrong? I'm trying to take the data entered in the fields to the next page when someone makes an error not filling an required field. Codes are below:

<?php

if (!$_POST['cname'] | !$_POST['cphone'] | !$_POST['caddress'] | !$_POST['ccity'] | !$_POST['cstate'] | !$_POST['czip'] | !$_POST['cbirthday']) {

$rname = $_REQUEST['rname'];
$rdate = $_REQUEST['rdate'];
$ragency = $_REQUEST['ragency'];
$rphone = $_REQUEST['rphone'];
$cname = $_REQUEST['cname'];
$cphone = $_REQUEST['cphone'];
$caddress = $_REQUEST['caddress'];
$ccity = $_REQUEST['ccity'];
$cstate = $_REQUEST['cstate'];
$czip = $_REQUEST['czip'];
$cbirthday = $_REQUEST['cbirthday'];
$medmemid = $_REQUEST['medmemid'];
$medclaim = $_REQUEST['medclaim'];
$marital = $_REQUEST['marital'];
$income = $_REQUEST['income'];
$gender = $_REQUEST['gender'];
$race = $_REQUEST['race'];
$caregiver = $_REQUEST['caregiver'];
$relationship = $_REQUEST['relationship'];
$memphone = $_REQUEST['memphone'];
$physician = $_REQUEST['physician'];
$phyphone = $_REQUEST['phyphone'];

session_start();
$_SESSION['rname'] = $rname;
$_SESSION['rdate'] = $rdate;
$_SESSION['ragency'] = $ragency;
$_SESSION['rphone'] = $rphone;
$_SESSION['cname'] = $cname;
$_SESSION['cphone'] = $cphone;
$_SESSION['caddress'] = $caddress;
$_SESSION['ccity'] = $ccity;
$_SESSION['cstate'] = $cstate;
$_SESSION['czip'] = $czip;
$_SESSION['cbirthday'] = $cbirthday;
$_SESSION['medmemid'] = $medmemid;
$_SESSION['medclaim'] = $medclaim;
$_SESSION['marital'] = $marital;
$_SESSION['income'] = $income;
$_SESSION['gender'] = $gender;
$_SESSION['race'] = $race;
$_SESSION['caregiver'] = $caregiver;
$_SESSION['relationship'] = $relationship;
$_SESSION['memphone'] = $memphone;
$_SESSION['physician'] = $physician;
$_SESSION['phyphone'] = $phyphone;

header ('location:referraldone.php?say=blankfields');
}

?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

        REFERRAL FORM

    Choose us as your Home Care Agency!
We provide services 24 hours per day, 7 days a week.

Please submit form below and your respond time
will be 48 hours.

*Bold Fields Required

        Reffered By:
<input name="rname" type="text" style="width:98%" />

Reffered Date:
<input name="rdate" type="text" style="width:98%" />

Reffered Agency:
<input name="ragency" type="text" style="width:98%" />

Phone:
<input name="rphone" type="text" style="width:98%" />

* Client Name:
<input name="cname" type="text" style="width:98%" />

* Phone:
<input name="cphone" type="text" style="width:98%" />

* Address:
<input name="caddress" type="text" style="width:98%" />

* City:
<input name="ccity" type="text" style="width:98%" />

* State:
<input name="cstate" type="text" style="width:98%" />

* Zip Code:
<input name="czip" type="text" style="width:98%" />

* Birthday:
<input name="cbirthday" type="text" style="width:98%" />

Medicaid Member ID:
<input name="medmemid" type="text" style="width:98%" />

Medicare Claim:
<input name="medclaim" type="text" style="width:98%" />

Marital Status:
<input name="marital" type="text" style="width:98%" />

Monthly Income:
<input name="income" type="text" style="width:98%" />

Gender:
<input name="gender" type="text" style="width:98%" />

Race:
<input name="race" type="text" style="width:98%" />

Caregiver Name:
<input name="caregiver" type="text" style="width:98%" />

Relationship:
<input name="relationship" type="text" style="width:98%" />

Phone:
<input name="memphone" type="text" style="width:98%" />

Physician:
<input name="physician" type="text" style="width:98%" />

Phone:
<input name="phyphone" type="text" style="width:98%" />

Please make sure all the BOLD fields are completed before submitting form.

        <input type="reset" value="Clear Fields"> <input type="submit" name="send" value="Send" />

</form>

Here's the error page that should take the session data and fill the fields with it, but it doesn't:

<?php
$sb = "5";

$say = $_REQUEST['say'];

$rname = $_SESSION['rname'];
$rdate = $_SESSION['rdate'];
$ragency = $_SESSION['ragency'];
$rphone = $_SESSION['rphone'];
$cname = $_SESSION['cname'];
$cphone = $_SESSION['cphone'];
$caddress = $_SESSION['caddress'];
$ccity = $_SESSION['ccity'];
$cstate = $_SESSION['cstate'];
$czip = $_SESSION['czip'];
$cbirthday = $_SESSION['cbirthday'];
$medmemid = $_SESSION['medmemid'];
$medclaim = $_SESSION['medclaim'];
$marital = $_SESSION['marital'];
$income = $_SESSION['income'];
$gender = $_SESSION['gender'];
$race = $_SESSION['race'];
$caregiver = $_SESSION['caregiver'];
$relationship = $_SESSION['relationship'];
$memphone = $_SESSION['memphone'];
$physician = $_SESSION['physician'];
$phyphone = $_SESSION['phyphone'];

if(isset($say)){
    switch ($say){
        case "formsent":
        $return = "Referral Form Sent. Your respond time will be 48 hours.";
        break;
        case "blankfields":
        $return = "All Bold Fields Required";
        break;
        default:
        break;
    }
}

if (isset($_POST['send'])) {

    if (!$_POST['cname'] | !$_POST['cphone'] | !$_POST['caddress'] | !$_POST['ccity'] | !$_POST['cstate'] | !$_POST['czip'] | !$_POST['cbirthday']) {

$rname = $_REQUEST['rname'];
$rdate = $_REQUEST['rdate'];
$ragency = $_REQUEST['ragency'];
$rphone = $_REQUEST['rphone'];
$cname = $_REQUEST['cname'];
$cphone = $_REQUEST['cphone'];
$caddress = $_REQUEST['caddress'];
$ccity = $_REQUEST['ccity'];
$cstate = $_REQUEST['cstate'];
$czip = $_REQUEST['czip'];
$cbirthday = $_REQUEST['cbirthday'];
$medmemid = $_REQUEST['medmemid'];
$medclaim = $_REQUEST['medclaim'];
$marital = $_REQUEST['marital'];
$income = $_REQUEST['income'];
$gender = $_REQUEST['gender'];
$race = $_REQUEST['race'];
$caregiver = $_REQUEST['caregiver'];
$relationship = $_REQUEST['relationship'];
$memphone = $_REQUEST['memphone'];
$physician = $_REQUEST['physician'];
$phyphone = $_REQUEST['phyphone'];

session_start();
$_SESSION['rname'] = $rname;
$_SESSION['rdate'] = $rdate;
$_SESSION['ragency'] = $ragency;
$_SESSION['rphone'] = $rphone;
$_SESSION['cname'] = $cname;
$_SESSION['cphone'] = $cphone;
$_SESSION['caddress'] = $caddress;
$_SESSION['ccity'] = $ccity;
$_SESSION['cstate'] = $cstate;
$_SESSION['czip'] = $czip;
$_SESSION['cbirthday'] = $cbirthday;
$_SESSION['medmemid'] = $medmemid;
$_SESSION['medclaim'] = $medclaim;
$_SESSION['marital'] = $marital;
$_SESSION['income'] = $income;
$_SESSION['gender'] = $gender;
$_SESSION['race'] = $race;
$_SESSION['caregiver'] = $caregiver;
$_SESSION['relationship'] = $relationship;
$_SESSION['memphone'] = $memphone;
$_SESSION['physician'] = $physician;
$_SESSION['phyphone'] = $phyphone;

header ('location:referraldone.php?say=blankfields');
}
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

        REFERRAL FORM

    Choose us as your Home Care Agency!
We provide services 24 hours per day, 7 days a week.

Please submit form below and your respond time
will be 48 hours.

*Bold Fields Required

        Reffered By:
<input name="rname" type="text" value="<?php echo $rname; ?>" style="width:98%" />

Reffered Date:
<input name="rdate" type="text" value="<?php echo $rdate; ?>" style="width:98%" />

Reffered Agency:
<input name="ragency" type="text" value="<?php echo $ragency; ?>" style="width:98%" />

Phone:
<input name="rphone" type="text" style=value="rphone" "width:98%" />

* Client Name:
<input name="cname" type="text" value="<?php echo $cname; ?>" style="width:98%" />

* Phone:
<input name="cphone" type="text" value="<?php echo $cphone; ?>" style="width:98%" />

* Address:
<input name="caddress" type="text" value="<?php echo $caddress; ?>" style="width:98%" />

* City:
<input name="ccity" type="text" value="<?php echo $ccity; ?>" style="width:98%" />

* State:
<input name="cstate" type="text" value="<?php echo $cstate; ?>" style="width:98%" />

* Zip Code:
<input name="czip" type="text" value="<?php echo $czip; ?>" style="width:98%" />

* Birthday:
<input name="cbirthday" type="text" value="<?php echo $cbirthday; ?>" style="width:98%" />

Medicaid Member ID:
<input name="medmemid" type="text" value="<?php echo $medmemid; ?>" style="width:98%" />

Medicare Claim:
<input name="medclaim" type="text" value="<?php echo $medclaim; ?>" style="width:98%" />

Marital Status:
<input name="marital" type="text" value="<?php echo $marital; ?>" style="width:98%" />

Monthly Income:
<input name="income" type="text" value="<?php echo $income; ?>" style="width:98%" />

Gender:
<input name="gender" type="text" value="<?php echo $gender; ?>" style="width:98%" />

Race:
<input name="race" type="text" value="<?php echo $race; ?>" style="width:98%" />

Caregiver Name:
<input name="caregiver" type="text" value="<?php echo $caregiver; ?>" style="width:98%" />

Relationship:
<input name="relationship" type="text" value="<?php echo $relationship; ?>" style="width:98%" />

Phone:
<input name="memphone" type="text" value="<?php echo $phone; ?>" style="width:98%" />

Physician:
<input name="physician" type="text" value="<?php echo $physician; ?>" style="width:98%" />

Phone:
<input name="phyphone" type="text" value="<?php echo $phyphone; ?>" style="width:98%" />

Please make sure all the BOLD fields are completed before submitting form.

        <input type="reset" value="Clear Fields"> <input type="submit" name="send" value="Send" />

</form>


问:
How to insert with table creation
I am looking for a more appropriate way to execute several inserts into a nonexistent table.
To create the table beforehand is not easily possible, as I don't know the data type of the selected column.
An "insert with create" would do, but I don't think there is anything like that.

Is there any better way to do so than to select into and then to insert?

Here is the "bad" way I do it, in an example very much stripped down to demonstrate the problem.

```<code>set nocount on

declare
    @name sysname = '',
    @i int = 0,
    @sql nvarchar(4000) = ''

declare test cursor for
    select top 10 a.name from sys.tables a inner join sys.columns b on a.object_id = b.object_id --and b.name = 'description'
open test
fetch next from test into @name
while (@@FETCH_STATUS <> -1)
begin

    if @i = 0 begin

        set @sql = 'select distinct top 10 description into #t1 from ' + @name + ''
        select @sql
        --  exec sp_executesql @sql

    end
    else begin

        set @sql = 'insert #t1 select distinct top 10 description into #t1 from ' + @name + ''
        select @sql
        --  exec sp_executesql @sql

    end
    set @i = @i + 1
    fetch next from test into @name
end
close test
deallocate test

if object_id ('tempdb..#t1') is not null select * from #t1
</code>```

This solution is "bad" as you need the statement at two positions. In the case shown here this is trivial, but when the statement gets more complex this can become an issue.

答:
You can simplify your query into this one:

```<code>set nocount on

declare
    @name sysname = '',
    @i int = 0,
    @sql nvarchar(4000) = N''

if object_id ('tempdb..#t1') is not null DROP TABLE #t1

;WITH cte AS (
    select top 10 a.[name]
    from sys.tables a
    inner join sys.columns b
        on a.object_id = b.object_id --and b.name = 'description'
)

SELECT @sql = @sql + N'UNION ALL
select distinct top 10 description
from ' + QUOTENAME([name])  + CHAR(13)
FROM cte

SELECT @sql = N';WITH cte AS (' + STUFF(@sql,1,10,') SELECT * INTO #t1 FROM cte')

PRINT @sql
--EXEC (@sql)

select * from #t1
</code>```

No cursor or while loop;

Temporary table is dropped (if exists) before query execution;

You got a weird query, as for now it takes the first table from sys.tables and SELECT TOP 10 Descriptions from this table as many times as there are columns in this table.

Title: How to insert with table creation

Body:
I am looking for a more appropriate way to execute several inserts into a nonexistent table.
To create the table beforehand is not easily possible, as I don't know the data type of the selected column.
An "insert with create" would do, but I don't think there is anything like that.

Is there any better way to do so than to select into and then to insert?

Here is the "bad" way I do it, in an example very much stripped down to demonstrate the problem.

set nocount on

declare
    @name sysname = '',
    @i int = 0,
    @sql nvarchar(4000) = ''

declare test cursor for
    select top 10 a.name from sys.tables a inner join sys.columns b on a.object_id = b.object_id --and b.name = 'description'
open test
fetch next from test into @name
while (@@FETCH_STATUS <> -1)
begin

    if @i = 0 begin

        set @sql = 'select distinct top 10 description into #t1 from ' + @name + ''
        select @sql
        --  exec sp_executesql @sql

    end
    else begin

        set @sql = 'insert #t1 select distinct top 10 description into #t1 from ' + @name + ''
        select @sql
        --  exec sp_executesql @sql

    end
    set @i = @i + 1
    fetch next from test into @name
end
close test
deallocate test

if object_id ('tempdb..#t1') is not null select * from #t1

This solution is "bad" as you need the statement at two positions. In the case shown here this is trivial, but when the statement gets more complex this can become an issue.

Body:
You can simplify your query into this one:

set nocount on

declare
    @name sysname = '',
    @i int = 0,
    @sql nvarchar(4000) = N''

if object_id ('tempdb..#t1') is not null DROP TABLE #t1

;WITH cte AS (
    select top 10 a.[name]
    from sys.tables a
    inner join sys.columns b
        on a.object_id = b.object_id --and b.name = 'description'
)

SELECT @sql = @sql + N'UNION ALL
select distinct top 10 description
from ' + QUOTENAME([name])  + CHAR(13)
FROM cte

SELECT @sql = N';WITH cte AS (' + STUFF(@sql,1,10,') SELECT * INTO #t1 FROM cte')

PRINT @sql
--EXEC (@sql)

select * from #t1

No cursor or while loop;

Temporary table is dropped (if exists) before query execution;

You got a weird query, as for now it takes the first table from sys.tables and SELECT TOP 10 Descriptions from this table as many times as there are columns in this table.


问:
Where orWhere Laravel 5.5 logical DB issue
I am in agony

This is my helper

```<code>$friend_query = Friend::where([
        'user_id' => Auth::id(),
        'friend_id' => $friend_id,
        ])->orWhere([
        'user_id' => $friend_id,
        'friend_id' => Auth::id(),
        ])->first();

        $friendship = new stdClass();
        $friendship->exist = false;
        $friendship->accepted = false;

        if (! is_null($friend_query))
        {
        $friendship->accepted = $friend_query->accepted;
        $friendship->exist = true;
    }
        var_dump($friendship->exist);
        exit;
        return $friendship;
</code>```

And when I am logged as 'user_id' => auth::id() - everything is fine but when I am logged as 'friend_id' who got request always var_dump return me true... This is third day I can not find solution. The photo of DB included in post.

答:
Try it like this :</p>
```<code>$friend_query = Friend::where([
                                'user_id' => Auth::id(),
                                'friend_id' => $friend_id,
                                ])
                        ->orWhere(function ($query) use($friend_id) {
                                    $query->where([
                                            'user_id' => $friend_id,
                                            'friend_id' => Auth::id(),
                                            ]);
                                })
                        ->first();
</code>```

Body:
I am in agony

This is my helper

$friend_query = Friend::where([
        'user_id' => Auth::id(),
        'friend_id' => $friend_id,
        ])->orWhere([
        'user_id' => $friend_id,
        'friend_id' => Auth::id(),
        ])->first();

        $friendship = new stdClass();
        $friendship->exist = false;
        $friendship->accepted = false;

        if (! is_null($friend_query))
        {
        $friendship->accepted = $friend_query->accepted;
        $friendship->exist = true;
    }
        var_dump($friendship->exist);
        exit;
        return $friendship;

And when I am logged as 'user_id' => auth::id() - everything is fine but when I am logged as 'friend_id' who got request always var_dump return me true... This is third day I can not find solution. The photo of DB included in post.

Body:
Try it like this :

$friend_query = Friend::where([
                                'user_id' => Auth::id(),
                                'friend_id' => $friend_id,
                                ])
                        ->orWhere(function ($query) use($friend_id) {
                                    $query->where([
                                            'user_id' => $friend_id,
                                            'friend_id' => Auth::id(),
                                            ]);
                                })
                        ->first();


问:
Split one column into multiple columns using SQL Query
I want to Split one column into multiple columns using SQL Query

data not only select it is store to other column

i have this type of table:

```<code> [ID]    [DATE_TIME]           [VALUE]

 1       2014-09-24 11:59:00   Record No = 00> 40 >Record No = 01> 40 >Record No = 02> 71>
</code>```

I need to Split Record number wise
like this:

```<code> [ID]    [DATE_TIME]          [VALUE1]              [VALUE2]

 1       2014-09-24 11:59:00  Record No = 00> 40 >  Record No = 01> 40 >
</code>```

```<code> [VALUE3]                [VALUE4]
 Record No = 02> 71>     NULL
</code>```

答:
You can use xml and pivot to achive this. Try this:

```<code>SELECT *
FROM   (SELECT A.[ID],
               'VALUE'
               + Cast(Row_number() OVER(partition BY [ID] ORDER BY ID ) AS
               VARCHAR(4))
                      AS rowid,
               A.[DATE_TIME],
               A.[VALUE],
               split.a.value('.', 'VARCHAR(100)')
                      AS [VALUES]
        FROM   (SELECT [ID],
                       [DATE_TIME],
                       [VALUE],
                       Cast ('<M>'
                             + Replace([VALUE], '>Record No', '</M><M>Record No'
                             )
                             + '</M>' AS XML) AS String
                FROM   #temp) AS A
               CROSS apply string.nodes ('/M') AS Split(a)) SourceTable
       PIVOT ( Max([VALUES])
             FOR ROWID IN([VALUE1],
                          [VALUE2],
                          [VALUE3],
                          [VALUE4]) ) AS pivottable
</code>```

Dynamically you can use following script:

```<code>CREATE TABLE #temp
  (
     [ID]        INT IDENTITY(1, 1),
     [DATE_TIME] DATETIME,
     [VALUE]     VARCHAR(255)
  )

INSERT INTO #temp
            (DATE_TIME,
             VALUE)
VALUES     ('2014-09-24 11:59:00',
            'Record No = 00> 40 >Record No = 01> 40 >Record No = 02> 71>')

SELECT A.[ID],
       'VALUE'
       + Cast(Row_number() OVER(partition BY [ID] ORDER BY ID ) AS VARCHAR(4))
       AS rowid,
       A.[DATE_TIME],
       A.[VALUE],
       split.a.value('.', 'VARCHAR(100)')
       AS [VALUEs]
INTO   #temp1
FROM   (SELECT [ID],
               [DATE_TIME],
               [VALUE],
               Cast ('<M>'
                     + Replace([VALUE], '>Record No', '</M><M>Record No')
                     + '</M>' AS XML) AS String
        FROM   #temp) AS A
       CROSS apply string.nodes ('/M') AS Split(a)

DECLARE @cols  AS NVARCHAR(max),
        @query AS NVARCHAR(max)

SET @cols = Stuff((SELECT DISTINCT ',' + Quotename(c.ROWID)
                   FROM   #temp1 c
                   FOR xml path(''), type).value('.', 'NVARCHAR(MAX)'), 1, 1, ''
            )

SET @query = ' select *
                from
                (
                    select *
                    from #temp1
                ) SourceTable
                pivot
                (
                    max([VALUEs])
                    for rowid in(' + @cols + ')
                ) as PivotTable'

EXECUTE(@query)
</code>```

Body:
I want to Split one column into multiple columns using SQL Query

data not only select it is store to other column

i have this type of table:

 [ID]    [DATE_TIME]           [VALUE]

 1       2014-09-24 11:59:00   Record No = 00> 40 >Record No = 01> 40 >Record No = 02> 71>

I need to Split Record number wise
like this:

 [ID]    [DATE_TIME]          [VALUE1]              [VALUE2]

 1       2014-09-24 11:59:00  Record No = 00> 40 >  Record No = 01> 40 >

 [VALUE3]                [VALUE4]
 Record No = 02> 71>     NULL

Body:
You can use xml and pivot to achive this. Try this:

SELECT *
FROM   (SELECT A.[ID],
               'VALUE'
               + Cast(Row_number() OVER(partition BY [ID] ORDER BY ID ) AS
               VARCHAR(4))
                      AS rowid,
               A.[DATE_TIME],
               A.[VALUE],
               split.a.value('.', 'VARCHAR(100)')
                      AS [VALUES]
        FROM   (SELECT [ID],
                       [DATE_TIME],
                       [VALUE],
                       Cast ('<M>'
                             + Replace([VALUE], '>Record No', '</M><M>Record No'
                             )
                             + '</M>' AS XML) AS String
                FROM   #temp) AS A
               CROSS apply string.nodes ('/M') AS Split(a)) SourceTable
       PIVOT ( Max([VALUES])
             FOR ROWID IN([VALUE1],
                          [VALUE2],
                          [VALUE3],
                          [VALUE4]) ) AS pivottable

Dynamically you can use following script:

CREATE TABLE #temp
  (
     [ID]        INT IDENTITY(1, 1),
     [DATE_TIME] DATETIME,
     [VALUE]     VARCHAR(255)
  )

INSERT INTO #temp
            (DATE_TIME,
             VALUE)
VALUES     ('2014-09-24 11:59:00',
            'Record No = 00> 40 >Record No = 01> 40 >Record No = 02> 71>')

SELECT A.[ID],
       'VALUE'
       + Cast(Row_number() OVER(partition BY [ID] ORDER BY ID ) AS VARCHAR(4))
       AS rowid,
       A.[DATE_TIME],
       A.[VALUE],
       split.a.value('.', 'VARCHAR(100)')
       AS [VALUEs]
INTO   #temp1
FROM   (SELECT [ID],
               [DATE_TIME],
               [VALUE],
               Cast ('<M>'
                     + Replace([VALUE], '>Record No', '</M><M>Record No')
                     + '</M>' AS XML) AS String
        FROM   #temp) AS A
       CROSS apply string.nodes ('/M') AS Split(a)

DECLARE @cols  AS NVARCHAR(max),
        @query AS NVARCHAR(max)

SET @cols = Stuff((SELECT DISTINCT ',' + Quotename(c.ROWID)
                   FROM   #temp1 c
                   FOR xml path(''), type).value('.', 'NVARCHAR(MAX)'), 1, 1, ''
            )

SET @query = ' select *
                from
                (
                    select *
                    from #temp1
                ) SourceTable
                pivot
                (
                    max([VALUEs])
                    for rowid in(' + @cols + ')
                ) as PivotTable'

EXECUTE(@query)


问:
How to map Ctrl+A and Ctrl+Shift+A differently?
In a terminal, one cannot distinguish Ctrl+A and Ctrl+Shift+A as they both emit the same key code, so I can see why Vim can't do it. But gVim, being an X application, can differentiate Ctrl+A and Ctrl+Shift+A. Is there any way to map those two things differently?

For starters, I'd like to do something like the following: Make "paste from clipboard" work like Gnome terminal, while keeping Ctrl+V to the visual mode.

```<code>:nmap <C-S-V> "+gP
</code>```

答:
Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8

But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim release.

Body:
In a terminal, one cannot distinguish Ctrl+A and Ctrl+Shift+A as they both emit the same key code, so I can see why Vim can't do it. But gVim, being an X application, can differentiate Ctrl+A and Ctrl+Shift+A. Is there any way to map those two things differently?

For starters, I'd like to do something like the following: Make "paste from clipboard" work like Gnome terminal, while keeping Ctrl+V to the visual mode.

:nmap <C-S-V> "+gP


问:
How to select Element with certain Class?
so if I want to apply a style to

Here's what I tried that works in my tests. But, surprisingly, I can't find this documented (in CSS Selectors, etc.)

```<code>div.ScreenShot {  display:inline-block;}
</code>```

答:
You can use .ScreenShot or div.ScreenShot as a selector, both work.

But div.ScreenShot has a higher specifity, so if there are different rules with both selectors that contain different settings, the settings in div.ScreenShot will overwrite those in .ScreenShot

Body:
so if I want to apply a style to

Here's what I tried that works in my tests. But, surprisingly, I can't find this documented (in CSS Selectors, etc.)

div.ScreenShot {  display:inline-block;}


问:
Change Xcode to use custom-installed version of Subversion
Does anyone know how to change the location of the svn tool used in the Xcode IDE?

I've installed a newer version in /opt/subversion/bin and updated my $PATH so that it works from the command line but can't get Xcode to recognize this.

答:
Applications in Mac OS X aren't run from a shell, so they won't have any knowledge of shell variables.  Just adding something to your $PATH in your .bashrc or .cshrc or whatever won't tell applications about it at all.

Furthermore, Xcode 3.0 and later support Subversion directly, rather than by calling through its command-line binary; this means that it will use the Subversion libraries in /usr/lib rather than any you've installed elsewhere.

OwnerDisplayName: mwahab

LastEditorDisplayName: Sören Kuklau

OwnerDisplayName: Chris Hanson


问:
html5 localStorage confusion
I am trying to figure out how to store dynamically created list elements in local storage with the key/value pair system, but cannot figure it out...

I have a list of bars which can be added to a 'favorites' list by click a star on the individual bar's page and having the particular list element cloned and then appended to the favorites list.

I can't figure out how to store this information using local storage...

This is the JS using Jquery toggling a class, swapping an image and then cloning and appending to the #favorites ul

```<code>$("document").ready(function() {

$('#club1668Star').toggle(club1668Blue, club1668White)

function club1668Blue(evt) {
    $('#club1668Star').toggleClass('club1668Blue').attr("src", "media/images/bluestar40.png");
    $("#barlist li[id=club1668List]").toggleClass('club1668Fav');
    $("#barlist li[class=club1668Fav]").clone().appendTo("#favourites ul[class=plasticBar]");

}

function club1668White(evt) {
    $('#club1668Star.club1668Blue').removeClass('club1668Blue').attr("src", "media/images/whitestar40.png")
    $("#barlist li[class=club1668Fav]").toggleClass('club1668Fav');
    $("#favourites ul[class=plasticBar] li[id=club1668List]").remove();
}
</code>```

});

any help would be greatly appreciated...

cheers,
mark

答: There's a well-known way to pass multiple JS objects as a single value, it is called JSON. Can't it suit you?</p>

Title: html5 localStorage confusion

Body:
I am trying to figure out how to store dynamically created list elements in local storage with the key/value pair system, but cannot figure it out...

I have a list of bars which can be added to a 'favorites' list by click a star on the individual bar's page and having the particular list element cloned and then appended to the favorites list.

I can't figure out how to store this information using local storage...

This is the JS using Jquery toggling a class, swapping an image and then cloning and appending to the #favorites ul

$("document").ready(function() {

$('#club1668Star').toggle(club1668Blue, club1668White)

function club1668Blue(evt) {
    $('#club1668Star').toggleClass('club1668Blue').attr("src", "media/images/bluestar40.png");
    $("#barlist li[id=club1668List]").toggleClass('club1668Fav');
    $("#barlist li[class=club1668Fav]").clone().appendTo("#favourites ul[class=plasticBar]");

}

function club1668White(evt) {
    $('#club1668Star.club1668Blue').removeClass('club1668Blue').attr("src", "media/images/whitestar40.png")
    $("#barlist li[class=club1668Fav]").toggleClass('club1668Fav');
    $("#favourites ul[class=plasticBar] li[id=club1668List]").remove();
}

});

any help would be greatly appreciated...

cheers,
mark


问:
Unable to load non-winning models in automl() use case
I'm using automl function with code snippet shown below

```<code>h2o.init()
h2o_train = as.h2o(train)
h2o_test = as.h2o(test)
aml <- h2o.automl(x=x, y=y, training_frame=h2o_train, leaderboard_frame=h2o_test)
print(aml@leaderboard)  # view top models
print(getParms(aml@leader))  #  get related info for top1 model
</code>```

After read through the doc, I couldn't find how to load the results for other models, the leaderboard shows their model_id. It would be valuable if we can load those models, or at least see their parameters.

答:
You can get a list of all models Id using the following:

```<code>> aml@leaderboard
</code>```

Note the output will be something as below:

```<code>                                               model_id      auc  logloss
1    DeepLearning_grid_0_AutoML_20171205_070022_model_1 0.808806 0.536941
2             GLM_grid_0_AutoML_20171205_070022_model_0 0.808672 0.524783
3 StackedEnsemble_BestOfFamily_0_AutoML_20171205_070022 0.797148 0.541090
4    DeepLearning_grid_0_AutoML_20171205_070022_model_2 0.793247 0.654405
5    StackedEnsemble_AllModels_0_AutoML_20171205_070022 0.788943 0.545078
6                 DeepLearning_0_AutoML_20171205_070022 0.783562 0.570281
</code>```

After that you can use h2o.getModel() API to get any of the model as below:

```<code>> aml6 = h2o.getModel("DeepLearning_0_AutoML_20171205_070022")
> aml6
</code>```

The above will give you the access to model = 6 from the AML leaderboard. Any of H2O Model API will work once you have access to model using the model_id from getModel() API.

Body:
I'm using automl function with code snippet shown below

h2o.init()
h2o_train = as.h2o(train)
h2o_test = as.h2o(test)
aml <- h2o.automl(x=x, y=y, training_frame=h2o_train, leaderboard_frame=h2o_test)
print(aml@leaderboard)  # view top models
print(getParms(aml@leader))  #  get related info for top1 model

After read through the doc, I couldn't find how to load the results for other models, the leaderboard shows their model_id. It would be valuable if we can load those models, or at least see their parameters.

Body:
You can get a list of all models Id using the following:

> aml@leaderboard

Note the output will be something as below:

                                               model_id      auc  logloss
1    DeepLearning_grid_0_AutoML_20171205_070022_model_1 0.808806 0.536941
2             GLM_grid_0_AutoML_20171205_070022_model_0 0.808672 0.524783
3 StackedEnsemble_BestOfFamily_0_AutoML_20171205_070022 0.797148 0.541090
4    DeepLearning_grid_0_AutoML_20171205_070022_model_2 0.793247 0.654405
5    StackedEnsemble_AllModels_0_AutoML_20171205_070022 0.788943 0.545078
6                 DeepLearning_0_AutoML_20171205_070022 0.783562 0.570281

After that you can use h2o.getModel() API to get any of the model as below:

> aml6 = h2o.getModel("DeepLearning_0_AutoML_20171205_070022")
> aml6

The above will give you the access to model = 6 from the AML leaderboard. Any of H2O Model API will work once you have access to model using the model_id from getModel() API.