Search Results

Search found 18661 results on 747 pages for 'linq to mysql'.

Page 82/747 | < Previous Page | 78 79 80 81 82 83 84 85 86 87 88 89  | Next Page >

  • fastest way to check to see if a certain index in a linq statement is null

    - by tehdoommarine
    Basic Details I have a linq statement that grabs some records from a database and puts them in a System.Linq.Enumerable: var someRecords = someRepoAttachedToDatabase.Where(p=>true); Suppose this grabs tons (25k+) of records, and i need to perform operations on all of them. to speed things up, I have to decided to use paging and perform the operations needed in blocks of 100 instead of all of the records at the same time. The Question The line in question is the line where I count the number of records in the subset to see if we are on the last page; if the number of records in subset is less than the size of paging - then that means there are no more records left. What I would like to know is what is the fastest way to do this? Code in Question int pageSize = 100; bool moreData = true; int currentPage = 1; while (moreData) { var subsetOfRecords = someRecords.Skip((currentPage - 1) * pageSize).Take(pageSize); //this is also a System.Linq.Enumerable if (subsetOfRecords.Count() < pageSize){ moreData = false;} //line in question //do stuff to records in subset currentPage++; } Things I Have Considered subsetOfRecords.Count() < pageSize subsetOfRecords.ElementAt(pageSize - 1) == null (causes out of bounds exception - can catch exception and set moreData to false there) Converting subsetOfRecords to an array (converting someRecords to an array will not work due to the way subsetOfRecords is declared - but I am open to changing it) I'm sure there are plenty of other ideas that I have missed.

    Read the article

  • C# Linq Select Problem in Method Chain.

    - by Gnought
    Note that the _src inherit IQueryable<U> and V inherit new(); I wrote the following statement, there is no syntax error. IQueryable<V> a = from s in _src where (s.Right - 1 == s.Left) select new V(); But if i re-wrote it as follows, the Visual Studio editor complains an error in the "Select" IQueryable<V> d = _src.Where(s => s.Right - 1 == s.Left).Select(s=> new V()); The Error is: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. Candidates are: System.Collections.Generic.IEnumerable<V> Select<U,V>(this System.Collections.Generic.IEnumerable<U>, System.Func<U,V>) (in class Enumerable) System.Linq.IQueryable<V> Select<U,V>(this System.Linq.IQueryable<U>, System.Linq.Expressions.Expression<System.Func<U,V>>) (in class Queryable) Could anyone explain this phenomenon, and what the solution is to fix the error?

    Read the article

  • child objects in linq

    - by gangt
    I checked before I posted but couldn't find a solution. I'm new to linq and it is draining my brain to understand it. I have an xml and want to use linq to fill object that has a child object. the xml and my linq is below. My issue is on this line TaskItems = t.Elements("taskdetail").ToList<TaskItem>() //this line doesn't work how do I fill this child object? var task1 = from t in xd.Descendants("taskheader") select new { Id = t.Element("id").Value, Name = t.Element("name").Value, IsActive = Convert.ToBoolean(Convert.ToInt16(t.Element("isactive").Value)) TaskItems = t.Elements("taskdetail").ToList<TaskItem>() }; <tasks> <taskheader> <id>1</id> <name>some task</name> <isactive>1</isactive> <taskdetail> <taskid>1</taskid> <name>action1</name> <value>some action</value> </taskdetail> <taskdetail> <taskid>1</taskid> <name>action2</name> <value>some other action</value> </taskdetail> </taskheader> </tasks> public class Task { public int Id; public string Name; public bool IsActive; public List<TaskItem> TaskItems = new List<TaskItem>(); } public class TaskItem { public int TaskId; public string Name; public string Value; }

    Read the article

  • sql to linq translated code

    - by ognjenb
    SQL: SELECT o.Id, o.OrderNumber, o.Date, d.Name AS 'Distributor', d.Notes AS 'DistrNotes', -- distributer c.Name AS 'Custoer', c.Notes AS 'CustmNotes', -- customer t.Name AS 'Transporter', -- transporter o.InvoiceFile, o.Notes, o.AwbFile, o.TrackingFile, o.Status, o.DeliveryNotification, o.ServiceType, o.ValidityDate, o.DeliveryTime, o.Weight, o.CustomerId, o.CustomerOrderNumber, o.CustomerDate, o.Shipment, o.Payment, o.TransporterId, o.TotalPrice, o.Discount, o.AlreadyPaid, o.Delivered, o.Received, o.OrderEnteredBy, CONCAT(e.Name, ' ', e.Surname) AS 'IBEKO Engineer', o.Confirmed FROM `order` o LEFT JOIN person d ON o.`DistributorId` = d.`Id` LEFT JOIN person c ON o.`CustomerId` = c.Id LEFT JOIN Transporter t ON o.`TransporterId` = t.Id LEFT JOIN IbekoEngineer e ON o.OrderEnteredBy = e.Id LINQ: testEntities6 ordersEntities = new testEntities6(); var orders_query = (from o in ordersEntities.order join pd in ordersEntities.person on o.DistributorId equals pd.Id join pc in ordersEntities.person on o.CustomerId equals pc.Id join t in ordersEntities.transporter on o.TransporterId equals t.Id select new OrdersModel { Id = o.Id, OrderNumber = o.OrderNumber, Date = o.Date, Distributor_Name = pdk.Name, Distributor_Notes = pdk.Notes, Customer_Name = pc.Name, Customer_Notes = pc.Notes, Transporter_Name = t.Name, InvoiceFile = o.InvoiceFile, Notes = o.Notes, AwbFile = o.AwbFile, TrackingFile = o.TrackingFile, Status = o.Status, DeliveryNotification = o.DeliveryNotification, ServiceType = o.ServiceType, ValidityDate = o.ValidityDate, DeliveryTime = o.DeliveryTime, Weight = o.Weight, CustomerId = o.CustomerId, CustomerOrderNumber = o.CustomerOrderNumber, CustomerDate = o.CustomerDate, Shipment = o.Shipment, Payment = o.Payment, TransporterId = o.TransporterId, TotalPrice = o.TotalPrice, Discount = o.Discount, AlreadyPaid = o.AlreadyPaid, Delivered = o.Delivered, Received = o.Received, OrderEnteredBy = o.OrderEnteredBy, Confirmed = o.Confirmed }); I translated the above SQL code into linq. SQL code return data from database but LINQ not return data. Why?

    Read the article

  • Logic for capturing unique characteristics in an object array. C# LINQ [closed]

    - by Shawn H.
    Given the following "response" or array of objects, what would be the most efficient way to get the desired results. There must be an easier way than the exhaustive and tedious way I'm doing it now. A LINQ solution would be fantastic. Situation #1 <things> <thing id="1"> <feature>Tall</feature> </thing> <thing id="2"> <feature>Tall</feature> </thing> <thing id="3"> <feature>Tall</feature> <feature>Wide</feature> </thing> <thing id="4"> <feature>Tall</feature> </thing> </things> Result: Wide Situation #2 <things> <thing id="1"> <feature>Short</feature> </thing> <thing id="2"> <feature>Tall</feature> </thing> <thing id="3"> <feature>Tall</feature> <feature>Wide</feature> </thing> <thing id="4"> <feature>Tall</feature> </thing> </things> Result: Wide, Short, Tall Situation #3 <things> <thing id="1"> <feature>Tall</feature> <feature>Thin</feature> </thing> <thing id="2"> <feature>Tall</feature> </thing> <thing id="3"> <feature>Tall</feature> <feature>Wide</feature> </thing> <thing id="4"> <feature>Tall</feature> </thing> </things> Result: Wide, Thin Thanks.

    Read the article

  • Benchmarking MySQL on win7

    - by Patrick
    I've setup a nginx server running php 5.3.6 and mysql 5.5.1.3. My computer is an AMD quadcore 9650, 4gb ram, 500gb 7200rpm HD. I ran the PHP MySQL Benchmark Tool v. 0.1, and got the following results: Testing a(n) MYISAM table using 100000 rows. Successfully created database speedtestdb Sucessfully created table speedtesttable Table Type Verified: MYISAM .. Done. 100000 inserts in 19.73628 seconds or 5067 inserts per second. Done. 100000 row reads in 0.2801 seconds or 357015 row reads per second. Done. 100000 updates in 4.03876 seconds or 24760 updates per second. I'm wondering where this stands as far as performance goes, and what are some steps I can take if any to improve on this. I'm not trying to make anything fantastic, just getting a feel for how to best optimize a web server in this configuration.

    Read the article

  • MySql Replication with a star topology

    - by Riotopsys
    My company currently operates in 3 separate locations connected by slow vpn links. Each site hosts a dedicated MySql server. I need to aggregate the data from all three of them onto a single server for corporate reporting. The powers that be have stated I cannot use circular replication or federated tables. Is there a third party tool for MySql that can replicate from multiple masters? Basically the diagram would be a daisy with the reporting server slave at center with multiple replication connections coming in from the master sites on the petals.

    Read the article

  • Database cluster... without Master/Slave?

    - by RadiantHex
    Hi there! I'm wondering if it is possible to have a set of SQLdb servers to which data is written and have them replicate, avoiding conflicting information. I imagine that a Master/Slave structure would be mandatory, I would like to know if a system where servers have no hierarchy could support replication. Currently I'm using MySQL, but I would be happy to move to another database if needed. Any ideas? :)

    Read the article

  • MySQL per-database replication?

    - by LucasBr
    So, my problem is interesting: we want to migrate from one server to another. We made a master-slave replication, but my boss came with the idea to make migration one database at a time. So he asked me to setup at the new server another MySQL instance, let the slave almost as-is and make the new instance be the new master incrementally, one database at a time. Is it possible, that is, can I transfer the database 'x' from old master to new master and just tell slave to synchronize 'x' at the new master from now on? I've read at this old thread ( Mysql Replication - are per-database threads possible? ) that this was not possible at that time. This can be done now? Thanks! Lucas Bracher.

    Read the article

  • Recovering/Rebuilding MySQL .FRM, .MY* files from IBDATA1

    - by Synetech
    I recently had an incident in which several MySQL files were wiped out (mostly from WordPress, but also a few of MySQL’s own files). The IBDATA1 file is unaffected, but several .frm are gone as are a few .myi and .myd files. So now I need to find out if there is a way to rebuild the missing files from IBDATA1. I tried Googling it, assuming that such an issue has come up before, and indeed there were numerous search results (including this question), but all of the ones I looked at were the opposite, about recovering from .frm and .my* files or somehow required these files. Is there a way to rebuild these files? I know I have a relatively recent backup (a .SQL file) if there isn’t, but I’m hoping that these are the kind of files that are rebuilt if missing or outdated.

    Read the article

  • MYSQL backup and restore

    - by Codezy
    I am having trouble getting mysql backups to run properly when their are views in the database. I think this might have something to do with needing a placeholder object for it. In any event I run this command: mysqldump -u myuser -pmypassword mydatabase | mysql -u myuser -pmypassword -C mydatabase_Beta The user has full privileges and I get this: View mydatabase_beta.yadayada references invalid tables or columns or functions or definer/invoker or view lack rights to use them. How can I back it up so that it restores all of my database properly? In the example I am restoring it to a different name but I do need to be able to restore a working copy. I think it is probably an additional mysqldump parameter or maybe hot copy would work better. Thoughts?

    Read the article

  • MySQL is killing the server IO.

    - by OneOfOne
    I manage a fairly large/busy vBulletin forums (~2-3k requests per second, running on gigenet cloud), the database is ~ 10 GB (~9 milion posts, ~60 queries per second), lately MySQL have been grinding the disk like there's no tomorrow according to iotop and slowing the site. The last idea I can think of is using replication, but I'm not sure how much that would help and worried about database sync. I'm out of ideas, any tips on how to improve the situation would be highly appreciated. Specs : Debian Lenny 64bit ~12Ghz (6 cores) CPU, 7520gb RAM, 160gb disk. Kernel : 2.6.32-4-amd64 mysqld Ver 5.1.54-0.dotdeb.0 for debian-linux-gnu on x86_64 ((Debian)) Other software: vBulletin 3.8.4 memcached 1.2.2 PHP 5.3.5-0.dotdeb.0 (fpm-fcgi) (built: Jan 7 2011 00:07:27) lighttpd/1.4.28 (ssl) - a light and fast webserver PHP and vBulletin are configured to use memcached. MySQL Settings : [mysqld] key_buffer = 128M max_allowed_packet = 16M thread_cache_size = 8 myisam-recover = BACKUP max_connections = 1024 query_cache_limit = 2M query_cache_size = 128M expire_logs_days = 10 max_binlog_size = 100M key_buffer_size = 128M join_buffer_size = 8M tmp_table_size = 16M max_heap_table_size = 16M table_cache = 96

    Read the article

  • installing old MySQL client libraries (libmysqlclient.so.15, libpq.so.4)

    - by Elijah Paul
    I'm attempting to install Nagios plugins on a Zimbra 8.0.2 server running CentOS 6.4, but have run into the following error when I run yum install nagios-plugins-all Error: Package: nagios-plugins-mysql-1.4.15-2.el5.x86_64 (epel) Requires: libmysqlclient.so.15()(64bit) Error: Package: nagios-plugins-pgsql-1.4.15-2.el5.x86_64 (epel) Requires: libpq.so.4()(64bit) Error: Package: nagios-plugins-mysql-1.4.15-2.el5.x86_64 (epel) Requires: libmysqlclient.so.15(libmysqlclient_15)(64bit) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest How can I install these libraries (libmysqlclient.so.15 & libpq.so.4)? Will installing these libraries possibly break Zimbra?

    Read the article

  • Use pt-table-sync to setup a new MySQL DB

    - by Generation D Systems
    I have 2 hosts (A and B). B contains a MySQL server with a database called mydb, and A contains a MySQL server with nothing (fresh install). I want to replicate the entire mydb from B to A, by running a script on A (I do not have shell access to B). Can I run this on A: pt-table-sync --execute h=b.mydomain.com,D=mydb h=a.mydomain.com I've read the docs but don't get a 100% comfort feeling (perhaps because of all the warnings about damaging your data if you don't know what you're doing). Will this work? as well, is h=a.mydomin.com necessary? (Will it route all traffic back in/out the local NIC?) can I use localhost or nothing at all?

    Read the article

  • MySQL blocking new connections, and mysqladmin flush-hosts

    - by aidan
    I'm running MySQL on a remote server, and it suddenly started rejecting all connections: $ mysql -h 192.168.1.10 -u root -p ERROR 1129 (00000): Host 'web' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' So, I try this flush-hosts command... $ mysqladmin flush-hosts -h 192.168.1.10 -u root -p mysqladmin: connect to server at '192.168.1.10' failed error: 'Host 'web' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'' I.e. it's blocking the very un-blocking tool it recommends. Am I doing it wrong, or will I have to resort to ssh/cpanel/physical access?

    Read the article

  • how connect to local mysql server (LAN)

    - by clarkk
    I got two Debian 6 servers - one for web and one for the database.. How can I connect through the local area network? On both servers I have permanently changed the hostnames /etc/hostname /etc/hosts web => web-server db => db-server In the privileges in mysql I have set the root user to accept requests from web-server (instead of localhost) and from the web-server I connect to db-server in my.cnf I have escaped the following line: # bind-address = 127.0.0.1 error Warning: mysqli::mysqli(): (HY000/2005): Unknown MySQL server host 'db-server' (1)

    Read the article

  • Good/Better config for MySQL on an EC2 Large Instance

    - by Tim Reynolds
    I have an EC2 Large instance dedicated to MySQL. It will be serving a Joomla/Magento combo so it has a blend of InnoDB and MyISAM tables. I have only worked with MyISAM in the past and am therefore unfamiliar with the settings InnoDB uses. Experiments so far have been less than fruitful, as I keep causing the InnoDB engine to be disabled. My instance is running Ubuntu 10.04 64 bit server edition and has ~7.5G of ram. MySQL is currently using ~0.6% of that, with somewhat poor performance. I would like to configure it to use as much of the system RAM as is reasonable. Testing some settings I learned that the InnoDB logs can't collectively be larger than 4G. Would anyone be able to provide some base InnoDB and MyISAM settings to get my started. Thank you Tim

    Read the article

  • Ubuntu Server Edition (Jaunty) x64 Segmentation faults in PHP mysql package

    - by Deeksy
    I've been running Jaunty with Apache2, PHP & MySQL running drupal websites as well as python 2.6 and trac on the same server. I'm getting quite a few segmentation faults and suhosin warnings on my drupal websites which don't seem to be related to the amount of RAM the server has (3GB) as the trac site is running happily without issues. The issue seems to be related to PHP accessing mysql and I'm getting suhosin warnings. Has anyone else seen this problem? Any ideas on how to fix it? Funnily enough, it's not a consistent error, as restarts tend to fix the issue temporarily.

    Read the article

  • mysql remote connection [closed]

    - by Fel
    I spoke with my host supporter to find what is my sql hostname. He said that the only way is add permissions in mysql remote (cpanel) to my actual ip. So the config in heidiSQL for example will be localhost userxxx passxxx But i have a dynamic ip, so i need to change the permissions every time, correct? Add the flag % probably is not a good idea, so how can I solve this problem? Why I dont have something like mysql.something.com ? Sorry, if this question is too basic.

    Read the article

  • Ruby, Rails & MySQL parity between Mac Client (10.6) & XServe (10.5)

    - by Meltemi
    We're setting up a RoR setup with Development on Mac OS X Client (10.6.3) and then using a Mac OS X Server (10.5.8) for testing and eventually deployment. I'd like to get as many systems in sync on these machines as possible. Wondering if there are any pitfalls. I seem to understand what's necessary under Client but Server has some hardwired stuff that I want to make sure doesn't break...or is updated correctly. Currently installed on both machines we have: OS X Client (10.6.3): Ruby 1.8.7 Rails 2.3.5 MySQL (not installed yet) OS X Server (10.5.8): Ruby 1.8.6 Rails 2.3.5 MySQL Ver 14.12 Distrib 5.0.82 Any suggestions...Ideally from someone who's done this on Leopard Server as well but I'll listen to general tips & proceedures

    Read the article

  • Mysql table Crashed during Optimize, table repair taking too long

    - by hellohellosharp
    One of my vital tables was being optimzied and MySQL crashed in the middle of it. It then said the table was corrupt. I am running repair but it is taking over an hour, I need this table up ASAP (I will even truncate it if necessary). Please help me get this solved. The table has about 54 million rows. This is a MyISAM. Any additional information needed, just ask. Here are the contents of my my.cnf: [mysqld] max_connections = 850 max_user_connections = 850 query_cache_size = 128M skip-external-locking key_buffer_size = 64M max_allowed_packet = 8M table_open_cache = 256 sort_buffer_size = 4M net_buffer_length = 16K read_buffer_size = 1M read_rnd_buffer_size = 1M myisam_sort_buffer_size = 32M innodb_file_per_table tmp_table_size = 100M max_heap_table_size = 64M thread_cache_size = 8 wait_timeout=25 interactive_timeout=25 table_cache=600 innodb_buffer_pool_size = 4G innodb_thread_concurrency = 8 innodb_flush_method = O_DIRECT # This setting allows the use of asynchronous I/O in InnoDB. # The following files track usage of this resource: # - /proc/sys/fs/aio-max-nr # - /proc/sys/fs/aio-nr # Default limit is 65536, of which a single instance of mysql uses 2661 out of the box innodb_use_native_aio = 1

    Read the article

  • Munin does not show Apache/mySQL stats in web view

    - by Chris
    I'm facing a very strange Problem. I just set up Munin on a fresh Ubuntu slice with a common LAMP Stack. Everything works great, except that Munin does just not show the Apache/mySQL stats in the web view. Everything else in the web view works great, Apache works, mySQL works. I even tried calling the plugins via console: sudo munin-run apache_accesses And it works fine. AFAIK Munin log files are not telling me any problems.. My only hint: when I run munin-run without sudo it gives me a "Permission denied" - could this be the problem?

    Read the article

  • PHP+AJAX with MySQL - Query every 2 seconds, too many in TIME_WAIT

    - by Ryan
    I have a basic HTML file, using jQuery's ajax, that is connecting to my polling.php script every 2 seconds. The polling.php simply connections to mysql, checks for ID's newer than my hidden, stored current ID, and then echo's if there is anything new. Since the javascript is connecting every 2 seconds, I am getting thousands of connections in TIME_WAIT, just for my client. This is because my script is re-connecting to MySQL over and over again. I have tried mysql_pconnect but it didn't help any. Is there any way I can get PHP to open 1 connection, and continue to query using it? Instead of reconnecting every single time and making all these TIME_WAIT connections. Unsure what to do here to make this work properly.

    Read the article

  • MySQL Stored Procedure Parameters are NULL

    - by emmilely
    I am stumped, and was hoping someone here would have a quick and easy answer. I did a fresh install of MySQL 5.5 and am trying to pass parameters into a stored procedure. The parameter values aren't being read by the stored procedure. MySQL doesn't throw an error and processes the code with null parameters. Here is the code: DELIMITER $$ CREATE DEFINER=`root`@`%` PROCEDURE `testing`(IN parameter INTEGER) BEGIN UPDATE table_name SET valueToChange = 'Test' WHERE mainID = @parameter; END And here is the query I'm using to call it: USE database_name; CALL testing(72); Can anyone help?

    Read the article

  • mysql connection is slow (5seconds)

    - by acidzombie24
    After building my webapp on a first boot i create 2 connections to mysql on debian then 1-2 (r/w) for every page after that. The connection consistently take 5.2 seconds to connect. Debian is in a VM running in my OS. Why is the connection taking this long? At times it will take < 0.1 seconds which is great but 5.2 x2-3 on every run is to much. Has anyone experience this problem? how do i solve it? note: I am using .NET to connect. Not that it matters. and its mysql v5

    Read the article

< Previous Page | 78 79 80 81 82 83 84 85 86 87 88 89  | Next Page >