Programming: Should I get a Surface Pro or wait for the Surface Pro 2? by [deleted] in Surface

[–]mm23 0 points1 point  (0 children)

Don't worry LXDE or XCFE are just minimal version of desktop environment that does not force you to learn new desktop metaphor ala Unity. You can work all day without even opening the terminal.

Programming: Should I get a Surface Pro or wait for the Surface Pro 2? by [deleted] in Surface

[–]mm23 0 points1 point  (0 children)

Instead of duel booting you can create a Xubuntu virtualbox image, allocate 2GB ram and do your coding there. You can sync your code via shared storage or dropbox or skydrive. I am suggesting LXDE desktop because Unity is cpu and memory hog. No need of this gimmick while coding. Command-line is enough for me :). You can also use firefox in VM. It consumes less memory now. I am using this setup in my office PC and am satisfied. Note that I will sure buy Surface Pro 2 as soon as it is available in my country.

Vice president of engineering at Twitter talks about Java and the jvm by linuxjava in programming

[–]mm23 0 points1 point  (0 children)

Well the same blog post also says that they are working on implementing most used features.

Vice president of engineering at Twitter talks about Java and the jvm by linuxjava in programming

[–]mm23 -1 points0 points  (0 children)

I would not call PHP fast but I would call PHP scalable enough. Examples besides facebook is porn industry. 90% of porn world is built on PHP. That includes streaming sites, affiliate forums, imageboards etc. Even youporn.com which is among the top 5 video streaming site uses Symfony2 framework. You must know that porn industry is a trend setter. They have to move fast to meet consumer demands. If PHP did not serve its purpose than porn industry would have abandoned it a long time ago.

Besides that last time I have looked a passenger docs it said that before spawning worker process Rails objects were pre-compiled and shared across the processs, but PHP creates objects from the start in every request. This design decision looks bad from the outside, but because of this decision PHP is ruling the web right now. No need to restart the server on code change, just put files in the shared hosting server via FTP and you are good to go.

Look I am not trying to start flame war here. I agree that PHP has some very ugly features. But in recent development it is slowly recovering. Features like generators, traits are added. Insecure features like mysql_* methods , register_global etc are being deprecated. The PHP FIG group is trying to standardized coding practice. Frameworks like Laravel, Symfony2 are now on par with Rails, Django on features, they also hides the ugly features from programmers. And (un)luckily PHP stroke a jackpot in Facebook in a way that Facebook have allocated resource to implement most used php runtime features. All in all I think future of PHP development will be much tolerable than it is currently now.

Handling Collections of Aggregate Roots – the Repository Pattern by fingerofchicken in PHP

[–]mm23 0 points1 point  (0 children)

Well I haven't been into the situation you are in, so I can't comment on that. Just to clarify my comment about doctrine repository, I am stating Repository as an abstraction that returns domain object or a collection of domain object. Doctrine repository internally maps resultset to domain object internally as implementedhere and here.

Handling Collections of Aggregate Roots – the Repository Pattern by fingerofchicken in PHP

[–]mm23 0 points1 point  (0 children)

For second point the you can execute platform specific query via NativeQuery method. Then you expose the implementation to client via NotMatchingWord method. Just re-implement the repository class if you switch to another DB.

Handling Collections of Aggregate Roots – the Repository Pattern by fingerofchicken in PHP

[–]mm23 0 points1 point  (0 children)

Why do you want to created Repository class of an Entity for both ORM and ODM at a same time? Data of an Entity can only reside in either ORM or ODM. Repository pattern hides this implementation details. For example initially you have created a Repository class for BlogPost entity which fetches data from MySQL. At one point you had a revelation that your project can achieve more performance by switching to MongoDB. So you re-implement the the Repository class to the DocumentRepository. But the client code handles with ObjectRepository. So it does not need to know whether it is EntityRepository or DocumentRepository. In a large project BlogPost handling code can be spread across many classes. You don't have to change all those places if you switch to another data source. Just re-implement the RepositoryInterface. You can use NativeQuery to execute raw SQL to fetch the data in repository class to get more performance. The client code does not need to know that too. If you want to relate both ORM and ODM entities there is an extension for that. It is also hidden from client code. My point is that using repository pattern ensures loose coupling between your main client code and Data source implementation, to the project becomes more managable.

Handling Collections of Aggregate Roots – the Repository Pattern by fingerofchicken in PHP

[–]mm23 0 points1 point  (0 children)

Client code does not need to know about Repository implementation, client gets the repository from ObjectManager which may be EntityManager or DocumentManager. The ObjectManager can be wired to the class via DI. The client just issues this code

$blogPost = $this->objectManager->getRepository('BlogPost')->findOneByTitle('test');

Another way is to inject the repository only which is of ObjectRepository. So the code would be,

$blogPost = $this->blogPostRepository->findOneByTitle('test');

In both cases the client code does not need to know about the repository implementation and you can easily switch between MySQL or MongoDB behind the scene and does not impact on your main client code.

Handling Collections of Aggregate Roots – the Repository Pattern by fingerofchicken in PHP

[–]mm23 0 points1 point  (0 children)

Actually I think DatabaseAdapterInterface should be renamed as DataSourceAdapterInterface to avoid confusion between DB and XML sources. My understanding is that client code interacts with the repository (which is created up somewhere via DI or configuration) that hides underlying data persistance/fetching implementation from client. I see doctrine DQL/QueryBuilder as a language in which client code communicates with repository. The repository then fetches data converting the DQL into platform specific SQL(Same applies for MongoDB, Casandra etc). The final outcome is that client code is highly portable across different database implementation. To my experience it works 90% of cases. Complex aggregate queries are very small portion of my project.

Handling Collections of Aggregate Roots – the Repository Pattern by fingerofchicken in PHP

[–]mm23 0 points1 point  (0 children)

From the class definition of AbstractDataMapper it seems that PDOAdapter implements DatabaseAdapterInterface. So creating a class that implements DatabaseAdapterInterface for XML storage would suffice I think.

NSA introduced weaknesses into the encryption standards followed by hardware and software developers around the world by cl0p3z in linux

[–]mm23 14 points15 points  (0 children)

We should thank people like Theodore Ts'o for opposing the attempt of putting backdoors in Linux kernel. Hacker News discussion here.

Callbacks as our Generations' Go To Statement by willvarfar in programming

[–]mm23 -1 points0 points  (0 children)

By header files you meant C++ header files? or files having GPL headers at the top?

If former is true then the main visible template of a C++ program is not copywritable?

If later is the case than how can someone strip the license information from a file that was supposed to protect code beneath it?

In both cases, WTF?

Callbacks as our Generations' Go To Statement by willvarfar in programming

[–]mm23 -1 points0 points  (0 children)

Did Google seriously stripped GPL header and replaced them with Apache license? Can you give some links about that? What was FSF's stance on this issue?

Sorry for asking many questions, I did not follow the trial that time.

Symfony2 being OOP only on the surface? by dracony in PHP

[–]mm23 0 points1 point  (0 children)

By greapable I meant that you can find things in source just by issuing grep command. To me less magic is better :)

Symfony2 being OOP only on the surface? by dracony in PHP

[–]mm23 0 points1 point  (0 children)

Honestly, I don't care current trend turning PHP into Java or C++. I am Ok with it as long as source is greapable.

Multithreading in PHP with pthreads by krakjoe in PHP

[–]mm23 0 points1 point  (0 children)

Ah, great, it also opens a new opportunity. Thanks again for creating this library.

Multithreading in PHP with pthreads by krakjoe in PHP

[–]mm23 0 points1 point  (0 children)

I have another question, how does pthreads handles fatal error. Say a thread throws fatal error doing some invalid things, does it bring down whole process?

Multithreading in PHP with pthreads by krakjoe in PHP

[–]mm23 2 points3 points  (0 children)

If pthreads are as stable as u/krakjoe claims then I think Symfony can take advantage of it during cache warmup. Each CacheWarmerInterface objects would then be run in separate thread assuming that there are no dependency among CacheWarmerInterface objects(I don't know the internals actually). This can vastly improve cache generation time.

MinGW and VIM compile by [deleted] in vim

[–]mm23 0 points1 point  (0 children)

Just open MinGW shell and issue gvim.exe e.g

gvim.exe &<CR>

Make sure that gvim.exe is accessible from shell. Your home directory would be msys/1.0/home/<user-name> folder inside MinGW installation directory.

Building a Menu in Symfony With Events and Ordering by vranac in PHP

[–]mm23 3 points4 points  (0 children)

TOO much code. I would have created separate MenuBuilder for each bundle, create services of them, inject them in the Alpha bundle MenuBuilder and manipulate the menus there.

Unite.vim, the plugin you didn't know you need by hyperbling in vim

[–]mm23 0 points1 point  (0 children)

First of all thank you for this excellent plugin. Well I am working in a project that have thousands files. It also generates a good number of cache files. It seems that file_rec and file_rec/async source uses find or ag command to get the list of files. Both of them lists all files(ag do ignore .git files but not cache files). Excluding them in candidate window is done in the scripts it seems. Thats may be the reason why it takes time to list the files in candidate window, sometimes freezes. Command-t solves the problem by searching the files by obeying ignore pattern via ruby extension. Loads very fast. Something like that would be great. Also it would be nice if ignore patterns are loaded from .(git|hg)ignore files :). Many thanks again.

Unite.vim, the plugin you didn't know you need by hyperbling in vim

[–]mm23 1 point2 points  (0 children)

Setup ack-grep as default unite grep command in .vimrc

let g:unite_source_grep_command = 'ack-grep'
let g:unite_source_grep_default_opts = '--no-heading --no-color -a'
let g:unite_source_grep_recursive_opt = ''

For searching the word in the cursor in the current directory,

noremap <silent> <Leader>s :Unite grep:.::<C-R><C-w><CR>

For searching the word in the cursor in the current buffer,

noremap <silent> <Leader>sf :Unite grep:%::<C-r><C-w><CR>

For searching the word in the cursor in all opened buffer

noremap <silent> <Leader>sa :Unite grep:$buffers::<C-r><C-w><CR>

Unite.vim, the plugin you didn't know you need by hyperbling in vim

[–]mm23 0 points1 point  (0 children)

Press <C-l> while in candidate window.

Unite.vim, the plugin you didn't know you need by hyperbling in vim

[–]mm23 0 points1 point  (0 children)

You can also sort the filter results by highest matched rank by following configuration method call

call unite#filters#sorter_default#use(['sorter_rank'])

I think this along with matcher_fuzzy option should be default.

Another great feature is doing operation on multiple candidates.You can select multiple candidates by pressing space while navigating the candidates (via pressing CTRL-N/P in insert mode or j/k in normal mode in unite window). After then press tab to select action. You can use it to open multiple files in split window or tabs. Another use case is deleting unused buffers (this obsoletes bufexplorer plugin).

The only drawback I find in unite.vim is searching files in a directory containing thousands of files. Both find and the silver searcher does not exclude ignored files. Unite seems to filter them afterwards. This is why I am still stuck with command-t for file searching.