FPGA ROM access contention
I've written a verilog code to implement AES on Virtex II Pro series FPGA.
Everything is fine before I do timing simulation. I mean I can get the
right encrypted data in function simulation. But in the timing simulation
or download it to FPGA board. The result is not correct any more. And I
try to debug it.
With timing simulation waveform, I found the bug involved with how I
implement SubByte function in AES. I used look up table (ROMs) to
implement it. But the inputs of these 16 ROMs become same. I write the
code for 16 ROMs as follows.
aes_sbox SBOX15 (di[127:120],sb[127:120]);
aes_sbox SBOX14 (di[119:112],sb[119:112]);
aes_sbox SBOX13 (di[111:104],sb[111:104]);
aes_sbox SBOX12 (di[103:96],sb[103:96]);
aes_sbox SBOX11 (di[95:88],sb[95:88]);
aes_sbox SBOX10 (di[87:80],sb[87:80]);
aes_sbox SBOX9 (di[79:72],sb[79:72]);
aes_sbox SBOX8 (di[71:64],sb[71:64]);
aes_sbox SBOX7 (di[63:56],sb[63:56]);
aes_sbox SBOX6 (di[55:48],sb[55:48]);
aes_sbox SBOX5 (di[47:40],sb[47:40]);
aes_sbox SBOX4 (di[39:32],sb[39:32]);
aes_sbox SBOX3 (di[31:24],sb[31:24]);
aes_sbox SBOX2 (di[23:16],sb[23:16]);
aes_sbox SBOX1 (di[15:8],sb[15:8]);
aes_sbox SBOX0 (di[7:0],sb[7:0]);
I used different bits to be inputs to different ROM. But in the timing
simulation, all of 16 byte inputs become the value of the least
significant byte. It just like I connected every ROM input with di[7:0].
So the output of these 16 ROMs are same. You can see the waveform below.
Pay attention to the signal 'sb'. It is 128 bit (16bytes), but every byte
is same with each other.
For example, sb is 128'h8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c. But the correct
one should be 128'h63cab7040953d051cd60e0e7ba70e18c. Please pay attention
to the last byte of correct value and wrong value. They are same. It just
like I copied 16 times.
And if I don't use ROMs to implement SubBytes function. It can get a
correct result from timing simulation and board. So I am sure the only
problem is those ROMs.
Also, it is not a problem of clock period. Cause the critical path delay
of this circuit is 13ns. And my clock period is 40ns. I tried to change
the clock period to 400ns. The bug is still there.
It seems that it is ROM access contention issue. But I don't know how to
fix it.
Saturday, 31 August 2013
How to inject jQuery or JavaScript to an iFrame?
How to inject jQuery or JavaScript to an iFrame?
I am trying to build a HTML,CSS, jQuery/JavaScript editor... How can I
inject JavaScript or jQuery into an iFrame? I tried searching all related
answers here, but none of the solutions is helping...
here's what I am talking about...#css, #js are textareas, while #iframe_id
is an iframe used to preview the changes.
css_code = $('#css').val();
js_code = $('#js').val();
css_content = "<style>" + css_code + "</style>"; // working
js_content = "<script>" + js_code + "</script>"; // does not work
$('#iframe_id').contents().find('head').append(css_content); // working
$('#iframe_id').contents().find('body').append(js_content); // does not work
The following works but only if I use core JavaScript, not sure
why...frame[0] basically is the same iframe (#iframe_id)...
var js_content = jsEditor.getValue();
frames[0].window.eval(js_content); // works only when JavaScript is
entered (not jQuery)
It may be something to do with the 'script' tags, maybe jQuery has a
problem with it...not sure why.
I am trying to build a HTML,CSS, jQuery/JavaScript editor... How can I
inject JavaScript or jQuery into an iFrame? I tried searching all related
answers here, but none of the solutions is helping...
here's what I am talking about...#css, #js are textareas, while #iframe_id
is an iframe used to preview the changes.
css_code = $('#css').val();
js_code = $('#js').val();
css_content = "<style>" + css_code + "</style>"; // working
js_content = "<script>" + js_code + "</script>"; // does not work
$('#iframe_id').contents().find('head').append(css_content); // working
$('#iframe_id').contents().find('body').append(js_content); // does not work
The following works but only if I use core JavaScript, not sure
why...frame[0] basically is the same iframe (#iframe_id)...
var js_content = jsEditor.getValue();
frames[0].window.eval(js_content); // works only when JavaScript is
entered (not jQuery)
It may be something to do with the 'script' tags, maybe jQuery has a
problem with it...not sure why.
Replacing null with zero
Replacing null with zero
Hi I have following select command in SQL Server. I am trying to change it
so if b.bId is null i want to assign it 0 value. So it displays 0 in the
field.
select top 1
a.sId
,b.bId
from tlocal a
left outer join t_ssr_buyer_reporting_period b on (b.id=a.mainId)
where
a.id=@xId;
Please let me know how to modify. Thanks
Hi I have following select command in SQL Server. I am trying to change it
so if b.bId is null i want to assign it 0 value. So it displays 0 in the
field.
select top 1
a.sId
,b.bId
from tlocal a
left outer join t_ssr_buyer_reporting_period b on (b.id=a.mainId)
where
a.id=@xId;
Please let me know how to modify. Thanks
Jquery with php and send mail
Jquery with php and send mail
I have one question , i have my form working very well with jquery - no
send at the moment - , this jquery works over website with page with his
header , body and footer and many divs inside , this jquery auto call the
same page for send the form and no call external page
My code it´s this :
<script>
jQuery(document).ready(function() {
$("#form1").submit(function(e){
e.preventDefault();
var data = jQuery('#form1').serialize();
jQuery.ajax({
data: data,
cache: false,
url: 'home.php',
type: 'POST',
async:false,
success: function(){
var tit=$("#title_s").val();
var men=$("#mensaje_s").val();
if (tit=="" || men=="")
{
jQuery("#cp_asesor_request_ok").show();
}
else
{
jQuery("#cp_asesor_request_ok").show();
}
}
});
});
});
</script>
**The Form**
<div id="cp_asesor_request_ok" style="display:none;">Form Send</div>
<div id="cp_asesor_request_fail" style="display:none;">Error Send</div>
<form id="form1" name="form1" method="post" action="">
<p>
<label for="textfield"></label>
<input type="text" name="title" id="title_s" class="cp_input_asesor"
value="title" onclick="this.value=''"/>
</p>
<p>
<label for="textarea"></label>
<textarea name="message" id="mensaje_s" class="cp_textarea_asesor"
cols="45" rows="5" title="Insertar Mensaje de Solicitud"></textarea>
<input type="submit" name="button" class="cp_submit_asesor" value="Send" />
</p>
</form>
The question it´s how i can send the email from form because all do from
jquery but how i can call to the php mail function from the same page , i
need yes or yes call to external page for send the email ? or from the
same page called home.php i can send the email , the page it´s home.php
and need call other time to home.php for send email , if no use jquery
it´s easy buut if use jquery how i can do it
Thank´s
I have one question , i have my form working very well with jquery - no
send at the moment - , this jquery works over website with page with his
header , body and footer and many divs inside , this jquery auto call the
same page for send the form and no call external page
My code it´s this :
<script>
jQuery(document).ready(function() {
$("#form1").submit(function(e){
e.preventDefault();
var data = jQuery('#form1').serialize();
jQuery.ajax({
data: data,
cache: false,
url: 'home.php',
type: 'POST',
async:false,
success: function(){
var tit=$("#title_s").val();
var men=$("#mensaje_s").val();
if (tit=="" || men=="")
{
jQuery("#cp_asesor_request_ok").show();
}
else
{
jQuery("#cp_asesor_request_ok").show();
}
}
});
});
});
</script>
**The Form**
<div id="cp_asesor_request_ok" style="display:none;">Form Send</div>
<div id="cp_asesor_request_fail" style="display:none;">Error Send</div>
<form id="form1" name="form1" method="post" action="">
<p>
<label for="textfield"></label>
<input type="text" name="title" id="title_s" class="cp_input_asesor"
value="title" onclick="this.value=''"/>
</p>
<p>
<label for="textarea"></label>
<textarea name="message" id="mensaje_s" class="cp_textarea_asesor"
cols="45" rows="5" title="Insertar Mensaje de Solicitud"></textarea>
<input type="submit" name="button" class="cp_submit_asesor" value="Send" />
</p>
</form>
The question it´s how i can send the email from form because all do from
jquery but how i can call to the php mail function from the same page , i
need yes or yes call to external page for send the email ? or from the
same page called home.php i can send the email , the page it´s home.php
and need call other time to home.php for send email , if no use jquery
it´s easy buut if use jquery how i can do it
Thank´s
MySQL query displaying more data than expected
MySQL query displaying more data than expected
I have MySql database connected to my Java app. My users can choose meals,
category of meals, quantity, write note and order that meals. I store that
orders in table usluga_hrana. At the moment I am working only with meals
service but I have other services too, like drink service, wake up service
and others. Thats why I need one more table for all orders from different
services and its called narudzba. Now I need to display values of all
these atributes in one query: broj_sobe (room number, table narudzba),
id_narudzba (id order, table narudzba), naziv_kategorija (category name,
table kategorija_jela), naziv_hrane (name of meal, table naziv_jela),
kolicina (quantity, table usluga_hrana), napomena (note, table
usluga_hrana), datum_vrijeme (date and time, table usluga_hrana) and
izvrseno (done, table narudzba). Problem is that all these atributes are
in different tables and when I execute my query, it displays me multiple
values of orders, meals etc.
My tables are connected this way:
PK id_usluga (table usluga) is FK id_usluga in table narudzba
PK id_usluga (table usluga) is FK id_usluga in table usluga_hrana PK
id_kategorija (table kategorija_jela) is FK id_kategorija in table
usluga_hrana
PK id_hrana (table naziv_jela) is FK id_hrana in table usluga_hrana PK
id_kategorija (table kategorija_jela) is FK id_kategorija in table
naziv_jela
Here is album of my tables and result of my query with multiple values:
http://imgur.com/a/6grPN
Here is album with rest of my tables: http://imgur.com/a/sFPie
Here is my query:
SELECT n.broj_soba, n.id_narudzba, kj.naziv_kategorija, nj.naziv_hrane,
us.kolicina,
us.napomena, us.datum_vrijeme, n.izvrseno
FROM narudzba n
JOIN usluga u ON n.id_usluga = u.id_usluga
JOIN usluga_hrana us ON u.id_usluga = us.id_usluga
JOIN naziv_jela nj ON us.id_jela = nj.id_jela
JOIN kategorija_jela kj ON nj.id_kategorija = kj.id_kategorija
GROUP BY n.id_narudzba, us.id_usluga_hrana
I have MySql database connected to my Java app. My users can choose meals,
category of meals, quantity, write note and order that meals. I store that
orders in table usluga_hrana. At the moment I am working only with meals
service but I have other services too, like drink service, wake up service
and others. Thats why I need one more table for all orders from different
services and its called narudzba. Now I need to display values of all
these atributes in one query: broj_sobe (room number, table narudzba),
id_narudzba (id order, table narudzba), naziv_kategorija (category name,
table kategorija_jela), naziv_hrane (name of meal, table naziv_jela),
kolicina (quantity, table usluga_hrana), napomena (note, table
usluga_hrana), datum_vrijeme (date and time, table usluga_hrana) and
izvrseno (done, table narudzba). Problem is that all these atributes are
in different tables and when I execute my query, it displays me multiple
values of orders, meals etc.
My tables are connected this way:
PK id_usluga (table usluga) is FK id_usluga in table narudzba
PK id_usluga (table usluga) is FK id_usluga in table usluga_hrana PK
id_kategorija (table kategorija_jela) is FK id_kategorija in table
usluga_hrana
PK id_hrana (table naziv_jela) is FK id_hrana in table usluga_hrana PK
id_kategorija (table kategorija_jela) is FK id_kategorija in table
naziv_jela
Here is album of my tables and result of my query with multiple values:
http://imgur.com/a/6grPN
Here is album with rest of my tables: http://imgur.com/a/sFPie
Here is my query:
SELECT n.broj_soba, n.id_narudzba, kj.naziv_kategorija, nj.naziv_hrane,
us.kolicina,
us.napomena, us.datum_vrijeme, n.izvrseno
FROM narudzba n
JOIN usluga u ON n.id_usluga = u.id_usluga
JOIN usluga_hrana us ON u.id_usluga = us.id_usluga
JOIN naziv_jela nj ON us.id_jela = nj.id_jela
JOIN kategorija_jela kj ON nj.id_kategorija = kj.id_kategorija
GROUP BY n.id_narudzba, us.id_usluga_hrana
How to make array data in custom jQuery Function?
How to make array data in custom jQuery Function?
I'm looking for some tutorial to make an array data in custom jQuery
Function, but I can't find any. Can you tell me how to make an array in
jQuery Function? I want to call my function like this :
$(this).myPlugin({
data_first: '1'
data_second: 'Hello'
});
my function script
(function($) {
$.fn.myPlugin = function(data) {
return this.each(function() {
alert(data[data_first]+' bla bla '+ data[data_second]);
});
}
})(jQuery);
I'm looking for some tutorial to make an array data in custom jQuery
Function, but I can't find any. Can you tell me how to make an array in
jQuery Function? I want to call my function like this :
$(this).myPlugin({
data_first: '1'
data_second: 'Hello'
});
my function script
(function($) {
$.fn.myPlugin = function(data) {
return this.each(function() {
alert(data[data_first]+' bla bla '+ data[data_second]);
});
}
})(jQuery);
Need some help trying to understand this code
Need some help trying to understand this code
I have been asked to: write a function boolean succeeds(char a, char b,
String s) that takes a string s and returns true if every occurrence of
the character b is always succeeded by the character a, and false
otherwise.
I came across this:
while (!s.equals("")) {
char c = s.charAt(0); // record first char
s = s.substring(1); // cut off first char
// if "first char is 'b' and next is
// not 'a'", we can return false
if (c == b && (s.equals("") || s.charAt(0) != a))
return false;
}
return true;
I cant quite get my head around it though? What does the s.equals"" mean?
I have been asked to: write a function boolean succeeds(char a, char b,
String s) that takes a string s and returns true if every occurrence of
the character b is always succeeded by the character a, and false
otherwise.
I came across this:
while (!s.equals("")) {
char c = s.charAt(0); // record first char
s = s.substring(1); // cut off first char
// if "first char is 'b' and next is
// not 'a'", we can return false
if (c == b && (s.equals("") || s.charAt(0) != a))
return false;
}
return true;
I cant quite get my head around it though? What does the s.equals"" mean?
Custom Attribute doesn't work in C#?
Custom Attribute doesn't work in C#?
I want to create an Attribute which will indicate who has the sufficient
permission to use the class .
So I created this :
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class AllowAttribute : Attribute
{
public AllowAttribute(params string[] allowedRoles)
{
IPrincipal user = Thread.CurrentPrincipal;
if (!allowedRoles.Any(user.IsInRole)) throw new Exception();
//here is the checking
}
}
And my testing class is :
[Allow(Roles.Administrator, Roles.OtherSampleRole)]
public class SamplePage
{
public void MyMethod()
{
Console.WriteLine("a");
}
}
(Roles.Administrator and Roles.OtherSampleRole are from here : )
public class Roles
{
public const string Administrator = "Administrator";
public const string OtherSampleRole = "OtherSampleRole";
}
Testing code ( which should fail) :
static void Main(string[] args)
{
Thread.CurrentPrincipal = new GenericPrincipal(new
GenericIdentity("Bob", "Passport"),
new[]
{
"lalala" // this value is invalid and should
fail at the attribute ctor
});
SamplePage sample = new SamplePage();
sample.MyMethod();
Console.ReadLine();
}
Question :
This is not working and I still see the output from the MyMethod method.
And I also can't get into (when debug mode) the ctor of the attribute.
What am I doing wrong ?
I want to create an Attribute which will indicate who has the sufficient
permission to use the class .
So I created this :
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class AllowAttribute : Attribute
{
public AllowAttribute(params string[] allowedRoles)
{
IPrincipal user = Thread.CurrentPrincipal;
if (!allowedRoles.Any(user.IsInRole)) throw new Exception();
//here is the checking
}
}
And my testing class is :
[Allow(Roles.Administrator, Roles.OtherSampleRole)]
public class SamplePage
{
public void MyMethod()
{
Console.WriteLine("a");
}
}
(Roles.Administrator and Roles.OtherSampleRole are from here : )
public class Roles
{
public const string Administrator = "Administrator";
public const string OtherSampleRole = "OtherSampleRole";
}
Testing code ( which should fail) :
static void Main(string[] args)
{
Thread.CurrentPrincipal = new GenericPrincipal(new
GenericIdentity("Bob", "Passport"),
new[]
{
"lalala" // this value is invalid and should
fail at the attribute ctor
});
SamplePage sample = new SamplePage();
sample.MyMethod();
Console.ReadLine();
}
Question :
This is not working and I still see the output from the MyMethod method.
And I also can't get into (when debug mode) the ctor of the attribute.
What am I doing wrong ?
CSS not working with IE8
CSS not working with IE8
I have a php login page which is working fine in firefox. But the sign-in
button is not working in IE8. Also the css layout is totally scrambled.
Please let me know where to upload the sorce zip so that i can receive
some help.
Thanks in advance.
I have a php login page which is working fine in firefox. But the sign-in
button is not working in IE8. Also the css layout is totally scrambled.
Please let me know where to upload the sorce zip so that i can receive
some help.
Thanks in advance.
Friday, 30 August 2013
Bootstrap modal doesn't close with 'x' after opening a second time
Bootstrap modal doesn't close with 'x' after opening a second time
So I have this issue where after I open a modal, close it(by either
clicking the 'x' or the background overlay). The second time I open the
modal, it only closes by clicking on the background overlay and closing by
clicking on the 'x' does not work.
Below is my code for the modal:
<div class="modal fade in" id="whatModal" aria-hidden="true">
<div class="modal-content col-md-offset-4 col-md-4">
<div class="modal-header">
<div class="close glyphicon glyphicon-remove"
data-dismiss="modal" data-target="#whatModal"></div>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Vestibulum feugiat dui ipsum, in laoreet eros
porttitor non.</p>
</div>
</div>
</div>
Oh, I'm using Bootstrap 3 by the way.
Any help is greatly appreciated after banging my head against the wall for
the past few hours.
So I have this issue where after I open a modal, close it(by either
clicking the 'x' or the background overlay). The second time I open the
modal, it only closes by clicking on the background overlay and closing by
clicking on the 'x' does not work.
Below is my code for the modal:
<div class="modal fade in" id="whatModal" aria-hidden="true">
<div class="modal-content col-md-offset-4 col-md-4">
<div class="modal-header">
<div class="close glyphicon glyphicon-remove"
data-dismiss="modal" data-target="#whatModal"></div>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Vestibulum feugiat dui ipsum, in laoreet eros
porttitor non.</p>
</div>
</div>
</div>
Oh, I'm using Bootstrap 3 by the way.
Any help is greatly appreciated after banging my head against the wall for
the past few hours.
Thursday, 29 August 2013
Reordering divs responsively with Twitter Bootstrap?
Reordering divs responsively with Twitter Bootstrap?
I am working with Twitter Bootstrap v3 and want to reorder elements
responsively, using column ordering and offsetting.
This is how I would like to use my elements. At -xs or -sm breakpoints,
with the containing div stacked 4 to a row:
At -md or -lg breakpoints, with the containing div stacked 2 to a row:
This is the current code - I know how to set the classes on the containing
div, but not on A, B and C:
<div class="row">
<div class="containing col-xs-6 col-sm-6 col-md-3 col-lg-3">
<div class="row">
<div class="a col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
A</div>
<div class="b col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
B</div>
<div class="c col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
C</div>
</div>
</div>
... more containing divs...
</div>
I can't figure out how to get A, B and C in the right order with Bootstrap
3's column ordering and offsetting. Is it actually possible?
This is as far as I've got using JSFiddle: http://jsfiddle.net/3vYgR/
I am working with Twitter Bootstrap v3 and want to reorder elements
responsively, using column ordering and offsetting.
This is how I would like to use my elements. At -xs or -sm breakpoints,
with the containing div stacked 4 to a row:
At -md or -lg breakpoints, with the containing div stacked 2 to a row:
This is the current code - I know how to set the classes on the containing
div, but not on A, B and C:
<div class="row">
<div class="containing col-xs-6 col-sm-6 col-md-3 col-lg-3">
<div class="row">
<div class="a col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
A</div>
<div class="b col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
B</div>
<div class="c col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
C</div>
</div>
</div>
... more containing divs...
</div>
I can't figure out how to get A, B and C in the right order with Bootstrap
3's column ordering and offsetting. Is it actually possible?
This is as far as I've got using JSFiddle: http://jsfiddle.net/3vYgR/
If else statement for array
If else statement for array
I'm currently hand coding my if else statement
if ($user_location[0] == $location){
$user_id = $page[0];
} else if ($user_location[1] == $location){
$user_id = $page[1];
} else if ($user_location[2] == $location){
$user_id = $page[2];
} else if ($user_location[3] == $location){
$user_id = $page[3];
} else if ($user_location[4] == $location){
$user_id = $page[4];
} else if ($user_location[5] == $location){
$user_id = $page[5];
} else if ($user_location[6] == $location){
$user_id = $page[6];
} else if ($user_location[7] == $location){
$user_id = $page[7];
} else if ($user_location[8] == $location){
$user_id = $page[8];
} else {
$user_id = $user_gen;
}
How do I make this if statement that auto increment the $user_location[]
and $page[] instead of hand coding?
I'm currently hand coding my if else statement
if ($user_location[0] == $location){
$user_id = $page[0];
} else if ($user_location[1] == $location){
$user_id = $page[1];
} else if ($user_location[2] == $location){
$user_id = $page[2];
} else if ($user_location[3] == $location){
$user_id = $page[3];
} else if ($user_location[4] == $location){
$user_id = $page[4];
} else if ($user_location[5] == $location){
$user_id = $page[5];
} else if ($user_location[6] == $location){
$user_id = $page[6];
} else if ($user_location[7] == $location){
$user_id = $page[7];
} else if ($user_location[8] == $location){
$user_id = $page[8];
} else {
$user_id = $user_gen;
}
How do I make this if statement that auto increment the $user_location[]
and $page[] instead of hand coding?
Loop within my single.php wordpess blog only return for one post
Loop within my single.php wordpess blog only return for one post
hi i has a wordpress blog i put this code below within single.php page in
side bar the code is the same code in the hompage side bar > this code is
correctly work in hompage sidebar and return to all posts but in the
single.php sidebar only return to one post.
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="new-posts-form">
<div class="new-posts-img"><a href="<?php the_permalink(); ?>"></a><a
href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php
the_post_thumbnail(array(100,80)); ?></a></div>
<div class="new-posts-title"><a href="<?php the_permalink(); ?>"><?php
the_title(); ?></a></div>
<div class="new-post-description"><?php content('11'); ?></div>
<div class="new-post-add-date-time"><img src="<?php
bloginfo('template_url'); ?>/images/tb_clock.png" /><?php the_time('F j,
Y'); ?> at <?php the_time('g:i a'); ?> : <?php the_category(', ') ?></div>
<?php endwhile; ?>
<?php endif; ?>
hi i has a wordpress blog i put this code below within single.php page in
side bar the code is the same code in the hompage side bar > this code is
correctly work in hompage sidebar and return to all posts but in the
single.php sidebar only return to one post.
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="new-posts-form">
<div class="new-posts-img"><a href="<?php the_permalink(); ?>"></a><a
href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php
the_post_thumbnail(array(100,80)); ?></a></div>
<div class="new-posts-title"><a href="<?php the_permalink(); ?>"><?php
the_title(); ?></a></div>
<div class="new-post-description"><?php content('11'); ?></div>
<div class="new-post-add-date-time"><img src="<?php
bloginfo('template_url'); ?>/images/tb_clock.png" /><?php the_time('F j,
Y'); ?> at <?php the_time('g:i a'); ?> : <?php the_category(', ') ?></div>
<?php endwhile; ?>
<?php endif; ?>
Wednesday, 28 August 2013
How to reference an aliased column in where clause that contains a grouping function
How to reference an aliased column in where clause that contains a
grouping function
I have a simple sql query below, which produces a usable result for me.
However I would ideally like to further limit the results of this query to
only include results where the aliased column total is less then 10. I
have tried directly referencing the aliased column in a where clause, and
also duplicating the COUNT() portion in a where clause, but that doesn't
work. Here is the query, thanks in advance for the help.
SELECT COUNT(DISTINCT iDomainID) AS totInFile, iFileGroup
FROM Domains.`ApacheVirtualHosts`
GROUP BY iFileGroup
grouping function
I have a simple sql query below, which produces a usable result for me.
However I would ideally like to further limit the results of this query to
only include results where the aliased column total is less then 10. I
have tried directly referencing the aliased column in a where clause, and
also duplicating the COUNT() portion in a where clause, but that doesn't
work. Here is the query, thanks in advance for the help.
SELECT COUNT(DISTINCT iDomainID) AS totInFile, iFileGroup
FROM Domains.`ApacheVirtualHosts`
GROUP BY iFileGroup
Accessing additional places results in Google Map API
Accessing additional places results in Google Map API
I'm building a Javascript application that will search a radius on
Googlemaps and return data of about 400 venues which is basically the
equivalent of 20 pages of Google.
Is this even possible?
Google say here: that the maximum results per query is 60 results
Is there anyway to get around this?
Thanks
I'm building a Javascript application that will search a radius on
Googlemaps and return data of about 400 venues which is basically the
equivalent of 20 pages of Google.
Is this even possible?
Google say here: that the maximum results per query is 60 results
Is there anyway to get around this?
Thanks
Cannot locate mysql instance in Solaris 10
Cannot locate mysql instance in Solaris 10
I am working on a system setup by another admin. A solaris with a webstack
setup. By using commands such as svcs -a|grep apache I can see apache
running or svcs -a|grep postgresql shows me postgres is disabled. However
svcs -a|grep mysql command does nothing. It just hops on the next line
prompt waiting for an input! This mysql databases I can see are all
located on this Solaris computer which is networked to a Fedora computer
running other applications. The windows clients networked to the Solaris
however have the applications whcih are based on MYSQL running normal.
Anyone with a clue? I actually want to access the MYSQL commandline on
Solaris but it says Mysql : not found!
I am working on a system setup by another admin. A solaris with a webstack
setup. By using commands such as svcs -a|grep apache I can see apache
running or svcs -a|grep postgresql shows me postgres is disabled. However
svcs -a|grep mysql command does nothing. It just hops on the next line
prompt waiting for an input! This mysql databases I can see are all
located on this Solaris computer which is networked to a Fedora computer
running other applications. The windows clients networked to the Solaris
however have the applications whcih are based on MYSQL running normal.
Anyone with a clue? I actually want to access the MYSQL commandline on
Solaris but it says Mysql : not found!
Smooth scroll UI draggable
Smooth scroll UI draggable
I'm having a problem with jQuery UI draggable..
I with to scroll an element within a smaller parent element, so that it
creates a kind of viewport.
However, I'm having an issue with the element being dragged as it's
snapping to the edges of the port.
Been battling with this for a while now so could really use some help...
please :)
Small sample code:
<link rel="stylesheet"
href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script type="text/javascript"
src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript"
src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<!-- CSS -->
<style type="text/css">
#port{
width:50px;
height:100px;
border:1px solid red;
overflow:hidden;
}
#obj {
width: 100px;
height: 100px;
border: 1px solid black;
cursor: pointer;
border-radius: 10px;
text-align: center;
background-color: lightpink;
}
</style>
<!-- Javascript -->
<script>
$(function ()
{
$("#obj").draggable(
{
containment: "#port",
scroll: false,
axis: 'x'
});
});
</script>
<!-- HTML -->
<div id="port">
<div id="obj">
<p>Drag me</p>
</div>
</div>
Here is a jsFiddle of the above : LINK
I'm having a problem with jQuery UI draggable..
I with to scroll an element within a smaller parent element, so that it
creates a kind of viewport.
However, I'm having an issue with the element being dragged as it's
snapping to the edges of the port.
Been battling with this for a while now so could really use some help...
please :)
Small sample code:
<link rel="stylesheet"
href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script type="text/javascript"
src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript"
src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<!-- CSS -->
<style type="text/css">
#port{
width:50px;
height:100px;
border:1px solid red;
overflow:hidden;
}
#obj {
width: 100px;
height: 100px;
border: 1px solid black;
cursor: pointer;
border-radius: 10px;
text-align: center;
background-color: lightpink;
}
</style>
<!-- Javascript -->
<script>
$(function ()
{
$("#obj").draggable(
{
containment: "#port",
scroll: false,
axis: 'x'
});
});
</script>
<!-- HTML -->
<div id="port">
<div id="obj">
<p>Drag me</p>
</div>
</div>
Here is a jsFiddle of the above : LINK
Tuesday, 27 August 2013
Calculate the time difference in android
Calculate the time difference in android
i have two time
String Time1= "13-08-2013 05:57:00 PM"
String Time2= "14-08-2013 06:00:00 AM"
Please help to calculate the time difference between two time in android.
i have two time
String Time1= "13-08-2013 05:57:00 PM"
String Time2= "14-08-2013 06:00:00 AM"
Please help to calculate the time difference between two time in android.
TPlane versus TImage3D in Delphi FMX?
TPlane versus TImage3D in Delphi FMX?
I have an DelphiXE4 application made with FMX. I want to have flat
textured objects (no thickness) where I can zoom and move the whole scene
on the screen.
(hint : Think about pictures on a wall)
I started with a TForm3D to implement TImage3D components with bitmap
assigned. It works well!
BUT I've tested with the TPlane component, I can do the same thing and
achieve the same result.
The question is : What is the difference between these 2 components
TImage3D & TPlane ?
This will help me to choose the right one for my - current and further -
needs.
FMX documents and wiki doesn't really help here !
I have an DelphiXE4 application made with FMX. I want to have flat
textured objects (no thickness) where I can zoom and move the whole scene
on the screen.
(hint : Think about pictures on a wall)
I started with a TForm3D to implement TImage3D components with bitmap
assigned. It works well!
BUT I've tested with the TPlane component, I can do the same thing and
achieve the same result.
The question is : What is the difference between these 2 components
TImage3D & TPlane ?
This will help me to choose the right one for my - current and further -
needs.
FMX documents and wiki doesn't really help here !
If RAM is cheap=?iso-8859-1?Q?=2C_why_don't_we_load_everything_to_RAM_and_run_it_from_th?=ere=?iso-8859-1?Q?=3F_=96_superuser.com?=
If RAM is cheap, why don't we load everything to RAM and run it from
there? – superuser.com
RAM is cheap, and much faster than SSDs. It's just volatile. So why don't
computers have a LOT of RAM, and on power up, load everything to the RAM
from the hard drive/SSD and just run everything from …
there? – superuser.com
RAM is cheap, and much faster than SSDs. It's just volatile. So why don't
computers have a LOT of RAM, and on power up, load everything to the RAM
from the hard drive/SSD and just run everything from …
JQuery checkbox check
JQuery checkbox check
Suppose I have 3 checkboxes (one,two,three). Now I want that if I click
checkbox one then checkbox two and three will uncheck.
Another example: if I click checkbox two then checkbox one and three will
uncheck.
And if I click checkbox three then checkbox one and two will uncheck.
HTML
<input type="checkbox" class="check" value="one"><label>One</label>
<input type="checkbox" class="check" value="two"><label>Two</label>
<input type="checkbox" class="check" value="three"><label>Three</label>
jQuery
$(document).ready(function(){
$(".check").click(function(){
$(".check").attr("checked", "checked");
} else {
$(".check").removeAttr("checked");
});
});
Suppose I have 3 checkboxes (one,two,three). Now I want that if I click
checkbox one then checkbox two and three will uncheck.
Another example: if I click checkbox two then checkbox one and three will
uncheck.
And if I click checkbox three then checkbox one and two will uncheck.
HTML
<input type="checkbox" class="check" value="one"><label>One</label>
<input type="checkbox" class="check" value="two"><label>Two</label>
<input type="checkbox" class="check" value="three"><label>Three</label>
jQuery
$(document).ready(function(){
$(".check").click(function(){
$(".check").attr("checked", "checked");
} else {
$(".check").removeAttr("checked");
});
});
How to give members access to their own protected page?
How to give members access to their own protected page?
I'd like to give each member access to their own personal page that only
I'll be able to edit. Each member will have their own personal page with
private info.
Do you have any suggestions on how to do this? Thank you!
I'd like to give each member access to their own personal page that only
I'll be able to edit. Each member will have their own personal page with
private info.
Do you have any suggestions on how to do this? Thank you!
unexpected token in HQL
unexpected token in HQL
This is my HQL quey.But this is executed,the following error occurred.How
we can solve this problem
error:unexpected token: d1
select d from DimensionStone d inner join d.stockRegister s where
d.stockRegister.stockRegisterId <=? and s.application.applicationId=?
and d.isIssued='No' or (s.stockRegisterId <=? and d.isIssued='Yes' and
d.issuedDate>(select max(updatedOn) from StockRegister st where
st.stockRegisterId<? and st.application.applicationId=?)) and d not
in(select d1 from DimensionStone d1 inner join d1.stockRegister s1
where s1.stockRegisterId <=? and s1.application.applicationId=?
d1.isIssued='No'
This is my HQL quey.But this is executed,the following error occurred.How
we can solve this problem
error:unexpected token: d1
select d from DimensionStone d inner join d.stockRegister s where
d.stockRegister.stockRegisterId <=? and s.application.applicationId=?
and d.isIssued='No' or (s.stockRegisterId <=? and d.isIssued='Yes' and
d.issuedDate>(select max(updatedOn) from StockRegister st where
st.stockRegisterId<? and st.application.applicationId=?)) and d not
in(select d1 from DimensionStone d1 inner join d1.stockRegister s1
where s1.stockRegisterId <=? and s1.application.applicationId=?
d1.isIssued='No'
change Text/DataFormat of Slider's ThumbTooltip
change Text/DataFormat of Slider's ThumbTooltip
I have a slider with maximum value of video's time in seconds (1 minute =
60 seconds, so if the video is 60 seconds length, the maximum value of the
slider will be 60).
When I drag the Thumb, there's ThumbTooltip that shows the current value I
am hovering.
I want to change that text so instead of displaying int, it will display
time 1 will be 00:01 and so on...
I tried to play with the style of the Slider with no luck.
Will appreciate your help.
I have a slider with maximum value of video's time in seconds (1 minute =
60 seconds, so if the video is 60 seconds length, the maximum value of the
slider will be 60).
When I drag the Thumb, there's ThumbTooltip that shows the current value I
am hovering.
I want to change that text so instead of displaying int, it will display
time 1 will be 00:01 and so on...
I tried to play with the style of the Slider with no luck.
Will appreciate your help.
Monday, 26 August 2013
C++ - Escape sequence doesn't work on my system
C++ - Escape sequence doesn't work on my system
I just started learning C++, and I came across an escape sequence that
must make a beep. When I compile it and run, i don't hear a beep for some
reason. Here is the code:
#include <iostream>
using namespace std;
int main(){
cout << "Cool\a\nHey man!\n";
return 0;
}
Any help would be appreciated. Thanks!
I just started learning C++, and I came across an escape sequence that
must make a beep. When I compile it and run, i don't hear a beep for some
reason. Here is the code:
#include <iostream>
using namespace std;
int main(){
cout << "Cool\a\nHey man!\n";
return 0;
}
Any help would be appreciated. Thanks!
How to make form always on top in Application
How to make form always on top in Application
I have a form that i want to always be on top whenever it is opened in the
application but i dont want it to be on top when the main form is
minimized or another application is navigated. I want it to be on top only
in my application.
Following the answer in the question : How to make a window always stay on
top in .Net?
this.TopMost = true;
Makes the form on top but the form is still on top when another
application is navigated to or the main form is closed.
Pls how do i make the form only on top in the application while enabling
user to still work on the main form?
I have a form that i want to always be on top whenever it is opened in the
application but i dont want it to be on top when the main form is
minimized or another application is navigated. I want it to be on top only
in my application.
Following the answer in the question : How to make a window always stay on
top in .Net?
this.TopMost = true;
Makes the form on top but the form is still on top when another
application is navigated to or the main form is closed.
Pls how do i make the form only on top in the application while enabling
user to still work on the main form?
Directive code executes before controller code
Directive code executes before controller code
I have created a directive like that I use like this:
<div car-form car="car" on-submit="createCar(car)"></div>
I use directive on both new and edit page that I have created. They have
their own controller. In the EditCarController I retrieve the car from a
RESTful webservice that I created. I also have assigned a controller
function to the directive (in the config object of the directive) where I
set some categories based on the car etc...However!
Since the car is loaded asynchrounsly from the page controller it isn't
always (random) loaded when the directive controller code starts to run.
How can I fix that? I need to be sure that the car I pass to the directive
is loaded.
I have created a directive like that I use like this:
<div car-form car="car" on-submit="createCar(car)"></div>
I use directive on both new and edit page that I have created. They have
their own controller. In the EditCarController I retrieve the car from a
RESTful webservice that I created. I also have assigned a controller
function to the directive (in the config object of the directive) where I
set some categories based on the car etc...However!
Since the car is loaded asynchrounsly from the page controller it isn't
always (random) loaded when the directive controller code starts to run.
How can I fix that? I need to be sure that the car I pass to the directive
is loaded.
Form That Submits Content Securely
Form That Submits Content Securely
I have built a WP site for a client. One of the pages has a form which my
client's customers will use to submit material to my client, and one of
the required fields is a file upload.
My client requires that the material submitted via that form reach my
client securely. I see no WP contact form plugin that achieves this. (The
ones that call themselves "secure", such as fast secure contact form, use
that term in a different sense: protection against people submitting
malicious content via the form.)
Here is the approach I'm now thinking of:
I use a standard plugin to create the form (I'm using contact form 7).
The contents of the form submission are not emailed to my client. She just
receives an email notification that the form was submitted.
I've installed the plugin contact form DB, so that my client can access
the contents of the submission from the WP admin.
But there are still at least two issues that need to be resolved:
I need to make contact form 7 submit the content securely.
My client needs to be able to view the submitted content in the WP admin
securely.
Regarding issue # 1, it it's too much of a hassle to figure out how to
make contact form 7 or any of the other WP contact form plugins submit the
content securely, I could code the form myself.
I see a plugin called Dagon Design that calls itself secure -- but the
example they give is a form with a non-secure url, and the action of the
form also is non-secure, leading me to believe that this plugin too is not
using "secure" in the sense that I need.
Any assistance on how to implement this, or any suggestions for an
alternative approach, would be welcome.
I have built a WP site for a client. One of the pages has a form which my
client's customers will use to submit material to my client, and one of
the required fields is a file upload.
My client requires that the material submitted via that form reach my
client securely. I see no WP contact form plugin that achieves this. (The
ones that call themselves "secure", such as fast secure contact form, use
that term in a different sense: protection against people submitting
malicious content via the form.)
Here is the approach I'm now thinking of:
I use a standard plugin to create the form (I'm using contact form 7).
The contents of the form submission are not emailed to my client. She just
receives an email notification that the form was submitted.
I've installed the plugin contact form DB, so that my client can access
the contents of the submission from the WP admin.
But there are still at least two issues that need to be resolved:
I need to make contact form 7 submit the content securely.
My client needs to be able to view the submitted content in the WP admin
securely.
Regarding issue # 1, it it's too much of a hassle to figure out how to
make contact form 7 or any of the other WP contact form plugins submit the
content securely, I could code the form myself.
I see a plugin called Dagon Design that calls itself secure -- but the
example they give is a form with a non-secure url, and the action of the
form also is non-secure, leading me to believe that this plugin too is not
using "secure" in the sense that I need.
Any assistance on how to implement this, or any suggestions for an
alternative approach, would be welcome.
my text align middle did not work
my text align middle did not work
Something wrong with my code. I need to center text in the middle of each
box. Thanks for your help
#navcontainer { padding: 0 5 20px 10px; }
ul#navlist { font-family: sans-serif; }
ul#navlist a
{
font-weight: bold;
text-decoration: none;
display: inline-block;
line-height:20px
vertical-align: middle;
}
ul#navlist, ul#navlist ul, ul#navlist li
{
margin: 0 8px;
padding: 0px;
list-style-type: none;
box-shadow: 8px 8px 12px #aaa;
}
ul#navlist li { float: left;
}
ul#navlist li a
{
color: #ffffff;
background-color: #EF634A;
//padding:10px;
padding: 10px 5px 10px 5px;
border: 1px #ffffff outset;
height: 40px;
}
ul#navlist li a:hover
{
color: #ffff00;
background-color: #003366;
}
ul#navlist li a:active
{
color: #cccccc;
background-color: #003366;
border: 1px #ffffff inset;
}
ul#subnavlist { display: none; }
ul#subnavlist li { float: none; }
ul#subnavlist li a
{
padding: 0px;
margin: 0px;
height: 20px;
}
ul#navlist li:hover ul#subnavlist
{
display: block;
//display: inline-block;
//display: table-cell;
position: absolute;
font-size: 8pt;
padding-top: 5px;
}
ul#navlist li:hover ul#subnavlist li a
{
display: block;
width : 260;
height : 100;
border: none;
padding: 2px;
}
ul#navlist li:hover ul#subnavlist li a:before { content: " >> "; }
and
<div id="navcontainer">
<ul id="navlist">
<li><a href="obs-geostrategique-sport.php?cat=1">PROGRAMME EUROPÉEN DE
LUTTE <br>CONTRE LE TRUCAGE DE MATCHS</a></li>
<li><a href="obs-geostrategique-sport.php?cat=2">ACTUALITÉS
SPORTIVES</a></li>
<li><a href="obs-geostrategique-sport.php?cat=3">COMMUNIQUÉS</a></li>
<li id="active"><a href="obs-geostrategique-sport.php?cat=4"
id="current">THEMATIQUES</a>
<ul id="subnavlist">
<li id="subactive"><a href="#" id="subcurrent">Lutte contre la
corruption</a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=1">Evènements
sportifs </a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=2">Bonne
gouvernance du sport</a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=3">Economie du
sport</a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=4">Lutte contre le
dopage</a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=5">Lutte pour
l'intégrité dans le sport</a></li>
</ul>
</li>
</ul>
</div>
Something wrong with my code. I need to center text in the middle of each
box. Thanks for your help
#navcontainer { padding: 0 5 20px 10px; }
ul#navlist { font-family: sans-serif; }
ul#navlist a
{
font-weight: bold;
text-decoration: none;
display: inline-block;
line-height:20px
vertical-align: middle;
}
ul#navlist, ul#navlist ul, ul#navlist li
{
margin: 0 8px;
padding: 0px;
list-style-type: none;
box-shadow: 8px 8px 12px #aaa;
}
ul#navlist li { float: left;
}
ul#navlist li a
{
color: #ffffff;
background-color: #EF634A;
//padding:10px;
padding: 10px 5px 10px 5px;
border: 1px #ffffff outset;
height: 40px;
}
ul#navlist li a:hover
{
color: #ffff00;
background-color: #003366;
}
ul#navlist li a:active
{
color: #cccccc;
background-color: #003366;
border: 1px #ffffff inset;
}
ul#subnavlist { display: none; }
ul#subnavlist li { float: none; }
ul#subnavlist li a
{
padding: 0px;
margin: 0px;
height: 20px;
}
ul#navlist li:hover ul#subnavlist
{
display: block;
//display: inline-block;
//display: table-cell;
position: absolute;
font-size: 8pt;
padding-top: 5px;
}
ul#navlist li:hover ul#subnavlist li a
{
display: block;
width : 260;
height : 100;
border: none;
padding: 2px;
}
ul#navlist li:hover ul#subnavlist li a:before { content: " >> "; }
and
<div id="navcontainer">
<ul id="navlist">
<li><a href="obs-geostrategique-sport.php?cat=1">PROGRAMME EUROPÉEN DE
LUTTE <br>CONTRE LE TRUCAGE DE MATCHS</a></li>
<li><a href="obs-geostrategique-sport.php?cat=2">ACTUALITÉS
SPORTIVES</a></li>
<li><a href="obs-geostrategique-sport.php?cat=3">COMMUNIQUÉS</a></li>
<li id="active"><a href="obs-geostrategique-sport.php?cat=4"
id="current">THEMATIQUES</a>
<ul id="subnavlist">
<li id="subactive"><a href="#" id="subcurrent">Lutte contre la
corruption</a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=1">Evènements
sportifs </a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=2">Bonne
gouvernance du sport</a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=3">Economie du
sport</a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=4">Lutte contre le
dopage</a></li>
<li><a href="obs-geostrategique-sport.php?cat=4&id=5">Lutte pour
l'intégrité dans le sport</a></li>
</ul>
</li>
</ul>
</div>
get_template_part() doesn't work
get_template_part() doesn't work
I use get_template_part() function to get theme options page content like
this:
function setup_theme_admin_menus() {
add_theme_page( "Theme Options", "Theme Options", "read",
"theme_options", "theme_options" );
}
function theme_options() {
get_template_part("content","options");
}
And it seems to work perfect when I use it on my localhost but when I
relocated it online it stopped rendering desired HTML. When I use
something like:
function theme_options() {
echo "Hello World!";
}
It works as expected both online and locally. No idea why it is happening.
I use get_template_part() function to get theme options page content like
this:
function setup_theme_admin_menus() {
add_theme_page( "Theme Options", "Theme Options", "read",
"theme_options", "theme_options" );
}
function theme_options() {
get_template_part("content","options");
}
And it seems to work perfect when I use it on my localhost but when I
relocated it online it stopped rendering desired HTML. When I use
something like:
function theme_options() {
echo "Hello World!";
}
It works as expected both online and locally. No idea why it is happening.
Connecting a UIButton to an IBOutlet and IBAction in code
Connecting a UIButton to an IBOutlet and IBAction in code
I have this is viewDidLoad:
// Set up register button
UIButton *registerButton = [UIButton buttonWithType:UIButtonTypeSystem];
[registerButton setTitle:@"Register" forState:UIControlStateNormal];
registerButton.frame = CGRectMake(0.0, 0.0, self.screenWidth / 2.0, 100.0);
and this:
- (IBAction)buttonPressed:(UIButton *)sender
{
}
I also have this in my .h file:
@property (nonatomic, weak) IBOutlet UIButton *registerButton;
How do I connect IBOutlets and IBActions to buttons I create in code?
I have this is viewDidLoad:
// Set up register button
UIButton *registerButton = [UIButton buttonWithType:UIButtonTypeSystem];
[registerButton setTitle:@"Register" forState:UIControlStateNormal];
registerButton.frame = CGRectMake(0.0, 0.0, self.screenWidth / 2.0, 100.0);
and this:
- (IBAction)buttonPressed:(UIButton *)sender
{
}
I also have this in my .h file:
@property (nonatomic, weak) IBOutlet UIButton *registerButton;
How do I connect IBOutlets and IBActions to buttons I create in code?
Sunday, 25 August 2013
Failed Deploy Apps to Heroku
Failed Deploy Apps to Heroku
I'm trying push my rails apps to heroku, first create heroku account and
then on command prompt
git init
git add .
git commit -m "init"
heroku login and then push ssh
heroku create mycvdemo
git push heroku master
C:\Sites\mycv>git push heroku master
Counting objects: 253, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (228/228), done.
Writing objects: 8% (21/253), 208.00 KiB | 3 KiB/s
but I'm getting this error :
C:\Sites\mycv>git push heroku master
Counting objects: 253, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (228/228), done.
Write failed: The connection was abortediB | 3 KiB/s
fatal: sha1 file '<stdout>' write error: Invalid argument
error: failed to push some refs to 'git@heroku.com:mycvdemo.git'
I always getting this error when 8% writing object.
I'm trying push my rails apps to heroku, first create heroku account and
then on command prompt
git init
git add .
git commit -m "init"
heroku login and then push ssh
heroku create mycvdemo
git push heroku master
C:\Sites\mycv>git push heroku master
Counting objects: 253, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (228/228), done.
Writing objects: 8% (21/253), 208.00 KiB | 3 KiB/s
but I'm getting this error :
C:\Sites\mycv>git push heroku master
Counting objects: 253, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (228/228), done.
Write failed: The connection was abortediB | 3 KiB/s
fatal: sha1 file '<stdout>' write error: Invalid argument
error: failed to push some refs to 'git@heroku.com:mycvdemo.git'
I always getting this error when 8% writing object.
Using JOIN to display data in a table
Using JOIN to display data in a table
Thanks for reading my question
i am trying to make *clients_id* from the table repair_jobs appear as the
name from the table contacts
but i am having no luck i have got 2 sql query's is this wrong?
the 1st
$query = "select * from repair_jobs";
this helps me display the information i need regarding the fields from
repair_jobs and works
this is the 2nd
$query = "SELECT repair_jobs.client_id, contacts.name
FROM repair_jobs
INNER JOIN contacts
ON repair_jobs.client_id=contacts.name";
under that i have this to try to display the name of the client
echo "<td>{$client_id}</td>";
but it is only displaying the number and not the data (clients name) that
i need
am i missing something?
Additional information
The client_id (repair_jobs) is a number and is the same as id (contacts)
but wanting to display the name (contacts)
CLIENTS
Id – name – surname – phone – address
REPAIRS
Id – clients_id (same as id in clients) – unit – date – price
Thanks for reading my question
i am trying to make *clients_id* from the table repair_jobs appear as the
name from the table contacts
but i am having no luck i have got 2 sql query's is this wrong?
the 1st
$query = "select * from repair_jobs";
this helps me display the information i need regarding the fields from
repair_jobs and works
this is the 2nd
$query = "SELECT repair_jobs.client_id, contacts.name
FROM repair_jobs
INNER JOIN contacts
ON repair_jobs.client_id=contacts.name";
under that i have this to try to display the name of the client
echo "<td>{$client_id}</td>";
but it is only displaying the number and not the data (clients name) that
i need
am i missing something?
Additional information
The client_id (repair_jobs) is a number and is the same as id (contacts)
but wanting to display the name (contacts)
CLIENTS
Id – name – surname – phone – address
REPAIRS
Id – clients_id (same as id in clients) – unit – date – price
Saturday, 24 August 2013
Connecting Vodafone USB Dongle in Ubuntu 13.04
Connecting Vodafone USB Dongle in Ubuntu 13.04
I am trying to connect Vodafone dongKle(ZTE K3770-Z) in my laptop with
13.04 version of Ubuntu. I went through so many forums, question but
couldn't find exact solution for it.
Yesterday I succeeded once with Sakis3G, but today that also doesn't work,
give me error saying - Port is being used.
Here is the result of lsusb -
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 0461:4dfa Primax Electronics, Ltd
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 008: ID 19d2:1177 ZTE WCDMA Technologies MSM
Bus 001 Device 004: ID 8087:07da Intel Corp.
Bus 001 Device 005: ID 147e:1002 Upek
Bus 002 Device 003: ID 04f2:b2ea Chicony Electronics Co., Ltd
I am trying to connect Vodafone dongKle(ZTE K3770-Z) in my laptop with
13.04 version of Ubuntu. I went through so many forums, question but
couldn't find exact solution for it.
Yesterday I succeeded once with Sakis3G, but today that also doesn't work,
give me error saying - Port is being used.
Here is the result of lsusb -
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 0461:4dfa Primax Electronics, Ltd
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 008: ID 19d2:1177 ZTE WCDMA Technologies MSM
Bus 001 Device 004: ID 8087:07da Intel Corp.
Bus 001 Device 005: ID 147e:1002 Upek
Bus 002 Device 003: ID 04f2:b2ea Chicony Electronics Co., Ltd
Expression query based on same criteria
Expression query based on same criteria
I don't know how to explain this in a few words so I don't know how to
search for it. I'm sure someone must have asked this question before but I
can't find it.
I'm trying to use an expression query where the criteria are identical. I
want to find total production by city but my production information comes
from stores. There could be 500 stores in 300 cities. Some of those cities
could have one store and some could have five.
The only way I can find to do this is to actually type each city into the
criteria field. There must be a way to tell Access to add where certain
criteria are IDENTICAL but I can only find operators. I feel like there is
probably a super simple solution but I have been working on this for three
hours and still can't get it to work. Any help is appreciated!
I don't know how to explain this in a few words so I don't know how to
search for it. I'm sure someone must have asked this question before but I
can't find it.
I'm trying to use an expression query where the criteria are identical. I
want to find total production by city but my production information comes
from stores. There could be 500 stores in 300 cities. Some of those cities
could have one store and some could have five.
The only way I can find to do this is to actually type each city into the
criteria field. There must be a way to tell Access to add where certain
criteria are IDENTICAL but I can only find operators. I feel like there is
probably a super simple solution but I have been working on this for three
hours and still can't get it to work. Any help is appreciated!
django: filter based on values
django: filter based on values
I need to take a set of values, in this case the foreign key liquorID in
LiquorInStore obtained with values() or values_list() and use them to
filter the results by ID of it's parent db, Liquor and return those to the
webpage.
This is the view, I fear I may not be using the variables correctly.
def store(request, store_id=1):
a = Store.objects.get(StoreID=store_id)
b = LiquorInStore.objects.filter(storeID__exact=a).values('liquorID')
args = {}
args['liquors'] = Liquor.objects.filter(id__exact=b)
args['a'] = a
return render(request, 'store.html', args)
Here is the models file as well in case that helps.
class LiquorInStore(models.Model):
StoreLiquorID = models.AutoField(primary_key=True)
liquorID = models.ForeignKey(Liquor)
storeID = models.ForeignKey(Store)
StorePrice = models.DecimalField('Store Price', max_digits=5,
decimal_places=2)
I need to take a set of values, in this case the foreign key liquorID in
LiquorInStore obtained with values() or values_list() and use them to
filter the results by ID of it's parent db, Liquor and return those to the
webpage.
This is the view, I fear I may not be using the variables correctly.
def store(request, store_id=1):
a = Store.objects.get(StoreID=store_id)
b = LiquorInStore.objects.filter(storeID__exact=a).values('liquorID')
args = {}
args['liquors'] = Liquor.objects.filter(id__exact=b)
args['a'] = a
return render(request, 'store.html', args)
Here is the models file as well in case that helps.
class LiquorInStore(models.Model):
StoreLiquorID = models.AutoField(primary_key=True)
liquorID = models.ForeignKey(Liquor)
storeID = models.ForeignKey(Store)
StorePrice = models.DecimalField('Store Price', max_digits=5,
decimal_places=2)
Sorting files according to size recursively
Sorting files according to size recursively
how to scan a folder recursively and find the largest files in the folder,
and sort them by size. I have tried using ls -R -S but it tends to list
the directories as well I need to scan the folders and print the files in
the folder and sub folders in sorted manner.
I tried using find but coudn't find a suitable solution.
how to scan a folder recursively and find the largest files in the folder,
and sort them by size. I have tried using ls -R -S but it tends to list
the directories as well I need to scan the folders and print the files in
the folder and sub folders in sorted manner.
I tried using find but coudn't find a suitable solution.
What is the minimum valid JSON?
What is the minimum valid JSON?
I've carefully read the JSON description http://json.org/ but I'm note
sure I know the answer to the simple question. What strings are the
minimum possible valid JSON?
"string" is the string valid JSON?
43 is the simple number valid JSON?
true is the boolean value a valid JSON?
{} is the empty object a valid JSON?
[] is the empty array a vlid JSON?
I've carefully read the JSON description http://json.org/ but I'm note
sure I know the answer to the simple question. What strings are the
minimum possible valid JSON?
"string" is the string valid JSON?
43 is the simple number valid JSON?
true is the boolean value a valid JSON?
{} is the empty object a valid JSON?
[] is the empty array a vlid JSON?
Countdown Timer using seconds and milliseconds
Countdown Timer using seconds and milliseconds
The goal of my timer is to:
Allow the user to count down from three pre-set times: 15secs, 30 secs, 60
secs The timer will count down to 00:00 and stops. The user can at any
time stop/start time or move countdown to new countdown time.
I have been able to do all of the above except for resetting the countdown
timer when it reaches 00:00. The problem is that when timer hits 00:00 it
no longer correctly starts the timer with the users new choice in time.
(The project is setup over nibs and has references to outlets belonging to
that nib).
@interface TimerController : UIView
@property (strong, nonatomic) IBOutlet UILabel *simplePageTitle;
@property (strong, nonatomic) IBOutlet UILabel *timerText;
- (IBAction)StartStop:(id)sender;
- (IBAction)fifteenSec:(id)sender;
- (IBAction)thirtySec:(id)sender;
- (IBAction)sixtySec:(id)sender;
@property (strong, nonatomic) IBOutlet UIButton *startstopButton;
@property int xtime;
@property NSTimer *millisecTimer;
@property int sec;
@property NSTimer *countdownTimer;
@property BOOL startCountdown;
@property BOOL resetTimer;
@property BOOL fifteen;
@property BOOL thirty;
@property BOOL sixty;
- (IBAction)StartStop:(id)sender {
if([sender isSelected]){
// NSLog(@"simple0");
startCountdown = NO;
[sender setSelected:NO];
} else {
// NSLog(@"simple1");
startCountdown = YES;
[sender setSelected:YES];
}
}
TimerController Implementation
- (IBAction)fifteenSec:(id)sender {
xtime = 1500;
fifteen = YES;
resetTimer = YES;
}
- (IBAction)thirtySec:(id)sender {
xtime = 3000;
thirty = YES;
resetTimer = YES;
}
- (IBAction)sixtySec:(id)sender {
xtime = 6000;
sixty = YES;
resetTimer = YES;
}
Main View controller
-(void)timerRun {
// NSLog(@"Timer Runner");
// IF USER PRESSES STARTCOUNTDOWN DO
if (self.timerPageView.startCountdown) {
if ((seconds >= 0 && milliseconds >= 0) ||
self.timerPageView.resetTimer == YES) {
self.timerPageView.sec = self.timerPageView.sec - 1;
seconds = self.timerPageView.sec / 100;
milliseconds = (self.timerPageView.sec * 10) % 1000;
NSString *timerOutput = [NSString stringWithFormat:@"%i:%.0f",
seconds, milliseconds];
self.timerPageView.timerText.text = timerOutput;
}
else if (((seconds == 0 && milliseconds == 0) &&
self.timerPageView.resetTimer != 0 && self.timerPageView.resetTimer ==
0))
{
NSLog(@"TR1");
NSString *timerOutput = @"0:00";
self.timerPageView.timerText.text = timerOutput;
//self.timerPageView.resetTimer = YES;
self.timerPageView.startCountdown = NO;
}
}
if (self.timerPageView.resetTimer == YES) {
NSLog(@"TR2");
[self setSpeedOfTimer];
}
}
-(void)setTimer
{
// SET TIMER SPACE INTERVALS
NSLog(@"Set Timer");
self.timerPageView.countdownTimer = [NSTimer
scheduledTimerWithTimeInterval:0.01 target:self
selector:@selector(timerRun) userInfo:Nil repeats:YES];
}
-(void)setSpeedOfTimer {
if (self.timerPageView.xtime == 0) {
self.timerPageView.xtime = 6000;
self.timerPageView.sec = self.timerPageView.xtime;
self.timerPageView.resetTimer = NO;
NSString *timerOutput = [NSString stringWithFormat:@"%i:%.0f",
seconds, milliseconds];
self.timerPageView.timerText.text = timerOutput;
NSLog(@"Passed1");
}
else if (self.timerPageView.resetTimer == YES) {
self.timerPageView.sec = self.timerPageView.xtime;
self.timerPageView.resetTimer = NO;
// NSString *timerOutput = [NSString stringWithFormat:@"%i:%.0f",
seconds, milliseconds];
// self.timerPageView.timerText.text = timerOutput;
NSLog(@"Passed2");
}
else {
NSString *timerOutput = @"00:00";
self.timerPageView.sec = self.timerPageView.xtime;
self.timerPageView.timerText.text = timerOutput;
NSLog(@"Passed3");
self.timerPageView.resetTimer = NO;
//self.timerPageView.startCountdown = NO;
}
if (self.timerPageView.sixty == YES) {
self.timerPageView.sec = self.timerPageView.xtime;
NSString *timerOutput = @"60:00";
self.timerPageView.timerText.text = timerOutput;
self.timerPageView.sixty = NO;
self.timerPageView.startCountdown = NO;
self.timerPageView.fifteen = NO;
self.timerPageView.thirty = NO;
NSLog(@"Passed6");
}
else if (self.timerPageView.fifteen == YES) {
NSString *timerOutput = @"15:00";
self.timerPageView.timerText.text = timerOutput;
// self.timerPageView.fifteen = NO;
self.timerPageView.startCountdown = YES;
self.timerPageView.sixty = NO;
self.timerPageView.thirty = NO;
self.timerPageView.fifteen = YES;
NSLog(@"%i", self.timerPageView.fifteen);
NSLog(@"Passed4");
}
else if (self.timerPageView.thirty == YES) {
self.timerPageView.sec = self.timerPageView.xtime;
NSString *timerOutput = @"30:00";
self.timerPageView.timerText.text = timerOutput;
// self.timerPageView.thirty = NO;
self.timerPageView.startCountdown = NO;
self.timerPageView.sixty = NO;
self.timerPageView.fifteen = NO;
NSLog(@"Passed5");
}
}
Any help would be great.
The goal of my timer is to:
Allow the user to count down from three pre-set times: 15secs, 30 secs, 60
secs The timer will count down to 00:00 and stops. The user can at any
time stop/start time or move countdown to new countdown time.
I have been able to do all of the above except for resetting the countdown
timer when it reaches 00:00. The problem is that when timer hits 00:00 it
no longer correctly starts the timer with the users new choice in time.
(The project is setup over nibs and has references to outlets belonging to
that nib).
@interface TimerController : UIView
@property (strong, nonatomic) IBOutlet UILabel *simplePageTitle;
@property (strong, nonatomic) IBOutlet UILabel *timerText;
- (IBAction)StartStop:(id)sender;
- (IBAction)fifteenSec:(id)sender;
- (IBAction)thirtySec:(id)sender;
- (IBAction)sixtySec:(id)sender;
@property (strong, nonatomic) IBOutlet UIButton *startstopButton;
@property int xtime;
@property NSTimer *millisecTimer;
@property int sec;
@property NSTimer *countdownTimer;
@property BOOL startCountdown;
@property BOOL resetTimer;
@property BOOL fifteen;
@property BOOL thirty;
@property BOOL sixty;
- (IBAction)StartStop:(id)sender {
if([sender isSelected]){
// NSLog(@"simple0");
startCountdown = NO;
[sender setSelected:NO];
} else {
// NSLog(@"simple1");
startCountdown = YES;
[sender setSelected:YES];
}
}
TimerController Implementation
- (IBAction)fifteenSec:(id)sender {
xtime = 1500;
fifteen = YES;
resetTimer = YES;
}
- (IBAction)thirtySec:(id)sender {
xtime = 3000;
thirty = YES;
resetTimer = YES;
}
- (IBAction)sixtySec:(id)sender {
xtime = 6000;
sixty = YES;
resetTimer = YES;
}
Main View controller
-(void)timerRun {
// NSLog(@"Timer Runner");
// IF USER PRESSES STARTCOUNTDOWN DO
if (self.timerPageView.startCountdown) {
if ((seconds >= 0 && milliseconds >= 0) ||
self.timerPageView.resetTimer == YES) {
self.timerPageView.sec = self.timerPageView.sec - 1;
seconds = self.timerPageView.sec / 100;
milliseconds = (self.timerPageView.sec * 10) % 1000;
NSString *timerOutput = [NSString stringWithFormat:@"%i:%.0f",
seconds, milliseconds];
self.timerPageView.timerText.text = timerOutput;
}
else if (((seconds == 0 && milliseconds == 0) &&
self.timerPageView.resetTimer != 0 && self.timerPageView.resetTimer ==
0))
{
NSLog(@"TR1");
NSString *timerOutput = @"0:00";
self.timerPageView.timerText.text = timerOutput;
//self.timerPageView.resetTimer = YES;
self.timerPageView.startCountdown = NO;
}
}
if (self.timerPageView.resetTimer == YES) {
NSLog(@"TR2");
[self setSpeedOfTimer];
}
}
-(void)setTimer
{
// SET TIMER SPACE INTERVALS
NSLog(@"Set Timer");
self.timerPageView.countdownTimer = [NSTimer
scheduledTimerWithTimeInterval:0.01 target:self
selector:@selector(timerRun) userInfo:Nil repeats:YES];
}
-(void)setSpeedOfTimer {
if (self.timerPageView.xtime == 0) {
self.timerPageView.xtime = 6000;
self.timerPageView.sec = self.timerPageView.xtime;
self.timerPageView.resetTimer = NO;
NSString *timerOutput = [NSString stringWithFormat:@"%i:%.0f",
seconds, milliseconds];
self.timerPageView.timerText.text = timerOutput;
NSLog(@"Passed1");
}
else if (self.timerPageView.resetTimer == YES) {
self.timerPageView.sec = self.timerPageView.xtime;
self.timerPageView.resetTimer = NO;
// NSString *timerOutput = [NSString stringWithFormat:@"%i:%.0f",
seconds, milliseconds];
// self.timerPageView.timerText.text = timerOutput;
NSLog(@"Passed2");
}
else {
NSString *timerOutput = @"00:00";
self.timerPageView.sec = self.timerPageView.xtime;
self.timerPageView.timerText.text = timerOutput;
NSLog(@"Passed3");
self.timerPageView.resetTimer = NO;
//self.timerPageView.startCountdown = NO;
}
if (self.timerPageView.sixty == YES) {
self.timerPageView.sec = self.timerPageView.xtime;
NSString *timerOutput = @"60:00";
self.timerPageView.timerText.text = timerOutput;
self.timerPageView.sixty = NO;
self.timerPageView.startCountdown = NO;
self.timerPageView.fifteen = NO;
self.timerPageView.thirty = NO;
NSLog(@"Passed6");
}
else if (self.timerPageView.fifteen == YES) {
NSString *timerOutput = @"15:00";
self.timerPageView.timerText.text = timerOutput;
// self.timerPageView.fifteen = NO;
self.timerPageView.startCountdown = YES;
self.timerPageView.sixty = NO;
self.timerPageView.thirty = NO;
self.timerPageView.fifteen = YES;
NSLog(@"%i", self.timerPageView.fifteen);
NSLog(@"Passed4");
}
else if (self.timerPageView.thirty == YES) {
self.timerPageView.sec = self.timerPageView.xtime;
NSString *timerOutput = @"30:00";
self.timerPageView.timerText.text = timerOutput;
// self.timerPageView.thirty = NO;
self.timerPageView.startCountdown = NO;
self.timerPageView.sixty = NO;
self.timerPageView.fifteen = NO;
NSLog(@"Passed5");
}
}
Any help would be great.
Issues with cross domain request
Issues with cross domain request
I work on a site that pulls images from multiple CDNs and I want to log
which image came from which CDN. These CDNs send an extra header param
with the images that names the server that sent the image.
Problems: - Ajax won't work because of the CORS disabled - Can't use a
proxy or put a proxy file on the CDNs because they only serve images
Any tips how to make this work with JS only? Or maybe with Flash?
Is there a way to "observe" the network with Javascript (like Firebug or
Chrome dev tools) ?
I work on a site that pulls images from multiple CDNs and I want to log
which image came from which CDN. These CDNs send an extra header param
with the images that names the server that sent the image.
Problems: - Ajax won't work because of the CORS disabled - Can't use a
proxy or put a proxy file on the CDNs because they only serve images
Any tips how to make this work with JS only? Or maybe with Flash?
Is there a way to "observe" the network with Javascript (like Firebug or
Chrome dev tools) ?
place footer at the bottom of the page
place footer at the bottom of the page
pI want to place a footer at the bottom of the page. It is contained
inside a div. The problem is that if I use fixed positioning, the footer
sticks at the bottom but does not disappear if I scroll up the page. If I
use absolute or relative positioning the footer shows up at the middle of
the page. /p pI want it to stay at the bottom but it should not be sticky
i.e when scroll up, the footer must disappear. It must shows when I scroll
down to bottom and reached end of the page./p pPS: The page contains an
iframe./p pstronghtml/strong/p precodelt;!DOCTYPE HTMLgt; lt;html
lang=engt; lt;headgt; lt;titlegt;Helplt;/titlegt; lt;meta charset=UTF-8gt;
lt;link rel=stylesheet href=style.cssgt; lt;/headgt; lt;bodygt; lt;div
id=headergt; lt;img id=logo src=images/logo.png alt=Logogt; lt;/divgt;
lt;div id=menugt; lt;ulgt; lt;ligt;lt;a href=about.html
target=contentgt;Aboutlt;/agt;lt;/ligt; lt;ligt;lt;a href=support.html
target=contentgt;Supportlt;/agt;lt;/ligt;lt;brgt; lt;ligt;Student
Operation lt;ulgt; lt;ligt;lt;a href=logging_in.html
target=contentgt;Logging Inlt;/agt;lt;/ligt; lt;ligt;lt;a
href=creating_enquiry.html target=contentgt;Creating
Enquirylt;/agt;lt;/ligt; lt;ligt;lt;a href=issuing_prospectus.html
target=contentgt;Issuing Prospectuslt;/agt;lt;/ligt; lt;ligt;lt;a
href=making_admission.html target=contentgt;Making
Admissionlt;/agt;lt;/ligt; lt;ligt;lt;a href=collecting_fees.html
target=contentgt;Collecting Feeslt;/agt;lt;/ligt; lt;ligt;lt;a
href=issuing_kit.html target=contentgt;Issuing Kitlt;/agt;lt;/ligt;
lt;/ulgt; lt;/ligt;lt;brgt; lt;ligt; Batch Operation lt;ulgt; lt;ligt;lt;a
href=creating_batch.html target=contentgt;Creating Batchlt;/agt;lt;/ligt;
lt;ligt;Marking Attendancelt;/ligt; lt;ligt;Transferring Batchlt;/ligt;
lt;/ulgt; lt;/ligt;lt;brgt; lt;ligt; Resource Operation lt;ulgt;
lt;ligt;Center Resource Allocationlt;/ligt; lt;ligt;Student Resource
Allocationlt;/ligt; lt;/ulgt; lt;/ligt;lt;brgt; lt;ligt; Course Operation
lt;ulgt; lt;ligt;Course Typelt;/ligt; lt;ligt;Course Listlt;/ligt;
lt;ligt;Course Modulelt;/ligt; lt;ligt;Course Price Listlt;/ligt;
lt;ligt;Distance University Listlt;/ligt; lt;/ulgt; lt;/ligt;lt;brgt;
lt;ligt; Inventory Operation lt;ulgt; lt;ligt;Kit Managementlt;/ligt;
lt;ligt;Item Categorylt;/ligt; lt;ligt;Item Stocklt;/ligt; lt;ligt;Item
Purchaselt;/ligt; lt;/ulgt; lt;/ligt;lt;brgt; lt;ligt; Admin Operation
lt;ulgt; lt;ligt;Kit Validationlt;/ligt; lt;ligt;Users amp;
Groupslt;/ligt; lt;ligt;Employee Managementlt;/ligt; lt;/ulgt; lt;/ligt;
lt;/ulgt; lt;/divgt; lt;div id=framegt; lt;iframe id=content
name=contentgt;lt;/iframegt; lt;/divgt; lt;div id=footergt; lt;pgt;Footer
textlt;/pgt; lt;/divgt; lt;/bodygt; lt;/htmlgt; /code/pre
pstrongcss/strong/p precodebody { margin: 0; padding: 0; font-family:
sans-serif; font-size: 80%; } #header { background-color: #f8651c;
padding-bottom: 5%; margin: 0; border: 0; } #logo { position: relative;
left: 20px; top: 20px; } #menu { width: 25%; float: left; border-right:
2px solid #a2a2a2; margin: 0; padding: 0; } #content { position: absolute;
height: 93%; width: 74%; padding: 0; margin: 0; border: 0; } #footer{
position: fixed; left: 0; bottom:0; background-color:#000; width:100%;
height: 10px; } /code/pre
pI want to place a footer at the bottom of the page. It is contained
inside a div. The problem is that if I use fixed positioning, the footer
sticks at the bottom but does not disappear if I scroll up the page. If I
use absolute or relative positioning the footer shows up at the middle of
the page. /p pI want it to stay at the bottom but it should not be sticky
i.e when scroll up, the footer must disappear. It must shows when I scroll
down to bottom and reached end of the page./p pPS: The page contains an
iframe./p pstronghtml/strong/p precodelt;!DOCTYPE HTMLgt; lt;html
lang=engt; lt;headgt; lt;titlegt;Helplt;/titlegt; lt;meta charset=UTF-8gt;
lt;link rel=stylesheet href=style.cssgt; lt;/headgt; lt;bodygt; lt;div
id=headergt; lt;img id=logo src=images/logo.png alt=Logogt; lt;/divgt;
lt;div id=menugt; lt;ulgt; lt;ligt;lt;a href=about.html
target=contentgt;Aboutlt;/agt;lt;/ligt; lt;ligt;lt;a href=support.html
target=contentgt;Supportlt;/agt;lt;/ligt;lt;brgt; lt;ligt;Student
Operation lt;ulgt; lt;ligt;lt;a href=logging_in.html
target=contentgt;Logging Inlt;/agt;lt;/ligt; lt;ligt;lt;a
href=creating_enquiry.html target=contentgt;Creating
Enquirylt;/agt;lt;/ligt; lt;ligt;lt;a href=issuing_prospectus.html
target=contentgt;Issuing Prospectuslt;/agt;lt;/ligt; lt;ligt;lt;a
href=making_admission.html target=contentgt;Making
Admissionlt;/agt;lt;/ligt; lt;ligt;lt;a href=collecting_fees.html
target=contentgt;Collecting Feeslt;/agt;lt;/ligt; lt;ligt;lt;a
href=issuing_kit.html target=contentgt;Issuing Kitlt;/agt;lt;/ligt;
lt;/ulgt; lt;/ligt;lt;brgt; lt;ligt; Batch Operation lt;ulgt; lt;ligt;lt;a
href=creating_batch.html target=contentgt;Creating Batchlt;/agt;lt;/ligt;
lt;ligt;Marking Attendancelt;/ligt; lt;ligt;Transferring Batchlt;/ligt;
lt;/ulgt; lt;/ligt;lt;brgt; lt;ligt; Resource Operation lt;ulgt;
lt;ligt;Center Resource Allocationlt;/ligt; lt;ligt;Student Resource
Allocationlt;/ligt; lt;/ulgt; lt;/ligt;lt;brgt; lt;ligt; Course Operation
lt;ulgt; lt;ligt;Course Typelt;/ligt; lt;ligt;Course Listlt;/ligt;
lt;ligt;Course Modulelt;/ligt; lt;ligt;Course Price Listlt;/ligt;
lt;ligt;Distance University Listlt;/ligt; lt;/ulgt; lt;/ligt;lt;brgt;
lt;ligt; Inventory Operation lt;ulgt; lt;ligt;Kit Managementlt;/ligt;
lt;ligt;Item Categorylt;/ligt; lt;ligt;Item Stocklt;/ligt; lt;ligt;Item
Purchaselt;/ligt; lt;/ulgt; lt;/ligt;lt;brgt; lt;ligt; Admin Operation
lt;ulgt; lt;ligt;Kit Validationlt;/ligt; lt;ligt;Users amp;
Groupslt;/ligt; lt;ligt;Employee Managementlt;/ligt; lt;/ulgt; lt;/ligt;
lt;/ulgt; lt;/divgt; lt;div id=framegt; lt;iframe id=content
name=contentgt;lt;/iframegt; lt;/divgt; lt;div id=footergt; lt;pgt;Footer
textlt;/pgt; lt;/divgt; lt;/bodygt; lt;/htmlgt; /code/pre
pstrongcss/strong/p precodebody { margin: 0; padding: 0; font-family:
sans-serif; font-size: 80%; } #header { background-color: #f8651c;
padding-bottom: 5%; margin: 0; border: 0; } #logo { position: relative;
left: 20px; top: 20px; } #menu { width: 25%; float: left; border-right:
2px solid #a2a2a2; margin: 0; padding: 0; } #content { position: absolute;
height: 93%; width: 74%; padding: 0; margin: 0; border: 0; } #footer{
position: fixed; left: 0; bottom:0; background-color:#000; width:100%;
height: 10px; } /code/pre
Friday, 23 August 2013
android edittext remove focus after clicking a button
android edittext remove focus after clicking a button
I have an Activity with an EditText and a Button. When the User clicks on
the EditText, the keyboard is shown and he can type in some Text - fine.
But when the user clicks on the Button I want the EditText to be no more
in focus i.e. the keyboard hides til the user clicks again on the
EditText.
What can I do to 'hide the focus' of the EditText, after the Button is
clicked. Some Code I can add in the OnClick Method of the Button to do
that?
Best Regards
I have an Activity with an EditText and a Button. When the User clicks on
the EditText, the keyboard is shown and he can type in some Text - fine.
But when the user clicks on the Button I want the EditText to be no more
in focus i.e. the keyboard hides til the user clicks again on the
EditText.
What can I do to 'hide the focus' of the EditText, after the Button is
clicked. Some Code I can add in the OnClick Method of the Button to do
that?
Best Regards
Ember Application Alerts
Ember Application Alerts
I currently have an application with the following application and view. I
want to be able to flash these notifications during various points in my
application. My current emberscripts file includes
class Candidate.ApplicationController extends Ember.ArrayController
alerts: Ember.Array.create
success: [
'TaDa!'
]
Candidate.NotificationView = Ember.View.extend
close: (type) ->
@$().slideUp 'normal', =>
@alerts.set type, null
templateName: 'views/alerts'
And my handlebars for the view looks like this:
<div class="alert alert-success">
<i class="icon-remove-sign"></i>
<button type="button" class="close" {{action 'close' 'success'
target='view'}}>×</button>
{{this}}
</div>
{{/each}}
Right now this works fine for the initialized value, but has a few issues.
It does not allow me to add new alerts
Hitting the close button closes all alerts at once
The close function does not remove the alert from the alerts object on the
application controller
How would I go about making this this a bit closer to a session flash
alert message bag like what would be available on the server?
I currently have an application with the following application and view. I
want to be able to flash these notifications during various points in my
application. My current emberscripts file includes
class Candidate.ApplicationController extends Ember.ArrayController
alerts: Ember.Array.create
success: [
'TaDa!'
]
Candidate.NotificationView = Ember.View.extend
close: (type) ->
@$().slideUp 'normal', =>
@alerts.set type, null
templateName: 'views/alerts'
And my handlebars for the view looks like this:
<div class="alert alert-success">
<i class="icon-remove-sign"></i>
<button type="button" class="close" {{action 'close' 'success'
target='view'}}>×</button>
{{this}}
</div>
{{/each}}
Right now this works fine for the initialized value, but has a few issues.
It does not allow me to add new alerts
Hitting the close button closes all alerts at once
The close function does not remove the alert from the alerts object on the
application controller
How would I go about making this this a bit closer to a session flash
alert message bag like what would be available on the server?
running a task in parallel in nodejs
running a task in parallel in nodejs
This seems to work:
function callLoop (n) {
function caller () {
console.log("hello from " + n);
setTimeout(function () {
caller();
}, 10000);
}
caller();
}
for (var i = 0; i < 5; i++) {
callLoop(i);
}
setTimeout, in this example, would instead be a long-running network call.
Is this the "correct" way to parallelize these network calls?
This seems to work:
function callLoop (n) {
function caller () {
console.log("hello from " + n);
setTimeout(function () {
caller();
}, 10000);
}
caller();
}
for (var i = 0; i < 5; i++) {
callLoop(i);
}
setTimeout, in this example, would instead be a long-running network call.
Is this the "correct" way to parallelize these network calls?
Why is port 2121 "closed" when netstat says it is Listening?
Why is port 2121 "closed" when netstat says it is Listening?
I'm running iis 6, and I created two ftp sites. One is running on port 21,
and it works just fine. The other is running on port 2121, and I did all
of the following: 1) I opened port 2121 in my firewall (even turned
firewall off completely). 2) I bound my new ftp site to port 2121, and it
shows that 2121 is bound by it. 3) I ran a elevated cmd prompt and typed
netstat -a and it shows port 2121 is "listening". 4) I browse on the local
system to ftp:// localhost:2121and it goes straight to the FTP server, no
problems.
Yet when I try to go to the ftp server from a computer that is connected
to a different internet provider (aka, my cell phone), it times out trying
to connect. When I go to any port checker website and tell it to test to
see if my port is open, it says "port 2121 is closed" on my site. Huh?
Netstat says it is "listening"?
So I tried also binding port 5999, and that times out too.
My "site" is a hosted VPS server provided by myhosting.com, so I trust
that they wouldn't be blocking any of my ports. That should answer your
questions regarding whether or not I am behind a router that isn't
forwarding the port.
Any help would be appreciated.
I'm running iis 6, and I created two ftp sites. One is running on port 21,
and it works just fine. The other is running on port 2121, and I did all
of the following: 1) I opened port 2121 in my firewall (even turned
firewall off completely). 2) I bound my new ftp site to port 2121, and it
shows that 2121 is bound by it. 3) I ran a elevated cmd prompt and typed
netstat -a and it shows port 2121 is "listening". 4) I browse on the local
system to ftp:// localhost:2121and it goes straight to the FTP server, no
problems.
Yet when I try to go to the ftp server from a computer that is connected
to a different internet provider (aka, my cell phone), it times out trying
to connect. When I go to any port checker website and tell it to test to
see if my port is open, it says "port 2121 is closed" on my site. Huh?
Netstat says it is "listening"?
So I tried also binding port 5999, and that times out too.
My "site" is a hosted VPS server provided by myhosting.com, so I trust
that they wouldn't be blocking any of my ports. That should answer your
questions regarding whether or not I am behind a router that isn't
forwarding the port.
Any help would be appreciated.
Curl fail to retrieve HTTPS content
Curl fail to retrieve HTTPS content
i've an issue on my production server running on Debian 6 (apt-get
update;apt-get upgrade done with success).
When I call an HTTPS (StartSSL) server I got an error message on Debian 6 :
#> curl --version
curl 7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o
zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s
rtsp scp sftp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
#> curl https://mydomain.com/api/
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify
failed
More details here: http://curl.haxx.se/docs/sslcerts.html
But when I call the same address on Debian 7 (server is up-to-date too),
everything working well :
#> curl --version
curl 7.26.0 (x86_64-pc-linux-gnu) libcurl/7.26.0 OpenSSL/1.0.1e zlib/1.2.7
libidn/1.25 libssh2/1.4.2 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s
rtmp rtsp scp sftp smtp smtps telnet tftp
Features: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz
TLS-SRP
#> curl https://mydomain.com/api/
{'code':'ko', 'message':'ERR_AUTH_BASIC_NEEDED'}
Do you have any idea why HTTPS fail on Curl Debian 6 and works with Debian
7 curl ?
i've an issue on my production server running on Debian 6 (apt-get
update;apt-get upgrade done with success).
When I call an HTTPS (StartSSL) server I got an error message on Debian 6 :
#> curl --version
curl 7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o
zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s
rtsp scp sftp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
#> curl https://mydomain.com/api/
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify
failed
More details here: http://curl.haxx.se/docs/sslcerts.html
But when I call the same address on Debian 7 (server is up-to-date too),
everything working well :
#> curl --version
curl 7.26.0 (x86_64-pc-linux-gnu) libcurl/7.26.0 OpenSSL/1.0.1e zlib/1.2.7
libidn/1.25 libssh2/1.4.2 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s
rtmp rtsp scp sftp smtp smtps telnet tftp
Features: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz
TLS-SRP
#> curl https://mydomain.com/api/
{'code':'ko', 'message':'ERR_AUTH_BASIC_NEEDED'}
Do you have any idea why HTTPS fail on Curl Debian 6 and works with Debian
7 curl ?
Thursday, 22 August 2013
ttyS1 loopback test
ttyS1 loopback test
While trying to do a loop back test on ttyS1, I am able to read the data
from ttyS1 without a loop back connector connected to my ttyS1 port.
Please suggest how I can clear ttyS1 buffer so that data is only read when
I have the loop back connector connected.
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <termios.h>
#define UART_SPEED B115200
char buf[512];
void init_serial (int fd)
{
struct termios termios;
int res;
res = tcgetattr (fd, &termios);
if (res < 0) {
fprintf (stderr, "Termios get error: %s\n", strerror (errno));
exit (-1);
}
cfsetispeed (&termios, UART_SPEED);
cfsetospeed (&termios, UART_SPEED);
termios.c_iflag &= ~(IGNPAR | IXON | IXOFF);
termios.c_iflag |= IGNPAR;
termios.c_cflag &= ~(CSIZE | PARENB | CSTOPB | CREAD | CLOCAL);
termios.c_cflag |= CS8;
termios.c_cflag |= CREAD;
termios.c_cflag |= CLOCAL;
termios.c_lflag &= ~(ICANON | ECHO);
termios.c_cc[VMIN] = 1;
termios.c_cc[VTIME] = 0;
res = tcsetattr (fd, TCSANOW, &termios);
if (res < 0) {
fprintf (stderr, "Termios set error: %s\n", strerror (errno));
exit (-1);
}
}
int main (int argc, char **argv)
{
int fd,fi;
int res;
int i;
if (argc < 2) {
fprintf (stderr, "Please enter device name\n");
return -1;
}
fd = open (argv[1], O_RDWR | O_NOCTTY);
if (fd < 0) {
fprintf (stderr, "Cannot open %s: %s\n", argv[1], strerror(errno));
return -1;
}
init_serial (fd);
tcflush(fd, TCIOFLUSH);
res = write (fd, "P=21\r\n", 7);
if (res < 0) {
fprintf (stderr, "Write error: %s\n", strerror(errno));
return -1;
}
tcdrain (fd);
res = read (fd, buf, 512);
fi=close(fd);
printf("%s\n","close retuns");
printf ("%d\n", fi);
if (res < 0) {
fprintf (stderr, "Read error: %s\n", strerror(errno));
return -1;
}
for (i=0; i<res; i++) {
printf ("%c", buf[i]);
}
for (i=0; i<512; i++) {
buf[i]=0;
}
return 0;
}
While trying to do a loop back test on ttyS1, I am able to read the data
from ttyS1 without a loop back connector connected to my ttyS1 port.
Please suggest how I can clear ttyS1 buffer so that data is only read when
I have the loop back connector connected.
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <termios.h>
#define UART_SPEED B115200
char buf[512];
void init_serial (int fd)
{
struct termios termios;
int res;
res = tcgetattr (fd, &termios);
if (res < 0) {
fprintf (stderr, "Termios get error: %s\n", strerror (errno));
exit (-1);
}
cfsetispeed (&termios, UART_SPEED);
cfsetospeed (&termios, UART_SPEED);
termios.c_iflag &= ~(IGNPAR | IXON | IXOFF);
termios.c_iflag |= IGNPAR;
termios.c_cflag &= ~(CSIZE | PARENB | CSTOPB | CREAD | CLOCAL);
termios.c_cflag |= CS8;
termios.c_cflag |= CREAD;
termios.c_cflag |= CLOCAL;
termios.c_lflag &= ~(ICANON | ECHO);
termios.c_cc[VMIN] = 1;
termios.c_cc[VTIME] = 0;
res = tcsetattr (fd, TCSANOW, &termios);
if (res < 0) {
fprintf (stderr, "Termios set error: %s\n", strerror (errno));
exit (-1);
}
}
int main (int argc, char **argv)
{
int fd,fi;
int res;
int i;
if (argc < 2) {
fprintf (stderr, "Please enter device name\n");
return -1;
}
fd = open (argv[1], O_RDWR | O_NOCTTY);
if (fd < 0) {
fprintf (stderr, "Cannot open %s: %s\n", argv[1], strerror(errno));
return -1;
}
init_serial (fd);
tcflush(fd, TCIOFLUSH);
res = write (fd, "P=21\r\n", 7);
if (res < 0) {
fprintf (stderr, "Write error: %s\n", strerror(errno));
return -1;
}
tcdrain (fd);
res = read (fd, buf, 512);
fi=close(fd);
printf("%s\n","close retuns");
printf ("%d\n", fi);
if (res < 0) {
fprintf (stderr, "Read error: %s\n", strerror(errno));
return -1;
}
for (i=0; i<res; i++) {
printf ("%c", buf[i]);
}
for (i=0; i<512; i++) {
buf[i]=0;
}
return 0;
}
perl non-greedy regex case matching too much
perl non-greedy regex case matching too much
I have a file with something like
<post href="http://example.com/" description="Example website" tag="more
text"/>
What I want to get is Example website. Doing cat file | perl -pe
's/.*description=".*?"//' works as expected, and I get tag="more text"/>,
but when trying cat file | perl -pe 's/.*description="(.*)?"/\1/' I get
Example website" tag="more text/>, while I was expecting to get Example
website. So it seems there's something with the capturing and the
backreference that is not working as intended, and I'm not sure how to
solve it.
I could always do cat file | perl -pe 's/.*description="//;s/".*//', sure,
but I really want to understand how to solve it with the regular
expression, instead of doing two substitutions.
I have a file with something like
<post href="http://example.com/" description="Example website" tag="more
text"/>
What I want to get is Example website. Doing cat file | perl -pe
's/.*description=".*?"//' works as expected, and I get tag="more text"/>,
but when trying cat file | perl -pe 's/.*description="(.*)?"/\1/' I get
Example website" tag="more text/>, while I was expecting to get Example
website. So it seems there's something with the capturing and the
backreference that is not working as intended, and I'm not sure how to
solve it.
I could always do cat file | perl -pe 's/.*description="//;s/".*//', sure,
but I really want to understand how to solve it with the regular
expression, instead of doing two substitutions.
RestKit 0.20 failed to fetch Entity
RestKit 0.20 failed to fetch Entity
I am using restkit 0.2 to perform a post request to a server. Here is the
setup code:
- (void)setupRestKit { //create RestKit object managers, one for API and
one fore OAuth due to being seperate endpoings. API Object manager is
default. RKObjectManager *apiObjectManager = [self
instantiateAPIObjectManager]; _oauthObjectManager = [self
instantiateOAuthObjectManager];
//create object store for core data persistence
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc]
initWithManagedObjectModel:[NSManagedObjectModel
mergedModelFromBundles:nil]];
//provide store to object manager
_oauthObjectManager.managedObjectStore = managedObjectStore;
apiObjectManager.managedObjectStore = managedObjectStore;
//add default formatter for timestamp strings
NSTimeZone *UTC = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
[RKObjectMapping addDefaultDateFormatterForString:@"yyyy-MM-dd HH:mm:ss"
inTimeZone:UTC];
// Register mappings
[KaptureOAuthToken
registerEntityMappingWithObjectManager:self.oauthObjectManager];
[managedObjectStore createPersistentStoreCoordinator];
//create sqlite persistant store to cache data to disk
NSString *path = [RKApplicationDataDirectory()
stringByAppendingPathComponent:@"kapture.sqlite"];
NSError *error;
NSPersistentStore *persistentStore = [managedObjectStore
addSQLitePersistentStoreAtPath:path
fromSeedDatabaseAtPath:nil
withConfiguration:nil
options:@{
NSInferMappingModelAutomaticallyOption:
@YES,
NSMigratePersistentStoresAutomaticallyOption:
@YES
}
error:&error];
NSAssert(persistentStore, @"Failed to add persistent store with error:
%@", error);
//create in-memory cache so objects are not persisted more than once
managedObjectStore.managedObjectCache = [[RKInMemoryManagedObjectCache
alloc]
initWithManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext];
//create contexts for core data objects
[managedObjectStore createManagedObjectContexts];
}
(RKObjectManager *)instantiateAPIObjectManager { RKObjectManager
*objectManager = [RKObjectManager managerWithBaseURL:[NSURL
URLWithString:[Environment sharedInstance].apiBaseURL]];
//show network activity indicator when loading network resources
[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
//set api key as default http header for requests
[objectManager.HTTPClient setDefaultHeader:[Environment
sharedInstance].apiKey value:@"Api-Key"];
//set http header for device type (i.e. iPhone 4) and version of the app
NSString *deviceName = [NSString stringWithFormat:@"%@ %@", [[UIDevice
currentDevice] model], [[UIDevice currentDevice] systemVersion]];
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *majorVersion = [infoDictionary
objectForKey:@"CFBundleShortVersionString"]; [objectManager.HTTPClient
setDefaultHeader:@"X-Requested-With" value:[NSString stringWithFormat:@"%@
- %@", deviceName, majorVersion]];
//set http header for api mime type [objectManager
setAcceptHeaderWithMIMEType:[Environment
sharedInstance].apiAcceptenceHeader];
objectManager.HTTPClient.allowsInvalidSSLCertificate = YES;
return objectManager; }
(RKObjectManager *)instantiateOAuthObjectManager { RKObjectManager
*objectManager = [RKObjectManager managerWithBaseURL:[NSURL
URLWithString:[Environment sharedInstance].apiOAuthBaseURL]];
//show network activity indicator when loading network resources
[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
objectManager.HTTPClient.allowsInvalidSSLCertificate = YES;
return objectManager; }
-(void)setupNetworkCaching { NSURLCache *URLCache = [[NSURLCache alloc]
initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024
diskPath:nil]; [NSURLCache setSharedURLCache:URLCache]; }
And EntityMappings are configured via a category on NSManagedObject
subclass via these two methods
+ (void)registerEntityMappingWithObjectManager:(RKObjectManager
*)objectManager { RKResponseDescriptor *responseDescriptor;
responseDescriptor = [RKResponseDescriptor
responseDescriptorWithMapping:[self
entityMappingUsingStore:objectManager.managedObjectStore]
method:RKRequestMethodPOST
pathPattern:@"/"
keyPath:@""
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[objectManager addResponseDescriptor:responseDescriptor];
}
(RKEntityMapping *)entityMappingUsingStore:(RKManagedObjectStore *)store {
RKEntityMapping *mapping = [RKEntityMapping
mappingForEntityForName:NSStringFromClass([KaptureOAuthToken class])
inManagedObjectStore:store];
NSDictionary *attributesDict = @{@"access_token": @"accessToken",
@"token_type": @"tokenType", @"expires": @"expirationDate", @"expires_in":
@"expiresIn", @"refresh_token": @"refreshToken"};
mapping.identificationAttributes = @[@"accessToken"];
[mapping addAttributeMappingsFromDictionary:attributesDict];
return mapping; }
My question is this: when I try to perform a POST request
[oauthObjectManager postObject:nil path:@"/" parameters:params
success:^(RKObjectRequestOperation *operation, RKMappingResult
*mappingResult) { dispatch_async(dispatch_get_main_queue(), ^(){
completion(YES, nil, mappingResult); }); }
failure:^(RKObjectRequestOperation *operation, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^(){ [self
notifyLoginError:error forNetwork:network]; }); }];
I get an expected response from the server and everything seems to go
through fine, but I get this error in the command line.
2013-08-22 17:29:11.949 Kapture[25335:1007] W
restkit.core_data.cache:RKEntityByAttributeCache.m:173 Failed to load
entity cache. Failed to execute fetch request: (entity: KaptureOAuthToken;
predicate: ((null)); sortDescriptors: ((null)); type:
NSDictionaryResultType; includesPendingChanges: NO; propertiesToFetch: ((
"(), name accessToken, isOptional 1, isTransient 0, entity
KaptureOAuthToken, renamingIdentifier accessToken, validation predicates
(\n), warnings (\n), versionHashModifier (null)\n userInfo {\n},
attributeType 700 , attributeValueClassName NSString, defaultValue
(null)", "(), name objectID, isOptional 1, isTransient 0, entity (null),
renamingIdentifier objectID, validation predicates (\n), warnings (\n),
versionHashModifier (null)\n userInfo {\n}" )); )
It seems that it cannot find the entity in the cache but I'm really not
sure. Any information is appreciated as always!
I am using restkit 0.2 to perform a post request to a server. Here is the
setup code:
- (void)setupRestKit { //create RestKit object managers, one for API and
one fore OAuth due to being seperate endpoings. API Object manager is
default. RKObjectManager *apiObjectManager = [self
instantiateAPIObjectManager]; _oauthObjectManager = [self
instantiateOAuthObjectManager];
//create object store for core data persistence
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc]
initWithManagedObjectModel:[NSManagedObjectModel
mergedModelFromBundles:nil]];
//provide store to object manager
_oauthObjectManager.managedObjectStore = managedObjectStore;
apiObjectManager.managedObjectStore = managedObjectStore;
//add default formatter for timestamp strings
NSTimeZone *UTC = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
[RKObjectMapping addDefaultDateFormatterForString:@"yyyy-MM-dd HH:mm:ss"
inTimeZone:UTC];
// Register mappings
[KaptureOAuthToken
registerEntityMappingWithObjectManager:self.oauthObjectManager];
[managedObjectStore createPersistentStoreCoordinator];
//create sqlite persistant store to cache data to disk
NSString *path = [RKApplicationDataDirectory()
stringByAppendingPathComponent:@"kapture.sqlite"];
NSError *error;
NSPersistentStore *persistentStore = [managedObjectStore
addSQLitePersistentStoreAtPath:path
fromSeedDatabaseAtPath:nil
withConfiguration:nil
options:@{
NSInferMappingModelAutomaticallyOption:
@YES,
NSMigratePersistentStoresAutomaticallyOption:
@YES
}
error:&error];
NSAssert(persistentStore, @"Failed to add persistent store with error:
%@", error);
//create in-memory cache so objects are not persisted more than once
managedObjectStore.managedObjectCache = [[RKInMemoryManagedObjectCache
alloc]
initWithManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext];
//create contexts for core data objects
[managedObjectStore createManagedObjectContexts];
}
(RKObjectManager *)instantiateAPIObjectManager { RKObjectManager
*objectManager = [RKObjectManager managerWithBaseURL:[NSURL
URLWithString:[Environment sharedInstance].apiBaseURL]];
//show network activity indicator when loading network resources
[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
//set api key as default http header for requests
[objectManager.HTTPClient setDefaultHeader:[Environment
sharedInstance].apiKey value:@"Api-Key"];
//set http header for device type (i.e. iPhone 4) and version of the app
NSString *deviceName = [NSString stringWithFormat:@"%@ %@", [[UIDevice
currentDevice] model], [[UIDevice currentDevice] systemVersion]];
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *majorVersion = [infoDictionary
objectForKey:@"CFBundleShortVersionString"]; [objectManager.HTTPClient
setDefaultHeader:@"X-Requested-With" value:[NSString stringWithFormat:@"%@
- %@", deviceName, majorVersion]];
//set http header for api mime type [objectManager
setAcceptHeaderWithMIMEType:[Environment
sharedInstance].apiAcceptenceHeader];
objectManager.HTTPClient.allowsInvalidSSLCertificate = YES;
return objectManager; }
(RKObjectManager *)instantiateOAuthObjectManager { RKObjectManager
*objectManager = [RKObjectManager managerWithBaseURL:[NSURL
URLWithString:[Environment sharedInstance].apiOAuthBaseURL]];
//show network activity indicator when loading network resources
[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
objectManager.HTTPClient.allowsInvalidSSLCertificate = YES;
return objectManager; }
-(void)setupNetworkCaching { NSURLCache *URLCache = [[NSURLCache alloc]
initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024
diskPath:nil]; [NSURLCache setSharedURLCache:URLCache]; }
And EntityMappings are configured via a category on NSManagedObject
subclass via these two methods
+ (void)registerEntityMappingWithObjectManager:(RKObjectManager
*)objectManager { RKResponseDescriptor *responseDescriptor;
responseDescriptor = [RKResponseDescriptor
responseDescriptorWithMapping:[self
entityMappingUsingStore:objectManager.managedObjectStore]
method:RKRequestMethodPOST
pathPattern:@"/"
keyPath:@""
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[objectManager addResponseDescriptor:responseDescriptor];
}
(RKEntityMapping *)entityMappingUsingStore:(RKManagedObjectStore *)store {
RKEntityMapping *mapping = [RKEntityMapping
mappingForEntityForName:NSStringFromClass([KaptureOAuthToken class])
inManagedObjectStore:store];
NSDictionary *attributesDict = @{@"access_token": @"accessToken",
@"token_type": @"tokenType", @"expires": @"expirationDate", @"expires_in":
@"expiresIn", @"refresh_token": @"refreshToken"};
mapping.identificationAttributes = @[@"accessToken"];
[mapping addAttributeMappingsFromDictionary:attributesDict];
return mapping; }
My question is this: when I try to perform a POST request
[oauthObjectManager postObject:nil path:@"/" parameters:params
success:^(RKObjectRequestOperation *operation, RKMappingResult
*mappingResult) { dispatch_async(dispatch_get_main_queue(), ^(){
completion(YES, nil, mappingResult); }); }
failure:^(RKObjectRequestOperation *operation, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^(){ [self
notifyLoginError:error forNetwork:network]; }); }];
I get an expected response from the server and everything seems to go
through fine, but I get this error in the command line.
2013-08-22 17:29:11.949 Kapture[25335:1007] W
restkit.core_data.cache:RKEntityByAttributeCache.m:173 Failed to load
entity cache. Failed to execute fetch request: (entity: KaptureOAuthToken;
predicate: ((null)); sortDescriptors: ((null)); type:
NSDictionaryResultType; includesPendingChanges: NO; propertiesToFetch: ((
"(), name accessToken, isOptional 1, isTransient 0, entity
KaptureOAuthToken, renamingIdentifier accessToken, validation predicates
(\n), warnings (\n), versionHashModifier (null)\n userInfo {\n},
attributeType 700 , attributeValueClassName NSString, defaultValue
(null)", "(), name objectID, isOptional 1, isTransient 0, entity (null),
renamingIdentifier objectID, validation predicates (\n), warnings (\n),
versionHashModifier (null)\n userInfo {\n}" )); )
It seems that it cannot find the entity in the cache but I'm really not
sure. Any information is appreciated as always!
How do I display a div tag as an example?
How do I display a div tag as an example?
I am working on a how-to and I want to show on the user's screen the line
like this:
Example: <div class="something>Example</div>
Obviously, the browser will render it as an actual div so how do I display
it as just text?
I am working on a how-to and I want to show on the user's screen the line
like this:
Example: <div class="something>Example</div>
Obviously, the browser will render it as an actual div so how do I display
it as just text?
Regex to detect urls with '?' character at the end
Regex to detect urls with '?' character at the end
I found many solutions, but none was useful for me.
Let's say, as an example, I want to find URLs that start with www. and end
with a space or ?. In this case, I really mean it ends in a ?, not that
it's necessarily a CGI-related URL.
I'm trying to use the regex
var r = /(^|[\s\?])(www\..+?(?=([\s]|\?|($))))/g;
My sample use: http://jsfiddle.net/DKNat/2/
How can I use \? in a regex to prevent the end of the URL containing /
before ??
I found many solutions, but none was useful for me.
Let's say, as an example, I want to find URLs that start with www. and end
with a space or ?. In this case, I really mean it ends in a ?, not that
it's necessarily a CGI-related URL.
I'm trying to use the regex
var r = /(^|[\s\?])(www\..+?(?=([\s]|\?|($))))/g;
My sample use: http://jsfiddle.net/DKNat/2/
How can I use \? in a regex to prevent the end of the URL containing /
before ??
Get defined CSS classes by pattern
Get defined CSS classes by pattern
Is there any possiblity get all defined CSS classes matching a pattern?
For example if you have some CSS rules defined like:
.my-custom-class-one {}
.my-custom-class-two {}
.my-custom-class-three {}
I'd like to have something like:
console.log( getClassNamesByPattern('my-custom-class-*') );
returning a list of the matching classes:
[ 'my-custom-class-one', 'my-custom-class-two', 'my-custom-class-three' ]
There is no markup matching those selectors (yet). Actually that's what
i'd like to create...
I thought maybe something like getComputedStyles would do the trick, but
since it expects an element, which doesn't exists, it doesn't seem to be
of much use...
Is there any possiblity get all defined CSS classes matching a pattern?
For example if you have some CSS rules defined like:
.my-custom-class-one {}
.my-custom-class-two {}
.my-custom-class-three {}
I'd like to have something like:
console.log( getClassNamesByPattern('my-custom-class-*') );
returning a list of the matching classes:
[ 'my-custom-class-one', 'my-custom-class-two', 'my-custom-class-three' ]
There is no markup matching those selectors (yet). Actually that's what
i'd like to create...
I thought maybe something like getComputedStyles would do the trick, but
since it expects an element, which doesn't exists, it doesn't seem to be
of much use...
Unset an Exception that is thrown
Unset an Exception that is thrown
Is it possible to unset an Exception that got thrown, so that it is not
getting catched in PHP?
class TestException extends \Exception
{
public function __construct($msg = null, $errno = null) {
parent::_construct($msg, $errno);
unset($this);
}
}
function test() {
throw new TestException();
}
try {
// Throws Exception
test();
// Exception triggered but unset by itself,
// so it cannot be catched and does not result in an error
} catch (\Exception $e) {
print_r($e);
}
So by the code above, an Exception gets thrown but not catched and does
not result in a PHP error?
Is it possible to unset an Exception that got thrown, so that it is not
getting catched in PHP?
class TestException extends \Exception
{
public function __construct($msg = null, $errno = null) {
parent::_construct($msg, $errno);
unset($this);
}
}
function test() {
throw new TestException();
}
try {
// Throws Exception
test();
// Exception triggered but unset by itself,
// so it cannot be catched and does not result in an error
} catch (\Exception $e) {
print_r($e);
}
So by the code above, an Exception gets thrown but not catched and does
not result in a PHP error?
Wednesday, 21 August 2013
Ubuntu 12.04 VM on Windows 8 Hyper-V - No Network Connectivity
Ubuntu 12.04 VM on Windows 8 Hyper-V - No Network Connectivity
I have been attempting to connect my Ubuntu 12.04 Virtual Machine to the
internet. I have been searching and found some information but have not
been successful so far. I have also tried Linux Mint and no network
connectivity there either.
My Adapter Settings:
Ubuntu Network Setup in HyperV
HyperV Virtual Switch Manager
I'm not sure if this is the issue, but it seems likely. However, anytime I
attempt to make the External Switch a Hyper-V Extensible Virtual Switch I
get the message shown below and I am unable to set that property.
Any help is appreciated.
If more information is needed please let me know. I tried to be as
thorough as possible
I have been attempting to connect my Ubuntu 12.04 Virtual Machine to the
internet. I have been searching and found some information but have not
been successful so far. I have also tried Linux Mint and no network
connectivity there either.
My Adapter Settings:
Ubuntu Network Setup in HyperV
HyperV Virtual Switch Manager
I'm not sure if this is the issue, but it seems likely. However, anytime I
attempt to make the External Switch a Hyper-V Extensible Virtual Switch I
get the message shown below and I am unable to set that property.
Any help is appreciated.
If more information is needed please let me know. I tried to be as
thorough as possible
I am trying to download ubuntu onto a USB but when i press browse on the USB linux downlader the file for ubuntu doesn't show up
I am trying to download ubuntu onto a USB but when i press browse on the
USB linux downlader the file for ubuntu doesn't show up
How do I download ubuntu onto my USB? I read the instructions but it still
doesn't work because the file isn't showing up when I press browse
USB linux downlader the file for ubuntu doesn't show up
How do I download ubuntu onto my USB? I read the instructions but it still
doesn't work because the file isn't showing up when I press browse
Is it possible to rollback a SQL Server transaction without suppressing the error?
Is it possible to rollback a SQL Server transaction without suppressing
the error?
This StackOverflow answer provides an elegant way to use TRY CATCH
ROLLBACK TRANSACTION, but it suppresses the error information.
Is there any way to rollback a transaction that doesn't suppress the error
that resulted in the rollback in the first place?
Here's an example T-SQL script based on the above method:
DECLARE @Table TABLE (
ID INT PRIMARY KEY
)
BEGIN TRY
BEGIN TRANSACTION
INSERT INTO @Table VALUES (1), (1)
COMMIT TRANSACTION
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION
END CATCH;
Thanks!
the error?
This StackOverflow answer provides an elegant way to use TRY CATCH
ROLLBACK TRANSACTION, but it suppresses the error information.
Is there any way to rollback a transaction that doesn't suppress the error
that resulted in the rollback in the first place?
Here's an example T-SQL script based on the above method:
DECLARE @Table TABLE (
ID INT PRIMARY KEY
)
BEGIN TRY
BEGIN TRANSACTION
INSERT INTO @Table VALUES (1), (1)
COMMIT TRANSACTION
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION
END CATCH;
Thanks!
Change letters into using batch
Change letters into using batch
I'm trying to create a batch file that will change some input text and
change them into their number counterparts of a=1,b=2,c=3 etc for example:
@echo off
set /p text=
echo :: %text% :: echo Is this correct? pause cls
for /f delims=: %%i in (%text%) do ( [something that changes the letters
into numbers] )
Thanks in advanced
I'm trying to create a batch file that will change some input text and
change them into their number counterparts of a=1,b=2,c=3 etc for example:
@echo off
set /p text=
echo :: %text% :: echo Is this correct? pause cls
for /f delims=: %%i in (%text%) do ( [something that changes the letters
into numbers] )
Thanks in advanced
Configuring WSO2 ESB to Work with an HTTP Proxy Server for Handling SOAP Requests and Responses
Configuring WSO2 ESB to Work with an HTTP Proxy Server for Handling SOAP
Requests and Responses
Our WSO2 ESB server (Windows, v4.7.0) runs on a machine on which all
connections go through a corporate http proxy server.
We have both a WSDL-based proxy service and a pass-through proxy service
configured on our WSO2 ESB server (both have published WSDL with in-line
specification). However, when we try to test these WSDL's generated by
WSO2 ESB with Soap UI, there is no response.
We are running WSO2 ESB server with the following arguments:
C:\wso2\wso2esb-4.7.0\bin>wso2server.bat -Dhttp.proxyHost=10.0.0.3
-Dhttp.proxyPort=8080 -Dhttps.proxyHost=10.0.0.3 -Dhttps.proxyPort=8080
Here, 10.0.0.3 is the IP address of the corporate http proxy server and
8080 is the port for that.
We also analyze the traffic (packets) with WireShark (using filter: ip.dst
== 10.0.0.3) to see what is going on.
When we send a request to wsdl-based proxy service WSDL in Soap UI, we can
trace that the request goes to the correct endpoint (via http proxy
server) but there's no response. It seems to us that the response is
somehow lost between the http proxy server and WSO2 ESB or we are missing
something to tell WSO2 ESB to handle such responses whose requests are
directed through an http proxy server.
When we send the same request to pass-through proxy service WSDL in Soap
UI, it is more problematic when we investigate Wireshark trace because the
request seems to fail reaching the correct endpoint.
How do we make sure that WSO2 ESB works with our corporate http proxy
server in directing and receiving requests / responses?
Requests and Responses
Our WSO2 ESB server (Windows, v4.7.0) runs on a machine on which all
connections go through a corporate http proxy server.
We have both a WSDL-based proxy service and a pass-through proxy service
configured on our WSO2 ESB server (both have published WSDL with in-line
specification). However, when we try to test these WSDL's generated by
WSO2 ESB with Soap UI, there is no response.
We are running WSO2 ESB server with the following arguments:
C:\wso2\wso2esb-4.7.0\bin>wso2server.bat -Dhttp.proxyHost=10.0.0.3
-Dhttp.proxyPort=8080 -Dhttps.proxyHost=10.0.0.3 -Dhttps.proxyPort=8080
Here, 10.0.0.3 is the IP address of the corporate http proxy server and
8080 is the port for that.
We also analyze the traffic (packets) with WireShark (using filter: ip.dst
== 10.0.0.3) to see what is going on.
When we send a request to wsdl-based proxy service WSDL in Soap UI, we can
trace that the request goes to the correct endpoint (via http proxy
server) but there's no response. It seems to us that the response is
somehow lost between the http proxy server and WSO2 ESB or we are missing
something to tell WSO2 ESB to handle such responses whose requests are
directed through an http proxy server.
When we send the same request to pass-through proxy service WSDL in Soap
UI, it is more problematic when we investigate Wireshark trace because the
request seems to fail reaching the correct endpoint.
How do we make sure that WSO2 ESB works with our corporate http proxy
server in directing and receiving requests / responses?
Don't understand why this JavaScript function can be called one way but not the other
Don't understand why this JavaScript function can be called one way but
not the other
I recently started learning JavaScript for the purpose of creating HTML5
games, and I've come across a behavior that I'm having a hard time
understanding.
As an example, I have a constructor that initializes new sprites with an
array of actions that they should carry out every time the game updates
(such as animating, moving, etc.). This JSFiddle demonstrates a basic
implementation.
Essentially, I'm confused as to why this doesn't work...
Sprite = function () {
this.actions = [this.animate];
};
Sprite.prototype = {
animate: function () { /* animate the sprite */ },
update: function () {
this.actions[0](); // doesn't do anything (?)
}
};
...but this does
Sprite = function () {
this.actions = [this.animate];
this.holder = 'whatever';
};
Sprite.prototype = {
animate: function () { /* animate the sprite */ },
update: function () {
this.holder = this.actions[0];
this.holder(); // executes animate function as desired
}
};
To my inexperienced eyes, both examples seem like they should do the exact
same thing. So why does nothing happen if I call this.actions[0]()
directly, but if I assign this.actions[0] to this.holder and then call
this.holder(), it works just fine?
not the other
I recently started learning JavaScript for the purpose of creating HTML5
games, and I've come across a behavior that I'm having a hard time
understanding.
As an example, I have a constructor that initializes new sprites with an
array of actions that they should carry out every time the game updates
(such as animating, moving, etc.). This JSFiddle demonstrates a basic
implementation.
Essentially, I'm confused as to why this doesn't work...
Sprite = function () {
this.actions = [this.animate];
};
Sprite.prototype = {
animate: function () { /* animate the sprite */ },
update: function () {
this.actions[0](); // doesn't do anything (?)
}
};
...but this does
Sprite = function () {
this.actions = [this.animate];
this.holder = 'whatever';
};
Sprite.prototype = {
animate: function () { /* animate the sprite */ },
update: function () {
this.holder = this.actions[0];
this.holder(); // executes animate function as desired
}
};
To my inexperienced eyes, both examples seem like they should do the exact
same thing. So why does nothing happen if I call this.actions[0]()
directly, but if I assign this.actions[0] to this.holder and then call
this.holder(), it works just fine?
Tuesday, 20 August 2013
How to change the data template of control at run time
How to change the data template of control at run time
I have a wpf application where have four radio buttons.
I want to change the content of the listview depending on the radio box
that is being checked.
I have defined the data template but cannot find the way to assign them to
the listview on radio box checked event . Below are the data templates.
<Window.Resources>
<DataTemplate x:Key="OneTimeDataTemplate">
<GroupBox Height="160" HorizontalAlignment="Left"
Margin="104,23,0,0" Name="gbOneTime" VerticalAlignment="Top"
Width="453">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36*" />
<ColumnDefinition Width="418*" />
</Grid.ColumnDefinitions>
<DatePicker Height="25" HorizontalAlignment="Left"
Margin="32,17,0,0" Name="datePicker1"
VerticalAlignment="Top" Width="115" Grid.Column="1" />
<toolkit:TimePicker Height="28" Format="ShortTime"
Margin="0,16,146,109" HorizontalAlignment="Right"
Width="105" Grid.Column="1"></toolkit:TimePicker>
<Label Content="Start:" Height="28"
HorizontalAlignment="Left" Margin="20,16,0,0"
Name="lblOneTimeStart" VerticalAlignment="Top"
Grid.ColumnSpan="2" />
<CheckBox Content="Active" Height="16"
HorizontalAlignment="Left" Margin="278,21,0,0"
Name="cbOneTimeActive" VerticalAlignment="Top"
Grid.Column="1" />
</Grid>
</GroupBox>
</DataTemplate>
<DataTemplate x:Key="DailyDataTemplate">
<GroupBox Height="104" HorizontalAlignment="Left"
Margin="105,21,0,0" Name="gbDaily" VerticalAlignment="Top"
Width="448">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36*" />
<ColumnDefinition Width="418*" />
</Grid.ColumnDefinitions>
<toolkit:TimePicker Format="ShortTime" Margin="13,7,0,63"
Grid.Column="1" HorizontalAlignment="Left" Width="105" />
<toolkit:TimePicker Format="ShortTime" Margin="0,9,145,61"
Grid.Column="1" HorizontalAlignment="Right" Width="105" />
<Label Content="From:" Height="28"
HorizontalAlignment="Left" Margin="6,6,0,0"
Name="lblDailyFrom" VerticalAlignment="Top"
Grid.ColumnSpan="2" />
<Label Content="To:" Height="28"
HorizontalAlignment="Left" Margin="122,8,0,0"
Name="lblDailyTo" VerticalAlignment="Top" Grid.Column="1"
/>
<Label Content="Run every :" Grid.ColumnSpan="2"
Height="28" HorizontalAlignment="Left" Margin="6,51,0,0"
Name="lblDailyRunEvery" VerticalAlignment="Top" />
<Label Content="days" Height="28"
HorizontalAlignment="Left" Margin="114,51,0,0"
Name="lblDailyDays" VerticalAlignment="Top"
Grid.Column="1" />
<TextBox Height="23" Text="1" HorizontalAlignment="Left"
Margin="53,53,0,0" Name="textBox3" VerticalAlignment="Top"
Width="53" Grid.Column="1" />
<CheckBox Content="Active" Height="16"
HorizontalAlignment="Left" Margin="286,13,0,0"
Name="cbDailyActive" VerticalAlignment="Top"
Grid.Column="1" />
</Grid>
</GroupBox>
</DataTemplate>
<DataTemplate x:Key="WeeklyDataTemplate">
<GroupBox Height="160" HorizontalAlignment="Left"
Margin="117,17,0,0" Name="gbWeekly" VerticalAlignment="Top"
Width="436" Grid.ColumnSpan="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36*" />
<ColumnDefinition Width="418*" />
</Grid.ColumnDefinitions>
<toolkit:TimePicker Format="ShortTime" Grid.Column="1"
HorizontalAlignment="Left" Margin="17,11,0,115"
Width="105" />
<toolkit:TimePicker Format="ShortTime" Grid.Column="1"
HorizontalAlignment="Right" Margin="0,13,141,115"
Width="105" />
<Label Content="From:" Grid.ColumnSpan="2" Height="28"
HorizontalAlignment="Left" Margin="10,10,0,0"
Name="label4" VerticalAlignment="Top" />
<Label Content="Run every :" Grid.ColumnSpan="2"
Height="28" HorizontalAlignment="Left" Margin="10,55,0,0"
Name="label6" VerticalAlignment="Top" />
<Label Content="week on:" Grid.Column="1" Height="28"
HorizontalAlignment="Left" Margin="98,55,0,0"
Name="label7" VerticalAlignment="Top" />
<TextBox Grid.Column="1" Height="23" Margin="53,60,311,0"
Name="textBox3" Text="1" VerticalAlignment="Top" />
<Label Content="To:" Height="28"
HorizontalAlignment="Left" Margin="140,10,0,0"
Name="label5" VerticalAlignment="Top" Grid.Column="1" />
<CheckBox Content="Monday" Height="16"
HorizontalAlignment="Left" Margin="13,104,0,0"
Name="checkBox1" VerticalAlignment="Top"
Grid.ColumnSpan="2" />
<CheckBox Content="Tuesday" Height="16"
HorizontalAlignment="Left" Margin="62,104,0,0"
Name="checkBox2" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Wednesday" Height="16"
HorizontalAlignment="Left" Margin="140,104,0,0"
Name="checkBox3" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Thursday" Height="16"
HorizontalAlignment="Left" Margin="221,104,0,0"
Name="checkBox4" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Sunday" Height="16"
HorizontalAlignment="Left" Margin="140,131,0,0"
Name="checkBox5" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Friday" Grid.ColumnSpan="2" Height="16"
HorizontalAlignment="Left" Margin="13,126,0,0"
Name="checkBox6" VerticalAlignment="Top" />
<CheckBox Content="Saturday" Height="16"
HorizontalAlignment="Left" Margin="62,131,0,0"
Name="checkBox7" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Active" Height="16"
HorizontalAlignment="Left" Margin="303,15,0,0"
Name="checkBox8" VerticalAlignment="Top" Grid.Column="1"
/>
</Grid>
</GroupBox>
</DataTemplate>
<DataTemplate x:Key="MonthlyDataTemplate">
<GroupBox Height="160" HorizontalAlignment="Left"
Margin="134,34,0,0" Name="gbMonthly" VerticalAlignment="Top"
Width="466" Grid.ColumnSpan="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36*" />
<ColumnDefinition Width="418*" />
</Grid.ColumnDefinitions>
<toolkit:TimePicker Format="ShortTime" Grid.Column="1"
HorizontalAlignment="Left" Margin="17,11,0,115"
Width="105" />
<toolkit:TimePicker Format="ShortTime" Grid.Column="1"
HorizontalAlignment="Right" Margin="0,13,141,115"
Width="105" />
<Label Content="From:" Grid.ColumnSpan="2" Height="28"
HorizontalAlignment="Left" Margin="10,10,0,0"
Name="lblMonthlyFrom" VerticalAlignment="Top" />
<Label Content="To:" Height="28"
HorizontalAlignment="Left" Margin="140,10,0,0"
Name="lblMonthlyTo" VerticalAlignment="Top"
Grid.Column="1" />
<ComboBox Grid.Column="1" Height="23"
HorizontalAlignment="Left" Margin="33,60,0,0"
Name="cbMonths" VerticalAlignment="Top" Width="244">
<ComboBoxItem Content="January"
DataContext="{Binding}" IsSelected="True" />
<ComboBoxItem Content="February" />
<ComboBoxItem Content="March" />
<ComboBoxItem Content="April" />
<ComboBoxItem Content="May" />
<ComboBoxItem Content="June" />
<ComboBoxItem Content="July" />
<ComboBoxItem Content="August" />
<ComboBoxItem Content="September" />
<ComboBoxItem Content="October" />
<ComboBoxItem Content="November" />
<ComboBoxItem Content="December" />
</ComboBox>
<Label Content="Months:" Grid.ColumnSpan="2" Height="28"
HorizontalAlignment="Left" Margin="10,58,0,0"
Name="label6" VerticalAlignment="Top" />
<ComboBox Grid.Column="1" Height="23"
HorizontalAlignment="Left" Margin="33,94,0,0"
Name="comboBox2" VerticalAlignment="Top" Width="244">
<ComboBoxItem Content="1" IsSelected="True" />
<ComboBoxItem Content="2" />
<ComboBoxItem Content="3" />
</ComboBox>
<Label Content="Days:" Grid.ColumnSpan="2" Height="28"
HorizontalAlignment="Left" Margin="10,92,0,0"
Name="label7" VerticalAlignment="Top" />
<CheckBox Content="Active" Height="16"
HorizontalAlignment="Left" Margin="306,15,0,0"
Name="checkBox1" VerticalAlignment="Top" Grid.Column="1"
/>
</Grid>
</GroupBox>
</DataTemplate>
</Window.Resources>
I have a wpf application where have four radio buttons.
I want to change the content of the listview depending on the radio box
that is being checked.
I have defined the data template but cannot find the way to assign them to
the listview on radio box checked event . Below are the data templates.
<Window.Resources>
<DataTemplate x:Key="OneTimeDataTemplate">
<GroupBox Height="160" HorizontalAlignment="Left"
Margin="104,23,0,0" Name="gbOneTime" VerticalAlignment="Top"
Width="453">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36*" />
<ColumnDefinition Width="418*" />
</Grid.ColumnDefinitions>
<DatePicker Height="25" HorizontalAlignment="Left"
Margin="32,17,0,0" Name="datePicker1"
VerticalAlignment="Top" Width="115" Grid.Column="1" />
<toolkit:TimePicker Height="28" Format="ShortTime"
Margin="0,16,146,109" HorizontalAlignment="Right"
Width="105" Grid.Column="1"></toolkit:TimePicker>
<Label Content="Start:" Height="28"
HorizontalAlignment="Left" Margin="20,16,0,0"
Name="lblOneTimeStart" VerticalAlignment="Top"
Grid.ColumnSpan="2" />
<CheckBox Content="Active" Height="16"
HorizontalAlignment="Left" Margin="278,21,0,0"
Name="cbOneTimeActive" VerticalAlignment="Top"
Grid.Column="1" />
</Grid>
</GroupBox>
</DataTemplate>
<DataTemplate x:Key="DailyDataTemplate">
<GroupBox Height="104" HorizontalAlignment="Left"
Margin="105,21,0,0" Name="gbDaily" VerticalAlignment="Top"
Width="448">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36*" />
<ColumnDefinition Width="418*" />
</Grid.ColumnDefinitions>
<toolkit:TimePicker Format="ShortTime" Margin="13,7,0,63"
Grid.Column="1" HorizontalAlignment="Left" Width="105" />
<toolkit:TimePicker Format="ShortTime" Margin="0,9,145,61"
Grid.Column="1" HorizontalAlignment="Right" Width="105" />
<Label Content="From:" Height="28"
HorizontalAlignment="Left" Margin="6,6,0,0"
Name="lblDailyFrom" VerticalAlignment="Top"
Grid.ColumnSpan="2" />
<Label Content="To:" Height="28"
HorizontalAlignment="Left" Margin="122,8,0,0"
Name="lblDailyTo" VerticalAlignment="Top" Grid.Column="1"
/>
<Label Content="Run every :" Grid.ColumnSpan="2"
Height="28" HorizontalAlignment="Left" Margin="6,51,0,0"
Name="lblDailyRunEvery" VerticalAlignment="Top" />
<Label Content="days" Height="28"
HorizontalAlignment="Left" Margin="114,51,0,0"
Name="lblDailyDays" VerticalAlignment="Top"
Grid.Column="1" />
<TextBox Height="23" Text="1" HorizontalAlignment="Left"
Margin="53,53,0,0" Name="textBox3" VerticalAlignment="Top"
Width="53" Grid.Column="1" />
<CheckBox Content="Active" Height="16"
HorizontalAlignment="Left" Margin="286,13,0,0"
Name="cbDailyActive" VerticalAlignment="Top"
Grid.Column="1" />
</Grid>
</GroupBox>
</DataTemplate>
<DataTemplate x:Key="WeeklyDataTemplate">
<GroupBox Height="160" HorizontalAlignment="Left"
Margin="117,17,0,0" Name="gbWeekly" VerticalAlignment="Top"
Width="436" Grid.ColumnSpan="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36*" />
<ColumnDefinition Width="418*" />
</Grid.ColumnDefinitions>
<toolkit:TimePicker Format="ShortTime" Grid.Column="1"
HorizontalAlignment="Left" Margin="17,11,0,115"
Width="105" />
<toolkit:TimePicker Format="ShortTime" Grid.Column="1"
HorizontalAlignment="Right" Margin="0,13,141,115"
Width="105" />
<Label Content="From:" Grid.ColumnSpan="2" Height="28"
HorizontalAlignment="Left" Margin="10,10,0,0"
Name="label4" VerticalAlignment="Top" />
<Label Content="Run every :" Grid.ColumnSpan="2"
Height="28" HorizontalAlignment="Left" Margin="10,55,0,0"
Name="label6" VerticalAlignment="Top" />
<Label Content="week on:" Grid.Column="1" Height="28"
HorizontalAlignment="Left" Margin="98,55,0,0"
Name="label7" VerticalAlignment="Top" />
<TextBox Grid.Column="1" Height="23" Margin="53,60,311,0"
Name="textBox3" Text="1" VerticalAlignment="Top" />
<Label Content="To:" Height="28"
HorizontalAlignment="Left" Margin="140,10,0,0"
Name="label5" VerticalAlignment="Top" Grid.Column="1" />
<CheckBox Content="Monday" Height="16"
HorizontalAlignment="Left" Margin="13,104,0,0"
Name="checkBox1" VerticalAlignment="Top"
Grid.ColumnSpan="2" />
<CheckBox Content="Tuesday" Height="16"
HorizontalAlignment="Left" Margin="62,104,0,0"
Name="checkBox2" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Wednesday" Height="16"
HorizontalAlignment="Left" Margin="140,104,0,0"
Name="checkBox3" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Thursday" Height="16"
HorizontalAlignment="Left" Margin="221,104,0,0"
Name="checkBox4" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Sunday" Height="16"
HorizontalAlignment="Left" Margin="140,131,0,0"
Name="checkBox5" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Friday" Grid.ColumnSpan="2" Height="16"
HorizontalAlignment="Left" Margin="13,126,0,0"
Name="checkBox6" VerticalAlignment="Top" />
<CheckBox Content="Saturday" Height="16"
HorizontalAlignment="Left" Margin="62,131,0,0"
Name="checkBox7" VerticalAlignment="Top" Grid.Column="1"
/>
<CheckBox Content="Active" Height="16"
HorizontalAlignment="Left" Margin="303,15,0,0"
Name="checkBox8" VerticalAlignment="Top" Grid.Column="1"
/>
</Grid>
</GroupBox>
</DataTemplate>
<DataTemplate x:Key="MonthlyDataTemplate">
<GroupBox Height="160" HorizontalAlignment="Left"
Margin="134,34,0,0" Name="gbMonthly" VerticalAlignment="Top"
Width="466" Grid.ColumnSpan="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36*" />
<ColumnDefinition Width="418*" />
</Grid.ColumnDefinitions>
<toolkit:TimePicker Format="ShortTime" Grid.Column="1"
HorizontalAlignment="Left" Margin="17,11,0,115"
Width="105" />
<toolkit:TimePicker Format="ShortTime" Grid.Column="1"
HorizontalAlignment="Right" Margin="0,13,141,115"
Width="105" />
<Label Content="From:" Grid.ColumnSpan="2" Height="28"
HorizontalAlignment="Left" Margin="10,10,0,0"
Name="lblMonthlyFrom" VerticalAlignment="Top" />
<Label Content="To:" Height="28"
HorizontalAlignment="Left" Margin="140,10,0,0"
Name="lblMonthlyTo" VerticalAlignment="Top"
Grid.Column="1" />
<ComboBox Grid.Column="1" Height="23"
HorizontalAlignment="Left" Margin="33,60,0,0"
Name="cbMonths" VerticalAlignment="Top" Width="244">
<ComboBoxItem Content="January"
DataContext="{Binding}" IsSelected="True" />
<ComboBoxItem Content="February" />
<ComboBoxItem Content="March" />
<ComboBoxItem Content="April" />
<ComboBoxItem Content="May" />
<ComboBoxItem Content="June" />
<ComboBoxItem Content="July" />
<ComboBoxItem Content="August" />
<ComboBoxItem Content="September" />
<ComboBoxItem Content="October" />
<ComboBoxItem Content="November" />
<ComboBoxItem Content="December" />
</ComboBox>
<Label Content="Months:" Grid.ColumnSpan="2" Height="28"
HorizontalAlignment="Left" Margin="10,58,0,0"
Name="label6" VerticalAlignment="Top" />
<ComboBox Grid.Column="1" Height="23"
HorizontalAlignment="Left" Margin="33,94,0,0"
Name="comboBox2" VerticalAlignment="Top" Width="244">
<ComboBoxItem Content="1" IsSelected="True" />
<ComboBoxItem Content="2" />
<ComboBoxItem Content="3" />
</ComboBox>
<Label Content="Days:" Grid.ColumnSpan="2" Height="28"
HorizontalAlignment="Left" Margin="10,92,0,0"
Name="label7" VerticalAlignment="Top" />
<CheckBox Content="Active" Height="16"
HorizontalAlignment="Left" Margin="306,15,0,0"
Name="checkBox1" VerticalAlignment="Top" Grid.Column="1"
/>
</Grid>
</GroupBox>
</DataTemplate>
</Window.Resources>
UnzipOpenFile (ZipArchive) is return uncorrectly when password is not right
UnzipOpenFile (ZipArchive) is return uncorrectly when password is not right
i'm using ZipArchive library to unzip/zip files in my iOS application.
I noticed that UnzipOpenFile will not return false when password is not
correct. Below is the sources.
Is there anybody has similar issue? (I have added my comments on it)
-(BOOL) UnzipOpenFile:(NSString*) zipFile
{
_unzFile = unzOpen( (const char*)[zipFile UTF8String] );
if( _unzFile )
{
unz_global_info globalInfo = {0};
if( unzGetGlobalInfo(_unzFile, &globalInfo )==UNZ_OK )
{
//NSLog([NSString stringWithFormat:@"%ld entries in the zip
file",globalInfo.number_entry] );
return false; // i have to add this myself here.
}
}
return _unzFile!=NULL;
}
-(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password
{
_password = password;
return [self UnzipOpenFile:zipFile];
}
i'm using ZipArchive library to unzip/zip files in my iOS application.
I noticed that UnzipOpenFile will not return false when password is not
correct. Below is the sources.
Is there anybody has similar issue? (I have added my comments on it)
-(BOOL) UnzipOpenFile:(NSString*) zipFile
{
_unzFile = unzOpen( (const char*)[zipFile UTF8String] );
if( _unzFile )
{
unz_global_info globalInfo = {0};
if( unzGetGlobalInfo(_unzFile, &globalInfo )==UNZ_OK )
{
//NSLog([NSString stringWithFormat:@"%ld entries in the zip
file",globalInfo.number_entry] );
return false; // i have to add this myself here.
}
}
return _unzFile!=NULL;
}
-(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password
{
_password = password;
return [self UnzipOpenFile:zipFile];
}
fclose, fopen and fwrite issues with writing multiple files
fclose, fopen and fwrite issues with writing multiple files
I have a program that records data from a serial port. Every so often, I
want to split up files such that the data logs don't become very large.
The problem is, after I recreate the FILE* and try to write into it, the
program crashes. No compiler errors/warnings before hand also...
The program does create one log for the first time interval, but once it's
time to create a new data log, it crashes at the fwrite.
First off, initializations/declarations.
char * DATA_DIR = "C:\DATA";
sprintf(path,"%s%s%s",DATA_DIR,curtime,".log"); //curtime is just the
current time in a string
FILE * DATA_LOG = fopen(path, "wb+");
And later on in a while loop
if(((CURRENT_TIME-PREVIOUS_TIME) > (SEC_IN_MINUTE * MINUTE_CHUNKS) ) &&
(MINUTE_CHUNKS != 0) && FIRST_TIME == 0) //all this does is just checks if
its time to make a new file
{
fclose(DATA_LOG); //end the current fileread
char * path;
char curtime[16];
//gets the current time and saves it to a file name
sprintf(curtime , "%s" , currentDateTime());
sprintf(path,"%s%s%s",DATA_DIR,curtime,".log");
DATA_LOG = fopen(path, "wb+"); //open the new file
//just some logic (not relevant to problem)
PREVIOUS_TIME = CURRENT_TIME;
newDirFlag = 1;
}
fwrite(cdata , sizeof(char) , numChars , DATA_LOG); //crashes here. cdata,
sizeof, and numChars don't change values
Any ideas why is this happening? I'm stumped.
I have a program that records data from a serial port. Every so often, I
want to split up files such that the data logs don't become very large.
The problem is, after I recreate the FILE* and try to write into it, the
program crashes. No compiler errors/warnings before hand also...
The program does create one log for the first time interval, but once it's
time to create a new data log, it crashes at the fwrite.
First off, initializations/declarations.
char * DATA_DIR = "C:\DATA";
sprintf(path,"%s%s%s",DATA_DIR,curtime,".log"); //curtime is just the
current time in a string
FILE * DATA_LOG = fopen(path, "wb+");
And later on in a while loop
if(((CURRENT_TIME-PREVIOUS_TIME) > (SEC_IN_MINUTE * MINUTE_CHUNKS) ) &&
(MINUTE_CHUNKS != 0) && FIRST_TIME == 0) //all this does is just checks if
its time to make a new file
{
fclose(DATA_LOG); //end the current fileread
char * path;
char curtime[16];
//gets the current time and saves it to a file name
sprintf(curtime , "%s" , currentDateTime());
sprintf(path,"%s%s%s",DATA_DIR,curtime,".log");
DATA_LOG = fopen(path, "wb+"); //open the new file
//just some logic (not relevant to problem)
PREVIOUS_TIME = CURRENT_TIME;
newDirFlag = 1;
}
fwrite(cdata , sizeof(char) , numChars , DATA_LOG); //crashes here. cdata,
sizeof, and numChars don't change values
Any ideas why is this happening? I'm stumped.
ISNULL twice for the same column
ISNULL twice for the same column
Is it possible to use ISNULL twice for the same column?
ISNULL(ISNULL(column, SELECT sum(column2) FROM table WHERE type = '1')),
SELECT sum(column2) FROM table WHERE type = '2'))
Or should I be doing this in a different way with IF ELSE somehow? How
would that look like?
Is it possible to use ISNULL twice for the same column?
ISNULL(ISNULL(column, SELECT sum(column2) FROM table WHERE type = '1')),
SELECT sum(column2) FROM table WHERE type = '2'))
Or should I be doing this in a different way with IF ELSE somehow? How
would that look like?
Regular expression matching unescaped paired brackets and nested function calls
Regular expression matching unescaped paired brackets and nested function
calls
Here's the problem: given a string like
"<p>The price for vehicles {capitalize(pluralize(vehicle))} is
{format_number(value, language)}</p><span>{employee_name}</span><span>\{do
not parse me}</span>"
I need (1) a regex pattern in PHP that matches all values between
un-escaped pairs of curly brackets and (2) another regex pattern that
matches function calls and nested function calls (once the first pattern
is matched). Of course, if I could use one regex only for both tasks that
would be awesome.
By the way, I can't use Smarty, Twig or any other library - that's the
only reason I have to build a parsing mechanism myself.
Thanks a ton!
calls
Here's the problem: given a string like
"<p>The price for vehicles {capitalize(pluralize(vehicle))} is
{format_number(value, language)}</p><span>{employee_name}</span><span>\{do
not parse me}</span>"
I need (1) a regex pattern in PHP that matches all values between
un-escaped pairs of curly brackets and (2) another regex pattern that
matches function calls and nested function calls (once the first pattern
is matched). Of course, if I could use one regex only for both tasks that
would be awesome.
By the way, I can't use Smarty, Twig or any other library - that's the
only reason I have to build a parsing mechanism myself.
Thanks a ton!
Arranging floats positioned relative to wrapper, new line for overlaps
Arranging floats positioned relative to wrapper, new line for overlaps
Okay, it's hard to explain this problem in the title. Basically each list
items is floated a certain percentage relative to the overall unordered
list. This works if you keep each list item on a separate line. However to
save space I want to show items on the same line as long as they dont
overlay. Obviously I could just position absolutely but this results in
overlaps. Im struggling to come up with any idea how to do this.
I have a fiddle created to show the problem - http://jsfiddle.net/K5j4J/
The way I have it also used javascript to set the left amount, although
hardcoded in the fiddle
jQuery(this).children('.holder').css("left", leftpos );
Okay, it's hard to explain this problem in the title. Basically each list
items is floated a certain percentage relative to the overall unordered
list. This works if you keep each list item on a separate line. However to
save space I want to show items on the same line as long as they dont
overlay. Obviously I could just position absolutely but this results in
overlaps. Im struggling to come up with any idea how to do this.
I have a fiddle created to show the problem - http://jsfiddle.net/K5j4J/
The way I have it also used javascript to set the left amount, although
hardcoded in the fiddle
jQuery(this).children('.holder').css("left", leftpos );
Web - can't open index page
Web - can't open index page
i'm having a prob. I've just made up a website in EasyPHP, everything runs
ok on localhost. Problem came out after that i uploaded files on VPS to
webserver, also the same prob. on webhosting. I cannot open my index.php
file, everytime it redirects me to login.php - administration. Without
index.php or login.php web doesn't work at all. The content of index file
is simple, just couple php script to show content, function to query
SQL... no redirection. thnks for help
i'm having a prob. I've just made up a website in EasyPHP, everything runs
ok on localhost. Problem came out after that i uploaded files on VPS to
webserver, also the same prob. on webhosting. I cannot open my index.php
file, everytime it redirects me to login.php - administration. Without
index.php or login.php web doesn't work at all. The content of index file
is simple, just couple php script to show content, function to query
SQL... no redirection. thnks for help
Monday, 19 August 2013
Can LaTeX create graphics like this?
Can LaTeX create graphics like this?
I am trying to see how good LaTeX is.
Can someone show me whether graphics like this can be reproduced in TeX?
The above figure is borrowed( for demo purpose only) from
Chapter 15 Descriptive Statistics, Part of 18 lectures series based on
Textbook Educational Research:Quantitative, Qualitative, and Mixed
Approaches By Burke Johnson and Larry Christensen Published by Sage
Publications
I am trying to see how good LaTeX is.
Can someone show me whether graphics like this can be reproduced in TeX?
The above figure is borrowed( for demo purpose only) from
Chapter 15 Descriptive Statistics, Part of 18 lectures series based on
Textbook Educational Research:Quantitative, Qualitative, and Mixed
Approaches By Burke Johnson and Larry Christensen Published by Sage
Publications
strong maximum principle - harmonic function
strong maximum principle - harmonic function
Consider the following the theorem in the classical PDE book of Evans(
chapter 2 ) :
(part of the strong maximum principle) Let $U$ a open set in $R^n$ and $u
\in C^2 (U) \cap C(\overline{U})$, with $\Delta u = 0$ in $U$.
If $U$ is connected and there exists a point $x_0 \in U$ such that
$$ u(x_0) = \displaystyle\max_{\overline{U}} u$$
then $u$ is constant within $U$.
Proof:
Suppose there exists a point $x_0 \in U$ with $u(x_0) = M =
\displaystyle\max_{\overline{U}} u . $ Then for $0 < r < dist (x_0 ,
\partial U)$, the mean value property asserts
$$ M = u(x_0) = \displaystyle\frac{\displaystyle\int_{B(x_0,r) } u \
dy}{|B(x_0, r)|} \leq M$$ .
Then $u = M$ in $B(x_0 , r)$ (*) . I dont understand the equality in
$(*)$, If i be non rigorous, for me is clear to see the equality in $(*)$.
But i dont know how to prove the equality... Someone can give me a hint
about how to prove the equality in $(*)$ ?
thanks in advance !
Consider the following the theorem in the classical PDE book of Evans(
chapter 2 ) :
(part of the strong maximum principle) Let $U$ a open set in $R^n$ and $u
\in C^2 (U) \cap C(\overline{U})$, with $\Delta u = 0$ in $U$.
If $U$ is connected and there exists a point $x_0 \in U$ such that
$$ u(x_0) = \displaystyle\max_{\overline{U}} u$$
then $u$ is constant within $U$.
Proof:
Suppose there exists a point $x_0 \in U$ with $u(x_0) = M =
\displaystyle\max_{\overline{U}} u . $ Then for $0 < r < dist (x_0 ,
\partial U)$, the mean value property asserts
$$ M = u(x_0) = \displaystyle\frac{\displaystyle\int_{B(x_0,r) } u \
dy}{|B(x_0, r)|} \leq M$$ .
Then $u = M$ in $B(x_0 , r)$ (*) . I dont understand the equality in
$(*)$, If i be non rigorous, for me is clear to see the equality in $(*)$.
But i dont know how to prove the equality... Someone can give me a hint
about how to prove the equality in $(*)$ ?
thanks in advance !
How to get line 1 from file : aaa, and then line 2, from file aaa. seperately, usuable within a bash script, anywhere.
How to get line 1 from file : aaa, and then line 2, from file aaa.
seperately, usuable within a bash script, anywhere.
I have a bash script that is something like this..
a=`xdotool search --name "ooo"`
if [[ "$a" ]]; then
xdotool windowactivate --sync $a
fi
above this code i need to mention
b = 'username'
c = 'password'
but i rather store the username and password in a text file named
a
in other words i need to do something like..
b = read_the_first_line_from_file_a
c = read_the_second_line_from_file_a
so far i came across with these codes. but they do not look "fit" for my
needs.
awk '{a[NR]=$0}END{ #here you could do whatever with a[1] (a) and a[2] (b)}
you see this code above i have been given.. how am i suppose to integrate
it with
b =
c =
?
is there a generic way to simply get line1 and line2 from a file and
assign them to variables in linux ?
seperately, usuable within a bash script, anywhere.
I have a bash script that is something like this..
a=`xdotool search --name "ooo"`
if [[ "$a" ]]; then
xdotool windowactivate --sync $a
fi
above this code i need to mention
b = 'username'
c = 'password'
but i rather store the username and password in a text file named
a
in other words i need to do something like..
b = read_the_first_line_from_file_a
c = read_the_second_line_from_file_a
so far i came across with these codes. but they do not look "fit" for my
needs.
awk '{a[NR]=$0}END{ #here you could do whatever with a[1] (a) and a[2] (b)}
you see this code above i have been given.. how am i suppose to integrate
it with
b =
c =
?
is there a generic way to simply get line1 and line2 from a file and
assign them to variables in linux ?
Genaerating random DateTime between a given DateTime range - C#
Genaerating random DateTime between a given DateTime range - C#
I have a listener which needs to be active randomly for 10 time for say 20
min in a given time period. So if the time period is say from 2013/08/20
10:00 to 2013/08/20 22:00, I need to generate a random DateTime 10 times
between this range keeping in mind that the listener needs a time of 20
min.
Thanks, Siddharth
I have a listener which needs to be active randomly for 10 time for say 20
min in a given time period. So if the time period is say from 2013/08/20
10:00 to 2013/08/20 22:00, I need to generate a random DateTime 10 times
between this range keeping in mind that the listener needs a time of 20
min.
Thanks, Siddharth
How to write a VB.Net Lambda expression
How to write a VB.Net Lambda expression
I am working on a VB.net project now. I am new to VB.Net LINQ and would
like to know the Lambda equivalent of
var _new = orders.Select(x => x.items > 0);
in VB.Net.
Someone please suggest!
I am working on a VB.net project now. I am new to VB.Net LINQ and would
like to know the Lambda equivalent of
var _new = orders.Select(x => x.items > 0);
in VB.Net.
Someone please suggest!
Sunday, 18 August 2013
Android Center Gridview Horizintally in RelativeLayout
Android Center Gridview Horizintally in RelativeLayout
I have a GridView which number of columns is determined at runtime, each
column have a width of 50dp, if the columns are not enough to fill the
parent (whole screen), I want the GridView to be centralized in the
parent, I tried a lot of things and the only think that works for me is
putting the gridviews's layout_width to a fixed number, but I really want
it to be wrap_content :(. This is my code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" >
<GridView
android:id="@+id/gridView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:clipChildren="true"
android:columnWidth="50dp"
android:horizontalSpacing="0dp"
android:numColumns="auto_fit"
android:padding="0dp"
android:gravity="center"
android:verticalSpacing="0dp" />
</RelativeLayout>
I have a GridView which number of columns is determined at runtime, each
column have a width of 50dp, if the columns are not enough to fill the
parent (whole screen), I want the GridView to be centralized in the
parent, I tried a lot of things and the only think that works for me is
putting the gridviews's layout_width to a fixed number, but I really want
it to be wrap_content :(. This is my code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" >
<GridView
android:id="@+id/gridView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:clipChildren="true"
android:columnWidth="50dp"
android:horizontalSpacing="0dp"
android:numColumns="auto_fit"
android:padding="0dp"
android:gravity="center"
android:verticalSpacing="0dp" />
</RelativeLayout>
Can not connect to sql-server database file
Can not connect to sql-server database file
In the output-directory of my solution there's a folder named Storage. In
this folder is a Databasefile Comments.sdf located which has no password.
Now I want to connect to this database by the following code:
string connectionString = @"Data Source=\Storage\Comments.sdf;Persist
Security Info=False;";
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
The line connection.Open(); throws an exception.
I only have the german error-message:
Netzwerkbezogener oder instanzspezifischer Fehler beim Herstellen einer
Verbindung mit SQL Server. Der Server wurde nicht gefunden, oder auf ihn
kann nicht zugegriffen werden. Überprüfen Sie, ob der Instanzname richtig
ist und ob SQL Server Remoteverbindungen zulässt. (provider: SQL Network
Interfaces, error: 25 - Verbindungszeichenfolge ungültig)
In english it's like:
A network-related or instance-specific error occurred while establishing a
connection to SQL Server. The server was not found or it can not be
accessed. Verify that the instance name is correct and that SQL Server
allows remote connections. (provider: SQL Network Interfaces, error: 25 -
Connection string is invalid)
Is there anything wrong with my connectionstring or do I have to set some
properties at the databasefile?
In the output-directory of my solution there's a folder named Storage. In
this folder is a Databasefile Comments.sdf located which has no password.
Now I want to connect to this database by the following code:
string connectionString = @"Data Source=\Storage\Comments.sdf;Persist
Security Info=False;";
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
The line connection.Open(); throws an exception.
I only have the german error-message:
Netzwerkbezogener oder instanzspezifischer Fehler beim Herstellen einer
Verbindung mit SQL Server. Der Server wurde nicht gefunden, oder auf ihn
kann nicht zugegriffen werden. Überprüfen Sie, ob der Instanzname richtig
ist und ob SQL Server Remoteverbindungen zulässt. (provider: SQL Network
Interfaces, error: 25 - Verbindungszeichenfolge ungültig)
In english it's like:
A network-related or instance-specific error occurred while establishing a
connection to SQL Server. The server was not found or it can not be
accessed. Verify that the instance name is correct and that SQL Server
allows remote connections. (provider: SQL Network Interfaces, error: 25 -
Connection string is invalid)
Is there anything wrong with my connectionstring or do I have to set some
properties at the databasefile?
ArrayIndexOutOfBounds Exception on employee database program
ArrayIndexOutOfBounds Exception on employee database program
I am very new to java and have been trying to get my bearings with it.
I've been trying to write an proof of concept employee database. It all
works fine until I enter the last employee condition, then I get an
ArrayIndexOutOfBoundsException. Here is the code for both of my files. Any
help would be appreciated.
import java.util.Scanner;
public class EmployeeInterface
{
public static void main(String[] args)
{
Scanner Input = new Scanner(System.in);
System.out.println("Please enter the number of employees to
register.");
int employeeCount = Input.nextInt();
Employee.setEmployeeNumber(employeeCount);
String employeeFullName;
String employeeAddress;
String employeeDateOfHire;
for(int x = 0; x <= employeeCount; x++)
{
System.out.println("Please enter the full name of employee
number " + (x + 1));
Input.nextLine();
employeeFullName = Input.nextLine();
System.out.println("Please enter the address of employee
number " + (x + 1));
employeeAddress = Input.nextLine();
System.out.println("Please enter the date of hire for employee
" + (x + 1));
employeeDateOfHire = Input.nextLine();
Employee.employeeRegister(x, employeeFullName,
employeeAddress, employeeDateOfHire);
}
}
}
Here is the second file:
public class Employee
{
private static int employeeCount;
private static String employees[][] = new String[employeeCount][4];
public static void setEmployeeNumber(int x)
{
employeeCount = x;
}
public static void employeeRegister(int employeeNumber, String
employeeFullName, String address, String employeeHireDate)
{
employees[employeeNumber][0] = employeeFullName;
employees[employeeNumber][1] = employeeFullName;
employees[employeeNumber][2] = employeeFullName;
employees[employeeNumber][3] = employeeFullName;
}
}
I am very new to java and have been trying to get my bearings with it.
I've been trying to write an proof of concept employee database. It all
works fine until I enter the last employee condition, then I get an
ArrayIndexOutOfBoundsException. Here is the code for both of my files. Any
help would be appreciated.
import java.util.Scanner;
public class EmployeeInterface
{
public static void main(String[] args)
{
Scanner Input = new Scanner(System.in);
System.out.println("Please enter the number of employees to
register.");
int employeeCount = Input.nextInt();
Employee.setEmployeeNumber(employeeCount);
String employeeFullName;
String employeeAddress;
String employeeDateOfHire;
for(int x = 0; x <= employeeCount; x++)
{
System.out.println("Please enter the full name of employee
number " + (x + 1));
Input.nextLine();
employeeFullName = Input.nextLine();
System.out.println("Please enter the address of employee
number " + (x + 1));
employeeAddress = Input.nextLine();
System.out.println("Please enter the date of hire for employee
" + (x + 1));
employeeDateOfHire = Input.nextLine();
Employee.employeeRegister(x, employeeFullName,
employeeAddress, employeeDateOfHire);
}
}
}
Here is the second file:
public class Employee
{
private static int employeeCount;
private static String employees[][] = new String[employeeCount][4];
public static void setEmployeeNumber(int x)
{
employeeCount = x;
}
public static void employeeRegister(int employeeNumber, String
employeeFullName, String address, String employeeHireDate)
{
employees[employeeNumber][0] = employeeFullName;
employees[employeeNumber][1] = employeeFullName;
employees[employeeNumber][2] = employeeFullName;
employees[employeeNumber][3] = employeeFullName;
}
}
Subscribe to:
Comments (Atom)