Click here to Skip to main content
15,887,350 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Import Excel sheet into Gridview and SQL Pin
Richard Deeming18-May-21 21:39
mveRichard Deeming18-May-21 21:39 
GeneralRe: Import Excel sheet into Gridview and SQL Pin
Richard MacCutchan18-May-21 22:01
mveRichard MacCutchan18-May-21 22:01 
GeneralRe: Import Excel sheet into Gridview and SQL Pin
Michael Hinkle19-May-21 17:27
Michael Hinkle19-May-21 17:27 
AnswerRe: Import Excel sheet into Gridview and SQL Pin
Richard Deeming18-May-21 21:42
mveRichard Deeming18-May-21 21:42 
AnswerRe: Import Excel sheet into Gridview and SQL Pin
Mycroft Holmes20-May-21 12:55
professionalMycroft Holmes20-May-21 12:55 
AnswerRe: Import Excel sheet into Gridview and SQL Pin
David Mujica21-May-21 5:26
David Mujica21-May-21 5:26 
AnswerRe: Import Excel sheet into Gridview and SQL Pin
SeeSharp214-Jul-21 10:41
SeeSharp214-Jul-21 10:41 
QuestionBlazor + MVC Pin
Super Lloyd11-May-21 4:37
Super Lloyd11-May-21 4:37 
AnswerRe: Blazor + MVC Pin
Super Lloyd11-May-21 4:58
Super Lloyd11-May-21 4:58 
QuestionIntegrate 3rd party Authenticator app Pin
Super Lloyd10-May-21 13:47
Super Lloyd10-May-21 13:47 
AnswerRe: Integrate 3rd party Authenticator app Pin
Richard Deeming18-May-21 4:06
mveRichard Deeming18-May-21 4:06 
GeneralRe: Integrate 3rd party Authenticator app Pin
Super Lloyd18-May-21 16:48
Super Lloyd18-May-21 16:48 
QuestionCSS not showing on my website! HELP! Pin
Gee_Suss 9-May-21 11:27
Gee_Suss 9-May-21 11:27 
AnswerRe: CSS not showing on my website! HELP! Pin
SeanChupas11-May-21 3:04
SeanChupas11-May-21 3:04 
QuestionFiltering an array of objects based on (another object/array of objects) Pin
Pavithran R8-May-21 9:07
Pavithran R8-May-21 9:07 
AnswerRe: Filtering an array of objects based on (another object/array of objects) Pin
jsc429-May-21 22:33
professionaljsc429-May-21 22:33 
QuestionPHP7, uasort method, return new instance Pin
jkirkerx23-Apr-21 8:12
professionaljkirkerx23-Apr-21 8:12 
AnswerRe: PHP7, uasort method, return new instance [Maybe Solved] Pin
jkirkerx24-Apr-21 9:53
professionaljkirkerx24-Apr-21 9:53 
I ended up with 2 methods that I couldn't figure out yesterday, the other being array_intersect which requires an array and not an object. So after about an hour of research on arrays and objects, I did some converting and ended up with this today, which worked after running several tests.
/*
* Method intersect
* Object Oriented array_intersect
* Using variadic argument
* <a href="https://www.schmengler-se.de/en/2017/04/php-7-type-safe-arrays-of-objects/">https://www.schmengler-se.de/en/2017/04/php-7-type-safe-arrays-of-objects/</a>
*/
public function intersect(KeyValues ...$keyValues): KeyValues {

    $a = iterator_to_array($this->traversable($this->getInnerIterator()));
    $b = iterator_to_array($this->traversable($keyValues));

    $arrayItems = array_intersect($a, $b);

    $newKeyValues = new KeyValues();
    foreach ($arrayItems as $arrayItem) {

        $newKeyValue = new KeyValue();
        $newKeyValue->setKey($arrayItem[0]);
        $newKeyValue->setValue($arrayItem[1]);
        $newKeyValues->add($newKeyValue);
    }

    return $newKeyValues;

}

Which segways to this. I didn't need uasort, and resorted back to sort. I really just want to reference the original object and sort it. So I'm going to have to give this more thought. In other words just sort the getInnerIterator().

Called it like this
$taskKeyValues = $taskKeyValues->sort();
/*
 * Method sort
 * Sort an Object instead of an array
 */
public function sort(): KeyValues {

    $arrayItems = iterator_to_array($this->traversable($this->getInnerIterator()));

    sort($arrayItems);

    $newKeyValues = new KeyValues();
    foreach ($arrayItems as $arrayItem) {

        $newKeyValue = new KeyValue();
        $newKeyValue->setKey($arrayItem[0]);
        $newKeyValue->setValue($arrayItem[1]);
        $newKeyValues->add($newKeyValue);
    }

    return $newKeyValues;

}
If it ain't broke don't fix it
Discover my world at jkirkerx.com

Questionsearch word in code phpstorm Pin
sookitak18-Apr-21 4:06
sookitak18-Apr-21 4:06 
AnswerRe: search word in code phpstorm Pin
SeanChupas23-Apr-21 9:16
SeanChupas23-Apr-21 9:16 
QuestionMaster Detail CRUD using blazor Pin
sanket16413-Apr-21 20:52
sanket16413-Apr-21 20:52 
SuggestionRe: Master Detail CRUD using blazor Pin
Shaun C Curtis14-Apr-21 6:37
mvaShaun C Curtis14-Apr-21 6:37 
GeneralRe: Master Detail CRUD using blazor Pin
sanket16414-Apr-21 8:40
sanket16414-Apr-21 8:40 
AnswerRe: Master Detail CRUD using blazor Pin
Mycroft Holmes14-Apr-21 13:28
professionalMycroft Holmes14-Apr-21 13:28 
GeneralRe: Master Detail CRUD using blazor Pin
sanket16415-Apr-21 8:09
sanket16415-Apr-21 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.