Rectangle 27 8

Code you wrote does not display anything, simply open a blank window (location.href is an hash for browsing history, not the content of the page).

Embed the PDF viewer inside an embed or object tag. It may not be as straightforward as you may imagine, take a look to this post for sample code. In short it should be something like this:

<object data="your_url_to_pdf" type="application/pdf">
    <embed src="your_url_to_pdf" type="application/pdf" />
</object>

That's basic code but I suggest to follow what I say in the linked post if you need higher cross-browser compatibility.

Download the file to local computer (simply add the full URL of your web service method that produces the file, do not forget to add the proper Content-Disposition in the header).

Open the file into a new browser window. Create a normal a tag as you point to a PDF file on-line that you want to display in a new window. Change the href to javascript:functionName and in that function produce the URI you'll use to call the web service method.

Whatever you'll do, do not forget to set the proper MIME type in your response moreover you method shouldn't return a byte stream (even if encoded) but a valid response for your web browser.

jquery - How to display a PDF stream in a browser using javascript - S...

javascript jquery pdf browser
Rectangle 27 8

Code you wrote does not display anything, simply open a blank window (location.href is an hash for browsing history, not the content of the page).

Embed the PDF viewer inside an embed or object tag. It may not be as straightforward as you may imagine, take a look to this post for sample code. In short it should be something like this:

<object data="your_url_to_pdf" type="application/pdf">
    <embed src="your_url_to_pdf" type="application/pdf" />
</object>

That's basic code but I suggest to follow what I say in the linked post if you need higher cross-browser compatibility.

Download the file to local computer (simply add the full URL of your web service method that produces the file, do not forget to add the proper Content-Disposition in the header).

Open the file into a new browser window. Create a normal a tag as you point to a PDF file on-line that you want to display in a new window. Change the href to javascript:functionName and in that function produce the URI you'll use to call the web service method.

Whatever you'll do, do not forget to set the proper MIME type in your response moreover you method shouldn't return a byte stream (even if encoded) but a valid response for your web browser.

jquery - How to display a PDF stream in a browser using javascript - S...

javascript jquery pdf browser
Rectangle 27 4

I had a similar problem with IE8 and https. When I tried to stream a pdf to a new window, I got a blank html page instead (it worked in FireFox and if it wasn't via https). After a lot of searching and trying different variations of the response headers, the solution for me was to set:

Response.AppendHeader("Accept-Ranges", "none");

This downloads the whole pdf before it opens which is less user-friendly if it is a very large pdf. But in my case most pdfs were only a few pages. Hope this helps someone out.

Just to say I had this same issue after introducing SSL on applications running on a Tomcat (J2EE) server i.e. pdf docs not being displayed in IE7. None of the cache-control solutions worked but this did i.e. "httpResponse.addHeader("Accept-Ranges", "none");". +1 from me.

internet explorer - Can't display PDF from HTTPS in IE 8 (on 64-bit Vi...

internet-explorer pdf internet-explorer-8 https 64bit
Rectangle 27 1

I ended up using VLC Player (which uses FFmpeg) for transcoding the RTMP stream with H.264 codec and displaying it in .ogg format with built-in http server of VLC. Also I started another instance of VLC for HLS streaming for Apple based devices. Here are the two commands for H.264 and HLS respectively (note: I did this on windows, and used wamp for HLS streaming as VLC does not provide the means for transport in this case):

vlc.exe -I dummy rtmp://_ip_addr_of_the_rtmp_stream :network-caching=0 :sout=#transcode{vcodec=theo,vb=512,scale=1,acodec=none}:http{mux=ogg,dst=:8181/stream.ogg} :no-sout-rtp-sap :no-sout-standard-sap :sout-keep

vlc.exe -I dummy rtmp://_ip_addr_of_the_rtmp_stream :network-caching=0 :sout="#transcode{vcodec=h264,vb=500, venc=x264{aud,profile=baseline,level=30,keyint=30,ref=1}, aenc=none} :std{access=livehttp{seglen=10,delsegs=true,numsegs=5, index=C:\wamp\www\stream.m3u8, index-url=http://_ip_addr_of_your_web_server/stream-########.ts}, mux=ts{use-key-frames}, dst=C:\wamp\www\stream-########.ts}"

Then in html page simply:

<video width="320" height="240" controls autoplay>
  <source src="http://_ip_addr_of_your_web_server/stream.m3u8" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'/>
  <source src="http://_ip_addr_of_your_web_server:8181/stream.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

This won't work on Internet Explorer unfortunately, in case you target all browsers/devices.

Flash fallback requires a flash web player, it won't work with just HTML5 tags.

I never said it would. But adding the necessary code is almost trivial, that is, if you do consider flash as a solution in whole

ffmpeg - Live streaming RTMP to HTML5 - Stack Overflow

html5 ffmpeg streaming video-streaming rtmp
Rectangle 27 0

Use java.awt's Robot class. It has a getScreenCapture(Rectangle) method which can be used to get BufferedImages of a portion of the screen. These BufferedImages can be edited with code, then can made to be flashed by having a full screen application display itself (and disappear to recapture the new Image.). Alternatively, you could filter it by using a transparent java full screen application using the above method, and displaying it on your applet to be "x-treamed".

However, my biggest question is how do you expect to control your game anyway? Also, why are you expected to something this big for something that can be easily solved.

It would be simpler and way more synchronized if you just used a screen recording software to turn it into a movie, then use Windows Movie Maker to modify it to your needs. You do not need to waste your time on code. =)

He needs a live stream, so your last paragraph is kind of not an option at all... The idea with java.awt.Robot might work although you would have to to all the stream creation yourself.

I will be streaming games simultaneously usings xsplit's dx10 screen capture. So the game I am playing will be broadcast to a twitch.tv account. The purpose of this program is to add overlays to this broadcast (animations) over the top of the game output in real time by pressing hotkeys. This functionality isn't achievable with current software limiations.

ffmpeg - Output a Java window as a webcam stream - Stack Overflow

java ffmpeg streaming transparency webcam
Rectangle 27 0

I had a similar problem with IE8 and https. When I tried to stream a pdf to a new window, I got a blank html page instead (it worked in FireFox and if it wasn't via https). After a lot of searching and trying different variations of the response headers, the solution for me was to set:

Response.AppendHeader("Accept-Ranges", "none");

This downloads the whole pdf before it opens which is less user-friendly if it is a very large pdf. But in my case most pdfs were only a few pages. Hope this helps someone out.

Just to say I had this same issue after introducing SSL on applications running on a Tomcat (J2EE) server i.e. pdf docs not being displayed in IE7. None of the cache-control solutions worked but this did i.e. "httpResponse.addHeader("Accept-Ranges", "none");". +1 from me.

internet explorer - Can't display PDF from HTTPS in IE 8 (on 64-bit Vi...

internet-explorer pdf internet-explorer-8 https 64bit
Rectangle 27 0

package Scrapper;

import java.util.LinkedList;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Node;
import org.jsoup.select.NodeVisitor;

class TagVisitor implements NodeVisitor {

    public static class TagInfo {

        public String name;
        public int depth;

        TagInfo(String name, int depth) {
            this.depth = depth;
            this.name = name;
        }
    }

    private LinkedList<TagInfo> tags = new LinkedList<>();

    public void head(Node node, int depth) {
        String tag = node.nodeName();
        if(!tag.startsWith("#")) {
            tags.add(new TagInfo('<'+node.nodeName()+'>', depth)); 
        }
    }

    public void tail(Node node, int depth) {
        //Do nothing
    }

    public LinkedList<TagInfo> getTags() {
        return tags;
    }

    public void printTree() {
        for(TagInfo info : tags) {
            String indentation = new String(new char[info.depth*2]).replace('\0', ' ');
            System.out.println(indentation + info.name);
        }
    }
}

public class MainJsoup {

    public static void main(String[] args) throws Exception {

        //InputStream stream = new FileInputStream("test.html");
        //Document doc = Jsoup.parse(stream, "UTF-8", "");
        String URL ="http://csb.stanford.edu/class/public/pages/sykes_webdesign/05_simple.html";
        Document doc = Jsoup
                        .connect(URL)
                        .userAgent("Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201")
                        .timeout(2000)
                        .get();     
        TagVisitor visitor = new TagVisitor();
        doc.traverse(visitor);
        visitor.printTree();
    }
}

How do I display just the html tag in JSoup java? - Stack Overflow

java html eclipse parsing jsoup
Rectangle 27 0

I solved the question thanks to ..it was a matter of /r characters..I guess that when I invoke the subprocess.Popen to run my command-line script, a Windows Command Prompt is open, the script executed, and the standard output stream is returned by the Prompt with /r/n line-endings instead of just /n.

Anyway, I will post the code and GUI workflow all the way...

  • I click a button, which calls the callMe() callback function
  • The callMe() function parses the arguments coming from an Entry widget and then invokes the python command-line script
  • The script returns the above-mentioned string and this is used by the callback to update the text of the Text widget

Here is the code:

#init the GUI elements and the Text widget
from Tkinter import *
root = Tk()     
top = Frame(root)
outputFrame = Frame(top)
outputFrame.pack(side='top', padx=20, pady=20)
outputTextArea = Text(outputFrame, yscrollcommand=scrollbar.set, width=150, height=40)
outputTextArea.pack(side='left', expand=YES, fill='both')

#callback executed when the button is clicked
def callMe():

    #get parameters
    # .....

    #command line execution script execution
    process = subprocess.Popen(command_line, stdout=subprocess.PIPE, shell=True)

    #get script output
    matr = process.stdout.readlines()  

    #from a list of strings to a single string
    output = "".join(matr)  # <<< now it is:  output = "".join(matr).replace('\r', '')

    #write output into the Text widget
    outputTextArea.insert(0.0, output)

Thanks very much to all of you, guys!

user interface - Python tkinter Entry widget displays bar characters i...

python user-interface character-encoding tkinter
Rectangle 27 0

I use iostreams, mainly because that makes it easier to fiddle with the stream later on (if I need it). For example, you could find out that you want to display the output in some trace window -- this is relatively easy to do with cout and cerr. You can, off course, fiddle with pipes and stuff on unix, but that is not as portable.

I do love printf-like formatting, so I usually format a string first, and then send it to the buffer. With Qt, I often use QString::sprintf (although they recommend using QString::arg instead). I've looked at boost.format as well, but couldn't really get used to the syntax (too many %'s). I should really give it a look, though.

iostream - Which C I/O library should be used in C++ code? - Stack Ove...

c++ iostream stdio
Rectangle 27 0

I tested a whole range of client applications and found CloudBerry S3 Explorer for windows and CrossFTP for Mac more powerful then Cyberduck, but I work a lot with private streaming video and audio, so my requirements are a bit higher then displaying images on a site.

But to answer your last question, you can drag a folder with subfolders into a bucket, the hierarchy is respected. You can work folders in a bucket, just as you work with FTP. But you have to make sure to set your images to public or your images will not show. Standard, any file is uploaded as a private file, requiring a signed URL to access it. But with a client application, you can set the inheritance of a bucket, so that files become automatically public. You can find a lot of info about this here: http://www.miracletutorials.com/category/s3-amazon-cloudfront/

php - Questions about using Amazon CloudFront and/or S3 as an image se...

php apache amazon-s3 amazon-cloudfront
Rectangle 27 0

@Darin Dimitrov , Thanks, the page was missing the reference. I fixed that problem, but it behaves strangely: The first time I click the button it doesn't do anything (doesn't go back to any action in the controller.) the second time I click the button it opens a new tab but gives an error that he resource is unavailable and it shows it is looking for a view called undefined! if I ignore this and go back to the original page and click the same button for the third time then it behaves as I hoped it would on the first click: it opens a new tab and displays the original page data streamed and formatted in pdf, all correctly! any suggestions? I really appreciate your help with this. Here is my JS code:

<script type="text/javascript">
 $(document).ready(function () {
     $("#btnPdf").click(function () {
         var url = $(this).attr("href");
         $(this).attr("href", '@MvcHtmlString.Create(Html.BuildUrlFromExpressionForAreas<MyController>(c => c.GeneratePdf(Request.Url.ToString())))').bind("click",
                function () {
                    var win = window.open(url);
                    win.focus();
                    return false;
                });
     });
   });
 </script>

@Darin Dimitrov , I lost access to my original profile and I had to post my comment like an answer. Sorry everyone, the answer above is not really an answer, but a follow up question on the comments below the first answer!

@Darin Dimitrov, the code actually behaves quite bizarre when I go back to the original page and continue clicking: on first click nothing happens, second click I get a new window with error, third click it opens 1 new window with error and one with the correct pdf streamed to the browser, forth click opens one new win with error and 2 new wins with pdf output,5th click gives one new error win and 3 new wins with pdf output, so on and so forth. Any suggestion what might be causing this strange behavior?

javascript - on clicking a button, opening a streamed page in new wind...

javascript asp.net-mvc-3
Rectangle 27 0

You might return a view with some javascript that first opens a new window and then refreshes to another view. If no javascript is active, the view wouldn't reload and a link would be there to open manually. If you create the PDF in memory, there is nothing you need to delete, just stream the in memory PDF to the client. I'm new to MVC myself, this is just an idea.

pdf - How to get ASP.NET MVC to open a new window? - Stack Overflow

asp.net-mvc pdf
Rectangle 27 0

Use a ProcessStartInfo class to redirect the console output to a stream of yours, then display the stream content in your windows control.

You can also take a look a the CodeDom namespace to produce on the fly assemblies, but it depends on your goal and requirement.

Get the output of a console program in my WinForms application (Specif...

c#
Rectangle 27 0

Unix and Windows permit the output of one command to be piped to the input of another. ImageMagick permits image data to be read and written from the standard streams STDIN (standard in) and STDOUT (standard out), respectively, using a pseudo-filename of -. In this example we pipe the output of convert to the display program:

$ convert logo: gif:- | display gif:-

The second explicit format "gif:" is optional in the preceding example. The GIF image format has a unique signature within the image so ImageMagick's display command can readily recognize the format as GIF. The convert program also accepts STDIN as input in this way:

convert rose: gif:- | convert - -resize "200%" bigrose.jpg

You can use the same filename convention with the import command.

p = subprocess.Popen(['import', '-crop', '305x42+1328+281', 
                      '-window', 'root', '-depth', '8', 'png:-' ], 
                      stdout=subprocess.PIPE,)

python - Send args to subprocess while using stdin - Stack Overflow

python subprocess pipe stdin io-redirection
Rectangle 27 0

If you had a link to click that would open a new window to show the image, you could just return the image directly by changing the page response to stream the image bytes (and change the content type of the response appropriately). Since you need to display the image within the grid, the only way I can think of doing this (since you can't change the response of the request) is to request all of the files, save it temporarily on the server, and set an image link to the downloaded file.

asp.net - how to display image in a grid view or data list? - Stack Ov...

asp.net sql c#-4.0
Rectangle 27 0

How about FFMpeg. FFMpeg can be used to stream Media contents and would work on Windows, Linux and Mac as well.

Moreover, FFmpeg is free software licensed under the LGPL or GPL.

lgpl - Is there any alternative to libVLC to stream and display rtsp? ...

rtsp lgpl libvlc
Rectangle 27 0

Contrary to what's suggested in other answers you can't really do more wrt. results with std::wcout than with std::cout. The standard wide output streams just translate to the program's single byte execution character encoding. Which by default in Windows is the OEM character encoding (which can be configured via an undocumented registry key).

But you can output Unicode via the Windows API's console functions.

Note: it's not a good idea to set console windows to UTF-8. Then the [cmd.exe] command interpreter just silently ignores most commands. At least in Windows XP and earlier.

Me I just set OEM to Windows ANSI Western (via the mentioned undocumented registry key) and it works for most purposes, but not Chinese of course. It's codepage 1252. Alternatively you can do that manually via command chcp 1252 in each command interpreter instance, and also other ways.

c++ - Can command prompt display unicode characters? - Stack Overflow

c++ windows unicode visual-studio-2005
Rectangle 27 0

I know this isn't what you asked for but you can host a VLC ActiveX component inside a window in WPF and then use that VLC control to connect to the stream and display the stream. This is how I got streaming working through WPF.

Can I see an example of a WPF application running VLC as an ActiveX component? I'd like to see what it looks like and what's involved in getting it running before I actually go for it.

Hi Stuart, could you post your example using VLC somewhere so that I can have a look. Thanks.

c# - Using MediaElement to play video from Stream - Stack Overflow

c# wpf wcf mediaelement
Rectangle 27 0

2 Conversations Window -right-click a tcp or udp stream and select "Prepare a Filter" | "Selected" | "A <-> B" You can see the Display Filter in the Filter Toolbar -right-click another tcp or udp stream and select "Prepare as Filter" | "... or Selected" | "A <-> B" -right-click the last tcp or udp stream and select "Apply as Filter" | "... or Selected" | "A <-> B" Next you can save those 3 streams in a separate capture file.

thanks a lot...it served the purpose very well.

saving some selected flows in a separate pcap file using wireshark - S...

wireshark wireshark-dissector
Rectangle 27 0

I know it's pretty late, but I found this solution that fits perfectly my needs and may be also yours.

c# - How do I display an MJPEG stream in a Windows Form application? -...

c# windows-forms-designer mjpeg