Search Results

Search found 1870 results on 75 pages for 'matt mcclellan'.

Page 46/75 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Unit Testing Model Classes that inherit from NSManagedObject

    - by Matt Baker
    So...I'm trying to get unit tests set up in my iPhone App but I'm having some issues. I'm trying to test my model classes but they inherit directly from NSManagedObject. I'm sure this is a problem but I don't know how to get around it. Everything is building and running as expected but I get this error when calling any method on the class I'm testing: Unknown.m:0:0 unrecognized selector sent to instance 0xc2b120 If I follow this structure (http://chanson.livejournal.com/115621.html) to create my object in my tests I end up with another error entirely but it still doesn't help me. Basically my question is this: how can I test a class that inherits from NSManagedObject?

    Read the article

  • problems with Console.SetOut in Release Mode?

    - by Matt Jacobsen
    i have a bunch of Console.WriteLines in my code that I can observe at runtime. I communicate with a native library that I also wrote. I'd like to stick some printf's in the native library and observe them too. I don't see them at runtime however. I've created a convoluted hello world app to demonstrate my problem. When the app runs, I can debug into the native library and see that the hello world is called. The output never lands in the textwriter though. Note that if the same code is run as a console app then everything works fine. C#: [DllImport("native.dll")] static extern void Test(); StreamWriter writer; public Form1() { InitializeComponent(); writer = new StreamWriter(@"c:\output.txt"); writer.AutoFlush = true; System.Console.SetOut(writer); } private void button1_Click(object sender, EventArgs e) { Test(); } and the native part: __declspec(dllexport) void Test() { printf("Hello World"); } Update: hamishmcn below started talking about debug/release builds. I removed the native call in the above button1_click method and just replaced it with a standard Console.WriteLine .net call. When I compiled and ran this in debug mode the messages were redirected to the output file. When I switched to release mode however the calls weren't redirected. Console redirection only seems to work in debug mode. How do I get around this?

    Read the article

  • Start thread with two parameters

    - by Matt
    I've got a method that gets called on an event, which presents me with two variables varA, varB (both strings). This method gets called with new information quite frequently, thus I have created a separate method that takes in the two parameters. I want to run this method in a thread, however have struck the issue that Thread.Start will not accept parameters. I've tried a few supposed methods, but have so far had no luck.. I think my best bet is to create a separate class, and handle it there.. However I have a List which I am inserting data into, and hit a dead end when the separate class tried to access that list, since it was in a different class. Can someone help me out here please?

    Read the article

  • How can I display a manual efficiently in Sharepoint

    - by Matt Palfreman
    My organisiation uses Sharepoint for its 'intranet'. I have been given the task of creating a site for my department. One of the things I need on there is a procedure guide, which is basically a 150 page document, whereby each page is a separate procedure. Is there an efficient way within sharepoint that these procedures can be stored and searchable somehow, rather than dumping a 150 page document on there?

    Read the article

  • Rails: Internationalization of Javascript Strings?

    - by Matt Rogish
    So, we have an existing Rails 2.3.5 app that does not support Internationalization at all. Now, I'm well familiar with Rails I8n stuff, but we have a LOT of output strings inside /javascripts/. I'm not a huge fan of this approach, but unfortunately it is too late to fix it now. How might we internationalize strings stored in JS files in a Rails app? Rails doesn't even serve the JS files... I'm thinking I could always have the Rails app serve up the JS files, but that seems pretty gross. Are there plugins to do this? Yikes.

    Read the article

  • using Applescript to retrieve movie file duration via Finder properties

    - by Matt
    When using Get Info on movie files in the Finder, I've noticed that many movie files have an accessible "Duration" property under the More Info tab. Is there an easy way to access this data using Applescript? I've tried lines like "set theTime to (duration of aFile)", but it doesn't seem to be as simple as that. Ideally I'd like to access the movie duration via the Finder properties without having to actually open the file in QuickTime. Is this possible? Edit: I seem to have figured this out... you need to use the "System Events" application, specifically the Movie File Suite of commands (and, importantly, you need to set the movie variable as a string, rather than an alias): set theMovie to (choose file with prompt "Select a movie file:") as string tell application "System Events" set theName to name of movie file theMovie set theDuration to (duration of contents of movie file theMovie) / (time scale of contents of movie file theMovie) end tell

    Read the article

  • How to turn a list of tuples into a string?

    - by matt
    I have a list of tuples that I'm trying to incorporate into a SQL query but I can't figure out how to join them together without adding slashes. My like this: list = [('val', 'val'), ('val', 'val'), ('val', 'val')] If I turn each tuple into a string and try to join them with a a comma I'll get something like ' (\'val\, \'val\'), ... ' What's the right way to do this, so I can get the list (without brackets) as a string?

    Read the article

  • Getting anchor text from a webpage using xpath within YQL

    - by Matt
    SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a/text()" does not work, whereas SELECT * FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a/text()" does. SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a" also works, it seems YQL has a bug, or am I missing something?

    Read the article

  • .Net System.Mail.Message adding multiple "To" addresses

    - by Matt Dawdy
    I just hit something I think is inconsistent, and wanted to see if I'm doing something wrong, if I'm an idiot, or... MailMessage msg = new MailMessage(); msg.To.Add("[email protected]"); msg.To.Add("[email protected]"); msg.To.Add("[email protected]"); msg.To.Add("[email protected]"); Really only sends this email to 1 person, the last one. To add multiples I have to do this: msg.To.Add("[email protected],[email protected],[email protected],[email protected]"); I don't get it. I thought I was adding multiple people to the "To" address collection, but what I was doing was replacing it. I think I just realized my error -- to add one item to the collection, use .To.Add(new MailAddress("[email protected]")) If you use just a string, it replaces everything it had in its list. Ugh. I'd consider this a rather large gotcha! Since I answered my own question, but I think this is of value to have in the stackoverflow archive, I'll still ask it. Maybe someone even has an idea of other traps that you can fall into.

    Read the article

  • looking for overview of readystate and browsers

    - by Matt
    I'm finding a lot of problems with trying to determine readyState between IE8, FF3, and Chrome. so far this is what I find: Chrome, FF do not fire an event for .onReadyStateChanged Chrome, FF support .onLoad IE8 supports .onReadyStateChanged, but does not support .onLoad IE8 has also returned loaded, and complete. Mostly it states loaded, but every now and then it spits out complete. Can anyone point me to a chart or overview of browsers and the way they handle readyStates?

    Read the article

  • How does MVC ViewData work?

    - by Matt
    I am toying around with an MVC application just to learn the technology. I am mocking up a check register application that keeps track of a checking account, what has cleared the bank and what has not. I am using EF for my model and everything seems to be working correctly insofar as Edit, Create, etc. However, I have a couple of totals at the top. One to show the bank's balance and another to show the actual balance. It works most of the time but when I do Edit's it does not always accurately reflect the new total and I need it to update everytime a change is made (i.e when something clears the bank): [Authorize(Roles = "admin, checkUser")] public ActionResult Index() { var resultSet = from myChecking in chk.tblCheckings orderby myChecking.id descending select myChecking; ViewData.Model = resultSet.Take(45).ToList(); //for balances var actualBalance = from theChecking in chk.tblCheckings select theChecking.deposit - theChecking.withdrawal; var bankBalance = from theChecking in chk.tblCheckings where theChecking.cleared == true select theChecking.deposit - theChecking.withdrawal; //get bank balance ViewData["bankBalance"] = bankBalance.Sum(); //get actual balance ViewData["actualBalance"] = actualBalance.Sum(); return View(); } I am showing the actual and other balance in the Index view as follows: <td colspan="9" style="text-align: center; font-size: 11pt; color: white;"> <%= string.Format("Bank Balance: {0:c}", ViewData["bankBalance"]) %> ------ <%= string.Format("Actual Balance: {0:c}", ViewData["actualBalance"]) %> </td>

    Read the article

  • How events are assigned in .NET

    - by Matt
    I just realized I didn't fully understand why in .NET you assign events using a += symbol. I figured this out yesterday when I needed to remove an event and without thinking I was doing someobject.onsomeevent += null thinking that would just remove the event I had previously assigned. After some investigation, I figured out I had to someobject.onsomeevent -= someeventmethod; After figuring this out, I realized I don't understand how event methods are assigned in .NET. So I have a few questions: First, does it mean that I can do someobject.onsomeevent += someeventmethod; someobject.onsomeevent += someeventothermethod; If so, when onsomeevent occurs will they both get hit, and in the order specified or simultaneously? Furthermore, how can I determine what event methods are already assigned to someobject.onsomeevent? Second, is there a way to save the events methods in some class, remove them from someobject.onsomeevent and re-assign them after some other procedures that would normally trigger the event are complete?

    Read the article

  • Linear regression confidence intervals in SQL

    - by Matt Howells
    I'm using some fairly straight-forward SQL code to calculate the coefficients of regression (intercept and slope) of some (x,y) data points, using least-squares. This gives me a nice best-fit line through the data. However we would like to be able to see the 95% and 5% confidence intervals for the line of best-fit (the curves below). What these mean is that the true line has 95% probability of being below the upper curve and 95% probability of being above the lower curve. How can I calculate these curves? I have already read wikipedia etc. and done some googling but I haven't found understandable mathematical equations to be able to calculate this. Edit: here is the essence of what I have right now. --sample data create table #lr (x real not null, y real not null) insert into #lr values (0,1) insert into #lr values (4,9) insert into #lr values (2,5) insert into #lr values (3,7) declare @slope real declare @intercept real --calculate slope and intercept select @slope = ((count(*) * sum(x*y)) - (sum(x)*sum(y)))/ ((count(*) * sum(Power(x,2)))-Power(Sum(x),2)), @intercept = avg(y) - ((count(*) * sum(x*y)) - (sum(x)*sum(y)))/ ((count(*) * sum(Power(x,2)))-Power(Sum(x),2)) * avg(x) from #lr Thank you in advance.

    Read the article

  • Storing uploaded content on a website

    - by Matt
    For the past 5 years, my typical solution for storing uploaded files (images, videos, documents, etc) was to throw everything into an "upload" folder and give it a unique name. I'm looking to refine my methods for storing uploaded content and I'm just wondering what other methods are used / preferred. I've considered storing each item in their own folder (folder name is the Id in the db) so I can preserve the uploaded file name. I've also considered uploading all media to a locked folder, then using a file handler, which you pass the Id of the file you want to download in the querystring, it would then read the file and send the bytes to the user. This is handy for checking access, and restricting bandwidth for users.

    Read the article

  • is that possible to crack Private key with Decrypted message and public key?

    - by matt clarck
    for example company B send an encrypted email with company A's public key (RSA/PGP/SSH/openSSL/...) the employer receive the encrypted email and send it to his boss who have the private key to decrypt message. the boss give decrypted email back to employer to work on it. question is can employer compare encrypted email with decrypted version and find out what is private key ? if it is possible then is there anyway to protect cracking private key from decrypted messages and comparing with encrypted messages/public key ?

    Read the article

  • Get number of times in loop over Hash object

    - by Matt Huggins
    I have an object of type Hash that I want to loop over via hash.each do |key, value|. I would like to get the number of times I've been through the loop starting at 1. Is there a method similar to each that provides this (while still providing the hash key/value data), or do I need to create another counter variable to increment within the loop?

    Read the article

  • R counting the occurrences of similar rows of data frame

    - by Matt
    I have data in the following format called DF (this is just a made up simplified sample): eval.num, eval.count, fitness, fitness.mean, green.h.0, green.v.0, offset.0 random 1 1 1500 1500 100 120 40 232342 2 2 1000 1250 100 120 40 11843 3 3 1250 1250 100 120 40 981340234 4 4 1000 1187.5 100 120 40 4363453 5 1 2000 2000 200 100 40 345902 6 1 3000 3000 150 90 10 943 7 1 2000 2000 90 90 100 9304358 8 2 1800 1900 90 90 100 284333 However, the eval.count column is incorrect and I need to fix it. It should report the number of rows with the same values for (green.h.0, green.v.0, and offset.0) by only looking at the previous rows. The example above uses the expected values, but assume they are incorrect. How can I add a new column (say "count") which will count all previous rows which have the same values of the specified variables? I have gotten help on a similar problem of just selecting all rows with the same values for specified columns, so I supposed I could just write a loop around that, but it seems inefficient to me.

    Read the article

  • Using jQuery in a GridView?

    - by Matt
    I have a traditional ASP.NET GridView. Inside of it I have a Template Field with edit capabilities. I need to use a jQuery autocomplete plugin on the edit piece. It works anywhere but inside of this GridView. In other words, I know the plugin works. Here is the ASP.NET stuff (yes, I'm using a SqlDataSource): <%# Eval("INGREDIENT_CODE") % And here is the jQuery in the document.ready(): $('[id$=txtEditIngredients]').autocomplete("LookupCodes.aspx?type=IC", { mustMatch: true }); What might I be doing wrong here?

    Read the article

  • Changing label color based on current label color in iPhone dev

    - by Matt Thomas
    I am having trouble figuring out the if statement code for changing the color of a UI label based on the current color of the label. For instance, if the label color is currently red and the correct button is pressed, I want the label color to change to black. If the label color is black I want the label color to change to blue. Many thanks for any tips.

    Read the article

  • Access Denied Java FileWriter / FileInputStream

    - by Matt
    My program downloads a websites source code, modifies it, creates the file, and then reuploads it through the FTP. However, I receive the following error when trying to open the created file: java.io.FileNotFoundException: misc.html (Access is denied) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at Manipulator.uploadSource(Manipulator.java:63) at Start.addPicture(Start.java:130) at Start$2.actionPerformed(Start.java:83) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) When I navigate to the folder directory and attempt to open "misc.html" with Notepad I receive Access is Denied. My code is fairly simple: File f = new File(page.sourceFileName); try { FileWriter out = new FileWriter(f); out.write(page.source); out.close(); } catch (IOException e) { e.printStackTrace(); } InputStream input = new FileInputStream(f); This is the vital excerpt from my program. I have copied this into a different test program and it works fine, I create a misc.html file and reopen it with both FileInputStream and manually. I would be worried about Administrator rights but the Test program works fine when I run it RIGHT after the problem program. I also have checked if the file exists and is a file with File methods and it is as well. Is this a result of me not closing a previous Input/Output properly? I've tried to check everything and I am fairly positive I close all streams as soon as they finish... Help! :)

    Read the article

  • Synchronizing Java Visualizer Audio and Visual

    - by Matt
    I've run into a problem creating a visualizer for .mp3 files in Java. My goal is to create a visualization that runs in time with the .mp3 file being played. I can currently visualize an .mp3 OR play it, but not both at the same time. I am using libraries which may make this trickier than necessary. I currently: Read in the .mp3 as a FileInputStream. a) Convert the FileInputStream into a Bitstream and run the Visualizer OR b) Pass the FileInputStream to a library Play method where it converts it into a Bitstream, decodes it, and plays it. I am using the JLayer library to play and decode the .mp3. My question is: how do I synchronize the two actions so that I can run both at the same time AND they line up (so my visualizations correspond to the changing frequencies). This implies that they finish at the same time as well.

    Read the article

  • Web Application Loading Screen

    - by Matt Charlton
    I have a web app that has several tree views. When the page loads i see the unordered lists and after a small latency the styling of the tree is rendered into the DOM. Is there a way to mask the webapp, and have a spinner in the middle of the screen, and when everything on the page is fully rendered the spinner goes away and the mask fades out? Kind of like a semi transparent mask that you would see on a lightbox pop-up dialog.

    Read the article

  • Should I specify both INDEX and UNIQUE INDEX?

    - by Matt Huggins
    On one of my PostgreSQL tables, I have a set of two fields that will be defined as being unique in the table, but will also both be used together when selecting data. Given this, do I only need to define a UNIQUE INDEX, or should I specify an INDEX in addition to the UNIQUE INDEX? This? CREATE UNIQUE INDEX mytable_col1_col2_idx ON mytable (col1, col2); Or this? CREATE UNIQUE INDEX mytable_col1_col2_uidx ON mytable (col1, col2); CREATE INDEX mytable_col1_col2_idx ON mytable (col1, col2);

    Read the article

  • heterogeneous comparisons in python3

    - by Matt Anderson
    I'm 99+% still using python 2.x, but I'm trying to think ahead to the day when I switch. So, I know that using comparison operators (less/greater than, or equal to) on heterogeneous types that don't have a natural ordering is no longer supported in python3.x -- instead of some consistent (but arbitrary) result we raise TypeError instead. I see the logic in that, and even mostly think its a good thing. Consistency and refusing to guess is a virtue. But what if you essentially want the python2.x behavior? What's the best way to go about getting it? For fun (more or less) I was recently implementing a Skip List, a data structure that keeps its elements sorted. I wanted to use heterogeneous types as keys in the data structure, and I've got to compare keys to one another as I walk the data structure. The python2.x way of comparing makes this really convenient -- you get an understandable ordering amongst elements that have a natural ordering, and some ordering amongst those that don't. Consistently using a sort/comparison key like (type(obj).__name__, obj) has the disadvantage of not interleaving the objects that do have a natural ordering; you get all your floats clustered together before your ints, and your str-derived class separates from your strs. I came up with the following: import operator def hetero_sort_key(obj): cls = type(obj) return (cls.__name__+'_'+cls.__module__, obj) def make_hetero_comparitor(fn): def comparator(a, b): try: return fn(a, b) except TypeError: return fn(hetero_sort_key(a), hetero_sort_key(b)) return comparator hetero_lt = make_hetero_comparitor(operator.lt) hetero_gt = make_hetero_comparitor(operator.gt) hetero_le = make_hetero_comparitor(operator.le) hetero_ge = make_hetero_comparitor(operator.gt) Is there a better way? I suspect one could construct a corner case that this would screw up -- a situation where you can compare type A to B and type A to C, but where B and C raise TypeError when compared, and you can end up with something illogical like a > b, a < c, and yet b > c (because of how their class names sorted). I don't know how likely it is that you'd run into this in practice.

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >