Daily Archives

Articles indexed Sunday December 26 2010

Page 2/23 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • HTML5 Video Javascript

    - by user373721
    Hi, I am not experienced in Javascript, I have the following script to play video files on Andriod phone, and it works fine. <script type="text/javascript"> function PlayMyVideo(arg) { var myVideo = document.getElementById([arg]); myVideo.play(); } </script> <video id="what" src="what.mp4" poster="" /> <input type="button" onclick="PlayMyVideo('what')" value="Play" /> I am trying to write the tag on the fly: <script type="text/javascript"> function PlayVideo() { new_video = document.createElement('video'); new_video.setAttribute('scr', 'what.mp4'); new_video.play(); } </script> <input type="button" onclick="PlayVideo()" value="Play2" /> Nothing happen, would appreciate your suggestions. Thanks in advance

    Read the article

  • Grand Central Strategy for Opening Multiple Files

    - by user276632
    I have a working implementation using Grand Central dispatch queues that (1) opens a file and computes an OpenSSL DSA hash on "queue1", (2) writing out the hash to a new "side car" file for later verification on "queue2". I would like to open multiple files at the same time, but based on some logic that doesn't "choke" the OS by having 100s of files open and exceeding the hard drive's sustainable output. Photo browsing applications such as iPhoto or Aperture seem to open multiple files and display them, so I'm assuming this can be done. I'm assuming the biggest limitation will be disk I/O, as the application can (in theory) read and write multiple files simultaneously. Any suggestions? TIA

    Read the article

  • PHP Readfile() number of bytes when user aborted

    - by jtnire
    Hi Everyone, I'm using a PHP script to stream a live video (i.e. a file which never ends) from a remote source. The output is viewed in VLC, not a web browser. I need to keep a count of the number of bytes transferred. Here is my code: <?php ignore_user_abort(true); $stream = $_GET['stream']; if($stream == "vid1") { $count = readfile('http://127.0.0.1:8080/'); logThis($count); } function logThis($c) { $myFile = "bytecount.txt"; $handle = fopen($myFile,'a'); fwrite($handle,"Count: " . $c . "\n"); fclose($handle); } ?> However it appears that when the user presses the stop button, logThis() is never called, even though I've put in ignore_user_abort(true); Any ideas on what I'm doing wrong? Thanks

    Read the article

  • C#: How to Make it Harder for Hacker/Cracker to Get Around or Bypass the Licensing Check?

    - by Peter Lee
    Hi all, Suppose that the user has saved the License file under the Application.StartupPath, where all users can read. And then, every time when the app starts, it will check if it can find and verify the license file. If the app can find and verify, we let the user to continue with full functinalities. If not, we prompt a MessageBox showing "Unlicencsed, continue to use with trial version, functionalities limited." My question is, if I'm a hacker/cracker, I would try to get around or bypass the licensing check instead of cracking the license file, because, if we use RSA signature, it's very difficult to crack a license file. So where should we put the license check? thanks. Merry Christmas and Happy New Year! Peter P.S.: and also, is it safe if I put a global variable IsLicensed (true / false) to limit the functionalities? Is it easy for a hacker to change IsLicensed = true?

    Read the article

  • Perl Regex Output only characters that can be used as unix filename

    - by Jeff Balinsky
    I wrote a basic mp3 organizing script for myself. I know the power of regex but I suck with the syntax I have the line $outname = "/home/jebsky/safehouse/music/mp3/" . $inital . "/" . $artist . "/" . $year ." - ". $album . "/" . $track ." - ". $artist ." - ". $title . ".mp3"; All I want is a regex to change $outname so that any non safe for filename characters get replaced by an underscore Thanks Jeff

    Read the article

  • Streaming audio not working in Android

    - by user320293
    Hi, I'm sure that this question has been asked before but I've been unable to find a solid answer. I'm trying to load a streaming audio from a server. Its a audio/aac file http://3363.live.streamtheworld.com:80/CHUMFMAACCMP3 The code that I'm using is private void playAudio(String str) { try { final String path = str; if (path == null || path.length() == 0) { Toast.makeText(RadioPlayer.this, "File URL/path is empty", Toast.LENGTH_LONG).show(); } else { // If the path has not changed, just start the media player MediaPlayer mp = new MediaPlayer(); mp.setAudioStreamType(AudioManager.STREAM_MUSIC); try{ mp.setDataSource(getDataSource(path)); mp.prepareAsync(); mp.start(); }catch(IOException e){ Log.i("ONCREATE IOEXCEPTION", e.getMessage()); }catch(Exception e){ Log.i("ONCREATE EXCEPTION", e.getMessage()); } } } catch (Exception e) { Log.e("RPLAYER EXCEPTION", "error: " + e.getMessage(), e); } } private String getDataSource(String path) throws IOException { if (!URLUtil.isNetworkUrl(path)) { return path; } else { URL url = new URL(path); URLConnection cn = url.openConnection(); cn.connect(); InputStream stream = cn.getInputStream(); if (stream == null) throw new RuntimeException("stream is null"); File temp = File.createTempFile("mediaplayertmp", ".dat"); temp.deleteOnExit(); String tempPath = temp.getAbsolutePath(); FileOutputStream out = new FileOutputStream(temp); byte buf[] = new byte[128]; do { int numread = stream.read(buf); if (numread <= 0) break; out.write(buf, 0, numread); } while (true); try { stream.close(); } catch (IOException ex) { Log.e("RPLAYER IOEXCEPTION", "error: " + ex.getMessage(), ex); } return tempPath; } } Is this the correct implementation? I'm not sure where I'm going wrong. Can someone please please help me on this.

    Read the article

  • Get wrong PATH_INFO after rewriting in lighttpd

    - by Satoru.Logic
    In my lighttpd config file, I have a rewrite rule like this: $HTTP["host"] == "sub.example.com" { url.rewrite = ( "^/(.*)" => "/sub/$1" ) } So when a user visits http://sub.example.com, she's actually visiting http://example.com/sub. The problem is that the PATH_INFO seems wrong, URL: http://sub.example.com/extra PATH_INFO: expected: /extra what I get: /sub/extra Now whenever I call request.get_path(), it returns something like http://sub.example.com/sub/extra, which is not what I want. Of course, I can just override the get_path method of the request class, but I wonder if there is a simpler way like changing the lighttpd config?

    Read the article

  • How do I iterate over a tuple

    - by Caligo
    How can I iterate over a tuple starting from, say, index 1 to 2? The following doesn't work. using boost::fusion::cons; typedef cons<A, cons<B, cons<C, cons<D> > > > MyTuple; MyTuple tuple_; template <class T> struct DoSomething{ DoSomething(T& t) : t_(&t){ } template <class U> void operator()(U u){ boost::fusion::at<mpl::int_<u> >(*t_); } T* t_; }; boost::mpl::for_each< boost::mpl::range_c<int, 1, 3> >( DoSomething<MyTuple>(tuple_) );

    Read the article

  • Changing dalvik/libcore causes rebuilding the whole framework

    - by ZelluX
    I'm adding some interception routines to Dalvik libcore methods (e.g. file open method in libcore/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java), which I think only changes basic sharing libraries. But to my surprise, every time I run make after modifications, it rebuilds nearly everything of the framework, such as Calculator application, W3C DOM parser, etc. It really takes time to build the framework after a small modification. I'm wondering if it is possible to reduce number of rebuilt components after modifying dalvik libcore? Thanks.

    Read the article

  • Why Does My Website Redirect me to my localhost?

    - by Noah Brainey
    Alright, my website has some issues that I'm not sure what's causing them. Visit this page http://online-file-sharing.net/tos.html and click one of the bottom footer links... it redirects you to your localhost in the address bar. I have no idea why it does this. I'm hosting this website on my own server, which is this computer, and using Xampp. If this information helps. Anyways any help would be greatly appreciated! I'm also using DYNDNS as my nameservers. I've already ask this question on superuser and webapps QnA sites neither could help. They said to come here. Another thing to note is that this website runs on one script and not multiple scripts (upload.cgi). However there are three files that aren't dynamic and aren't part of the upload.cgi file... these are about.html, browse.html and tos.html. Another thing to note is that my homepage which is upload.cgi can only be accessed by manually typing in online-file-sharing.net/cgi-bin/upload.cgi (which isn't it's real location but it seems to recognize it this way... but redirects me to my localhost). .htaccess file code: DirectoryIndex upload.cgi My upload.cgi path code: my $version = "4.14"; $ENV{PATH} = '/bin:/usr/bin'; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; ($ENV{DOCUMENT_ROOT}) = ($ENV{DOCUMENT_ROOT} =~ /(.*)/); # untaint. #$ENV{SCRIPT_NAME} = '/cgi-bin/upload.cgi'; use lib './perlmodules'; #use Time::HiRes 'gettimeofday'; #my $hires_start = gettimeofday(); my (%PREF,%TEXT) = (); The script I'm using is FileChucker. I hope this information is enough to find an answer... if not please let me know and I'll post as much information as you need!

    Read the article

  • Using two threads and controlling one from the other in java?

    - by sidra
    Can someone please help me out. I need to use two threads in a way that one thread will run permanently while(true) and will keep track of a positioning pointer (some random value coming in form a method). This thread has a logic, if the value equals something, it should start the new thread. And if the value does not equal it should stop the other thread. Can someone give me some code snippet (block level) about how to realize this?

    Read the article

  • How to create an iPad directory view like animation?

    - by mahes25
    In the recent iOS 4.2 update, Apple introduced a nice animation for creating one level directories. I am trying to figure out how to implement a similar animation in my project. I would deeply appreciate it if anyone could give me any pointers to do this efficiently. From my investigation, I believe this animation or effect could be done very efficiently using Core Image which would allow me to write a custom filter. Unfortunately, Core Image is not available in iPhone. So how can do it? I read a blog post that explained a core animation scheme to create an iPad flip clock. The problem I have is similar but has important differences. Besides, I not excited about saving the subimage combinations, which I believe can cause a memory issue. Please enlighten me on the possible ways of doing this animation. I am relatively new to iOS programming, so I might have missed obvious ways of doing this animation or effect.

    Read the article

  • How do you get left position of parent element

    - by littleMan
    I've tried using position.left it says invalid object i've tried css.('left') i don't really know what to do. I want to get the position of the parent element so I can animate the child element left position Im creating a scrolling effect. <div id="MyDiv"> <div>Element 1</div> <div>Element 2</div></div><div id="Prev">Prev</div><div id="Next">Next</div>

    Read the article

  • Check the encoding of text in SQlite

    - by JJG
    I'm having a nightmare dealing with non Eurpean texts in SQlite. I think the problem is that SQlite isn't encoding the text in UTF8. So I want to check what the encoding is, and hopefully change it to utf8. I encoded a CSV in UTF8 and simply imported it to SQlite but the non-roman text is garbled. I would like to know: 1)how to check the encoding. 2)How to change the encoding if it is not utf8. I've been reading about Pragma encoding, but I'm not sure how to use this.

    Read the article

  • What's the best way to reference a .DLL - as a normal reference or as a web service?

    - by dotnetdev
    Hi, What is the best way to reference an existing .NET dll (Class library)? Is there any benefit to expose web services from the class library and reference these as opposed to referencing the actual .dll (Although one benefit of the web service approach is the granularity and thus surface area exposed is up to you at coding time)? I am thinking with loose coupling in mind, as a criteria. Thanks

    Read the article

  • Google account: Can retrieve the picture from openid? Can I get it with OAuth to google?

    - by Jonathan
    Hi! I need to retrieve the name, email and picture from a google account. I am already using the openid to make the user login with it's google acc. Can I have the picture URL from the openid proccess? with OAuth I cant'seem to find the right scope to retrieve this information... See this link: http://code.google.com/apis/gdata/docs/directory.html there is a list of scopes that you can fetch with REST api to google and I didnt't see the one related to the profile. Btw, I am using PHP and the openid is already working, but didn't start with the oauth untill I know if I can(and need) retrieve the picture (because email and name already comes within the openid proccess) thanks, Joe

    Read the article

  • Manhattan Heuristic function for A-star (A*)

    - by Shawn Mclean
    I found this algorithm here. I have a problem, I cant seem to understand how to set up and pass my heuristic function. static public Path<TNode> AStar<TNode>(TNode start, TNode destination, Func<TNode, TNode, double> distance, Func<TNode, double> estimate) where TNode : IHasNeighbours<TNode> { var closed = new HashSet<TNode>(); var queue = new PriorityQueue<double, Path<TNode>>(); queue.Enqueue(0, new Path<TNode>(start)); while (!queue.IsEmpty) { var path = queue.Dequeue(); if (closed.Contains(path.LastStep)) continue; if (path.LastStep.Equals(destination)) return path; closed.Add(path.LastStep); foreach (TNode n in path.LastStep.Neighbours) { double d = distance(path.LastStep, n); var newPath = path.AddStep(n, d); queue.Enqueue(newPath.TotalCost + estimate(n), newPath); } } return null; } As you can see, it accepts 2 functions, a distance and a estimate function. Using the Manhattan Heuristic Distance function, I need to take 2 parameters. Do I need to modify his source and change it to accepting 2 parameters of TNode so I can pass a Manhattan estimate to it? This means the 4th param will look like this: Func<TNode, TNode, double> estimate) where TNode : IHasNeighbours<TNode> and change the estimate function to: queue.Enqueue(newPath.TotalCost + estimate(n, path.LastStep), newPath); My Manhattan function is: private float manhattanHeuristic(Vector3 newNode, Vector3 end) { return (Math.Abs(newNode.X - end.X) + Math.Abs(newNode.Y - end.Y)); }

    Read the article

  • Custompage Module-Issue with CSS (Drupal-6.x)

    - by jc70
    I'm new to Drupal and have recently installed the custompage module. I received a lot of errors until I placed "custom.tpl.php" in the custompage module folder. I am able to navigate to the custom page from the primary links. But, the CSS I created for that specific page is not showing up. I'm thinking it's because "custom.tpl.php" is located in the module folder of Drupal Core and my CSS is in the theme folder. But I'm not sure how to fix the problem. I tried to copy the "custom.tpl.php" in my themes folder, but then I receive a lot of errors. Any help would be appreciated.

    Read the article

  • Why does my CGI script keep redirecting links to localhost?

    - by Noah Brainey
    Visit this page http://online-file-sharing.net/tos.html and click one of the bottom footer links. It redirects you to your localhost in the address bar. I have no idea why it does this. This is in the main script that my entire website revolves around: upload.cgi $ENV{PATH} = '/bin:/usr/bin'; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; ($ENV{DOCUMENT_ROOT}) = ($ENV{DOCUMENT_ROOT} =~ /(.*)/); # untaint. #$ENV{SCRIPT_NAME} = '/cgi-bin/upload.cgi'; use lib './perlmodules'; #use Time::HiRes 'gettimeofday'; #my $hires_start = gettimeofday(); my (%PREF,%TEXT) = (); No file is displayed when someone visits the root directory, although I have a .htaccess file saying to open my upload.cgi file which is located in my root directory. When I point my browser directly to the CGI file it works but it brings me to my localhost again. I'm hosting this website on my own server, which is this computer, and using XAMPP if this information helps. I'm also using DynDNS as my nameservers. I hope you can give me some insight.

    Read the article

  • Information about recent code injection from http://superiot.ru

    - by klennepette
    Hello, I manage the hosting for a few dozen websites. Since about a week I've been finding this code in 12 different websites in theindex.php files: <script type="text/javascript" src="http://superiot.ru/**.js"></script> // The name of the actual javascript file differs <!-- some hash here--> Some of the websites are on different servers, some aren't. I'm just wondering if anyone else has been seeing this too. Edit with some more information: All servers are centOS 5.3 PHP versions are either 5.2.9 or 5.2.4 Apache versions are either 2.2.3 or 1.3.39

    Read the article

  • All-on-one-page print view in Plone

    - by Kev
    We have a Plone 4 document that is in a hierarchy. At each node there's either a document, or a folder. Folders then have more documents and folders. We want to be able to print the entire hierarchy, which means rendering the whole thing on one page. I see a number of web sites like this one that seem to have something like this. Is it manually done or is there some add-on I can get to make this feature possible?

    Read the article

  • Does Windows Home Server support folder redirection?

    - by Shawn Miller
    Windows provides the ability to redirect specific user folders to server locations, using a group policy extension called Folder Redirection. The Wikipedia article and Microsoft's marketing page for Windows Home Server suggests a tons of great features, but I don't see anything about specifically about Folder Redirection. I currently run a domain controller in the home so that I can push the folder redirection group policy down to all PCs. Windows Home Server looks like a better fit, but I'd hate to give up on the ease of folder redirection to automatically save all documents, music, pictures to the file server. Any thoughts?

    Read the article

  • Is it safe to use an IDE to SATA power adapter for an extended period of time?

    - by qwertymk
    I just bought a computer from HP and they failed to include SATA power connectors with the power supply other then the one HD and DVD drive. Meanwhile I have two IDE to SATA power adapters that came with my "USB 2.0 to SATA/IDE cable" http://www.amazon.com/USB-2-0-SATA-Cable-Adapter/dp/B001OORN06 3rd pic on the left. I was wondering if I would just open up my computer and use it to plug it my SATA drives to the IDE power sources and mount it to the motherboard, would it damage my drives in the long run or have any other significant effects. A friend told me he knows people who have had their HD burn out because of this

    Read the article

  • Custom one-key keyboard shortcuts in Outlook 2010?

    - by cksubs
    I'm a gmail junkie, and one of my favorite features is the keyboard shortcut "a" inside an email to archive the message. I can't remember if that was the default or if I set it to such a quick little keypress, but by now it's totally ingrained in my memory. I'm setting up Outlook 2010 for work, and set up a similar "quick step" to archive, mark as read, and mark as complete any email. It would be great, except for keyboard shortcuts they only give the option for "CTRL + SHIFT + 1" and other number key options. With a keyboard shortcut that convoluted, I'm not going to remember it and might as well just reach for my mouse. Is there any way to set custom keyboard shortcuts for Outlook 2010? I want one-key shortcuts, not 3-keys-at-once!

    Read the article

  • Install Ubuntu 10.10 from loopback mounted ISO image

    - by Zifre
    I have a laptop with a faulty BIOS that has stopped booting from CDs even though it supports it (and it doesn't support booting from USB drives). I am trying to install Ubuntu 10.10 on it. I already had 9.10 installed. I tried using Kexec, but it refused to accept the kernel image. Eventually I found this page which shows how to make GRUB 2 boot from an ISO file. That worked fine, and I am now running the live image from the file. (If I can get this to work, it will be my new preferred way of installing Ubuntu, as it saves CDs and boots much faster.) However, I can't install it. The installer won't make changes to the hard drive, because the partition containing the ISO is mounted (and can't be unmounted because it is in use). Even if I only choose to use other partitions that are not mounted, the installer refuses to go any farther. Clearly, it should be possible using other partitions on the same disk. Is there any way to work around this issue or force the installer to go ahead?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >