How do I delete all elements from a priority queue? That means how do I destroy a priority queue?
advanced thanks for u answer. Is there any clear- or erase-like method?
Please explain me what is happening. I have created a WinForms .NET application which has DataGridView on a form and should update database when DataGridView inline editing is used.
Form has SqlDataAdapter _da with four SqlCommands bound to it. DataGridView is bound directly to DataTable _names.
Such a CellValueChanged handler:
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
_da.Update(_names);
}
does not update database state although _names DataTable is updated. All the rows of _names have RowState == DataRowState.Unchanged
Ok, I modified the handler:
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
DataRow row = _names.Rows[e.RowIndex];
row.BeginEdit();
row.EndEdit();
_da.Update(_names);
}
this variant really writes modified cell to database, but when I attempt to insert new row into grid, I get an error about an absence of row with index e.RowIndex
So, I decided to improve the handler further:
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (_names.Rows.Count<e.RowIndex)
{
DataRow row = _names.Rows[e.RowIndex];
row.BeginEdit();
row.EndEdit();
}
else
{
DataRow row = _names.NewRow();
row["NameText"] = dataGridView1["NameText", e.RowIndex].Value;
_names.Rows.Add(row);
}
_da.Update(_names);
}
Now the really strange things happen when I insert new row to grid: the grid remains what it was until _names.Rows.Add(row); After this line THREE rows are inserted into table - two rows with the same value and one with Null value.
The slightly modified code:
DataRow row = _names.NewRow();
row["NameText"] = "--------------"
_names.Rows.Add(row);
inserts three rows with three different values: one as entered into the grid, the second with "--------------" value and third - with Null value.
I really got stuck in guessing what is happening.
I am pretty new to PHP and I am trying to make an inventory database. I have been trying to make it so that a user can enter a card ID and then amount the want to add to the inventory and have it update the inventory. For example someone could type in test and 2342 and it would update test. Here is what I have been trying with no success:
add.html
<body>
<form action="add.php" method="post">
Card ID: <input type="text" name="CardID" />
Amount to Add: <input type="text" name="Add" />
<input type="submit" />
</form>
</body>
</html>
add.php
<?php
$link = mysql_connect('tulsadir.ipowermysql.com', 'cbouwkamp', '!starman1');
if (!$link){
die('Could not connect: ' . mysql_error());
}
mysql_select_db("tdm_inventory", $link);
$add = $_POST[Add]
mysql_query("UPDATE cardLists SET AmountLeft = '$add' WHERE cardID = 'Test'");
echo "test successful";
mysql_close($link);
?>
This is probably a very common question, but I was unable to find an answer myself;
All my list elements call the function setQuery like this
onClick="admin_stats.setQuery(this);"
rather than [hardcode] add this to every list element, is there a way to simply have it run when a list element is clicked?
I'm not very familiar with jQuery Live or binding/unbinding, but I think they would play a role here?
Before I reinvent a rather square-looking wheel I thought I might ask =)
How to reduce gap between two display:inline items?
gap is showing on all browser?
ul.tabs li {
display:inline;
margin:0 padding:0;}
I can fix the problem using float:left in the LI elements but I need
to understand why it's happening.
question: how can i bind the same vector, lets say o=c(1,2,3,4) mutiple times to get a matrix like
o=array(c(1,2,3,4,1,2,3,4,1,2,3,4), dim(c(4,3))
o
[,1] [,2] [,3]
[1,] 1 1 1
[2,] 2 2 2
[3,] 3 3 3
[4,] 4 4 4
in a nicer way then: o=cbind(o,o,o) and maybe more generalized (dublicate()??
I need this to specifiy colors for elements in textplot()
thx a lot
I am developing with app engine SDK. I have a feeling this is much too basic a question so apologies ahead of time...
A simple submit button doesnt work instead of just showing an alert box as expected it continues on afterwards and redirects me to the latest http-request, and I think this is because I dont understand how to tell the browser to recognize the proper URLs.
Why does my browser say I am at the most recent http-request http://localhost:8080/putProjectInDB rather than the somepage.html that was actually served to the browser that I am currently looking at?
How can I get the browser to recognize and show in its url spot the normal expected http://somepage.html ?
Just in case, here are details of the specific problem which you might be able to ignore for answering the question:
This hasnt been mattered for me until I just wanted to put into my .html a simple button that changes some stuff of the page without needing the server. The below code after displaying the alert box redirects me to the last server request http://localhost:8080/putProjectInDB instead of just staying in the same html page.
in header:
function MyFormCommands() {
alert('Some Text');
}
in body:
<form onSubmit="MyFormCommands()" ><input type=submit ></form >
i have a form in drupal with jquery based date module. there are multiple fields with date picker enabled. i want to set the value of all of them (they all have class .date-popup-init) to the value of the first field (#edit-field, the 'from' date) when that field is set.
my code so far:
<script type="text/javascript">
var DatePicked = function() {
var firstdate = $("#edit-field");
var updater = firstdate.datepicker("getDate");
$(".date-popup-init").each(function(){
$(this).datepicker("setDate", updater);
});
}
$(function() {
$("#edit-field").datepicker({
onSelect: DatePicked
});
});
</script>
this seems to randomly work; it sets the date of some fields to the value of #edit-field, seemingly different fields each time.
also, the form adds more datepicker-enabled fields via ajax. is there any way to ensure that all these new fields, when they load, pick up the value of #edit-field as well?
disclaimer: last night was my first attempt at javascript of any kind. i have a basic idea now. the above was cobbled through countless google examples.
I'm working on a simple vote system. It works fine when the two files are together(locally).
However, when I publish it on blogger, it is unable to output the results. (on click the vote gets registered on the webhost, but the results just don't show!)
heres my code:
<script type="text/javascript">
function getVote(int)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("poll").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","http://pacontest.eu.pn/poll_vote.php?vote="+int,true);
xmlhttp.send();
}
</script>
<div id="poll">
<h3>Do you like this?</h3>
<form>
Yes:
<input type="radio" name="vote" value="0" onclick="getVote(this.value)" />
No:
<input type="radio" name="vote" value="1" onclick="getVote(this.value)" />
</form>
</div>
I have a Combobox to fill the data for City, State and PinCode
these combobox is dopdown list and the user will pick it.
and it loads once the form opens.
Here is the CODE:
/// CODE TO BRING A DATA FROM SQL INTO THE FORM DROP LIST
/// To fill the sates from States Table
cn = new SqlConnection(@"Data Source=Nick-PC\SQLEXPRESS;Initial Catalog=AutoDB;Integrated Security=True");
cmd= new SqlCommand("select * from TblState",cn);
cn.Open();
SqlDataReader dr;
try
{
dr = cmd.ExecuteReader();
while (dr.Read())
{
SelectState.Items.Add(dr["State"].ToString());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
cn.Close();
}
//To fill the Cities from City Table
cn1 = new SqlConnection(@"Data Source=Nick-PC\SQLEXPRESS;Initial Catalog=AutoDB;Integrated Security=True");
cmd1 = new SqlCommand("SELECT * FROM TblCity", cn);
cn.Open();
SqlDataReader ds;
try
{
ds = cmd1.ExecuteReader();
while (ds.Read())
{
SelectCity.Items.Add(ds["City"].ToString());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
cn1.Close();
}
// To fill the Data in the Pincode from the City Table
cn2 = new SqlConnection(@"Data Source=Nick-PC\SQLEXPRESS;Initial Catalog=AutoDB;Integrated Security=True");
cmd2 = new SqlCommand("SELECT (Pincode) FROM TblCity ", cn2);
cn2.Open();
SqlDataReader dm;
try
{
dm = cmd2.ExecuteReader();
while (dm.Read())
{
SelectPinCode.Items.Add(dm["Pincode"].ToString());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
cn2.Close();
}
its kinda Big, i am doing the same steps for all the combo-box, but is there a way i can merge it in a simple way.
I was making this simple trial, but can anyone tell me why the distance from the border of DIV to the H2 header is so much ? How can I reduce it ? I don't want space ...
Prova WIDGET
<link rel="stylesheet" href="jquery-ui-1.8.custom/css/smoothness/jquery-ui-1.8.custom.css" type="text/css">
<link rel="stylesheet" href="jquery-ui-1.8.custom/development-bundle/ui/jquery-ui-1.8.custom.css" type="text/css">
<script src="jquery-ui-1.8.custom/development-bundle/jquery-1.4.2.js" type="text/javascript"></script>
<script src="jquery-ui-1.8.custom/js/jquery-ui-1.8.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(themify);
function themify(){
$("div").addClass("ui-widget ui-widget-content ui-corner-all");
$("input").addClass("ui-button ui-button-text");
$(":header").addClass("ui-widget-header ui-corner-all"); //ui-widget
}
</script>
<style>#test{display:none}</style>
<script type="text/javascript">
function rendiVisibile(){
if(document.getElementById("test").style.display = "none"){
$("#test").css({"width":"200px","float":"right","text-align":"center"});
$("#test").show("slide",{},1000);
}
}
</script>
</head>
<body>
<h2>Tentativo widget con DIV</h2>
<form action="">
<input type="button" value="Submit" id="pulsante" onclick="rendiVisibile()";><br/></br>
<div id="test">
<h2>CIAO</h2>
Un saluto
</div>
</form>
</body>
var arr1:Array = new Array();
arr1.push(item1);
arr1.push(item2);
arr1.push(item3);
then arr1 and its elements get passed to other functions
is there a way to know the index of an item in the array?
GetParentArrayIndex(item2) would give me 1;
I have an asp.net usercontrol which represents a "popup" dialog. Basically, it's a wrapper for the jQuery UI dialog which can be subclassed to easily make dialogs.
As part of this control, I need to inject a div into the page the control is used on, either at the very top or very bottom of the form so that when the popup is instantiated, it's parent is changed to this div. This allows "nested" popups without the child popup being trapped inside the parent popup.
The trouble is, I can't find a safe way to inject this div into the page. A usercontrol doesn't have a preinit event, so I can't do it there, and calling Page.Form.Controls.Add(...) in Init, Load or PreRender causes the standard exception "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases."
I thought I had found a solution by using...
ScriptManager.RegisterClientScriptBlock(Page, Me.GetType, UniqueID + "_Dialog_Div", containerDiv, False)
... which seemed to work well normally, but recently a coworker tried putting an UpdatePanel inside the dialog and now she's getting the error "The script tag registered for type 'ASP.controls_order_viewzips_ascx' and key 'ctl00$ContentBody$OViewZips_Dialog_Div' has invalid characters outside of the script tags: . Only properly formatted script tags can be registered."
How are you supposed to add controls to the pages control collection from inside a user control?
Hi,
i m starting a new project that would basically take input from user and save them to database among about 30 screens, and i would like to find a framework that will allow the maximum number of these features out of the box :
.net c#.
windows form.
unit testing
continuous integration
logging
screens with lists, combo boxes, text boxes, add, delete, save, cancel that are easy to update when you add a property to your classes or a field to your database.
auto completion on controls to help user find its way
use of an orm like nhibernate
easy multithreading and display of wait screens for user
easy undo redo
tabbed child windows
search forms
ability to grant access to some functionnalities according to user profiles
mvp/mvvm or whatever design patterns
either some code generation from database to c# classe or generation of database schema from c# classes
some kind of database versioning / upgrade to easily update database when i release patches to application once in production
automatic control resizing
code metrics analysis
some code generator i can use against my entities that would generate some rough form i can rearrange after
code documentation generator
...
At this point i have 3 options :
Build from scratch on top of clr :(
Find functionnalities among several open source framework and use them as a stack for infrastucture
Find a "software factory"
I know its lot but i really would like to use existing code to build upon so i can focus on business rules.
What open source tools would u use to achieve these ?
hi :)
after an hour of trying to find a solution, I give up (temporarily). "this.selectedIndex = -1" clears all select element just fine in FF and other browsers, but NOT in Internet Explorer 8.
any idea how to clear select elements in IE?
thanks!
I have an arraylist (eg: h1) contain some urls.
eg: http://www.google.com,http://www.yahoo.com,http://www.xyz.com,.....
How can i put hyperlinks to each elements in that arraylist in c# ? Means by clicking on that url it should navigate to corresponding website.Can you give an example??
Also, how can i use 'Hyperlink' keyword in c# ?
I've created a simple menu and submenu with tags(not allowed to use ul elements). To access the submenu the user hovers their mouse over the menu item. I use the onmouseover and onmouseout events to either show or hide the sub menu depending on which item is selected.
A pipe (|) is used to seperate each submenu item and this is what is causing me problems.
When a user hovers their mouse above the pipe character the subMenu div calls the onmouseout event which is not what I want. So I added padding around the pipe character and a minus margin so that there were no gaps between the pipe character and the other elements.
This worked for all browsers including IE8. But in IE7 (I haven't tested IE6 yet) the submenu div calls the onmouseout event when I touch the top bit of either the left or right border of the pipe character span element.
<div id="subMenu" onmouseout="hideSubMenu()" >
<div id="opinionSubMenu" onmouseover="showOpinionSubMenu()">
<a id="Blogs" href="HTMLNew.htm">BLOGS</a>
<span class="SubMenuDelimiter">|</span>
<a id="Comments" href="HTMLNew.htm">COMMENTS</a>
<span class="SubMenuDelimiter">|</span>
<a id="Views" href="HTMLNew.htm">VIEWS</a>
</div>
<div id="learningSubMenu" onmouseover="showLearningSubMenu()">
<a id="Articles" href="HTMLNew.htm">ARTICLES</a>
<span class="SubMenuDelimiter">|</span>
<a id="CoursesCases" href="HTMLNew.htm">COURSES & CASES</a>
<span class="SubMenuDelimiter">|</span>
<a id="PracticeImpact" href="HTMLNew.htm">PRACTICE IMPACT</a>
</div>
</div>
This is my css class
#subMenu{
padding:10px 0px;
background-color:#F58F2D;
font-weight:normal;
text-decoration:none;
font-family:Lucida Sans Unicode;
font-size:14px;
float:left;
width:100%;
display:none;}
#Blogs, #Comments, #Views, #Articles
{
padding:10px 5px;
background:none repeat scroll 0 0 transparent;
color:#000000;
font-weight:normal;
text-decoration:none;
border:solid 1px black;}
#Blogs:hover, #Comments:hover, #Views:hover, #Articles:hover{
color:#ffffff;
text-decoration:none;}
.SubMenuDelimiter{
padding:10px 5px;
margin:10px -5px;}
Hello all,
in my current site, i am using the new Jscrollpane in order to generate a scrollbar for a menu (not my descision but the designer's descision so i dont wanna get into how 90's that all looks like..).
my menu is based on a <UL> the <li> elements inside it have the attribute "text-align: right;".
my problem that on IE alone the menu text doesnt show when i apply the ScrollPane to the menu. when i delete the ScrollPane function from my code- the menu re-appears.
i checked the page with "microsoft Expression" DOM inspector in order to examine how IE sees my code and i can see the <li> elements there, only the text inside them is missing.
when i disable the "text-align: right;" for the <li> in my CSS, the text shows again.
i suspect this has something to do with the jScrollPane's containing which is relatively aligned but i cannot be sure..
can anyone suggest some fix for this problem?
a link to a page where you can see the problem is here:
http://kaplanoland.com/index.php?option=com_content&view=article&id=2&Itemid=12
the problematic menu is on the right side of the page. on every browser but IE you can see the text. only on IE not.
my CSS code for that menu (not including the jScrollPane CSS) is here:
div#menu2{
position: absolute;
top: 123px;
right: 36px;
width: 330px;
height: 150px;
}
div#menu2_scroll{ /*the actual scroller*/
height: 150px;
}
div#menu2 div#menu2_contain{
}
div#menu2 li{
text-align: right;
}
div#menu2 li span{
line-height: 18px;
}
div#menu2 a:link,
div#menu2 a:visited{
color: #808285 ;
font-family: Arial, Helvetica, sans-serif ;
font-size: 12px ;
}
div#menu2 a:hover,
div#menu2 li#current a{
color: #000000 ;
font-family: Arial, Helvetica, sans-serif ;
font-size: 12px ;
}
div#menu2 span.separator{
display: block;
padding-top: 12px;
padding-bottom: 40px;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #000000;
}
div#menu2 span.separator span {
padding-top: 12px;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #808285;
}
thank you all so much.
Hello,
I am developing a web application, where i want to give freedom of changing style elements of css linked to a page via an admin screen. So I am wondering is there any way I can load CSS file into a C# object or into XML passable formate and update it from the admin screen inputs?
Thank you,
Krishnaraj
I'm getting a datetime string in a format like "2009-05-28T16:15:00" (this is ISO 8601, I believe) one hack-ish option seems to be to parse the string using time.strptime and passing the first 6 elements of the touple into the datetime constructor, like:
datetime.datetime(*time.strptime("2007-03-04T21:08:12", "%Y-%m-%dT%H:%M:%S")[:6])
I haven't been able to find a "cleaner" way of doing this, is there one?
In my application I have methods which returns a control (checkbox, radiobutton, textbox) but I want to use the same class for my webform and winform. How can I achieve this? I was thinking about an interface, but I don't know how to implement this.
In my code I have the following methods:
public TextBox GenerateTextfield(AnswerPossibility answerPossibility)
{
TextBox textBox = new TextBox();
textBox.Tag = answerPossibility.Tag;
return textBox;
}
public Collection<ButtonBase> GenerateMultipleChoice(Collection<AnswerPossibility> answers)
{
Collection<ButtonBase> checks = new Collection<ButtonBase>();
foreach (AnswerPossibility a in answers)
{
CheckBox chk = new CheckBox();
chk.Text = a.Text;
chk.Name = "chk" + a.Id.ToString();
chk.Tag = a.Tag;
checks.Add(chk);
}
return checks;
}
How can I make this so, that I can use this methods in a win form as well in a web form?
http://www.sendspace.com/file/2zlfgn
I have the php files i been trying to get them to save to xml.
I have tried
$product1=array();
$product1['id'] = new product( "19990","modrl","maf","purpose","war");
only the ID writes to xml. since model,maf etc are sub-elements is there a different way to create the objectarray?
I have a web app that is using jQuery to replace the RETURN key with TAB so that when I user presses return the form is not submitted but rather the cursor moves to the next text field.
This works in all browsers but only 1/2 works on the iPad. On the iPad the next field is highlighted but the keyboard is hidden. How can I keep the keyboard visible or force it somehow?
Here's my code (thanks to http://thinksimply.com/blog/jquery-enter-tab):
function checkForEnter (event) {
if (event.keyCode == 13) {
currentBoxNumber = textboxes.index(this);
if (textboxes[currentBoxNumber + 1] != null) {
nextBox = textboxes[currentBoxNumber + 1]
nextBox.focus();
nextBox.select();
event.preventDefault();
return false;
}
}
}
Drupal.behaviors.formFields = function(context) {
$('input[type="text"]').focus(function() { $(this).removeClass("idleField").addClass("focusField"); });
$('input[type="text"]').blur(function() { $(this).removeClass("focusField").addClass("idleField"); });
// replaces the enter/return key function with tab
textboxes = $("input.form-text");
if ($.browser.mozilla) {
$(textboxes).keypress (checkForEnter);
} else {
$(textboxes).keydown (checkForEnter);
}
};
Example:
$arr = array('apple'='sweet','grapefruit'='bitter','pear'='tasty','banana'='yellow');
I want to switch the positions of grapefruit and pear, so the array will become
'apple'='sweet','pear'='tasty','grapefruit'='bitter','banana'='yellow')
I know the keys and values of the elements I want to switch, is there an easy way to do this? Or will it require a loop + creating a new array?
Thanks
Is there a way to add, specifically, formelements for every day that are distinguishable per day? Below is an example.
I know FullCalendar is built to handle "Events", so from what I can tell in the docs, it's not really possible. But I'm not a Javascript guru either, so would anyone else know of a solution? I'm hoping to not have to reinvent the wheel.