mercredi 5 octobre 2016

I am trying to format a horizontal navigation list

Vote count: 0

So I want to format a horizontal navigation list. In my HTML page it says: <nav class="horizontal">

So in my css file I put this but it doesnt seem to work:

 Nav.Horizontal {
    background-color:rgb(0,0,0);
    color: rgb(255,255,255);
    font-weight: bold;
    font-size:10px;
    letter-spacing:3px;
}

a:Nav.Horizontal {
    color:rgb(255,0,0)
}

asked 24 secs ago

Let's block ads! (Why?)



I am trying to format a horizontal navigation list

Swift In App Purchases Tutorial, Confused over Button to Method Linking.

Vote count: 0

i am fairly new IOS developer, but have recently managed to get IAP working by following this tutorial.

http://ift.tt/25yjA8d

Now this all works, and items are displayed in a listview with a buy button generated when a item is detected as purchasable.

Now what I am confused about is the following:

1.How to induce the payment method from a seperate view controller, i can not see any calls to buy the product from the existing buttons?

2.How would they know what product i was wanting to buy, how is the product reference being passed through when buying a product.

Looking through the code i am struggling to understand these 2 vital elements.

Code attached below

Thanks

Product Cell class, appears to dynamically create buy button in the table view based on the products available from the store import UIKit import StoreKit

class ProductCell: UITableViewCell {
   static let priceFormatter: NumberFormatter = {
let formatter = NumberFormatter()

formatter.formatterBehavior = .behavior10_4
formatter.numberStyle = .currency

return formatter
  }()

  var buyButtonHandler: ((_ product: SKProduct) -> ())?

  var product: SKProduct? {
    didSet {
  guard let product = product else { return }

  textLabel?.text = product.localizedTitle

  if RageProducts.store.isProductPurchased(product.productIdentifier) {
    accessoryType = .checkmark
    accessoryView = nil
    detailTextLabel?.text = ""
  } else if IAPHelper.canMakePayments() {
    ProductCell.priceFormatter.locale = product.priceLocale
    detailTextLabel?.text = ProductCell.priceFormatter.string(from: product.price)

    accessoryType = .none
    accessoryView = self.newBuyButton()
  } else {
    detailTextLabel?.text = "Not available"
  }
}
   }

  override func prepareForReuse() {
super.prepareForReuse()

textLabel?.text = ""
detailTextLabel?.text = ""
accessoryView = nil
  }

  func newBuyButton() -> UIButton {
let button = UIButton(type: .system)
button.setTitleColor(tintColor, for: UIControlState())
button.setTitle("Buy", for: UIControlState())
button.addTarget(self, action: #selector(ProductCell.buyButtonTapped(_:)), for: .touchUpInside)
button.sizeToFit()

    return button
 }

  func buyButtonTapped(_ sender: AnyObject) {
buyButtonHandler?(product!)
  }
}

RageProducts, contains product identifiers for products in itunes connect

 import Foundation

 public struct RageProducts {

  public static let Item1 = "com.justlift.Recipe1"
  public static let Item2 = "com.justlift.Test"

 fileprivate static let productIdentifiers: Set<ProductIdentifier> =[RageProducts.Item1,Item2]

  public static let store = IAPHelper(productIds:  RageProducts.productIdentifiers)
     }

 func resourceNameForProductIdentifier(_ productIdentifier: String) -> String?     {
   return productIdentifier.components(separatedBy: ".").last
      }

asked 31 secs ago

Let's block ads! (Why?)



Swift In App Purchases Tutorial, Confused over Button to Method Linking.

How to call Rest API in php with GET method?

Vote count: 0

I have API with url, type (method) i.e. GET , user-agent, accept type.

using these I have to call API

So how can I call these API using Core PHP.

I got some answers with php curl but want to know other options in php

Thanks

asked 6 secs ago

Let's block ads! (Why?)



How to call Rest API in php with GET method?

App Engine development server fails to execute task and with no stack trace whatsoever

Vote count: 0

I'm currently trying to queue tasks in App Engine using the Flask framework, but I'm having some difficulty. I run my code, and it seems like the tasks are queued properly when I check the admin server at localhost:8000/taskqueue. However, the console repeatedly print the following error:

`
WARNING  2016-10-05 17:08:09,560 taskqueue_stub.py:1981] Task task1 failed to execute. This task will retry in 0.100 seconds
`

Furthermore, it doesn't seem like the desired code is being executed.

My question is, why isn't my code working? I apologize for the very broad question, however there's no stack trace to guide me through to something more specific. I've simplified my code however to make my error reproducible. The code below should print the phrase "sample task" onto the console 5 times. However, this does not occur.

`
#main.py

from google.appengine.api.taskqueue import taskqueue
from flask import Flask, Response

app = Flask(__name__)

@app.route("/get")
def get():
    for i in range(5):
        # attempt to execute the desired function 5 times
        # the message "sample task" should be printed to the console five times
        task = taskqueue.add(
            queue_name='my-queue',
            url='/sample_task',
        )
        message += 'Task {} enqueued, ETA {}.<br>'.format(task.name, task.eta)

    response = Response(message)
    return response

@app.route("/sample_task")
def sample_task():
    message = "sample task"
    print (message)
    return Response(message)


if __name__ == "__main__":
    app.run()
`

app.yaml

`
# app.yaml

runtime: python27
api_version: 1
threadsafe: true

# [START handlers]
handlers:
- url: /sample_task
  script: main.app
  login: admin

- url: /get
  script: main.app
  login: admin
`

queue.yaml

`
# queue.yaml

queue:
- name: my-queue
  rate: 1/s
  bucket_size: 40
  max_concurrent_requests: 1
`

asked 10 secs ago

Let's block ads! (Why?)



App Engine development server fails to execute task and with no stack trace whatsoever

How to switch images in a C# WPF application?

Vote count: 0

I am trying to make an application that switches between an image of the heads sign of a coin and the tails side of a coin. However, every time I press either the "heads" button or the "tails" button, an error occurs. How can I fix my code so that the image successfully switches?

XAML:

<Window x:Class="HeadsOrTails.MainWindow"
    xmlns="http://ift.tt/o66D3f"
    xmlns:x="http://ift.tt/mPTqtT"
    xmlns:d="http://ift.tt/pHvyf2"
    xmlns:mc="http://ift.tt/pzd6Lm"
    xmlns:local="clr-namespace:HeadsOrTails"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <Image 
        x:Name="coinImage"
        HorizontalAlignment="Center"
        Height="100"
        Margin="43,10,374,209"
        VerticalAlignment="Center"
        Width="100"
        Loaded="Image_Loaded"/>
    <Button x:Name="tailsButton" Content="Show Tails" HorizontalAlignment="Center" Height="40" Margin="190,214,197,65" VerticalAlignment="Center" Width="130" Click="tailsButton_Click"/>
    <Button x:Name="headsButton" Content="Show Heads" HorizontalAlignment="Center" Height="40" Margin="43,214,344,65" VerticalAlignment="Center" Width="130" Click="headsButton_Click"/>
    <Button x:Name="exitButton" Content="Exit" HorizontalAlignment="Center" Height="40" Margin="339,214,48,65" VerticalAlignment="Center" Width="130" Click="exitButton_Click"/>

</Grid>
</Window>

C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Media;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HeadsOrTails
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }

    private void Image_Loaded(object sender, RoutedEventArgs e)
    {

    }

    private void tailsButton_Click(object sender, RoutedEventArgs e)
    {
        //create a second bitmap image (tails)
        BitmapImage c = new BitmapImage();
        c.BeginInit();
        c.UriSource = new Uri(@"C:\Users\Raymond Karrenbauer\Documents\Visual Studio 2015\Projects\HeadsOrTails\tails.jpg");
        c.EndInit();

        var image = sender as Image;
        image.Source = c;
    }

    private void headsButton_Click(object sender, RoutedEventArgs e)
    {
        //create the new bitmap image (heads)
        BitmapImage b = new BitmapImage();
        b.BeginInit();
        b.UriSource = new Uri(@"C:\Users\Raymond Karrenbauer\Documents\Visual Studio 2015\Projects\HeadsOrTails\heads.jpg");
        b.EndInit();

        var image = sender as Image;
        image.Source = b;
    }

    private void exitButton_Click(object sender, RoutedEventArgs e)
    {
        this.Close();
    }
}
}

asked 49 secs ago

Let's block ads! (Why?)



How to switch images in a C# WPF application?

SQL - Only return when no rows hold a value

Vote count: 0

I am looking for a way to return an ID only if NO rows hold a certain value

For example:

ID | Date

1 | 01/01/2001

1 | 02/02/2002

1 | 03/03/2003

If I want SQL to return the ID only if no dates are equal to 02/02/2002, how would I script that? I have tried and failed with the below:

select ID

from (example)

where date != 02/02/2002

The problem is that this still returns the ID - 1, as the first and last row do not equal 02/02/2002. What I am aiming for is no returned results because at least one row held the matching date.

I would need the script to completely skip the ID when there is a matching date in any row.

For clarity the below should return the ID when using the same 'select' as above because no dates are matching:

ID | Date

2 | 03/03/2003

2 | 04/04/2004

2 | 05/05/2005

asked 52 secs ago

Let's block ads! (Why?)



SQL - Only return when no rows hold a value

mardi 22 mars 2016

handling large amounts of data using the google maps api

I'm designing an android application where a user can enter there address and it will fetch a list of bars/clubs/eateries within a 300 miles radius.

The way it currently works is, The user inputs his/her address and the app sends a call to a RESTful service(asp) which then selects every bar/club/eaterie and checks there distance from the users location, puts any within a 300 mile distance into an array and returns the result as json once it's finished.

The problem is this is really slow because it has to select every bar/club/eaterie from the database and calculate the distance(I have roughly 20k rows of data)

The average response time for the entire process (user clicking search to having the information displayed on there phone) is about 6-8 seconds, I would like to get it down to about 1-2 seconds

Is there a better way to go about this ? having to select all of the records and check the distance for each one is what's causing the issue.



handling large amounts of data using the google maps api