Posts

javascript - WYSIWYG without the HTML tags? -

is possible take text wysiwyg editor? example, if have following text: <a href="whatever"> sdadsa<>,.<> <p </a> is possible take text inside sdadsa<>,.<> ? some might don't use editor need make 2 copies 1 tags , other without html tags , html tags match. is possible take text without html tags? if want strip html tags out of output, have 2 methods: with php - use strip_tags($output) . with javascript - type var plaintext= editoroutput.replace(/(<([^>]+)>)/ig,""); or use php.js's equivalent php method.

Svn update paths from a file in command line. How? Is it possibly? -

i have lot of file paths in file should updated. not know, how can this. tried use < operator , not working. if update 1 one, takes long time. any idea? what can in such case use svn's changelist mechanism. you can create own list first: $> svn changelist mylist /src/cpp/foo $> svn changelist mylist /src/cpp/bar and can use during update this: $> svn update --changelist mylist this way, file in list mylist updated. note can use changelists commit files only.

python - Recursively delete folders below 3rd level in large structure of folders -

i have large structure of thousands of folders only, interested in keeping folders in top 3 levels, , deleting rest. looking recursive python script this. appreciated. untested, os.walk() : import os import shutil base = '.' root, dirs, files in os.walk(base): n = 0 head = root while head , head != base: head, _ = os.path.split(head) n += 1 if n == 3: dir in dirs: shutil.rmtree(os.path.join(root, dir)) del dirs[:] # clear dirs os.walk() doesn't subdirectories

mysql - CREATE table LIKE a JOIN -

select * t1 join t2 on t1.id1 = t2.id2 yields join of tables on mysql. how can store result in third table without having define column column. i tried create third table doesn't work. create table t3 ( select * t1 join t2 on t1.id1 = t2.id2 ) if want new table contain results of select : create table t3 select * t1 join t2 on t1.id1 = t2.id2 or if want based on schema of join: create table t3 select * t1 join t2 on t1.id1 = t2.id2 false

Creating vector of boost dynamic_bitset in C++ -

i want create array of dynamic_bitsets. created vector of dynamic_bitset using, vector<boost::dynamic_bitset<>> v; how can specify size of each of these dynamic_bitsets i.e. v[0], v[1] etc? in general case, specify size through constructor. boost::dynamic_bitset<> x(3); this line vector<boost::dynamic_bitset<>> v; create empty vector. instead have requested filled default entries have same value, 1 does vector<int> v(n, 1); to create vector n entries 1 vector<boost::dynamic_bitset<>> v( n, boost::dynamic_bitset<>(3) ) ; to have contain n boost::dynamic_bitset<> s 3 bits. if vector contains enough elements should able set v[i] different size v[i] = boost::dynamic_bitset<>( 100 ) ; alternative create empty vector , use v.push_back(boost::dynamic_bitset<>(42)) add correctly sized elements.

javascript - How do I make a jquery modal always centered on the page? -

i've see problem jquery modal popup boxes. i'm wondering, there jquery code keep jquery modal centered in page? know can achieved pure javascript code jquery? if want center element jquery, try this; var browserw = $(window).width(); var centerele = (browserw - 960) / 2; //if ur website design's width 960 $('.centeredele').css({'left':centerele + 'px'});//or margin-left, ur choise

php - Escaped value ('\s) in database -

i'm using codeigniter, , basically: $val = $this->db->call_function('real_escape_string', $this->input->post('name')); this on data before putting database. , when enters value o'hara, in database appear o\'hara so, guess can string slashes on output, usual way of escaping , storing data in database? solved active records escapes query, double escaping, 'real_escape_string' function so guess don't need use real_escape_string @ all, active records the '\' called escape character , must used next character after (in case ') won't interfere sql statement. however, if you're using ci, should take care of of you. there's 'html helper' believe can use format or take out slashes on outputted text. then, wrong, when outputting values db in ci, slashes automatically stripped.