|
|
At work I am asked to do integrate our web app with some 3rd party authenticator app, say Microsoft Authenticator (they are really thinking Twilio, since MS Auth App seem expensive to use), so that some (specific) (web) page are protected with an additional level of security that would require to enter the web code from the authenticator app (not really standard MFA usage, anyway..)
At first sight this look impossible... However I noticed that in both MS and Google Authenticator there is a list of app that can be registered, not all from either MS or google... So there might be a way to use "some" well known 3rd party authenticator app with your login... Any link please?
|
|
|
|
|
Assuming you're using the standard code for generating the authenticator PIN, almost any app can be used. For example, I use Authy[^] so I can access the same set of codes on all of my computers and my mobile phone.
There are various references on how to generate the PIN from your own code. For example:
Implementing Two Factor Authentication in ASP.NET MVC with Google Authenticator[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thanks for the tip! going to investigate that!
|
|
|
|
|
Hello. I am at my wits' end trying to make this work. I have developed a website in Dreamweaver and it displays correctly. I have used custom fonts that have displayed correctly. When previewing it from Dreamweaver in Firefox, Chrome and Opera it all displays fine. When I upload to the remote server the website displays fine in Firefox but not in Chrome and Opera. I am not sure what is happening and I am stuck as I need it to display properly. Any guidance would be massively appreciated. Kind Regards
The website is siconlightning.solutions
🤯
|
|
|
|
|
Use the browser's developer tools (F12) to see if a file is not getting loaded or if css is not getting applied.
|
|
|
|
|
Can anyone help me know how to filter an array of objects based on another object with conditions.
const arrayToFilter= [ {
name: 'Arlin Schistl',
screen_name: 'aschistl1c',
followers_count: 101,
following_count: 657,
location: 'Indonesia',
verified: true,
},
{
name: 'Henka Perren',
screen_name: 'hperren1d',
followers_count: 170,
following_count: 422,
location: 'Mexico',
verified: true, },
{
name: 'Mei Raja',
screen_name: 'hperren1d',
followers_count: 17330,
following_count: 42,
location: 'Porur',
verified: false, }
]
Filter conditions :
const conditions=[
{
id: 'name',
operator: 'CONTAINS'
value: 'Bob',
},
{
condition:'OR',
id: 'followers_count',
operator: 'GTE'
value: 200,
},
{
condition:'AND',
id: 'following_count',
operator: 'LTE'
value: 10,
},
{
condition:'AND',
id: 'followers_count',
operator: 'GTE'
value: 150,
}
]
Please let me know what will be the optimized code for this. Thanks in advance!
|
|
|
|
|
Question: Are the criteria sequential or do they obey a hierarchy of operator? That is, using your example, do you want
( (name CONTAINS bob)
OR ( (followers_count GTE 200)
AND ( (following_count LTE 10)
AND (followers_count GTE 150)
) ) ) or, perhaps,
( ( (name CONTAINS bob)
OR (followers_count GTE 200)
)
AND (following_count LTE 10)
AND (followers_count GTE 150)
)
|
|
|
|
|
I wrote this PHP 7.14.4 class to represent an object of Keys and Values, made up of Key Value. It uses IteratorIterator, which I have found to contains about 15 useful methods to do things like count(), append(), move() and uasort(). I wrote this sort of piecing together some concepts, and thought it would be a nice method to have in my swiss army knife.
I get this error message, and I understand what it says, and I have 1/2 a clue on how to fix it, but I can't visualize how to return a new instance of KeyValue.
Fatal error: Uncaught TypeError: Return value of KeyValues::uaSort() must be an instance of KeyValues, none returned in C:\App\Dev\PCAD\models\keyValue.model.php:52 Stack trace: #0 C:\App\Dev\PCAD\api\prices\priceSetUpdate.api.php(61): KeyValues->uaSort() #1 {main} thrown in C:\App\Dev\PCAD\models\keyValue.model.php on line 52
I called the method like this below ....
I'm surprised PHP didn't complain about my merge method concept that I wrote. I included the extra code so you can get an idea of what I'm doing and how I use it.
foreach ($partKeyValues as $partKeyValue) {
$referenceId = $partKeyValue->getValue();
$taskVersions = TaskVersionsRepository::getTaskVersionsByReferenceId($referenceId);
$taskKeyValues->merge($taskVersions);
}
$taskKeyValues->uaSort();
class KeyValues extends IteratorIterator {
public function __construct(KeyValues ...$keyValues)
{
parent::__construct(new ArrayIterator($keyValues));
}
public function count() : int
{
return $this->getInnerIterator()->count();
}
public function merge(KeyValues $keyValues)
{
foreach ($keyValues as $keyValue) {
$this->getInnerIterator()->append($keyValue);
}
}
public function uaSort(): KeyValues {
$this->getInnerIterator()->uasort(
function(KeyValue $a, KeyValue $b) {
return $a->getValue() <=> $b->getValue();
}
);
}
class KeyValue {
private $key;
private $value;
public function __construct()
{
}
public function getKey() { return $this->key; }
public function setKey($key) { $this->key = $key; }
public function getValue() { return $this->value; }
public function setValue($value) { $this->value = $value; }
}
So your probably wondering what the story here is on me working with PHP 7.4. I decided to help this company that got burned on a PHP 4.7 project last worked on in 2011, in which the designers and coders lost control of proper programming practices, going completely crazy with PHP which is typical. They put the presentation HTML in classes, and business logic in the presentation layer. Then their IT guy thought he could be a programmer and started working on it making it worst, because he thought the existing code was proper programming practices.
Whats weird, is that the IT company hosting the App suggested to the customer that they should upgrade from PHP 4.73 to PHP 8 to plug the security holes, thinking that the upgrade was like upgrading to Windows 10. So I went along with it, and began to realize that upgrading to PHP 8 was more like a quest to stop writing bad procedural code and embrace the power of object orientated programming in PHP 8. My goal is to get this right, do a great job, and not shame myself with what I deliver.
I'm starting to like PHP, and see why so many organizations use it to this date. This really hasn't been a journey of learning how to code in PHP, but more like a proper lesson in how to implement proper design principles for me. Perhaps this finally elevates me to a higher level of thinking.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
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.
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();
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
|
|
|
|
|
How to find a word in the project code in phpstorm?
|
|
|
|
|
|
Hello All,
I want to develop Master Details CRUD option. I have seen lots of examples in which developed using GRID but my requirement is different than this.
Let me explain with an example
-------Master Part-------
Order No__________ Order Date___________
Customer_______________
----------Details Part------------
ProductName _____{Selection}______ Rate______ Qty____ [Add]
-----------{GRID}--------------
Product1 20.00 1 [EDIT] [DELETE]
Product2 50.00 1 [EDIT] [DELETE]
[SAVE][CANCEL]
Please check this -> Example screen
modified 14-Apr-21 3:04am.
|
|
|
|
|
|
Hello
Thanks for reply.
Every application has own problems and benefits.
|
|
|
|
|
You product selection line is not part of the detail and can be placed in the master area or as a separate area altogether, it does not participate in the master detail structure but adds to the detail.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
My Table Stucture look like
OrderId int
OrderNo string
CustomerName string
AddDate DateTime
OrderDtlId int
OrderId int(FK from OrderMaster)
ProductId int(FK from ProductMaster)
Qty decimal
Rate decimal
|
|
|
|
|
Your table structure is correct. You need to add a detail item when the user clicks add taking the ProductId from the user selection. This needs to be done in code, not in the UI control.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
There are many libraries for activities like slider, drag and drop, while these are available, do we need to know pure javascript for these situations when working in a company? Sure, most people are familiar with the classic scrolling structure I've been talking about, but the more advanced ones I mentioned. Of course, this should be a general situation, although it varies from company to company. How necessary do you think it is to learn these
|
|
|
|
|
You got caught by the content filters and your messages were waiting for human moderation.
As you reposted the message, I have let through both copies but deleted one of them.
Please next time be patient, we get a lot of spam and that's why the filters and the human "OK" might be needed for some posts by new accounts.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
It entirely depends on the circumstances. You have to strike a balance between how much overhead the library adds to you page versus how much developer time it would take to implement the feature using pure Javascript.
Something like drag and drop[^] is fairly easy to implement in pure Javascript these days. But a library might have more advanced features which may take a while to replicate.
But either way, I wouldn't necessarily expect anyone to "know" the APIs, since there are plenty of references available to look them up.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm trying to create a 90 deg rotated layout. But the problem is that none of the method I used to use works in this case. Since it is rotated, changing size, getting it responsive does not seem to work.
I'm trying to let the "My Project" title take half of the rotated screen and the other half will contain images and containers.
Can anyone help me out with this? How do i make sure that it resizes and placement is always half:half layout without overflow during resize in different device size. Please provide me with a hint to complete my work. Thank you!
Link to the code in jsfiddle.
Here's a link to the think I'm doing: https://jsfiddle.net/7tfy4gdh/1/
Here's what i want to build: https://prnt.sc/10wb1p7
What I have tried:
I've tried doing flex, using vh, and media query. I just can't seem to get it done. Please help!
|
|
|
|
|
Hi. I need some idea on how to document this refresh token API details based on this codes? What details should I provide? I can't really understand.
@GetMapping(value = Constants.REST_API_REFRESH_TOKEN)
public ResponseEntity<Object> getRefreshToken(@RequestHeader(Constants.HTTP_AUTH_HEADER) String authHeader, HttpServletRequest request) {
log.info("Generate refresh token");
String token = httpUtil.extractSecurityToken(authHeader);
ResponseBase body = new ResponseBase();
body.setSuccess(true);
body.setMessage("Refresh Token generated");
String refreshToken;
DefaultClaims claims = (io.jsonwebtoken.impl.DefaultClaims) request.getAttribute("claims");
if(null == claims) {
refreshToken = jwtTokenUtil.renewToken(token);
} else {
refreshToken = jwtTokenUtil.renewToken(claims);
}
return httpUtil.createResponseEntityJson(HttpStatus.OK, httpUtil.createSecTokenHeader(refreshToken), body);
}
|
|
|
|
|
I've been trying for a couple of hours. So I have these models or object classes, one called KeyValues and KeyValue. I make a database call, and create the KeyValues object with a collection of KeyValue. This is working pretty good in just PHP V7.4.14, and I'm happy with it.
So now, I made an API, that creates a JSON array of KeyValues, and some plain Javascript to call Fetch and get the list from my hacked together PHP file. I can't figure out how to package the JSON from my object in PHP.
I wanted to use the example below, forJSON(), and was thinking that it can take an object, and package it in one line of code, but I have no clue if I fabricated it right, and how to call it. I would that it belongs in the InteratorIterator to process the whole object.
The last example is me trying just piece something together from information on the internet. I had a couple that worked, but the format was wrong, so this is just concept code of what I'm trying to do.
I just need help in filling in a couple of blanks I'm missing in the concept of how it works.
class KeyValues extends IteratorIterator {
<pre>
public function __construct(KeyValues ...$keyValues)
{
parent::__construct(new ArrayIterator($keyValues));
}
class KeyValue {
var $key;
var $value;
var $keyValues;
public function __construct()
{
}
public function getKey() { return $this->key; }
public function setKey($key) { $this->key = $key; }
public function getValue() { return $this->value; }
public function setValue($value) { $this->value = $value; }
public function forJSON(): array
{
foreach ($this->keyValues as $keyValue) $keyValues[] = $keyValue->forJSON();
return array(
'key' => $this->getKey(),
'value' => $this->getValue()
);
}
}
$jsonRaw = [];
foreach ($keyValues as $keyValue) {
$jsonArray = $keyValue->getKey() => $keyValue->getValue();
array_push($jsonRaw, $jsonArray);
}
echo json_encode($jsonRaw, JSON_PRETTY_PRINT);
exit();
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I can't believe how much time I spent on this, to write about 5 lines of code. I wasn't able to get my object forJson() to work 100% but I'm pretty close on it, actually being able to generate JSON from an object->forJson(); . So this is my temp solution for now so I can move forward.
I'm kind of surprised that json_encode knew to wrap the strings in quotes, and leave the numbers as is.
$jsonArray = [];
foreach ($keyValues as $keyValue) {
$jsonItem = array(
"key" => $keyValue->getKey(),
"value" => $keyValue->getValue()
);
array_push($jsonArray, $jsonItem);
}
echo json_encode($jsonArray, JSON_PRETTY_PRINT);
Also using plain Javascript, and trying to stay sort of ECMA 6, which also took forever to figure out yet so simple. This is inside a Fetch call to a PHP file that just echos out JSON.
I was really surprised that I didn't have to parse the JSON, or do anything special with it. I fiddled with the Object using different types and they all seem to produce the same values.
for (const keyValue of Object.values(data)) {
let option = document.createElement('option');
option.text = keyValue.key;
option.value = keyValue.value;
addOperationElement.add(option);
}
Alright, back to being able to move forward with this section of the app. I'm starting to like PHP V7+ and can see why so many companies use it. It does the job and is fairly simple to construct and fabricate. But you need a damn good editor like PHP Storm to keep it organized and clean.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|