AudioServicesCreateSystemSoundID URL - objective-c

In this call:
AudioServicesCreateSystemSoundID((CFURLRef)urlSound, &audioID);
does urlSound have to be a local file? I am passing in a wav file on a website but it's returning 0. Is that why?
Thanks

Yes.
(The URL is converted using CFURLGetFileSystemRepresentation and then opened with the standard UNIX open(2) function, so it's pretty sure that URL should point to a local file.)

Related

Codeigniter not accepting sql in allowed_filetypes for upload despite mime fix

Codeigniter (latest version) keeps spitting out "The filetype you are attempting to upload is not allowed" when trying to use 'sql' as the allowed filetype in $config['allowed_types'].
I've added 'sql' => 'text/x-sql' to mimes.php config file and verified the browser is indeed recognizing the sql file as being of type text/x-sql but still, no luck.
Is there anything else I can check to get this working? I'd rather not use * for allowed file types if possible.
I know this sounds really crazy but I would make the rule to accept anything (*) and I would check for extension (in this case *.sql). Reason why is simple, browser sets mimetype and I can not rely on that...
But please try following mimetypes application/octet-stream and of course text/plain.
You can check mimetype with $_FILES['userfile']['type']

no callback function in cross domain json file

i'm trying to use cross domain jsonp. i have done this before using the callback function in the json file from the other domain. i'm looking at an example json data file that google uses in one of its tutorials:
http://earthquake.usgs.gov/earthquakes/feed/geojsonp/2.5/week -- here obviously the callback function here is eqfeed_callback. in the json file i'm trying to use, there is no callback function that kicks everything off, there is just a bracket [. the file starts off like:
[{"Address":"4441 Van Nuys Blvd","City":"Sherman Oaks" ...
and ends like:
}]
what should i do? is there another way to get at the data without a callback function? i can't edit this file. it's a service that i have a subscription to.
thx.
If it's not your server, and the server doesn't support JSONP, there's no way you can force it to return jsonp. You could try adding ?callback=callback to your url to see if that convinces the server to wrap it in a callback, but if it doesn't, you're out of luck.
Well, almost. There is actually a really dirty hack that you shouldn't use, which is to override javascript's standard Array constructor to assign the contents of the array to a global variable. But that's pretty hideous and I strongly advise against it.
Better ask the maintainer of the service if they're willing to support JSONP. Or better yet, add a CORS header.

Read from a file opened with O_WRONLY

Is it possible to read from a file which is opened using open system call with O_WRONLY flag in Unix?. If it is possible then what does Write Only (O_WRONLY) mean??
Thanks,
LinuxPenseur
Yes, it's possible, just not with the file descriptor returned from that open() call.
Duh. Oh course write-only means exactly that — write ONLY.

WCF - reading an xml file in a service using XElement.Load

i have a simple xml file in a wcf service that i am trying to load using Xelement.Load("sample.xml") which is not reading the file. What's the right way of doing this?
The service is supposed to return an xml to an asp.net application.
TIA
I got it to work by providing the ABSOLUTE path as the parameter to the XElement.Load() method, RELATIVE path would be better though.
You should try something like this then.
var appPath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
bodyFile = Path.Combine(appPath, #"<File Name Path");
This will work relative to your application's physical path.

IIS/Cache problem?

I have a program that checks if a file is present every 3 seconds, using webrequest and webresponse. If that file is present it does something if not, ect, that part works fine. I have a web page that controls the program by creating the file with a message and other variables as entered into the page, and then creates it and shoots it over to the folder that the program is checking. There is also a "stop" button that deletes that file.
This works well except that after one message is launched and then deleted, when it is launched the second time with a different message the program still sees the old message. I watch the file be deleted in IIS, so that is not the issue.
I've thought about meta tags to prevent caching, but would having the file be dynamically named solve this issue also? How would I make the program be able to check for a file where only the first part of the filename is known? I've found solutions for checking directories on local machines, but that won't work here.
Any ideas welcome, thanks.
I'm not that used to IIS, but in Apache you can create a .htaccess and set/modify HTTP-Headers.
With 'Cache-Control' you can tell a proxy/browser not to cache a file.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
A solution like this may work in IIS too if it is really a cache problem.
(To test this, open using your preffered browser with caching turned off
A simple hack is to add something unique to the url each time
http://www.yourdomain.com/yourpage.aspx?random=123489797
Adding a random number to the URL forces it to be fresh. Even if you don't use the querystring param, IIS doesnt know that, so executes the page again anyways.