Daily Archives

Articles indexed Sunday January 16 2011

Page 15/29 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • How can I detect whether an image is a PNG or APNG format?

    - by perlit
    APNG is backwards compatible with PNG. I opened up an apng and png file in a hex editor and the first few bytes look identical. So if a user uploads either of these formats, how do I detect what the format really is? I've seen this done on some sites that block apng. I'm guessing the ImageMagick library makes this easy, but what if I were to do the detect without the use of an image processing library (for learning purposes)? Can I look for specific bytes that tell me if the file is apng? Solutions in any language is welcome.

    Read the article

  • inline divs with hidden overflow

    - by Jim
    I want to create 3 divs side by side when only one of them is visible. -------------- -------------- -------------- | visible | | invisible | | invisible | | | | | | | -------------- -------------- -------------- In order to do this I have tried to create a wrapping div with a 100px width, and hidden overflow. What am I doing wrong? <div style="width:50px;height:349px; overflow:hidden"> <div style="display: inline;">first div</div> <div style="display: inline;">second div</div> <div style="display: inline;">third div</div> </div>

    Read the article

  • int vs const int&

    - by Valdo
    I've noticed that I usually use constant references as return values or arguments. I think the reason is that it works almost the same as using non-reference in the code. But it definitely takes more space and function declarations become longer. I'm OK with such code but I think some people my find it a bad programming style. What do you think? Is it worth writing const int& over int? I think it's optimized by the compiler anyway, so maybe I'm just wasting my time coding it, a?

    Read the article

  • Need to get all referrals ID with using MYSQL

    - by Fero
    Hi all, I having a referral table like below. > id referredByID referrerID > > 1001 1 2 > > 1002 2 3 > > 1003 2 4 > > 1004 5 7 From the above table structure i need to get the users whom i referred and the users whom are referred by their referrals. For Example: I am referredByID-1 I referred the ID - 2 Now the ID - 2 referred ID -3 And in the same case ID-2 referred ID - 4 Now my output needs to be look like: Referrals Done By Me: id - 2 id - 3 id - 4 How can this be done using MYSQL. Any help will be appreciated.. Thanks in advance...

    Read the article

  • Jquery slider going the wrong way

    - by Rob
    Im using a jquery slider and having an issue with what direction it scrolls on click. It seems to screw up after clicking the right arrow then left, but will scroll left if clicked first, weird. Is this a bug or am I missing something here? PS- Im using Chrome (Mac) but seems to behave the same with Firefox and Safari See example http://www.warface.co.uk/clients/warface.co.uk/blog/ Please click the red central arrow to reveal the slider. Many thanks Rob

    Read the article

  • Create a new site programmatically and select parent site? (SharePoint)

    - by peter
    Hi, I am using the following code to create a new site: newWeb = SPContext.GetContext(HttpContext.Current).Web.Webs.Add(newSiteUrl, newSiteName, null, (uint)1033, siteTemplate, true, false); try { newWeb.Update(); } NewSiteUrl and newSiteName are values from two textboxes and on whichever site I use this code (in a web part) the new site will be a subsite to this site. I would now like to be able to select a parent site so that the new site can sit anywhere in the site collection, not just as a subsite to the site where I use the web part. I created the following function to get all the sites in the site collection and populate a drop down with the name and url for every site private void getSites() { SPSite oSiteCollection = SPContext.Current.Site; SPWebCollection collWebsite = oSiteCollection.AllWebs; for (int i = 0; i < collWebsite.Count; i++) { ddlParentSite.Items.Add(new ListItem(collWebsite[i].Title, collWebsite[i].Url)); } oSiteCollection.Dispose(); } If the user selects a site in the dropdown, is it possible to use that URL in newSiteUrl so decide where the new site should be? I don't get it to work really and the new site still becomes a subsite to the current one. I guess it has to do with HttpContext.Current? Any ideas on how I should do it instead? It's the first time I write custom web parts and the sharepoint object model is a bit overwhelming at the moment. Thanks in advance.

    Read the article

  • How to delay program for a certain number of milliseconds, or until a key is pressed?

    - by Jack
    I need to delay my program's execution for a specified number of milliseconds, but also want the user to be able to escape the wait when a key is pressed. If no key is pressed the program should wait for the specified number of milliseconds. I have been using Thread.Sleep to halt the program (which in the context of my program I think is ok as the UI is set to minimise during the execution of the main method). I have thought about doing something like this: while(GetAsyncKeyState(System.Windows.Forms.Keys.Escape) == 0 || waitTime > totalWait) { Thread.Sleep(100); waitTime += 100; } As Thread.Sleep will wait until at least the time specified before waking the thread up, there will obviously be a large unwanted extra delay as it is scaled up in the while loop. Is there some sort of method that will sleep for a specified amount of time but only while a condition holds true? Or is the above example above the "correct" way to do it but to use a more accurate Sleep method? If so what method can I use? Thanks in advance for your help.

    Read the article

  • Sort array by two specifics values in PHP

    - by Roger
    The folks have already showed me how to sort an array by a specific value using usort and a fallback function in PHP. What if this specifc value doesn't exist and we have to use two values? in the example bellow the values [4] and [5]... In other words, I want to do this: order all objects numericaly by the fith value of each object from the highest to the lowest, and addicionally, for those objects that have the fifht value is empty (in the examplem '-'), order them by the fourth value. Array( [0] => Array( [0] => links-patrocinados [1] => adwords [2] => 0,5 [3] => R$92,34 [4] => 823000 [5] => 49500 ) [1] => Array( [0] => adwords [1] => google adwords como funciona [2] => 0,38 [3] => R$0,20 [4] => 480 [5] => 480 ) [2] => Array( [0] => links-patrocinados [1] => adword [2] => 0,39 [3] => R$58,77 [4] => 49500 [5] => 2900 ) [3] => Array( [0] => agencia [1] => agencias viagens espanholas [2] => - [3] => R$0,20 [4] => 58 [5] => - ) [4] => Array( [0] => agencia [1] => era agencia imobiliaria [2] => - [3] => R$0,20 [4] => 73 [5] => - ) )

    Read the article

  • JVM crash at CompilerThread

    - by duduamar
    Hi My java application is crashing almost consistently when trying to compile a specific method (it's always the same method), with SIGSEGV: A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00002aaaab6642a5, pid=8348, tid=1087596864 JRE version: 6.0_16-b01 Java VM: Java HotSpot(TM) 64-Bit Server VM (14.2-b01 mixed mode linux-amd64 ) Problematic frame: V [libjvm.so+0x5332a5] An error report file with more information is saved as: hs_err_pid8348.log If you would like to submit a bug report, please visit: http://java.sun.com/webapps/bugreport/crash.jsp The crash log (interesting parts...): A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00002aaaab6642a5, pid=8348, tid=1087596864 JRE version: 6.0_16-b01 Java VM: Java HotSpot(TM) 64-Bit Server VM (14.2-b01 mixed mode linux-amd64 ) Problematic frame: V [libjvm.so+0x5332a5] If you would like to submit a bug report, please visit: http://java.sun.com/webapps/bugreport/crash.jsp --------------- T H R E A D --------------- Current thread (0x00002aab1f7ac800): JavaThread "CompilerThread0" daemon [_thread_in_native, id=8694, stack(0x0000000040c36000,0x00000000 40d37000)] I tried to create a core dump and connect to it, but I couldn't find the CompilerThread there (maybe it's been killed be

    Read the article

  • Removing index.php on MAMP

    - by djeetee
    this questions was asked before and has had many responses. The problem is nothing i tried worked. Background: i use MAMP and all of my web project are located under WebProjects which I relocated out of its standard location within the MAMP folder in Applications. so my structure is something like this: Documents/WebProjects/GreatSite/Application/... What happened so far: my understanding is that removing index.php can be done either through httpd.conf or .htaccess. anytime i touched httpd.conf, Apache refuses to start. I tried various edits to .htaccess including the one in codeigniter.com/wiki/mod-rewrite and the last one from a post on SO which is this: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?/$1 [L] this give me the following error when i access the site: An Error Was Encountered Unable to determine what should be displayed. A default route has not been specified in the routing file. I have updated config.php to have $config['index_page'] = ''; and i have placed the .htaccess file in the GreatSite folder. One other note, my CI system folder is up a level from GreatSite. Not sure if this has any impact. also, apache has the module loaded. so, I'm hoping someone has successfully done this on MAMP and could provide direction specifically around the content of their .htaccess (or even httpd.conf), it's location and any other mods they had to make to get this going. thanks

    Read the article

  • use of const in c++ [closed]

    - by prp
    class X; class Y { public: Y(const X & x){cout<<"In Y"<<endl;} }; class X { public: operator Y()const{cout<<"In X"<<endl;} }; void fun(Y y) { cout<<"In fun"<<endl; } int main() { X x; fun(x); } can any one throw some light on this c++ program ...please i am new to c++

    Read the article

  • Telerik ASP.NET MVC2 Grid Delete Function with compound key.

    - by Dani
    I have a grid with a compound key: OrderId, ItemID. When I update the grid - the public ActionResult UpdateItemGridAjax(int OrderID, string ItemID) Gets both values from the grid. When I delete a row I get only the first one: public ActionResult DeleteItemGridAjax(int OrderID, string ItemID) Why is it happens and how can I get the ItemId value of the deleted row ? Grid Definition: <%= Html.Telerik().Grid<ItemsInOrderPOCO>() .Name("ItemsInOrderGrid") .DataKeys(dataKeys => { dataKeys.Add(e => e.OrderID); dataKeys.Add(e => e.ItemID); }) .ToolBar(commands => commands.Insert()) .DataBinding(dataBinding => { dataBinding.Ajax() //Ajax binding .Select("SelectItemGridAjax", "Orders", new { OrderID = Model.myOrder.OrderID }) .Insert("InsertItemGridAjax", "Orders", new { OrderID = Model.myOrder.OrderID }) .Update("UpdateItemGridAjax", "Orders") .Delete("DeleteItemGridAjax", "Orders"); }) .Columns(c => { c.Bound(o => o.ItemID); c.Bound(o => o.OrderID).Column.Visible = false; c.Bound(o => o.ItemDescription); c.Bound(o => o.NumOfItems); c.Bound(o => o.CostOfItem); c.Bound(o => o.TotalCost); c.Bound(o => o.SupplyDate); c.Command(commands => { commands.Edit(); commands.Delete(); }).Width(180).Title("Upadte"); })

    Read the article

  • Limiting number of text lines in a table cell

    - by Kuzco
    I have a table cell where I need to limit the text to a max of two lines. I tried achieving this by placing an inner div with a limited height: div { border: 1px solid #EECCDD; width: 100px; height: 40px; overflow: hidden; } <div> <p>bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla</p> </div> <div> <p>bla bla bla bla</p> </div> However, in this case the cells which have only one line of text are not vertically aligned to the middle. I know there are ways to vertically align a text within a div, but most of the ones I found seemed a bit complicated and/or hacky (like this one), and felt like a bit of an overkill. Is there a different way to effectively limit the number of lines inside the cell, or a simple way to align the text in the way I did it?

    Read the article

  • Squid3 not working. Access denied.

    - by Nitish
    I installed SQUID3 on a Linux machine with two ethernet interfaces (eth0 and eth1). I used the default settings in the squid.conf file and uncommented the two lines acl localnet src 192.168.0.0/16 and http_access allow localnet. eth0 is connected to a router, which provides Internet access. It is assigned an IP 192.168.1.2 by the router. I manually configured eth1 to have an IP address 192.168.5.1. It is connected to a switch. Systems having IP addresses 192.168.5.x are connected to this switch. I ran these two commands for NAT: iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.5.1:3128 iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128 But when I try to access internet from a system having IP 192.168.5.2 through the proxy I get an error that says "Access denied". What is wrong with my configuration?

    Read the article

  • Load-balancing between a Procurve switch and a server

    - by vlad
    Hello I've been searching around the web for this problem i've been having. It's similar in a way to this question: How exactly & specifically does layer 3 LACP destination address hashing work? My setup is as follows: I have a central switch, a Procurve 2510G-24, image version Y.11.16. It's the center of a star topology, there are four switches connected to it via a single gigabit link. Those switches service the users. On the central switch, I have a server with two gigabit interfaces that I want to bond together in order to achieve higher throughput, and two other servers that have single gigabit connections to the switch. The topology looks as follows: sw1 sw2 sw3 sw4 | | | | --------------------- | sw0 | --------------------- || | | srv1 srv2 srv3 The servers were running FreeBSD 8.1. On srv1 I set up a lagg interface using the lacp protocol, and on the switch I set up a trunk for the two ports using lacp as well. The switch showed that the server was a lacp partner, I could ping the server from another computer, and the server could ping other computers. If I unplugged one of the cables, the connection would keep working, so everything looked fine. Until I tested throughput. There was only one link used between srv1 and sw0. All testing was conducted with iperf, and load distribution was checked with systat -ifstat. I was looking to test the load balancing for both receive and send operations, as I want this server to be a file server. There were therefore two scenarios: iperf -s on srv1 and iperf -c on the other servers iperf -s on the other servers and iperf -c on srv1 connected to all the other servers. Every time only one link was used. If one cable was unplugged, the connections would keep going. However, once the cable was plugged back in, the load was not distributed. Each and every server is able to fill the gigabit link. In one-to-one test scenarios, iperf was reporting around 940Mbps. The CPU usage was around 20%, which means that the servers could withstand a doubling of the throughput. srv1 is a dell poweredge sc1425 with onboard intel 82541GI nics (em driver on freebsd). After troubleshooting a previous problem with vlan tagging on top of a lagg interface, it turned out that the em could not support this. So I figured that maybe something else is wrong with the em drivers and / or lagg stack, so I started up backtrack 4r2 on this same server. So srv1 now uses linux kernel 2.6.35.8. I set up a bonding interface bond0. The kernel module was loaded with option mode=4 in order to get lacp. The switch was happy with the link, I could ping to and from the server. I could even put vlans on top of the bonding interface. However, only half the problem was solved: if I used srv1 as a client to the other servers, iperf was reporting around 940Mbps for each connection, and bwm-ng showed, of course, a nice distribution of the load between the two nics; if I run the iperf server on srv1 and tried to connect with the other servers, there was no load balancing. I thought that maybe I was out of luck and the hashes for the two mac addresses of the clients were the same, so I brought in two new servers and tested with the four of them at the same time, and still nothing changed. I tried disabling and reenabling one of the links, and all that happened was the traffic switched from one link to the other and back to the first again. I also tried setting the trunk to "plain trunk mode" on the switch, and experimented with other bonding modes (roundrobin, xor, alb, tlb) but I never saw any traffic distribution. One interesting thing, though: one of the four switches is a Cisco 2950, image version 12.1(22)EA7. It has 48 10/100 ports and 2 gigabit uplinks. I have a server (call it srv4) with a 4 channel trunk connected to it (4x100), FreeBSD 8.0 release. The switch is connected to sw0 via gigabit. If I set up an iperf server on one of the servers connected to sw0 and a client on srv4, ALL 4 links are used, and iperf reports around 330Mbps. systat -ifstat shows all four interfaces are used. The cisco port-channel uses src-mac to balance the load. The HP should use both the source and destination according to the manual, so it should work as well. Could this mean there is some bug in the HP firmware? Am I doing something wrong?

    Read the article

  • What's wrong with my MAC address?

    - by Shaul
    I have a D-Link DSL-2650U router, and exactly one computer on the network. For reasons of port forwarding I want to give my computer a static internal IP address, so that I don't take the chance of losing my NAT settings every time the computer reboots. So here's a screen shot that summarizes the entire problem: WTH is wrong with my MAC address? It's copied and pasted from the command prompt window! I tried editing out the dashes, but it still doesn't work. Am I doing something wrong, or is there a bug in the D-Link firmware?

    Read the article

  • Restore wubi install after changing master drive

    - by Johnny
    Recently I got a 160G drive to install other Unix distributions and learn to use them for the sake of my current job. However I've got only 2 drive connectors free (on the primary channel). Therefore I've decided to remove an 80G hard drive which has the MBR and the main Windows bootloader. My problem in particular is that I've got another 250G drive which has a Wubi installation of Ubuntu 10.04 (Lucid Lynx), which I want to preserve on the bootloader that's going to be running for all the other OSes (potentially Grub). How would I do that? Since Wubi is actually sort of windows reliant, as far as I've learned so far.

    Read the article

  • opening a GUID usb stick in windows 7

    - by altomic
    so I have a mac which I have files on. I put in a GUID formatted usb stick and dropped some files on to it. took the stick and plugged in to my netbook with win7. In Devices & Printers it shows up. It also appears in "safely remove hardware". no actual letter or device when i search for it in other ways. Question - how do I access the files of my GUID usb stick on my windows 7 netbook? thanks

    Read the article

  • Week in Geek: IPv6 Capable Smartphones Compromise User Privacy Edition

    - by Asian Angel
    This week we learned how to “clone a disk, resize static windows, and create system function shortcuts”, use 45 different services, sites, and apps to help read favorite sites, add MP3 support to Audacity (for saving in MP3 format), install a Wii game loader for easy backups and fast load times, create a Blue Screen of Death in any color, and more. Photo by legofenris. Weekly News Links Photo by The H Security. IPv6: Smartphones compromise users’ privacy Since version 4 of the iOS operating system, Apple’s iPhones, iPads and iPods have been capable of handling IPv6, and most Android devices have been capable since version 2.1. However, the operating systems transfer an ID that discloses information about their users. Dumb phones can be attacked too Much of the discussion of security threats to mobile phones revolves around smartphones, but researchers have found that less advanced “feature phones,” still used by the majority of people around the world, also are vulnerable to attack. SCADA exploit – the dragon awakes The recent publication of an exploit for KingView, a software package for visualising industrial process control systems, appears to be having an effect. Threatpost reports that both the Chinese vendor Wellintech and Chinese CERT (CN-CERT) have now reacted. Sophos: Spam to get more malicious Spam is becoming more malicious in nature as trickery tactics change in line with current user interests, according to a new report released Tuesday by Sophos. Global spam traffic rebounds as Rustock wakes Spam is on the rise after the Rustock botnet awoke from its Christmas slumber, according to Symantec. Cracking WPA keys in the cloud At the forthcoming Black Hat conference, blogger Thomas Roth plans to demonstrate how weak WPA PSKs can be cracked quickly and easily using Amazon’s Elastic Compute Cloud (EC2) service. Microsoft Security Advisory: Vulnerability in Internet Explorer could allow remote code execution Provides a link to more details about the vulnerability and shows a work-around/fix for the problem. Adobe plans to make it easier to delete Flash cookies in web browsers The new API, NPAPI:ClearSiteData, will allow Flash cookies – also known as Local Shared Objects (LSO) – to be deleted directly in the browser’s settings. Firefox beta getting new database standard The ninth beta version of Firefox is set to get support for a standard called IndexedDB that provides a database interface useful for offline data storage and other tasks needing information on a browser’s computer. MetroPCS accused of blocking certain Net content MetroPCS is violating the FCC’s recently approved Net neutrality rules by blocking certain Internet content, say several public interest groups. Server and Tools chief Muglia to leave Microsoft in summer 2011 Microsoft veteran and Server & Tools Business (STB) President Bob Muglia is leaving Microsoft, according to an email that CEO Steve Ballmer sent to employees on January 10. Report: DOJ nearing decision on Google-ITA The U.S. Department of Justice is gearing up for a possible formal antitrust investigation into whether or not Google should be allowed to purchase travel software company ITA Software, according to a report. South Korea says Google Street View broke law Police in South Korea reportedly say Google broke the country’s law when its Street View service captured personal data from unsecure Wi-Fi networks. The backlash over Google’s HTML5 video bet Choosing strategies based on what you believe to be long-term benefits is generally a good idea when running a business, but if you manage to alienate the world in the process, the long term may become irrelevant. Google answers critics on HTML5 Web video move Google responded to critics of its decision to drop support for a popular HTML5 video codec by declaring that a royalty-supported standard for Web video will hold the Web hostage. Random TinyHacker Links A Special GiveAway: a Great Book & Great Security Software The team from 7 Tutorials has a special giveaway running during the month of January. Signed copies of their latest book, full 1-year licenses of BitDefender Internet Security 2011 and free 3-month trials for everyone willing to participate. One Click Rooting For Android Phones Here’s a nice tool that helps you root your Android phone effortlessly. New Angry Birds Free version 1.0 Available in the App Store. Google Code University Learn programming at Google Code University. Capture and Share Your Favorite Part Of a YouTube Video SnipSnip.it lets you share only the part of the video that you like. Super User Questions More great questions and answers from this past week’s popular topics at Super User. What are the Windows A: and B: drives used for? Does OS X support linux-like features? What is the easiest way to make a backup of an entire hard disk? Will shifting from Wireless to Wired network result in better performance? Is it legal to install Windows 7 Home Premium Retail inside VMware virtual machine? How-To Geek Weekly Article Recap Enjoy reading through our hottest articles from this past week. The 50 Best Ways to Disable Built-in Windows Features You Don’t Want The Best of CES (Consumer Electronics Show) in 2011 How to Upgrade Windows 7 Easily (And Understand Whether You Should) The Worst of CES (Consumer Electronics Show) in 2011 The How-To Geek Guide to Audio Editing: Basic Noise Removal One Year Ago on How-To Geek More great articles from one year ago filled with helpful geeky goodness for you to enjoy. Share Text & Images the Easy Way with JustPaste.it Start Portable Firefox in Safe Mode Firefox 3.6 Release Candidate Available, Here’s How to Fix Your Incompatible Extensions Protect Your Computer from “Little Hands” with KidSafe Lock Prying Eyes Out of Your Minimized Windows Custom Crocheted Cylon-Cthulhu Hybrid What happens when you let your Cylon Centurion figure and your crocheted Cthulhu spend too many lonely nights together? A Cylon-Cthulhu hybrid, of course! You can get your own from the Cthulhu Chick store over on Etsy. Note: This is not an ad…Ruth is a friend of ours, and this Cylon-Cthulhu hybrid makes the perfect guard for the new MVP trophy in our office. The Geek Note Whether it is a geeky indoor project or just getting outside, we hope that you and your families have a terrific fun-filled weekend! Remember to keep sending those great tips in to us at [email protected]. Photo by qwrrty. Latest Features How-To Geek ETC How to Upgrade Windows 7 Easily (And Understand Whether You Should) The How-To Geek Guide to Audio Editing: Basic Noise Removal Install a Wii Game Loader for Easy Backups and Fast Load Times The Best of CES (Consumer Electronics Show) in 2011 The Worst of CES (Consumer Electronics Show) in 2011 HTG Projects: How to Create Your Own Custom Papercraft Toy Firefox 4.0 Beta 9 Available for Download – Get Your Copy Now The Frustrations of a Computer Literate Watching a Newbie Use a Computer [Humorous Video] Season0nPass Jailbreaks Current Gen Apple TVs IBM’s Jeopardy Playing Computer Watson Shows The Pros How It’s Done [Video] Tranquil Juice Drop Abstract Wallpaper Pulse Is a Sleek Newsreader for iOS and Android Devices

    Read the article

  • Where is the start up file located?

    - by starcorn
    Hello, I want to add some lines which should execute every time Ubuntu boots up, so I don't have to change them manually everytime. I've read in some place that you should edit this file /etc/rc.local. However when I add the lines I want to execute at start up it doesn't run those lines. So I wonder where the start up file is located in ubuntu? Those lines I want to add is to change the sensitivity for the trackpoint One of the lines I want to add: echo -n 250 > /sys/devices/platform/i8042/serio1/serio2/sensitivity

    Read the article

  • Screensaver + lock double login problem after Maverick upgrade

    - by dr Hannibal Lecter
    Just found something strange after updating from 10.04 to 10.10. I've set up my screensaver to lock the account when activated. When I log back in, I see my desktop for a second and then the screensaver starts again and I have to re-login. I checked my process list in gnome system monitor, and I have two gnome-screensaver processes(!?), one started as /usr/bin/gnome-screensaver and other simply as gnome-screensaver. And no, I did not start one manually. Where do I look for a way to switch off one of those (supposing that's the problem)? I did not find anything in my startup applications.

    Read the article

  • 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

  • Spring MVC with several configurations

    - by Michael Bulla
    Hello, for my spring-mvc application I created several types of configuration (unittest, integration, qa, production). All the configs are in one war-file, so there is only one type of application I create. Which configuration to take should be decided by the server, where the application is running. To decide what kind of configuration should be used, I have to look into a file. After that I can decide which configuration should be used by spring mvc. For now by convention there is always the -servlet.xml used. Is there a way how to decide dynamically which config to take? Regards, Michael

    Read the article

  • Replace special characters in python

    - by Marcos Placona
    Hi, I have some text coming from the web as such: £6.49 Obviously I would like this to be displayed as: £6.49 I have tried the following so far: s = url['title'] s = s.encode('utf8') s = s.replace(u'Â','') And a few variants on this (after finding it on this very same forum) But still no luck as I keep getting: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 100: ordinal not in range(128) Could anyone help me getting this right? UPDATE: Adding the reppr examples and content type u'Star Trek XI &#xA3;3.99' u'Oscar Winners Best Pictures Box Set \xc2\xa36.49' Content-Type: text/html; charset=utf-8 Thanks in advance

    Read the article

  • How to iterate over numerically named object properties

    - by Scott Schluer
    So I have a horribly designed class that I can't change that has properties like this: object.Color1 object.Color2 object.Color3 etc... How can I iterate through those with a for loop. In other words, something like this: for (int i = 0; i <= 40; i++) { string PropertyName = "Color" + i; if (object.PropertyName != "") { // do something } } Obviously this code wouldn't work but it gives you an idea of what I'm after. I have to do some processing on each property and I don't want to repeat my code 40 times. :) A loop would be perfect, I'm just not sure how to create the name of the property on the fly.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >