lundi 7 juillet 2014

Date formatting is not formatting correctly


Vote count:

0




I can't figure out why this is returning Wed Jul 02 18:21:27 CDT 2014 instead of 07/02/14 6:21 pm



public void setPubDate(String pubDate) {

SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
long x = dateFormat.parse(pubDate).getTime();
Date date = new Date(x);
SimpleDateFormat newFormat = new SimpleDateFormat("MM/dd/yy H:mm aa");
newFormat.format(dateFormat.parse(pubDate));
this.pubDate = date;

}


asked 1 min ago






Custom watch face for Android Wear


Vote count:

-2




A few apps have come out already for Android Wear that contain custom watch faces (like this one). They are not just apps that simply display a watch face; they are full-fledged faces that are selectable when long-pressing the home screen of the watch. I can't find any documentation on how to set up your app to provide a custom face. How do you configure your app to provide a face?



asked 1 min ago

Jarett

1,644





How to get better logging of EJB annotation replacement from GlassFish?


Vote count:

0




I'm learning EJB as I go along, and one of the biggest problems I find is that my annotations sometimes do not work. For instance, I have in an @Entity:



@EJB(beanName="EventTriggerQueue") TriggerQueueAbst evq;


With:



@Local
public interface TriggerQueueAbst {
public void queue(Object obj, Map<String, String> outputs);
}


And:



@Stateless
public class EventTriggerQueue implements Serializable, TriggerQueueAbst {
private static final long serialVersionUID = 5038081840391929418L;

// JMS Queue declaration
@Resource(mappedName="jms/MyFactory")
private ConnectionFactory connectionFactory;

@Resource(mappedName="jms/EventTriggerQueue")
private Queue etQueue;

@Override
public void queue(Object evpObj, Map<String, String> outputs) {
//....
}
}


However, when I put a breakpoint on:



evq.queue(obj, outputs);


evq is just null, not a proxy. Is it possible to enable more detailed logging information that will show why the @EJB was ignored or skipped?



asked 49 secs ago

Ken Y-N

1,459





Find common between two objects arrays


Vote count:

0




On the Sales web site, customers place orders for all kinds of products: business cards, t-shirts, brochures, and so on. Suppose we r Represent a product as a string containing the product's name, like "business card" or "t-shirt". Likewise, we represent a customer order as an array of products. Using your favorite programming language, write me a function that accepts two orders as arguments and outputs the products that they have in common.



asked 42 secs ago






Trigger TeamCity build only when detecting changes in .java files on VCS checkout


Vote count:

0




Is there a command or parameter in TeamCity wherein it will only trigger the build if there's at least one java file that's committed when doing VCS checkout? I'm using TeamCity 8.1.3.



asked 1 min ago






Can't add cookies to ajax page JSP


Vote count:

0




I'm developing a simple JSP page with a div updated via AJAX XMLHttpRequest object When I try to use (response.addCookies(String,String)) I get no errors but the page stops loading and there are no output whatsoever... Are there no way I can add cookies through an Ajax request object???



asked 1 min ago






Is there a way to write a pointcut for a getter to an annotated field?


Vote count:

0




I'm trying to write a pointcut which will intercept getters for annotated members.



public class MyClass {

private String volume;

@MyAttribute
private Validity validity;


public void setValidity( Validity obj ){
validity = obj;
}

public Validity getValidity(){
return validity;
}
}


Is there a way to write a pointcut that will intercept all calls to getValidity() based on validity being annotated with @MyAttribute? Written differently, I'm looking to create a pointcut for any getter of a member field that is annotated with @MyAttribute.


Is this even feasible?



asked 2 mins ago

Eric B.

3,209





Node.js server.listen callback?


Vote count:

0




I have a node.js application and I need to run a command once the server starts listening. The docs on server.listen say:

server.listen(port, [hostname], [backlog], [callback])

but when I try to use this format, the code is not run, but no error messages are appearing. Here is the listening part of my application:



var spawn = require('child_process').spawn
function listen(port) {
try {
server.listen(port, "localhost",511, function() {
spawn("open",["http://localhost:"+port+"/"])
})
} catch (e) {
listen(port+1)
}
}


Thanks,

Vulpus



asked 19 secs ago

Vulpus

635





How do I specify a serial port in the following python script using sys.argv and serial?


Vote count:

0




I am relatively new to python, and am trying to specify a bluetooth serial port to be used with a script I obtained from GitHub (http://ift.tt/1oCHfi8). I am on a mac and want to specify a bluetooth device whose port looks like this: "/dev/tty.XXXX-XXX-XXX". So far all of my attempts result in the "no device specified" error provided by the program. How to I embed my serial port path into this script?



#!/usr/bin/python
import sys, struct, array, time, serial

def wait_for_ack():
ddata = ""
ack = struct.pack('B', 0xff)
while ddata != ack:
ddata = ser.read(1)
return

if len(sys.argv) < 2:
print "no device specified"
print "You need to specifiy the serial port of the shimmer you wish to connect to"
print "example:"
print " getBtStreamVersion.py Com5"
print " or"
print " getBtStreamVersion.py /dev/rfcomm0"

print
else:
ser = serial.Serial(sys.argv[1], 115200)
ser.flushInput()


Thanks for your help and sharing your expertise!



asked 31 secs ago






Debian Wheezy Places > Connect To Server Host Key Verification Failed


Vote count:

0




I've got a stumper. First let me say that previously this worked fine, but since I made some changes to my sshd_config file (for added security) I am unable to connect to my Debian Wheezy box (from another Deb Wheezy box) using the Places > Connect To Server options.


I will say that I can connect via ssh back and forth between boxes via a root terminal just fine, but I cannot connect using the same root login from one box to the other. Anybody got any ideas on this?


The only log error I get on the host machine (/var/log/auth.log) is Connection closed by XXX.XXX.XXX.XXX [preauth]. Of course there are no log entries on the client machine.


Here's my sshd_config file from the HOST machine (Removed commented out lines for readability): Port 22 Protocol HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key UsePrivilegeSeparation yes KeyRegenerationInterval 3600 ServerKeyBits 768 SyslogFacility AUTH LogLevel INFO LoginGraceTime 120 PermitRootLogin yes StrictModes no RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile %h/.ssh/authorized_keys IgnoreRhosts yes RhostsRSAAuthentication no HostbasedAuthentication no PermitEmptyPasswords no ChallengeResponseAuthentication no PasswordAuthentication yes X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes Banner /etc/ssh/ssh.banner AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server UsePAM no


And here's the ssh_config file from my CLIENT machine (again, commented out lines removed) Host * PasswordAuthentication yes IdentityFile ~/.ssh/id_rsa SendEnv LANG LC_* HashKnownHosts no GSSAPIAuthentication yes GSSAPIDelegateCredentials no


AFAIK, the only settings I changed prior to it working correctly were on the sshd_config file, probably just the PasswordAuthentication RSAAuthentication and/or PubKeyAuthentication.


Anybody got any ideas? I've hunted around and couldn't find any solutions that worked.


Again, ssh via terminal works fine both ways, but not via Places > Connect To Server (settings SSH, port 22 with root user name and password.) Connect To Server error message on screen shows Host Key Verification Failed.


Thanks in advance for enlightening me.



asked 27 secs ago

Max

3





Google Spreadsheets API with PHP – Fatal error: Uncaught exception


Vote count:

0




I'm trying to get started with the google SpreadSheet API. I know there are a bunch of other languages but PHP is the only one I'm vaguely competent in. I keep falling at the first hurdle and getting:



Fatal error: Uncaught exception 'Google\Spreadsheet\Exception' in
/Users/djave/Google Drive/Sites/practise/gdata/lib/Google/Spreadsheet/ServiceRequestFactory.php:48

Stack trace: #0 /Users/djave/Google Drive/Sites/practise/gdata/lib/Google/Spreadsheet/SpreadsheetService.php(37):
Google\Spreadsheet\ServiceRequestFactory::getInstance()
#1 /Users/djave/Google Drive/Sites/practise/gdata/index.php(32): Google\Spreadsheet\SpreadsheetService->getSpreadsheets()
#2 {main} thrown in /Users/djave/Google Drive/Sites/practise/gdata/lib/Google/Spreadsheet/ServiceRequestFactory.php on line 48


How this happens:


Next, fiddle with the code until it works



set_include_path('lib/');

require_once 'lib/Google/Client.php';
require_once 'lib/Google/Service/Books.php';

$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey("-------------------------------------");
$service = new Google_Service_Books($client);
$optParams = array('filter' => 'free-ebooks');
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);

foreach ($results as $item) {
echo $item['volumeInfo']['title'], "<br /> \n";
}


Result: prints out a list of books


First off I copy the example exactly below what I have, then include all the right files until it can find everything:



set_include_path('lib/');

require_once 'lib/Google/Client.php';
require_once 'lib/Google/Service/Books.php';
require_once 'lib/Google/Spreadsheet/SpreadsheetService.php';
require_once 'lib/Google/Spreadsheet/ServiceRequestFactory.php';
require_once 'lib/Google/Spreadsheet/Exception.php';

$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey("AIzaSyBGP-SKU_z3PBpfzpN-xdEt1GWn6n6j0Gc");
$service = new Google_Service_Books($client);
$optParams = array('filter' => 'free-ebooks');
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);

foreach ($results as $item) {
echo $item['volumeInfo']['title'], "<br /> \n";
}

$spreadsheetService = new Google\Spreadsheet\SpreadsheetService();
$spreadsheetFeed = $spreadsheetService->getSpreadsheets();
$spreadsheet = $spreadsheetFeed->getByTitle('MySpreadsheet');
$worksheetFeed = $spreadsheet->getWorksheets();


But I just get



Fatal error: Uncaught exception 'Google\Spreadsheet\Exception' in /Users/djave/Google Drive/Sites/practise/gdata/lib/Google/Spreadsheet/ServiceRequestFactory.php:48 Stack trace: #0 /Users/djave/Google Drive/Sites/practise/gdata/lib/Google/Spreadsheet/SpreadsheetService.php(37): Google\Spreadsheet\ServiceRequestFactory::getInstance() #1 /Users/djave/Google Drive/Sites/practise/gdata/index.php(23): Google\Spreadsheet\SpreadsheetService->getSpreadsheets() #2 {main} thrown in /Users/djave/Google Drive/Sites/practise/gdata/lib/Google/Spreadsheet/ServiceRequestFactory.php on line 48


I'm doing something really stupid, right? Thanks for any help



asked 16 secs ago

Djave

682





Rails 4 - update_attributes not updating


Vote count:

0




I have the following form:



<%= form_for @user, :html => {:class => 'edit-form' }, :url => {:action => 'add_group', :id => @user.id }, :remote => true do |f| %>
<%= f.select :group_ids, Group.all.collect {|x| [x.name, x.id]}, {}, :class => 'multiselect', :multiple => true %>
<button type="submit" id="submit_it" class="btn btn-primary">Submit</button>
<% end %>


And in my controller:



def add_group
@user = User.find(params[:id])
unless @user.update_attributes(option_params)
respond_to do |format|
format.html
format.js
end
end
end

def option_params
params.require(:user).permit!
end


And thus, when the form is submitted, I do get a response with my "update.js.erb" file, and the following shows up in the console:



Started PATCH "/user_management/add_group?id=41" for 123.45.67.89 at 2014-07-07 22:58:38 +0000
Processing by UserController#update as JS
Parameters: {"utf8"=>"✓", "user"=>{"group_ids"=>["", "3", "4"]}, "multiselect"=>"4", "id"=>"add_group"}
Rendered user/update.js.erb (0.1ms)
Completed 200 OK in 13ms (Views: 11.9ms | ActiveRecord: 0.0ms)


But, nothing actually gets updated in the database.


There are no validations in my model that would be causing this not to update.


My model relationships are such:



class User < ActiveRecord::Base
has_many :group_assignments
has_many :groups, through: :group_assignments
end

class Group < ActiveRecord::Base
has_many :group_assignments
has_many :users, through: :group_assignments
end

class GroupAssignment < ActiveRecord::Base
belongs_to :group
belongs_to :user
end


Any ideas on why this would not be updating?



asked 33 secs ago

Dodinas

1,290





Matplotlib colorbar with a histogram


Vote count:

0




I made a histogram of array x with each bar color-coded according to the average of another property y in that bin. How can I make an associated colorbar?



norm = matplotlib.colors.Normalize(vmin=np.min(y), vmax=np.max(y))
cmap = cm.jet
m = cm.ScalarMappable(norm=norm, cmap=cmap)

fig = plt.figure()
n, bins, patches= plt.hist(x, bins = np.arange(0,max_x) + 0.5)
for i in range(np.size(patches)):
plt.setp(patches[i],color=m.to_rgba(y[i]))
plt.colorbar(norm=norm,cmap=cmap)
plt.show()


This colorbar returns an error message " No mappable was found to use for colorbar creation. First define a mappable such as an image (with imshow) or a contour set (with contourf)."



asked 32 secs ago

Cokes

153





Django upgrade, Import Error and conflicting package names


Vote count:

0




I have an older django project (created while 1.3 was hot) which I'm attempting to convert to the latest Django 1.6.


The new directory strucure was converted to the new way, and the project name was removed from all imports (from myproject.api import x became from api import x)


myproject/ myproject/ __init__.py settings.py urls.py api/ __init__.py resthandler.py platforms/ __init__.py plat1/ __init__.py handlers.py api/ __init__.py


The problem is that platforms/plat1/handlers attempts to import from /api/resthandler.py


from api.resthandler import RestHandler


But as there is already an api at a lower level, it fails with an ImportError as resthandler is not there, its 2 levels up and one down in /api. I've tried returning the project level to imports, tried relative imports, nothing helps. I can't seem to import /api from within platforms/plat1/. I'd go and change the entire structure but I wanted to see if I'm missing something before I take that route.



asked 1 min ago

Harel

405





Creating objects from classes in PHP results with objects with same data


Vote count:

0




I have a problem with my classes. I wrote a class item. When I create objects from this class, there is no problem when creating one, but more objects results in initializing all previous objects with the data from the last one.


This is how i create the objects:



$a = new Item(1, 111, 123, "Laptop", "NOT HP ProBook 450 G1, E9Y47EA", "kom.", 1, 20500, 25000, 18, 12, 1);


So like this everything will be fine if i print it to screen ti will give the following:


Item: | 00001 | Laptop___________________ NOT HP ProBook 450 G1, E9Y47EA____________________ | Units: kom. Availability: 0001 - 20.500,00 - 25.000,00 || G: 12 months


But if I create another Item object:



$b = new Item(2, 222, 456, "DESKTOP", "blah", "kom.", 2, 41000, 46000, 18, 12, 1);


when echoing them i get:


Item: | 00002 | DESKTOP__________________ blah______________________________________________ | Units: kom. Availability: 0002 - 41.000,00 - 46.000,00 || G: 12 months


Item: | 00002 | DESKTOP__________________ blah______________________________________________ | Units: kom. Availability: 0002 - 41.000,00 - 46.000,00 || G: 12 months


As you can see, looks like they are both initialized with equal data.


Anyone, any ideas?


Thanks in advance!



require_once("item.interface.php");
require_once("../conf/numberFormat.config.php");

//class item

class Item implements iItem
{
private static $id; //int
private static $cipher; //int
private static $serialNumber; //big int
private static $name; //string
private static $description; //text
private static $unit; //measurment unit
private static $quantity; //int
private static $price; //double
private static $recomendedPrice; //double
private static $vat; //tiny int
private static $guarantee; //tiny int
private static $warehouse; //small int

//formatting
private static $decimalPoint;
private static $decimals;
private static $thousandSeparator;

public function Item($id, $cipher, $serialNumber, $name, $description, $unit, $quantity, $price, $recomendedPrice,
$vat, $guarantee, $warehouse)
{
self::$id = $id;
self::$cipher = $cipher;
self::$serialNumber = $serialNumber;
self::$name = $name;
self::$description = $description;
self::$unit = $unit;
self::$quantity = $quantity;
self::$price = $price;
self::$recomendedPrice = $recomendedPrice;
self::$vat = $vat;
self::$guarantee = $guarantee;
global $decimalPoint;
self::$decimalPoint = $decimalPoint;
global $decimals;
self::$decimals = $decimals;
global $thousandSeparator;
self::$thousandSeparator = $thousandSeparator;
self::$warehouse = $warehouse;
}

//set methods
public function setId($id)
{
self::$id = $id;
}

public function setCipher($cipher)
{
self::$cipher = $cipher;
}

public function setSerialNumber($serialNumber)
{
self::$serialNumber = $serialNumber;
}

public function setName($name)
{
self::$name = $name;
}

public function setDescription($description)
{
self::$description = $description;
}

public function setUnit($unit)
{
self::$unit = $unit;
}

public function setQuantity($quantity)
{
self::$quantity = $quantity;
}

public function setPrice($price)
{
self::$price = $price;
}

public function setRecomendedPrice($recomendedPrice)
{
self::$recomendedPrice = $recomendedPrice;
}

public function setVat($vat)
{
self::$vat = $vat;
}

public function setGuarantee($guarantee)
{
self::$guarantee = $guarantee;
}

public function setWarehouse($warehouse)
{
self::$warehouse = $warehouse;
}

//get methods
public function getId()
{
return self::$id;
}

public function getCipher()
{
return self::$cipher;
}

public function getSerialNumber()
{
return self::$serialNumber;
}

public function getName()
{
return self::$name;
}

public function getDescription()
{
return self::$description;
}

public function getUnit()
{
return self::$unit;
}

public function getQuantity()
{
return self::$quantity;
}

public function getPrice()
{
return self::$price;
}

public function getRecomendedPrice()
{
return self::$recomendedPrice;
}

public function getVat()
{
return self::$vat;
}

public function getGuarantee()
{
return self::$guarantee;
}

public function getWarehouse()
{
return self::$warehouse;
}

//other methods
public function toString()
{
global $ITEM;
return ucfirst($ITEM).": | " . sprintf("%05d", self::$id) . " | " . STR_PAD(self::$name, 25, "_") .
" <i>" . STR_PAD(self::$description, 50, "_") . "</i> | Units: ".self::$unit." Availability: " .
sprintf("%04d", self::$quantity) . " - " . self::formatPrice(self::$price) .
" - " . self::formatPrice(self::$recomendedPrice) . " || G: " . self::$guarantee .
" months";
}

public function toHTML()
{
return false;
}

private function formatPrice($input)
{
return number_format($input, self::$decimals, self::$decimalPoint, self::$thousandSeparator);
}
}


asked 21 secs ago

Dean

16





Setup and configure raspberry pi to connect with wpa2-enterprise networks


Vote count:

0




I'm currently studying at school and it uses wpa2-enterprise security settings to access their wifi.


How would I configure my raspberry pi so that it will connect to this kind of wifi?



asked 31 secs ago






Passing strings as arguments in dplyr verbs


Vote count:

0




I would like to be able to define arguments for dplyr verbs



filter1<- "!is.na(attend)"
filter2<- "is.na(attend)"


and then use these strings in dply functions :



ds1<- ds %>%
filter(eval(cat(filter2)))
ds2<- ds %>%
filter(eval(cat(filter1)))


But it throws in error



!is.na(attend)
Error: filter condition does not evaluate to a logical vector.


How to pass a string as an argument in a dplyr verb?



asked 49 secs ago

andrey

160





RestKit POSTed managed object becomes duplicate when response is enveloped in an array


Vote count:

0




When I POST a Core Data managed object using RestKit, RestKit doesn't update the existing object but creates a new object instead.


The returned JSON always contains the newly created object, but wraps it into a plural keyed array. I found that if I change this to just the one object, the updating works as expected.


I would like to keep the array in the response so that all responses are consistently in the plural form. I tried adding a second identificationAttribute that was set before the POST. My rationale was that RK could use that to identify the object in the local store, but it didn't work.


Is there any way I can make RestKit update the record, even when returned from the server wrapped in an array?


Example request



{
"user": {
"email": "example@example.com",
}
}


Response



{
"users": [{
"email": "example@example.com",
}]
}


asked 33 secs ago

Rengers

4,562





JaCoCo code coverage parameters on SONAR?


Vote count:

0




JaCoCo coverage parameters on SONAR?


I have a question regarding JaCoCo covergare report been published on SONAR.


When I run sonar:sonar, what I observe on the sonar server is that the coverage report only shows the "line coverage".


But the jacoco documentation and the forums say that JaCoCo can show "branch coverage, line coverage, method coverage, class coverage, complexity, instructions coverage"


In order to see the above mentioned coverage parameters, what am I supposed to include and where?


Please help. Would be of great help as I am preparing some comparisons for code analysis and unit test coverage.



asked 42 secs ago






Core Data keeps two objects instead 27 in fetchObjects


Vote count:

0




First step: Upload from Json data(total of data = 27 objects) then i want keep all this objects in my Core Data; Second Step: After time period i checking my Json again for new objects. Compare Core Data objects count with Json objects count, if its different i going to add this objects to my Core Data. But my Core Data has a wrong objects count on the second step(2 objects in fetchObjects). In summary i would like to copy all objects from Json to my Core Data and each ten seconds i check for new objects in my Json. Here is my following code:



- (NSInteger) isNewData: (NSArray *) fetchedObjects
{
///////////json part
NSURLRequest* urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:getMessageURL] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSData * data = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:nil error:nil];
_json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
///////////core data part
//NSManagedObjectContext *context = [self managedObjectContext];
/*NSError *error;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Entity" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];*/
/////////if part
NSLog(@"%d",fetchedObjects.count);
return _json.count - fetchedObjects.count;
}

- (void) loadDataToCoreDataFromJson: (NSInteger) odds andSecond: (NSManagedObjectContext *) context
{
//core data connection
Entity *newList = [NSEntityDescription
insertNewObjectForEntityForName:@"Entity"
inManagedObjectContext:context];
newList = [NSEntityDescription insertNewObjectForEntityForName:@"Entity" inManagedObjectContext:context];
for (int i = 0; i < odds; i++)//?
{
//NSManagedObjectContext *context = [self managedObjectContext];

newList.login = [[_json objectAtIndex:_json.count - odds + i] objectForKey:@"login"];
newList.message = [[_json objectAtIndex:_json.count - odds + i] objectForKey:@"message"];
newList.date = [[_json objectAtIndex:_json.count - odds + i] objectForKey:@"date"];
[context save:nil];
}

}

- (void) loadDataFromCoreDataToArrays : (NSArray*) fetchedObjects
{
_getDate = [[NSMutableArray alloc] init];
_getMessage = [[NSMutableArray alloc] init];
_getLogin = [[NSMutableArray alloc] init];
///////////core data part connection
//NSManagedObjectContext *context = [self managedObjectContext];
for (int i = 0; i < fetchedObjects.count; i++)
{
Entity * info = [fetchedObjects objectAtIndex:i];
[_getLogin addObject:info.login];
[_getMessage addObject:info.message];
[_getDate addObject:info.date];
}

}

- (void) chating
{
AppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
NSManagedObjectContext *context = appDelegate.managedObjectContext;
NSError *error;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Entity" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
NSInteger odds = [self isNewData: fetchedObjects]; //0 if no data, if > 0 then there are N new data;
if (odds != 0)
{
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
[self loadDataToCoreDataFromJson: odds andSecond:context];
[self loadDataFromCoreDataToArrays: fetchedObjects];
[self reloadMyTableView];
}
}

- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
_buttonSend.enabled = NO;
[self loadUserDefault];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
_connects++;
NSLog(@"return message");
dispatch_async(dispatch_get_main_queue(), ^{
[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(chating) userInfo:nil repeats:YES];
[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(reloadMyTableView) userInfo:nil repeats:YES];
});
});
}


I think i doing wrong with Core Data. Thanks every body for help.




rmaddy

74k

asked 24 secs ago






Better use one long query or multiple ones?


Vote count:

0




i have this simple function:



$password = 'userinput';
$username = 'userinput02';

$bdd = new PDO('mysql:host=localhost;dbname=mydatabase', 'root', '');
$stmt = $bdd->prepare('SELECT username, hash, someinfo, someotherinfo FROM users WHERE username = ?');
$stmt->execute(array($username));
$reponse = $stmt->fetch();

if($reponse['username'])
{
if(password_verify($password, $reponse['hash']))
{
UseSomeInfo();
echo 'good password';
}
}


and i'm wondering if only selecting the username, wait for 1st statement to be confirmed, then selecting the hash isn't a more efficiant/standard/secure way to do the same thing.



asked 3 mins ago






document.write Javascript function


Vote count:

0




Here's my code:



<script LANGUAGE="Javascript">
function choiceReturn(obj) {
switch(obj.value) {
case "1":
document.write("<input value='Fund (L###)' type='text'
class='button3' onfocus='if(this.value == "Fund (L###)"){this.value = '';}'
onblur="if(this.value == ''){this.value = 'Fund (L###)'}">");

}
}
</script>

<select name="funds_menu" onchange="choiceReturn(this);">
<option selected>Choose 1 to 3</option>
<option value="1">1. Choose fund</option>
<option value="2">2. Prepare data</option>
<option value="3">3. Perform valuation</option>
</select>


My intention: Upon selecting the first item from the list, the Fund (L###) input box appears. I also have some minor code onblur and onfocus to make this a bit cooler.


However, nothing happens. What am I doing wrong? There's a lot of quotation marks there. Perhaps that's what's messing this up.



asked 1 min ago


1 Answer



Vote count:

0




Multiline strings aren't a thing in JavaScript. You're going to have to concatenate them separately. Furthermore, some of your nested nested strings aren't escaped properly. Fixed code:



document.write("<input value='Fund (L###)' type='text' " +
"class='button3' onfocus='if(this.value == \"Fund (L###)\"){this.value = '';}' " +
"onblur='if(this.value == \"\"){this.value = \"Fund (L###)\"}'>");


answered 5 secs ago

Doorknob

22.4k




How do I convert an AWSFile to a simple File in ruby?


Vote count:

0




Currently I am doing it in the following way with a tempfile, but I am assuming that there are better approaches to doing this



@file_to_convert = ... # An Fog::AWSFile
Encoding.default_internal = 'ASCII-8BIT'
tempfile = Tempfile.new(['remote-file', ".xlsx"])
tempfile.write(@file_to_convert.body)
tempfile.close
@converted_file = tempfile


Any help would be appreciated



asked 1 min ago






convert string to mysql query using regex


Vote count:

0




i make update by mistake in column in mysql database it become like this way



ID keyword Default_value
1 header_HOME EXCURSIONS
2 header_APARTMENTS EXCURSIONS
3 header_Excursions EXCURSIONS
4 header_Sea_Excursions EXCURSIONS
5 header_Desert_Safari EXCURSIONS
6 header_Sight_Seeing EXCURSIONS
7 header_Shore_excursions EXCURSIONS
8 header_Plan_excursions EXCURSIONS
9 header_Others EXCURSIONS
10 header_Hotels EXCURSIONS


now i want to update my database with this pattern


column 1 - ID is the first number in every line (the same no change )


column 2 - keyword the same value with patter word_word (the same no change )


column 3 - the word or words in column 2 with out first word and '' and also change every '' to ' ' one space


like UPDATE my_table SET keyword = 'header_Sea_Excursions' where id=4



asked 3 mins ago

tito11

1,846





Selecting DataTypes of specific columns Oracle SQl Developer


Vote count:

0




I am trying to generate data_types of specific columns.



Time Date Msg

34.324, 09/13/2011, thankyou,


I would like to generate the type of that specific value


e.g



VarChar2, Date, varchar2(char 30)


I wrote this sql statement below and it works for all the tables



Select data_type, column_name, table_name, owner from all_tab_columns;


However when I try to access specific tables or column_names or both I only get the headers like so..


INPUT



select data_type, column_name, table_name, owner from all_tab_columns where
table_name = 'MyTable' and column_name= 'ColumnOfInterest'


OUTPUT



data_type column_name table_name, owner


Any ideas on what I am doing wrong ?



asked 45 secs ago






Cakephp ajax form won't load the right view


Vote count:

0




I'm just trying to call a function from a form submision (which is also call from ajax).


I want to call the add method but it's the index which always called.


My ajax view with the ajax submission form :



<?php $count = count($files); ?>
<div id="message"></div>
<i><?= __('Nombre de fichiers liés : ') . $count ?></i>
<?= $this->Form->create('FilesManager', array('enctype' => 'multipart/form-data', 'url' => array('action' => 'add'))); ?>
<?= $this->Form->input('file', array('type' => 'file', 'label' => false, 'class' => 'form-control')); ?>
<?= $this->Js->submit('Envoyer', array('update' => '#message', 'div' => false, 'type' => 'json', 'async' => false)); ?>
<?= $this->Js->writeBuffer(); ?>


i've also tried :



<?= $this->Form->create(null, array('enctype' => 'multipart/form-data', 'url' => array('controller' => 'FilesManagers', 'action' => 'add'))); ?>

<?= $this->Form->create('FilesManager/add', array('enctype' => 'multipart/form-data')); ?>


asked 1 min ago






Ubuntu 10.04 Sublime Text 2 Installation Error /usr/bin/dpkg returned an error code (1)


Vote count:

0




I'm trying to install Sublime Text 2 for Ubuntu 10.04 which should be straightforward. However, I get this error message when I try to complete install:



Setting up sublime-text (2.0.2-1~webupd8~3) ...
cp: cannot stat `/var/cache/sublime-text-2/Sublime Text 2/*': No such file or directory
dpkg: error processing sublime-text (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
sublime-text
E: Sub-process /usr/bin/dpkg returned an error code (1)


I've checked my directory and I'm 100% certain that this directory exists:



/var/cache/sublime-text-2/Sublime Text 2/*'


The contents of the directory contain these files inside:



Sublime Text 2.0.2 x64.tar.bz2


This naturally leads me to believe that the error is /usr/bin/dpkg. I've tried looking into it and have already attempted these commands:



sudo apt-get clean
sudo apt-get update && sudo apt-get upgrade


and then:



sudo dpkg --configure -a
sudo apt-get -f install


The errors are the same for these commands.


A last ditch effort would be to try this solution that I found from the following link:


Potential Sublime Text 2 Ubuntu Solution


The post says to implement this solution for the problem files which in my case would be /var/cache/sublime-text-2/Sublime Text 2/*



sudo dpkg -i --force-overwrite <filename>
sudo apt-get -f install

For the above two files you’d execute:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/file
sudo apt-get -f install


I tried this and I still get the same error.



sudo dpkg -i --force-overwrite /var/cache/sublime-text-2/Sublime Text 2/*


Did I type this incorrectly? I have a feeling that the astericks is incorrect. Any help would be appreciated. I'm running out of options. Thanks.



asked 48 secs ago






validating file contents when uploading to Django form


Vote count:

0




I am trying to validate a CSV file uploaded into Django Admin - to make sure it's in the right format and so on.


It also relies on another value in the form so I am validating it inside the forms clean method:



def clean(self):
cleaned_data = super(CSVInlineForm, self).clean()
csv_file = cleaned_data.get('csv_file')
contents = csv_file.read()
# ...validate contents here...
return cleaned_data


My model save method looks like this:



def save(self, *args, **kwargs):
contents = self.csv_file.read()
# ... do something with the contents here ...
return super(CSVModel, self).save(*args, **kwargs)


The problem comes when I read the file contents inside the clean method, I can not read the csv_file inside the model save method (it returns an empty string). Inside the clean method I can read and parse the file.


The file is uploaded perfectly fine and intact.


If I comment out the csv_file.read() line in the clean method, the save method works fine and can read the file contents.


It's behaving as if the file can only be read once?


And if I re-save the model the file reading and parsing works normally.


This is all within django admin - the forms are being handled correctly as far as I can tell.



asked 1 min ago






Modal View controller not displaying at Center


Vote count:

0




I am working on an ipad app where i have to display a table view as form sheet, when i click a cell in the table the form should resize


I wrote this code



-(void)viewWillAppear:(BOOL)animated
{
self.view.superview.frame = CGRectMake(0, 0, 290, 620);
}


and when a cell is clicked i wrote self.view.superview.bounds = CGRectMake(0, 0, 600, 620); in did select row at index path.... both these times the form sheet is not displayed in the center. Where am i going wrong. Is there any other method to implement this behaviour



asked 2 mins ago






How to restrict button to cause validation to specific controls?


Vote count:

0




I have textboxes and a grid view. Inside grid view there are text boxes which are also validating. And in the footer there is a button which create new row if grid view current row pass the validation.


The problem is that when buton inside grid view is pressed it also validates the contents outside the grid. How to control this?


My aspx code is as:



<h4>Worked Date</h4>
<asp:TextBox runat="server" ID="txtDateOfWorkForInserting" CssClass="form-control" EnableViewState="false" ClientIDMode="Static" ValidateEmptyText="true"/>
<asp:RequiredFieldValidator ID="rfvDateOgWork"
CssClass="text-danger" ControlToValidate="txtDateOfWorkForInserting"
runat="server" EnableViewState="true" ErrorMessage="*" ToolTip="Select Date" Display="Dynamic" ></asp:RequiredFieldValidator>

<asp:GridView ID="gvWorkDone" runat="server" ShowFooter="True" AutoGenerateColumns="False"
CellPadding="4" GridLines="None" OnRowDeleting="gvWorkDone_RowDeleting" CssClass="table-responsive table table-striped"
Style="text-align: left" >
<Columns>
<asp:BoundField DataField="RowNumber" HeaderText="SNo" />
<asp:TemplateField HeaderText="Work Description">
<ItemTemplate>
<asp:TextBox ID="txtWorkDone" runat="server" CssClass="form-control multilineTextbox" TextMode="MultiLine" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtWorkDone"
ErrorMessage="*" SetFocusOnError="True" InitialValue="<% %>"></asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Time To Complete">
<ItemTemplate>
<asp:DropDownList runat="server" ID="ddlTotalTime">
<asp:ListItem Selected="True">1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>6</asp:ListItem>
<asp:ListItem>7</asp:ListItem>
<asp:ListItem>8</asp:ListItem>
<asp:ListItem>9</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlTotalTime"
ErrorMessage="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" />
<FooterTemplate>
<asp:Button ID="ButtonAdd" runat="server" Text="Add New Row" OnClick="ButtonAdd_Click" CausesValidation="false"/>
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>


asked 1 min ago






bluez compatible kernel version


Vote count:

0




I am using the kernel version 3.0.35 with bluez-4.98 in linux. With this I'm able to advertise the ibeacon as per the hcitool command given in one of the SO questions. I am also able to connect to the other ble device but not able to list its services using 'primary' in gatttool.


I want to use my device now as a peripheral to let other device to get its Device Information, and later in the Central mode to know the Device Information of other ble devices.


Will this kernel version and bluez version be compatible for the task?



asked 1 min ago






Join SQL query optimization


Vote count:

0




I've been trying to improve performance of my query which is executing quite a long time. I've already checked explain plan and it looks ok (two nested loops, usage of index) Can you spot any improvement possibilities? Maybe some of the functions I'm using aren't too fast? Or maybe its just a problem of large data set and there is not much I can do? Thanks for any advice!



SELECT COUNT(*),
TRUNC(a_tab.some_date) ,
TO_CHAR(MIN(a_tab.some_date),'dd/MM/YYYY HH24:mm:ss') ,
TO_CHAR(MAX(a_tab.some_date),'dd/MM/YYYY HH24:mm:ss')
FROM TABLE_A a_tab
JOIN TABLE_B b_tab
ON a_tab.id = b_tab.a_tab_id
where b_tab.keyword_name = 'NAME_X'
AND b_tab.keyword_value = 'VALUE_X'
AND a_tab.some_date BETWEEN to_date('01/05/2014','dd/MM/YYYY') AND to_date('01/06/2014','dd/MM/YYYY')
AND extract (hour FROM a_tab.some_date) BETWEEN 0 AND 13
GROUP BY TRUNC(a_tab.some_date)
ORDER BY TRUNC(a_tab.some_date);


asked 36 secs ago

xwhyz

305





Need help on MYSQL QUERY (SUM)


Vote count:

0




I need some help from you with a SELECT QUERY. I just wanted to sum correctly the following table. The table is a synthese from several other tables. I probably will add an id int value for student's name instead of text to make it easier to goup - but this is not my problem.


I want to sum for each student the three types of absent lessons. But with my sql I got only one each time! What am I doing wrong? I tried several changes but I didn't find it out..


I wanted to add a screen from my mysql table but I don't have enough reputation..



SELECT DISTINCT (P.synthese_abs_schueler_name) AS synthese_abs_schueler_name,
SUM(A.synthese_sum) AS absent,
SUM(B.synthese_sum) AS nonexcused,
SUM(C.synthese_sum) AS tardive,
SUM(absent + nonexcused) AS totalabs,
FROM
synthese_abs AS P
LEFT JOIN (SELECT synthese_abs_schueler_name, synthese_abs_type, synthese_abs_sum AS synthese_sum FROM synthese_abs WHERE synthese_abs_type = 1 AND synthese_abs_sum >0 GROUP BY synthese_abs_schueler_name) AS A
ON A.synthese_abs_type = P.synthese_abs_type AND A.synthese_abs_schueler_name = P.synthese_abs_schueler_name

LEFT JOIN (SELECT synthese_abs_schueler_name, synthese_abs_type, synthese_abs_sum AS synthese_sum FROM synthese_abs WHERE synthese_abs_type = 2 AND synthese_abs_sum >0 GROUP BY synthese_abs_schueler_name) AS B
ON B.synthese_abs_type = P.synthese_abs_type AND B.synthese_abs_schueler_name = P.synthese_abs_schueler_name

LEFT JOIN (SELECT synthese_abs_schueler_name, synthese_abs_type, synthese_abs_sum AS synthese_sum FROM synthese_abs WHERE synthese_abs_type = 3 AND synthese_abs_sum >0 GROUP BY synthese_abs_schueler_name) AS C
ON C.synthese_abs_type = P.synthese_abs_type AND C.synthese_abs_schueler_name = P.synthese_abs_schueler_name

ORDER BY P.synthese_abs_schueler_name


asked 36 secs ago






Own TDataSet descendant using an interface as proxy to another dataset


Vote count:

0




I try to use an universal over an interface. This works.


Now I want to create a TDataSet descendant, which gets its data over this interface. Unfortunately I did not manage to hold the current record in sync. So if I attach my TDataSet to a TDataSource and attach this to a TDBGrid, I get only the first entry. If I try to update the current record in GetFieldData, all entries except the first are empty in my grid. If I do not update anything, the first entry is duplicated in all rows.


One problem is, that TDataLink writes directly in a private field (it resides in the same unit) instead of using a method or property. Another problem is, that I cannot overwrite many methods of TDataSet because the developers where so clever not to make them virtual...


For example I tried to set the private field FActiveRecord over a pointer to the property ActiveRecord and update it by UpdateCursorPos. But it crashes in UpdateCursorPos.


When I debug, I see that RecordCount contains the correct value, but FRecordCount is 1.


Unfortunately there is no real documentation regarding creating an own descendant of TDataSet. And all material I found (most links are dead), did not really help me because I cannot use it if I do not directly manage the data.


I created a small project out of the units I already had and boiled it down a bit. You can find it here: http://ift.tt/1rGykQf The FireDAC units can be deleted, you can use whatever TDataSet you like to test. You only have to replace TestTable in FormCreate in: TDatasetGateway.Create(TestTable)


Has someone experience with TDataSet descendants and can help me? Thank you!



asked 1 min ago






Detect full IE version in JS


Vote count:

0




First of all, I am sorry if it was already asked, but I would like to know how i can detect (using javascript) which exact version of IE is running.


I already know window.navigator.userAgent witch returns ... MSIE 8.0 ... , but what i want is 8.0.6 or 8.0.9 (they have differences, some things that work in 8.0.9 doesn't work in 8.0.6)


Thanks for reading.



asked 32 secs ago






WAI-ARIA - selected menuitem


Vote count:

0




I'm doing some code clean up / validation in a web site, and have run into an issue.


According to the WAI-ARIA spec, the state aria-selected is not allowed on the role menuitem: http://ift.tt/1hGzxP2. Neither can I find any state for menuitem that seem to mark the menuitem as selected: http://ift.tt/1jYt3f1.


The menustructure is like this:



<nav role="navigation">
<ul role="menubar">
<li role="menuitem" aria-selected="true">
<a href="currentpage">Current page</a>
</li>
<li role="menuitem">
<a href="anotherpage">Another page</a>
</li>
</ul>
</nav>


What would be the correct implementation of a selected menuitem?



asked 39 secs ago






Excel VBA select and delete sheets using UserForm


Vote count:

0




My userform was supposed to make a list of existing sheets in the current workbook, and allow the user to choose which sheets to keep. Then it would remove the rest. Unfortunately, the program seems to remove sheets at random, and I can not think of a solution. Could you help me? I am a beginner in VBA. The code is below.



Option Explicit

Private Sub UserForm_Initialize()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
UserForm1.ListBox1.AddItem (WS.Name)
ListBox1.MultiSelect = fmMultiSelectMulti
Next
End Sub

Private Sub CommandButton1_Click()
Dim I, A As Long
A = ListBox1.ListCount
For I = 0 To A - 1
If ListBox1.Selected(I) = False Then
Sheets(I + 1).Delete
End If
Next
Unload (UserForm1)
End Sub


PS. I tried using sheet names, but I couldn't figure out a way to get names of the non-selected sheets from the list. ListBox(I).Name didn't seem to work.



asked 51 secs ago






Maximum value of a direct fourier transform


Vote count:

0




I have a list of samples of a wave with all values between -1 and +1. Those values have been read from a music file. I will now,



  1. apply the direct fourier transform, (scipy.fftpack.rfft)

  2. normalize the values by dividing them by the square root of the number of samples,

  3. calculate the power for each item in the list. (sqrt(real^2 + imag^2))


What are the maximum values I can expect to be in this list after all of this? I would have expected the maximum power to be 1, as the maximum amplitude in the input data is also 1. However, this is only the case for a simple sine wave. As soon as I start doing this with real music, I get higher values.


How would I "normalize" the power to get values between 0and 1? Is it even possible to find out the maximum value? If not, what is the best practice to scale the results?



asked 2 mins ago

anroesti

2,150





iOS 7 Open folder animation


Vote count:

0




I'd like to know if someone knows how to reproduce the animation when users open an app folder on iPhone home screen. It looks like you "dive" in the folder. I'm adding a files explorer to my app to browse dropbox users photos, I'm using a UICollectionViewController to do it and I would like to reproduce the animation when the user open a folder.


I've found some blogs to do iOS 6 animation, like splitting the screen when a folder is open but I really want to implement the iOS 7 one.


Thanks



asked 28 secs ago






Zend elements or Validator


Vote count:

0




Is there a zend form element or validator method I can use for user input that accepts both numbers and characters e.g 525555CPG . Or am I going to have to create a custom one.



asked 1 min ago






how to find selected text in html


Vote count:

0




how i can to find selected text in a div , in html


for example we have selected from 5 to 11 in this text :



<div id="txt" >This is some <i> text </i> </div>


selected : is some ,


but in html is : id="txt


how to find this and replace between <p> or <span> that other tags to avoid loss of ?


excuse me for my bad english :)



asked 48 secs ago






ROR: How to sort array with .limit method


Vote count:

0




I want to show the records based on created date DESC.But I have to select only one record for each user based on created date DESC. For that I am using the .limit method to get only one record from database and .order method to sort the array like this:



@messages = Message.where('FromUserId = ? or ToUserId = ?', user.id, user.id).order('created_at DESC').limit(1)
array = Array.new
@messages.each do |message|
response = Hash.new
response[:id]=message.id
response[:from]=message.FromUserId
response[:to]=message.ToUserId
response[:date]=message.created_at.strftime("%d/%m/%y %I:%M %p")
response[:content]=message.MessageContent
array.push(response)
end


But it is showing the old record on the top when I loop the array I also tried using this one:



@messges = array.sort { |a,b| a[:date] <=> b[:date] }


But again I get the same result.Can someone tell me what is the right way to do it.



asked 1 min ago






dimanche 6 juillet 2014

Parse error: syntax error, unexpected 'else' (T_ELSE) in php


Vote count:

0




Hey guys I m having a tricky issue but unable to get out of it.


Here I m providing a radio button with namely two option free or paid registration but when I going in else part I m receiving an error.


I checked out the syntax line by line still it is unable to resolve why I m getting and error for else.


Please check and help me out.



<?php $regtype = (isset($postdata['regtype']))? $postdata['regtype']:0;?>
Registration Type: <?php echo $form->radio("regtype",array('0' => $translate->_("Free"),'1' =>$translate->_("Paid")),array('separator'=>"\n",'value'=>$regtype));?>
<?php $type = $_POST['data[regtype]'];?>
<?php if ($type == "Free")
?>
<form action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="POST">
<?php if($agency['monthly_fee'] != ''):?>
<?php echo $form->hidden("monthly_fee",array('value'=>$agency['monthly_fee']));?>
<?php endif;?>

<table class="list" border="0" cellspacing="0" cellpadding="0">

<tr>
<th width="200">Plan</th>
<td>
<?php $a="Monthly Rs.600"; $b="3 months Rs. 1,650"; $c="12 months Rs. 6,000"; ?>
<?php echo $form->select("plan",array($a=>'Monthly Rs.600',$b=>'3 months Rs. 1,650',$c=>'12 months Rs. 6,000'),$postdata["plan"]);?>
</td>
</tr>
<tr>
<th width="200"><?php echo $translate->_("student_master_name");?></th>
<td>
<?php echo $translate->_("student_master_name1");?>:<?php echo $form->text("name1",array('value'=>$postdata["name1"]));?>
<?php echo $translate->_("student_master_name2");?>:<?php echo $form->text("name2",array('value'=>$postdata["name2"]));?>
</td>
</tr>
<?php if($gl_locale=="ja"):?>
<tr>
<th>ローマ字</th>
<td>
Surnames:<?php echo $form->text("roma1",array('value'=>$postdata["roma1"]));?>
Given names:<?php echo $form->text("roma2",array('value'=>$postdata["roma2"]));?>
</td>
</tr>
<?php endif;?>
<tr>
<th scope="row"><?php echo $translate->_("student_master_gender");?></th>
<td>
<?php $gender = (isset($postdata['gender']))? $postdata['gender']:0;?>
<?php echo $form->radio("gender",array('0' => $translate->_("common_male"),'1' =>$translate->_("common_female")),array('separator'=>"\n",'value'=>$gender));?>
</td>
</tr>
<tr>
<th scope="row"><?php echo $translate->_("student_master_birth");?></th>
<td>
<?php echo $form->year("birth",1900,date("Y"),$postdata['birth_year'],array('name'=>'data[birth_year]'),"----"); ?><?php echo $translate->_("common_year");?>
<?php echo $form->month("birth",$postdata['birth_month'],array('name'=>'data[birth_month]'),"--");?><?php echo $translate->_("common_month");?>
<?php echo $form->day("birth",$postdata['birth_day'],array('name'=>'data[birth_day]'),"--");?><?php echo $translate->_("common_day");?>
</td>
</tr>
<tr>
<th><?php echo $translate->_("student_master_country");?></th>
<td>
<?php echo $form->select("country_id",$country_data,$postdata['country_id'],array('id'=>'country'),$translate->_("common_choose"));?>
</td>
</tr>
<tr>
<th><?php echo $translate->_("student_master_email");?></th>
<td><?php echo $form->text("email",array('id'=>'mail','value'=>$postdata['email'])); ?></td>
</tr>
<tr>
<th width="200"><?php echo $translate->_("student_master_login_id");?></th>
<td><?php echo $form->text("login_id",array('class'=>'required ||','value'=>$postdata['login_id']));?> <?php echo $translate->_("bmat-entry-tdtxt");?></td>
</tr>
<tr>
<th><?php echo $translate->_("student_master_login_password");?></th>
<td><?php echo $form->password("login_password",array('class'=>'required ||','value'=>$postdata['login_password']));?></td>
</tr>
<tr>
<th><?php echo $translate->_("student_master_login_password");?>(<?php echo $translate->_("bmat-entry-thtxt");?>)</th>
<td><?php echo $form->password("login_password_cfm",array('class'=>'required ||','value'=>$postdata['login_password_cfm']));?></td>
</tr>
</table>

<?php if(!isset($postdata['c-code'])) $postdata['c-code'] = $coupon_code;?>
<?php echo $form->hidden("c-code",array('class'=>'||','value'=>$postdata['c-code']));?>

<?php echo $form->hidden('MemberInfoToken',array('value'=>$MemberInfoToken))?>
<?php echo $form->hidden('stat',array('value'=>'confirm'))?>

<?php //echo $form->hidden('entry_date',array('value'=>date('Y/m/d')))?>
<?php if($gl_locale == 'ja'):?>
<h3><?php echo $translate->_("bmat-entry-kiyaku");?></h3>
<div id="agreement" class="mrg-t10">
<p class="mrg-t10" style="font-weight:bold;">第1条(本規約の適用)</p>
<p>1. 本規約はイープランニング(以下当社という)が運営する特定ドメイン上のウェブサイト 「B-MAT」(以下当社ウェブサイトという)において提供する教育プログラムサービス(以下本サービスという)を、利用者 (第2条にて定義します)が利用する場合の遵守すべき諸条件を定めるものです。</p>
<p>2. 当社は、本サービスの各々について適宜、個別の利用規約(以下「個別規 約」といいます)を定めることができるものとします。</p>

<p style="font-weight:bold;">第2条(ご利用条件について)</p>
<p>利用者には、当社が当該利用者の利用登録を承認した時点で、当社が提供する本サー ビスを利用する資格(以下、「利用者資格」といいます)が与えられます。<br />
利用者は、本利用規約の他、当社が定める各種の規約(以下、「個別規程」といいます)に同意頂き、本サービ スをご利用ください。 なお、本利用規約と個別規程の定めが異なる場合には、個別規程の定めが優先するものとします。<br />
本利用規約および個別規程(以下、併せて「本利用規約等」といいます)については、利用者に対する事前の通 知なく、当社が変更できるものとします。 本利用規約等が変更された場合、当該変更後の利用者による本サービスの利用に は変更後の本利用規約等が適用されるものとし、当該利用により、利用者は当該変更に同意したものとみなされます。</p>

<p style="font-weight:bold;">第3条(著作権について)</p>
<p>本Webサイトに掲載されている著作物(文書、資料、画像、音声、動画等)の著作権は、 イープランニングまたはその他の権利者に帰属します。 これらの著作物につきましては、別段の定めがある場合を除き、私的 使用その他著作権法で特に認められている範囲を超えてご利用(複製、改変、上映、公衆送信、頒布、再使用許諾等を含 む)はできません。 仮に、営利目的でご使用になった場合、相応の使用料をいただくか、使用差し止めの処置を取る場合もあ りますのでご注意ください。</p>

<p style="font-weight:bold;">第4条(利用上の注意)</p>
<p>利用者は、利用に際して登録した情報(以下、「登録情報」といいます。メールアドレス やパスワード等を含みます)について、自己の責任の下、任意に登録、管理するものとします。 利用者は、第三者にパスワ ードを使用されることのないよう、以下の事項を守らなければなりません。</p>

<p>・第三者に自己のパスワードを公開しないこと。<br />
・複数の人間が使用するコンピュータならびに携帯電話上で本サービスを利用する場合は、本 サービスの利用を終えるときに必ずログアウトしウェブブラウザを終了させること。<br />
・複数の人間が使用するコンピュータ上で本サービスを利用する場合は、ログイン情報記録(ログイン時のメールアド レスとパスワードの入力を省略できる機能)の登録解除を行っておくこと。<br />
・当社は、登録されたパスワードによって本サービスの利用があった場合、利用登録をおこな った本人が利用したものと扱うことができ、当該利用によって生じた結果ならびにそれに伴う一切の責任については、利用登録 を行った本人に帰属するものとします。<br />
登録情報の管理は、利用者が自己の責任の下で行うものとし、登録情報が不正確または虚偽であったために利用 者が被った一切の不利益および損害に関して、当社は責任を負わないものとします。</p>

<p style="font-weight:bold;">第5条(個人情報について)</p>
<p>個人情報は、当社が別途定めるプライバシーポリシーに則り、適正に取り扱うこととしま す。 <br />
利用者の同意なく、機密保持契約を結んだ協力企業以外に利用者の個人情報を開示することはありません。ただ し、以下の場合に、個人情報を開示することがあります。</p>

<p>・法令に基づいて、開示が必要であると当社が合理的に判断した場合<br />
・人の生命、身体または財産の保護のために必要がある場合であって、本人の同意を得るこ とが困難であると判断した場合<br />
・公衆衛生の向上または児童の健全な育成の推進のために特に必要がある場合であって、本 人の同意を得ることが困難であると判断した場合<br />
・国の機関もしくは地方公共団体またはその委託を受けた者が法令の定める事務を遂行するこ とに対して協力する必要がある場合であって、本人の同意を得ることにより当該事務の遂行に支障を及ぼすおそれがあると判断 した場合<br />
・合併その他の事由によりサービスの主体が変更され、サービスの継続のため個人情報を移管する必要があると判断した場合</p>

<p>ワールドカップおよびワールドカップJrに入賞した場合は、名前と国名のみ当サイトのワールドカップサイト内に表示します。</p>

<p style="font-weight:bold;">第6条(免責)</p>
<p>・何らかの原因によるシステム障害が起こった場合、その時の獲得ポイントや賞品が無効となる場合があります。<br />
・ポイント獲得および商品交換など、諸所のルールが途中で変更になる場合があります。 </p>

</div><!--agreement-->

<div id="agree-chk">
<input type="hidden" name="data[agree]" value="0">
<label><input name="data[agree]" type="checkbox" value="1"> <?php echo $translate->_("bmat-entry-doui");?></label>
</div>
<?php else:?>
<input type="hidden" name="data[agree]" value="1">
<?php endif;?>
<div style="text-align:center" class="mrg-t10">
<input type="button" name="back" value="&nbsp;&nbsp;<?php echo $translate->_("otn_member_entry_index_back");?>&nbsp;&nbsp;" onclick="history.back();"/>&nbsp;&nbsp;
<input type="submit" name="btnSubmit" value="&nbsp;&nbsp;<?php echo $translate->_("otn_member_entry_index_confirm");?>&nbsp;&nbsp;" />
</div>
<?php endif;?>

</form>

<?php else:?> **<!-- Here I m getting an error -->**
<label>In paid registration</label>
<?php endif;?>


asked 31 secs ago

Atiq

36





Mapping single column to two columns during load ops in MySQL


Vote count:

0




Below is my text file structure



id | u_name | url | date | time
1 | svk23 | www.google.com | 2013-10- 02 | 23


Below is my target table where I want to load the text file



id|datebin|u_name|url|date|time
1|2013-10-02|http://ift.tt/1odgaz5


I want to map date value to 'datebin' column during load ops...is it possible to do that in MySQl?



asked 1 min ago






Passing a collection to the Spring MVC controller in Angular JS


Vote count:

0




I am using angularjs on the front end and spring MVC for the back end logic


I am familiar with the below code



@RequestMapping(value = "/positions/open/save", method = RequestMethod.POST)
@ResponseBody
public EntityListingApiResponse<OpenPositionRating> saveOpen(@ModelAttribute OpenPositionRating obj, BindingResult bindingResult){
...//code to save
}


This works fine.


Now I want pass the collection of OpenPositionRating object. I tried it using @RequestParam annotation and @ModelAttribute annotation. In case I use @ModelAttribute annotation, it does call the method but I get empty list in the parameters of saveOpen method



@RequestMapping(value = "/positions/open/save", method = RequestMethod.POST)
@ResponseBody
public EntityListingApiResponse<OpenPositionRating> saveOpen(@ModelAttribute ArrayList<OpenPositionRating> obj, BindingResult bindingResult){
...//code to save
}


This doesn't work


Below is the code to call the above method (.js file):



var openPositionRatings = [
{ restrictedUntil: '2014-07-26', rating: 3, id: 20055, openPosition: null, restricted: false },
{ restrictedUntil: '2014-07-26', rating: 5, id: 20053, openPosition: null, restricted: false },
{ restrictedUntil: '2014-07-26', rating: 6, id: 45652, openPosition: null, restricted: true }
];
$http({
url:'api/products/pep/positions/open/save',
method:'POST',
dataType: 'JSON',
data: $.param(openPositionRatings,true),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(data){
}


here openPositionRating is explicit javascript object created for testing.


Below is my OpenPositionRating entity:



@Entity
@Table(name="OPEN_POSITION_RATING")
public class OpenPositionRating implements Serializable {
@Id
@Column(name="ID")
private Long id;

@OneToOne(cascade = {}, fetch = FetchType.LAZY)
@JoinColumn(name="POSITION_ID", unique = false)
private OpenPosition openPosition;

@Column(name="RATING", updatable=true, insertable=true, nullable=true)
private Integer rating;

@Column(name="RESTRICTED", updatable=true, length=1, nullable=false)
private Boolean restricted;

@Temporal(TemporalType.DATE)
@Column(name="RESTRICTED_UNTIL", updatable=true, nullable=true, length=7)
private Date restrictedUntil;

....//Constructors and setter getters
}


asked 58 secs ago






Utilizing the Parse subdomain


Vote count:

0




So, using Parse, I navigated to the "Settings" tab on my App's dashboard and clicked on the side option called "Web Hosting." Then, I typed in my App's name next to the parseapp.com.


Now my App's subdomain is myapp.parseapp.com


However, I am having trouble figuring out how to utilize my App's subdomain. I have my App running on CloudCode right now through Parse's servers but want to put my files on the subdomain so when I load myapp.parseapp.com my web app shows up.


Could someone point me in the right direction?


Thank you!



asked 26 secs ago