PostId
int64 4
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 1
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -55
461k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
21.5k
| Title
stringlengths 3
250
| BodyMarkdown
stringlengths 5
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 32
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,351,151 | 07/05/2012 19:24:10 | 445,312 | 06/05/2009 00:11:55 | 2,635 | 116 | How can I cancel an Asychronous request in objective-c | Hi i am using two class files called URLConnection taken from here: https://github.com/0xSina/URLConnection
It’s not just a wrapper around NSURLConnection’s synchronous method using GCD
What you get:
- Speed that you get out of pure asynchronous implementation of
NSURLConnection.
- Upload progress
- Download progress
- Blocks, making everything simple and look clean!
- No need to import dozens of libraries and frameworks.
I have a URLConnection.h a URLConnection.m and customclass..
**Here's my question**
How can i cancel the running asynchronous connection by calling a method from the custom class?
I able to download any data i like by adjusting the myrequest etc along with the approriate url and then i have a seperate method to save the data. however i would like to add a button hooked up to a method which i know how to to do but then have that method be able to cancel the connection by perhaps calling a method in the URLConnection class.
atm i have tried to create a class method added into the URLConnection.m like such
+(void)cancel {
[connection cancel]
}
however this returns errors and seriously crashes the program. i want to be able to smoothly cancel a connection without any problems. and then from there i will display my existing hud and do something like
[SVProgressHUD showStringForCancel:@"Download cancelled"]; which ill figure out how to do. its just the problem of being able to create the right code and having a cancel method which i can call during a asynchronous call so i can therefor cancel it safely in case the need arises (when the user wants to cancel the current download).
Here is the three documents I'm working with
**the URLConnection.h fie**
//URLConnection.h
#import <Foundation/Foundation.h>
typedef void (^URLConnectionCompletionBlock) (NSData *data, NSURLResponse *response);
typedef void (^URLConnectioErrorBlock) (NSError *error);
typedef void (^URLConnectioUploadProgressBlock) (float progress);
typedef void (^URLConnectioDownloadProgressBlock) (float progress);
@interface URLConnection : NSObject
+ (void)asyncConnectionWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock
uploadPorgressBlock:(URLConnectioUploadProgressBlock)uploadBlock
downloadProgressBlock:(URLConnectioDownloadProgressBlock)downloadBlock;
+ (void)asyncConnectionWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock;
+ (void)asyncConnectionWithURLString:(NSString *)urlString
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock;
@end
**and the URLConnection.m file**
//URLConnection.m
#import "URLConnection.h"
@interface URLConnection () {
NSURLConnection *connection;
NSURLRequest *request;
NSMutableData *data;
NSURLResponse *response;
long long downloadSize;
URLConnectionCompletionBlock completionBlock;
URLConnectioErrorBlock errorBlock;
URLConnectioUploadProgressBlock uploadBlock;
URLConnectioDownloadProgressBlock downloadBlock;
}
- (id)initWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock
uploadPorgressBlock:(URLConnectioUploadProgressBlock)uploadBlock
downloadProgressBlock:(URLConnectioDownloadProgressBlock)downloadBlock;
- (void)start;
@end
@implementation URLConnection
+ (void)asyncConnectionWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock
uploadPorgressBlock:(URLConnectioUploadProgressBlock)uploadBlock
downloadProgressBlock:(URLConnectioDownloadProgressBlock)downloadBlock {
URLConnection *connection = [[URLConnection alloc] initWithRequest:request
completionBlock:completionBlock
errorBlock:errorBlock
uploadPorgressBlock:uploadBlock
downloadProgressBlock:downloadBlock];
[connection start];
[connection release];
}
+ (void)asyncConnectionWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock {
[URLConnection asyncConnectionWithRequest:request
completionBlock:completionBlock
errorBlock:errorBlock
uploadPorgressBlock:nil
downloadProgressBlock:nil];
}
+ (void)asyncConnectionWithURLString:(NSString *)urlString
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
[URLConnection asyncConnectionWithRequest:request
completionBlock:completionBlock
errorBlock:errorBlock];
}
- (id)initWithRequest:(NSURLRequest *)_request
completionBlock:(URLConnectionCompletionBlock)_completionBlock
errorBlock:(URLConnectioErrorBlock)_errorBlock
uploadPorgressBlock:(URLConnectioUploadProgressBlock)_uploadBlock
downloadProgressBlock:(URLConnectioDownloadProgressBlock)_downloadBlock {
self = [super init];
if (self) {
request = [_request retain];
completionBlock = [_completionBlock copy];
errorBlock = [_errorBlock copy];
uploadBlock = [_uploadBlock copy];
downloadBlock = [_downloadBlock copy];
}
return self;
}
- (void)dealloc {
[request release];
[data release];
[response release];
[completionBlock release];
[errorBlock release];
[uploadBlock release];
[downloadBlock release];
[super dealloc];
}
- (void)start {
connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
data = [[NSMutableData alloc] init];
[connection start];
}
#pragma mark NSURLConnectionDelegate
- (void)connectionDidFinishLoading:(NSURLConnection *)_connection {
if(completionBlock) completionBlock(data, response);
}
- (void)connection:(NSURLConnection *)_connection
didFailWithError:(NSError *)error {
if(errorBlock) errorBlock(error);
}
- (void)connection:(NSURLConnection *)connection
didReceiveResponse:(NSHTTPURLResponse *)_response {
response = [_response retain];
downloadSize = [response expectedContentLength];
}
- (void)connection:(NSURLConnection *)connection
didReceiveData:(NSData *)_data {
[data appendData:_data];
if (downloadSize != -1) {
float progress = (float)data.length / (float)downloadSize;
if(downloadBlock) downloadBlock(progress);
}
}
//THIS MOST LIKELY CAN SAVE DATA ON SERVER.
- (void)connection:(NSURLConnection *)connection
didSendBodyData:(NSInteger)bytesWritten
totalBytesWritten:(NSInteger)totalBytesWritten
totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
float progress= (float)totalBytesWritten/(float)totalBytesExpectedToWrite;
if (uploadBlock) uploadBlock(progress);
}
@end
**and here is how i call the URLConnection from my customclass:**
#import customclass.h
//....blah blah...
-(void)download{
//create request
//create url etc ready to feed the data for the below code
[URLConnection asyncConnectionWithRequest:myrequest
completionBlock:^(NSData *data, NSURLResponse *response) {
[SVProgressHUD dismissWithSuccess:@"Download Complete\nVideo in Photo Gallery"];
[videoContentData setData:data];
[self saveData];
NSLog(@"Download Complete\nVideo in Photo Gallery");
} errorBlock:^(NSError *error) {
[SVProgressHUD dismissWithError:@"Error!"];
} uploadPorgressBlock:^(float progress) {
//Upload progress (0..1)
} downloadProgressBlock:^(float progress) {
//Download progress (0.1)
//NSLog(@"progress: %f", progress);
[SVProgressHUD setProgress:progress];
}];
}
-(void)cancel{
// add something here but dont know what to be able to go into the URLConnection class and then cancel the connection inside there...
}
| objective-c | asynchronous | delegates | nsurlconnection | cancel | null | open | How can I cancel an Asychronous request in objective-c
===
Hi i am using two class files called URLConnection taken from here: https://github.com/0xSina/URLConnection
It’s not just a wrapper around NSURLConnection’s synchronous method using GCD
What you get:
- Speed that you get out of pure asynchronous implementation of
NSURLConnection.
- Upload progress
- Download progress
- Blocks, making everything simple and look clean!
- No need to import dozens of libraries and frameworks.
I have a URLConnection.h a URLConnection.m and customclass..
**Here's my question**
How can i cancel the running asynchronous connection by calling a method from the custom class?
I able to download any data i like by adjusting the myrequest etc along with the approriate url and then i have a seperate method to save the data. however i would like to add a button hooked up to a method which i know how to to do but then have that method be able to cancel the connection by perhaps calling a method in the URLConnection class.
atm i have tried to create a class method added into the URLConnection.m like such
+(void)cancel {
[connection cancel]
}
however this returns errors and seriously crashes the program. i want to be able to smoothly cancel a connection without any problems. and then from there i will display my existing hud and do something like
[SVProgressHUD showStringForCancel:@"Download cancelled"]; which ill figure out how to do. its just the problem of being able to create the right code and having a cancel method which i can call during a asynchronous call so i can therefor cancel it safely in case the need arises (when the user wants to cancel the current download).
Here is the three documents I'm working with
**the URLConnection.h fie**
//URLConnection.h
#import <Foundation/Foundation.h>
typedef void (^URLConnectionCompletionBlock) (NSData *data, NSURLResponse *response);
typedef void (^URLConnectioErrorBlock) (NSError *error);
typedef void (^URLConnectioUploadProgressBlock) (float progress);
typedef void (^URLConnectioDownloadProgressBlock) (float progress);
@interface URLConnection : NSObject
+ (void)asyncConnectionWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock
uploadPorgressBlock:(URLConnectioUploadProgressBlock)uploadBlock
downloadProgressBlock:(URLConnectioDownloadProgressBlock)downloadBlock;
+ (void)asyncConnectionWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock;
+ (void)asyncConnectionWithURLString:(NSString *)urlString
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock;
@end
**and the URLConnection.m file**
//URLConnection.m
#import "URLConnection.h"
@interface URLConnection () {
NSURLConnection *connection;
NSURLRequest *request;
NSMutableData *data;
NSURLResponse *response;
long long downloadSize;
URLConnectionCompletionBlock completionBlock;
URLConnectioErrorBlock errorBlock;
URLConnectioUploadProgressBlock uploadBlock;
URLConnectioDownloadProgressBlock downloadBlock;
}
- (id)initWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock
uploadPorgressBlock:(URLConnectioUploadProgressBlock)uploadBlock
downloadProgressBlock:(URLConnectioDownloadProgressBlock)downloadBlock;
- (void)start;
@end
@implementation URLConnection
+ (void)asyncConnectionWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock
uploadPorgressBlock:(URLConnectioUploadProgressBlock)uploadBlock
downloadProgressBlock:(URLConnectioDownloadProgressBlock)downloadBlock {
URLConnection *connection = [[URLConnection alloc] initWithRequest:request
completionBlock:completionBlock
errorBlock:errorBlock
uploadPorgressBlock:uploadBlock
downloadProgressBlock:downloadBlock];
[connection start];
[connection release];
}
+ (void)asyncConnectionWithRequest:(NSURLRequest *)request
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock {
[URLConnection asyncConnectionWithRequest:request
completionBlock:completionBlock
errorBlock:errorBlock
uploadPorgressBlock:nil
downloadProgressBlock:nil];
}
+ (void)asyncConnectionWithURLString:(NSString *)urlString
completionBlock:(URLConnectionCompletionBlock)completionBlock
errorBlock:(URLConnectioErrorBlock)errorBlock {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
[URLConnection asyncConnectionWithRequest:request
completionBlock:completionBlock
errorBlock:errorBlock];
}
- (id)initWithRequest:(NSURLRequest *)_request
completionBlock:(URLConnectionCompletionBlock)_completionBlock
errorBlock:(URLConnectioErrorBlock)_errorBlock
uploadPorgressBlock:(URLConnectioUploadProgressBlock)_uploadBlock
downloadProgressBlock:(URLConnectioDownloadProgressBlock)_downloadBlock {
self = [super init];
if (self) {
request = [_request retain];
completionBlock = [_completionBlock copy];
errorBlock = [_errorBlock copy];
uploadBlock = [_uploadBlock copy];
downloadBlock = [_downloadBlock copy];
}
return self;
}
- (void)dealloc {
[request release];
[data release];
[response release];
[completionBlock release];
[errorBlock release];
[uploadBlock release];
[downloadBlock release];
[super dealloc];
}
- (void)start {
connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
data = [[NSMutableData alloc] init];
[connection start];
}
#pragma mark NSURLConnectionDelegate
- (void)connectionDidFinishLoading:(NSURLConnection *)_connection {
if(completionBlock) completionBlock(data, response);
}
- (void)connection:(NSURLConnection *)_connection
didFailWithError:(NSError *)error {
if(errorBlock) errorBlock(error);
}
- (void)connection:(NSURLConnection *)connection
didReceiveResponse:(NSHTTPURLResponse *)_response {
response = [_response retain];
downloadSize = [response expectedContentLength];
}
- (void)connection:(NSURLConnection *)connection
didReceiveData:(NSData *)_data {
[data appendData:_data];
if (downloadSize != -1) {
float progress = (float)data.length / (float)downloadSize;
if(downloadBlock) downloadBlock(progress);
}
}
//THIS MOST LIKELY CAN SAVE DATA ON SERVER.
- (void)connection:(NSURLConnection *)connection
didSendBodyData:(NSInteger)bytesWritten
totalBytesWritten:(NSInteger)totalBytesWritten
totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
float progress= (float)totalBytesWritten/(float)totalBytesExpectedToWrite;
if (uploadBlock) uploadBlock(progress);
}
@end
**and here is how i call the URLConnection from my customclass:**
#import customclass.h
//....blah blah...
-(void)download{
//create request
//create url etc ready to feed the data for the below code
[URLConnection asyncConnectionWithRequest:myrequest
completionBlock:^(NSData *data, NSURLResponse *response) {
[SVProgressHUD dismissWithSuccess:@"Download Complete\nVideo in Photo Gallery"];
[videoContentData setData:data];
[self saveData];
NSLog(@"Download Complete\nVideo in Photo Gallery");
} errorBlock:^(NSError *error) {
[SVProgressHUD dismissWithError:@"Error!"];
} uploadPorgressBlock:^(float progress) {
//Upload progress (0..1)
} downloadProgressBlock:^(float progress) {
//Download progress (0.1)
//NSLog(@"progress: %f", progress);
[SVProgressHUD setProgress:progress];
}];
}
-(void)cancel{
// add something here but dont know what to be able to go into the URLConnection class and then cancel the connection inside there...
}
| 0 |
11,351,153 | 07/05/2012 19:24:13 | 1,355,221 | 04/25/2012 04:03:56 | 3 | 0 | find xml element with multiple values | Can I use element.findall() from xml.etree.ElementTree to find an element with multiple values in a single attribute?
I can use this to find all of the div elements with class="day":
from xml.etree.ElementTree import ElementTree
calendar = ElementTree()
calendar.parse("calendar-week.xml")
calendar.findall('.//div[@class="day"]')
or this to find all of the div elements with the class="first day":
calendar.findall('.//div[@class="first day"]')
but is there way to find all of the div elements with "day" in their class? I can not find any docs on how to do this. Is there a way to use regular expressions here?
<body>
<div class="calendar-week">
<div class="first day" id="su">Sunday</div>
<div class="day" id="mo">Monday</div>
<div class="day" id="tu">Tuesday</div>
<div class="day" id="we">Wednesday</div>
<div class="day" id="th">Thursday</div>
<div class="day" id="fr">Friday</div>
<div class="last day" id="sa">Saturday</div>
<div class="clear-float"></div>
</div><!-- /calendar-week -->
</body> | python | elementtree | findall | multiple-value | null | null | open | find xml element with multiple values
===
Can I use element.findall() from xml.etree.ElementTree to find an element with multiple values in a single attribute?
I can use this to find all of the div elements with class="day":
from xml.etree.ElementTree import ElementTree
calendar = ElementTree()
calendar.parse("calendar-week.xml")
calendar.findall('.//div[@class="day"]')
or this to find all of the div elements with the class="first day":
calendar.findall('.//div[@class="first day"]')
but is there way to find all of the div elements with "day" in their class? I can not find any docs on how to do this. Is there a way to use regular expressions here?
<body>
<div class="calendar-week">
<div class="first day" id="su">Sunday</div>
<div class="day" id="mo">Monday</div>
<div class="day" id="tu">Tuesday</div>
<div class="day" id="we">Wednesday</div>
<div class="day" id="th">Thursday</div>
<div class="day" id="fr">Friday</div>
<div class="last day" id="sa">Saturday</div>
<div class="clear-float"></div>
</div><!-- /calendar-week -->
</body> | 0 |
11,351,157 | 07/05/2012 19:24:21 | 748,656 | 05/11/2011 12:27:14 | 398 | 12 | Iterate over bean in Javascript? | We normally do something like this JSTL on the jsp....but I now need to set data in the javascript using JSON. How would I do something like this in Javascript/JSON
Basically loop over a bean and pull out its parameters:
<c:forEach var="field" items="${detFields}">
${field.groupName}
${field.breakoutAllowed}
</c:forEach>
so I can put it inside something like this:
"data": [{
"value": "${field.groupName}"
}, {
"value": "${field.breakoutAllowed}"
}] | javascript | json | jstl | null | null | null | open | Iterate over bean in Javascript?
===
We normally do something like this JSTL on the jsp....but I now need to set data in the javascript using JSON. How would I do something like this in Javascript/JSON
Basically loop over a bean and pull out its parameters:
<c:forEach var="field" items="${detFields}">
${field.groupName}
${field.breakoutAllowed}
</c:forEach>
so I can put it inside something like this:
"data": [{
"value": "${field.groupName}"
}, {
"value": "${field.breakoutAllowed}"
}] | 0 |
11,351,159 | 07/05/2012 19:24:28 | 1,284,799 | 03/22/2012 01:32:45 | 18 | 0 | Actionscript 3 Menu with dynamically loaded options and mouse overs | working on (as the title states) a menu with dynamically loaded options with mouse overs.
The chain of events as I see it (this could be flawed) is:
•Use loop to place one empty MovieClip for each entry in the XML file, down a number of pixels each time. We will call these 'entries'.
•Inside each entry add a textField (text from XML), draw a rectangle with alpha=0 (to be the highlight on mouseover), and add another movieclip from the library.
•Add mouseover & mouseout eventListeners to each 'entry' which set the invisible rectangle to alpha=1, and change the color of the text and movieclip from library.
Following is the function that initiates all of this. As it stands currently, it does virtually nothing, and makes no visible change to what is displayed when run:
function loadHighlight():void
{
var yTmp:Number = -153.15;
for (var i:Number = 0; i < photo_total; i++)
{
var Highlight:MovieClip = new MovieClip();
Highlight.y=yTmp;
Highlight.x= 0;
Highlight.height=144;
Highlight.width=1170;
Highlight.alpha=1;
Highlight.addEventListener(MouseEvent.MOUSE_OVER, highlightOvr);
//Draw Invisible Rectangle
var rectngle:Shape = new Shape();
rectngle.graphics.beginFill (0x0DAC54);
rectngle.graphics.drawRect(0, 0, 1170, 144);
rectngle.graphics.endFill();
rectngle.alpha = 0;
Highlight.addChildAt(rectngle, 0);
//Load photosArray
var photoname = photo_data[i].@TEXT;;
var photolist:TextField = new TextField();
photosArray[i] = photolist;
photosArray[i].textColor = 0x0DAC54;
photosArray[i].x = 558.05;
photosArray[i].y = 20.65;
photosArray[i].embedFonts = true;
photosArray[i].antiAliasType = AntiAliasType.ADVANCED;
photosArray[i].defaultTextFormat = listformat;
photosArray[i].selectable = false;
photosArray[i].wordWrap = true;
photosArray[i].text = photoname;
photosArray[i].autoSize = TextFieldAutoSize.LEFT;
photosArray[i].mouseEnabled = false;
Highlight.addChildAt(photosArray[i], 1);
//Load thumbFrames
var thumbFrame:thmbFrame = new thmbFrame();
thumbFrame.y= -51;
thumbFrame.x= 377;
Highlight.addChildAt(thumbFrame, 1);
thmbFrames.push(thmbFrame);
function highlightOvr(event:MouseEvent):void
{
event.target.rectngle.alpha=1;
event.target.photosArray.textColor = 0x000000;
event.target.thmbFrames.color = 0x000000;
//trace (thmbFrames[i]);
event.target.addEventListener(MouseEvent.MOUSE_OUT, highlightOut);
}
function highlightOut(event:MouseEvent):void
{
event.target.rectngle.alpha = 0;
//event.target.alpha=0;
event.target.removeEventListener(MouseEvent.MOUSE_OUT, highlightOut);
event.target.photosArray.textColor = 0x0DAC54;
event.target.thmbFrames.color = 0x0DAC54;
}
MediaPage.photoSelect.photoList.addChild(Highlight);
yTmp = yTmp + 153;
photoHighlights.push(Highlight);
}
}
I don't know if the way I'm going about this is even remotely intelligent. Any advice is appreciated.
Thanks,
-T.
| xml | actionscript-3 | flash-cs5 | null | null | null | open | Actionscript 3 Menu with dynamically loaded options and mouse overs
===
working on (as the title states) a menu with dynamically loaded options with mouse overs.
The chain of events as I see it (this could be flawed) is:
•Use loop to place one empty MovieClip for each entry in the XML file, down a number of pixels each time. We will call these 'entries'.
•Inside each entry add a textField (text from XML), draw a rectangle with alpha=0 (to be the highlight on mouseover), and add another movieclip from the library.
•Add mouseover & mouseout eventListeners to each 'entry' which set the invisible rectangle to alpha=1, and change the color of the text and movieclip from library.
Following is the function that initiates all of this. As it stands currently, it does virtually nothing, and makes no visible change to what is displayed when run:
function loadHighlight():void
{
var yTmp:Number = -153.15;
for (var i:Number = 0; i < photo_total; i++)
{
var Highlight:MovieClip = new MovieClip();
Highlight.y=yTmp;
Highlight.x= 0;
Highlight.height=144;
Highlight.width=1170;
Highlight.alpha=1;
Highlight.addEventListener(MouseEvent.MOUSE_OVER, highlightOvr);
//Draw Invisible Rectangle
var rectngle:Shape = new Shape();
rectngle.graphics.beginFill (0x0DAC54);
rectngle.graphics.drawRect(0, 0, 1170, 144);
rectngle.graphics.endFill();
rectngle.alpha = 0;
Highlight.addChildAt(rectngle, 0);
//Load photosArray
var photoname = photo_data[i].@TEXT;;
var photolist:TextField = new TextField();
photosArray[i] = photolist;
photosArray[i].textColor = 0x0DAC54;
photosArray[i].x = 558.05;
photosArray[i].y = 20.65;
photosArray[i].embedFonts = true;
photosArray[i].antiAliasType = AntiAliasType.ADVANCED;
photosArray[i].defaultTextFormat = listformat;
photosArray[i].selectable = false;
photosArray[i].wordWrap = true;
photosArray[i].text = photoname;
photosArray[i].autoSize = TextFieldAutoSize.LEFT;
photosArray[i].mouseEnabled = false;
Highlight.addChildAt(photosArray[i], 1);
//Load thumbFrames
var thumbFrame:thmbFrame = new thmbFrame();
thumbFrame.y= -51;
thumbFrame.x= 377;
Highlight.addChildAt(thumbFrame, 1);
thmbFrames.push(thmbFrame);
function highlightOvr(event:MouseEvent):void
{
event.target.rectngle.alpha=1;
event.target.photosArray.textColor = 0x000000;
event.target.thmbFrames.color = 0x000000;
//trace (thmbFrames[i]);
event.target.addEventListener(MouseEvent.MOUSE_OUT, highlightOut);
}
function highlightOut(event:MouseEvent):void
{
event.target.rectngle.alpha = 0;
//event.target.alpha=0;
event.target.removeEventListener(MouseEvent.MOUSE_OUT, highlightOut);
event.target.photosArray.textColor = 0x0DAC54;
event.target.thmbFrames.color = 0x0DAC54;
}
MediaPage.photoSelect.photoList.addChild(Highlight);
yTmp = yTmp + 153;
photoHighlights.push(Highlight);
}
}
I don't know if the way I'm going about this is even remotely intelligent. Any advice is appreciated.
Thanks,
-T.
| 0 |
11,411,285 | 07/10/2012 10:22:39 | 826,912 | 07/03/2011 13:21:06 | 115 | 2 | strtok returns too many strings | I am developing a program that's a sort of heartbeat designed to run on a variety of servers. The function in question, reproduced below, retrieves the list of "friends," and for each "friend" in the list, it executes a handshake operation (via ping_and_report, not shown).
The problem is that on first call to this routine, strtok_r seems to return more strings than are present in the source, and I have not been able to determine why. The code:
void pingServerList(int dummy) {
char *p ;
char *my_friends ;
char *nextSvr, *savePtr ; ;
char *separators = ",; \t" ;
server_list_t *ent = NULL ;
static long round_nbr = 0 ;
unsigned int len ;
time_t now ;
char message[4096] ;
char *hex ;
round_nbr++ ;
p = get_server_list() ;
if (p) {
len =strlen(p) ;
my_friends = malloc(len+1) ;
strncpy(my_friends, p, len) ;
}
nextSvr = strtok_r(my_friends, separators, &savePtr) ;
while (nextSvr) {
// Ensure that nobody messes with nextSvr. . .
char *workSvr = malloc(strlen(nextSvr) + 1) ;
strcpy(workSvr, nextSvr) ;
if (debug) {
len = strlen(workSvr) * 2 + 3 ;
hex = malloc(len) ;
get_hex_val(workSvr, hex, len) ;
write_log(fp_debug
, "Server: %s (x'%s')"
, workSvr, hex) ;
free(hex) ;
}
ping_and_report(workSvr, round_nbr) ;
free(workSvr) ;
nextSvr = strtok_r(NULL, separators, &savePtr) ;
}
... is not too complex at that point, I think. And I don't see any room for mucking with the values. But the log file reveals the issue here:
2012-07-09 23:26 Debug activated...
2012-07-09 23:26 get_server_list() returning velmicro, stora-2 (x'76656C6D6963726F2C2073746F72612D32')
2012-07-09 23:26 Server: velmicro (x'76656C6D6963726F')
2012-07-09 23:26 Server: stora-2 (x'73746F72612D32')
2012-07-09 23:26 Server: re (x'726519')
The crazy thing is that (at least from several executions of the code) this will only fail on the first call. Calls 2-n (where n is in the hundreds) do not exhibit this problem.
Do any of you folks see what I'm obviously missing? (BTW: this fails exactly the same way on four different systems with versions of linux.) | c | strtok | null | null | null | null | open | strtok returns too many strings
===
I am developing a program that's a sort of heartbeat designed to run on a variety of servers. The function in question, reproduced below, retrieves the list of "friends," and for each "friend" in the list, it executes a handshake operation (via ping_and_report, not shown).
The problem is that on first call to this routine, strtok_r seems to return more strings than are present in the source, and I have not been able to determine why. The code:
void pingServerList(int dummy) {
char *p ;
char *my_friends ;
char *nextSvr, *savePtr ; ;
char *separators = ",; \t" ;
server_list_t *ent = NULL ;
static long round_nbr = 0 ;
unsigned int len ;
time_t now ;
char message[4096] ;
char *hex ;
round_nbr++ ;
p = get_server_list() ;
if (p) {
len =strlen(p) ;
my_friends = malloc(len+1) ;
strncpy(my_friends, p, len) ;
}
nextSvr = strtok_r(my_friends, separators, &savePtr) ;
while (nextSvr) {
// Ensure that nobody messes with nextSvr. . .
char *workSvr = malloc(strlen(nextSvr) + 1) ;
strcpy(workSvr, nextSvr) ;
if (debug) {
len = strlen(workSvr) * 2 + 3 ;
hex = malloc(len) ;
get_hex_val(workSvr, hex, len) ;
write_log(fp_debug
, "Server: %s (x'%s')"
, workSvr, hex) ;
free(hex) ;
}
ping_and_report(workSvr, round_nbr) ;
free(workSvr) ;
nextSvr = strtok_r(NULL, separators, &savePtr) ;
}
... is not too complex at that point, I think. And I don't see any room for mucking with the values. But the log file reveals the issue here:
2012-07-09 23:26 Debug activated...
2012-07-09 23:26 get_server_list() returning velmicro, stora-2 (x'76656C6D6963726F2C2073746F72612D32')
2012-07-09 23:26 Server: velmicro (x'76656C6D6963726F')
2012-07-09 23:26 Server: stora-2 (x'73746F72612D32')
2012-07-09 23:26 Server: re (x'726519')
The crazy thing is that (at least from several executions of the code) this will only fail on the first call. Calls 2-n (where n is in the hundreds) do not exhibit this problem.
Do any of you folks see what I'm obviously missing? (BTW: this fails exactly the same way on four different systems with versions of linux.) | 0 |
11,410,965 | 07/10/2012 10:05:52 | 1,393,623 | 05/14/2012 11:34:47 | 517 | 49 | Android Darken Screen and show Progress | I am uploading/downloading some data in my application using AsyncTask. What I want is that, when the AsyncTask is running, the whole screen should get dimmed/disabled and a ProgressBar would be shown in the middle of the screen as long as the task is running.
Something like this
![Something like this][1]
[1]: http://i.stack.imgur.com/RKn2U.png
Any ideas / suggestions are most welcome.
Really need to implement it in my application! | android | progress-bar | darken | null | null | null | open | Android Darken Screen and show Progress
===
I am uploading/downloading some data in my application using AsyncTask. What I want is that, when the AsyncTask is running, the whole screen should get dimmed/disabled and a ProgressBar would be shown in the middle of the screen as long as the task is running.
Something like this
![Something like this][1]
[1]: http://i.stack.imgur.com/RKn2U.png
Any ideas / suggestions are most welcome.
Really need to implement it in my application! | 0 |
11,410,966 | 07/10/2012 10:05:54 | 1,514,405 | 07/10/2012 09:58:28 | 1 | 0 | Changed password, acess token invalid | Website feed to facebook pages is broken and I get the following message:
"message":"Error validating access token: The session has been invalidated because the user has changed the password.","type":"OAuthException","code":190,"error_subcode":460
Similar questions already been asked but I notice some of them are quite old and I want to make sure the answer is up to date.
Can I resolve it without reapplying for a new token ? | facebook | passwords | token | null | null | null | open | Changed password, acess token invalid
===
Website feed to facebook pages is broken and I get the following message:
"message":"Error validating access token: The session has been invalidated because the user has changed the password.","type":"OAuthException","code":190,"error_subcode":460
Similar questions already been asked but I notice some of them are quite old and I want to make sure the answer is up to date.
Can I resolve it without reapplying for a new token ? | 0 |
11,411,265 | 07/10/2012 10:21:33 | 829,194 | 07/05/2011 07:31:28 | 616 | 47 | Why Data Context Class create a new database? | Guys I am a new bee to asp .net mvc 3.
In the MS Visual web Developer express 2010, I created a new project using Visual C# / Web / ASP .net MVC 3 Web App. using a form authentication template. I deleted all the controller and view files and added my own. I added a new data sample.mdf in App_Data folder and changed the connection string accordingly and created country model. But when I create CRUD controller for the country model it asks me for the Data Context Class. It does not accept empty and I have to mention Data Context Class. And when I create Data Context Class, it creates a new Database of same Data Context Class name. It does not user the database that I mentioned in the Web.config file.
I want Country model data to be added in the same.mdf file and not in the context Database.
Please help... Thank you. | asp.net | asp.net-mvc | asp.net-mvc-3 | null | null | null | open | Why Data Context Class create a new database?
===
Guys I am a new bee to asp .net mvc 3.
In the MS Visual web Developer express 2010, I created a new project using Visual C# / Web / ASP .net MVC 3 Web App. using a form authentication template. I deleted all the controller and view files and added my own. I added a new data sample.mdf in App_Data folder and changed the connection string accordingly and created country model. But when I create CRUD controller for the country model it asks me for the Data Context Class. It does not accept empty and I have to mention Data Context Class. And when I create Data Context Class, it creates a new Database of same Data Context Class name. It does not user the database that I mentioned in the Web.config file.
I want Country model data to be added in the same.mdf file and not in the context Database.
Please help... Thank you. | 0 |
11,411,267 | 07/10/2012 10:21:39 | 1,514,434 | 07/10/2012 10:12:15 | 1 | 0 | Change button and div on click | Hello I need to mimic this websites function with the "view 360" button: http://www.designrattan.co.uk/daybed/apple
I have attempted it here:
http://designliving.tk/winchester-rattan-garden-round-table-set
but several things are wrong as you can see.
I need the DIV to change when clicking the button, but I also need the button to change every time it is clicked (from "view 360" to "view image").
In addition to that I need the images in my photos tab to be able to change the div and button back to "view 360"
I hope this all makes sense!,
Thanks everyone! | javascript | jquery | html | css | null | null | open | Change button and div on click
===
Hello I need to mimic this websites function with the "view 360" button: http://www.designrattan.co.uk/daybed/apple
I have attempted it here:
http://designliving.tk/winchester-rattan-garden-round-table-set
but several things are wrong as you can see.
I need the DIV to change when clicking the button, but I also need the button to change every time it is clicked (from "view 360" to "view image").
In addition to that I need the images in my photos tab to be able to change the div and button back to "view 360"
I hope this all makes sense!,
Thanks everyone! | 0 |
11,430,513 | 07/11/2012 10:20:06 | 1,482,442 | 06/26/2012 10:39:55 | 8 | 0 | wordpress - it is possibe to change menu of the admin? | I am using wordpress to develope a site. One of my current tasks is to add a new link in the admin panel, on the left column. To be more explicit, where i have the links: Dashbord , Media , Links , Posts ... to add my own link. It is possible?
Thank you in advance ! :) | wordpress | admin | null | null | null | null | open | wordpress - it is possibe to change menu of the admin?
===
I am using wordpress to develope a site. One of my current tasks is to add a new link in the admin panel, on the left column. To be more explicit, where i have the links: Dashbord , Media , Links , Posts ... to add my own link. It is possible?
Thank you in advance ! :) | 0 |
11,430,587 | 07/11/2012 10:24:04 | 1,517,423 | 07/11/2012 10:16:18 | 1 | 0 | JSF check if value one the view is in enum | Suppose I have enum with 5 values. I want to make conditional rendering depending on the value some filed in bean took:
<h:outputText vale="xxx" rendered="#{myBean.enumValue eq 'FIRST'}">
<h:outputText vale="xxx" rendered="#{myBean.enumValue eq 'SECOND'}">
<h:outputText vale="zzz" rendered="#{myBean.enumValue eq 'THIRD'}">
etc.
Is it possible to make it simpler and check if enumValue is IN defined enum or its part (for example, by calling enum method which gives only some of its values (for 'xxx' value of the field, if the enumValue is FIRST or SECOND), but without building big conditional on the view?
Thank you | jsf | view | xhtml | enums | null | null | open | JSF check if value one the view is in enum
===
Suppose I have enum with 5 values. I want to make conditional rendering depending on the value some filed in bean took:
<h:outputText vale="xxx" rendered="#{myBean.enumValue eq 'FIRST'}">
<h:outputText vale="xxx" rendered="#{myBean.enumValue eq 'SECOND'}">
<h:outputText vale="zzz" rendered="#{myBean.enumValue eq 'THIRD'}">
etc.
Is it possible to make it simpler and check if enumValue is IN defined enum or its part (for example, by calling enum method which gives only some of its values (for 'xxx' value of the field, if the enumValue is FIRST or SECOND), but without building big conditional on the view?
Thank you | 0 |
11,430,588 | 07/11/2012 10:24:11 | 1,168,848 | 01/25/2012 09:31:57 | 126 | 0 | find rowwise maxCoeff and Index of maxCoeff in Eigen | I want to find the maximum values and indices by row of a matrix. I based this on an example on the [eigen website ](http://eigen.tuxfamily.org/dox/TutorialReductionsVisitorsBroadcasting.html) (example 7).
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
MatrixXf::Index maxIndex;
VectorXf maxVal = mat.rowwise().maxCoeff(&maxIndex);
std::cout << "Maxima at positions " << endl;
std::cout << maxIndex << std::endl;
std::cout << "maxVal " << maxVal << endl;
}
Problem here is that my line
VectorXf maxVal = mat.rowwise().maxCoeff(&maxIndex);
is wrong. The original example has
float maxNorm = mat.rowwise().sum().maxCoeff(&maxIndex);
i.e. there is an additional reduction .sum() involved. any suggestions? I guess I just want the eigen equivalent to what in matlab I would write as
[maxval maxind] = max(mymatrix,[],2)
i.e. find maximum value and it's index over the second dimension of mymatrix and return in a (nrow(mymatrix),2) matrix.
thanks!
(sent to the eigen list as well, sorry for cross-posting.)
| eigen | null | null | null | null | null | open | find rowwise maxCoeff and Index of maxCoeff in Eigen
===
I want to find the maximum values and indices by row of a matrix. I based this on an example on the [eigen website ](http://eigen.tuxfamily.org/dox/TutorialReductionsVisitorsBroadcasting.html) (example 7).
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
MatrixXf::Index maxIndex;
VectorXf maxVal = mat.rowwise().maxCoeff(&maxIndex);
std::cout << "Maxima at positions " << endl;
std::cout << maxIndex << std::endl;
std::cout << "maxVal " << maxVal << endl;
}
Problem here is that my line
VectorXf maxVal = mat.rowwise().maxCoeff(&maxIndex);
is wrong. The original example has
float maxNorm = mat.rowwise().sum().maxCoeff(&maxIndex);
i.e. there is an additional reduction .sum() involved. any suggestions? I guess I just want the eigen equivalent to what in matlab I would write as
[maxval maxind] = max(mymatrix,[],2)
i.e. find maximum value and it's index over the second dimension of mymatrix and return in a (nrow(mymatrix),2) matrix.
thanks!
(sent to the eigen list as well, sorry for cross-posting.)
| 0 |
11,430,590 | 07/11/2012 10:24:12 | 597,993 | 02/01/2011 06:45:44 | 70 | 8 | How to verify the Literal text on the UI | Here is part of the UI where i have got some literal texts like
Opportunity Name Momentum Test (ID=AANA-19KVBE)
Account Account Internal
Owner Christopher Braden
Sales Order Region North America
Locale English United States
Currency US Dollar
The piece of code for the above is as follows
<table class="datatable" width="100%">
<tbody>
<tr class="oddrow">
<td>Opportunity Name</td>
<td class="wrap_content">
Momentum Test (ID=AANA-19KVBE)
<br>
<a target="_blank" href="http://www.example.com">View in Salesforce</a>
</td>
</tr>
<tr class="evenrow">
<td>Account</td>
<td class="wrap_content">
Akamai Internal
<br>
<a target="_blank" href="http://www.example.com">View in Salesforce</a>
</td>
</tr>
<tr class="oddrow">
<td>Owner</td>
<td>Christopher Braden</td>
</tr>
<tr class="evenrow">
<td>Sales Order Region</td>
<td>North America</td>
</tr>
<tr class="oddrow">
<td>Locale</td>
<td>English - United States</td>
</tr>
<tr class="evenrow">
<td>Currency</td>
<td>US Dollar</td>
</tr>
</tbody>
</table>
I need to retrieve these values individually, store it to compare it in a different page.
for example : i need to know "United States" is stored under "Location"
Please help me
Thanks & Regards
Kiran
| selenium | selenium-firefoxdriver | null | null | null | null | open | How to verify the Literal text on the UI
===
Here is part of the UI where i have got some literal texts like
Opportunity Name Momentum Test (ID=AANA-19KVBE)
Account Account Internal
Owner Christopher Braden
Sales Order Region North America
Locale English United States
Currency US Dollar
The piece of code for the above is as follows
<table class="datatable" width="100%">
<tbody>
<tr class="oddrow">
<td>Opportunity Name</td>
<td class="wrap_content">
Momentum Test (ID=AANA-19KVBE)
<br>
<a target="_blank" href="http://www.example.com">View in Salesforce</a>
</td>
</tr>
<tr class="evenrow">
<td>Account</td>
<td class="wrap_content">
Akamai Internal
<br>
<a target="_blank" href="http://www.example.com">View in Salesforce</a>
</td>
</tr>
<tr class="oddrow">
<td>Owner</td>
<td>Christopher Braden</td>
</tr>
<tr class="evenrow">
<td>Sales Order Region</td>
<td>North America</td>
</tr>
<tr class="oddrow">
<td>Locale</td>
<td>English - United States</td>
</tr>
<tr class="evenrow">
<td>Currency</td>
<td>US Dollar</td>
</tr>
</tbody>
</table>
I need to retrieve these values individually, store it to compare it in a different page.
for example : i need to know "United States" is stored under "Location"
Please help me
Thanks & Regards
Kiran
| 0 |
11,430,603 | 07/11/2012 10:24:50 | 698,316 | 04/08/2011 08:55:28 | 6 | 0 | How to capture H.264 encoded frame in android? | I understand like, there are two ways of capturing video in android.
<br/>1) using SurfaceView API
<br/>2) using MediaRecorder API
My aim is to capture H.264 encoded video frames (using android's H.264 default codec) to send it over network using RTP.
On using SurfaceView API way, I am getting raw frames.<br/>
On using MediaRecorder API, I am not able to get video frames.<br/>
Can you suggest a way to capture the H.264 encoded frames using android's default H.264 codec support.
| android | video | native | h.264 | codec | null | open | How to capture H.264 encoded frame in android?
===
I understand like, there are two ways of capturing video in android.
<br/>1) using SurfaceView API
<br/>2) using MediaRecorder API
My aim is to capture H.264 encoded video frames (using android's H.264 default codec) to send it over network using RTP.
On using SurfaceView API way, I am getting raw frames.<br/>
On using MediaRecorder API, I am not able to get video frames.<br/>
Can you suggest a way to capture the H.264 encoded frames using android's default H.264 codec support.
| 0 |
11,430,604 | 07/11/2012 10:24:52 | 30,155 | 10/21/2008 22:20:59 | 14,241 | 420 | Why don't Generic Interface Constraints automatically apply to implementing classes? | Here's a simple interface and concrete implementation.
public interface IDoWork<T> where T : class, new()
{
T Create() ;
}
public class ThingThatDoesWork<T> : IDoWork<T>
{
public T Create() { return default(T); }
}
void Main()
{
IDoWork<object> i = new ThingThatDoesWork<object>();
var v = i.Create();
Console.WriteLine(v);
}
The problem is that I get a compile error at `public class ThingThatDoesWork` saying.
> The type 'T' must be a reference type in order to use it as parameter
> 'T' in the generic type or method 'UserQuery.IDoWork<T>'
>
> 'T' must be a non-abstract type with a public parameterless
> constructor in order to use it as parameter 'T' in the generic type or
> method 'UserQuery.IDoWork<T>'
Now the solution for this is to add the generic constraint to the concrete implementation as well. I.e.
*Incorrect*
public class ThingThatDoesWork<T> : IDoWork<T>
*Correct*
public class ThingThatDoesWork<T> : IDoWork<T> where T : class, new()
My question is, why do I need to add the constraint to the implementation. Shouldn't the compiler realise this and automatically apply the same constraint since the implementation is already implementing an interface with that constraint.
| c# | .net | generics | interface | constraints | null | open | Why don't Generic Interface Constraints automatically apply to implementing classes?
===
Here's a simple interface and concrete implementation.
public interface IDoWork<T> where T : class, new()
{
T Create() ;
}
public class ThingThatDoesWork<T> : IDoWork<T>
{
public T Create() { return default(T); }
}
void Main()
{
IDoWork<object> i = new ThingThatDoesWork<object>();
var v = i.Create();
Console.WriteLine(v);
}
The problem is that I get a compile error at `public class ThingThatDoesWork` saying.
> The type 'T' must be a reference type in order to use it as parameter
> 'T' in the generic type or method 'UserQuery.IDoWork<T>'
>
> 'T' must be a non-abstract type with a public parameterless
> constructor in order to use it as parameter 'T' in the generic type or
> method 'UserQuery.IDoWork<T>'
Now the solution for this is to add the generic constraint to the concrete implementation as well. I.e.
*Incorrect*
public class ThingThatDoesWork<T> : IDoWork<T>
*Correct*
public class ThingThatDoesWork<T> : IDoWork<T> where T : class, new()
My question is, why do I need to add the constraint to the implementation. Shouldn't the compiler realise this and automatically apply the same constraint since the implementation is already implementing an interface with that constraint.
| 0 |
11,430,605 | 07/11/2012 10:24:52 | 1,490,276 | 06/29/2012 04:49:23 | 1 | 0 | How to get SSL Setting (Required SSL checkbox value) using c#? | We have a scenario where we need to dynamically get the SSL setting like (Required SSL checkbox value) from our codebehind. If user checked/unchecked the checkbox we need to get the value from our codebehind using C#. | c# | asp.net | null | null | null | 07/12/2012 13:25:19 | not a real question | How to get SSL Setting (Required SSL checkbox value) using c#?
===
We have a scenario where we need to dynamically get the SSL setting like (Required SSL checkbox value) from our codebehind. If user checked/unchecked the checkbox we need to get the value from our codebehind using C#. | 1 |
11,651,180 | 07/25/2012 13:45:53 | 1,551,791 | 07/25/2012 13:38:10 | 1 | 0 | How to change this error message into alert pop up in php? | I want to modify this code into pop up alert. Currently, this code only produce error message. I want to modify it so when course clashed, the pop up will appear
if($clash_courses==1)
{
$error_msg .= 'Course ';
$c = 0;
foreach($course_id as $id){
$c++;
$error_msg .= $id;
if($c<count($course_id))
$error_msg .= ' and ';
}
$error_msg .= ' have clashed.';
}
| php | null | null | null | null | null | open | How to change this error message into alert pop up in php?
===
I want to modify this code into pop up alert. Currently, this code only produce error message. I want to modify it so when course clashed, the pop up will appear
if($clash_courses==1)
{
$error_msg .= 'Course ';
$c = 0;
foreach($course_id as $id){
$c++;
$error_msg .= $id;
if($c<count($course_id))
$error_msg .= ' and ';
}
$error_msg .= ' have clashed.';
}
| 0 |
11,651,181 | 07/25/2012 13:45:54 | 207,717 | 11/10/2009 11:23:53 | 2,364 | 94 | Are there onLoad/onError events triggered when embeding flash object in HTML? | I'm embeding flash player in HTML by inlining such HTML:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"
width="470" height="320">
<param name="movie"
value="http://myserver.com/strobe/StrobeMediaPlayback.swf"></param>
<param name="FlashVars"
value="src=http://myserver.com/mymovie.flv"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://myserver.com/strobe/StrobeMediaPlayback.swf"
type="application/x-shockwave-flash"
allowscriptaccess="always" allowfullscreen="true"
width="470" height="320"
FlashVars="src=http://myserver.com/mymovie.flv">
</embed>
</object>
I would like to receive callback onLoad or onError informing if the SWF application was properly downloaded and initialized. Is is possible? Does flash plugin expose such events for javascript? | javascript | html | flash | null | null | null | open | Are there onLoad/onError events triggered when embeding flash object in HTML?
===
I'm embeding flash player in HTML by inlining such HTML:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"
width="470" height="320">
<param name="movie"
value="http://myserver.com/strobe/StrobeMediaPlayback.swf"></param>
<param name="FlashVars"
value="src=http://myserver.com/mymovie.flv"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://myserver.com/strobe/StrobeMediaPlayback.swf"
type="application/x-shockwave-flash"
allowscriptaccess="always" allowfullscreen="true"
width="470" height="320"
FlashVars="src=http://myserver.com/mymovie.flv">
</embed>
</object>
I would like to receive callback onLoad or onError informing if the SWF application was properly downloaded and initialized. Is is possible? Does flash plugin expose such events for javascript? | 0 |
11,651,182 | 07/25/2012 13:45:57 | 886,955 | 08/10/2011 00:34:47 | 18 | 1 | Search With Auto-Suggest | I'm looking for something very similar to this code:
http://hernantz.github.com/doubleSuggest/
I want to use a search autosuggest feature that displays the album art, and name of the artist, but DOESN'T connect with Spotify to bring up alternate artists. I tried fiddling with the code a bit, but I can't get it to work quite right. I want it to simply auto suggest as the user is typing, and if they happen to type without looking and enter an incorrect band name to bring them a page that says the artist couldn't be found.
Thanks in advance for any and all help. Apparently my PHP is rusty... | image | search | autosuggest | null | null | null | open | Search With Auto-Suggest
===
I'm looking for something very similar to this code:
http://hernantz.github.com/doubleSuggest/
I want to use a search autosuggest feature that displays the album art, and name of the artist, but DOESN'T connect with Spotify to bring up alternate artists. I tried fiddling with the code a bit, but I can't get it to work quite right. I want it to simply auto suggest as the user is typing, and if they happen to type without looking and enter an incorrect band name to bring them a page that says the artist couldn't be found.
Thanks in advance for any and all help. Apparently my PHP is rusty... | 0 |
11,651,183 | 07/25/2012 13:46:04 | 402,421 | 07/26/2010 15:02:09 | 483 | 7 | doPostback and then navigate to another page | I am trying to call __doPostBack from within JavaScript and then navigate to another page. The script I have is:
$(document).ready(function() {
$("a.change-link").click(function(){
__doPostBack("","");
location.href='pageToGoTo';
});
});
The code is not getting to the `location.href='pageToGoTo'` line after the post back.
Is there anyway to achieve this functionality?
Thanks
| javascript | dopostback | null | null | null | null | open | doPostback and then navigate to another page
===
I am trying to call __doPostBack from within JavaScript and then navigate to another page. The script I have is:
$(document).ready(function() {
$("a.change-link").click(function(){
__doPostBack("","");
location.href='pageToGoTo';
});
});
The code is not getting to the `location.href='pageToGoTo'` line after the post back.
Is there anyway to achieve this functionality?
Thanks
| 0 |
11,651,188 | 07/25/2012 13:46:19 | 1,048,244 | 11/15/2011 18:45:42 | 89 | 0 | How copy specific data out of a file using python? | I have some large data files and I want to copy out certain pieces of data on each line, basically an ID code. The ID code has a | on one side and a space on the other. I was wondering would it be possible to pull out just the ID. Also I have two data files, one has 4 ID codes per line and the other has 23 per line.
At the moment I'm thinking something like copying each line from the data file, then subtract the strings from each other to get the desired ID code, but surely there must be an easier way! Help?
Here is an example of a line from the data file that I'm working with
cluster8032: WoodR1|Wood_4286 Q8R1|EIK58010 F113|AEV64487.1 NFM421|PSEBR_a4327
and from this line I would want to output on separate lines
Wood_4286
EIK58010
AEV644870.1
PSEBR_a4327
| python | null | null | null | null | null | open | How copy specific data out of a file using python?
===
I have some large data files and I want to copy out certain pieces of data on each line, basically an ID code. The ID code has a | on one side and a space on the other. I was wondering would it be possible to pull out just the ID. Also I have two data files, one has 4 ID codes per line and the other has 23 per line.
At the moment I'm thinking something like copying each line from the data file, then subtract the strings from each other to get the desired ID code, but surely there must be an easier way! Help?
Here is an example of a line from the data file that I'm working with
cluster8032: WoodR1|Wood_4286 Q8R1|EIK58010 F113|AEV64487.1 NFM421|PSEBR_a4327
and from this line I would want to output on separate lines
Wood_4286
EIK58010
AEV644870.1
PSEBR_a4327
| 0 |
11,619,087 | 07/23/2012 19:23:14 | 1,546,755 | 07/23/2012 19:20:46 | 1 | 0 | WSO1 httpd: om_element.c:955: axiom_element_set_text: Assertion failed | We are getting the foolowing error in httpd.conf:-
httpd: om_element.c:955: axiom_element_set_text: Assertion `text != ((void *)0)' failed.
Please suggest | httpd | wso2 | null | null | null | null | open | WSO1 httpd: om_element.c:955: axiom_element_set_text: Assertion failed
===
We are getting the foolowing error in httpd.conf:-
httpd: om_element.c:955: axiom_element_set_text: Assertion `text != ((void *)0)' failed.
Please suggest | 0 |
11,619,088 | 07/23/2012 19:23:18 | 1,030,542 | 11/02/2011 00:22:28 | 128 | 0 | Executing multiple commands using Net::SSH::Perl module | I am new to this module. I tried a sample program and it worked fine. But, now I would like to how do I execute multiple commands in this program :
use Net::SSH::Perl;
my $hostname = "<<hostname>>";
my $username = "<<username>>";
my $password = "<<password>>";
my $cmd = 'mkdir script; cd cronscript';
my $ssh = Net::SSH::Perl->new("$hostname", debug=>0);
$ssh->login("$username","$password");
my ($stdout,$stderr,$exit) = $ssh->cmd("$cmd");
print $stdout; | perl | ssh | perl-module | null | null | null | open | Executing multiple commands using Net::SSH::Perl module
===
I am new to this module. I tried a sample program and it worked fine. But, now I would like to how do I execute multiple commands in this program :
use Net::SSH::Perl;
my $hostname = "<<hostname>>";
my $username = "<<username>>";
my $password = "<<password>>";
my $cmd = 'mkdir script; cd cronscript';
my $ssh = Net::SSH::Perl->new("$hostname", debug=>0);
$ssh->login("$username","$password");
my ($stdout,$stderr,$exit) = $ssh->cmd("$cmd");
print $stdout; | 0 |
11,651,196 | 07/25/2012 13:46:37 | 1,306,364 | 04/01/2012 13:58:03 | 8 | 0 | Cant seem to get fgetc working the second time reading a file | I'm reopening and reading a file, SORTED.txt, after closing it from its first time use - copying all the contents of another file, UNSORTED.txt.
After copying from UNSORTED.txt, I wanted to count the number of lines of what I've copied (as a seperate process, and not during the copy process). It seems that fegtc() does not point at the beginning of the file (SORTED.txt) the second time over, hence the value of lines remains as what it was initialized as, 0. Also, in general, can I get the repointing of fgetc() done without closing and reopening the file in consideration?
Grateful for any help.
Cheers!
f = fopen("./TEXTFILES/UNSORTED.txt", "w");
if (f == NULL){
printf("ERROR opening file\n");
return 100;
}
for (i=0; i<1000000; i++){
fprintf(f, "%d\n", (23*rand()-rand()/13));
}
fclose(f);
f = fopen("./TEXTFILES/UNSORTED.txt", "r");
if (f == NULL){
return 100;
}
s = fopen("./TEXTFILES/SORTED.txt", "w");
if (s == NULL){
return 101;
}
while(1){
j = getc(f);
if (j == EOF) break;
fputc(j, s);
}
fclose(f);
//Closed source file. Read number of lines in target file.
fclose(s);
s = fopen("./TEXTFILES/SORTED.txt", "w");
j = 0;
while(1){
j = fgetc(s);
if (j == EOF) break;
if (j == '\n') lines++;
}
fclose(s);
printf("\n%d\n", lines); | c | fgetc | null | null | null | null | open | Cant seem to get fgetc working the second time reading a file
===
I'm reopening and reading a file, SORTED.txt, after closing it from its first time use - copying all the contents of another file, UNSORTED.txt.
After copying from UNSORTED.txt, I wanted to count the number of lines of what I've copied (as a seperate process, and not during the copy process). It seems that fegtc() does not point at the beginning of the file (SORTED.txt) the second time over, hence the value of lines remains as what it was initialized as, 0. Also, in general, can I get the repointing of fgetc() done without closing and reopening the file in consideration?
Grateful for any help.
Cheers!
f = fopen("./TEXTFILES/UNSORTED.txt", "w");
if (f == NULL){
printf("ERROR opening file\n");
return 100;
}
for (i=0; i<1000000; i++){
fprintf(f, "%d\n", (23*rand()-rand()/13));
}
fclose(f);
f = fopen("./TEXTFILES/UNSORTED.txt", "r");
if (f == NULL){
return 100;
}
s = fopen("./TEXTFILES/SORTED.txt", "w");
if (s == NULL){
return 101;
}
while(1){
j = getc(f);
if (j == EOF) break;
fputc(j, s);
}
fclose(f);
//Closed source file. Read number of lines in target file.
fclose(s);
s = fopen("./TEXTFILES/SORTED.txt", "w");
j = 0;
while(1){
j = fgetc(s);
if (j == EOF) break;
if (j == '\n') lines++;
}
fclose(s);
printf("\n%d\n", lines); | 0 |
11,651,202 | 07/25/2012 13:47:04 | 838,556 | 07/11/2011 09:07:32 | 37 | 1 | JQuery Mobile swipe between Pages like a gallery | My App consists of different HTML5 Pages. I know how to swipe between them with JQuery Mobile. But I want something like a horizontal progress bar. So that the users knows that there a maybe 10 pages and he is a the beginning.
I know these gallery plugins. But I don't want to swipe images. I want to swipe the whole pages without any buttons.
I'll hope someone has an idea how to code something like that or has an example project for me.
Thanks! | jquery | html5 | jquery-mobile | swipe | null | null | open | JQuery Mobile swipe between Pages like a gallery
===
My App consists of different HTML5 Pages. I know how to swipe between them with JQuery Mobile. But I want something like a horizontal progress bar. So that the users knows that there a maybe 10 pages and he is a the beginning.
I know these gallery plugins. But I don't want to swipe images. I want to swipe the whole pages without any buttons.
I'll hope someone has an idea how to code something like that or has an example project for me.
Thanks! | 0 |
11,472,773 | 07/13/2012 14:43:18 | 434,218 | 08/29/2010 13:00:14 | 1,530 | 10 | Input misalligned in WP reCAPTCHA | I've added a reCAPTCHA plugin for WP. It seem to work, but the input field is shifted to the right. Anyone seen this sort of thing happen before?
Is it some sort of CSS parent float affecting it?
![enter image description here][1]
[1]: http://i.stack.imgur.com/QhQcH.png | wordpress-plugin | recaptcha | null | null | null | null | open | Input misalligned in WP reCAPTCHA
===
I've added a reCAPTCHA plugin for WP. It seem to work, but the input field is shifted to the right. Anyone seen this sort of thing happen before?
Is it some sort of CSS parent float affecting it?
![enter image description here][1]
[1]: http://i.stack.imgur.com/QhQcH.png | 0 |
11,472,777 | 07/13/2012 14:43:24 | 1,378,680 | 05/06/2012 22:26:38 | 322 | 1 | How to return a value into a variable in Java | If I want to put all the values from the myNum[x] into a varible
int myNum[] = {1, 2, 22, 89, 56, 45};
int num = myNum.length;
int greater ;
for (int x = 0 ; x < num ; x++)
if (myNum[x] > 10) {
System.out.print(greater+"are than 10");
}
P.S. Still trying to find my feet in Java Programming | java | null | null | null | null | null | open | How to return a value into a variable in Java
===
If I want to put all the values from the myNum[x] into a varible
int myNum[] = {1, 2, 22, 89, 56, 45};
int num = myNum.length;
int greater ;
for (int x = 0 ; x < num ; x++)
if (myNum[x] > 10) {
System.out.print(greater+"are than 10");
}
P.S. Still trying to find my feet in Java Programming | 0 |
11,472,778 | 07/13/2012 14:43:24 | 533,060 | 12/07/2010 01:13:46 | 40 | 0 | Concerning Methodology and Proper Practices in Java | This may be a weird question, but is there anything wrong, methodologically speaking, about how I'm using enums here (See the Operation enum)?
https://github.com/NicholasRoge/jrpgme/blob/master/src/roge/utils/Math.java
Like I said, it's an odd question, but it just looks so... Odd, to me. I had the idea one night, and it worked out perfectly. | java | enums | methodology | null | null | null | open | Concerning Methodology and Proper Practices in Java
===
This may be a weird question, but is there anything wrong, methodologically speaking, about how I'm using enums here (See the Operation enum)?
https://github.com/NicholasRoge/jrpgme/blob/master/src/roge/utils/Math.java
Like I said, it's an odd question, but it just looks so... Odd, to me. I had the idea one night, and it worked out perfectly. | 0 |
11,472,706 | 07/13/2012 14:39:12 | 117,610 | 06/04/2009 19:57:34 | 21 | 2 | SSRS 2008R2 Snapshot based report subscriptions not consistently firing | I'm running Reporting Services 2008R2 and I have several subscriptions that are supposed to fire once the snapshot of the given report is refreshed. My problem is that sometimes the snapshot will update, but the subscription doesn't fire. If I look in the log, I see this error.
> e ERROR: Throwing
> Microsoft.ReportingServices.Diagnostics.Utilities.ScheduleNotFoundException:
> ,
> Microsoft.ReportingServices.Diagnostics.Utilities.ScheduleNotFoundException:
> The schedule '66bb2f51-479b-46b8-9682-f7f547067b45' cannot be found.
> The schedule identifier that is provided to an operation cannot be
> located in the report server database.;
I can manually create a new snapshot, however and the subscription will fire normally. This problem isn't consistent, either. Some reports seem to do it more often than others, but none of them have this problem all the time. I've tried deleting the subscriptions and recreating them.
I haven't had much luck finding a solution on my own, so if anyone else has seen this before an knows what to do or can at least give me another place to look, I would appreciate it. | reporting-services | ssrs-2008 | null | null | null | null | open | SSRS 2008R2 Snapshot based report subscriptions not consistently firing
===
I'm running Reporting Services 2008R2 and I have several subscriptions that are supposed to fire once the snapshot of the given report is refreshed. My problem is that sometimes the snapshot will update, but the subscription doesn't fire. If I look in the log, I see this error.
> e ERROR: Throwing
> Microsoft.ReportingServices.Diagnostics.Utilities.ScheduleNotFoundException:
> ,
> Microsoft.ReportingServices.Diagnostics.Utilities.ScheduleNotFoundException:
> The schedule '66bb2f51-479b-46b8-9682-f7f547067b45' cannot be found.
> The schedule identifier that is provided to an operation cannot be
> located in the report server database.;
I can manually create a new snapshot, however and the subscription will fire normally. This problem isn't consistent, either. Some reports seem to do it more often than others, but none of them have this problem all the time. I've tried deleting the subscriptions and recreating them.
I haven't had much luck finding a solution on my own, so if anyone else has seen this before an knows what to do or can at least give me another place to look, I would appreciate it. | 0 |
11,472,786 | 07/13/2012 14:43:43 | 1,227,714 | 02/23/2012 07:19:53 | 45 | 0 | RegEx get the until the next not the last | Input:
55 511 00,"805, 809, 810, 839, 840",J223,201,338,116,16,200,115,6,P,S,"8,5","25,74",47,242,"55,7"
RegEx:
,"(.*)",
Marks:
,"805, 809, 810, 839, 840",J223,201,338,116,16,200,115,6,P,S,"8,5","25,74",
Should Mark:
,"805, 809, 810, 839, 840",
OR
805, 809, 810, 839, 840
I think this explains enough.. I dont know how to descripe in other way.
Does anyone know how to realise this? I am not that good at RegEx... | regex | null | null | null | null | null | open | RegEx get the until the next not the last
===
Input:
55 511 00,"805, 809, 810, 839, 840",J223,201,338,116,16,200,115,6,P,S,"8,5","25,74",47,242,"55,7"
RegEx:
,"(.*)",
Marks:
,"805, 809, 810, 839, 840",J223,201,338,116,16,200,115,6,P,S,"8,5","25,74",
Should Mark:
,"805, 809, 810, 839, 840",
OR
805, 809, 810, 839, 840
I think this explains enough.. I dont know how to descripe in other way.
Does anyone know how to realise this? I am not that good at RegEx... | 0 |
11,466,122 | 07/13/2012 07:37:26 | 1,503,248 | 07/05/2012 07:36:20 | 1 | 1 | Does anyone knows how DB2 Recovery Expert works, when extracting transaction logs? | I am writing a sql2nosql synchronizing tool by java. I gotta to extract DB2 history archived transaction logs, however not like Oracle logmnr, DB2 has no suitable API or method, except her own tool 'Recovery Expert'.Don't mention snapshot or event monitor for me, because I am analyzing history archived logs.
Does anyone help me how DB2 Recovery Expert works, when extracting logs?
Regards Deyin from China | logging | transactions | db2 | extract | null | null | open | Does anyone knows how DB2 Recovery Expert works, when extracting transaction logs?
===
I am writing a sql2nosql synchronizing tool by java. I gotta to extract DB2 history archived transaction logs, however not like Oracle logmnr, DB2 has no suitable API or method, except her own tool 'Recovery Expert'.Don't mention snapshot or event monitor for me, because I am analyzing history archived logs.
Does anyone help me how DB2 Recovery Expert works, when extracting logs?
Regards Deyin from China | 0 |
11,472,790 | 07/13/2012 14:44:04 | 1,178,399 | 01/30/2012 15:34:43 | 17 | 0 | Analog to CROSS APPLY | Can anyone say what is the best way to substitute CROSS APPLY in the next sql query ?
SELECT *
FROM V_CitizenVersions
CROSS APPLY
dbo.GetCitizenRecModified(Citizen, LastName, FirstName, MiddleName,
BirthYear, BirthMonth, BirthDay, ..... ) -- lots of params
I need to migrate queries that were written for ms sql server 2005 to postgre 9.1.
GetCitizenRecModified function is table valued Function. i can't place code of this function because it's really enormous, it makes some difficult computations and i can't abandon it.
Thanx in advance! | sql | cross-apply | null | null | null | null | open | Analog to CROSS APPLY
===
Can anyone say what is the best way to substitute CROSS APPLY in the next sql query ?
SELECT *
FROM V_CitizenVersions
CROSS APPLY
dbo.GetCitizenRecModified(Citizen, LastName, FirstName, MiddleName,
BirthYear, BirthMonth, BirthDay, ..... ) -- lots of params
I need to migrate queries that were written for ms sql server 2005 to postgre 9.1.
GetCitizenRecModified function is table valued Function. i can't place code of this function because it's really enormous, it makes some difficult computations and i can't abandon it.
Thanx in advance! | 0 |
11,472,791 | 07/13/2012 14:44:04 | 260,506 | 01/27/2010 22:52:11 | 82 | 3 | iOS - Execute a Piece of Code for 10 Seconds | I'd like to execute a piece of code every 500ms for a total of 10 seconds. I have the code working executing every half a second with this code
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(getLevel:) userInfo:nil repeats: YES];
but I cannot seem to figure out how to stop it executing after 10 seconds. The "repeats" argument doesnt seem to allow for a specified time.
Could someone point me in the direction of where I should go with this?
Thanks
Brian | objective-c | ios | nstimer | null | null | null | open | iOS - Execute a Piece of Code for 10 Seconds
===
I'd like to execute a piece of code every 500ms for a total of 10 seconds. I have the code working executing every half a second with this code
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(getLevel:) userInfo:nil repeats: YES];
but I cannot seem to figure out how to stop it executing after 10 seconds. The "repeats" argument doesnt seem to allow for a specified time.
Could someone point me in the direction of where I should go with this?
Thanks
Brian | 0 |
11,351,160 | 07/05/2012 19:24:29 | 1,118,307 | 12/27/2011 21:22:52 | 698 | 22 | Are string concatenations using + optimized to a StringBuilder implementation in .NET? | I've read multiple places that in Java 1.5+ `String` concatenations are optimized to using a `StringBuilder` when a program is compiled. It's unclear to me if this is a standard or just a common optimization many compilers employ. Any clarificion in regards to this would be appreciated, but mainly it's a lead-in to my second question.
Does .NET similarly optimize? I'm aware that if I use `StringBuilder` this will eliminate any ambiguity but I personally find the simplicity of `+` easier to read. If .NET does, did this start in a specific version? Elaboration is appreciated. | c# | java | .net | string | optimization | null | open | Are string concatenations using + optimized to a StringBuilder implementation in .NET?
===
I've read multiple places that in Java 1.5+ `String` concatenations are optimized to using a `StringBuilder` when a program is compiled. It's unclear to me if this is a standard or just a common optimization many compilers employ. Any clarificion in regards to this would be appreciated, but mainly it's a lead-in to my second question.
Does .NET similarly optimize? I'm aware that if I use `StringBuilder` this will eliminate any ambiguity but I personally find the simplicity of `+` easier to read. If .NET does, did this start in a specific version? Elaboration is appreciated. | 0 |
11,351,167 | 07/05/2012 19:24:56 | 1,094,338 | 12/12/2011 18:34:54 | 83 | 0 | How to use Cast in Oracle sp | in follwing "AND CAST(FLAGS AS BIGINT) & 1 = 1" how to write this for an Oracle sp we have to allow app to handle Oracle users as well.
ALTER PROCEDURE [OGEN].[DBD_GET_STOCK_SUMMARY]
@FACILITY_KEY VARCHAR(1000),
@START_DATE DATETIME,
@END_DATE DATETIME
AS
BEGIN
SELECT COUNT(*) COUNT, OGEN.DATEONLY(CREATED_ON) [DATE]
FROM OGEN.NDC_M_FORMULARY
WHERE OGEN.DATEONLY(CREATED_ON) BETWEEN OGEN.DATEONLY(@START_DATE) AND OGEN.DATEONLY(@END_DATE)
AND FACILITY_KEY IN (SELECT VALUE FROM OGEN.COMMA_TO_TABLE(@FACILITY_KEY))
**AND CAST(FLAGS AS BIGINT) & 1 = 1**
GROUP BY OGEN.DATEONLY(CREATED_ON)
END
GO | sql | oracle | query | null | null | null | open | How to use Cast in Oracle sp
===
in follwing "AND CAST(FLAGS AS BIGINT) & 1 = 1" how to write this for an Oracle sp we have to allow app to handle Oracle users as well.
ALTER PROCEDURE [OGEN].[DBD_GET_STOCK_SUMMARY]
@FACILITY_KEY VARCHAR(1000),
@START_DATE DATETIME,
@END_DATE DATETIME
AS
BEGIN
SELECT COUNT(*) COUNT, OGEN.DATEONLY(CREATED_ON) [DATE]
FROM OGEN.NDC_M_FORMULARY
WHERE OGEN.DATEONLY(CREATED_ON) BETWEEN OGEN.DATEONLY(@START_DATE) AND OGEN.DATEONLY(@END_DATE)
AND FACILITY_KEY IN (SELECT VALUE FROM OGEN.COMMA_TO_TABLE(@FACILITY_KEY))
**AND CAST(FLAGS AS BIGINT) & 1 = 1**
GROUP BY OGEN.DATEONLY(CREATED_ON)
END
GO | 0 |
11,351,173 | 07/05/2012 19:25:11 | 1,266,554 | 03/13/2012 13:19:54 | 7 | 0 | How to hack the HTML response from Apache HTTPD? | I need to include some HTML fragments (into the <head> element) for each page that is handle by HTTPD. Why? I need to hack some natives javascript functions for security policy needs.
Thank you. | httpd | null | null | null | null | null | open | How to hack the HTML response from Apache HTTPD?
===
I need to include some HTML fragments (into the <head> element) for each page that is handle by HTTPD. Why? I need to hack some natives javascript functions for security policy needs.
Thank you. | 0 |
11,351,175 | 07/05/2012 19:25:15 | 1,504,939 | 07/05/2012 18:53:57 | 1 | 0 | scroll content under image without interruption | I have a div loading content from an other html page with a banner over it. I would like to know if it's technically possible to create a text who moves, without going under the banner so without interruption.
I'm using jScrollPane:
<li id="menu1"><div class="link-bg"><a href="#sur-toute-la-ligne">SUR TOUTE LA LIGNE</b></a></div></li>
What did you suggest me?
Thank you for your help. | javascript | null | null | null | null | null | open | scroll content under image without interruption
===
I have a div loading content from an other html page with a banner over it. I would like to know if it's technically possible to create a text who moves, without going under the banner so without interruption.
I'm using jScrollPane:
<li id="menu1"><div class="link-bg"><a href="#sur-toute-la-ligne">SUR TOUTE LA LIGNE</b></a></div></li>
What did you suggest me?
Thank you for your help. | 0 |
11,351,176 | 07/05/2012 19:25:15 | 1,504,466 | 07/05/2012 15:22:03 | 1 | 0 | Fetch the entire DataModel? (Core Data) | For the last few days I've been trying to build a simple load/save system for a game using Core Data. Either I'm totally missing something (read: I'm blind and/or stupid) or Core Data just isn't made for what I want to do with it.
Saving, loading and creating my UIManagedDocument works fine. Setting and loading values for attributes in my savegame entity works fine as well.
The problem is that these values are lost when my app quits, because I don't know how to access them.
I have about 200 attributes inside my savegame entity, such as (NSNumber *)currentIncome, (NSNumber *)currentMoney, (NSNumber *)currentMonth etc. Seems simple, right? If I were to group these into attributes with relationships, I'd probably end up with about 20 attributes. From what I gathered from the Core Data Programming Guide, in order to fill the entity with the values from my saved UIManagedDocument, I need to perform a fetchrequest with a predicate which fills an array of results.
This is where my first question arises: Would I need to perform a fetchrequest for every single attribute? This seems useful if you only have a few attributes or if you have 'to many' relationships. In my case, this would seem incredibly tedious though.
I might be missing something very essential here, but I would need something like "load my UIManagedDocument and automatically fill my NSManagedModel with the one that was saved in the document's context" and I cannot find it.
That is where my second question comes in: Is CoreData and UIManagedDocument even the right approach for this? 200 variables is too much for NSUserDefaults - I could imagine using NSCoding though. I definately want to incorporate iCloud savegame sharing at a later point, and UIManagedDocument and CoreData just seemed perfect for this. | core-data | nsmanagedobject | uimanageddocument | null | null | null | open | Fetch the entire DataModel? (Core Data)
===
For the last few days I've been trying to build a simple load/save system for a game using Core Data. Either I'm totally missing something (read: I'm blind and/or stupid) or Core Data just isn't made for what I want to do with it.
Saving, loading and creating my UIManagedDocument works fine. Setting and loading values for attributes in my savegame entity works fine as well.
The problem is that these values are lost when my app quits, because I don't know how to access them.
I have about 200 attributes inside my savegame entity, such as (NSNumber *)currentIncome, (NSNumber *)currentMoney, (NSNumber *)currentMonth etc. Seems simple, right? If I were to group these into attributes with relationships, I'd probably end up with about 20 attributes. From what I gathered from the Core Data Programming Guide, in order to fill the entity with the values from my saved UIManagedDocument, I need to perform a fetchrequest with a predicate which fills an array of results.
This is where my first question arises: Would I need to perform a fetchrequest for every single attribute? This seems useful if you only have a few attributes or if you have 'to many' relationships. In my case, this would seem incredibly tedious though.
I might be missing something very essential here, but I would need something like "load my UIManagedDocument and automatically fill my NSManagedModel with the one that was saved in the document's context" and I cannot find it.
That is where my second question comes in: Is CoreData and UIManagedDocument even the right approach for this? 200 variables is too much for NSUserDefaults - I could imagine using NSCoding though. I definately want to incorporate iCloud savegame sharing at a later point, and UIManagedDocument and CoreData just seemed perfect for this. | 0 |
11,351,178 | 07/05/2012 19:25:19 | 1,303,116 | 03/30/2012 11:23:16 | 2,924 | 157 | Python: Shortest way to extract and count elements from an array of String? | I'm very new to Python and do know that my question is very simple but I've not found an existed question on SO yet.
I have an array contains string elements. Now I want to extract elements and count the number of appearances of them, them sort in descending order.
For example:
['ab' 'ab' 'ac']
then the output should be:
'ab' 2
'ac' 1
Also, it's bad of me that I don't know what is the best way to store my output (in a map, hash... or something like that? Again, I'm not sure)...
Thanks for any help. | python | null | null | null | null | null | open | Python: Shortest way to extract and count elements from an array of String?
===
I'm very new to Python and do know that my question is very simple but I've not found an existed question on SO yet.
I have an array contains string elements. Now I want to extract elements and count the number of appearances of them, them sort in descending order.
For example:
['ab' 'ab' 'ac']
then the output should be:
'ab' 2
'ac' 1
Also, it's bad of me that I don't know what is the best way to store my output (in a map, hash... or something like that? Again, I'm not sure)...
Thanks for any help. | 0 |
11,351,180 | 07/05/2012 19:25:20 | 1,504,990 | 07/05/2012 19:18:51 | 1 | 0 | What is the default font in macvim, and how does one check this? | I know how to **change** the font properties, but I don't know how to check what the **default** one is. I would appreciate if someone showed me how to check what the default font is. | unix | vim | macvim | null | null | null | open | What is the default font in macvim, and how does one check this?
===
I know how to **change** the font properties, but I don't know how to check what the **default** one is. I would appreciate if someone showed me how to check what the default font is. | 0 |
11,351,183 | 07/05/2012 19:25:34 | 608,259 | 02/08/2011 14:24:22 | 161 | 1 | How to get XML tag value in Python | I have some XML in a unicode-string variable in Python as follows:
<?xml version='1.0' encoding='UTF-8'?>
<results preview='0'>
<meta>
<fieldOrder>
<field>count</field>
</fieldOrder>
</meta>
<result offset='0'>
<field k='count'>
<value><text>6</text></value>
</field>
</result>
</results>
How do I extract the `6` in `<value><text>6</text></value>` using Python?
| python | xml | parsing | dom | xml-parsing | null | open | How to get XML tag value in Python
===
I have some XML in a unicode-string variable in Python as follows:
<?xml version='1.0' encoding='UTF-8'?>
<results preview='0'>
<meta>
<fieldOrder>
<field>count</field>
</fieldOrder>
</meta>
<result offset='0'>
<field k='count'>
<value><text>6</text></value>
</field>
</result>
</results>
How do I extract the `6` in `<value><text>6</text></value>` using Python?
| 0 |
11,351,191 | 07/05/2012 19:26:00 | 615,732 | 02/14/2011 05:15:57 | 54 | 1 | Gnat create process without console | I need an application that will run silently in the background, yet still interact with the current user's desktop, and is not a service.
I want the application to start without spawning a stdout console.
In C, it seems to be done using FreeConsole in Kernel32.dll, so I imported the function:
procedure Free_Console
is
use System;
type Shared_Library_Function
is access function
return Interfaces.C.Int;
pragma Convention(Stdcall, Shared_Library_Function);
function To_Shared_Library_Function
is new Ada.Unchecked_Conversion(System.Address, Shared_Library_Function);
function Load_Library(
File_Name : in Interfaces.C.Char_Array)
return System.Address;
pragma Import(Stdcall, Load_Library, "LoadLibrary", "_LoadLibraryA@4");
function Get_Function_Address(
Module : in System.Address;
Function_Name : in Char_Array)
return System.Address;
pragma Import(stdcall, Get_Function_Address, "GetProcAddress", "_GetProcAddress@8");
Library : System.Address := Load_Library(To_C("kernel32.dll"));
Pointer : System.Address := Get_Function_Address(Library, To_C("FreeConsole"));
begin
if Pointer /= System.Null_Address then
declare
Result : Interfaces.C.Int := 1;
begin
Result := To_Shared_Library_Function(Pointer).all;
end;
else
-- TODO Handle Error
null;
end if;
end Free_Console;
This only detaches the process from the console, it doesn't remove the console. Details about this behavior found [here][1]
So I tried to keep track of the handle to the window, and then CloseHandle() it.
function Get_Console_Handle
return System.Address
is
use System;
STD_INPUT_HANDLE : constant Interfaces.C.Unsigned_Long := -10;
STD_OUTPUT_HANDLE : constant Interfaces.C.Unsigned_Long := -11;
STD_ERROR_HANDLE : constant Interfaces.C.Unsigned_Long := -12;
type Shared_Library_Function
is access function(
Standard_Handle : Interfaces.C.Unsigned_Long)
return System.Address;
pragma Convention(Stdcall, Shared_Library_Function);
function To_Shared_Library_Function
is new Ada.Unchecked_Conversion(System.Address, Shared_Library_Function);
function Load_Library(
File_Name : in Interfaces.C.Char_Array)
return System.Address;
pragma Import(Stdcall, Load_Library, "LoadLibrary", "_LoadLibraryA@4");
function Get_Function_Address(
Module : in System.Address;
Function_Name : in Char_Array)
return System.Address;
pragma Import(stdcall, Get_Function_Address, "GetProcAddress", "_GetProcAddress@8");
Library : System.Address := Load_Library(To_C("kernel32.dll"));
Pointer : System.Address := Get_Function_Address(Library, To_C("GetStdHandle"));
begin
if Pointer /= System.Null_Address then
return To_Shared_Library_Function(Pointer).all(STD_OUTPUT_HANDLE);
else
return System.Null_Address;
end if;
end Get_Console_Handle;
--winbase.CloseHandle
function Close_Handle(
Object_Handle : in System.Address)
return Interfaces.C.Int;
pragma Import(Stdcall, "CloseHandle");
This doesn't do anything either. I bet the Get_Console_Handle returns an incorrect handle.
My question is, is there a Gnat command line option to not create a console window, or a way of closing the console window?
[1]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms683150(v=vs.85).aspx | ada | gnat | null | null | null | null | open | Gnat create process without console
===
I need an application that will run silently in the background, yet still interact with the current user's desktop, and is not a service.
I want the application to start without spawning a stdout console.
In C, it seems to be done using FreeConsole in Kernel32.dll, so I imported the function:
procedure Free_Console
is
use System;
type Shared_Library_Function
is access function
return Interfaces.C.Int;
pragma Convention(Stdcall, Shared_Library_Function);
function To_Shared_Library_Function
is new Ada.Unchecked_Conversion(System.Address, Shared_Library_Function);
function Load_Library(
File_Name : in Interfaces.C.Char_Array)
return System.Address;
pragma Import(Stdcall, Load_Library, "LoadLibrary", "_LoadLibraryA@4");
function Get_Function_Address(
Module : in System.Address;
Function_Name : in Char_Array)
return System.Address;
pragma Import(stdcall, Get_Function_Address, "GetProcAddress", "_GetProcAddress@8");
Library : System.Address := Load_Library(To_C("kernel32.dll"));
Pointer : System.Address := Get_Function_Address(Library, To_C("FreeConsole"));
begin
if Pointer /= System.Null_Address then
declare
Result : Interfaces.C.Int := 1;
begin
Result := To_Shared_Library_Function(Pointer).all;
end;
else
-- TODO Handle Error
null;
end if;
end Free_Console;
This only detaches the process from the console, it doesn't remove the console. Details about this behavior found [here][1]
So I tried to keep track of the handle to the window, and then CloseHandle() it.
function Get_Console_Handle
return System.Address
is
use System;
STD_INPUT_HANDLE : constant Interfaces.C.Unsigned_Long := -10;
STD_OUTPUT_HANDLE : constant Interfaces.C.Unsigned_Long := -11;
STD_ERROR_HANDLE : constant Interfaces.C.Unsigned_Long := -12;
type Shared_Library_Function
is access function(
Standard_Handle : Interfaces.C.Unsigned_Long)
return System.Address;
pragma Convention(Stdcall, Shared_Library_Function);
function To_Shared_Library_Function
is new Ada.Unchecked_Conversion(System.Address, Shared_Library_Function);
function Load_Library(
File_Name : in Interfaces.C.Char_Array)
return System.Address;
pragma Import(Stdcall, Load_Library, "LoadLibrary", "_LoadLibraryA@4");
function Get_Function_Address(
Module : in System.Address;
Function_Name : in Char_Array)
return System.Address;
pragma Import(stdcall, Get_Function_Address, "GetProcAddress", "_GetProcAddress@8");
Library : System.Address := Load_Library(To_C("kernel32.dll"));
Pointer : System.Address := Get_Function_Address(Library, To_C("GetStdHandle"));
begin
if Pointer /= System.Null_Address then
return To_Shared_Library_Function(Pointer).all(STD_OUTPUT_HANDLE);
else
return System.Null_Address;
end if;
end Get_Console_Handle;
--winbase.CloseHandle
function Close_Handle(
Object_Handle : in System.Address)
return Interfaces.C.Int;
pragma Import(Stdcall, "CloseHandle");
This doesn't do anything either. I bet the Get_Console_Handle returns an incorrect handle.
My question is, is there a Gnat command line option to not create a console window, or a way of closing the console window?
[1]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms683150(v=vs.85).aspx | 0 |
11,628,551 | 07/24/2012 10:05:50 | 1,543,891 | 07/22/2012 11:46:07 | 9 | 0 | MySQL Order by after SUM | I've worked out this bit of code for a question i have:
SELECT Event_id, SUM(Money) AS 'Total Money'
FROM prize
GROUP BY Event_id
ORDER BY 'Total Money' DESC;
However it does not order by the total money. If i omit the ' ' marks and call the column Total_Money, it works fine:
SELECT Event_id, SUM(Money) AS Total_Money
FROM prize
GROUP BY Event_id
ORDER BY Total_Money DESC
Why is this?
Is there a way to call the column Total Money and sort how i want? | mysql | order | sum | null | null | null | open | MySQL Order by after SUM
===
I've worked out this bit of code for a question i have:
SELECT Event_id, SUM(Money) AS 'Total Money'
FROM prize
GROUP BY Event_id
ORDER BY 'Total Money' DESC;
However it does not order by the total money. If i omit the ' ' marks and call the column Total_Money, it works fine:
SELECT Event_id, SUM(Money) AS Total_Money
FROM prize
GROUP BY Event_id
ORDER BY Total_Money DESC
Why is this?
Is there a way to call the column Total Money and sort how i want? | 0 |
11,628,558 | 07/24/2012 10:05:58 | 1,548,289 | 07/24/2012 09:59:46 | 1 | 0 | Every line of text file into new row | I need to insert every line of a text file the user can upload into a new row.
The code I'm using now:
include_once "config.php"; //includes all the DB info
if ($_FILES["file"]["error"] > 0)
{
echo $_FILES["file"]["error"];
}
if (file_exists("uploads/" . $_FILES["file"]["name"]))
{
echo "This file does already exist";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"], "tablefile.txt");
}
$thefile = "/tablefile.txt";
$result = mysql_query("LOAD DATA INFILE '$thefile'" .
" INTO TABLE testtable FIELDS TERMINATED BY ' '");
if (!$result) {
die("Could not load. " . mysql_error());
}
mysql_close($dbconnect);
echo "uploaded";
The text file for example looks like:
20281
28291
27819
17282
I need the script to insert every code in the text file into a seperate line in the SQL database. Every code in the txt file is on a new line.
Would be great if someone could help me out here.
Thanks
| php | sql | file | text | null | null | open | Every line of text file into new row
===
I need to insert every line of a text file the user can upload into a new row.
The code I'm using now:
include_once "config.php"; //includes all the DB info
if ($_FILES["file"]["error"] > 0)
{
echo $_FILES["file"]["error"];
}
if (file_exists("uploads/" . $_FILES["file"]["name"]))
{
echo "This file does already exist";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"], "tablefile.txt");
}
$thefile = "/tablefile.txt";
$result = mysql_query("LOAD DATA INFILE '$thefile'" .
" INTO TABLE testtable FIELDS TERMINATED BY ' '");
if (!$result) {
die("Could not load. " . mysql_error());
}
mysql_close($dbconnect);
echo "uploaded";
The text file for example looks like:
20281
28291
27819
17282
I need the script to insert every code in the text file into a seperate line in the SQL database. Every code in the txt file is on a new line.
Would be great if someone could help me out here.
Thanks
| 0 |
11,628,584 | 07/24/2012 10:07:23 | 1,439,116 | 06/06/2012 07:34:15 | 140 | 2 | jdk 7 watch service api and file permission | We are using `Watch Service Api` (jdk 7) to tracking the file create in my system. And Up till now all thing are work ok. Every file is created on my system tracked by my program.
But we have trouble that when we use NFS (the directory we track actually existed on another computer in LAN).
This code track seem not work.
Can any one tell me how to work around this situation. How can I setup NFS to support `Watch service api` java jdk7 or can anyone tell me a better library.
thanks all | java | filesystems | filesystemwatcher | java-io | jdk7 | null | open | jdk 7 watch service api and file permission
===
We are using `Watch Service Api` (jdk 7) to tracking the file create in my system. And Up till now all thing are work ok. Every file is created on my system tracked by my program.
But we have trouble that when we use NFS (the directory we track actually existed on another computer in LAN).
This code track seem not work.
Can any one tell me how to work around this situation. How can I setup NFS to support `Watch service api` java jdk7 or can anyone tell me a better library.
thanks all | 0 |
11,628,586 | 07/24/2012 10:07:45 | 1,033,200 | 11/07/2011 05:32:14 | 333 | 8 | custom scroll bar extending with auto content | I have added the accordion inside the custom scroll bar div but if the content of the accordion is more, the scroll bar is not extending. It will extend only plain content is added (by removing accordion).
Here is my html
<div id="scrollbar1">
<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
<div class="viewport">
<div class="overview">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td>
<!--Accordion starts here-->
<ul class="acc" id="nested">
<li>
<h3><a href="#">test<span>3 Modules Missing</span></a> </h3>
<div class="acc-section">
<div class="acc-content">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tb">
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
</table>
</div>
</div>
</li>
<li>
<h3><a href="#">sss 3</a></h3>
<div class="acc-section">
<div class="acc-content">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tb">
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
</table>
</div>
</div>
</li>
</ul>
<!--Accordion ends here-->
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
And CSS is
/* Tiny Scrollbar */
#scrollbar1 { width:100%; background-color:#eeeae0}
#scrollbar1 .viewport { width: 98.9%; height: 440px; overflow: hidden; position: relative; }
#scrollbar1 .overview { list-style: none; width:990px; position: absolute; left: 0; top: 0; padding: 0; margin: 0; }
#scrollbar1 .scrollbar{ background: transparent url(../images/bg-scrollbar-track-y.png) repeat-y ; position: relative; background-position: 0 0; float: right; width: 10px; }
#scrollbar1 .thumb { background: transparent url(../images/bg-scrollbar-thumb-y.png) no-repeat 0 0; height: 20px; width: 10px; cursor: pointer; overflow: hidden; position: absolute; top: 0; left:0; }
#scrollbar1 .disable { display: none; }
/*accordion*/
#nested {width:100%; list-style:none; margin:0}
#nested h3 {
background-color: #DADADA;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FCFCFC), to(#DADADA));
background: -moz-linear-gradient(top, #FCFCFC 0%, #DADADA 100%); margin:6px 0 0 0; padding:0
}
#nested h3 a {
display:block;
padding: 3px 16px; margin:0 6px;
background-color: #DADADA;
background: url(../images/clps_arrw.png) no-repeat left, -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FCFCFC), to(#DADADA));
background: url(../images/clps_arrw.png) no-repeat left, -moz-linear-gradient(top, #FCFCFC 0%, #DADADA 100%);
font: bold 12px "Helvetica Neue", Helvetica, Arial, sans-serif;
color:#1e1e1e; text-decoration:none; line-height:26px}
#nested .acc-section {overflow:hidden; }
#nested h3 a:hover { color: #000;}
#nested .acc-selected a { color: #1e1e1e; background:url(../images/clps_arrw_dwn.png) no-repeat left;}
#nested .acc-selected a:hover { color: #1e1e1e; background:url(../images/clps_arrw_dwn.png) no-repeat left;}
#nested span{ background-color:#990e0e; border-radius:4px; display:inline-block; padding:2px 6px; font: bold 11px "Helvetica Neue", Helvetica, Arial, sans-serif; color:#e6e0d3; margin-left:8px;}
| html5 | css3 | scrollbar | accordion | null | null | open | custom scroll bar extending with auto content
===
I have added the accordion inside the custom scroll bar div but if the content of the accordion is more, the scroll bar is not extending. It will extend only plain content is added (by removing accordion).
Here is my html
<div id="scrollbar1">
<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
<div class="viewport">
<div class="overview">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td>
<!--Accordion starts here-->
<ul class="acc" id="nested">
<li>
<h3><a href="#">test<span>3 Modules Missing</span></a> </h3>
<div class="acc-section">
<div class="acc-content">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tb">
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
</table>
</div>
</div>
</li>
<li>
<h3><a href="#">sss 3</a></h3>
<div class="acc-section">
<div class="acc-content">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tb">
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
<tr>
<td> </td>
<td>test 1</td>
<td>test added </td>
<td>test</td>
</tr>
</table>
</div>
</div>
</li>
</ul>
<!--Accordion ends here-->
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
And CSS is
/* Tiny Scrollbar */
#scrollbar1 { width:100%; background-color:#eeeae0}
#scrollbar1 .viewport { width: 98.9%; height: 440px; overflow: hidden; position: relative; }
#scrollbar1 .overview { list-style: none; width:990px; position: absolute; left: 0; top: 0; padding: 0; margin: 0; }
#scrollbar1 .scrollbar{ background: transparent url(../images/bg-scrollbar-track-y.png) repeat-y ; position: relative; background-position: 0 0; float: right; width: 10px; }
#scrollbar1 .thumb { background: transparent url(../images/bg-scrollbar-thumb-y.png) no-repeat 0 0; height: 20px; width: 10px; cursor: pointer; overflow: hidden; position: absolute; top: 0; left:0; }
#scrollbar1 .disable { display: none; }
/*accordion*/
#nested {width:100%; list-style:none; margin:0}
#nested h3 {
background-color: #DADADA;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FCFCFC), to(#DADADA));
background: -moz-linear-gradient(top, #FCFCFC 0%, #DADADA 100%); margin:6px 0 0 0; padding:0
}
#nested h3 a {
display:block;
padding: 3px 16px; margin:0 6px;
background-color: #DADADA;
background: url(../images/clps_arrw.png) no-repeat left, -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FCFCFC), to(#DADADA));
background: url(../images/clps_arrw.png) no-repeat left, -moz-linear-gradient(top, #FCFCFC 0%, #DADADA 100%);
font: bold 12px "Helvetica Neue", Helvetica, Arial, sans-serif;
color:#1e1e1e; text-decoration:none; line-height:26px}
#nested .acc-section {overflow:hidden; }
#nested h3 a:hover { color: #000;}
#nested .acc-selected a { color: #1e1e1e; background:url(../images/clps_arrw_dwn.png) no-repeat left;}
#nested .acc-selected a:hover { color: #1e1e1e; background:url(../images/clps_arrw_dwn.png) no-repeat left;}
#nested span{ background-color:#990e0e; border-radius:4px; display:inline-block; padding:2px 6px; font: bold 11px "Helvetica Neue", Helvetica, Arial, sans-serif; color:#e6e0d3; margin-left:8px;}
| 0 |
11,628,587 | 07/24/2012 10:07:48 | 1,548,293 | 07/24/2012 10:01:50 | 1 | 0 | Entity Framework - How to create base class for entity class? | I have three tables with same structure. I am using entity framework. I want to create generic function that accepts only that three class types. but i couldn't give more than one type in type parameter. Is there any way? or i want to add only base class, how to create base class because they are generated from entities? | c# | entity-framework | null | null | null | null | open | Entity Framework - How to create base class for entity class?
===
I have three tables with same structure. I am using entity framework. I want to create generic function that accepts only that three class types. but i couldn't give more than one type in type parameter. Is there any way? or i want to add only base class, how to create base class because they are generated from entities? | 0 |
11,628,588 | 07/24/2012 10:07:58 | 1,548,219 | 07/24/2012 09:35:25 | 1 | 0 | Generate dynamic sitemap with js? | I have a small site, it has a bit of dynamic tabbed content which is loaded from a JSON file via an AJAX request and used to populate the DOM, the tabs themselves and content they contain are all generated on the fly from this JSON. This is all tied together with History.js so each tab is bookmarkable and indexable via a url: ?state=whatever.
I'm now looking to put together a sitemap.xml to submit to Google which contains all the URLs for the relevant tabs.
However, There is no server-side processing for the site, it is all static content served up in an S3 bucket.
I'm looking to see if there is a way, using purely font-end technologies to generate the sitemap from the same JSON file which is used to populate the various tabs.
Any ideas or suggestions?
Thanks,
Robert | javascript | jquery | json | seo | sitemap | null | open | Generate dynamic sitemap with js?
===
I have a small site, it has a bit of dynamic tabbed content which is loaded from a JSON file via an AJAX request and used to populate the DOM, the tabs themselves and content they contain are all generated on the fly from this JSON. This is all tied together with History.js so each tab is bookmarkable and indexable via a url: ?state=whatever.
I'm now looking to put together a sitemap.xml to submit to Google which contains all the URLs for the relevant tabs.
However, There is no server-side processing for the site, it is all static content served up in an S3 bucket.
I'm looking to see if there is a way, using purely font-end technologies to generate the sitemap from the same JSON file which is used to populate the various tabs.
Any ideas or suggestions?
Thanks,
Robert | 0 |
11,601,127 | 07/22/2012 14:31:31 | 602,030 | 02/03/2011 18:08:45 | 424 | 15 | Anyone tried to create directional buttons with the <corners> tag? | For whatever reason the following style doesn't work. It creates a button with square corners. But I'm trying to have the two left corners square and the two right corners rounded to create a button with a directional shape.
Anyone have any idea?
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="0dp"
android:topLeftRadius="0dp"
android:bottomRightRadius="30dp"
android:topRightRadius="30dp" />
<gradient android:angle="90"
android:centerColor="#FFBD21"
android:endColor="#FFD060"
android:gradientRadius="60"
android:startColor="#FFAE18"
android:type="linear"
android:useLevel="false" />
</shape> | android | corners | xml-drawable | cornerradius | null | null | open | Anyone tried to create directional buttons with the <corners> tag?
===
For whatever reason the following style doesn't work. It creates a button with square corners. But I'm trying to have the two left corners square and the two right corners rounded to create a button with a directional shape.
Anyone have any idea?
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="0dp"
android:topLeftRadius="0dp"
android:bottomRightRadius="30dp"
android:topRightRadius="30dp" />
<gradient android:angle="90"
android:centerColor="#FFBD21"
android:endColor="#FFD060"
android:gradientRadius="60"
android:startColor="#FFAE18"
android:type="linear"
android:useLevel="false" />
</shape> | 0 |
11,628,595 | 07/24/2012 10:08:26 | 99,834 | 05/02/2009 12:01:45 | 8,851 | 220 | Unable to remotely connect to JMX? | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
`-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1100`
I checked, and I can telnet to this port, from both locally and remotely.
Still, VisualVM or jconsole are failing to connect, after spending some considerably time trying to.
REMOTE MACHINE with JMX (debian)
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
MY WORKSTATION (OS X)
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
What is the problem?
| java | jmx | null | null | null | null | open | Unable to remotely connect to JMX?
===
For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
`-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1100`
I checked, and I can telnet to this port, from both locally and remotely.
Still, VisualVM or jconsole are failing to connect, after spending some considerably time trying to.
REMOTE MACHINE with JMX (debian)
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
MY WORKSTATION (OS X)
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
What is the problem?
| 0 |
11,628,597 | 07/24/2012 10:08:31 | 1,178,820 | 01/30/2012 19:21:11 | 32 | 0 | Best way to apply shadow to each side of wrapper | I guess this is a very typical design, there is a full screen background image, and a centred wrapper for the content with a white background. The left and right edge of this white wrapper there is a neat shadow a few pixels wide. Similar to [this site][1].
What is the best way to achieve this? Background image (and if so, on what and how?) or border, something else? Any help appreciated.
[1]: http://www.santandersalt.co.uk/ | css | border | shadow | null | null | null | open | Best way to apply shadow to each side of wrapper
===
I guess this is a very typical design, there is a full screen background image, and a centred wrapper for the content with a white background. The left and right edge of this white wrapper there is a neat shadow a few pixels wide. Similar to [this site][1].
What is the best way to achieve this? Background image (and if so, on what and how?) or border, something else? Any help appreciated.
[1]: http://www.santandersalt.co.uk/ | 0 |
11,628,598 | 07/24/2012 10:08:35 | 1,226,418 | 02/22/2012 16:55:30 | 530 | 45 | How can I sum a column of large hours:mins:seconds figures in excel? | Using MS Excel 2010.
A column of hours, mins, secs e.g.
12345:34:34
12345:34:34
12345:34:34
Is totalled as
00000:00:00
The cells' format is set to [h]:mm:ss
Can anyone suggest a way of getting the correct answer please?
I've tried =a1+a2+a3 as well as =sum(a1:a3) | excel | null | null | null | null | null | open | How can I sum a column of large hours:mins:seconds figures in excel?
===
Using MS Excel 2010.
A column of hours, mins, secs e.g.
12345:34:34
12345:34:34
12345:34:34
Is totalled as
00000:00:00
The cells' format is set to [h]:mm:ss
Can anyone suggest a way of getting the correct answer please?
I've tried =a1+a2+a3 as well as =sum(a1:a3) | 0 |
11,628,600 | 07/24/2012 10:08:38 | 1,548,286 | 07/24/2012 09:58:22 | 1 | 0 | How to count number of "page-break-after" from dynamic content? | In my website, i'm getting product description from content management where user would add "style="page-break-after:always". My requirement is to hide the content after the first "page-break-after" and provide the link "more info" clicking which the hidden content should be visible.
Please help me with cross browser solution to identify the first "page-break-after" style using Jquery from the dynamic content. | jquery | get | styles | element | null | null | open | How to count number of "page-break-after" from dynamic content?
===
In my website, i'm getting product description from content management where user would add "style="page-break-after:always". My requirement is to hide the content after the first "page-break-after" and provide the link "more info" clicking which the hidden content should be visible.
Please help me with cross browser solution to identify the first "page-break-after" style using Jquery from the dynamic content. | 0 |
11,628,601 | 07/24/2012 10:08:44 | 1,548,280 | 07/24/2012 09:54:43 | 1 | 0 | reading data from a USB port | I wanna read temperature of the room using a thermocouple in and monitor it.I want to write my program in C#. can anyone help me?
( I prefer to use measurement studio and DAQmx) | c# | null | null | null | null | 07/25/2012 08:51:47 | not a real question | reading data from a USB port
===
I wanna read temperature of the room using a thermocouple in and monitor it.I want to write my program in C#. can anyone help me?
( I prefer to use measurement studio and DAQmx) | 1 |
11,628,602 | 07/24/2012 10:08:47 | 896,310 | 08/16/2011 08:51:45 | 87 | 0 | To manage xcode workspace | I have few iphone applications which uses same classes. These applications run fine, but I face problem when I want to change something in apps, suppose I want to add one new feature to all of my applications. For this I need to do same changes in all the projects. So I want to create a master application, which will contain all common resources of applications in it. Each application will take the resources from master app and add more if it has something extra. Can I use workspace concept here? I don't know much about workspace or dependency management in workspace. Can anybody help me in this matter? Please. Thanks in advance. | xcode | workspace | null | null | null | null | open | To manage xcode workspace
===
I have few iphone applications which uses same classes. These applications run fine, but I face problem when I want to change something in apps, suppose I want to add one new feature to all of my applications. For this I need to do same changes in all the projects. So I want to create a master application, which will contain all common resources of applications in it. Each application will take the resources from master app and add more if it has something extra. Can I use workspace concept here? I don't know much about workspace or dependency management in workspace. Can anybody help me in this matter? Please. Thanks in advance. | 0 |
11,411,297 | 07/10/2012 10:23:35 | 1,281,694 | 03/20/2012 18:27:34 | 35 | 0 | Xcode move Storyboard elements more precisely | Is it possibly to move storyboard elements in smaller steps than it is possibly by pressing the arrow keys on the keyboard? | xcode | storyboard | null | null | null | null | open | Xcode move Storyboard elements more precisely
===
Is it possibly to move storyboard elements in smaller steps than it is possibly by pressing the arrow keys on the keyboard? | 0 |
11,411,298 | 07/10/2012 10:23:36 | 1,164,485 | 01/23/2012 07:34:24 | 1,121 | 28 | Is ThreadAbortException to be expected in a HTTP handler on Windows Azure? | I have an ASP.NET HTTP handler hosted on Windows Azure in a "small" compute instance. It handles downloads and uploads of large binary files. Nothing else runs within that web role, and there are 2 instances configured, as per guidelines. When a download is done from a computer with a slow connection and I try to perform several downloads at once to choke the bandwidth on the client side, sometimes I get a `ThreadAbortException` in the handler, most often during a `.Write` to the `Response.OutputStream` (I set `Response.BufferOutput = false` beforehand). The stack trace is as follows:
System.Threading.ThreadAbortException: Thread was being aborted.
at System.Web.Hosting.UnsafeIISMethods.MgdExplicitFlush(IntPtr context)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush)
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at MyHandler.ProcessGetRequest(HttpContext context)
at MyHandler.ProcessRequest(HttpContext context)
(the `Stream.Write` call is apparently inlined so it does not show in the stack trace).
Why is the thread being aborted? I am guessing I am hitting some kind of a timeout (possibly a socket write timeout), is aborting the thread a normal way for the ASP.NET runtime to handle it?
Note that it is a single HTTP handler, not an .aspx/.cshtml page or MVC controller, and nowhere in my code am I touching `Response.End`, `Response.Redirect` or `Server.Transfer`. | asp.net | azure | httphandler | null | null | null | open | Is ThreadAbortException to be expected in a HTTP handler on Windows Azure?
===
I have an ASP.NET HTTP handler hosted on Windows Azure in a "small" compute instance. It handles downloads and uploads of large binary files. Nothing else runs within that web role, and there are 2 instances configured, as per guidelines. When a download is done from a computer with a slow connection and I try to perform several downloads at once to choke the bandwidth on the client side, sometimes I get a `ThreadAbortException` in the handler, most often during a `.Write` to the `Response.OutputStream` (I set `Response.BufferOutput = false` beforehand). The stack trace is as follows:
System.Threading.ThreadAbortException: Thread was being aborted.
at System.Web.Hosting.UnsafeIISMethods.MgdExplicitFlush(IntPtr context)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush)
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at MyHandler.ProcessGetRequest(HttpContext context)
at MyHandler.ProcessRequest(HttpContext context)
(the `Stream.Write` call is apparently inlined so it does not show in the stack trace).
Why is the thread being aborted? I am guessing I am hitting some kind of a timeout (possibly a socket write timeout), is aborting the thread a normal way for the ASP.NET runtime to handle it?
Note that it is a single HTTP handler, not an .aspx/.cshtml page or MVC controller, and nowhere in my code am I touching `Response.End`, `Response.Redirect` or `Server.Transfer`. | 0 |
11,411,301 | 07/10/2012 10:23:50 | 1,432,009 | 06/02/2012 05:30:02 | 15 | 1 | thread main exiting due to uncaught exception in jpct game engine | I am trying to run a demo of JPCT. But run time error is happening. My code is below.//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package com.JPCTDemo;
import java.lang.reflect.Field;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.opengles.GL10;
import android.app.Activity;
import android.content.res.Resources;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import com.threed.jpct.Camera;
import com.threed.jpct.Config;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Light;
import com.threed.jpct.Loader;
import com.threed.jpct.Logger;
import com.threed.jpct.Object3D;
import com.threed.jpct.RGBColor;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;
import com.threed.jpct.util.MemoryHelper;
public class JPCTDemo extends Activity {
// Used to handle pause and resume...
private static JPCTDemo master = null;
private GLSurfaceView mGLView;
private MyRenderer renderer = null;
private FrameBuffer fb = null;
private World world = null;
private int move = 0;
private float turn = 0;
private RGBColor back = new RGBColor(50, 50, 100);
private float touchTurn = 0;
private float touchTurnUp = 0;
private float xpos = -1;
private float ypos = -1;
private Texture planeReplace = null;
private Object3D plane = null;
private Object3D tree2 = null;
private Object3D tree1 = null;
private Object3D grass = null;
private Texture font = null;
private Object3D box = null;
private Object3D rock = null;
private Light sun = null;
protected void onCreate(Bundle savedInstanceState) {
Logger.log("onCreate");
if (master != null) {
copy(master);
}
super.onCreate(savedInstanceState);
mGLView = new GLSurfaceView(getApplication());
mGLView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
// Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
// back to Pixelflinger on some device (read: Samsung I7500)
int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
EGLConfig[] configs = new EGLConfig[1];
int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);
return configs[0];
}
});
renderer = new MyRenderer();
mGLView.setRenderer(renderer);
setContentView(mGLView);
}
@Override
protected void onPause() {
Logger.log("onPause");
super.onPause();
mGLView.onPause();
}
@Override
protected void onResume() {
Logger.log("onResume");
super.onResume();
mGLView.onResume();
}
protected void onStop() {
Logger.log("onStop");
super.onStop();
}
private void copy(Object src) {
try {
Logger.log("Copying data from master Activity!");
Field[] fs = src.getClass().getDeclaredFields();
for (Field f : fs) {
f.setAccessible(true);
f.set(this, f.get(src));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public boolean onTouchEvent(MotionEvent me) {
if (me.getAction() == MotionEvent.ACTION_DOWN) {
xpos = me.getX();
ypos = me.getY();
return true;
}
if (me.getAction() == MotionEvent.ACTION_UP) {
xpos = -1;
ypos = -1;
touchTurn = 0;
touchTurnUp = 0;
return true;
}
if (me.getAction() == MotionEvent.ACTION_MOVE) {
float xd = me.getX() - xpos;
float yd = me.getY() - ypos;
xpos = me.getX();
ypos = me.getY();
touchTurn = xd / 100f;
touchTurnUp = yd / 100f;
return true;
}
try {
Thread.sleep(15);
} catch (Exception e) {
// Doesn't matter here...
}
return super.onTouchEvent(me);
}
public boolean onKeyDown(int keyCode, KeyEvent msg) {
if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
move = 2;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
move = -2;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
turn = 0.05f;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
turn = -0.05f;
return true;
}
return super.onKeyDown(keyCode, msg);
}
public boolean onKeyUp(int keyCode, KeyEvent msg) {
if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
move = 0;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
move = 0;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
turn = 0;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
turn = 0;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
TextureManager.getInstance().replaceTexture("grassy", planeReplace);
return true;
}
return super.onKeyUp(keyCode, msg);
}
protected boolean isFullscreenOpaque() {
return true;
}
class MyRenderer implements GLSurfaceView.Renderer {
private int fps = 0;
private int lfps = 0;
private long time = System.currentTimeMillis();
private boolean stop = false;
private SimpleVector sunRot = new SimpleVector(0, 0.05f, 0);
public MyRenderer() {
Config.maxPolysVisible = 500;
Config.farPlane = 1500;
Config.glTransparencyMul = 0.1f;
Config.glTransparencyOffset = 0.1f;
Config.useVBO=true;
Texture.defaultToMipmapping(true);
Texture.defaultTo4bpp(true);
}
public void stop() {
stop = true;
}
public void onSurfaceChanged(GL10 gl, int w, int h) {
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(gl, w, h);
if (master == null) {
world = new World();
Resources res = getResources();
TextureManager tm = TextureManager.getInstance();
Texture grass2 = new Texture(res.openRawResource(R.raw.grassy));
Texture leaves = new Texture(res.openRawResource(R.raw.tree2y));
Texture leaves2 = new Texture(res.openRawResource(R.raw.tree3y));
Texture rocky = new Texture(res.openRawResource(R.raw.rocky));
Texture planetex = new Texture(res.openRawResource(R.raw.planetex));
planeReplace = new Texture(res.openRawResource(R.raw.rocky));
font = new Texture(res.openRawResource(R.raw.numbers));
font.setMipmap(false);
tm.addTexture("grass2", grass2);
tm.addTexture("leaves", leaves);
tm.addTexture("leaves2", leaves2);
tm.addTexture("rock", rocky);
tm.addTexture("grassy", planetex);
plane = Loader.loadSerializedObject(res.openRawResource(R.raw.serplane));
rock = Loader.loadSerializedObject(res.openRawResource(R.raw.serrock));
tree1 = Loader.loadSerializedObject(res.openRawResource(R.raw.sertree1));
tree2 = Loader.loadSerializedObject(res.openRawResource(R.raw.sertree2));
grass = Loader.loadSerializedObject(res.openRawResource(R.raw.sergrass));
grass.translate(-45, -17, -50);
grass.rotateZ((float) Math.PI);
rock.translate(0, 0, -90);
rock.rotateX(-(float) Math.PI / 2);
tree1.translate(-50, -92, -50);
tree1.rotateZ((float) Math.PI);
tree2.translate(60, -95, 10);
tree2.rotateZ((float) Math.PI);
plane.rotateX((float) Math.PI / 2f);
plane.setName("plane");
tree1.setName("tree1");
tree2.setName("tree2");
grass.setName("grass");
rock.setName("rock");
world.addObject(plane);
world.addObject(tree1);
world.addObject(tree2);
world.addObject(grass);
world.addObject(rock);
plane.strip();
tree1.strip();
tree2.strip();
grass.strip();
rock.strip();
grass.setTransparency(10);
tree1.setTransparency(40);
tree2.setTransparency(40);
RGBColor dark = new RGBColor(100, 100, 100);
tree1.setAdditionalColor(dark);
tree2.setAdditionalColor(dark);
grass.setAdditionalColor(dark);
world.setAmbientLight(20, 20, 20);
world.buildAllObjects();
sun = new Light(world);
sun.setIntensity(250, 250, 250);
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 250);
cam.moveCamera(Camera.CAMERA_MOVEUP, 100);
cam.lookAt(plane.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(plane.getTransformedCenter());
sv.y -= 300;
sv.x -= 100;
sv.z += 200;
sun.setPosition(sv);
MemoryHelper.compact();
if (master == null) {
Logger.log("Saving master Activity!");
master = JPCTDemo.this;
}
}
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
Logger.log("onSurfaceCreated");
}
public void onDrawFrame(GL10 gl) {
try {
if (!stop) {
Camera cam = world.getCamera();
if (turn != 0) {
world.getCamera().rotateY(-turn);
}
if (touchTurn != 0) {
world.getCamera().rotateY(touchTurn);
touchTurn = 0;
}
if (touchTurnUp != 0) {
world.getCamera().rotateX(touchTurnUp);
touchTurnUp = 0;
}
if (move != 0) {
world.getCamera().moveCamera(cam.getDirection(), move);
}
fb.clear(back);
world.renderScene(fb);
world.draw(fb);
blitNumber(lfps, 5, 5);
fb.display();
if (box != null) {
box.rotateX(0.01f);
}
if (sun != null) {
sun.rotate(sunRot, plane.getTransformedCenter());
}
if (System.currentTimeMillis() - time >= 1000) {
lfps = fps;
fps = 0;
time = System.currentTimeMillis();
}
fps++;
} else {
if (fb != null) {
fb.dispose();
fb = null;
}
}
} catch (Exception e) {
e.printStackTrace();
Logger.log("Drawing thread terminated!", Logger.MESSAGE);
}
}
private void blitNumber(int number, int x, int y) {
if (font != null) {
String sNum = Integer.toString(number);
for (int i = 0; i < sNum.length(); i++) {
char cNum = sNum.charAt(i);
int iNum = cNum - 48;
fb.blit(font, iNum * 5, 0, x, y, 5, 9, FrameBuffer.TRANSPARENT_BLITTING);
x += 5;
}
}
}
}
}
My logcat error is
07-10 16:01:48.679: E/dalvikvm(1417): Could not find class 'com.threed.jpct.RGBColor', referenced from method com.JPCTDemo.JPCTDemo.<init>
07-10 16:01:48.690: E/AndroidRuntime(1417): Uncaught handler: thread main exiting due to uncaught exception
07-10 16:01:48.699: E/AndroidRuntime(1417): java.lang.VerifyError: com.JPCTDemo.JPCTDemo
07-10 16:01:48.699: E/AndroidRuntime(1417): at java.lang.Class.newInstanceImpl(Native Method)
07-10 16:01:48.699: E/AndroidRuntime(1417): at java.lang.Class.newInstance(Class.java:1472)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.os.Looper.loop(Looper.java:123)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread.main(ActivityThread.java:4203)
07-10 16:01:48.699: E/AndroidRuntime(1417): at java.lang.reflect.Method.invokeNative(Native Method)
07-10 16:01:48.699: E/AndroidRuntime(1417): at java.lang.reflect.Method.invoke(Method.java:521)
07-10 16:01:48.699: E/AndroidRuntime(1417): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
07-10 16:01:48.699: E/AndroidRuntime(1417): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
07-10 16:01:48.699: E/AndroidRuntime(1417): at dalvik.system.NativeStart.main(Native Method)
07-10 16:01:48.709: E/dalvikvm(1417): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
Thanks advance for help
| jpct | null | null | null | null | null | open | thread main exiting due to uncaught exception in jpct game engine
===
I am trying to run a demo of JPCT. But run time error is happening. My code is below.//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package com.JPCTDemo;
import java.lang.reflect.Field;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.opengles.GL10;
import android.app.Activity;
import android.content.res.Resources;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import com.threed.jpct.Camera;
import com.threed.jpct.Config;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Light;
import com.threed.jpct.Loader;
import com.threed.jpct.Logger;
import com.threed.jpct.Object3D;
import com.threed.jpct.RGBColor;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;
import com.threed.jpct.util.MemoryHelper;
public class JPCTDemo extends Activity {
// Used to handle pause and resume...
private static JPCTDemo master = null;
private GLSurfaceView mGLView;
private MyRenderer renderer = null;
private FrameBuffer fb = null;
private World world = null;
private int move = 0;
private float turn = 0;
private RGBColor back = new RGBColor(50, 50, 100);
private float touchTurn = 0;
private float touchTurnUp = 0;
private float xpos = -1;
private float ypos = -1;
private Texture planeReplace = null;
private Object3D plane = null;
private Object3D tree2 = null;
private Object3D tree1 = null;
private Object3D grass = null;
private Texture font = null;
private Object3D box = null;
private Object3D rock = null;
private Light sun = null;
protected void onCreate(Bundle savedInstanceState) {
Logger.log("onCreate");
if (master != null) {
copy(master);
}
super.onCreate(savedInstanceState);
mGLView = new GLSurfaceView(getApplication());
mGLView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
// Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
// back to Pixelflinger on some device (read: Samsung I7500)
int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
EGLConfig[] configs = new EGLConfig[1];
int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);
return configs[0];
}
});
renderer = new MyRenderer();
mGLView.setRenderer(renderer);
setContentView(mGLView);
}
@Override
protected void onPause() {
Logger.log("onPause");
super.onPause();
mGLView.onPause();
}
@Override
protected void onResume() {
Logger.log("onResume");
super.onResume();
mGLView.onResume();
}
protected void onStop() {
Logger.log("onStop");
super.onStop();
}
private void copy(Object src) {
try {
Logger.log("Copying data from master Activity!");
Field[] fs = src.getClass().getDeclaredFields();
for (Field f : fs) {
f.setAccessible(true);
f.set(this, f.get(src));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public boolean onTouchEvent(MotionEvent me) {
if (me.getAction() == MotionEvent.ACTION_DOWN) {
xpos = me.getX();
ypos = me.getY();
return true;
}
if (me.getAction() == MotionEvent.ACTION_UP) {
xpos = -1;
ypos = -1;
touchTurn = 0;
touchTurnUp = 0;
return true;
}
if (me.getAction() == MotionEvent.ACTION_MOVE) {
float xd = me.getX() - xpos;
float yd = me.getY() - ypos;
xpos = me.getX();
ypos = me.getY();
touchTurn = xd / 100f;
touchTurnUp = yd / 100f;
return true;
}
try {
Thread.sleep(15);
} catch (Exception e) {
// Doesn't matter here...
}
return super.onTouchEvent(me);
}
public boolean onKeyDown(int keyCode, KeyEvent msg) {
if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
move = 2;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
move = -2;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
turn = 0.05f;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
turn = -0.05f;
return true;
}
return super.onKeyDown(keyCode, msg);
}
public boolean onKeyUp(int keyCode, KeyEvent msg) {
if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
move = 0;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
move = 0;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
turn = 0;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
turn = 0;
return true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
TextureManager.getInstance().replaceTexture("grassy", planeReplace);
return true;
}
return super.onKeyUp(keyCode, msg);
}
protected boolean isFullscreenOpaque() {
return true;
}
class MyRenderer implements GLSurfaceView.Renderer {
private int fps = 0;
private int lfps = 0;
private long time = System.currentTimeMillis();
private boolean stop = false;
private SimpleVector sunRot = new SimpleVector(0, 0.05f, 0);
public MyRenderer() {
Config.maxPolysVisible = 500;
Config.farPlane = 1500;
Config.glTransparencyMul = 0.1f;
Config.glTransparencyOffset = 0.1f;
Config.useVBO=true;
Texture.defaultToMipmapping(true);
Texture.defaultTo4bpp(true);
}
public void stop() {
stop = true;
}
public void onSurfaceChanged(GL10 gl, int w, int h) {
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(gl, w, h);
if (master == null) {
world = new World();
Resources res = getResources();
TextureManager tm = TextureManager.getInstance();
Texture grass2 = new Texture(res.openRawResource(R.raw.grassy));
Texture leaves = new Texture(res.openRawResource(R.raw.tree2y));
Texture leaves2 = new Texture(res.openRawResource(R.raw.tree3y));
Texture rocky = new Texture(res.openRawResource(R.raw.rocky));
Texture planetex = new Texture(res.openRawResource(R.raw.planetex));
planeReplace = new Texture(res.openRawResource(R.raw.rocky));
font = new Texture(res.openRawResource(R.raw.numbers));
font.setMipmap(false);
tm.addTexture("grass2", grass2);
tm.addTexture("leaves", leaves);
tm.addTexture("leaves2", leaves2);
tm.addTexture("rock", rocky);
tm.addTexture("grassy", planetex);
plane = Loader.loadSerializedObject(res.openRawResource(R.raw.serplane));
rock = Loader.loadSerializedObject(res.openRawResource(R.raw.serrock));
tree1 = Loader.loadSerializedObject(res.openRawResource(R.raw.sertree1));
tree2 = Loader.loadSerializedObject(res.openRawResource(R.raw.sertree2));
grass = Loader.loadSerializedObject(res.openRawResource(R.raw.sergrass));
grass.translate(-45, -17, -50);
grass.rotateZ((float) Math.PI);
rock.translate(0, 0, -90);
rock.rotateX(-(float) Math.PI / 2);
tree1.translate(-50, -92, -50);
tree1.rotateZ((float) Math.PI);
tree2.translate(60, -95, 10);
tree2.rotateZ((float) Math.PI);
plane.rotateX((float) Math.PI / 2f);
plane.setName("plane");
tree1.setName("tree1");
tree2.setName("tree2");
grass.setName("grass");
rock.setName("rock");
world.addObject(plane);
world.addObject(tree1);
world.addObject(tree2);
world.addObject(grass);
world.addObject(rock);
plane.strip();
tree1.strip();
tree2.strip();
grass.strip();
rock.strip();
grass.setTransparency(10);
tree1.setTransparency(40);
tree2.setTransparency(40);
RGBColor dark = new RGBColor(100, 100, 100);
tree1.setAdditionalColor(dark);
tree2.setAdditionalColor(dark);
grass.setAdditionalColor(dark);
world.setAmbientLight(20, 20, 20);
world.buildAllObjects();
sun = new Light(world);
sun.setIntensity(250, 250, 250);
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 250);
cam.moveCamera(Camera.CAMERA_MOVEUP, 100);
cam.lookAt(plane.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(plane.getTransformedCenter());
sv.y -= 300;
sv.x -= 100;
sv.z += 200;
sun.setPosition(sv);
MemoryHelper.compact();
if (master == null) {
Logger.log("Saving master Activity!");
master = JPCTDemo.this;
}
}
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
Logger.log("onSurfaceCreated");
}
public void onDrawFrame(GL10 gl) {
try {
if (!stop) {
Camera cam = world.getCamera();
if (turn != 0) {
world.getCamera().rotateY(-turn);
}
if (touchTurn != 0) {
world.getCamera().rotateY(touchTurn);
touchTurn = 0;
}
if (touchTurnUp != 0) {
world.getCamera().rotateX(touchTurnUp);
touchTurnUp = 0;
}
if (move != 0) {
world.getCamera().moveCamera(cam.getDirection(), move);
}
fb.clear(back);
world.renderScene(fb);
world.draw(fb);
blitNumber(lfps, 5, 5);
fb.display();
if (box != null) {
box.rotateX(0.01f);
}
if (sun != null) {
sun.rotate(sunRot, plane.getTransformedCenter());
}
if (System.currentTimeMillis() - time >= 1000) {
lfps = fps;
fps = 0;
time = System.currentTimeMillis();
}
fps++;
} else {
if (fb != null) {
fb.dispose();
fb = null;
}
}
} catch (Exception e) {
e.printStackTrace();
Logger.log("Drawing thread terminated!", Logger.MESSAGE);
}
}
private void blitNumber(int number, int x, int y) {
if (font != null) {
String sNum = Integer.toString(number);
for (int i = 0; i < sNum.length(); i++) {
char cNum = sNum.charAt(i);
int iNum = cNum - 48;
fb.blit(font, iNum * 5, 0, x, y, 5, 9, FrameBuffer.TRANSPARENT_BLITTING);
x += 5;
}
}
}
}
}
My logcat error is
07-10 16:01:48.679: E/dalvikvm(1417): Could not find class 'com.threed.jpct.RGBColor', referenced from method com.JPCTDemo.JPCTDemo.<init>
07-10 16:01:48.690: E/AndroidRuntime(1417): Uncaught handler: thread main exiting due to uncaught exception
07-10 16:01:48.699: E/AndroidRuntime(1417): java.lang.VerifyError: com.JPCTDemo.JPCTDemo
07-10 16:01:48.699: E/AndroidRuntime(1417): at java.lang.Class.newInstanceImpl(Native Method)
07-10 16:01:48.699: E/AndroidRuntime(1417): at java.lang.Class.newInstance(Class.java:1472)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.os.Looper.loop(Looper.java:123)
07-10 16:01:48.699: E/AndroidRuntime(1417): at android.app.ActivityThread.main(ActivityThread.java:4203)
07-10 16:01:48.699: E/AndroidRuntime(1417): at java.lang.reflect.Method.invokeNative(Native Method)
07-10 16:01:48.699: E/AndroidRuntime(1417): at java.lang.reflect.Method.invoke(Method.java:521)
07-10 16:01:48.699: E/AndroidRuntime(1417): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
07-10 16:01:48.699: E/AndroidRuntime(1417): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
07-10 16:01:48.699: E/AndroidRuntime(1417): at dalvik.system.NativeStart.main(Native Method)
07-10 16:01:48.709: E/dalvikvm(1417): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
Thanks advance for help
| 0 |
11,411,303 | 07/10/2012 10:23:55 | 108,207 | 05/16/2009 17:51:55 | 3,039 | 197 | Load third-party Ogre 3D xml model in jmonkeyengine? | I'm trying to load a model that comes with the WorldForge 3d models. When I do it I however get this exception and I suspect that the program can't find the model nor the textures:
com.jme3.asset.AssetNotFoundException: objects/creatures/goblin/goblin.mesh.xml
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:277)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:410)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:420)
at adventure.Main.simpleInitApp(Main.java:110)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:225)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
at java.lang.Thread.run(Thread.java:679)
The code I want to run that should import a goblin is
1
Spatial model3 = assetManager.loadModel("objects/creatures/goblin/goblin.mesh.xml");
Neither does an absolute path work.
Can you help me?
| java | eclipse | ubuntu | jmonkeyengine | null | null | open | Load third-party Ogre 3D xml model in jmonkeyengine?
===
I'm trying to load a model that comes with the WorldForge 3d models. When I do it I however get this exception and I suspect that the program can't find the model nor the textures:
com.jme3.asset.AssetNotFoundException: objects/creatures/goblin/goblin.mesh.xml
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:277)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:410)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:420)
at adventure.Main.simpleInitApp(Main.java:110)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:225)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
at java.lang.Thread.run(Thread.java:679)
The code I want to run that should import a goblin is
1
Spatial model3 = assetManager.loadModel("objects/creatures/goblin/goblin.mesh.xml");
Neither does an absolute path work.
Can you help me?
| 0 |
11,411,304 | 07/10/2012 10:23:56 | 906,805 | 08/22/2011 23:45:02 | 95 | 7 | order by count from another table | I hope itll be legal to post this as i'm aware of other similar posts on this topic. But im not able to get the other solutions to work, so trying to post my own scenario. Pretty much on the other examples like this one, im unsure how they use the tablenames and rows. is it through the punctuation?
SELECT bloggers.*, COUNT(post_id) AS post_count
FROM bloggers LEFT JOIN blogger_posts
ON bloggers.blogger_id = blogger_posts.blogger_id
GROUP BY bloggers.blogger_id
ORDER BY post_count
I have a table with articles, and a statistics table that gets new records every time an article is read. I am trying to make a query that sorts my article table by counting the number of records for that article id in the statistics table. like a "sort by views" functions.
my 2 tables:
**article**
id
**statistics**
pid <- same as article id
Looking at other examples im lacking the left join. just cant wrap my head around how to work that. my query at the moment looks like this:
$query = "SELECT *, COUNT(pid) AS views FROM statistics GROUP BY pid ORDER BY views DESC";
Any help is greatly appreciated! | mysql | count | order-by | left-join | null | null | open | order by count from another table
===
I hope itll be legal to post this as i'm aware of other similar posts on this topic. But im not able to get the other solutions to work, so trying to post my own scenario. Pretty much on the other examples like this one, im unsure how they use the tablenames and rows. is it through the punctuation?
SELECT bloggers.*, COUNT(post_id) AS post_count
FROM bloggers LEFT JOIN blogger_posts
ON bloggers.blogger_id = blogger_posts.blogger_id
GROUP BY bloggers.blogger_id
ORDER BY post_count
I have a table with articles, and a statistics table that gets new records every time an article is read. I am trying to make a query that sorts my article table by counting the number of records for that article id in the statistics table. like a "sort by views" functions.
my 2 tables:
**article**
id
**statistics**
pid <- same as article id
Looking at other examples im lacking the left join. just cant wrap my head around how to work that. my query at the moment looks like this:
$query = "SELECT *, COUNT(pid) AS views FROM statistics GROUP BY pid ORDER BY views DESC";
Any help is greatly appreciated! | 0 |
11,411,305 | 07/10/2012 10:23:57 | 1,341,708 | 04/18/2012 14:53:57 | 90 | 1 | Powershell: Foreach Input | I'm stuck on something that I know is really simple but for the life of me can't figure out.
I'm trying to import a .txt file with a list of hostnames, which once retrived, the script returns the amount of totalphysicalmemory installed.
so far I have this:
function get
{
$boxes = Get-Content C:\Temp\hostnamesforRAM.txt
foreach($box in $boxes)
{
Get-WmiObject Win32_ComputerSystem | select TotalPhysicalMemory
}
}
get
however, it just simply returns this:
4151570432
4151570432
4151570432
4151570432
4151570432
Any ideas?
Thanks
| powershell | foreach | ram | null | null | null | open | Powershell: Foreach Input
===
I'm stuck on something that I know is really simple but for the life of me can't figure out.
I'm trying to import a .txt file with a list of hostnames, which once retrived, the script returns the amount of totalphysicalmemory installed.
so far I have this:
function get
{
$boxes = Get-Content C:\Temp\hostnamesforRAM.txt
foreach($box in $boxes)
{
Get-WmiObject Win32_ComputerSystem | select TotalPhysicalMemory
}
}
get
however, it just simply returns this:
4151570432
4151570432
4151570432
4151570432
4151570432
Any ideas?
Thanks
| 0 |
11,411,306 | 07/10/2012 10:23:58 | 283,114 | 02/28/2010 14:54:48 | 353 | 11 | java.lang.ClassCastException: oracle.sql.BLOB cannot be cast to oracle.sql.BLOB | I have problem retrieving a blob object from oracle DB to java API with jdbc.
The problem is when I execute a Collable statement with a function from the db which return me a blob field this exception is thrown on the line :
`tempBlob = (oracle.sql.BLOB)cstmt.getObject(1);`
with this error message : java.lang.ClassCastException: oracle.sql.BLOB cannot be cast to oracle.sql.BLOB. The object which I get from the DB is a instance of oracle.sql.BLOB. The tempBlob
variable is a object oracle.sql.BLOB. Where is the problem? | java | oracle | blob | null | null | null | open | java.lang.ClassCastException: oracle.sql.BLOB cannot be cast to oracle.sql.BLOB
===
I have problem retrieving a blob object from oracle DB to java API with jdbc.
The problem is when I execute a Collable statement with a function from the db which return me a blob field this exception is thrown on the line :
`tempBlob = (oracle.sql.BLOB)cstmt.getObject(1);`
with this error message : java.lang.ClassCastException: oracle.sql.BLOB cannot be cast to oracle.sql.BLOB. The object which I get from the DB is a instance of oracle.sql.BLOB. The tempBlob
variable is a object oracle.sql.BLOB. Where is the problem? | 0 |
11,411,308 | 07/10/2012 10:24:04 | 1,508,641 | 07/07/2012 11:29:06 | 1 | 0 | User Interface Design in Android | I want to design the layouts programatically that means without the xml file as per project requirement.
But the terms used programatically is completely different from xml file.Is their any useful tutorial to learn programatically that means without xml file. guide me!
| android | null | null | null | null | null | open | User Interface Design in Android
===
I want to design the layouts programatically that means without the xml file as per project requirement.
But the terms used programatically is completely different from xml file.Is their any useful tutorial to learn programatically that means without xml file. guide me!
| 0 |
11,411,309 | 07/10/2012 10:24:09 | 1,480,052 | 06/25/2012 13:01:54 | 20 | 1 | OpenCV Image Manipulation | I am trying to find out the difference in 2 images.
Scenario: Suppose that i have 2 images, one of a background and the other of a person in front of the background, I want to subtract the two images in such a way that I get the position of the person, that is the program can detect where the person was standing and give the subtracted image as the output.
The code that I have managed to come up with is taking two images from the camera and re-sizing them and is converting both the images to gray scale. I wanted to know what to do after this. I checked the subtract function provided by OpenCV but it takes arrays as inputs so I don't know how to progress.
The code that I have written is:
cap>>frame; //gets the first image
cv::cvtColor(frame,frame,CV_RGB2GRAY); //converts it to gray scale
cv::resize(frame,frame,Size(30,30)); //re-sizes it
cap>>frame2;//gets the second image
cv::cvtColor(frame2,frame2,CV_RGB2GRAY); //converts it to gray scale
cv::resize(frame2,frame2,Size(30,30)); //re-sizes it
Now do I simply use the subtract function like:
cv::subtract(frame_gray,frame,frame);
or do I apply some filters first and then use the subtract function? | c++ | opencv | machine-learning | computer-vision | image-manipulation | null | open | OpenCV Image Manipulation
===
I am trying to find out the difference in 2 images.
Scenario: Suppose that i have 2 images, one of a background and the other of a person in front of the background, I want to subtract the two images in such a way that I get the position of the person, that is the program can detect where the person was standing and give the subtracted image as the output.
The code that I have managed to come up with is taking two images from the camera and re-sizing them and is converting both the images to gray scale. I wanted to know what to do after this. I checked the subtract function provided by OpenCV but it takes arrays as inputs so I don't know how to progress.
The code that I have written is:
cap>>frame; //gets the first image
cv::cvtColor(frame,frame,CV_RGB2GRAY); //converts it to gray scale
cv::resize(frame,frame,Size(30,30)); //re-sizes it
cap>>frame2;//gets the second image
cv::cvtColor(frame2,frame2,CV_RGB2GRAY); //converts it to gray scale
cv::resize(frame2,frame2,Size(30,30)); //re-sizes it
Now do I simply use the subtract function like:
cv::subtract(frame_gray,frame,frame);
or do I apply some filters first and then use the subtract function? | 0 |
11,411,311 | 07/10/2012 10:24:16 | 1,422,493 | 05/28/2012 21:49:10 | 3 | 1 | Getting nil from NSNumberformater numberFromString | I'm trying to format an amount from a .txt file coming in es_US locale(x,xxx.xx), to my current locale with is es_ES(x.xxx,xx). I would expect that [NSNumberFormater numberFromString] would just reformat the string, however and I'm only getting a nil value from this method.
I also tried another approach after checking the answers from here, but NSDecimalnumber does not work if the string has thousand separators, so if anybody could tell me what am I doing wrong please...
- (void) setSaldo_sap:(NSString *)saldo_sap{
NSNumberFormatter *numFormatter = [[NSNumberFormatter alloc] init];
[numFormatter setLocale:[NSLocale currentLocale]];
[numFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
[numFormatter setNegativeFormat:@"-¤#,##0.00"];
//saldo_sap = @" -324,234.55"
NSString * tmpString = [saldo_sap stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
//tmpString = @"-324,234.55"
NSNumber *num = [numFormatter numberFromString:tmpString];
//num = nill
NSDecimalNumber *tempNumber = [NSDecimalNumber decimalNumberWithString:tmpString];
//tempNumber = 324
_saldo_sap = [numFormatter stringFromNumber:tempNumber];
}
| objective-c | null | null | null | null | null | open | Getting nil from NSNumberformater numberFromString
===
I'm trying to format an amount from a .txt file coming in es_US locale(x,xxx.xx), to my current locale with is es_ES(x.xxx,xx). I would expect that [NSNumberFormater numberFromString] would just reformat the string, however and I'm only getting a nil value from this method.
I also tried another approach after checking the answers from here, but NSDecimalnumber does not work if the string has thousand separators, so if anybody could tell me what am I doing wrong please...
- (void) setSaldo_sap:(NSString *)saldo_sap{
NSNumberFormatter *numFormatter = [[NSNumberFormatter alloc] init];
[numFormatter setLocale:[NSLocale currentLocale]];
[numFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
[numFormatter setNegativeFormat:@"-¤#,##0.00"];
//saldo_sap = @" -324,234.55"
NSString * tmpString = [saldo_sap stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
//tmpString = @"-324,234.55"
NSNumber *num = [numFormatter numberFromString:tmpString];
//num = nill
NSDecimalNumber *tempNumber = [NSDecimalNumber decimalNumberWithString:tmpString];
//tempNumber = 324
_saldo_sap = [numFormatter stringFromNumber:tempNumber];
}
| 0 |
11,411,312 | 07/10/2012 10:24:21 | 1,514,425 | 07/10/2012 10:05:44 | 1 | 0 | Symfony memory issue | I've been struggling with symfony and memory leak
i did a small test to find out the reason of this leak
here is some raw php code to fetch one entry form the database and echo out one value
$old_memory = round(memory_get_usage() / 1024 , 2);
echo "memory stage1 $old_memory kb<br />";
mysql_connect('localhost', '*****','*****');
mysql_select_db('******');
$query = 'select * from sf_guard_user where id = 15 limit 1';
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
echo $row['username'].'<br />';
unset($query);
unset($result);
unset($row);
$new_memory = round(memory_get_usage() / 1024 , 2);
echo "memory stage2 $new_memory kb<br />";
echo "query_worth : " . ($new_memory - $old_memory) . " kb";
the result of the previous code is this
memory stage1 361.25 kb
Grandezza
memory stage2 367.31 kb
query_worth : 6.06 kb
then i've created an executeTest action to do the same with symfony and doctrine :
public function executeTest(sfWebRequest $request){
$old_memory = round(memory_get_usage() / 1024 , 2);
echo "memory stage1 $old_memory kb<br />";
$query = Doctrine_Core::getTable('sfGuardUser')->createQuery()->where('id = 15')->limit(1);
$result = $query->execute();
echo $result[0]['username']. '<br />';
$query->free(true);
unset($query);
$result->free(true);
unset($result);
$new_memory = round(memory_get_usage() / 1024 , 2);
echo "memory stage2 $new_memory kb<br />";
echo "query_worth : " . ($new_memory - $old_memory) . " kb";
exit();
}
which gives the following :
memory stage1 14700.48 kb
Grandezza
memory stage2 14690.6 kb
query_worth : -9.88 kb
i see that the query doesn't eat up memory at all however 15mb of ram get used every time i call this action !!! what gives ??!!
any tips how to deal with this
thanks | memory-leaks | symfony-1.4 | null | null | null | null | open | Symfony memory issue
===
I've been struggling with symfony and memory leak
i did a small test to find out the reason of this leak
here is some raw php code to fetch one entry form the database and echo out one value
$old_memory = round(memory_get_usage() / 1024 , 2);
echo "memory stage1 $old_memory kb<br />";
mysql_connect('localhost', '*****','*****');
mysql_select_db('******');
$query = 'select * from sf_guard_user where id = 15 limit 1';
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
echo $row['username'].'<br />';
unset($query);
unset($result);
unset($row);
$new_memory = round(memory_get_usage() / 1024 , 2);
echo "memory stage2 $new_memory kb<br />";
echo "query_worth : " . ($new_memory - $old_memory) . " kb";
the result of the previous code is this
memory stage1 361.25 kb
Grandezza
memory stage2 367.31 kb
query_worth : 6.06 kb
then i've created an executeTest action to do the same with symfony and doctrine :
public function executeTest(sfWebRequest $request){
$old_memory = round(memory_get_usage() / 1024 , 2);
echo "memory stage1 $old_memory kb<br />";
$query = Doctrine_Core::getTable('sfGuardUser')->createQuery()->where('id = 15')->limit(1);
$result = $query->execute();
echo $result[0]['username']. '<br />';
$query->free(true);
unset($query);
$result->free(true);
unset($result);
$new_memory = round(memory_get_usage() / 1024 , 2);
echo "memory stage2 $new_memory kb<br />";
echo "query_worth : " . ($new_memory - $old_memory) . " kb";
exit();
}
which gives the following :
memory stage1 14700.48 kb
Grandezza
memory stage2 14690.6 kb
query_worth : -9.88 kb
i see that the query doesn't eat up memory at all however 15mb of ram get used every time i call this action !!! what gives ??!!
any tips how to deal with this
thanks | 0 |
11,411,314 | 07/10/2012 10:24:44 | 1,326,517 | 04/11/2012 12:13:15 | 47 | 2 | joins in MySQL for leave management in PHP and MySQL | I have 4 tables like shown below
Table: leave_request
+------------+----------+--------------+------------+----------------------+
| request_id | staff_id | applied_from | applied_to | status |
+------------+----------+--------------+------------+----------------------+
| 1 | 10 | 01-07-2012 | 02-07-2012 | approved |
| 2 | 12 | 02-07-2012 | 02-07-2012 | awaiting HR approval |
+------------+----------+--------------+------------+----------------------+
Table: leave_approval
+-------------+-------------+---------------+-------------+
| request_id | approved_by | approved_from | approved_to |
+-------------+-------------+---------------+-------------+
| 1 | 1 | 01-07-2012 | 02-07-2012 |
| 1 | 2 | 01-07-2012 | 02-07-2012 |
| 2 | 1 | 02-07-2012 | 02-07-2012 |
+-------------+-------------+---------------+-------------+
Table: staff
+-----------+-------+----------+
| staff_id | name | group_id |
+-----------+-------+----------+
| 1 | jack | 1 |
| 2 | jill | 2 |
| 10 | sam | 3 |
| 12 | david | 3 |
+-----------+-------+----------+
Table: group
+-----------+------------+
| group_id | group_name |
+-----------+------------+
| 1 | admin |
| 2 | HR |
| 3 | staff |
+-----------+------------+
I need to make a report by joining these tables, It should look like below:
+----------+------------+----------+-------------+-----------+--------------+-----------+
|applied_by|applied_from|applied_to|approved_from|approved_to|approved_admin|approved_hr|
+----------+------------+----------+-------------+-----------+--------------+-----------+
| sam | 01-07-2012 |02-07-2012|01-07-2012 |02-07-2012 | Jack | Jill |
| david | 02-07-2012 |02-07-2012|02-07-2012 |02-07-2012 | Jack | null |
+----------+------------+----------+-------------+-----------+--------------+-----------+
Thanks in advance :) | php | mysql | join | null | null | 07/10/2012 13:24:28 | too localized | joins in MySQL for leave management in PHP and MySQL
===
I have 4 tables like shown below
Table: leave_request
+------------+----------+--------------+------------+----------------------+
| request_id | staff_id | applied_from | applied_to | status |
+------------+----------+--------------+------------+----------------------+
| 1 | 10 | 01-07-2012 | 02-07-2012 | approved |
| 2 | 12 | 02-07-2012 | 02-07-2012 | awaiting HR approval |
+------------+----------+--------------+------------+----------------------+
Table: leave_approval
+-------------+-------------+---------------+-------------+
| request_id | approved_by | approved_from | approved_to |
+-------------+-------------+---------------+-------------+
| 1 | 1 | 01-07-2012 | 02-07-2012 |
| 1 | 2 | 01-07-2012 | 02-07-2012 |
| 2 | 1 | 02-07-2012 | 02-07-2012 |
+-------------+-------------+---------------+-------------+
Table: staff
+-----------+-------+----------+
| staff_id | name | group_id |
+-----------+-------+----------+
| 1 | jack | 1 |
| 2 | jill | 2 |
| 10 | sam | 3 |
| 12 | david | 3 |
+-----------+-------+----------+
Table: group
+-----------+------------+
| group_id | group_name |
+-----------+------------+
| 1 | admin |
| 2 | HR |
| 3 | staff |
+-----------+------------+
I need to make a report by joining these tables, It should look like below:
+----------+------------+----------+-------------+-----------+--------------+-----------+
|applied_by|applied_from|applied_to|approved_from|approved_to|approved_admin|approved_hr|
+----------+------------+----------+-------------+-----------+--------------+-----------+
| sam | 01-07-2012 |02-07-2012|01-07-2012 |02-07-2012 | Jack | Jill |
| david | 02-07-2012 |02-07-2012|02-07-2012 |02-07-2012 | Jack | null |
+----------+------------+----------+-------------+-----------+--------------+-----------+
Thanks in advance :) | 3 |
11,542,613 | 07/18/2012 13:31:13 | 580,951 | 01/19/2011 05:27:16 | 133 | 9 | Using templates in Knockout.js viewmodels inside module | So I'm converting an old web forms app to be more modular and I rewrote the page using knockout. Now that I've got everything working I wanted to export my knockout viewmodels into a module, but I'm running into an issue with the built in template system not rendering the template.
e.g.
<script type="text/javascript">
var MyPage = (function($, ko) {
var my = {};
my.Message = function(message) {
var self = this;
self.messageId = message.messageId;
self.messageText = message.messageText;
};
my.MessageViewModel = function() {
var self = this;
self.messageArray = ko.observableArray([]);
self.getMessageArray = function() {
$.ajax({
//get message array
success: function() {
//map message array and push new my.Message into messageArray
}
});
};
};
return my;
}) (jQuery, ko);
$(document).ready(function () {
ko.applyBindings(new MyPage.MessageViewModel());
});
</script>
<script type="text/html" id="messageTemplate">
<tr>
<td data-bind="text: messageId"></td>
<td data-bind="text: messageText"></td>
</tr>
</script>
//exert from html
<table>
<thead>
<tr>
<th>Message Id</th>
<th>Message Text</th>
</tr>
</thead>
<tbody data-bind="template: {name: messageTemplate, foreach: messageArray}">
</tbody>
</table> | javascript | templates | knockout.js | null | null | null | open | Using templates in Knockout.js viewmodels inside module
===
So I'm converting an old web forms app to be more modular and I rewrote the page using knockout. Now that I've got everything working I wanted to export my knockout viewmodels into a module, but I'm running into an issue with the built in template system not rendering the template.
e.g.
<script type="text/javascript">
var MyPage = (function($, ko) {
var my = {};
my.Message = function(message) {
var self = this;
self.messageId = message.messageId;
self.messageText = message.messageText;
};
my.MessageViewModel = function() {
var self = this;
self.messageArray = ko.observableArray([]);
self.getMessageArray = function() {
$.ajax({
//get message array
success: function() {
//map message array and push new my.Message into messageArray
}
});
};
};
return my;
}) (jQuery, ko);
$(document).ready(function () {
ko.applyBindings(new MyPage.MessageViewModel());
});
</script>
<script type="text/html" id="messageTemplate">
<tr>
<td data-bind="text: messageId"></td>
<td data-bind="text: messageText"></td>
</tr>
</script>
//exert from html
<table>
<thead>
<tr>
<th>Message Id</th>
<th>Message Text</th>
</tr>
</thead>
<tbody data-bind="template: {name: messageTemplate, foreach: messageArray}">
</tbody>
</table> | 0 |
11,542,614 | 07/18/2012 13:31:13 | 1,534,898 | 07/18/2012 13:20:18 | 1 | 0 | Design view not available with python tools for Visual studio 2010 | I have created a project with iron python and .net under sharp develop but I want to use the project to be run with VS 2010. I have installed the python tool for visual studio 2010.
When I build the project and run it, I can see the program executed that means, I can see the GUI which I have created and the menu also works.
But, what I cant do is switch to the Designer mode and move some buttons etc. because there is no Design view available for any of the source files.
In the source code however, I see the buttons etc. with specific coordinates, size and other properties, but there is simply no Design view where I can edit the button.
Can anyone know where the problem is? | visual-studio-2010 | ironpython | null | null | null | null | open | Design view not available with python tools for Visual studio 2010
===
I have created a project with iron python and .net under sharp develop but I want to use the project to be run with VS 2010. I have installed the python tool for visual studio 2010.
When I build the project and run it, I can see the program executed that means, I can see the GUI which I have created and the menu also works.
But, what I cant do is switch to the Designer mode and move some buttons etc. because there is no Design view available for any of the source files.
In the source code however, I see the buttons etc. with specific coordinates, size and other properties, but there is simply no Design view where I can edit the button.
Can anyone know where the problem is? | 0 |
11,542,615 | 07/18/2012 13:31:14 | 1,002,669 | 10/19/2011 07:54:59 | 76 | 0 | Visual studio mvc 3 project on TFS | I have a mvc 3 project on TFS. I also use EF 4 and SQL server 2008 R2.
I found some strange behavior:
-I change data type in SQL server (let say Guid to int)
-I update EF 4
-I change all variables type from guid to int that correlates to that field
***to here everything works fine***
-now let say I have a view with a hidden field @Html.HiddenFor(m => m.Id).
In my model I changed that Id to appropriate type let say from Guid to int. This view is Checked in and as I assumed did not need any change. But when I run the project I get exception on that field and Visual studios request is old Guid...Wtf??...then I check out this view, delete m.Id and agian rewrite m.Id and everything works fine. | asp.net-mvc-3 | visual-studio-2010 | null | null | null | null | open | Visual studio mvc 3 project on TFS
===
I have a mvc 3 project on TFS. I also use EF 4 and SQL server 2008 R2.
I found some strange behavior:
-I change data type in SQL server (let say Guid to int)
-I update EF 4
-I change all variables type from guid to int that correlates to that field
***to here everything works fine***
-now let say I have a view with a hidden field @Html.HiddenFor(m => m.Id).
In my model I changed that Id to appropriate type let say from Guid to int. This view is Checked in and as I assumed did not need any change. But when I run the project I get exception on that field and Visual studios request is old Guid...Wtf??...then I check out this view, delete m.Id and agian rewrite m.Id and everything works fine. | 0 |
11,542,616 | 07/18/2012 13:31:14 | 315,619 | 04/13/2010 15:06:13 | 618 | 21 | GCM (Google Cloud Messaging ) for Android, writing 3rd party server in .Net | Need some help to implement 3rd party server for GCM (Google Cloud Messaging) for Android using .Net.
The official documentation gives guidelines for using it using servlet-api and gcm-server.jar ( java helper APIs for server side ).
Is there any equivalent for using it in .Net framework.
Any guideliness that would help to implement GCM using .Net? | android | .net | android-gcm | null | null | null | open | GCM (Google Cloud Messaging ) for Android, writing 3rd party server in .Net
===
Need some help to implement 3rd party server for GCM (Google Cloud Messaging) for Android using .Net.
The official documentation gives guidelines for using it using servlet-api and gcm-server.jar ( java helper APIs for server side ).
Is there any equivalent for using it in .Net framework.
Any guideliness that would help to implement GCM using .Net? | 0 |
11,542,617 | 07/18/2012 13:31:26 | 1,372,414 | 05/03/2012 12:04:17 | 168 | 19 | IIS7 URL Filtering | I'm trying to denied access to my website when users use a URL like
https://www.mywebsite.com/./somepage.aspx
Right now when I try the url above IIS7 will serve:
https://www.mywebsite.com/somepage.aspx
I also installed urlscan on the server with
AllowDotInPath=0
[DenyUrlSequences]
.. ; Don't allow directory traversals
./ ; Don't allow trailing dot on a directory name
\ ; Don't allow backslashes in URL
: ; Don't allow alternate stream access
% ; Don't allow escaping after normalization
& ; Don't allow multiple CGI processes to run on a single request
but it still allowing access :(
My way of testing it is using curl:
curl -I https://www.mywebsite.com/./somepage.aspx
What am i doing wrong?
Thanks in advances! | asp.net | security | iis7 | null | null | null | open | IIS7 URL Filtering
===
I'm trying to denied access to my website when users use a URL like
https://www.mywebsite.com/./somepage.aspx
Right now when I try the url above IIS7 will serve:
https://www.mywebsite.com/somepage.aspx
I also installed urlscan on the server with
AllowDotInPath=0
[DenyUrlSequences]
.. ; Don't allow directory traversals
./ ; Don't allow trailing dot on a directory name
\ ; Don't allow backslashes in URL
: ; Don't allow alternate stream access
% ; Don't allow escaping after normalization
& ; Don't allow multiple CGI processes to run on a single request
but it still allowing access :(
My way of testing it is using curl:
curl -I https://www.mywebsite.com/./somepage.aspx
What am i doing wrong?
Thanks in advances! | 0 |
11,542,621 | 07/18/2012 13:31:43 | 1,184,902 | 02/02/2012 10:58:51 | 138 | 14 | Inter Portlet Communication in JetSpeed2 | I am looking for code to do inter portlet communication in JetSpeed Client Side. I tried browsing around but there is no correct wikis available. I know a way of using bind and fire functions of JQuery which still have to check. Also wanted to know if there is any API inside Jetspeed for the same? | portlet | jetspeed2 | null | null | null | null | open | Inter Portlet Communication in JetSpeed2
===
I am looking for code to do inter portlet communication in JetSpeed Client Side. I tried browsing around but there is no correct wikis available. I know a way of using bind and fire functions of JQuery which still have to check. Also wanted to know if there is any API inside Jetspeed for the same? | 0 |
11,542,629 | 07/18/2012 13:32:12 | 1,534,860 | 07/18/2012 13:05:52 | 1 | 0 | C# MDM Server with Apple, not able to send Push Notification | We are working on a MDM solution for iOS devices.
We are already able to install profiles with a MDM-Payload over a website and we already receive PUT requestes sent by the iOS devices containing the PushMagic, a deviceToken and other values as well.
We created a COMPANY.pem SSL certificiate using this description:
http://www.softhinker.com/in-the-news/iosmdmvendorcsrsigning
We tried to send a Push Notification with the library push-sharp:
https://github.com/Redth/PushSharp
We were using MDM.p12 file build with these commands
openssl pkcs12 -export -in ./COMPANY.pem -inkey ./customerPrivateKey.pem -certfile ./CertificateSigningRequest.certSigningRequest -out MDM.p12
The program sending this notification does not throw any errors and exits normally.
But we are not receiving any Push-Notifications on our devices nor receiving anything through the feedback service.
Also to mention is that we tried to use the sandbox-server and the production-server as well.
Here is our code using the push-sharp library:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Text;
using PushSharp;
using PushSharp.Apple;
namespace PushSharp.Sample
{
class Program
{
static void Main(string[] args)
{
//Create our service
PushService push = new PushService();
//Wire up the events
push.Events.OnDeviceSubscriptionExpired += new Common.ChannelEvents.DeviceSubscriptionExpired(Events_OnDeviceSubscriptionExpired);
push.Events.OnDeviceSubscriptionIdChanged += new Common.ChannelEvents.DeviceSubscriptionIdChanged(Events_OnDeviceSubscriptionIdChanged);
push.Events.OnChannelException += new Common.ChannelEvents.ChannelExceptionDelegate(Events_OnChannelException);
push.Events.OnNotificationSendFailure += new Common.ChannelEvents.NotificationSendFailureDelegate(Events_OnNotificationSendFailure);
push.Events.OnNotificationSent += new Common.ChannelEvents.NotificationSentDelegate(Events_OnNotificationSent);
//Configure and start Apple APNS
// IMPORTANT: Make sure you use the right Push certificate. Apple allows you to generate one for connecting to Sandbox,
// and one for connecting to Production. You must use the right one, to match the provisioning profile you build your
// app with!
//var appleCert = File.ReadAllBytes("C:\\TEMP\\apns-mdm.p12");
var appleCert = File.ReadAllBytes(@".\MDM.p12");
//IMPORTANT: If you are using a Development provisioning Profile, you must use the Sandbox push notification server
// (so you would leave the first arg in the ctor of ApplePushChannelSettings as 'false')
// If you are using an AdHoc or AppStore provisioning profile, you must use the Production push notification server
// (so you would change the first arg in the ctor of ApplePushChannelSettings to 'true')
push.StartApplePushService(new ApplePushChannelSettings(true, appleCert, "PWD"));
//String p12File = @".\apns-mdm.p12";
//String p12Password = "PWD";
String pushMagicString = "00454668-00B2-4122-A1DC-72ACD64E6AFB";
//String deviceToken = "27asObngxvVNb3RvRMs3XVaEWC1DNa3TjFE12stKsig=";
//Configure and start Android GCM
//IMPORTANT: The SENDER_ID is your Google API Console App Project ID.
// Be sure to get the right Project ID from your Google APIs Console. It's not the named project ID that appears in the Overview,
// but instead the numeric project id in the url: eg: https://code.google.com/apis/console/?pli=1#project:785671162406:overview
// where 785671162406 is the project id, which is the SENDER_ID to use!
//push.StartGoogleCloudMessagingPushService(new GcmPushChannelSettings("785671162406", "AIzaSyC2PZNXQDVaUpZGmtsF_Vp8tHtIABVjazI", "com.pushsharp.test"));
//Configure and start Windows Phone Notifications
//push.StartWindowsPhonePushService(new WindowsPhone.WindowsPhonePushChannelSettings());
//Fluent construction of a Windows Phone Toast notification
//push.QueueNotification(NotificationFactory.WindowsPhone().Toast()
//.ForEndpointUri(new Uri("http://sn1.notify.live.net/throttledthirdparty/01.00/AAFCoNoCXidwRpn5NOxvwSxPAgAAAAADAgAAAAQUZm52OkJCMjg1QTg1QkZDMkUxREQ"))
//.ForOSVersion(WindowsPhone.WindowsPhoneDeviceOSVersion.MangoSevenPointFive)
//.WithBatchingInterval(WindowsPhone.BatchingInterval.Immediate)
//.WithNavigatePath("/MainPage.xaml")
//.WithText1("PushSharp")
//.WithText2("This is a Toast"));
//Fluent construction of an iOS notification
//IMPORTANT: For iOS you MUST MUST MUST use your own DeviceToken here that gets generated within your iOS app itself when the Application Delegate
// for registered for remote notifications is called, and the device token is passed back to you
String test = "3d 58 64 4d 90 d3 18 09 22 5c 50 d2 12 16 b5 67 71 1e be 5c 13 6e 41 3c 3e 81 b5 52 30 68 09 a5";
test = test.Replace(" ", string.Empty);
Console.WriteLine("Device Token length is: " + test.Length);
Console.WriteLine("DeviceToken is: " + test);
Console.WriteLine("PushMagic is: " + pushMagicString);
DateTime dayAfterTomorrow = DateTime.Now.AddDays(2);
Console.WriteLine("Expiry date is: " + dayAfterTomorrow.ToString());
push.QueueNotification(NotificationFactory.Apple()
.ForDeviceToken(test).WithExpiry(dayAfterTomorrow).WithCustomItem("mdm", pushMagicString));
//push.Events.RaiseNotificationSent(NotificationFactory.Apple()
// .ForDeviceToken(hex).WithCustomItem("mdm", pushMagicString));
//Fluent construction of an Android GCM Notification
//push.QueueNotification(NotificationFactory.AndroidGcm()
// .ForDeviceRegistrationId("APA91bG7J-cZjkURrqi58cEd5ain6hzi4i06T0zg9eM2kQAprV-fslFiq60hnBUVlnJPlPV-4K7X39aHIe55of8fJugEuYMyAZSUbmDyima5ZTC7hn4euQ0Yflj2wMeTxnyMOZPuwTLuYNiJ6EREeI9qJuJZH9Zu9g")
// .WithCollapseKey("NONE")
// .WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"7\"}"));
Console.WriteLine("Waiting for Queue to Finish...");
//Stop and wait for the queues to drains
push.StopAllServices(true);
Console.WriteLine("Queue Finished, press return to exit...");
Console.ReadLine();
}
static void Events_OnDeviceSubscriptionIdChanged(Common.PlatformType platform, string oldDeviceInfo, string newDeviceInfo)
{
//Currently this event will only ever happen for Android GCM
Console.WriteLine("Device Registration Changed: Old-> " + oldDeviceInfo + " New-> " + newDeviceInfo);
}
static void Events_OnNotificationSent(Common.Notification notification)
{
Console.WriteLine("Sent: " + notification.Platform.ToString() + " -> " + notification.ToString());
}
static void Events_OnNotificationSendFailure(Common.Notification notification, Exception notificationFailureException)
{
Console.WriteLine("Failure: " + notification.Platform.ToString() + " -> " + notificationFailureException.Message + " -> " + notification.ToString());
}
static void Events_OnChannelException(Exception exception)
{
Console.WriteLine("Channel Exception: " + exception.ToString());
}
static void Events_OnDeviceSubscriptionExpired(Common.PlatformType platform, string deviceInfo)
{
Console.WriteLine("Device Subscription Expired: " + platform.ToString() + " -> " + deviceInfo);
}
}
}
We encoded the received deviceToken using this website:
hp:\\home.paulschou.net/tools/xlate/
from base64 to HEX.
We are also using the APS/PC Logging profile on our iOS device to get more output through the debug console provided by IPCU. | c# | apple | push | apns | mdm | null | open | C# MDM Server with Apple, not able to send Push Notification
===
We are working on a MDM solution for iOS devices.
We are already able to install profiles with a MDM-Payload over a website and we already receive PUT requestes sent by the iOS devices containing the PushMagic, a deviceToken and other values as well.
We created a COMPANY.pem SSL certificiate using this description:
http://www.softhinker.com/in-the-news/iosmdmvendorcsrsigning
We tried to send a Push Notification with the library push-sharp:
https://github.com/Redth/PushSharp
We were using MDM.p12 file build with these commands
openssl pkcs12 -export -in ./COMPANY.pem -inkey ./customerPrivateKey.pem -certfile ./CertificateSigningRequest.certSigningRequest -out MDM.p12
The program sending this notification does not throw any errors and exits normally.
But we are not receiving any Push-Notifications on our devices nor receiving anything through the feedback service.
Also to mention is that we tried to use the sandbox-server and the production-server as well.
Here is our code using the push-sharp library:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Text;
using PushSharp;
using PushSharp.Apple;
namespace PushSharp.Sample
{
class Program
{
static void Main(string[] args)
{
//Create our service
PushService push = new PushService();
//Wire up the events
push.Events.OnDeviceSubscriptionExpired += new Common.ChannelEvents.DeviceSubscriptionExpired(Events_OnDeviceSubscriptionExpired);
push.Events.OnDeviceSubscriptionIdChanged += new Common.ChannelEvents.DeviceSubscriptionIdChanged(Events_OnDeviceSubscriptionIdChanged);
push.Events.OnChannelException += new Common.ChannelEvents.ChannelExceptionDelegate(Events_OnChannelException);
push.Events.OnNotificationSendFailure += new Common.ChannelEvents.NotificationSendFailureDelegate(Events_OnNotificationSendFailure);
push.Events.OnNotificationSent += new Common.ChannelEvents.NotificationSentDelegate(Events_OnNotificationSent);
//Configure and start Apple APNS
// IMPORTANT: Make sure you use the right Push certificate. Apple allows you to generate one for connecting to Sandbox,
// and one for connecting to Production. You must use the right one, to match the provisioning profile you build your
// app with!
//var appleCert = File.ReadAllBytes("C:\\TEMP\\apns-mdm.p12");
var appleCert = File.ReadAllBytes(@".\MDM.p12");
//IMPORTANT: If you are using a Development provisioning Profile, you must use the Sandbox push notification server
// (so you would leave the first arg in the ctor of ApplePushChannelSettings as 'false')
// If you are using an AdHoc or AppStore provisioning profile, you must use the Production push notification server
// (so you would change the first arg in the ctor of ApplePushChannelSettings to 'true')
push.StartApplePushService(new ApplePushChannelSettings(true, appleCert, "PWD"));
//String p12File = @".\apns-mdm.p12";
//String p12Password = "PWD";
String pushMagicString = "00454668-00B2-4122-A1DC-72ACD64E6AFB";
//String deviceToken = "27asObngxvVNb3RvRMs3XVaEWC1DNa3TjFE12stKsig=";
//Configure and start Android GCM
//IMPORTANT: The SENDER_ID is your Google API Console App Project ID.
// Be sure to get the right Project ID from your Google APIs Console. It's not the named project ID that appears in the Overview,
// but instead the numeric project id in the url: eg: https://code.google.com/apis/console/?pli=1#project:785671162406:overview
// where 785671162406 is the project id, which is the SENDER_ID to use!
//push.StartGoogleCloudMessagingPushService(new GcmPushChannelSettings("785671162406", "AIzaSyC2PZNXQDVaUpZGmtsF_Vp8tHtIABVjazI", "com.pushsharp.test"));
//Configure and start Windows Phone Notifications
//push.StartWindowsPhonePushService(new WindowsPhone.WindowsPhonePushChannelSettings());
//Fluent construction of a Windows Phone Toast notification
//push.QueueNotification(NotificationFactory.WindowsPhone().Toast()
//.ForEndpointUri(new Uri("http://sn1.notify.live.net/throttledthirdparty/01.00/AAFCoNoCXidwRpn5NOxvwSxPAgAAAAADAgAAAAQUZm52OkJCMjg1QTg1QkZDMkUxREQ"))
//.ForOSVersion(WindowsPhone.WindowsPhoneDeviceOSVersion.MangoSevenPointFive)
//.WithBatchingInterval(WindowsPhone.BatchingInterval.Immediate)
//.WithNavigatePath("/MainPage.xaml")
//.WithText1("PushSharp")
//.WithText2("This is a Toast"));
//Fluent construction of an iOS notification
//IMPORTANT: For iOS you MUST MUST MUST use your own DeviceToken here that gets generated within your iOS app itself when the Application Delegate
// for registered for remote notifications is called, and the device token is passed back to you
String test = "3d 58 64 4d 90 d3 18 09 22 5c 50 d2 12 16 b5 67 71 1e be 5c 13 6e 41 3c 3e 81 b5 52 30 68 09 a5";
test = test.Replace(" ", string.Empty);
Console.WriteLine("Device Token length is: " + test.Length);
Console.WriteLine("DeviceToken is: " + test);
Console.WriteLine("PushMagic is: " + pushMagicString);
DateTime dayAfterTomorrow = DateTime.Now.AddDays(2);
Console.WriteLine("Expiry date is: " + dayAfterTomorrow.ToString());
push.QueueNotification(NotificationFactory.Apple()
.ForDeviceToken(test).WithExpiry(dayAfterTomorrow).WithCustomItem("mdm", pushMagicString));
//push.Events.RaiseNotificationSent(NotificationFactory.Apple()
// .ForDeviceToken(hex).WithCustomItem("mdm", pushMagicString));
//Fluent construction of an Android GCM Notification
//push.QueueNotification(NotificationFactory.AndroidGcm()
// .ForDeviceRegistrationId("APA91bG7J-cZjkURrqi58cEd5ain6hzi4i06T0zg9eM2kQAprV-fslFiq60hnBUVlnJPlPV-4K7X39aHIe55of8fJugEuYMyAZSUbmDyima5ZTC7hn4euQ0Yflj2wMeTxnyMOZPuwTLuYNiJ6EREeI9qJuJZH9Zu9g")
// .WithCollapseKey("NONE")
// .WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"7\"}"));
Console.WriteLine("Waiting for Queue to Finish...");
//Stop and wait for the queues to drains
push.StopAllServices(true);
Console.WriteLine("Queue Finished, press return to exit...");
Console.ReadLine();
}
static void Events_OnDeviceSubscriptionIdChanged(Common.PlatformType platform, string oldDeviceInfo, string newDeviceInfo)
{
//Currently this event will only ever happen for Android GCM
Console.WriteLine("Device Registration Changed: Old-> " + oldDeviceInfo + " New-> " + newDeviceInfo);
}
static void Events_OnNotificationSent(Common.Notification notification)
{
Console.WriteLine("Sent: " + notification.Platform.ToString() + " -> " + notification.ToString());
}
static void Events_OnNotificationSendFailure(Common.Notification notification, Exception notificationFailureException)
{
Console.WriteLine("Failure: " + notification.Platform.ToString() + " -> " + notificationFailureException.Message + " -> " + notification.ToString());
}
static void Events_OnChannelException(Exception exception)
{
Console.WriteLine("Channel Exception: " + exception.ToString());
}
static void Events_OnDeviceSubscriptionExpired(Common.PlatformType platform, string deviceInfo)
{
Console.WriteLine("Device Subscription Expired: " + platform.ToString() + " -> " + deviceInfo);
}
}
}
We encoded the received deviceToken using this website:
hp:\\home.paulschou.net/tools/xlate/
from base64 to HEX.
We are also using the APS/PC Logging profile on our iOS device to get more output through the debug console provided by IPCU. | 0 |
11,542,631 | 07/18/2012 13:32:17 | 383,633 | 07/05/2010 11:55:57 | 429 | 35 | JQuery pagination with validation | I was wondering if anyone has come across a JQuery pagination script where a validation event can occur and if validation is successful then to load in the next page that was selected, else let JS Validator point out the errors and prevent next page from being loaded.
Basically I am writing some code that has a questionnaire type form and some fields require validation.
Currently I am playing with www.xarg.org pagination script and added in some code to allow validation to occur on various field elements but his code seems to trigger onFormat first before onSelect occurs (onSelect is where my validation kicks in) so although the error occurs on page 1, the link that you select next is highlighted which I am trying to avoid.
I have uploaded my code so far here ([http://rkcr.recruitment.saint-dev.co.uk/form_stackoverflow.html][1]) if anyone either could advise or recommend another solution.
Also, just a heads up that I am not a hardcore JS developer but hacking my through to make ends meet :-|
Thanks
Raj
[1]: http://rkcr.recruitment.saint-dev.co.uk/form_stackoverflow.html | javascript | jquery | validation | null | null | null | open | JQuery pagination with validation
===
I was wondering if anyone has come across a JQuery pagination script where a validation event can occur and if validation is successful then to load in the next page that was selected, else let JS Validator point out the errors and prevent next page from being loaded.
Basically I am writing some code that has a questionnaire type form and some fields require validation.
Currently I am playing with www.xarg.org pagination script and added in some code to allow validation to occur on various field elements but his code seems to trigger onFormat first before onSelect occurs (onSelect is where my validation kicks in) so although the error occurs on page 1, the link that you select next is highlighted which I am trying to avoid.
I have uploaded my code so far here ([http://rkcr.recruitment.saint-dev.co.uk/form_stackoverflow.html][1]) if anyone either could advise or recommend another solution.
Also, just a heads up that I am not a hardcore JS developer but hacking my through to make ends meet :-|
Thanks
Raj
[1]: http://rkcr.recruitment.saint-dev.co.uk/form_stackoverflow.html | 0 |
11,542,609 | 07/18/2012 13:31:08 | 1,179,863 | 01/31/2012 08:35:21 | 31 | 4 | Associate a UITableViewController to UITableView | I am working on an iOS application and i need your help guys !
My home page is a UIView, in this UIView i have a UIImageView,..., and also a UITableView.
I create a UITableViewController class and i need to associate this class to my UITableView.
How can i do ?
Best regards !
| objective-c | ios | xcode | uitableview | uiview | null | open | Associate a UITableViewController to UITableView
===
I am working on an iOS application and i need your help guys !
My home page is a UIView, in this UIView i have a UIImageView,..., and also a UITableView.
I create a UITableViewController class and i need to associate this class to my UITableView.
How can i do ?
Best regards !
| 0 |
11,542,639 | 07/18/2012 13:32:37 | 262,703 | 01/31/2010 00:01:46 | 338 | 2 | How do you access a child element in Actionscript 2? | I have the following Flash structure.
Main Timeline
---test_menu (Movie Clip)
------test_menu_sub (Movie Clip)
---------submenu_item (Button)
On Main Timeline (2nd frame), I added this code:
test_menu.test_menu_sub.submenu_item.onPress = function () {
trace("clicked");
}
However, this doesn't work. How do you access a child element or movie clip in actionscript 2? Please see the following files for reference.
- FLA: https://www.dropbox.com/s/h220lrnd8a4ns0t/test.fla
- SWF: https://www.dropbox.com/s/utbjaa6s9wcqbmb/test.swf
| flash | actionscript-2 | null | null | null | null | open | How do you access a child element in Actionscript 2?
===
I have the following Flash structure.
Main Timeline
---test_menu (Movie Clip)
------test_menu_sub (Movie Clip)
---------submenu_item (Button)
On Main Timeline (2nd frame), I added this code:
test_menu.test_menu_sub.submenu_item.onPress = function () {
trace("clicked");
}
However, this doesn't work. How do you access a child element or movie clip in actionscript 2? Please see the following files for reference.
- FLA: https://www.dropbox.com/s/h220lrnd8a4ns0t/test.fla
- SWF: https://www.dropbox.com/s/utbjaa6s9wcqbmb/test.swf
| 0 |
11,542,640 | 07/18/2012 13:32:43 | 1,529,876 | 07/16/2012 19:26:22 | 1 | 0 | How to make Django unit-tests all retrieve from the same test database? | Currently when I run a set of unit-tests on Django, each test makes its own database. This means that traversing multiple features of the site all require a user sign up, login, etc.. It would be much simpler if they all fetched from the same temporary database - anyway to do this? | python | database | django | unit-testing | null | null | open | How to make Django unit-tests all retrieve from the same test database?
===
Currently when I run a set of unit-tests on Django, each test makes its own database. This means that traversing multiple features of the site all require a user sign up, login, etc.. It would be much simpler if they all fetched from the same temporary database - anyway to do this? | 0 |
11,373,573 | 07/07/2012 08:42:09 | 1,508,441 | 07/07/2012 08:18:20 | 1 | 0 | User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable | I was working in web application. I tried removing the jar duplication from my war with <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>. This helped me in excluding the jar from my war. While deploying the ear in websphere i have the follwing issue,
I have checked my war class path it contains the log4j.jar and common-logging1.1.jar.
Kindly help!!!
Error log:
[7/6/12 22:34:10:577 CEST] 00000165 webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
org.apache.commons.logging.LogConfigurationException: User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.
at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:874)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:604)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:336)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:310) | java | log4j | websphere-6.1 | null | null | null | open | User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable
===
I was working in web application. I tried removing the jar duplication from my war with <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>. This helped me in excluding the jar from my war. While deploying the ear in websphere i have the follwing issue,
I have checked my war class path it contains the log4j.jar and common-logging1.1.jar.
Kindly help!!!
Error log:
[7/6/12 22:34:10:577 CEST] 00000165 webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
org.apache.commons.logging.LogConfigurationException: User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.
at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:874)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:604)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:336)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:310) | 0 |
11,373,576 | 07/07/2012 08:42:36 | 429,938 | 08/24/2010 19:16:26 | 468 | 19 | CakePHP caching elements with duration | Regarding to [cookbook][1] we can cache elements like this:
echo $this->element('helpbox', array(), array('cache' => true));
Caching with configuration is like this:
echo $this->element('helpbox', array(),
array('cache' => array('config' => 'view_long') );
How can I cache elements without predefined configuration ? How can I cache duration to elements? I tried this, but didn't work:
echo $this->element('helpbox', array(),
array('cache' => array('time' => '+30 minutes')));
[1]: http://book.cakephp.org/2.0/en/views.html#caching-elements | php | cakephp | element | cakephp-2.0 | null | null | open | CakePHP caching elements with duration
===
Regarding to [cookbook][1] we can cache elements like this:
echo $this->element('helpbox', array(), array('cache' => true));
Caching with configuration is like this:
echo $this->element('helpbox', array(),
array('cache' => array('config' => 'view_long') );
How can I cache elements without predefined configuration ? How can I cache duration to elements? I tried this, but didn't work:
echo $this->element('helpbox', array(),
array('cache' => array('time' => '+30 minutes')));
[1]: http://book.cakephp.org/2.0/en/views.html#caching-elements | 0 |
11,373,569 | 07/07/2012 08:41:24 | 1,362,712 | 04/28/2012 10:11:54 | 6 | 0 | connect selfcreated simuation-events to objects inside an Div with JavaScript | i have some Problem... i send a selfcreated mouse-click-event with parameters to a Div with an Streetview inside but the event does not change the Streetview like it happened wenn i click the same x,y coordate in the div by real mouse click.
The following Code shows the position of the click. It works with reale mouse like with my event-simulation. Shows the clickposition and break the eventchain, so that the streetview does not change. So I know, that my simulationcode works
divStreetView.addEventListener("click", function(event){
alert("Client X: "+ event.clientX + " Y: " + event.clientY + " Page X: "+ event.pageX + " Y: " + event.pageY); //”click”
event.stopPropagation();//break the eventchain
},true);
Has anyone an idea, how i can connect my simulation mouse-event to the Streetview inside the DIV, so that the google api handle the event.
| javascript | javascript-events | maps | simulation | streetview | null | open | connect selfcreated simuation-events to objects inside an Div with JavaScript
===
i have some Problem... i send a selfcreated mouse-click-event with parameters to a Div with an Streetview inside but the event does not change the Streetview like it happened wenn i click the same x,y coordate in the div by real mouse click.
The following Code shows the position of the click. It works with reale mouse like with my event-simulation. Shows the clickposition and break the eventchain, so that the streetview does not change. So I know, that my simulationcode works
divStreetView.addEventListener("click", function(event){
alert("Client X: "+ event.clientX + " Y: " + event.clientY + " Page X: "+ event.pageX + " Y: " + event.pageY); //”click”
event.stopPropagation();//break the eventchain
},true);
Has anyone an idea, how i can connect my simulation mouse-event to the Streetview inside the DIV, so that the google api handle the event.
| 0 |
11,373,580 | 07/07/2012 08:43:45 | 569,558 | 01/10/2011 08:55:17 | 135 | 9 | cocos2d-iphone SimpleAudioEngine preload strategy | What is the best strategy for SimpleAudioEngine effects preload ? Preload all sound effects at game startup ? Or in each screen's creation preload only the effects used in this screen ?
Are loaded effects released at some point ? | cocos2d-iphone | null | null | null | null | null | open | cocos2d-iphone SimpleAudioEngine preload strategy
===
What is the best strategy for SimpleAudioEngine effects preload ? Preload all sound effects at game startup ? Or in each screen's creation preload only the effects used in this screen ?
Are loaded effects released at some point ? | 0 |
11,373,583 | 07/07/2012 08:44:05 | 586,399 | 01/23/2011 14:42:31 | 1,045 | 75 | STL set_symmetric_difference usage | I was solving a programming problem, which wants to find the SYMMETRIC DIFFERENCE between two sets. I have solved it using STL's `set_symmetric_difference`. I am given two `vector<int>s`, `A` and `B`:
> A = {342,654,897,312,76,23,78}
> B = {21,43,87,98,23,756,897,234,645,876,123}
Sould return (correct answer):
> { 21,43,76,78,87,98,123,234,312,342,645,654,756,876 }
But I get:
> { 21,43,76,78,87,98,123,234,312,342,645,65,756,876}
What is the problem ? Here is my code:
sort(A.begin(), A.end());
sort(B.begin(), B.end());
// allocate the smallest size of A,B as maximum size
vector<int> c(A.size() < B.size() ? B.size() : A.size());
vector<int>::iterator i;
i = set_symmetric_difference(A.begin(), A.end(), B.begin(), B.end(), c.begin());
return vector<int>(c.begin(), i);
**NOTE:**
I get correct answers for the rest of examples. This example only gives me this wrong answer. | c++ | stl | null | null | null | null | open | STL set_symmetric_difference usage
===
I was solving a programming problem, which wants to find the SYMMETRIC DIFFERENCE between two sets. I have solved it using STL's `set_symmetric_difference`. I am given two `vector<int>s`, `A` and `B`:
> A = {342,654,897,312,76,23,78}
> B = {21,43,87,98,23,756,897,234,645,876,123}
Sould return (correct answer):
> { 21,43,76,78,87,98,123,234,312,342,645,654,756,876 }
But I get:
> { 21,43,76,78,87,98,123,234,312,342,645,65,756,876}
What is the problem ? Here is my code:
sort(A.begin(), A.end());
sort(B.begin(), B.end());
// allocate the smallest size of A,B as maximum size
vector<int> c(A.size() < B.size() ? B.size() : A.size());
vector<int>::iterator i;
i = set_symmetric_difference(A.begin(), A.end(), B.begin(), B.end(), c.begin());
return vector<int>(c.begin(), i);
**NOTE:**
I get correct answers for the rest of examples. This example only gives me this wrong answer. | 0 |
11,373,584 | 07/07/2012 08:44:20 | 1,494,003 | 07/01/2012 07:48:46 | 10 | 0 | Joining tuples within a list | I want to join a set of tuples that are within a list.
For example,
[(1, 2, 3), (1, 2, 4), (1, 2, 5)]
would become
[123, 124, 125]
(or ['123', '124', '125'] if it must become a string)
I have no idea how to do this, and searching returns little of use.
How do I go about this?
Thankyou | python | null | null | null | null | null | open | Joining tuples within a list
===
I want to join a set of tuples that are within a list.
For example,
[(1, 2, 3), (1, 2, 4), (1, 2, 5)]
would become
[123, 124, 125]
(or ['123', '124', '125'] if it must become a string)
I have no idea how to do this, and searching returns little of use.
How do I go about this?
Thankyou | 0 |
11,373,586 | 07/07/2012 08:44:31 | 1,389,014 | 05/11/2012 08:50:58 | 78 | 0 | Is there a way to number records extracted . | I need to extract data from my relational database as XML, and I need to assign a number to each record that I extract. I wrote the following XQuery...
<myRecords> {
let $i := 0
for $Territories in collection("Northwind.dbo.Territories")/Territories
let $i := $i + 1
return
<territory rec_count="{$i}">
{$Territories/TerritoryDescription/text()}
</territory>
} </myRecords>
... I don't get the result I expected:
<myRecords>
<territory rec_count="1">Westboro</territory>
<territory rec_count="1">Bedford</territory>
<territory rec_count="1">Georgetown</territory>
…
The record number isn't incremented. Why?
XQuery is a functional language without side effects — you can't really create a notion of state in XQuery as you might in Java or C#, for example. In some cases, you can simulate state using a recursive function, but to solve this problem there is a much simpler solution: you can use a positional variable. Here's the XQuery:
<myRecords> {
for $Territories at $i in collection("Northwind.dbo.Territories")/Territories
return
<territory rec_count="{$i}">
{$Territories/TerritoryDescription/text()}
</territory>
} </myRecords>
And here's the (hoped-for) result:
<myRecords>
<territory rec_count="1">Westboro</territory>
<territory rec_count="2">Bedford</territory>
<territory rec_count="3">Georgetow</territory>
… | xquery | null | null | null | null | null | open | Is there a way to number records extracted .
===
I need to extract data from my relational database as XML, and I need to assign a number to each record that I extract. I wrote the following XQuery...
<myRecords> {
let $i := 0
for $Territories in collection("Northwind.dbo.Territories")/Territories
let $i := $i + 1
return
<territory rec_count="{$i}">
{$Territories/TerritoryDescription/text()}
</territory>
} </myRecords>
... I don't get the result I expected:
<myRecords>
<territory rec_count="1">Westboro</territory>
<territory rec_count="1">Bedford</territory>
<territory rec_count="1">Georgetown</territory>
…
The record number isn't incremented. Why?
XQuery is a functional language without side effects — you can't really create a notion of state in XQuery as you might in Java or C#, for example. In some cases, you can simulate state using a recursive function, but to solve this problem there is a much simpler solution: you can use a positional variable. Here's the XQuery:
<myRecords> {
for $Territories at $i in collection("Northwind.dbo.Territories")/Territories
return
<territory rec_count="{$i}">
{$Territories/TerritoryDescription/text()}
</territory>
} </myRecords>
And here's the (hoped-for) result:
<myRecords>
<territory rec_count="1">Westboro</territory>
<territory rec_count="2">Bedford</territory>
<territory rec_count="3">Georgetow</territory>
… | 0 |
11,373,589 | 07/07/2012 08:45:08 | 976,050 | 10/03/2011 04:13:20 | 95 | 0 | Calling variable from PHP Switch | I can upload my document onto my main testing directory. But I wish to call out my variable which is staffNo and place it in the specific staffNo directory. But I'm not able to parse out the variable even though I have declared my appropriate name for my input.
For example:
**Staff Page**
<form id="Staff" name="Staff" method="post" action="upload.php" enctype="multipart/form-data">
//My staffno variable
<input type="hidden" id="staffNo" name="staffNo" value="<?php echo $staffNo?>"/>
//Upload document
<input name="upload" id="upload" type="file"/>";
<input type="hidden" name="upload" value="upload"/>";
//Submit button
<input type="submit" name="submit" value="Submit">
</form>
**upload.php**
switch($_POST['submit'])
{
case 'Submit':
if ($_FILES["upload"]["error"] > 0)
{
echo "Error: " . $_FILES["upload"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["upload"]["name"] . "<br />";
echo "Type: " . $_FILES["upload"]["type"] . "<br />";
echo "Stored in: " . $_FILES["upload"]["tmp_name"];
move_uploaded_file($_FILES["upload"]["tmp_name"],
"documents/"."staffNo"."/".$_FILES["upload"]["name"]);
echo "Stored in: " ."./documents/"."staffNo"."/". $_FILES["upload"]["name"];
}
break;
case 'others':
break;
default;
My staffNo variable was not able to call out even though it is under the form already. Did I did wrong somewhere? And I also wanted to create a new folder for the staffNo if it's not found inside. But now the basic staffNo variable was unable to call out. Kindly advise. | php | sqlite3 | null | null | null | null | open | Calling variable from PHP Switch
===
I can upload my document onto my main testing directory. But I wish to call out my variable which is staffNo and place it in the specific staffNo directory. But I'm not able to parse out the variable even though I have declared my appropriate name for my input.
For example:
**Staff Page**
<form id="Staff" name="Staff" method="post" action="upload.php" enctype="multipart/form-data">
//My staffno variable
<input type="hidden" id="staffNo" name="staffNo" value="<?php echo $staffNo?>"/>
//Upload document
<input name="upload" id="upload" type="file"/>";
<input type="hidden" name="upload" value="upload"/>";
//Submit button
<input type="submit" name="submit" value="Submit">
</form>
**upload.php**
switch($_POST['submit'])
{
case 'Submit':
if ($_FILES["upload"]["error"] > 0)
{
echo "Error: " . $_FILES["upload"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["upload"]["name"] . "<br />";
echo "Type: " . $_FILES["upload"]["type"] . "<br />";
echo "Stored in: " . $_FILES["upload"]["tmp_name"];
move_uploaded_file($_FILES["upload"]["tmp_name"],
"documents/"."staffNo"."/".$_FILES["upload"]["name"]);
echo "Stored in: " ."./documents/"."staffNo"."/". $_FILES["upload"]["name"];
}
break;
case 'others':
break;
default;
My staffNo variable was not able to call out even though it is under the form already. Did I did wrong somewhere? And I also wanted to create a new folder for the staffNo if it's not found inside. But now the basic staffNo variable was unable to call out. Kindly advise. | 0 |
11,351,203 | 07/05/2012 19:26:52 | 1,195,909 | 02/07/2012 22:45:53 | 46 | 1 | Python sequence translation | I have a list of pairs like `[(0, 34), (1, 77), (2, 6), (3, 60), (4, 2), (5, 5), (6, 13)]` and I'd like to reenumerate this list keeping the order and changing only the second elements with integers from 0 to n - 1, where n is the list length. The result should be `[(0, 4), (1, 6), (2, 2), (3, 5), (4, 0), (5, 1), (6, 3)]`.
I began writing a function that accepts integer sequences, but not integer pairs:
def translation(seq):
return [sorted(set(seq)).index(x) for x in seq]
>>> translate([34, 77, 6, 60, 2, 5, 13])
[4, 6, 2, 5, 0, 1, 3]
` | python | sequence | null | null | null | null | open | Python sequence translation
===
I have a list of pairs like `[(0, 34), (1, 77), (2, 6), (3, 60), (4, 2), (5, 5), (6, 13)]` and I'd like to reenumerate this list keeping the order and changing only the second elements with integers from 0 to n - 1, where n is the list length. The result should be `[(0, 4), (1, 6), (2, 2), (3, 5), (4, 0), (5, 1), (6, 3)]`.
I began writing a function that accepts integer sequences, but not integer pairs:
def translation(seq):
return [sorted(set(seq)).index(x) for x in seq]
>>> translate([34, 77, 6, 60, 2, 5, 13])
[4, 6, 2, 5, 0, 1, 3]
` | 0 |
11,351,205 | 07/05/2012 19:26:58 | 247,002 | 01/09/2010 09:49:49 | 1,354 | 59 | Charge event if phone turned off | I am looking for a way to hook into the charge event, that is started if the device is turned off. You know that one, that starts an animation of a charging battery.
I am having a rooted phone and want to start the phone if the charger is connected.
Fist of all I need to know what part of the system this is? The bootloader?
| android | null | null | null | null | null | open | Charge event if phone turned off
===
I am looking for a way to hook into the charge event, that is started if the device is turned off. You know that one, that starts an animation of a charging battery.
I am having a rooted phone and want to start the phone if the charger is connected.
Fist of all I need to know what part of the system this is? The bootloader?
| 0 |
11,351,206 | 07/05/2012 19:27:02 | 1,329,707 | 04/12/2012 16:49:48 | 73 | 3 | createReadStream to pipe into stdin of a spawn | I have hit a bit of a road block and i am wondering if anyone can help me out.
I am trying to use ".pipe()" to redirect a file to the stdin of a spawned process
so if anyone knows how to correctly pipe a stream made with createReadStream into the stdin of a process created with spawn i would love a a little example code :D
function pdf_to_text(f,callback){
var convert = spawn('pdftotext', ['-','-'])
f.pipe(convert.stdin)
//... do stuff
}
pdf_to_text(process.stdin,process_log) // this will work just fine
pdf_to_text(fs.createReadStream('./test.txt'),process_log) // i can't get this to work for the life of me
| node.js | null | null | null | null | null | open | createReadStream to pipe into stdin of a spawn
===
I have hit a bit of a road block and i am wondering if anyone can help me out.
I am trying to use ".pipe()" to redirect a file to the stdin of a spawned process
so if anyone knows how to correctly pipe a stream made with createReadStream into the stdin of a process created with spawn i would love a a little example code :D
function pdf_to_text(f,callback){
var convert = spawn('pdftotext', ['-','-'])
f.pipe(convert.stdin)
//... do stuff
}
pdf_to_text(process.stdin,process_log) // this will work just fine
pdf_to_text(fs.createReadStream('./test.txt'),process_log) // i can't get this to work for the life of me
| 0 |
11,351,207 | 07/05/2012 19:27:14 | 742,058 | 05/06/2011 15:35:34 | 248 | 22 | Another discussion on when a specific DTO class is required | I am working on a large project which, in part, is to replace an existing server stack. With a large, very normalized database, it was clear that we would need to construct many composite objects. An example of one of my queries is such:
My composite object definition:
[DataContract]
public class CompositeEvent
{
Guid eventIdentity;
string accountIdentity;
string eventMessage;
DateTime eventLoggedOn;
string methodName;
string programName;
string userIdentity;
List<CompositeException> exceptions = new List<CompositeException>( );
List<CompositeParameter> methodParameters = new List<CompositeParameter>( );
List<CompositeParameter> databaseParameters = new List<CompositeParameter>( );
[DataMember]
public Guid EventIdentity
{
get { return eventIdentity; }
set { eventIdentity = value; }
}
[DataMember]
public string AccountIdentity
{
get { return accountIdentity; }
set { accountIdentity = value; }
}
[DataMember]
public string EventMessage
{
get { return eventMessage; }
set { eventMessage = value; }
}
[DataMember]
public DateTime EventLoggedOn
{
get { return eventLoggedOn; }
set { eventLoggedOn = value; }
}
[DataMember]
public string MethodName
{
get { return methodName; }
set { methodName = value; }
}
[DataMember]
public string ProgramName
{
get { return programName; }
set { programName = value; }
}
[DataMember]
public string UserIdentity
{
get { return userIdentity; }
set { userIdentity = value; }
}
public string QualifiedCreator
{
get
{
if ( String.IsNullOrEmpty( programName ) && String.IsNullOrEmpty( methodName ) )
return string.Empty;
return string.Format( "{0}:{1}", String.IsNullOrEmpty( ProgramName ) ? "{undefined}" : ProgramName, String.IsNullOrEmpty( MethodName ) ? "{undefined}" : MethodName );
}
}
[DataMember]
public int EventTypeIdentity { get; set; }
[DataMember]
public string EventTypeName { get; set; }
[DataMember]
public List<CompositeException> Exceptions
{
get { return exceptions; }
set { exceptions = value; }
}
[DataMember]
public List<CompositeParameter> MethodParameters
{
get { return methodParameters; }
set { methodParameters = value; }
}
[DataMember]
public List<CompositeParameter> DatabaseParameters
{
get { return databaseParameters; }
set { databaseParameters = value; }
}
}
And my database query in my service :
using ( Framework.Data.FrameworkDataEntities context = new Data.FrameworkDataEntities( ) )
{
var list = from item in context.EventLogs
join typeName in context.EventLogTypes on item.EventTypeId equals typeName.Id
orderby item.EventLoggedOn, item.EventLogType
select new CompositeEvent
{
AccountIdentity = item.AccountIdentity,
EventIdentity = item.Id,
EventLoggedOn = item.EventLoggedOn,
EventMessage = item.EventMessage,
EventTypeIdentity = item.EventTypeId,
EventTypeName = typeName.EventTypeName,
MethodName = item.MethodName,
ProgramName = item.ProgramName,
UserIdentity = item.UserIdentity
};
return new List<CompositeEvent>( list );
}
Now it is clear from the definition of my composite object that it only contains data, no business rules, and no other persistence or exposure of business structure, data structure, or anything else.
Yet my team mate states that this can only exist in the domain model and I MUST spend cycles moving my data from this well-defined object to a DTO. Not only that but a) all DTO's must have DTO in their name and b) they must only exist for the purpose of being moved across the network. So when our client code is developed it must a) create properties of each object property and b) move from the DTO to the view model properties.
I feel that this is taking DTO to the extreme. That based on the definition of the composite objects that these ARE data transfer objects. Also I see absolutely no issue with storing this object in the client and doing bindings directly to this object in the client. Since all I'm doing is taking every property defined in the composite object and copying them into the DTO it seems to be a massive waste of time and cycles to create an object only to copy it to another object then copy it once again to internal properties of the client.
I'm interested in other opinions on this. I feel that I'm not violating any of the OOP rules such as Separation of Concerns or Single Responsibility Principle ... at least as long as you don't become extremely anal about these. Opinions???? | c# | dto | srp | soc | null | null | open | Another discussion on when a specific DTO class is required
===
I am working on a large project which, in part, is to replace an existing server stack. With a large, very normalized database, it was clear that we would need to construct many composite objects. An example of one of my queries is such:
My composite object definition:
[DataContract]
public class CompositeEvent
{
Guid eventIdentity;
string accountIdentity;
string eventMessage;
DateTime eventLoggedOn;
string methodName;
string programName;
string userIdentity;
List<CompositeException> exceptions = new List<CompositeException>( );
List<CompositeParameter> methodParameters = new List<CompositeParameter>( );
List<CompositeParameter> databaseParameters = new List<CompositeParameter>( );
[DataMember]
public Guid EventIdentity
{
get { return eventIdentity; }
set { eventIdentity = value; }
}
[DataMember]
public string AccountIdentity
{
get { return accountIdentity; }
set { accountIdentity = value; }
}
[DataMember]
public string EventMessage
{
get { return eventMessage; }
set { eventMessage = value; }
}
[DataMember]
public DateTime EventLoggedOn
{
get { return eventLoggedOn; }
set { eventLoggedOn = value; }
}
[DataMember]
public string MethodName
{
get { return methodName; }
set { methodName = value; }
}
[DataMember]
public string ProgramName
{
get { return programName; }
set { programName = value; }
}
[DataMember]
public string UserIdentity
{
get { return userIdentity; }
set { userIdentity = value; }
}
public string QualifiedCreator
{
get
{
if ( String.IsNullOrEmpty( programName ) && String.IsNullOrEmpty( methodName ) )
return string.Empty;
return string.Format( "{0}:{1}", String.IsNullOrEmpty( ProgramName ) ? "{undefined}" : ProgramName, String.IsNullOrEmpty( MethodName ) ? "{undefined}" : MethodName );
}
}
[DataMember]
public int EventTypeIdentity { get; set; }
[DataMember]
public string EventTypeName { get; set; }
[DataMember]
public List<CompositeException> Exceptions
{
get { return exceptions; }
set { exceptions = value; }
}
[DataMember]
public List<CompositeParameter> MethodParameters
{
get { return methodParameters; }
set { methodParameters = value; }
}
[DataMember]
public List<CompositeParameter> DatabaseParameters
{
get { return databaseParameters; }
set { databaseParameters = value; }
}
}
And my database query in my service :
using ( Framework.Data.FrameworkDataEntities context = new Data.FrameworkDataEntities( ) )
{
var list = from item in context.EventLogs
join typeName in context.EventLogTypes on item.EventTypeId equals typeName.Id
orderby item.EventLoggedOn, item.EventLogType
select new CompositeEvent
{
AccountIdentity = item.AccountIdentity,
EventIdentity = item.Id,
EventLoggedOn = item.EventLoggedOn,
EventMessage = item.EventMessage,
EventTypeIdentity = item.EventTypeId,
EventTypeName = typeName.EventTypeName,
MethodName = item.MethodName,
ProgramName = item.ProgramName,
UserIdentity = item.UserIdentity
};
return new List<CompositeEvent>( list );
}
Now it is clear from the definition of my composite object that it only contains data, no business rules, and no other persistence or exposure of business structure, data structure, or anything else.
Yet my team mate states that this can only exist in the domain model and I MUST spend cycles moving my data from this well-defined object to a DTO. Not only that but a) all DTO's must have DTO in their name and b) they must only exist for the purpose of being moved across the network. So when our client code is developed it must a) create properties of each object property and b) move from the DTO to the view model properties.
I feel that this is taking DTO to the extreme. That based on the definition of the composite objects that these ARE data transfer objects. Also I see absolutely no issue with storing this object in the client and doing bindings directly to this object in the client. Since all I'm doing is taking every property defined in the composite object and copying them into the DTO it seems to be a massive waste of time and cycles to create an object only to copy it to another object then copy it once again to internal properties of the client.
I'm interested in other opinions on this. I feel that I'm not violating any of the OOP rules such as Separation of Concerns or Single Responsibility Principle ... at least as long as you don't become extremely anal about these. Opinions???? | 0 |
11,351,214 | 07/05/2012 19:27:34 | 810,015 | 06/22/2011 09:03:40 | 7 | 1 | replacing nested if statement with and | I am wondering whether nested if is better than AND statement. I have a loop that goes so many times so I am thinking of faster execution available. Below is the code that has same logic with my code. The nested if statement is inside a loop.
for ( int i = 0; i < array.length; i++)
{
// do stuff
if (x == 5)
{
if (y == 3)
{
// do stuff
}
}
}
Will my code be faster by a significant difference if I replace the nested if with this And STATEMENT?
if ((x == 5) && (y == 3))
// do stuff
I have read this [link](http://stackoverflow.com/questions/337037/replacing-nested-if-statements) but I didn't find the answer. I am a student and still learning, thanks for all the feedback! | c# | nested-if | null | null | null | null | open | replacing nested if statement with and
===
I am wondering whether nested if is better than AND statement. I have a loop that goes so many times so I am thinking of faster execution available. Below is the code that has same logic with my code. The nested if statement is inside a loop.
for ( int i = 0; i < array.length; i++)
{
// do stuff
if (x == 5)
{
if (y == 3)
{
// do stuff
}
}
}
Will my code be faster by a significant difference if I replace the nested if with this And STATEMENT?
if ((x == 5) && (y == 3))
// do stuff
I have read this [link](http://stackoverflow.com/questions/337037/replacing-nested-if-statements) but I didn't find the answer. I am a student and still learning, thanks for all the feedback! | 0 |
11,351,216 | 07/05/2012 19:27:42 | 137,695 | 07/13/2009 20:44:43 | 56 | 1 | Aptana 3 - Setup PHP Executable | I'm trying to use an Aptana plugin that requires a PHP executable with a certain name. Everywhere online people just say to go to Window > Preferences > PHP > PHP Executables.
There is no "PHP Executables" menu in my Aptana 3 though.
Is there another way to setup PHP Executables in Aptana 3? | php | aptana3 | null | null | null | null | open | Aptana 3 - Setup PHP Executable
===
I'm trying to use an Aptana plugin that requires a PHP executable with a certain name. Everywhere online people just say to go to Window > Preferences > PHP > PHP Executables.
There is no "PHP Executables" menu in my Aptana 3 though.
Is there another way to setup PHP Executables in Aptana 3? | 0 |
11,351,218 | 07/05/2012 19:27:50 | 1,427,151 | 05/30/2012 22:28:29 | 21 | 2 | Slider changes scrolling of the screen when clicked | I am working on a website <http://dev.io-web.com/portfolio.aspx> and am having difficulty with the slider that I programmed. **For some reason when you click to change slides it resets the position of the scrolling on the site to the top. Is there a way to make it not change the position of the screen?** I'll include part of the code for the slider as well so it's easier to understand what I'm doing:
$(".slide1").click(function() {
if(current_slide != "slide1"){
$(".arrow").animate({"margin-left":"349px"});
if(current_slide == "slide2"){
$(".slide2_display").stop(true,true).fadeOut().hide();
$(".slide1_display").fadeIn().show();
current_slide = "slide1";
$("#slide2content").hide();
$("#slide1content").show();
}
else if(current_slide == "slide3"){
$(".slide3_display").stop(true,true).fadeOut().hide();
$(".reps_display").fadeIn().show();
current_slide = "slide1";
$("#slide3content").hide();
$("#slide1content").show();
}
else{
$(".slide4_display").stop(true,true).fadeOut().hide();
$(".slide1_display").fadeIn().show();
current_slide = "slide1";
$("#slide4content").hide();
$("#slide1content").show();
}
}
});
I have this coded for each of the 4 different displays. It should only change the displays and not change the scrolling of the page, but maybe the click function automatically does something like that. Any help with a solution would be greatly appreciated. Feel free to take a look at the work in progress at the url listed above. | javascript | jquery | slider | null | null | null | open | Slider changes scrolling of the screen when clicked
===
I am working on a website <http://dev.io-web.com/portfolio.aspx> and am having difficulty with the slider that I programmed. **For some reason when you click to change slides it resets the position of the scrolling on the site to the top. Is there a way to make it not change the position of the screen?** I'll include part of the code for the slider as well so it's easier to understand what I'm doing:
$(".slide1").click(function() {
if(current_slide != "slide1"){
$(".arrow").animate({"margin-left":"349px"});
if(current_slide == "slide2"){
$(".slide2_display").stop(true,true).fadeOut().hide();
$(".slide1_display").fadeIn().show();
current_slide = "slide1";
$("#slide2content").hide();
$("#slide1content").show();
}
else if(current_slide == "slide3"){
$(".slide3_display").stop(true,true).fadeOut().hide();
$(".reps_display").fadeIn().show();
current_slide = "slide1";
$("#slide3content").hide();
$("#slide1content").show();
}
else{
$(".slide4_display").stop(true,true).fadeOut().hide();
$(".slide1_display").fadeIn().show();
current_slide = "slide1";
$("#slide4content").hide();
$("#slide1content").show();
}
}
});
I have this coded for each of the 4 different displays. It should only change the displays and not change the scrolling of the page, but maybe the click function automatically does something like that. Any help with a solution would be greatly appreciated. Feel free to take a look at the work in progress at the url listed above. | 0 |
11,350,823 | 07/05/2012 19:01:05 | 780,257 | 06/01/2011 22:07:42 | 16 | 0 | AVG and GROUP BY | I have a set of records from which I select and average various data, and group by the hour. It seems as if this function/query does an excellent job of averaging as I am getting 744 records with no problems. However from June 8 to June 16 it seems to skip the averaging and group by. As massive as the data is I have combed through trying to find a reason why this might occur. It seems as if the data in those rows are no different than the data in the other rows and there should be no reason for skipping of records from June 8 to June 16. There are NULLS, but I would assume AVG would just skip this data? Has anyone seen or encountered this error before? | sql | select | group-by | avg | null | null | open | AVG and GROUP BY
===
I have a set of records from which I select and average various data, and group by the hour. It seems as if this function/query does an excellent job of averaging as I am getting 744 records with no problems. However from June 8 to June 16 it seems to skip the averaging and group by. As massive as the data is I have combed through trying to find a reason why this might occur. It seems as if the data in those rows are no different than the data in the other rows and there should be no reason for skipping of records from June 8 to June 16. There are NULLS, but I would assume AVG would just skip this data? Has anyone seen or encountered this error before? | 0 |
11,693,382 | 07/27/2012 18:14:05 | 526,108 | 12/01/2010 05:42:52 | 149 | 5 | Smart GWT: Construct CheckboxItem from array | I'm using smart gwt and I have the code:
for(int i = 0; i < userArray.length; i++) {
CheckboxItem c1 = new CheckboxItem();
c1.setTitle(userArray[i]);
c1.setName("c1[]");
frmUsers.setFields(c1);
}
in which I intend to present a user with checkbox options, but it doesn't work. Any idea on how I can achieve this will highly appreciated. | gwt | checkbox | null | null | null | null | open | Smart GWT: Construct CheckboxItem from array
===
I'm using smart gwt and I have the code:
for(int i = 0; i < userArray.length; i++) {
CheckboxItem c1 = new CheckboxItem();
c1.setTitle(userArray[i]);
c1.setName("c1[]");
frmUsers.setFields(c1);
}
in which I intend to present a user with checkbox options, but it doesn't work. Any idea on how I can achieve this will highly appreciated. | 0 |
11,693,384 | 07/27/2012 18:14:17 | 1,226,780 | 02/22/2012 20:18:03 | 13 | 0 | Error while gathering tablenames from Database c# and asp.net | Database Name is ONLINEEXAM
I have several tables in the db and i want to list some table names starts with letters "set % " in Dropdownlist in asp.net
Here i used the following code and i m getting the Error is :
**invalid object name ONLINEEXAM.dbo.sysobjects**
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
paperset();
}
}
private void paperset()
{
try
{
string conn = ConfigurationManager.ConnectionStrings["sqlconn"].ConnectionString;
SqlConnection con = new SqlConnection(conn);
con.Open();
SqlCommand cmd = new SqlCommand("select * from ONLINEEXAM.dbo.sysobjects where name like 'Set%'", con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
ListItem item = new ListItem();
item.Value = dr[0].ToString();
papersetlist.Items.Add(item);
}
dr.Close();
con.Close();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
}
} | c# | asp.net | sql | sql-server | database | null | open | Error while gathering tablenames from Database c# and asp.net
===
Database Name is ONLINEEXAM
I have several tables in the db and i want to list some table names starts with letters "set % " in Dropdownlist in asp.net
Here i used the following code and i m getting the Error is :
**invalid object name ONLINEEXAM.dbo.sysobjects**
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
paperset();
}
}
private void paperset()
{
try
{
string conn = ConfigurationManager.ConnectionStrings["sqlconn"].ConnectionString;
SqlConnection con = new SqlConnection(conn);
con.Open();
SqlCommand cmd = new SqlCommand("select * from ONLINEEXAM.dbo.sysobjects where name like 'Set%'", con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
ListItem item = new ListItem();
item.Value = dr[0].ToString();
papersetlist.Items.Add(item);
}
dr.Close();
con.Close();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
}
} | 0 |
11,693,386 | 07/27/2012 18:14:19 | 1,558,428 | 07/27/2012 18:06:26 | 1 | 0 | JQUERY refreshing .val() after inserting in to database | How do I can refresh time()
$("#leaveComment").find("input#time").val("<? echo time(); ?>");
after inserting into database (insert database is configured and working in file resources/lib/add-comment.php)?
[here is full code of needed jquery][1]
[1]: http://paste.php.lv/6281064c6d1aa8b1e67ef5e2a03f47ae?lang=javascript | php | jquery | value | refresh | null | null | open | JQUERY refreshing .val() after inserting in to database
===
How do I can refresh time()
$("#leaveComment").find("input#time").val("<? echo time(); ?>");
after inserting into database (insert database is configured and working in file resources/lib/add-comment.php)?
[here is full code of needed jquery][1]
[1]: http://paste.php.lv/6281064c6d1aa8b1e67ef5e2a03f47ae?lang=javascript | 0 |
11,693,390 | 07/27/2012 18:14:31 | 538,429 | 12/10/2010 21:54:25 | 180 | 10 | Updating existing custom properties word doc | I am trying to update existing custom properties programatically on a word .doc (word 97 - 2003). I initially solved with Aspose but due to limited licenses I can't use it for this project.
This code is taken wholesale from here with minor modifications for word instead of excel http://stackoverflow.com/questions/1137763/accessing-excel-custom-document-properties-programatically.
The first method works to add a custom property if it does not exist, the second can pull custom properties. I have not figured out how to update a property that already exists. I think it might have to do with the verb in InvokeMember() but I can't find much documentation.
public void SetDocumentProperty(string propertyName, string propertyValue)
{
object oDocCustomProps = oWordDoc.CustomDocumentProperties;
Type typeDocCustomProps = oDocCustomProps.GetType();
object[] oArgs = {propertyName,false,
MsoDocProperties.msoPropertyTypeString,
propertyValue};
typeDocCustomProps.InvokeMember("Add",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
oDocCustomProps,
oArgs);
}
public object GetDocumentProperty(string propertyName, MsoDocProperties type)
{
object returnVal = null;
object oDocCustomProps = oWordDoc.CustomDocumentProperties;
Type typeDocCustomProps = oDocCustomProps.GetType();
object returned = typeDocCustomProps.InvokeMember("Item",
BindingFlags.Default |
BindingFlags.GetProperty, null,
oDocCustomProps, new object[] { propertyName });
Type typeDocAuthorProp = returned.GetType();
returnVal = typeDocAuthorProp.InvokeMember("Value",
BindingFlags.Default |
BindingFlags.GetProperty,
null, returned,
new object[] { }).ToString();
return returnVal;
} | c# | ms-word | null | null | null | null | open | Updating existing custom properties word doc
===
I am trying to update existing custom properties programatically on a word .doc (word 97 - 2003). I initially solved with Aspose but due to limited licenses I can't use it for this project.
This code is taken wholesale from here with minor modifications for word instead of excel http://stackoverflow.com/questions/1137763/accessing-excel-custom-document-properties-programatically.
The first method works to add a custom property if it does not exist, the second can pull custom properties. I have not figured out how to update a property that already exists. I think it might have to do with the verb in InvokeMember() but I can't find much documentation.
public void SetDocumentProperty(string propertyName, string propertyValue)
{
object oDocCustomProps = oWordDoc.CustomDocumentProperties;
Type typeDocCustomProps = oDocCustomProps.GetType();
object[] oArgs = {propertyName,false,
MsoDocProperties.msoPropertyTypeString,
propertyValue};
typeDocCustomProps.InvokeMember("Add",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
oDocCustomProps,
oArgs);
}
public object GetDocumentProperty(string propertyName, MsoDocProperties type)
{
object returnVal = null;
object oDocCustomProps = oWordDoc.CustomDocumentProperties;
Type typeDocCustomProps = oDocCustomProps.GetType();
object returned = typeDocCustomProps.InvokeMember("Item",
BindingFlags.Default |
BindingFlags.GetProperty, null,
oDocCustomProps, new object[] { propertyName });
Type typeDocAuthorProp = returned.GetType();
returnVal = typeDocAuthorProp.InvokeMember("Value",
BindingFlags.Default |
BindingFlags.GetProperty,
null, returned,
new object[] { }).ToString();
return returnVal;
} | 0 |
11,693,391 | 07/27/2012 18:14:36 | 398,467 | 07/21/2010 21:00:27 | 61 | 3 | How can I create and download a zip file using Actionscript | I'm developing an application using Adobe Flex 4.5 SDK, in which the user would be able to export multiple files bundled in one zip file. I was thinking that I must need to take the following steps in order for performing this task:
1- Create a temporary folder on the server for the user who requested the download. Since it is an anonymous type of user, I have to read Sate/Session information to identify the user.
2- Copy all the requested files into the temporary folder on the server
3- Zip the copied file
4- Download the zip file from the server to the client machine
I was wondering if anybody knows any best-practice/sample-code for the task
Thanks | flex | flash-builder | null | null | null | null | open | How can I create and download a zip file using Actionscript
===
I'm developing an application using Adobe Flex 4.5 SDK, in which the user would be able to export multiple files bundled in one zip file. I was thinking that I must need to take the following steps in order for performing this task:
1- Create a temporary folder on the server for the user who requested the download. Since it is an anonymous type of user, I have to read Sate/Session information to identify the user.
2- Copy all the requested files into the temporary folder on the server
3- Zip the copied file
4- Download the zip file from the server to the client machine
I was wondering if anybody knows any best-practice/sample-code for the task
Thanks | 0 |
11,693,401 | 07/27/2012 18:15:14 | 428,073 | 08/23/2010 05:58:43 | 773 | 8 | How do i make JOIN when need to carried out first table column values? | I have two tables `rawtable` and `tradetable`
rawtable
rawid companyname uniqueID
1 AAA-XA 9CV
2 BBB-DEMO 10K
3 CCC-XOXO 7D
tradetable
tradeid securityname CUSIP
1 AAACOMP 9CV
2 BBBCOMP 10K
Now what i need is `companyname` from `rawtable` is bit mixed so i need to have `securityname` from `tradetable` as companyname for that i used LEFT JOIN
declare DataSourceId = 3;
SELECT DISTINCT
@DataSourceId,
dbo.CleanText(tradetable.securityname),
FROM
tradetable
LEFT JOIN
(
SELECT DISTINCT
companyname,
uniqueID
FROM
rawtable
) rawtable ON tradetable.cusip = rawtable. uniqueID
which will give me `names` from `tradetable` but here i will miss the new not matching names from `rawtable` but i want those name too but in select statemnt
if i use
declare DataSourceId = 3;
SELECT DISTINCT
@DataSourceId,
dbo.CleanText(rawtable.securityname) --instead of tradetable
then i will select wrong mixed name
solw can i solve this problem? or from somewhere else i need to carried out correct names as i want it like `tradetable` `securityname `
description :
rawtable
companyname uniqueID
AAA-XA 9CV
BBB-DEMO 10K
CCC-XOXO 7D
tradetable
securityname CUSIP
AAACOMP 9CV
BBBCOMP 10K
in `raw table` `companyname` is `AAA-XA` which is not correct for `uniqueID `
it should be `AAACOMP` as it is there in table `tradetable`
i need to pass these select staement parameter to stored procedure so need to carried out
1. correct names 2. additional records also which is from `rawtable` so for correct name
need to go else where or any other solution?
| sql | sql-server | stored-procedures | join | left-join | null | open | How do i make JOIN when need to carried out first table column values?
===
I have two tables `rawtable` and `tradetable`
rawtable
rawid companyname uniqueID
1 AAA-XA 9CV
2 BBB-DEMO 10K
3 CCC-XOXO 7D
tradetable
tradeid securityname CUSIP
1 AAACOMP 9CV
2 BBBCOMP 10K
Now what i need is `companyname` from `rawtable` is bit mixed so i need to have `securityname` from `tradetable` as companyname for that i used LEFT JOIN
declare DataSourceId = 3;
SELECT DISTINCT
@DataSourceId,
dbo.CleanText(tradetable.securityname),
FROM
tradetable
LEFT JOIN
(
SELECT DISTINCT
companyname,
uniqueID
FROM
rawtable
) rawtable ON tradetable.cusip = rawtable. uniqueID
which will give me `names` from `tradetable` but here i will miss the new not matching names from `rawtable` but i want those name too but in select statemnt
if i use
declare DataSourceId = 3;
SELECT DISTINCT
@DataSourceId,
dbo.CleanText(rawtable.securityname) --instead of tradetable
then i will select wrong mixed name
solw can i solve this problem? or from somewhere else i need to carried out correct names as i want it like `tradetable` `securityname `
description :
rawtable
companyname uniqueID
AAA-XA 9CV
BBB-DEMO 10K
CCC-XOXO 7D
tradetable
securityname CUSIP
AAACOMP 9CV
BBBCOMP 10K
in `raw table` `companyname` is `AAA-XA` which is not correct for `uniqueID `
it should be `AAACOMP` as it is there in table `tradetable`
i need to pass these select staement parameter to stored procedure so need to carried out
1. correct names 2. additional records also which is from `rawtable` so for correct name
need to go else where or any other solution?
| 0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.