Angularjs ng-repeat-start /end and filter weird behaviour
I am trying to create Master Details in table here is the plnkr Code
but as i start putting filter for the ng-repeat the dom rendering behaves
weird
click the + button to expand row and the search the textbox
am i doing some thing wrong
Thursday, 3 October 2013
Wednesday, 2 October 2013
Having difficulty pairing with a bluetooth OBDII device on Ubuntu
Having difficulty pairing with a bluetooth OBDII device on Ubuntu
I'm attempting to pair with a automotive OBDII bluetooth device from a
Beaglebone Black running Ubuntu Linux, and not having a ton of luck.
I was able, initially to set up hci0 using bluez-simple-agent, although it
never asked me for a PIN. The PIN for this device is supposed to be
"1234". Now, when I run bluez-simple-agent, I get this:
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo bluez-simple-agent hci0
00:0D:18:A0:4E:35
Creating device failed: org.bluez.Error.AlreadyExists: Already Exists
Which would be fine if it was working, but when I try to bind using
rfcomm, I repeatedly get either "Can't connect RFCOMM socket: Invalid
exchange" (first time after restarting the device) and then "Can't connect
RFCOMM socket: Connection refused" every time thereafter.
This is my /etc/bluetooth/rfcomm.conf file:
rfcomm0 {
# Automatically bind the device at startup
bind no;
# Bluetooth address of the device
device 00:0D:18:A0:4E:35;
# RFCOMM channel for the connection
channel 16;
# Description of the connection
comment "OBDII";
}
And running "rfcomm bind 0" does successfully create a device at
/dev/rfcomm0:
rfcomm0: 00:0D:18:A0:4E:35 channel 16 clean
However, trying to read from /dev/rfcomm0, gives me this:
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Invalid exchange
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Connection refused
ubuntu@ubuntu-armhf:/etc/bluetooth$
And thereafter, rfcomm returns this:
ubuntu@ubuntu-armhf:/etc/bluetooth$ rfcomm
rfcomm0: 00:0D:18:A0:4E:35 channel 16 closed
I think I am using the correct channel (16) based on the result of
"sdptool records"
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo sdptool records 00:0D:18:A0:4E:35
...
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 16
Profile Descriptor List:
"Serial Port" (0x1101)
Version: 0x0100
Any help would be greatly appreciated, because I'm pretty well out of
ideas at this point.
Refs: rfcomm Manually Using Bluetooth RFCOMM How to Set Up Bluetooth
Serial connection over Bluetooth
I'm attempting to pair with a automotive OBDII bluetooth device from a
Beaglebone Black running Ubuntu Linux, and not having a ton of luck.
I was able, initially to set up hci0 using bluez-simple-agent, although it
never asked me for a PIN. The PIN for this device is supposed to be
"1234". Now, when I run bluez-simple-agent, I get this:
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo bluez-simple-agent hci0
00:0D:18:A0:4E:35
Creating device failed: org.bluez.Error.AlreadyExists: Already Exists
Which would be fine if it was working, but when I try to bind using
rfcomm, I repeatedly get either "Can't connect RFCOMM socket: Invalid
exchange" (first time after restarting the device) and then "Can't connect
RFCOMM socket: Connection refused" every time thereafter.
This is my /etc/bluetooth/rfcomm.conf file:
rfcomm0 {
# Automatically bind the device at startup
bind no;
# Bluetooth address of the device
device 00:0D:18:A0:4E:35;
# RFCOMM channel for the connection
channel 16;
# Description of the connection
comment "OBDII";
}
And running "rfcomm bind 0" does successfully create a device at
/dev/rfcomm0:
rfcomm0: 00:0D:18:A0:4E:35 channel 16 clean
However, trying to read from /dev/rfcomm0, gives me this:
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Invalid exchange
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Connection refused
ubuntu@ubuntu-armhf:/etc/bluetooth$
And thereafter, rfcomm returns this:
ubuntu@ubuntu-armhf:/etc/bluetooth$ rfcomm
rfcomm0: 00:0D:18:A0:4E:35 channel 16 closed
I think I am using the correct channel (16) based on the result of
"sdptool records"
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo sdptool records 00:0D:18:A0:4E:35
...
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 16
Profile Descriptor List:
"Serial Port" (0x1101)
Version: 0x0100
Any help would be greatly appreciated, because I'm pretty well out of
ideas at this point.
Refs: rfcomm Manually Using Bluetooth RFCOMM How to Set Up Bluetooth
Serial connection over Bluetooth
jQuery Post non working
jQuery Post non working
I'm trying to send via javascript some variables to a php file which will
store them in a db. However nothing happens and I don't find my mistake. I
am sure that the variables are initizialised in javascript and they are
not in php (cause the php code write an empty log). Can you help me?
Thanks a lot
Javascript code:
<script src="http://localhost:8080/libs/jquery-1.10.2.min.js"></script>
<script>
function returned(data) {
alert(data);
}
function postSecret()
{
....
alert(v_text + "\n" + v_age + "\n" + v_is_male);
jQuery.post( "http://localhost:8080/libs/post.php", { text:
v_text, age: v_age, is_male: v_is_male }, returned(data),
"json");
}
</script>
Post.php:
<?php
printf("dkls");
$file = 'log.txt';
$content .= "session: ".$_POST['text']." || ".$_POST['is_male']."
|| ".$_POST['age']."\n";
file_put_contents($file, $content, FILE_APPEND | LOCK_EX);
... database...
?>
I'm trying to send via javascript some variables to a php file which will
store them in a db. However nothing happens and I don't find my mistake. I
am sure that the variables are initizialised in javascript and they are
not in php (cause the php code write an empty log). Can you help me?
Thanks a lot
Javascript code:
<script src="http://localhost:8080/libs/jquery-1.10.2.min.js"></script>
<script>
function returned(data) {
alert(data);
}
function postSecret()
{
....
alert(v_text + "\n" + v_age + "\n" + v_is_male);
jQuery.post( "http://localhost:8080/libs/post.php", { text:
v_text, age: v_age, is_male: v_is_male }, returned(data),
"json");
}
</script>
Post.php:
<?php
printf("dkls");
$file = 'log.txt';
$content .= "session: ".$_POST['text']." || ".$_POST['is_male']."
|| ".$_POST['age']."\n";
file_put_contents($file, $content, FILE_APPEND | LOCK_EX);
... database...
?>
How can I make blend edges with shaders
How can I make blend edges with shaders
let me introduce my answer.
This is triagnle rendered with webgl. Well it is a little enlarged ...
And this is triangle, which I want to have:
So Im looking for some shader, that will be able to blend edges of
primitive triangle. I have an idea how to realize one, but Im probably not
good enough to write it yet.
My idea is something like: Based on position of 3 vertices calculate for
each fragment, how much does primitive cover pixel, and then set up
transparency of this pixel based on calculated information...
I can get 2D coordinates from vertex shader and use them in fragment
shader. Now I probably want to use gl_FragCoord.xy or gl_PointCoord.xy and
calculate % pixel cover, but I not able to compare these values (it seems
that units are different, I compute miles with milimetres and also 'point
zero' is somewhere else for these vectors), so I can't calculate final
transparency value.
Can anyone help me please? Just turn me correct way.
let me introduce my answer.
This is triagnle rendered with webgl. Well it is a little enlarged ...
And this is triangle, which I want to have:
So Im looking for some shader, that will be able to blend edges of
primitive triangle. I have an idea how to realize one, but Im probably not
good enough to write it yet.
My idea is something like: Based on position of 3 vertices calculate for
each fragment, how much does primitive cover pixel, and then set up
transparency of this pixel based on calculated information...
I can get 2D coordinates from vertex shader and use them in fragment
shader. Now I probably want to use gl_FragCoord.xy or gl_PointCoord.xy and
calculate % pixel cover, but I not able to compare these values (it seems
that units are different, I compute miles with milimetres and also 'point
zero' is somewhere else for these vectors), so I can't calculate final
transparency value.
Can anyone help me please? Just turn me correct way.
mysqli_prepared_statement escapes single and double quotes?
mysqli_prepared_statement escapes single and double quotes?
I am using mysqli_prepared statements to insert into data base as follows:
//insert the poll
$stmnt_insert_poll = mysqli_prepare($con,'INSERT INTO `tblpolls`
(`poll_user_id`, `poll_type_id`, `poll_title`, `poll_details`,
`poll_img`) VALUES (?, ?, ?, ?, ?);');
mysqli_stmt_bind_param($stmnt_insert_poll,'ddsss',$_SESSION['userid'],$_POST['cbotypes'],$_POST['txttitle'],$_POST['txtdetails'],$new_image_name);
if(!mysqli_stmt_execute($stmnt_insert_poll))
{
$query_success = false;
}
$new_poll_id = mysqli_stmt_insert_id($stmnt_insert_poll);
mysqli_stmt_close($stmnt_insert_poll);
I disabled Magic quotes from WHM Cpanel but it still adds backslash to the
single and double quotes. The odd thing is that I still see
"magic_quotes_gpc-On-On" in phpinfo()
I DO NOT WANT TO escape the double quotes only but it shows the
backslashes when trying to select it and view it again.
I am using mysqli_prepared statements to insert into data base as follows:
//insert the poll
$stmnt_insert_poll = mysqli_prepare($con,'INSERT INTO `tblpolls`
(`poll_user_id`, `poll_type_id`, `poll_title`, `poll_details`,
`poll_img`) VALUES (?, ?, ?, ?, ?);');
mysqli_stmt_bind_param($stmnt_insert_poll,'ddsss',$_SESSION['userid'],$_POST['cbotypes'],$_POST['txttitle'],$_POST['txtdetails'],$new_image_name);
if(!mysqli_stmt_execute($stmnt_insert_poll))
{
$query_success = false;
}
$new_poll_id = mysqli_stmt_insert_id($stmnt_insert_poll);
mysqli_stmt_close($stmnt_insert_poll);
I disabled Magic quotes from WHM Cpanel but it still adds backslash to the
single and double quotes. The odd thing is that I still see
"magic_quotes_gpc-On-On" in phpinfo()
I DO NOT WANT TO escape the double quotes only but it shows the
backslashes when trying to select it and view it again.
Tuesday, 1 October 2013
Jquery play framework avoid dual submission
Jquery play framework avoid dual submission
I have a Jquery which submits during on complete and because of that the
submission happens twice. Is there a way to avoid the same?
Following is the code snippet.
My routes for Claim loading looks like this. # Claim Loading for
Historical Claims GET /claimLoading controllers.ClaimLoading.form POST
/claimLoading controllers.ClaimLoading.submit
In my controller the submit happens as shown.
/**
* Handle form submission.
*/
def submit = Action { implicit request =>
claimLoadingForm.bindFromRequest.fold(
// Form has errors, redisplay it
errors => {
Logger.info("Some error occurred before calling the service")
BadRequest(html.claimloading.form(errors))
},
claimLoading => {
// Invoke the LoadCSVorXML2Mongo service from here
claimsLoadingService.loadCSVOrXMLClaimToDatabase(claimLoading.claimLoadingPath)
val resultSummary = claimsLoadingService.retrieveSummaryInfo
// We got a valid ClaimLoading value, display the summary
Ok(html.claimloading.summary(claimLoading,
Json.prettyPrint(resultSummary)))
}
)
}
Jquery call from the button click is >>>>
/views/claimloading/form.scala.html
<input type="button" class="btn primary" id="claimsLoadButton"
value="Invoke Claim Loading">
Jquery in the form.scala under claimloading is >>>>
<script type="text/javascript" xmlns="http://www.w3.org/1999/html">
$(document).ready( function () {
$("#claimsLoadButton").click(function () {
createLoadingModal();
showLoader(true);
$.ajax({
url: "/claimLoading",
type: "POST",
data: $("#claimLoadingForm").serialize(), // serializes the
form's elements.
dataType:"json",
success: function (data) {
showLoader(false);
},
error: function (jqXHR, textStatus, errorThrown) {
},
complete: function (data) {
submitClaimsLoading();
}
});
});
});
function submitClaimsLoading()
{
$("#claimLoadingForm").submit();
showLoader(false);
}
</script>
I have a Jquery which submits during on complete and because of that the
submission happens twice. Is there a way to avoid the same?
Following is the code snippet.
My routes for Claim loading looks like this. # Claim Loading for
Historical Claims GET /claimLoading controllers.ClaimLoading.form POST
/claimLoading controllers.ClaimLoading.submit
In my controller the submit happens as shown.
/**
* Handle form submission.
*/
def submit = Action { implicit request =>
claimLoadingForm.bindFromRequest.fold(
// Form has errors, redisplay it
errors => {
Logger.info("Some error occurred before calling the service")
BadRequest(html.claimloading.form(errors))
},
claimLoading => {
// Invoke the LoadCSVorXML2Mongo service from here
claimsLoadingService.loadCSVOrXMLClaimToDatabase(claimLoading.claimLoadingPath)
val resultSummary = claimsLoadingService.retrieveSummaryInfo
// We got a valid ClaimLoading value, display the summary
Ok(html.claimloading.summary(claimLoading,
Json.prettyPrint(resultSummary)))
}
)
}
Jquery call from the button click is >>>>
/views/claimloading/form.scala.html
<input type="button" class="btn primary" id="claimsLoadButton"
value="Invoke Claim Loading">
Jquery in the form.scala under claimloading is >>>>
<script type="text/javascript" xmlns="http://www.w3.org/1999/html">
$(document).ready( function () {
$("#claimsLoadButton").click(function () {
createLoadingModal();
showLoader(true);
$.ajax({
url: "/claimLoading",
type: "POST",
data: $("#claimLoadingForm").serialize(), // serializes the
form's elements.
dataType:"json",
success: function (data) {
showLoader(false);
},
error: function (jqXHR, textStatus, errorThrown) {
},
complete: function (data) {
submitClaimsLoading();
}
});
});
});
function submitClaimsLoading()
{
$("#claimLoadingForm").submit();
showLoader(false);
}
</script>
Module removed in the root folder's web.config is being used in a subfolder
Module removed in the root folder's web.config is being used in a subfolder
My application has this structure
MyApplication -Themes
In my application's webconfig I remove the UrlAuthorization module and add
my own:
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
<add name="MyModule" type="MyType, MyNamespace"
preCondition="managedHandler" />
</modules>
My Theme folder has this webconfig (this is the complete webconfig):
<?xml version="1.0"?>
<configuration>
<system.web>
<pages styleSheetTheme="" validateRequest="false" />
</system.web>
</configuration>
I have this deployed in 3 environments. 2 of them works correctly but in
one of them I have the UrlAuthorization module working when I make a
request do a file inside the Theme folder.
I know that the UrlAuthorization is active because I do not get the
resource I requested, but an URL /ReturnURl/... path
The < remove> tag is working because removing it causes the whole request
to be redirect to the /ReturnUrl
Is there any reason that may cause this behavior to happen only in this
machine? I deployed all of them and I do not remember making and different
task on any of them
thanks!
My application has this structure
MyApplication -Themes
In my application's webconfig I remove the UrlAuthorization module and add
my own:
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
<add name="MyModule" type="MyType, MyNamespace"
preCondition="managedHandler" />
</modules>
My Theme folder has this webconfig (this is the complete webconfig):
<?xml version="1.0"?>
<configuration>
<system.web>
<pages styleSheetTheme="" validateRequest="false" />
</system.web>
</configuration>
I have this deployed in 3 environments. 2 of them works correctly but in
one of them I have the UrlAuthorization module working when I make a
request do a file inside the Theme folder.
I know that the UrlAuthorization is active because I do not get the
resource I requested, but an URL /ReturnURl/... path
The < remove> tag is working because removing it causes the whole request
to be redirect to the /ReturnUrl
Is there any reason that may cause this behavior to happen only in this
machine? I deployed all of them and I do not remember making and different
task on any of them
thanks!
Synergy Foss not connecting to client PC [on hold]
Synergy Foss not connecting to client PC [on hold]
I am using Synergy keyboard and sharing software. My mac is the server and
i have a windows PC that is the client.
The windows PC seems to be working okay but on the mac it is stuck on
Synergy is starting. and it says
*NOTE: config file:
/var/folders/jz/yvtbpbtd4z31nmglb4wwvpv00000gn/T/qt_temp.BM5997 NOTE: log
level: NOTE* every time i click Apply or Start
I am using Synergy keyboard and sharing software. My mac is the server and
i have a windows PC that is the client.
The windows PC seems to be working okay but on the mac it is stuck on
Synergy is starting. and it says
*NOTE: config file:
/var/folders/jz/yvtbpbtd4z31nmglb4wwvpv00000gn/T/qt_temp.BM5997 NOTE: log
level: NOTE* every time i click Apply or Start
Centreon (Nagios) setting a host macro (variable)
Centreon (Nagios) setting a host macro (variable)
EDIT2: Got it working - There was an unrelated problem that meant even
though I was tinkering with the 'faulty' host definition, the revised
check was not being run so I was always seeing the original error message.
I am trying to add a new variable (macro) to a host template through the
Centreon (2.4.2) GUI so that the value can be picked up when doing a
check, but I am getting an error. Here's what I have so far:
I have a host template with a macro name of INSTANCECODE
I have a check command like this:
RUBYOPT="rubygems" ruby /usr/lib64/nagios/plugins/check_ec2_status.rb -a
$HOSTADDRESS$ -i $_HOSTINSTANCECODE$ -f $ARG1$
I have a host definition that uses the template mentioned above, and has
INSTANCECODE filled in as i-xx4770xx (An Amazon EC2 instance
code/reference)
But the check comes back with an error: "Error occured while trying to
retrieve EC2 instance: $"
If I hard-code the instance value into the check it works fine
Using the Nagios interface, which has a tool for checking I can't see any
variable expansion for $_HOSTINSTANCECODE$ taking place.
Any useful suggestions would be appreciated.
Edit - for Keith: Generated host template:
define host{
name Amazon_Instance
alias Amazon Instance
check_command check_amazon_ec2_status
max_check_attempts 5
check_interval 60
retry_interval 120
check_period 24x7
contact_groups Supervisors
contacts Supervisor
notification_interval 60
first_notification_delay 60
notification_options d,u,r
register 0
_INSTANCECODE
}
EDIT2: Got it working - There was an unrelated problem that meant even
though I was tinkering with the 'faulty' host definition, the revised
check was not being run so I was always seeing the original error message.
I am trying to add a new variable (macro) to a host template through the
Centreon (2.4.2) GUI so that the value can be picked up when doing a
check, but I am getting an error. Here's what I have so far:
I have a host template with a macro name of INSTANCECODE
I have a check command like this:
RUBYOPT="rubygems" ruby /usr/lib64/nagios/plugins/check_ec2_status.rb -a
$HOSTADDRESS$ -i $_HOSTINSTANCECODE$ -f $ARG1$
I have a host definition that uses the template mentioned above, and has
INSTANCECODE filled in as i-xx4770xx (An Amazon EC2 instance
code/reference)
But the check comes back with an error: "Error occured while trying to
retrieve EC2 instance: $"
If I hard-code the instance value into the check it works fine
Using the Nagios interface, which has a tool for checking I can't see any
variable expansion for $_HOSTINSTANCECODE$ taking place.
Any useful suggestions would be appreciated.
Edit - for Keith: Generated host template:
define host{
name Amazon_Instance
alias Amazon Instance
check_command check_amazon_ec2_status
max_check_attempts 5
check_interval 60
retry_interval 120
check_period 24x7
contact_groups Supervisors
contacts Supervisor
notification_interval 60
first_notification_delay 60
notification_options d,u,r
register 0
_INSTANCECODE
}
Monday, 30 September 2013
Evaluate $ \lim=?iso-8859-1?Q?=5F{x\rightarrow{\frac\pi2_}}_?=(\sec(x) \tan(x))^{\cos(x)}$ without L'Hôpital's rule
Evaluate $ \lim_{x\rightarrow{\frac\pi2 }} (\sec(x) \tan(x))^{\cos(x)}$
without L'Hôpital's rule
I have tried changing limit to $\lim_{x\rightarrow0}$ and use some
trigonometry identity ($\sin^2(x)+\cos^2(x) = 1$ and $\sin (x+\pi/2) =
\cos(x)$) but doesn't work
I have no idea on how to do this now...
$$ \lim_{x\rightarrow{\frac\pi2 }} (\sec(x) \tan(x))^{\cos(x)} $$
without L'Hôpital's rule
I have tried changing limit to $\lim_{x\rightarrow0}$ and use some
trigonometry identity ($\sin^2(x)+\cos^2(x) = 1$ and $\sin (x+\pi/2) =
\cos(x)$) but doesn't work
I have no idea on how to do this now...
$$ \lim_{x\rightarrow{\frac\pi2 }} (\sec(x) \tan(x))^{\cos(x)} $$
MBR not found error during installation
MBR not found error during installation
I am completely new to Linux/Ubantu..but I want to learn it..recently my
HD crashed so I bought a new ssd and installed windows on C drive..I have
my normal stuff on D drive and want to install Ubantu on E driver which is
65gb..when I tried to install ubantu from USB, I got an error that MBR is
missing..can anyone please help me with it or point me the right
direction.. Thanks a lot..looking forward to have fun with Ubantu :)
I am completely new to Linux/Ubantu..but I want to learn it..recently my
HD crashed so I bought a new ssd and installed windows on C drive..I have
my normal stuff on D drive and want to install Ubantu on E driver which is
65gb..when I tried to install ubantu from USB, I got an error that MBR is
missing..can anyone please help me with it or point me the right
direction.. Thanks a lot..looking forward to have fun with Ubantu :)
How to get started/pick/understand what web service tools to use
How to get started/pick/understand what web service tools to use
Ok, so this is an open-ended question. I would like to start with I am not
looking for an exact answer, as much as I am trying to find the correct
path to educating myself for what I need to do.
I am an iOS developer (5 years now) and I also know a decent amount about
HTML, CSS, and some PHP. I have dabbled in JavaScript and barely even
touched Ruby (On Rails), so it is fair to say that I am a novice web
developer. I can build great front ends but the backend and connecting it
are where I need help.
I am looking to build a product that has a few requirements. Here they are:
Scalable database to store ever increasing data over time. Users will be
continually adding new content that will need to be stored and also
indexed to be viewed later. This will include text, photos, and possibly
video clips (most likely not initially).
The ability to handle messaging. This is not a chat service, but rather
the ability to click on a user and say send message, and they will have a
dashboard section that will allow then to view and respond to those
messages. This will also be stored on the database. Nothing profound here,
standard implementation.
Easy access to maintain this data and content. I will need to be able to
quickly query the submitted content and grab all the data for users to
see.
Obviously the need to manage user accounts. Seems like a separate table or
DB for user accounts and linking them with content is needed. I feel like
this and number 3 are subsets of number 1 so I apologize if this is
redundant.
The bottom line is there are so many options, I have no idea what will or
will not work for my site. I barely know command line and terminal, I know
nothing about servers and Amazon Web Services seems like an amazing tool
but it is filled with tons of technical stuff I don't understand.
I am the type of person who will read books, watch videos, read tutorials
and constantly scan over Stack Overflow to learn new things, but in this
instance I am not sure what I should be learning.
Any idea's on what programming language I should be using? What web
service will fulfill my requirements? How will this all tie in to the HTML
side of things?
I am looking for some guidance on where to start, and ANY information will
be helpful. Links to articles to read, suggestions, personal experiences
are all welcome.
Thanks!
Ok, so this is an open-ended question. I would like to start with I am not
looking for an exact answer, as much as I am trying to find the correct
path to educating myself for what I need to do.
I am an iOS developer (5 years now) and I also know a decent amount about
HTML, CSS, and some PHP. I have dabbled in JavaScript and barely even
touched Ruby (On Rails), so it is fair to say that I am a novice web
developer. I can build great front ends but the backend and connecting it
are where I need help.
I am looking to build a product that has a few requirements. Here they are:
Scalable database to store ever increasing data over time. Users will be
continually adding new content that will need to be stored and also
indexed to be viewed later. This will include text, photos, and possibly
video clips (most likely not initially).
The ability to handle messaging. This is not a chat service, but rather
the ability to click on a user and say send message, and they will have a
dashboard section that will allow then to view and respond to those
messages. This will also be stored on the database. Nothing profound here,
standard implementation.
Easy access to maintain this data and content. I will need to be able to
quickly query the submitted content and grab all the data for users to
see.
Obviously the need to manage user accounts. Seems like a separate table or
DB for user accounts and linking them with content is needed. I feel like
this and number 3 are subsets of number 1 so I apologize if this is
redundant.
The bottom line is there are so many options, I have no idea what will or
will not work for my site. I barely know command line and terminal, I know
nothing about servers and Amazon Web Services seems like an amazing tool
but it is filled with tons of technical stuff I don't understand.
I am the type of person who will read books, watch videos, read tutorials
and constantly scan over Stack Overflow to learn new things, but in this
instance I am not sure what I should be learning.
Any idea's on what programming language I should be using? What web
service will fulfill my requirements? How will this all tie in to the HTML
side of things?
I am looking for some guidance on where to start, and ANY information will
be helpful. Links to articles to read, suggestions, personal experiences
are all welcome.
Thanks!
Drag and drop from outook to webapp
Drag and drop from outook to webapp
I'm coding a JSP with a drop zone where users can move any files (PDF,
.XDOC, .XLS, ....) for uploading and I want to make it works with email
too.
In my servlet, it seems to be OK if the dragged email is at first drop on
localdisk, then drop in the webpage. In that case i'm receiving some data.
Unfortunately, if it's directly drop from Outlook, nothinhg's happening...
Any suggestions to make it works ?
I'm coding a JSP with a drop zone where users can move any files (PDF,
.XDOC, .XLS, ....) for uploading and I want to make it works with email
too.
In my servlet, it seems to be OK if the dragged email is at first drop on
localdisk, then drop in the webpage. In that case i'm receiving some data.
Unfortunately, if it's directly drop from Outlook, nothinhg's happening...
Any suggestions to make it works ?
Sunday, 29 September 2013
How can I find out the very first time linux machine start up?
How can I find out the very first time linux machine start up?
When we use uptime, it only shown us the up-time of ours machine since it
started from the last time it turning on/shutdown/reboot.
But, what if I want to get the time when our machine started from the very
first time when it installed?
Do Linux own this tools? Or any clues about how I can find out the answer
of it?
When we use uptime, it only shown us the up-time of ours machine since it
started from the last time it turning on/shutdown/reboot.
But, what if I want to get the time when our machine started from the very
first time when it installed?
Do Linux own this tools? Or any clues about how I can find out the answer
of it?
jQuery dynamic generated table rows with input fileds need sum and validation
jQuery dynamic generated table rows with input fileds need sum and validation
I need help in jQuery generated dynamic table rows with input fields and
select box, I want when I select in select box one input field two is
disabled and when I select two input field two is disabled as I added more
rows different values of input fields, I also need sum of all inserted
rows input fields my code is here :
<table id="mytable">
<thead>
<th>Course</th>
<th>Fee for Coures 1</th>
<th>Fee for final course</th>
</thead>
<tbody>
<tr>
<td>
<select name="code">
<option value="1">javascript</option>
<option value="2">PHP mysql</option>
</select>
</td>
<td><input type="text" id="fee" name="js-fee"></td>
<td><input type="text" id="fee" name="php-fee"></td>
</tr>
</tbody> </table>
my jQuery code is here it is working true, just need help for sum of all
inserted rows input and disabled field if select one field two is disable
and if selected two field one is disable all row can have different values
<script type="text/javascript">
$(document).ready(function () {
$("#insert-more").click(function() {
$("#mytable").each(function () {
var tds = '<tr>';
jQuery.each($('tr:last td', this), function () {
tds += '<td>' + $(this).html() + '</td>';
});
tds += '</tr>';
if ($('tbody', this).length > 0) {
$('tbody', this).append(tds);
} else {
$(this).append(tds);
}
});
});
});
</script>
I need help in jQuery generated dynamic table rows with input fields and
select box, I want when I select in select box one input field two is
disabled and when I select two input field two is disabled as I added more
rows different values of input fields, I also need sum of all inserted
rows input fields my code is here :
<table id="mytable">
<thead>
<th>Course</th>
<th>Fee for Coures 1</th>
<th>Fee for final course</th>
</thead>
<tbody>
<tr>
<td>
<select name="code">
<option value="1">javascript</option>
<option value="2">PHP mysql</option>
</select>
</td>
<td><input type="text" id="fee" name="js-fee"></td>
<td><input type="text" id="fee" name="php-fee"></td>
</tr>
</tbody> </table>
my jQuery code is here it is working true, just need help for sum of all
inserted rows input and disabled field if select one field two is disable
and if selected two field one is disable all row can have different values
<script type="text/javascript">
$(document).ready(function () {
$("#insert-more").click(function() {
$("#mytable").each(function () {
var tds = '<tr>';
jQuery.each($('tr:last td', this), function () {
tds += '<td>' + $(this).html() + '</td>';
});
tds += '</tr>';
if ($('tbody', this).length > 0) {
$('tbody', this).append(tds);
} else {
$(this).append(tds);
}
});
});
});
</script>
Removing and prepending in jQuery
Removing and prepending in jQuery
I am trying to achieve a simple unordered list, with the following
behaviour. When a list item is clicked, it needs to go on top of the list.
I managed to do it by assigning the element to a variable, removing "this"
(the clicked item) and prepending my element variable.
This seems to work. Only once.
I guess this is because the elements are removed from the DOM, and the new
ones are not "detected". WHat is the right way to do it?
Here's my simple code:
$('ul.selekta li').on('click', function() {
var element = $(this);
$(this).remove();
$('ul.selekta').prepend(element);
});
Any help is super appreciated!
I am trying to achieve a simple unordered list, with the following
behaviour. When a list item is clicked, it needs to go on top of the list.
I managed to do it by assigning the element to a variable, removing "this"
(the clicked item) and prepending my element variable.
This seems to work. Only once.
I guess this is because the elements are removed from the DOM, and the new
ones are not "detected". WHat is the right way to do it?
Here's my simple code:
$('ul.selekta li').on('click', function() {
var element = $(this);
$(this).remove();
$('ul.selekta').prepend(element);
});
Any help is super appreciated!
this function for taking input from string how does it take input using bitwise operator and manipulat string into no please explain
this function for taking input from string how does it take input using
bitwise operator and manipulat string into no please explain
How has the string been manipulated to integer and what is use of bitwise
operators..this function has been used in c to take input from string of
numbers
inline LL inp()
{
LL num = 0;
char p = gc;
while(p<33)p=gc;
while(p>33) {
num = (num << 3)+ (num << 1)+ (p -'0');
p = gc;
}
return num;
};
bitwise operator and manipulat string into no please explain
How has the string been manipulated to integer and what is use of bitwise
operators..this function has been used in c to take input from string of
numbers
inline LL inp()
{
LL num = 0;
char p = gc;
while(p<33)p=gc;
while(p>33) {
num = (num << 3)+ (num << 1)+ (p -'0');
p = gc;
}
return num;
};
Saturday, 28 September 2013
Access a vector inside of a map that is inside another map
Access a vector inside of a map that is inside another map
I have a map called nfa (see below)
map<string, NFANode*> nfa;
nfa is filled with NFANode objects. (see below)
class NFANode {
public:
string label;
map<string,vector<NFANode*> >tr;
bool accepting;
bool starting;
NFANode(string s, bool a, bool x){
accepting = a;
label = s;
starting = x;
}
};
Inside each object there is another map call tr and inside of tr there is
a vector with information. I am trying to access the vector to print out
each element of the vector and cannot figure out how. I have been trying
to use an iterator with no luck.
map<string, NFANode*>::iterator nfaIt;
for (nfaIt = nfa.begin(); nfaIt != nfa.end(); ++nfaIt){
cout << "content of tr are: " << nfaIt->second->tr->second << endl;
}
Any help would be greatly appreciated.
I have a map called nfa (see below)
map<string, NFANode*> nfa;
nfa is filled with NFANode objects. (see below)
class NFANode {
public:
string label;
map<string,vector<NFANode*> >tr;
bool accepting;
bool starting;
NFANode(string s, bool a, bool x){
accepting = a;
label = s;
starting = x;
}
};
Inside each object there is another map call tr and inside of tr there is
a vector with information. I am trying to access the vector to print out
each element of the vector and cannot figure out how. I have been trying
to use an iterator with no luck.
map<string, NFANode*>::iterator nfaIt;
for (nfaIt = nfa.begin(); nfaIt != nfa.end(); ++nfaIt){
cout << "content of tr are: " << nfaIt->second->tr->second << endl;
}
Any help would be greatly appreciated.
WordPress images reloaded when refreshing a page (I don't want it to)
WordPress images reloaded when refreshing a page (I don't want it to)
When I refresh the page, it reloads the images which is something I don't
want
I am working on two WordPress blogs http://www.i-phony.com and
http://www.dz-ahbeb.com <<< Check them out
They have the same exact template. But the is a problem is only with the
first website. even though the settings are the same.
I tried disabling plugins and the problem was still there.
What do you suggest?
Thanks everyone
When I refresh the page, it reloads the images which is something I don't
want
I am working on two WordPress blogs http://www.i-phony.com and
http://www.dz-ahbeb.com <<< Check them out
They have the same exact template. But the is a problem is only with the
first website. even though the settings are the same.
I tried disabling plugins and the problem was still there.
What do you suggest?
Thanks everyone
Setting a value that has parameters
Setting a value that has parameters
I'm looking for a way to set the value index.totalNumCitations to the
value I set in that while loop. I set the value to 1 initially so the for
loop would execute at least once. I tried obtaining the value before the
for loop and that also wasn't working. If someone could point me in the
right direction I would be very appreciative.
for (int i = 0; i < index.totalNumCitations; i++) {
while (inputInteger > 50 || inputInteger < 0) {
inputInteger = Integer.parseInt(sc.nextLine());
index.Index(inputInteger);
}
This is the method used in the while loop
public void Index(int totalNumCit) {
if (totalNumCit <= 50 && totalNumCit > 0) {
this.totalNumCitations = totalNumCit;
citationIndex = new Citation[totalNumCit];
} else {
System.out.println("Error: Please enter a number between 0 and 50.");
}
}
I'm looking for a way to set the value index.totalNumCitations to the
value I set in that while loop. I set the value to 1 initially so the for
loop would execute at least once. I tried obtaining the value before the
for loop and that also wasn't working. If someone could point me in the
right direction I would be very appreciative.
for (int i = 0; i < index.totalNumCitations; i++) {
while (inputInteger > 50 || inputInteger < 0) {
inputInteger = Integer.parseInt(sc.nextLine());
index.Index(inputInteger);
}
This is the method used in the while loop
public void Index(int totalNumCit) {
if (totalNumCit <= 50 && totalNumCit > 0) {
this.totalNumCitations = totalNumCit;
citationIndex = new Citation[totalNumCit];
} else {
System.out.println("Error: Please enter a number between 0 and 50.");
}
}
Microsoft JScript Runtime error on HttpGet
Microsoft JScript Runtime error on HttpGet
I have a JavaFX program that gets one page before the FX Gui loads, just
to verify that a user is logged on. Problem is that I get two consecutive
error windows telling me that "This property or method is not supported by
this object".
I have done some research but most of the stuff I found was about
JavaScript... Could it be that the HttpClient executes the JQuery on the
page?
Thanks in advance
I have a JavaFX program that gets one page before the FX Gui loads, just
to verify that a user is logged on. Problem is that I get two consecutive
error windows telling me that "This property or method is not supported by
this object".
I have done some research but most of the stuff I found was about
JavaScript... Could it be that the HttpClient executes the JQuery on the
page?
Thanks in advance
Friday, 27 September 2013
Nesting nav in header tag
Nesting nav in header tag
When I place my <nav> inside my <header> the element seems to wrap the
<p></p> above it. It should not but I can't see why? My html must be
getting rusty.
<header class="clearfix">
<h1 id="heading">Main Heading</h1>
<h2>Sub Heading</h2>
<p>Tagline - Lorem ipsum dolor sit amet. Dolore, corporis.</p>
<div id="home" class="landing">
</div><!--end #home-->
<nav class="clearfix main-nav">
<ul class="clearfix">
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#video">Video</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
CSS
header{ text-align:right;}
header p{ float:right;}
.main-nav{ width: 100%; background-color: #d3eafc;}
.main-nav ul{ clear:both; list-style:none; padding:0; margin:10px 0;}
.main-nav ul li{ float:left; list-style:none; width:150px;
border-right: 1px solid #999;}
.main-nav a:link,
.main-nav a:visited{
display:block;
line-height:30px;
text-align:center;
color:#fff;
text-decoration:none;
}
http://jsfiddle.net/otherDewi/u2xNN/
When I place my <nav> inside my <header> the element seems to wrap the
<p></p> above it. It should not but I can't see why? My html must be
getting rusty.
<header class="clearfix">
<h1 id="heading">Main Heading</h1>
<h2>Sub Heading</h2>
<p>Tagline - Lorem ipsum dolor sit amet. Dolore, corporis.</p>
<div id="home" class="landing">
</div><!--end #home-->
<nav class="clearfix main-nav">
<ul class="clearfix">
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#video">Video</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
CSS
header{ text-align:right;}
header p{ float:right;}
.main-nav{ width: 100%; background-color: #d3eafc;}
.main-nav ul{ clear:both; list-style:none; padding:0; margin:10px 0;}
.main-nav ul li{ float:left; list-style:none; width:150px;
border-right: 1px solid #999;}
.main-nav a:link,
.main-nav a:visited{
display:block;
line-height:30px;
text-align:center;
color:#fff;
text-decoration:none;
}
http://jsfiddle.net/otherDewi/u2xNN/
How to initialize structure with compiler generated backing fields
How to initialize structure with compiler generated backing fields
Ultra simple question... How does one properly initialize private backing
fields on a structure? I get a compiler error:
Backing field for automatically implemented property 'Rectangle.Y' must be
fully assigned before control is returned to the caller. Consider calling
the default constructor from a constructor initializer.
Heres the source code.
public struct Rectangle
{
public Rectangle(int x, int y, int width, int height)
{
X = x;
Y = y;
Width = width;
Height = height;
}
public int Width { get; private set; }
public int Height { get; private set; }
public int X { get; private set; }
public int Y { get; private set; }
}
Ultra simple question... How does one properly initialize private backing
fields on a structure? I get a compiler error:
Backing field for automatically implemented property 'Rectangle.Y' must be
fully assigned before control is returned to the caller. Consider calling
the default constructor from a constructor initializer.
Heres the source code.
public struct Rectangle
{
public Rectangle(int x, int y, int width, int height)
{
X = x;
Y = y;
Width = width;
Height = height;
}
public int Width { get; private set; }
public int Height { get; private set; }
public int X { get; private set; }
public int Y { get; private set; }
}
Do i have to create a certain nonclustered index every now and then?
Do i have to create a certain nonclustered index every now and then?
I have a database table that has more than 50 Million record and to
improve searching i had to create a non clustered indexes, and once i
create one it takes 5 ~ 10 minutes to be created so i guess in the
background it sorts the data according to the index.
So for example before adding index to my table searching was awful and
takes long time and when i added the non clustered index, searching was
fast.
But that was only when i had 50 million records.
The question is, what if i defined the index at the very beginning when
creating the table before adding any data to the table? Would it give the
same search performance i am getting right now? or do i have to delete and
recreate the index every now and then to sort the data regularly?
I am sorry if my question seemed stupid, i just started learning about
indexes and it is a confusing topic for me.
I have a database table that has more than 50 Million record and to
improve searching i had to create a non clustered indexes, and once i
create one it takes 5 ~ 10 minutes to be created so i guess in the
background it sorts the data according to the index.
So for example before adding index to my table searching was awful and
takes long time and when i added the non clustered index, searching was
fast.
But that was only when i had 50 million records.
The question is, what if i defined the index at the very beginning when
creating the table before adding any data to the table? Would it give the
same search performance i am getting right now? or do i have to delete and
recreate the index every now and then to sort the data regularly?
I am sorry if my question seemed stupid, i just started learning about
indexes and it is a confusing topic for me.
c# menuItem1 will not disable
c# menuItem1 will not disable
Is this wrong?
I always get "cb1 and firmware" even if my checkBox2 is checked. I also
tried with just & instead of &&.
It was working fine before I had to add it into thread to get UI to update
correctly.
private void MyWorkerThread2()
{
if ((this.IsChecked(checkBox1) && (myString == "86.09.0000")))
{
MessageBox.Show("cb1 and firmware");
Prep.clean();
startedimage();
wipefiles();
}
else if (this.IsChecked(checkBox1) &&
(this.IsChecked(checkBox2) && (myString == "86.09.0000")))
{
MessageBox.Show("cb1 and firmware and cb2");
Prep.clean();
startedimage();
fscreate();
wipefiles();
}
else if (myString == "86.09.0000")
{
MessageBox.Show("firmware");
if (myThread == null)
{
Prep.clean();
startedimage();
myThread = new Thread(MyWorkerThread);
myThread.IsBackground = true;
myThread.Start();
}
}
else
{
FactoryReset();
}
}
public delegate bool IsCheckedDelegate(CheckBox cb);
public bool IsChecked(CheckBox cb)
{
if (cb.InvokeRequired)
{
return (bool)cb.Invoke(new IsCheckedDelegate(IsChecked),
new Object[] { cb });
}
else
{
return cb.Checked;
}
}
Is this wrong?
I always get "cb1 and firmware" even if my checkBox2 is checked. I also
tried with just & instead of &&.
It was working fine before I had to add it into thread to get UI to update
correctly.
private void MyWorkerThread2()
{
if ((this.IsChecked(checkBox1) && (myString == "86.09.0000")))
{
MessageBox.Show("cb1 and firmware");
Prep.clean();
startedimage();
wipefiles();
}
else if (this.IsChecked(checkBox1) &&
(this.IsChecked(checkBox2) && (myString == "86.09.0000")))
{
MessageBox.Show("cb1 and firmware and cb2");
Prep.clean();
startedimage();
fscreate();
wipefiles();
}
else if (myString == "86.09.0000")
{
MessageBox.Show("firmware");
if (myThread == null)
{
Prep.clean();
startedimage();
myThread = new Thread(MyWorkerThread);
myThread.IsBackground = true;
myThread.Start();
}
}
else
{
FactoryReset();
}
}
public delegate bool IsCheckedDelegate(CheckBox cb);
public bool IsChecked(CheckBox cb)
{
if (cb.InvokeRequired)
{
return (bool)cb.Invoke(new IsCheckedDelegate(IsChecked),
new Object[] { cb });
}
else
{
return cb.Checked;
}
}
XPath search does not work
XPath search does not work
I try to access an xml file with dom4j. I also tried trough the dom of
org.w3c but this failed in the same way. I have a sample of the xml file
which I try to read below. I try to read the attribute xlink:href from the
element loc but for some reason this always fails. When I try the same
methods on an simple xml file I write myself, it does work. I've been
working on this for days now. Here is my method:
File file = new File("schemas/pfs-2013-04-01-presentation.xml");
SAXReader reader = new SAXReader();
Document document = reader.read(file);
XPath xpath = document.createXPath("//loc");
Map uris = new HashMap();
uris.put("", "http://www.xbrl.org/2003/linkbase");
uris.put("xbrli","http://www.xbrl.org/2003/instance");
uris.put("xlink","http://www.w3.org/1999/xlink");
uris.put("xsi","http://www.w3.org/2001/XMLSchema-instance");
xpath.setNamespaceURIs(uris);
List<Node> nodes = xpath.selectNodes(xpath);
From these 'nodes' I want to read the attributes later on. When I execute
this the List is empty however. This is something do not understand.
Can anyone help me with this please? thanks
<?xml version="1.0" encoding="UTF-8"?>
<linkbase xmlns="http://www.xbrl.org/2003/linkbase"
xmlns:xbrli="http://www.xbrl.org/2003/instance"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xbrl.org/2003/linkbase
http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd"
xmlns:presentationAttribute="http://www.nbb.be/be/fr/pfs/presentationAttribute"
>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullIdentifyingData"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullIdentifyingData"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullBalanceSheet"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullBalanceSheet"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullIncomeStatement"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullIncomeStatement"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullAppropriationsWithdrawings"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullAppropriationsWithdrawings"/>
<roleRef roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullDisclosures"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullDisclosures"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullSocialBalanceSheet"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullSocialBalanceSheet"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullValidationRules"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullValidationRules"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullManagementReport"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullManagementReport"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullAccountantsReport"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullAccountantsReport"/>
<presentationLink xlink:type="extended"
xlink:role="http://www.nbb.be/be/fr/pfs/ci/role/FullIdentifyingData">
<loc xlink:type="locator"
xlink:href="pfs-2013-04-01.xsd#pfs_IdentifyingData"
xlink:label="IdentifyingData_1" />
<loc xlink:type="locator"
xlink:href="pfs-gcd-2013-04-01.xsd#pfs-gcd_GlobalCommonDocument"
xlink:label="GlobalCommonDocument_2" />
<loc xlink:type="locator"
xlink:href="pfs-gcd-2013-04-01.xsd#pfs-gcd_EntityInformation"
xlink:label="EntityInformation_3" />
<loc xlink:type="locator"
xlink:href="pfs-gcd-2013-04-01.xsd#pfs-gcd_EntityName"
xlink:label="EntityName_4" />
<loc xlink:type="locator"
xlink:href="pfs-gcd-2013-04-01.xsd#pfs-gcd_EntityCurrentLegalName"
xlink:label="EntityCurrentLegalName_5" />
I try to access an xml file with dom4j. I also tried trough the dom of
org.w3c but this failed in the same way. I have a sample of the xml file
which I try to read below. I try to read the attribute xlink:href from the
element loc but for some reason this always fails. When I try the same
methods on an simple xml file I write myself, it does work. I've been
working on this for days now. Here is my method:
File file = new File("schemas/pfs-2013-04-01-presentation.xml");
SAXReader reader = new SAXReader();
Document document = reader.read(file);
XPath xpath = document.createXPath("//loc");
Map uris = new HashMap();
uris.put("", "http://www.xbrl.org/2003/linkbase");
uris.put("xbrli","http://www.xbrl.org/2003/instance");
uris.put("xlink","http://www.w3.org/1999/xlink");
uris.put("xsi","http://www.w3.org/2001/XMLSchema-instance");
xpath.setNamespaceURIs(uris);
List<Node> nodes = xpath.selectNodes(xpath);
From these 'nodes' I want to read the attributes later on. When I execute
this the List is empty however. This is something do not understand.
Can anyone help me with this please? thanks
<?xml version="1.0" encoding="UTF-8"?>
<linkbase xmlns="http://www.xbrl.org/2003/linkbase"
xmlns:xbrli="http://www.xbrl.org/2003/instance"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xbrl.org/2003/linkbase
http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd"
xmlns:presentationAttribute="http://www.nbb.be/be/fr/pfs/presentationAttribute"
>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullIdentifyingData"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullIdentifyingData"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullBalanceSheet"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullBalanceSheet"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullIncomeStatement"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullIncomeStatement"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullAppropriationsWithdrawings"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullAppropriationsWithdrawings"/>
<roleRef roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullDisclosures"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullDisclosures"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullSocialBalanceSheet"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullSocialBalanceSheet"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullValidationRules"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullValidationRules"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullManagementReport"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullManagementReport"/>
<roleRef
roleURI="http://www.nbb.be/be/fr/pfs/ci/role/FullAccountantsReport"
xlink:type="simple"
xlink:href="pfs-full-2013-04-01.xsd#FullAccountantsReport"/>
<presentationLink xlink:type="extended"
xlink:role="http://www.nbb.be/be/fr/pfs/ci/role/FullIdentifyingData">
<loc xlink:type="locator"
xlink:href="pfs-2013-04-01.xsd#pfs_IdentifyingData"
xlink:label="IdentifyingData_1" />
<loc xlink:type="locator"
xlink:href="pfs-gcd-2013-04-01.xsd#pfs-gcd_GlobalCommonDocument"
xlink:label="GlobalCommonDocument_2" />
<loc xlink:type="locator"
xlink:href="pfs-gcd-2013-04-01.xsd#pfs-gcd_EntityInformation"
xlink:label="EntityInformation_3" />
<loc xlink:type="locator"
xlink:href="pfs-gcd-2013-04-01.xsd#pfs-gcd_EntityName"
xlink:label="EntityName_4" />
<loc xlink:type="locator"
xlink:href="pfs-gcd-2013-04-01.xsd#pfs-gcd_EntityCurrentLegalName"
xlink:label="EntityCurrentLegalName_5" />
Map physical screen position to an array of GraphicsDevice with Swing
Map physical screen position to an array of GraphicsDevice with Swing
In Windows, each screen has an number or identity assigned I assume is
relative to how I physically connected my monitor cables. Key to my
question is that I can reconfigure these screens but they will keep their
identity.
Java's call to
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices() will
give me an array of GraphicsDevice.
How can I correlate the order of screens in the array with the Window
numbering? I'd be interested in a cross-platform solution.
For example, my Windows configuration looks like this
but the array returned looks like this
screens[0] = relates to screen 2
screens[1] = relates to screen 3
screens[2] = relates to screen 1
So the physical
NB the code I get I'd like to use is along the lines of this
frame.setLocation(
screens[i].getDefaultConfiguration().getBounds().x, frame.getY());
where i should be the physical number and not the position in the array
(or its mapping if you see what I mean).
In Windows, each screen has an number or identity assigned I assume is
relative to how I physically connected my monitor cables. Key to my
question is that I can reconfigure these screens but they will keep their
identity.
Java's call to
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices() will
give me an array of GraphicsDevice.
How can I correlate the order of screens in the array with the Window
numbering? I'd be interested in a cross-platform solution.
For example, my Windows configuration looks like this
but the array returned looks like this
screens[0] = relates to screen 2
screens[1] = relates to screen 3
screens[2] = relates to screen 1
So the physical
NB the code I get I'd like to use is along the lines of this
frame.setLocation(
screens[i].getDefaultConfiguration().getBounds().x, frame.getY());
where i should be the physical number and not the position in the array
(or its mapping if you see what I mean).
Thursday, 26 September 2013
Chrome performance: "legal" property names vs
Chrome performance: "legal" property names vs
So this is an interesting one... While I was testing the performance of
setAttribute vs. normal property set on an element, I found an odd
behavior, which I then tested on regular objects and... It's still odd!
So if you have an object A = {}, and you set its property like
A['abc_def'] = 1, or A.abc_def = 1, they are basically the same. But then
if you do A['abc-def'] = 1 or A['123-def'] = 1 then you are in trouble. It
goes wayyy slower. I set up a test here: http://jsfiddle.net/naPYL/1/.
They all work the same on all browsers except chrome. The funny thing is
that for "abc_def" property, chrome is actually much faster than Firefox
and IE, as I expected. But for "abc-def" it's at least twice as slow.
So what happens here basically (at least from my tests) is that when using
"correct" syntax for properties (legal C syntax, which you can use with
dot properties) - It's fast, but when you use syntax that requires using
brackets (a[...]) then you're in trouble.
I tried to imagine what implementation detail would distinguish in such a
way between the two modes, and couldn't. Because as I think of it, if you
do support those non-standard names, you are probably translating all
names to the same mechanics, and the rest is just syntax which is compiled
into that mechanic. So . syntax and [] should be all the same after
compilation. But obviously something is going the other way around here...
Without looking at V8's source code, could anyone think of a really
satisfying answer? (Think of it as an exercise :-))
So this is an interesting one... While I was testing the performance of
setAttribute vs. normal property set on an element, I found an odd
behavior, which I then tested on regular objects and... It's still odd!
So if you have an object A = {}, and you set its property like
A['abc_def'] = 1, or A.abc_def = 1, they are basically the same. But then
if you do A['abc-def'] = 1 or A['123-def'] = 1 then you are in trouble. It
goes wayyy slower. I set up a test here: http://jsfiddle.net/naPYL/1/.
They all work the same on all browsers except chrome. The funny thing is
that for "abc_def" property, chrome is actually much faster than Firefox
and IE, as I expected. But for "abc-def" it's at least twice as slow.
So what happens here basically (at least from my tests) is that when using
"correct" syntax for properties (legal C syntax, which you can use with
dot properties) - It's fast, but when you use syntax that requires using
brackets (a[...]) then you're in trouble.
I tried to imagine what implementation detail would distinguish in such a
way between the two modes, and couldn't. Because as I think of it, if you
do support those non-standard names, you are probably translating all
names to the same mechanics, and the rest is just syntax which is compiled
into that mechanic. So . syntax and [] should be all the same after
compilation. But obviously something is going the other way around here...
Without looking at V8's source code, could anyone think of a really
satisfying answer? (Think of it as an exercise :-))
Thursday, 19 September 2013
What Javascript library should I use for Calendaring that is *NOT* integrated with the phone?
What Javascript library should I use for Calendaring that is *NOT*
integrated with the phone?
I'm developing a Javascript application that needs its own calendar,
separate from the native Android/ iPhone calendar.
What Javascript library allows for me to manage a calendar separate from
the default "main" calendar on the phone?
My goal is to list appointments, and have a Day/Week/Month view, ideally
in a form that the user is already familiar with (Android/iOS)
integrated with the phone?
I'm developing a Javascript application that needs its own calendar,
separate from the native Android/ iPhone calendar.
What Javascript library allows for me to manage a calendar separate from
the default "main" calendar on the phone?
My goal is to list appointments, and have a Day/Week/Month view, ideally
in a form that the user is already familiar with (Android/iOS)
How to vertical align my images with Texts
How to vertical align my images with Texts
I have a question regarding a vertical align of my image and text
I have someone like
<div id='div1'>
<div id='div2'>
text here, more and more and more and more texts…….
<img src='test.png' class='img'/>
</div>
</div>
#div2{
border-color: black;
border-style: solid;
border-width: 0 1px 1px 1px;
padding: 10px;
font-size: .8em;
}
#div1{
width: 250px;
}
.img{
float:right;
vertical-align:middle;
}
I want my result like
text here, more and more and more
and more and more and more and more img here
texts
Can anyone help me about it? Thanks a lot!
The image will be in vertical middle no matter how many line of texts I have.
I have a question regarding a vertical align of my image and text
I have someone like
<div id='div1'>
<div id='div2'>
text here, more and more and more and more texts…….
<img src='test.png' class='img'/>
</div>
</div>
#div2{
border-color: black;
border-style: solid;
border-width: 0 1px 1px 1px;
padding: 10px;
font-size: .8em;
}
#div1{
width: 250px;
}
.img{
float:right;
vertical-align:middle;
}
I want my result like
text here, more and more and more
and more and more and more and more img here
texts
Can anyone help me about it? Thanks a lot!
The image will be in vertical middle no matter how many line of texts I have.
Why GLSL "optimizing" this shader?
Why GLSL "optimizing" this shader?
I have simple shader where I trying to apply scaling and rotation onto
model's coordinates
#version 330
layout(location = 0) in vec3 VertexPosition;
layout(location = 1) in vec3 VertexNormal;
layout(location = 2) in vec2 VertexUV;
out VS_GS_VERTEX
{
vec3 vs_worldpos;
vec3 vs_normal;
vec2 VertexUV;
} vertex_out;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
uniform mat4 lookAtMatrix;
uniform mat4 mdlScaleMatrix;
uniform mat4 mdlRotMatrix;
void main(void)
{
mat4 mdlMat = mdlRotMatrix * mdlScaleMatrix;
vec4 mdlPos = mdlMat * vec4(VertexPosition, 1.0);
mat4 MVP = projectionMatrix * lookAtMatrix * modelMatrix;
gl_Position = MVP * mdlPos;
gl_Normal = mat3(modelMatrix) * VertexNormal;
vertex_out.vs_worldpos = gl_Position.xyz;
vertex_out.vs_normal = gl_Normal;
vertex_out.VertexUV = VertexUV;
}
but for some reason glGetUniformLocation for mdlRotMatrix and
mdlScaleMatrix returns -1. I can see values 4-6 for other uniforms. Why it
happens? I checked names and copy-pasted several times, made error in code
to check and got compilation error (shader works with exact file), so
names and shader are intact.
I have simple shader where I trying to apply scaling and rotation onto
model's coordinates
#version 330
layout(location = 0) in vec3 VertexPosition;
layout(location = 1) in vec3 VertexNormal;
layout(location = 2) in vec2 VertexUV;
out VS_GS_VERTEX
{
vec3 vs_worldpos;
vec3 vs_normal;
vec2 VertexUV;
} vertex_out;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
uniform mat4 lookAtMatrix;
uniform mat4 mdlScaleMatrix;
uniform mat4 mdlRotMatrix;
void main(void)
{
mat4 mdlMat = mdlRotMatrix * mdlScaleMatrix;
vec4 mdlPos = mdlMat * vec4(VertexPosition, 1.0);
mat4 MVP = projectionMatrix * lookAtMatrix * modelMatrix;
gl_Position = MVP * mdlPos;
gl_Normal = mat3(modelMatrix) * VertexNormal;
vertex_out.vs_worldpos = gl_Position.xyz;
vertex_out.vs_normal = gl_Normal;
vertex_out.VertexUV = VertexUV;
}
but for some reason glGetUniformLocation for mdlRotMatrix and
mdlScaleMatrix returns -1. I can see values 4-6 for other uniforms. Why it
happens? I checked names and copy-pasted several times, made error in code
to check and got compilation error (shader works with exact file), so
names and shader are intact.
Return NULL from XML EXPLICIT subquery where no rows exist
Return NULL from XML EXPLICIT subquery where no rows exist
This is probably simple to do, but I'm having a brain-fart on this one...
I'm using FOR XML EXPLICIT as part of a subquery so that I can explicitly
define the format of the returned XML. Therefore I'm using UNION ALL to
define that format.
This is working fine, but I need it to return NULL if there are no rows in
that sub-query... at the moment it is returning an empty root element:
<codes/>. That is because I need the first row for the definition.
Here is a sqlfiddlecom with everything below for you to look at.
This is a version of the TSQL as it currently is...
SELECT
P.[PROJECTID],
P.[PROJECTNAME],
( SELECT *
FROM (
SELECT
1 AS TAG,
NULL AS PARENT,
NULL AS 'codes!1',
NULL AS 'code!2!!element',
NULL AS 'code!2!split'
UNION ALL
SELECT
2 AS TAG,
1 AS PARENT,
NULL,
C.[CODE],
C.[SPLIT]
FROM [CODES] C
WHERE C.[PROJECTID] = P.[PROJECTID]
) AS [CODEXMLDATA]
FOR XML EXPLICIT
) AS [CODESXML]
FROM [PROJECTS] P
Example data would be along the lines of
PROJECTS table
PROJECTID PROJECTNAME
1 This
2 That
3 Other
CODES table
PROJECTID CODE SPLIT
1 ABC 45
1 BCD 65
2 CDE 100
The result is coming out as...
PROJECTID PROJECTNAME CODESXML
1 This <codes><code split="45">ABC</code><code
split="55">BCD</code></codes>
2 That <codes><code split="100">CDE</code></codes>
3 Other <codes/>
The result I need is (note the NULL on the 3rd line)...
PROJECTID PROJECTNAME CODESXML
1 This <codes><code split="45">ABC</code><code
split="55">BCD</code></codes>
2 That <codes><code split="100">CDE</code></codes>
3 Other NULL
Can anybody give me a hint how I can make it return NULL when there are no
CODES?
This is probably simple to do, but I'm having a brain-fart on this one...
I'm using FOR XML EXPLICIT as part of a subquery so that I can explicitly
define the format of the returned XML. Therefore I'm using UNION ALL to
define that format.
This is working fine, but I need it to return NULL if there are no rows in
that sub-query... at the moment it is returning an empty root element:
<codes/>. That is because I need the first row for the definition.
Here is a sqlfiddlecom with everything below for you to look at.
This is a version of the TSQL as it currently is...
SELECT
P.[PROJECTID],
P.[PROJECTNAME],
( SELECT *
FROM (
SELECT
1 AS TAG,
NULL AS PARENT,
NULL AS 'codes!1',
NULL AS 'code!2!!element',
NULL AS 'code!2!split'
UNION ALL
SELECT
2 AS TAG,
1 AS PARENT,
NULL,
C.[CODE],
C.[SPLIT]
FROM [CODES] C
WHERE C.[PROJECTID] = P.[PROJECTID]
) AS [CODEXMLDATA]
FOR XML EXPLICIT
) AS [CODESXML]
FROM [PROJECTS] P
Example data would be along the lines of
PROJECTS table
PROJECTID PROJECTNAME
1 This
2 That
3 Other
CODES table
PROJECTID CODE SPLIT
1 ABC 45
1 BCD 65
2 CDE 100
The result is coming out as...
PROJECTID PROJECTNAME CODESXML
1 This <codes><code split="45">ABC</code><code
split="55">BCD</code></codes>
2 That <codes><code split="100">CDE</code></codes>
3 Other <codes/>
The result I need is (note the NULL on the 3rd line)...
PROJECTID PROJECTNAME CODESXML
1 This <codes><code split="45">ABC</code><code
split="55">BCD</code></codes>
2 That <codes><code split="100">CDE</code></codes>
3 Other NULL
Can anybody give me a hint how I can make it return NULL when there are no
CODES?
Is this an reasonable use case for storing JSON in MySQL?
Is this an reasonable use case for storing JSON in MySQL?
I understand that it is generally considered a "bad idea" to store JSON in
a MySQL column due to the fact that it becomes difficult to maintain and
is not easily searched, or otherwise queried. However, I feel that the
scenario I have encountered in my application is a reasonable use case for
storing JSON data in my MySQL table. I am indeed looking for an answer,
particularly one that may point out any difficulties which I may have
overlooked, or if there is any good reason to avoid what I have planned
and if so, an alternate approach.
The application at hand provides resource and inventory management, and
supports building Assemblies, which may contain an infinite number of sub
assemblies.
I have a table which holds all of the metadata for items, such as their
name, sku, retail price, dimensions, and most importantly to this
question: the item type. An item can either be a part or an assembly. For
items defined as assemblies, their contents are stored in another table,
item_assembly_contents whose structure is rather expected, using a
parent_id column to link the children to the parent. As you may expect, at
any time, a user may decide to add or remove an item from an assembly, or
otherwise modify the assembly contents or delete it entirely.
Here is a very simple example Assembly in JSON format, demonstrating a
single Sub Assembly structure.
{
"id":1,
"name":"Fruit Basket",
"type":"assembly",
"contents":[
{
"id":10,
"parent_id":1,
"name":"Apple",
"type":"part",
"quantity":1
},
{
"id":11,
"parent_id":1,
"name":"Orange",
"type":"part",
"quantity":1
},
{
"id":12,
"parent_id":1,
"name":"Bag-o-Grapes",
"type":"assembly",
"quantity":1,
"contents":[
{
"id":100,
"parent_id":12,
"name":"Green Grape",
"quanity":10,
"type":"part"
},
{
"id":101,
"parent_id":12,
"name":"Purple Grape",
"quanity":10,
"type":"part"
}
]
}
]
}
The Fruit Basket is an Assembly, which contains a Sub-Assembly named "Bag
o Fruits". This all works wonderfully, until orders and shipments come
into consideration.
Take for example, an outbound shipment containing an assembly. At any
time, the user must be able to see the contents of the assembly, as they
were defined at the time of shipment, which rules out simply retrieving
the data from the items and item_assembly_contents table, as these tables
may have been modified since the shipment was created. Therefore, assembly
contents must be explicitly saved with the shipment so that they may be
viewed at a later date, independent of the state or mere existence of the
assembly in the user's defined inventory (that being, the items table).
It is storing the assembly contents along side the shipment contents that
has me a bit confused, and where I believe storing the data in JSON is the
best solution. It is critical to understand the following points about
this data:
It will NOT be used for Searches
Any UPDATES will simply overwrite the contents of the row
It will MOST OFTEN be used to populate a Tree View on the Client, which
will accept the JSON as it exists in the table, without any need for
modification.
See this image for a (hopefully) more clear visualization of the data:
Questions
Is this a reasonable use case? Are my concerns meaningless?
Is there anything that I have looked over that may come back to bite me?
Can you provide an explanation why I should NOT proceed with my proposed
schema, and if so....
Can you provide an alternative approach?
As always, thank you so much for your time and please do not hesitate to
request clarification or additional information.
I understand that it is generally considered a "bad idea" to store JSON in
a MySQL column due to the fact that it becomes difficult to maintain and
is not easily searched, or otherwise queried. However, I feel that the
scenario I have encountered in my application is a reasonable use case for
storing JSON data in my MySQL table. I am indeed looking for an answer,
particularly one that may point out any difficulties which I may have
overlooked, or if there is any good reason to avoid what I have planned
and if so, an alternate approach.
The application at hand provides resource and inventory management, and
supports building Assemblies, which may contain an infinite number of sub
assemblies.
I have a table which holds all of the metadata for items, such as their
name, sku, retail price, dimensions, and most importantly to this
question: the item type. An item can either be a part or an assembly. For
items defined as assemblies, their contents are stored in another table,
item_assembly_contents whose structure is rather expected, using a
parent_id column to link the children to the parent. As you may expect, at
any time, a user may decide to add or remove an item from an assembly, or
otherwise modify the assembly contents or delete it entirely.
Here is a very simple example Assembly in JSON format, demonstrating a
single Sub Assembly structure.
{
"id":1,
"name":"Fruit Basket",
"type":"assembly",
"contents":[
{
"id":10,
"parent_id":1,
"name":"Apple",
"type":"part",
"quantity":1
},
{
"id":11,
"parent_id":1,
"name":"Orange",
"type":"part",
"quantity":1
},
{
"id":12,
"parent_id":1,
"name":"Bag-o-Grapes",
"type":"assembly",
"quantity":1,
"contents":[
{
"id":100,
"parent_id":12,
"name":"Green Grape",
"quanity":10,
"type":"part"
},
{
"id":101,
"parent_id":12,
"name":"Purple Grape",
"quanity":10,
"type":"part"
}
]
}
]
}
The Fruit Basket is an Assembly, which contains a Sub-Assembly named "Bag
o Fruits". This all works wonderfully, until orders and shipments come
into consideration.
Take for example, an outbound shipment containing an assembly. At any
time, the user must be able to see the contents of the assembly, as they
were defined at the time of shipment, which rules out simply retrieving
the data from the items and item_assembly_contents table, as these tables
may have been modified since the shipment was created. Therefore, assembly
contents must be explicitly saved with the shipment so that they may be
viewed at a later date, independent of the state or mere existence of the
assembly in the user's defined inventory (that being, the items table).
It is storing the assembly contents along side the shipment contents that
has me a bit confused, and where I believe storing the data in JSON is the
best solution. It is critical to understand the following points about
this data:
It will NOT be used for Searches
Any UPDATES will simply overwrite the contents of the row
It will MOST OFTEN be used to populate a Tree View on the Client, which
will accept the JSON as it exists in the table, without any need for
modification.
See this image for a (hopefully) more clear visualization of the data:
Questions
Is this a reasonable use case? Are my concerns meaningless?
Is there anything that I have looked over that may come back to bite me?
Can you provide an explanation why I should NOT proceed with my proposed
schema, and if so....
Can you provide an alternative approach?
As always, thank you so much for your time and please do not hesitate to
request clarification or additional information.
Why does Visual Studio (2008 and 2010) put three bytes at the beginning on newly created text and xml files?
Why does Visual Studio (2008 and 2010) put three bytes at the beginning on
newly created text and xml files?
When I create a new TEXT or XML file within Visual Studio (2010) three
bytes are set at the top of the file. They can't be seen unless you're
using a binary editor.
Why are they there and what do they do?
Is there a way to stop Visual Studio from putting them there?
As it stands I cannot use Visual Studio to XML files because these bytes
screw up the parser.
newly created text and xml files?
When I create a new TEXT or XML file within Visual Studio (2010) three
bytes are set at the top of the file. They can't be seen unless you're
using a binary editor.
Why are they there and what do they do?
Is there a way to stop Visual Studio from putting them there?
As it stands I cannot use Visual Studio to XML files because these bytes
screw up the parser.
Can't get one div completely to the right
Can't get one div completely to the right
I am looking for help regarding a <div> problem. In the header section I
have a logo, facebook (button) and my menu. The facebook button and the
logo are in the right place, however I cannot manage to get the menu in
the right place. I want to it to be to the right side, sticking to the
right side of the browser.
I hope someone is willing to help me.
<body>
<div id="topContainer">
<div id="centerContainer">
<a href="index.html" class="logo fl">
<img src="images/logoMAIN.png" alt="Grand Cafe de Reebok" /></a>
<div id="social">
<a
href="https://www.facebook.com/GrandCafeDeReebok?fref=ts"><img
src="images/ Facebook.png" /></a>
</div> <!-- End social -->
<div id="navigation">
<ul class="nav">
<li class="active"><a href="index.html"><span>de
Reebok</span></a></li>
<li><a href="menu.html"><span>Menu</span></a></li>
<li><a
href="reserveer.html"><span>Reserveer</span></a></li>
<li><a
href="openingstijden.html"><span>Openingstijden</span></a></li>
<li><a
href="arrangement.html"><span>Arrangement</span></a></li>
<li><a href="fotos.html"><span>Foto's</span></a></li>
</ul>
</div> <!-- End navigation -->
</div> <!-- End centerContainer -->
</div> <!-- End topContainer -->
The CSS file:
#centerContainer {
width: 100%;
height: 280px;
margin: 0 auto;}
.logo {
float: left;
margin: 58px 36px 33px 85px;
display: block;
position: relative;
height: 200px;
width: 180px;}
#social {
float: right;
margin: 20px 30px 0 0;}
#navigation ul li {
text-decoration: none;
text-transform: uppercase;
display: inline;
font-family: Arial;
font-size: 16px;
text-align: center;}
#navigation ul li a {
margin-right: 18px;
line-height: 60px;
margin-left: 3px;}
#navigation ul li a:hover {
color: #fff;}
#navigation ul li.active a {
color: #fff;}
#navigation {
float: right;
margin: 90px 0px 77px 0px;
background-color: rgba(0,0,0,0.41);
width: 680px;
padding: 15px;
height: 70px;
position: absolute;
clear: both;}
#mainContainer {
background-image: url(../images/mainContainer-bg.png);
padding-top: 20px;
margin-top: 20px;
height: 462px;
-webkit-box-shadow: 0 12px 40px -6px black;
-moz-box-shadow: 0 12px 40px -6px black;
box-shadow: 0 12px 40px -6px black;
position: relative;
overflow: hidden;
width: 100%;}
I am looking for help regarding a <div> problem. In the header section I
have a logo, facebook (button) and my menu. The facebook button and the
logo are in the right place, however I cannot manage to get the menu in
the right place. I want to it to be to the right side, sticking to the
right side of the browser.
I hope someone is willing to help me.
<body>
<div id="topContainer">
<div id="centerContainer">
<a href="index.html" class="logo fl">
<img src="images/logoMAIN.png" alt="Grand Cafe de Reebok" /></a>
<div id="social">
<a
href="https://www.facebook.com/GrandCafeDeReebok?fref=ts"><img
src="images/ Facebook.png" /></a>
</div> <!-- End social -->
<div id="navigation">
<ul class="nav">
<li class="active"><a href="index.html"><span>de
Reebok</span></a></li>
<li><a href="menu.html"><span>Menu</span></a></li>
<li><a
href="reserveer.html"><span>Reserveer</span></a></li>
<li><a
href="openingstijden.html"><span>Openingstijden</span></a></li>
<li><a
href="arrangement.html"><span>Arrangement</span></a></li>
<li><a href="fotos.html"><span>Foto's</span></a></li>
</ul>
</div> <!-- End navigation -->
</div> <!-- End centerContainer -->
</div> <!-- End topContainer -->
The CSS file:
#centerContainer {
width: 100%;
height: 280px;
margin: 0 auto;}
.logo {
float: left;
margin: 58px 36px 33px 85px;
display: block;
position: relative;
height: 200px;
width: 180px;}
#social {
float: right;
margin: 20px 30px 0 0;}
#navigation ul li {
text-decoration: none;
text-transform: uppercase;
display: inline;
font-family: Arial;
font-size: 16px;
text-align: center;}
#navigation ul li a {
margin-right: 18px;
line-height: 60px;
margin-left: 3px;}
#navigation ul li a:hover {
color: #fff;}
#navigation ul li.active a {
color: #fff;}
#navigation {
float: right;
margin: 90px 0px 77px 0px;
background-color: rgba(0,0,0,0.41);
width: 680px;
padding: 15px;
height: 70px;
position: absolute;
clear: both;}
#mainContainer {
background-image: url(../images/mainContainer-bg.png);
padding-top: 20px;
margin-top: 20px;
height: 462px;
-webkit-box-shadow: 0 12px 40px -6px black;
-moz-box-shadow: 0 12px 40px -6px black;
box-shadow: 0 12px 40px -6px black;
position: relative;
overflow: hidden;
width: 100%;}
Zoom in and rotate simultaneously on seekbar in Android
Zoom in and rotate simultaneously on seekbar in Android
I am working on a project where I need to ZoomIn and rotate the image
simultaneously on seekbar progress value.
I have tried below code. But this is not working. This is just rotating
the image.
Matrix matrix = new Matrix();
matrix.postRotate(curValue);
//matrix.postScale(curValue, curValue);
Bitmap resizedBitmap = Bitmap.createBitmap(bitmaprotate, 0, 0, bmpWidth,
bmpHeight, matrix, true);
mainImage.setImageBitmap(resizedBitmap);
I am working on a project where I need to ZoomIn and rotate the image
simultaneously on seekbar progress value.
I have tried below code. But this is not working. This is just rotating
the image.
Matrix matrix = new Matrix();
matrix.postRotate(curValue);
//matrix.postScale(curValue, curValue);
Bitmap resizedBitmap = Bitmap.createBitmap(bitmaprotate, 0, 0, bmpWidth,
bmpHeight, matrix, true);
mainImage.setImageBitmap(resizedBitmap);
Wednesday, 18 September 2013
Is it possible to find all visited links in the browser?
Is it possible to find all visited links in the browser?
This is the snippet from this code:
<a href='www.apple.com'>apple</a>
<a href='www.google.com'>Google</a>
__
a{
display: block;
background-color: rgba(200,200,180,0.4);
margin-bottom: 18px;
line-height: 160%;
}
a:visited{
background-color: red;
}
It applies :visited css to second hyperlink and if I change first
hyperlink from www.apple.com to http://www.apple.com it applies :visited
css to that also (strange?).
Why I am doing this is because one of the QA person says that one of the
hyperlink in my page always shows as visited while he didn't visited the
link. Even if we reset safari it still shows as visited. Unless we restart
the mac it always says visited.
Is it possible to show him the list of hyperlinks he visited. ( It is not
in browser history as well )
This is the snippet from this code:
<a href='www.apple.com'>apple</a>
<a href='www.google.com'>Google</a>
__
a{
display: block;
background-color: rgba(200,200,180,0.4);
margin-bottom: 18px;
line-height: 160%;
}
a:visited{
background-color: red;
}
It applies :visited css to second hyperlink and if I change first
hyperlink from www.apple.com to http://www.apple.com it applies :visited
css to that also (strange?).
Why I am doing this is because one of the QA person says that one of the
hyperlink in my page always shows as visited while he didn't visited the
link. Even if we reset safari it still shows as visited. Unless we restart
the mac it always says visited.
Is it possible to show him the list of hyperlinks he visited. ( It is not
in browser history as well )
Existing HTML website, but processing on Google App Engine?
Existing HTML website, but processing on Google App Engine?
I have a website hosted already and it contains an HTML form. I want to be
able to submit the form to a Python script on Google App engine to handle
the data. In the documentation, there is a tutorial to process forms with
Python, but it was from a page that was served in the script itself. How
do I link an existing domain/webpage to a script running on Google App
Engine? Thanks for any help!
~Carpetfizz
I have a website hosted already and it contains an HTML form. I want to be
able to submit the form to a Python script on Google App engine to handle
the data. In the documentation, there is a tutorial to process forms with
Python, but it was from a page that was served in the script itself. How
do I link an existing domain/webpage to a script running on Google App
Engine? Thanks for any help!
~Carpetfizz
How can I separate user inputted string and store it into an array
How can I separate user inputted string and store it into an array
I was wondering if you could help me and figure this out without using
something like strtok. This assignment is meant for me to build something
that will accept input and direct the user to the right area. I want to
get something like....
Help Copy
and it stores it as
array[1] = Help
array[2] = Copy.
I tried to do something like cin>>arr[1]; and cin>>arr[2] but at the same
time what if the user enters copy then I am not sure how to do it cause if
I put just one cin then what if the user puts help copy.
Basically I am not sure how to accept any size input and store anything
they put in as elements in an array.
I would try something like cin.get or getline but they don't seem to
really help me and my cin idea was not helpful at all.
This is what I have so far.
int main()
{
string user;
cout<<"Hello there, what is your desired username?"<<endl;
cin >> user;
system("cls");
cout<<"Hello, " << user << "! How are you doing?"<<endl<<endl;
cout<< user << ": ";
return 0;
}
I was wondering if you could help me and figure this out without using
something like strtok. This assignment is meant for me to build something
that will accept input and direct the user to the right area. I want to
get something like....
Help Copy
and it stores it as
array[1] = Help
array[2] = Copy.
I tried to do something like cin>>arr[1]; and cin>>arr[2] but at the same
time what if the user enters copy then I am not sure how to do it cause if
I put just one cin then what if the user puts help copy.
Basically I am not sure how to accept any size input and store anything
they put in as elements in an array.
I would try something like cin.get or getline but they don't seem to
really help me and my cin idea was not helpful at all.
This is what I have so far.
int main()
{
string user;
cout<<"Hello there, what is your desired username?"<<endl;
cin >> user;
system("cls");
cout<<"Hello, " << user << "! How are you doing?"<<endl<<endl;
cout<< user << ": ";
return 0;
}
How to access object methods by name?
How to access object methods by name?
I have a small question: if i run this:
print(list(globals()))
this is the output:
['__package__', '__loader__', '__doc__', , '__file__', 'b', '__name__',
'__builtins__', 'a']
I want to try a method with all of these elements, especially a and b .
But this would be like:
'a'.run()
so this doesn´t work at all.
i need sth like:
a.run()
thanks for help in advance!
I have a small question: if i run this:
print(list(globals()))
this is the output:
['__package__', '__loader__', '__doc__', , '__file__', 'b', '__name__',
'__builtins__', 'a']
I want to try a method with all of these elements, especially a and b .
But this would be like:
'a'.run()
so this doesn´t work at all.
i need sth like:
a.run()
thanks for help in advance!
How to disable audio output processing on an htc phone with Android
How to disable audio output processing on an htc phone with Android
I am trying to measure the audio path from speaker to microphone on two
different phones, an htc Wildfire S running Android 2.3.5, and an htc One
X running Android 4.0.3. Using Eclipse, I coded an app that has wave files
played back using an android.media.MediaPlayer. However, my recordings
show that something like an automatic gain control is applied to the
output, as loud files are attenuated, and the recordings feature almost
equal amplitudes, although the played back files vary widely in their
respective amplitudes.
How can I switch any processing of the audio data off prior to output? I
would like to obtain direct control over raw audio output.
Thanks in advance.
I am trying to measure the audio path from speaker to microphone on two
different phones, an htc Wildfire S running Android 2.3.5, and an htc One
X running Android 4.0.3. Using Eclipse, I coded an app that has wave files
played back using an android.media.MediaPlayer. However, my recordings
show that something like an automatic gain control is applied to the
output, as loud files are attenuated, and the recordings feature almost
equal amplitudes, although the played back files vary widely in their
respective amplitudes.
How can I switch any processing of the audio data off prior to output? I
would like to obtain direct control over raw audio output.
Thanks in advance.
What is the point of Partial Views in Asp.net MVC
What is the point of Partial Views in Asp.net MVC
Ive noticed that there seems to be no real difference between a view and a
partial view. For instance, one can create a view but can render it as a
partial view by using
@Html.Partial("ViewName")
or by specifying that its action return it as
return PartialView();
Ive noticed that the opposite is also the case - ie, one can create a
partial view but if it is returned as a full view, it will be displayed
with the default layout for the views.
My question is this - When adding a new view in Visual Studio, one is
given the option of creating a view that is partial or not. Isn't this
redundant, since a view can be rendered as both a partial and a full view
anyway?
Ive noticed that there seems to be no real difference between a view and a
partial view. For instance, one can create a view but can render it as a
partial view by using
@Html.Partial("ViewName")
or by specifying that its action return it as
return PartialView();
Ive noticed that the opposite is also the case - ie, one can create a
partial view but if it is returned as a full view, it will be displayed
with the default layout for the views.
My question is this - When adding a new view in Visual Studio, one is
given the option of creating a view that is partial or not. Isn't this
redundant, since a view can be rendered as both a partial and a full view
anyway?
List of all devices connected to a network
List of all devices connected to a network
I am learning sockets in C, but i can't find any information about getting
a list of all the connected devices in my WLAN network (I am using Linux).
Can anyone provide me of information or where i can start learning?
I am learning sockets in C, but i can't find any information about getting
a list of all the connected devices in my WLAN network (I am using Linux).
Can anyone provide me of information or where i can start learning?
Remove and in Text using RegEx
Remove and in Text using RegEx
I am trying to get the text available inside the elements. I have used the
innerHTML to retrieve that inner text, but in few elements the inner Text
is placed inside the elements.
While retrieving the text value am getting it as "sample text" as the
output string. Can anyone help me to remove the "" in the output string
using RegEx so that i can only have "sample text" in my output string.
<a href="#"><span>Sample Text</span></a>
Note: I am not using any Javascript Libraries in the page.
I am trying to get the text available inside the elements. I have used the
innerHTML to retrieve that inner text, but in few elements the inner Text
is placed inside the elements.
While retrieving the text value am getting it as "sample text" as the
output string. Can anyone help me to remove the "" in the output string
using RegEx so that i can only have "sample text" in my output string.
<a href="#"><span>Sample Text</span></a>
Note: I am not using any Javascript Libraries in the page.
Tuesday, 17 September 2013
Using SSl on loccalhost problems
Using SSl on loccalhost problems
i am trying to open a default https://localhost page from my default xampp
page but i am continuously receiving error as below for chrome and firefox
CHROME
SSL connection error Unable to make a secure connection to the server.
This may be a problem with the server, or it may be requiring a client
authentication certificate that you don't have. Error 107
(net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
FIREROX
The connection was interrupted The connection to localhost was interrupted
while the page was loading. The site could be temporarily unavailable or
too busy. Try again in a few moments. If you are unable to load any pages,
check your computer's network connection. If your computer or network is
protected by a firewall or proxy, make sure that Firefox is permitted to
access the Web.
I have done all the settings for ssl, where as i dont think i need to do
any setting for it the version for xampp is 1.7 and the same version
installed on my home pc runs the default page https://localhost perfectly
without any custom settings , the thing that i cant help noticing is the
prompt for accepting the certificate in the browser with the following
text.
This Connection is Untrusted You have asked Firefox to connect securely to
localhost, but we can't confirm that your connection is secure. Normally,
when you try to connect securely, sites will present trusted
identification to prove that you are going to the right place. However,
this site's identity can't be verified. What Should I Do? If you usually
connect to this site without problems, this error could mean that someone
is trying to impersonate the site, and you shouldn't continue.
This particular message appear on my home PC through which i can install
the certificate and move on to the site, same is fir all the other Pc in
my office but not on your Office PC..
i am trying to open a default https://localhost page from my default xampp
page but i am continuously receiving error as below for chrome and firefox
CHROME
SSL connection error Unable to make a secure connection to the server.
This may be a problem with the server, or it may be requiring a client
authentication certificate that you don't have. Error 107
(net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
FIREROX
The connection was interrupted The connection to localhost was interrupted
while the page was loading. The site could be temporarily unavailable or
too busy. Try again in a few moments. If you are unable to load any pages,
check your computer's network connection. If your computer or network is
protected by a firewall or proxy, make sure that Firefox is permitted to
access the Web.
I have done all the settings for ssl, where as i dont think i need to do
any setting for it the version for xampp is 1.7 and the same version
installed on my home pc runs the default page https://localhost perfectly
without any custom settings , the thing that i cant help noticing is the
prompt for accepting the certificate in the browser with the following
text.
This Connection is Untrusted You have asked Firefox to connect securely to
localhost, but we can't confirm that your connection is secure. Normally,
when you try to connect securely, sites will present trusted
identification to prove that you are going to the right place. However,
this site's identity can't be verified. What Should I Do? If you usually
connect to this site without problems, this error could mean that someone
is trying to impersonate the site, and you shouldn't continue.
This particular message appear on my home PC through which i can install
the certificate and move on to the site, same is fir all the other Pc in
my office but not on your Office PC..
Equivalent of Python's locals()?
Equivalent of Python's locals()?
Python's locals() function, when called within the scope of a function,
returns a dictionary whose key-value pairs are the names and values of the
function's local variables. For example:
def menu():
spam = 3
ham = 9
eggs = 5
return locals()
print menu() # {'eggs': 5, 'ham': 9, 'spam': 3}
Does JavaScript have anything like this?
Python's locals() function, when called within the scope of a function,
returns a dictionary whose key-value pairs are the names and values of the
function's local variables. For example:
def menu():
spam = 3
ham = 9
eggs = 5
return locals()
print menu() # {'eggs': 5, 'ham': 9, 'spam': 3}
Does JavaScript have anything like this?
Replacing specific line with new line in a .txt file
Replacing specific line with new line in a .txt file
I am trying to edit a text file. My problem is I cant get the new line,
which replaces some part of the old line, to the same position the old
line was located in the file (meaning the same line number). The newline
tends to print out at the bottom of the file. How can I change that?
public static void main(String[] args) {
new class().query();
List<String> strlist = new ArrayList<String>() ;
File file = new File("file");
try {
PrintWriter out = new PrintWriter(new FileWriter(file, true));
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
if (line.contains("j(ac)")) {
String raw = "" ;
for (int index = 0; index < strlist.size(); index++) {
String s = strlist.get(index);
raw = raw + "," + s;
}
String raw2 = raw.replaceFirst(",", "");
String newline = line.replaceAll("/.*?/", "/"+raw2+"/");
out.write(newline);
out.close();
}
scanner.close();
} catch (IOException e) {
System.out.println(" Error reading file");
}
}
}
I am trying to edit a text file. My problem is I cant get the new line,
which replaces some part of the old line, to the same position the old
line was located in the file (meaning the same line number). The newline
tends to print out at the bottom of the file. How can I change that?
public static void main(String[] args) {
new class().query();
List<String> strlist = new ArrayList<String>() ;
File file = new File("file");
try {
PrintWriter out = new PrintWriter(new FileWriter(file, true));
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
if (line.contains("j(ac)")) {
String raw = "" ;
for (int index = 0; index < strlist.size(); index++) {
String s = strlist.get(index);
raw = raw + "," + s;
}
String raw2 = raw.replaceFirst(",", "");
String newline = line.replaceAll("/.*?/", "/"+raw2+"/");
out.write(newline);
out.close();
}
scanner.close();
} catch (IOException e) {
System.out.println(" Error reading file");
}
}
}
Compare two int lists
Compare two int lists
I have an object that looks like this:
public class TestObject {
private string name = string.Empty;
private List<int> ids;
public TestObject(List<int> ids, string name)
{
this.ids = ids;
this.name = name;
}
public string Name
{
get { return name; }
set { name = value; }
}
public List<int> Ids
{
get { return ids; }
set { ids = value; }
}
}
I get a list of of these objects that looks something like this:
List<TestObject> listTest = new List<TestObject>();
listTest.Add(new TestObject((new int[] { 0, 1, 5 }).ToList(), "Test1"));
listTest.Add(new TestObject((new int[] { 10, 35, 15 }).ToList(), "Test2"));
listTest.Add(new TestObject((new int[] { 55 }).ToList(), "Test3"));
listTest.Add(new TestObject((new int[] { 44 }).ToList(), "Test4"));
listTest.Add(new TestObject((new int[] { 7, 17 }).ToList(), "Test5"));
Then I have several lists of integers like so:
List<int> list1 = new List<int>();
list1.Add(0);
list1.Add(1);
list1.Add(5);
List<int> list2 = new List<int>();
list2.Add(4);
List<int> list3 = new List<int>();
list3.Add(7);
List<int> list4 = new List<int>();
list4.Add(55);
What I'd like to do is to be able to check these integers lists against
the TestObject list and extract TestObjects that are equal. In other
words, in this example list1 would find a hit in the object at position 0,
list4 would find a hit in position 2, there is no hit for list3 as there
is only a partial in position 4 and there is no hit for list2 as it does
not exist.
I thought first that it could be done with "Except." So, if there is
nothing between the listN and listTest at n position then that is a hit??
The thing is how to compare the listN to the list in the object at
position N in listTest??
I have an object that looks like this:
public class TestObject {
private string name = string.Empty;
private List<int> ids;
public TestObject(List<int> ids, string name)
{
this.ids = ids;
this.name = name;
}
public string Name
{
get { return name; }
set { name = value; }
}
public List<int> Ids
{
get { return ids; }
set { ids = value; }
}
}
I get a list of of these objects that looks something like this:
List<TestObject> listTest = new List<TestObject>();
listTest.Add(new TestObject((new int[] { 0, 1, 5 }).ToList(), "Test1"));
listTest.Add(new TestObject((new int[] { 10, 35, 15 }).ToList(), "Test2"));
listTest.Add(new TestObject((new int[] { 55 }).ToList(), "Test3"));
listTest.Add(new TestObject((new int[] { 44 }).ToList(), "Test4"));
listTest.Add(new TestObject((new int[] { 7, 17 }).ToList(), "Test5"));
Then I have several lists of integers like so:
List<int> list1 = new List<int>();
list1.Add(0);
list1.Add(1);
list1.Add(5);
List<int> list2 = new List<int>();
list2.Add(4);
List<int> list3 = new List<int>();
list3.Add(7);
List<int> list4 = new List<int>();
list4.Add(55);
What I'd like to do is to be able to check these integers lists against
the TestObject list and extract TestObjects that are equal. In other
words, in this example list1 would find a hit in the object at position 0,
list4 would find a hit in position 2, there is no hit for list3 as there
is only a partial in position 4 and there is no hit for list2 as it does
not exist.
I thought first that it could be done with "Except." So, if there is
nothing between the listN and listTest at n position then that is a hit??
The thing is how to compare the listN to the list in the object at
position N in listTest??
Reassigning a generic Java variable
Reassigning a generic Java variable
I'm slightly confused why the following does not compile:
public <E extends Object> E doSomething() {
return new Object();
}
I've researched the problem a little and found various fixes like casting
to an (E) or using Class Literals but I'm still unsure what is actually
wrong with the above.
I'm slightly confused why the following does not compile:
public <E extends Object> E doSomething() {
return new Object();
}
I've researched the problem a little and found various fixes like casting
to an (E) or using Class Literals but I'm still unsure what is actually
wrong with the above.
Simple coding test
Simple coding test
I need to create a simple coding test in Java but I don't know much java.
I don't know how exceptions work in Java. I don't need the answers, I just
want to translate this to Java as it is. Here is the C# version
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test
{
class Program
{
static void Main(string[] args)
{
try
{
//reverse string
Testone("one two three four");
//Output the largest sum of 2 contiguous integers in this array
Testtwo(new int[5]{5,7,2,6,12});
//Anagrams?
Testthree("traditional","rtdatioialn");
catch (Exception e)
{
Console.WriteLine("{0} Exception was caught.", e);
}
Console.WriteLine("'q' to exit.");
while (Console.Read() != 113) {
}
}
private static void Testone(string One)
{
throw new NotImplementedException();
}
private static void Testtwo(int[] Two)
{
throw new NotImplementedException();
}
private static void Testthree(string Three, string Four)
{
throw new NotImplementedException();
}
}
I need to create a simple coding test in Java but I don't know much java.
I don't know how exceptions work in Java. I don't need the answers, I just
want to translate this to Java as it is. Here is the C# version
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test
{
class Program
{
static void Main(string[] args)
{
try
{
//reverse string
Testone("one two three four");
//Output the largest sum of 2 contiguous integers in this array
Testtwo(new int[5]{5,7,2,6,12});
//Anagrams?
Testthree("traditional","rtdatioialn");
catch (Exception e)
{
Console.WriteLine("{0} Exception was caught.", e);
}
Console.WriteLine("'q' to exit.");
while (Console.Read() != 113) {
}
}
private static void Testone(string One)
{
throw new NotImplementedException();
}
private static void Testtwo(int[] Two)
{
throw new NotImplementedException();
}
private static void Testthree(string Three, string Four)
{
throw new NotImplementedException();
}
}
Sunday, 15 September 2013
jQuery video clicking image to action video play (with placeholder on YT player)
jQuery video clicking image to action video play (with placeholder on YT
player)
I'm trying to click a thumbnail image in one div to play an embedded
youtube video in another div (embedded as iframe) as a full size video.
I've gotten that far, but instead of the YT player showing when the page
loads i need a static image to replace it. I'm very new to jquery but have
created the code from a few other answers on here so am a bit stuck on how
to do the replacement image along with the rest of it. any help would be
amazing.
any chance of any of this working on image maps instead of divs?
<title>JS Bin</title>
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.9.1.min.js">// <![CDATA[
// <![CDATA[
// ]]>
// ]]></script>
</p>
<div class="video_case"><iframe
src="http://www.youtube.com/embed/oHg5SJYRHA0" width="560" height="315"
allowfullscreen="" frameborder="0"></iframe></div>
<div class="video_wrapper">
<ul>
<li class="video_thumbnail"><a
href="http://www.youtube.com/embed/oHg5SJYRHA0?autoplay=1&controls=0"
title="" class="video-1"><img
src="/ProductImages_Display/PREVIEW/2/5172_31188_10523.jpg" border="0"
width="180" height="268" style="border: 0;" /></a></li>
</ul>
</div>
<p>
<script type="text/javascript">// <![CDATA[
$(function() {
$(".video-1").on("click", function(event) {
event.preventDefault();
$(".video_case iframe").prop("src",
$(event.currentTarget).attr("href"));
});
});
// ]]></script>
player)
I'm trying to click a thumbnail image in one div to play an embedded
youtube video in another div (embedded as iframe) as a full size video.
I've gotten that far, but instead of the YT player showing when the page
loads i need a static image to replace it. I'm very new to jquery but have
created the code from a few other answers on here so am a bit stuck on how
to do the replacement image along with the rest of it. any help would be
amazing.
any chance of any of this working on image maps instead of divs?
<title>JS Bin</title>
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.9.1.min.js">// <![CDATA[
// <![CDATA[
// ]]>
// ]]></script>
</p>
<div class="video_case"><iframe
src="http://www.youtube.com/embed/oHg5SJYRHA0" width="560" height="315"
allowfullscreen="" frameborder="0"></iframe></div>
<div class="video_wrapper">
<ul>
<li class="video_thumbnail"><a
href="http://www.youtube.com/embed/oHg5SJYRHA0?autoplay=1&controls=0"
title="" class="video-1"><img
src="/ProductImages_Display/PREVIEW/2/5172_31188_10523.jpg" border="0"
width="180" height="268" style="border: 0;" /></a></li>
</ul>
</div>
<p>
<script type="text/javascript">// <![CDATA[
$(function() {
$(".video-1").on("click", function(event) {
event.preventDefault();
$(".video_case iframe").prop("src",
$(event.currentTarget).attr("href"));
});
});
// ]]></script>
Regex: remove double parenthesis but preserve singles
Regex: remove double parenthesis but preserve singles
I have a bunch of co-ordinate data coming back in the following format:
TYPE ((lat long, lat long), (lat long, lat long), (lat long))
I'm trying and failing at creating a regex that will remove anything
except digits, spaces, commas, hypens, and SINGLE parenthesis; I can't for
the life of me figure out how to remove double parenthesis but not single.
I don't need to replace the double parenthesis with singles, just remove
them.
What I've come up with so far is:
preg_replace('/[^0-9,.-\s\(\)/', '', $val);
But this removes ALL brackets, which is not what I want. I've been trying
with lookahead/lookbehind assertions but can't quite seem to get it
right...
I have a bunch of co-ordinate data coming back in the following format:
TYPE ((lat long, lat long), (lat long, lat long), (lat long))
I'm trying and failing at creating a regex that will remove anything
except digits, spaces, commas, hypens, and SINGLE parenthesis; I can't for
the life of me figure out how to remove double parenthesis but not single.
I don't need to replace the double parenthesis with singles, just remove
them.
What I've come up with so far is:
preg_replace('/[^0-9,.-\s\(\)/', '', $val);
But this removes ALL brackets, which is not what I want. I've been trying
with lookahead/lookbehind assertions but can't quite seem to get it
right...
Chrome hide element on scroll after orientationchange
Chrome hide element on scroll after orientationchange
I'm facing a problem I can't figure out how to solve. I'm almost sure this
is a Chrome bug since in other browsers it works like a charm but I want
to be sure. On my website, developed using a mobile first and responsive
design approach, I have a menu that uses the Left Nav Flyout pattern. On
Tablets and desktops, I show it full width.
When I load the website on my smartphone (specifically an Android device)
using Chrome in Portrait mode, once I rotate the device (passing in
Landscape mode) and start to scroll the page, as soon as I reach the menu
position, the latter magically disappears. What is really strange is that
if you try to click the space that now is completely white, you can see
that the links are actually there. I tried to use the inspector to find
the problem but didn't succeed.
So, wow can I solve the problem? Anyone else had this issue before? If you
know it's a bug, I'm glad to add a temporary workaround as well.
I'm facing a problem I can't figure out how to solve. I'm almost sure this
is a Chrome bug since in other browsers it works like a charm but I want
to be sure. On my website, developed using a mobile first and responsive
design approach, I have a menu that uses the Left Nav Flyout pattern. On
Tablets and desktops, I show it full width.
When I load the website on my smartphone (specifically an Android device)
using Chrome in Portrait mode, once I rotate the device (passing in
Landscape mode) and start to scroll the page, as soon as I reach the menu
position, the latter magically disappears. What is really strange is that
if you try to click the space that now is completely white, you can see
that the links are actually there. I tried to use the inspector to find
the problem but didn't succeed.
So, wow can I solve the problem? Anyone else had this issue before? If you
know it's a bug, I'm glad to add a temporary workaround as well.
Twitter Bootstrap content in Google Chrome is expanded all the way horizontally and not vertically
Twitter Bootstrap content in Google Chrome is expanded all the way
horizontally and not vertically
I have just finished my first responsive site with Twitter Bootstrap and
it uses scrollspy to scroll up and down through the five sections of the
site(Home,etc,etc,etc,etc). The site works just fine in Firefox and IE but
in Chrome and Safari the content of the lower sections is expanded
horizontally and not vertically like it does with Mozilla Firefox and IE.
horizontally and not vertically
I have just finished my first responsive site with Twitter Bootstrap and
it uses scrollspy to scroll up and down through the five sections of the
site(Home,etc,etc,etc,etc). The site works just fine in Firefox and IE but
in Chrome and Safari the content of the lower sections is expanded
horizontally and not vertically like it does with Mozilla Firefox and IE.
Div appear after scroll past a div
Div appear after scroll past a div
I know there are a lot of tutorials to let a div appear after scroll down
a certain amount of pixels.
But what I want is to let a div appear when the user scrolls past another
div. And when they scroll back up it has to disappear again.
Why not after an amount of pixels? I want to use this for my menubar to
appear on the top of my page after the user scrolls past the banner image.
BUT when you scale down the browser (mobile, tablet, small screen...) the
banner image will scale down to! The image will not be the same height as
before. The menubar would appear to late or to earlier;) that's why I want
the menubar to appear after that image (div).
Hope you guys can help!
I know there are a lot of tutorials to let a div appear after scroll down
a certain amount of pixels.
But what I want is to let a div appear when the user scrolls past another
div. And when they scroll back up it has to disappear again.
Why not after an amount of pixels? I want to use this for my menubar to
appear on the top of my page after the user scrolls past the banner image.
BUT when you scale down the browser (mobile, tablet, small screen...) the
banner image will scale down to! The image will not be the same height as
before. The menubar would appear to late or to earlier;) that's why I want
the menubar to appear after that image (div).
Hope you guys can help!
How to compare function objects
How to compare function objects
How do I compare if two function objects hold the same function reference?
struct A {
void b(){}
}
int main() {
A a;
auto f1 = std::bind(&A::b, a);
auto f2 = std::bind(&A::b, a);
f1 == f2 // ???
}
How do I compare if two function objects hold the same function reference?
struct A {
void b(){}
}
int main() {
A a;
auto f1 = std::bind(&A::b, a);
auto f2 = std::bind(&A::b, a);
f1 == f2 // ???
}
PHP - mysql_fetch_assoc() issue
PHP - mysql_fetch_assoc() issue
I'm new to PHP and I'm trying to learn how to display data I select from a
mysql database (phpmyadmin). My current php code consists of 2 files
connect.inc.php and connecting.php:
conncet.inc.php is the file used to establish connection with the database:
<?php
//Varialbles
//MYSQL details
$mysql_server='localhost';
$mysql_user='root';
$mysql_user_pass='12345678';
$mysql_db='test';
//Messages
$db_conn_error='Could not connect to database';
if(mysql_connect($mysql_server, $mysql_user, $mysql_user_pass)
and mysql_select_db($mysql_db)){
echo 'Connection is ok'.'<br>';
}
else
{
echo 'Connection is not ok';
}
?>
while the other file (connecting.php) should display any records in the
particular table called food :
<?php
require 'connect.inc.php';
$query = "SELECT 'food', 'calories' FROM food ORDER BY 'id'";
if ($query_run = mysql_query($query)){
while($query_row = mysql_fetch_assoc($query_run)){
$food = $query_row['food'];
$calories = $query_row['calories'];
echo $food . ' has '.$calories.' calories.<br>';
}
}
else
{
echo 'Query Failed';
}
?>
Additional details:
server name : localhost
user : root
password : 12345678
database name : test
table name : food
field names : id, food, calories, healthy_unhealthy
Ths issue is that whenever i execute code in the file connecting.php i
always get the following:
Connection is ok
food has calories calories.
food has calories calories.
When it should say
Connection is ok
Pizza has 1000 calories
Salad has 200 calories
Help is highly appreciated :)
Thanks in advance,
Joe :)
I'm new to PHP and I'm trying to learn how to display data I select from a
mysql database (phpmyadmin). My current php code consists of 2 files
connect.inc.php and connecting.php:
conncet.inc.php is the file used to establish connection with the database:
<?php
//Varialbles
//MYSQL details
$mysql_server='localhost';
$mysql_user='root';
$mysql_user_pass='12345678';
$mysql_db='test';
//Messages
$db_conn_error='Could not connect to database';
if(mysql_connect($mysql_server, $mysql_user, $mysql_user_pass)
and mysql_select_db($mysql_db)){
echo 'Connection is ok'.'<br>';
}
else
{
echo 'Connection is not ok';
}
?>
while the other file (connecting.php) should display any records in the
particular table called food :
<?php
require 'connect.inc.php';
$query = "SELECT 'food', 'calories' FROM food ORDER BY 'id'";
if ($query_run = mysql_query($query)){
while($query_row = mysql_fetch_assoc($query_run)){
$food = $query_row['food'];
$calories = $query_row['calories'];
echo $food . ' has '.$calories.' calories.<br>';
}
}
else
{
echo 'Query Failed';
}
?>
Additional details:
server name : localhost
user : root
password : 12345678
database name : test
table name : food
field names : id, food, calories, healthy_unhealthy
Ths issue is that whenever i execute code in the file connecting.php i
always get the following:
Connection is ok
food has calories calories.
food has calories calories.
When it should say
Connection is ok
Pizza has 1000 calories
Salad has 200 calories
Help is highly appreciated :)
Thanks in advance,
Joe :)
Identify PID of long running process
Identify PID of long running process
I am not a very good programmer, please help me with this.
I need to identify long running process and save pid of that process to a
file. With the below command I am able to identify age of long running
process. But after this I am struck with how to grep PID of that long
running process? Any help is greatly appreciated.
ps -eo pid,etime,cmd | grep DSD.RUN | awk '{print $2}' | ./script.sh |
xargs -I [] bash -c 'if [ "[]" -gt "86400" ]; then echo []; fi'
Script.sh: (got this from stackoverflow post)
#!/bin/bash
awk -F $':' -f <(cat - <<-'EOF'
{
if (NF == 2) {
print $1*60 + $2
} else if (NF == 3) {
split($1, a, "-");
if (a[2] > 0) {
print ((a[1]*24+a[2])*60 + $2) * 60 + $3;
} else {
print ($1*60 + $2) * 60 + $3;
}
}
}
EOF
) < /dev/stdin
I am not a very good programmer, please help me with this.
I need to identify long running process and save pid of that process to a
file. With the below command I am able to identify age of long running
process. But after this I am struck with how to grep PID of that long
running process? Any help is greatly appreciated.
ps -eo pid,etime,cmd | grep DSD.RUN | awk '{print $2}' | ./script.sh |
xargs -I [] bash -c 'if [ "[]" -gt "86400" ]; then echo []; fi'
Script.sh: (got this from stackoverflow post)
#!/bin/bash
awk -F $':' -f <(cat - <<-'EOF'
{
if (NF == 2) {
print $1*60 + $2
} else if (NF == 3) {
split($1, a, "-");
if (a[2] > 0) {
print ((a[1]*24+a[2])*60 + $2) * 60 + $3;
} else {
print ($1*60 + $2) * 60 + $3;
}
}
}
EOF
) < /dev/stdin
Saturday, 14 September 2013
xcode 5 GM is mercilessly hanging all the time
xcode 5 GM is mercilessly hanging all the time
I don't know what is going on, but I have downloaded xcode 5 gm and it is
worse than dp 6. It hangs when creating a brand new project. It hangs when
I rename a class, and when trying to set up a local git repository. It is
a blank project master/detail template.
Does anyone have any idea what to do? I have already deleted xcode 5 by
dragging the app to the trash.
Is there anything I can do about this? I assume that I will want to remove
all traces of xcode from my computer and retry again? I'm on the latest
mountain lion os.
I don't know what is going on, but I have downloaded xcode 5 gm and it is
worse than dp 6. It hangs when creating a brand new project. It hangs when
I rename a class, and when trying to set up a local git repository. It is
a blank project master/detail template.
Does anyone have any idea what to do? I have already deleted xcode 5 by
dragging the app to the trash.
Is there anything I can do about this? I assume that I will want to remove
all traces of xcode from my computer and retry again? I'm on the latest
mountain lion os.
Objectless A* Implementation
Objectless A* Implementation
My current pathfinder is a .NET 2.0 implementation of Eric Lippert's Path
Finding Using A* in C# 3.0 series. Eric's pathfinder is excellent (if you
haven't read his articles, do read them), but I wouldn't agree with the
assertion that in order to get a faster implementation of A* you'd have to
use C++.
Eric's algorithm creates an enormous amount of temporary objects each time
it is ran, even if the Node type is a struct; every piece of a Path is an
object, and a large percentage of insertions into his PriorityQueue class
results in a new Queue object.
In my application, I have to generate a large number of A* paths in
soft-realtime, but I'm allowed to give-up after the closed-list exceeds a
certain threshold. It should be possible for me to run A* without
allocating any new memory between calls. However, presently nothing is
reused, everything is reallocated again on the next call.
If I were coding an A* implementation in C++, one of my design goals would
be allowing the user to specify a starting capacity of the pathfinder and
reusing any memory allocated for the next time the pathfinder is ran
(whatever results the user wanted to keep, that user would be instructed
to make a copy). This is an extremely efficient approach, and I think it's
something C# can accomplish also.
This seems like it could be really tricky to write though, has it ever
been done before? Are there pitfalls that you'd think I'd run into with
trying to implement it?
The non-trivial problematic areas in Eric's algorithm are:
Path (an implementation of an immutable stack) - Forces the use of objects
(regardless of whether Node is a struct).
PriorityQueue - Most insertions will result in a new Queue object, and
when it doesn't, it could still result in the Queue doing an internal
resize.
My current pathfinder is a .NET 2.0 implementation of Eric Lippert's Path
Finding Using A* in C# 3.0 series. Eric's pathfinder is excellent (if you
haven't read his articles, do read them), but I wouldn't agree with the
assertion that in order to get a faster implementation of A* you'd have to
use C++.
Eric's algorithm creates an enormous amount of temporary objects each time
it is ran, even if the Node type is a struct; every piece of a Path is an
object, and a large percentage of insertions into his PriorityQueue class
results in a new Queue object.
In my application, I have to generate a large number of A* paths in
soft-realtime, but I'm allowed to give-up after the closed-list exceeds a
certain threshold. It should be possible for me to run A* without
allocating any new memory between calls. However, presently nothing is
reused, everything is reallocated again on the next call.
If I were coding an A* implementation in C++, one of my design goals would
be allowing the user to specify a starting capacity of the pathfinder and
reusing any memory allocated for the next time the pathfinder is ran
(whatever results the user wanted to keep, that user would be instructed
to make a copy). This is an extremely efficient approach, and I think it's
something C# can accomplish also.
This seems like it could be really tricky to write though, has it ever
been done before? Are there pitfalls that you'd think I'd run into with
trying to implement it?
The non-trivial problematic areas in Eric's algorithm are:
Path (an implementation of an immutable stack) - Forces the use of objects
(regardless of whether Node is a struct).
PriorityQueue - Most insertions will result in a new Queue object, and
when it doesn't, it could still result in the Queue doing an internal
resize.
How to detect outliers in an ArrayList
How to detect outliers in an ArrayList
I'm trying to think of some code that will allow me to search through my
ArrayList and detect any values outside the common range of "good values."
Example: 100 105 102 13 104 22 101
How would I be able to write the code to detect that (in this case) 13 and
22 don't fall within the "good values" of around 100?
I'm trying to think of some code that will allow me to search through my
ArrayList and detect any values outside the common range of "good values."
Example: 100 105 102 13 104 22 101
How would I be able to write the code to detect that (in this case) 13 and
22 don't fall within the "good values" of around 100?
Converting a number to base x
Converting a number to base x
I'm trying to change a number i to a base k (1 < k < 17) It seems like my
numbers always get printed out backward example: i = 10, k = 2 returns
0101 Should be 1010
Code
long i = Long.parseLong(args[0]);
int k = Integer.parseInt(args[1]);
long v = 1;
while (v <= i/k) {
v *= k;
}
long n = i;
while (v > 0) {
//...
long res = (n % k);
n = n/k;
if(res == 11){
System.out.print("A");}
else if(res == 12){
System.out.print("B");}
else if(res == 13){
System.out.print("C");}
else if(res == 14){
System.out.print("D");}
else if(res == 15){
System.out.print("E");}
else if(res == 16){
System.out.print("F");}
else{
System.out.print(res);
}
v = v/k;
}
System.out.println();
I'm trying to change a number i to a base k (1 < k < 17) It seems like my
numbers always get printed out backward example: i = 10, k = 2 returns
0101 Should be 1010
Code
long i = Long.parseLong(args[0]);
int k = Integer.parseInt(args[1]);
long v = 1;
while (v <= i/k) {
v *= k;
}
long n = i;
while (v > 0) {
//...
long res = (n % k);
n = n/k;
if(res == 11){
System.out.print("A");}
else if(res == 12){
System.out.print("B");}
else if(res == 13){
System.out.print("C");}
else if(res == 14){
System.out.print("D");}
else if(res == 15){
System.out.print("E");}
else if(res == 16){
System.out.print("F");}
else{
System.out.print(res);
}
v = v/k;
}
System.out.println();
heatmap in a single select or stored procedure
heatmap in a single select or stored procedure
I have a table of server requests - each with a timestamp. What I would
like to accomplish is that the result of my query (or preferably a stored
procedure) gives me, for a single day, a table with each hour of the day
across the top (from 0 to 23) and each minute of the hour down the side
(from 0 to 59). The intersecting data would display the count of requests
per minute, per hour.
What I have tried so far is group the minutes by hour of the day, and
manipulate that in excel to produce the 24x60 matrix using:
SELECT DatePart(HH,Timestamp) as [Hour]
, DatePart(MI,Timestamp) as [Minute]
, Count(*) as [Count]
FROM Requests
WHERE DatePart(Day,Timestamp) = 12
GROUP BY DatePart(HH,Timestamp),
DatePart(MI,Timestamp)
ORDER BY DatePart(HH,Timestamp)
, DatePart(MI,Timestamp)
Any help would be greatly appreciated, thanks in advance for your time :)
I have a table of server requests - each with a timestamp. What I would
like to accomplish is that the result of my query (or preferably a stored
procedure) gives me, for a single day, a table with each hour of the day
across the top (from 0 to 23) and each minute of the hour down the side
(from 0 to 59). The intersecting data would display the count of requests
per minute, per hour.
What I have tried so far is group the minutes by hour of the day, and
manipulate that in excel to produce the 24x60 matrix using:
SELECT DatePart(HH,Timestamp) as [Hour]
, DatePart(MI,Timestamp) as [Minute]
, Count(*) as [Count]
FROM Requests
WHERE DatePart(Day,Timestamp) = 12
GROUP BY DatePart(HH,Timestamp),
DatePart(MI,Timestamp)
ORDER BY DatePart(HH,Timestamp)
, DatePart(MI,Timestamp)
Any help would be greatly appreciated, thanks in advance for your time :)
check img size and form before upload
check img size and form before upload
i have the following problem, i m trying to check the file size and the
format of some pics, using FOR EACH here's the code
....
$check = 0;
$errors= array();
foreach($_FILES['files']['tmp_name'] as $key => $tmp_name )
{
$file_name = $key.$_FILES['files']['name'][$key];
$file_size =$_FILES['files']['size'][$key];
$file_tmp =$_FILES['files']['tmp_name'][$key];
$file_type=$_FILES['files']['type'][$key];
$allowedExts = array("JPEG", "jpeg", "jpg", "JPG");
$temp = explode(".", $_FILES["files"]["name"][$key]);
$extension = end($temp);
$file_ext=strtolower(end($temp));
if ($file_size > 2097152)
{
$errors = 'Bigger than limit';
$check = 1;
}
else if (in_array($file_ext,$allowedExts) === false)
{
$errors = 'Wrong format';
$check = 2;
}
}
}
if ($check = 1)
{
print '<script type="text/javascript">';
print 'alert("ÊÜðïéï áðü ôá áñ÷åßá óáò îåðåñíÜåé ôï üñéï ôùí 3mb.
Ðáñáêáëþ åëÝãîôå ôá áñ÷åßá óáò!!!")';
print '</script>';
}
else if ($check = 2)
{
print '<script type="text/javascript">';
print 'alert("Ðáñáêáëþ åéóÜãåôå ìüíï áñ÷åßá óå .jpeg êáé .jpg
format!!!")';
print '</script>';
}
else if ($check = 0)
{
foreach($_FILES['files']['tmp_name'] as $key => $tmp_name )
{
$file_name = $key.$_FILES['files']['name'][$key];
$file_size =$_FILES['files']['size'][$key];
$file_tmp =$_FILES['files']['tmp_name'][$key];
$file_type=$_FILES['files']['type'][$key];
$allowedExts = array("JPEG", "jpeg", "jpg", "JPG");
$temp = explode(".", $_FILES["files"]["name"][$key]);
$extension = end($temp);
$file_ext=strtolower(end($temp));
if (($file_size <= 2097152) && (in_array($file_ext,$allowedExts)
=== true))
{
$desired_dir=$Kwdikos_Sunergath.'_'.$Hmeromhnia_Musthriou.'_'.$date_added;
if(empty($errors)==true)
{
if(is_dir($desired_dir)==false){
mkdir("$desired_dir", 0700); // Create directory if
it does not exist
}
if(is_dir("$desired_dir/".$file_name)==false)
{
move_uploaded_file($file_tmp,"$desired_dir/".$file_name);
}
else
{ //rename the file if
another one exist
$new_dir="$desired_dir/".$file_name.time();
rename($file_tmp,$new_dir) ;
}
mysql_query("INSERT INTO mpla mpla mpla)");
}
}
}
so when i m trying to uplod a file less than 2mb it makes the $check = 1
and i dont know why.... if i skip the check code it works...
i have the following problem, i m trying to check the file size and the
format of some pics, using FOR EACH here's the code
....
$check = 0;
$errors= array();
foreach($_FILES['files']['tmp_name'] as $key => $tmp_name )
{
$file_name = $key.$_FILES['files']['name'][$key];
$file_size =$_FILES['files']['size'][$key];
$file_tmp =$_FILES['files']['tmp_name'][$key];
$file_type=$_FILES['files']['type'][$key];
$allowedExts = array("JPEG", "jpeg", "jpg", "JPG");
$temp = explode(".", $_FILES["files"]["name"][$key]);
$extension = end($temp);
$file_ext=strtolower(end($temp));
if ($file_size > 2097152)
{
$errors = 'Bigger than limit';
$check = 1;
}
else if (in_array($file_ext,$allowedExts) === false)
{
$errors = 'Wrong format';
$check = 2;
}
}
}
if ($check = 1)
{
print '<script type="text/javascript">';
print 'alert("ÊÜðïéï áðü ôá áñ÷åßá óáò îåðåñíÜåé ôï üñéï ôùí 3mb.
Ðáñáêáëþ åëÝãîôå ôá áñ÷åßá óáò!!!")';
print '</script>';
}
else if ($check = 2)
{
print '<script type="text/javascript">';
print 'alert("Ðáñáêáëþ åéóÜãåôå ìüíï áñ÷åßá óå .jpeg êáé .jpg
format!!!")';
print '</script>';
}
else if ($check = 0)
{
foreach($_FILES['files']['tmp_name'] as $key => $tmp_name )
{
$file_name = $key.$_FILES['files']['name'][$key];
$file_size =$_FILES['files']['size'][$key];
$file_tmp =$_FILES['files']['tmp_name'][$key];
$file_type=$_FILES['files']['type'][$key];
$allowedExts = array("JPEG", "jpeg", "jpg", "JPG");
$temp = explode(".", $_FILES["files"]["name"][$key]);
$extension = end($temp);
$file_ext=strtolower(end($temp));
if (($file_size <= 2097152) && (in_array($file_ext,$allowedExts)
=== true))
{
$desired_dir=$Kwdikos_Sunergath.'_'.$Hmeromhnia_Musthriou.'_'.$date_added;
if(empty($errors)==true)
{
if(is_dir($desired_dir)==false){
mkdir("$desired_dir", 0700); // Create directory if
it does not exist
}
if(is_dir("$desired_dir/".$file_name)==false)
{
move_uploaded_file($file_tmp,"$desired_dir/".$file_name);
}
else
{ //rename the file if
another one exist
$new_dir="$desired_dir/".$file_name.time();
rename($file_tmp,$new_dir) ;
}
mysql_query("INSERT INTO mpla mpla mpla)");
}
}
}
so when i m trying to uplod a file less than 2mb it makes the $check = 1
and i dont know why.... if i skip the check code it works...
Friday, 13 September 2013
Button animations on one thread and working in another thread
Button animations on one thread and working in another thread
I think my problem is very basic but i am new to android so just need this
solution. I have 20 buttons and all of them are animating(translation and
scaling) on the screen. I want to create a new thread and do animations
there. Those buttons have images on them,code is working fine in UI thread
but sometimes i am getting ANR message and exception that application may
be doing too much work on its main thread. Please help Thank you
I think my problem is very basic but i am new to android so just need this
solution. I have 20 buttons and all of them are animating(translation and
scaling) on the screen. I want to create a new thread and do animations
there. Those buttons have images on them,code is working fine in UI thread
but sometimes i am getting ANR message and exception that application may
be doing too much work on its main thread. Please help Thank you
R read.table loops row column entries to next row
R read.table loops row column entries to next row
This is the first time I encountered this problem using read.table: For
row entries with very large number of columns, read.table loops the column
entries into the next rows.
I have a .txt file with rows of variable and unequal length. For reference
this is the .txt file I am reading:
http://www.broadinstitute.org/gsea/msigdb/download_file.jsp?filePath=/resources/msigdb/4.0/c5.bp.v4.0.symbols.gmt
Here is my code:
tabsep <- gsub("\\\\t", "\t", "\\t")
MSigDB.collection = read.table(fileName, header = FALSE, fill = TRUE,
as.is = TRUE, sep = tabsep)
Partial output: first columns
V1
V2
V3 V4 V5 V6
1 TRNA_PROCESSING
http://www.broadinstitute.org/gsea/msigdb/cards/TRNA_PROCESSING ADAT1
TRNT1 FARS2
2 REGULATION_OF_BIOLOGICAL_QUALITY
http://www.broadinstitute.org/gsea/msigdb/cards/REGULATION_OF_BIOLOGICAL_QUALITY
DLC1 ALS2 SLC9A7
3 DNA_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/DNA_METABOLIC_PROCESS
XRCC5 XRCC4 RAD51C
4 AMINO_SUGAR_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/AMINO_SUGAR_METABOLIC_PROCESS
UAP1 CHIA GNPDA1
5 BIOPOLYMER_CATABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/BIOPOLYMER_CATABOLIC_PROCESS
BTRC HNRNPD USE1
6 RNA_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/RNA_METABOLIC_PROCESS
HNRNPF HNRNPD SYNCRIP
7 INTS6
LSM5 LSM4 LSM3 LSM1
8 CRK
9 GLUCAN_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/GLUCAN_METABOLIC_PROCESS
GCK PYGM GSK3B
10 PROTEIN_POLYUBIQUITINATION
http://www.broadinstitute.org/gsea/msigdb/cards/PROTEIN_POLYUBIQUITINATION
ERCC8 HUWE1 DZIP3
...
Partial output: last columns
V403 V404 V405 V406 V407 V408 V409 V410 V411 V412
V413 V414 V415 V416 V417 V418 V419 V420 V421
1
2 CALCA CALCB FAM107A CDK11A RASGRP4 CDK11B SYN3 GP1BA TNN ENO1
PTPRC MTL5 ISOC2 RHAG VWF GPI HPX SLC5A7 F2R
3
4
5
6 IRF2 IRF3 SLC2A4RG LSM6 XRCC6 INTS1 HOXD13 RP9 INTS2 ZNF638
INTS3 ZNF254 CITED1 CITED2 INTS9 INTS8 INTS5 INTS4 INTS7
7 POU1F1 TCF7L2 TNFRSF1A NPAS2 HAND1 HAND2 NUDT21 APEX1 ENO1 ERF
DTX1 SOX30 CBY1 DIS3 SP1 SP2 SP3 SP4 NFIC
8
9
10
For instance, column entries for row 6 gets looped to fill row 7 and row
8. I seem to only this problem for row entries with very large number of
columns. This occurs for other .txt files as well but it breaks at
different column numbers. I inspected all the row entries at where the
break happens and there are no unusual characters in the entries (they are
all standard upper case gene symbols).
I have tried both read.table and read.delim with the same result. If I
convert the .txt file to .csv first and use the same code, I do not have
this problem (see below for the equivalent output). But I don't want to
convert each file first .csv and really I just want to understand what is
going on.
Correct output if I convert to .csv file:
MSigDB.collection = read.table(fileName, header = FALSE, fill = TRUE,
as.is = TRUE, sep = ",")
V1
V2
V3 V4 V5 V6
1 TRNA_PROCESSING
http://www.broadinstitute.org/gsea/msigdb/cards/TRNA_PROCESSING ADAT1
TRNT1 FARS2 METTL1
2 REGULATION_OF_BIOLOGICAL_QUALITY
http://www.broadinstitute.org/gsea/msigdb/cards/REGULATION_OF_BIOLOGICAL_QUALITY
DLC1 ALS2 SLC9A7 PTGS2
3 DNA_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/DNA_METABOLIC_PROCESS
XRCC5 XRCC4 RAD51C XRCC3
4 AMINO_SUGAR_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/AMINO_SUGAR_METABOLIC_PROCESS
UAP1 CHIA GNPDA1 GNE
5 BIOPOLYMER_CATABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/BIOPOLYMER_CATABOLIC_PROCESS
BTRC HNRNPD USE1 RNASEH1
6 RNA_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/RNA_METABOLIC_PROCESS
HNRNPF HNRNPD SYNCRIP MED24
7 GLUCAN_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/GLUCAN_METABOLIC_PROCESS
GCK PYGM GSK3B EPM2A
8 PROTEIN_POLYUBIQUITINATION
http://www.broadinstitute.org/gsea/msigdb/cards/PROTEIN_POLYUBIQUITINATION
ERCC8 HUWE1 DZIP3 DDB2
9 PROTEIN_OLIGOMERIZATION
http://www.broadinstitute.org/gsea/msigdb/cards/PROTEIN_OLIGOMERIZATION
SYT1 AASS TP63 HPRT1
This is the first time I encountered this problem using read.table: For
row entries with very large number of columns, read.table loops the column
entries into the next rows.
I have a .txt file with rows of variable and unequal length. For reference
this is the .txt file I am reading:
http://www.broadinstitute.org/gsea/msigdb/download_file.jsp?filePath=/resources/msigdb/4.0/c5.bp.v4.0.symbols.gmt
Here is my code:
tabsep <- gsub("\\\\t", "\t", "\\t")
MSigDB.collection = read.table(fileName, header = FALSE, fill = TRUE,
as.is = TRUE, sep = tabsep)
Partial output: first columns
V1
V2
V3 V4 V5 V6
1 TRNA_PROCESSING
http://www.broadinstitute.org/gsea/msigdb/cards/TRNA_PROCESSING ADAT1
TRNT1 FARS2
2 REGULATION_OF_BIOLOGICAL_QUALITY
http://www.broadinstitute.org/gsea/msigdb/cards/REGULATION_OF_BIOLOGICAL_QUALITY
DLC1 ALS2 SLC9A7
3 DNA_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/DNA_METABOLIC_PROCESS
XRCC5 XRCC4 RAD51C
4 AMINO_SUGAR_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/AMINO_SUGAR_METABOLIC_PROCESS
UAP1 CHIA GNPDA1
5 BIOPOLYMER_CATABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/BIOPOLYMER_CATABOLIC_PROCESS
BTRC HNRNPD USE1
6 RNA_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/RNA_METABOLIC_PROCESS
HNRNPF HNRNPD SYNCRIP
7 INTS6
LSM5 LSM4 LSM3 LSM1
8 CRK
9 GLUCAN_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/GLUCAN_METABOLIC_PROCESS
GCK PYGM GSK3B
10 PROTEIN_POLYUBIQUITINATION
http://www.broadinstitute.org/gsea/msigdb/cards/PROTEIN_POLYUBIQUITINATION
ERCC8 HUWE1 DZIP3
...
Partial output: last columns
V403 V404 V405 V406 V407 V408 V409 V410 V411 V412
V413 V414 V415 V416 V417 V418 V419 V420 V421
1
2 CALCA CALCB FAM107A CDK11A RASGRP4 CDK11B SYN3 GP1BA TNN ENO1
PTPRC MTL5 ISOC2 RHAG VWF GPI HPX SLC5A7 F2R
3
4
5
6 IRF2 IRF3 SLC2A4RG LSM6 XRCC6 INTS1 HOXD13 RP9 INTS2 ZNF638
INTS3 ZNF254 CITED1 CITED2 INTS9 INTS8 INTS5 INTS4 INTS7
7 POU1F1 TCF7L2 TNFRSF1A NPAS2 HAND1 HAND2 NUDT21 APEX1 ENO1 ERF
DTX1 SOX30 CBY1 DIS3 SP1 SP2 SP3 SP4 NFIC
8
9
10
For instance, column entries for row 6 gets looped to fill row 7 and row
8. I seem to only this problem for row entries with very large number of
columns. This occurs for other .txt files as well but it breaks at
different column numbers. I inspected all the row entries at where the
break happens and there are no unusual characters in the entries (they are
all standard upper case gene symbols).
I have tried both read.table and read.delim with the same result. If I
convert the .txt file to .csv first and use the same code, I do not have
this problem (see below for the equivalent output). But I don't want to
convert each file first .csv and really I just want to understand what is
going on.
Correct output if I convert to .csv file:
MSigDB.collection = read.table(fileName, header = FALSE, fill = TRUE,
as.is = TRUE, sep = ",")
V1
V2
V3 V4 V5 V6
1 TRNA_PROCESSING
http://www.broadinstitute.org/gsea/msigdb/cards/TRNA_PROCESSING ADAT1
TRNT1 FARS2 METTL1
2 REGULATION_OF_BIOLOGICAL_QUALITY
http://www.broadinstitute.org/gsea/msigdb/cards/REGULATION_OF_BIOLOGICAL_QUALITY
DLC1 ALS2 SLC9A7 PTGS2
3 DNA_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/DNA_METABOLIC_PROCESS
XRCC5 XRCC4 RAD51C XRCC3
4 AMINO_SUGAR_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/AMINO_SUGAR_METABOLIC_PROCESS
UAP1 CHIA GNPDA1 GNE
5 BIOPOLYMER_CATABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/BIOPOLYMER_CATABOLIC_PROCESS
BTRC HNRNPD USE1 RNASEH1
6 RNA_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/RNA_METABOLIC_PROCESS
HNRNPF HNRNPD SYNCRIP MED24
7 GLUCAN_METABOLIC_PROCESS
http://www.broadinstitute.org/gsea/msigdb/cards/GLUCAN_METABOLIC_PROCESS
GCK PYGM GSK3B EPM2A
8 PROTEIN_POLYUBIQUITINATION
http://www.broadinstitute.org/gsea/msigdb/cards/PROTEIN_POLYUBIQUITINATION
ERCC8 HUWE1 DZIP3 DDB2
9 PROTEIN_OLIGOMERIZATION
http://www.broadinstitute.org/gsea/msigdb/cards/PROTEIN_OLIGOMERIZATION
SYT1 AASS TP63 HPRT1
why does textscan import twice rows of data?
why does textscan import twice rows of data?
When I use textscan to import my csv data, it doubles the rows. I have
only 2000 rows of data, but 4000 rows of data are imported. fid = fopen
('RawDataRep.csv','rt'); data = textscan(fid,
'%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s','Delimiter',',','HeaderLines',1);
fclose(fid);
When I use textscan to import my csv data, it doubles the rows. I have
only 2000 rows of data, but 4000 rows of data are imported. fid = fopen
('RawDataRep.csv','rt'); data = textscan(fid,
'%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s','Delimiter',',','HeaderLines',1);
fclose(fid);
How to use jquery custom validation plug-in for mvc
How to use jquery custom validation plug-in for mvc
MVC validation is ok but lots of free & fancy jquery validation plug-in
are available. so how could i incorporate custom jquery validation plug-in
for MVC model validation instead of using default unobtrusive library. can
any one guide me with sample code or give me any link which discuss
everything step-by-step like which classes need to extend to have this
kind of facility. here i attach a picture of jquery fancy validation
plug-in. thanks
MVC validation is ok but lots of free & fancy jquery validation plug-in
are available. so how could i incorporate custom jquery validation plug-in
for MVC model validation instead of using default unobtrusive library. can
any one guide me with sample code or give me any link which discuss
everything step-by-step like which classes need to extend to have this
kind of facility. here i attach a picture of jquery fancy validation
plug-in. thanks
why the c++ constructor was not called when it appear as the static member variable?
why the c++ constructor was not called when it appear as the static member
variable?
I had a strange problem ,
declare a static member variable whose name is B class in A class . And
initialize in the cpp file. but the constructor of B class was never
called. I try to use some small test , the test constructor could be
called normally. so it is very strange for our production system.
The code like this , in hpp:
class Test
{
public:
Test()
{
ofstream file("/tmp/wup.txt",ios::app);
file << "wup in test" << endl;
file.close();
}
};
//## An extended personality
class TsdNAExtPersonality : public TsdNAPersonality{
public:
TsdNAExtPersonality(
s_gg62_personRec * gg62Header,
TsdNAFunctionType requiredFunctionType);
private:
static Test test;
public:
TsdNAExtPersonality( string * personalityFile, TsdNAFunctionType
requiredFunctionType);
};
And in another cpp file I initialize with
Test TsdNAExtPersonality::test;
I have tried in several way, but i found all of ways are unusefull.
did not set the variable as member variable but as global variable ==>
also can't output
change the member variable as pointer and change the initialize way as
using new ==> no
the environment is HP-UX ,and the compile is aCC
so my question are :
is there any compile option will influence the variable ? in other words,
all the static variable will not be initialized.
from the standard of C++ it should be called when the library was load,
right?
I put another static int value using the same way, it could be
initialized. but the class constructor is not called , very strange.
is there any mistake in my code ?
variable?
I had a strange problem ,
declare a static member variable whose name is B class in A class . And
initialize in the cpp file. but the constructor of B class was never
called. I try to use some small test , the test constructor could be
called normally. so it is very strange for our production system.
The code like this , in hpp:
class Test
{
public:
Test()
{
ofstream file("/tmp/wup.txt",ios::app);
file << "wup in test" << endl;
file.close();
}
};
//## An extended personality
class TsdNAExtPersonality : public TsdNAPersonality{
public:
TsdNAExtPersonality(
s_gg62_personRec * gg62Header,
TsdNAFunctionType requiredFunctionType);
private:
static Test test;
public:
TsdNAExtPersonality( string * personalityFile, TsdNAFunctionType
requiredFunctionType);
};
And in another cpp file I initialize with
Test TsdNAExtPersonality::test;
I have tried in several way, but i found all of ways are unusefull.
did not set the variable as member variable but as global variable ==>
also can't output
change the member variable as pointer and change the initialize way as
using new ==> no
the environment is HP-UX ,and the compile is aCC
so my question are :
is there any compile option will influence the variable ? in other words,
all the static variable will not be initialized.
from the standard of C++ it should be called when the library was load,
right?
I put another static int value using the same way, it could be
initialized. but the class constructor is not called , very strange.
is there any mistake in my code ?
Without using for loop how to check whether an element of an array starts with particular string in postgresql
Without using for loop how to check whether an element of an array starts
with particular string in postgresql
In my postgresql query im using a for loop to check whether an element of
an array starts with particular string. If it starts with that particular
string then my query will display the index of that element.
Eg :
FOR i in 1..array_length(array[childrens],2) LOOP -- childrens is the array
IF position('SP' in childrens[i]) != 0 THEN
......
In this loop im checking element by element which is time consuming. So
please can anyone suggest me some idea to do this task and reduce the time
taken.
with particular string in postgresql
In my postgresql query im using a for loop to check whether an element of
an array starts with particular string. If it starts with that particular
string then my query will display the index of that element.
Eg :
FOR i in 1..array_length(array[childrens],2) LOOP -- childrens is the array
IF position('SP' in childrens[i]) != 0 THEN
......
In this loop im checking element by element which is time consuming. So
please can anyone suggest me some idea to do this task and reduce the time
taken.
Thursday, 12 September 2013
how to calculate an every process separately and display them at together at running time?
how to calculate an every process separately and display them at together
at running time?
b.putFloat("My Odometer", (float)
(gpsdataElements.Distance-Contsants.jobStartKm));
if(gpsdataElements.Speed<1)
{
Contsants.cont_WaitingTimeInSec++;
}
float totalKm = Contsants.jobEndKm-Contsants.jobStartKm ;
if (totalKm<Contsants.minDist)
{
float totalfare=Contsants.minFare;
b.putString("Fare", String.format("%.2f",(totalfare)));
}
else
{
float totalfare= Contsants.minFare+
((totalKm-Contsants.minDist) *Contsants.rupeeKm)
+(Contsants.cont_WaitingTimeInSec/60)*1;
b.putString("Fare", String.format("%.2f",(totalfare)));
}
here is my code for calculating total fare. problem in else part
condition. During running time it will not display the calculation
properly. It was hangs up and shows force close error. any other way to
calculate this (Contsants.minFare+ ((totalKm-Contsants.minDist)
*Contsants.rupeeKm) +(Contsants.cont_WaitingTimeInSec/60)*1) three
parameters separately and display them together at running time. Because i
am going to use this code for taxi booking application. i want to display
the current fare in the display at running time.
at running time?
b.putFloat("My Odometer", (float)
(gpsdataElements.Distance-Contsants.jobStartKm));
if(gpsdataElements.Speed<1)
{
Contsants.cont_WaitingTimeInSec++;
}
float totalKm = Contsants.jobEndKm-Contsants.jobStartKm ;
if (totalKm<Contsants.minDist)
{
float totalfare=Contsants.minFare;
b.putString("Fare", String.format("%.2f",(totalfare)));
}
else
{
float totalfare= Contsants.minFare+
((totalKm-Contsants.minDist) *Contsants.rupeeKm)
+(Contsants.cont_WaitingTimeInSec/60)*1;
b.putString("Fare", String.format("%.2f",(totalfare)));
}
here is my code for calculating total fare. problem in else part
condition. During running time it will not display the calculation
properly. It was hangs up and shows force close error. any other way to
calculate this (Contsants.minFare+ ((totalKm-Contsants.minDist)
*Contsants.rupeeKm) +(Contsants.cont_WaitingTimeInSec/60)*1) three
parameters separately and display them together at running time. Because i
am going to use this code for taxi booking application. i want to display
the current fare in the display at running time.
function calling within a class C++
function calling within a class C++
Within the same class I have
Executive::Executive(std::istream& fin){
std::ifstream dFin(argv[2]);
if(!dFin.is_open()){
std::cout <<"Could not open directives file.";
std::cout <<endl;
}
else{
std::string directive;
dFin >>directive;
int x;
dFin >>x;
if(directive=="print"){
}
and the function
void Executive::print(int i) const{
if(i>MAX_NUM_POLYNOMIALS){
std::cout <<"Sorry, " <<i <<" is not within the known polynomials.";
std::cout <<endl;
}
else{
pNom[i].print(std::cout);
std::cout << i <<'\n';
}
}
In the last bit of the first code, how do I call the print function from
the second code? They're in the same class, and I don't want to confuse
calling it with the print function being called from another class in the
second part.
Within the same class I have
Executive::Executive(std::istream& fin){
std::ifstream dFin(argv[2]);
if(!dFin.is_open()){
std::cout <<"Could not open directives file.";
std::cout <<endl;
}
else{
std::string directive;
dFin >>directive;
int x;
dFin >>x;
if(directive=="print"){
}
and the function
void Executive::print(int i) const{
if(i>MAX_NUM_POLYNOMIALS){
std::cout <<"Sorry, " <<i <<" is not within the known polynomials.";
std::cout <<endl;
}
else{
pNom[i].print(std::cout);
std::cout << i <<'\n';
}
}
In the last bit of the first code, how do I call the print function from
the second code? They're in the same class, and I don't want to confuse
calling it with the print function being called from another class in the
second part.
Wednesday, 11 September 2013
My javascript code fail in other version of browsers except Internet Explorer 10
My javascript code fail in other version of browsers except Internet
Explorer 10
I need some help where my javascript code fail in Chrome, Firefox, IE6-9
except IE10. Can someone spot any error on this piece of code? What is the
correct syntax to use in this code? See my code below :
<script type="text/javascript">
//Working in IE 10 but fail in other version including Firefox & Chrome
$(function Enabler(object) {
var lstWorksheet = document.getElementById('<%=
ddlWorkSheetList.ClientID %>');
var bPreview = document.getElementById('<%= ButtonPreviewFile.ClientID
%>');
var bImport = document.getElementById('<%= ButtonImportData.ClientID
%>');
if (lstWorksheet.selectedIndex != 0) {
bPreview.disabled = false;
bImport.disabled = false;
}
else {
bPreview.disabled = true;
bImport.disabled = true;
}
});
//Working in IE 10 but fail in other version including Firefox & Chrome
$(function GetFile(object) {
var bBrowseFile = document.getElementById('<%=
FileUploadExcel.ClientID %>');
var bGetWorksheet = document.getElementById('<%=
ButtonGetSheetName.ClientID %>');
var bResult = document.getElementById('<%= LabelUpload.ClientID %>');
$(bBrowseFile).change(function () {
if ($(this).val()) {
$(bGetWorksheet).attr('disabled', false);
bResult.style.color = "Green";
bResult.innerHTML = "<BR><B>Selected file is : </B>" +
bBrowseFile.value;
}
else {
$(bGetWorksheet).attr('disabled', true);
}
});
});
I attach this link to a full source code of my program here
Explorer 10
I need some help where my javascript code fail in Chrome, Firefox, IE6-9
except IE10. Can someone spot any error on this piece of code? What is the
correct syntax to use in this code? See my code below :
<script type="text/javascript">
//Working in IE 10 but fail in other version including Firefox & Chrome
$(function Enabler(object) {
var lstWorksheet = document.getElementById('<%=
ddlWorkSheetList.ClientID %>');
var bPreview = document.getElementById('<%= ButtonPreviewFile.ClientID
%>');
var bImport = document.getElementById('<%= ButtonImportData.ClientID
%>');
if (lstWorksheet.selectedIndex != 0) {
bPreview.disabled = false;
bImport.disabled = false;
}
else {
bPreview.disabled = true;
bImport.disabled = true;
}
});
//Working in IE 10 but fail in other version including Firefox & Chrome
$(function GetFile(object) {
var bBrowseFile = document.getElementById('<%=
FileUploadExcel.ClientID %>');
var bGetWorksheet = document.getElementById('<%=
ButtonGetSheetName.ClientID %>');
var bResult = document.getElementById('<%= LabelUpload.ClientID %>');
$(bBrowseFile).change(function () {
if ($(this).val()) {
$(bGetWorksheet).attr('disabled', false);
bResult.style.color = "Green";
bResult.innerHTML = "<BR><B>Selected file is : </B>" +
bBrowseFile.value;
}
else {
$(bGetWorksheet).attr('disabled', true);
}
});
});
I attach this link to a full source code of my program here
Subscribe to:
Comments (Atom)