Thursday, 3 October 2013

Fetching records from two tables

Fetching records from two tables

I hve two tables ...i need to fetch the records from the two table..no
record should be missed useing MySql
Ex: table-1 prod_id Name date 1 a 01-09-13 2 b 02-09-13 3 c 03-09-13 3 c
05-09-13
table-2 prod_id Name date 1 a 01-09-13 2 b 01-09-13 3 c 04-09-13
out put:
t1.prod_id t1.name t2.prod_id t2.name date 1 a 1 a 01-09-13 - - 2 b
01-09-13 2 b - - 02-09-13 3 c - - 03-09-13 - - 3 - 04-09-13 3 c - -
05-09-13

Wednesday, 2 October 2013

How to redirect (307 Temporary Redirect) with UrlRewriter?

How to redirect (307 Temporary Redirect) with UrlRewriter?

i've created a rule using UrlRewriter to perform a redirect:
<rewriter>
<redirect url="~/ResetClock.ashx" to="~/ResetClock" />
</rewriter>
The problem is that it is issuing a 301 Moved Permanantly redirect:
POST /ResetClock.asp HTTP/1.1
HTTP/1.1 301 Moved Permanently
Location: /ResetClock
i can mark the redirect as "temporary" redirect:
<rewriter>
<redirect url="~/ResetClock.ashx" to="~/ResetClock" permanent="false" />
</rewriter>
In which case it incorrectly issues a 302 Found redirect:
POST /ResetClock.asp HTTP/1.1
HTTP/1.1 302 Found
Location: /ResetClock
The problem is that both of these redirects are the wrong redirect to
issue. i need UrlRewriter to issue a:
307 Temporary Redirect
How can i do that?
Note: The reason i need it to issue a 307, is the reason 307 (and 303)
were invented: all browsers handle 302 incorrectly; converting a POST into
a GET. i need to tell the User-Agent that they need to post elsewhere:
POST /ResetClock.ashx HTTP/1.1
HTTP/1.1 307 Temporary Redirect
Location: /ResetClock
and the client will issue the redirect to the correct location.

KineticJS - error when I release mouse above shape

KineticJS - error when I release mouse above shape

I'm having some trouble with Kineticjs when creating a rectangle by
clicking and draggning.
$('#my-canvas').mousedown(function() {
// Create rectangle
// Add rectangle to layer
// Draw layer
});
// Dragging
$('#my-canvas').mousemove(function() {
// Update rectangles size/position so that it matches the current
mouse position
// Draw layer
});
Then when I release (mouseup), I get the following error:
Uncaught TypeError: Cannot read property '_id' of undefined
Kinetic.Util.addMethods._mouseup
(anonymous function)
If I make sure the mouse is not on the rectangle when releasing it I don't
get the error. But since I'm using the mouse to drag out the rectangle the
mouse position is going to be at rectangles end position.
I've searched and searched with no result.
Thanks in advance.

Rename files using php - filenames in text file

Rename files using php - filenames in text file

I have a list of file names in a text file and i have been reading the
text file and using the vales to rename files in the folder. Example of
the names in the text file, each name in the file represents two images
(front and back).
12455 124788 12145
Basically we have duplex scanned a number of images, scanner gives it a
default name of 1, 2, 3 etc and we would like to rename it to the code on
the file, so the codes are entered in the text file and the rename program
will rename the files accordingly
Problem i am getting is it is only renaming the last two images in the
folder. Here is the code thanks for the help
<?php
$second_file = "n";
$do_second = "n";
$i = 0;
$count = 0;
if ($handle = opendir('C:\xampp\htdocs\test')) {
$a = 0;
echo "Directory handle: $handle\n";
echo "Files:\n";
$file = fopen("num.txt","r") or exit ("Unable to open file num.txt");
while (!feof($file)){
$data = fgets($file);
$data2 = substr($data,0,9);
$num[$i] = $data2;
$i = $i + 1;
$count = $count + 1;
}
$a = 0;
while (false !== ($file2 = readdir($handle))) {
$filename[$a] = $file2;
$a = $a + 1;}
sort($filename,SORT_NUMERIC);
$count2 = 0;
for($a=2; $a <sizeof($filename); $a++){
$value = $num[$count2];
$test = $filename[$a];
$temp2 = substr($filename[$a],0,1);
if ($temp2 !== "."){
if ($second_file =="n") {
$temp = substr($filename[$a], 0, 1);
if($temp !== "R") {
rename("/xampp/htdocs/test/$test","/xampp/htdocs/test/R1
- $value - front.JPG");
$second_file = "y";
$do_second = "n";
print "First file no: $value <br>";
}
}
if ($second_file =="y") {
$temp = substr($filename[$a], 0, 1);
if($temp !== "R") {
if($do_second =="y"){
rename("/xampp/htdocs/test/$test","/xampp/htdocs/test/R1 -
$value - back.JPG");
$second_file = "n";
$count2 = $count2 + 1;
print "Second file yes: $value <br>";
}
if($do_second =="n"){
$do_second = "y";
}
}
}
}
}
fclose($file);
closedir($handle);
print "Rename complete"; }

Get fields/columns from mysqli result

Get fields/columns from mysqli result

How can I get the values by the field names using mysqli in PHP? My code is:
$stmt = $con->prepare('SELECT * FROM employees WHERE employee_id = ?');
$stmt->bind_param('s', $emp_id);
$stmt->execute();
$result = $stmt->get_result();
I want to retrieve my data by field name like $row['employee_id']

Tuesday, 1 October 2013

iOS: Approoach: displaying fed with link thumbnails, youtube/vimeo thumbs

iOS: Approoach: displaying fed with link thumbnails, youtube/vimeo thumbs

I am trying to replicate a feed that we have in our HTML app. Think of it
just like a facebook feed. Each feed post corresponds to a cell.
In our HTML rails app we use auto_html to look for web site links, youtube
or vimeo videos and generate a preview like this: http://cl.ly/RjBC We
also have text that can precede or follow the link.
I need to replicate this functionality in iOS in a UITableView. This means
the UITableView cell must adjust its height to match the post. I'm not
sure how to handle that, but I'll deal with that once I can figure out how
to render the post.
A co-worker suggested I embed a UIWebView in each cell and render each
post from the website. This might work, but I'm not sure if it is the best
approach. And I'm not sure if I could detect cell selection...
Another approach is to get the link and do the thumbnail process using an
iOS library. But I haven't been able to find an iOS library that will
auto-generate a thumbnail like auto-html does. Here is a link to auto-html
for a better explanation btw: https://github.com/dejan/auto_html
Any thoughts on approach? Are there any iOS libraries that do this? I
haven't found one....
thanks!

Adding tooltip to submenu

Adding tooltip to submenu

I am unable to see the tooltip when using it for submenu:
<ui:composition
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<p:menubar styleClass="menu">
<p:submenu id="dye" label="dye1" >
<p:menuitem value="#{messages.OS_MENU}"
actionListener="#{navMenuBean.actionListener}"
title="#{messages.OS_TITLE}" update=":mainForm" ajax="false"
icon="ui-icon-star"/>
<p:menuitem value="#{messages.GEN_MENU}"
actionListener="#{navMenuBean.actionListener}"
title="#{dim_messages.GEN_TITLE}" update=":mainForm" ajax="true"
icon="ui-icon-star"/>
<p:menuitem value="#{messages.INFO_MENU}"
actionListener="#{navMenuBean.actionListener}"
title="#{dim_messages.INFO_TITLE}" update=":mainForm" ajax="true"
icon="ui-icon-star"/>
</p:submenu>
<pe:tooltip for="dye" value="test"/>
</p:menubar>
</ui:composition>
I think the syntax is correct
Any advice what I am missing
Thanks

How can I disable USB removable devices except mouse and keyboard [on hold]

How can I disable USB removable devices except mouse and keyboard [on hold]

I am the owner of a small company (4 employees) and I have Win 7 Ultimate
on my machine. My other PCs are connected via LAN and they too have
Windows 7 on their machine. My question is, is there any way to prevent
USB storage devices. Recently I found one of the employee cheating on me
and found he is taking away some important projects which he has access
too. I'd like to prevent that.
I read some tricks about changing values in registry but those are just
tricks. Changing it's value back again would bring back the USB access. I
need some genuine way to prevent access to USB. Only me when logged in as
Administrator account should be able to access USB storage devices.

what is multiplicative group of all integers coprime with $N$ called?

what is multiplicative group of all integers coprime with $N$ called?

what is multiplicative group of all integers coprime with $N$ called?
I am not sure the tags are correct or not!