VFW_E_NOT_IN_GRAPH in directshow's video-capture - camera

Me again, trying to use directShow.
I tried to implement an example from a camera-distributor to read the camera (I would like to get frames in Form of an Byte-Array) and am getting a VFW_E_NOT_IN_GRAPH-Error when trying to connect the pins.
I already searched and now know, that that means, I didn't add a specific Filter to the graphbuilder (or the filter I used isn't compatible?), but I added a Filter and can't see any differences to the sample... however, the sample isn't a project, but only code-scraps, so I think I may have forgotten any initialization...
Could you please take a look at this and tell me whether you find an error?
Everything works find without error, just the last hr is filled with 0x8004025F and nothing happens (I made a stop-point within DoRenderSample-method):
HRESULT hr = S_OK;
IBaseFilter* pFilter=0;
hr=CreateKernelFilter(
CLSID_VideoInputDeviceCategory,
L"Videology USB-C Camera",
&pFilter
);
CoInitialize(NULL);
// CComQIPtr<IVideology20K1XX> pKs(pFilter);
CComQIPtr<IVideologyCommon> pKs( pFilter );
if(pFilter==0)return;
// hr=pKs->SetWhiteBalanceMode(wbAuto);
CBitmapRenderer *m_pSnapshotter = new CBitmapRenderer( _T("Bitmap renderer"), NULL, &hr );
if( FAILED(hr) )
{
ASSERT("Couldn't create bitmap renderer.");
return;
}
m_pSnapshotter->SetCallback( (IBitmapCallback*) this );
CComQIPtr< IBaseFilter > pGrabBase( m_pSnapshotter );
IGraphBuilder* m_pGraphBuilder=0;
hr = CoCreateInstance(CLSID_FilterGraph, NULL,
CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&m_pGraphBuilder);
hr = m_pGraphBuilder->AddFilter( pGrabBase, L"Snapshot" );
CComPtr<IPin> pOutPin;
hr= pFilter->FindPin( L"1", &pOutPin );
CBasePin* pInPin = m_pSnapshotter->GetPin( 0 );
hr = m_pGraphBuilder->Connect( pOutPin, pInPin );
I hope I didn't forget any important informations...
(Using C++-Builder from embarcadero XE2 16 and DirectShow9 from 2005 I think)

The error code tells you what is wrong. VFW_E_NOT_IN_GRAPH, something is not in graph. You connect two pins, which belong to two filters. One of the filters is not in graph. As you add pGrabBase a few lines above, then the other filter is not in the graph. Add it as well prior to connecting pins.

Related

Cannonjs move body forward according to its quaternion

I'm struggling with Cannonjs physics lib, I got a sphere body with a changing quaternion, I just want that body to move forward according to its quaternion. I found many topics related to that but none of the suggested codes is working.
Is it a simple way to achieve that simple task?
So far I tried the solution given here but the using of vmult() method do not change the vector3 at all...
body.quaternion = new CANNON.Quaternion(0,1,0,0); // Whatever value you put here will not change the result of the vmult() operation below
var localVelocity = new CANNON.Vec3(0, 0, 1);
var worldVelocity = body.quaternion.vmult(localVelocity); //-> worldVelocity = (0,0,1)
body.velocity.copy(worldVelocity);
Try to set and not copy the body.velocity, this way:
let directionVector = new CANNON.Vec3(0, 0, 1);
directionVector.z -= moveDistance;
directionVector = vehicleBody.quaternion.vmult( directionVector );
vehicleBody.velocity.set( directionVector.x, directionVector.y, directionVector.z );

Paypal Php Sdk - NotifyUrl is not a fully qualified URL Error

I have this code
$product_info = array();
if(isset($cms['site']['url_data']['product_id'])){
$product_info = $cms['class']['product']->get($cms['site']['url_data']['product_id']);
}
if(!isset($product_info['id'])){
/*
echo 'No product info.';
exit();
*/
header_url(SITE_URL.'?subpage=user_subscription#xl_xr_page_my%20account');
}
$fee = $product_info['yearly_price_end'] / 100 * $product_info['fee'];
$yearly_price_end = $product_info['yearly_price_end'] + $fee;
$fee = ($product_info['setup_price_end'] / 100) * $product_info['fee'];
$setup_price_end = $product_info['setup_price_end'] + $fee;
if(isset($_SESSION['discountcode_amount'])){
$setup_price_end = $setup_price_end - $_SESSION['discountcode_amount'];
unset($_SESSION['discountcode_amount']);
}
$error = false;
$plan_id = '';
$approvalUrl = '';
$ReturnUrl = SITE_URL.'payment/?payment_type=paypal&payment_page=process_agreement';
$CancelUrl = SITE_URL.'payment/?payment_type=paypal&payment_page=cancel_agreement';
$now = $cms['date'];
$now->modify('+5 minutes');
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
$cms['options']['plugin_paypal_clientid'], // ClientID
$cms['options']['plugin_paypal_clientsecret'] // ClientSecret
)
);
use PayPal\Api\ChargeModel;
use PayPal\Api\Currency;
use PayPal\Api\MerchantPreferences;
use PayPal\Api\PaymentDefinition;
use PayPal\Api\Plan;
use PayPal\Api\Patch;
use PayPal\Api\PatchRequest;
use PayPal\Common\PayPalModel;
use PayPal\Api\Agreement;
use PayPal\Api\Payer;
use PayPal\Api\ShippingAddress;
// Create a new instance of Plan object
$plan = new Plan();
// # Basic Information
// Fill up the basic information that is required for the plan
$plan->setName($product_info['name'])
->setDescription($product_info['desc_text'])
->setType('fixed');
// # Payment definitions for this billing plan.
$paymentDefinition = new PaymentDefinition();
// The possible values for such setters are mentioned in the setter method documentation.
// Just open the class file. e.g. lib/PayPal/Api/PaymentDefinition.php and look for setFrequency method.
// You should be able to see the acceptable values in the comments.
$setFrequency = 'Year';
//$setFrequency = 'Day';
$paymentDefinition->setName('Regular Payments')
->setType('REGULAR')
->setFrequency($setFrequency)
->setFrequencyInterval("1")
->setCycles("999")
->setAmount(new Currency(array('value' => $yearly_price_end, 'currency' => $cms['session']['client']['currency']['iso_code'])));
// Charge Models
$chargeModel = new ChargeModel();
$chargeModel->setType('SHIPPING')
->setAmount(new Currency(array('value' => 0, 'currency' => $cms['session']['client']['currency']['iso_code'])));
$paymentDefinition->setChargeModels(array($chargeModel));
$merchantPreferences = new MerchantPreferences();
// ReturnURL and CancelURL are not required and used when creating billing agreement with payment_method as "credit_card".
// However, it is generally a good idea to set these values, in case you plan to create billing agreements which accepts "paypal" as payment_method.
// This will keep your plan compatible with both the possible scenarios on how it is being used in agreement.
$merchantPreferences->setReturnUrl($ReturnUrl)
->setCancelUrl($CancelUrl)
->setAutoBillAmount("yes")
->setInitialFailAmountAction("CONTINUE")
->setMaxFailAttempts("0")
->setSetupFee(new Currency(array('value' => $setup_price_end, 'currency' => $cms['session']['client']['currency']['iso_code'])));
$plan->setPaymentDefinitions(array($paymentDefinition));
$plan->setMerchantPreferences($merchantPreferences);
// ### Create Plan
try {
$output = $plan->create($apiContext);
} catch (Exception $ex){
die($ex);
}
echo $output->getId().'<br />';
echo $output.'<br />';
Been working with paypal php sdk for some days now and my code stop working.
So i went back to basic and i am still getting the same damn error.
I am trying to create a plan for subscription but getting the following error:
"NotifyUrl is not a fully qualified URL"
I have no idea how to fix this as i dont use NotfifyUrl in my code?
Could be really nice if anyone had an idea how to fix this problem :)
Thanks
PayPal did a update to their API last night which has caused problem within their SDK.
They are sending back null values in their responses.
I MUST stress the error is not on sending the request to PayPal, but on processing their response.
BUG Report : https://github.com/paypal/PayPal-PHP-SDK/issues/1151
Pull Request : https://github.com/paypal/PayPal-PHP-SDK/pull/1152
Hope this helps, but their current SDK is throwing exceptions.
Use below simple fix.
Replace below function in vendor\paypal\rest-api-sdk-php\lib\PayPal\Api\MerchantPreferences.php
public function setNotifyUrl($notify_url)
{
if(!empty($notify_url)){
UrlValidator::validate($notify_url, "NotifyUrl");
}
$this->notify_url = $notify_url;
return $this;
}
If you get the same error for return_url/cancel_url, add the if condition as above.
Note: This is not a permanent solution, you can use this until getting the update from PayPal.
From the GitHub repo for the PayPal PHP SDK, I see that the error you mentioned is thrown when MerchantPreferences is not given a valid NotifyUrl. I see you're setting the CancelUrl and ReturnUrl, but not the NotifyUrl. You may simply need to set that as well, i.e.:
$NotifyUrl = (some url goes here)
$obj->setNotifyUrl($NotifyUrl);
Reason behind it!
error comes from.
vendor\paypal\rest-api-sdk-php\lib\PayPal\Validation\UrlValidator.php
line.
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new \InvalidArgumentException("$urlName is not a fully qualified URL");
}
FILTER_VALIDATE_URL: according to this php function.
INVALID URL: "http://cat_n.domain.net.in/"; // IT CONTAIN _ UNDERSCORE.
VALID URL: "http://cat-n.domain.net.in/"; it separated with - dash
here you can dump your url.
vendor\paypal\rest-api-sdk-php\lib\PayPal\Validation\UrlValidator.php
public static function validate($url, $urlName = null)
{
var_dump($url);
}
And then check this here: https://www.w3schools.com/PHP/phptryit.asp?filename=tryphp_func_validate_url
you can check here what character will reason for invalid.

Prestashop 1.4.9: An account is already registered with this e-mail

I reported a bug in prestashop community at http://forge.prestashop.com/browse/PSCFI-6967 yesterday. Do anybody suggest me any fix for it?
Well since you haven't posted minor version, I've took the first and the last minor versions and diffed them (Customer.php class to be precise).
This is 1.4.0.1:
static public function customerExists($email, $return_id = false)
{
if (!Validate::isEmail($email))
die (Tools::displayError());
$result = Db::getInstance()->getRow('
SELECT `id_customer`
FROM `'._DB_PREFIX_.'customer`
WHERE `email` = \''.pSQL($email).'\'');
if ($return_id)
return intval($result['id_customer']);
else
return isset($result['id_customer']);
}
And this is 1.4.8.3:
public static function customerExists($email, $return_id = false, $ignoreGuest = true)
{
if (!Validate::isEmail($email))
die (Tools::displayError());
$result = Db::getInstance()->getRow('
SELECT `id_customer`
FROM `'._DB_PREFIX_.'customer`
WHERE `email` = \''.pSQL($email).'\''
.($ignoreGuest ? 'AND `is_guest` = 0' : ''));
if ($return_id)
return (int)($result['id_customer']);
else
return isset($result['id_customer']);
}
The thing is, that you are using something in between these two and closer to the lower one.
As you can see the later one has another optional parameter $ignoreGuest which defaults to true. Hence every validation is bypassed.
You can do either one of these two things:
Upgrade to the latest version of 1.4 (http://code.google.com/p/prestashop/downloads/detail?name=prestashop_1.4.8.3.zip&can=2&q=) if any of your components are not compatible with 1.5. If they are - go all the way to the latest.
If on the other hand you just need a quick and dirty fix: change the function in Customer class to the second one in this answer.

Symbian : Getting contacts from SIM on s60 3rd edition

Here is the code that counts number of contacts stored on SIM card. When I compile it, I get error showing that lib for usage of RBasicGsmPhone should be included. I googled a lott and found that gsmbas.lib is needed,but there is no such lib file in mmp file suggestions. What to do?? Someone pls help
TInt SimCntCount = 0;
/*this code is just to get the TSY name*/
CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeUnspecified);
CleanupStack::PushL(db);
CCommsDbTableView* table = db->OpenTableLC(TPtrC(MODEM));
table->GotoFirstRecord();
table->ReadTextL(TPtrC(MODEM_TSY_NAME),iTsyName);
// Cleanup - CommsDB no longer needed
CleanupStack::PopAndDestroy(2); // table,db
// Connect to the ETel server
RTelServer aTelServer;
User::LeaveIfError(aTelServer.Connect());
CleanupClosePushL(aTelServer);
User::LeaveIfError(aTelServer.LoadPhoneModule(iTsyName));
TInt numberOfPhones;
User::LeaveIfError(aTelServer.EnumeratePhones(numberOfPhones));
SimCntCount = 0;
for (TInt i=numberOfPhones; i>0; i--) {
// Get the phone name
RTelServer::TPhoneInfo phoneInfo;
User::LeaveIfError(aTelServer.GetPhoneInfo(i-1,phoneInfo));
// Open the phone by name
RBasicGsmPhone phone;
User::LeaveIfError(phone.Open(aTelServer,phoneInfo.iName));
TInt phoneBookCount;
phone.EnumeratePhoneBooks(phoneBookCount);
RBasicGsmPhone::TPhoneBookInfo aPbInfo;
for(TInt j=0;j<phoneBookCount;j++){
phone.GetPhoneBookInfo(j,aPbInfo);
SimCntCount += aPbInfo.iUsed;
}
phone.Close();
}
CleanupStack::PopAndDestroy(1);
Some libraries are actually not public and must be obtained from Nokia. You can try to contact Nokia's Symbian support about this topic - if they still have any interes in it.

wxBufferedPaintDC GetGraphicsContext return NULL pointer

To get rid of flicker, I use wxBufferedPaintDC in place of wxPaintDC. But there comes a problem. In my paint function, in order to draw a cubic beizer curve I must use GetGraphicsContext to create a path. My question is why GetGraphicsContext returns a NULL pointer when using wxBufferedPaintDC.
void DotGraphView::OnPaint(wxPaintEvent & WXUNUSED(evt))
{
wxBufferedPaintDC dc(this);
PrepareDC(dc);
PaintBackground(dc);
wxGCDC &gdc = (wxGCDC&)dc;
wxGraphicsContext * gc = gdc.GetGraphicsContext(); /* here gc = NULL */
wxGraphicsPath path = gc->CreatePath(); /* program collapses here */
...
}
The cast that you have from wxBufferedPaintDC to wxGCDC looks a little suspicious to me, the wxGraphicsContext pages suggests doing it like this:
wxGraphicsContext *gc = wxGraphicsContext::Create( dc );
if (gc)
{
//drawing code here
delete gc;
}
I feel suspicious too, the suggestion page does not work.
Now I use the following codes and the program run ok.
wxBufferedPaintDC pdc(this);
wxGCDC gdc;
wxGraphicsRenderer * const renderer = wxGraphicsRenderer::GetDefaultRenderer();
wxGraphicsContext * context = renderer->CreateContext(pdc);
gdc.SetGraphicsContext(context);
wxDC & dc = (wxDC &)gdc;
PrepareDC(dc);
Draw(dc);
...
You should use wxAutoBufferedPaintDC.
There is no need to buffer on some platform (like GTK).
Then, you can use the constructor
wxGCDC gcdc(dc);
This works at least on GTK and MSW.