Thursday, 3 October 2013

url rewrite with multiple param

url rewrite with multiple param

I need to convert an URL, with some params like this:
/anytext/l1v5n3
to a normal URL with querystring:
/index.php?liv=1&id=5&lang=3
the params l, v, n could be in any order and the following value could be
numeric and can include special symbols (+,-, etc.)
Any help will be appreciated!

Wednesday, 2 October 2013

Sorted String List Array Based- Add Method

Sorted String List Array Based- Add Method

public void add(String item) throws ListException
// Inserts item into its proper position in a sorted list
// Throws an exception if the item connot be placed on the list
{
try
{
}
catch(Exception e)
{
throw new ListException("Add to List failed: " + e.toString());
}
}
i need help with the add method, how would go about this?

jQuery plugin's syntax is too strange

jQuery plugin's syntax is too strange

I have a little trouble about the meaning of syntax "(function( $ )" and
"(jQuery)" in the below code.
(function( $ ){
$.fn.myPlugin = function() {
// Do your awesome plugin stuff here
};})(jQuery);
Can you please explain what meaning of them ?
If I want to change phrase "(jQuery)" in the above code to "(abc)" then
how to do it and how to use it ?
Thanks for taking the time to answer my question.

flag 0 or 1 on a foreach loop php

flag 0 or 1 on a foreach loop php

I have a query always results to two rows. How can i flag the first row
equal 1 and the second is 0?
here is the code
$rows = array(
array('number' => 1),
array('number' => 2)
);
$i=1;
foreach($rows as $r) {
if($i == 1) {
$i = 1;
} else {
$i = 0;
}
//Flag first row as 1
//Flag second row as 0;
}
Is this correct?

Tuesday, 1 October 2013

What is the difference between a frame got from a video device and image loaded after saving the frame

What is the difference between a frame got from a video device and image
loaded after saving the frame

In matlab I am not getting what should I get after working on a frame. But
I get if i write that frame in a file and read it back and it works fine.
I = step(vidDevice); % Acquire single frame
imwrite(I,'tmp.jpg');
im=imread('tmp.jpg');
out=skin_detect(im);
But I get only the black image if I work directly on the frame.
I = step(vidDevice); % Acquire single frame
out=skin_detect(im);

Portable JNDI name for DataSource

Portable JNDI name for DataSource

I have a EJB with field
@Resource(lookup = "jdbc/sampleDS")
private DataSource ds;
and persistence.xml with entry
<jta-data-source>jdbc/sampleDS</jta-data-source>
I want to make the application easy portable across different Java EE
servers. But in JBoss JNDI name has to start with java:/ or java:jboss/.
At the same time Glassfish doesn't like symbol ':'. How to achieve
portability? I tried to set attribute use-java-context="false" for data
source instandalone.xml, but it didn't help me.
Thanks in advance.

cannot open reg backup file because in use (by who though)

cannot open reg backup file because in use (by who though)

I don't know if this is bad so please forgive me ahead of time.
Wasn't sure if this would be considered repost:
http://stackoverflow.com/q/19014447/139698
or if it wouldn't have gotten visibility here?

Prove/disprove statements regarding continuous functions.

Prove/disprove statements regarding continuous functions.

I found some old math tests from my school years and thought it might be
fun to see what I still remember. The answer is simply, not as much as I
hoped for. I'm having trouble proving/disproving these statements, not
sure where to go with it.
If f is a continuous function on the closed interval [a,b] then f([a,b] =
[f(a),f(b)] or f([a,b]) = [f(b),f(a)].
There exists a function f that maps ]0,1[ to R/Z+
Is there a continuous function that maps ]0,10] to R?
I'm pretty sure that when I get 2, 3 will follow closely, hopefully at least.