Daily Archives

Articles indexed Saturday April 17 2010

Page 14/81 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • How to substr html entities properly?

    - by Emily
    Hi everyone. I have like this : $mytext="that&#039;s really &quot;confusing&quot; and &lt;absolutly&gt; silly"; echo substr($mytext,0,6); The output in this case will be : that&# instead of that's What i want is to count html entities as 1 character then substr, because i always end up with breaked html or some obscure characters at the end of text. Please don't suggest me to html decode it then substr then encode it, i want a clean method :) Thanks

    Read the article

  • [Repost-ish] Impossibly slow queries, Tables indexed, How can I speed it up?

    - by colorfulgrayscale
    Hi guys, I posted a little earlier on here at http://stackoverflow.com/questions/2656837/query-results-taking-too-long-on-200k-database-speed-up-tips asking about slow executing SQL queries. I was told to index the columns; I did. and its still slow (slow as in, i never see the results, both mysql and sqlite freeze up on query). Help would be greatly appreciated. Here is the SQL SELECT equipment.`unitID` AS `equipment_unitID`, equipment.`fleetCode` AS `equipment_fleetCode`, equipment.type AS equipment_type, equipment.tiremap AS equipment_tiremap, tiremap.`TireID` AS `tiremap_TireID`, tiremap.`WorkMap` AS `tiremap_WorkMap`, tiremap.`Position` AS `tiremap_Position`, tiremap.`DepthMap` AS `tiremap_DepthMap`, tiremap.timestamp AS tiremap_timestamp, workreference.`aMap` AS `workreference_aMap`, workreference.`bMap` AS `workreference_bMap`, tirework.`RO` AS `tirework_RO`, tirework.location AS tirework_location, tirework.mileage AS tirework_mileage, tirework.`mechanicCode` AS `tirework_mechanicCode`, tirework.`partNumber` AS `tirework_partNumber`, tirework.`historyID` AS `tirework_historyID`, tirework.workmap AS tirework_workmap, tirework.timestamp AS tirework_timestamp FROM equipment, tiremap, workreference, tirework WHERE equipment.tiremap = tiremap.`TireID` AND tiremap.`WorkMap` = workreference.`aMap` AND workreference.`bMap` = tirework.workmap LIMIT 5 and here is the EXPLAIN for it id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE equipment ALL tiremap 14079 1 SIMPLE tiremap ref PRIMARY,WorkMap,TireID,WorkMap_2 PRIMARY 52 tire.equipment.tiremap 3 1 SIMPLE workreference ref aMap,bMap aMap 52 tire.tiremap.WorkMap 1 1 SIMPLE tirework eq_ref NewIndex1 NewIndex1 52 tire.workreference.bMap 1

    Read the article

  • php and mysql listing databases and looping through results

    - by Jacksta
    Beginner help needed :) I am doign an example form a php book which lists tables in databases. I am getting an error on line 36: $db_list .= "$table_list"; <?php //connect to database $connection = mysql_connect("localhost", "admin_cantsayno", "cantsayno") or die(mysql_error()); //list databases $dbs = @mysql_list_dbs($connection) or die(mysql_error()); //start first bullet list $db_list = "<ul>"; $db_num = 0; //loop through results of functions while ($db_num < mysql_num_rows($dbs)) { //get database names and make each a list point $db_names[$db_num] = mysql_tablename($dbs, $db_num); $db_list .= "<li>$db_names[$db_num]"; //get table names and make another list $tables = @mysql_list_tables($db_names[$db_num]) or die(mysql_error()); $table_list = "<ul>"; $table_num = 0; //loop through results of function while ($table_num < mysql_num_rows($tables)){ //get table names and make each bullet point $table_names[$table_num] = mysql_tablename($tables, $table_num); $table_list .= "<li>$table_names[$table_num]"; $table_num++; } //close inner bullet list and increment number to continue $table_list .= "</ul>" $db_list .= "$table_list"; $db_num++; } //close outer bullet list $db_list .= "</ul>"; ?> <html> <head> <title>MySQL Tables</title> </head> <body> <p><strong>Data bases and tables on local host</strong></p> <? echo "$db_list"; ?> </body>

    Read the article

  • java web browser slow

    - by zachary
    org.eclipse.swt.browser.Browser I load the embedded browser into java and have it load a page. It seems to load really slow... is this an issue with the page caching? What can I do to speed this up?

    Read the article

  • How to allow sorting in the Django admin by a custom list_display field, which doesn't have a DB fie

    - by Gj
    I have a custom list_display field which is responsible for a column of integers in one of my admin pages. I need to allow staff members to sort according to it. There's a solution for how to acheive that if the integer represents a count/average/etc of some DB field, which is not the case for me. [ the solution for that case is here: http://stackoverflow.com/questions/2168475/django-admin-how-to-sort-by-one-of-the-custom-list-display-fields-that-has-no-da ] Any ideas how I can achieve this sorting without actually creating and maintaining a DB field for the values?

    Read the article

  • Which JMS broker implementations allowing resending messages saved in dead message queue?

    - by marabol
    I wonder, if there JMS broker, that allows administrators to resend (via GUI or any tool) messages, saved in a ded message queue or dead letter queue, after solving the causing problem (e.g. database is down, not enough space...). WebSphere provide a feature to resend messages saved in dead letter queue: 1 Glassfish 2.1.1 using Sun Java System Message Queue 4.4 has no feature to do this, I think so. What are the options on other JMS brokers? Or is the best way, not to use the DMQ/DLQ feature, if you are depend on a message? Thanks a lot

    Read the article

  • How can I send an std::vector<std::string> over a UNIX socket?

    - by Mike
    For my application, I need to be able to send an std::vector<std::string> over a UNIX socket(local), and get a copy of the vector on the other end of the socket. What's the easiest way to do this with O(1) messages relative to the size of the vector(i.e. without sending a message for each string in the vector)? Since this is all on the same host, and because I control both ends of the socket, I'm not concerned with machine-specific issues such as endinness or vector/string representation.

    Read the article

  • How to setup Xcode 3.1.4 with Perforce ?

    - by Azeworai
    Hi everyone, I've been trying to setup Xcode with Perforce for about 7 hours now and managed to get the Perforce Repository Authenticated within Xcode. The problem I have is, within the repositories window, I don't see any directories for me to check out. I can see the p4root login and client are ok with the tick on the repository log. When I try to Import an xcode project directory within the Perforce root directory- the import fails with '/Users/jackson/p4root/alpha/MessageTapper' is not under the Perforce root. I have p4d running on the local machine, and have created a user and workspace. The workspace has the directories in view. I'm hoping for someone to give me some direction or maybe point me to a good reference to how to set perforce up with xcode. Thanks!

    Read the article

  • logging in scala

    - by IttayD
    In Java, the standard idiom for logging is to create a static variable for a logger object and use that in the various methods. In Scala, it looks like the idiom is to create a Logging trait with a logger member and mixin the trait in concrete classes. This means that each time an object is created it calls the logging framework to get a logger and also the object is bigger due to the additional reference. Is there an alternative that allows the ease of use of "with Logging" while still using a per-class logger instance? EDIT: My question is not about how one can write a logging framework in Scala, but rather how to use an existing one (log4j) without incurring an overhead of performance (getting a reference for each instance) or code complexity. Also, yes, I want to use log4j, simply because I'll use 3rd party libraries written in Java that are likely to use log4j.

    Read the article

  • Multiple records with one request in RESTful system

    - by keithjgrant
    All the examples I've seen regarding a RESTful architecture have dealt with a single record. For example, a GET request to mydomain.com/foo/53 to get foo 53 or a POST to mydomain.com/foo to create a new Foo. But what about multiple records? Being able to request a series of Foos by id or post an array of new Foos generally would be more efficient with a single API request rather than dozens of individual requests. Would you "overload" mydomain.com/foo to handle requests for both a single or multiple records? Or would you add a mydomain.com/foo-multiple to handle plural POSTs and GETs? I'm designing a system that may potentially need to get many records at once (something akin to mydomain.com/foo/53,54,66,86,87) But since I haven't seen any examples of this, I'm wondering if there's something I'm just not getting about a RESTful architecture that makes this approach "wrong".

    Read the article

  • Why there is no open source framework (like Java) for C# application development?

    - by Calvin
    Hi, C# is much more popular than Java in recent years. As a general-purpose programming language, many people feel that C# is better designed than Java. Why until now there is no open source framework for C# application development? Why no one take the initiative to develop a open source framework for C# which is comparable to Java? (Many people say Mono is not a mature framework and should not be used in serious application development.) Calvin

    Read the article

  • strange problem when placing UILabels on UITableView and calling reloadData

    - by user262325
    Hello everyone I hope to list all files in a directory to an UITableView atableview There are files in Document directory a.txt b.txt F (folder) c.txt in folder F, there are 2 files M.exe N.exe When I change to folder F, it should display on atableview M.exe N.exe but Result is in F, it displayed b.txt F the codes are shown as below -(void) removeACell:(NSInteger)row; { NSUInteger _lastSection = 0;//[self numberOfSectionsInTableView:atableview]; NSUInteger _lastRow =row;// [atableview numberOfRowsInSection:_lastSection] - 1; NSUInteger _path[2] = {_lastSection, _lastRow}; NSIndexPath *_indexPath = [[NSIndexPath alloc] initWithIndexes:_path length:2]; NSArray *_indexPaths = [[NSArray alloc] initWithObjects:_indexPath, nil]; [_indexPath release]; [atableview deleteRowsAtIndexPaths:_indexPaths withRowAnimation:UITableViewRowAnimationBottom]; [_indexPaths release]; } -(void) reloadDirectory { if([fileArray count]>0) { NSInteger n=fileArray.count; for(int i=n-1;i>=0;i--) { [fileArray removeObjectAtIndex: i]; [self removeACell:i]; } } NSFileManager *manager = [NSFileManager defaultManager]; NSLog(@"*******************" ); NSLog(@"ffff%@",[self appDelegate].gCurrentPath_AppDelegate); for(NSString *path in [manager contentsOfDirectoryAtPath:[self appDelegate].gCurrentPath_AppDelegate error:nil]) { NSDictionary *modData= [manager attributesOfItemAtPath: [appDelegate.gCurrentPath_AppDelegate //directory of files stringByAppendingPathComponent:path ] error:nil ]; NSDate * dateModified=(NSDate *) [modData objectForKey:NSFileModificationDate]; NSNumber *fileSize=[modData objectForKey:NSFileSize] ; if(dateModified) { FileObj *newobj=[[FileObj alloc] init ]; [ newobj seta:1]; NSString *ss=[[NSString alloc] initWithFormat:@"%@",path] ; [newobj setfileName:ss]; NSLog(@"---------------%@",ss); BOOL isDir; [manager fileExistsAtPath:[appDelegate.gCurrentPath_AppDelegate stringByAppendingPathComponent:path ] isDirectory:&isDir]; [newobj setisDirectory: isDir ]; [newobj setfilePath:@"1"]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"EEE MMM dd HH:mm:ss zzz yyyy"]; NSString *stringFromDate =[[NSString alloc] initWithString: [formatter stringFromDate:dateModified]]; [newobj setfileDate:stringFromDate]; [formatter release]; NSString * fileSize1= [[NSString alloc] initWithFormat:@"%d",[fileSize integerValue] ]; [newobj setfileSize: fileSize1]; [ fileArray addObject:newobj]; [newobj release]; }; [atableview reloadData]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSInteger row=[indexPath row]; NSInteger section=[indexPath section]; static NSString *SimpleTableIdentifier1 = @"CellTableIdentifier"; UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ]; int newRow = [indexPath row]; selectIndex=newRow; if(cell==nil) { //**breakpoint AAA here** CGRect cellframe=CGRectMake(0, 0, 300, 60); cell=[[[UITableViewCell alloc] initWithFrame:cellframe reuseIdentifier:SimpleTableIdentifier1] autorelease]; if ([[fileArray objectAtIndex:row] getisDirectory]) { UIImage *image = [UIImage imageNamed:@"folder.png"]; cell.imageView.image = image; } else { UIImage *image = [UIImage imageNamed:@"files.png"]; cell.imageView.image = image; } cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton; ///-------------------------------------------------------- UILabel *b1 =[ [UILabel alloc]init]; b1.frame = CGRectMake(40.9f,8.0f,250.0f,20.0f) ; [b1 setBackgroundColor:[UIColor clearColor]]; [b1 setTag:(row+15000)]; //------------------------------------------------------- UILabel *b2 =[ [UILabel alloc]init]; b2.frame = CGRectMake(40.9f,30.0f,250.0f,13.0f) ; [b2 setBackgroundColor:[UIColor clearColor]]; [b2 setTag:row+16000]; [b2 setFont:[UIFont systemFontOfSize:10.0]]; //------------------------------------------------ UILabel *b3 =[ [UILabel alloc]init]; b3.frame = CGRectMake(40.9f,45.0f,250.0f,13.0f) ; [b3 setBackgroundColor:[UIColor clearColor]]; [b3 setFont:[UIFont systemFontOfSize:10.0]]; [b3 setTag:row+17000]; [cell.contentView addSubview:b1]; [cell.contentView addSubview:b2]; [cell.contentView addSubview:b3]; [b1 release]; [b2 release]; [b3 release]; }; if([fileArray count]>0) //check if fileArray is correct { NSLog(@"___________________" ); for (int i=0;i<[fileArray count];i++) { NSLog(@"->%@",[[fileArray objectAtIndex:i] getfileName] ); } } UILabel *tem1UILabel=(UILabel*)[cell.contentView viewWithTag:row+15000]; NSString *s1=[[NSString alloc] initWithFormat: [[fileArray objectAtIndex:row] getfileName] ]; NSLog(@"--->%@",s1 ); tem1UILabel.text=s1; [s1 release]; UILabel *tem2UILabel=(UILabel*)[cell.contentView viewWithTag:row+16000]; NSString *s2=[[NSString alloc] initWithFormat: [[fileArray objectAtIndex:row] getfileDate] ]; tem2UILabel.text=s2; [s2 release]; UILabel *tem3UILabel=(UILabel*)[cell.contentView viewWithTag:row+17000]; NSString *s3=[[NSString alloc] initWithFormat: [[fileArray objectAtIndex:row] getfileSize]]; tem3UILabel.text=s3; [s3 release]; return cell; } I set the breakpoint at AAA and found that when I loaded folder F, my application did stop at the breakpoint. But I have removed all cells in atableview before call 'reloadData'. I checked the content of fileArray which is the data source of atableview and found that everything is correct except the display on atableview. Welcome any comment. Thanks interdev

    Read the article

  • authlogic rails question - how to code for an API

    - by phil swenson
    I have authlogic going on my app, but now I need to have an an API. I don't want to establish a session, just want a user to send in data in a json request such as: {"type":"address","password":"mypassword","name":"my notificaiton name goes here","user":"myusername","text":"my interesting stuff goes here"} So questions - 1) is this a decent approach? 2) how do i do the auth inside my rails controller?

    Read the article

  • weird FileField url in admin site

    - by panchicore
    My model class TheFile(models.Model): document = models.FileField(upload_to="archivos") The weird HTML admin link: <a hacking_google_maps_and_google_earth.pdf="" archivos="" media="" localhost:8000="" http:="" href="" target="_blank">archivos/Hacking_Google_Maps_And_Google_Earth.pdf</a> If I firebug-edit the href="" it works :S

    Read the article

  • NHibernate Transactions Best Practices

    - by Ramiro
    I have been reading about Nhibernate for a while and have been trying to use it for a site I'm implementing. I read the article by Billy McCafferty on NHibernate best practices but I did not see any indication on where is the best place to handle transactions. I thought of putting that code in the Data Access Object (DAO) but then I'm not sure how to handle cases in which more than one DAO is used. What are the best places to put transaction code in your NHibernate Application?

    Read the article

  • select for update with ruby oci8

    - by ash34
    how do I do a 'select for update' and then 'update' the row using ruby oci8. I have two fields counter1 and counter2 in a table which has only 1 record. I want to select the values from this table and then increment them by locking the row using select for update. thanks.

    Read the article

  • Login and register page PHP

    - by Ben
    How do I make a log in (as one document) and register (as another document) page for my site using PHPMyAdmin? So that people can register and log into my site. Thanks! Benjamin

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >