Search Results

Search found 4077 results on 164 pages for 'throw'.

Page 38/164 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • SQL ADO.NET shortcut extensions (old school!)

    - by Jeff
    As much as I love me some ORM's (I've used LINQ to SQL quite a bit, and for the MSDN/TechNet Profile and Forums we're using NHibernate more and more), there are times when it's appropriate, and in some ways more simple, to just throw up so old school ADO.NET connections, commands, readers and such. It still feels like a pain though to new up all the stuff, make sure it's closed, blah blah blah. It's pretty much the least favorite task of writing data access code. To minimize the pain, I have a set of extension methods that I like to use that drastically reduce the code you have to write. Here they are... public static void Using(this SqlConnection connection, Action<SqlConnection> action) {     connection.Open();     action(connection);     connection.Close(); } public static SqlCommand Command(this SqlConnection connection, string sql){    var command = new SqlCommand(sql, connection);    return command;}public static SqlCommand AddParameter(this SqlCommand command, string parameterName, object value){    command.Parameters.AddWithValue(parameterName, value);    return command;}public static object ExecuteAndReturnIdentity(this SqlCommand command){    if (command.Connection == null)        throw new Exception("SqlCommand has no connection.");    command.ExecuteNonQuery();    command.Parameters.Clear();    command.CommandText = "SELECT @@IDENTITY";    var result = command.ExecuteScalar();    return result;}public static SqlDataReader ReadOne(this SqlDataReader reader, Action<SqlDataReader> action){    if (reader.Read())        action(reader);    reader.Close();    return reader;}public static SqlDataReader ReadAll(this SqlDataReader reader, Action<SqlDataReader> action){    while (reader.Read())        action(reader);    reader.Close();    return reader;} It has been awhile since I've really revisited these, so you will likely find opportunity for further optimization. The bottom line here is that you can chain together a bunch of these methods to make a much more concise database call, in terms of the code on your screen, anyway. Here are some examples: public Dictionary<string, string> Get(){    var dictionary = new Dictionary<string, string>();    _sqlHelper.GetConnection().Using(connection =>        connection.Command("SELECT Setting, [Value] FROM Settings")            .ExecuteReader()            .ReadAll(r => dictionary.Add(r.GetString(0), r.GetString(1))));    return dictionary;} or... public void ChangeName(User user, string newName){    _sqlHelper.GetConnection().Using(connection =>         connection.Command("UPDATE Users SET Name = @Name WHERE UserID = @UserID")            .AddParameter("@Name", newName)            .AddParameter("@UserID", user.UserID)            .ExecuteNonQuery());} The _sqlHelper.GetConnection() is just some other code that gets a connection object for you. You might have an even cleaner way to take that step out entirely. This looks more fluent, and the real magic sauce for me is the reader bits where you can put any kind of arbitrary method in there to iterate over the results.

    Read the article

  • Hybrid wireless network repeating

    - by Oli
    Summary: I'd like to use two Ubuntu computers to extend/compliment an existing wireless access point. I have a network which currently looks a bit like this: What the diagram doesn't show is the interference caused by our house. It's a wifi-blocking robot sent here from the past. The two wired computers are in areas where the signal is most blocked (not by design, just a happy co-incidence). Both wired computers have fairly good network cards. They're both Ubuntu machines and I would like to turn them into additional base stations. I know I could throw more networking hardware at this (network extenders or cable in additional, pure wireless access points) but I've got two Linux machines sitting in ideal places and I feel like they should be able to help me out. I've tried ad-hoc networks but I need something that is a lot more transparent (eg you can migrate from base to base without a connection dropping); it should look like one network to clients.

    Read the article

  • Why is Google Webmaster Tools crawling invalid URLS and showing 500 errors?

    - by Amos Kane
    Google Webmaster tools is reporting 12k+ 500 errors. Eeek! None of the URLS are valid- they all contain www.youtube.com. First, why is Google crawling these URLS if they don't exist? I supplied a sitemap, and they are of course not in the sitemap. I don't have a robots.txt blocking anything. I've checked for invalid redirects--none, and checked for unclosed tags or something that would throw www.youtube.com into the URL by accident--none. In every 'linked from', the referring URL is also a bad URL, with www.youtube.com in it. The Google Tools report no malware, and I can't check the server logs because the host won't give me access. Really stuck!! Any ideas appreciated!

    Read the article

  • Write this java source in Clojure

    - by tikky
    Need to write this code in clojure.... package com.example.testvaadin; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import clojure.lang.RT; import com.vaadin.Application; import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; public class Clojure4Vaadin extends AbstractApplicationServlet { @Override protected Class getApplicationClass()throws ClassNotFoundException { return Application.class; } @Override protected Application getNewApplication(HttpServletRequest request) throws ServletException { try { RT.load(getServletConfig().getInitParameter("script-name"), true); return (Application)RT.var(getServletConfig().getInitParameter("package-name"),getServletConfig().getInitParameter("function-name")).invoke(new String[0]); } catch (Exception e) { throw new ServletException(e); } } }

    Read the article

  • Why doesn't my graphic card software support 1280*1024?

    - by Allwar
    Hi, I have an external monitor which is an 20" 1280*1024. In windows 7 it works fine with that resolution but in ubuntu it can't. Example: In windows I connect it and activates it, done. In ubuntu I connect and the only resolution that is available is the ones my laptop screen support, 12" 1366*768. My laptop is an asus 1201n. If I force it to use 1280*1024 both screen crashes and i have to force a reboot. When I force it I only force the external monitor, the laptop is already at maximum 1366*768. I connect it throw VGA. ((The graphic card supports 1280*1024 in windows 7, #Fail)) alvar@alvars-laptop:~$ disper -l display DFP-0: HSD121PHW1 resolutions: 320x175, 320x200, 360x200, 320x240, 400x300, 416x312, 512x384, 640x350, 576x432, 640x400, 680x384, 720x400, 640x480, 720x450, 640x512, 700x525, 800x512, 840x525, 800x600, 960x540, 832x624, 1024x768, 1366x768 display CRT-0: CRT-0 resolutions: 320x240, 400x300, 512x384, 680x384, 640x480, 800x600, 1024x768, 1152x864, 1360x768

    Read the article

  • #altnetseattle in Closing

    - by GeekAgilistMercenary
    So again, the #altnetseattle Conference easily was one of the most useful events of the year for me.  The amount of ideas, thoughts, and conversations that happen in just those two days often outweigh all the presentations I see at other conferences throughout the year.  The reason is simple, they are directed, to the point, and done with the ideal of open spaces.  This makes each session exhaustive on a particular topics.  Throw together some of the smartest people in the field and you have a bang up awesome energy and conversation. I got to talk about cloud computer, a little bit, and REST Architecture as sessions I kicked off myself.  Those were a blast.  I also got to meet a ton of other super talented like minded developers and engineers that are out there kicking the tires of .NET (and other languages/tech stacks like Ruby on Rails). Overall the conference rocked and I will definitely be coming back!  With that, I am headed home to Portland.

    Read the article

  • Mentioning a price for a service behind a free app in App Store

    - by David
    We are making a business service and have created an app to be used as a front-end. The app is free, but the service is not. Due to Apple taking 30% of in-app purchases, our service cannot be bought as an in-app purchase. My question is: Could Apple choose to throw out our app if we mention the price of the service in the description of our app in iTunes or in a help-text in the app? It seems unreasonable that this would cause problems, but the potential consequences to our business could be terrible so I want to make sure.

    Read the article

  • How can I factor momentum into my space sim?

    - by Josh Petite
    I am trying my hand at creating a simple 2d physics engine right now, and I'm running into some problems figuring out how to incorporate momentum into movement of a spaceship. If I am moving in a given direction at a certain velocity, I am able to currently update the position of my ship easily (Position += Direction * Velocity). However, if the ship rotates at all, and I recalculate the direction (based on the new angle the ship is facing), and accelerate in that direction, how can I take momentum into account to alter the "line" that the ship travels? Currently the ship changes direction instantaneously and continues at its current velocity in that new direction when I press the thrust button. I want it to be a more gradual turning motion so as to give the impression that the ship itself has some mass. If there is already a nice post on this topic I apologize, but nothing came up in my searches. Let me know if any more information is needed, but I'm hoping someone can easily tell me how I can throw mass * velocity into my game loop update.

    Read the article

  • How to handle estimates for programmers joining the team?

    - by Jordan
    Iteration has already started, new programmer joins the team, task X has already been estimated to be 30 hours by a different developer. What is the best practice in this situation? new developer runs with the given estimate (the idea being that any discrepancy will be corrected for when velocity is calculated?) new developer re-estimates task? (if so, what if it's significantly higher and no longer fits in the iteration?) throw our hands up and go back to waterfall? something else entirely?

    Read the article

  • A little SQL tip for C# developers

    - by MikeParks
    The other day at work I came across a handy little block of SQL code from Jeremiah Clark's blog. It's pretty simple logic but through the mind of a C# developer making some quick DB updates, seems to me that it's more likely to end up writing out the code in Solution 1 instead of Solution 2 below to solve the problem. Basically, I needed to check and see if a specific record existed in Table1. If it does exist, then update that record, otherwise insert a new record into Table1. Solution 1: IF EXISTS (SELECT * FROM Table1 WHERE Column1='SomeValue')     UPDATE Table1 SET (...) WHERE Column1='SomeValue' ELSE     INSERT INTO Table1 VALUES (...) Solution 2: UPDATE Table1 SET (...) WHERE Column1='SomeValue' IF @@ROWCOUNT=0     INSERT INTO Table1 VALUES (...)         As Jeremiah explains, they both accomplish the same thing but from a performance standpoint, Solution 2 is the better way to go (saved table/index scan). Just wanted to throw this small tip out there. Thanks! - Mike

    Read the article

  • What C++ libraries can be used in game development [closed]

    - by RedShft
    I'm currently in the planning stage for my next game, and since I've been away from C++ for a while I have some questions about helpful libraries. I plan on making a 2D game with SDL, constructing my own simple 2D engine. I plan on making this game for the PC. What libraries would you recommend to make this process easier? What about unittests? What about an enforce operator to throw exceptions? int a = 1; enforce(a == 2); //Throws an exception, Specifically, i'm looking for general purpose libraries, that implement that make my life easier (like boost). Also, a helpful library for physics/collision, AI, XML file parsing (specifically working with the Tiled map editor), and any others that you guys have used that are useful in a 2D game.

    Read the article

  • How to display image in html image tag - node.js [on hold]

    - by ykel
    I use the following code to store image to file system and to retrieve the image, I would like to display the retrieved image on html image tag, hower the image is rendered on the response page but not on the html image tag. here is my html image tag: <img src="/show"> THIS CODE RETREIVES THE IMAGE: app.get('/show', function (req, res) { var FilePath=__dirname+"/uploads/3562_564927103528411_1723183324_n.jpg"; fs.readFile(FilePath,function(err,data){ if(err)throw err; console.log(data); res.writeHead(200, {'Content-Type': 'image/jpeg'}); res.end(data); // Send the file data to the browser. }) });

    Read the article

  • How should I design a wizard for generating requirements and documentation

    - by user1777663
    I'm currently working in an industry where extensive documentation is required, but the apps I'm writing are all pretty much cookie cutter at a high level. What I'd like to do is build an app that asks a series of questions regarding business rules and marketing requirements to generate a requirements spec. For example, there might be a question set that asks "Does the user need to enter their age?" and a follow-up question of "What is the minimum age requirement?" If the inputs are "yes" and "18", then this app will generate requirements that look something like this: "The registration form shall include an age selector" "The registration form shall throw an error if the selected age is less than 18" Later on down the line, I'd like to extend this to do additional things like generate test cases and even code, but the idea is the same: generate some output based on rules determined by answering a set of questions. Are there any patterns I could research to better design the architecture of such an application? Is this something that I should be modeling as a finite state machine?

    Read the article

  • I'm having trouble learning

    - by Gavin Sapp
    I'm only 13 but i'm genuinely interested in CS and would really like it if I could actually accomplish it. I've read books on C++ and C#, but ALL of them are the same!! They all say "Ok so since you have no prior knowledge in this what so ever, write a snippet that will do this and then make a GUI and then throw it into the Priafdhsu hfad then add the program and then program your own compiler to do some stuff". It's really getting annoying. I've payed near $40 (via Paypal) on ebooks that supposedly taught people to program with no prior knowledge. ALL OF THEM EXPECT ME TO ALREADY KNOW THE LANGUAGE. Is there something that I'm missing or am I suppose to be born with the property of CS? I would very much appreciate it if someone could explain this to me or possibly refer me to a tutorial on Programming Theory that starts from below ground zero as I have know knowledge in CS at all.

    Read the article

  • Switching between levels, re-initialize existing structure or create new one?

    - by Martino Wullems
    This is something I've been wondering for quite a while. When building games that exist out of multiple levels (platformers, shmups etc) what is the prefered method to switch between the levels? Let's say we have a level class that does the following: Load data for the level design (tiles), enemies, graphics etc. Setup all these elements in their appriopate locations and display them Start physics and game logic I'm stuck between the following 2 methods: 1: Throw away everything in the level class and make a new one, we have to load an entirely new level anyway! 2: pause the game logic and physics, unload all currents assets, then re-initialize those components with the level data for the new level. They both have their pros and cons. Method 1 is alot easier and seems to make sense since we have to redo everything anyway. But method 2 allows you to re-use exisiting elements which might save resources and allows for a smoother transfer to the new level.

    Read the article

  • Maintainability of Boolean logic - Is nesting if statements needed?

    - by Vaccano
    Which of these is better for maintainability? if (byteArrayVariable != null) if (byteArrayVariable .Length != 0) //Do something with byteArrayVariable OR if ((byteArrayVariable != null) && (byteArrayVariable.Length != 0)) //Do something with byteArrayVariable I prefer reading and writing the second, but I recall reading in code complete that doing things like that is bad for maintainability. This is because you are relying on the language to not evaluate the second part of the if if the first part is false and not all languages do that. (The second part will throw an exception if evaluated with a null byteArrayVariable.) I don't know if that is really something to worry about or not, and I would like general feedback on the question. Thanks.

    Read the article

  • How Often do You Change E-mail Addresses? [Poll]

    - by Asian Angel
    Recently we ran across an article about a man who consistently changes his e-mail address every 20 months. Why? To throw off spam. With that in mind we became curious and decided to ask how often you change your e-mail addresses… Everyone has their own method for dealing with the bane known as spam whether it is heavy filtering, separate accounts to catch possible spam activity, abandoning swamped accounts, etc. Here is your opportunity to share how you deal with spam, protect your accounts, and to voice your thoughts regarding consistent timed changes to new accounts as mentioned in the article linked to below. How-To Geek Polls require Javascript. Please Click Here to View the Poll. How Frequently Do You Change Your Email Address? [Apartment Therapy] 6 Ways Windows 8 Is More Secure Than Windows 7 HTG Explains: Why It’s Good That Your Computer’s RAM Is Full 10 Awesome Improvements For Desktop Users in Windows 8

    Read the article

  • What can I put in my software development blog to make it a good showcase of me?

    - by Sean
    I have been itching to write a software development blog for some time now. The best advice I've received about blog writing is "Write the blog you would have want to read". Its good advice but its only half the story, Once you write a blog it becomes your showcase on the Internet, it is bound to come up on any search conducted by a future colleague or employer. It can be a good thing or it can do some serious damage. So if there are any hiring managers out there, can you give me a few pointers on what it is in a blog that give you a good impression about candidate and/or the kind of stuff that causes you to throw the candidate's resume to the nearest bean? Does a blog have to come up with a clever piece of code every week? (Don’t think I can manage it) Is it OK to blog more then not about development methods to improved quality and productivity (have a lot of ideas about that). Can I blog about stuff I did not try first hand but seems noteworthy?

    Read the article

  • Can I create a hybrid software-RAID array with disks of different sizes?

    - by stueng
    Products such as Synology offer something called Synology Hybrid RAID http://www.synology.com/us/products/features/RAID.php This RAID type allows you to make best use of your disks available by using all the disk space available as long as at least two disks share the same increased size where a typical RAID setup would simply "throw away" the extra space I would like to build a NAS with 4 disks available. I will begin by populating it with 3 X 3TB to give me 6TB usable. By the time I have filled this 6TB I imagine that 4TB disks will have come down in price, so at this stage I would add a 4th 4TB disk to give me an additional 3TB of space. When I next run out of space I will change one of the original 3TB disks with a 4TB disk giving me an additional 1TB of space. This is not possible with a typical RAID configuration, only with these "hybrid RAID" types I am wondering if I can acheive a similar "hybrid RAID" with Ubuntu? or another linux distro?

    Read the article

  • Skills for RAD developer.

    - by Janis Peisenieks
    I am about to embark on an exquisite journey. I have applied for an event, where in span of 48 straight hours, strangers meet, throw around some great ideas, decide on teams, and make a working prototype of IT project. All within 48 hours. I anticipate, that this will be very skill and ability intensive experience, and I want to be prepared. Since i will need to develop my part of the code quickly, I have a following question: What would be the most needed skills for these 48 hours? I do know, that things like proper documentation, version control and such are pretty important for a full fledged application/program/web development, but for this span of frantic coding? Background: I am a web developer, so answers applicable to web development would be more appreciated than others.

    Read the article

  • Wheres my memory going?

    - by Stu2000
    My machine keeps 'freezing' before eventaully logging out with all the programs exiting. This is rather annoying, and I think its because I keep running out of memory. I am not running any custom software, just netbeans, chrome etc. (Stuff I usually run on other ubuntu computers without issue). For some reason my memory usage is through the roof as seen here, but I can't quite figure out why. Here is a screenshot which may be useful with htop and gnome-system monitor open as user and as root. I notice that my console-kit-daemon is taking up about a gig of 'virtual memory'. Is that normal? Any tips/advice will be helpful. In the meantime I have ordered 2 x 4 gig ram sticks to try and just throw hardware at the issue.

    Read the article

  • Computer refuses to boot either ubuntu disk I'm using

    - by xtraorange
    I'm attempting to set up an Amahi server, and thus have taken an older PC and wiped it clean using DBAN. I'm now in the process of installing Ubuntu, but for some reason the computer refuses to recognize either form of Ubuntu I throw at it, even though it recognizes the Windows XP CD fine. Things it can't be: Boot order - I've tripple checked A bad DVD - I've booted the live CD off of my Mac just fine. A drive issue - the drive boots other cd's just fine, I've tested both an XP and the ultimate boot disk for windows... they are booting fine. A drive conflict - I have unplugged the only hard drive, leaving the DVD drive alone, still no recognition. I've tried both Ubuntu 12 and an older Ubuntu 10 CD, it refuses to recognize either one. It's like my computer has decided it will have nothing to do with Ubuntu. Any help would be greatly appreciated.

    Read the article

  • Moving large amounts of data between shared hosts

    - by Bryan M.
    I recently acquired a client who is a photographer and was interested in moving web hosts since his current host had threatened to throw him off due to CPU spiking. The migration went fairly easily, with about 350MBs of website and media files. Then I discovered about 60GBs of client galleries he had failed to mention. I am unable to move this much data myself, since I'm capping out at about 20kb/s on the FTP connection. Has anyone encountered a situation where they needed to migrate this much data between cheap hosting? Should we contact the hosting companies about this (he is moving from Westhost to MediaTemple)?

    Read the article

  • Choice of node.js modules to demo flexibility

    - by John K
    I'm putting together a presentation to talk about and demo node.js to client-side JavaScript developers. The language concepts and syntax are not an issue for them, so instead I'd like to get right into things and show off node's abilities that differ from client-side scripting. There are numerous modules available in the NPM registry and many people have much more experience with the registry than I do. I'm looking for a selection of node modules based on recommendations from your experience that show a variety of uses for node that are practical, broadly useful and can be demonstrated with a small code sample without requiring much domain knowledge on behalf of the audience. Neat and impressive is good too - I can throw in a couple of shock and awe items for cool factor. To be fair, top-voted answers will get most consideration for inclusion. My hope is this will result in a well-rounded demonstration of node technology.

    Read the article

  • Podcast with AJI about iOS development coming from a .NET background

    - by Tim Hibbard
    I talked with Jeff and John from AJI Software the other day about developing for the iOS platform. We chatted about learning Xcode and Objective-C, provisioning devices and the app publishing process. We all have a .NET background and made lots of comparisons between the two platforms/ecosystems/fanbois. They even let me throw in a plug for Christian Radio Locator. Jeff was my first contact with the Kansas City .NET community. It was probably about 10 years ago. He pushed me to talk more (and rescued me from my first talk that bombed) and blog more. One time a group of us took a 16 hour car trip to South Carolina for a code camp and live podcasted the whole thing. Good times.Listen to the show Click here to subscribe to more AJI Reports in the future.

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >