Saturday, April 7, 2018

Swift uipickerView example



The reason I am posting this source code is that I was doing research for a project and came to the understanding that there are not many examples which demonstrate how to use Swift uipickerView in Xcode with one picker and many numbers to choose from.
  This particular example has two uipickerViews and two labels where the info from the uipickerView is sent to the labels.   This is not a full tutorial however it is a guide for someone who knows what they are doing in Swift but needs a quick example of a uipickerView in action.

import UIKit

class SettingsTableViewController: UITableViewControllerUIPickerViewDataSourceUIPickerViewDelegate {

    @IBOutlet weak var beginningPickerView: UIPickerView!
    @IBOutlet weak var endingPickerView: UIPickerView!
    @IBOutlet weak var beginningPickerViewLabel: UILabel!
    @IBOutlet weak var endingPickerViewLabel: UILabel!
    
    var picker: UIPickerView!
    var beginningPicker: UIPickerView!
    var beginningPickerSegue: String?
    var endingPickerSegue: String?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        picker = UIPickerView()
        picker.dataSource = self
        picker!.delegate = self
        picker.center = view.center
        view.addSubview(picker)
        
        beginningPicker = UIPickerView()
        beginningPicker.dataSource = self
        beginningPicker!.delegate = self
        view.addSubview(beginningPicker)
   
        self.pickerView(endingPickerView, didSelectRow: 1000, inComponent: 0)
        //endingPickerView.selectRow(1000, inComponent: 0, animated: false)
        
    }
    
    func numberOfComponents(in pickerView: UIPickerView) -> Int {
        if pickerView == picker {
            return 1
        } else if pickerView == beginningPicker {
            return 1
        }
        return 0
    }
   
    func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
        if pickerView == picker {
            return 1000
        } else if pickerView == beginningPicker {
            return 1000
        }
        return 0
    }
    
    func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
        return "\(row + 1)"
        
    }
    
    //this updates the label to reflect pickerView value
    func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
        
        let selectedValueEndingPickerView = pickerView.selectedRow(inComponent: 0)
        let selectedBeginningPickerView = pickerView.selectedRow(inComponent: 0)
        
        if pickerView == beginningPicker {
            
            beginningPickerViewLabel.text = String(selectedBeginningPickerView + 1)
            beginningPickerSegue = String(selectedBeginningPickerView + 1)
            
        } else if pickerView == picker {
            endingPickerViewLabel.text = String(selectedValueEndingPickerView + 1)
            endingPickerSegue = String(selectedValueEndingPickerView + 1)
        }
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
        if (segue.identifier == "unwindToStart") {
            let svc = segue.destination asServerViewController
            svc.serverNumberLowLabel.text = beginningPickerSegue
            svc.serverNumberHighLabel.text = endingPickerSegue
        }
    }
    

}

Thank you for reading.



If this helped you great.  If you need more info to keep researching because I am a beginner and still learning myself.




Check out this app Link to Google play app

Saturday, September 30, 2017

PHP Delimiters





What are PHP delimiters?

     Php delimiters are used to embed PHP code on an HTML web page.  

     The four main methods for marking PHP code in a page are like this. Here is the default method <?php "CODE"; ?>, the shorthand version <? "CODE"; ?>, the script version which is like this <script language = "php> "CODE"; </script> , and the ASP method like this <% "CODE"; %>.  

     The problem with the short tag syntax (<? "CODE"; ?>) is that it has to be enabled using a short_open_tag directive and some servers might not be configured execute the shorthand. However short tag syntax could save you some time if you don't like typing out the default tag.  

     This script tag (<script language = "php> "CODE"; </script>) is beneficial if you have an editor that doesn't do well with the standard delimiter syntax, but it can take longer to type so it might be beneficial to find a new editor if you have trouble using default escape tags.  

     The ASP method (<% "CODE"; %>) is used to separate dynamic PHP from static however it is recommended that you do not use the ASP method because it is a not a common delimiter and might cause problems.  

Thanks for reading.  

Check out this Truth or Dare game.
https://play.google.com/store/apps/details?id=com.calebsapps.mynam.truthordare
References:

Sunday, July 9, 2017

Can a Proxy Server Protect My Personal Information




What Is a Proxy Server?

A proxy server is a server that sits between a computer and access to the World Wide Web.  It can be used to benefit a user who needs anonymity and a company who wants to block access to certain sites on the Web. 


Blocks Internet Access

Some companies set up proxy servers so their employees have restricted access to the internet.  The proxy server routes the internet access through a server which only then allows access to the websites that are not blocked.  This is one of the most common uses for a proxy server. 

Proxies can hide your identity 

If a proxy server is configured properly it can block the information that is normally sent through a website from the user.  This information typically means your IP address, your location, your ISP.  The proxy can also protect you from cookies being put on your computer giving away more personal information such as browsing history, shopping info, and other personal information.

Proxies can also be bad

Some proxy servers can do the opposite of protecting you.  If you log onto them they can do the same things as downloading a virus they can install software that can harm your computer or steal personal information.  So if you decide to use a proxy server make sure that you do so after researching the site where the server is hosted.  

You can always use a proxy server to look out for your safety as well as the safety of others as long as you do your research. And normally proxy sites are not blocked by most company's allowing for a loophole in the security process(hint hint).



Happy Surfing!

Thanks for reading.

Tuesday, November 22, 2016

Christmas Trivia Answers


Here is the link to this trivia app in case you link onto the answer page first:
https://play.google.com/store/apps/details?id=calebsapps.com.christmastriviagame2&hl=en

Answers for Christmas Trivia

Question 1:  Who's birthday is being celebrated on December 25th? 

Answer 1: Jesus Christ.

Question 2: Which was the first state to recognize Christmas as  a official holiday?

Answer 2: Alabama

Question 3:  Which company was the first to use Santa Clause in a advertising commercial?

Answer 3:  Cocoa Cola.

Question 4:  How many points does a snowflake have?

Answer 4:  Six.

Question 5:  What is the traditional ornament placed at the top of the Christmas Tree?

Answer 5: An Angel.

Question 6:  What country can be credited with the creation of egg nog?

Answer 6: England.

Question 7: What do kids traditionally leave out for Santa Clause to eat?

Answer 7: Milk and Cookies.

Question 8:  From what country does the poinsettia plant originate?

Answer 8: Mexico.

Question 9:  What color are the berries from the Mistletoe?

Answer 9: White.

Question 10:  What was the name of Ebenezer Scrooge's partner in the Christmas Carol, the play?

Answer 10: Jacob Marley.

Question 11:  How many gifts are actually given on the 12 days of Christmas?

Answer 11: 364.

Question 12: What would the other reindeers not let Rudolph do?

Answer 12:  Play in all the reindeer games.

Question 13:  What color was the Grinch who stole Christmas?

Answer 13:  Green.

Question 14:  Who's eye's are made of coal:

Answer 14:  Frosty's.

Question 15:  Which 3D puzzle sold by Ideal Toy Corp., was the most popular Christmas gift in 1980?

Answer 15: Rubik's Cube.

Question 16: What was the name of the character played by Macauley Culkin in the movie Home Alone?

Answer 16:  Kevin Mccallister.

Question 17:  What type of pet is 'Santa's Little Helper' in the TV cartoon series, The Simpsons?

Answer 17:  A dog.

Question 18:  Who tried to steal Christmas from the \"Who's of Whoville\" in the 1966 cartoon based on the Dr. Seuss Story?

Answer 18: The Grinch.

Question 19:  What part of the turkey is saved and pulled apart as a superstitious good luck custom?

Answer 19: Wishbone.

Question 20: What is \"Frosty the Snowman's\" nose made of?

Answer 20: A button.

Question 21:  What river did Washington cross on Christmas Eve?

Answer 21: The Delaware.

Question 22: What is the biggest selling music christmas single of all time?

Answer 22: White Christmas.

Question 23:  What was the last ghost called in "A Christmas Carol"?

Answer 23:  The ghost of Christmas yet to come.

Question 24:  In "A Charlie Brown Christmas" who plays the dusty innkeeper in the Christmas play?

Answer 24:  Pigpen.

Question 25:  In what town was Jesus born?

Answer 25: Bethlaham.

Question 26:  Yule Log cake is the traditional Christmas cake served in which European country?

Answer 26: Israel

Question 27: How tall was the tallest Christmas tree?

Answer 27: 221 feet.

Question 28:  In the movie "A Christmas Carol" how many ghosts visited Scrooge?

Answer 28: Four.

Question 29:  How many years are trees used as a Christmas tree's grown?

Answer 29: 15 Years.

Question 30:What does the letter X stand for in X-mas?

Answer 30: Jesus Christ.

Question 31:What state do all letters addressed to Santa go to?

Answer 31: Indiana.

Question 32:Feliz Navidad is Happy Christmas in which language?

Answer 32:  Spanish.

If you enjoyed this app check out my thanksgiving one.  
http://www.calebsapps.com/2016/11/thanksgiving-trivia-app.html

And this truth or Dare one  https://play.google.com/store/apps/details?id=com.calebsapps.mynam.truthordare or my sites link : Link to Google play Truth or Dare game

Sunday, November 6, 2016

Thanksgiving Trivia app!



Check out this guy in my new app on google play!

It's a Thankgiving trivia app.

You can download it here for free!

https://play.google.com/store/apps/details?id=calebsapps.com.thanksgiving1&hl=en

Answers for Thanksgiving Trivia/Quiz


Answers

Here are the answers to the Thanksgiving Quiz.  Don't forget to memorize the answers and play again!

Question 1: What day each year does thanksgiving occur on in the United States? Answer: The fourth Thursday of November. Question 2: Which was the first state to practice thanksgiving in 1855? Answer: Virginia. Question 3: How many feathers does a adult turkey have? Answer: 5,000 to 6,000. Question 4: What was the name of the American Indian tribe who helped the pilgrims grow the food for thanksgiving? Answer: Wampanoag tribe. Question 5: How many days was the original Thanksgiving celebration? Answer: 3 days. Question 6: What year was the fourth thursday of November declared a federal U.S. Holiday? Answer: 1941. Question 7: What was the name of the ship the pilgrims sailed in to discover America? Answer: Mayflower. Question 8: Where in Massachusetts did the pilgrims celebrate Thanksgiving? Answer: Plymouth. Question 9:The pilgrims sailed what ocean to reach America? Answer: Atlantic Ocean. Question 10:How many of the pilgrims died before the first Thanksgiving? Answer: 50 Percent. Question 11: What other country observes Thanksgiving as national holiday? Answer: Canada. Question 12: What does cornucopia mean? Answer: Horn of plenty. Question 13: What food do we not eat, that the pilgrims ate at the first Thanksgiving? Answer: Codfish. Question 14: What is the name of the famous rock where the Pilgrims first landed? Answer: Plymouth Rock. Question 15: What was the original name of the Pilgrims? Answer: Puritans. Question 16: What year did the first Thanksgiving take place? Answer: 1621. Question 17: Which type of Turkey is called a Gobbler? Answer: A male. Question 18: What is the chemical in Turkey meat that some believe make you sleepy after eating? Answer: Tryptophan. Question 19: What part of the turkey is saved and pulled apart as a superstitious good luck custom? Answer: Wishbone. Question 20: What religion is the main affiliate of Thanksgiving? Answer: Thanksgiving has no religious affiliations. Question 21: How many pilgrims were on the Mayflower? Answer: 102 Question 22: What is a Turduckin? Answer: A duck cooked in a chicken cooked in a turkey. Question 23: How fast can a wild turkey run on the ground when scared? Answer: 20 Miles per hour. Question 24: How heavy was the world record Turkey? Answer: 86 Pounds Question 25: What was the drink of choice for the pilgrims? Answer: Beer. Question 26: Which country consumes the most Turkey per capita? Answer: Israel. Question 27: Which vegetable did the pilgrims have but not eat because they thought it was poisonous? Answer: Potato. Question 28: What is the name of the famous Thanksgiving parade hosted in New York every year? Answer: Macy's Day Parade. Question 29: What is the traditional pie served at Thanksgiving dinner? Answer: Pumpkin Pie. Question 30: When Neil Armstrong and Buzz Aldrin ate their first meal on the moon what was it? Answer: A turkey dinner. Question 31: What is typically stuffed into turkey's and then baked? Answer: Seasoned bread (stuffing). Question 32: How many turkey's are eaten each Thanksgiving? Answer: 46 million.

Sunday, October 2, 2016

Fun FREE app! Halloween trivia!


Due to a lack of interest, this app has been disabled on the Play Store.


I have made a multiple choice version of  my Halloween app.

Have fun and please download  


also on google play:
https://play.google.com/store/apps/details?id=calebsapps.com.triviatest2&hl=en

And don't forget to get your Halloween Costume. This quiz should help you find it!
http://www.seventeen.com/life/life-quizzes/a27465/halloween-costume-quiz/

Top costumes this year for individuals will be : Harley Quinn, Joker, "Some" super hero and Pirates!

Try a Trump or Hillary costume if you don't like them try a Scary Clown.

Featured Post

Washington State Poisonous Toad

The Western Toad pictured above can be green or brown and is always covered in warts.  (This is the frog he tried to eat) One w...