dimanche 31 août 2014

NSfetch Request Returns The Same Data Always Not Returns the Updated Data


Vote count:

0




I am developing one iOS Application using core data.Rest kit is using for connect with web services,With the help of rest kit i synched the data from web service and stored in my local core data base.It is working fine for me.When i will call the fetch request the data is getting in correct. But after some time i want the latest updated data from the web service, if i do sync again the latest data is getting and replaced in my bd correctly.But if i try to fetch the latest data the fetch request returns the first data that saved in the data base. But if i restart my application the fetch request returns the updated data.What is the actual problem. I am new in iOS so i do not understand the problem.How I will solve the issue.



asked 17 secs ago







NSfetch Request Returns The Same Data Always Not Returns the Updated Data

flipcard within angularjs directive with limited scope


Vote count:

0




I have this html code with CSS. I want to put this in a directive template and re-use the directive, limiting scope to each element.



<div ng-controller="flipCtrl">
<div class="flip"> <div class="card" ng-class="{'flipped':isFlipped}" ng-click="isFlipped=!isFlipped">
<div class="face front">Project</div>
<div class="face back">TechLead</div>
</div>
</div>
</div>


I am not able to get it to work when I copy the entire text in the html into the template of directive.


the idea is that each flipcard will flip when clicked on it.


CSS



<style>
body {
background: #ccc;
}
.flip {
-webkit-perspective: 800;
width: 400px;
height: 200px;
position: relative;
margin: 50px auto;
}
.flip .card.flipped {
-webkit-transform: rotatex(-180deg);
}
.flip .card {
width: 100%;
height: 100%;
-webkit-transform-style: preserve-3d;
-webkit-transition: 0.5s;
}
.flip .card .face {
width: 100%;
height: 100%;
position: absolute;
-webkit-backface-visibility: hidden ;
z-index: 2;
font-family: Georgia;
font-size: 3em;
text-align: center;
line-height: 200px;
}
.flip .card .front {
position: absolute;
z-index: 1;
background: black;
color: white;
cursor: pointer;
}
.flip .card .back {
-webkit-transform: rotatex(-180deg);
background: blue;
background: white;
color: black;
cursor: pointer;
}
</style>


asked 1 min ago







flipcard within angularjs directive with limited scope

Java 'Date' object size


Vote count:

-1




How to effectively determine the size of a Date object in my memory?


Initially I went through this link which talks about 9 bytes for a date object..


I was trying to find it out when I found this link, where it talks about 32 bytes!!!! for a date object in memory.


Date Object Size in Memory


Kindly help.



asked 2 mins ago

LPD

1,485






Java 'Date' object size

shell script that send email before exiting


Vote count:

0




i am trying to write a shell script that will send me an email before exiting itself


or


as i am running this on an amazon ec2 DEBAIN spot request and it should send me an email before the instances is terminated



#!/bin/bash
sendEmailLog()
{
emailLog=true
if [ $emailLog = "true" ];then
/usr/bin/mpack -s "emailed log" -a "/srv/log.html" "emailid@gmail.com";
fi
exit 0;
}

trap sendEmailLog INT TERM EXIT KILL QUIT

aws ec2 terminate-instances instances ID


asked 38 secs ago

Moses

131






shell script that send email before exiting

if the reply is more than 1 why do not react


Vote count:

0




why not work if more than one answer key:


can not use the key



if (resp == 'open')



but if I replace it with one letter only, then he can work



if (resp == 'y')



or replace it with the number, then he can work



if (resp == 1)



I wish she could write more than one letter



#include <iostream>

using namespace std;

int main(){
char resp;
index:
cout<<endl;
cout<<"just an example of course"<<endl;
cout<<"type {open} to return to the index\n";
cin>>resp;
if (resp == 'open'){
goto index;
}
else if(jawab == 2)
{
return EXIT_SUCCESS;
}



}


asked 1 min ago







if the reply is more than 1 why do not react

Overriding Django allauth login form with ACCOUNT_FORMS


Vote count:

0




I already overrode the signup form with the simple settings variable ACCOUNT_SIGNUP_FORM_CLASS but to override the login form you need to use ACCOUNT_FORMS = {'login': 'yourapp.forms.LoginForm'}. I have the form I want and it displys perfectly with crispy-forms:



class LoginForm(forms.Form):
login = forms.EmailField(required = True)
password = forms.CharField(widget = forms.PasswordInput, required = True)

helper = FormHelper()
helper.form_show_labels = False
helper.layout = Layout(
Field('login', placeholder = 'Email address'),
Field('password', placeholder = 'Password'),
FormActions(
Submit('submit', 'Log me in to Cornell Forum', css_class = 'btn-primary')
),
)


When I submit the form I get AttributeError at /account/login/ - 'LoginForm' object has no attribute 'login'. What's going wrong here? The source for the original allauth login form is here: http://ift.tt/1u5Pplv



asked 25 secs ago

wnajar

414






Overriding Django allauth login form with ACCOUNT_FORMS

NodeJS, Facebook API, xCode


Vote count:

0




I am trying to create an ios App that talks to a backend API written in nodejs. The backend also has an accompanying webapp also written in nodejs. The idea is that you can login (using facebook-js) on either the app or the webapp and post things to to.


My question is this, let's say that the user decided to login using the ios App, then call some backend API method to post an article, how do I make this work without essentially forcing the user to login twice?


Not sure if I'm making sense, any help would be greatly appreciated!



asked 36 secs ago







NodeJS, Facebook API, xCode

NVD3 Charts in a Bootstrap carousel


Vote count:

0




I am rendering multibar charts in a Boostrap carousel using NVD3. After lots of tweaking I am finally able to create a carousel with charts in each item. One thing I noticed is that any chart other than the active item is squished, and it doesn't render until the window is resized. Is there a way to render the charts that aren't active correctly?



asked 38 secs ago







NVD3 Charts in a Bootstrap carousel

In App Purchases not downloading in live app but working in sandbox mode


Vote count:

0




I have an app with in app purchases and I just pushed an update. The IAPs worked in the previous version and work just fine in the sandbox mode, in the new live version, however,when my users click an IAP it asks for their ID, confirms the purchase and says "thank you for your purchase" and charges the user but doesn't actually download the file! The Restore feature also no longer works in the live version (works fine in sandbox mode), the IAPs sort of flicker for a 1/2 second but nothing starts to download.


Has anyone run into an issue like this before? Or have any idea how to fix it? Or how I can debug bug that only shows up in the live version. I'm a relative novice so the more detailed your response the better. - Restore and IAPs don't work in live version - IAPs worked in previous version, I haven't updated the IAPs - IAPS work fine in sandbox mode - I have waited 48 hours for the any issues withs servers to sync up and nothing has changed - The IAPs are hosted by Apple - My Apple ID allows IAPS - All of my contracts are active and up to date



#import "IAPHelper.h"
#import <StoreKit/StoreKit.h>
#import "IAPProduct.h"
#import "VerificationController.h"
#import "IAPProductInfo.h"
#import "IAPProductPurchase.h"
#import "AFNetworking.h"
#import "AFHTTPClient.h"
#import "AFHTTPRequestOperation.h"
#import "NSData+Base64.h"
#import "HMAppDelegate.h"

static NSString *const IAPServerBaseURL =
@"http://ift.tt/1quse2T";
static NSString *const IAPServerProductsURL =
@"/GCC7/IAP/productInfos.plist";
//static NSString *const IAPServerVerifyURL =
//@"/clients/hangman3/"; Needed if I want to verify receipts off my own server

static NSString *const IAPHelperPurchasesPlist =
@"purchases.plist";

@interface IAPHelper () <SKProductsRequestDelegate, SKPaymentTransactionObserver>
@end

@implementation IAPHelper {
SKProductsRequest * _productsRequest;
RequestProductsCompletionHandler _completionHandler;
BOOL _productsLoaded;
}

- (id)init {
if ((self = [super init])) {
_products = [NSMutableDictionary dictionary];



[self loadPurchases];
[self loadProductsWithCompletionHandler:^(BOOL success,
NSError *error) {
}];

}
return self;


}

- (IAPProduct *)addProductForProductIdentifier:
(NSString *)productIdentifier {
IAPProduct * product = _products[productIdentifier];
if (product == nil) {
product = [[IAPProduct alloc]
initWithProductIdentifier:productIdentifier];
_products[productIdentifier] = product;
}
return product;
}

- (void)addInfo:(IAPProductInfo *)info
forProductIdentifier:(NSString *)productIdentifier {

IAPProduct * product = [self
addProductForProductIdentifier:productIdentifier];
product.info = info;

// NSLog(@"product info : %@",product.info);

}


- (void)requestProductsWithCompletionHandler:
(RequestProductsCompletionHandler)completionHandler {

_completionHandler = [completionHandler copy];

[self loadProductsWithCompletionHandler:^(BOOL success,
NSError *error) {

NSMutableSet * productIdentifiers = [NSMutableSet
setWithCapacity:_products.count];
for (IAPProduct * product in _products.allValues) {
if (product.info) {
product.availableForPurchase = NO;
[productIdentifiers
addObject:product.productIdentifier];
}
}

_productsRequest = [[SKProductsRequest alloc]
initWithProductIdentifiers:productIdentifiers];
_productsRequest.delegate = self;
[_productsRequest start];

}];

}

#pragma mark - SKProductsRequestDelegate

- (void)productsRequest:(SKProductsRequest *)request
didReceiveResponse:(SKProductsResponse *)response {

NSArray *invalidproductIdentifiers = response.invalidProductIdentifiers;
for (NSString *invalidProductId in response.invalidProductIdentifiers)
{
// NSLog(@"Invalid product id: %@" , invalidProductId);
}

NSLog(@"Loaded list of products...");
_productsRequest = nil;

// 1
NSArray * skProducts = response.products;
for (SKProduct * skProduct in skProducts) {
IAPProduct * product =
_products[skProduct.productIdentifier];
product.skProduct = skProduct;
product.availableForPurchase = YES;
}

// 2
for (NSString * invalidProductIdentifier in
response.invalidProductIdentifiers) {
IAPProduct * product =
_products[invalidProductIdentifier];
product.availableForPurchase = NO;
// NSLog(@"Invalid product identifier, removing: %@",invalidProductIdentifier);
}

// 3
NSMutableArray * availableProducts = [NSMutableArray array];

for (IAPProduct * product in _products.allValues) {
if (product.availableForPurchase) {
[availableProducts addObject:product];
}
}

_completionHandler(YES, availableProducts);
_completionHandler = nil;


}


- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {

// NSLog(@"Failed to load list of products.");
_productsRequest = nil;

// 5
_completionHandler(FALSE, nil);
_completionHandler = nil;

}

- (void)buyProduct:(IAPProduct *)product {

HMAppDelegate *appDel = (HMAppDelegate*)[[UIApplication sharedApplication]delegate];

appDel.plistDeleteProduct = product.productIdentifier;

// NSAssert(product.allowedToPurchase, @"This product isn't allowed to be purchased!");

// NSLog(@"Buying %@...", product.productIdentifier);

product.purchaseInProgress = YES ;
SKPayment * payment = [SKPayment
paymentWithProduct:product.skProduct];
[[SKPaymentQueue defaultQueue] addPayment:payment];

}

- (void)paymentQueue:(SKPaymentQueue *)queue
updatedTransactions:(NSArray *)transactions
{
for (SKPaymentTransaction * transaction in transactions) {
switch (transaction.transactionState)
{
case SKPaymentTransactionStatePurchased:
[self completeTransaction:transaction];
break;
case SKPaymentTransactionStateFailed:
[self failedTransaction:transaction];
break;
case SKPaymentTransactionStateRestored:
[self restoreTransaction:transaction];
default:
break;
}
};
}

- (void)completeTransaction:(SKPaymentTransaction *)transaction {
NSLog(@"completeTransaction...");
[self validateReceiptForTransaction:transaction];
}

- (void)restoreTransaction:(SKPaymentTransaction *)transaction {
NSLog(@"restoreTransaction...");
[self validateReceiptForTransaction:transaction];
}

- (void)failedTransaction:(SKPaymentTransaction *)transaction {

NSLog(@"failedTransaction...");
if (transaction.error.code != SKErrorPaymentCancelled)
{
NSLog(@"Transaction error: %@",
transaction.error.localizedDescription);

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"GCC App Error"
message:transaction.error.localizedDescription
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];

}

IAPProduct * product =
_products[transaction.payment.productIdentifier];
[self notifyStatusForProductIdentifier:
transaction.payment.productIdentifier
string:@"Purchase failed."];
product.purchaseInProgress = NO;
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
}

- (void)notifyStatusForProductIdentifier:
(NSString *)productIdentifier string:(NSString *)string {
IAPProduct * product = _products[productIdentifier];
[self notifyStatusForProduct:product string:string];
}

- (void)notifyStatusForProduct:(IAPProduct *)product
string:(NSString *)string {

}

- (void)provideContentForTransaction:
(SKPaymentTransaction *)transaction
productIdentifier:(NSString *)productIdentifier {

IAPProduct * product = _products[productIdentifier];

if (transaction.downloads) {

product.skDownload = transaction.downloads[0];
if (transaction.downloads.count > 1) {
NSLog(@"Unexpected number of downloads!");
}
[[SKPaymentQueue defaultQueue]
startDownloads:transaction.downloads];

} else {

// Put the code from before here
IAPProduct * product = _products[productIdentifier];

if (product.info.consumable) {
[self
purchaseConsumable:product.info.consumableIdentifier
forProductIdentifier:productIdentifier
amount:product.info.consumableAmount];
} else {
NSURL * bundleURL = [[NSBundle mainBundle].resourceURL
URLByAppendingPathComponent:product.info.bundleDir];
[self purchaseNonconsumableAtURL:bundleURL
forProductIdentifier:productIdentifier];
}

[self notifyStatusForProductIdentifier:productIdentifier
string:@"Purchase complete!"];

product.purchaseInProgress = NO;
[[SKPaymentQueue defaultQueue] finishTransaction:
transaction];

}

}

- (void)purchaseConsumable:(NSString *)consumableIdentifier
forProductIdentifier:(NSString *)productIdentifier
amount:(int)consumableAmount {
int previousAmount = [[NSUserDefaults standardUserDefaults]
integerForKey:consumableIdentifier];
int newAmount = previousAmount + consumableAmount;
[[NSUserDefaults standardUserDefaults] setInteger:newAmount
forKey:consumableIdentifier];
[[NSUserDefaults standardUserDefaults] synchronize];

IAPProductPurchase * previousPurchase = [self
purchaseForProductIdentifier:productIdentifier];
if (previousPurchase) {
previousPurchase.timesPurchased++;
} else {
IAPProductPurchase * purchase = [[IAPProductPurchase alloc]
initWithProductIdentifier:productIdentifier consumable:YES
timesPurchased:1 libraryRelativePath:@""
contentVersion:@""];
[self addPurchase:purchase
forProductIdentifier:productIdentifier];
}
[self savePurchases];

}

- (void)provideContentWithURL:(NSURL *)URL {
}

- (void)purchaseNonconsumableAtURL:(NSURL *)nonLocalURL
forProductIdentifier:(NSString *)productIdentifier {

NSError * error = nil;
BOOL success = FALSE;
BOOL exists = FALSE;
BOOL isDirectory = FALSE;

// 1
NSString * libraryRelativePath =
nonLocalURL.lastPathComponent;
NSString * localPath = [[self libraryPath]
stringByAppendingPathComponent:libraryRelativePath];
NSURL * localURL = [NSURL fileURLWithPath:localPath
isDirectory:YES];
exists = [[NSFileManager defaultManager]
fileExistsAtPath:localPath isDirectory:&isDirectory];

// 2
if (exists) {
BOOL success = [[NSFileManager defaultManager]
removeItemAtURL:localURL error:&error];
if (!success) {
NSLog(@"Couldn't delete directory at %@: %@",
localURL, error.localizedDescription);
}
}

// 3
NSLog(@"Copying directory from %@ to %@", nonLocalURL,
localURL);
success = [[NSFileManager defaultManager]
copyItemAtURL:nonLocalURL toURL:localURL error:&error];
if (!success) {
NSLog(@"Failed to copy directory: %@",
error.localizedDescription);
[self notifyStatusForProductIdentifier:productIdentifier
string:@"Copying failed."];
return;
}

// 1
NSString * contentVersion = @"";



NSString *bundle = [[NSBundle mainBundle] pathForResource:@"ContentInfo" ofType:@"plist"];

// NSLog(@"contents of plist :%@",bundle);


NSURL * contentInfoURL = [localURL
URLByAppendingPathComponent:@"ContentInfo.plist"];
exists = [[NSFileManager defaultManager]
fileExistsAtPath:contentInfoURL.path
isDirectory:&isDirectory];
if (exists) {
// 2
NSDictionary * contentInfo = [NSDictionary
dictionaryWithContentsOfURL:contentInfoURL];
contentVersion = contentInfo[@"ContentVersion"];
NSString * contentsPath = [libraryRelativePath
stringByAppendingPathComponent:@"Contents"];
// 3
NSString * fullContentsPath = [[self libraryPath]
stringByAppendingPathComponent:contentsPath];
if ([[NSFileManager defaultManager]
fileExistsAtPath:fullContentsPath]) {
libraryRelativePath = contentsPath;
localPath = [[self libraryPath]
stringByAppendingPathComponent:libraryRelativePath];
localURL = [NSURL fileURLWithPath:localPath
isDirectory:YES];
}
}

// 4
[self provideContentWithURL:localURL];

// 5
IAPProductPurchase * previousPurchase = [self
purchaseForProductIdentifier:productIdentifier];
if (previousPurchase) {
previousPurchase.timesPurchased++;

// 6
NSString * oldPath = [[self libraryPath]
stringByAppendingPathComponent:
previousPurchase.libraryRelativePath];

// NSLog(@"path : %@",oldPath);

success = [[NSFileManager defaultManager]
removeItemAtPath:oldPath error:&error];
if (!success) {
// NSLog(@"Could not remove old purchase at %@",oldPath);
} else {
// NSLog(@"Removed old purchase at %@", oldPath);
}

// 7
previousPurchase.libraryRelativePath =
libraryRelativePath;
previousPurchase.contentVersion = contentVersion;
} else {
IAPProductPurchase * purchase =
[[IAPProductPurchase alloc]
initWithProductIdentifier:productIdentifier
consumable:NO timesPurchased:1
libraryRelativePath:libraryRelativePath
contentVersion:contentVersion];
[self addPurchase:purchase
forProductIdentifier:productIdentifier];
}

[self notifyStatusForProductIdentifier:productIdentifier
string:@"Purchase complete!"];

// 8
[self savePurchases];

}

- (void)restoreCompletedTransactions {
[[SKPaymentQueue defaultQueue]
restoreCompletedTransactions];
}

- (void)validateReceiptForTransaction:

(SKPaymentTransaction *)transaction {

HMAppDelegate *del = (HMAppDelegate *)[UIApplication sharedApplication].delegate;

IAPProduct * product =
_products[transaction.payment.productIdentifier];
VerificationController * verifier =
[VerificationController sharedInstance];

[verifier verifyPurchase:transaction
completionHandler:^(BOOL success) {
if (success) {
//NSLog(@"Successfully verified receipt!");
[self provideContentForTransaction:transaction
productIdentifier:
transaction.payment.productIdentifier];

del.previouslyVerified = YES;
}


if (del.previouslyVerified == YES) {

// NSLog(@"skipping verification");

}
else {

NSLog(@"Failed to validate receipt.");
product.purchaseInProgress = NO;
[[SKPaymentQueue defaultQueue]
finishTransaction: transaction];


NSLog(@"ferification failed.....");



}


}];

}


// 1
- (NSString *)libraryPath {
NSArray * libraryPaths =
NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSUserDomainMask, YES);
return libraryPaths[0];
}

// 2
- (NSString *)purchasesPath {
return [[self libraryPath]
stringByAppendingPathComponent:IAPHelperPurchasesPlist];
}

// 3
- (void)addPurchase:(IAPProductPurchase *)purchase
forProductIdentifier:(NSString *)productIdentifier {

IAPProduct * product = [self
addProductForProductIdentifier:productIdentifier];
product.purchase = purchase;

}

// 4
- (IAPProductPurchase *)purchaseForProductIdentifier:
(NSString *)productIdentifier {
IAPProduct * product = _products[productIdentifier];
if (!product) return nil;

return product.purchase;
}

- (void)loadPurchases {

// 1
NSString * purchasesPath = [self purchasesPath];

// NSLog(@"purchase path : %@",purchasesPath);

NSDictionary *names = [[NSDictionary alloc]
initWithContentsOfFile:purchasesPath];
NSArray *keys = [names allKeys];
NSString *key = [keys objectAtIndex:0];
names = [names objectForKey:key];
// NSLog(@"keys = %@ names = %@",keys,names);

NSArray * purchasesArray = [NSKeyedUnarchiver
unarchiveObjectWithFile:purchasesPath];


for (IAPProductPurchase * purchase in purchasesArray) {
// 2
if (purchase.libraryRelativePath) {
NSString * localPath = [[self libraryPath]
stringByAppendingPathComponent:
purchase.libraryRelativePath];
NSURL * localURL = [NSURL fileURLWithPath:localPath
isDirectory:YES];
[self provideContentWithURL:localURL];
}
// 3
[self addPurchase:purchase
forProductIdentifier:purchase.productIdentifier];
// NSLog(@"Loaded purchase for %@ (%@)",purchase.productIdentifier, purchase.contentVersion);
}

}

- (void)savePurchases {

// 1
NSString * purchasesPath = [self purchasesPath];
NSMutableArray * purchasesArray = [NSMutableArray array];
for (IAPProduct * product in _products.allValues) {
if (product.purchase) {
[purchasesArray addObject:product.purchase];
}
}
// 2
BOOL success = [NSKeyedArchiver
archiveRootObject:purchasesArray toFile:purchasesPath];
// NSLog(@"purchase path : %@",purchasesPath);

if (!success) {
// NSLog(@"Failed to save purchases to %@", purchasesPath);
}

}

- (void)loadProductsWithCompletionHandler:(void (^)
(BOOL success, NSError * error))completionHandler {

for (IAPProduct * product in _products.allValues) {
product.info = nil;
product.availableForPurchase = NO;
}

NSURL * baseUrl = [NSURL URLWithString:IAPServerBaseURL];
AFHTTPClient * httpClient = [[AFHTTPClient alloc]
initWithBaseURL:baseUrl];
NSURL * url = [NSURL URLWithString:IAPServerProductsURL
relativeToURL:baseUrl];
NSMutableURLRequest * request = [NSURLRequest
requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:60];
AFHTTPRequestOperation *operation = [httpClient
HTTPRequestOperationWithRequest:request
success:^(AFHTTPRequestOperation *operation, id
responseObject)
{
NSData * productInfosData = [operation responseData];
NSError * error = nil;
NSArray * productInfosArray =
[NSPropertyListSerialization
propertyListWithData:productInfosData
options:NSPropertyListImmutable format:NULL
error:&error];
if (productInfosArray == nil) {
completionHandler(FALSE, error);
} else {

for (NSDictionary * productInfoDict in
productInfosArray) {
IAPProductInfo * info = [[IAPProductInfo alloc]
initFromDict:productInfoDict];
[self addInfo:info
forProductIdentifier:info.productIdentifier];
};

if (!_productsLoaded) {
_productsLoaded = YES;
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
}

completionHandler(TRUE, nil);
}

} failure:^(AFHTTPRequestOperation *operation,
NSError *error) {
completionHandler(FALSE, error);
}];
[httpClient enqueueHTTPRequestOperation:operation];
}

- (void)paymentQueue:(SKPaymentQueue *)queue
updatedDownloads:(NSArray *)downloads {

SKDownload * download = [downloads objectAtIndex:0];
SKPaymentTransaction * transaction = download.transaction;
SKPayment * payment = transaction.payment;
NSString * productIdentifier = payment.productIdentifier;
IAPProduct * product = _products[productIdentifier];

product.progress = download.progress;

NSLog(@"Download state: %d", download.downloadState);
if (download.downloadState == SKDownloadStateFinished) {
[self purchaseNonconsumableAtURL:download.contentURL
forProductIdentifier:productIdentifier];
product.purchaseInProgress = NO;
[[SKPaymentQueue defaultQueue] finishTransaction:
transaction];

} else if (download.downloadState ==
SKDownloadStateFailed) {
NSLog(@"Download failed.");
[self notifyStatusForProductIdentifier:productIdentifier
string:@"Download failed."];

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Download Failed"
message:@"Make sure you have enough space on your device. If problems persist uninstall and reinstall the app. You will not be charged for restoring previously purchased classes."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
alertView.tag = 1;
[alertView show];
product.purchaseInProgress = NO;
[[SKPaymentQueue defaultQueue] finishTransaction:
transaction];

} else if (download.downloadState ==
SKDownloadStateCancelled) {
NSLog(@"Download cancelled.");
[self notifyStatusForProductIdentifier:productIdentifier
string:@"Download cancelled."];
product.purchaseInProgress = NO;
[[SKPaymentQueue defaultQueue] finishTransaction:
transaction];

} else {
NSLog(@"Download for %@: %0.2f complete",
productIdentifier, product.progress); }
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
NSLog(@"Clicked button index 0");}
}

- (void)pauseDownloads:(NSArray *)downloads {
[[SKPaymentQueue defaultQueue] pauseDownloads:downloads];}
- (void)resumeDownloads:(NSArray *)downloads {
[[SKPaymentQueue defaultQueue] resumeDownloads:downloads];}
- (void)cancelDownloads:(NSArray *)downloads { [[SKPaymentQueue defaultQueue] cancelDownloads:downloads];}
@end


asked 1 min ago







In App Purchases not downloading in live app but working in sandbox mode

Irregular bootstrap column wrapping


Vote count:

0




Running Rails 4.1.4 with the latest releases of haml, haml-rails, sass, and bootstrap-sass. For a user display, my HAML is as such:



.tutors-listing
.row
- @users.each do |tutor|
.col-xs-12.col-md-3
.row.tutor
.col-xs-offset-1.col-xs-4.col-md-12
= image_tag tutor.photo, :class => 'img-responsive img-circle tutor-photo'
%h4.tutor-name
= tutor.first_name

%p
teaches
%strong.tutor-skills
= tutor.teachables


However, this markup results in the following glitch: Irregular column wrappingMore irregular column wrapping


I'm hoping somenone can devine what's wrong here. At the medium breakpoint, there should be 4 columns evenly.



asked 45 secs ago







Irregular bootstrap column wrapping

Having trouble rotating div via css("transform":"(180deg)");


Vote count:

0




http://ift.tt/1r1C51d


Hey everyone, I'm trying to get my .flip divs to flip through rotateY, but what I have isn't working and I'm not sure what I'm doing wrong. Would very much appreciate some help. Thanks.


JS:



$("#a1, #a2, #a3, #a4").hover(function(){
$(".flip").css("background-color","yellow");
$(".flip").css("transform":"(180deg)");
},function(){
$(".flip").css("background-color","#00FF00");
$(".flip").css("transform":"");
});


HTML:



<body>
<div id="tile_wrapper">

<div id="a1" class="tile a one">
<div class="frame">
<div class="flip"></div>
</div>
</div>

<div id="a2" class="tile a two">
<div class="frame">
<div class="flip"></div>
</div>
</div>

<div id="a3" class="tile a three">
<div class="frame">
<div class="flip"></div>
</div>
</div>

<div id="a4" class="tile a four">
<div class="frame">
<div class="flip"></div>
</div>
</div>
</div>


CSS:



html, body, .frame, .flip {
width: 50px;
height: 50px;
margin: 0;
}

#tile_wrapper {
width: 232px;
height: 50px;
}


.tile {
display: inline-block;
float: left;
height: 50px;
width: 50px;
padding: 4px;
}

.tile {
-webkit-perspective: 100px;
-moz-perspective: 100px;
-o-perspective: 100px;
perspective: 100px;
}

.flip {
transition: background-color 0.6s ease-out;
background-color: #00FF00;
}

.frame {
-webkit-transition: 0.6s;
-webkit-transform-style: preserve-3d;
-moz-transition: 0.6s;
-moz-transform-style: preserve-3d;
-o-transition: 0.6s;
-o-transform-style: preserve-3d;
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}


asked 1 min ago







Having trouble rotating div via css("transform":"(180deg)");

How to use hasNextInt for this code?


Vote count:

0




Okay so the problem is to write a program that will identify vowels from consonant. I need to use Scanner and has Next()


the output should look like this


Enter a letter: a a is vowel Enter a letter: b b is consonant Enter a letter: 1 1 is invalid input


it will keep reading until it reaches the end of file professor hinted to use has Next Int because it will return false when there is no input


So here is what i have so far



public static void main (String[] args){
Scanner input = new Scanner(System.in);

boolean vowel = true;

do {
System.out.print("Enter a letter: ");
char letter = input.nextLine( ).charAt(0);

if (letter=='a'||letter=='A'||letter=='e'||letter=='E'||letter=='i'||letter=='I'||letter=='o'||letter=='O'||letter=='u'||letter=='U'){
System.out.println(letter + " is a vowel");

}
else if(Character.isLetter(letter)){
System.out.println(letter + " is a consonant");

}
else {
System.out.println(letter + " is an invalid input");

}
}
while(vowel);


}
}


asked 30 secs ago







How to use hasNextInt for this code?

Why my XMLParser do this to my database?


Vote count:

0




I am parsing my database and my application goes NPE. Now, i checked what happened in the database thru another app. This is my xmlparser method.


try {



float scorefloat = 0;
while (parser.next() != XmlPullParser.END_TAG) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
String name = parser.getName();
if (name.equals("record")) {
String id = null, workoutName = null, muscletype = null, machine = null,
score=null, videopath=null;
Workout w = new Workout(workoutName, muscletype, machine, scorefloat, videopath);
while (parser.next() != XmlPullParser.END_TAG) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
name = parser.getName();
if (name.equals("id")) {
id = readText(parser);

} else if (name.equals("workoutname")) {
workoutName = readText(parser);
w.setWorkoutName(workoutName);
} else if (name.equals("muscletype")) {
muscletype = readText(parser);
w.setMuscleType(muscletype);
} else if (name.equals("machine")) {
machine = readText(parser);
w.setMachine(machine);
} else if (name.equals("score")){
score = readText(parser);
w.setScore(Float.parseFloat(score));
} else if (name.equals("videopath")){
videopath = readText(parser);
w.setVideoPath(videopath);

}
myDbHelper.insertWorkout(w);
}



}


this is the output of the database: http://ift.tt/1u5jdi5



asked 19 secs ago







Why my XMLParser do this to my database?

Need To Close A Panel When Clicked Outside (Lost Focus)


Vote count:

0




I have an issue that I cannot seem to overcome.


In my application, I have a custom class that loads a form into a panel upon startup. Then when I click a button on my main form I show the panel as visible revealing the form to the user.


My problem is that I want to be able to hide the panel when a user clicks outside of it (back onto the main form).


so far I have tried Form_Deactivate, Form_Leave, Form_LostFocus, Panel_Leave and Panel_LostFocus events but nothing will seem to trigger an event consistently to hide the panel. The only thing that works is if the user clicks inside the form (on a listview control) once the form is visible and then clicks outside of the form.


Is there anyway I can ensure this event gets called everytime whether the user clicks the form or not?


So far my code looks something like:



Public Class cls_UserObjects

Private frm As frmUsers
Public pnl As Panel

Public Sub ShowUserPanel()
Try
frm = New frmUsers
frm.TopLevel = False
pnl.Controls.Add(frm)
frm.Show()
frm.Focus()
....
End Class


Then in my main form I call the code below to build the form into the panel:



class_Users.pnl = pnlUsers
class_Users.ShowUserPanel()


And pnlUsers.Visible = True to show it to the user


I just can't seem to close it. I understand that Panels don't support the LostFocus properly, however, I can't find away around this. Maybe it has something to do with how I am opening my form/panel but I was advised to use classes to open forms so I can have more control over the controls within my forms from outside calls.


Any help appreciated. Thanks



asked 5 mins ago

Riples

206






Need To Close A Panel When Clicked Outside (Lost Focus)

Why is my external screen not responding?


Vote count:

0




I'm making an iOS app that interacts with an external monitor and the problem is that I can't find the reason why the "actions" don't have any effect.


Example: Trying to launch function "getData" (ExternalViewController) from BettingEntranceViewController.


Using separate storyboards for iPad and External monitor.


ViewController.h



#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@end


ViewController.m



#import "ViewController.h"
#import "ExternalViewController.h"

@interface ViewController ()

@property (strong, nonatomic) IBOutlet UITextView *loger;
@property (strong, nonatomic) UIScreen *extScreen;
@property (strong, nonatomic) UIWindow *extWindow;

@end

@implementation ViewController

- (void)logMessage:(NSString*)message
{
self.loger.text = [self.loger.text stringByAppendingString:message];
[self.loger scrollRangeToVisible:NSMakeRange([self.loger.text length], 0)];
}

- (void)screenDidSomething:(NSNotification *)notification
{
NSArray *screens;

screens = [UIScreen screens];
NSUInteger screenCount = [screens count];

if (screenCount > 1) {
self.extScreen = screens[1];
[self logMessage:@"Wuhu ext is!"];
} else {
self.extScreen = nil;
self.extWindow = nil;
}

self.extWindow = [[UIWindow alloc] initWithFrame:self.extScreen.bounds];
self.extWindow.screen = self.extScreen;

[self logMessage:[NSString stringWithFormat:@"External screen resolution: %f x %f \n", self.extScreen.bounds.size.width, self.extScreen.bounds.size.height]];

UIStoryboard *externalStory = [UIStoryboard storyboardWithName:@"External" bundle:nil];
ExternalViewController *externalTroller = [externalStory instantiateInitialViewController];
self.extWindow.rootViewController = externalTroller;

self.extWindow.hidden = NO;
}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(screenDidSomething:)
name:UIScreenDidConnectNotification
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(screenDidSomething:)
name:UIScreenDidDisconnectNotification
object:nil];
}

- (void)viewDidDisappear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIScreenDidConnectNotification
object:nil];

[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIScreenDidDisconnectNotification
object:nil];
}


- (void)viewDidLoad {
[super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

@end


ExternalViewController.h



#import <UIKit/UIKit.h>
#import "BettingEntranceViewController.h"

@interface ExternalViewController : UIViewController

- (void)getData;

@end


ExternalViewController.m



#import "ExternalViewController.h"
#import "BettingEntranceViewController.h"

@interface ExternalViewController ()

@property (strong, nonatomic) IBOutlet UITextView *logar;

@end

@implementation ExternalViewController

- (void)viewDidLoad {
[super viewDidLoad];

[self logMessage:[NSString stringWithFormat:@"Zloadano!"]];

//[self getData]
}

- (void)logMessage:(NSString *)message
{
self.logar.text = [self.logar.text stringByAppendingString:message];
[self.logar scrollRangeToVisible:NSMakeRange([self.logar.text length], 0)];
}

- (void)getData
{
[self logMessage:[NSString stringWithFormat:@"It works!"]];

}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

@end


BettingEntranceViewController.h



#import <UIKit/UIKit.h>

@interface BettingEntranceViewController : UIViewController

@end


BettingEntranceViewController.m



#import "BettingEntranceViewController.h"
#import "ExternalViewController.h"
#import "unistd.h"

@interface BettingEntranceViewController ()

@property (strong, nonatomic) ExternalViewController *externalTroller;

@end

@implementation BettingEntranceViewController


- (void)viewDidLoad {
[super viewDidLoad];

self.externalTroller = [[ExternalViewController alloc] init];
}


- (IBAction)sendGuest:(id)sender
{

[self.externalTroller getData];

}

@end


asked 1 min ago







Why is my external screen not responding?

Cross-Compiling C++ OpenCV project on Ubuntu 12.04 for Windows 7


Vote count:

0




I am new to cross compiling and have a problem with compiling a C++ project using OpenCV 2.4.9 on Ubuntu 12.04 for Windows 7. Unfortunately I did not find an appropriate solution here or elsewhere on the web.


Here are some more details:



  • I use cmake to create the makefiles

  • Compilation works fine for Ubuntu

  • I installed mingw32

  • I had to add some symbolic links to /usr/local/include/opencv2/ in the /usr/i586-mingw32msvc/include/ folder to resolve dependencies.


My Toolchain-mingw32.cmake looks like this:



SET(CMAKE_SYSTEM_NAME Windows)

SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)

SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)


My CMakeLists.txt looks like this:



cmake_minimum_required(VERSION 2.8.3)
project(process)

find_package(OpenCV REQUIRED)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

set(CMAKE_BUILD_TYPE Release)

add_executable(process process.cpp <more .cpp-files>)

target_link_libraries(process ${OpenCV_LIBS} ${OpenMP_LIBS})


When I run cmake in the build folder (build/x86/windows/release)



cmake -DCMAKE_TOOLCHAIN_FILE=../../../../src/Toolchain-mingw32.cmake
../../../../src/


I get the following result:



-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/i586-mingw32msvc-gcc
-- Check for working C compiler: /usr/bin/i586-mingw32msvc-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/i586-mingw32msvc-g++
-- Check for working CXX compiler: /usr/bin/i586-mingw32msvc-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: build/x86/windows/release


Then I make and get the following error:



make

Scanning dependencies of target process
[ 6%] Building CXX object CMakeFiles/http://ift.tt/1r1igHs
...
[100%] Building CXX object CMakeFiles/http://ift.tt/1nifFnP
make[2]: *** No rule to make target `opencv_videostab-NOTFOUND', needed by `process.exe'. Stop.
make[1]: *** [CMakeFiles/process.dir/all] Error 2
make: *** [all] Error 2


Cross compiling without special dependencies works. Any help is appreciated!



asked 44 secs ago







Cross-Compiling C++ OpenCV project on Ubuntu 12.04 for Windows 7

Arithmetic pointer with void*


Vote count:

0




So I need to create a call to strange_step that results in it printing out the if statement:



void strange_step(void* value)
{
if(*(int*)(value+5) == 15)
printf("4: Illinois\n");
else
printf("4: ERROR\n");
}


I've tried the following (since to my knowledge, with gcc, it treats void* like a char* so increments 1 byte):



int arr[10];
arr[4] = 15;
arr[5] = 15;
arr[3] = 15;
arr[2] = 15;
arr[6] = 15;
arr[7] = 15;
arr[8] = 15;
arr[9] = 15;
//arr[10] = 15;
strange_step(arr);


But that just seems to print out random numbers. What am I missing?



asked 31 secs ago







Arithmetic pointer with void*

IF NOT EXIST and Insert mysql stored procedure


Vote count:

0




hey guys can someone point me whats wrong in my mysql code im trying to create a stored procedure called in a trigger were a user insert a new book in the books table, the bookqty table insert if callNumber does not exist and updates when exist, but in some point the insert query is not working but the update query works fine thank you in advance


use librarydb; drop procedure if exists intoBooksQty; delimiter $$



create procedure intoBooksQty(in newcallNumber varchar(10))

begin
if not exists (select * from books where callNumber = newcallNumber) then
insert into librarydb.bookqty(callNumber,bookQty,bookqtyOut) values (newcallNumber, 1,0);
else
update bookqty set bookQty = bookQty + 1 where callNumber = newCallNumber;
end if;
end$$


delimiter ;



asked 29 secs ago







IF NOT EXIST and Insert mysql stored procedure

Celerybeat schedule executing task multiple times?


Vote count:

0




I have a task calculate_common_locations which runs once via CELERYBEAT_SCHEDULE. The task simply calls a function in the database:



@app.task
def calculate_common_locations():
db.execute("SELECT * FROM calculate_centroids('b')")


This is the entry in CELERYBEAT_SCHEDULE:



CELERYBEAT_SCHEDULE = {
'common_locations': {
'task': 'clients.tasks.calculate_common_locations',
'schedule': crontab(hour=23, day_of_week='sun'), #every week
},
[..]
}


I got an IntegrityError because the function was executed twice, see the currently running queries:


enter image description here


There is two different backends connecting (at different times, see backend_start) but executing the same task at exactly the same time (xact_start, query_start).


I am using pgbouncer to reuse celery connections. Could that be an issue? What else could cause celery to execute the task twice?


This is how celery gets started (via supervisord):



celery worker --beat --app=cloud.celery app:app --concurrency=10 -l INFO -s /home/foo/run/celerybeat-schedule --pidfile=/home/foo/run/celerybeat.pid


asked 34 secs ago







Celerybeat schedule executing task multiple times?

Dynamic random grid


Vote count:

0




I'm trying to generate a random 2D grid that is procedurally generated from the [x, y] coordinates (as opposed to pre-generating a 2D array of numbers). The reason for this is that the map is potentially huge, and there is a good possibility that much of the grid will not actually be needed.


Here's what I have so far:



double value_at(Grid *grid, int seed, int x, int y) {
srand(seed + x + y * grid->width);
return (double)rand() / (RAND_MAX + 1.0);
}


It's generating grids properly, however I'm seeing a lot of regularities in the output:


Grid 1Grid 2


You can see that there is a sort of "grain" that sends lines moving diagonally through the output.


I'm doing some research on it but I'm having some trouble finding ways to do this. Does anybody have an idea on how to get the grids to be a bit more "random"?



asked 1 min ago

robbrit

7,242






Dynamic random grid

reading and formatting a text file in ansi c


Vote count:

0




I'm learning C and one of the tasks it to read in a text file, and have it output a formatted text file. The final product should look like this:



1)"I must not fear.[4,17]
2)Fear is the mind-killer.[4,24]
3)Fear is the little-death that brings total obliteration.[8,56]
4)I will face my fear.[5,20]
.
.
.
13)oneWord_allAlone[1,16]
13 lines, 94 words, 481 characters
Line 10 has the most words (16)
Line 7 has the most characters (68)


I've written the code and can get something close-ish, but the information is out of order and the variables are wrong and it cuts off the first letter of each sentence. I get:



I must not fear0.)
[4, 16]
ear is the mind-killer.0)
[7 39]
ear is the little-death that brings total obliteration.0)
[14 92]
.
.
.
neWord_allAlone1)
[86 470]
1 lines, 20360 words, 110685 characters
line 1 has the most words with (86)
line 1 has the most characters with 470)


Where it is getting 110685 characters is beyond me. So, with that said, what am I doing wrong? As far as I can tell, I have all the variables set up properly, but the output is in the wrong order, the first character is being cut off, and the counts are wayyyy off. Any help is much appreciated! Here's my code:



#include <stdio.h>

#define IN 1
#define OUT 0

void main()
{

int c = 0;
int numChars = 0;
int numWords = 0;
int numLines = 0;
int state = OUT;
int test = 0;
int largestNumChars = 0;
int largestNumWords = 0;
int totalNumChars = 0;
int totalNumWords = 0;
int lineWithMostChars = 0;
int lineWithMostWords = 0;

FILE *doesthiswork;
doesthiswork = fopen("testWords.in", "r");
while ((test = fgetc(doesthiswork)) != EOF)
{
if ( test == '\n')
{
++numLines;
}
while ((test = fgetc(doesthiswork)) != '\n')
{
++numChars;
putchar(test);
if (test == ' ' || test == '\t' || test == '\n')
{
state = OUT;
} else if (state == OUT){
state = IN;
++numWords;
}
totalNumWords = totalNumWords + numWords;
totalNumChars = totalNumChars + numChars;
}

if (largestNumChars == 0)
{
largestNumChars = numChars;
} else if (largestNumChars < numChars)
{
largestNumChars = numChars;
lineWithMostChars = numLines;
} else
{
largestNumChars = largestNumChars;
lineWithMostChars = lineWithMostChars;
}
if (largestNumWords == 0)
{
largestNumWords = numWords;
lineWithMostWords = numLines;
} else if (largestNumWords < numWords)
{
largestNumWords = numWords;
lineWithMostWords = lineWithMostWords;
} else {
largestNumWords = largestNumWords;
}

printf("%d) %c [%d %d]\n",numLines, test, numWords, numChars);
}
printf("%d lines, %d words, %d characters\n", numLines, totalNumWords, totalNumChars);
printf("line %d has the most words with (%d)\n", lineWithMostWords, largestNumWords);
printf("line %d has the most characters with (%d)\n", lineWithMostChars, largestNumChars);
}


asked 39 secs ago







reading and formatting a text file in ansi c

Trying to count how many characters there are in a string in C


Vote count:

-1





void reverse(char s[]) {
int i;
int len = 0;
for (i=0; s[i] != '0'; i++) {
len = len + 1;
}


Here is my code above. s[] is the string I am trying to reverse; Please help! Thanks



asked 1 min ago







Trying to count how many characters there are in a string in C

show poll result in personal page


Vote count:

0




I am using wp-poll widget.It's working well.My problem is the poll results. It's show the result in same place with poll. Actually I would like to show poll results in page.At the same time hide the poll from side bar.


Thanks for your help!



asked 19 secs ago







show poll result in personal page

Date between dates, ignore year


Vote count:

0




What's the best (fastest) approach to compare if date is in range of dates independently from year?


table "dates":



some_column| since | upto |
-----------|--------------|-------------|
'foo' | '2011-05-01' | '2013-06-01'|


Now I want this query to return 'foo'



SELECT foo FROM dates WHERE '2014-05-05' BETWEEN `since` AND `upto`


If needed, I can change format of stored dates in "dates" table, but I cannot change format of date which I put into query as that value is typically from another table (It's part of more complex query using joins).



asked 56 secs ago







Date between dates, ignore year

How to fix this bug in the Kotlin Web Demo?


Vote count:

0




I'm a real n00b in Kotlin and have just started with its demo. There' no direct link, please click on Problems and then on Runs on the left.


The problem solution is trivial, but there's a bug in



private fun assertEquals<T>(actual : T?, expected : T?, message : Any? = null) {
if (actual != expected) {
errors++
println("Test failed")
val trace = Thread.currentThread()?.getStackTrace()!!
if (trace.size > 6) {
// Finding relevant stack frames
val location = trace.getFrameAfter("runs.Tester", "expect") // ERROR HERE
val function = trace.getFrameAfter("runs.TesterRunner", "forFunction") // AND HERE
println("at ${function?.getClassName()}.${function?.getMethodName()}(line:${location?.getLineNumber()})")
}
if (message != null)
println(message)
}
else if (!skipSuccessful)
println("OK")
}


which I don't understand. It says



Type mismatch: inferred type is kotlin.Array<java.lang.StackTraceElement> but
kotlin.Array<java.lang.StackTraceElement?> was expected


and I can neither how the former was inferred nor why the latter is expected. Especially I don't understand where can two such assumption come from a single method call.


I "fixed" it by removing the offending lines, but I'm sure someone can enlighten me.



asked 43 secs ago







How to fix this bug in the Kotlin Web Demo?

htaccess clean urls without modifying base url


Vote count:

0




I'm trying to clean the url



/file.php?page=[whatever]


to



/file/[whatever]


using .htaccess. The file.php resides in the root public_html folder.


The below code works perfectly, but even though I've specified the file type as php it still applies to other files (such as css) and breaks links!


The two solutions I've found on the internet are:




  • Avoid relative links to external files and include the full path




  • add my domain in the base tag to the head of every .html page




I don't want to do either of these as they make me unable to work on the site locally with MAMP/XAMPP.



RewriteRule ^file/([^/\.]+)/?$ file.php?p=$1 [L]


asked 1 min ago

Joe

5






htaccess clean urls without modifying base url

How i can fix this? Rendering problems


Vote count:

0




Rendering problems:


The following classes could not be instantiated:



  • com.google.android.gms.ads.AdView . . .


Anyone can tell me the solution of this error? :L got my API level in 19.



asked 39 secs ago







How i can fix this? Rendering problems

What is the equivalent of this binary in mantissa exponent form in denary


Vote count:

0




The following mantissa and exponents are represented in twos complement form using 8bits each.



Mantissa: 10010000
Exponent: 00000001


This is how I tried it,



1.0010000 x 2^1
10.010000


Converting this decimal point binary to denary:


-2.25


But the answer is supposed to be -1.75, what have I done wrong?



asked 42 secs ago







What is the equivalent of this binary in mantissa exponent form in denary

mySQL primary key oddity


Vote count:

0




I have a script which INSERT's data into a table and then later on when you INSERT new data it DELETE's the previous record/s and INSERT's the current data set.


The only issue is that the primary key gets wacked.


e.g. first four rows



1
2
3
4


then when i delete these and enter new data



5
3
4
6


note: the above numbers represent primary key id auto incrementations


Why does the incrementation become confused almost?




juergen d

81.8k

asked 1 min ago







mySQL primary key oddity

How do I turn off smart quotes in Jekyll?


Vote count:

0




How do I turn off smart quotes and apostrophes in Jekyll? It is breaking my gulp spellcheck process.


I want words like doesn't to stay with a single straight quote. Instead Jekyll is converting them to smart quotes like doesnt’ and I need them to stay single quoted for spell checking.


This is what I tried in my _config.yml:



kramdown:
smartquotes: ["apos", "rsquo", "ldquo", "rdquo"]


I'm using kramdown.



asked 29 secs ago







How do I turn off smart quotes in Jekyll?

Ruby on Rails: How would I access this Carrierwave @original_filename params?


Vote count:

0




I'm currently using Carrierwave and want to be able to save the original filename as my model Document's title. I see that when I submit the document uploader form, the filename is saved as @original_filename.


How would I access this? I tried params[:document][:attachment][:original_filename] , but the "@" is what's confusing me.


Also, the main reason why I want to save the filename as a hard title is because if I use Document.attachment.file.filename, it sometimes shows as "6sw=&Expires=1409522546" instead of the filename, probably because of the random extensions that get added when the file gets uploaded to S3


Parameters:


{"utf8"=>"✓", "authenticity_token"=>"f67R1N2JR0b4WDWeYfSzI8q3DKwK59y487TXhR4xYvo=", "document"=>{"attachment"=>#, @original_filename="1 documents.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"document[attachment]\"; filename=\"1 documents.png\"\r\nContent-Type: image/png\r\n">}, "commit"=>"Upload Files"}



asked 2 mins ago







Ruby on Rails: How would I access this Carrierwave @original_filename params?

What is the Difference between the below two function?


Vote count:

-2




I am trying to figure out the below two function But i couldn't able to get the answer


Function 1: By tylor serious



long long expo(int n,int x) {
long long sum = 1;
for(int i = n-1; i>0; --i)
sum = 1 + x * sum / i;
return sum;
}

Function 2:

long long exp(int a,int b) {
if( b == 0) return 1;
if( b % 2 ) return a * exp(a,b-1);
long long t = exp(a,b/2);
return t * t;
}


asked 36 secs ago







What is the Difference between the below two function?

How to produce frequency polygons for each row of a data frame with an unnamed first column


Vote count:

0






So this is I'm sure a fairly elementary problem. I have a data frame that has data for 10 years for a bunch of countries. It looks like this. The data frame is df.



X2003 X2004 X2005 X2006 X2007 X2008 X2009 X2010 X2011 X2012


Afghanistan 7.321 7.136 6.930 6.702 6.456 6.196 5.928 5.659 5.395 5.141 Albania 2.097 2.004 1.919 1.849 1.796 1.761 1.744 1.741 1.748 1.760 Algeria 2.412 2.448 2.507 2.580 2.656 2.725 2.781 2.817 2.829 2.820 Angola 6.743 6.704 6.657 6.598 6.523 6.434 6.331 6.218 6.099 5.979 Antigua and Barbuda 2.268 2.246 2.224 2.203 2.183 2.164 2.146 2.130 2.115 2.102 Argentina 2.340 2.310 2.286 2.268 2.254 2.241 2.228 2.215 2.201 2.188



The first column is metadata. It hasn't got a name. I'd like to use qplot to plot frequency polygons (basically time series) for each of the rows. Something like the following command: qplot (data = df, binwidth = 1, geom="freqpoly") but I get the following error



Error: stat_bin requires the following missing aesthetics: x. I would like to set x = first column but I don't have a name on that column. Do I have to create a first column of country names? If so, how do I do that? Seems like there should be an easier way. Sorry if this is so elementary.


Thanks for reading!



asked 40 secs ago







How to produce frequency polygons for each row of a data frame with an unnamed first column

HtmlAgilityPack - Getting rid of Ads between html comment tags


Vote count:

0




I need to get rid of the Part between <!-- custom ads -->and <!-- /custom ads --> in this code snippet.



<!-- custom ads -->
<div style="float:left">
<!-- custom_Forum_Postbit_336x280 -->
<div id='div-gpt-ad-1526374586789-2' style='width:336px; height:280px;'>
<script type='text/javascript'>
googletag.display('div-gpt-ad-1526374586789-2');
</script>
</div>
</div>
<div style="float:left; padding-left:20px">
<!-- custom_Forum_Postbit_336x280_r -->
<div id='div-gpt-ad-1526374586789-3' style='width:336px; height:280px;'>
<script type='text/javascript'>
googletag.display('div-gpt-ad-1526374586789-3');
</script>
</div>
</div>
<div class="clear"></div>

<br>
<!-- /custom ads -->


<!-- google_ad_section_start -->Some Text,<br>
Some More Text...<br>
<!-- google_ad_section_end -->


I can already find the two comments with this xPath //comment()[contains(., 'custom')], but now i'm stuck with how to remove everything, which is in between those "tags".



foreach (var comment in htmlDoc.DocumentNode.SelectNodes("//comment()[contains(., 'custom')]"))
{
MessageBox.Show(comment.OuterHtml);
}


Any suggestions?



asked 1 min ago







HtmlAgilityPack - Getting rid of Ads between html comment tags

Facebook mobile sites "Suggested Apps". How do they do it?


Vote count:

0




I would like to replicate the way you can side scroll the suggested apps on the Facebook mobile site (see attached photo).


It looks like each app is an individual div but it scrolls so smooth! Though if I could make one change I would want it to scroll and flow more than just one div box at a time if the user flicks harder/faster on a touch screen device. In addition to that, I would like it to show part of the next/previous div so it's more intuitive for the user to know that they can swipe left or right for more divs/photos.


Ideally I'd like to put photos (so like, a gallery swiper) into each of these divs. Can anyone point me in the right direction? I've looked into some of the other options (galleries, iscroll variants) but none of them do what I want to do.


http://ift.tt/1qte0iA



asked 54 secs ago







Facebook mobile sites "Suggested Apps". How do they do it?

Test if first element in map transversal?


Vote count:

0




Is it possible to test to see how many times you've looped over the map?


Something like the following:



@item.itemImgs.map { img =>
@if(img._1) {
<html stuff>
}
}


The above is the Play Framework templating engine in a *.scala.html document.



asked 22 secs ago







Test if first element in map transversal?

NSArray Retrieving Single Item


Vote count:

0




I seem to be struggling this morning with this one. I have a NSArray that is filled with data. Pretty simple so far. Ultimately I need to retrieve one or more of the items out of the array to simply display on the device. Below



NSArray *myViews = viewsArray;

NSString *activeView = [myViews valueForKey:@"Active"];



I know the Array is correct but for some reason unbeknown to myself I can get one of the items out of the array and set it so I can use it else where. Perhaps a scope issue.


My Array looks like this;



[0]
NSObject
appViewName = (NSString *) @"AcmeAPP"
appActive = (NSString *) @"True"


I have also tried looping over the array but that doesn't seem to work either. Clearly I'm missing something.



asked 1 min ago

Jeremy

121






NSArray Retrieving Single Item

how to convert this gradiency for IE9 and 10


Vote count:

0




How can i convert this firefox gradient bit for IE9 ?



background: -moz-linear-gradient(left center , #003f6a 0%, #003f6a 45%, #0086bb 55%, #0086bb 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);


asked 13 secs ago







how to convert this gradiency for IE9 and 10