Search Results

Search found 2151 results on 87 pages for 'steve johnson'.

Page 21/87 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Help with OpenVPN setup on Windows Server 2003

    - by Bill Johnson
    Hi all, Just wondering if someone can assist me further with the set-up of OpenVPN on my Windows Server 2003. I have configured Win Server as per the following guide: http://tinyurl.com/kxusv and I'm now at the stage of Creating the config files. I have a few questions that I need some assistance with. My server IP is 192.168.1.10 and my routers IP address is 192.168.1.1 (the router is a Netgear DGN2000). I have edited the server.ovpn file as per the following: push "dhcp-option DNS X.X.X.X" # Replace the Xs with the IP address of the DNS for your home network (usually your ISP's DNS) push "dhcp-option DNS X.X.X.X" # A second DNS server if you have one to include my ISP DNS and I have not edited anything else. Now my issue is with the client1.opvpn file as per the below: client dev tap #dev-node MyTAP #If you renamed your TAP interface or have more than one TAP interface then remove the # at the beginning and change "MyTAP" to its name proto udp remote YOURHOST.dyndns.org 1194 #You will need to enter you dyndns account or static IP address here. The number following it is the port you set in the server's config route 192.168.1.0 255.255.255.0 vpn_gateway 3 #This it the IP address scheme and subnet of your normal network your server is on. Your router would usually be 192.168.1.1 resolv-retry infinite nobind persist-key persist-tun ca "C:\\Program Files\\OpenVPN\\easy-rsa\\keys\\ca.crt" cert "C:\\Program Files\\OpenVPN\\easy-rsa\\keys\\client1.crt" # Change the next two lines to match the files in the keys directory. This should be be different for each client. key "C:\\Program Files\\OpenVPN\\easy-rsa\\keys\\client1.key" # This file should be kept secret ns-cert-type server cipher BF-CBC # Blowfish (default) encrytion comp-lzo verb 1 To me it looks like I will need to amend the following: remote YOURHOST.dyndns.org 1194 #You will need to enter you dyndns account or static IP address here. The number following it is the port you set in the server's config route 192.168.1.0 255.255.255.0 vpn_gateway 3 #This it the IP address scheme and subnet of your normal network your server is on. Your router would usually be 192.168.1.1 So, should the first line be the static IP of the machine that I'm applying this to? The IP address of the server (192.168.1.10) or something else? I'm also stuck on the second part 'route 192.168.1.0 255.255.255.0 vpn_gateway 3' Should this be the router IP which is 192.168.1.1 and the subnet is 255.255.255.0 and that is all I need to alter? The final part that I'm stuggling with is Configuring the router. Basically I have a Netgear DGN2000 and as it mentions that the router should be configured to port forward port 1194 to the server’s IP address of 192.168.1.150 all I have been able to do is in 'Firewall Rules' and on 'Inbound Services', set the Service to 'Any(ALL) and Send to LAN Server point to 1923.168.1.150. I'm not sure if this is correct? It is the following stage of the help guide that I'm struggling with and really need some help with: You need to make sure the port you configured OpenVPN to listen on is forwarded on the router to the IP address of your server. On the WRT54G, port forwarding is configured in the “Applications & Gaming” section. Enter 1194 for the port, UDP for the protocol, and 192.168.1.150 for the IP address. Make sure the entry is enabled and then save the setting. Next, you need to add an entry to the router’s Routing Table. This will enable the router to properly route requests from the clients to the TAP interface of the server. On the WRT54G you would go to the “Setup” page and then the “Advanced Routing” section. Enter the follwing info to make the entry: Enter Route Name: openVPN Destination LAN IP: 192.168.10.0 Subnet Mask: 255.255.255.252 Default Gateway: 192.168.1.150 Interface: LAN & Wireless Once the info has been typed in make sure you save the setting. Can anyone possibly guide me through setting this part up with my Netgear router. I see that once I have these 2 parts complete I'm there so I would really appreciate someone walking me through what is required in completing this. Much appreciated.

    Read the article

  • Creating a network link between 2 very close buildings

    - by Daniel Johnson
    I have a charity who have two adjacent medium sized modern detached houses (in the UK): the buildings stand next to each other and are less than 5 metres apart. They have DSL connected to a single computer in one of the buildings. They want to add a network with wireless, and want it to work across both buildings. Being a charity they need to keep costs down. The network would be used for sharing Word documents, e-mail, browsing and skyping. My initial thoughts were to connect the buildings with fibre. So: Option 1 Use fibre between the buildings. Sufficient cable and two TP-LINK MC100CM Fast Ethernet Media Converters. Cost ~£80.00. But there is the extra cost and hassle of running the cable down and up the external walls, lifting and relaying paving, and burying underground. Never having fitted fibre I'm also a little worried about going up the wall and then bending the cable at 90 degrees to go through the wall and into the building. Option 2 Use two TP-Link TL-WA7510N High Powered Outdoor 5Ghz 15dBi Wireless antennas to connect the buildings. There is a clear line of sight at first floor level. Cost ~£100. And much easier to fit than fibre! Is using the TL-WA7510Ns overkill? Is there something more suitable? I had hoped to use some Netgear stuff, e.g. two DGN2200, one in each house and also use them to provide the wireless link between the buildings. However, in bridge mode wireless client association is not available and repeater mode with client association only supports WEP security which isn't strong enough. Is there something similar that would be up to the job? Option 3 Connect the buildings with UTP cable. My concerns here are risk of electric shock due to a difference of potential between the buildings (or are they so close this shouldn't be an issue) and protection from lightning strikes. Is fitting lighting arrestors expensive? And what can be done to ameliorate against the risk of shock? This all falls outside my area of expertise so I would really appreciate some advice.

    Read the article

  • Why did Intel drop the Itanium?

    - by Cole Johnson
    I was reading up on the history of the computer and I came along the IA-64 (Itanium) processors. They sounded really interesting and I was confused as to why Intel would decide to drop them. The ability to choose explicitly what 2 instructions you wanted to run in that cycle is a great idea, especially when writing your program in assembly, for example, a faster bootloader. The hundreds of registers should be convincing for any assembly programmer. You could essentially store all the functions variables in the registers if it doesn't call any other ones. The ability to do instructions like this: (qp) xor r1 = r2, r3 ; r1 = r2 XOR r3 (qp) xor r1 = (imm8), r3 ; r1 = (imm8) XOR r3 versus having to do: ; eax = r1 ; ebx = r2 ; ecx = r3 mov eax, ebx ; first put r2 into r1 xor eax, ecx ; then set r1 equivalent to r2 XOR r3 or ; SAME mov eax, (imm32) ; first put (imm32) into r1 xor eax, ecx ; then set r1 equivalent to (imm32) XOR r3 I heard it was because of no backwards x86 comparability, but couldn't thy be fixed by just adding the Pentium circuitry to it and just add a processor flag that would switch it to Itanium mode (like switching to Protected or Long mode) All the great things about it would have surly put them a giant leap ahead of AMD. Any ideas? Sadly this means you will need a very advanced compiler to do this. Or even one per specific model of the CPU. (E.g. a newer version of the Itanium with an extra feature would require different compiler). When I was working on a WinForms (target only had .NET 2.0) project in Visual Studio 2010, I had a compile target of IA-64. That means that there is a .NET runtime that was able to be compiled for IA-64 and a .NET runtime means Windows. Plus, Hamilton's answer mentions Windows NT. Having a full blown OS like Windows NT means that there is a compiler capable of generating IA-64 machine code.

    Read the article

  • Excel 2007: Filtering out rows in a table based on a list

    - by Sam Johnson
    I have a large table that looks like this: ID String 1 abcde 2 defgh 3 defgh 4 defgh 5 ijkl 6 ijkl 7 mnop 8 qrst I want to selectivley hide rows by populating a list of filterd values. For example, I'd like to filter out (hide) all rows that contain 'ef', 'kl', and 'qr'. Is there an easy way to do this? I know how to use Advanced filters to include only the rows that contain those substrings, but not the inverse. Has anyone does this before?

    Read the article

  • Servers/Websites Keep Going Down

    - by Tyler Johnson
    Okay, I'm a noobie. I know how to build and compose a website, but I have no idea what I'm doing when it comes to servers and server commands, etc. I've recently had a problem with all of my sites on our servers going down all at once and then I have to go in and reboot the server for them to come up again. At first this was annoying, but now it is becoming agonizing as it now takes 3-4 reboots for the websites to come back up. I contacted support for my hosting, but they are not being very helpful. They just keep telling me what the issue might be and basically telling me that I'm going to have to look into it and figure it out, which really isn't possible since I know nothing. Anyway, here are the things they said were possible reasons: They said I have "strange logs" in my Apache webserver log, error: sh: fetch: command not found. My php.ini memory limit is: 256M which is very high. It should be 32M or 64M. Server is reaching Max Clients, meaning we have more than 150 visitors at a time. (They supposedly "fixed" this, but the sites/server are still going down) I have some Wordpress sites with plugins getting errors like: PHP Warning: pack(): Type H: illegal hex digit G in... PHP Fatal error: Cannot use object of type stdClass as array in... PHP Fatal error: Maximum execution time of 30 seconds exceeded in... PHP Fatal error: Call to undefined function file_exists() in... PHP Parse error: syntax error, unexpected '<' I know that's a lot, but I really am at wits end and have no idea what to do now. If anyone could maybe give me some advice or point me in the right direction I would greatly appreciate it! Thanks! Oh, and here are the specs for my server: RAM: 2048MB CPU Shares: 40 Primary Disk: 50GB Data Transfer: 75GB Port Speed: 5Mbps Type: Linux

    Read the article

  • How can I prepare a TortoiseSVN installer to use the serf HTTP library instead of neon?

    - by Sam Johnson
    I'm going to be distributing instructions on how to access our new Subversion repository with TortoiseSVN. Because it's hosted on Windows, and we have some large files in the repository, we have to use the Serf HTTP library instead of neon. This is normally specified by manually editing the Subversion "servers" file on the client machine and adding the line http-library=serf Is there a way I can customize the TortoiseSVN installer to do this automatically? I'm just trying to get it up and running as easy as possible for our new SVN users.

    Read the article

  • Are there any easy ways to create a YouTube playlist or download queue from a text file?

    - by Eric Johnson
    In other words, if I have a list with entries formatted "[Artist Name] - [Track Name]" without advanced knowledge of their corresponding YouTube URLs (if any exist), how might I script things so that YouTube searches for each entry, and generates the URLs for the first n number of identical or similar entries per a YouTube query? Do any simple solutions come to mind that might lever wget, PowerShell, or Python? Thanks!

    Read the article

  • How to copy/paste LARGE amounts of text in Windows

    - by Johnson
    I am not sure if this is more suited for Superuser or Stackoverflow, but here goes... A little bit of background: I'm learning SQL and was trying to make a very large table which I could use for optimization tests. Something generic with random values. I created a little Java program to do just that, and was able to put out a text file with 100,000 lines, each line being an SQL INSERT statement for a new random record. However, with anything much bigger than 100,000 lines, I had problems either opening/using the text file in any text editor, or copying/pasting the text to the windows clipboard and then into SQL Developer so I could execute it as a script. I'm probably overlooking something really obvious, or doing something really stupid. There has got to be a better way to do this, but I couldn't find anything through Google or Stackoverflow or Superuser. Thanks!

    Read the article

  • Can I recover a lost text file in Windows 7?

    - by Marcus Johnson
    How can I recover a lost text file in Windows 7?? It has very important information in it and of course, it is gone because of the stupid Windows Update thing....it just automatically closed all of my stuff and restarted my computer!! Would the text file possibly be in the Temp folder in my computer?? I don't know much about this stuff...but I need it. I didn't save the file which makes me think I can never get it back...but I want to make sure. Thanks. I was using notepad.

    Read the article

  • Shared Exchange Calendar View

    - by Mark A Johnson
    My department creates a shared calendar for everyone to enter their out-of-office times. This requires duplicate entry for those of us who keep all our info in our own Exchange calendar. Is there a way in Exchange to create a View that's simply a combination view of multiple users' calendars? For example, we would create a view with all the departments' users calendars combined, but only those marked "out of office". Ideally, the subject line would also include the user's name, but this would not be 100% necessary.

    Read the article

  • Enabling Session State in SharePoint 2010?

    - by Steve Danner
    I have a web service built for SharePoint 2007 that I am trying to port to SharePoint 2010. This web service is dependent on session state to function properly, but so far, I have been enable to get session state to work at all in SharePoint 2010. This web service runs as its own web application under t he /_vti_bin virtual directory. I have tried all of the following with no luck: Ensured the "State Service" service application is running. Added the System.Web.SessionState.SessionStateModule http module to my application's web.config file. Added the System.Web.SessionState.SessionStateModule http module to my SharePoint root web.config file. Added <pages enableSessionState="true" /> to my application's web.config file. Added <pages enableSessionState="true" /> to my root web.config file. Additional Environment info: Visual Studio 2008 - SP1 .NET 3.5 - SP1 SharePoint 2010 - RC Windows Server 2008 R2 ASMX web service (not WCF) Had anyone had any luck getting a web application or web service to use session state in SharePoint 2010 yet? Thanks! Steve

    Read the article

  • What's the best way to refresh a UITableView within a UINavigationController hierarchy

    - by Steve Neal
    Hi, I'm pretty new to iPhone development and have struggled to find what I consider to be a neat way around this problem. I have a user interface where a summary of record data is displayed in a table inside a navigation controller. When the user clicks the accessory button for a row, a new view is pushed onto the navigation controller revealing a view where the user can edit the data in the corresponding record. Once done, the editing view is popped from the navigation controller's stack and the user is returned to the table view. My problem is that when the user returns to the table view, the table still shows the state of the data before the record was edited. I must therefore reload the table data to show the changes. It doesn't seem possible to reload the table data before it is displayed as the call only updates displayed records. Reloading it after the table has been displayed results in the old data changing before the user's eyes, which I'm not too happy with. This seems to me like a pretty normal thing to want to do in an iPhone app. Can anyone please suggest the best practice approach to doing this? I feel like I'm missing something. Cheers - Steve.

    Read the article

  • Forcing CLLocationManager updates - does it help or hurt?

    - by Steve N
    I've been trying to find any way to optimize the performance of my location-based iPhone application and have seen some people mention that you can force location updates by starting and stopping your CLLocationManager. I need the best accuracy I can get, and the user in my case would probably like to see updates every few seconds (say, 10 seconds) as they walk around. I've set the filters accordingly, but I notice that sometimes I don't get any updates on the device for quite some time. I'm testing the following approach, which forces an update when a fixed time interval passes (I'm using 20 seconds). My gut tells me this really won't help me provide more accurate updates to the user, and that just leaving CLLocationManager running all the time is probably the best approach. - (void)forceLocationUpdate { [[LocationManager locationManager] stopUpdates]; [[LocationManager locationManager] startUpdates]; [self performSelector:@selector(forceLocationUpdate) withObject:nil afterDelay:20.0]; } My question is- does forcing updates from CLLocationManager actually improve core location performance? Does it hurt performance? If I'm outside in an open field with good GPS reception, will this help then? Does anyone have experience trying this? Thanks in advance, Steve

    Read the article

  • How to read the birthday_date from the Facebook API

    - by Steve
    I have been chasing my tail on this! And it should be so simple!! I have an app in FaceBook that is working fine. However, I need to get the user's birth date. I have successfully got the request for extended permissions, but cannot get the birthday_date out and into a variable/store in database. <?php require_once('facebook.php'); $facebook = new Facebook(array( 'appId' => 'xxxxx', 'secret' => 'yyyyyyy', 'cookie' => true )); if ($facebook->getSession()) { $uid = $facebook->getUser(); $fbme = $facebook->api('/me'); } else { $params = array( 'fbconnect'=>0, 'canvas'=>1, 'req_perms'=>'publish_stream','email','user_location','user_birthday' ); $loginUrl = $facebook->getLoginUrl($params); print "<script type='text/javascript'>top.location.href = '$loginUrl';</script>"; } $session = $facebook->getSession(); $token = $session['access_token']; I would be very grateful if someone could show me the PHP code that reads the extended permissions and places the results into variables. Thanks Steve

    Read the article

  • FullCalendar events from asp.net ASHX page not displaying

    - by Steve Howard
    Hi I have been trying to add some events to the fullCalendar using a call to a ASHX page using the following code. Page script: <script type="text/javascript"> $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month, agendaWeek,agendaDay' }, events: 'FullCalendarEvents.ashx' }) }); c# code: public class EventsData { public int id { get; set; } public string title { get; set; } public string start { get; set; } public string end { get; set; } public string url { get; set; } public int accountId { get; set; } } public class FullCalendarEvents : IHttpHandler { private static List<EventsData> testEventsData = new List<EventsData> { new EventsData {accountId = 0, title = "test 1", start = DateTime.Now.ToString("yyyy-MM-dd"), id=0}, new EventsData{ accountId = 1, title="test 2", start = DateTime.Now.AddHours(2).ToString("yyyy-MM-dd"), id=2} }; public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json."; context.Response.Write(GetEventData()); } private string GetEventData() { List<EventsData> ed = testEventsData; StringBuilder sb = new StringBuilder(); sb.Append("["); foreach (var data in ed) { sb.Append("{"); sb.Append(string.Format("id: {0},", data.id)); sb.Append(string.Format("title:'{0}',", data.title)); sb.Append(string.Format("start: '{0}',", data.start)); sb.Append("allDay: false"); sb.Append("},"); } sb.Remove(sb.Length - 1, 1); sb.Append("]"); return sb.ToString(); } } The ASHX page gets called and returnd the following data: [{id: 0,title:'test 1',start: '2010-06-07',allDay: false},{id: 2,title:'test 2',start: '2010-06-07',allDay: false}] The call to the ASHX page does not display any results, but if I paste the values returned directly into the events it displays correctly. I am I have been trying to get this code to work for a day now and I can't see why the events are not getting set. Any help or advise on how I can get this to work would be appreciated. Steve

    Read the article

  • spring-roo dojox.grid.DataGrid not rendered

    - by Steve Wall
    Hello, I'm using spring-roo trying to use dojox.grid.DataGrid. The page renders as a plain table. Why does it not use the DataGrid? Thanks! Steve <div xmlns:spring="http://www.springframework.org/tags" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"><jsp:output omit-xml-declaration="yes" /> <script type="text/javascript"> dojo.require("dijit.TitlePane"); </script> <script type="text/javascript" src="&lt;c:url value=&quot;/resources/dojo/dojo.js&quot; /&gt;"> </script> <script type="text/javascript" src="&lt;c:url value=&quot;/resources/spring/Spring.js&quot; /&gt;"> </script> <script type="text/javascript" src="&lt;c:url value=&quot;/resources/spring/Spring-Dojo.js&quot; /&gt;"> </script> <script type="text/javascript"> dojo.require("dojox.grid.DataGrid"); dojo.require("dojox.data.CsvStore"); </script> <div id="_title"><spring:message var="app_name" code="application.name" /> <spring:message var="title" code="welcome.titlepane" arguments="${app_name}" /> <script type="text/javascript"> Spring.addDecoration(new Spring.ElementDecoration( { elementId : '_title', widgetType : 'dijit.TitlePane', widgetAttrs : { title : '${title}' } })); </script> <h4>Title</h4> <table dojoType="dojox.grid.DataGrid"> <thead> <tr> <th field="fieldName" width="200px">Column Name</th> <th field="fieldName" width="200px">Column Name</th> </tr> </thead> <tbody> <tr> <td>test1</td> <td>test2</td> </tr> <tr> <td>test3</td> <td>test4</td> </tr> </tbody> </table> </div> </div>

    Read the article

  • Best Practice for Images with Codeigniter : Generating Thumbs or Resizing on the Fly

    - by Steve K
    Hi all, I know there’s been a good deal written on thumbnail generation and the like with CI, but I wanted to explain what I’ve made and see what kind of best-practice advice I could find. Here’s my story… Currently, I have a site which allows users to upload collections of photos to projects they’ve created after first creating an account. Upon account creation, the site generates folders for the users in the following fashion for each of five pre-defined projects: /students/username/project_num/images/thumbs/ (This is to say that within a pre-created students folder, the username, project_num, images and thumbs folders are created recursively five times.) When a user uploads images to a project, I have a gallery controller which uploads the full images into the images folder for the project_num, and then creates a smaller thumbnail which maintains its ratio. So far so good. On the index page of the site, where these thumbnails and full images are displayed, I had a bit of a brain lapse, thinking I could simply output the full image while resizing it via css for a ‘medium-size’ image which would lead to the full-size image when clicked. (To be clear, the path is: Click on thumbnail— Load scaled full-size (medium-size) image via ajax into a display area above thumbs— Click on medium-sized image— Load full size image via lightbox, or something of that nature.) I have everything working to this point, except, as one might imagine, resizing the full-sized images with css doesn’t maintain aspect ratio for the thumbs, which means I need to find the best way to resize these. In thinking about it, I figured I had two options: I could resize the image on the fly when the user clicks a thumbnail to load the medium-sized image via ajax. (I have a method ‘get_image($url)’ in my gallery controller which simply loads a view with an image tag and the image source passed to it, etc.) I thought perhaps I could send it first to my gallery model, resize it there on the fly, and send it on to the view. The problem I’m having is that resizing it on the fly and echoing it out gives me the raw image data (I apologize, I don’t know that’s the right term). I’ve tried using data_uris to format the raw data into something echoable, but with no success. Is this method possible? The second option I considered was to generate a second medium-sized thumbnail when the user uploads the image with maintain_ratio set to true. This method is slightly less ideal, given that when providing a way for the user to delete their projects, I’ll need to scan for an additional set of images to delete. Not a huge deal, definitely, but something I figured could be avoided by generating the medium-sized image on the fly. I hope I’ve been clear in my explanations, if long-winded! I’m very curious to see what suggestions folks have about the best way to handle this. Much thanks for reading, and any suggestions are much-appreciated! Steve K.

    Read the article

  • Updating records with their subordinates via CTE or subquery

    - by Mike Jolley
    Let's say I have a table with the following columns: Employees Table employeeID int employeeName varchar(50) managerID int totalOrganization int managerID is referential to employeeID. totalOrganization is currently 0 for all records. I'd like to update totalOrganization on each row to the total number of employees under them. So with the following records: employeeID employeeName managerID totalOrganization 1 John Cruz NULL 0 2 Mark Russell 1 0 3 Alice Johnson 1 0 4 Juan Valdez 3 0 The query should update the totalOrganizations to: employeeID employeeName managerID totalOrganization 1 John Cruz NULL 3 2 Mark Russell 1 0 3 Alice Johnson 1 1 4 Juan Valdez 3 0 I know I can get somewhat of an org. chart using the following CTE: WITH OrgChart (employeeID, employeeName,managerID,level) AS ( SELECT employeeID,employeeName,0 as managerID,0 AS Level FROM Employees WHERE managerID IS NULL UNION ALL SELECT Employees.employeeID,Employees.employeeName,Employees.managerID,Level + 1 FROM Employees INNER JOIN OrgChart ON Employees.managerID = OrgChart.employeeID ) SELECT employeeID,employeeName,managerID, level FROM OrgChart; Is there any way to update the Employees table using a stored procedure rather than building some routine outside of SQL to parse through the data?

    Read the article

  • JSON Beautifier

    - by Randy Mayer
    Hi, do you know any "JSON Beautifier"? Thanks! From {"name":"Steve","surname":"Jobs","company":"Apple"} To { "name" : "Steve", "surname" : "Jobs", "company" : "Apple" }

    Read the article

  • WPF ComboBox SelectedValue not updating from binding source.

    - by vg1890
    Here's my binding source object: Public Class MyListObject Private _mylist As New ObservableCollection(Of String) Private _selectedName As String Public Sub New(ByVal nameList As List(Of String), ByVal defaultName As String) For Each name In nameList _mylist.Add(name) Next _selectedName = defaultName End Sub Public ReadOnly Property MyList() As ObservableCollection(Of String) Get Return _mylist End Get End Property Public ReadOnly Property SelectedName() As String Get Return _selectedName End Get End Property End Class Here is my XAML: <Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" xmlns:local="clr-namespace:WpfApplication1" > <Window.Resources> <ObjectDataProvider x:Key="MyListObject" ObjectInstance="" /> </Window.Resources> <Grid> <ComboBox Height="23" Margin="24,91,53,0" Name="ComboBox1" VerticalAlignment="Top" SelectedValue="{Binding Path=SelectedName, Source={StaticResource MyListObject}, Mode=OneWay}" ItemsSource="{Binding Path=MyList, Source={StaticResource MyListObject}, Mode=OneWay}" /> <Button Height="23" HorizontalAlignment="Left" Margin="47,0,0,87" Name="btn_List1" VerticalAlignment="Bottom" Width="75">List 1</Button> <Button Height="23" Margin="0,0,75,87" Name="btn_List2" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75">List 2</Button> </Grid> </Window> Here's the code-behind: Class Window1 Private obj1 As MyListObject Private obj2 As MyListObject Private odp As ObjectDataProvider Public Sub New() InitializeComponent() Dim namelist1 As New List(Of String) namelist1.Add("Joe") namelist1.Add("Steve") obj1 = New MyListObject(namelist1, "Steve") . Dim namelist2 As New List(Of String) namelist2.Add("Bob") namelist2.Add("Tim") obj2 = New MyListObject(namelist2, "Tim") odp = DirectCast(Me.FindResource("MyListObject"), ObjectDataProvider) odp.ObjectInstance = obj1 End Sub Private Sub btn_List1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btn_List1.Click odp.ObjectInstance = obj1 End Sub Private Sub btn_List2_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btn_List2.Click odp.ObjectInstance = obj2 End Sub End Class When the Window first loads, the bindings hook up fine. The ComboBox contains the names "Joe" and "Steve" and "Steve" is selected by default. However, when I click a button to switch the ObjectInstance to obj2, the ComboBox ItemsSource gets populated correctly in the dropdown, but the SelectedValue is set to Nothing instead of being equal to obj2.SelectedName. Thanks in advance!

    Read the article

  • DataRelation Insert and ForeignKey

    - by Steve
    Guys, I have a winforms application with two DataGridViews displaying a master-detail relationship from my Person and Address tables. Person table has a PersonID field that is auto-incrementing primary key. Address has a PersonID field that is the FK. I fill my DataTables with DataAdapter and set Person.PersonID column's AutoIncrement=true and AutoIncrementStep=-1. I can insert records in the Person DataTable from the DataGridView. The PersonID column displays unique negative values for PersonID. I update the database by calling DataAdapter.Update(PersonTable) and the negative PersonIDs are converted to positive unique values automatically by SQL Server. Here's the rub. The Address DataGridView show the address table which has a DataRelation to Person by PersonID. Inserted Person records have the temporary negative PersonID. I can now insert records into Address via DataGridView and Address.PersonID is set to the negative value from the DataRelation mapping. I call Adapter.Update(AddressTable) and the negative PersonIDs go into the Address table breaking the relationship. How do you guys handle primary/foreign keys using DataTables and master-detail DataGridViews? Thanks! Steve EDIT: After more googling, I found that SqlDataAdapter.RowUpdated event gives me what I need. I create a new command to query the last id inserted by using @@IDENTITY. It works pretty well. The DataRelation updates the Address.PersonID field for me so it's required to Update the Person table first then update the Address table. All the new records insert properly with correct ids in place! Adapter = new SqlDataAdapter(cmd); Adapter.RowUpdated += (s, e) => { if (e.StatementType != StatementType.Insert) return; //set the id for the inserted record SqlCommand c = e.Command.Connection.CreateCommand(); c.CommandText = "select @@IDENTITY id"; e.Row[0] = Convert.ToInt32( c.ExecuteScalar() ); }; Adapter.Fill(this); SqlCommandBuilder sb = new SqlCommandBuilder(Adapter); sb.GetDeleteCommand(); sb.GetUpdateCommand(); sb.GetInsertCommand(); this.Columns[0].AutoIncrement = true; this.Columns[0].AutoIncrementSeed = -1; this.Columns[0].AutoIncrementStep = -1;

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >