Link breaks in Minecraft Chat? - java

I am building a plugin that requires a user to click on a Long link in chat. Somethig like this:
http://www.example.com/sample.php?code=124ds8g89fgfg9fd9g76hg89f7d698d67fgh7
Whenever i send this to the user:
sender.sendMessage(url);
Only part of the link is copied...example: http://www.example.com/sample.php?code=124ds8
How do i make minecraft accept the full URL length? I do not want to use 3rd Part Url shorten-ers either. Thanks!

Minecraft will automatically wrap onto the next line, or cut of a part of the Link/Message if it is too long, it can only fit so many characters into the textbox.
Your best bet is to use something like goo.gl or bit.ly to shorten the links into something more manageable.

Related

How to make your app google something?

I made sure that this hasn't been asked before:
I want to enhance an app by me.
Currently, it shows a dialog telling the user to google something, but that's very unprofessional. There's just a button to open http://www.google.com via Intent and that's it.
But I want to make it open a google search link,
searching for "%s test search" %s in the strings.xml will be replaced with the device model.
I know, I need to work with replacing parts of strings, so I need spaces replaced with "+" and so on. But how do I do this so I can paste this into the URL?
Replacing strings with + etc. is URL encoding (http://www.w3schools.com/tags/ref_urlencode.asp) and so here's how to do this in Java : http://docs.oracle.com/javase/7/docs/api/java/net/URLEncoder.html
As for Google Search Querystrings, see : https://moz.com/ugc/the-ultimate-guide-to-the-google-search-parameters
You might of course hit some terms of service or terms of use issues, so it might be worth checking with whatever site you link to that you are allowed to use it in that way (like http://www.google.com/intl/en/policies/terms/).

Is there jQuery,mentionsId edit option?

I am using mentions input jquery for my text area for mentioning names like facebook.
When I try to edit the mentioned text, already mentioned name changes to plaintext. How can I handle this?
Actually there is no such option, jQuery is a JavaScript Library, which you can implement for your own usage.
You cannot just ask jQuery to do your own work. You need to code it out!
When Facebook uses this feature, they actually try to use it like [userId:userName] which would be changed back to the Name and the Link to their profile.
I would ask you to do the same, when a user edit the names, replace that text fully. Don't just append it, just replace it as a whole. This way, the plaintext wouldn't be written and the mentionsId would have the new Name mentioned inside it.

How to save a java-generated base64 image to server?

I've been struggling with this for the last few hours and can't seem to figure it out at all. To start I'll lay out what I'm trying to do.
I want to make it so that when you generate a craft idea on this page
http://craftspo.com/craft-idea-generator/
it saves an image of the idea on my server (so that I could then allow the user to pin it on Pinterest, share it on FB, and so on).
So far, I've managed to get it so that when they click the button, it uses html2canvas to snag a snapshot of the table. The problem is that image ends up being in base64, so it's pretty much unusable.
From what I've read, you can really only decode (and then save) base64 images to a server using PHP. And of course PHP is only called whenever you load the page but I'd rather not make them reload the page every time they generate a new idea. So is there anything else I can do? Even if it means doing something completely different. At this point, I just wanna make it happen so I can feel like I conquered the problem!
if I recall correctly base64 or image has no different,
just like the comment above
you could use it like :
<img src="data:image;base64,etc"/>
if you don't want the user to reload, you could use ajax to replace the src using javascript/jquery, you could just replace it with base64 image instead link to image.
if the image ain't that big, I myself would prefer to use base64,
you could also save the base64 string into database, if it could hold the length :D
and use it later on

Read and Analyze Data on another webpage and insert onto mine

Im trying to make a simple webpage which obtains football league table data
http://www.skysports.com/football/league/0,19540,11660,00.html
For example i want to read in the points column and divide it by the number of games played to get an average points per game column that i will print onto my webpage.
How can i do this online?
Im quite experienced at doing this with offline programmes such as C/Matlab but i dont know where to start with it online.
Thanks
I wouldn't suggest to do it client side (on browser). It will be easier to scrap on server side (using java for example) following the steps:
Grab the content of the webpage (skysports)
Use existing html markup with regex to locate the desired content part.
Strip/split html markup with regex to get records (tr) and fields (td).
Cast values and do your math.
Use results to generate your version of html or json or whatever.
Serve the generated content to your client.
In general scrapping is easy but not guaranteed for tomorrow as source html markup may change at any time (and without warning).
I can provide a basic sample in C# if you want. (Sorry I haven't "java" since 1997).
You use jQuery.get like this:
$.get('http://www.skysports.com/football/league/0,19540,11660,00.html', function(data) {
//do the parsing here
});
There are several programing languages capable of getting at this information, PHP would be the classic method using curl or file_get_contents and regex parsing to extract the bits you want. You could do it with Yahoo Pipes as well if your web host does not allow remote URL retrieval.
If none of the Java brigade come back with something better contact me and I'll do some rough code for you in PHP.

How can I highlight text - strictly timed - a la Karaoke without Flash on a web page. What technology choice?

I would like to display the whole text of a poem, then have text highlighted according to a pre-established time sequence. Something like Karaoke, but without any sound track. A user would then be able to read it at exactly the "right" tempo.
I figure I can generate a subtitle track (for example, with something like Aegisum - although this keeps crashing on my Mac) with the timing data. Something line by line, such as:
1
00:00:18,067 --> 00:00:20,067
Twinkle twinkle little star
2
00:00:20,467 --> 00:00:22,467
How I wonder what you are
... or better still, a word or sylable at a time.
I don't want to use Flash for iPad/iPhone reasons.
My exact question is this as I'm somewhat naive: What would be the best technology to use? I don't need an exact solution, just some pointers on where I should concentrate my efforts. Does Timed Text in HTML5 (TTML) have anything I could use on this? Or SMIL?
Someone posted a karaoke display engine build in js: https://github.com/sk89q/ricekaraoke
You can use Javascript and CSS to accomplish what you want. You can wrap each word in a span, then apply styles to the span elements at the proper timing intervals. If you can store timing information about when you want corresponding words highlighted, you can use setInterval to add styles at the appropriate times. If you want to use HTML5 features, you might look into using Canvas or SVG to enable more advanced animations.
You can achieve a karaoke effect using a javascript library from Mozilla called popcorn.js You can download it from http://mozillapopcorn.org/
Here is a tutorial http://net.tutsplus.com/articles/news/a-look-at-popcorn/
Here is a demo http://danharper.me/demo/a-look-at-popcorn/
Lots of links to related info at the bottom of the second link.

Categories