Sunday, 1 September 2013

Find Kth Largest Sum Pair

Find Kth Largest Sum Pair

Given two arrays sorted in ascending order, we want to find the Kth
largest sum such that one element is picked from 1st array and the second
element is picked from the 2nd array.
I am already aware of the O(Klogk) solution , using Max-Heap given here .
I've read somewhere that there exists a O(k) solution for this (using two
pointers may be) , which i am unable to figure out .
Any ideas/approaches people ?

Saturday, 31 August 2013

How can I understand when a folder is opened using c++?

How can I understand when a folder is opened using c++?

How can I understand when a folder is opened using c++? I need it so much.
Any help will be appreciated? I want to get list of folders which they
currently r opened.

Multiple channel's message comes into single channel

Multiple channel's message comes into single channel

i am fresher of Spring Integration, i am confuing one question which i
have multiple channels but now i want to assemble messages from those
channel into single channel, how to implement it ? my senario is that i
have lots of businees modues and each module will corresponding to one
channel, those channels will receive the request then assemble the message
into one single channel , then output to the jms server:
is below code possible ?
<channel id='a'/> <bridge input-channel='a' out-channel='assembled'/>
<channel id='b'/> <bridge input-channel='b' out-channel='assembled'/>
<channel id='b'/> <bridge input-channel='c' out-channel='assembled'/>
<channel id='c'/> <bridge input-channel='d' out-channel='assembled'/>
<channel id='assembled'/>
<!-- the router will desicde which jms gateway to be sent -->
<router input-channel='assembled' >
<channel id='to_jms1'/>
<channel id='to_jms2'/>
<jms-outbound-gateway id='jms1' channel='to_jms1'/>
<jms-outbound-gateway id='jms2' channel='to_jms2'/>

change structure of url to directory-like structure

change structure of url to directory-like structure

pI know this question has been asked and answered many times, but my
experience of .htaccess, regualr expressions, mod rewrites etc.. have
normally drove me crazy./p pI see on most websites the structure of the
url is in a directory-like structure, codewwww.linku.biz/edit/code.
strongMy ultimate question is how do you do this?/strong/p pstrongAre all
these sites behind the scenes have normal URL variables but just
re-wrote?/strong such as codewww.linku.biz/myprofile?edit=whatever/code
strong, is this all done with .htaccess, and mod_rewrites?/strong/p ul
lipI want to type in my url codewww.linku.biz/search/code however its
actually codewww.linku.biz/search.php/code/p/li lipI want to type in my
url codewww.linku.biz/JackTrow/code however its actually
codewww.linku.biz/profile.php?us=JackTrow/code/p/li lipAlso I want data
re-wrote when I have lots of URL data, such as
codewww.linku.biz/search?a=1amp;b=2amp;c=3/code actually beeing
codewww.linku.biz/search.php?a=1amp;b=2amp;c=3/code/p/li /ul

Densefeaturedetector OpenCV not working with SURF and SIFT

Densefeaturedetector OpenCV not working with SURF and SIFT

When I use the DenseFeatureDetector in opencv, adding SURF or SIFT
DescriptorExtractor gives descriptor vectors that contains contains a lot
of zeros (seldomly contains numbers). While using using ORB or BRIEF as
DescriptorExtractor gives a vector with normal values. is that normal and
How can i fix that?

Ant detects non-existent package while IDE shows error

Ant detects non-existent package while IDE shows error

My ant build is working fine (compile, jar goals execute without errors).
However, the IDE shows errors in the code. I have tried Eclipse and
IntelliJ-IDEA; both show the same behaviour.
For example, in the following line
import com.google.javascript.rhino.head.ErrorReporter;
my IDE points out that the package com.google.javascript.rhino.head does
not exist. And it is true as I verified that no such package exists at
that location.
I would like to configure my IDE to build correctly so that I can use
debug features. What am I missing here?

Radio button checked attribute not updating on user action

Radio button checked attribute not updating on user action

I am trying to monitor the change on a radio group.
I am using topcoat with the following HTML :
<ul class="topcoat-list">
<li class="topcoat-list__item">
<label class="topcoat-radio-button__label">
<input type="radio" name="topcoat" value="1" checked="checked">
<div class="topcoat-radio-button"></div>
Test1
</label>
</li>
<li class="topcoat-list__item">
<label class="topcoat-radio-button__label">
<input type="radio" name="topcoat" value="2">
<div class="topcoat-radio-button"></div>
Test2
</label>
</li>
<li class="topcoat-list__item">
<label class="topcoat-radio-button__label">
<input type="radio" name="topcoat" value="3">
<div class="topcoat-radio-button"></div>
Test3
</label>
</li>
</ul>
For a reason I don't quite get, the checked attribute does not get updated
when the use selects another radio button...
I would like to be able to monitor the change with javascript, but right
now, I can't get the value of the radio group...