Combining android sqlite with rating bar

Urgent: Need help with this, my application is able to start just that I’m only able to add the name and rating only once. After that, I’m not able to update the name or design even though it display results updated.

Below are my codes

Scenario:

Name: (Allow user to enter name)

Rating design: (Rating bar)

Add (allow user to add their name and ratings)

Update (Allow user to update to make changes)

Listview (Display the name and the ratings)

AndroidManifest.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
   >
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="left">

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_margin="10dp">
            <ImageView
                android:layout_width="150dp"
                android:layout_height="50dp"
                android:scaleType="fitXY"
                android:src="@drawable/logo_jpg" />
        </TableRow>
       <TableRow
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"
           android:layout_margin="10dp">
           <TextView
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:textColor="#000000"
               android:text="Name:"
               android:textStyle="bold"/>
           <EditText
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:id="@+id/editText"
               android:ems="10"/>
       </TableRow>
        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_margin="10dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#000000"
                android:text="Rate Design:"
                android:textStyle="bold"/>
            <RatingBar
                android:id="@+id/ratingBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:numStars="5"
                android:stepSize="1.0"
                android:rating="0.0" />
        </TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button"
                android:layout_alignParentLeft="true"
                android:layout_alignParentRight="true"
                android:layout_below="@id/ratingBar"
                android:onClick="AddResult"
                android:text="Add"/>

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button2"
                android:layout_alignParentLeft="true"
                android:layout_alignParentRight="true"
                android:layout_below="@id/button"
                android:onClick="UpdateResult"
                android:text="Update"/>
        <LinearLayout>
            <ListView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/listView"
                android:layout_alignParentLeft="true"
                android:layout_below="@id/button2">
                </ListView>
        </LinearLayout>
    </TableLayout>
</ScrollView>
</LinearLayout>

read more

Combining android sqlite with rating bar

Urgent: Need help with this, my application is able to start just that I’m only able to add the name and rating only once. After that, I’m not able to update the name or design even though it display results updated.

Below are my codes

Scenario:

Name: (Allow user to enter name)

Rating design: (Rating bar)

Add (allow user to add their name and ratings)

Update (Allow user to update to make changes)

Listview (Display the name and the ratings)

AndroidManifest.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
   >
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="left">

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_margin="10dp">
            <ImageView
                android:layout_width="150dp"
                android:layout_height="50dp"
                android:scaleType="fitXY"
                android:src="@drawable/logo_jpg" />
        </TableRow>
       <TableRow
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"
           android:layout_margin="10dp">
           <TextView
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:textColor="#000000"
               android:text="Name:"
               android:textStyle="bold"/>
           <EditText
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:id="@+id/editText"
               android:ems="10"/>
       </TableRow>
        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_margin="10dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#000000"
                android:text="Rate Design:"
                android:textStyle="bold"/>
            <RatingBar
                android:id="@+id/ratingBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:numStars="5"
                android:stepSize="1.0"
                android:rating="0.0" />
        </TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button"
                android:layout_alignParentLeft="true"
                android:layout_alignParentRight="true"
                android:layout_below="@id/ratingBar"
                android:onClick="AddResult"
                android:text="Add"/>

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button2"
                android:layout_alignParentLeft="true"
                android:layout_alignParentRight="true"
                android:layout_below="@id/button"
                android:onClick="UpdateResult"
                android:text="Update"/>
        <LinearLayout>
            <ListView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/listView"
                android:layout_alignParentLeft="true"
                android:layout_below="@id/button2">
                </ListView>
        </LinearLayout>
    </TableLayout>
</ScrollView>
</LinearLayout>

read more

Cannot execute sample OpenCL code

My Hardware is :

1) Intel Xeon E5-2650 Processor

2) Nvidia GTX 680 GPU

I am using Windows 7 Professional 64-bit.

According to the online instructions provided by Intel, I installed the OpenCL drivers and runtime along with Intel INDE.

I have latest Nvidia drivers 358.50 installed.

I am using Eclipse CDT as my IDE for OpenCL. Using following code in C++ project file Test.cpp

#include<iostream>
#include<CL/cl.h>
using namespace std;
int main()
{
    cl_int err;
    cl_uint numPlatforms;
    err = clGetPlatformIDs(0,NULL,&numPlatforms);
    if (CL_SUCCESS == err)
        cout << "\nDetected OpenCL platforms: " << numPlatforms;
    else
        cout << "\nError calling clGetPlatformIDs. Error code: " << err;
    return 0;
}

I have succesfully linked the required OpenCL.lib file from Intel provided SDK as well as the include folder for loading the header files in Eclipse.
However after a successful Build I am unable to execute the binary file.

I get an error that the exe file has stopped working. Using Microsoft Visual Studio to Debug i get an error:-

Unhandled exception at 0x00000000004017D0 in OpenCL.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

read more

Bon Apetit! Six of the Best WordPress Restaurant Menu Plugins

With approximately 1 million restaurants in the US alone, consumers are faced with an impressive selection of culinary options from which to pick. But while all these dining options are positive for consumers, it also means that restaurant owners are facing increased competition.

Technology is probably the last thing that you expected to have an impact on the restaurant industry, but it’s absolutely true. In fact, the National Restaurant Association reported some pretty interesting statistics in their 2015 Restaurant Industry Forecast including:

read more

CorePlot – Scatter Plot issue using the Custom Labels

Im trying to draw a scatter plot and after exploring a while got the axis labels right. I’m using the label policy as none and added my own custom labels. But for some reason it just draws a straight line, even though I have used the sample data differently. Here’s the pic of the graph from the simulator

enter image description here

And the code I’m using:

- (void)viewDidLoad {

[super viewDidLoad];
self.startDate = @"09 Oct 15";
self.endDate = @"10 Oct 15";
self.yAxisLabels = [[NSMutableArray alloc] init];
CGFloat startPrice = 1.23445;
for (int i=0;i<24;i++) {
    startPrice += 0.00001;
    [self.yAxisLabels addObject:[NSString stringWithFormat:@"%f",startPrice]];
}
[self configureHost];
[self configureGraph];
[self configureAxis];
[self configurePlot];

// Do any additional setup after loading the view, typically from a nib.
}

- (void)configureHost {
  self.hostView = [[CPTGraphHostingView alloc]   initWithFrame:self.view.bounds];
[self.view addSubview:self.hostView];

}
 - (void)configureGraph {

CPTGraph *graph = [[CPTXYGraph alloc] initWithFrame: self.hostView.bounds];
CPTTheme *theme = [CPTTheme themeNamed:kCPTPlainWhiteTheme];
[graph applyTheme:theme];
graph.plotAreaFrame.paddingLeft = 50.0f;
graph.plotAreaFrame.paddingBottom = 60.0f;
graph.plotAreaFrame.borderLineStyle = nil;
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) graph.defaultPlotSpace;
NSTimeInterval xLow       = 0.0;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(xLow) length:CPTDecimalFromDouble(24.0)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0) length:CPTDecimalFromDouble(30.0)];
self.hostView.hostedGraph = graph;


}

 - (void)configureAxis {

 // NSDate *refDate = [NSDate dateWithTimeIntervalSinceReferenceDate:31556926 * 10];

CPTMutableLineStyle *axisLineStyle = [CPTMutableLineStyle lineStyle];
axisLineStyle.lineWidth = 1.0f;
axisLineStyle.lineColor = [CPTColor blackColor];
CPTMutableTextStyle *axisTextStyle = [[CPTMutableTextStyle alloc] init];
axisTextStyle.color = [CPTColor lightGrayColor];
axisTextStyle.fontName  = @"Helvetica";
axisTextStyle.fontSize  =  10.0f;
CPTMutableLineStyle *tickLineStyle = [CPTMutableLineStyle lineStyle];
tickLineStyle.lineColor = [CPTColor blackColor];
tickLineStyle.lineWidth = 1.0f;
CPTMutableLineStyle *majorGridLineStyle = [CPTMutableLineStyle lineStyle];
tickLineStyle.lineColor = [CPTColor darkGrayColor];
tickLineStyle.lineWidth = 1.0f;
CPTMutableLineStyle *minorGridLineStyle = [CPTMutableLineStyle lineStyle];
tickLineStyle.lineColor = [CPTColor lightGrayColor];
tickLineStyle.lineWidth = 0.3f;

// 2 - Get axis set
CPTXYAxisSet *axisSet = (CPTXYAxisSet *) self.hostView.hostedGraph.axisSet;

axisSet.yAxis.tickDirection = CPTSignNegative;
axisSet.xAxis.tickDirection = CPTSignNone;
axisSet.yAxis.labelingPolicy = CPTAxisLabelingPolicyNone;
axisSet.xAxis.labelingPolicy = CPTAxisLabelingPolicyNone;

//Configuring X-axis
CPTXYAxis *x = axisSet.xAxis;
x.axisLineStyle = axisLineStyle;
x.labelTextStyle = axisTextStyle;
x.majorTickLineStyle = tickLineStyle;
x.majorIntervalLength = CPTDecimalFromFloat(oneDay/6);
x.majorTickLength = 10.0f;
x.minorTickLength = 1.0f;
x.minorTickLineStyle = tickLineStyle;
x.minorTicksPerInterval = 5.0f;
x.majorGridLineStyle = majorGridLineStyle;
x.minorGridLineStyle = minorGridLineStyle;
x.labelOffset = 15.0f;
NSArray *customTickLocations = [NSArray arrayWithObjects:[NSDecimalNumber numberWithInt:0],
                                [NSDecimalNumber numberWithInt:6],
                                [NSDecimalNumber numberWithInt:12],
                                [NSDecimalNumber numberWithInt:18],
                                [NSDecimalNumber numberWithInt:23],
                                 nil];

NSArray *customXAxisLabels = [NSArray arrayWithObjects:self.startDate,@"6 AM",@"12 PM",@"6 PM",self.endDate, nil];
NSUInteger labelLocation = 0;
NSMutableArray *customLabels = [NSMutableArray arrayWithCapacity:[customXAxisLabels count]];
for (NSNumber *tickLocation in customTickLocations) {
    CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText: [customXAxisLabels objectAtIndex:labelLocation++] textStyle:x.labelTextStyle];
    newLabel.tickLocation = [tickLocation decimalValue];
    newLabel.offset = axisSet.xAxis.labelOffset + axisSet.xAxis.majorTickLength;
    [customLabels addObject:newLabel];

}
x.axisLabels = [NSSet setWithArray:customLabels];
x.majorTickLocations = [NSSet setWithArray:customTickLocations];


//Configuring Y-axis
CPTXYAxis *y=axisSet.yAxis;
//y.orthogonalCoordinateDecimal = CPTDecimalFromDouble(-0.5);
y.axisLineStyle = axisLineStyle;
y.labelTextStyle = axisTextStyle;
y.majorTickLineStyle = axisLineStyle;
y.majorIntervalLength = CPTDecimalFromFloat(5.0f);
y.majorTickLength = 3.0f;
y.minorTickLength = 1.0f;
y.minorTickLineStyle = tickLineStyle;
y.minorTicksPerInterval = 5.0f;
y.majorGridLineStyle = majorGridLineStyle;
y.minorGridLineStyle = minorGridLineStyle;
y.labelOffset = 3.0f;


NSMutableArray *customYAxisLabels = [NSMutableArray arrayWithCapacity:[self.yAxisLabels count]];
for (NSNumber *tickLocation in customTickLocations) {
    CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText: [self.yAxisLabels objectAtIndex:[tickLocation integerValue]] textStyle:axisSet.yAxis.labelTextStyle];
    newLabel.tickLocation = [tickLocation decimalValue];
    //newLabel.majorTickLocations = [tickLocation decimalValue];
    newLabel.offset = axisSet.yAxis.labelOffset + axisSet.yAxis.majorTickLength;
    [customYAxisLabels addObject:newLabel];

}
y.axisLabels = [NSSet setWithArray:customYAxisLabels];
y.majorTickLocations = [NSSet setWithArray:customTickLocations];



 }
  - (void)configurePlot {

CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] init];
dataSourceLinePlot.identifier = @"Data Source Plot";

CPTGraph *graph = self.hostView.hostedGraph;

CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) graph.defaultPlotSpace;
NSTimeInterval xLow       = 0.0;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(xLow) length:CPTDecimalFromDouble(24.0)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0) length:CPTDecimalFromDouble(30.0)];

CPTMutableLineStyle *lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy];
lineStyle.lineWidth              = 3.0;
lineStyle.lineColor              = [CPTColor greenColor];
dataSourceLinePlot.dataLineStyle = lineStyle;


[graph addPlot:dataSourceLinePlot];


// Add plot symbols
CPTMutableLineStyle *symbolLineStyle = [CPTMutableLineStyle lineStyle];
symbolLineStyle.lineColor = [CPTColor blackColor];
CPTPlotSymbol *plotSymbol = [CPTPlotSymbol ellipsePlotSymbol];
plotSymbol.fill               = [CPTFill fillWithColor:[CPTColor blueColor]];
plotSymbol.lineStyle          = symbolLineStyle;
plotSymbol.size               = CGSizeMake(2.0, 2.0);
dataSourceLinePlot.plotSymbol = plotSymbol;
dataSourceLinePlot.dataSource = self;

  }

  #pragma mark - CPTPlotDataSource methods
  -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot {
return [self.yAxisLabels count];
  }

   -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index {
NSInteger valueCount = [self.yAxisLabels count];
switch (fieldEnum) {
    case CPTScatterPlotFieldX:
        if (index < valueCount) {
            NSLog(@"x value >>> %lu",(unsigned long)index);
            return [NSNumber numberWithUnsignedInteger:index];
        }
        break;

    case CPTScatterPlotFieldY:
        if ([plot.identifier isEqual:@"Data Source Plot"] == YES) {
            NSLog(@"y value >>> %@",[self.yAxisLabels objectAtIndex:index]);
            return [self.yAxisLabels objectAtIndex:index];
        }
        break;
}
return [NSDecimalNumber zero];

 }

read more