Posts

How php and own frameworks works in background? -

i new on web programming .i on c# .net platform on desktop. tried understand php , php frameworks confused little . understand php file can import classes in file php file require_once function. frameworks doesnt import own classes require_once function . think different dont understand.can explain me please? most frameworks uses technique called "autoloading" automatically resolve , include needed dependencies. an "autoloader" function called php when unknown class being referenced. "autoloader" can either procedurally create class or include external file based on file name. the current (php 5.1.2 , higher) proper way of doing using spl_autoload_register() . here example of autoloader: function autoload_example($classname) { $normalizedname = strtolower($classname); if(file_exists('includes/' . $normalizedname . '.inc')) { require_once('includes/' . $normalizedname . '.inc'); } elseif(file...

postgresql - How to add custom DB provider to be accessible in Visual Studio? -

Image
i wanted work custom db provider in visual studio. need use entity framework. for example, downloaded npgsql, registered them in gac: gacutil -i c:\temp\npgsql.dll gacutil -i c:\temp\mono.security.dll and added machine.config file: <add name="npgsql data provider" invariant="npgsql" support="ff" description=".net framework data provider postgresql server" type="npgsql.npgsqlfactory, npgsql, version=2.0.6.0, culture=neutral, publickeytoken=5d8b90d52f46fda7" /> but npgsql did not appear in datasource list in visual studio: how add custom db provider list? upd: if use command string edmgen.exe got error: error 7001: failed find or load registered .net framework data provider. you need declare dbfactoryprovider in config file (web.config, machine.config, etc). here's sample 1 pulled project using mysql: <system.data> <dbproviderfactories> <remove invariant="mysq...

linux - c++ profiler that can attach to a running process? -

i have program written in c++ want profile, , want avoid restarting when start , stop profiling. ideally profiling both cpu usage , memory allocation. there tool allow me this? i'm running on linux. free oprofile perf systemtap (probably want redhat/centos distro this) not free vtune

ruby - Installing RMagick Gem -

i wanted gem install rmagick and got this: building native extensions. take while... error: error installing rmagick: error: failed build gem native extension. /usr/bin/ruby1.8 extconf.rb extconf.rb:1:in `require': no such file load -- mkmf (loaderror) extconf.rb:1 imagemagick , libmagickwand-dev installed. using ubuntu linux. any help? yours, joern. use rvm install ruby (preferred) or use apt-get install ruby ruby-dev aptitude install build-essential imagemagick libmagickcore-dev libmagickwand-dev gem install rmagick --edit 1-- need ruby-dev (or ruby-full) compiling rmagick before gem install.

emacs:highlight the current line by underline it -

in vim, can use "set cursorline" in dotvim file turn on. there way in emacs? in .emacs, customize face hl-line-mode , like: (global-hl-line-mode 1) (set-face-attribute hl-line-face nil :underline t) hl-line-face variable stores name of face hl-line-mode uses show current line. can customize :foreground :background , bunch of other attributes liking. check docs here . the global-hl-line-mode turns on highlighting current line in buffers. if want in buffers, turn on m-x hl-line-mode .

c# - iTextSharp 5 polish character -

i have problem polish character using itextsharp. want create pdf html. works fine polish character missing. use function lower: private void createpdf(string html) { //memorystream msoutput = new memorystream(); textreader reader = new stringreader(html);// step 1: creation of document-object document document = new document(pagesize.a4, 30, 30, 30, 30); // step 2: // create writer listens document // , directs xml-stream file pdfwriter writer = pdfwriter.getinstance(document, new filestream("test.pdf", filemode.create)); // step 3: create worker parse document htmlworker worker = new htmlworker(document); // step 4: open document , start worker on document document.open(); worker.startdocument(); // step 5: parse html document worker.parse(reader); // step 6: close document , worker worker.enddocument(); worker.close(); ...

wildcard - The issue of * in Command line argument -

i wrote program in java accepts input via command line arguments. input of 2 numbers , operator command line. multiply 2 numbers, have give input e.g. 5 3 * , it's not working written. why not accepting * command line? that's because * shell wildcard: has special meaning shell, expands before passing on command (in case, java ). since need literal * , need escape shell. exact way of escaping varies depending on shell, can try: java programname 5 3 "*" or: java programname 5 3 \* by way, if want know shell * , try printing content of string[] args main method. you'll find contain names of files in directory. this can handy if need pass filenames command line arguments. see also wikipedia: glob for example, if directory contains 2 files, a.log , b.log command cat *.log expanded shell cat a.log b.log wikipedia: escape character in bourne shell ( sh ), asterisk ( * ) , question mark ( ? ) characters wildcard charact...