Search Results

Search found 747 results on 30 pages for 'anthony chan'.

Page 23/30 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • youtube - video upload failure - unable to convert file - encoding the video wrong?

    - by Anthony
    I am using .NET to create a video uploading application. Although it's communicating with YouTube and uploading the file, the processing of that file fails. YouTube gives me the error message, "Upload failed (unable to convert video file)." This supposedly means that "your video is in a format that our converters don't recognize..." I have made attempts with two different videos, both of which upload and process fine when I do it manually. So I suspect that my code is a.) not encoding the video properly and/or b.) not sending my API request properly. Below is how I am constructing my API PUT request and encoding the video: Any suggestions on what the error could be would be appreciated. Thanks P.S. I'm not using the client library because my application will use the resumable upload feature. Thus, I am manually constructing my API requests. Documentation: http://code.google.com/intl/ja/apis/youtube/2.0/developers_guide_protocol_resumable_uploads.html#Uploading_the_Video_File Code: // new PUT request for sending video WebRequest putRequest = WebRequest.Create(uploadURL); // set properties putRequest.Method = "PUT"; putRequest.ContentType = getMIME(file); //the MIME type of the uploaded video file //encode video byte[] videoInBytes = encodeVideo(file); public static byte[] encodeVideo(string video) { try { byte[] fileInBytes = File.ReadAllBytes(video); Console.WriteLine("\nSize of byte array containing " + video + ": " + fileInBytes.Length); return fileInBytes; } catch (Exception e) { Console.WriteLine("\nException: " + e.Message + "\nReturning an empty byte array"); byte [] empty = new byte[0]; return empty; } }//encodeVideo //encode custom headers in a byte array byte[] PUTbytes = encode(putRequest.Headers.ToString()); public static byte[] encode(string headers) { ASCIIEncoding encoding = new ASCIIEncoding(); byte[] bytes = encoding.GetBytes(headers); return bytes; }//encode //entire request contains headers + binary video data putRequest.ContentLength = PUTbytes.Length + videoInBytes.Length; //send request - correct? sendRequest(putRequest, PUTbytes); sendRequest(putRequest, videoInBytes); public static void sendRequest(WebRequest request, byte[] encoding) { Stream stream = request.GetRequestStream(); // The GetRequestStream method returns a stream to use to send data for the HttpWebRequest. try { stream.Write(encoding, 0, encoding.Length); } catch (Exception e) { Console.WriteLine("\nException writing stream: " + e.Message); } }//sendRequest

    Read the article

  • How to tell a method has a varargs argument using reflection?

    - by Anthony Kong
    Here is a sample code package org.example; import java.lang.reflect.Method; class TestRef { public void testA(String ... a) { for (String i : a) { System.out.println(i); } } public static void main(String[] args){ Class testRefClass = TestRef.class; for (Method m: testRefClass.getMethods()) { if (m.getName() == "testA") { System.out.println(m); } } } } The output is public void org.example.TestRef.testA(java.lang.String[]) So the signature of the method is reported to take a array of String. Is there any mean in the reflection library I can tell that the method is originally declared to take a varargs?

    Read the article

  • NoClassDefFoundError for a packaged class

    - by Anthony
    I'm trying to run a jar file that uses the YouTube Data API and I'm getting a NoClassDefFoundError for one of the API classes: AuthenticationException.class is found in the gdata-core-1.0 jar: The gdata-core-1.0 jar has been added to my classpath: What am I doing wrong?

    Read the article

  • XDocument default namespace

    - by Anthony Faull
    How can I set the default namespace of an existing XDocument (so I can deserialize it with DataContractSerializer). I tried the following: var doc = XDocument.Parse("<widget/>"); var attrib = new XAttribute("xmlns", "http://schemas.datacontract.org/2004/07/Widgets"); doc.Root.Add(attrib); The exception I get is is The prefix '' cannot be redefined from '' to 'http://schemas.datacontract.org/2004/07/Widgets' within the same start element tag. Any ideas?

    Read the article

  • How to catch an expected (and intended) 302 Ajax response?

    - by Anthony
    So, if you look back at my previous question about Exchange Autodiscover, you'll see that the easiet way to get the autodiscover URL is to send a non-secure, non-authenticated GET request to the server, ala: http://autodiscover.exchangeserver.org/autodiscover/autodiscover.xml The server will respond with a 302 redirect with the correct url in the Location header. I'm trying out something really simple at first with a Chrome extension, where I have: if (req.readyState==4 && req.status==302) { return req.getResponseHeader("Location"); } With another ajax call set up with the full XML Post and the user credentials, But instead Chrome hangs at this point, and a look at the developer panel shows that it is not returning back the response but instead is acting like no response was given, meanwhile showing a Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101 in the error log. The way I see it, refering to the exact response status is about the same as "catching" it, but I'm not sure if the problem is with Chrome/WebKit or if this is how XHR requests always handle redirects. I'm not sure how to catch this so that I can get still get the headers from the response. Or would it be possible to set up a secondary XHR such that when it gets the 302, it sends a totally different request? Quick Update I just changed it so that it doesn't check the response code: if (req.readyState==4) { return req.getResponseHeader("Location"); } and instead when I alert out the value it's null. and there is still the same error and no response in the dev console. SO it seems like it either doesn't track 302 responses as responses, or something happens after that wipes that response out?

    Read the article

  • Android Developers, Are you adding APP 2 SD in a future app release and if so for which applications

    - by Anthony
    For Android application developers regarding 2.2 and the new App 2 SD feature. Android 2.2 now allows you to have your applications installed onto the SD card instead of using the phones internal memory. Will any of you be adding this feature onto your next release and if so what is your app? I know applications built with the App 2 SD function cannot be used when the SD card is mounted. Maybe 2 versions of each app on the market would work out great for those that would need an app while the phone is mounted. What do you think about this idea? Are you aware of any other negative issues that arise from an application built for this feature?

    Read the article

  • Can you control pinterest's "find image" results?

    - by anthony
    Rather than add Pin It buttons through our site, I would like to simply control what images show up in Pinterest's "Find Image" results if a user decides to pin one of our URLs. As of now, "Find Images" allows the user to scroll through the images it finds on the page so they can select which image to pin. The "found" images start with the first jpg in the html file, I'm assuming (could that be a bad assumption??). On our site, this forces a user to scroll through about 15 navigation and promotion images before arriving at the featured product image. Is there any way to specify this image to show first in those results? Maybe through a meta tag, or by adding a class or id to the element? Without a public Pinterest API, this seems like just guesswork, but I wanted to see if anyone else has run into this, or solved this. Thanks.

    Read the article

  • can't list files in a directory

    - by Anthony
    I'm using CF 7 and this code is not returning any files: <cfset fileLocation = "\\server\uploader\pass-fail"> <cfdirectory action = "list" directory = fileLocation name = "pass_fail_files" > <cfdump var="#pass_fail_files#" expand="yes" label="files in pass-fail" > <cfoutput>#pass_fail_files.name#</cfoutput> <cfoutput>#pass_fail_files.directory#</cfoutput> <cfoutput>#pass_fail_files.size#</cfoutput> <cfoutput>#pass_fail_files.type#</cfoutput> <cfoutput>#pass_fail_files.dateLastModified#</cfoutput> <cfoutput>#pass_fail_files.attributes#</cfoutput> <cfoutput>#pass_fail_files.mode# </cfoutput> I have checked to make sure that the directory indeed has several text files. But when I run the code, all I get is: What am I doing wrong?

    Read the article

  • Python function correctly/incorrectly?

    - by Anthony Kernan
    I'm just starting too use python, learning experience. I know the basics logic of programming. I have a function in python that is running everytime, even when it's not supposed to. I use an if statement in the beginning of the function. I don't know why this if statement is not working, confused. I have another function that is similar and works correctly. Am I missing something simple? Here's the function that is not working... def check_artist_art(): if os.path.exists("/tmp/artistinfo") and open("/tmp/artistinfo").read() != title: #if artist == "": if os.path.exists(home + "/.artist"): os.remove(home + "/.artist") if os.path.exists("/tmp/artistinfo"): os.remove("/tmp/artistinfo") print artist return False else: os.path.exists("/tmp/artistinfo") and open("/tmp/artistinfo").read() == artist return False return True And this is the similar function that is working correctly.. def check_album(): if os.path.exists("/tmp/albuminfo") and open("/tmp/albuminfo").read() != album: if os.path.exists(home + "/.album"): os.remove(home + "/.album") if os.path.exists("/tmp/albuminfo"): os.remove("/tmp/albuminfo") return False elif os.path.exists("/tmp/trackinfo") and open("/tmp/trackinfo").read() == artist + album: return False return True Any help is greatly appreciated.

    Read the article

  • Google map - How to escape charaters in the title of a marker in a google map?

    - by Anthony
    Say have this piece of code: var marker = new google.maps.Marker({ position: location, title: 'B&#250;fals', map: map }); This creates a marker as expected but if I hover the mouse over it I don’t see 'Búfals' as I would expect (instead I see the html code). This doesn't make any difference: var marker = new google.maps.Marker({ position: location, title: unescape('B&#250;fals'), map: map }); Any ideas? Thanks.

    Read the article

  • Does a lazy-programmer file auto-generator tags exist?

    - by Anthony Forloney
    I was wondering (if possible) if there was a program/tool/utility that when I create a new file and provide it with an extension that it creates the tags automatically? For example, a new file I create called index.php would have the appropriate tags auto-generated inside: <?php ?> I hope you get the idea. Does one, or could one, exist, preferably Windows based? Any information regarding this would be helpful.

    Read the article

  • UIActivityViewController 101

    - by Anthony Guay
    I'm starting to get familiar with the new iOS 6 way to share: UIActivityViewController (the same as when you share a photo from the native iOS photo app), but I'm experiencing a few problems. First, when I choose to share via email, I can't find a way to set the subject of the email. Second, when I post on twitter, I can't find how to post a URL (except explicitly writing it in a NSString). Before, on iOS 5, I was using MFMailComposeViewController for Mail and SLComposeViewController for Twitter. It worked well. If there's no way to choose the subject with UIActivityViewController, could there be a way that I put my own custom buttons on the ActivityViewController, buttons that will call MFMailComposeViewController and SLComposeViewController when touched? I'm just speculating here. Thanks!

    Read the article

  • JQuery validation with default input.

    - by Anthony
    I am using this technique to place default input in the text fields as a hint to users. http://www.dailycoding.com/Posts/default_text_fields_using_simple_jquery_trick.aspx I would like to also validate the fields using jquery validate. How can i get the validater to ignore the default input?

    Read the article

  • Does a lazy-programmer "document template" with tags exist for Windows?

    - by Anthony Forloney
    I was wondering (if possible) if there was a program/tool/utility that when I create a new file and provide it with an extension that it creates the tags automatically? For example, a new file I create called index.php would have the appropriate tags auto-generated inside: <?php ?> I hope you get the idea. Does one, or could one, exist, preferably Windows based? Any information regarding this would be helpful.

    Read the article

  • Redirect based on Accept-Language

    - by Anthony Faull
    I need to honor the web browser's list of language preferences. Supported languages are English and French. For example: http_accept_language="jp-JP;fr;en-US;en" redirects to a directory called /French/. How can I do this with rewrite rules in my .htaccess file?

    Read the article

  • Trouble decoding JSON string with PHP

    - by Anthony
    I'm trying to send an array of objects from JS to PHP using JSON. I have an array of players as follows: var player; var players = new Array(); //loop for number of players player = new Object(); player.id = theID; players[i] = player; Then my AJAX call looks like this: JSONplayers = JSON.stringify(players); $.ajax({ type: "POST", url: "php/ajax_send_players.php", data: { "players" : JSONplayers } On the PHP side the decode function looks like this $players = $_REQUEST['players']; echo var_dump($players); $players = json_decode($players); echo 'players: ' .$players. '--'. $players[0] . '--'. $players[0]->id; Debugging in chrome, the JSON players var looks like this before it is sent: JSONplayers: "[{"id":"Percipient"},{"id":"4"}]" And when I vardump in PHP it looks OK, giving this: string(40) "[{\"id\":\"Percipient\"},{\"id\":\"4\"}]" But I can't access the PHP array, and the echo statement about starting with players: outputs this: players: ---- Nothing across the board...maybe it has something to do with the \'s in the array, I am new to this and might be missing something very simple. Any help would be greatly appreciated. note I've also tried json_decode($players, true) to get it as an assoc array but get similar results.

    Read the article

  • Android: Custom Clock widget Service work-around?

    - by Anthony Forloney
    I was interested in developing a clock widget for the homescreen and upon reading Home Screen Widgets tutorial, is there a pre-existing Service I could reference for updating the current time rather than re-inventing the wheel? I have currently Retro Clock on my android phone and noticed that when I click it, it pops up the Alarm Clock settings, but with the default Google Analog Clock widget, upon click does nothing. Is that because the Retro Clock widget implements the Alarm Clock service? If so, how can I go about referencing that service? Or do I have this all wrong and misunderstood? Any help is appreciated. EDIT: I believe implementing the service to update the clock would drain the battery life tremendously, any ideas on a work around or help shed some light on any performance issues with using Service?

    Read the article

  • jQuery UI dialog + WebKit + HTML response with script

    - by Anthony Koval'
    Once again I am faced with a great problem! :) So, here is the stuff: on the client side, I have a link. By clicking on it, jQuery makes a request to the server, gets response as HTML content, then popups UI dialog with that content. Here is the code of the request-function: function preview(){ $.ajax({ url: "/api/builder/", type: "post", //dataType: "html", data: {"script_tpl": $("#widget_code").text(), "widgets": $.toJSON(mwidgets), "widx": "0"}, success: function(data){ //console.log(data) $("#previewArea").dialog({ bgiframe: true, autoOpen: false, height: 600, width: 600, modal: true, buttons: { "Cancel": function() { $(this).dialog('destroy'); } } }); //console.log(data.toString()); $('#previewArea').attr("innerHTML", data.toString()); $("#previewArea").dialog("open"); }, error: function(){ console.log("shit happens"); } }) } The response (data) is: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript">var smakly_widget_sid = 0 ,widgets = [{"cols": "2","rows": "2","div_id": "smakly_widget","wid": "0","smakly_style": "small_image",}, ] </script> <script type="text/javascript" src="/media/js/smak/smakme.js"></script> </head> <body> preview <div id="smakly_widget" style="width:560px;height:550px"> </div> </body> </html> As you see, there is a script to load: smakme.js, somehow it doesn't execute in WebKit-based browsers (I tried in Safari and Chrome), but in Firefox, Internet Explorer and Opera it works as expected! Here is that script: String.prototype.format = function(){ var pattern = /\{\d+\}/g; var args = arguments; return this.replace(pattern, function(capture){ return args[capture.match(/\d+/)]; }); } var turl = "/widget" var widgetCtrl = new(function(){ this.render_widget = function (w, content){ $("#" + w.div_id).append(content); } this.build_widgets = function(){ for (var widx in widgets){ var w = widgets[widx], iurl = '{0}?sid={1}&wid={2}&w={3}&h={4}&referer=http://ya.ru&thrash={5}'.format( turl, smakly_widget_sid, w.wid, w.cols, w.rows, Math.floor(Math.random()*1000).toString()), content = $('<iframe src="{0}" width="100%" height="100%"></iframe>'.format(iurl)); this.render_widget(w, content); } } }) $(document).ready(function(){ widgetCtrl.build_widgets(); }) Is that some security issue, or anything else?

    Read the article

  • Oauth : Get user's permissions without any redirection to a server.

    - by Anthony
    Hello, in my website, I want to add a "invite friend of my contacts book" functionnality. I would like that the user fills the loggin form in my website. Then the website contacts Google Mail, Yahoo Mail, Live Mail and retrieves the contact list. In the Oauth protocole supported by Google and Yahoo, the user is redirected to a Google or Yahoo page (like Facebook) in order to permit the user to give permissions. But I saw two websites which didn't any redirections to get the contacts book (LinkedIn for a Google mail account and Theauteurs with a live mail.) Do you know how I can get a contacts book without redirect the user to Google, Microsoft or Yahoo website.

    Read the article

  • What's the best way to fix memory leaks on the iPhone?

    - by Anthony Glyadchenko
    I'm trying to use XCode's Leaks utility to fix some memory leaks in my code. Is there a better and more understandable way to check for leaks with explanations that pinpoint the exact line and/or offer suggestions? Another question, I'm using AVAudioRecorder in my code in one of my view controllers. Should I load the recorder in viewDidLoad or in viewWillAppear?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >