Search Results

Search found 676 results on 28 pages for 'dt'.

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

  • How to get the list of SqlInstances of a paricular machine

    - by Cute
    Can anyone tell me how to get remote Sqlserver instances using c# and SMO or any api? I have a remote server name "RemoteMC", which has 2 instances of sql server: "RemoteMc" and "RemoteMC\sqlexpress" I try to get the instances in code like this: Server srv=new Server("RemoteMC"); DataTable dt=SmoApplication.EnumAvailableSqlServer(true); But it returns "Host\sqlexpress" I don't know what went wrong. How can I get the result back as: RemoteMC RemoteMC\sqlexpress; ?

    Read the article

  • physics game programming box2d - orientating a turret-like object using torques

    - by egarcia
    This is a problem I hit when trying to implement a game using the LÖVE engine, which covers box2d with Lua scripting. The objective is simple: A turret-like object (seen from the top, on a 2D environment) needs to orientate itself so it points to a target. The turret is on the x,y coordinates, and the target is on tx, ty. We can consider that x,y are fixed, but tx, ty tend to vary from one instant to the other (i.e. they would be the mouse cursor). The turret has a rotor that can apply a rotational force (torque) on any given moment, clockwise or counter-clockwise. The magnitude of that force has an upper limit called maxTorque. The turret also has certain rotational inertia, which acts for angular movement the same way mass acts for linear movement. There's no friction of any kind, so the turret will keep spinning if it has an angular velocity. The turret has a small AI function that re-evaluates its orientation to verify that it points to the right direction, and activates the rotator. This happens every dt (~60 times per second). It looks like this right now: function Turret:update(dt) local x,y = self:getPositon() local tx,ty = self:getTarget() local maxTorque = self:getMaxTorque() -- max force of the turret rotor local inertia = self:getInertia() -- the rotational inertia local w = self:getAngularVelocity() -- current angular velocity of the turret local angle = self:getAngle() -- the angle the turret is facing currently -- the angle of the like that links the turret center with the target local targetAngle = math.atan2(oy-y,ox-x) local differenceAngle = _normalizeAngle(targetAngle - angle) if(differenceAngle <= math.pi) then -- counter-clockwise is the shortest path self:applyTorque(maxTorque) else -- clockwise is the shortest path self:applyTorque(-maxTorque) end end ... it fails. Let me explain with two illustrative situations: The turret "oscillates" around the targetAngle. If the target is "right behind the turret, just a little clock-wise", the turret will start applying clockwise torques, and keep applying them until the instant in which it surpasses the target angle. At that moment it will start applying torques on the opposite direction. But it will have gained a significant angular velocity, so it will keep going clockwise for some time... until the target will be "just behind, but a bit counter-clockwise". And it will start again. So the turret will oscillate or even go in round circles. I think that my turret should start applying torques in the "opposite direction of the shortest path" before it reaches the target angle (like a car braking before stopping). Intuitively, I think the turret should "start applying torques on the opposite direction of the shortest path when it is about half-way to the target objective". My intuition tells me that it has something to do with the angular velocity. And then there's the fact that the target is mobile - I don't know if I should take that into account somehow or just ignore it. How do I calculate when the turret must "start braking"?

    Read the article

  • Encrypted Search Index File

    - by mcxiand
    Hi, Does anybody know a full text search engine like dtsearch that has an encrypted index files? We were having problem because our application is hosted on cloud. And we have an agreement with the clients that all files on the cloud must be encrypted. However, the generated index files on dt search can be read as plain text. Any ideas?

    Read the article

  • Read from XML > Add to Listview

    - by Zubirg
    I have some problems getting the data that i read from XML split into seperate columns. Any help this new C# coder would get would be appreciated. XDocument xmlDoc = XDocument.Load("emails.xml"); var t = from c in xmlDoc.Descendants("dt") select (string)c.Element("name") + (string)c.Element("email"); foreach (string item in t) { listView.Items.Add(item); }

    Read the article

  • Can't read excel file after creating it using File.WriteAllText() function

    - by Srikanth Mattihalli
    public void ExportDataSetToExcel(DataTable dt) { HttpResponse response = HttpContext.Current.Response; response.Clear(); response.Charset = "utf-8"; response.ContentEncoding = Encoding.GetEncoding("utf-8"); response.ContentType = "application/vnd.ms-excel"; Random Rand = new Random(); int iNum = Rand.Next(10000, 99999); string extension = ".xls"; string filenamepath = AppDomain.CurrentDomain.BaseDirectory + "graphs\\" + iNum + ".xls"; string file_path = "graphs/" + iNum + extension; response.AddHeader("Content-Disposition", "attachment;filename=\"" + iNum + "\""); string query = "insert into graphtable(graphtitle,graphpath,creategraph,year) VALUES('" + iNum.ToString() + "','" + file_path + "','" + true + "','" + DateTime.Now.Year.ToString() + "')"; try { int n = connect.UpdateDb(query); if (n > 0) { resultLabel.Text = "Merge Successfull"; } else { resultLabel.Text = " Merge Failed"; } resultLabel.Visible = true; } catch { } using (StringWriter sw = new StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { // instantiate a datagrid DataGrid dg = new DataGrid(); dg.DataSource = dt; //ds.Tables[0]; dg.DataBind(); dg.RenderControl(htw); File.WriteAllText(filenamepath, sw.ToString()); // File.WriteAllText(filenamepath, sw.ToString(), Encoding.UTF8); response.Write(sw.ToString()); response.End(); } } } Hi all, I have created an excel sheet from datatable using above function. I want to read the excel sheet programatically using the below connectionstring. This string works fine for all other excel sheets but not for the one i created using the above function. I guess it is because of excel version problem. OleDbConnection conn= new OleDbConnection("Data Source='" + path +"';provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;";); Can anyone suggest a way by which i can create an excel sheet such that it is readable again using above query. I cannot use Microsoft InterOp library as it is not supported by my host.

    Read the article

  • linq, selecting columns as IEnumerable<DataRow>

    - by joe
    how can i do in linq: IEnumerable<DataRow> query = from rec in dt.AsEnumerable() where rec.Field<decimal>("column2") == 1 && foo(rec.Field<decimal>("column1")) select new { column1 = rec.Field<decimal>("column1"), column2 = rec.Field<decimal>("column2"), column3 = rec.Field<decimal>("column3")} ; this does not work. Im trying to select some columns as new datatable then join it later with some other datatable.

    Read the article

  • How to echo Hyperlink Containing a Variable?

    - by John
    Hello, In the code below, I would like to make the word that prints out as the variable "$submittor" a hyperlink to "http://www...com/.../members/index.php?profile=$submittor" . I can't get it to work; I think I'm doing the formatting wrong. How can I do it? Thanks in advance, John echo '<div class="sitename3name">Submitted by '.$submittor.' on '.$dt->format('F j, Y &\nb\sp &\nb\sp g:i a').'</div>';

    Read the article

  • WPF/C#: How to simplify the use of codes when calling a function (Generating Images)

    - by eibhrum
    I created a function in one of my application that allows to generate an image (in WPF) by getting the 'source path' from the database that I am using: public void ShowImageThumb() { try { cn = new MySqlConnection(); cn.ConnectionString = ConfigurationManager.AppSettings["MyConnection"]; cn.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT thumb FROM album WHERE thumbNo=1"; MySqlDataAdapter adp = new MySqlDataAdapter(); adp.SelectCommand = cmd; DataTable dt = new DataTable(); adp.Fill(dt); MySqlDataReader r = cmd.ExecuteReader(); while (r.Read()) { BitmapImage bmi1 = new BitmapImage(new Uri(r[0].ToString(), UriKind.Relative)); image1.Source = bmi1; } r.Close(); cn.Close(); } catch (Exception err){ System.Windows.MessageBox.Show(err.Message); } finally { } } Take a look on my SQL statement. I put a WHERE thumbNo=1 which allows the function to get 1 record. You see, I do have at least 10 records - file paths listed in that table. I just wanna ask if there's a possible way to make my SQL statement something like this: SELECT thumb FROM album; while having this piece of code inserted in my function: BitmapImage bmi2 = new BitmapImage(new Uri(r["second record?"].ToString(), UriKind.Relative)); image2.Source = bmi2; //something like this BitmapImage bmi3 = new BitmapImage(new Uri(r["third record?"].ToString(), UriKind.Relative)); image3.Source = bmi3; //something like this and so on and so forth, without ending up creating 10 different functions for 10 records. ShowImageThumb2(); . . // will not do this . ShowImageThumb10(); Sorry for the lengthy post. I hope somebody could answer back. Thanks!

    Read the article

  • How to deal with class composition when components cannot be accessed from the outside?

    - by Chathuranga
    For example if I say I have three classes A, B, and C where B and C have a composition relation ship with A. That means the life of B and C is handled by A, and also B and C cannot access directly from the outside. For some reason my DataService class needs to return objects of B and C as It cant return a object of A as B and C cannot be initialized at the same time. (to be able to initializeC you have to initializeB first). So that I'm returning DataTables from DataService and then inside the class A those data tables are converted to B / C objects. If B and C objects cannot be initialized at the same time is it valid to say that B and C have a composition relationship with A? If its composition is it must to generate A with B and C inside? What is the proper way to handle this sort of a problem? EDIT: Following code explains the way I'm doing it now with DataTables. Example: class A { private List<B> B; private List <C> C; public A() { B= new List<B>(); C= new List<C>(); } public List<B> GetB( DataTable dt) { // Create a B list from dt return B; } } class Presenter { private void Show B() { _View.DataGrid = A.GetB(DataService.GetAListOfB()); } } The actual scenario is I have a class called WageInfo and classes Earning and Deduction having a composition relationship in the design. But for you to generate Deductions first you should Generate earnings and should be saved in a table. Then only you can generate deductions for the earnings to calculate balance wages. Also note that these contained classes have a one to many relationship with the containing class WageInfo. So actually WageInfo has a List<Earnings> and List<Deduction> My initial question was, is it ok if my DataService class returns Deductions / Earnings objects (actually lists) not a WageInfo? Still not clear?

    Read the article

  • C# MultiThread Safe Class Design

    - by Robert
    I'm trying to designing a class and I'm having issues with accessing some of the nested fields and I have some concerns with how multithread safe the whole design is. I would like to know if anyone has a better idea of how this should be designed or if any changes that should be made? using System; using System.Collections; namespace SystemClass { public class Program { static void Main(string[] args) { System system = new System(); //Seems like an awkward way to access all the members dynamic deviceInstance = (((DeviceType)((DeviceGroup)system.deviceGroups[0]).deviceTypes[0]).deviceInstances[0]); Boolean checkLocked = deviceInstance.locked; //Seems like this method for accessing fields might have problems with multithreading foreach (DeviceGroup dg in system.deviceGroups) { foreach (DeviceType dt in dg.deviceTypes) { foreach (dynamic di in dt.deviceInstances) { checkLocked = di.locked; } } } } } public class System { public ArrayList deviceGroups = new ArrayList(); public System() { //API called to get names of all the DeviceGroups deviceGroups.Add(new DeviceGroup("Motherboard")); } } public class DeviceGroup { public ArrayList deviceTypes = new ArrayList(); public DeviceGroup() {} public DeviceGroup(string deviceGroupName) { //API called to get names of all the Devicetypes deviceTypes.Add(new DeviceType("Keyboard")); deviceTypes.Add(new DeviceType("Mouse")); } } public class DeviceType { public ArrayList deviceInstances = new ArrayList(); public bool deviceConnected; public DeviceType() {} public DeviceType(string DeviceType) { //API called to get hardwareIDs of all the device instances deviceInstances.Add(new Mouse("0001")); deviceInstances.Add(new Keyboard("0003")); deviceInstances.Add(new Keyboard("0004")); //Start thread CheckConnection that updates deviceConnected periodically } public void CheckConnection() { //API call to check connection and returns true this.deviceConnected = true; } } public class Keyboard { public string hardwareAddress; public bool keypress; public bool deviceConnected; public Keyboard() {} public Keyboard(string hardwareAddress) { this.hardwareAddress = hardwareAddress; //Start thread to update deviceConnected periodically } public void CheckKeyPress() { //if API returns true this.keypress = true; } } public class Mouse { public string hardwareAddress; public bool click; public Mouse() {} public Mouse(string hardwareAddress) { this.hardwareAddress = hardwareAddress; } public void CheckClick() { //if API returns true this.click = true; } } }

    Read the article

  • Saving JQuery Draggable Sitemap Values Correctly

    - by mdolon
    I am trying to implement Boagworld's Sitemap tutorial, however I am running into difficulty trying to correctly save the child/parent relationships. The HTML is as follows, however populated with other items as well: <input type="hidden" name="sitemap-order" id="sitemap-order" value="" /> <ul id=”sitemap”> <li id="1"> <dl> <dt><a href=”#”>expand/collapse</a> <a href=”#”>Page Title</a></dt> <dd>Text Page</dd> <dd>Published</dd> <dd><a href=”#”>delete</a></dd> </dl> <ul><!–child pages–></ul> </li> </ul> And here is the JQuery code: $('#sitemap li').prepend('<div class="dropzone"></div>'); $('#sitemap li').draggable({ handle: ' > dl', opacity: .8, addClasses: false, helper: 'clone', zIndex: 100 }); var order = ""; $('#sitemap dl, #sitemap .dropzone').droppable({ accept: '#sitemap li', tolerance: 'pointer', drop: function(e, ui) { var li = $(this).parent(); var child = !$(this).hasClass('dropzone'); //If this is our first child, we'll need a ul to drop into. if (child && li.children('ul').length == 0) { li.append('<ul/>'); } //ui.draggable is our reference to the item that's been dragged. if (child) { li.children('ul').append(ui.draggable); }else { li.before(ui.draggable); } //reset our background colours. li.find('dl,.dropzone').css({ backgroundColor: '', backgroundColor: '' }); li.find('.dropzone').css({ height: '8px', margin: '0' }); // THE PROBLEM: var parentid = $(this).parent().attr('id'); menuorder += ui.draggable.attr('id')+'=>'+parentid+','; $("#sitemap-order").val(order); }, over: function() { $(this).filter('dl').css({ backgroundColor: '#ccc' }); $(this).filter('.dropzone').css({ backgroundColor: '#aaa', height: '30px', margin: '5px 0'}); }, out: function() { $(this).filter('dl').css({ backgroundColor: '' }); $(this).filter('.dropzone').css({ backgroundColor: '', height: '8px', margin: '0' }); } }); When moving items into the top-level (without parents), the parentid value I get is of the first list item (the parent container), so I can never remove the parent value and have a top-level item. Is there a no-brainer answer that I'm just not seeing right now? Any help is appreciated.

    Read the article

  • Look over my C# SQLite Query, what am I doing wrong?

    - by CODe
    I'm writing a WinForms database application using SQLite and C#. I have a sqlite query that is failing, and I'm unsure as to where I'm going wrong, as I've tried everything I could think of. public DataTable searchSubs(String businessName, String contactName) { string SQL = null; if ((businessName != null && businessName != "") && (contactName != null && contactName != "")) { // provided business name and contact name for search SQL = "SELECT * FROM SUBCONTRACTOR WHERE BusinessName LIKE %@BusinessName% AND Contact LIKE %@ContactName%"; } else if ((businessName != null && businessName != "") && (contactName == null || contactName == "")) { // provided business name only for search SQL = "SELECT * FROM SUBCONTRACTOR WHERE BusinessName LIKE %@BusinessName%"; } else if ((businessName == null || businessName == "") && (contactName != null && contactName != "")) { // provided contact name only for search SQL = "SELECT * FROM SUBCONTRACTOR WHERE Contact LIKE %@ContactName%"; } else if ((businessName == null || businessName == "") && (contactName == null || contactName == "")) { // provided no search information SQL = "SELECT * FROM SUBCONTRACTOR"; } SQLiteCommand cmd = new SQLiteCommand(SQL); cmd.Parameters.AddWithValue("@BusinessName", businessName); cmd.Parameters.AddWithValue("@ContactName", contactName); cmd.Connection = connection; SQLiteDataAdapter da = new SQLiteDataAdapter(cmd); DataSet ds = new DataSet(); try { da.Fill(ds); DataTable dt = ds.Tables[0]; return dt; } catch (Exception e) { MessageBox.Show(e.ToString()); return null; } finally { cmd.Dispose(); connection.Close(); } } I continually get an error saying that it is failing near the %'s. That's all fine and dandy, but I guess I'm structuring it wrong, but I don't know where! I tried adding apostrophes around the "like" variables, like this: SQL = "SELECT * FROM SUBCONTRACTOR WHERE Contact LIKE '%@ContactName%'"; and quite honestly, that is all I can think of. Anyone have any ideas?

    Read the article

  • Can you explicitly set a structure layout/alignment in C++ as you can in C#?

    - by Gary Willoughby
    In C# you have nice alignment attributes such as this: [StructLayout(LayoutKind.Explicit)] public struct Message { [FieldOffset(0)] public int a; [FieldOffset(4)] public short b; [FieldOffset(6)] public int c; [FieldOffset(22)] //Leave some empty space just for the heck of it. public DateTime dt; } Which gives you fine control on how you need your structure to be layed out in memory. Is there such a thing in standard C++?

    Read the article

  • Why do I get this error message very often ?

    - by ahmed
    "There is no row at position 0." Hi I keep on getting this error message. If mytable.rows(0).items(2) >= 0 then dim myid = dt.Rows(0).Item(6).ToString End if Please help me in this matter and I would never ever like to see this message again.Thanking you all.

    Read the article

  • I've caught an exception!! Now what?

    - by Jonesy
    Hi folks, I've started using try catch blocks (bit late i know!) but now im not sure what to do with the exception once i've caught it. What do people usually do here? -- Jonesy Try connection.Open() Dim sqlCmd As New SqlCommand("do some SQL", connection) Dim sqlDa As New SqlDataAdapter(sqlCmd) sqlDa.Fill(dt) Catch ex As SQLException ' ahhhh what to do now!!!? Finally connection.Close() End Try

    Read the article

  • how to generate the "create table" sql statement for an existing table in postgreSQL

    - by Raja
    I have a table created long ago in postgreSQL. Now i want to look at the sql statement used to create it but cannot figure it out. Also when i do the \dS+ tablename it says table not found, but \dt+ tablename is working fine. The \dS+ lists all the table names owned by the root postgres user and doesn't show up tables that i created with my user account. Any help is greatly appreciated. Thanks

    Read the article

  • How do I translate a ISO 8601 datetime string into a Python datetime object?

    - by Andrey Fedorov
    I'm getting a datetime string in a format like "2009-05-28T16:15:00" (this is ISO 8601, I believe) one hack-ish option seems to be to parse the string using time.strptime and passing the first 6 elements of the touple into the datetime constructor, like: datetime.datetime(*time.strptime("2007-03-04T21:08:12", "%Y-%m-%dT%H:%M:%S")[:6]) I haven't been able to find a "cleaner" way of doing this, is there one?

    Read the article

  • How can I filter a report with duplicate fields in related records?

    - by Graham Jones
    I have a report where I need to filter out records where there is a duplicate contract number within the same station but a different date. It is not considered a duplicate value becuase of the different date. I then need to summarize the costs and count the contracts but even if i suppress the "duplicate fields" it will summarize the value. I want to select the record with the most current date. Station Trans-DT Cost Contract-No 8 5/11/2010 10 5008 8 5/12/2010 15 5008 9 5/11/2010 12 5012 9 5/15/2010 50 5012

    Read the article

  • c# Column datatype Date type (NOT DateTime)

    - by Sha Le
    Hi All: I want know is there good way to detect Column DataType for Date field (NOT DateTime)? This what currently I do: switch (dt.Columns[col].DataType.FullName) { case "System.DateTime": formatedVal = Formatter.GetDateTime(val); break; // which is NOT possible, but something equivalent am looking for case "System.Date": formatedVal = Formatter.GetDate(val); break; default: formatedVal = val.ToString(); break; } Thanks a bunch. :-)

    Read the article

  • Navigate through .Net Grid

    - by SH
    is there a way to navigate through gird found on this page by passing parameters in query string? http://pubrec3.hillsclerk.com/oncore/search.aspx?bd=01/01/2008&ed=12/31/2008&bt=O&lb=1000000&ub=1000000000&d=5/6/2010&pt=-1&dt=D,%20MTG&st=consideration Or any code suggestion? All example could i need in C#.

    Read the article

  • DateTime group by date or hours

    - by nCdy
    01.02.2010 0:00:00 - 01.02.2010 anytime 01.02.2010 0:00:00 - 01.02.2010 0:any minutes and seconds so here is my date : DateTime x; it's 01.02.2010 0:00:00 as a string x.Date.ToString() here I compare date DatarowsForOneDay = dt.Select("DailyRecTime= '" + x.ToString() + "'"); So how can I group by date + Hours without care about minutes and seconds.

    Read the article

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