I have a bool field in a cell of a datagrid. What I want to do is to color the row with red for true and green for false.
How can I do this with the C# Datagrid?
In a production server there are index.html and index.php
By default index.html is getting loaded.
I want index.php to be the default script to load and if index.php is not present then index.html can load.
It is a shared hosting so we do not have access to the httpd.conf file
So i thought of creating .htaccess file which would do the above condition.
What is the directive to include in .htaccess file to do so?
I have a simple jQuery image switch that is failing.
$('.heart_img').click(function()
{
var heart_type = $(this).attr('src');
//alert( heart_type );
if ( heart_type == 'images/unheart.png')
{
//alert('uheart');
$(this).attr('src','images/heart.png');
}
else if ( heart_type == 'images/heart.png');
{
$(this).attr('src','images/unheart.png');
}
});
The alerts fire correctly when not commented out so and the images are in the correct place so I am not sure what the problem is.
On this page
http://zenchan.com/program/
When I rollover the right box 2nd from the top suddenly the overlapping (negative margin disappears). What's happening is that a 'hover' class is being added to shift the background sprite.
The two yellow boxes are debugging: if the hover class is put their in advance there is no problem. So fundamentally the CSS is not a problem for IE7 but adding the class is.
Any ideas what's causing this. I've tried adding haslayout to various elements but to little effect.
the motivation is for checking what has changed in a deeply nest map, kind of like a reverse of update-in.
This is a simple example:
(def p1 {:a {:a1 :1 :a2 :2}
:b {:b1 :1 :b2 :2}})
(def p2 (update-in p1 [:a :a1] (constantly :updated))
;; => {:a {:a1 :updated :a2 :2}
;; :b {:b1 :1 :b2 :2}}
(what-changed? p1 p2)
;; => {:keys [:a :a1] :value :updated)
(what-changed? p2 p1)
;; => {:keys [:a :a1] :value :2)
I'm hoping that because clojure maps are persistent data-structures, there may be a smart algorithm to figure this out by looking at the underlying structure as opposed to walking through the nested maps and comparing the difference.
I would like to do something like:
git history my_file
possible output
2010-05-16
+ add this line
+ more code here
2010-05-15
+ delete code below
- bad code
- more bad codd
2010-05-12
+ changes made here
action: User/Details
View: Details
In my 'Details' view, a user can click on an actionlink that goes to
the action :User/UserBehavior From which I again return a "Details" View.
the url shows http://User/UserBehavior
If I return redirectToAction to the Details action, I still get the "UserBehavior" action in the url.
how do I redirect and present the new url of the action? isnt that the way its supposed to be?
TO CLARIFY: WHEN YOU USE REDIRECTTOACTION, SHOULD THE URL IN THE BROWSER SHOW THE ORIGINAL ACTION OR THE ACTION YOU REDIRECTED TO?
If i have a background image defined as:
#header
{
width: 100%;
background: url(/Content/images/header.jpg) -0 0 no-repeat;
}
and i want to overwrite that after the page loads. Shouldn't this code work?
$("#header").css('background-image', '/Content/images/aff/header_<%=affiliateID%>.jpg')
I need convert or set encoding windows-1251
Process p = new Process();
StreamWriter sw;
StreamReader sr;
StreamReader err;
ProcessStartInfo psI = new ProcessStartInfo("cmd");
psI.UseShellExecute = false;
psI.RedirectStandardInput = true;
psI.RedirectStandardOutput = true;
psI.RedirectStandardError = true;
psI.CreateNoWindow = true;
p.StartInfo = psI;
p.Start();
sw = p.StandardInput;
sr = p.StandardOutput;
err = p.StandardError;
sw.AutoFlush = true;
if (tbComm.Text != "")
sw.WriteLine(tbComm.Text);
else
//execute default command
sw.WriteLine("dir \\");
sw.Close();
textBox1.Text = sr.ReadToEnd();// this not support russian word. I need convert or set encoding windows-1251
textBox1.Text += err.ReadToEnd();
I'm new to ruby so forgive me if this is simple or I get some terminology wrong.
I've got a bunch of unit tests (actually they're integration tests for another project, but they use ruby test/unit) and they all include from a module that sets up an instance variable for the log object. When I run the individual tests I'd like log.level to be debug, but when I run a suite I'd like log.level to be error. Is it possible to do this with the approach I'm taking, or does the code need to be restructured?
Here's a small example of what I have so far.
The logging module:
#!/usr/bin/env ruby
require 'logger'
module MyLog
def setup
@log = Logger.new(STDOUT)
@log.level = Logger::DEBUG
end
end
A test:
#!/usr/bin/env ruby
require 'test/unit'
require 'mylog'
class Test1 < Test::Unit::TestCase
include MyLog
def test_something
@log.info("About to test something")
# Test goes here
@log.info("Done testing something")
end
end
A test suite made up of all the tests in its directory:
#!/usr/bin/env ruby
Dir.foreach(".") do |path|
if /it-.*\.rb/.match(File.basename(path))
require path
end
end
Background
I'm trying to make a menu, you hover over the button and the background image shifts its Y position to give you the 'over' effect for each button.
CSS
.menu {float: left;}
.menu span {display: none;}
.menu a {display: block; margin: 10px; width: 200px; height: 50px;}
#itemA {background: url('images/btnA.png') no-repeat 0 0;}
#itemB {background: url('images/btnB.png') no-repeat 0 0;}
#itemC {background: url('images/btnC.png') no-repeat 0 0;}
#itemD {background: url('images/btnD.png') no-repeat 0 0;}
HTML
<div class="menu">
<a id="itemA" href="#"><span>AAAAA</span></a>
<a id="itemB" href="#"><span>BBBBB</span></a>
<a id="itemC" href="#"><span>CCCCC</span></a>
<a id="itemD" href="#"><span>DDDDD</span></a>
</div>
Problem
why do none of these work?
/*** - test A
a.menu:link {background-position: 0 -51px;}
a.menu:visited {display: block; margin: 10px; width: 200px; height: 32px;}
***/
/*** - test B
a.menu:hover {background-position: 0 -51px;}
***/
/*** - test C
.menu a:hover {background-position: 0 -51px;}
***/
/*** - test D
.menu:hover a {background-position: 0 -51px;}
***/
/*** - test E
a:hover .menu {background-position: 0 -51px;}
***/
Notes
images are 200x101px (50px high with a 1px seperator)
Question
why do none of these work, should any of them work, is there a solution im missing?
thanks in advance!
Hi everyone!
I have a list of items that have checkboxes associated with them, and the items are beneath a list header, which also has a checkbox(for db purposes only) which is actually hidden from view. I need to make it so that if any of the checkboxes beneath the header is checked, then the header checkbox is checked as well. BUT I also need to make it so that if all of the checkboxes are unchecked, then the header one is unchecked...how hard is this going to be?
This is how I have it setup now:
if($('.childCheckBox').is(":checked")){
$('#parentBox').attr('checked', true);
}
Now I am thinking that if I were to do something where I add an else if clause:
else if($('.proBox2').is(not)(":checked"){
alert("uncheck parent");
}
But I don't know the correct syntax for is-not, or isn't, or even if there is anything that will do that. Are there any thoughts out there? I need the box to check if one is selected and uncheck if none are selected. Thanks!!
Take a look at this example code, which doesn't work:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--
function moveMe() {
document.getElementById('moveme').top = 200;
document.getElementById('moveme').style.backgroundcolor = 'green';
document.getElementById('writeme').innerHtml = 'abc';
alert('called!');
}
// -->
</script>
<style type="text/css">
.moveable {
position: absolute;
top: 30px;
left: 200px;
width: 100px;
height: 100px;
background-color: yellow;
}
#writeme {
background-color: red;
color: white;
}
</style>
</head>
<body>
<div id="moveme" class="moveable" onClick="moveMe()">
<p id="writeme">Hello!</p>
</div>
</body>
</html>
When I click on the text the alert is displayed, but nothing is changed in the document. The paragraph text is not overwritten, the div is not moved... tested it in FF and IE, also checked the DOM via Firebug: strange thing is that the new values are written to the nodes, but they are displayed in bold, and the old values are still there. WTF?
I guess I'm missing something fundamental here.
I have a class that stores data in asp.net c# application that never changes. I really don't want to put this data in the database - I would like it to stay in the application. Here is my way to store data in the application:
public class PostVoteTypeFunctions
{
private List<PostVoteType> postVotes = new List<PostVoteType>();
public PostVoteTypeFunctions()
{
PostVoteType upvote = new PostVoteType();
upvote.ID = 0;
upvote.Name = "UpVote";
upvote.PointValue = PostVotePointValue.UpVote;
postVotes.Add(upvote);
PostVoteType downvote = new PostVoteType();
downvote.ID = 1;
downvote.Name = "DownVote";
downvote.PointValue = PostVotePointValue.DownVote;
postVotes.Add(downvote);
PostVoteType selectanswer = new PostVoteType();
selectanswer.ID = 2;
selectanswer.Name = "SelectAnswer";
selectanswer.PointValue = PostVotePointValue.SelectAnswer;
postVotes.Add(selectanswer);
PostVoteType favorite = new PostVoteType();
favorite.ID = 3;
favorite.Name = "Favorite";
favorite.PointValue = PostVotePointValue.Favorite;
postVotes.Add(favorite);
PostVoteType offensive = new PostVoteType();
offensive.ID = 4;
offensive.Name = "Offensive";
offensive.PointValue = PostVotePointValue.Offensive;
postVotes.Add(offensive);
PostVoteType spam = new PostVoteType();
spam.ID = 0;
spam.Name = "Spam";
spam.PointValue = PostVotePointValue.Spam;
postVotes.Add(spam);
}
}
When the constructor is called the code above is ran. I have some functions that can query the data above too. But is this the best way to store information in asp.net? if not what would you recommend?
I have a problem. I use a Button as a BarButtonItem. It works fine so far, but my backgroundcolor works only if I click on my button. How can I make it so that my backgroundcolor will be set every time ?
UIButton *redEmergencyButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
redEmergencyButton.frame = CGRectMake(100, 100, 100, 50);
redEmergencyButton.backgroundColor = [UIColor colorWithRed:0.8
green:0.898039215686274509803
blue:1.0
alpha:1.0];
[redEmergencyButton setTitle:@"Emergency"
forState:UIControlStateNormal];
[redEmergencyButton addTarget:self
action:@selector(doEmergency)
forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *rButton = [[UIBarButtonItem alloc]
initWithCustomView:redEmergencyButton];
Sorry if this is obvious: I found a lot of questions similar to mine but I can't figure it out for my own data. I have a data frame that looks like this:
A <- c(1,6)
B <- c(2,7)
C <- c(3,8)
D <- c(4,9)
E <- c(5,0)
df <- data.frame(A,B,C,D,E)
df
A B C D E
1 1 2 3 4 5
2 6 7 8 9 0
And I need this:
df
X1
A 1
A 6
B 2
B 7
C 3
C 8
D 4
D 9
E 5
E 0
Thanks!
Hi Guys,
I currently have the DatePicker in my project but there are problems due to the need that I need a specific format to be returned, not the regional format.
Anyway in VS I could manipulate the format to how I wanted but in Blend there is no option, can anyone help me out here?
btw this isn't any custom style.
Thanks.
Hi,
I need to target all links with a class of hslide and attach this to them. Any jquery guru's out there know how to do this?
onclick="return hs.expand(this, { slideshowGroup: 'groupC0', wrapperClassName: 'rounded-white', outlineType : 'rounded-white', dimmingOpacity: 0.8, align : 'center', transitions : ['expand', 'crossfade'], fadeInOut: true });"
Thanks,
C
I have jQuery grid with user data; my first column is ID:
$("#table").click(function(e) {
var row = jQuery(e.target).parent();
Name = row.attr("id");
Friends(Name);
});
Now when I click on the row I am getting the ID value. I am passing this ID to one function to display it.
It always shows the name of the first row - it isn't changing for every row click...
Any ideas?
I need to transform the following xml doc:
<a>
<b/>
<c/>
myText
</a>
into this:
<a>
<b/>
<c/>
differentText
</a>
So, i wrote this XSLT document
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" />
<xsl:template match="/a/text()">
<a>
<b/>
<c/>
differentText
</a>
</xsl:template>
</xsl:stylesheet>
This way, i get the following result:
<?xml version="1.0" encoding="utf-8"?>
<a>
<b /><c />
differentText
</a>
<a>
<b /><c />
differentText
</a>
<a>
<b /><c />
differentText
</a>
The result appears repeated 3 times because 3 matches are being done.. Why? I could i fix it? Thanks
I hava a JFrame with multiple JPanels of similar width aligned one below other. I use one of these JPanels to display a JTable which is the last JPanel of the lot. This JPanel has a JScrollpane as a child component. This is where I try to add my table dynamically. Initial height of this JScrollpane is set to 40.
I designed above template using Netbeans 6.8
Now I'm trying to add the table to the JPanel. When a button is pressed below code snippet is called. The class which includes this code extends javax.swing.JFrame class.
I am expecting below code would adjust table height according to the row count and display the table.
SearchTable = new JTable(RowData, DisplayNames) {
@Override
public boolean isCellEditable(int rowIndex, int vColIndex) {
return false;
}
};
// if row count is less than 10 then display all the rows without a scroll bar
if (SearchTable.getRowCount() < 10) {
pnl_tblpanel.setPreferredSize(new Dimension(625, SearchTable.getRowHeight() * (SearchTable.getRowCount() + 4)));
scr_tblholder.setPreferredSize(new Dimension(625, SearchTable.getRowHeight() * (SearchTable.getRowCount() + 4)));
} else {// if row count is more than 10 display first 10 rows and add a scroll bar
pnl_tblpanel.setPreferredSize(new Dimension(625, SearchTable.getRowHeight() * (10 + 2)));
scr_tblholder.setAutoscrolls(true);
}
//pnl_tblpanel.add(scr_tblholder);
scr_tblholder.setViewportView(SearchTable);
//pnl_tblpanel.repaint();
pnl_tblpanel.validate();
this.validate();
//this.repaint();
pnl_tblpanel.setVisible(true);
this.pack();
The table displays, but the table height is not changed according to the row count. It stays its default value. I have been trying many combinations of validate and repaint but nothing worked. (More in desperation)
Can anyone shed some light on this
Thank you
I have done
Dim qd as querydef
set qd = Querydefs("MyQuery")
set qd.sql = "..."
In debug qd.sql has been updated but the physical MyQuery still contains the old sql.
How to update this physical query ?