Posts

How to replace first occurrence of string in Java -

i want replace first occurrence of string in following. string test = "see comments, test, us" **if test contains input follows should not replace see comments, (with space @ end) see comments, see comments** i want output follows, output: test, thanks in advance, you can use replacefirst(string regex, string replacement) method of string.

c++ - hash_map not working -

#include <ext/hash_map> using namespace std; class hash_t : public __gnu_cxx::hash_map<const char*, list<time_t> > { }; hash_t hash; ... i'm having problems using hash_map. const char* im using key 12 length number format 58412xxxxxxx. know there 483809 different numbers, should hash_map size after inserting everything, i'm getting 193 entries. hash_t::iterator = hash.find(origen.c_str()); if (it != hash.end()) { //found x++; (*it).second.push_front(fecha); } else { //not found y++; list<time_t> lista(1, fecha); hash.insert(make_pair(origen.c_str(), lista)); } the same procedure works using python dictionaries (i'm getting correct number of entries) not close using c++. possible since every key begins 58412 (actually every key, not of them, , that's reason don't want chop 5 chars), im getting lot of collisions? const char* not key, since have pointer comparison instead of strin...

css - Why aren't my hyperlinks changing colors or underlining? -

why aren't hyperlinks changing colors or underlining? have in css in standard vs 2010 site: a:link, a:visited { color: #034af3; outline: none; } a:hover { color: #1d60ff; text-decoration: none; outline: none; } a:active { color: #034af3; outline: none; } p { margin-bottom: 10px; line-height: 1.6em; } what doing wrong? in wrong spot? thanks! you have set not display text-decoration on hover. with hover decoration: http://jsfiddle.net/kbznb/ without hover decoration: http://jsfiddle.net/kbznb/1/ it looks changing color, due color similarities of #1d60ff , #034af3

Should an array or a class be used for holding multiple variables in PHP? -

currently, creating script parse information out of type of report passed it. there part of script pull students information report , save later processing. is best hold in form of class, or in array variable? figure there 3 methods use. edit: really, question comes down 1 way have sort of performance advantage? because otherwise, each method same last. as class direct access variables: class studentinformation { public $studentid; public $firstname; public $lastname; public $middlename; public $programyear; public $timegenerated; function studentinformation(){} } as class functions: class studentinformation { private $studentid; private $firstname; private $lastname; private $middlename; private $programyear; private $timegenerated; function studentinformation(){} public function setstudentid($id) { $this->studentid = $id; } public function getstudentid() { return $th...

Externalize strings in Javascript -

i have been searching on line tool externalized strings in javascript have been unable so. hoping there similar 1 built eclipse (source -> externalize strings...). if knows of tool or plugin eclipse accomplish that, let me know. we have software project mature needs support translations, , hence need string externalized. i suggest use json-based language look-up table if want populate these values via javascript. eclipse cannot this. see: localization in web app using javascript , json

sql server - Using stored procedure output parameters in C# -

i having problem returning output parameter sql server stored procedure c# variable. have read other posts concerning this, not here on other sites, , cannot work. here have. trying print value comes back. following code returns null value. trying return primary key. have tried using @@identity , scope_indentity() (i.e. set @newid = scope_identity() ). stored procedure: create procedure usp_insertcontract @contractnumber varchar(7), @newid int output begin insert [dbo].[contracts] (contractnumber) values (@contractnumber) select @newid = id [dbo].[contracts] contractnumber = @contractnumber end opening database: pvconnectionstring = "server = desktop-pc\\sqlexpress; database = pvdatabase; user id = sa; password = *******; trusted_connection = true;"; try { pvconnection = new sqlconnection(pvconnectionstring); pvconnection.open(); } catch (exception e) { databaseerror = true; } executing command: pvcommand = new sql...

python - How to perform multiple changes to a csv file without intervening writes -

i want perform multiple edits rows in csv file without making multiple writes output csv file. i have csv need convert , clean specific format program use. example, i'd to: remove blank rows remove rows value of column "b" not number with new data, create new column , explode first part of values in column b new column here's example of data: "a","b","c","d","e" "apple","blah","1","","0.00" "ape","12_fun","53","25","1.00" "aloe","15_001","51","28",2.00" i can figure out logic behind each process, can't figure out how perform each process without reading , writing file each time. i'm using csv module. there better way perform these steps @ once before writing final csv? i define set of tests , set of processes. if tests pass, processes appl...