I have a WPF application that uses the navigation window and frames to navigate between xaml pages. Every time it goes between the pages it makes a click sound. Is there a way to disable that?
This should be easy but its proving difficult...
My element I want centred is exactly this <input type="text">
I don't want the text centred, just the text box within the outer div.
This is my attempt which is not working
<div class ="temp123">
<input type="text" />
</div>
Where:
.temp123
{
margin: 0 auto;
margin-left: auto;
margin-right: auto;
}
The text box remains on the left.
The outer div has a fixed with of 300px and itself is centered using margin: 0 auto;
I have a OneToMany relationship in an SQL Server database.
When I add the tables to my Linq to SQL diagram (DBML) the relationship comes up as OneToOne.
I have other OneToMany relationships which synchronise correctly.
Even If I change the cardinality to OneToMany the collection still only returns a single entity.
Could this be a bug?
Ever looked at the Computer Language Benchmarks Game (formerly known as the Great Language Shootout)?
Perl has some pretty healthy competition there at the moment. It also occurs to me that there's probably some places that Perl's scores could be improved. The biggest one is in the chameneos-redux script right now—the Perl version runs the worst out of any language: 1,626 times slower than the C baseline solution!
There are some restrictions on how the programs can be made and optimized, and there is Perl's interpreted runtime penalty, but 1,626 times? There's got to be something that can get the runtime of this program way down.
Taking a look at the source code and the challenge, how can the speed be improved?
First, I am NOT a python developer. I am trying to fix an issue within a python script that is being executed from the command line. This script was written by someone who is no longer around, and no longer willing to help with issues.
This is python 2.5, and for the moment it cannot be upgraded. Here are the lines of code in question:
start_time = datetime.strptime(str(paf.Start),"%Y-%m-%d %H:%M:%S")
dict_start = datetime(*start_time[:6])
end_time = datetime.strptime(str(paf.End),"%Y-%m-%d %H:%M:%S")
dict_end = datetime(*end_time[:6])
When this code is ran, it generates an error with the description: 'datetime.datetime' object is unsubscriptable.
This is the import statement:
from datetime import datetime
I have a feeling that this is something simple, but not being my native language and Google not yielding any valuable results, I am stuck. I have tried a couple of different import methods, yielding different errors, but all with these statements. Any help on this would be greatly appreciated.
I'm using DataAnnotations attributes to validate my model objects. My model class looks similar to this:
public class MyModel
{
[Required]
public string Title { get; set; }
[Required]
public List<User> Editors { get; set; }
}
public class User
{
public int Id { get; set; }
[Required]
public string FullName { get; set; }
[Required]
[DataType(DataType.Email)]
public string Email { get; set; }
}
My controller action looks like:
public ActionResult NewItem(MyModel data)
{
//...
}
User is presented with a view that has a form with:
a text box with dummy name where users enter user's names. For each user they enter, there's a client script coupled with ajax that creates an <input type="hidden" name="data.Editors[0].Id" value="userId" /> for each user entered (enumeration index is therefore not always 0 as written here), so default model binder is able to consume and bind the form without any problems.
a text box where users enter the title
Since I'm using Asp.net MVC 2 RTM which does model validation instead of input validation I don't know how to avoid validation errors.
The thing is I have to use BindAttribute on my controller action. I would have to either provide a white or a black list of properties. It's always a better practice to provide a white list. It's also more future proof.
The problem
My form works fine, but I get validation errors about user's FullName and Email properties since they are not provided. I also shouldn't feed them to the client (via ajax when user enters user data), because email is personal contact data and is not shared between users.
If there was just a single user reference on MyModel I would write
[Bind(Include = "Title, Editor.Id")]
But I have an enumeration of them. How do I provide Bind white list to work with my model?
Using EF we can use LINQ to read data which is rather simple (especialy using fluent calls), but we have less control unless we write eSQL on our own.
Is writing eSQL database actually data store independant code?
So if we decide to change data store, can the same statements still be used?
Is writing eSQL strings in your code pose any serious security threats similar to writing TSQL statements in plain strings?
So we moved to SPs. Could we still mode eSQL scripts outside of code as well and use some other technique to make them a bit more secure?
It's not clear to me what linking options exist for the Boost.Thread 1.34.1 library. I'm on Ubuntu 8.04 and I've found that using eitherr boost_thread or boost_thread-mt during linking both compile and run, but I don't see any documentation on these or any other linking options in above link.
What Boost.Thread linking options are available and what do the mean?
I have a Data Flow Task and am connecting to a database via an OLE DB Source component to extract data. This data feeds into a Conditional Split component to separate the data based on a simple expression.
After the evaluation of this expression, the data will end up in either of two locations: LocationA or LocationB.
Alright, I have that all set up and working properly. Once the data is separated into these two locations, additional processing is to be done on the records.
Here's where I am stuck: I need the the processing of records in LocationA to occur before the processing of records in LocationB.
Is there a way to set precedence of which tasks occur before others? If not, what is the best way to handle this? I was thinking I may need to write the data in LocationA and LocationB back out to the database and create a new data flow task in the control flow to handle the order of which these records must be dealt with.
Any help is greatly appreciated!
I'm trying to create a Silverlight line chart from an XMLRPC data source (coming from Drupal), what steps do I need to take? Is there a step by step tutorial anywhere on how to do this?
This is embarrassing, but I can't seem to find a way to list the names of the tables in our DB2 database. Here is what I tried:
root@VO11555:~# su - db2inst1
root@VO11555:~# . ~db2inst1/sqllib/db2profile
root@VO11555:~# LIST ACTIVE DATABASES
We receive this error: SQL1092N "ROOT" does not have the authority to perform the requested command or operation.
The DB2 version number follows.
root@VO11555:~# db2level
DB21085I Instance "db2inst1" uses "64" bits and DB2 code release "SQL09071"
with level identifier "08020107".
Informational tokens are "DB2 v9.7.0.1", "s091114", "IP23034", and Fix Pack
"1".
Product is installed at "/opt/db2V9.7".
Hi all
could you please help me find out the time complexity of the Fleury' algoritm(which is used to get the Eulerian circuit)?
Searched on the web,but no results.
thanks/
This is a Tips & Tricks question with the purpose of letting people accumulate their patterns, tips and tricks for Lua.
Lua is a great scripting language, however there is a lack of documented patterns, and I'm sure everyone has their favorites, so newcomers and people wondering if they should use it or not can actually appreciate the language's beauty.
I have the following class (abreviated for simplicity). The app it multi-threaded so the Set and Get are a bit more complicated but should be ok.
namespace News.RSS
{
public class FeedEngine : DependencyObject
{
public static readonly DependencyProperty _processing = DependencyProperty.Register("Processing", typeof(bool), typeof(FeedEngine), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
public bool Processing
{
get
{
return (bool)this.Dispatcher.Invoke(
DispatcherPriority.Normal, (DispatcherOperationCallback)delegate { return GetValue(_processing); }, Processing);
}
set
{
this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
(SendOrPostCallback)delegate { SetValue(_processing, value); },
value);
}
}
public void Poll()
{
while (Running)
{
Processing = true;
//Do my work to read the data feed from remote source
Processing = false;
Thread.Sleep(PollRate);
}
//
}
}
}
Next I have my main form as the following:
<Window x:Class="News.Main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:News.Converters"
xmlns:local="clr-namespace:News.Lookup"
xmlns:rss="clr-namespace:News.RSS"
Title="News" Height="521" Width="927" Initialized="Window_Initialized" Closing="Window_Closing" >
<Window.Resources>
<ResourceDictionary>
<converter:BooleanConverter x:Key="boolConverter" />
<converter:ArithmeticConverter x:Key="arithConverter" />
...
</ResourceDictionary>
</Window.Resources>
<DockPanel Name="dockPanel1" SnapsToDevicePixels="False" >
<ToolBarPanel Height="37" Name="toolBarPanel" Orientation="Horizontal" DockPanel.Dock="Top" >
<ToolBarPanel.Children>
<Button DataContext="{DynamicResource FeedEngine}" HorizontalAlignment="Right" Name="btnSearch" ToolTip="Search" Click="btnSearch_Click" IsEnabled="{Binding Path=Processing, Converter={StaticResource boolConverter}}">
<Image Width="32" Height="32" Name="imgSearch" Source="{Resx ResxName=News.Properties.Resources, Key=Search}" />
</Button>
...
</DockPanel>
</Window>
As you can see I set the DataContext to FeedEngine and Bind IsEnabled to Processing. I have also tested the boolConverter separately and it functions (just applies ! (Not) to a bool).
Here is my Main window code behind in case it helps to debug.
namespace News
{
/// <summary>
/// Interaction logic for Main.xaml
/// </summary>
public partial class Main : Window
{
public FeedEngine _engine;
List<NewsItemControl> _newsItems = new List<NewsItemControl>();
Thread _pollingThread;
public Main()
{
InitializeComponent();
this.Show();
}
private void Window_Initialized(object sender, EventArgs e)
{
// Load current Feed data.
_engine = new FeedEngine();
ThreadStart start = new ThreadStart(_engine.Poll);
_pollingThread = new Thread(start);
_pollingThread.Start();
}
}
}
Hope someone can see where I missed a step.
Thanks.
I have a gridview and, when a record is double-clicked, I want it to open up a new detail-view form for that particular record.
As an example, I have created a Customer class:
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.SqlClient;
using System.Collections;
namespace SyncTest
{
#region Customer Collection
public class CustomerCollection : BindingListView<Customer>
{
public CustomerCollection() : base()
{
}
public CustomerCollection(List<Customer> customers) : base(customers)
{
}
public CustomerCollection(DataTable dt)
{
foreach (DataRow oRow in dt.Rows)
{
Customer c = new Customer(oRow);
this.Add(c);
}
}
}
#endregion
public class Customer : INotifyPropertyChanged, IEditableObject, IDataErrorInfo
{
private string _CustomerID;
private string _CompanyName;
private string _ContactName;
private string _ContactTitle;
private string _OldCustomerID;
private string _OldCompanyName;
private string _OldContactName;
private string _OldContactTitle;
private bool _Editing;
private string _Error = string.Empty;
private EntityStateEnum _EntityState;
private Hashtable _PropErrors = new Hashtable();
public event PropertyChangedEventHandler PropertyChanged;
private void FirePropertyChangeNotification(string propName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propName));
}
}
public Customer()
{
this.EntityState = EntityStateEnum.Unchanged;
}
public Customer(DataRow dr)
{
//Populates the business object item from a data row
this.CustomerID = dr["CustomerID"].ToString();
this.CompanyName = dr["CompanyName"].ToString();
this.ContactName = dr["ContactName"].ToString();
this.ContactTitle = dr["ContactTitle"].ToString();
this.EntityState = EntityStateEnum.Unchanged;
}
public string CustomerID
{
get
{
return _CustomerID;
}
set
{
_CustomerID = value;
FirePropertyChangeNotification("CustomerID");
}
}
public string CompanyName
{
get
{
return _CompanyName;
}
set
{
_CompanyName = value;
FirePropertyChangeNotification("CompanyName");
}
}
public string ContactName
{
get
{
return _ContactName;
}
set
{
_ContactName = value;
FirePropertyChangeNotification("ContactName");
}
}
public string ContactTitle
{
get
{
return _ContactTitle;
}
set
{
_ContactTitle = value;
FirePropertyChangeNotification("ContactTitle");
}
}
public Boolean IsDirty
{
get
{
return ((this.EntityState != EntityStateEnum.Unchanged) || (this.EntityState != EntityStateEnum.Deleted));
}
}
public enum EntityStateEnum
{
Unchanged,
Added,
Deleted,
Modified
}
void IEditableObject.BeginEdit()
{
if (!_Editing)
{
_OldCustomerID = _CustomerID;
_OldCompanyName = _CompanyName;
_OldContactName = _ContactName;
_OldContactTitle = _ContactTitle;
}
this.EntityState = EntityStateEnum.Modified;
_Editing = true;
}
void IEditableObject.CancelEdit()
{
if (_Editing)
{
_CustomerID = _OldCustomerID;
_CompanyName = _OldCompanyName;
_ContactName = _OldContactName;
_ContactTitle = _OldContactTitle;
}
this.EntityState = EntityStateEnum.Unchanged;
_Editing = false;
}
void IEditableObject.EndEdit()
{
_Editing = false;
}
public EntityStateEnum EntityState
{
get
{
return _EntityState;
}
set
{
_EntityState = value;
}
}
string IDataErrorInfo.Error
{
get
{
return _Error;
}
}
string IDataErrorInfo.this[string columnName]
{
get
{
return (string)_PropErrors[columnName];
}
}
private void DataStateChanged(EntityStateEnum dataState, string propertyName)
{
//Raise the event
if (PropertyChanged != null && propertyName != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
//If the state is deleted, mark it as deleted
if (dataState == EntityStateEnum.Deleted)
{
this.EntityState = dataState;
}
if (this.EntityState == EntityStateEnum.Unchanged)
{
this.EntityState = dataState;
}
}
}
}
Here is my the code for the double-click event:
private void customersDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
Customer oCustomer = (Customer)customersBindingSource.CurrencyManager.List[customersBindingSource.CurrencyManager.Position];
CustomerForm oForm = new CustomerForm();
oForm.NewCustomer = oCustomer;
oForm.ShowDialog(this);
oForm.Dispose();
oForm = null;
}
Unfortunately, when this code runs, I receive an InvalidCastException error stating "Unable to cast object to type 'System.Data.DataRowView' to type 'SyncTest.Customer'".
This error occurs on the very first line of that event:
Customer oCustomer = (Customer)customersBindingSource.CurrencyManager.List[customersBindingSource.CurrencyManager.Position];
What am I doing wrong?... and what can I do to fix this? Any help is greatly appreciated.
Thanks!
Hi
My application runs for few hours, There is no increase in any value ( vmsize, memory) of Task Manager. But after few hours i get out of memory errors.
In sysinternals i see that "Virtual Size" is contineously increasing, and when it reach around 2 GB i start getting memory errors.
So what kind of memory leak is that ?
How can i demonstrate it with a code ? Is it possible to reproduce same thing with any piece of code where none of the memory value increase but only the Virtual Size in sysinternsl process explorer increase ?
thanks for any suggestions
Hi,
I have a Customers table and would like to assign a Salesperson to each customer in a round-robin fashion.
Customers
--CustomerID
--FName
--SalespersonID
Salesperson
--SalespersonID
--FName
So, if I have 15 customers and 5 salespeople, I would like the end result to look something like this:
CustomerID -- FName -- SalespersonID
1 -- A -- 1
2 -- B -- 2
3 -- C -- 3
4 -- D -- 4
5 -- E -- 5
6 -- F -- 1
7 -- G -- 2
8 -- H -- 3
9 -- I -- 4
10 -- J -- 5
11 -- K -- 1
12 -- L -- 2
13 -- M -- 3
14 -- N -- 4
15 -- 0 -- 5
etc...
I've been playing around with this for a bit and am trying to write some SQL to update my Customers table with the appropriate SalespersonID, but am having some trouble getting it to work.
Any ideas are greatly appreciated!
I'm following the demo code from article of phpsqlgeocode.html
In the db, I inserted some Chinese addresses, which is utf8 encode. I
found after urlencode the Chinese address, the output of the address
will be wrong.Like this one:
http://maps.google.com.tw/maps/geo?output=csv&key=ABQIAAAAfG3KxFZXjEslq8VNxMBpKRR08snBovzCxLQZ9DWwpnzxH-ROPxSAS9Q36m-6OOy0qlwTL6Ht9qp87w&q=%3F%3F%3F%3F%3F%3F%3F%3F%3F132%3F
Then output(can't query from php, it have to test as browser url
link),
200,5,59.3266963,18.2733433
Whose address is actually located in Taichung Taiwan, but turn out to
in Sweden Europe. But when I paste the Chinese address(such as ????????
?131?56?58?60?) in the url, the result turn out to be fine!!!
So my question is how to make sure it send out the original Chiness
address?? how to prevent urlencode()??? I found take urlencode() away
not change anything.
(I've change the MAPS_HOST from maps.google.com to
maps.google.com.tw.)
(I'm sure my key is right, and other English address geocoding are
fine.)
Thanks!!
I have a version control system (e.g. Subversion) and now I'd like to set up a build process. Now I have to create a version number and insert it into the system. But where does the version number come from and get into? Assume I want to use this common <major.<minor.<bugfix/revision scheme. Should I pass a number to the build script? Or should I pass arguments like increaseMajor, increaseMinor, increaseRevision? Or would you recommend to create a branch with the number which will be detected by the build script?
I could imagine that the major and minor version number have to be put in manually somewhere. The revision number could be increased automaically. But still I don't know where I would place the major and minor number.
In my case I have some php files that I would like to zip, but before I have to insert some version numbers into php file.
I have edited this post to try to make my request clearer:
I do not use Subversion, that was just an example. And I don't want to discuss the version number scheme.
Imagine I want to create version 3.5.0 or 3.5.1. Would I pass this version number to a build script? Would the script create the branch in the repository with this number or would it expect that someone has already created this branch? Manually? Or would the build script look for name of the branch (e.g. '3.5.1) and use it for further things? And does the version number come from my brain or is it automatically created (I guess the major/minor number it comes from my little brain and revision number is created)? Or would you place the number into a file that may gets inserted into the repository?
I guess if would use a release management tool I would insert the version number there. But I don't use one yet.
I'm trying to add JBoss repository to m2eclipse, mainly for Hibernate. It seems to work, but it can't find the latest version of Hibernate (3.5.1), only 3.5.0beta. I looked at some other packages, and they all seem a couple of months behind. What could be causing this?
I'm running latest m2eclipse, and i guess latest Eclipse (it just says 20100218-1602, eclipse people think it's funny to not include version in the about dialog), on ubuntu 9.10.
This is my settings.xml
<settings>
<profiles>
<profile>
<id>jboss-maven2-release-repository</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>jboss-maven2-release-repository</id>
<url>http://repository.jboss.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jboss-snapshots</id>
<url>http://snapshots.jboss.org/maven2</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-releases</id>
<url>http://repository.jboss.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>jboss-snapshots</id>
<url>http://snapshots.jboss.org/maven2</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
How do I create an Application Pool on IIS 6.0 using a Powershell script?
This is what I have come up with so far:
$appPool = [wmiclass] "root\MicrosoftIISv2:IIsApplicationPool"
Thanks
Just a sidenote: I'm not sure whether I should post this to serverfault as well, because some MOSS admin may have some info for me as well?
A bit of explanation first (without Asp.net MVC)
Is it possible to integrate the two? Is it possible to write an application that would share at least credential information with MOSS?
I have to write a MOSS application that has to do with these technologies:
MOSS 2010
Personal client certificates authentication (most probably on USB keys)
Active Directory Federation Services
Separate SQL DB that would serve application specific data (separate as not being part of MOSS DB)
How should it work?
Users should authenticate using personal certificates into MOSS 2010
There would be a certain part of MOSS that would be related to my custom application
This application should only authorize certain users via AD FS - I guess these users should have a certain security claim attached to them
This application should manage users (that have access to this app) with additional (app specific) security claims related to this application (as additional application level authorization rights for individual application parts)
This application should use custom SQL 2008 DB heavily with its own data
This application should have the possibility to integrate with external systems as well (Exchange for instance to inject calendar entries, ERP systems etc)
This application should be able to export its data (from its DB) to files. I don't know if it's possible, but it would be nice if the app could add these files to MOSS and attach authorization info to them so only users with sufficient rights would be able to view/open these files.
Why Asp.net MVC then?
I'm very well versed in Asp.net MVC (also with the latest version) and I haven't done anything on Sharepoint since version 2003 (which doesn't do me no good or prepare me for the latest version in any way shape or form). This project will most probably be a death march project so I would rather write my application as a UI rich Asp.net MVC application and somehow integrate it into MOSS. But not only via a link, because I would like to at least share credentials, so users wouldn't need to re-login when accessing my app. Using Asp.net MVC I would at least have the possibility to finish on time or be less death marching. Is this at all possible?
Questions
Is it possible to integrate Asp.net MVC into MOSS as described above?
If integration is not possible, would it be possible to create a completely MOSS based application that would work as described?
Which parts of MOSS 2010 should I use to accomplish what I need?
Ever looked at the Computer Language Benchmarks Game, (formerly known as the Great Language Shootout)?
Perl has some pretty healthy competition there at the moment. It also occurs to me that there's probably some places that Perl's scores could be improved. The biggest one is in the chameneos-redux script right now - the Perl version runs the worst out of any language : 1,626 times slower than the C baseline solution!
There are some restrictions on how the programs can be made and optimized, and there is Perl's interpreted runtime penalty, but 1,626 times? There's got to be something that can get the runtime of this program way down.
Taking a look at the source code and the challenge, what do you think could be done to reduce this runtime speed?
In our company we have a discussion whether to put project files into our RCS. What do you think? Consider an Eclipse project file for a C project that contain source and make files and other things. Would you put it into RCS?
I would like to change the formatting on my BASH prompt from this:
[email protected]:~/some/very/annoying/long/path$
to something like this:
[email protected]:~/some/very/annoying/long/path
$
The idea is that I would be able to type a reasonably long command on one line without it wrapping to the next line so quickly.