Search Results

Search found 3484 results on 140 pages for 'chris dubois'.

Page 106/140 | < Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >

  • no DOM in wordpress admin

    - by Chris
    I correctly inserted a javascript file into the wordPress admin with : wp_enqueue_script() I know that the script is loading. I tested it with an alert(). I then found that I am unable to access the DOM. When I tried : document.getElementsByTagName('body')[0].addEventListener('load', function() {}); This error was: Uncaught TypeError: Cannot call method 'addEventListener' of undefined This is the first time I have used 'settings api' or inserted scripts into the WordPress admin.

    Read the article

  • Importing a spreadsheet, but having trouble.

    - by Chris Phelps
    I have a form that allows a user to import a spreadsheet. This spreadsheet is generally static when it comes to column headers, but now the users want to be able to include an optional column (called Notes). My code crashes when I try to read the column from the spreadsheet if it doesn't exist. Dim objCommand As New OleDbCommand() objCommand = ExcelConnection() 'function that opens spreadsheet and returns objCommand Dim reader As OleDbDataReader reader = objCommand.ExecuteReader() While reader.Read() Dim Employee As String = Convert.ToString(reader("User")) Dim SerialNUM As String = Convert.ToString(reader("serialno")) **Dim Notes As String = Convert.ToString(reader("notes"))** If the spreadsheet contains a Notes column, all goes well. If not, crash. How can I check to see if the Notes column exists in the spreadsheet to avoid the crash?

    Read the article

  • How do I get certain code to execute before every single controller action in ASP.NET MVC 2?

    - by Chris
    I want to check some things about the state of the session, the user agent, etc, and possibly take action and return a special view BEFORE a controller method gets a chance to execute. For example: Most common: User requests Home/Index System checks to make sure x != 0. x does not equal zero, so the Home/Index controller executes like normal. But, sometimes: User requests Home/Index System checks to make sure x != 0. x DOES equal zero. The user must be notified and the requested controller action cannot be allowed to execute. I think this involves the use of ActionFilters. But I have read about them and I don't understand if I can preempt the controller method and return a view before it executes. I am sure I could execute code before the controller method runs, but how do I keep it from running in some instances and return a custom view, or direct to a different controller method?

    Read the article

  • How to convert "0" and "1" to false and true

    - by Chris
    I have a method which is connecting to a database via Odbc. The stored procedure which I'm calling has a return value which from the database side is a 'Char'. Right now I'm grabbing that return value as a string and using it in a simple if statement. I really don't like the idea of comparing a string like this when only two values can come back from the database, 0 and 1. OdbcCommand fetchCommand = new OdbcCommand(storedProc, conn); fetchCommand.CommandType = CommandType.StoredProcedure; fetchCommand.Parameters.AddWithValue("@column ", myCustomParameter); fetchCommand.Parameters.Add("@myReturnValue", OdbcType.Char, 1). Direction = ParameterDirection.Output; fetchCommand.ExecuteNonQuery(); string returnValue = fetchCommand.Parameters["@myReturnValue"].Value.ToString(); if (returnValue == "1") { return true; } What would be the proper way to handle this situation. I've tried 'Convert.ToBoolean()' which seemed like the obvious answer but I ran into the 'String was not recognized as a valid Boolean. ' exception being thrown. Am I missing something here, or is there another way to make '1' and '0' act like true and false? Thanks!

    Read the article

  • C# Using colors in console , how to store in a simplified notation

    - by Chris
    Hello, The code below shows a line in different colors. But thats alot of code to type just for one line and to repeat that all over a program again. How exactly can i simplify this , so i dont need to write the same amount of code over and over? Console.ForegroundColor = ConsoleColor.Cyan; Console.Write(">>> Order: "); Console.ResetColor(); Console.Write("Data"); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write("Parity"); Console.ForegroundColor = ConsoleColor.Cyan; Console.Write(" <<<"); Is there any way to store ... = Console.ForegroundColor = ConsoleColor.Cyan; ? "text" + color? + "text"; etc... Any input appreciated regards.

    Read the article

  • "this" in function parameter

    - by chris
    Looking at some code examples for HtmlHelpers, and I see declarations that look like: public static string HelperName(this HtmlHelper htmlHelper, ...more regular params ) I can't remember seeing this type of construct any where else - can someone explain the purpose of the "this"? I thought that by declaring something public static meant that the class did not need to be instantiated - so what is "this" in this case?

    Read the article

  • Force column order, Excel data table

    - by Chris
    I have a Excel Workbook that I use as a report template. I change the datasource on each pivot and datatable in a C# app. When I change the datatable datasource it tweeks the columns. Is there a way to force the column order? private void RefreshRawData(string dataSource, string connection) { xl._Worksheet ws = (xl._Worksheet)xlTemplate.Worksheets["Raw Data"]; xl.ListObject table = ws.ListObjects["Table_ExternalData_1"]; xl.QueryTable qt = table.QueryTable; qt.CommandText = dataSource; qt.Connection = GetExcelConnectionString((string)qt.Connection); qt.BackgroundQuery = false; qt.Refresh(m); Marshal.ReleaseComObject(ws); Marshal.ReleaseComObject(table); Marshal.ReleaseComObject(qt); ws = null; table = null; qt = null; }

    Read the article

  • Turing's Craft exercise stumped me... seems too easy.

    - by Chris
    "Write a for loop that prints the integers 1 through 40, separated by spaces or new lines. You may use only one variable, count which has already been declared as an integer." So I use... for(count = 1; count <= 40; count++) { cout << " " << count; } but they are using stdio.h as the only header and cout is not recognized. It hints that the output format should be (" ",count), but I can't figure out what print function to use. stdio.h can use fprintf or fwrite, but I don't have enough parameters for either function. Any ideas?

    Read the article

  • C# Express 2010 Multi-Threading

    - by Chris Evans
    Hi, I have a windows app that I have been running in c# Express 2008 for a year and have been trying to convert it over the last few days to 2010. The problem I am having is it is a multi-threaded application that has to run a series of code every second. What it does is have a main thread, that calls 3 worker threads, waits for them to finish then does some additional processing, sleeps till 1 second and runs again. The problem is part of the code can call a web service that takes 8 seconds to respond, so this bit of code gets called using ThreadPool.QueueUserWorkItem. The problem is when running in 2010 when this part of the code gets called the main thread continues to run but when it awakens the sub threads it hangs until the Threadpool method finishes running. This never happens in 2008. Any suggestions? So far I put that bit of code in it's own thread rather than using Threadpool but same issue.

    Read the article

  • Creating a Calender in PHP

    - by Chris T
    Are there any APIs/Libraries that make it easy to generate a calender for a certain month/year? I need to have some sort of admin interface for a "event planner" part of a CMS for a local youth group and I'm at a loss as to how to generate a decent calender.

    Read the article

  • Ruby - Passing Blocks To Methods

    - by Chris Bunch
    I'm trying to do Ruby password input with the Highline gem and since I have the user input the password twice, I'd like to eliminate the duplication on the blocks I'm passing in. For example, a simple version of what I'm doing right now is: new_pass = ask("Enter your new password: ") { |prompt| prompt.echo = false } verify_pass = ask("Enter again to verify: ") { |prompt| prompt.echo = false } And what I'd like to change it to is something like this: foo = Proc.new { |prompt| prompt.echo = false } new_pass = ask("Enter your new password: ") foo verify_pass = ask("Enter again to verify: ") foo Which unfortunately doesn't work. What's the correct way to do this?

    Read the article

  • wchar to char in c++

    - by Chris
    I have a Windows CE console application that's entry point looks like this int _tmain(int argc, _TCHAR* argv[]) I want to check the contents of argv[1] for "-s" convert argv[2] into an integer. I am having trouble narrowing the arguments or accessing them to test. I initially tried the following with little success if (argv[1] == L"-s") I also tried using the narrow function of wostringstream on each character but this crashed the application. Can anyone shed some light? Thanks

    Read the article

  • How can I make a workspace-folder level build script visible in the Eclipse Project Explorer?

    - by Chris
    I have a number of interdependent projects in an Eclipse workspace. Eclipse manages dependencies between them within the IDE but I'm starting work on a master build script that will sit in the folder about all the projects (the workspace folder). I haven't decided on if I will use Maven, Gradle or Ant/Ivy tet, but my question is, is there a way so that I can see a build script in the workspace folder in the Project/Package explorer? Currently it only shows me projects, but assuming I decide on an Ant build, I want to be able to see the main build.xml file in this window. I've played around with settings to no avail. Is it possible? If not, should I just set up an external run configuration instead?

    Read the article

  • Best practice for near reuse of model components?

    - by Chris Knight
    I have a requirement to use a Fund model in my code. It will contain a fund name and fund code. In the interest of reuse I've poked around the package containing the other models used and found an existing Fund model. However the issue here is that, in addition to fund name and code, it also contains an amount. Amount isn't directly relevant in my context. So, do I: 1) Use the existing Fund model as is, ignoring the setters/getters for fund amount. 2) Put a FundDescription interface onto the existing Fund model for accessing only the information I'm interested in. 3) Make a FundDescription base class from which the existing Fund model could now extend 4) Create a whole new seperate model since the two are slightly contextually different

    Read the article

  • Specifying Struts templates source

    - by Chris
    Say I'm using a form with a text-field. <@s.form action="login" <@s.textfield label="E-mail" name="email"/ <@s.submit value="send"/ How can I specify that the text-form should be generated by a custom template (text_login.ftl) rather than the standard text.ftl?

    Read the article

  • bind parent child listview asp.net

    - by Chris
    I'm trying to display two linq query results in a prent and child listview. I have the following code which gets the correct values to populate the listviews but when I nest the child listview inside the parent list view, I get an error saying "The name 'ListView2' does not exist in the current context". I presume I need to bind the two listviews in the code behind but my problem is I don't know how or the best way to do this. I have read a couple of posts on similar problems but my lack of knowledge on the subject doesn't make it clear to me. Please can somebody help me figure this out? It's the final piece of code I need to complete. Many thanks in advance. Here is my .aspx code: <asp:ListView ID="ListView1" runat="server"> <EmptyDataTemplate>No data was returned.</EmptyDataTemplate> <ItemSeparatorTemplate><br /></ItemSeparatorTemplate> <ItemTemplate> <li> <asp:Label ID="LabelID" runat="server" Text='<%# Eval("RecordID") %>'></asp:Label><br /> <asp:Label ID="LabelNumber" runat="server" Text='<%# Eval("CartID") %>'></asp:Label><br /> <asp:Label ID="LabelName" runat="server" Text='<%# Eval("Number") %>'></asp:Label><br /> <asp:Label ID="LabelDestination" runat="server" Text='<%# Eval("Destination") %>'></asp:Label><br /> <asp:Label ID="LabelPkgName" runat="server" Text='<%# Eval("PkgName") %>'></asp:Label> <li> <!-- LIST VIEW FOR FEATURES --> <asp:ListView ID="ListView2" runat="server"> <EmptyDataTemplate>No data was returned.</EmptyDataTemplate> <ItemSeparatorTemplate><br /></ItemSeparatorTemplate> <ItemTemplate> <li> <asp:Label ID="LabelFeatureName" runat="server" Text='<%# Eval("FeatureName") %>'></asp:Label><br /> <asp:Label ID="LabelFeatureSetUp" runat="server" Text='<%# Eval("FeatureSetUp") %>'></asp:Label><br /> <asp:Label ID="LabelFeatureMonthly" runat="server" Text='<%# Eval("FeatureMonthly") %>'></asp:Label><br /> </li> </ItemTemplate> <LayoutTemplate> <ul ID="itemPlaceholderContainer" runat="server" style=""> <li runat="server" id="itemPlaceholder" /> </ul> </LayoutTemplate> </asp:ListView> <!-- LIST VIEW FOR FEATURES [END] --> </li> </li> </ItemTemplate> <LayoutTemplate> <ul ID="itemPlaceholderContainer" runat="server" style=""> <li runat="server" id="itemPlaceholder" /> </ul> </LayoutTemplate> </asp:ListView> Here is my code behind: MyShoppingCart userShoppingCart = new MyShoppingCart(); string cartID = userShoppingCart.GetShoppingCartId(); using (ShoppingCartv2Entities db = new ShoppingCartv2Entities()) { var CartNumber = from c in db.NewViews where c.CartID == cartID select c; foreach (NewView item in CartNumber) { ListView1.DataSource = CartNumber; ListView1.DataBind(); } var CartFeature = from f in db.NewViews join o in db.NumberFeatureViews on f.RecordID equals o.RecordID where f.CartID == cartID select new { o.FeatureName, o.FeatureSetUp, o.FeatureMonthly }; foreach (var x in CartFeature) { ListView2.DataSource = CartFeature; ListView2.DataBind(); } }

    Read the article

  • How do I organize C# classes that inherit from one another, but also have properties that inherit from one another?

    - by Chris
    I have an application that has a concept of a Venue, a place where events happen. A Venue is owned by a Company and has many VenueParts. So, it looks like this: public abstract class Venue { public int Id { get; set; } public string Name { get; set; } public virtual Company Company { get; set; } public virtual ICollection<VenuePart> VenueParts { get; set; } } A Venue can be a GolfCourseVenue, which is a Venue that has a Slope and a specific kind of VenuePart called a HoleVenuePart: public class GolfCourseVenue { public string Slope { get; set; } public virtual ICollection<HoleVenuePart> Holes { get; set; } } In the future, there may also be other kinds of Venues that all inherit from Venue. They might add their own fields, and will always have VenueParts of their own specific type. My declarations above seem wrong, because now I have a GolfCourseVenue with two collections, when really it should just have the one. I can't override it, because the type is different, right? When I run reports, I would like to refer to the classes generically, where I just spit out Venues and VenueParts. But, when I render forms and such, I would like to be specific. I have a lot of relationships like this and am wondering what I am doing wrong. For example, I have an Order that has OrderItems, but also specific kinds of Orders that have specific kinds of OrderItems.

    Read the article

  • Re-ordering a collection of UIView's based on their CGPoint

    - by Chris
    Hi all, I have a NSMutableArray that holds a collection of UIViewControllers Amongst other properties and methods an instance of each of the viewControllers are placed in a parent view The user will place these objects individually when desired to. So essentially I use - (void)addSubview:(UIView *)view when a new view is added to the parent view controller. Because the UI is isometric it's made things a tad more complicated What I am trying to do is re-order the views based on their co-ordinate position, so items higher up the parent UIView frame is indexed lower then views lower in the parent UIview frame. And items that are on the left side of the view are positioned at a higher index to those on the right I think the solution may have to do with re-ordering the NSMutableArray but how can I compare the CGpoints? Do I need to compare the x and y separately?

    Read the article

  • Adding file names to an array list in java

    - by Chris G
    Hi I am currently needing to load the contents of a folders filenames to an arraylist I have but I am unsure as how to do this. To put it into perspective I have a folder with One.txt, Two.txt, Three.txt etc. I want to be able to load this list into an arraylist so that if I was to check the arraylist its contents would be : arraylist[0] = One arraylist[1] = Two arraylist[3] = Three If anyone could give me any insight into this it would be much appreciated.

    Read the article

  • Bridge or Factory and How

    - by Chris
    I'm trying to learn patterns and I've got a job that is screaming for a pattern, I just know it but I can't figure it out. I know the filter type is something that can be abstracted and possibly bridged. I'M NOT LOOKING FOR A CODE REWRITE JUST SUGGESTIONS. I'm not looking for someone to do my job. I would like to know how patterns could be applied to this example. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.IO; using System.Xml; using System.Text.RegularExpressions; namespace CopyTool { class CopyJob { public enum FilterType { TextFilter, RegExFilter, NoFilter } public FilterType JobFilterType { get; set; } private string _jobName; public string JobName { get { return _jobName; } set { _jobName = value; } } private int currentIndex; public int CurrentIndex { get { return currentIndex; } } private DataSet ds; public int MaxJobs { get { return ds.Tables["Job"].Rows.Count; } } private string _filter; public string Filter { get { return _filter; } set { _filter = value; } } private string _fromFolder; public string FromFolder { get { return _fromFolder; } set { if (Directory.Exists(value)) { _fromFolder = value; } else { throw new DirectoryNotFoundException(String.Format("Folder not found: {0}", value)); } } } private List<string> _toFolders; public List<string> ToFolders { get { return _toFolders; } } public CopyJob() { Initialize(); } private void Initialize() { if (ds == null) { ds = new DataSet(); } ds.ReadXml(Properties.Settings.Default.ConfigLocation); LoadValues(0); } public void Execute() { ExecuteJob(FromFolder, _toFolders, Filter, JobFilterType); } public void ExecuteAll() { string OrigPath; List<string> DestPaths; string FilterText; FilterType FilterWay; foreach (DataRow rw in ds.Tables["Job"].Rows) { OrigPath = rw["FromFolder"].ToString(); FilterText = rw["FilterText"].ToString(); switch (rw["FilterType"].ToString()) { case "TextFilter": FilterWay = FilterType.TextFilter; break; case "RegExFilter": FilterWay = FilterType.RegExFilter; break; default: FilterWay = FilterType.NoFilter; break; } DestPaths = new List<string>(); foreach (DataRow crw in rw.GetChildRows("Job_ToFolder")) { DestPaths.Add(crw["FolderPath"].ToString()); } ExecuteJob(OrigPath, DestPaths, FilterText, FilterWay); } } private void ExecuteJob(string OrigPath, List<string> DestPaths, string FilterText, FilterType FilterWay) { FileInfo[] files; switch (FilterWay) { case FilterType.RegExFilter: files = GetFilesByRegEx(new Regex(FilterText), OrigPath); break; case FilterType.TextFilter: files = GetFilesByFilter(FilterText, OrigPath); break; default: files = new DirectoryInfo(OrigPath).GetFiles(); break; } foreach (string fld in DestPaths) { CopyFiles(files, fld); } } public void MoveToJob(int RecordNumber) { Save(); LoadValues(RecordNumber - 1); } public void AddToFolder(string folderPath) { if (Directory.Exists(folderPath)) { _toFolders.Add(folderPath); } else { throw new DirectoryNotFoundException(String.Format("Folder not found: {0}", folderPath)); } } public void DeleteToFolder(int index) { _toFolders.RemoveAt(index); } public void Save() { DataRow rw = ds.Tables["Job"].Rows[currentIndex]; rw["JobName"] = _jobName; rw["FromFolder"] = _fromFolder; rw["FilterText"] = _filter; switch (JobFilterType) { case FilterType.RegExFilter: rw["FilterType"] = "RegExFilter"; break; case FilterType.TextFilter: rw["FilterType"] = "TextFilter"; break; default: rw["FilterType"] = "NoFilter"; break; } DataRow[] ToFolderRows = ds.Tables["Job"].Rows[currentIndex].GetChildRows("Job_ToFolder"); for (int i = 0; i <= ToFolderRows.GetUpperBound(0); i++) { ToFolderRows[i].Delete(); } foreach (string fld in _toFolders) { DataRow ToFolderRow = ds.Tables["ToFolder"].NewRow(); ToFolderRow["JobId"] = ds.Tables["Job"].Rows[currentIndex]["JobId"]; ToFolderRow["Job_Id"] = ds.Tables["Job"].Rows[currentIndex]["Job_Id"]; ToFolderRow["FolderPath"] = fld; ds.Tables["ToFolder"].Rows.Add(ToFolderRow); } } public void Delete() { ds.Tables["Job"].Rows.RemoveAt(currentIndex); LoadValues(currentIndex++); } public void MoveNext() { Save(); currentIndex++; LoadValues(currentIndex); } public void MovePrevious() { Save(); currentIndex--; LoadValues(currentIndex); } public void MoveFirst() { Save(); LoadValues(0); } public void MoveLast() { Save(); LoadValues(ds.Tables["Job"].Rows.Count - 1); } public void CreateNew() { Save(); int MaxJobId = 0; Int32.TryParse(ds.Tables["Job"].Compute("Max(JobId)", "").ToString(), out MaxJobId); DataRow rw = ds.Tables["Job"].NewRow(); rw["JobId"] = MaxJobId + 1; ds.Tables["Job"].Rows.Add(rw); LoadValues(ds.Tables["Job"].Rows.IndexOf(rw)); } public void Commit() { Save(); ds.WriteXml(Properties.Settings.Default.ConfigLocation); } private void LoadValues(int index) { if (index > ds.Tables["Job"].Rows.Count - 1) { currentIndex = ds.Tables["Job"].Rows.Count - 1; } else if (index < 0) { currentIndex = 0; } else { currentIndex = index; } DataRow rw = ds.Tables["Job"].Rows[currentIndex]; _jobName = rw["JobName"].ToString(); _fromFolder = rw["FromFolder"].ToString(); _filter = rw["FilterText"].ToString(); switch (rw["FilterType"].ToString()) { case "TextFilter": JobFilterType = FilterType.TextFilter; break; case "RegExFilter": JobFilterType = FilterType.RegExFilter; break; default: JobFilterType = FilterType.NoFilter; break; } if (_toFolders == null) _toFolders = new List<string>(); _toFolders.Clear(); foreach (DataRow crw in rw.GetChildRows("Job_ToFolder")) { AddToFolder(crw["FolderPath"].ToString()); } } private static FileInfo[] GetFilesByRegEx(Regex rgx, string locPath) { DirectoryInfo d = new DirectoryInfo(locPath); FileInfo[] fullFileList = d.GetFiles(); List<FileInfo> filteredList = new List<FileInfo>(); foreach (FileInfo fi in fullFileList) { if (rgx.IsMatch(fi.Name)) { filteredList.Add(fi); } } return filteredList.ToArray(); } private static FileInfo[] GetFilesByFilter(string filter, string locPath) { DirectoryInfo d = new DirectoryInfo(locPath); FileInfo[] fi = d.GetFiles(filter); return fi; } private void CopyFiles(FileInfo[] files, string destPath) { foreach (FileInfo fi in files) { bool success = false; int i = 0; string copyToName = fi.Name; string copyToExt = fi.Extension; string copyToNameWithoutExt = Path.GetFileNameWithoutExtension(fi.FullName); while (!success && i < 100) { i++; try { if (File.Exists(Path.Combine(destPath, copyToName))) throw new CopyFileExistsException(); File.Copy(fi.FullName, Path.Combine(destPath, copyToName)); success = true; } catch (CopyFileExistsException ex) { copyToName = String.Format("{0} ({1}){2}", copyToNameWithoutExt, i, copyToExt); } } } } } public class CopyFileExistsException : Exception { public string Message; } }

    Read the article

  • Amazon Product Advertising API: XXX is not a valid value for BrowseNodeId

    - by Chris
    Hello, I am using the Amazon product Advertising API to fetch the product categories. For US categories it is working. But using browse nodes from different sites I get the following error: "569604 is not a valid value for BrowseNodeId. Please change this value and retry your request." I got the browse-nodes from the following site: http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?BrowseNodeIDs.html Where is the problem? Thanks for your help!

    Read the article

  • Is there a good IDE for SQLite ?

    - by Chris Conway
    Is there a tool out there that can interact with a SQLite database in a similar way that TOAD works with Oracle or Management Studio works with SQL Server? I'm looking for something that visually shows table structures, views, etc. Looking to target the Windows platform (preferably Vista). Thanks!

    Read the article

  • Scala: XML Attribute parsing

    - by Chris
    I'm trying to parse a rss feed that looks like this for the attribute "date": <rss version="2.0"> <channel> <item> <y:c date="AA"></y:c> </item> </channel> </rss> I tried several different versions of this: (rssFeed contains the RSS data) println(((rssFeed \\ "channel" \\ "item" \ "y:c" \"date").toString)) But nothing seems to work. What am I missing? Any help would really be appreciated!

    Read the article

  • Import data from an SSRS report via SSIS package

    - by Chris
    First, I ask that you not ask 'why.' In the famous words of Tennyson "Ours is not to reason why. Ours is but to do and die." It's one of those, "This is what you have, deal with it." situations. The source data comes from SSRS report. The goal is to load the data into a database via SSIS. The hopeful goal is to avoid human intervention in having to download the SSRS report into Excel or CSV. There will be complex SSIS processing from there on out. Any suggestions are humbly appreciated.

    Read the article

< Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >