Saturday, 14 September 2013

SSRS passing parameters to a web service call

SSRS passing parameters to a web service call

I'm calling a function on an XML web service, and that service requires a
boolean value. But I am at a loss as to how to send a value. It looks like
I'll need a parameter, but it's not having any effect. I've got a
parameter that needs to be put into the report, calling it Boolean at the
moment for simplicity.
<Parameters>
<Parameter Name="Boolean"/>
</Parameters>
This isn't having any effect on the result, it's always being treated as a
function with the default value of false.

Exception from writeln function if the input size is big

Exception from writeln function if the input size is big

I am reading the amplitudes of a audio file in D. From string I am
converting the into float[] Than I am writing it like :
auto amplitudeByTime = file2string("data8.txt");//file2string returns
a float[] with size I determine.
writeln(amplitudeByTime);
Everything is ok if the size of float[] is 1660(or less) but when it to
1661(or more) writeln throws an exception like:
std.stdio.StdioException@std\stdio.d(2431): Bad file descriptor
----------------
0x0040EA7B
0x00411F62
0x0040FD80
0x0040FDBB
0x0040F9B9
0x0040B774
0x75EDD2E9 in BaseThreadInitThunk
0x77BF1603 in RtlInitializeExceptionChain
0x77BF15D6 in RtlInitializeExceptionChain
----------------
Do you have any idea about what might be problem?

Magento - set currency when creating order programatically?

Magento - set currency when creating order programatically?

I have a dev magento with multi-currency enabled (GBP, EUR , USD). I am
trying to create a sales order against my dev magento in Euro - however
the order keeps creating in GBP (my base currency).
Any idea what I am doing wrong? Here's my code so far:
<?php
// Init Magento In Admin Store Context
require_once '/home/www-data/public_html/app/Mage.php';
$app = Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
// Function To Generate Magento Sales Order
function CreateOrder($orderData = array())
{
// Validate Order Data
if (!sizeof($orderData)) {
exit('Invalid Order Data');
}
$orderData = (object)$orderData;
if (!sizeof($orderData->BasketData)) {
exit('Sales Order Basket Cannot Be Empty');
}
// Anticipate Error
try
{
// Start New Sales Order Quote
$quote = Mage::getModel('sales/quote')
->setStoreId($orderData->StoreId);
// Set Sales Order Quote Currency
$quote->setCurrency($orderData->Currency);
// Load Sales Order Customer
$customer = Mage::getModel('customer/customer')
->setWebsiteId($orderData->CustomerWebsiteId)
->load($orderData->CustomerId);
// Assign Customer To Sales Order Quote
$quote->assignCustomer($customer);
// Configure Notification
$quote->setSendCconfirmation($orderData->SendConfirmation ? '1' :
'0');
// Add Products To Sales Order Quote
foreach ($orderData->BasketData as $orderLine)
{
// Add Product To Sales Order Quote
$quote->addProduct(
Mage::getModel('catalog/product')->load($orderLine['ProductId']),
new Varien_Object(array(
'price' => floatval($orderLine['Price']),
'qty' => intval($orderLine['Qty'])
))
);
}
// Set Sales Order Billing Address
$billingAddress = $quote->getBillingAddress()->addData(array(
'firstname' => $orderData->BillingAddress['Firstname'],
'lastname' => $orderData->BillingAddress['Lastname'],
'company' => $orderData->BillingAddress['Company'],
'street' =>
array($orderData->BillingAddress['AddressLine1'],
$orderData->BillingAddress['AddressLine2']),
'region_id' => 0,
'region' => $orderData->BillingAddress['Region'],
'city' => $orderData->BillingAddress['City'],
'postcode' => $orderData->BillingAddress['Postcode'],
'country_id' =>
getCountryId($orderData->BillingAddress['Country']),
'telephone' => $orderData->BillingAddress['Telephone']
));
// Set Sales Order Shipping Address
$shippingAddress = $quote->getShippingAddress()->addData(array(
'firstname' => $orderData->ShippingAddress['Firstname'],
'lastname' => $orderData->ShippingAddress['Lastname'],
'company' => $orderData->ShippingAddress['Company'],
'street' =>
array($orderData->ShippingAddress['AddressLine1'],
$orderData->ShippingAddress['AddressLine2']),
'region_id' => 0,
'region' => $orderData->ShippingAddress['Region'],
'city' => $orderData->ShippingAddress['City'],
'postcode' => $orderData->ShippingAddress['Postcode'],
'country_id' =>
getCountryId($orderData->ShippingAddress['Country']),
'telephone' => $orderData->ShippingAddress['Telephone']
));
// Collect Rates and Set Shipping & Payment Method
$shippingAddress->setCollectShippingRates(true)
->collectShippingRates()
->setShippingMethod($orderData->ShippingMethod)
->setPaymentMethod($orderData->PaymentMethod);
// Set Sales Order Payment
$quote->getPayment()->importData(array('method' =>
$orderData->PaymentMethod));
// Collect Totals & Save Quote
$quote->collectTotals()->save();
// Create Order From Quote
$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();
$increment_id = $service->getOrder()->getIncrementId();
// Resource Clean-Up
$quote = $customer = $service = null;
// Finished
return $increment_id;
}
catch (Exception $e)
{
// Error
exit($e->getMessage());
}
}
// HELPER FUNCTION
function getCountryId($countryName) {
$countryId = '';
$countryCollection =
Mage::getModel('directory/country')->getCollection();
foreach ($countryCollection as $country) {
if ($countryName == $country->getName()) {
$countryId = $country->getCountryId();
break;
}
}
$countryCollection = null;
return $countryId;
}
// TEST Order Create Function
echo CreateOrder(array(
'Currency' => 'EUR', // Euro
'StoreId' => 3, // Trade Store View
'CustomerWebsiteId' => 2, // Trade Website
'CustomerId' => 5, // Latheesan K.
'SendConfirmation' => false,
'BasketData' => array
(
array('ProductId' => 3, 'Price' => 13.00, 'Qty' => 1), // VCF001
array('ProductId' => 6, 'Price' => 1.00, 'Qty' => 1), // VCF002
array('ProductId' => 8, 'Price' => 14.99, 'Qty' => 1), // VCF003
),
'BillingAddress' => array
(
'Firstname' => 'Latheesan',
'Lastname' => 'Kanes',
'Company' => 'Intelli B.I. Ltd',
'AddressLine1' => 'Unit 1, Eastman Road',
'AddressLine2' => 'Acton',
'Region' => '',
'City' => 'London',
'Postcode' => 'W3 7QS',
'Country' => 'United Kingdom',
'Telephone' => '0208 428 2832',
),
'ShippingAddress' => array
(
'Firstname' => 'Latheesan',
'Lastname' => 'Kanes',
'Company' => 'Intelli B.I. Ltd',
'AddressLine1' => 'Unit 1, Eastman Road',
'AddressLine2' => 'Acton',
'Region' => '',
'City' => 'London',
'Postcode' => 'W3 7QS',
'Country' => 'United Kingdom',
'Telephone' => '0208 428 2832',
),
'ShippingMethod' => 'flatrate_flatrate',
'PaymentMethod' => 'checkmo'
));
?>
Also, this line isn't turning on email notification on order create:
// Configure Notification
$quote->setSendCconfirmation($orderData->SendConfirmation ? '1' : '0');
How do you enable email notification?
Regards, Latheesan

Break mysql row examination with primary key

Break mysql row examination with primary key

id int(primary key , unique)
status enum('enable','disable')
round tinyint(1) (index)
core tinyint(1) (index)
timestamp int(10) (index)
I got a query in a table about 1,800,000 rows.
there's a query like
SELECT * FROM tblmatch WHERE status = 'disable' and round=0 AND core = 3
AND time_stamp < UNIX_TIMESTAMP() ORDER BY time_stamp ASC LIMIT 0,10
Row examination of the query is about 1,680,000 rows
So, i added a id > 1600000 statement to the query , so it looks like
SELECT * FROM tblmatch WHERE id > 1600000 AND status = 'disable' and
round=0 AND time_stamp < UNIX_TIMESTAMP() ORDER BY time_stamp ASC LIMIT
0,10
yet row examinations is the same.
is there anyway to break row examination?

I need a basic jQuery FancyBox [on hold]

I need a basic jQuery FancyBox [on hold]

i need a basic javaScript code to create a basic jQuery FancyBox. please
help me to create a javascript FancyBox ?
i am new for javascript programming.
Thank You !!!

Friday, 13 September 2013

how to pass html table data to controller in mvc 4.0

how to pass html table data to controller in mvc 4.0

I have a HTML table in view . I want to pass the html table data to
controller in mvc 4.0. I read this Answer how to pass html table data to
controller in mvc2.0 But I don't know how to use jquery and Json to pass
data. Can any one help me.

Using quit/q in a function causes RStudio to fatal error

Using quit/q in a function causes RStudio to fatal error

More of a curiosity but when you use q or quit inside of a function inside
of R studio it causes a fatal error as seen here:

But the same function in rgui causes R to stop as usual. And using just
q() in RStudio closes R as expected. Why does q in a function cause
RStudio to literally bomb?
Example function that causes the bomb:
FUN <- function() q()
FUN()
Here's my sessionInfo:
R Under development (unstable) (2013-09-04 r63830)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.1.0
RStudio Version 0.97.551