Computing desk | ||
---|---|---|
< August 29 | << Jul | August | Sep >> | August 31 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
In bytecode for the Java Virtual Machine, is it legal for a constructor to catch Throwables thrown by the superclass's constructor, thus supplying the caller with a reference to an uninitialized object? In other words, would bytecode equivalent to the following Java code be legal if it didn't have to come from a standards-compliant Java compiler?
public class WithNonNullField { protected final Object o; public WithNonFullField(Object o) { if (o == null) {throw new NullPointerException("o can't be null in WithNonNullField constructor");} this.o = o; } } public class WithNullableField extends WithNonNullField { public WithNullableField(Object o) { try { super(o); } catch (NullPointerException ignored) {/* Lo and behold, this.o == null */} } }
Given that the caught Throwable instances might include an IllegalAccessError, would doing this allow a class with only private constructors to be subclassed with public constructors in a JVM launched with -Xverify:none? (I know that at the bytecode level, a class with no access to the superclass's constructors can be generated to have no constructors at all, and can still be instantiated through the backdoors that Objenesis uses. However, neither it nor its subclasses can be deserialized from a standard ObjectInputStream if the super-constructor access check cannot be bypassed.) Neon Merlin 01:59, 30 August 2017 (UTC)
How to embed popular videos from my YouTube channel?-- Joseph 12:57, 30 August 2017 (UTC)
I did read your question, it's very unclear and my question did answer your question as originally posted. If you want want to embed popular videos from your Youtube channel, open up each popular Youtube video from you channel, follow what I said, and then paste the code into wherever you are trying to embed.
Your question is still unclear as you clarification has not helped. Where do you want this playlist which you've now brought up for the first time. Are you saying you want to embed a Youtube playlist if popular videos, or you just want to embed a bunch of popular videos on a site and call it a playlist? If the later, just do what I said, and add these videos to your website or whatever and call it a play list. If you want to add videos to a Youtube playlist and then embed the playlist, add them to the playlist and embed the playlist, I'm not sure why you need us to tell you how to do that. You claim you already know how to embed a playlist.
Are you saying you don't know how to add videos to a Youtube playlist? If so this has nothing to do with embedding so I have no idea why you even brought that up. If you want to add videos to a Youtube playlist, just click on 'add to' on the video page, and then choose a playlist or create a new one to add it to. If they're your own videos, you can also add them to a playlist in the Creator Studio simply by selecting them in the video manager then click the add to at the top. This even shows the view count and you can also sort by view count so you can easily select 'popular videos' whatever you mean by that.
Alternatively also from the Creator Studio, you can edit the playlist directly and add videos including your own videos in that way. You can even define rules to automatically add videos to the play list [1], although none of them involve view count. So if you want to automatically add videos over a certain view count to a playlist, you'll need to use third party software to do so. Even more so if you want to automatically add and remove videos to keep a playlist of a certain size with the most popular videos based on view count.
Incidentally I've tried to provide every single thing I could think of in relation to your question. If you want clearer answers you need to be clearer on what you're asking about.
<iframe width="600" height="340" src="http://www.youtube.com/embed?max-results=1&controls=0&showinfo=0&rel=0&listType=user_uploads&list=YOUR_CHANNEL_NAME_HERE" frameborder="0" allowfullscreen></iframe>I'm not much experienced with coding and that's why I came here. Sorry, I can't explain any more than this.-- Joseph 18:12, 30 August 2017 (UTC)
Embed has a specific meaning when it comes to the web. It refers to adding content to a website from another website in such way that it appears as part of the first website. Adding Youtube videos to a Youtube playlist is not embeding. Your own definition seems to agree with that. So I don't know why you even bring this nonsense up since you were the one complaining about irrelevant responses because even if we ignore that embed has a specific meaning when it comes to the web, what you're trying to do is indeed embedding and no one has questioned that.
The reason I explained so much was because it was entirely unclear what you were asking about. As I already said, if you want clear answers, you need clear questions. This is the first time you explicitly mentioned 'popular uploads'. Previously you mentioned 'popular videos' which is a confusing term since it's not a term used by Google in reference to a specific channels content.
Channels can choose to show 'popular uploads' (which since this is Youtube are all technically videos) but it's not true that all channels have the 'popular uploads' feature. Channels can choose whether to enable it. See for example [2] which shows how this is done. Plenty of channels do not have it enabled [3] [4] [5] [6] [7]. (Admitedly you can generate different channel pages for subscribers and new users, and possibly other things if you have more advanced options, not sure about that one. So it's possible you will see popular uploads on these channels whereas I don't.)
Note that the last one does have a 'popular' playlist but it is not the Youtube 'popular uploads' feature but rather appears to be a custom playlist generated by whoever manages the channel. Other channels may handle this differently, e.g. this [8] has a 'Best of' playlist which is again a custom playlist which I presume was generated by whoever manages the channel.
The popular uploads feature appears to be a special automatically created playlist which behaves in certain weird ways. I suspect it may always exist even if it's not shown but I don't know how to find it if the channel doesn't display it. You can sort videos by view count on the channel's page, but clicking play all will still just play all for the channel's upload playlist not sorted by poularity. Since from all your comments, you're referring to the 'popular uploads' on your own channel, this isn't really an issue here. Still all this is why clarity on your questions is essential since it took your third reply to make clear you were referring to the 'popular uploads' feature of Youtube not something else like 'popular videos' which is what you first mentioned.
Speaking of which, you claim you know how to embed playlists, but do you? Because the example code you have shown is not for embedding a playlist. All it can really do is embed a user's videos. To obtain the code for embedding a playlist, you do a similar thing as you do for embedding a video except you need to be on the playlist page. [9]
An import diversion, at the current time Youtube's Material Design/Polymer framework UI seems to be lacking a button to share playlists unless I'm missing it completely. Which means it's lacking the ability to easily generate the code to share a playlist. (Sharing for videos is there, as is embedding although a little changed.) Mind you I'm not sure if you're seeing the new UI, this page [10] suggests it has had a worldwide launch but it sort of sounds like this may be referring to the ability for anyone to enable it, rather than it being enabled by default. I didn't enable it, nor did my friend who fist pointed out the change to me, so it's possible it was only enable by default in NZ or whatever as many companies do due to the small but English speaking population with widespread internet usage. Anyway if you are seeing the new UI, you can add &disable_polymer=true to the end of your Youtube URL to get back the old UI until Youtube re-adds a share feature for playlists (I'm guessing they will if it really is missing).
Getting back to how to actually embed a playlist, if you go to Al Jazeera English's channel [11] then click on videos [12] then click on play all you should be taken to the first video of the all uploads playlist page which is currently this [13]. If you then click on the playlist name 'Uploads from Al Jazeera English' you'll be taken to the playlist proper albeit with the possible polymer issue. Anyway this is the all uploads play list for Al Jazeera English [14] with the necessary string to disable polymer. You should be able to use it to generate code for embedding a playlist:
<iframe width="1280" height="720" src="https://www.youtube.com/embed/videoseries?list=UUNye-wNBqNL5ZzHSJj3l8Bg" frameborder="0" allowfullscreen></iframe>
By doing so, you can see how this code itself can easily be changed to embed some other playlist simply by changing the list string. this is actually quite important for what you want to do. So there's actually a very important and not just aside reason for you know how Google apparently recommends you embed playlists. Rather than the adhoc way you appear to be using for simply embedding a user's videos which I'm guessing is just some code you took off some site without knowing what you're doing.
But also it's helpful to use the Youtube feature to generate the code since you can change the settings. Your example has several presets. Do you actually know what they are and what they do and how to change them? I don't think there's any Youtube feature to automatically generate your code so you will have to change them manually, precisely because as I said, it's probably not how Google would suggest you embed a user's videos since I'm sure they recommend you just embed their all uploads playlist. And remember, you don't have a way to embed a generic playlist, you have some possibly hackish way to embed a user's upload playlist.
If you already did know how to do what I said, why on earth are you using the crappy code you've shown?
Note that your example code says the last parameter is for the channel name but this is confusing. AFAICT, using the channel ID sting in the paramater, i.e. the string you see when the URL is /channel doesn't actually work. You need to use the user profile name i.e. the string you see when the URL /user. As an aside, I should add if you try to actually embed Al Jazeera's uploads playlist you'll find it doesn't work because they don't allow embedding so you can't play the videos.
And another point, although Youtube seems to work with your code when embedded, it breaks if you go to Youtube from it. You can watch the video, but any semblance of a playlist is lost. The next video will be whatever Youtube has algorithmically chosen for you. A simple example would be to compare these two.
<iframe width="1280" height="720" src="https://www.youtube.com/embed?listType=user_uploads&list=BBCEarth" frameborder="0" allowfullscreen></iframe>
<iframe width="1280" height="720" src="https://www.youtube.com/embed/videoseries?list=UUwmZiChSryoWQCZMIQezgTg" frameborder="0" allowfullscreen></iframe>
You will see both give you playlists of 100 videos when embedded, but while the later allows you to visit Youtube and continue watching the playlist, including going past the 100, the code derived from your example does not. It breaks in the way I said it does so the playlist is los and it seems to do this whether or not polymer is enabled. Since you disabled controls anyway maybe you don't care. However are you certain your example code is actually well supported by Youtube? Because this weird issue makes me wonder if it's the sort of thing which isn't really supported and so could break at any time. Maybe there's something in the API to suggest what you're doing is okay but I somewhat doubt you know that. So yes, using adhoc methods with code you found from some random site is risky and pointless when you don't understand what you're doing and when the site itself provides a method to generate the necessary code based on their recommended method.
Anyway as for the main question after all these distractions arising from your confusing comments and poor way of doing things, well as I said earlier, the code has a playlist string. So if you have a playlist string you can simply substitute in another playlist string. But how do we get the playlist string for popular uploads? Well if you visit a channel with the 'popular uploads' feature enabled, you'll see there is a play all button next to the playlist. (I presume you know this since you talked about the feature anyway.) If you look at the URL or just click on it, you'll notice there is actually a playlist string embedded in it. Al Jazeera is one example, but since they don't allow embedding maybe not the best one here. So let's use Vsauce [15]. If you look for the popular uploads list, you should see in the URL it has the string PU6nSFpj9HTCZ5t-N3Rm3-HA. So using that, we can subsitute it into the earlier code:
<iframe width="1280" height="720" src="https://www.youtube.com/embed/videoseries?list=PU6nSFpj9HTCZ5t-N3Rm3-HA" frameborder="0" allowfullscreen></iframe>
I've tried it with some minor testing and it seems to work. If you're not happy with the parameters I specified, either change them in the code yourself or generate your own playlist code since I've told you how, as does Google. Anyway although it seems to work, I'm not sure how well this is supported by Youtube. As I mentioned, the popular uploads seems to be a special playlist and behaves in unusual ways. For example, if you are on the video of playlist playing page, you'll find the title for the playlist isn't a link, i.e. you can't click on it to be taken to the main playlist page. If you simply subtitute the playlist string into a playlist URL e.g. [16] it doesn't work. And all these with or without polymer. I'm not certain if the playlist string itself is constant or ever changes. Note also if you click on the playlist name (popular uploads) in a Youtube channel, it just takes you to the videos page sorted by view count. (So clicking play all doesn't actually work as may wish, as said above.)
Incidentally I tried adding both &sort=p and &search_sort=video_view_count to both your code and a properly embedded playlist, neither work. I'm not that surprised since AFAICT, playlists aren't inended to be re-sorted by end users. You can shuffle during playback, but the playlist has a fixed order which whoever manages it sets. (Or in the case of the all uploads playlist, the sorting is most recent. Re-sorting on the videos page is not affecting the playlist per se, just affecting what's shown on the video page.)
In other words, you should be able to use the method I've shown to embed the automatically generated 'popular uploads' playlist on an external website, provided you can see the playlist, e.g. if it's your own. But there's a chance it may break or otherwise not work as expected at any time, and you may be SOL since I'm not sure this is really something well supported by Google. (Although I haven't look into their API so maybe there are other options.)
Nil Einne ( talk) 18:18, 31 August 2017 (UTC)
How long are computer science books worth reading? That is, besides for the historical interest. After books of the 80s still interesting or are they always inevitably needing updating. — Preceding unsigned comment added by 31.4.143.40 ( talk) 15:45, 30 August 2017 (UTC)
Computing desk | ||
---|---|---|
< August 29 | << Jul | August | Sep >> | August 31 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
In bytecode for the Java Virtual Machine, is it legal for a constructor to catch Throwables thrown by the superclass's constructor, thus supplying the caller with a reference to an uninitialized object? In other words, would bytecode equivalent to the following Java code be legal if it didn't have to come from a standards-compliant Java compiler?
public class WithNonNullField { protected final Object o; public WithNonFullField(Object o) { if (o == null) {throw new NullPointerException("o can't be null in WithNonNullField constructor");} this.o = o; } } public class WithNullableField extends WithNonNullField { public WithNullableField(Object o) { try { super(o); } catch (NullPointerException ignored) {/* Lo and behold, this.o == null */} } }
Given that the caught Throwable instances might include an IllegalAccessError, would doing this allow a class with only private constructors to be subclassed with public constructors in a JVM launched with -Xverify:none? (I know that at the bytecode level, a class with no access to the superclass's constructors can be generated to have no constructors at all, and can still be instantiated through the backdoors that Objenesis uses. However, neither it nor its subclasses can be deserialized from a standard ObjectInputStream if the super-constructor access check cannot be bypassed.) Neon Merlin 01:59, 30 August 2017 (UTC)
How to embed popular videos from my YouTube channel?-- Joseph 12:57, 30 August 2017 (UTC)
I did read your question, it's very unclear and my question did answer your question as originally posted. If you want want to embed popular videos from your Youtube channel, open up each popular Youtube video from you channel, follow what I said, and then paste the code into wherever you are trying to embed.
Your question is still unclear as you clarification has not helped. Where do you want this playlist which you've now brought up for the first time. Are you saying you want to embed a Youtube playlist if popular videos, or you just want to embed a bunch of popular videos on a site and call it a playlist? If the later, just do what I said, and add these videos to your website or whatever and call it a play list. If you want to add videos to a Youtube playlist and then embed the playlist, add them to the playlist and embed the playlist, I'm not sure why you need us to tell you how to do that. You claim you already know how to embed a playlist.
Are you saying you don't know how to add videos to a Youtube playlist? If so this has nothing to do with embedding so I have no idea why you even brought that up. If you want to add videos to a Youtube playlist, just click on 'add to' on the video page, and then choose a playlist or create a new one to add it to. If they're your own videos, you can also add them to a playlist in the Creator Studio simply by selecting them in the video manager then click the add to at the top. This even shows the view count and you can also sort by view count so you can easily select 'popular videos' whatever you mean by that.
Alternatively also from the Creator Studio, you can edit the playlist directly and add videos including your own videos in that way. You can even define rules to automatically add videos to the play list [1], although none of them involve view count. So if you want to automatically add videos over a certain view count to a playlist, you'll need to use third party software to do so. Even more so if you want to automatically add and remove videos to keep a playlist of a certain size with the most popular videos based on view count.
Incidentally I've tried to provide every single thing I could think of in relation to your question. If you want clearer answers you need to be clearer on what you're asking about.
<iframe width="600" height="340" src="http://www.youtube.com/embed?max-results=1&controls=0&showinfo=0&rel=0&listType=user_uploads&list=YOUR_CHANNEL_NAME_HERE" frameborder="0" allowfullscreen></iframe>I'm not much experienced with coding and that's why I came here. Sorry, I can't explain any more than this.-- Joseph 18:12, 30 August 2017 (UTC)
Embed has a specific meaning when it comes to the web. It refers to adding content to a website from another website in such way that it appears as part of the first website. Adding Youtube videos to a Youtube playlist is not embeding. Your own definition seems to agree with that. So I don't know why you even bring this nonsense up since you were the one complaining about irrelevant responses because even if we ignore that embed has a specific meaning when it comes to the web, what you're trying to do is indeed embedding and no one has questioned that.
The reason I explained so much was because it was entirely unclear what you were asking about. As I already said, if you want clear answers, you need clear questions. This is the first time you explicitly mentioned 'popular uploads'. Previously you mentioned 'popular videos' which is a confusing term since it's not a term used by Google in reference to a specific channels content.
Channels can choose to show 'popular uploads' (which since this is Youtube are all technically videos) but it's not true that all channels have the 'popular uploads' feature. Channels can choose whether to enable it. See for example [2] which shows how this is done. Plenty of channels do not have it enabled [3] [4] [5] [6] [7]. (Admitedly you can generate different channel pages for subscribers and new users, and possibly other things if you have more advanced options, not sure about that one. So it's possible you will see popular uploads on these channels whereas I don't.)
Note that the last one does have a 'popular' playlist but it is not the Youtube 'popular uploads' feature but rather appears to be a custom playlist generated by whoever manages the channel. Other channels may handle this differently, e.g. this [8] has a 'Best of' playlist which is again a custom playlist which I presume was generated by whoever manages the channel.
The popular uploads feature appears to be a special automatically created playlist which behaves in certain weird ways. I suspect it may always exist even if it's not shown but I don't know how to find it if the channel doesn't display it. You can sort videos by view count on the channel's page, but clicking play all will still just play all for the channel's upload playlist not sorted by poularity. Since from all your comments, you're referring to the 'popular uploads' on your own channel, this isn't really an issue here. Still all this is why clarity on your questions is essential since it took your third reply to make clear you were referring to the 'popular uploads' feature of Youtube not something else like 'popular videos' which is what you first mentioned.
Speaking of which, you claim you know how to embed playlists, but do you? Because the example code you have shown is not for embedding a playlist. All it can really do is embed a user's videos. To obtain the code for embedding a playlist, you do a similar thing as you do for embedding a video except you need to be on the playlist page. [9]
An import diversion, at the current time Youtube's Material Design/Polymer framework UI seems to be lacking a button to share playlists unless I'm missing it completely. Which means it's lacking the ability to easily generate the code to share a playlist. (Sharing for videos is there, as is embedding although a little changed.) Mind you I'm not sure if you're seeing the new UI, this page [10] suggests it has had a worldwide launch but it sort of sounds like this may be referring to the ability for anyone to enable it, rather than it being enabled by default. I didn't enable it, nor did my friend who fist pointed out the change to me, so it's possible it was only enable by default in NZ or whatever as many companies do due to the small but English speaking population with widespread internet usage. Anyway if you are seeing the new UI, you can add &disable_polymer=true to the end of your Youtube URL to get back the old UI until Youtube re-adds a share feature for playlists (I'm guessing they will if it really is missing).
Getting back to how to actually embed a playlist, if you go to Al Jazeera English's channel [11] then click on videos [12] then click on play all you should be taken to the first video of the all uploads playlist page which is currently this [13]. If you then click on the playlist name 'Uploads from Al Jazeera English' you'll be taken to the playlist proper albeit with the possible polymer issue. Anyway this is the all uploads play list for Al Jazeera English [14] with the necessary string to disable polymer. You should be able to use it to generate code for embedding a playlist:
<iframe width="1280" height="720" src="https://www.youtube.com/embed/videoseries?list=UUNye-wNBqNL5ZzHSJj3l8Bg" frameborder="0" allowfullscreen></iframe>
By doing so, you can see how this code itself can easily be changed to embed some other playlist simply by changing the list string. this is actually quite important for what you want to do. So there's actually a very important and not just aside reason for you know how Google apparently recommends you embed playlists. Rather than the adhoc way you appear to be using for simply embedding a user's videos which I'm guessing is just some code you took off some site without knowing what you're doing.
But also it's helpful to use the Youtube feature to generate the code since you can change the settings. Your example has several presets. Do you actually know what they are and what they do and how to change them? I don't think there's any Youtube feature to automatically generate your code so you will have to change them manually, precisely because as I said, it's probably not how Google would suggest you embed a user's videos since I'm sure they recommend you just embed their all uploads playlist. And remember, you don't have a way to embed a generic playlist, you have some possibly hackish way to embed a user's upload playlist.
If you already did know how to do what I said, why on earth are you using the crappy code you've shown?
Note that your example code says the last parameter is for the channel name but this is confusing. AFAICT, using the channel ID sting in the paramater, i.e. the string you see when the URL is /channel doesn't actually work. You need to use the user profile name i.e. the string you see when the URL /user. As an aside, I should add if you try to actually embed Al Jazeera's uploads playlist you'll find it doesn't work because they don't allow embedding so you can't play the videos.
And another point, although Youtube seems to work with your code when embedded, it breaks if you go to Youtube from it. You can watch the video, but any semblance of a playlist is lost. The next video will be whatever Youtube has algorithmically chosen for you. A simple example would be to compare these two.
<iframe width="1280" height="720" src="https://www.youtube.com/embed?listType=user_uploads&list=BBCEarth" frameborder="0" allowfullscreen></iframe>
<iframe width="1280" height="720" src="https://www.youtube.com/embed/videoseries?list=UUwmZiChSryoWQCZMIQezgTg" frameborder="0" allowfullscreen></iframe>
You will see both give you playlists of 100 videos when embedded, but while the later allows you to visit Youtube and continue watching the playlist, including going past the 100, the code derived from your example does not. It breaks in the way I said it does so the playlist is los and it seems to do this whether or not polymer is enabled. Since you disabled controls anyway maybe you don't care. However are you certain your example code is actually well supported by Youtube? Because this weird issue makes me wonder if it's the sort of thing which isn't really supported and so could break at any time. Maybe there's something in the API to suggest what you're doing is okay but I somewhat doubt you know that. So yes, using adhoc methods with code you found from some random site is risky and pointless when you don't understand what you're doing and when the site itself provides a method to generate the necessary code based on their recommended method.
Anyway as for the main question after all these distractions arising from your confusing comments and poor way of doing things, well as I said earlier, the code has a playlist string. So if you have a playlist string you can simply substitute in another playlist string. But how do we get the playlist string for popular uploads? Well if you visit a channel with the 'popular uploads' feature enabled, you'll see there is a play all button next to the playlist. (I presume you know this since you talked about the feature anyway.) If you look at the URL or just click on it, you'll notice there is actually a playlist string embedded in it. Al Jazeera is one example, but since they don't allow embedding maybe not the best one here. So let's use Vsauce [15]. If you look for the popular uploads list, you should see in the URL it has the string PU6nSFpj9HTCZ5t-N3Rm3-HA. So using that, we can subsitute it into the earlier code:
<iframe width="1280" height="720" src="https://www.youtube.com/embed/videoseries?list=PU6nSFpj9HTCZ5t-N3Rm3-HA" frameborder="0" allowfullscreen></iframe>
I've tried it with some minor testing and it seems to work. If you're not happy with the parameters I specified, either change them in the code yourself or generate your own playlist code since I've told you how, as does Google. Anyway although it seems to work, I'm not sure how well this is supported by Youtube. As I mentioned, the popular uploads seems to be a special playlist and behaves in unusual ways. For example, if you are on the video of playlist playing page, you'll find the title for the playlist isn't a link, i.e. you can't click on it to be taken to the main playlist page. If you simply subtitute the playlist string into a playlist URL e.g. [16] it doesn't work. And all these with or without polymer. I'm not certain if the playlist string itself is constant or ever changes. Note also if you click on the playlist name (popular uploads) in a Youtube channel, it just takes you to the videos page sorted by view count. (So clicking play all doesn't actually work as may wish, as said above.)
Incidentally I tried adding both &sort=p and &search_sort=video_view_count to both your code and a properly embedded playlist, neither work. I'm not that surprised since AFAICT, playlists aren't inended to be re-sorted by end users. You can shuffle during playback, but the playlist has a fixed order which whoever manages it sets. (Or in the case of the all uploads playlist, the sorting is most recent. Re-sorting on the videos page is not affecting the playlist per se, just affecting what's shown on the video page.)
In other words, you should be able to use the method I've shown to embed the automatically generated 'popular uploads' playlist on an external website, provided you can see the playlist, e.g. if it's your own. But there's a chance it may break or otherwise not work as expected at any time, and you may be SOL since I'm not sure this is really something well supported by Google. (Although I haven't look into their API so maybe there are other options.)
Nil Einne ( talk) 18:18, 31 August 2017 (UTC)
How long are computer science books worth reading? That is, besides for the historical interest. After books of the 80s still interesting or are they always inevitably needing updating. — Preceding unsigned comment added by 31.4.143.40 ( talk) 15:45, 30 August 2017 (UTC)