Search Results

Search found 10 results on 1 pages for 'dtb'.

Page 1/1 | 1 

  • How do I compare two datatables

    - by cmrhema
    I have a datatable that will consist of 72 columns. I will download it in the excel sheet using VSTO, which works fine. Now the user will change either one of these rows or all of these rows and will also insert a fresh row. Considering the datatable downloaded first to be dtA, and the one that has been modified in the excel sheet to be dtB. I want to compare dtA and dtB. I need to find out all the rows in dtB that do not exist in dtA. I cant put foreach loop for each and every single row and evaluate as its a very untidy way of coding. What is a better way to do this? I did this way, DataTable dtA = new DataTable(); dtA.Columns.Add("ENo"); dtA.Columns.Add("ENo1"); dtA.Columns.Add("ENo2"); dtA.Columns.Add("ENo3"); dtA.Columns.Add("ENo4"); for (int i = 0; i < 5; i++) { DataRow dr = dtA.NewRow(); dr[0] = "Part 0 " + i.ToString(); dr[1] = "Part 1 " + i.ToString(); dr[2] = "Part 2 " + i.ToString(); dr[3] = "Part 3 " + i.ToString(); dr[4] = "Part 4 " + i.ToString(); dtA.Rows.Add(dr); } DataTable dtB = new DataTable(); dtB.Columns.Add("ENo"); dtB.Columns.Add("ENo1"); dtB.Columns.Add("ENo2"); dtB.Columns.Add("ENo3"); dtB.Columns.Add("ENo4"); for (int i = 5; i < 10; i++) { DataRow dr = dtB.NewRow(); dr[0] = "Part 0 " + i.ToString(); dr[1] = "Part 1 " + i.ToString(); dr[2] = "Part 2 " + i.ToString(); dr[3] = "Part 3 " + i.ToString(); dr[4] = "Part 4 " + i.ToString(); dtB.Rows.Add(dr); } Response.Write("\n"); Response.Write("dt A"); Response.Write("\n"); for (int i = 0; i < dtA.Rows.Count; i++) { Response.Write(dtA.Rows[i][i].ToString()); Response.Write("\n"); } Response.Write("\n"); Response.Write("dt B"); Response.Write("\n"); for (int i = 0; i < dtB.Rows.Count; i++) { Response.Write(dtB.Rows[i][i].ToString()); Response.Write("\n"); } var VarA = dtA.AsEnumerable(); var varB = dtA.AsEnumerable(); var diff = VarA.Except(varB); Response.Write("except"); foreach (var n in diff) { Response.Write(n.Table.Rows[0].ToString()); } But I do not know what to use in the foreach var, What should I use pls?

    Read the article

  • tftpd-hpa service must be restarted before working after fresh boot

    - by Steve
    I'm running Ubuntu 12.04 inside a VirtualBox VM. I've installed tftpd-hpa so I can boot an embedded Linux device via tftp. My problem is that after a fresh boot of the VM, tftpd doesn't seem to work until I restart the service, after which is works great until the system is rebooted. The transcript below should explain the situation. EDIT: After the fresh boot, I execute netstat -a | grep tftp and find nothing. After restarting the service, the same command returns udp 0 0 *:tftp *:* (whitespace removed). I think this might be the key to the problem, I'm just not sure how to resolve it. I don't think it's related to this specific issue, but I had another problem with tftpd that was asked and answered in this question. steve@steve-VirtualBox:~$ cat /etc/default/tftpd-hpa # /etc/default/tftpd-hpa TFTP_USERNAME="tftp" TFTP_DIRECTORY="/var/lib/tftpboot" TFTP_ADDRESS="0.0.0.0:69" TFTP_OPTIONS="--secure" steve@steve-VirtualBox:~$ ls -l /var/lib/tftpboot total 8204 -rw-r--r-- 1 root root 34352 May 28 08:22 am335x-boneblack.dtb -rw-r--r-- 1 root root 33206 May 28 08:22 am335x-bone.dtb -rw-r--r-- 1 root root 41564 May 28 08:22 am335x-evm.dtb -rw-r--r-- 1 root root 38048 May 28 08:22 am335x-evmsk.dtb -rwxr-xr-x 1 root root 4117904 May 20 09:39 zImage -rw-r--r-- 1 root root 4117616 May 28 08:22 zImage-am335x-evm.bin steve@steve-VirtualBox:~$ tftp localhost tftp> get zImage Transfer timed out. tftp> quit steve@steve-VirtualBox:~$ sudo service tftpd-hpa restart [sudo] password for steve: tftpd-hpa stop/waiting tftpd-hpa start/running, process 2106 steve@steve-VirtualBox:~$ tftp localhost tftp> get zImage Received 4143798 bytes in 1.4 seconds tftp> quit steve@steve-VirtualBox:~$

    Read the article

  • selectLimit in JQgrid

    - by Leander
    Hallo, I have a problem. I'am trying to get some data from my database. But with a limit. So i use the selectLimit command. But when i load the grid my firebug gives the following error: "parsererror"?e:null},parse:function(d...d(a.fn.jqGrid,d);this.no_legacy_api|| When I go to the selectLimit in the jqgrid.php and print out what the function returns it normaly return an array with all 500 objects with the correct data. This is the code of the grid: <?php require_once ($_SERVER['DOCUMENT_ROOT'].'/includes_config/config.inc.php'); require_once ($_SERVER['DOCUMENT_ROOT'].'/portal/classes/core/database/class_Database_control.php'); $dtb = new clsDatabaseControl(); $dtb = $dtb->getDatabase(ConnectionString); $dtb->doConnect(); require_once (ClassRoot.'/3rd/jqgrid/jq-config.php'); require_once (ClassRoot.'/3rd/jqgrid/php/jqGrid.php'); require_once (ClassRoot.'/3rd/jqgrid/php/jqGridPdo.php'); //require_once (ClassRoot.'/modules/logging/class_logging_control.php'); // //$oLogginControl = new clsLoggingControl($dtb); //$sSQL = $oLogginControl->getAanmeldingenGrid(); $sSQL = "SELECT LogAanmeldID, LogAanmeldStamp, UserFirstName, UserLastName, LogAanmeldIP, LogAanmeldMethod, LogAanmeldHost, LogAanmeldAgent FROM log_aanmelden, user WHERE log_aanmelden.LogAanmeldUserID = user.UserID"; $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); $conn->query("SET NAMES utf8"); $grid = new jqGridRender($conn); //$grid->SelectCommand = $sSQL; $grid->selectLimit($sSQL ,500,1); $grid->dataType = 'json'; $grid->setColModel(); $grid->setUrl('modules/module_logging/index.php?grid=2'); $grid->setGridOptions(array( "hoverrows"=>true, //"sortname"=>"naam", "height"=>450 )); // Enable toolbar searching $grid->toolbarfilter = true; $grid->setFilterOptions(array("stringResult"=>true)); $grid->navigator = true; $grid->setNavOptions('navigator', array("excel"=>true,"add"=>false,"edit"=>false,"del"=>false,"view"=>true, "refresh"=>false)); $custom = <<<CUSTOM $(document).ready(function() { gridParentWidth = $(window).width(); $('#grid').jqGrid('setGridWidth',gridParentWidth-10); }) $(window).resize(function() { gridParentWidth = $(window).width(); $('#grid').jqGrid('setGridWidth',gridParentWidth-10); }); function formatAddAdresboek(cellValue, options, rowObject) { var imageHtml = "<a href='?FFID=51000&TID=1&INS=3&contactID=" + cellValue + "' originalValue='" + cellValue + "'><img border='0' alt='Toevoegen aan Persoonlijk Adresboek' src='images/16X16/new_user.gif'/></a>"; imageHtml = imageHtml + " <a href='?FFID=51000&TID=2&INS=3&contactID=" + cellValue + "' originalValue='" + cellValue + "'><img border='0' alt='Toevoegen aan Praktijk Adresboek' src='images/16X16/new_usergroup.gif'/></a>"; return imageHtml; } function unformatAddAdresboek(cellValue, options, cellObject) { return $(cellObject.html()).attr("originalValue"); } CUSTOM; $grid->setJSCode($custom); // Enjoy $grid->renderGrid('#grid','#pager',true, null, null, true,true); $conn = null; ?> When I inspect the $_GET the answer is empty and in stead of a JSON tab there is an HTML tab. When i use the selectCommand in stead of the selectLimit it return all the data correct as an json object an parses it correcly in the grid but it doens't use the LIMIT, Because when i add the limit. PDO doens't work anymore. So how do I get the object from the selectLimit to the grid? Can someone please help me get the grid working?

    Read the article

  • Normalizing chains of .Skip() and .Take() calls

    - by dtb
    I'm trying to normalize arbitrary chains of .Skip() and .Take() calls to a single .Skip() call followed by an optional single .Take() call. Here are some examples of expected results, but I'm not sure if these are correct: .Skip(5) => .Skip(5) .Take(7) => .Skip(0).Take(7) .Skip(5).Skip(7) => .Skip(12) .Skip(5).Take(7) => .Skip(5).Take(7) .Take(7).Skip(5) => .Skip(5).Take(2) .Take(5).Take(7) => .Skip(0).Take(5) .Skip(5).Skip(7).Skip(11) => .Skip(23) .Skip(5).Skip(7).Take(11) => .Skip(12).Take(11) .Skip(5).Take(7).Skip(3) => .Skip(8).Take(4) .Skip(5).Take(7).Take(3) => .Skip(5).Take(4) .Take(11).Skip(5).Skip(3) => .Skip(8).Take(3) .Take(11).Skip(5).Take(7) => .Skip(5).Take(6) .Take(11).Take(5).Skip(3) => .Skip(3).Take(2) .Take(11).Take(5).Take(3) => .Skip(0).Take(3) Can anyone confirm these are the correct results to be expected? Here is the basic algorithm that I derived from the examples: class Foo { private int skip; private int? take; public Foo Skip(int value) { if (value < 0) value = 0; this.skip += value; if (this.take.HasValue) this.take -= value; return this; } public Foo Take(int value) { if (value < 0) value = 0; if (!this.take.HasValue || value < this.take) this.take = value; return this; } } Any idea how I can confirm if this is the correct algorithm?

    Read the article

  • I really need help with Delphi... text files and arrays with sorting?

    - by DTB
    I have read a text file (of names) into an array and I need how to sort those names into alphabetical order and display that in a rich edit? Please give me the code from this point onwards: readln(myfile,arr[i]); 'myfile' is the text file and 'arr' is the array of string. Also, I have declared 'i' as an integer even though it is a array of string. Is that OK?

    Read the article

  • CodeContracts: Possibly calling a method on a null reference

    - by dtb
    I'm having an argument with the CodeContracts static analysis tool. My code: class Foo { private static Foo instance = new Foo(); private string bar; public Foo() { bar = "Hello World"; } public static int BarLength() { return instance.bar.Length; // <<-- } } The tool tells me that instance.bar may be a null reference. I believe the opposite. Who is right? How can I prove it wrong?

    Read the article

  • Django form linking 2 models by many to many field.

    - by Ed
    I have two models: class Actor(models.Model): name = models.CharField(max_length=30, unique = True) event = models.ManyToManyField(Event, blank=True, null=True) class Event(models.Model): name = models.CharField(max_length=30, unique = True) long_description = models.TextField(blank=True, null=True) I want to create a form that allows me to identify the link between the two models when I add a new entry. This works: class ActorForm(forms.ModelForm): class Meta: model = Actor The form includes both name and event, allowing me to create a new Actor and simultaneous link it to an existing Event. On the flipside, class EventForm(forms.ModelForm): class Meta: model = Event This form does not include an actor association. So I am only able to create a new Event. I can't simultaneously link it to an existing Actor. I tried to create an inline formset: EventFormSet = forms.models.inlineformset_factory(Event, Actor, can_delete = False, extra = 2, form = ActorForm) but I get an error <'class ctg.dtb.models.Actor'> has no ForeignKey to <'class ctg.dtb.models.Event'> This isn't too surprising. The inlineformset worked for another set of models I had, but this is a different example. I think I'm going about it entirely wrong. Overall question: How can I create a form that allows me to create a new Event and link it to an existing Actor?

    Read the article

  • Users database empty after Samba3 to Samba4 migration on different servers

    - by ouzmoutous
    I have to migrate a Samba 3 to a new Samba 4 server. My problem is that the database on the samba 3 server seems a bit empty. The secrets.dtb file is only 20K whereas the “pbedit -L |wc -l”command give me 16970 lines. On my Samba3 /var/lib/samba is 1,5M After I had migrate the databse (following instructions on http://dev.tranquil.it/index.php/SAMBA_-_Migration_Samba3_Samba4), “pdbedit -L” command on the new server give me only : SAMBA4$, Administrator, dns-samba4, krbtgt and nobody. So I tried to create a VM with a Samba3. I added some users, done the same things I did for the migration and now I can see the users created on the VM. It’s like users on the Samba 3 server are in a sort of cache. I already migrate the /etc/{passwd,shadow,group} files and I can see users with the “getent passwd” command. Any ideas why my users are present when I use pdbedit but the database is so empty ? The global part of my smb.conf on the Samba 3 server : [global] workgroup = INTERNET netbios name = PDC-SMB3 server string = %h server interfaces = eth0 obey pam restrictions = Yes passdb backend = smbpasswd passwd program = /usr/bin/passwd %u passwd chat = *new* %n\n *Re* %n\n *pa* username map = /etc/samba/smbusers unix password sync = Yes syslog = 0 log file = /var/log/samba/log.%U max log size = 1000 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 add user script = /usr/sbin/useradd -s /bin/false -m '%u' -g users delete user script = /usr/sbin/userdel -r '%u' add group script = /usr/sbin/groupadd '%g' delete group script = /usr/sbin/groupdel '%g' add user to group script = /usr/sbin/usermod -G '%g' '%u' add machine script = /usr/sbin/useradd -s /bin/false -d /dev/null '%u' -g machines logon script = logon.cmd logon home = \\$L\%U domain logons = Yes os level = 255 preferred master = Yes local master = Yes domain master = Yes dns proxy = No ldap ssl = no panic action = /usr/share/samba/panic-action %d invalid users = root admin users = admin, root, administrateur log level = 2

    Read the article

  • Discover generic types

    - by vittore
    Thanks @dtb for help, he advised really need piece of code for generic service locator static class Locator { private static class LocatorEntry<T> where T : ... { public static IDataManager<T> instance; } public static void Register<T>(IDataManager<T> instance) where T : ... { LocatorEntry<T>.instance = instance; } public static IDataManager<T> GetInstance<T>() where T : ... { return LocatorEntry<T>.instance; } } However in my previous version I used reflection on assembly to discover a hundred of DataManager's I want to write an method discover like the following void Discover() { var pManager = new ProtocolSQLDataManager(); Register(pManager); var rManager = new ResultSQLDataManager(); Register(rManager); var gType = typeof(ISQLDataAccessManager<>); foreach (Type type in Assembly.GetExecutingAssembly().GetTypes()) { if (type.IsSubclassOf(gType) && !type.IsAbstract)) { var manager = Activator.CreateInstance(type); // put something here in order to make next line of code works Register<T>(manager); } } } How to cast type to appropriate type in order to make Register working( and call appropriate Register ?

    Read the article

  • How To Skip Commercials in Windows 7 Media Center

    - by DigitalGeekery
    If you use Windows 7 Media Center to record live TV, you’re probably interested in skipping through commercials. After all, a big reason to record programs is to avoid commercials, right? Today we focus on a fairly simple and free way to get you skipping commercials in no time. In Windows 7, the .wtv file format has replaced the dvr-ms file format used in previous versions of Media Center for Recorded TV. The .wtv file format, however, does not work very well with commercial skipping applications.  The Process Our first step will be to convert the recorded .wtv files to the previously used dvr-ms file format. This conversion will be done automatically by WtvWatcher. It’s important to note that this process deletes the original .wtv file after successfully converting to .dvr-ms. Next, we will use DVRMSToolBox with the DTB Addin to handle commercials skipping. This process does not “cut” or remove the commercials from the file. It merely skips the commercials during playback. WtvWatcher Download and install the WTVWatcher (link below). To install WtvWatcher, you’ll need to have Windows Installer 3.1 and .NET Framework 3.5 SP1. If you get the Publisher cannot be verified warning you can go ahead and click Install. We’ve completely tested this app and it contains no malware and runs successfully.   After installing, the WtvWatcher will pop up in the lower right corner of your screen. You will need to set the path to your Recorded TV directory. Click on the button for “Click here to set your recorded TV path…”   The WtvWatcher Preferences window will open…   …and you’ll be prompted to browse for your Recorded TV folder. If you did not change the default location at setup, it will be found at C:\Users\Public\Recorded TV. Click “OK” when finished. Click the “X” to close the Preferences screen. You should now see WtvWatcher begin to convert any existing WTV files.   The process should only take a few minutes per file. Note: If WtvWatcher detects an error during the conversion process, it will not delete the original WTV file.    You will probably want to run WtvWatcher on startup. This will allow WtvWatcher too constantly scan for new .wtv files to convert. There is no setting in the application to run on startup, so you’ll need to copy the WTV icon from your desktop into your Windows start menu “Startup” directory. To do so, click on Start > All Programs, right-click on Startup and click on Open all users. Drag and drop, or cut and paste, the WtvWatcher desktop shortcut into the Startup folder. DVRMSToolBox and DTBAddIn Next, we need to download and install the DVRMSToolBox and the DTBAddIn. These two pieces of software will do the actual commercial skipping. After downloading the DVRMSToolBox zip file, extract it and double-click the setup.exe file.  Click “Next” to begin the installation.   Unless DVRMSToolBox will only be used by Administrator accounts, check the “Modify File Permissions” box. Click “Next.” When you get to the Optional Components window, uncheck Download/Install ShowAnalyzer. We will not be using that application. When the installation is complete, click “Close.”    Next we need to install the DTBAddin. Unzip the download folder and run the appropriate .msi file for your system. It is available in 32 & 64 bit versions. Just double click on the file and take the default options. Click “Finish” when the install is completed. You will then be prompted to restart your computer. After your computer has restarted, open DVRMSToolBox settings by going to Start > All Programs, DVRMSToolBox, and click on DVRMStoMPEGSettings. On the MC Addin tab, make sure that Skip Commercials is checked. It should be by default.   On the Commercial Skip tab, make sure the Auto Skip option is selected. Click “Save.”   If you try to watch recorded TV before the file conversion and commercial indexing process is complete you’ll get the following message pop up in Media Center. If you click Yes, it will start indexing the commercials if WtvWatcher has already converted it to dvr-ms. Now you’re ready to kick back and watch your recorded tv without having to wait through those long commercial breaks. Conclusion The DVRMSToolBox is a powerful and complex application with a multitude of features and utilities. We’ve showed you a quick and easy way to get your Windows Media Center setup to skip commercials. This setup, like virtually all commercial skipping setups, is not perfect. You will occasionally find a commercial that doesn’t get skipped. Need help getting your Windows 7 PC configured for TV? Check out our previous tutorial on setting up live TV in Windows Media Center. Links Download WTV Watcher Download DVRMSToolBox Download DTBAddin Similar Articles Productive Geek Tips Using Netflix Watchnow in Windows Vista Media Center (Gmedia)Increase Skip and Replay Intervals in Windows 7 Media CenterSchedule Updates for Windows Media CenterIntegrate Hulu Desktop and Windows Media Center in Windows 7Add Color Coding to Windows 7 Media Center Program Guide TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 PCmover Professional Make your Joomla & Drupal Sites Mobile with OSMOBI Integrate Twitter and Delicious and Make Life Easier Design Your Web Pages Using the Golden Ratio Worldwide Growth of the Internet How to Find Your Mac Address Use My TextTools to Edit and Organize Text

    Read the article

1