I am trying to connect to and get data from my import.io extractor. I am then trying to import the data to a MySQL database. I have been following the example given here: http://support.import.io/knowledgebase/articles/511605-extractor-to-sql-database but I am unable to get any data into my database for some reason. Any help resolving this would be very helpful. Below is some additional information.
Below is the output when I run the commands found in the tutorial which have been modified a bit for my personal use.
./importSQL.py
CONFIG FOUND, YAY!
{u'username': u'dmhumph_dmhumph', u'database': u'dmhumph_WATERFOWLGEARFINDER', u'inputUrl': u'https://www.rogerssportinggoods.com/decoys/avery-greenhead-gear-decoys/full-body-goose.html', u'mapping': {u'product_name/_text': u'product_name', u'image/_alt': u'product_name2', u'image': u'image', u'availability': u'availability', u'price': u'price', u'product_name/_title': u'product_name3', u'product_name': u'link'}, u'host': u'localhost', u'table': u'FullBodyGeese', u'ioAPIKey': u'<API-Key-Here>', u'password': u'<Password-Here>', u'sourceUUID': u'<Source-UUID-Here>', u'port': 3306, u'ioUserID': u'<IO-User-ID-Here>'}
Recieved 1 rows of data
product_name, product_name2, image, availability, price, product_name3, link
Mappings: {u'product_name/_text': u'product_name', u'image/_alt': u'product_name2', u'image': u'image', u'availability': u'availability', u'price': u'price', u'product_name/_title': u'product_name3', u'product_name': u'link'}
Below is a sample of the data returned when I just go out and get the data from the same extractor and dump it to a file:
stdClass Object
(
[offset] => 0
[results] => Array
(
[0] => stdClass Object
(
[product_name/_text] => Avery GHG Tim Newbold Lesser Canadas Sleeper 4 Pack
[image] => https://www.rogerssportinggoods.com/media/catalog/product/cache/1/small_image/210x/9df78eab33525d08d6e5fb8d27136e95/A/V/AV-72322-550.png
[price] => Regular Price: $99.99 Special Price $44.99
[availability] => Out of stock
[image/_alt] => Avery GHG Tim Newbold Lesser Canadas Sleeper 4 Pack
[product_name] => https://www.rogerssportinggoods.com/decoys/avery-greenhead-gear-decoys/full-body-goose/avery-ghg-tim-newbold-lesser-canadas-sleeper-4-pack.html
[product_name/_title] => Avery GHG Tim Newbold Lesser Canadas Sleeper 4 Pack
)
[1] => stdClass Object
(
[product_name/_text] => Avery GHG 72302 Tim Newbold Fully Flocked Lesser Canadas Sleepers
[image] => https://www.rogerssportinggoods.com/media/catalog/product/cache/1/small_image/210x/9df78eab33525d08d6e5fb8d27136e95/A/V/AV-72302-550.png
[price] => Regular Price: $129.99 Special Price $69.99
[availability] => Out of stock
[image/_alt] => Avery GHG 72302 Tim Newbold Fully Flocked Lesser Canadas Sleepers
[product_name] => https://www.rogerssportinggoods.com/decoys/avery-greenhead-gear-decoys/full-body-goose/avery-ghg-tim-newbold-fully-flocked-lesser-canadas-sleepers.html
[product_name/_title] => Avery GHG 72302 Tim Newbold Fully Flocked Lesser Canadas Sleepers
)
[2] => stdClass Object
(
[product_name/_text] => Greenhead Gear Pro Grade Series Full Body Canada Goose Decoys
[image] => https://www.rogerssportinggoods.com/media/catalog/product/cache/1/small_image/210x/9df78eab33525d08d6e5fb8d27136e95/A/V/AV-71446-500.png
[price] => Regular Price: $139.99 Special Price $89.99
[availability] => Out of stock
[image/_alt] => Greenhead Gear Pro Grade Series Full Body Canada Goose Decoys
[product_name] => https://www.rogerssportinggoods.com/decoys/avery-greenhead-gear-decoys/full-body-goose/greenhead-gear-pro-grade-series-full-body-canada-goose-decoys.html
[product_name/_title] => Greenhead Gear Pro Grade Series Full Body Canada Goose Decoys
)
)
[cookies] => Array
(
[0] => frontend="q7jjmij9u3jlnh505vl2d1oa45";Path="/";Domain="www.rogerssportinggoods.com";Port="443"
[1] => CATEGORY_INFO="%5B%5D";Path="/";Domain="www.rogerssportinggoods.com";Port="443"
[2] => LAST_CATEGORY="70";Path="/";Domain="www.rogerssportinggoods.com";Port="443"
)
[connectorVersionGuid] => 44b6228b-c59c-47a0-8cbf-458fabe5d77d
[connectorGuid] => 4a60b47a-b973-4e51-8e15-47cf81fb1858
[pageUrl] => https://www.rogerssportinggoods.com/decoys/avery-greenhead-gear-decoys/full-body-goose.html
[outputProperties] => Array
(
[0] => stdClass Object
(
[name] => product_name
[type] => URL
)
[1] => stdClass Object
(
[name] => image
[type] => IMAGE
)
[2] => stdClass Object
(
[name] => price
[type] => STRING
)
[3] => stdClass Object
(
[name] => availability
[type] => STRING
)
)
)
Related
we use elasticsearch to power our classified search engine Listings360 Kenya.
In Elasticsearch version 6 during the search we could get the total hits documents count used for pagination here from this json output
Array
(
[took] => 3
[timed_out] =>
[_shards] => Array
(
[total] => 5
[successful] => 5
[skipped] => 0
[failed] => 0
)
[hits] => Array
(
[total] => 30540
[max_score] =>
[hits] => Array
(
[0] => Array
(
Now the exact same search with elasticsearch 7 give the following json output
Array
(
[took] => 14
[timed_out] =>
[_shards] => Array
(
[total] => 1
[successful] => 1
[skipped] => 0
[failed] => 0
)
[hits] => Array
(
[total] => Array
(
[value] => 10000
[relation] => gte
)
[max_score] =>
[hits] => Array
(
[0] => Array
(
You can see that i don't have the [hits][total] anymore which is used for pagination purpose.
Any idea how to get that back
Thank you for your help
jap, that´s one of the breaking changes in 7.0.
Have a look at the search param track_total_hits which forces the count to always be accurate. Nevertheless, the new format will still apply and you need to patch your application (that's why it's a breaking change).
Here is more detailed info regarding the new response structure.
I need to combine those two array into a single array.
1st query result
Array ( [0] => stdClass Object ( [p_type] => Bank [tsales] => 131000 [tdues] => 55000 [tpaid] => 75000 ) [1] => stdClass Object ( [p_type] => Cash [tsales] => 104000 [tdues] => 50000 [tpaid] => 54000 ) [2] => stdClass Object ( [p_type] => bKash [tsales] => 25000 [tdues] => 10000 [tpaid] => 5000 ) [3] => stdClass Object ( [p_type] => Pause [tsales] => 4000 [tdues] => 1000 [tpaid] => 2000 ) )
2nd query result
Array ( [0] => stdClass Object ( [dpayment] => 1000 ) [1] => stdClass Object ( [dpayment] => 5000 ) [2] => stdClass Object ( [dpayment] => 1000 ) [3] => stdClass Object ( [dpayment] => 5000 ) )
try to use array_merge. That should be very easy.
Your query result shows that you using $query->result() to get the value,
Instead of using result(), use $query->row_array();
then you get single dimensional array for both queries
then use array_merge() that would be easy
I am exporting data from mysql to excel in codeigniter it's working fine on localhost
but it's not working on server .on server it prints only array like this.
Array
(
[0] => Array
(
[id] => 135
[type] => 3
[product_service] =>
[email] => bewcontrols#gmail.com
[first_name] => gurwinder sigh
[last_name] =>
[company_name] =>
[country] =>
[state] =>
[city] =>
[phone_number] => 91-011-09971587701
[mobile] => 09971587701
[fax_number] =>
[address] => f-127 mayapuri indl area phase2 new delhi
[zipcode] =>
[message] => Subject: Fwd to purchase/ maint. for repairing of SOLENOID VALVE and PNEUMATIC cylinders ,DELHI,BHUPINDER ENGG.
Dear Sir,
I'd like to take this opportunity to introduce BEW Pneumatic
Controls,Delhi, to you.
We manufacture Heavy Duty Solenoid Valves in Spool construction
using all-Aluminium fittings.While most manufacturers use plastic
fittings,plastic cages, we at BEW pioneered Aluminium fittings and
have incorporated them across our product line.
Please find attached our latest product catalogue for your perusal and
we look forward to hearing from you soon.
Best Regards,
Gurwinder Singh
Mobile-09811019362,
and 09971587701
[status] => 1
[reply_status] => N
[receive_date] => 2014-11-16 18:22:06
[order_quantity] =>
)
[1] => Array
(
[id] => 134
[type] => 3
[product_service] =>
[email] => mohamed#gmail.com
[first_name] => mohamed
[last_name] =>
[company_name] =>
[country] =>
[state] => 0
[city] =>
[phone_number] =>
[mobile] => 9944556611
[fax_number] =>
[address] =>
[zipcode] =>
[message] => jhkhjh
[status] => 1
[reply_status] => N
[receive_date] => 2014-11-11 15:42:47
[order_quantity] => 20
)
<?php
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=filename.csv');
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
// output the column headings
//fputcsv($output, array('Column 1', 'Column 2', 'Column 3'));
// fetch the data
mysql_connect('localhost', 'user', 'pass');
mysql_select_db("database");
$rows = mysql_query('SELECT something, something, something FROM table');
// loop over the rows, outputting them
while ($row = mysql_fetch_assoc($rows)) fputcsv($output, $row);
?>
ok its simple in CI
Just download csv library
then
$this->db->select('*')->from('yourtabl')->where(array('your_conditions'));
$query = $this->db->get();
$this->load->helper('csv');
query_to_csv($query, TRUE, 'yourfilename.csv');
and bingo
$categ = $this->FreeadsCategory->bindModel( array( 'hasMany' => array( 'Subcategory' => array('foreignKey' => 'category_id', 'order'=>'id ASC') ) ) );
$data = $this->FreeadsCategory->findById($i);
$this->set("datas", $data);
I am not able to fetch the datas in view page using cakephp
If i give pr($datas); showing nothing in ctp file
If i print the data in controller i am getting the following array structure
Array
(
[FreeadsCategory] => Array
(
[id] => 1
[uuid] => 51512434-e4c4-441b-b90e-16f8732d5573
[category] => Automobiles
[status] => Active
)
[Subcategory] => Array
(
[0] => Array
(
[id] => 1
[uuid] => 4ea15f22-adf0-4020-b35d1-052ff9ff9a27
[category_id] => 1
[subcategory] => Cars/Cabs/Jeeps
[status] => Active
)
[1] => Array
(
[id] => 5
[uuid] => 51cec363-e7ac-4095-a86b-0ccdf260d1b4
[category_id] => 1
[subcategory] => Buses/Lorries
[status] => Active
)
)
You don't fetch data in views, that violates the MVC pattern. Technically there are ways to do it but it's plain wrong, you'll end up with unmaintanable garbage code.
I really recommend you to get started by reading about the MVC design pattern and to do the CakePHP blog tutorial first to get a minimum of understanding of how CakePHP works.
Where in the Google Maps API docs can I find a table explaining the accuracy values of Geocode lookups?
Has the range of values changed in between V2 and V3?
Here are the Google Maps API Docs. It contains a table with accuracy values...
http://code.google.com/apis/maps/documentation/reference.html#GGeoAddressAccuracy
Constant | Description
0 Unknown location.
1 Country level accuracy.
2 Region (state, province, prefecture, etc.) level accuracy.
3 Sub-region (county, municipality, etc.) level accuracy.
4 Town (city, village) level accuracy.
5 Post code (zip code) level accuracy.
6 Street level accuracy.
7 Intersection level accuracy.
8 Address level accuracy.
9 Premise (building name, property name, shopping center, etc.) level accuracy.
Here are the real status answers from geocoder:
You can output the status inside your geocoding function:
myMap.geocoder.geocode(
{ address: someAdress } ),
function ( responses, status ) {
console.log( status );
}
);
When passing the status, you can switch those four values:
switch ( status )
{
case 'ROOFTOP' :
var precision = 'precise';
break;
case 'RANGE_INTERPOLATED' :
var precision = 'interpolated';
break;
case 'APPROXIMATE' :
var precision = 'approximately';
break;
case 'ZERO_RESULTS' :
var precision = 'no address';
break;
}
#Pekka
I don't know if you saw, but V3 does not include accuracy anymore. It seems that there is a different way though. If you add the results of the address_component elements you get a similar result. Disclaimer: I am not 100% sure about this but it looks like that they included the accuracy this way. I am currently doing some testing is this the way to go.
Here an example:
I searched for: 555 Pearl Street, Boulder
Here the result with Address Level accuracy (8 levels deep).
[address_component] => Array
(
[0] => SimpleXMLElement Object
(
[long_name] => 555
[short_name] => 555
[type] => street_number
)
[1] => SimpleXMLElement Object
(
[long_name] => Pearl St
[short_name] => Pearl St
[type] => route
)
[2] => SimpleXMLElement Object
(
[long_name] => Boulder
[short_name] => Boulder
[type] => Array
(
[0] => locality
[1] => political
)
)
[3] => SimpleXMLElement Object
(
[long_name] => Boulder
[short_name] => Boulder
[type] => Array
(
[0] => administrative_area_level_3
[1] => political
)
)
[4] => SimpleXMLElement Object
(
[long_name] => Boulder
[short_name] => Boulder
[type] => Array
(
[0] => administrative_area_level_2
[1] => political
)
)
[5] => SimpleXMLElement Object
(
[long_name] => Colorado
[short_name] => CO
[type] => Array
(
[0] => administrative_area_level_1
[1] => political
)
)
[6] => SimpleXMLElement Object
(
[long_name] => United States
[short_name] => US
[type] => Array
(
[0] => country
[1] => political
)
)
[7] => SimpleXMLElement Object
(
[long_name] => 80302
[short_name] => 80302
[type] => postal_code
)
)