Monday, 2 September 2013

Linux Screen, Log commands

Linux Screen, Log commands

Folks.
Is there a way to increase the screen log size? I cannot save all my
history...
$ screen -S creed1
$ command1
output command 1... (50 lines)
$ command2
output command 2... (200 lines)
$ command3
output command 3... (60 lines)
$ command4
output command 4... (75 lines)
Ctrl + A + H (saving hardcopy.0)
enter code herevim hardcopy.0 ... only shows the last 100 lines aprox.
I wanna know this for compliance purposes with a customer.
Thanks in advance.

Run Maxima on iOS Without Rejection From The App Store?

Run Maxima on iOS Without Rejection From The App Store?

Is there a way to run maxima on iOS?
I know running another binary is grounds for rejection, so is there a way
to not have to start another binary? Or is there another library that can
do what maxima can do? I need factor(), expand(), diff() and ratsimp(). Or
is this impossible?
I have not tried to do this with the exception of doing a little googling,
because I am not a super advanced at iOS Development, so I have no idea
how to go about this.
Thanks, Ari

IOS error while using a search bar

IOS error while using a search bar

Hi in my app I've a TableView in which I show something and I want to
search in this TableView for a text I write in the search bar, so I
followed this tutorial. In my app I'm having a problem, when I run the app
and I try to search a letter it crash and in xCode I see this information:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<__NSCFString 0x9e45990> valueForUndefinedKey:]: this class is not key
value coding-compliant for the key name.'. I checked my Storyboard to see
if I have something wrong, but it's all ok. So I guess the problem it's in
the code, I will post here my code and I hope you can help me what's
wrong.
#import "TableWasteViewController.h"
#import "WasteXmlParser.h"
#import "WasteDetailViewController.h"
@interface TableWasteViewController ()
@property(nonatomic,strong)NSArray *arrayWastes;
@property(nonatomic,strong)NSMutableArray *typeOfWaste;
@property(nonatomic,strong)NSMutableArray *typeOfBin;
@property(nonatomic,strong)NSMutableArray *indexWastes;
@property(nonatomic,strong)NSMutableArray *typeOfWasteBackup;
@end
@implementation TableWasteViewController
@synthesize searchBar;
@synthesize filteredWasteArray;
@synthesize typeOfWaste;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle
*)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
WasteXmlParser *parser = [[WasteXmlParser alloc]init];
[parser parseWasteXml];
self.arrayWastes = [[NSArray alloc]init];
self.arrayWastes = [parser.arrayWastes mutableCopy];
self.indexWastes = [[NSMutableArray alloc]init];
typeOfWaste = [[NSMutableArray alloc]init];
self.typeOfBin = [[NSMutableArray alloc]init];
for (int i = 0; i < [self.arrayWastes count]; i++) {
[typeOfWaste addObject:[self.arrayWastes[i] objectForKey:@"type"]];
}
self.filteredWasteArray = [NSMutableArray
arrayWithCapacity:[self.typeOfWaste count]];
self.typeOfWasteBackup = [self.typeOfWaste mutableCopy];
}
#pragma mark Content Filtering
- (void)filterContentForSearchText:(NSString*)searchText
scope:(NSString*)scope {
[self.filteredWasteArray removeAllObjects];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF.name
contains[c] %@", searchText];
filteredWasteArray = [NSMutableArray arrayWithArray:[typeOfWaste
filteredArrayUsingPredicate:predicate]];
}
#pragma mark - UISearchDisplayController Delegate Methods
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller
shouldReloadTableForSearchString:(NSString *)searchString {
[self filterContentForSearchText:searchString scope:
[[self.searchDisplayController.searchBar scopeButtonTitles]
objectAtIndex:[self.searchDisplayController.searchBar
selectedScopeButtonIndex]]];
return YES;
}
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller
shouldReloadTableForSearchScope:(NSInteger)searchOption {
[self
filterContentForSearchText:self.searchDisplayController.searchBar.text
scope:
[[self.searchDisplayController.searchBar scopeButtonTitles]
objectAtIndex:searchOption]];
return YES;
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
//return self.arrayWastes.count;
if (self.tableWaste ==
self.searchDisplayController.searchResultsTableView) {
return [filteredWasteArray count];
} else {
return [self.arrayWastes count];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
UIFont *myFont = [UIFont fontWithName:@"Arial" size:14.0];
if (cell == nil) {
cell = [[UITableViewCell
alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
cell.textLabel.font = myFont;
cell.textLabel.numberOfLines = 2;
//cell.textLabel.text =
[self.arrayWastes[indexPath.row]objectForKey:@"type"];
if (self.tableWaste ==
self.searchDisplayController.searchResultsTableView) {
cell.textLabel.text =
[self.filteredWasteArray[indexPath.row]objectForKey:@"type"];
} else {
cell.textLabel.text =
[self.arrayWastes[indexPath.row]objectForKey:@"type"];
}
return cell;
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSIndexPath *indexPath = [self.tableWaste indexPathForSelectedRow];
WasteDetailViewController *vc = segue.destinationViewController;
vc.typeOfWaste = [self.arrayWastes[indexPath.row]objectForKey:@"type"];
vc.typeOfBin = [self.arrayWastes[indexPath.row]objectForKey:@"place"];
vc.urlPic = [self.arrayWastes[indexPath.row]objectForKey:@"imgUrl"];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (IBAction)backToHome:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
@end
Thank you!

How to call external javascript function inside a php tag?

How to call external javascript function inside a php tag?

I have a php tag and inside that i have a script tag like this ..
<?php
echo' <script language= javascript type= text/javascript>
//HERE
</script>';
?>
I need to call external javascript function(External means external .js
file) and this is a .php page and have not I know this is a stupid
question but plz give me a solution??

Sunday, 1 September 2013

NPM Installs Package Outside Current Directory

NPM Installs Package Outside Current Directory

I try to install express package using npm from inside
/home/iwan/my-project directory:
npm install express
express@3.3.7 ../node_modules/express
„¥„Ÿ„Ÿ methods@0.0.1
„¥„Ÿ„Ÿ cookie-signature@1.0.1
„¥„Ÿ„Ÿ range-parser@0.0.4
„¥„Ÿ„Ÿ fresh@0.2.0
„¥„Ÿ„Ÿ buffer-crc32@0.2.1
„¥„Ÿ„Ÿ cookie@0.1.0
„¥„Ÿ„Ÿ debug@0.7.2
„¥„Ÿ„Ÿ send@0.1.4 (mime@1.2.11)
„¤„Ÿ„Ÿ commander@1.2.0 (keypress@0.1.0)
The strange thing is npm doesn't install express package in current dir
(/home/iwan/my-project/node_modules/express), but in
/home/iwan/node_modules/express.
Did i miss something?

How to remove every second occurrence within a string?

How to remove every second occurrence within a string?

Basically, I have a string that I need to search through and remove every
SECOND occurrence within it.
Here is what my string looks like ($s):
question1,answer1,answer2,answer3,answer4
question2,answer1,answer2,answer3,answer4
question3,answer1,answer2,answer3,answer4
Here is what my code currently looks like:
$toRemove = array("\n");
$finalString = str_replace($toRemove, "", $s);
As you can see, each line within my s string contains two \n between them.
I would like to search through my string and only replace every SECOND \n
so that my string ends up being:
question1,answer1,answer2,answer3,answer4
question2,answer1,answer2,answer3,answer4
question3,answer1,answer2,answer3,answer4
Is this possible? If so, how can I do it?

HtmlUnit button click

HtmlUnit button click

I'm trying to send a message on www.meetme.com but can't figure out how to
do it. I can type in the message in the comment area but clicking the Send
button doesn't do anything. What am I doing wrong? When I login and press
the Login button the page does change and everything is fine. Anyone have
any ideas or clues?
HtmlPage htmlPage = null;
HtmlElement htmlElement;
WebClient webClient = null;
HtmlButton htmlButton;
HtmlForm htmlForm;
try{
// Create and initialize WebClient object
webClient = new WebClient(BrowserVersion.FIREFOX_17 );
webClient.setCssEnabled(false);
webClient.setJavaScriptEnabled(false);
webClient.setThrowExceptionOnFailingStatusCode(false);
webClient.setThrowExceptionOnScriptError(false);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setUseInsecureSSL(true);
webClient.getCookieManager().setCookiesEnabled(true);
/*webClient.setRefreshHandler(new RefreshHandler() {
public void handleRefresh(Page page, URL url, int arg) throws
IOException {
System.out.println("handleRefresh");
}
});*/
htmlPage = webClient.getPage("http://www.meetme.com");
htmlForm =
htmlPage.getFirstByXPath("//form[@action='https://ssl.meetme.com/login']");
htmlForm.getInputByName("username").setValueAttribute("blah@gmail.com");
htmlForm.getInputByName("password").setValueAttribute("blah");
//Signing in
htmlButton = htmlForm.getElementById("login_form_submit");
htmlPage = (HtmlPage) htmlButton.click();
htmlPage =
webClient.getPage("http://www.meetme.com/member/1234567890");
System.out.println("BEFORE CLICK");
System.out.println(htmlPage.asText());
//type message in text area
HtmlTextArea commentArea =
(HtmlTextArea)htmlPage.getFirstByXPath("//textarea[@id='profileQMBody']");
commentArea.setText("Testing");
htmlButton = (HtmlButton)
htmlPage.getHtmlElementById("profileQMSend");
htmlPage = (HtmlPage)htmlButton.click();
webClient.waitForBackgroundJavaScript(7000);
//The print is exactly the same as the BEFORE CLICK print
System.out.println("AFTER CLICK");
System.out.println(htmlPage.asText());
}catch(ElementNotFoundException e){
e.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}