Posts

Featured post

php - Remove before echoing -

say have list this hello1 hello2 hello3 hello4 goodbye hello6 hello7 hello8 how can remove goodbye , print everything else besides goodbye? use unset , array_search this: $array = array('hello1','hello2','hello3','hello4','goodbye','hello6','hello7','hello8'); if(($key = array_search('goodbye', $array)) !== false) unset($array[$key]); this 2 things in 1 if statement: if assigned value of $key (the return value of array_search ) truthy, proceed , use index, otherwise, don't anything. necessary because if return value of array_search false , resulting $array[false] not intended behavior @ all.

sql server - python to mssql encoding problem -

Image
greetings by using pymssql library, want write data mssql database encounter encoding issues. here sample code write db: # -*- coding: utf-8 -*- import _mssql .... connection info data here .... def mssql_connect(): return _mssql.connect(server=host, user=username, password=pass, database=db, charset="utf-8") con = mssql_connect() insert_ex_sql = "insert mydatabsae (id, programname, programdetail) values (1, 'test characters ÜŞiçÇÖö', 'löşüiiğĞü');" con.execute_non_query(insert_ex_sql) con.close() sadly data written db corrupted: the collacation of mssql db is: turkish_ci_as how can solved? here possible solution : the key insert_ex_sq.encode('your language encoder') . try instead: con.execute_non_query(insert_ex_sq.encode('your language encoder'))

compression - File formats with included versioning -

i idea of using compressed folders containers file formats. used libreoffice or dia. if want define special purpose file format, can define folder , file structure , zip root folder , have single file data in single file. imported files live originals inside compressed file. defining binary file format 0 features lot of work. now question: there applications using compressed folders file formats , versioning inside folder? benefits great. commit state in project file , versioning decorated functions own application. diffs presented own way. libraries working compressed files , versioning available. used versioning system should distributed system, repository lives inside working folder , not seperate example subversion client-server model. what think? i'm sure there applications out there using approach, couldn't find one. or there major drawback in approach? sounds interesting idea. know many applications claim have "unlimited" undo , redo, that...

command line - HELP: UDP broadcast vlc stream weirdness! -

hi i'm trying using vlc broadcast udp stream within lan, making tv channel. i used command line launch vlc vlc ok run = cvlc --repeat filename.avi --sout '#standard{access=udp,mux=ts,dst=239.255.12.42:8001} problem works on network, , have problem receiving on network without router! question: magical address "239.255.x.x" ? network hardware require udp broadcast besides switches , cables? wireless can accept udp broadcast? thanks answers! the 239.255.x.x addresses part of multicast address space, ranging 224.0.0.0 239.255.255.255 (and there specific-use areas in there). you've correctly noted doesn't work without router. because basic ip stack still wants know how route addresses determine interface send them on. can either add static route multicast (that address or multicast addresses), or put in default gateway.

.net - Probably simple regex search -

what regex find text#2? pattern it's first occurance of "z=" after c. text want rest of line after z=. i'm using regex in .net a x b x z=text#1 x c x z=text#2 .*c.*z=([^\n]*).* you'll need turn on . matching newlines ( regexoptions.singleline below). here's c# code generated my regex tester : using system; using system.text.regularexpressions; namespace myapp { class class1 { static void main(string[] args) { string sourcestring = "source string match pattern"; regex re = new regex(@".*c.*z=([^\n]*).*",regexoptions.singleline); matchcollection mc = re.matches(sourcestring); int midx=0; foreach (match m in mc) { (int gidx = 0; gidx < m.groups.count; gidx++) { console.writeline("[{0}][{1}] = {2}", midx, re.getgroupnames()[gidx], m.groups[gidx].value); } ...

opengl - Given a 4x4 homogeneous matrix, how can i get 3D world coords? -

so have object getting rotated translated , rotated again. storing matrix of these translations object member. when come object picking need know 3d world coords of object. currently have been able position of object so coords[0] = finalmatrix[12]; coords[1] = finalmatrix[13]; coords[2] = finalmatrix[14]; this giving me correct positions of objects want take rotations account well. any great... the matrix 4x4 matrix, you've got single dimensional matrix appears elements arranged follows: [0] [4] [8] [12] [1] [5] [9] [13] [2] [6] [10] [14] [3] [7] [11] [15] the rotation part top left 3x3 matrix see here , in case elements [0]-[2] , [4]-[6] , [8]-[10]

cmd - Consoles and Tabs -

when start tomcat server console using startup.bat script, new command window opens filled java logging statements. i use console2 leverages tabs each open console window. possible let java system create new tab within console2 instead of opening new command window? this has nothing java, merely down way catalina.bat called startup.bat catalina.bat can called either "start" argument or "run" argument. run start catalina in current window start start catalina in separate window so open startup.bat, scroll bottom should see "%executable%" start %cmd_line_args% change "%executable%" run %cmd_line_args% exit i add exit after close calling window.