Hide text after script load - html

How do I move Spritz box to the top of page when it loads? Or, how do I remove all text from the page after Spritz gets the text? And, how can I make it so that anyone who visits the page can upload a .txt file for Spritz to read?
I'm trying to code a very simple web page in HTML, but I'm having some problems.
The end result of what I'm trying to do is that when my page finishes loading, nothing shows up except for the Spritz Box (see code below) which I want to start showing the words from the book (again, see code below).
The problems I am having is that the text is taking up too much space on the page (were talking about a couple hundred thousand words here, I removed a bunch for sake of this question). This causes problems with the area that Spritz shows up in (usually at the bottom of the massive page of text).
<!DOCTYPE html>
</style>
<div id="bodyContent" class="mw-body-content">
<font size="0">
The Magicians - Lev Grossman
BOOK I
BROOKLYN
Quentin did a magic trick. Nobody noticed.
They picked their way along the cold, uneven sidewalk together: James, Julia, and Quentin. James and Julia held hands. That’s how things were now. The sidewalk wasn’t quite wide enough, so Quentin trailed after them, like a sulky child. He would rather have been alone with Julia, or just alone period, but you couldn’t have everything. Or at least the available evidence pointed overwhelmingly to that conclusion.
“Okay!” James said over his shoulder. “Q. Let’s talk strategy.”
James seemed to have a sixth sense for when Quentin was starting to feel sorry for himself. Quentin’s interview was in seven minutes. James was right after him.
“Nice firm handshake. Lots of eye contact. Then when he’s feeling comfortable, you hit him with a chair and I’ll break his password and e-mail Princeton.”
“Just be yourself, Q,” Julia said.
Her dark hair was pulled back in a wavy bunch. Somehow it made it worse that she was always so nice to him.
“How is that different from what I said?”
Quentin did the magic trick again. It was a very small trick, a basic one-handed sleight with a nickel. He did it in his coat pocket where nobody could see. He did it again, then he did it backward.
“I have one guess for his password,” James said. “Password.”
It was kind of incredible how long this had been going on, Quentin thought. They were only seventeen, but he felt like he’d known James and Julia forever. The school systems in Brooklyn sorted out the gifted ones and shoved them together, then separated the ridiculously brilliant ones from the merely gifted ones and shoved them together, and as a result they’d been bumping into each other in the same speaking contests and regional Latin exams and tiny, specially convened ultra-advanced math classes since elementary school. The nerdiest of the nerds. By now, their senior year, Quentin knew James and Julia better than he knew anybody else in the world, not excluding his parents, and they knew him. Everybody knew what everybody else was going to say before they said it. Everybody who was going to sleep with anybody else had already done it. Julia—pale, freckled, dreamy Julia, who played the oboe and knew even more physics than he did—was never going to sleep with Quentin.
Quentin was thin and tall, though he habitually hunched his shoulders in a vain attempt to brace himself against whatever blow was coming from the heavens, and which would logically hit the tall people first. His shoulder-length hair was freezing in clumps. He should have stuck around to dry it after gym, especially with his interview today, but for some reason—maybe he was in a self-sabotaging mood—he hadn’t. The low gray sky threatened snow. It seemed to Quentin like the world was offering up special little tableaux of misery just for him: crows perched on power lines, stepped-in dog shit, windblown trash, the corpses of innumerable wet oak leaves being desecrated in innumerable ways by innumerable vehicles and pedestrians.
“God, I’m full,” James said. “I ate too much. Why do I always eat too much?”
</font>
</div>
<script type="text/javascript">
// Javascript URL redirection
window.location.replace("javascript:(function(){function%20loadScript()%7Bvar%20script=document.createElement(%27script%27);script.setAttribute(%27type%27,%27text/javascript%27);script.setAttribute(%27charset%27,%27UTF-8%27);script.setAttribute(%27async%27,%27true%27);script.setAttribute(%27src%27,%27https://sdk.spritzinc.com/js/1.2/bookmarklet/js/SpritzletOuter.js%3F%27+(new%20Date().getTime()).toString().substring(0,7));document.documentElement.appendChild(script);script.onload=script.onreadystatechange=function()%7Bvar%20rs=script.readyState;if(!rs%20||%20rs===%27loaded%27%20||%20rs===%27complete%27)%7Bscript.onload=script.onreadystatechange=null;Spritzlet.init();}};}if(window.Spritzlet)%7BSpritzlet.activate();}else%7Bwindow.Spritzlet=window.Spritzlet%20||%7B};window.Spritzlet=%7Borigin:window.location.protocol+%27//%27+window.location.host,loaderVersion:1.0};loadScript();}})();");
</script>

You want spritz window to appear on top of the page and you're ok with text being hidden, did I get it right? If so just hide the text with css display: none and you're ready to go, check this out

Related

My code returns empty list while running Beautifulsoup for web scraping

I am new to web scraping. I am trying to scrape the reviews from yelp. When I run my code I get an empty list as my output. I used BeautifulSoup to find it. Would really appreciate it if someone can help me...
Here is my code:
import requests
from bs4 import BeautifulSoup
r = requests.get('https://www.yelp.com/biz/bottega-louie-los-angeles')
soup = BeautifulSoup(r.text,'html.parser')
soup.findAll(class_='raw__09f24__T4Ezm')
Output:
[]
The url is dynamic, bs4 can't mimic javascript but data is also generating api calls json response as GET method from where easily can grab data using requests module only.
script:
import requests
URL = "https://www.yelp.com/biz/TkFEKhsCixPWlShULKvMdQ/review_feed?rl=en&q=&sort_by=relevance_desc&start=10"
jsonData=requests.get(URL).json()
for review in jsonData['reviews']:
print(review['comment']['text'].replace('<br>','').replace('</br>',''))
Output:
This review is much overdue : I've dined here quite a few times over the past few years and must admit, it was really missed when closed. My appreciation for Bottega Louie was felt more while they were shut down for over a year since the pandemic hit. Ever since they opened doors a few months ago, the energy really went up in that area.Service has always been top notch. My favorite item on their menu are their chocolate hazelnut beignets which don't resemble authentic ones at all (BL's version are way better to me). When we ordered them to-go the last time, they didn't come filled and the filling came in a container which was not the
same. I love their fresh pastries and some of their beautiful cakes look better than they taste but their tiramisu is hands down -- the best we've had!Their pasta dishes are ok; there
was this seafood turmeric yellow-ish looking plate I had years ago but they took it off the menu which I'll always remember. The Caesar salad dressing is off the charts but the portion and ingredients is a rip off. I'd rather go to Sweet Green for a much more satisfying Caesar salad.Pizzas have always been consistently tasty. Their packaged candy/chocolate gift section is always a great idea for friends and family visiting. Very happy to have them back in action and hope they continue to thrive.
Such a quaint and beautiful bakery/cafe. I was blown away by the beautiful scenery. The food was amazing as well. I orderedMushroom fries- hmmm interesting flavor. Not great though. 3/5Soufflé pancake- Heaven on earth!! 10/10Breakfast sandwich(?) It was very delicious. A little messy, but the bacon was AMAZING???-7/10THE Basic Breakfast which was basic- still fresh ND well
prepared. 6/10The pizza with broccoli. This was a no for me. For 28.00...nope. 2/10. However,
the ingredients were fresh. If it were something other than broccoli. It would have been very
good.All in all, a great spot. Cons- The dogs on the patio are a bad addition. There should be a dogs only area. I have terrible allergies, and we sat next to 2 huge dogs!!! Very bizarre to bring your dog to brunch.
When youve been here before you get used to certain dishes. The lobster hash is now different. **insert sad face** They don't make it with crispy home style potatoes now they use hash
browns which come in a little circle; and comes in a sauce: it is nowhere near the amount that they used to serve. See previous pictures I also ordered the beignets and they came out burnt amount burnt so I sent them back.
No reservation? If you're a party of ~3 or less, just take a seat at the bar for weekend brunch. It's still a lovely experience without the hour-long wait time at the seated portion of the restaurant.I ordered...- Smoked Salmon Benedict: 5/5. The bombbb. Your typical poached egg and hollandaise sauce, but on top of a crispy hash brown (and served with a side salad). It was SO good, and this is coming from someone who doesn't like runny eggs. The serving
size is generous and I was full after the first egg. The salad is simple, but fresh and delicious.- Mimosa: 3/5. Standard drink, nothing special. All cocktails for brunch are $18, so I'd recommend going for something like the Juicy instead. The mint and cucumber in the Juicy make for a lighter, more refreshing drink (and boozier from the vodka).Service was great, and everyone was very friendly considering how busy it was. If you're serious about getting a sit-down meal at BL, I'd highly recommend getting a reservation in advance. Enjoy!
One of the best brunch spots for the money. This place is not overly priced and you'll come out feeing you had one of the best meals of your life.When my girlfriend and I went, we were seated fairly quickly and treated really well from the get go. I recommend coming a bit earlier during the weekend brunch as the line can build up fast. As for the food. Everything we ordered was amazing. The best part of the meal had to be the lobster hash. A close second would be the calamari. Every bite we had on the table was delicious and you probably can't go wrong with anything you order here. The desserts here are also fantastic! Everything is freshly made and wonderfully tasting! Definitely need to come check this place out if you are around. It is worth the wait and worth the money. Come check this place out!
Being half Italian I feel I can spot a great Italian meal right when I taste it so after stopping in for Valentines dinner tonight I can say that this is delicious food and nothing like so many of the non authentic Italian restaurant chains all around the US. They have a great selection of desserts and many will be stopping in for those, but the restaurant service is the real best part. They don't take reservations, nor can you put your name on a waitlist digitally like they say they can do on their VM, but still we only waited 25 minutes tonight and it
was worth it.I had to get an Italian Soda to drink with my meal because they have been something that I have loved since childhood but rarely see anymore, so if you're in the mood for
something sweet I would highly recommend ordering one. For the food we ordered the Carpaccio
to start and it was very good and for $18 it was a fair price. For our entrees we got the Carbonara (which was my favorite) and the Burrata pizza. I can say the pizza is the best that I've had in DTLA, Pizzanista is my other favorite, I was pleasantly surprised how good it was. It had crisped garlic on top and they went above by cooking the spinach before adding it to the pizza which is the authentic way and sadly many other places don't focus on the smaller details as well. Overall a casual and delicious meal. It's priced fairly and can get very busy depending on the day and time so I would be prepared to wait around a half an hour to
be seated. I will be back again soon.
The. Best. Desserts!! Came here with a friend for a celebratory dinner. The food was pretty good. I got the salmon. It was a little bit unevenly seasoned but nothing too bad. My friend mentioned that the pasta was a little bit heavy on the butter. That being said, still great experience overall. Now the desserts, that's where they killed it! We got a box of macarons with assorted flavors. I personally loved the espresso and strawberry ones but each flavor was strong and well executed. We also tried three of their pastries (not exactly sure what their names are) the lemon tart and chocolate bar was amazing. Rich in flavor and well balanced. The apple tart was a little heavy with the apple to filling ratio but still amazing! I highly recommend dropping by to try some of the desserts! The service was amazing as well and there was convenient psrking across the street in a garage. (You do have to pay though) Overall, I would give dinner a 4/5, dessert a 5/5, service a 5/5, and environment a 5/5.
Beautiful interior with amazing food.There was a bit of a wait but that's okay!The pizza was thinly crustedMeatballs were juicyCoffee was strongPasta was flavorfulWhat more can you ask for?
Review for their desserts (no food): Went here on a Sunday night for some sweets. There's
separate seating for ppl getting food vs desserts. Obvi the seating for the restaurant is fancier. Maybe we came too late but most of the cakes were sold out by the time we got there. We were still able to get a small tiramisu for around $18 (if my memory is correct). The full size cake is $40. I was shocked at how expensive the small cake was but it tasted so smooth and creamy. In other words it was very good so I guess I understand why it's expensive. But would I buy it again? Probs not. It's a once in a lifetime experience. Our group also got macarons and that was pricey too. But their macarons are good quality and taste good too. Again,
I prob won't spend this much money on desserts ever again. But I do recommend this place when you want to treat yourself to fancy desserts.
First time at this spot, man is it popular BECAUSE it was packed! Picked up some goodies for my moms birthday. I got:LE NOIRChocolate sponge cake, milk chocolate ganache & dark chocolate ganacheRASPBERRY CHOCOLATEChocolate joconde, raspberry marmalade & chocolate caramel ganacheThey pastries were beautiful! Each looked like a piece of art too pretty to eat! I HAD A BITE OF THE LE NOIR. You talking mouth watering good! The flavors were rich, paired with vanilla Ice cream.. DELICIOUS. Definitely recommend

Is it possible to create an app that automatically retunes slightly out-of-tune music to be A440 with Javascript?

One pet peeve I have with a lot of older rock music records from the 60's and 70's
is they sometimes are slightly of of tune with the standard a440 reference pitch, so playing along on my guitar sounds bad. Right now I manually adjust the pitch of the track by ear in Audacity, but this often takes some time. I was hoping there was something out there that could detect the frequency of the first few notes of a music file, analyze that and see how far it is from any standard A440 note, and then you could use that number to determine how much you needed to make the track sharp or flat to match A440 tuning.
Is it possible to create an app that automatically retunes slightly out-of-tune music to be A440 with Javascript?
Yes. Check out this pitch detection demo by Chris Wilson.
There are some big caveats though, and they don't really have anything to do with JavaScript.
Voice Selection
What instruments do you care about? Obviously wideband stuff like percussion is atonal... but it's still going to turn up in your audio, and will have a pitch. How about the difference between a voice and wind instruments? A lot of vocalists will go off pitch intentionally. You will need to use bandpass fliters to get the range you care about, at a minimum.
Original Intonation
What about the instruments being in tune in the first place? "Another one bites the dust" comes to mind as a rock record from the 70s that starts off terribly out of tune... and maybe intentionally.
Pyscoacoustics and Harmonics
Sometimes we hear things that aren't really there. If I play a trombone down a scale, to the very bottom of its range, it will actually stop producing a fundamental... yet because I was playing a familiar scale downward, us humans will still perceive one. This might not throw off your detection by a lot, but it will somewhat, particularly on those atonal-but-not-really percussion instruments.
In summary, this is possible but it's going to be a lot of work. Please come back and post a link once you've done this!

Calculate UIWebView height with dynamic content

Hello I would like to know how to calculate height of a uiwebview with the content height is changing from time to time?
Therefore, it would change after webviewDidFinishLoad delegate method.
e.g. like this one
"<!DOCTYPE html><html><head><script src=\"https://code.jquery.com/jquery-2.1.1.min.js\"></script><meta charset=\"utf-8\"><title>JS Bin</title></head><body><h1>Heading</h1><div></div><h2>Body</h2><p>Attention he extremity unwilling on otherwise. Conviction up partiality as delightful is discovered. Yet jennings resolved disposed exertion you off. Left did fond drew fat head poor. So if he into shot half many long. China fully him every fat was world grave.</p> <p>Excited him now natural saw passage offices you minuter. At by asked being court hopes. Farther so friends am to detract. Forbade concern do private be. Offending residence but men engrossed shy. Pretend am earnest offered arrived company so on. Felicity informed yet had admitted strictly how you. Luckily friends do ashamed to do suppose. Tried meant mr smile so. Exquisite behaviour as to middleton perfectly. Chicken no wishing waiting am. Say concerns dwelling graceful six humoured. Whether mr up savings talking an. Active mutual nor father mother exeter change six did all. It prepare is ye nothing blushes up brought. Or as gravity pasture limited evening on. Wicket around beauty say she. Frankness resembled say not new smallness you discovery. Noisier ferrars yet shyness weather ten colonel. Too him himself engaged husband pursuit musical. Man age but him determine consisted therefore. Dinner to beyond regret wished an branch he. Remain bed but expect suffer little repair. </p><p>Attention he extremity unwilling on otherwise. Conviction up partiality as delightful is discovered. Yet jennings resolved disposed exertion you off. Left did fond drew fat head poor. So if he into shot half many long. China fully him every fat was world grave.</p><p>Attention he extremity unwilling on otherwise. Conviction up partiality as delightful is discovered. Yet jennings resolved disposed exertion you off. Left did fond drew fat head poor. So if he into shot half many long. China fully him every fat was world grave.</p> <h3>Footer</h3><script>$(function() {var count = 0;$(document.body).click(function() {var test = count%2 === 0;$('div').css('background', test ? '#AAA' : '#888').height(test ? 150 : 300);count++;}).click();setInterval(function() {$(document.body).click();}, 1500);});</script></body></html>"
Thanks
UPDATE
I tried KVO, the contentSize.height only changed to longer one. It won't goes back to short one. Note that iOS safari could handle it without problem.
It is unlikely you can estimate the size before the content is loaded. However, you can set the web view size based on the content size after the content is loaded in the delegate call webViewDidFinishLoad.

Circular/Ideal Orbits using PyEphem

After many days searching for the answer and probaly not asking the google oracle the right question I am here. First off I am not an astronomer and other I might just be missing that one piece of information I need to answer this myself
I am trying to figure if I can use PyEphem to calculate the position of the planets in a circular orbit. This is for a mechanical display of objects in the solar system, their orbits, and correct position in those orbits. Therefore, I could be looking at the orbit of the planets around the sun, the moons around their planets, etc.... but using perfect circles to represent their positions (so not 100% accurate, but close).
I have not tried anything yet as I am not sure how this would work. As I said I am most likely missing that one piece of information and all will fall into place.
Thanks.

What are the factors most important to developing a game?

I would like to know this to understand why some games like Mario is still playing today and because no other. This is to implement in future game projects.
What are the factors most important to developing a game?
Gameplay or Graphics? Both?
EDIT:
It's Possible combine these two?
Gameplay, combined with the often-missed concept of ease of play. If I can't pick up a game and make progress in a couple minutes I probably won't go back to it after I've been away. It's just disheartening to have to relearn how to play a game. Mario tended to have simple interfaces, one or two commands only, which makes it easy to come back to. Comes back to this: http://xkcd.com/484/
Gameplay. So many modern games just seem to spend their entire budget on developing an incredible graphics engine and forget to include plot / interesting gameplay. One example is Doom 3. It's kind of interesting, and spooky to play, but it's SO REPETITIVE. Tunnel after dark, deserted tunnel... compare it to Doom 2 which had a plethora of different types of missions. Doom 2 had crap graphics, but there's a reason people keep playing it.
That being said, a big reason people play old games is from nostalgic value. The gameplay might not be particularly excellent, but it does bring back memories, so that automatically adds value to the game.
Graphics are, of course, also important... you can't get away with 16-color 2D sprites anymore (or at least, not as easily). Rather than spend the entire budget on graphics, though, look into an OK graphics engine, and spend some time making the game:
Fun to play.
Have replay value.
Easy to pick up.
The most important is that you ENTERTAIN your target users.
Some users want gameplay. Some users are wow-ed by just graphics.
The think the real importance is addictiveness, which, of course, is rather hard to program in. However, I think the key to that is a task which is very easy to "almost" achieve. It's the "I'm almost there; just one more try" effect that keep most people coming back.
This might be a bit old-school for most peoples liking, but I'd have to say gameplay.
Put it this way, I still find myself running old SNES games I loved on an emulator these days, but I can't see myself playing a game that had great graphics but rubbish gameplay after it has had its time.
Both are preferable, but it's gameplay that generates the classics of each era.
Game play is what gets you hooked, especially if there's a very low learning curve such as pacman or breakout. Graphics is what sucks you into downloading / buying a game. Sometimes nice graphics is a demo don't necessarily translate to a nice game. I've seen so many games that have beautiful front screens, background, etc. but the actual game graphics such as characters, objects, etc. suck. Generally it's a good idea to think about your game design to make it easy to understand and play initially, then it gets harder with later levels by adding bosses, threats, bonuses, increasing speed, etc. Then fine tune how the game looks with snazzy graphics.
I would say it depends. For indie games, gameplay is the most important because that's what will keep your players entertained. obviously for big budget games, you need both to be successful. But as long as your graphics are clean and neat, players shouldn't complaint too much.
Distinguish between designing the game and programming the game. For a programmer, a game is simply an application, no different from any other kind of software. Game design is a whole 'nother beast of a different color :) If you can program well, you can program a game well.
Good game designers are the same kind of rare creative as good storytellers--who aren't necessarily always good writers.
Gameplay in terms of being easy to get the basics but difficult to master would be one factor, for sure. For example look at Diablo II for something with some nice basic elements but also some elements to keep playing for a long long time, like horadic cube recipes for example.
Replayability is another factor. How much does the game change if I pick a different starting character, assuming a game with this style like an action RPG or FPS or beat-em-up(Street Fighter II)? Is the game enjoyable from different views? How good is the AI if I have computer opponents in a real-time strategy game and how many settings are there?
Graphics can be a nice complement but just because a game looks nice doesn't mean I'll spend hundreds of hours on it. Titan Quest would be a nice example of taking the Diablo II style and adding some eye candy that makes for a nice game.
Nostalgia is a big factor in why some old games are still played like the old Super Mario games. The memories of playing those old games and seeing how cool it was to get to the next level can be why some will go back again and again. It is the reason why I still play my SNES at times.