Sunday, August 28, 2016

// // Leave a Comment

Facebook User Base Growth Calculator

The program below is the answer to Deitel's Java How to Program (9th Edition) Chapter 5 Exercise 5.32.

Question: According to CNNMoney.com, Facebook hit 500 million users in July of 2010 and its user base has been growing at a rate of 5% per month. Using the compound-growth technique you learned in Fig. 5.6 and assuming this growth rate continues, how many months will it take for Facebook to grow its user base to one billion users? How many months will it take for Facebook to grow its user base to two billion users (which, at the time of this writing, was the total number of people on the Internet)?

Solution: Using the technique (compound interest formula),
                                                a = p + (1 + r)n
where a = amount
           p = principal
           r = rate
           n = time (in years)

We are looking for how long the user base will grow to a certain number (time) so we make "n" the subject of the formula and convert "n" to months by multiplying by 12.
                                                n = Math.log(amount/principal) / Math.log(1.0 + rate)
/**
 *
 * @Author: Aghatise Osazuwa
 * Website: www.cscprogrammingtutorials.com
 *
 * Exercise 5.32 - Facebook User Base Growth
 *
 */ 

public class FBUserGrowth {
    public static void main (String [] args) {
        System.out.println("\n\nThis Program Calculates How Many Months Facebook Users Will Reach " 
            + "1,000,000,000 and 2,000,000,000.");

        double n;              
        double principal = 500000000.0; // initial amount before interest
        double rate = 0.05;
        double amount = 1000000000.0;
        n = Math.log(amount/principal)/Math.log(1.0 + rate);
        System.out.printf("\nUser base will be 1,000,000,000 in %d months.\n", Math.round(n*12));
        amount = 2000000000.0;
        n = Math.log(amount/principal)/Math.log(1.0 + rate);
        System.out.printf("\nUser base will be 2,000,000,000 in %d months.\n\n", Math.round(n*12));
    }
}

Facebook User Base Growth Calculator in Java
Program Output


Click here to see other answers to Java How to Program.
Read More

Saturday, August 27, 2016

// // Leave a Comment

Credit Limit Calculator In Java

Question: Develop a Java application that determines whether any of several department-store customers has exceeded the credit limit on a charge account. For each customer, the following facts are available:
  1. account number
  2. balance at the beginning of the month
  3. total of all items charged by the customer this month
  4. total of all credits applied to the customer’s account this month
  5. allowed credit limit.
The program should input all these facts as integers, calculate the new balance (= beginning balance + charges – credits), display the new balance and determine whether the new balance exceeds the customer’s credit limit. For those customers whose credit limit is exceeded, the program should display the message "Credit limit exceeded".

/**
 *
 * @Author: Aghatise Osazuwa
 * Website: www.cscprogrammingtutorials.com
 *
 * Exercise 4.18 - Credit Limit Calculator
 *
 */ 

import java.util.Scanner;

public class CreditLimitCalculator {

    public static void main(String[] args) {

        int accountNumber;  // stores the account number of the customer
        int balance;  // stores the balance of the customer at the beginning of the month
        int totalItems; // stores the total of all items charged by the customer this month 
        int totalCredits;  // stores the total of all credits applied to the customer’s account this month
        int allowedCreditLimit;  // stores the allowed credit limit of the customer

        Scanner input = new Scanner(System.in); //create scanner object for collecting input from user

        System.out.println("This Application Determines Whether Any Of Several "
                + "Department-store \nCustomers Has Exceeded The Credit Limit On A Charge Account.\n");

        System.out.println("Enter \"CUSTOMER ACCOUNT NUMBER\": ");
        accountNumber = input.nextInt();

        System.out.println();

        System.out.println("Enter \"CUSTOMER BALANCE\" at the  beginning of the month: ");
        balance = input.nextInt();

        System.out.println();

        System.out.println("Enter \"TOTAL OF ALL ITEMS CHARGED\" by the Customer this month: ");
        totalItems = input.nextInt();

        System.out.println();

        System.out.println("Enter \"TOTAL OF ALL CREDITS APPLIED\" to the Customer this month: ");
        totalCredits = input.nextInt();

        System.out.println();

        System.out.println("Enter the \"ALLOWED CREDIT LIMIT\" of the Customer: ");
        allowedCreditLimit = input.nextInt();

        System.out.println();

        int newBalance = balance + totalItems - totalCredits;

        System.out.println("Customer: " + accountNumber + "\n"
                + "Balance at the beginning of the month: " + balance + "\n"
                + "Total number of items charged this month: " + totalItems + "\n"
                + "Total number of Credits Applied this month: " + totalCredits + "\n");

        System.out.println("The Customer's new Balance is " + newBalance);

        System.out.println();

        if (newBalance < allowedCreditLimit) {
            System.out.println("CREDIT LIMIT EXCEEDED");
        }

        System.out.println();
    }
}


Java Credit Limit Calculator
Program Output


Click here to see other answers to Dietel's Java How to Program exercises.
Read More
// // Leave a Comment

Java Gas Mileage Calculator

Question: Drivers are concerned with the mileage their automobiles get. One driver has kept track of several trips by recording the miles driven and gallons used for each tankful. Develop a Java application that will input the miles driven and gallons used (both as integers) for each trip. The program should calculate and display the miles per gallon obtained for each trip and print the combined miles per gallon obtained for all trips up to this point. All averaging calculations should produce floating-point results. Use class Scanner and sentinel-controlled repetition to obtain the data from the user.
/**
 *
 * @Author: Aghatise Osazuwa
 * Website: www.cscprogrammingtutorials.com
 *
 * Exercise 4.17 - Gas Mileage
 *
 */ 

import java.util.Scanner;

public class GasMileage {

    public static void main(String[] args) {

        int miles;  
        int gallons;
        int totalMiles = 0;
        int totalGallons = 0;

        Scanner input = new Scanner(System.in); 

        System.out.println("This Application Determines Calculates And Displays"
                + " The Miles Per Gallon Obtained For Each Trip And Print The" 
                + " Combined Miles Per Gallon Obtained For All Trips.\n");

        System.out.println("\nEnter miles driven or -1 to Quit: ");
        miles = input.nextInt();
        
        while (miles != -1 ) {            
            System.out.println("Enter gallons used: ");
            gallons = input.nextInt();
            System.out.println("\nMiles driven for this trip: " + miles);
            System.out.println("Gallons used for this trip: " + gallons);
            totalMiles += miles;
            totalGallons += gallons;
            System.out.printf("\nMiles per gallon for this trip: %f\nCombined Miles "
                    + "per gallon: %f\n",(double)miles/gallons, (double)totalMiles/totalGallons);
            
            System.out.println("\nEnter miles driven or -1 to Quit: ");
            miles = input.nextInt();
        }
        System.out.println();
    }  
}

Java Gas Mileage Calculator
Program Output


Click here to see other answers to Dietel's Java How to Program exercises.
Read More

Monday, August 22, 2016

// // Leave a Comment

How To Save Images And Videos From A Webpage That Disable Right-click

There are some websites on the Internet that disables right-click. The main reason why they do so is to protect their content. In other words to prevent copy and pasting their work elsewhere without their permission and/or proper reference.

No right click
If you happen to visit such site and you want to save an image or download a video, use any of the three methods below.

Use view-source command

To do this enter the command view-source: before the url/website address in your browser's address bar. For example:
view-source:www.websiteaddress.com
Simply replace "www.websiteaddress.com" with the website address you want to download from and press ↵ Enter. The page will load the source code for that webpage. Search for the image/video you want to download, copy the link and paste into your address bar. The image should load and you can now right-click to save image/video. Sometimes, some websites host videos on third party sites so the direct link may not be on the source page. To download such videos, search for the video player used to embed the video. It should have the video link. Open a new tab and go to en.savefrom.net. Copy and paste the video link into the search bar and press ↵ Enter. It will search for the video link and you can download in your preferred format.

Hint: To easily find the image use ctrl+F (Windows) or Command-F (Mac) to find any text close to the image on the webpage.

Use Mozilla Firefox Browser

To use this method, follow the steps below:
  1. Open the Firefox Configuration page. In address bar, type about:config and press ↵ Enter. You will need to confirm that you understand that changing settings could result in Firefox not working properly.
  2. Type context into the Search bar. Find preference name listed as "dom.event.contextmenu.enabled" and double-click to toggle it to "false".
  3. You may still receive a message about right-clicking not being allowed, but the right-click menu should appear after you close the message.
Now, try right-clicking on a website that you couldn't before. Click here for more details about this method.

Save The Webpage To Your Computer

The third method is to save the webpage to your computer using the command ctrl+S (Windows) or Command+S (Mac). After saving the webpage, go to the location where you saved it in your computer and open the folder (usually the title of the webpage unless you change it). The folder should contain all the files on the webpage (images, scripts, source codes).

Screenshot The Image

Another method for saving images on websites that disable right-click is to screenshot the image. You can do this by using the following tools:

These are the methods I know of so far to bypass websites with right-click disabled. If you know of any other method not mentioned above, any suggestion/correction or questions, use the comment box below and I will reply as soon as possible.
Read More
// // Leave a Comment

20 Apple TV Tips And Tricks

The latest generation of the Apple TV has a lot to offer that its predecessors don't. It's a casual gaming device, has useful apps like weather or news services and even comes with Siri baked in to help you find what you're looking for faster than thumbing through countless menus with the remote. And unlike before, there are two storage options to choose from.

It's easy to nail down the basics with Apple TV. But there are countless features, tricks and Siri commands that aren't immediately apparent to first time users or those who don't dive too deep into settings. Here are 20 tips and tricks to help you master the Apple TV.

  1. Rename your Apple TV
  2. If you have more than one Apple TV in your house, you can easily rename them to better tell them apart. Go to Settings > General > About > Name and choose one of the preset names, such as Living Room, Bedroom or Office. If you don't like any of those, you can select Custom Name at the bottom and set your own.

    This will help you determine which Apple TV you're streaming or mirroring content to.

  3. Force a reboot using the remote
  4. When your Apple TV is acting wonky or an application isn't working correctly, you can navigate through the settings menu to reboot. Or you can simply hold the Home + Menu buttons until you see the front status light on the Apple TV start rapidly blinking. When you release the buttons, it will force a reboot.

  5. Put Apple TV to sleep
  6. Apple TV will automatically go to sleep after a set amount of time. This can be customized at Settings > General > Sleep After. However, if you want to manually put Apple TV to sleep, long press the Home button and select Sleep. Pressing any button the remote will wake up Apple TV again.

  7. Quickly move apps into folders
  8. If you have a lot of apps installed on your Apple TV, you can organize them into folders. Just like in iOS, you long press on the icon and drag it over another app icon to create a folder. If you're adding an app to an existing folder, you can drag and drop it into the folder, which can sometimes be unwieldy with the Apple TV remote.

    An easier way to do this is to long press on the icon and press the Play/Pause button and select Move to [folder name] to quickly drop it into any folder.

  9. Customize the screensaver
  10. The new Apple TV aerial screensavers look incredible. They bring beautiful cityscapes or other scenery into your living room in the form of high resolution video. But if those aren't your speed, you can change the screensaver and how often they update.

    Go to Settings > General > Screensaver and select Apple Photos, My Photos, Home Sharing or My Music. Each selection comes with different settings to tweak, such as the transition between photos or how often new Aerial screensavers are downloaded.

  11. Scrub faster with Siri
  12. You can click on either side of the touchpad on the new Siri remote to skip forward or backwards 10 seconds at a time. If you click to pause, you can scrub even faster by sliding left or right on the trackpad.

    To jump ahead or back a specific amount of time, you can just Siri. Say, "Jump back 5 minutes" or "Skip ahead 10 minutes."

  13. Another way to delete apps
  14. If you'd like to declutter your Apple TV home screen by deleting apps you no longer use, long press on an icon, press the Play/Pause button, select Delete and confirm your selection.

    A faster way to quickly delete multiple applications is to go to Settings > General > Manage Storageand click the trash can icons to the right of the apps you want to uninstall.

  15. Extra Menu button functions
  16. The Menu button does more than take you to the previous page. If you double-click it, the screensaver will start. Triple-clicking the Menu button will activate your Accessibility Shortcuts, such as Closed Captioning, Voice Over or Zoom. If you have more than one enabled, the triple-press will ask which shortcut you want to toggle.

  17. Get to the app switcher
  18. I spent weeks with my Apple TV before I even realized there is an App Switcher, a la iOS. To get to it,double-press the Home button. Swiping left and right will scroll you through a chronological list of your most recent apps. Swiping up when stopped on an application preview will close that app.

  19. Press Play/Pause while typing to shift
  20. The on-screen keyboard isn't the greatest, but if you choose to use it, knowing that the Play/Pausebutton works as a shift or caps lock will save you from having to manually switch from uppercase to lowercase on-screen. This can save quite a bit of effort when entering passwords.

    Also, while it's not an official shortcut, if you need to delete everything you've typed in a search bar or text field, rather than swiping all the way to the right and long-pressing on the on-screen delete key, just quickly tap the Siributton. Queuing up Siri will delete any text you've entered to make way for dictation input, but if you tap the button fast enough, it won't have time to hear any input and acts as a quick delete key.

  21. Add a keyboard or gamepad
  22. To save yourself even more trouble when searching or typing any amount of text on Apple TV, grab a Bluetooth keyboard and pair it. Put your keyboard into pairing mode and go to Settings > Remotes and Devices > Bluetooth. Select your keyboard from the Other Devices section and follow the on-screen prompts.

    You can also connect gamepads to your Apple TV to use it as a lightweight game console. The gamepad must be Bluetooth-enabled and MFi certified.

  23. Pair Bluetooth headphones
  24. Under the same Bluetooth menu, you can also pair Bluetooth headphones for late night television binges while your cohabitants sleep. I've also found this helpful when a TV show or movie has unusual or poor sound leveling. You can use the Reduce Loud Sounds option, but listening through headphones seems to work better.

  25. Use your iPhone as a remote
  26. Apple recently updated the Apple TV Remote app for iPhone. Just download the app, connect your phone to the same network as the TV, add as many Apple TVs as you have in your home and use the iPhone to control them. With the latest update, you can also queue Siri from the iPhone, which was not previously possible.

    With this app installed, you can also use the up to two iPhones as gamepads in any game that supports it.

  27. Use an Apple Watch as a remote
  28. If you have the Apple TV Remote app installed on your iPhone, it should also install on your Apple Watch.

    When you open the Remote app on your Apple Watch, you can add your Apple TVs and begin controlling them from your wrist. Swiping any direction on the watch works like the touchpad on the remote, as does tapping it. There's a Menu button and Play/Pause, but no Home button.

  29. Stream any audio to your entertainment system
  30. While there is no official support for apps like Spotify or Google Play Music on Apple TV, you can still stream your favorite app through your entertainment system using AirPlay and an Apple TV.

    Open your music streaming or podcast catcher of choice, begin playing audio and look for the AirPlay or Cast icon within the app. If you don't see it, you can try swiping up from the bottom of the iPhone screen and turning on AirPlay from Control Center. Select your Apple TV and stream your music through your television or surround sound.

  31. Control your smart home remotely
  32. Until later this year, you can't use the Apple TV to control your smart HomeKit devices directly. But you can use the Apple TV to control HomeKit devices remotely using Siri on an iPhone or iPad.

    Once you've setup your HomeKit devices from your iOS device and login to your iCloud account on the Apple TV, speak some commands to Siri when you're out of Bluetooth range of the devices and the Apple TV will take care of the rest.

  33. Ask Siri what to watch Taylor Martin/CNET
  34. If you're not sure what you should watch when you first sit down, just press the Siri button and say, "What should I watch?" Siri will give you a selection of what's new and popular. You can also say, "Show me popular movies" or "What shows are trending right now?"

  35. "What did he just say?"
  36. This is easily one of the most useful commands for the Apple TV. If you're watching television or a movie and you can't understand what a character said, you can hold the Siri button and ask, "What did he just say?" The video will rewind to a point before the last person started speaking and Closed Captioning will be temporarily turned on so you can not only hear it again, you can also read what they said.

  37. Enable Family Sharing
  38. If you enable Family Sharing on your iCloud account and login to your Apple TV with that account, everyone's purchased content can be shared on a single Apple TV. Your past purchases will appear under the Purchased tab in the App Store, iTunes Movies and TV Shows apps. To access another user's purchased content, go to the Purchased tab, select Family Sharing and click on a users photo.

    In order to access another user's music, you will need to go to Settings > Accounts > iTunes and App Store and switch accounts there.

  39. Capture the screen
  40. As long as content isn't playing, you can record the screen of your Apple TV using a USB-C cable and Quicktime on a Mac.

    Connect the USB-C cable to the back of your Apple TV and the other end into a port on your Mac. Open Quicktime and go to File > New Movie Recording. In the window that appears, click the downward facing arrow button beside the record button and select your Apple TV from the dropdown menu. The live preview of your Apple TV's screen will appear on your Mac. Just press the record button to start capturing the screen.

Originally on CNET.
Read More

Sunday, August 21, 2016

// // Leave a Comment

Samsung Galaxy Note 7 Now On Sale

The much-anticipated phone-tablet hybrid went on sale Friday, along with a bevvy of new accessories and companion devices from Samsung.

Samsung Galaxy Note 7

The wait is over for those looking to buy what a CNET reviewer dubbed the "sexiest large-screen phone ever."

The new 5.7-inch Samsung Galaxy Note 7 is officially available in 10 countries and territories, including the US, Canada, Australia and South Korea. In the US, all four major carriers plus regional operator US Cellular will carry the Note 7 in stores in three colors: blue coral, silver titanium and black onyx. It's also available in the US from retailers, including Best Buy, Amazon, Target and Sam's Club.

CNET reviewer Jessica Dolcourt gave high marks to the oversized water- and dust-resistant handset with a sleek wraparound screen and a stylus, but also noted its hefty $850 price tag. Check out the full review here.

In addition to the Galaxy Note 7, several other anticipated Samsung products are also available starting Friday.

More Photos of the Samsung Galaxy Note 7


Samsung Galaxy Note 7 front screen   Samsung Galaxy Note 7 with stylus

Samsung Galaxy Note 7 homescreen               Samsung Galaxy Note 7 using stylus


New Accessories And Companion Devices From Samsung

Gear VR: The $100 newly designed virtual-reality headset plugs into many of the latest Galaxy phones, including the Note 7 and S7 and allows users to experience VR anywhere.

Gear 360: This 360-degree camera, which retails for $350, is also compatible with the latest Galaxy smartphones and allows users to create high-resolution, 360-degree images and video that can be shared directly to social networks or used with Samsung VR products.

Gear IconX: These $200 wireless earbuds are designed for fitness with enough memory to store up to 1,000 songs. They also track your speed, distance, pace and heart rate in real time and can sync to Samsung's S Health app via a smartphone.

Level Active: These lightweight, sweat-resistant earbuds cost $100.

Samsung Connect auto: Announced back in February, this connected-car solution, which creates a Wi-Fi hotspot via AT&T's 4G LTE service for up to 10 devices, is also available.


Source:  CNET
Read More

Saturday, August 20, 2016

// // Leave a Comment

Twitter Axes 235,000 More Accounts In Terror Crackdown

Twitter logo

Twitter announced Thursday that it had cut off 235,000 accounts during the past six months in a heightened crackdown on use of the global messaging service to promote violent extremist causes. 

The suspensions raised to 360,000 the total number of accounts sidelined since the middle of 2015 and was helping “drive meaningful results” in curbing the activity, according to the San Francisco-based company. 

Twitter has been striving to balance protecting free speech at the one-to-many messaging service with not providing a stage for extremist groups to spread violent messages and enlist people to their causes. 

In February, Twitter said that it had neutralized 125,000 accounts for violating rules against violent threats and promotion of terrorism. 

“Since that announcement, the world has witnessed a further wave of deadly, abhorrent terror attacks across the globe,” Twitter said in a blog post.
 
“We strongly condemn these acts and remain committed to eliminating the promotion of violence or terrorism on our platform.” 

Daily suspensions of accounts are up more than 80 percent since last year, and spike in the immediate aftermath of terror attacks, according to Twitter. 

Twitter said that it is getting quicker at identifying extremist content and shutting down accounts involved, resulting in dramatic decreases in the number of followers attracted while posts are active. 

Enlisting Software 

Moves have been made to make it tougher for people behind suspended accounts to immediately return to Twitter, and teams reviewing reports of suspected terror content have been expanded. 

Like Twitter, Facebook and YouTube rely heavily on users to point out posts that violate standards or policies. 

Tech titans have been increasingly dabbling with enlisting software to battle extremist propaganda. 

“There is no one ‘magic algorithm’ for identifying terrorist content on the Internet,” Twitter said in the post. “But, we continue to utilize other forms of technology, like proprietary spam-fighting tools, to supplement reports from our users and help identify repeat account abuse.” 

During the past six months, automated tools have helped Twitter identify more than a third of the accounts suspended for promoting terrorism, according to the company. 

Twitter said that it collaborates with other online social platforms in the fight against terror content. 

Since dreadful attacks in Paris and the city of San Bernardino in California, pressure has been growing for online social networks to thwart extremist groups from taking advantage of their platforms.
 

Legal Shield

A US judge last week tossed out a lawsuit accusing Twitter of abetting terrorism by allowing Islamic State (IS) group propaganda to be broadcast using the messaging platform. 

District Court Judge William Orrick granted a motion by Twitter to dismiss the case, reasoning that providing a platform for speech is within the law and that the company did not create the content. 

The Communications Decency Act (CDA) protects online platforms from being held responsible for what users post. 

The suit was filed in San Francisco federal court by the families of two government contractors killed late last year while working at a police training center run by the United States in Amman, according to court documents. 

A Jordanian police captain studying at the center fatally shot the two men, and IS later claimed the captain was a “lone wolf” working for the group’s cause, the judge recounted in his ruling. 

“As horrific as these deaths were, under the CDA Twitter cannot be treated as a publisher or speaker of ISIS’s hateful rhetoric and is not liable under the facts alleged,” Orrick said in the decision, using another name for IS. 

The suit accused Twitter of providing “material support” by letting accounts spread the message of the extremist group. 

The judge left open the option of refiling an amended version of the suit.


Source:  Vanguard
Read More