Find duplicate arrays and sum another in array
sorry for my english ...
I use loop while and make array in $results. My array looks like this:
[0] => Array
(
[id] => 1
[data] => 2013-09-05
[Gabinet] => gabinet1
[a] => 0
[b] => 1
[c] => 0
)
[1] => Array
(
[id] => 2
[data] => 2013-09-05
[Gabinet] => gabinet2
[a] => 0
[b] => 0
[c] => 19
)
[2] => Array
(
[id] => 3
[data] => 2013-09-04
[Gabinet] => gabinet1
[a] => 9
[b] => 0
[c] => 1
)
[3] => Array
(
[id] => 4
[data] => 2013-09-04
[Gabinet] => gabinet2
[a] => 0
[b] => 2
[c] => 3
)
And how i can change this arrays to this:
[0] => Array
(
[Gabinet] => gabinet1
[a] => 9
[b] => 1
[c] => 1
)
[1] => Array
(
[Gabinet] => gabinet2
[a] => 0
[b] => 2
[c] => 22
)
How to find duplicate and sum another index. Which function do you use to
make this work.
Thursday, 5 September 2013
Remove header row from CSV's
Remove header row from CSV's
I have a directory with circa 3k CSV files containing various data, I need
to collate these into a single file at some point, but first I need to
remove all of the header rows from each file.
Usually for this I would collate the files, and then simply open in Excel,
and filter to the header rows before deleting them all. Unfortunately,
these sum to something around 9M rows, and Excel doesn't like that...
Can anybody think of a way around this? Preferably some sort of batch
script that will run through all files in a directory.
Thanks in advance,
A.
I have a directory with circa 3k CSV files containing various data, I need
to collate these into a single file at some point, but first I need to
remove all of the header rows from each file.
Usually for this I would collate the files, and then simply open in Excel,
and filter to the header rows before deleting them all. Unfortunately,
these sum to something around 9M rows, and Excel doesn't like that...
Can anybody think of a way around this? Preferably some sort of batch
script that will run through all files in a directory.
Thanks in advance,
A.
Google analytics: cross domain tracking + 301 redirect
Google analytics: cross domain tracking + 301 redirect
I'm right now working on multiple websites from the same company each one
connected to the others with a list of links on the top header.
The visits tracking is done with Google analytics and everything seems to
be working fine. Too bad that they now seem to be unhappy with all the
utm* parameters which get attached at the bottom of the url to obtain
cross domain tracking.
For me the best solution seems to be this: each url which links to another
one of the sites is like 'www.somename.com/en' where 'en' is the desired
language. After clicking the new page opens with an url like
'www.somename.com/en?_utma=xxxxxxxx&_utmb=...'
If i remove from the links the language changing the href to
'www.somename.com' when the page loads, the site makes a 301 redirect from
'www.somename.com/?_utma=xxxxxxxx&_utmb=...' to 'www.somename.com/en'
where 'en' is the standard language, obtaining in this way exactly what
the site owner desires.
Since i don't have access to the G anlaytics account i would like to ask
if this might be the right solution or if we may be losing the cross
domain tracking.
The cookie __utmz seems to contain the right referrer but I'm not sure if
this can be considered enough to check if it is working.
But then i checked the other parameters here
http://helpful.knobs-dials.com/index.php/Utma,_utmb,_utmz_cookies and it
seems to me that all the other values on the cookies that we get after
getting on the new domain don't have to be in any way related to the ones
on the previous page (the site with the links).
What else should i check to be sure that everything is still working fine?
Thanks,
I'm right now working on multiple websites from the same company each one
connected to the others with a list of links on the top header.
The visits tracking is done with Google analytics and everything seems to
be working fine. Too bad that they now seem to be unhappy with all the
utm* parameters which get attached at the bottom of the url to obtain
cross domain tracking.
For me the best solution seems to be this: each url which links to another
one of the sites is like 'www.somename.com/en' where 'en' is the desired
language. After clicking the new page opens with an url like
'www.somename.com/en?_utma=xxxxxxxx&_utmb=...'
If i remove from the links the language changing the href to
'www.somename.com' when the page loads, the site makes a 301 redirect from
'www.somename.com/?_utma=xxxxxxxx&_utmb=...' to 'www.somename.com/en'
where 'en' is the standard language, obtaining in this way exactly what
the site owner desires.
Since i don't have access to the G anlaytics account i would like to ask
if this might be the right solution or if we may be losing the cross
domain tracking.
The cookie __utmz seems to contain the right referrer but I'm not sure if
this can be considered enough to check if it is working.
But then i checked the other parameters here
http://helpful.knobs-dials.com/index.php/Utma,_utmb,_utmz_cookies and it
seems to me that all the other values on the cookies that we get after
getting on the new domain don't have to be in any way related to the ones
on the previous page (the site with the links).
What else should i check to be sure that everything is still working fine?
Thanks,
Wednesday, 4 September 2013
Jquery (toggle & collapse) does not loop - Only work once
Jquery (toggle & collapse) does not loop - Only work once
http://jsfiddle.net/4KUMv/
The following script shows a different background depending on the state
of the div.
When it is not expanded it shows the "plus (+)" sign, while when is
expanded it does not have background image (does not shows anything).
The problem there is that only work once.
(The .mix value makes the Div expands, and the .meta class switch to
different background).
Any clue?
Jquery Code:
$(document).ready(function() {
$('.meta').click(function() {
$(this).css('background', 'none');
});
$('.mix').click(function(){
var collapse_content_selector = $(this).attr('href');
var toggle= $(this);
$('.meta').click(function() {
$(this).css('background', 'url(images/arrow_down.png)
no-repeat scroll 95% 97% transparent');
});
$(collapse_content_selector).toggle(function(){
});
$('.meta').click(function() {
$(this).css('background', 'none');
});
});
});
Thank you!
http://jsfiddle.net/4KUMv/
The following script shows a different background depending on the state
of the div.
When it is not expanded it shows the "plus (+)" sign, while when is
expanded it does not have background image (does not shows anything).
The problem there is that only work once.
(The .mix value makes the Div expands, and the .meta class switch to
different background).
Any clue?
Jquery Code:
$(document).ready(function() {
$('.meta').click(function() {
$(this).css('background', 'none');
});
$('.mix').click(function(){
var collapse_content_selector = $(this).attr('href');
var toggle= $(this);
$('.meta').click(function() {
$(this).css('background', 'url(images/arrow_down.png)
no-repeat scroll 95% 97% transparent');
});
$(collapse_content_selector).toggle(function(){
});
$('.meta').click(function() {
$(this).css('background', 'none');
});
});
});
Thank you!
overflow-y how solve this
overflow-y how solve this
I have a div, with width 972px, but I have two pages, when one page have a
height of 1000px+ and other have height 800px+-.
look:
HTML
<div id="wraper">
</div>
CSS:
#wraper { width: 978px; margin: 25px auto; }
the height is two pages are diferent, one is 1000px+ (the scroll is
active), and other is 800px (the scroll isn't active).
The problem is, why solve this problem, maintaining centralized
independent div scroll appear or not? How to scroll the viewport
ignored.
I have a div, with width 972px, but I have two pages, when one page have a
height of 1000px+ and other have height 800px+-.
look:
HTML
<div id="wraper">
</div>
CSS:
#wraper { width: 978px; margin: 25px auto; }
the height is two pages are diferent, one is 1000px+ (the scroll is
active), and other is 800px (the scroll isn't active).
The problem is, why solve this problem, maintaining centralized
independent div scroll appear or not? How to scroll the viewport
ignored.
A record self referencing in mysql
A record self referencing in mysql
I've got a self referencing table in mySql, a table of managers and
employees.
CREATE TABLE `employee` (
`employee_id` BIGINT(10) NOT NULL AUTO_INCREMENT,
`firstname` VARCHAR(50) NULL DEFAULT NULL,
`lastname` VARCHAR(50) NULL DEFAULT NULL,
`manager_id` BIGINT(20) NULL DEFAULT NULL,
PRIMARY KEY (`employee_id`),
CONSTRAINT `FK_MANAGER` FOREIGN KEY (`manager_id`) REFERENCES `employee`
(`employee_id`)
)
I want to know if it's conceptual correct that a record references
himself. I explain better: some employees has relationships with some
manager, so for example employees 3,5,7 have relationships with manager 1,
but I'd like to create a list to show all record related to manager 1 and
also manager 1. So I've tried to make manager 1 have relationships with
himself, so manager 1 refers to manager 1.
I've got no errors, but wanna know if this is a correct way to implement
this relationship or if I will have problems in future.
Thanks
I've got a self referencing table in mySql, a table of managers and
employees.
CREATE TABLE `employee` (
`employee_id` BIGINT(10) NOT NULL AUTO_INCREMENT,
`firstname` VARCHAR(50) NULL DEFAULT NULL,
`lastname` VARCHAR(50) NULL DEFAULT NULL,
`manager_id` BIGINT(20) NULL DEFAULT NULL,
PRIMARY KEY (`employee_id`),
CONSTRAINT `FK_MANAGER` FOREIGN KEY (`manager_id`) REFERENCES `employee`
(`employee_id`)
)
I want to know if it's conceptual correct that a record references
himself. I explain better: some employees has relationships with some
manager, so for example employees 3,5,7 have relationships with manager 1,
but I'd like to create a list to show all record related to manager 1 and
also manager 1. So I've tried to make manager 1 have relationships with
himself, so manager 1 refers to manager 1.
I've got no errors, but wanna know if this is a correct way to implement
this relationship or if I will have problems in future.
Thanks
From where does the program allocates memory
From where does the program allocates memory
As a C/C++ programmer I have used malloc /new to allocate memory. I am
just wondering how does the OS allocates memory ?
1) Does it allocates from RAM or from hard-disk or from somewhere else?
2) Can I borrow memory form hard disk just in case ?
As a C/C++ programmer I have used malloc /new to allocate memory. I am
just wondering how does the OS allocates memory ?
1) Does it allocates from RAM or from hard-disk or from somewhere else?
2) Can I borrow memory form hard disk just in case ?
Subscribe to:
Posts (Atom)