PostId
int64 13
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 3
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -33
210k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
5.77k
| Title
stringlengths 10
250
| BodyMarkdown
stringlengths 12
30k
| Tag1
stringlengths 1
25
⌀ | Tag2
stringlengths 1
25
⌀ | Tag3
stringlengths 1
25
⌀ | Tag4
stringlengths 1
25
⌀ | Tag5
stringlengths 1
25
⌀ | PostClosedDate
stringlengths 19
19
⌀ | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 47
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,821,816 | 03/22/2012 11:58:49 | 384,253 | 07/06/2010 07:01:42 | 479 | 1 | How to redraw the customview (which is subview of another viewcontroller's view) when the device is orientedin iphone sdk | My custom view having the methods as
- (id) initWithSundayAsFirst:(BOOL)s frame:(CGSize)frame {
viewSize = frame;
if (!(self = [super initWithFrame:CGRectMake(0, 0, frame.width, frame.height)])) return nil;
self.backgroundColor = [UIColor grayColor];
if(is_iPad())
viewSize.width = frame.width - 80;
else
viewSize.width = frame.width - 25;
viewSize.height = frame.height-80;
sunday = s;
currentTile = [[TKCalendarMonthTiles alloc] initWithMonth:[[NSDate date] firstOfMonth] marks:nil startDayOnSunday:sunday parentFrame:viewSize];
NSLog(@"\n current tile date === %@",currentTile.dateSelected);
[currentTile setTarget:self action:@selector(tile:)];
if(is_iPad())
self.frame = CGRectMake(40, 40, viewSize.width, viewSize.height);
else
self.frame = CGRectMake(12, 40, viewSize.width, viewSize.height);
self.backgroundColor = [UIColor clearColor];
//[self addSubview:self.topBackground];
[self.tileBox addSubview:currentTile];
[self addSubview:self.tileBox];
return self;
}
And My drawRect method looks like:
- (void) drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect r = CGRectMake(0, 0, tileSize.width, tileSize.height);
if(today > 0){
int pre = firstOfPrev > 0 ? lastOfPrev - firstOfPrev + 1 : 0;
int index = today + pre-1;
CGRect r =[self rectForCellAtIndex:index];
r.origin.y -= 7;
}
CGColorRef whiteColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0].CGColor;
CGContextSetStrokeColorWithColor(context, whiteColor);
CGContextSetLineWidth(context, 1.0);
UIFont *font;
UIFont *font2;
int index = 0;
if(is_iPad())
{
font = [UIFont boldSystemFontOfSize:dateFontSizeForIPAD];
font2 =[UIFont boldSystemFontOfSize:dotFontSize];
}
else
{
font = [UIFont boldSystemFontOfSize:dateFontSizeForIPHONE];
font2 =[UIFont boldSystemFontOfSize:dotFontSize];
}
UIColor *color = [UIColor grayColor];
NSString *tiledate;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"dd-MM-YYYY"];
tiledate =[dateFormatter stringFromDate:monthDate];
// NSDate *tilemonthDate = monthDate;
NSLog(@"\n Tile month date value = %@",tiledate);
NSArray *dateArray = [tiledate componentsSeparatedByString:@"-"];
NSString *monthValue = [dateArray objectAtIndex:1];
if(firstOfPrev>0){
[color set];
for(int i = firstOfPrev;i<= lastOfPrev;i++){
r = [self rectForCellAtIndex:index];
if ([marks count] > 0)
[self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2 month:nil];
else
[self drawTileInRect:r day:i mark:NO font:font font2:font2 month:nil];
index++;
}
}
color = [UIColor whiteColor];
[color set];
for(int i=1; i <= daysInMonth; i++){
r = [self rectForCellAtIndex:index];
if(today == i) [[UIColor redColor] set];
if ([marks count] > 0)
{
[self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2 month:monthValue];
}
else
[self drawTileInRect:r day:i mark:NO font:font font2:font2 month:monthValue];
if(today == i) [color set];
index++;
}
[[UIColor grayColor] set];
int i = 1;
while(index % 7 != 0){
r = [self rectForCellAtIndex:index] ;
if ([marks count] > 0)
[self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2 month:nil];
else
[self drawTileInRect:r day:i mark:NO font:font font2:font2 month:nil];
i++;
index++;
}
[self setNeedsLayout];
}
In my viewcontroller The code is like:
psMonthView = (TKCalendarMonthView*)[[TKCalendarMonthView alloc] initWithSundayAsFirst:YES frame:self.view.bounds.size];
psMonthView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
psMonthView.eventDelegate = self;
[self.view addSubview:psMonthView];
I made this custom view as subview to another viewcontrollers view.
When I autorotate the device how should I redraw the contents in the customview?
Any help, really appreciated,
Thanks to all,
Monish.
| iphone | objective-c | customview | null | null | null | open | How to redraw the customview (which is subview of another viewcontroller's view) when the device is orientedin iphone sdk
===
My custom view having the methods as
- (id) initWithSundayAsFirst:(BOOL)s frame:(CGSize)frame {
viewSize = frame;
if (!(self = [super initWithFrame:CGRectMake(0, 0, frame.width, frame.height)])) return nil;
self.backgroundColor = [UIColor grayColor];
if(is_iPad())
viewSize.width = frame.width - 80;
else
viewSize.width = frame.width - 25;
viewSize.height = frame.height-80;
sunday = s;
currentTile = [[TKCalendarMonthTiles alloc] initWithMonth:[[NSDate date] firstOfMonth] marks:nil startDayOnSunday:sunday parentFrame:viewSize];
NSLog(@"\n current tile date === %@",currentTile.dateSelected);
[currentTile setTarget:self action:@selector(tile:)];
if(is_iPad())
self.frame = CGRectMake(40, 40, viewSize.width, viewSize.height);
else
self.frame = CGRectMake(12, 40, viewSize.width, viewSize.height);
self.backgroundColor = [UIColor clearColor];
//[self addSubview:self.topBackground];
[self.tileBox addSubview:currentTile];
[self addSubview:self.tileBox];
return self;
}
And My drawRect method looks like:
- (void) drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect r = CGRectMake(0, 0, tileSize.width, tileSize.height);
if(today > 0){
int pre = firstOfPrev > 0 ? lastOfPrev - firstOfPrev + 1 : 0;
int index = today + pre-1;
CGRect r =[self rectForCellAtIndex:index];
r.origin.y -= 7;
}
CGColorRef whiteColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0].CGColor;
CGContextSetStrokeColorWithColor(context, whiteColor);
CGContextSetLineWidth(context, 1.0);
UIFont *font;
UIFont *font2;
int index = 0;
if(is_iPad())
{
font = [UIFont boldSystemFontOfSize:dateFontSizeForIPAD];
font2 =[UIFont boldSystemFontOfSize:dotFontSize];
}
else
{
font = [UIFont boldSystemFontOfSize:dateFontSizeForIPHONE];
font2 =[UIFont boldSystemFontOfSize:dotFontSize];
}
UIColor *color = [UIColor grayColor];
NSString *tiledate;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"dd-MM-YYYY"];
tiledate =[dateFormatter stringFromDate:monthDate];
// NSDate *tilemonthDate = monthDate;
NSLog(@"\n Tile month date value = %@",tiledate);
NSArray *dateArray = [tiledate componentsSeparatedByString:@"-"];
NSString *monthValue = [dateArray objectAtIndex:1];
if(firstOfPrev>0){
[color set];
for(int i = firstOfPrev;i<= lastOfPrev;i++){
r = [self rectForCellAtIndex:index];
if ([marks count] > 0)
[self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2 month:nil];
else
[self drawTileInRect:r day:i mark:NO font:font font2:font2 month:nil];
index++;
}
}
color = [UIColor whiteColor];
[color set];
for(int i=1; i <= daysInMonth; i++){
r = [self rectForCellAtIndex:index];
if(today == i) [[UIColor redColor] set];
if ([marks count] > 0)
{
[self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2 month:monthValue];
}
else
[self drawTileInRect:r day:i mark:NO font:font font2:font2 month:monthValue];
if(today == i) [color set];
index++;
}
[[UIColor grayColor] set];
int i = 1;
while(index % 7 != 0){
r = [self rectForCellAtIndex:index] ;
if ([marks count] > 0)
[self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2 month:nil];
else
[self drawTileInRect:r day:i mark:NO font:font font2:font2 month:nil];
i++;
index++;
}
[self setNeedsLayout];
}
In my viewcontroller The code is like:
psMonthView = (TKCalendarMonthView*)[[TKCalendarMonthView alloc] initWithSundayAsFirst:YES frame:self.view.bounds.size];
psMonthView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
psMonthView.eventDelegate = self;
[self.view addSubview:psMonthView];
I made this custom view as subview to another viewcontrollers view.
When I autorotate the device how should I redraw the contents in the customview?
Any help, really appreciated,
Thanks to all,
Monish.
| 0 |
9,423,763 | 02/24/2012 00:44:39 | 200,166 | 10/31/2009 14:41:29 | 9,361 | 196 | How To Make Commons Configuration's setListDelimiter Work? | I would like to use an alternate list delimiter in Apache Commons Configuration. However, despite trying a great many different ways of accessing a Configuration object and setting its list delimiter, I can never get it to actually use anything other than the default comma delimiter.
I'm using Commons Configuration version 1.8.0 with Java 1.6.0_29 on Mac OS X.
Randall Schulz | apache-commons-config | null | null | null | null | null | open | How To Make Commons Configuration's setListDelimiter Work?
===
I would like to use an alternate list delimiter in Apache Commons Configuration. However, despite trying a great many different ways of accessing a Configuration object and setting its list delimiter, I can never get it to actually use anything other than the default comma delimiter.
I'm using Commons Configuration version 1.8.0 with Java 1.6.0_29 on Mac OS X.
Randall Schulz | 0 |
4,996,837 | 02/14/2011 20:19:36 | 616,782 | 02/14/2011 20:11:23 | 1 | 0 | python code execution - no output | When I run these 2 python files: it executes correctly but doesn't produce any output. How do I check the output?
# Features:
# - Searching for devices
# - Listing devices
# - Handling events (new device located, removed device)
from brisa.core.reactors import install_default_reactor
reactor = install_default_reactor()
from brisa.core.threaded_call import run_async_function
from brisa.upnp.control_point.control_point import ControlPoint
from datetime import datetime
service = ('u', 'urn:schemas-upnp-org:service:SwitchPower:1')
binary_light_type = 'urn:schemas-upnp-org:device:BinaryLight:1'
tempo_initial = 0
tempo_final = 0
def on_new_device(dev):
""" Callback triggered when a new device is found.
"""
print 'Got new device:', dev.udn
print "Type 'list' to see the whole list"
if not dev:
return
def on_removed_device(udn):
""" Callback triggered when a device leaves the network.
"""
print 'Device is gone:', udn
def get_switch_service(device):
return device.services[service[1]]
def create_control_point():
""" Creates the control point and binds callbacks to device events.
"""
c = ControlPoint()
c.subscribe('new_device_event', on_new_device)
c.subscribe('removed_device_event', on_removed_device)
return c
def main():
""" Main loop iteration receiving input commands.
"""
c = create_control_point()
c.start()
run_async_function(_handle_cmds, (c, ))
reactor.add_after_stop_func(c.stop)
reactor.main()
def _exit(c):
""" Stops the _handle_cmds loop
"""
global running_handle_cmds
running_handle_cmds = False
def _help(c):
""" Prints the available commands that are used in '_handle_cmds' method.
"""
print 'Available commands: '
for x in ['exit', 'help', 'search', 'set_light <dev number>',
'get_status', 'get_target', 'turn <on/off>', 'stop',
'list']:
print '\t%s' % x
def _search(c):
""" Start searching for devices of type upnp:rootdevice and repeat
search every 600 seconds (UPnP default)
"""
c.start_search(600, 'upnp:rootdevice')
def _get_status(c):
""" Gets the binary light status and print if it's on or off.
"""
try:
service = get_switch_service(c.current_server)
status_response = service.GetStatus()
if status_response['ResultStatus'] == '1':
print 'Binary light status is on'
else:
print 'Binary light status is off'
except Exception, e:
if not hasattr(c, 'current_server') or not c.current_server:
print 'BinaryLight device not set.Please use set_light <n>'
else:
print 'Error in get_status():', e
def _get_target(c):
""" Gets the binary light target and print if it's on or off.
"""
try:
service = get_switch_service(c.current_server)
status_response = service.GetTarget()
if status_response['RetTargetValue'] == '1':
print 'Binary light target is on'
else:
print 'Binary light target is off'
except Exception, e:
if not hasattr(c, 'current_server') or not c.current_server:
print 'BinaryLight device not set.Please use set_light <n>'
else:
print 'Error in get_target():', e
def _set_light(c, command):
""" Gets the binary device by the number that is passed as parameter
"""
try:
devices = c.get_devices().values()
c.current_server = devices[int(command)]
service = get_switch_service(c.current_server)
service.event_subscribe(c.event_host,
associar_a_evento, None,
True, renovacao_associar_evento)
service.subscribe_for_variable('Status',novo_evento)
if c.current_server and \
c.current_server.device_type != binary_light_type:
print 'Please choose a BinaryLight device.'
c.current_server = None
except:
print 'BinaryLight number not found. Please run list and '\
'check again'
c.current_server = None
def _turn(c, command):
""" Turns the binary device on or off
"""
try:
cmd = {'on': '1', 'off': '0'}.get(command, '')
if not cmd:
print 'Wrong usage. Please try turn on or turn off.'
service = get_switch_service(c.current_server)
print service
global tempo_inicial
tempo_inicial = datetime.now()
service.SetTarget(NewTargetValue=cmd)
print 'Turning binary light', command
except Exception, e:
if not hasattr(c, 'current_server') or not c.current_server:
print 'BinaryLight device not set.Please use set_light <n>'
else:
print 'Error in set_status():', e
def _stop(c):
""" Stop searching
"""
c.stop_search()
def _list_devices(c):
""" Lists the devices that are in network.
"""
k = 0
for d in c.get_devices().values():
print 'Device no.:', k
print 'UDN:', d.udn
print 'Name:', d.friendly_name
print 'Device type:', d.device_type
print 'Services:', d.services.keys() # Only print services name
print 'Embedded devices:', [dev.friendly_name for dev in \
d.devices.values()] # Only print embedded devices names
print
k += 1
# Control the loop at _handle_cmds function
running_handle_cmds = True
commands = {'exit': _exit,
'help': _help,
'search': _search,
'stop': _stop,
'list': _list_devices,
'turn': _turn,
'set_light': _set_light,
'get_status': _get_status,
'get_target': _get_target}
def _handle_cmds(c):
while running_handle_cmds:
try:
input = raw_input('>>> ').strip()
if len(input.split(" ")) > 0:
try:
if len(input.split(" ")) > 1:
commands[input.split(" ")[0]](c, input.split(" ")[1])
else:
commands[input.split(" ")[0]](c)
except KeyError, IndexError:
print 'Invalid command, try help'
except TypeError:
print 'Wrong usage, try help to see'
except KeyboardInterrupt, EOFError:
c.stop()
break
# Stops the main loop
reactor.main_quit()
if __name__ == '__main__':
main()
File 2 code:
from brisa.core.reactors import install_default_reactor
reactor = install_default_reactor()
import os
from brisa.upnp.device import Device, Service
class SwitchPower(Service):
def __init__(self):
Service.__init__(self, 'SwitchPower',
'urn:schemas-upnp-org:service:SwitchPower:1',
'',
os.getcwd() + '/SwitchPower-scpd.xml')
self.target = False
self.status = False
def soap_SetTarget(self, *args, **kwargs):
self.target = kwargs['newTargetValue']
print 'Light switched ', {'1': 'on', '0': 'off'}.get(self.target, None)
self.status = self.target
return {}
def soap_GetTarget(self, *args, **kwargs):
return {'RetTargetValue': self.target}
def soap_GetStatus(self, *args, **kwargs):
return {'ResultStatus': self.status}
class BinaryLight(object):
def __init__(self):
self.server_name = 'Binary Light Device'
self.device = None
def _create_device(self):
project_page = 'https://192.168.0.100/Desktop'
self.device = Device('urn:schemas-upnp-org:device:BinaryLight:1',
self.server_name,
manufacturer='Ankit',
manufacturer_url=project_page,
model_name='Binary Light Device',
model_description='A UPnP Binary Light Device',
model_number='1.0',
model_url=project_page)
def _add_services(self):
switch = SwitchPower()
self.device.add_service(switch)
def start(self):
self._create_device()
self._add_services()
self.device.start()
reactor.add_after_stop_func(self.device.stop)
reactor.main()
if __name__ == '__main__':
device = BinaryLight()
device.start()
| python | upnp | null | null | null | 07/16/2012 01:53:58 | not a real question | python code execution - no output
===
When I run these 2 python files: it executes correctly but doesn't produce any output. How do I check the output?
# Features:
# - Searching for devices
# - Listing devices
# - Handling events (new device located, removed device)
from brisa.core.reactors import install_default_reactor
reactor = install_default_reactor()
from brisa.core.threaded_call import run_async_function
from brisa.upnp.control_point.control_point import ControlPoint
from datetime import datetime
service = ('u', 'urn:schemas-upnp-org:service:SwitchPower:1')
binary_light_type = 'urn:schemas-upnp-org:device:BinaryLight:1'
tempo_initial = 0
tempo_final = 0
def on_new_device(dev):
""" Callback triggered when a new device is found.
"""
print 'Got new device:', dev.udn
print "Type 'list' to see the whole list"
if not dev:
return
def on_removed_device(udn):
""" Callback triggered when a device leaves the network.
"""
print 'Device is gone:', udn
def get_switch_service(device):
return device.services[service[1]]
def create_control_point():
""" Creates the control point and binds callbacks to device events.
"""
c = ControlPoint()
c.subscribe('new_device_event', on_new_device)
c.subscribe('removed_device_event', on_removed_device)
return c
def main():
""" Main loop iteration receiving input commands.
"""
c = create_control_point()
c.start()
run_async_function(_handle_cmds, (c, ))
reactor.add_after_stop_func(c.stop)
reactor.main()
def _exit(c):
""" Stops the _handle_cmds loop
"""
global running_handle_cmds
running_handle_cmds = False
def _help(c):
""" Prints the available commands that are used in '_handle_cmds' method.
"""
print 'Available commands: '
for x in ['exit', 'help', 'search', 'set_light <dev number>',
'get_status', 'get_target', 'turn <on/off>', 'stop',
'list']:
print '\t%s' % x
def _search(c):
""" Start searching for devices of type upnp:rootdevice and repeat
search every 600 seconds (UPnP default)
"""
c.start_search(600, 'upnp:rootdevice')
def _get_status(c):
""" Gets the binary light status and print if it's on or off.
"""
try:
service = get_switch_service(c.current_server)
status_response = service.GetStatus()
if status_response['ResultStatus'] == '1':
print 'Binary light status is on'
else:
print 'Binary light status is off'
except Exception, e:
if not hasattr(c, 'current_server') or not c.current_server:
print 'BinaryLight device not set.Please use set_light <n>'
else:
print 'Error in get_status():', e
def _get_target(c):
""" Gets the binary light target and print if it's on or off.
"""
try:
service = get_switch_service(c.current_server)
status_response = service.GetTarget()
if status_response['RetTargetValue'] == '1':
print 'Binary light target is on'
else:
print 'Binary light target is off'
except Exception, e:
if not hasattr(c, 'current_server') or not c.current_server:
print 'BinaryLight device not set.Please use set_light <n>'
else:
print 'Error in get_target():', e
def _set_light(c, command):
""" Gets the binary device by the number that is passed as parameter
"""
try:
devices = c.get_devices().values()
c.current_server = devices[int(command)]
service = get_switch_service(c.current_server)
service.event_subscribe(c.event_host,
associar_a_evento, None,
True, renovacao_associar_evento)
service.subscribe_for_variable('Status',novo_evento)
if c.current_server and \
c.current_server.device_type != binary_light_type:
print 'Please choose a BinaryLight device.'
c.current_server = None
except:
print 'BinaryLight number not found. Please run list and '\
'check again'
c.current_server = None
def _turn(c, command):
""" Turns the binary device on or off
"""
try:
cmd = {'on': '1', 'off': '0'}.get(command, '')
if not cmd:
print 'Wrong usage. Please try turn on or turn off.'
service = get_switch_service(c.current_server)
print service
global tempo_inicial
tempo_inicial = datetime.now()
service.SetTarget(NewTargetValue=cmd)
print 'Turning binary light', command
except Exception, e:
if not hasattr(c, 'current_server') or not c.current_server:
print 'BinaryLight device not set.Please use set_light <n>'
else:
print 'Error in set_status():', e
def _stop(c):
""" Stop searching
"""
c.stop_search()
def _list_devices(c):
""" Lists the devices that are in network.
"""
k = 0
for d in c.get_devices().values():
print 'Device no.:', k
print 'UDN:', d.udn
print 'Name:', d.friendly_name
print 'Device type:', d.device_type
print 'Services:', d.services.keys() # Only print services name
print 'Embedded devices:', [dev.friendly_name for dev in \
d.devices.values()] # Only print embedded devices names
print
k += 1
# Control the loop at _handle_cmds function
running_handle_cmds = True
commands = {'exit': _exit,
'help': _help,
'search': _search,
'stop': _stop,
'list': _list_devices,
'turn': _turn,
'set_light': _set_light,
'get_status': _get_status,
'get_target': _get_target}
def _handle_cmds(c):
while running_handle_cmds:
try:
input = raw_input('>>> ').strip()
if len(input.split(" ")) > 0:
try:
if len(input.split(" ")) > 1:
commands[input.split(" ")[0]](c, input.split(" ")[1])
else:
commands[input.split(" ")[0]](c)
except KeyError, IndexError:
print 'Invalid command, try help'
except TypeError:
print 'Wrong usage, try help to see'
except KeyboardInterrupt, EOFError:
c.stop()
break
# Stops the main loop
reactor.main_quit()
if __name__ == '__main__':
main()
File 2 code:
from brisa.core.reactors import install_default_reactor
reactor = install_default_reactor()
import os
from brisa.upnp.device import Device, Service
class SwitchPower(Service):
def __init__(self):
Service.__init__(self, 'SwitchPower',
'urn:schemas-upnp-org:service:SwitchPower:1',
'',
os.getcwd() + '/SwitchPower-scpd.xml')
self.target = False
self.status = False
def soap_SetTarget(self, *args, **kwargs):
self.target = kwargs['newTargetValue']
print 'Light switched ', {'1': 'on', '0': 'off'}.get(self.target, None)
self.status = self.target
return {}
def soap_GetTarget(self, *args, **kwargs):
return {'RetTargetValue': self.target}
def soap_GetStatus(self, *args, **kwargs):
return {'ResultStatus': self.status}
class BinaryLight(object):
def __init__(self):
self.server_name = 'Binary Light Device'
self.device = None
def _create_device(self):
project_page = 'https://192.168.0.100/Desktop'
self.device = Device('urn:schemas-upnp-org:device:BinaryLight:1',
self.server_name,
manufacturer='Ankit',
manufacturer_url=project_page,
model_name='Binary Light Device',
model_description='A UPnP Binary Light Device',
model_number='1.0',
model_url=project_page)
def _add_services(self):
switch = SwitchPower()
self.device.add_service(switch)
def start(self):
self._create_device()
self._add_services()
self.device.start()
reactor.add_after_stop_func(self.device.stop)
reactor.main()
if __name__ == '__main__':
device = BinaryLight()
device.start()
| 1 |
11,244,495 | 06/28/2012 12:18:54 | 1,488,506 | 06/28/2012 12:14:27 | 1 | 0 | i want to use Foursquare restaurent data in my application? | i have searched on google but didn,t succeded?
also how to logout from foursquare?
please giveme some link that has code?
Thanks in advance | android | null | null | null | null | 06/28/2012 12:32:40 | not a real question | i want to use Foursquare restaurent data in my application?
===
i have searched on google but didn,t succeded?
also how to logout from foursquare?
please giveme some link that has code?
Thanks in advance | 1 |
9,221,169 | 02/10/2012 00:40:56 | 856,753 | 07/21/2011 19:49:10 | 24 | 0 | jquery dropdown not working any of the browsers | <script type="text/javascript">
$(document).ready(function() {
$("#credit_pay").hide();
$("#downpayment_method").change(function() {
if ($("#downpayment_method").val()=='credit_card') {
$("#credit_pay").show("fast");
} else {
$("#credit_pay").hide("fast");
};
if ($("#downpayment_method").val()=='e_check') {
$("#e_pay").show("fast");
} else {
$("#e_pay").hide("fast");
};
});
});
</script>
<tr>
<td>
<label for="downpayment_method">Downpayment Method</label>
<select id="downpayment_method" name="downpayment_method" >
<option value="" selected="selected"></option>
<option value="credit_card">Credit Card</option>
<option value="e_check">E-check</option>
</select>
</td>
</tr>
The above code i wrote works great on http://jsfiddle.net/gDtFS/ :
But it does not work on any of my browsers.
In firefug it shows the following in red:
$
DP_jQuery_1328833882393
jQuery
I cannot comprehend what the above means.
I have included the following files:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" type="text/javascript"></script>
Is there anything I am missing?
<div id="credit_pay">
<tr>
<td>
<label for="name_on_card">Name on Card</label>
<input type="text" name="name_on_card">
<label for="billing_zip">Billing Zip</label>
<input type="text" name="billing_zip">
</td>
</tr>
<tr>
<td>
<label for="card_type">Card Type</label>
<select id="card_type" name="card_type">
<option value="" selected="selected"></option>
<option value="Visa">Visa</option>
<option value="Mastercard">Mastercard</option>
<option value="Discover">Discover</option>
<option value="Amex">Amex</option>
</select>
</td>
</tr>
</div>
<div id="e_pay">
<tr>
<td>
<label for="name_on_account">Name on Account</label>
<input type="text" name="name_on_account">
</td>
</tr>
<tr>
<td>
<label for="routing_no">Routing #</label>
<input type="text" name="routing_no">
</td>
</tr>
<tr>
<td>
<label for="account_no">Account #</label>
<input type="text" name="account_no">
</td>
</tr>
</div>
| jquery | null | null | null | null | 02/12/2012 04:56:45 | too localized | jquery dropdown not working any of the browsers
===
<script type="text/javascript">
$(document).ready(function() {
$("#credit_pay").hide();
$("#downpayment_method").change(function() {
if ($("#downpayment_method").val()=='credit_card') {
$("#credit_pay").show("fast");
} else {
$("#credit_pay").hide("fast");
};
if ($("#downpayment_method").val()=='e_check') {
$("#e_pay").show("fast");
} else {
$("#e_pay").hide("fast");
};
});
});
</script>
<tr>
<td>
<label for="downpayment_method">Downpayment Method</label>
<select id="downpayment_method" name="downpayment_method" >
<option value="" selected="selected"></option>
<option value="credit_card">Credit Card</option>
<option value="e_check">E-check</option>
</select>
</td>
</tr>
The above code i wrote works great on http://jsfiddle.net/gDtFS/ :
But it does not work on any of my browsers.
In firefug it shows the following in red:
$
DP_jQuery_1328833882393
jQuery
I cannot comprehend what the above means.
I have included the following files:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" type="text/javascript"></script>
Is there anything I am missing?
<div id="credit_pay">
<tr>
<td>
<label for="name_on_card">Name on Card</label>
<input type="text" name="name_on_card">
<label for="billing_zip">Billing Zip</label>
<input type="text" name="billing_zip">
</td>
</tr>
<tr>
<td>
<label for="card_type">Card Type</label>
<select id="card_type" name="card_type">
<option value="" selected="selected"></option>
<option value="Visa">Visa</option>
<option value="Mastercard">Mastercard</option>
<option value="Discover">Discover</option>
<option value="Amex">Amex</option>
</select>
</td>
</tr>
</div>
<div id="e_pay">
<tr>
<td>
<label for="name_on_account">Name on Account</label>
<input type="text" name="name_on_account">
</td>
</tr>
<tr>
<td>
<label for="routing_no">Routing #</label>
<input type="text" name="routing_no">
</td>
</tr>
<tr>
<td>
<label for="account_no">Account #</label>
<input type="text" name="account_no">
</td>
</tr>
</div>
| 3 |
10,116,341 | 04/12/2012 01:43:03 | 1,226,486 | 02/22/2012 17:24:01 | 3 | 0 | PHP script not firing when aliased to by Postfix - I'm at wits' end | I've tried to include as much info in this post as possible.
I'm using Postfix on an Amazon EC2 Ubuntu server and it seems that a PHP script I have aliased to an address isn't firing. Mailing works fine but the script just isn't firing. I've probably missed something easy and would appreciate any other ideas with this.
The code below is that of the script. At the moment it is just a basic script to write to a file the contents of `php://stdin`. I'm not sure if this is the best way to write this script but it seems to be ok for now as it's just a temporary one to use for troubleshooting this problem.
#!/usr/bin/php -q
<?php
$data = '';
$fileName = "parsedData.txt";
$stdin = fopen('php://stdin', 'r');
$fh = fopen($fileName, 'w');
while(!feof($stdin))
{
$data .= fgets($stdin, 8192);
}
fwrite($fh, $data);
fclose($stdin);
fclose($fh);
?>
I have verified this works by passing it a .txt file containing some text.
./test2.php < data.txt
Now that my PHP script seems to work fine locally, I need to make sure it is being called correctly. `sudo chmod 777` has been run on the test2.php script. Here is the relevant /etc/aliases file entry.
test: "|/usr/bin/php -q /var/test/php/test2.php"
I run newaliases every time I change this. This seems to be the most correct syntax as it specifies the location of php fully. `test@mydomain` receives emails fine from both internal and external when it is not set to be aliased. According to syslog this is successfully delivered to the command rather than maildir.
postfix/local[2117]: 022AB407CC: to=<[email protected]>, relay=local, delay=0.5, delays=0.43/0.02/0/0.05, dsn=2.0.0, status=sent **(delivered to command: /usr/bin/php -q /var/test/php/test2.php)**
The alias has also been written in the following ways without success (either because they go to maildir instead of the command due to wrong syntax or the script just isn't firing).
test: |"php -q /var/test/php/test2.php"
test: "|php -q /var/test/php/test2.php"
test: |"/usr/bin/php -q /var/test/php/test2.php"
test: "| php -q /var/test/php/test2.php"
test: "|/var/test/php/test2.php"
test: |"/var/test/php/test2.php"
The relevent part of my postfix main.cf files looks like this -
myhostname = domainnamehere.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = domainnamehere.com, internalawsiphere, localhostinternalaws, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command =
home_mailbox = Maildir/
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
I had `error_log("script has started!");` at the beginning of `test2.php` so that it would appear in the php log file if the script was successfully being called. I made sure to go into the php.ini to turn on error_logging and specify a location for it to save to but I couldn't get this to work. It would help to be able to get this to work because I could tell if the script was failing when it go to the `php://stdin` function as there may be some problem with it handling emails rather than cat'ed .txt files.
My end goal is to get a service that will save emails on a certain addresss, with their attachments, to a MySQL database and then return a unique code for each file/email to the user. Is there an easier way to do something like this than use php scripts? does something like squirrelmail or dbmail do this?
I've completely exhausted my ideas with this one. Maybe I should just try another email service?
Oh wise people of StackOverflow, help me! | php | linux | email | amazon-ec2 | postfix | null | open | PHP script not firing when aliased to by Postfix - I'm at wits' end
===
I've tried to include as much info in this post as possible.
I'm using Postfix on an Amazon EC2 Ubuntu server and it seems that a PHP script I have aliased to an address isn't firing. Mailing works fine but the script just isn't firing. I've probably missed something easy and would appreciate any other ideas with this.
The code below is that of the script. At the moment it is just a basic script to write to a file the contents of `php://stdin`. I'm not sure if this is the best way to write this script but it seems to be ok for now as it's just a temporary one to use for troubleshooting this problem.
#!/usr/bin/php -q
<?php
$data = '';
$fileName = "parsedData.txt";
$stdin = fopen('php://stdin', 'r');
$fh = fopen($fileName, 'w');
while(!feof($stdin))
{
$data .= fgets($stdin, 8192);
}
fwrite($fh, $data);
fclose($stdin);
fclose($fh);
?>
I have verified this works by passing it a .txt file containing some text.
./test2.php < data.txt
Now that my PHP script seems to work fine locally, I need to make sure it is being called correctly. `sudo chmod 777` has been run on the test2.php script. Here is the relevant /etc/aliases file entry.
test: "|/usr/bin/php -q /var/test/php/test2.php"
I run newaliases every time I change this. This seems to be the most correct syntax as it specifies the location of php fully. `test@mydomain` receives emails fine from both internal and external when it is not set to be aliased. According to syslog this is successfully delivered to the command rather than maildir.
postfix/local[2117]: 022AB407CC: to=<[email protected]>, relay=local, delay=0.5, delays=0.43/0.02/0/0.05, dsn=2.0.0, status=sent **(delivered to command: /usr/bin/php -q /var/test/php/test2.php)**
The alias has also been written in the following ways without success (either because they go to maildir instead of the command due to wrong syntax or the script just isn't firing).
test: |"php -q /var/test/php/test2.php"
test: "|php -q /var/test/php/test2.php"
test: |"/usr/bin/php -q /var/test/php/test2.php"
test: "| php -q /var/test/php/test2.php"
test: "|/var/test/php/test2.php"
test: |"/var/test/php/test2.php"
The relevent part of my postfix main.cf files looks like this -
myhostname = domainnamehere.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = domainnamehere.com, internalawsiphere, localhostinternalaws, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command =
home_mailbox = Maildir/
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
I had `error_log("script has started!");` at the beginning of `test2.php` so that it would appear in the php log file if the script was successfully being called. I made sure to go into the php.ini to turn on error_logging and specify a location for it to save to but I couldn't get this to work. It would help to be able to get this to work because I could tell if the script was failing when it go to the `php://stdin` function as there may be some problem with it handling emails rather than cat'ed .txt files.
My end goal is to get a service that will save emails on a certain addresss, with their attachments, to a MySQL database and then return a unique code for each file/email to the user. Is there an easier way to do something like this than use php scripts? does something like squirrelmail or dbmail do this?
I've completely exhausted my ideas with this one. Maybe I should just try another email service?
Oh wise people of StackOverflow, help me! | 0 |
8,323,177 | 11/30/2011 08:46:43 | 469,849 | 10/08/2010 04:50:53 | 86 | 4 | System design interview questions | As a new grad attending interviews, I feel that the sections I do the worst are in system design questions like `How will you design a search engine?` Or `How do you support google like instant responses`
I make answers and it sounds convincing to me, but I feel I can do better by studying such systems themselves to get an understanding of the problems that arise and needs to be solved. Can the community point me to resources (blogs, online classes, text books, white papers, academic publications anything.,) to help me along this task? | architecture | system | null | null | null | 12/01/2011 20:48:19 | not a real question | System design interview questions
===
As a new grad attending interviews, I feel that the sections I do the worst are in system design questions like `How will you design a search engine?` Or `How do you support google like instant responses`
I make answers and it sounds convincing to me, but I feel I can do better by studying such systems themselves to get an understanding of the problems that arise and needs to be solved. Can the community point me to resources (blogs, online classes, text books, white papers, academic publications anything.,) to help me along this task? | 1 |
6,484,177 | 06/26/2011 13:19:37 | 816,110 | 06/26/2011 12:07:08 | 1 | 0 | How to set a string from a text file in C# | I have a text file which always has one line, how could I set a string for the first line of the text file in C#?
e.g. line1 in test.txt = string version | c# | .net | windows | null | null | null | open | How to set a string from a text file in C#
===
I have a text file which always has one line, how could I set a string for the first line of the text file in C#?
e.g. line1 in test.txt = string version | 0 |
3,872,015 | 10/06/2010 11:37:46 | 419,672 | 08/13/2010 14:48:31 | 1 | 0 | Does Google rate the webpage by amount of visits? | there is quite extensive discussion about this topic on another website and I am really losing my confidence. The thing is that I claim that the amount (count) of visits is NOT a criteria for increasing the PR of the particular web because:
a) Google just doesn't know about every single visit on a webpage (in case it's not using GA)
b) Google just would not rate by something what Google actually affects
Thanks for your opinions.
Peter. | google | seo | null | null | null | 10/06/2010 12:04:42 | off topic | Does Google rate the webpage by amount of visits?
===
there is quite extensive discussion about this topic on another website and I am really losing my confidence. The thing is that I claim that the amount (count) of visits is NOT a criteria for increasing the PR of the particular web because:
a) Google just doesn't know about every single visit on a webpage (in case it's not using GA)
b) Google just would not rate by something what Google actually affects
Thanks for your opinions.
Peter. | 2 |
10,097,478 | 04/10/2012 22:39:50 | 343,302 | 05/17/2010 17:43:03 | 826 | 51 | VIM: matchtime not working | Does the VIM `matchtime` option not work in Putty? I have tried this `.vimrc` but I still cannot get the option to work:
set showmatch
set matchtime=1
The server that I am SSHing into is CentOS 5.x, VIM 7.0.
Thanks. | vim | null | null | null | null | 04/11/2012 16:20:46 | off topic | VIM: matchtime not working
===
Does the VIM `matchtime` option not work in Putty? I have tried this `.vimrc` but I still cannot get the option to work:
set showmatch
set matchtime=1
The server that I am SSHing into is CentOS 5.x, VIM 7.0.
Thanks. | 2 |
11,406,427 | 07/10/2012 04:04:25 | 484,290 | 10/22/2010 14:06:21 | 1,377 | 43 | Creating playN project | I'm getting some problem in understanding playN project, can someone explain how to create a playN project or point me to a link that has enough documentation. I've used the playN samples. its really confusing. Does someone has a link that has proper documentation for playN?? | eclipse | playn | null | null | null | null | open | Creating playN project
===
I'm getting some problem in understanding playN project, can someone explain how to create a playN project or point me to a link that has enough documentation. I've used the playN samples. its really confusing. Does someone has a link that has proper documentation for playN?? | 0 |
10,519,520 | 05/09/2012 15:47:19 | 1,385,055 | 05/09/2012 15:43:10 | 1 | 0 | How do I get substring of multiple array elements using substr function in perl? |
I am trying to get the substring of array elements 0 to 410 of an array simultaneously in perl.Is there a way to do this without iterating over an array using substr function alone??
Thanks.
| perl | substring | null | null | null | 05/10/2012 04:00:51 | not a real question | How do I get substring of multiple array elements using substr function in perl?
===
I am trying to get the substring of array elements 0 to 410 of an array simultaneously in perl.Is there a way to do this without iterating over an array using substr function alone??
Thanks.
| 1 |
7,474,593 | 09/19/2011 17:03:03 | 933,425 | 09/07/2011 18:57:31 | 5 | 1 | how can i change my sql server 2005 authentication mode | how can i change my sql server 2005 authentication mode from "Windows authenticated mode " to " Sql Server Authetication" after the SQL Server has been installed | sql-server-2005 | null | null | null | null | 09/19/2011 20:09:51 | off topic | how can i change my sql server 2005 authentication mode
===
how can i change my sql server 2005 authentication mode from "Windows authenticated mode " to " Sql Server Authetication" after the SQL Server has been installed | 2 |
1,064,543 | 06/30/2009 15:59:33 | 123,773 | 06/16/2009 15:45:06 | 1 | 0 | Where to put a local xsd file in Jboss 4.05 | I am working on Jboss 4.05 , I have an xsd file that was on jboss.com and want to have it locally on my system, I can not find the right location to put this file, when starting the jboss I get this error:
Offending resource: class path resource [spring/my-context.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 75 in XML document from class path resource [spring/my-ranking-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'seam:instance'.
the problem started when jboss.com went down, i located the relevant xsd and downloaded it. i have tried putting it in the bin directory of jboss and also on the lib directory under the server to no avail.
thanks in advance,
Dov
| jboss | xsd | null | null | null | null | open | Where to put a local xsd file in Jboss 4.05
===
I am working on Jboss 4.05 , I have an xsd file that was on jboss.com and want to have it locally on my system, I can not find the right location to put this file, when starting the jboss I get this error:
Offending resource: class path resource [spring/my-context.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 75 in XML document from class path resource [spring/my-ranking-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'seam:instance'.
the problem started when jboss.com went down, i located the relevant xsd and downloaded it. i have tried putting it in the bin directory of jboss and also on the lib directory under the server to no avail.
thanks in advance,
Dov
| 0 |
8,365,253 | 12/03/2011 03:26:08 | 1,067,754 | 11/27/2011 10:07:47 | 1 | 0 | Why it gives wrong output i.e 2.... But i | // A program to allocate the memory to integer from using of "free()" function.
#include <iostream.h>
void main()
{
int *integer;
integer=new int[5];
cout << sizeof(integer);
} | c# | java | php | c++ | c | 12/03/2011 03:52:58 | not a real question | Why it gives wrong output i.e 2.... But i
===
// A program to allocate the memory to integer from using of "free()" function.
#include <iostream.h>
void main()
{
int *integer;
integer=new int[5];
cout << sizeof(integer);
} | 1 |
861,027 | 05/14/2009 00:09:04 | 64,417 | 02/10/2009 03:38:41 | 560 | 18 | Code golf in Ruby: What's your favourite trick? | Anything that saves a few characters and produces horrible, unreadable code is fair game.
My favourite is cheating spacing with the ternary operator. If you're testing a question-mark-method (like .nil?), the only place you need a space is after the second question mark:
x.odd?? "odd":"even"
| ruby | code-golf | null | null | null | 02/20/2012 22:40:41 | not constructive | Code golf in Ruby: What's your favourite trick?
===
Anything that saves a few characters and produces horrible, unreadable code is fair game.
My favourite is cheating spacing with the ternary operator. If you're testing a question-mark-method (like .nil?), the only place you need a space is after the second question mark:
x.odd?? "odd":"even"
| 4 |
9,651,571 | 03/11/2012 01:07:12 | 1,072,869 | 11/30/2011 07:50:32 | 103 | 0 | Is it possible to use an Attribute to override a method? (in C#) | For example, would it be possible to mark a 'Man' class with the 'PetOwner' attribute, which overrides the constructor with something that creates a 'Dog' object as well as calling the 'Man' base constructor?
(And overrides 'Man's 'GoForWalk()' method to include interaction with his Dog?)
I'm quite new to Reflection, and was curious about this so I figured I may as well ask.
Does this involve Reflection.Emit somehow?
I also had a look at [this][1] question, but I dont think it fully relates to what I am asking (and I dont fully understand it either).
Thanks for any help! :)
[1]: http://stackoverflow.com/questions/592671/overriding-a-property-with-an-attribute | c# | reflection | methods | attributes | override | null | open | Is it possible to use an Attribute to override a method? (in C#)
===
For example, would it be possible to mark a 'Man' class with the 'PetOwner' attribute, which overrides the constructor with something that creates a 'Dog' object as well as calling the 'Man' base constructor?
(And overrides 'Man's 'GoForWalk()' method to include interaction with his Dog?)
I'm quite new to Reflection, and was curious about this so I figured I may as well ask.
Does this involve Reflection.Emit somehow?
I also had a look at [this][1] question, but I dont think it fully relates to what I am asking (and I dont fully understand it either).
Thanks for any help! :)
[1]: http://stackoverflow.com/questions/592671/overriding-a-property-with-an-attribute | 0 |
4,767,206 | 01/22/2011 09:58:42 | 515,762 | 11/22/2010 07:46:29 | 11 | 0 | Generating Word file in PHP | I am able to generate the word file,But my problem is want the dta in table structure.So i have used html table tag in php...But the O/p does not look satisfactory..It takes lot of space...Any idea how can i solve it | php | null | null | null | null | 01/23/2011 00:04:14 | not a real question | Generating Word file in PHP
===
I am able to generate the word file,But my problem is want the dta in table structure.So i have used html table tag in php...But the O/p does not look satisfactory..It takes lot of space...Any idea how can i solve it | 1 |
10,361,822 | 04/28/2012 08:18:17 | 1,160,580 | 01/20/2012 12:10:05 | -3 | 2 | How to set Orientation of Screen in Landscape and Portrait mode in Blackberry | How to Set Orientation of Screen in Portrait mode.
when i Change it to Landscape Mode than Orientation of
Screen in Different Way. | blackberry | null | null | null | null | null | open | How to set Orientation of Screen in Landscape and Portrait mode in Blackberry
===
How to Set Orientation of Screen in Portrait mode.
when i Change it to Landscape Mode than Orientation of
Screen in Different Way. | 0 |
7,134,867 | 08/20/2011 21:39:30 | 902,570 | 08/19/2011 14:04:17 | 6 | 0 | Google's regular expression library RE2 ported to Java | Did anyone come across Java version of Goggle's regular expression library RE2 or a java library with similar capabilities and good performance? The performance requirement is linear time with regard to the length of regular expression and the input text length. | java | regex | google | null | null | 08/23/2011 01:44:50 | not a real question | Google's regular expression library RE2 ported to Java
===
Did anyone come across Java version of Goggle's regular expression library RE2 or a java library with similar capabilities and good performance? The performance requirement is linear time with regard to the length of regular expression and the input text length. | 1 |
6,542,888 | 07/01/2011 01:56:32 | 774,275 | 05/28/2011 11:47:02 | 6 | 0 | CoreData NSArrayController addObject: Agonizingly Slow... | I have a CoreData app that imports information from an *.xml file. The file has two sections, summary and detail.
In essence, I have two table views, tvSummary and tvDetail; two array controllers, acSummary and acDetail; and one mutable array, maDetail.
I use the [acSummary addObject:newSummaryData]; method to add summary data records to the acSummary array controller when I import a file. Once the file is imported the summary data fields populate the tvSummary table view.
When I use the [acDetail addObject:newDetailData]; method to add detail data records to the acDetail array controller it can take upwards of twenty minutes to import up to 72000 records (most files contain between 3600 and 21600 records). Once this lengthy process is completed the imported detail data fields populate the tvDetail table view. When I make selections in the tvSummary table view the data displayed in the tvDetail table view changes to match the selected row. I think this is how it is supposed to work.
During the Cocoa / Objective-c / Core Data learning process (I am still a neophyte) I have found I can copy 72000 records to the maDetail mutable array in about five seconds. I have also found I can copy the contents of the maDetail mutable array to the acDetail array controller in about two seconds using the [acDetail setContent:maDetail]; method.
What I can not figure out is how to get the acDetail array controller to remember the content it was given when I select a different row in the tvSummary table view. I see references to forcing an array controller 'save', however, I can not find any documentation on how to implement such a method. Any advice or direction would be greatly appreciated. | core-data | nsmutablearray | nsarraycontroller | null | null | null | open | CoreData NSArrayController addObject: Agonizingly Slow...
===
I have a CoreData app that imports information from an *.xml file. The file has two sections, summary and detail.
In essence, I have two table views, tvSummary and tvDetail; two array controllers, acSummary and acDetail; and one mutable array, maDetail.
I use the [acSummary addObject:newSummaryData]; method to add summary data records to the acSummary array controller when I import a file. Once the file is imported the summary data fields populate the tvSummary table view.
When I use the [acDetail addObject:newDetailData]; method to add detail data records to the acDetail array controller it can take upwards of twenty minutes to import up to 72000 records (most files contain between 3600 and 21600 records). Once this lengthy process is completed the imported detail data fields populate the tvDetail table view. When I make selections in the tvSummary table view the data displayed in the tvDetail table view changes to match the selected row. I think this is how it is supposed to work.
During the Cocoa / Objective-c / Core Data learning process (I am still a neophyte) I have found I can copy 72000 records to the maDetail mutable array in about five seconds. I have also found I can copy the contents of the maDetail mutable array to the acDetail array controller in about two seconds using the [acDetail setContent:maDetail]; method.
What I can not figure out is how to get the acDetail array controller to remember the content it was given when I select a different row in the tvSummary table view. I see references to forcing an array controller 'save', however, I can not find any documentation on how to implement such a method. Any advice or direction would be greatly appreciated. | 0 |
6,183,034 | 05/31/2011 04:31:19 | 737,369 | 05/04/2011 05:17:59 | 7 | 1 | How can I read dynamically res.raw The MP3 files | private void PlayAlphabetSound()
{
if(drawingSurface.AlphabetIDCounter==0){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.oorah);
}else if(drawingSurface.AlphabetIDCounter==1){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.aira);
}else if(drawingSurface.AlphabetIDCounter==2){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.eeree);
}else if(drawingSurface.AlphabetIDCounter==3){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.sasa);
}else if(drawingSurface.AlphabetIDCounter==4){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.haha);
}else if(drawingSurface.AlphabetIDCounter==5){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.kaka);
}else if(drawingSurface.AlphabetIDCounter==6){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.khakha);
}else if(drawingSurface.AlphabetIDCounter==7){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.gaga);
} else if(drawingSurface.AlphabetIDCounter==8){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.ghaga);
}else if(drawingSurface.AlphabetIDCounter==9){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.angaga);
}else if(drawingSurface.AlphabetIDCounter==10){
sound1.release();
}
} | java | android | null | null | null | 06/28/2011 11:19:33 | not a real question | How can I read dynamically res.raw The MP3 files
===
private void PlayAlphabetSound()
{
if(drawingSurface.AlphabetIDCounter==0){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.oorah);
}else if(drawingSurface.AlphabetIDCounter==1){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.aira);
}else if(drawingSurface.AlphabetIDCounter==2){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.eeree);
}else if(drawingSurface.AlphabetIDCounter==3){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.sasa);
}else if(drawingSurface.AlphabetIDCounter==4){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.haha);
}else if(drawingSurface.AlphabetIDCounter==5){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.kaka);
}else if(drawingSurface.AlphabetIDCounter==6){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.khakha);
}else if(drawingSurface.AlphabetIDCounter==7){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.gaga);
} else if(drawingSurface.AlphabetIDCounter==8){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.ghaga);
}else if(drawingSurface.AlphabetIDCounter==9){
sound1.release();
sound1 = MediaPlayer.create(this, R.raw.angaga);
}else if(drawingSurface.AlphabetIDCounter==10){
sound1.release();
}
} | 1 |
7,048,668 | 08/13/2011 04:56:09 | 890,873 | 08/11/2011 23:10:47 | 1 | 0 | radio button click tracking in jquery | I want to track the radio button click tracking. first we have to select one radio button among many radio buttons, then click on the button. How to track the both the things at once? | click | tracking | null | null | null | null | open | radio button click tracking in jquery
===
I want to track the radio button click tracking. first we have to select one radio button among many radio buttons, then click on the button. How to track the both the things at once? | 0 |
10,811,669 | 05/30/2012 07:18:22 | 1,425,304 | 05/30/2012 06:23:04 | 1 | 0 | R rgl distance between axis ticks and tick labels | Thanks firstly, to anyone who is taking time out of their day to help me solve my problem - I am a newbie and this is my first post, so please be gentle!
I am plotting some point data using plot3d().
I would like to bring my y axis tick labels a little closer to my y axis tick marks.
The best way I can think of doing this is to
1) plot the data first, without drawing the axes
2) call on axis3d() to draw the y axis and tick marks but suppress labels from being drawn.
3) query the current position of each tick mark in 3D space. Store positions in a vector.
4) use mtext3d() to add labels at positions based on an adjustment to the vector
I am having a problem at step 3. I don't know how to query the position of each tick mark.
par3d() allows you to query a number of graphical parameters, is there something similar I can use to get the position each y axis tick?
Am I approaching this wrong? Probably.
Here is an example piece of code, without text added for y axis labels....
require(rgl)
x <- rnorm(5)
y <- rnorm(5)
z <- rnorm(5)
open3d()
plot3d(x,y,z,axes=F,xlab="",ylab="",zlab="")
par3d(ignoreExtent=TRUE)
par3d(FOV=0)
par3d(userMatrix=rotationMatrix(0,1,0,0))
axis3d('y',nticks=5,labels = FALSE)
par3d(zoom=1)
par3d(windowRect=c(580,60,1380,900))
thanks a bunch
| r | rgl | null | null | null | null | open | R rgl distance between axis ticks and tick labels
===
Thanks firstly, to anyone who is taking time out of their day to help me solve my problem - I am a newbie and this is my first post, so please be gentle!
I am plotting some point data using plot3d().
I would like to bring my y axis tick labels a little closer to my y axis tick marks.
The best way I can think of doing this is to
1) plot the data first, without drawing the axes
2) call on axis3d() to draw the y axis and tick marks but suppress labels from being drawn.
3) query the current position of each tick mark in 3D space. Store positions in a vector.
4) use mtext3d() to add labels at positions based on an adjustment to the vector
I am having a problem at step 3. I don't know how to query the position of each tick mark.
par3d() allows you to query a number of graphical parameters, is there something similar I can use to get the position each y axis tick?
Am I approaching this wrong? Probably.
Here is an example piece of code, without text added for y axis labels....
require(rgl)
x <- rnorm(5)
y <- rnorm(5)
z <- rnorm(5)
open3d()
plot3d(x,y,z,axes=F,xlab="",ylab="",zlab="")
par3d(ignoreExtent=TRUE)
par3d(FOV=0)
par3d(userMatrix=rotationMatrix(0,1,0,0))
axis3d('y',nticks=5,labels = FALSE)
par3d(zoom=1)
par3d(windowRect=c(580,60,1380,900))
thanks a bunch
| 0 |
3,681,834 | 09/10/2010 01:54:32 | 296 | 08/04/2008 13:26:48 | 1,503 | 122 | Is there an official reference stating that battery life is one of the reasons why a Garbage Collector was not included inside iOS? | In [the following SO question][1], it is mentionned that the Garage Collector was not included in [iOS][2] in order to conserve battery power.
Is there an offical reference from Apple stating that battery life is one of the reasons why a Garbage Collector was not included inside iOS?
I have been looking for it on google but was not able to find anything relevant.
[1]: http://stackoverflow.com/questions/416108/is-garbage-collection-supported-for-iphone-applications
[2]: http://en.wikipedia.org/wiki/IOS_(Apple) | garbage-collection | apple | ios | null | null | null | open | Is there an official reference stating that battery life is one of the reasons why a Garbage Collector was not included inside iOS?
===
In [the following SO question][1], it is mentionned that the Garage Collector was not included in [iOS][2] in order to conserve battery power.
Is there an offical reference from Apple stating that battery life is one of the reasons why a Garbage Collector was not included inside iOS?
I have been looking for it on google but was not able to find anything relevant.
[1]: http://stackoverflow.com/questions/416108/is-garbage-collection-supported-for-iphone-applications
[2]: http://en.wikipedia.org/wiki/IOS_(Apple) | 0 |
7,629,285 | 10/02/2011 21:18:29 | 962,779 | 09/24/2011 16:07:48 | 1 | 0 | Is there any successful Windows Azure based website and web services? | I am evaluating Windows Azure and Google App Engine.
Personally I prefer Windows Azure as I have been a C# developer for years. However, I do understand Azure will be too expensive for a start up company.
Could anyone let me know any successful Azure based website or web services?
Any opinion about Azure VS GAE is welcome.
Thanks | google-app-engine | azure | null | null | null | 10/03/2011 00:32:00 | not constructive | Is there any successful Windows Azure based website and web services?
===
I am evaluating Windows Azure and Google App Engine.
Personally I prefer Windows Azure as I have been a C# developer for years. However, I do understand Azure will be too expensive for a start up company.
Could anyone let me know any successful Azure based website or web services?
Any opinion about Azure VS GAE is welcome.
Thanks | 4 |
1,794,594 | 11/25/2009 04:19:36 | 195,652 | 10/23/2009 21:57:30 | 1 | 0 | Bash Shell Script error: syntax error near unexpected token '{ | Below is the snippet of code that keeps giving me the problem. Could someone explain to me why my code isn't working.
# Shell Version of Login Menu
Administrator ()
{
clear
./Administrator.sh
}
# ------ Student User Menu ------
Student_Menu()
{
clear
./studentMenu.sh
}
# ------ Borrow Menu ------
Borrow_Menu()
{
clear
./BorrowBookMenu.sh
}
# ============================================
# ------ Main Menu Function Definition -------
# ============================================
menu()
{
echo ""
echo "1. Administrator"
echo ""
echo "2. Student user"
echo ""
echo "3. Guest"
echo ""
echo "4. Exit"
echo ""
echo "Enter Choice: "
read userChoice
if ["$userChoice" == "1"]
then
Administrator
fi
if ["$userChoice" == "2"]
then
Student_Menu
fi
if ["$userChoice" == "3"]
then
Borrow_Menu
fi
if ["$userChoice" == "4"]
then
echo "GOODBYE"
sleep
exit 0
fi
echo
echo ...Invalid Choice...
echo
sleep
clear
menu
}
# Call to Main Menu Function
menu | shell | bash | null | null | null | null | open | Bash Shell Script error: syntax error near unexpected token '{
===
Below is the snippet of code that keeps giving me the problem. Could someone explain to me why my code isn't working.
# Shell Version of Login Menu
Administrator ()
{
clear
./Administrator.sh
}
# ------ Student User Menu ------
Student_Menu()
{
clear
./studentMenu.sh
}
# ------ Borrow Menu ------
Borrow_Menu()
{
clear
./BorrowBookMenu.sh
}
# ============================================
# ------ Main Menu Function Definition -------
# ============================================
menu()
{
echo ""
echo "1. Administrator"
echo ""
echo "2. Student user"
echo ""
echo "3. Guest"
echo ""
echo "4. Exit"
echo ""
echo "Enter Choice: "
read userChoice
if ["$userChoice" == "1"]
then
Administrator
fi
if ["$userChoice" == "2"]
then
Student_Menu
fi
if ["$userChoice" == "3"]
then
Borrow_Menu
fi
if ["$userChoice" == "4"]
then
echo "GOODBYE"
sleep
exit 0
fi
echo
echo ...Invalid Choice...
echo
sleep
clear
menu
}
# Call to Main Menu Function
menu | 0 |
8,599,716 | 12/22/2011 05:18:39 | 1,076,890 | 12/02/2011 07:07:32 | 6 | 0 | How to Access Windows Desktop Using NoVNC | How can i access windows desktop using **NoVNC**?..like i can access Linux desktop using HTML5 compatible browser...Thanks in advance | python | windows | operating-system | vnc | null | 12/22/2011 08:12:56 | off topic | How to Access Windows Desktop Using NoVNC
===
How can i access windows desktop using **NoVNC**?..like i can access Linux desktop using HTML5 compatible browser...Thanks in advance | 2 |
11,290,587 | 07/02/2012 08:58:43 | 1,495,585 | 03/13/2011 11:41:56 | 6 | 0 | Active Directory recovery server 2008 R2 | So here is my problem.
My hard drive recently failed and I lost my backups.
I do have the NTDS and SYSVOL folders with contents from my previous active directory install.
Is it possible to recover my old active directory users/computers/etc from these files?
I've replaced the hard drive and installed windows again, setup the domain the same as well. My only problem now is if i can recover the previous AD information or now.
any help would be appreciated!
thanks ahead of time.
| windows | active-directory | windows-server-2008 | windows-server-2008-r2 | null | 07/02/2012 15:33:44 | off topic | Active Directory recovery server 2008 R2
===
So here is my problem.
My hard drive recently failed and I lost my backups.
I do have the NTDS and SYSVOL folders with contents from my previous active directory install.
Is it possible to recover my old active directory users/computers/etc from these files?
I've replaced the hard drive and installed windows again, setup the domain the same as well. My only problem now is if i can recover the previous AD information or now.
any help would be appreciated!
thanks ahead of time.
| 2 |
11,113,939 | 06/20/2012 06:26:32 | 1,447,199 | 06/10/2012 10:11:43 | 3 | 0 | explaining a line in batch file | I am analyzing a batch file and there is a line that it edit a txt file(input) and making a txt file(output),
The batch is using three helping tools.exe : 1.grep .2.sed 3.cut
I tried to read their manual use but it wasn't easy
The line is :
type input.txt | sed "s#""#'#g" | grep -o "class='name[^>]*" | sed -n "/id=/p" | grep -o "surname=[^>]*" | cut -d"'" -f2 >output.txt
So I want to know how the PC interpret this line ? following which rules ?
also I was wondering if there is a smarter way of doing this ?
for example using one tool(if exist) instead of 3 tools(grep,sed,cut) ?
thnaks | batch | editor | null | null | null | null | open | explaining a line in batch file
===
I am analyzing a batch file and there is a line that it edit a txt file(input) and making a txt file(output),
The batch is using three helping tools.exe : 1.grep .2.sed 3.cut
I tried to read their manual use but it wasn't easy
The line is :
type input.txt | sed "s#""#'#g" | grep -o "class='name[^>]*" | sed -n "/id=/p" | grep -o "surname=[^>]*" | cut -d"'" -f2 >output.txt
So I want to know how the PC interpret this line ? following which rules ?
also I was wondering if there is a smarter way of doing this ?
for example using one tool(if exist) instead of 3 tools(grep,sed,cut) ?
thnaks | 0 |
3,420,950 | 08/06/2010 04:12:21 | 318,976 | 04/17/2010 00:08:09 | 212 | 8 | R checking pairs of rows in a dataframe | I have a data frame holding information on options like this
> chData
myIdx strike_price date exdate cp_flag strike_price return
1 8355342 605000 1996-04-02 1996-05-18 P 605000 0.002340
2 8355433 605000 1996-04-02 1996-05-18 C 605000 0.002340
3 8356541 605000 1996-04-09 1996-05-18 P 605000 -0.003182
4 8356629 605000 1996-04-09 1996-05-18 C 605000 -0.003182
5 8358033 605000 1996-04-16 1996-05-18 P 605000 0.003907
6 8358119 605000 1996-04-16 1996-05-18 C 605000 0.003907
7 8359391 605000 1996-04-23 1996-05-18 P 605000 0.005695
where cp_flag means that a certain option is either a call or a put. What is a way to make sure that for each date, there is a both a call and a put, and drop the rows for which this does not exist? I can do it with a for loop, but is there a more clever way?
| r | null | null | null | null | null | open | R checking pairs of rows in a dataframe
===
I have a data frame holding information on options like this
> chData
myIdx strike_price date exdate cp_flag strike_price return
1 8355342 605000 1996-04-02 1996-05-18 P 605000 0.002340
2 8355433 605000 1996-04-02 1996-05-18 C 605000 0.002340
3 8356541 605000 1996-04-09 1996-05-18 P 605000 -0.003182
4 8356629 605000 1996-04-09 1996-05-18 C 605000 -0.003182
5 8358033 605000 1996-04-16 1996-05-18 P 605000 0.003907
6 8358119 605000 1996-04-16 1996-05-18 C 605000 0.003907
7 8359391 605000 1996-04-23 1996-05-18 P 605000 0.005695
where cp_flag means that a certain option is either a call or a put. What is a way to make sure that for each date, there is a both a call and a put, and drop the rows for which this does not exist? I can do it with a for loop, but is there a more clever way?
| 0 |
7,168,233 | 08/23/2011 22:18:20 | 854,396 | 07/20/2011 16:41:50 | 16 | 4 | Are there many devices around with early iOS Versions? | I am to decide wether to use a comfortable function that was introduced with iOS 3.2 versus a rather complicated implementation that works fine with older versions too.
3.2 does not run on first generation devices.
Are there any statistics available that tell you how much of a potential market is excluded by setting iOS 3.2 as a minimum requirement? | iphone | ios | os-version | null | null | 08/25/2011 01:47:06 | off topic | Are there many devices around with early iOS Versions?
===
I am to decide wether to use a comfortable function that was introduced with iOS 3.2 versus a rather complicated implementation that works fine with older versions too.
3.2 does not run on first generation devices.
Are there any statistics available that tell you how much of a potential market is excluded by setting iOS 3.2 as a minimum requirement? | 2 |
996,644 | 06/15/2009 15:07:42 | 114,770 | 05/30/2009 12:17:42 | 1 | 1 | jquery selector can't read from hidden field | The following jquery 1.3.2 code works:
<input type="select" value="236434" id="ixd" name='ixd' />
<script>
console.log( $('#ixd') );
console.log( $("input[name='ixd']") );
</script>
Console shows:
> [input#ixd 236434]
>
> [input#ixd 236434]
However setting the input to "hidden" prevents the selectors working. Any clues?
<input type="hidden" value="236434" id="ixd" name='ixd' />
<script>
console.log( $('#ixd') );
console.log( $("input[name='ixd']") );
</script>
Console shows:
> []
>
> [] | jquery | hidden | forms | element | selectors | null | open | jquery selector can't read from hidden field
===
The following jquery 1.3.2 code works:
<input type="select" value="236434" id="ixd" name='ixd' />
<script>
console.log( $('#ixd') );
console.log( $("input[name='ixd']") );
</script>
Console shows:
> [input#ixd 236434]
>
> [input#ixd 236434]
However setting the input to "hidden" prevents the selectors working. Any clues?
<input type="hidden" value="236434" id="ixd" name='ixd' />
<script>
console.log( $('#ixd') );
console.log( $("input[name='ixd']") );
</script>
Console shows:
> []
>
> [] | 0 |
8,851,163 | 01/13/2012 13:15:02 | 894,609 | 08/15/2011 07:34:01 | 26 | 0 | Which is the best way to built a wordpress theme | 1.Should I make a static website using xhtml, css and javascript first and then convert it to a wordpress theme.
OR
2.Should I directly start building the theme from scratch.
OR
3.Should I use any framework
OR
4.Combination of the above.
| wordpress | wordpress-theming | null | null | null | 01/14/2012 21:57:26 | not constructive | Which is the best way to built a wordpress theme
===
1.Should I make a static website using xhtml, css and javascript first and then convert it to a wordpress theme.
OR
2.Should I directly start building the theme from scratch.
OR
3.Should I use any framework
OR
4.Combination of the above.
| 4 |
10,502,835 | 05/08/2012 16:46:18 | 650,180 | 03/08/2011 16:50:35 | 38 | 5 | caret positionning in contentEditable containing dom images | I'm having problems with setting caret position in a contentEditable iframe, as soon as I add an ":)" emoticon.
How would you manage?
Here is a basic template:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
var init = function () { // initialization
this.editor = $('#wysiwyg');
this.editor.curWin = this.editor.prop('contentWindow');
this.editor.curDoc = this.editor.curWin.document;
this.editor.curDoc.designMode = "On";
this.editor.curBody = $(this.curDoc).contents().find('body');
this.editor.html = function (data) { // shortcut to set innerHTML
if (typeof data == "undefined")
return this.curBody.html();
this.curBody.html(data);
return $(this);
};
var emoji = function (data) { // replace every :) by an image
return data.replace(':)', '<img src="http:\/\/dean.resplace.net\/blog\/wp-content\/uploads\/2011\/10\/wlEmoticon-smile1.png"\/>');
};
var self = this;
this.editor.contents().find('body').keypress(function (ev) { // handler on key pressed
var me = $(this);
setTimeout(function () { // timeout so that the iframe is containing the last character inputed
var sel = self.editor.curWin.getSelection();
var offset = sel.focusOffset;
me.html( emoji( me.html() ) );
var body = $(self.editor.curDoc).find('body').get(0);
sel.collapse(body, offset); //here is where i set positionning
return;
}, 100);
return true;
});
};
</script>
</head>
<body onload="init()">
<iframe id="wysiwyg"></iframe>
</body>
</html>
StackOverflow demands that i add more context to explain the code sections, but for me it seems to be clear. So sorry to add so more "cool story bro" comments but i can't see what i can explain more than this. Anyway, i'm open to any question. | javascript | contenteditable | caret | null | null | null | open | caret positionning in contentEditable containing dom images
===
I'm having problems with setting caret position in a contentEditable iframe, as soon as I add an ":)" emoticon.
How would you manage?
Here is a basic template:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
var init = function () { // initialization
this.editor = $('#wysiwyg');
this.editor.curWin = this.editor.prop('contentWindow');
this.editor.curDoc = this.editor.curWin.document;
this.editor.curDoc.designMode = "On";
this.editor.curBody = $(this.curDoc).contents().find('body');
this.editor.html = function (data) { // shortcut to set innerHTML
if (typeof data == "undefined")
return this.curBody.html();
this.curBody.html(data);
return $(this);
};
var emoji = function (data) { // replace every :) by an image
return data.replace(':)', '<img src="http:\/\/dean.resplace.net\/blog\/wp-content\/uploads\/2011\/10\/wlEmoticon-smile1.png"\/>');
};
var self = this;
this.editor.contents().find('body').keypress(function (ev) { // handler on key pressed
var me = $(this);
setTimeout(function () { // timeout so that the iframe is containing the last character inputed
var sel = self.editor.curWin.getSelection();
var offset = sel.focusOffset;
me.html( emoji( me.html() ) );
var body = $(self.editor.curDoc).find('body').get(0);
sel.collapse(body, offset); //here is where i set positionning
return;
}, 100);
return true;
});
};
</script>
</head>
<body onload="init()">
<iframe id="wysiwyg"></iframe>
</body>
</html>
StackOverflow demands that i add more context to explain the code sections, but for me it seems to be clear. So sorry to add so more "cool story bro" comments but i can't see what i can explain more than this. Anyway, i'm open to any question. | 0 |
7,018,416 | 08/10/2011 22:01:24 | 874,658 | 08/02/2011 13:01:42 | 6 | 1 | Parse error: syntax error, unexpected T_ELSE | Im gettin this arror and i can work out why:
**Parse error: syntax error, unexpected T_ELSE in /home/gezzamon/public_html/paypal/success/index.php on line 87**
Line 87 is:
**else (strcmp ($lines[0], "FAIL") == 0) { ?>**
// parse the data
$lines = explode("\n", $res);
$keyarray = array();
//Make sure that the payment was SUCCESSFUL
if (strcmp ($lines[0], "SUCCESS") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
for ($i=1; $i<count($lines);$i++){
list($key,$val) = explode("=", $lines[$i]);
$keyarray[urldecode($key)] = urldecode($val);
}
// process payment
$firstname = $keyarray['first_name'];
$lastname = $keyarray['last_name'];
$itemnumber = $keyarray['item_number'];
$itemname = $keyarray['item_name'];
$amount = $keyarray['mc_gross'];
//Verify the item and if needed set a cookie that gives them access
if ($itemname == "Secret Page Access") {
}
} ?>
<table>
<tr>
<td>Name:</td>
<td><?=$firstname . " " . $lastname?></td>
</tr>
<tr>
<td>Item you bought:</td>
<td><?=$itemname?></td>
</tr>
<tr>
<td>Price:</td>
<td>$<?=$amount?></td>
</tr>
<? if ($itemname == "Secret Page Access") { ?>
<tr>
<td>Link to special page:</td>
<td><a href="http://www.gezzamondo.co.uk/paypal/hello.html">Secret page</a></td>
</tr>
<? } ?>
</table>
<? }
else (strcmp ($lines[0], "FAIL") == 0) { ?>
<p>Hmmm.. Something might have gone wrong during your transaction. Contact usso we can check it for you!</p>
<? }
}
fclose ($fp); ?> | php | null | null | null | null | null | open | Parse error: syntax error, unexpected T_ELSE
===
Im gettin this arror and i can work out why:
**Parse error: syntax error, unexpected T_ELSE in /home/gezzamon/public_html/paypal/success/index.php on line 87**
Line 87 is:
**else (strcmp ($lines[0], "FAIL") == 0) { ?>**
// parse the data
$lines = explode("\n", $res);
$keyarray = array();
//Make sure that the payment was SUCCESSFUL
if (strcmp ($lines[0], "SUCCESS") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
for ($i=1; $i<count($lines);$i++){
list($key,$val) = explode("=", $lines[$i]);
$keyarray[urldecode($key)] = urldecode($val);
}
// process payment
$firstname = $keyarray['first_name'];
$lastname = $keyarray['last_name'];
$itemnumber = $keyarray['item_number'];
$itemname = $keyarray['item_name'];
$amount = $keyarray['mc_gross'];
//Verify the item and if needed set a cookie that gives them access
if ($itemname == "Secret Page Access") {
}
} ?>
<table>
<tr>
<td>Name:</td>
<td><?=$firstname . " " . $lastname?></td>
</tr>
<tr>
<td>Item you bought:</td>
<td><?=$itemname?></td>
</tr>
<tr>
<td>Price:</td>
<td>$<?=$amount?></td>
</tr>
<? if ($itemname == "Secret Page Access") { ?>
<tr>
<td>Link to special page:</td>
<td><a href="http://www.gezzamondo.co.uk/paypal/hello.html">Secret page</a></td>
</tr>
<? } ?>
</table>
<? }
else (strcmp ($lines[0], "FAIL") == 0) { ?>
<p>Hmmm.. Something might have gone wrong during your transaction. Contact usso we can check it for you!</p>
<? }
}
fclose ($fp); ?> | 0 |
3,435,435 | 08/08/2010 18:04:51 | 281,465 | 10/02/2009 13:07:37 | 529 | 7 | GPL, LGPL and MPL - What does it mean? | i am implementing a web application for a company, i would like to use the rich text editor distributed by ckeditor.com to allow the users to modify the content of some web pages
Can I use it or I am going to break any law?
Thanks
| licensing | null | null | null | null | 08/08/2010 18:35:51 | off topic | GPL, LGPL and MPL - What does it mean?
===
i am implementing a web application for a company, i would like to use the rich text editor distributed by ckeditor.com to allow the users to modify the content of some web pages
Can I use it or I am going to break any law?
Thanks
| 2 |
11,529,019 | 07/17/2012 18:56:27 | 1,532,731 | 07/17/2012 18:50:23 | 1 | 0 | members system for OSClass CMS | i want to create a members system for OsClass script,i need simple member and premium member and business member, each member have options,for example business and premium have to pay using Paypal in registration.
witch files i need to edit,and how the payment idea dos work?
thank you! | php | script | null | null | null | 07/18/2012 09:53:31 | not a real question | members system for OSClass CMS
===
i want to create a members system for OsClass script,i need simple member and premium member and business member, each member have options,for example business and premium have to pay using Paypal in registration.
witch files i need to edit,and how the payment idea dos work?
thank you! | 1 |
4,028,312 | 10/26/2010 21:47:23 | 329,637 | 04/30/2010 09:27:00 | 4,160 | 193 | How to attach an object to an event in C#/.NET? | I defined the following DataTemplate for a LibraryContainer:
<DataTemplate x:Key="ContainerItemTemplate">
<Grid>
<Border BorderThickness="1" BorderBrush="White" Margin="3">
<s:SurfaceTextBox IsReadOnly="True" Width="120" Text="{Binding Path=name}" Padding="3"/>
</Border>
<s:SurfaceButton Content="Expand" Click="SourceFilePressed"></s:SurfaceButton>
</Grid>
</DataTemplate>
The SourceFilePressed is the following:
private void SourceFilePressed(object sender, RoutedEventArgs e)
{
Logging.Logger.getInstance().log(sender.ToString());
e.Handled = true;
}
In the method SourceFilePressed who can I get the object that is binded to the SurfaceTextBox that is in the same grid as the pressed button? Can I somehow in the DataTemplate attach this object to the Click-Event? | c# | .net | pixelsense | null | null | null | open | How to attach an object to an event in C#/.NET?
===
I defined the following DataTemplate for a LibraryContainer:
<DataTemplate x:Key="ContainerItemTemplate">
<Grid>
<Border BorderThickness="1" BorderBrush="White" Margin="3">
<s:SurfaceTextBox IsReadOnly="True" Width="120" Text="{Binding Path=name}" Padding="3"/>
</Border>
<s:SurfaceButton Content="Expand" Click="SourceFilePressed"></s:SurfaceButton>
</Grid>
</DataTemplate>
The SourceFilePressed is the following:
private void SourceFilePressed(object sender, RoutedEventArgs e)
{
Logging.Logger.getInstance().log(sender.ToString());
e.Handled = true;
}
In the method SourceFilePressed who can I get the object that is binded to the SurfaceTextBox that is in the same grid as the pressed button? Can I somehow in the DataTemplate attach this object to the Click-Event? | 0 |
9,923,261 | 03/29/2012 10:09:37 | 1,187,314 | 02/03/2012 10:49:41 | 87 | 10 | Error: Access of undefined property JSON ... but it IS there | I am developing a Flash application (Flash Player 11 as target platform) that uses the AS3 Facebook API, which in turn uses as3corelib JSON functionality. Or at least it should do so.
However, in spite of including the [latest version][1] (.93) of the as3corelib.swc, I still get the "Error: Access of undefined property JSON". I also tried including the sources directly, to no avail.
Any ideas what I am doing wrong?
As I said, the *.swc is definitely included. As is the source code (all at the correct path).
[1]: https://github.com/mikechambers/as3corelib/downloads | actionscript-3 | flash | facebook-graph-api | flashdevelop | null | null | open | Error: Access of undefined property JSON ... but it IS there
===
I am developing a Flash application (Flash Player 11 as target platform) that uses the AS3 Facebook API, which in turn uses as3corelib JSON functionality. Or at least it should do so.
However, in spite of including the [latest version][1] (.93) of the as3corelib.swc, I still get the "Error: Access of undefined property JSON". I also tried including the sources directly, to no avail.
Any ideas what I am doing wrong?
As I said, the *.swc is definitely included. As is the source code (all at the correct path).
[1]: https://github.com/mikechambers/as3corelib/downloads | 0 |
6,111,724 | 05/24/2011 14:08:40 | 767,880 | 05/24/2011 14:08:40 | 1 | 0 | Circular Queue Array in C | Dear Users of StackOverflow,
I am currently having a issue at the moment and work is beginning to pile up. I have been given a task from a lecturer to produce a circular queue array. Basically the program has been provided but it is missing out the functions.
My Knowledge of C is quite poor but I am learning.
How will I go about creating the functions to:
- Initialise Queue
- Show a message if queue is full
- Show a message if queue is empty
- Add to Queue
- Delete an element from Queue
-------------------------------------------------------------------
*/
// pre-processor directives
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
// constants
const MAXQ = 5;
// user-defined types
typedef struct circularQADT {
int front;
int rear;
int size;
float entry [MAXQ];
};
// Function prototypes
// control modules
void menuControl();
void addControl(circularQADT&);
void deleteControl(circularQADT&);
// display modules
void displayMenu();
void displayQ(circularQADT&);
// primitive operations
void initialiseQ(circularQADT&);
int emptyQ(int);
int fullQ(int);
void addToQ(circularQADT&, float);
float deleteFromQ(circularQADT&);
// start of program
void main()
{
clrscr();
menuControl();
} // end main
void menuControl()
{
circularQADT oneQueue;
char choice;
initialiseQ(oneQueue);
displayMenu();
do {
gotoxy (1, 19);
displayQ (oneQueue);
gotoxy (17, 11);
printf ("Make your selection > ");
choice = toupper(getch());
switch (choice)
{
case '1' : initialiseQ(oneQueue);
break;
case '2' : addControl (oneQueue);
break;
case '3' : deleteControl (oneQueue);
break;
} //endswith
} while (choice != 'Q');
} // end menuControl
void displayQ (circularQADT& aQueue)
{
int indx;
printf ("Qsize : %d", aQueue.size);
printf ("\nQfront : %d", aQueue.front);
printf ("\nQrear : %d",aQueue.rear);
printf ("\nQueue : ");
clreol();
if (aQueue.size == 0)
printf ("empty");
else {
for (int i=aQueue.rear; indx !=aQueue.front; i--){
if ( i < 0)
indx = i+MAXQ;
else
indx = i;
// endif
printf ("->%.2f", aQueue.entry[indx]);
} // endfor
} // endif
} // end displayQ
void displayMenu()
{
printf ("\n\t\t Software Development: Array Data Structures");
printf ("\n\t\t Assessment Task 2.1 - circular queue
with counter)");
printf ("\n\n\t\t\t1. Initialise queue.");
printf ("\n\t\t\t2. Add to queue (append).");
printf ("\n\t\t\t3. Delete from queue (serve).");
printf ("\n\t\t\tQ. QUIT");
} // displayMenu
/*
You are required to implement the following functions
*/
void addControl (circularQADT& aQueue)
{
/* Displays an error message if the queue
is full, otherwise, prompts for a value
and calls addToQ().
Placing your code here. */
} // end addControl
void deleteControl (circularQADT& aQueue) {
/* Displays an error message if the queue
is empty, otherwise, calls deleteFromQ().
Placing your code here. */
} // end deleteControl
// primitive operations
void initialiseQ (circularQADT& aQueue) {
/* Placing your code here */
} // end initialiseQ
int fullQ (int Qsize)
{
/* Placing your code here */
} // end fullQ
int emptyQ (int Qsize)
{
/* Placing your code here */
} // end emptyQ
void addToQ (circularQADT &aQueue, float aValue) {
/* Placing your code here */
} // end addToQ
float deleteFromQ (circularQADT &aQueue) {
/*Placing your code here */
} // end deleteQ
-----------------------------------------------------
Thank you for your time on reading this and I hope to recieve some feedback.
Regards,
Joe
| c | arrays | queue | program | circular | 05/24/2011 14:39:29 | not a real question | Circular Queue Array in C
===
Dear Users of StackOverflow,
I am currently having a issue at the moment and work is beginning to pile up. I have been given a task from a lecturer to produce a circular queue array. Basically the program has been provided but it is missing out the functions.
My Knowledge of C is quite poor but I am learning.
How will I go about creating the functions to:
- Initialise Queue
- Show a message if queue is full
- Show a message if queue is empty
- Add to Queue
- Delete an element from Queue
-------------------------------------------------------------------
*/
// pre-processor directives
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
// constants
const MAXQ = 5;
// user-defined types
typedef struct circularQADT {
int front;
int rear;
int size;
float entry [MAXQ];
};
// Function prototypes
// control modules
void menuControl();
void addControl(circularQADT&);
void deleteControl(circularQADT&);
// display modules
void displayMenu();
void displayQ(circularQADT&);
// primitive operations
void initialiseQ(circularQADT&);
int emptyQ(int);
int fullQ(int);
void addToQ(circularQADT&, float);
float deleteFromQ(circularQADT&);
// start of program
void main()
{
clrscr();
menuControl();
} // end main
void menuControl()
{
circularQADT oneQueue;
char choice;
initialiseQ(oneQueue);
displayMenu();
do {
gotoxy (1, 19);
displayQ (oneQueue);
gotoxy (17, 11);
printf ("Make your selection > ");
choice = toupper(getch());
switch (choice)
{
case '1' : initialiseQ(oneQueue);
break;
case '2' : addControl (oneQueue);
break;
case '3' : deleteControl (oneQueue);
break;
} //endswith
} while (choice != 'Q');
} // end menuControl
void displayQ (circularQADT& aQueue)
{
int indx;
printf ("Qsize : %d", aQueue.size);
printf ("\nQfront : %d", aQueue.front);
printf ("\nQrear : %d",aQueue.rear);
printf ("\nQueue : ");
clreol();
if (aQueue.size == 0)
printf ("empty");
else {
for (int i=aQueue.rear; indx !=aQueue.front; i--){
if ( i < 0)
indx = i+MAXQ;
else
indx = i;
// endif
printf ("->%.2f", aQueue.entry[indx]);
} // endfor
} // endif
} // end displayQ
void displayMenu()
{
printf ("\n\t\t Software Development: Array Data Structures");
printf ("\n\t\t Assessment Task 2.1 - circular queue
with counter)");
printf ("\n\n\t\t\t1. Initialise queue.");
printf ("\n\t\t\t2. Add to queue (append).");
printf ("\n\t\t\t3. Delete from queue (serve).");
printf ("\n\t\t\tQ. QUIT");
} // displayMenu
/*
You are required to implement the following functions
*/
void addControl (circularQADT& aQueue)
{
/* Displays an error message if the queue
is full, otherwise, prompts for a value
and calls addToQ().
Placing your code here. */
} // end addControl
void deleteControl (circularQADT& aQueue) {
/* Displays an error message if the queue
is empty, otherwise, calls deleteFromQ().
Placing your code here. */
} // end deleteControl
// primitive operations
void initialiseQ (circularQADT& aQueue) {
/* Placing your code here */
} // end initialiseQ
int fullQ (int Qsize)
{
/* Placing your code here */
} // end fullQ
int emptyQ (int Qsize)
{
/* Placing your code here */
} // end emptyQ
void addToQ (circularQADT &aQueue, float aValue) {
/* Placing your code here */
} // end addToQ
float deleteFromQ (circularQADT &aQueue) {
/*Placing your code here */
} // end deleteQ
-----------------------------------------------------
Thank you for your time on reading this and I hope to recieve some feedback.
Regards,
Joe
| 1 |
4,631,552 | 01/08/2011 00:29:13 | 190,767 | 10/15/2009 17:00:22 | 34 | 3 | MS Access: Query Reuse / Supplying Query Parameters Using VBA | I have two very complex queries that are displayed on the same form and that use multiple parameters supplied by that Form. I would like to reuse the query in a VBA function and/or on another form. As such, I have two questions:
1. Is there a way to write the SQL statement such that a query dynamically determines the form to read its parameter from rather than having to specify the name of the form? E.g., Something along the line of Me!startDate, rather than Forms!myForm!startDate.
2. Is there a way to supply parameters to a query when opening it as a DAO RecordSet? | ms-access | access-vba | null | null | null | null | open | MS Access: Query Reuse / Supplying Query Parameters Using VBA
===
I have two very complex queries that are displayed on the same form and that use multiple parameters supplied by that Form. I would like to reuse the query in a VBA function and/or on another form. As such, I have two questions:
1. Is there a way to write the SQL statement such that a query dynamically determines the form to read its parameter from rather than having to specify the name of the form? E.g., Something along the line of Me!startDate, rather than Forms!myForm!startDate.
2. Is there a way to supply parameters to a query when opening it as a DAO RecordSet? | 0 |
4,672,201 | 01/12/2011 17:58:37 | 99,923 | 05/02/2009 17:30:50 | 2,001 | 111 | Other common protocols besides HTTP? | I usually pass data between my web servers (in different locations) using HTTP requests (sometimes using SSL if it's sensitive). I was wondering if there were any **lighter protocols** that I might be able to swap HTTP(S) for that would also support public/private keys like SSH or something.
I used PHP sockets to build a SMTP client before so I wouldn't mind doing that if required. | http | protocols | alternative | null | null | null | open | Other common protocols besides HTTP?
===
I usually pass data between my web servers (in different locations) using HTTP requests (sometimes using SSL if it's sensitive). I was wondering if there were any **lighter protocols** that I might be able to swap HTTP(S) for that would also support public/private keys like SSH or something.
I used PHP sockets to build a SMTP client before so I wouldn't mind doing that if required. | 0 |
3,481,385 | 08/14/2010 00:02:47 | 420,090 | 08/13/2010 23:48:33 | 1 | 0 | Segmentation Fault using Tinyxml | I'm trying to read an Xml file recursively using Tinyxml, but when I try to acces the data I get a "Segmentation Fault". here is the code :
<code>
int id=0, categoria=0;
const char* nombre;
do{
ingrediente = ingrediente->NextSiblingElement("Ingrediente");
contador++;
if(ingrediente->Attribute("id")!=NULL)id = atoi( ingrediente->Attribute("id") );
if(ingrediente->Attribute("categoria")!=NULL)categoria = atoi ( ingrediente->Attribute("categoria") );
if(ingrediente!=NULL)nombre = ( ( ingrediente->FirstChild() )->ToText() )->Value();
}while(ingrediente);
</code>
For some reason, the three "if" lines throws me the Segmentation Fault but I've not idea about where is the problem.
Thanks in advance. | c++ | tinyxml | null | null | null | null | open | Segmentation Fault using Tinyxml
===
I'm trying to read an Xml file recursively using Tinyxml, but when I try to acces the data I get a "Segmentation Fault". here is the code :
<code>
int id=0, categoria=0;
const char* nombre;
do{
ingrediente = ingrediente->NextSiblingElement("Ingrediente");
contador++;
if(ingrediente->Attribute("id")!=NULL)id = atoi( ingrediente->Attribute("id") );
if(ingrediente->Attribute("categoria")!=NULL)categoria = atoi ( ingrediente->Attribute("categoria") );
if(ingrediente!=NULL)nombre = ( ( ingrediente->FirstChild() )->ToText() )->Value();
}while(ingrediente);
</code>
For some reason, the three "if" lines throws me the Segmentation Fault but I've not idea about where is the problem.
Thanks in advance. | 0 |
2,161,264 | 01/29/2010 10:29:15 | 238,779 | 12/26/2009 08:54:17 | 100 | 3 | Tips for improving performance of DB that is above size 40 GB (Sql Server 2005) | The current DB or our project has crossed over 40 GB this month and on an average it is growing monthly by around 3 GB. Now all the tables are best normalized and proper indexing has been used. But still as the size is growing it is taking more time to fire even basic queries like 'select count(1) from table'. So can u share some more points that will help in this front. Database is Sql Server 2005. Thanks in advance. | sql | server | performance | null | null | null | open | Tips for improving performance of DB that is above size 40 GB (Sql Server 2005)
===
The current DB or our project has crossed over 40 GB this month and on an average it is growing monthly by around 3 GB. Now all the tables are best normalized and proper indexing has been used. But still as the size is growing it is taking more time to fire even basic queries like 'select count(1) from table'. So can u share some more points that will help in this front. Database is Sql Server 2005. Thanks in advance. | 0 |
10,887,170 | 06/04/2012 19:32:42 | 1,183,614 | 02/01/2012 20:06:36 | 15 | 0 | How to select distinct by 2 fields | I need to be able to only select records which have an IsActive = 1 in addition to all of this:
SELECT DISTINCT 0 as CommunityID,
CASE Libname
WHEN 'RKHL' THEN 'ROCK HILL'
WHEN 'FTML' THEN 'FORT MILL'
WHEN 'LANC' THEN 'LANCASTER'
WHEN 'BREV' THEN 'BREVARD'
WHEN 'PBTC' THEN 'MIDLANDS-CLEC'
WHEN 'PBTI' THEN 'MIDLANDS-ILEC'
END AS CommunityDesc,
LibName,
LibName + '|' AS FilterByID,
IsActive
FROM Reference.dbo.Community
WHERE LibName <> 'CAROTEL'
UNION
SELECT CommunityID, RTRIM(COMMNAME) AS CommunityDesc, LibName, LibName + '|' + RTRIM(COMMNAME) AS FilterByID, IsActive
FROM Reference.dbo.Community
WHERE LibName <> 'CAROTEL'
ORDER BY 1,3;
| sql | database | group-by | distinct | null | null | open | How to select distinct by 2 fields
===
I need to be able to only select records which have an IsActive = 1 in addition to all of this:
SELECT DISTINCT 0 as CommunityID,
CASE Libname
WHEN 'RKHL' THEN 'ROCK HILL'
WHEN 'FTML' THEN 'FORT MILL'
WHEN 'LANC' THEN 'LANCASTER'
WHEN 'BREV' THEN 'BREVARD'
WHEN 'PBTC' THEN 'MIDLANDS-CLEC'
WHEN 'PBTI' THEN 'MIDLANDS-ILEC'
END AS CommunityDesc,
LibName,
LibName + '|' AS FilterByID,
IsActive
FROM Reference.dbo.Community
WHERE LibName <> 'CAROTEL'
UNION
SELECT CommunityID, RTRIM(COMMNAME) AS CommunityDesc, LibName, LibName + '|' + RTRIM(COMMNAME) AS FilterByID, IsActive
FROM Reference.dbo.Community
WHERE LibName <> 'CAROTEL'
ORDER BY 1,3;
| 0 |
6,177,122 | 05/30/2011 13:46:24 | 85,057 | 03/31/2009 12:39:09 | 924 | 9 | iPhone OpenGL game: Can't get constant fps | I've developed a game for iPhone in c++ and OpenGL, and did all my testing in an iPod 3rd gen where it runs at constant 60fps.
Now I'm doing some tests on an iPod 1st gen and I get about 20-30 fps (about 35 ms per frame). I know that's normal because of hardware differences, but the most weird part is that every 40 frames (aprox) there is a frame that takes about 120 ms and I can't find the problem; it seems it's random.
I would appreciate any idea. | iphone | performance | opengl-es | null | null | 05/30/2011 16:24:53 | not a real question | iPhone OpenGL game: Can't get constant fps
===
I've developed a game for iPhone in c++ and OpenGL, and did all my testing in an iPod 3rd gen where it runs at constant 60fps.
Now I'm doing some tests on an iPod 1st gen and I get about 20-30 fps (about 35 ms per frame). I know that's normal because of hardware differences, but the most weird part is that every 40 frames (aprox) there is a frame that takes about 120 ms and I can't find the problem; it seems it's random.
I would appreciate any idea. | 1 |
2,317,779 | 02/23/2010 11:45:56 | 255,412 | 01/21/2010 01:35:36 | 11 | 0 | Understanding the library functions in c++ | If I'd like to know how a function written in like standard C++ library work (not just the MSDN description). I mean how does it allocate, manage, deallocate memory and return you the result. where or what do you need to know to understand that? | c++ | null | null | null | null | 02/23/2010 23:39:47 | not a real question | Understanding the library functions in c++
===
If I'd like to know how a function written in like standard C++ library work (not just the MSDN description). I mean how does it allocate, manage, deallocate memory and return you the result. where or what do you need to know to understand that? | 1 |
5,735,827 | 04/20/2011 19:50:33 | 252,556 | 01/17/2010 10:50:30 | 857 | 24 | CUDA/PyCUDA: Diagnosing launch failure that disappears under cuda-gdb | Anyone know likely avenues of investigation for kernel launch failures that disappear when run under cuda-gdb? Memory assignments are within spec, launches fail on the same run of the same kernel every time, and (so far) it hasn't failed within the debugger.
Oh Great SO Gurus, What now? | c | debugging | gdb | cuda | gdb-python | null | open | CUDA/PyCUDA: Diagnosing launch failure that disappears under cuda-gdb
===
Anyone know likely avenues of investigation for kernel launch failures that disappear when run under cuda-gdb? Memory assignments are within spec, launches fail on the same run of the same kernel every time, and (so far) it hasn't failed within the debugger.
Oh Great SO Gurus, What now? | 0 |
11,643,876 | 07/25/2012 06:27:28 | 1,448,330 | 06/11/2012 07:03:22 | 35 | 0 | find the next specific element using javascript? | I have a problem on this, i want to enabled the select element by checking the check box that correspond the select element in a row. how can i do that?
<table>
<?php do { ?>
<tr>
<td><input type="checkbox" /></td>
<td>
<select disabled="disabled">
<option value="1">Dog</option>
<option value="2">Cat</option>
</select>
</td>
</tr>
<?php } while($row = mysql_fetch_assoc($result)); ?>
</table>
| javascript | null | null | null | null | null | open | find the next specific element using javascript?
===
I have a problem on this, i want to enabled the select element by checking the check box that correspond the select element in a row. how can i do that?
<table>
<?php do { ?>
<tr>
<td><input type="checkbox" /></td>
<td>
<select disabled="disabled">
<option value="1">Dog</option>
<option value="2">Cat</option>
</select>
</td>
</tr>
<?php } while($row = mysql_fetch_assoc($result)); ?>
</table>
| 0 |
9,473,464 | 02/27/2012 22:35:48 | 357,937 | 06/03/2010 21:33:49 | 89 | 1 | In what programming language is Sublime Text 2 written | I like Sublime text 2 and how its cross-platform. Do you know in which language is this programm written, or which technologies are used? Thanks. | programming-languages | sublimetext | null | null | null | 02/28/2012 22:31:32 | off topic | In what programming language is Sublime Text 2 written
===
I like Sublime text 2 and how its cross-platform. Do you know in which language is this programm written, or which technologies are used? Thanks. | 2 |
2,459,860 | 03/17/2010 04:10:59 | 293,221 | 03/14/2010 01:43:13 | 44 | 1 | how walker class in wordpress work | is Anybody know how to understand how walker class in wordpress work ? What is it ? And (maybe) How ? | wordpress | null | null | null | null | null | open | how walker class in wordpress work
===
is Anybody know how to understand how walker class in wordpress work ? What is it ? And (maybe) How ? | 0 |
2,460,831 | 03/17/2010 08:55:20 | 264,244 | 02/02/2010 10:46:14 | 23 | 0 | Which silverlight book i should buy? | Can you recommend me some good silverlight books? Thanks. | silverlight | books | null | null | null | 03/04/2012 23:23:14 | not constructive | Which silverlight book i should buy?
===
Can you recommend me some good silverlight books? Thanks. | 4 |
11,628,499 | 07/24/2012 10:02:41 | 1,526,474 | 07/15/2012 04:37:15 | 17 | 0 | Copyright issue with apple | I am working on a game and it seems very boring with the existing icons and music.. I was wondering if I am allowed to use some movie characters and music like james bond or south park.. If I am not allowed to use them, what should I do? I am not a designer so I always get images from google.. | ios | apple | copyright | null | null | 07/24/2012 13:14:28 | off topic | Copyright issue with apple
===
I am working on a game and it seems very boring with the existing icons and music.. I was wondering if I am allowed to use some movie characters and music like james bond or south park.. If I am not allowed to use them, what should I do? I am not a designer so I always get images from google.. | 2 |
1,180,213 | 07/24/2009 21:21:30 | 115,608 | 06/01/2009 19:31:12 | 83 | 3 | Jquery: The $ dollarsign | I have something simple like this:
$(selector).append("somestuff");
But since I'm going to reuse the selector I cache it with:
var $selector = $(selector);
So I end up with:
$selector.append("somestuff");
My question is, should I be doing that, or should I be doing:
var selector = $(selector);
selector.append("somestuff");
Trying either one, both works. Which method is correct, why. Is the '$' $selector unnecessary because the jquery object has already been declared in $(selector).
Thanks. | jquery | null | null | null | null | null | open | Jquery: The $ dollarsign
===
I have something simple like this:
$(selector).append("somestuff");
But since I'm going to reuse the selector I cache it with:
var $selector = $(selector);
So I end up with:
$selector.append("somestuff");
My question is, should I be doing that, or should I be doing:
var selector = $(selector);
selector.append("somestuff");
Trying either one, both works. Which method is correct, why. Is the '$' $selector unnecessary because the jquery object has already been declared in $(selector).
Thanks. | 0 |
10,945,913 | 06/08/2012 09:04:15 | 1,404,852 | 05/19/2012 08:32:10 | 17 | 0 | Client Server, designing protocol | I code client-server application on sockets, and i have task to design my own protocol. Client and server communicating with xml. I use JAXB library. Client perfectly write XML into output stream. But i can not read it in Server. Can you show how to reciev datas from client properly?
Thi is a Client:
public class Client {
public static final String SERVER_HOST = "localhost";
public static final Integer SERVER_PORT = 4444;
public static final Logger LOG = Logger.getLogger(Client.class);
public static void main(String[] args) throws IOException {
System.out.println("Welcome to Client side");
XMLProtocol protocol = new XMLProtocol();
Socket fromserver = null;
fromserver = new Socket(SERVER_HOST, SERVER_PORT);
BufferedReader in = new BufferedReader(new InputStreamReader(fromserver.getInputStream()));
PrintWriter out = new PrintWriter(fromserver.getOutputStream(), true);
BufferedReader inu = new BufferedReader(new InputStreamReader(System.in));
String fuser, fserver;
while ((fuser = inu.readLine()) != null) {
protocol.setComId((long) 0);
protocol.setContent("Client content");
protocol.setLogin("User");
try {
JAXBContext jaxbContext = JAXBContext.newInstance(XMLProtocol.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.marshal(protocol, out);
} catch (JAXBException e) {
LOG.error("Error while processing protocol"+e);
}
fserver = in.readLine();
System.out.println(fserver);
if (fuser.equalsIgnoreCase("close"))
break;
if (fuser.equalsIgnoreCase("exit"))
break;
}
out.close();
in.close();
inu.close();
fromserver.close();
}
}
And Server:
package dataart.practice.server;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import org.apache.log4j.Logger;
public class Server {
public static final Logger LOG = Logger.getLogger(Server.class);
public static final String SERVER_HOST = "localhost";
public static final Integer SERVER_PORT = 4444;
public static Integer userCount = 0;
public static void main(String[] args) throws IOException {
LOG.trace("Server started");
ServerSocket s = new ServerSocket(SERVER_PORT);
try {
while (true) {
LOG.trace("Waiting for connections...");
Socket socket = s.accept();
try {
new ServerThread(socket);
LOG.trace("Users in the chat: "+(userCount+1));
userCount++;
} catch (IOException e) {
socket.close();
}
}
} finally {
s.close();
}
}
}
And my thread.
public class ServerThread extends Thread {
private static final Logger LOG = Logger.getLogger(ServerThread.class);
private Socket socket;
private BufferedReader in;
private PrintWriter out;
private String buffer;
public ServerThread(Socket s) throws IOException {
socket = s;
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);
start();
}
public void run() {
try {
while (true) {
if ((buffer = in.readLine()).endsWith("</xmlProtocol>")) {
JAXBContext jaxbContext = JAXBContext.newInstance(XMLProtocol.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
//sXMLProtocol protocol = (XMLProtocol) jaxbUnmarshaller.unmarshal();
//LOG.trace("Getting message from user" + protocol.getContent());
}
LOG.trace("Nop");
}
} catch (JAXBException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
socket.close();
LOG.trace("Socket closed");
} catch (IOException e) {
LOG.error("Socket no closed" + e);
}
}
}
}
What should i write on Server to parse XML that i get? I try to parse InputStream | java | jaxb | client-server | unmarshall | null | null | open | Client Server, designing protocol
===
I code client-server application on sockets, and i have task to design my own protocol. Client and server communicating with xml. I use JAXB library. Client perfectly write XML into output stream. But i can not read it in Server. Can you show how to reciev datas from client properly?
Thi is a Client:
public class Client {
public static final String SERVER_HOST = "localhost";
public static final Integer SERVER_PORT = 4444;
public static final Logger LOG = Logger.getLogger(Client.class);
public static void main(String[] args) throws IOException {
System.out.println("Welcome to Client side");
XMLProtocol protocol = new XMLProtocol();
Socket fromserver = null;
fromserver = new Socket(SERVER_HOST, SERVER_PORT);
BufferedReader in = new BufferedReader(new InputStreamReader(fromserver.getInputStream()));
PrintWriter out = new PrintWriter(fromserver.getOutputStream(), true);
BufferedReader inu = new BufferedReader(new InputStreamReader(System.in));
String fuser, fserver;
while ((fuser = inu.readLine()) != null) {
protocol.setComId((long) 0);
protocol.setContent("Client content");
protocol.setLogin("User");
try {
JAXBContext jaxbContext = JAXBContext.newInstance(XMLProtocol.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.marshal(protocol, out);
} catch (JAXBException e) {
LOG.error("Error while processing protocol"+e);
}
fserver = in.readLine();
System.out.println(fserver);
if (fuser.equalsIgnoreCase("close"))
break;
if (fuser.equalsIgnoreCase("exit"))
break;
}
out.close();
in.close();
inu.close();
fromserver.close();
}
}
And Server:
package dataart.practice.server;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import org.apache.log4j.Logger;
public class Server {
public static final Logger LOG = Logger.getLogger(Server.class);
public static final String SERVER_HOST = "localhost";
public static final Integer SERVER_PORT = 4444;
public static Integer userCount = 0;
public static void main(String[] args) throws IOException {
LOG.trace("Server started");
ServerSocket s = new ServerSocket(SERVER_PORT);
try {
while (true) {
LOG.trace("Waiting for connections...");
Socket socket = s.accept();
try {
new ServerThread(socket);
LOG.trace("Users in the chat: "+(userCount+1));
userCount++;
} catch (IOException e) {
socket.close();
}
}
} finally {
s.close();
}
}
}
And my thread.
public class ServerThread extends Thread {
private static final Logger LOG = Logger.getLogger(ServerThread.class);
private Socket socket;
private BufferedReader in;
private PrintWriter out;
private String buffer;
public ServerThread(Socket s) throws IOException {
socket = s;
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);
start();
}
public void run() {
try {
while (true) {
if ((buffer = in.readLine()).endsWith("</xmlProtocol>")) {
JAXBContext jaxbContext = JAXBContext.newInstance(XMLProtocol.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
//sXMLProtocol protocol = (XMLProtocol) jaxbUnmarshaller.unmarshal();
//LOG.trace("Getting message from user" + protocol.getContent());
}
LOG.trace("Nop");
}
} catch (JAXBException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
socket.close();
LOG.trace("Socket closed");
} catch (IOException e) {
LOG.error("Socket no closed" + e);
}
}
}
}
What should i write on Server to parse XML that i get? I try to parse InputStream | 0 |
6,141,940 | 05/26/2011 16:30:32 | 46,717 | 12/16/2008 16:13:09 | 580 | 13 | SQL test for prospective employees | I hope it's okay to ask this question here, but I'm wondering if anyone out there in the data analyst/IT community has developed a test for applicants to verify their sql skills at an intermediate to advanced level?
thank you!
-C | sql | testing | interview-questions | null | null | 05/26/2011 16:35:25 | off topic | SQL test for prospective employees
===
I hope it's okay to ask this question here, but I'm wondering if anyone out there in the data analyst/IT community has developed a test for applicants to verify their sql skills at an intermediate to advanced level?
thank you!
-C | 2 |
11,083,130 | 06/18/2012 12:41:40 | 1,201,160 | 02/10/2012 03:09:27 | 59 | 2 | auto install apk after download | i have a code which download the apk from server by using Asynctask, Currently the new intent will pop up and ask the user for the permission, how to make the apps will auto install the apk after the download is done. i want to put the progress of the installation in the notification bar like google play store did :)
Below is the code how i show the apk:
@Override
protected void onPostExecute(Void unused) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file:///sdcard/MaxApps/3d.apk"), "application/vnd.android.package-archive");
startActivity(intent);
}
| android | android-asynctask | null | null | null | null | open | auto install apk after download
===
i have a code which download the apk from server by using Asynctask, Currently the new intent will pop up and ask the user for the permission, how to make the apps will auto install the apk after the download is done. i want to put the progress of the installation in the notification bar like google play store did :)
Below is the code how i show the apk:
@Override
protected void onPostExecute(Void unused) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file:///sdcard/MaxApps/3d.apk"), "application/vnd.android.package-archive");
startActivity(intent);
}
| 0 |
11,177,083 | 06/24/2012 11:32:15 | 1,189,194 | 02/04/2012 10:21:28 | 13 | 0 | ajax code define error or doesn't respond | I am new to ajax. Studies basic from wrook's blog.
I used the below code to insert into my db using ajax.
But the code does't print any thing other than 'Just wait a second'.
the JsFiddle <a href="http://jsfiddle.net/abelkbil/VwFa8/"> link </a>
Ajax code is as below:-
/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if (browser == "Microsoft Internet Explorer") {
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}
else {
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();
function insertReply() {
if (http.readyState == 4) {
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('insert_response').innerHTML = 'User added:' + response;
}
}
/* -------------------------- */
/* INSERT */
/* -------------------------- */
/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
var nocache = 0;
function insert() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('insert_response').innerHTML = "Just a second...";
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var username = encodeURI(document.getElementById('Username').value);
var name = encodeURI(document.getElementById('Name').value);
var password = encodeURI(document.getElementById('Password').value);
document.getElementById('insert_response').innerHTML = 'h ' + username + ' ' + name;
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'insert.php?name=' + name + '&username=' + username + '&password=' + password);
http.onreadystatechange = insertReply;
http.send(null);
}
The php code to insert db is ::--
if(isset($_GET['name']) && isset($_GET['username'])&& isset($_GET['password'])){
$name= $_GET['name'];
$username= $_GET['username'];
$password= $_GET['password'];
$sql = "INSERT INTO `vidyasims`.`user_accounts` (`UserID`, `UserName`, `Name`, `Password`) VALUES (NULL, '. $username. ','. $name. ', '. $password. ');";
$insertSite= mysql_query($sql) or die(mysql_error());
//If is set URL variables and insert is ok, show the site name -->
echo $username;
} else {
echo 'Error! Please fill all fileds!';
support is welcomed. Thanks in advance.
Note- The above code doent add a new user to db! | php | javascript | jquery | ajax | null | null | open | ajax code define error or doesn't respond
===
I am new to ajax. Studies basic from wrook's blog.
I used the below code to insert into my db using ajax.
But the code does't print any thing other than 'Just wait a second'.
the JsFiddle <a href="http://jsfiddle.net/abelkbil/VwFa8/"> link </a>
Ajax code is as below:-
/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if (browser == "Microsoft Internet Explorer") {
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}
else {
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();
function insertReply() {
if (http.readyState == 4) {
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('insert_response').innerHTML = 'User added:' + response;
}
}
/* -------------------------- */
/* INSERT */
/* -------------------------- */
/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
var nocache = 0;
function insert() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('insert_response').innerHTML = "Just a second...";
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var username = encodeURI(document.getElementById('Username').value);
var name = encodeURI(document.getElementById('Name').value);
var password = encodeURI(document.getElementById('Password').value);
document.getElementById('insert_response').innerHTML = 'h ' + username + ' ' + name;
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'insert.php?name=' + name + '&username=' + username + '&password=' + password);
http.onreadystatechange = insertReply;
http.send(null);
}
The php code to insert db is ::--
if(isset($_GET['name']) && isset($_GET['username'])&& isset($_GET['password'])){
$name= $_GET['name'];
$username= $_GET['username'];
$password= $_GET['password'];
$sql = "INSERT INTO `vidyasims`.`user_accounts` (`UserID`, `UserName`, `Name`, `Password`) VALUES (NULL, '. $username. ','. $name. ', '. $password. ');";
$insertSite= mysql_query($sql) or die(mysql_error());
//If is set URL variables and insert is ok, show the site name -->
echo $username;
} else {
echo 'Error! Please fill all fileds!';
support is welcomed. Thanks in advance.
Note- The above code doent add a new user to db! | 0 |
8,997,979 | 01/25/2012 04:52:31 | 546,029 | 12/17/2010 12:06:41 | 409 | 5 | Is there a way to post all values in a multiselect list and not just the selected ones? | I have two MultiSelect lists (AllProductList and SelectedProductList), AllProductList contains all products for a particular category and I add/clone options from the AllProductList to the SelectedProductList using JQuery.
I obviously only wish to post the values in the SelectedProductList and irrespective of whether
they are selected or not.
I have wrapped the form tags around the SelectedProductList only and now need some way to post
all option values in it, irrespective whether selected or not. | jquery | html | forms | http | null | null | open | Is there a way to post all values in a multiselect list and not just the selected ones?
===
I have two MultiSelect lists (AllProductList and SelectedProductList), AllProductList contains all products for a particular category and I add/clone options from the AllProductList to the SelectedProductList using JQuery.
I obviously only wish to post the values in the SelectedProductList and irrespective of whether
they are selected or not.
I have wrapped the form tags around the SelectedProductList only and now need some way to post
all option values in it, irrespective whether selected or not. | 0 |
4,593,055 | 01/04/2011 11:23:56 | 193,637 | 10/21/2009 07:45:29 | 136 | 10 | How to make JAXB recognize @XmlElement(default='something') annotation parameters? | Having no luck in generating XML with fixed element values using JAXB 2.1 RI.
We're generating XML bound code using xjc and marshall the results.
It works for attributes using `<xs:attribute fixed='something'/>` and the JAXB customization property `fixedAttributeAsConstantProperty`.
For elements we figured that there was no way to do the same. Or is there?
As a workaround, we used `<xs:element default='something'/>` which is turned into `@XmlElement(default='something')`. Now my guess is that you can tell the marshaller somehow to interpret the `default` parameter and generate an element with the corresponding content, like `<element>something</element>`.
I've looked at the standard and RI vendor specific marshaller configuration properties without finding something useful.
There seems to be an xjc plug-in that does something similar[1], but I'd be kinda surprised if there is no standard JAXB way to do so.
Any pointers are much appreciated, thanks.
[1] http://fisheye5.cenqua.com/browse/~raw,r=1.5/jaxb2-commons/www/default-value/index.html | java | jaxb | jaxb2 | null | null | null | open | How to make JAXB recognize @XmlElement(default='something') annotation parameters?
===
Having no luck in generating XML with fixed element values using JAXB 2.1 RI.
We're generating XML bound code using xjc and marshall the results.
It works for attributes using `<xs:attribute fixed='something'/>` and the JAXB customization property `fixedAttributeAsConstantProperty`.
For elements we figured that there was no way to do the same. Or is there?
As a workaround, we used `<xs:element default='something'/>` which is turned into `@XmlElement(default='something')`. Now my guess is that you can tell the marshaller somehow to interpret the `default` parameter and generate an element with the corresponding content, like `<element>something</element>`.
I've looked at the standard and RI vendor specific marshaller configuration properties without finding something useful.
There seems to be an xjc plug-in that does something similar[1], but I'd be kinda surprised if there is no standard JAXB way to do so.
Any pointers are much appreciated, thanks.
[1] http://fisheye5.cenqua.com/browse/~raw,r=1.5/jaxb2-commons/www/default-value/index.html | 0 |
9,102,234 | 02/01/2012 19:47:45 | 742,547 | 05/06/2011 22:35:58 | 22 | 1 | XmlSerializer in C# won't serialize IEnumerable | I have an invocation logger that is intended to record all method calls along with the parameters associated with the method using XmlSerializer. It works well for most of the calls, but it throws an exception for all methods that has a parameter of IEnumerable type.
For example, `void MethodWithPlace( Place value )` would be serialized, but `void MethodWithPlace( IEnumerable<Place> value )` would not.
The exception is
> System.NotSupportedException: Cannot serialize interface
> System.Collections.Generic.IEnumerable`1[[Place,
> Test, Version=0.0.0.0, Culture=neutral]].
What should I do to make it work with those methods with IEnumerable as one of its parameters? Thanks!
| c# | xml-serialization | xmlserializer | null | null | null | open | XmlSerializer in C# won't serialize IEnumerable
===
I have an invocation logger that is intended to record all method calls along with the parameters associated with the method using XmlSerializer. It works well for most of the calls, but it throws an exception for all methods that has a parameter of IEnumerable type.
For example, `void MethodWithPlace( Place value )` would be serialized, but `void MethodWithPlace( IEnumerable<Place> value )` would not.
The exception is
> System.NotSupportedException: Cannot serialize interface
> System.Collections.Generic.IEnumerable`1[[Place,
> Test, Version=0.0.0.0, Culture=neutral]].
What should I do to make it work with those methods with IEnumerable as one of its parameters? Thanks!
| 0 |
3,523,896 | 08/19/2010 16:24:51 | 423,100 | 08/17/2010 16:35:23 | 1 | 1 | Retrieving 2 sql querry from one page to other using hyperlink Gridview | Greetings everyone,
I have a code to pass the querry from a one page that has a gridview hyperlink but what i didn't know is how to retrieve it..
Here is my code i hope you could help me fix this one.. thnx
Have a nice day ^^,
> **First Location page**
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" HorizontalAlign="Center" Width="570px"
AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None">
<RowStyle BackColor="#E3EAEB" />
<Columns>
<asp:BoundField DataField="course_cat" HeaderText="course_cat"
SortExpression="course_cat">
</asp:BoundField>
<asp:BoundField DataField="section_name" HeaderText="section_name"
SortExpression="section_name">
</asp:BoundField>
<asp:BoundField DataField="no_of_students" HeaderText="numberofstudents"
SortExpression="no_of_students">
</asp:BoundField>
<asp:BoundField DataField="section_id" HeaderText="section_id"
InsertVisible="False" ReadOnly="True" SortExpression="section_id" Visible="False" />
<asp:BoundField DataField="course_id" HeaderText="course_id"
InsertVisible="False" ReadOnly="True" SortExpression="course_id" Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="section_id,course_id"
DataNavigateUrlFormatString="ClassList.aspx?section_id={0}& course_id={1}"
Text="View Students" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbProLearnConnectionString %>"
SelectCommand="SELECT tblCourses.course_id, tblCourses.course_cat, tblSections.section_id, tblSections.section_name, tblSections.no_of_students FROM tblCourses
CROSS JOIN tblSections GROUP BY tblCourses.course_id, tblCourses.course_cat, tblSections.section_id, tblSections.section_name, tblSections.no_of_students">
</asp:SqlDataSource>
> **Destination Page**
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" HorizontalAlign="Center" Width="570px"
AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None">
<RowStyle BackColor="#E3EAEB" />
<Columns>
<asp:BoundField DataField="StudentID" HeaderText="StudentID"
SortExpression="StudentID" />
<asp:BoundField DataField="LastName" HeaderText="LastName"
SortExpression="LastName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName"
SortExpression="FirstName" />
<asp:TemplateField HeaderText="section_name" SortExpression="section_name">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("section_name") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("section_name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="course_cat" SortExpression="course_cat">
<EditItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("course_cat") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("course_cat") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbProLearnConnectionString %>"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT tblStudents.StudentID, tblStudents.LastName, tblStudents.FirstName, (SELECT section_name FROM tblSections AS tblSections_1
WHERE (tblStudentSubject.section_id = section_id)) AS section_name, (SELECT course_cat FROM tblCourses AS tblCourses_1
WHERE (tblStudentSubject.course_id = course_id)) AS course_cat FROM tblStudentSubject
INNER JOIN tblStudents ON tblStudentSubject.student_id = tblStudents.StudentID
INNER JOIN tblCourses AS tblCourses ON tblStudentSubject.course_id = tblCourses.course_id
INNER JOIN tblSections AS tblSections ON tblStudentSubject.section_id = tblSections.section_id
WHERE (tblStudentSubject.section_id = @section_id) AND (tblStudentSubject.course_id = @course_id) ORDER BY tblStudents.LastName">
<SelectParameters>
<asp:QueryStringParameter Name="section_id" QueryStringField="section_id" />
<asp:QueryStringParameter Name="course_id" QueryStringField="course_id" />
</SelectParameters>
</asp:SqlDataSource>
| c# | .net | asp.net | vb.net | .net-3.5 | null | open | Retrieving 2 sql querry from one page to other using hyperlink Gridview
===
Greetings everyone,
I have a code to pass the querry from a one page that has a gridview hyperlink but what i didn't know is how to retrieve it..
Here is my code i hope you could help me fix this one.. thnx
Have a nice day ^^,
> **First Location page**
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" HorizontalAlign="Center" Width="570px"
AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None">
<RowStyle BackColor="#E3EAEB" />
<Columns>
<asp:BoundField DataField="course_cat" HeaderText="course_cat"
SortExpression="course_cat">
</asp:BoundField>
<asp:BoundField DataField="section_name" HeaderText="section_name"
SortExpression="section_name">
</asp:BoundField>
<asp:BoundField DataField="no_of_students" HeaderText="numberofstudents"
SortExpression="no_of_students">
</asp:BoundField>
<asp:BoundField DataField="section_id" HeaderText="section_id"
InsertVisible="False" ReadOnly="True" SortExpression="section_id" Visible="False" />
<asp:BoundField DataField="course_id" HeaderText="course_id"
InsertVisible="False" ReadOnly="True" SortExpression="course_id" Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="section_id,course_id"
DataNavigateUrlFormatString="ClassList.aspx?section_id={0}& course_id={1}"
Text="View Students" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbProLearnConnectionString %>"
SelectCommand="SELECT tblCourses.course_id, tblCourses.course_cat, tblSections.section_id, tblSections.section_name, tblSections.no_of_students FROM tblCourses
CROSS JOIN tblSections GROUP BY tblCourses.course_id, tblCourses.course_cat, tblSections.section_id, tblSections.section_name, tblSections.no_of_students">
</asp:SqlDataSource>
> **Destination Page**
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" HorizontalAlign="Center" Width="570px"
AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None">
<RowStyle BackColor="#E3EAEB" />
<Columns>
<asp:BoundField DataField="StudentID" HeaderText="StudentID"
SortExpression="StudentID" />
<asp:BoundField DataField="LastName" HeaderText="LastName"
SortExpression="LastName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName"
SortExpression="FirstName" />
<asp:TemplateField HeaderText="section_name" SortExpression="section_name">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("section_name") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("section_name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="course_cat" SortExpression="course_cat">
<EditItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("course_cat") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("course_cat") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbProLearnConnectionString %>"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT tblStudents.StudentID, tblStudents.LastName, tblStudents.FirstName, (SELECT section_name FROM tblSections AS tblSections_1
WHERE (tblStudentSubject.section_id = section_id)) AS section_name, (SELECT course_cat FROM tblCourses AS tblCourses_1
WHERE (tblStudentSubject.course_id = course_id)) AS course_cat FROM tblStudentSubject
INNER JOIN tblStudents ON tblStudentSubject.student_id = tblStudents.StudentID
INNER JOIN tblCourses AS tblCourses ON tblStudentSubject.course_id = tblCourses.course_id
INNER JOIN tblSections AS tblSections ON tblStudentSubject.section_id = tblSections.section_id
WHERE (tblStudentSubject.section_id = @section_id) AND (tblStudentSubject.course_id = @course_id) ORDER BY tblStudents.LastName">
<SelectParameters>
<asp:QueryStringParameter Name="section_id" QueryStringField="section_id" />
<asp:QueryStringParameter Name="course_id" QueryStringField="course_id" />
</SelectParameters>
</asp:SqlDataSource>
| 0 |
8,132,180 | 11/15/2011 06:08:28 | 1,046,898 | 11/15/2011 05:41:19 | 1 | 0 | Is there a more effective method to avoiding spam on StackOverflow and similar websites? | StackOverflow offers a unique way of preventing spam by requiring new users to amass 15 'reputation points' before they can post answers to questions. This prevents spam and garbage answers, but in turn promotes spam and garbage *questions*. Since the egg comes before the chicken and since we water plants from their roots and not their leaves, wouldn't it make more sense to allow new users to post answers and disallow them from posting questions rather than the converse?
For example, what is a new user supposed to do if he inadvertantly stumbles across the answer to a three-year old (and as-of-yet unanswered) question, and just wants to post the answer for public benefit? Such a user would first have to come up with an irrelevant but not entirely dumb question in order to gain enough rep rank to post the answer to the *original* question that brought them to this site in the first place. This in turn generates the exact same 'spam' S.O. was trying to avoid in the first place! | spam | null | null | null | null | 11/15/2011 11:46:56 | off topic | Is there a more effective method to avoiding spam on StackOverflow and similar websites?
===
StackOverflow offers a unique way of preventing spam by requiring new users to amass 15 'reputation points' before they can post answers to questions. This prevents spam and garbage answers, but in turn promotes spam and garbage *questions*. Since the egg comes before the chicken and since we water plants from their roots and not their leaves, wouldn't it make more sense to allow new users to post answers and disallow them from posting questions rather than the converse?
For example, what is a new user supposed to do if he inadvertantly stumbles across the answer to a three-year old (and as-of-yet unanswered) question, and just wants to post the answer for public benefit? Such a user would first have to come up with an irrelevant but not entirely dumb question in order to gain enough rep rank to post the answer to the *original* question that brought them to this site in the first place. This in turn generates the exact same 'spam' S.O. was trying to avoid in the first place! | 2 |
5,589,476 | 04/08/2011 01:28:28 | 330,644 | 05/02/2010 02:13:24 | 10,915 | 583 | What is a state tracker? | What is a state tracker? I see this term a lot relating to the development of components for Gallium3D. | opengl | null | null | null | null | null | open | What is a state tracker?
===
What is a state tracker? I see this term a lot relating to the development of components for Gallium3D. | 0 |
9,921,575 | 03/29/2012 08:18:27 | 1,300,202 | 03/29/2012 08:06:13 | 1 | 0 | My CSS does not work in IE urgen need please | i position a div to be on top of another, it work good in other web browsers but ie, can any one help me? my site is http://www.newenergywave.vn/index.php?option=com_content&view=frontpage&Itemid=151
thanks in advanced | internet-explorer | null | null | null | null | 04/01/2012 03:59:54 | too localized | My CSS does not work in IE urgen need please
===
i position a div to be on top of another, it work good in other web browsers but ie, can any one help me? my site is http://www.newenergywave.vn/index.php?option=com_content&view=frontpage&Itemid=151
thanks in advanced | 3 |
7,531,706 | 09/23/2011 15:56:48 | 459,234 | 09/27/2010 07:38:25 | 59 | 0 | move a small circle around a big circle | this i an interview question i encountered with HULU.
>Given two circles, one has radius 1 and the other has radius 2. Let the small one rotate along the perimeter of the big one. how many circles will the small one rotates when it has moves one round inside the big one? and what about outside? | math | interview-questions | null | null | null | 09/23/2011 16:06:26 | off topic | move a small circle around a big circle
===
this i an interview question i encountered with HULU.
>Given two circles, one has radius 1 and the other has radius 2. Let the small one rotate along the perimeter of the big one. how many circles will the small one rotates when it has moves one round inside the big one? and what about outside? | 2 |
3,921,234 | 10/13/2010 06:21:30 | 473,187 | 10/12/2010 10:11:25 | 6 | 0 | my attachment file not working | $fileatt= $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
if (is_uploaded_file($fileatt))
{
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
}
| php | email | attachment | null | null | 10/13/2010 11:18:06 | not a real question | my attachment file not working
===
$fileatt= $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
if (is_uploaded_file($fileatt))
{
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
}
| 1 |
34,325 | 08/29/2008 10:17:08 | 1,034 | 08/11/2008 16:29:38 | 1 | 4 | Should I use a cross-platform GUI-toolkit or rely on the native ones? | On my side job as programmer, I am to write a program in C++ to convert audio files from/to various formats. Probably, this will involve building a simple GUI.
Will it be a great effort to build seperate GUIs for Mac and Windows using Cocoa and WinForms instead of a cross-platform toolkit like Qt or GTK? (I will have to maintain a seperate Windows-version and Mac-Version anyway)
The GUI will probably be very simple and only need very basic functionality.
I always felt that native GUIs feel far more intuitive than its cross-platform brethren... | c++ | gui | mac | windows | crossplatform | null | open | Should I use a cross-platform GUI-toolkit or rely on the native ones?
===
On my side job as programmer, I am to write a program in C++ to convert audio files from/to various formats. Probably, this will involve building a simple GUI.
Will it be a great effort to build seperate GUIs for Mac and Windows using Cocoa and WinForms instead of a cross-platform toolkit like Qt or GTK? (I will have to maintain a seperate Windows-version and Mac-Version anyway)
The GUI will probably be very simple and only need very basic functionality.
I always felt that native GUIs feel far more intuitive than its cross-platform brethren... | 0 |
6,268,075 | 06/07/2011 15:56:03 | 747,396 | 05/10/2011 18:37:31 | 6 | 2 | Rails [3.1.0.rc1] webrick freeze on http 500 error | since I installed rails 3.1.0, when some bugs occur, Webrick freezes for a couple of minutes when some bugs occur (not all bugs, apparently the 500 ones).
My gemfile looks like this:
source 'http://rubygems.org'
gem "rails", "3.1.0.rc1"
#Asset template engines
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
gem "simple-navigation"
gem 'ranked-model' #, :git => '[email protected]:harvesthq/ranked-model.git'
gem 'formtastic'
gem 'validation_reflection'
gem "paperclip", "~> 2.3"
gem 'devise'
gem 'heroku'
gem "aws-s3"
gem "scoped_search"
gem "meta_search", :git => 'git://github.com/ernie/meta_search.git'
gem "kaminari"
group :production do
gem "pg", "~> 0.11.0"
gem 'therubyracer-heroku', '0.8.1.pre3'
gem 'exception_notification', :require => 'exception_notifier'
end
group :development, :test do
gem 'mysql2'
end
require 'csv'
I'm on Mac OS X 10.6.7.
Can anyone help me on this? Thanks,
Nicolas
| ruby-on-rails | freeze | webrick | null | null | null | open | Rails [3.1.0.rc1] webrick freeze on http 500 error
===
since I installed rails 3.1.0, when some bugs occur, Webrick freezes for a couple of minutes when some bugs occur (not all bugs, apparently the 500 ones).
My gemfile looks like this:
source 'http://rubygems.org'
gem "rails", "3.1.0.rc1"
#Asset template engines
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
gem "simple-navigation"
gem 'ranked-model' #, :git => '[email protected]:harvesthq/ranked-model.git'
gem 'formtastic'
gem 'validation_reflection'
gem "paperclip", "~> 2.3"
gem 'devise'
gem 'heroku'
gem "aws-s3"
gem "scoped_search"
gem "meta_search", :git => 'git://github.com/ernie/meta_search.git'
gem "kaminari"
group :production do
gem "pg", "~> 0.11.0"
gem 'therubyracer-heroku', '0.8.1.pre3'
gem 'exception_notification', :require => 'exception_notifier'
end
group :development, :test do
gem 'mysql2'
end
require 'csv'
I'm on Mac OS X 10.6.7.
Can anyone help me on this? Thanks,
Nicolas
| 0 |
4,537,900 | 12/27/2010 10:00:04 | 438,624 | 09/03/2010 04:57:03 | 645 | 45 | How to restrict date range of a jquery datepicker by giving two dates? | I am having two dates that is stored in db and am selecting it using $.ajax() and what i need is to show the datepicker values between the dates I selected from db.
Here is my code for it.But it is not working properly
function setDatePickerSettings(isFisc) {
var fSDate, fEDate;
$.ajax({
type: "POST",
url: '../Asset/Handlers/AjaxGetData.ashx?fisc=1',
success: function(data) {
alert(data);
var res = data.split("--");//data will be 4/4/2010 12:00:00--5/4/2011 12:00:00
var sDate = res[0].split(getSeparator(res[0]));
alert("Separator " + getSeparator(res[1]) + " Starts " + sDate);
var eDate = res[1].split(getSeparator(res[1]));
alert("End " + eDate);
alert("sub " + sDate[0]);
fSDate = new Date(sDate[2].substring(0, 4), sDate[0], sDate[1]);
alert("Starts " + fSDate.substring(0, 4));
fEDate = new Date(eDate[2].substring(0, 4), eDate[0], eDate[1]);
alert("eND " + fEDate.toString());
}
});
var dtSettings = {
changeMonth: true,
changeYear: true,
showOn: 'both',
buttonImage: clientURL + 'images/calendar.png',
buttonImageOnly: true,
showStatus: true,
showOtherMonths: false,
dateFormat: 'dd/mm/yy',
minDate:fSDate, //assigning startdate
maxDate:fEDate //assigning enddate
};
return dtSettings;
}
Pls provide some solution. I need the datetime picker which requires values between that range. Thanks in advance
| jquery | jquery-ui | jquery-datepicker | null | null | null | open | How to restrict date range of a jquery datepicker by giving two dates?
===
I am having two dates that is stored in db and am selecting it using $.ajax() and what i need is to show the datepicker values between the dates I selected from db.
Here is my code for it.But it is not working properly
function setDatePickerSettings(isFisc) {
var fSDate, fEDate;
$.ajax({
type: "POST",
url: '../Asset/Handlers/AjaxGetData.ashx?fisc=1',
success: function(data) {
alert(data);
var res = data.split("--");//data will be 4/4/2010 12:00:00--5/4/2011 12:00:00
var sDate = res[0].split(getSeparator(res[0]));
alert("Separator " + getSeparator(res[1]) + " Starts " + sDate);
var eDate = res[1].split(getSeparator(res[1]));
alert("End " + eDate);
alert("sub " + sDate[0]);
fSDate = new Date(sDate[2].substring(0, 4), sDate[0], sDate[1]);
alert("Starts " + fSDate.substring(0, 4));
fEDate = new Date(eDate[2].substring(0, 4), eDate[0], eDate[1]);
alert("eND " + fEDate.toString());
}
});
var dtSettings = {
changeMonth: true,
changeYear: true,
showOn: 'both',
buttonImage: clientURL + 'images/calendar.png',
buttonImageOnly: true,
showStatus: true,
showOtherMonths: false,
dateFormat: 'dd/mm/yy',
minDate:fSDate, //assigning startdate
maxDate:fEDate //assigning enddate
};
return dtSettings;
}
Pls provide some solution. I need the datetime picker which requires values between that range. Thanks in advance
| 0 |
658,576 | 03/18/2009 14:45:41 | 65,936 | 02/13/2009 07:10:58 | 11 | 0 | Setting document library permissions in WSS 2.0 | I am using WSS2.0. Am trying to set some permissions to a document library but not getting the desired behavior. I have created a sharepoint user and assigned it to 'Reader' group. I just want this user to view document library content but not make any changes like check out or upload new document or delete etc. Hence I assign the Reader group. But when I login to the site as this user I am able to delete documents and perform other changes. I checked the document library permissions and it contains Reader, Contributor, Administrator groups and also the permissions are not inherited from the parent.
Is there any other settings I need to check. Have I missed or misunderstood anything?
Please advise.
Thanks,
Jagannath | sharepoint | wss | null | null | null | null | open | Setting document library permissions in WSS 2.0
===
I am using WSS2.0. Am trying to set some permissions to a document library but not getting the desired behavior. I have created a sharepoint user and assigned it to 'Reader' group. I just want this user to view document library content but not make any changes like check out or upload new document or delete etc. Hence I assign the Reader group. But when I login to the site as this user I am able to delete documents and perform other changes. I checked the document library permissions and it contains Reader, Contributor, Administrator groups and also the permissions are not inherited from the parent.
Is there any other settings I need to check. Have I missed or misunderstood anything?
Please advise.
Thanks,
Jagannath | 0 |
5,305,523 | 03/14/2011 22:43:54 | 606,860 | 02/07/2011 17:43:38 | 64 | 2 | How to use black translucent status bar upon startup - info.plist key/value doesn't seem to work | I have no problem setting the status bar of my app in the app delegate didFinishLaunchingWithOptions: messsage.
However, the problem is, when my app is launched, the splash screen (default.png) is displayed with the standard colored status bar (some type of silver color). Then, once my app loads, it is changed to black translucent.
So... after doing a bit of research, I was told to add the following key/value to my info.plist file:
"UIStatusBarStyle" as the key
"UIStatusBarStyleBlackTranslucent" as the value
I've done that, rebuilt, etc. However, I don't see anything different. I still get the default status bar when the splash screen is displayed. Same result with simulator as well as device.
Any suggestions? | iphone | sdk | style | status | bar | null | open | How to use black translucent status bar upon startup - info.plist key/value doesn't seem to work
===
I have no problem setting the status bar of my app in the app delegate didFinishLaunchingWithOptions: messsage.
However, the problem is, when my app is launched, the splash screen (default.png) is displayed with the standard colored status bar (some type of silver color). Then, once my app loads, it is changed to black translucent.
So... after doing a bit of research, I was told to add the following key/value to my info.plist file:
"UIStatusBarStyle" as the key
"UIStatusBarStyleBlackTranslucent" as the value
I've done that, rebuilt, etc. However, I don't see anything different. I still get the default status bar when the splash screen is displayed. Same result with simulator as well as device.
Any suggestions? | 0 |
11,221,667 | 06/27/2012 07:51:46 | 1,483,308 | 06/26/2012 15:52:10 | 1 | 0 | Browsermob proxy | I am trying to setup Browsermob proxy but when I try to create a new proxy through the command :
curl -X POST http://<localhost>:9090/proxy
it throws open an html document which says "The requested URL could not be retrieved"
Any help?? | proxy | null | null | null | null | 06/28/2012 13:58:29 | off topic | Browsermob proxy
===
I am trying to setup Browsermob proxy but when I try to create a new proxy through the command :
curl -X POST http://<localhost>:9090/proxy
it throws open an html document which says "The requested URL could not be retrieved"
Any help?? | 2 |
8,116,516 | 11/14/2011 02:00:03 | 1,044,457 | 11/13/2011 18:29:47 | 1 | 0 | snap image to specific point on select? | basically what i want to do, is to select an image (thumbnail, from a drop down list, whatever - that part's unimportant), and have predefined points on that image, that instantly snap it in place to a certain point on another image.
<br>
something like: <br>
object a ---> snap target a<br>
object b ---> snap target b
<br>
(so "object a" would automatically snap to "snap target a", when "object a" is clicked).
i'm assuming this would be fairly complex, so even a point in the right direction (would this involve image mapping? svg? jquery draggable grid stuff?) would be appreciated.
and yes, i am aware that i really have no idea what i'm talking about O_O | svg | grid | mapping | points | snapping | 11/22/2011 03:13:16 | not a real question | snap image to specific point on select?
===
basically what i want to do, is to select an image (thumbnail, from a drop down list, whatever - that part's unimportant), and have predefined points on that image, that instantly snap it in place to a certain point on another image.
<br>
something like: <br>
object a ---> snap target a<br>
object b ---> snap target b
<br>
(so "object a" would automatically snap to "snap target a", when "object a" is clicked).
i'm assuming this would be fairly complex, so even a point in the right direction (would this involve image mapping? svg? jquery draggable grid stuff?) would be appreciated.
and yes, i am aware that i really have no idea what i'm talking about O_O | 1 |
6,635,034 | 07/09/2011 13:30:56 | 685,847 | 03/31/2011 13:46:13 | 1 | 0 | Read chat histroy from openfire server with smack. | How can we fetch chat log or chat histroy from Openfire server using smack library into android application? | android | openfire | smack | null | null | null | open | Read chat histroy from openfire server with smack.
===
How can we fetch chat log or chat histroy from Openfire server using smack library into android application? | 0 |
11,506,822 | 07/16/2012 14:50:09 | 1,528,523 | 07/16/2012 10:00:47 | 1 | 0 | How to capture standard output from COM object command in PHP script in Win XP environment: Commands shutdown versus Rscript | I am not getting any output (expecting R script version info ) in code snippet below
//$runCommand = "C:\\WINDOWS\\system32\\shutdown.exe -t:30";
$runCommand = "G:\\Progra~1\\R\\R-2.14.0\\bin\\Rscript.exe --version -e 1+1";
$WshShell = new COM("WScript.Shell");
$output = $WshShell->Exec($runCommand)->StdOut->ReadAll;
echo "<p>$output</p>";
and getting proper output (explaining usage options of shutdown command) in code snippet below
$runCommand = "C:\\WINDOWS\\system32\\shutdown.exe -t:30";
//$runCommand = "G:\\Progra~1\\R\\R-2.14.0\\bin\\Rscript.exe --version -e 1+1";
$WshShell = new COM("WScript.Shell");
$output = $WshShell->Exec($runCommand)->StdOut->ReadAll;
echo "<p>$output</p>";
Can anyone explain why this is happening? The objective is to capture the version of R script in the php program. The code snippets of command shutdown is to test whether the COM object is working correctly.
The COM object is working correctly in case of native command "shutdown" but not in case of installed program R. Can someone guide how to capture the details of the R version
pro-grammatically from within php script by tweaking above code?!
Thanking you!
| php | windows | r | com | stdout | null | open | How to capture standard output from COM object command in PHP script in Win XP environment: Commands shutdown versus Rscript
===
I am not getting any output (expecting R script version info ) in code snippet below
//$runCommand = "C:\\WINDOWS\\system32\\shutdown.exe -t:30";
$runCommand = "G:\\Progra~1\\R\\R-2.14.0\\bin\\Rscript.exe --version -e 1+1";
$WshShell = new COM("WScript.Shell");
$output = $WshShell->Exec($runCommand)->StdOut->ReadAll;
echo "<p>$output</p>";
and getting proper output (explaining usage options of shutdown command) in code snippet below
$runCommand = "C:\\WINDOWS\\system32\\shutdown.exe -t:30";
//$runCommand = "G:\\Progra~1\\R\\R-2.14.0\\bin\\Rscript.exe --version -e 1+1";
$WshShell = new COM("WScript.Shell");
$output = $WshShell->Exec($runCommand)->StdOut->ReadAll;
echo "<p>$output</p>";
Can anyone explain why this is happening? The objective is to capture the version of R script in the php program. The code snippets of command shutdown is to test whether the COM object is working correctly.
The COM object is working correctly in case of native command "shutdown" but not in case of installed program R. Can someone guide how to capture the details of the R version
pro-grammatically from within php script by tweaking above code?!
Thanking you!
| 0 |
9,317,428 | 02/16/2012 19:03:22 | 906,592 | 08/22/2011 20:13:19 | 451 | 2 | Mixed model with lme4. Is the effect significant? | I use lme4 in R to fit the mixed model
lmer(value~status+(1|experiment)))
where value is continuous, status and experiment are factors, and I get
Linear mixed model fit by REML
Formula: value ~ status + (1 | experiment)
AIC BIC logLik deviance REMLdev
29.1 46.98 -9.548 5.911 19.1
Random effects:
Groups Name Variance Std.Dev.
experiment (Intercept) 0.065526 0.25598
Residual 0.053029 0.23028
Number of obs: 264, groups: experiment, 10
Fixed effects:
Estimate Std. Error t value
(Intercept) 2.78004 0.08448 32.91
statusD 0.20493 0.03389 6.05
statusR 0.88690 0.03583 24.76
Correlation of Fixed Effects:
(Intr) statsD
statusD -0.204
statusR -0.193 0.476
How can I know that the effect of status is significant? R reports only t-values and not p-values
Thanks a lot | r | null | null | null | null | 02/16/2012 21:27:20 | off topic | Mixed model with lme4. Is the effect significant?
===
I use lme4 in R to fit the mixed model
lmer(value~status+(1|experiment)))
where value is continuous, status and experiment are factors, and I get
Linear mixed model fit by REML
Formula: value ~ status + (1 | experiment)
AIC BIC logLik deviance REMLdev
29.1 46.98 -9.548 5.911 19.1
Random effects:
Groups Name Variance Std.Dev.
experiment (Intercept) 0.065526 0.25598
Residual 0.053029 0.23028
Number of obs: 264, groups: experiment, 10
Fixed effects:
Estimate Std. Error t value
(Intercept) 2.78004 0.08448 32.91
statusD 0.20493 0.03389 6.05
statusR 0.88690 0.03583 24.76
Correlation of Fixed Effects:
(Intr) statsD
statusD -0.204
statusR -0.193 0.476
How can I know that the effect of status is significant? R reports only t-values and not p-values
Thanks a lot | 2 |
6,662,277 | 07/12/2011 09:48:37 | 716,334 | 04/20/2011 02:47:28 | 61 | 0 | Recommended books on programming paradigm? | I have done programming for around 4-5 years now. However, I still lacks the ability to make a clear and effective design. My designs always fall apart as things get complicated. Mostly what happened is the design starts with purely OOP approach; however, it starts to fall apart and become ambiguous as more codes are added in. This made me feel sort of lacking in design ability. Therefore, I went and found some wiki sites on Programming Paradigm. It was really surprising, because I only have heard of OOP and procedural but never knew of the other ones (functional programming etc.). I was interested in being open-minded to other type of designs so that I could polish my design skills.
So, Are there any recommended books that talk about programming paradigm? | books | paradigms | null | null | null | 07/13/2011 03:37:47 | not constructive | Recommended books on programming paradigm?
===
I have done programming for around 4-5 years now. However, I still lacks the ability to make a clear and effective design. My designs always fall apart as things get complicated. Mostly what happened is the design starts with purely OOP approach; however, it starts to fall apart and become ambiguous as more codes are added in. This made me feel sort of lacking in design ability. Therefore, I went and found some wiki sites on Programming Paradigm. It was really surprising, because I only have heard of OOP and procedural but never knew of the other ones (functional programming etc.). I was interested in being open-minded to other type of designs so that I could polish my design skills.
So, Are there any recommended books that talk about programming paradigm? | 4 |
8,646,720 | 12/27/2011 16:12:26 | 209,706 | 11/12/2009 15:30:53 | 2,142 | 96 | Git: how to change the commit message of the HEAD commit without touching the index/working tree | I know that I can use `git commit --amend --file=path-to-my-new-message` but this will amend staged changes, too. Of course, I could stash and later apply&drop the stash, but is there a quicker solution to change the HEAD commit message **without** committing the staged changes? | git | commit | commit-message | null | null | null | open | Git: how to change the commit message of the HEAD commit without touching the index/working tree
===
I know that I can use `git commit --amend --file=path-to-my-new-message` but this will amend staged changes, too. Of course, I could stash and later apply&drop the stash, but is there a quicker solution to change the HEAD commit message **without** committing the staged changes? | 0 |
5,101,563 | 02/24/2011 07:18:25 | 98,437 | 04/30/2009 10:13:22 | 46 | 1 | Is it possibile to create a custom keyboard for my app? | In android, is it possible to create a keyboard only for my application (no need for the other applications to use it)?
I found this project http://code.google.com/p/android-misc-widgets/, which creates from scratch a virtual keyboard as a view, but I wonder if this is the only way...
Thanks in advance
Enrico | android | keyboard | null | null | null | null | open | Is it possibile to create a custom keyboard for my app?
===
In android, is it possible to create a keyboard only for my application (no need for the other applications to use it)?
I found this project http://code.google.com/p/android-misc-widgets/, which creates from scratch a virtual keyboard as a view, but I wonder if this is the only way...
Thanks in advance
Enrico | 0 |
6,475 | 08/08/2008 23:46:31 | 527 | 08/06/2008 14:44:09 | 87 | 19 | Faster way to find duplicates conditioned by time | In a machine with AIX without <pre>PERL</pre> I need to filter records that will be considered duplicated if they have the same id and if they were registered between a period of four hours.
I implemented this filter using <pre>AWK</pre> and work pretty well but I need a solution much faster:
<pre>
# Generar lista de Duplicados
awk 'BEGIN {
FS=","
}
/OK/ {
old[$8] = f[$8];
f[$8] = mktime($4, $3, $2, $5, $6, $7);
x[$8]++;
}
/OK/ && x[$8]>1 && f[$8]-old[$8] < 14400 {
print $0;
}
function mktime (y,m,d,hh,mm,ss) {
return ss + (mm*60) + (hh*3600) + (d*86400) + (m*2592000) + (y*31536000);
}
' the.big.file.txt
</pre>
Any suggestions? Are there ways to improve the environment (preloading the file or someting like that)?
The input file is already sorted. | aix | unix | awk | perl | performance | null | open | Faster way to find duplicates conditioned by time
===
In a machine with AIX without <pre>PERL</pre> I need to filter records that will be considered duplicated if they have the same id and if they were registered between a period of four hours.
I implemented this filter using <pre>AWK</pre> and work pretty well but I need a solution much faster:
<pre>
# Generar lista de Duplicados
awk 'BEGIN {
FS=","
}
/OK/ {
old[$8] = f[$8];
f[$8] = mktime($4, $3, $2, $5, $6, $7);
x[$8]++;
}
/OK/ && x[$8]>1 && f[$8]-old[$8] < 14400 {
print $0;
}
function mktime (y,m,d,hh,mm,ss) {
return ss + (mm*60) + (hh*3600) + (d*86400) + (m*2592000) + (y*31536000);
}
' the.big.file.txt
</pre>
Any suggestions? Are there ways to improve the environment (preloading the file or someting like that)?
The input file is already sorted. | 0 |
8,609,981 | 12/22/2011 21:35:05 | 598,741 | 02/01/2011 16:39:55 | 62 | 0 | Cant understand why table is with double border. | I have a page: http://f1u.org/competitions
There are 3 tables. I can't understand why they all are with double border.
Please help me to understand. | html | css | joomla | null | null | 12/22/2011 21:39:36 | too localized | Cant understand why table is with double border.
===
I have a page: http://f1u.org/competitions
There are 3 tables. I can't understand why they all are with double border.
Please help me to understand. | 3 |
11,195,990 | 06/25/2012 19:26:06 | 1,480,891 | 06/25/2012 19:23:16 | 1 | 0 | i want to show php values in href tag using echo statement | <?php if($approve == 0)
{ echo '<a href="?p=reject_data&approve=reject_image&mem_id=$mem_id&img_id=$img_id">Pending</a>';?>
<?php }else if($approve == 2)
{ echo '<a href="?p=reject_data&approve=reject_image&mem_id=$mem_id&img_id=$img_id">Rejected</a>';}?>
</div>
it is returning the same $img_id and $mem_id in browser. everything is fine but it is not working. please help. reply me soon.. thanks in regards.. | php | null | null | null | null | 06/26/2012 01:26:55 | not a real question | i want to show php values in href tag using echo statement
===
<?php if($approve == 0)
{ echo '<a href="?p=reject_data&approve=reject_image&mem_id=$mem_id&img_id=$img_id">Pending</a>';?>
<?php }else if($approve == 2)
{ echo '<a href="?p=reject_data&approve=reject_image&mem_id=$mem_id&img_id=$img_id">Rejected</a>';}?>
</div>
it is returning the same $img_id and $mem_id in browser. everything is fine but it is not working. please help. reply me soon.. thanks in regards.. | 1 |
2,531,406 | 03/28/2010 00:03:40 | 301,626 | 03/25/2010 11:15:54 | 1 | 0 | HeaderedContentControl ItemsSource | Why there is no HeaderedContentControl ItemsSource property ?
How then can i databing to a list of objects to be represented by HeaderedContentControl...
Thanks
John | wpf-controls | wpf | null | null | null | null | open | HeaderedContentControl ItemsSource
===
Why there is no HeaderedContentControl ItemsSource property ?
How then can i databing to a list of objects to be represented by HeaderedContentControl...
Thanks
John | 0 |
9,659,276 | 03/11/2012 21:57:32 | 1,204,054 | 02/11/2012 17:20:13 | 48 | 0 | App development in C. | I have a silly question. So, i'm currenly learning to program in C and I'd like to know if it is possible to create Iphone applications in C language. I searched the web and got an impression that all Iphone applications are written in Objective-C, is this really the case?
Thank you very much for your help. | iphone | c | null | null | null | 03/11/2012 23:17:08 | not a real question | App development in C.
===
I have a silly question. So, i'm currenly learning to program in C and I'd like to know if it is possible to create Iphone applications in C language. I searched the web and got an impression that all Iphone applications are written in Objective-C, is this really the case?
Thank you very much for your help. | 1 |
7,280,332 | 09/02/2011 07:24:18 | 665,440 | 03/17/2011 08:39:34 | 158 | 1 | Unicode in C# ASP.NET | I need to generate report and insert page in my application in Devenagari script using unicode. But I am little bit confused in the given context. So, How to Integrate the Unicode in asp.net. Any solution is highly appreciate | unicode | null | null | null | null | 09/02/2011 20:23:47 | not a real question | Unicode in C# ASP.NET
===
I need to generate report and insert page in my application in Devenagari script using unicode. But I am little bit confused in the given context. So, How to Integrate the Unicode in asp.net. Any solution is highly appreciate | 1 |
7,033,298 | 08/11/2011 21:47:13 | 700,195 | 04/09/2011 18:28:05 | 113 | 6 | boost::serialization function not returning | Ok so i've set up boost::serialization to work with objects whose constructor and destructors are private (forcing you to make them through "factories"), but after doing the coming steps, the << operator of a boost::oarchive never returns.
I've followed what was happening exactly in a debugger, but don't know what's happening **after the ending brackets of the object's serialization function. It's not even reaching the overloaded destroy function.** I think it's some internal business, maybe an infinite loop.
- To do this i've overided the `load/save_construct_data function` and
the `access::destroy template function` with the appropriate
parameters.
- I also defined a serialization function for each factory-built
object, but it doesn't do anything as to force you to pass a pointer
instead.
- You'll also notice i've added my own Save() function as so the user
can specify a different factory to use for recreating (loading) the
object back up if needed.
**Why would this be happening and how do i fix it?**
here's the source:
oa << WallBody2; //this is the call in main, wallBody2 is a b2Body*
template<>
static void access::destroy( const b2Body * t) // const appropriate here?
{
// the const business is an MSVC 6.0 hack that should be
// benign on everything else
const_cast<b2Body*>(t)->GetWorld()->DestroyBody(const_cast<b2Body*>(t));
}
template<>
static void access::destroy( const b2Fixture * t) // const appropriate here?
{
// the const business is an MSVC 6.0 hack that should be
// benign on everything else
const_cast<b2Fixture*>(t)->GetBody()->DestroyFixture(const_cast<b2Fixture*>(t));
}
template<class Archive>
inline void save_construct_data( Archive & ar, const b2Body * t, const unsigned int file_version)
{
// save data required to construct instance
b2World* WorldPtr= const_cast<b2Body*>(t)->GetWorld();
ar & WorldPtr;
Save(ar, const_cast<b2Body*>(t), file_version);
}
template<class Archive>
inline void save_construct_data( Archive & ar, const b2Fixture * t, const unsigned int file_version)
{
// save data required to construct instance
b2Body* BodyPtr= const_cast<b2Fixture*>(t)->GetBody();
ar & BodyPtr;
Save(ar, const_cast<b2Fixture*>(t), file_version);
}
template<class Archive>
void serialize(Archive & ar, b2Fixture& b2, const unsigned int version)
{ std::cout << "b2Fixture is not serializable, only b2Fixture pointers are" << std::endl;};
template<class Archive>
void serialize(Archive & ar, b2Body& b2, const unsigned int version)
{ std::cout << "b2Fixture is not serializable, only b2Fixture pointers are" << std::endl;};
template<class Archive>
void Save(Archive & ar, b2Body* b2, const unsigned int version)
{
b2World* World = b2->GetWorld();
ar & World;
b2BodyDef InitialBodyDef;
InitialBodyDef.inertiaScale= b2->GetInertia(); // QUESTION: Is there any way to get/set this from a body (not def)
ar & InitialBodyDef; // QUESTION: wtf is inertiaScale? any relation to MassData?
b2BodyDef BodyDef;
BodyDef.angle= b2->GetAngle();
BodyDef.position= b2->GetPosition();
BodyDef.active= b2->IsActive();
BodyDef.angularDamping= b2->GetAngularDamping();
BodyDef.angularVelocity= b2->GetAngularVelocity();
BodyDef.awake= b2->IsAwake();
BodyDef.bullet= b2->IsBullet();
BodyDef.fixedRotation= b2->IsFixedRotation();
BodyDef.linearDamping= b2->GetLinearDamping();
BodyDef.linearVelocity= b2->GetLinearVelocity();
BodyDef.type= b2->GetType();
BodyDef.userData= b2->GetUserData();
ar & BodyDef;
// number of fixtures saved first so when loaded we know
// how many fixturedefs to extract
unsigned int numbFixtures=0;
for (b2Fixture* fixture = b2->GetFixtureList(); fixture; fixture = fixture->GetNext())
numbFixtures++;
ar & numbFixtures; //TODO: find out if boost will detect this as a list
for (b2Fixture* fixture = b2->GetFixtureList(); fixture; fixture = fixture->GetNext())
ar & fixture;
}
template<class Archive>
void Save(Archive & ar, b2Fixture* b2, const unsigned int version)
{
b2Body* Body = b2->GetBody();
ar & Body;
//Registered so boost can differentiate types of "shapes"
ar.register_type(static_cast<b2CircleShape *>(NULL));
ar.register_type(static_cast<b2PolygonShape *>(NULL));
b2Shape* Shape= b2->GetShape();
ar & Shape;
b2FixtureDef FixtureDef;
FixtureDef.density= b2->GetDensity();
FixtureDef.filter= b2->GetFilterData();
FixtureDef.friction= b2->GetFriction();
FixtureDef.isSensor= b2->IsSensor();
FixtureDef.restitution= b2->GetRestitution();
FixtureDef.userData= b2->GetUserData();
ar & FixtureDef;
}
If you can't locate the problem or aren't boost-savy please upvote =) i've been dealing with this for a week. | c++ | serialization | boost | infinite-loop | boost-serialization | null | open | boost::serialization function not returning
===
Ok so i've set up boost::serialization to work with objects whose constructor and destructors are private (forcing you to make them through "factories"), but after doing the coming steps, the << operator of a boost::oarchive never returns.
I've followed what was happening exactly in a debugger, but don't know what's happening **after the ending brackets of the object's serialization function. It's not even reaching the overloaded destroy function.** I think it's some internal business, maybe an infinite loop.
- To do this i've overided the `load/save_construct_data function` and
the `access::destroy template function` with the appropriate
parameters.
- I also defined a serialization function for each factory-built
object, but it doesn't do anything as to force you to pass a pointer
instead.
- You'll also notice i've added my own Save() function as so the user
can specify a different factory to use for recreating (loading) the
object back up if needed.
**Why would this be happening and how do i fix it?**
here's the source:
oa << WallBody2; //this is the call in main, wallBody2 is a b2Body*
template<>
static void access::destroy( const b2Body * t) // const appropriate here?
{
// the const business is an MSVC 6.0 hack that should be
// benign on everything else
const_cast<b2Body*>(t)->GetWorld()->DestroyBody(const_cast<b2Body*>(t));
}
template<>
static void access::destroy( const b2Fixture * t) // const appropriate here?
{
// the const business is an MSVC 6.0 hack that should be
// benign on everything else
const_cast<b2Fixture*>(t)->GetBody()->DestroyFixture(const_cast<b2Fixture*>(t));
}
template<class Archive>
inline void save_construct_data( Archive & ar, const b2Body * t, const unsigned int file_version)
{
// save data required to construct instance
b2World* WorldPtr= const_cast<b2Body*>(t)->GetWorld();
ar & WorldPtr;
Save(ar, const_cast<b2Body*>(t), file_version);
}
template<class Archive>
inline void save_construct_data( Archive & ar, const b2Fixture * t, const unsigned int file_version)
{
// save data required to construct instance
b2Body* BodyPtr= const_cast<b2Fixture*>(t)->GetBody();
ar & BodyPtr;
Save(ar, const_cast<b2Fixture*>(t), file_version);
}
template<class Archive>
void serialize(Archive & ar, b2Fixture& b2, const unsigned int version)
{ std::cout << "b2Fixture is not serializable, only b2Fixture pointers are" << std::endl;};
template<class Archive>
void serialize(Archive & ar, b2Body& b2, const unsigned int version)
{ std::cout << "b2Fixture is not serializable, only b2Fixture pointers are" << std::endl;};
template<class Archive>
void Save(Archive & ar, b2Body* b2, const unsigned int version)
{
b2World* World = b2->GetWorld();
ar & World;
b2BodyDef InitialBodyDef;
InitialBodyDef.inertiaScale= b2->GetInertia(); // QUESTION: Is there any way to get/set this from a body (not def)
ar & InitialBodyDef; // QUESTION: wtf is inertiaScale? any relation to MassData?
b2BodyDef BodyDef;
BodyDef.angle= b2->GetAngle();
BodyDef.position= b2->GetPosition();
BodyDef.active= b2->IsActive();
BodyDef.angularDamping= b2->GetAngularDamping();
BodyDef.angularVelocity= b2->GetAngularVelocity();
BodyDef.awake= b2->IsAwake();
BodyDef.bullet= b2->IsBullet();
BodyDef.fixedRotation= b2->IsFixedRotation();
BodyDef.linearDamping= b2->GetLinearDamping();
BodyDef.linearVelocity= b2->GetLinearVelocity();
BodyDef.type= b2->GetType();
BodyDef.userData= b2->GetUserData();
ar & BodyDef;
// number of fixtures saved first so when loaded we know
// how many fixturedefs to extract
unsigned int numbFixtures=0;
for (b2Fixture* fixture = b2->GetFixtureList(); fixture; fixture = fixture->GetNext())
numbFixtures++;
ar & numbFixtures; //TODO: find out if boost will detect this as a list
for (b2Fixture* fixture = b2->GetFixtureList(); fixture; fixture = fixture->GetNext())
ar & fixture;
}
template<class Archive>
void Save(Archive & ar, b2Fixture* b2, const unsigned int version)
{
b2Body* Body = b2->GetBody();
ar & Body;
//Registered so boost can differentiate types of "shapes"
ar.register_type(static_cast<b2CircleShape *>(NULL));
ar.register_type(static_cast<b2PolygonShape *>(NULL));
b2Shape* Shape= b2->GetShape();
ar & Shape;
b2FixtureDef FixtureDef;
FixtureDef.density= b2->GetDensity();
FixtureDef.filter= b2->GetFilterData();
FixtureDef.friction= b2->GetFriction();
FixtureDef.isSensor= b2->IsSensor();
FixtureDef.restitution= b2->GetRestitution();
FixtureDef.userData= b2->GetUserData();
ar & FixtureDef;
}
If you can't locate the problem or aren't boost-savy please upvote =) i've been dealing with this for a week. | 0 |
2,762,363 | 05/04/2010 01:59:21 | 329,347 | 03/05/2009 07:23:12 | 21 | 0 | Page replace with RJS | I try to implement a vote feature in one of my rails projects. I use the following codes (in vote.rjs) to replace the page with a Partial template (_vote.rhtml). But when I click, the vote number can not be updated immediately. I have to refresh the page to see the change.
#vote.rjs
page.replace("votes#{@foundphoto.id}", :partial=>"vote", :locals=>{:voteable=>@foundphoto})
The partial template is as follows:
#_vote.rhtml
<span id="votes<%= voteable.id %>">
<%= link_to_remote "+(#{voteable.votes_for})",
:update=>"vote",
:url => { :action=>"vote",
:id=>voteable.id,
:vote=>"for"} %>
/
<%= link_to_remote "-(#{voteable.votes_against})",
:update=>"vote",
:url => { :action=>"vote",
:id=>voteable.id,
:vote=>"against"} %>
</span>
any ideas? Thanks. | ruby-on-rails | rjs | ajax | null | null | null | open | Page replace with RJS
===
I try to implement a vote feature in one of my rails projects. I use the following codes (in vote.rjs) to replace the page with a Partial template (_vote.rhtml). But when I click, the vote number can not be updated immediately. I have to refresh the page to see the change.
#vote.rjs
page.replace("votes#{@foundphoto.id}", :partial=>"vote", :locals=>{:voteable=>@foundphoto})
The partial template is as follows:
#_vote.rhtml
<span id="votes<%= voteable.id %>">
<%= link_to_remote "+(#{voteable.votes_for})",
:update=>"vote",
:url => { :action=>"vote",
:id=>voteable.id,
:vote=>"for"} %>
/
<%= link_to_remote "-(#{voteable.votes_against})",
:update=>"vote",
:url => { :action=>"vote",
:id=>voteable.id,
:vote=>"against"} %>
</span>
any ideas? Thanks. | 0 |
414,702 | 01/05/2009 22:15:36 | 24,989 | 10/03/2008 20:53:50 | 21 | 0 | are there any public wikis that allow password protected contents? | I want to migrate a local wikis contents to a public site but I don't want to install a wiki. Are there any wikis that will let users create a password protected sub-content area? | wiki | null | null | null | null | 01/06/2009 02:44:41 | off topic | are there any public wikis that allow password protected contents?
===
I want to migrate a local wikis contents to a public site but I don't want to install a wiki. Are there any wikis that will let users create a password protected sub-content area? | 2 |
9,367,835 | 02/20/2012 20:17:47 | 1,221,937 | 02/20/2012 20:13:55 | 1 | 0 | Hashes: Whirlpool vs RIPEMD-160 vs SHA-512 | I want to use Truecrypt to encryt my whole system drive. I've settled on AES for encryption, but I don't know which hash algorithm to go for.
Which is faster, Whirlpool, RIPEMD-160 or SHA-512? Which would offer better security? | encryption | hash | partition | drive | truecrypt | 02/21/2012 20:25:22 | off topic | Hashes: Whirlpool vs RIPEMD-160 vs SHA-512
===
I want to use Truecrypt to encryt my whole system drive. I've settled on AES for encryption, but I don't know which hash algorithm to go for.
Which is faster, Whirlpool, RIPEMD-160 or SHA-512? Which would offer better security? | 2 |
4,094,941 | 11/04/2010 08:36:12 | 442,124 | 09/08/2010 06:42:35 | 16 | 1 | Prolog Question - How to generate sublists of a given length | I want to generate all the sublists of a given list with the given property that they have a certain length mentioned as argument and also they have as a containing element a given element which is passed as a parameter. I have managed to do this but with the help of two predicates, and in terms of optimality is very slow:
`sublist([], []).` <br>
`sublist([A|T], [A|L]):-`<br>
`sublist(T, L).` <BR>
`sublist(T, [_|L]):-`<Br>
`sublist(T, L).` <br> <BR>
`choose(T, L):-`<br>
`sublist(T, L),`<br>
`(dimension(2, T); dimension(1, T)),`<br>
`belongs(f, T).`
In here I would like to return through the `T` parameter of the `choose` predicate all the sublists of the L list which have the dimension 2 or 1 and which contains the `f` element. <br>The predicates `dimension` and `member` has the same usage as the predefined predicates `length`, respectively `member`.<br><br>Can you please tell me how to incorporate this two conditions within the `sublist` predicate so that the program builds only those particular sublists?
| prolog | null | null | null | null | null | open | Prolog Question - How to generate sublists of a given length
===
I want to generate all the sublists of a given list with the given property that they have a certain length mentioned as argument and also they have as a containing element a given element which is passed as a parameter. I have managed to do this but with the help of two predicates, and in terms of optimality is very slow:
`sublist([], []).` <br>
`sublist([A|T], [A|L]):-`<br>
`sublist(T, L).` <BR>
`sublist(T, [_|L]):-`<Br>
`sublist(T, L).` <br> <BR>
`choose(T, L):-`<br>
`sublist(T, L),`<br>
`(dimension(2, T); dimension(1, T)),`<br>
`belongs(f, T).`
In here I would like to return through the `T` parameter of the `choose` predicate all the sublists of the L list which have the dimension 2 or 1 and which contains the `f` element. <br>The predicates `dimension` and `member` has the same usage as the predefined predicates `length`, respectively `member`.<br><br>Can you please tell me how to incorporate this two conditions within the `sublist` predicate so that the program builds only those particular sublists?
| 0 |
9,737,880 | 03/16/2012 13:11:03 | 1,274,079 | 03/16/2012 13:05:13 | 1 | 0 | Hibernate one to many relation | I have 1 to Many releationship
@Entity
@Table(name = "job")
public class JobBean implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
private Long id;
@Column(name = "name")
protected String name;
@Column(name = "state")
protected String state;
.......
@Entity
@Table(name = "task")
public class TaskBean implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "tid", updatable = false, nullable = false)
protected Long tid;
@Column(name = "id")
protected Long id;
@Column(name = "state")
protected String state;
@Column(name = "progress")
protected int progress;
In Task the id is the forign key from Job.
I want to get all the jobs and its associated tasks. How does my hibernate util look like?
| hibernate | onetomany | null | null | null | null | open | Hibernate one to many relation
===
I have 1 to Many releationship
@Entity
@Table(name = "job")
public class JobBean implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
private Long id;
@Column(name = "name")
protected String name;
@Column(name = "state")
protected String state;
.......
@Entity
@Table(name = "task")
public class TaskBean implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "tid", updatable = false, nullable = false)
protected Long tid;
@Column(name = "id")
protected Long id;
@Column(name = "state")
protected String state;
@Column(name = "progress")
protected int progress;
In Task the id is the forign key from Job.
I want to get all the jobs and its associated tasks. How does my hibernate util look like?
| 0 |
2,521,297 | 03/26/2010 05:29:40 | 293,031 | 03/13/2010 16:23:51 | 76 | 2 | How can I dispose of an object (say a Bitmap) when it becomes orphaned ? | I have a class A providing Bitmaps to other classes B, C, etc.
Now class A holds its bitmaps in a ring queue so after a while it will lose reference to the bitmap.
While it's still in the queue, the same Bitmap can be checked out by several classes so that, say, B and C can both hold a reference to this same Bitmap. But it can also happen that only one of them checked out the Bitmap or even none of them.
I would like to dispose of the bitmap when it's not being needed any more by either A, B or C.
I suppose I have to make B and C responsible for somehow signaling when they're finished using it but I'm not sure about the overall logic.
Should it be a call to something like DisposeIfNowOrphan() that would be called :
1 - when the Bitmap gets kicked out of the queue in class A
2 - when B is finished with it
3 - when C is finished with it
If that's the best strategy, how can I evaluate the orphan state ?
Any advice would be most welcome. | dispose | shared-objects | c# | orphaned-objects | null | null | open | How can I dispose of an object (say a Bitmap) when it becomes orphaned ?
===
I have a class A providing Bitmaps to other classes B, C, etc.
Now class A holds its bitmaps in a ring queue so after a while it will lose reference to the bitmap.
While it's still in the queue, the same Bitmap can be checked out by several classes so that, say, B and C can both hold a reference to this same Bitmap. But it can also happen that only one of them checked out the Bitmap or even none of them.
I would like to dispose of the bitmap when it's not being needed any more by either A, B or C.
I suppose I have to make B and C responsible for somehow signaling when they're finished using it but I'm not sure about the overall logic.
Should it be a call to something like DisposeIfNowOrphan() that would be called :
1 - when the Bitmap gets kicked out of the queue in class A
2 - when B is finished with it
3 - when C is finished with it
If that's the best strategy, how can I evaluate the orphan state ?
Any advice would be most welcome. | 0 |
6,451,965 | 06/23/2011 09:29:36 | 803,062 | 06/17/2011 10:36:09 | 22 | 1 | How to make connectivity between sqlite3 file and iphone application? | i am working on a application which needs connectivity with database i had create database and import it successfully but i dont know how connect it with code can any help me? | iphone | objective-c | sqlite3 | null | null | 06/23/2011 15:55:43 | not a real question | How to make connectivity between sqlite3 file and iphone application?
===
i am working on a application which needs connectivity with database i had create database and import it successfully but i dont know how connect it with code can any help me? | 1 |
9,113,504 | 02/02/2012 13:53:06 | 1,042,555 | 11/11/2011 22:25:37 | 72 | 4 | Procedurally generating a building interior for a 2D platformer | I want to generate some levels for my platformer game which takes place inside an underwater base. Therefore, the levels should consist of several major "domes" linked together by narrow corridors, viewed from the side, navigated left to right.
While I have found some information for generating platformer levels in general, they tend to focus on "smoother" geometry- semi-random and somewhat chaotic hills, unaligned floating platforms and so on. Since I want my levels to resemble a building, I want long, coherently arranged platforms and preferably few "floating" platforms.
On the up side, tight control of difficulty is not an issue- my focus is not on physics/jumping so being navigable and not wholly illogical is enough for my levels.
I can think of some basic steps:
1. Generate a random number of rectangles with randomized dimensions, and arrange them on a rough line. Perhaps do this by making a short random walk biased to the right to place each rectangles.
2. Generate one building section inside each rectangle, complete with hallway doors.
3. Connect the hallway doors.
Generating individual buildings is a bit more mysterious. I can imagine picking a random shape, such as square or dome or trapezoid with slanted roof or slanted side wall, then picking a handful of random points inside, and drawing a platform to the left or right until you hit a wall. Afterwards, a top-down scan can do some pathfinding and draw ladders to make sure every level is accessible.
![A very rough drawing (purple shows doors to other buildings)][1]
[1]: http://i.stack.imgur.com/XXWxp.png
I am making my game in C#/XNA, although I am considering making the levelgen routines in Matlab.
My question is, does anyone have any advice on this? Are there resources (papers, tutorials, projects, level design guides for humans, anything) that deal with specifically this kind of generation, especially with the algorithm?
Also, how feasible would it be to write a genetic algorithm (possibly manually deciding which results go extinct) for this? | algorithm | procedural-generation | null | null | null | 02/06/2012 17:09:08 | not constructive | Procedurally generating a building interior for a 2D platformer
===
I want to generate some levels for my platformer game which takes place inside an underwater base. Therefore, the levels should consist of several major "domes" linked together by narrow corridors, viewed from the side, navigated left to right.
While I have found some information for generating platformer levels in general, they tend to focus on "smoother" geometry- semi-random and somewhat chaotic hills, unaligned floating platforms and so on. Since I want my levels to resemble a building, I want long, coherently arranged platforms and preferably few "floating" platforms.
On the up side, tight control of difficulty is not an issue- my focus is not on physics/jumping so being navigable and not wholly illogical is enough for my levels.
I can think of some basic steps:
1. Generate a random number of rectangles with randomized dimensions, and arrange them on a rough line. Perhaps do this by making a short random walk biased to the right to place each rectangles.
2. Generate one building section inside each rectangle, complete with hallway doors.
3. Connect the hallway doors.
Generating individual buildings is a bit more mysterious. I can imagine picking a random shape, such as square or dome or trapezoid with slanted roof or slanted side wall, then picking a handful of random points inside, and drawing a platform to the left or right until you hit a wall. Afterwards, a top-down scan can do some pathfinding and draw ladders to make sure every level is accessible.
![A very rough drawing (purple shows doors to other buildings)][1]
[1]: http://i.stack.imgur.com/XXWxp.png
I am making my game in C#/XNA, although I am considering making the levelgen routines in Matlab.
My question is, does anyone have any advice on this? Are there resources (papers, tutorials, projects, level design guides for humans, anything) that deal with specifically this kind of generation, especially with the algorithm?
Also, how feasible would it be to write a genetic algorithm (possibly manually deciding which results go extinct) for this? | 4 |
9,861,531 | 03/25/2012 15:51:51 | 1,124,197 | 12/31/2011 10:00:55 | 52 | 1 | django-paypal ipn not responding | i am using [this app][1] to implement paypal into my application. However when i make the payment and everything, django keeps on complaining that i don't have a csrf_token when i already inserted it into my template form.
This is my template:
<form method="post" action="/paypal/">
{% csrf_token %}
<p>
To change your subscription, select a membership and the subscription rate:
</p>
<select name="membership_input" id="id_membership">
<option>Silver</option>
<option>Gold</option>
<option>Platinum</option>
</select>
<select name="subscription_input" id="id_subscription" style = "float: center; margin-left: 30px;">
<option>Monthly</option>
<option>Quarterly</option>
<option>Yearly</option>
</select></br></br>
{{ form }}
</form>
And this is my view that handles the paypal elements:
def paypal(request):
c = RequestContext(request,{})
c.update(csrf(request))
if request.method == 'POST':
if 'membership_input' in request.POST:
if 'subscription_input' in request.POST:
membership = request.POST['membership_input']
subscription = request.POST['subscription_input']
if membership == "Gold":
if subscription == "Quarterly":
price = "2400.00"
if subscription == "Monthly":
price = "1000.00"
if subscription == "Yearly":
price = "8000.00"
elif membership == "Silver":
if subscription == "Quarterly":
price = "1200.00"
if subscription == "Monthly":
price = "500.00"
if subscription == "Yearly":
price = "4000.00"
elif membership == "Premium":
if subscription == "Quarterly":
price = "4800.00"
if subscription == "Monthly":
price = "2000.00"
if subscription == "Yearly":
price = "16000.00"
paypal_dict = {"business":settings.PAYPAL_RECEIVER_EMAIL,"amount": price ,"item_name": membership+" membership" ,"invoice": "09876543", "notify_url": "%s%s" % (settings.SITE_NAME, reverse('paypal-ipn')),"return_url": "http://rosebud.mosuma.net",}
# Create the instance.
form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form.sandbox()}
c = RequestContext(request,{"form": form.sandbox()})
return render_to_response("paypal.html", c)
else:
return HttpResponseRedirect("/")
I have already tried using requestContext as mentioned by django and inserted the csrf token but i don't know why it's not working.
Also if i were to enable recurring paypal subscriptions how do i do it?
Any help is appreciated.
[1]: https://github.com/johnboxall/django-paypal | django | django-paypal | null | null | null | null | open | django-paypal ipn not responding
===
i am using [this app][1] to implement paypal into my application. However when i make the payment and everything, django keeps on complaining that i don't have a csrf_token when i already inserted it into my template form.
This is my template:
<form method="post" action="/paypal/">
{% csrf_token %}
<p>
To change your subscription, select a membership and the subscription rate:
</p>
<select name="membership_input" id="id_membership">
<option>Silver</option>
<option>Gold</option>
<option>Platinum</option>
</select>
<select name="subscription_input" id="id_subscription" style = "float: center; margin-left: 30px;">
<option>Monthly</option>
<option>Quarterly</option>
<option>Yearly</option>
</select></br></br>
{{ form }}
</form>
And this is my view that handles the paypal elements:
def paypal(request):
c = RequestContext(request,{})
c.update(csrf(request))
if request.method == 'POST':
if 'membership_input' in request.POST:
if 'subscription_input' in request.POST:
membership = request.POST['membership_input']
subscription = request.POST['subscription_input']
if membership == "Gold":
if subscription == "Quarterly":
price = "2400.00"
if subscription == "Monthly":
price = "1000.00"
if subscription == "Yearly":
price = "8000.00"
elif membership == "Silver":
if subscription == "Quarterly":
price = "1200.00"
if subscription == "Monthly":
price = "500.00"
if subscription == "Yearly":
price = "4000.00"
elif membership == "Premium":
if subscription == "Quarterly":
price = "4800.00"
if subscription == "Monthly":
price = "2000.00"
if subscription == "Yearly":
price = "16000.00"
paypal_dict = {"business":settings.PAYPAL_RECEIVER_EMAIL,"amount": price ,"item_name": membership+" membership" ,"invoice": "09876543", "notify_url": "%s%s" % (settings.SITE_NAME, reverse('paypal-ipn')),"return_url": "http://rosebud.mosuma.net",}
# Create the instance.
form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form.sandbox()}
c = RequestContext(request,{"form": form.sandbox()})
return render_to_response("paypal.html", c)
else:
return HttpResponseRedirect("/")
I have already tried using requestContext as mentioned by django and inserted the csrf token but i don't know why it's not working.
Also if i were to enable recurring paypal subscriptions how do i do it?
Any help is appreciated.
[1]: https://github.com/johnboxall/django-paypal | 0 |
6,093,055 | 05/23/2011 05:07:17 | 126,597 | 06/21/2009 23:19:57 | 647 | 24 | Working out what application is changing an sql database value | I'm running into an issue where the legacy database that many applications read/write to keeps getting changed, and I can't work out what is changing it.
My application changes a certain value in a certain row of the table, but something keeps changing it back after a week or so and I'm stumped to work out what it could be.
Is there any way I can attach an event/trigger onto this value and then have it store/email the details of what changed it ? or at least what time it was changed? | sql | sql-server | triggers | null | null | null | open | Working out what application is changing an sql database value
===
I'm running into an issue where the legacy database that many applications read/write to keeps getting changed, and I can't work out what is changing it.
My application changes a certain value in a certain row of the table, but something keeps changing it back after a week or so and I'm stumped to work out what it could be.
Is there any way I can attach an event/trigger onto this value and then have it store/email the details of what changed it ? or at least what time it was changed? | 0 |
10,911,523 | 06/06/2012 09:29:04 | 1,369,541 | 05/02/2012 08:45:05 | 1 | 0 | Web page larger than body height? | This webpage being in beta, http://porkystuff.com, has a very big problem.
The webpage is larger than the BODY and the HTML tags. I've checked this with developer tools in both Chrome and Firefox.
I HAVE tried adding `html, body{ height:100%; }`. | css | height | webpage | null | null | null | open | Web page larger than body height?
===
This webpage being in beta, http://porkystuff.com, has a very big problem.
The webpage is larger than the BODY and the HTML tags. I've checked this with developer tools in both Chrome and Firefox.
I HAVE tried adding `html, body{ height:100%; }`. | 0 |
9,018,268 | 01/26/2012 12:43:43 | 1,120,820 | 12/29/2011 09:14:18 | 6 | 0 | Ubuntu and Linux Mint and what web development software to use | I'm a PHP web developer. I mostly use PHP editors, FTP, multiple web browsers, email (e.g: thunderbird), graphic software etc.
I would like to know which one is the better for **web development** amongst Ubuntu and Linux Mint.
Any feedback and opinions would be appreciated. Also please let me know if you recommend any particular editors and graphic tools like Photoshop.
Thanks. | ubuntu | mint | null | null | null | 01/27/2012 11:22:58 | off topic | Ubuntu and Linux Mint and what web development software to use
===
I'm a PHP web developer. I mostly use PHP editors, FTP, multiple web browsers, email (e.g: thunderbird), graphic software etc.
I would like to know which one is the better for **web development** amongst Ubuntu and Linux Mint.
Any feedback and opinions would be appreciated. Also please let me know if you recommend any particular editors and graphic tools like Photoshop.
Thanks. | 2 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.