are you saying I shouldn't be asking this question here? and what's wrong with my function names?? (setFlash is part of CakePHP)

Hi,
I'm pretty new to CakePHP, and have been managing so far.
I've created a scraper that scrapes TV.com for episode information (episode number, airdate, title, description). The scraper works fine, and returns an array such as:
[CODE]Array
(
[0] => Array
(
[name] => Stowaway
[number] => 17
[description] => No synopsis available. Write a synopsis.
[date] => 3/18/2011
[show_id] => 11
)

[1] => Array
    (
        [name] => Os
        [number] => 16
        [description] => While Walter attempts to figure out a way to stop the spread of vortexes on This Side, the team investigate a series of thefts committed by criminals who can control gravity.
        [date] => 3/11/2011
        [show_id] => 11
    )

)[/CODE]

The array is definately there, because I can print_r it.

On to the controller. The controller is called episodes_controller, and has the usual CRUB actions, plus the scraper. I've added an action called addAll which calls the scraper and then is meant to save the array into the database using a foreach loop. Here's the code:
[CODE] function addAll($id = null) {
if (!$id) {
$this->Session->setFlash(('Invalid show id entered', true));
//$this->redirect('/episodes');
}
$show = $this->requestAction('/shows/getTvById/'.$id); //gets the tv.com url
$episodes = $this->scrape($show, $id); //scrapes tv.com for the show
$this->set('episodes', $episodes); //sets $TVshowInfo for the view
$count = 0;
foreach ($episodes as $episode) {
$this->Episode->set($episode);
if($this->Episode->save()){
$count++;
}
}
$this->Session->setFlash(
($count.' episodes were saved.', true));
//$this->redirect('/episodes');
}[/CODE]
Every time I run it, the Flash message say's 0 episodes saved.
I've tried variations such as [CODE]if ($this->Episode->save($episode)){[/CODE] with ...

Hi,

I was trying to use my friend's hard drive the other day, but my Windows computer would not recognize it because it was in a Mac file format.
I'm now trying to create a program (simple cli), pretty much a file folder, but that would be able to read (and eventually copy from) Mac and Linux file formatted drives as well.
I'm still at the starting stages (I'm still a newbie) and I've been looking around the web trying to find a way to simply look at the drives connected to the computer.
So far, the only way I've found to do it is to use WMI. The thing is, if I use WMI, will I still be able to read file formats that windows does not recognize?
If there are any other ways that anyone can think of to do this, I would be very grateful.
Thanks,

theweirdone

No, I don't hear anything at all. I take it I'd need to change the sound settings on the TV, but what exactly would I need to change?
Thank you for replying, by the way. :-)

I know this is a easy problem to fix normally, but I've had no success yet. I have a Sony Vaio FW with Windows Vista, and a Maxent TV. I've connected the laptop to the tv with an HDMI cable. The image is displayed on the tv with no problem but there is no sound whatsoever. I've gone to the control panel and changed the default sound device to HDMI Device, still no success. I went into "Configure" and pressed on "Test", and it says it failed.
I've also noticed that when I play a movie or anything at all with sound, the computer itself doesn't register the sound, because I click the sound icon in the bottom right corner, and normally there's a green bar that moves up and down according to the volume of the sound currently playing, but when it's set to HDMI there's nothing at all.
Any help would be appreciated.
Thanks.

Hi,
I'm trying to extract certain things from a web page. The website is TVRage.com, and the example I'm using at the moment is [URL="

Hi,
I'm trying to take a date, add a day to it, and then convert it to a string. The date's format starts out like: '10/1/2009', and should end like: '2009-10-1'.
I can do that part, but then I can't convert it to a date format and add a day. Here's what I have so far:
[CODE]

!/usr/bin/env python

import time
import datetime

    epdate = episode_content[entry_number][index2+13:index3].replace('/', '-') #reformat so that the slashes are replaced
    epdate = epdate.split('-') #split the string into three
    epdate = epdate[2] + '-' + epdate[0] + '-' + epdate[1] #reorder the date to the correct format
    epdate = epdate.replace(' ', '')#make sure there are no whitespaces
    episode_date.append (epdate) #add it to my dictionary
    epdate = time.strptime(epdate, '%Y-%m-%d') #convert epdate to time type
    epdatestart = datetime.datetime(*time.strptime(epdate, '%Y-%m-%d')[:6]) #save as start date in datetype form
    epdateend = datetime.datetime(*time.strptime(epdate, '%Y-%m-%d')[:6]) + datetime.timedelta(days=1) #save as end date in datetype form
    #epdate2 = epdate + datetime.timedelta(days=1)
    print str(epdatestart)
    print str(epdateend)

[/CODE]
At the moment, the error I get is caused by the 'strptime':
[QUOTE]TypeError: expected string of buffer[/QUOTE]

Any help is appreciated
Thanks

Seems to have done it. Thanks.

Hi,
I'm making something of an RSS reader-ish.
I'm using the [URL="

Hi,
I'm trying to get a list of the subjects that I'm getting from emails in gmail.
I can get the subjects, but I can't seem to get them into a list. Here's my code so far:
[CODE]

! usr/bin/env python

import imaplib
M=imaplib.IMAP4_SSL('imap.gmail.com', 993)
M.login('user@gmail.com','password')
M.select()
typ, emails = M.search(None, 'ALL')
subject = []
for email in emails[0].split():
typ, subjects = M.fetch(email, '(BODY[HEADER.FIELDS (SUBJECT)])')
print '%s' % subjects[0][1]
subject = subjects[0][1]
M.close()
M.logout()
print subject
[/CODE]

The first print statement prints the subjects, but once I've added them to list 'subject', and try to print it, it only prints the last subject. I've tried changing the following lines:
[CODE]
subject = subjects[0][1]
to
subject += subjects[0][1]
[/CODE]
but that adds the subjects to the list as individual characters, instead of a string.
I've been working on this one problem for over an hour now, and I know it's a very basic thing (at least I think it should be), yet I can't solve it.
Any help appreciated...