Daily Archives

Articles indexed Sunday December 9 2012

Page 3/12 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How do I remove the unity 2D option in lightdm (login sceen) in ubuntu 12.04?

    - by user113460
    Because I wish to view my full username at login, I want to remove the "Unity 2D" option at the login screen. Currently the last part of the username (after the 20th digit) is hidden behind the Ubuntu-icon which enables switching to Unity 2D. Another option would be to decrease the font-size of the username, is any of this possible? Btw this is not an issue in Ubuntu 12.10, where the username font-size is smaller, and Unity 2D unsupported!

    Read the article

  • Multiple Passwords on One Account

    - by user110789
    I'd like to join three ideas into one interesting and sometimes useful feature. There was a question about using multiple passwords earlier this year, but it didn't receive much attention. I'd like to ask the question again after showing an interesting and new way to use the feature. The three original posts I found to be interestingly combined were: (1) Multiple passwords per user (2) http://blog.littleimpact.de/index.php/2009/09/14/automatic-encryption-of-home-directories-using-truecrypt-62-and-pam_exec/ (3) http://www.truecrypt.org/docs/hidden-volume Basically I'd like to login to my account with two passwords and depending on the password I use, I would get a different content in my home directory. In a way I would get a cryptographically hidden account into my system. So the question is, is it possible to allow multiple passwords to log on to Ubuntu/Linux for the same user?

    Read the article

  • Why is user "lightdm" trying to log into my SBS 2003?

    - by user652740
    I have 7 Ubuntu desktops connected to a SBS 2003 using Centrify. I have a rather weird scenario, whereby a user with the name lightdm is trying to log into our server, possibly automatically. I thought lightdm was the session manager, not a user? Does anybody know what could be causing this? There is no user: "lightdm" on the server and the problem only comes from one of the 7 internal desktops connected to the server (its IP address is in the local network).

    Read the article

  • how to recover lost partitions data

    - by TheJoester
    I have a 2TB SATA drive that was being used as file storage on my UBUNTU computer. I was re-imaging my windows box so I used that drive to back up some files to it. I did this by taking the drive from my windows PC and putting it in my UBUNTU PC, mounted it and copied the files over. After the windows refresh I thought it would be easier to take the 2 TB drive and dock it in the external dock my Windows case has built in. Anyway it would recognize in BIOS but windows would not see it (because it was EXT3 or EXT4) so when I went into the disk manager it advised me the drive needed to be initialized. Me not thinking I initialized it as a GUID Partition table. Now it sees it as a blank drive, even in UBUNTU. I have done nothing else to write or change the drive. I was wondering if there is a qay to repair the old partitioning and get access to my files back? many thanks! EDIT: I followed the instructions in the link @kniwor sent me. I used the command sudo gpart -W /dev/sda /dev/sda and here was the result: Guessed primary partition table: Primary partition(1) type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX) size: 0mb #s(1) s(2861671176-2861671176) chs: (1023/254/63)-(1023/254/63)d (178130/202/1)-(178130/202/1)r Primary partition(2) type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX) size: 0mb #s(1) s(3484550160-3484550160) chs: (1023/254/63)-(1023/254/63)d (216903/55/1)-(216903/55/1)r Primary partition(3) type: 000(0x00)(unused) size: 0mb #s(0) s(0-0) chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r Primary partition(4) type: 000(0x00)(unused) size: 0mb #s(0) s(0-0) chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r Not sure it found what I wanted. suggestions?

    Read the article

  • Adsense ads are not a good fit for my site

    - by Ryan Grush
    I run an academic network for college students to communicate at particular universities and we run Google Adsense. The site pulls in a decent amount for a side project but our CTR is horrible <0.2% and our RPM is equally low. The problem lies in the fact that Google pegs us as an education site (which we are) but shows our users ads for U of Phoenix, Devry U and other for-profit universities. All of our users are students of the more higher-caliber institutions and therefore have no use for these ads. I've known about this problem for some time but I don't know what to do to show more relevant ads instead (i.e. Spring Break, school apparel, poker, sports, etc). What would be the best way to change this?

    Read the article

  • OutOfBounds Exception when creating a PolygonShape using jbox2d

    - by B3nGr33ni3r
    So here's the deal, i'm parsing a file that contains the vertices for a polygon, that i want to create in box2d. I create a new PolygonShape() and then call .set() giving it a defined array of Vec, and that defined array's .length property. I expected this to work, since the documentation for jbox2d says this method takes a Vec array, and the count of Vec objects in that array. However, it errors out, and it seems to be unrelated to my code. The error i get is Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8 at org.jbox2d.collision.shapes.PolygonShape.set(PolygonShape.java:174) and, upon looking at that line in the jbox2d svn repository, i still cannot figure out the issue. Any help is appreciated!

    Read the article

  • Geometry Shader: distortions

    - by Christophe Lionet
    This is a cross-question from Stack Overflow, I thought it would be more appropriate here. There is a lot of code I could be posting. To avoid overloading the page with code, I will post any part of the code if requested. I am working from the ParticleGS DirectX10 sample, to build a geometry shader based particle system in DirectX 11. Using the sample code, and changing it to my liking, I am able to draw a single quad (which is essentially one particle constantly recreating itself). However, I noticed a problem which was similar to one I once had: the rendered shape is distorted. Here is a video showcasing what is happening. http://youtu.be/6NY_hxjMfwY Now, I used to have this issue when using several effects together, when I realised that I needed to explicitely set the geometry shader to null for the other effects. I solved this problem, as you can see in the video, as the rest of the scene is drawing properly. Note that some sides are being culled somehow, although I turned off culling in my main render state. The texturing is fine too, the texture draws with appropriate proportions relative to the quad. I really don't see what I could be doing wrong here... what would cause the geometry shader to behave in such a way? Again, I will post any piece code you will request.

    Read the article

  • How to achieve 'forward' movement (into the screen) using Cocos2D?

    - by lemikegao
    I'm interested in creating a 2.5D first-person shooter (like Doom) and I currently don't understand how to implement the player moving forward. The player will also be able to browse around the world (left, right, up, down) via gyroscope control. I plan to only use 2D sprites and no 3D models. My first attempt was to increase the scale of layers to make it appear as if the player was moving toward the objects but I'm not sure how to make it seem as if the player is passing around the objects (instead of running into them). If there are extensions that I should take a look at (like Cocos3D), please let me know. Thanks for the help! Note: I've only created 2D games so was hoping to get guided into the right direction

    Read the article

  • Difficulties with rotation of a sprite

    - by Andy
    I want to program a dolphin that jumps and rotates like a real dolphin. Jumping is not the problem, but I don't know how to make the rotation. My dolphin always rests in the same angle while it jumps. But I want that it changes the rotation during the jump, like a real dolphin does. How can I improve the rotation? public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Texture2D image, water; float Gravity = 5.0F; float Acceleration = 20.0F; Vector2 Position = new Vector2(1200,720); Vector2 Velocity; float rotation = 0; SpriteEffects flip; Vector2 Speed = new Vector2(0, 0); public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; } protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); image = Content.Load<Texture2D>("cartoondolphin"); water = Content.Load<Texture2D>("background"); flip = SpriteEffects.None; } protected override void Update(GameTime gameTime) { float VelocityX = 0f; float VelocityY = 0f; float time = (float)gameTime.ElapsedGameTime.TotalSeconds; KeyboardState kbState = Keyboard.GetState(); if(kbState.IsKeyDown(Keys.Left)) { rotation = 0; flip = SpriteEffects.None; VelocityX += -5f; } if(kbState.IsKeyDown(Keys.Right)) { rotation = 0; flip = SpriteEffects.FlipHorizontally; VelocityX += 5f; } // jump if the dolphin is under water if(Position.Y >= 670) { if (kbState.IsKeyDown(Keys.A)) { if (flip == SpriteEffects.None) { rotation = 45; VelocityY += 40f; } else { rotation = -45; VelocityY += 40f; } } } else { VelocityY += -10f; } float deltaY = 0; float deltaX = 0; deltaY = Gravity * (float)gameTime.ElapsedGameTime.TotalSeconds; deltaX += VelocityX * (float)gameTime.ElapsedGameTime.TotalSeconds * Acceleration; deltaY += -VelocityY * (float)gameTime.ElapsedGameTime.TotalSeconds * Acceleration; Speed = new Vector2(Speed.X + deltaX, Speed.Y + deltaY); Position += Speed * (float)gameTime.ElapsedGameTime.TotalSeconds; Velocity.X = 0; if (Position.Y + image.Height/2 > graphics.PreferredBackBufferHeight) Position.Y = graphics.PreferredBackBufferHeight - image.Height/2; base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); spriteBatch.Draw(water, new Rectangle(0, graphics.PreferredBackBufferHeight -100, graphics.PreferredBackBufferWidth, 100), Color.White); spriteBatch.Draw(image, Position, null, Color.White, MathHelper.ToRadians(rotation), new Vector2(image.Width / 2, image.Height / 2), 1, flip, 1); spriteBatch.End(); base.Draw(gameTime); } }

    Read the article

  • global variables doesn't change value in Javascript

    - by user1856906
    My project is composed by 2 html pages: 1)index.html, wich contains the login and the registration form. 2)user_logged.html, wich contains all the features of a logged user. Now, what I want to do is a control if the user is really logged, to avoid the case where a user paste a url in the browser and can see the pages of another user. hours as now, if a user paste this url in the browser: www.user_loggato.html?user=x#profile is as if logged in as user x and this is not nice. My html pages both use js files that contains scripts. I decided to create a global variable called logged inizialized to false and change the variable to true when the login is succesfull. The problem is that the variable, remains false. here is the code: var logged=false; (write in the file a.js) while in the file b.js I have: function login() { //if succesfull logged=true; window.location.href = "user_loggato.html?user="+ JSON.parse(str).username + #profilo"; Now with some alerts I found that my variable logged is always false. Why? if I have not explained well or if there is not some information in order to respond to my question let me know.

    Read the article

  • Interface name as a Type

    - by user1889148
    I am trying to understand interfaces in Java and have this task to do which I am a stack with. It must be something easy, but I don't seem to see the solution. Interface contains a few methods, one of them should return true if all elements of this set are also in the set. I.e. public interface ISet{ //some methods boolean isSubsetOf(ISet x); } Then the class: public class myClass implements ISet{ ArrayList<Integer> mySet; public myClass{ mySet = new ArrayList<Integer>(); } //some methods public boolean isSubsetOf(ISet x){ //method body } } What do I need to write in method body? How do I check that the instance of myClass is a subset of ISet collection? I was trying to cast, but it gives an error: ArrayList<Integer> param = (ArrayList<Integer>)x; return param.containsAll(mySet);

    Read the article

  • Cocos 2D v1.0.1 : Crash at changing CCMenuItemImage normal image

    - by Max
    I retrieve a crash log file, which, after XCode analysis on my archive show the problematic line of code : Date/Time: 2012-12-08 23:48:08.930 +0100 OS Version: iPhone OS 5.1.1 (9B206) Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000 Crashed Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x31a4088f __exceptionPreprocess + 163 1 libobjc.A.dylib 0x3188b259 objc_exception_throw + 33 2 CoreFoundation 0x31a40789 +[NSException raise:format:] + 1 3 Foundation 0x374c73a3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 91 4 Killer 0x0017ed35 -[CCSprite initWithFile:] (CCSprite.m:201) 5 Killer 0x0017e419 +[CCSprite spriteWithFile:] (CCSprite.m:93) 6 Killer 0x00123101 -[Player makeZombie] (Player.m:1363) 7 Killer 0x00105a51 -[PlayScene endOfKilling:] (PlayScene.m:1438) Which clearly indicates the second of the two following lines is crashing: NSLog(@"images %@ %@",self.zombieImage,self.zombieImageDown); [self.characterSprite setNormalImage:[CCSprite spriteWithFile:self.zombieImage]]; I know that the crash seem to happend when the user is touching the corresponding CCMeanuItemImage, is there a problem if the user is touching it, while we change the normal et selected images of it ? Is this the right manner to change its image (i do it several times during the game) ? Thanks for your ideas

    Read the article

  • Timer not beginning from 00:00

    - by studentProgrammer
    I have a Game in which there is a timer involved. For each two minutes that passes a new round between different players begins. So, I have a text box starting from 00:00 and changes each second until it is equal to 02:00. Now, I want to save the state of the game in the middle of a round if the user closes the form. What I need to do is that upon loading, the textbox starts at the time that the user left the game the last time and continue up till 02:00 normally. How can I do this? This is what I have until now where Tournament is the Form public Tournament() { _timer = new System.Windows.Forms.Timer(); _timer.Interval = 1000; _timer.Tick += Timer_Tick; _myDateTime = DateTime.Now; newDate = new DateTime(); newDate = newDate.AddMinutes(2.00); _timer.Start(); InitializeComponent(); } void Timer_Tick(object sender, EventArgs e) { var diff = DateTime.Now.Subtract(_myDateTime); this.textBox1.Text = diff.ToString(@"mm\:ss"); DateTime dt = Convert.ToDateTime(diff.ToString()); if (newDate.Minute == dt.Minute) { _timer.Stop(); _myDateTime = DateTime.Now; displayPointsOrResults(); this.textBox1.Text = diff.ToString(@"mm\:ss"); } } In my LoadGame method: where timePassed is what I have written in the text box string[] splitted6 = timePassed.Split(':'); if (splitted6[0] == "00") { int remainingTime = 120 - Convert.ToInt32(splitted6[1]); DateTime time = DateTime.Now.Date; time = time.AddMinutes(remainingTime); _myDateTime = time; } else { int leftTime = Convert.ToInt32(splitted[0].Trim('0') + splitted[1]); int remainingTime = 120 - leftTime; DateTime time = DateTime.Now.Date; time = time.AddMinutes(remainingTime); _myDateTime = time; }

    Read the article

  • Failed to sum splited text

    - by user1784753
    I have a problem when summing all of bx3.text to t2.text. first I split bx3.text with space private void total() { string[] ps = bx3.Text.Split(new string[] {" "}, StringSplitOptions.None ); t2.Text = ps.Select(x => Convert.ToInt32(x)).Sum().ToString(); } I did try with t2.text = ps[1] and the number showed was correct. but when i try to sum it all, I got error "Input string was not in a correct format" on (x = Convert.ToInt32(x)) bx3.text is full of user-input number separated by single space " "

    Read the article

  • Has anyone used ever Mangoslick from themeforest?

    - by bonesnatch
    I was assigned to integrate MangoSlick theme to our current admin panel, Its a jQuery, Slick(?) and Responsive template. First, let me explain how the API goes In the documentation, it only says this is the only way data-[options]=[value] Example: If I wanna make a progress bar I can use this format <div class="progress"> <div class="bar" data-title="[title]" data-value="[value]" data-max="[max]" data-format="[format string]"></div> </div> so filling-in values <div class="progress"> <div class="bar" data-title="Space" data-value="1285" data-max="5120" data-format="0,0 MB"></div> </div> I will have this as output Now, the main question is when I use jQuery attr() to change the attribute values for data-title, data-max, data-value and data-format. Why is it not working? <script> var jq = $.noConflict(); jq(document).ready(function(){ jq('#bokz').attr("data-title", "No Space"); }); </script> Using the script above and inspect element in chrome the values are changed but not in the progressbar Some of you may have some ideas on this? Any help/suggestion would be very much appreciated.

    Read the article

  • How To Run Postgres locally

    - by Rohit Rayudu
    I read the Postgres docs for Flask and they said that to run Postgres you should have the following code app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = postgresql://localhost/[YOUR_DB_NAME]' db = SQLAlchemy(app) How do I know my database name? I wrote db as the name - but I got an error sqlalchemy.exc.OperationalError: (OperationalError) FATAL: database "[db]" does not exist Running Heroku with Flask if that helps

    Read the article

  • How to get Netty websocket client example working

    - by Paul Butcher
    I'm struggling to get the netty example websocket client working. I've compiled successfully with 4.0.0.Alpha8, but when I try to connect to a server (also a netty example) I get: Exception in thread "main" io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response upgrade: websocket at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13.finishHandshake(WebSocketClientHandshaker13.java:204) which makes no sense to me whatsoever, given that this piece of code reads: String upgrade = response.getHeader(Names.UPGRADE); if (!Values.WEBSOCKET.equalsIgnoreCase(upgrade)) { throw new WebSocketHandshakeException("Invalid handshake response upgrade: " + response.getHeader(Names.UPGRADE)); } And as the message in the exception demonstrates, the Upgrade header does contain websocket as expected. Any idea what's going on?

    Read the article

  • Apache Mod Rewrite with Periods in URL

    - by Ben Althauser
    Ok, so I am using (or trying to use) two primary mod_rewrite rules, and they seem to be conflicting with one another RewriteRule ^/?help$ index.php?page=help [L] and RewriteRule ^/?([a-zA-Z0-9._-]+)$ index.php?user=$1 [L] If I get rid of the period -. in the second rule, my help page is displayed, and I can display a user page as well, but when I add the period, my help page doesn't display, but instead (I think) gets processed as a user page. Anyone have any pointers?

    Read the article

  • VS2012 - Sync project properties and ClickOnce Build number

    - by Horst Walter
    There is a build / version number automatically increasing with Publish for ClickOnce applications. This version number is different from the assembly version in the project properties (which in turn is automatically displayed in a generated WPF about box). Is there a way to sync the ClickOnce version number and the project number in the assembly properties? Goal is to get an automatically increasing and identical version number for both places.

    Read the article

  • Using DCMTK in iOS application

    - by BlackFlam3
    I want to use DCMTK in my application and have successfully compiled DCMTK 3.6.0 for the iOS Simulator. Then I created a workspace into which I added the DCMTK project and my application. I added the .a files as target dependencies and linked the binaries. I think I am missing the part where I have to set the header/library search paths. I try to include a header file say #include "dcm2xml.h" and it says file not found. What am I doing wrong? I have seen this. - how to use dcmtk in iphone project But I think there's a simpler way without using that framework.

    Read the article

  • Error in Getting Youtube Video Title, Description and thumbnail

    - by Muhammad Ayyaz Zafar
    I was getting youtube title and youtube description form the same code but now its not working I am getting following error: Warning: DOMDocument::load() [domdocument.load]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/colorsfo/public_html/zaroorat/admin/pages/addSongProcess.php on line 16 Warning: DOMDocument::load(http://gdata.youtube.com/feeds/api/videos/Y7G-tYRzwYY) [domdocument.load]: failed to open stream: no suitable wrapper could be found in /home/colorsfo/public_html/zaroorat/admin/pages/addSongProcess.php on line 16 Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/videos/Y7G-tYRzwYY" in /home/colorsfo/public_html/zaroorat/admin/pages/addSongProcess.php on line 16 .................................... Following Coding is used to get Youtube Video Data: $url = "http://gdata.youtube.com/feeds/api/videos/".$embedCodeParts2[0]; $doc = new DOMDocument; @$doc->load($url); $title = $doc->getElementsByTagName("title")->item(0)->nodeValue; $videoDescription = $doc->getElementsByTagName("description")->item(0)->nodeValue; It was working before (This coding is working fine in Local server but on internet its not working) but now its not working. Please guide me how to fix this error. Thanks for your time.

    Read the article

  • Make JQuery UI Dialog automatically grow HEIGHT to fit its contents (width remains static)

    - by Zack Macomber
    Having looked into How can I make a JQuery UI Dialog automatically grow or shrink to fit its contents?, I am using the height: "auto" option when building a jQuery modal dialog box: $( "#dialog-message" ).dialog({ autoOpen: false, width: "400", height: "auto", show: "slide", modal: true, buttons: { Ok: function() { $( this ).dialog( "close" ); } } }); However, the height isn't "growing" to fit all of the contents. I'm still seeing a vertical scrollbar as in this image: Is there a way right in the definition code I listed to ensure that the height grows enough so that a vertical scrollbar doesn't show? Or, do I need to do this programmatically before opening the dialog box? Edit 1 Not sure why, but Chrome is displaying this fine but IE 8 isn't. I need it to specifically work in IE 8 so I believe I'm just going to put a bottom margin on the text.

    Read the article

  • Writing Unit Tests for an ASP.NET MVC Action Method that handles Ajax Request and Normal Request

    - by shiju
    In this blog post, I will demonstrate how to write unit tests for an ASP.NET MVC action method, which handles both Ajax request and normal HTTP Request. I will write a unit test for specifying the behavior of an Ajax request and will write another unit test for specifying the behavior of a normal HTTP request. Both Ajax request and normal request will be handled by a single action method. So the ASP.NET MVC action method will be execute HTTP Request object’s IsAjaxRequest method for identifying whether it is an Ajax request or not. So we have to create mock object for Request object and also have to make as a Ajax request from the unit test for verifying the behavior of an Ajax request. I have used NUnit and Moq for writing unit tests. Let me write a unit test for a Ajax request Code Snippet [Test] public void Index_AjaxRequest_Returns_Partial_With_Expense_List() {     // Arrange       Mock<HttpRequestBase> request = new Mock<HttpRequestBase>();     Mock<HttpResponseBase> response = new Mock<HttpResponseBase>();     Mock<HttpContextBase> context = new Mock<HttpContextBase>();       context.Setup(c => c.Request).Returns(request.Object);     context.Setup(c => c.Response).Returns(response.Object);     //Add XMLHttpRequest request header     request.Setup(req => req["X-Requested-With"]).         Returns("XMLHttpRequest");       IEnumerable<Expense> fakeExpenses = GetMockExpenses();     expenseRepository.Setup(x => x.GetMany(It.         IsAny<Expression<Func<Expense, bool>>>())).         Returns(fakeExpenses);     ExpenseController controller = new ExpenseController(         commandBus.Object, categoryRepository.Object,         expenseRepository.Object);     controller.ControllerContext = new ControllerContext(         context.Object, new RouteData(), controller);     // Act     var result = controller.Index(null, null) as PartialViewResult;     // Assert     Assert.AreEqual("_ExpenseList", result.ViewName);     Assert.IsNotNull(result, "View Result is null");     Assert.IsInstanceOf(typeof(IEnumerable<Expense>),             result.ViewData.Model, "Wrong View Model");     var expenses = result.ViewData.Model as IEnumerable<Expense>;     Assert.AreEqual(3, expenses.Count(),         "Got wrong number of Categories");         }   In the above unit test, we are calling Index action method of a controller named ExpenseController, which will returns a PartialView named _ExpenseList, if it is an Ajax request. We have created mock object for HTTPContextBase and setup XMLHttpRequest request header for Request object’s X-Requested-With for making it as a Ajax request. We have specified the ControllerContext property of the controller with mocked object HTTPContextBase. Code Snippet controller.ControllerContext = new ControllerContext(         context.Object, new RouteData(), controller); Let me write a unit test for a normal HTTP method Code Snippet [Test] public void Index_NormalRequest_Returns_Index_With_Expense_List() {     // Arrange               Mock<HttpRequestBase> request = new Mock<HttpRequestBase>();     Mock<HttpResponseBase> response = new Mock<HttpResponseBase>();     Mock<HttpContextBase> context = new Mock<HttpContextBase>();       context.Setup(c => c.Request).Returns(request.Object);     context.Setup(c => c.Response).Returns(response.Object);       IEnumerable<Expense> fakeExpenses = GetMockExpenses();       expenseRepository.Setup(x => x.GetMany(It.         IsAny<Expression<Func<Expense, bool>>>())).         Returns(fakeExpenses);     ExpenseController controller = new ExpenseController(         commandBus.Object, categoryRepository.Object,         expenseRepository.Object);     controller.ControllerContext = new ControllerContext(         context.Object, new RouteData(), controller);     // Act     var result = controller.Index(null, null) as ViewResult;     // Assert     Assert.AreEqual("Index", result.ViewName);     Assert.IsNotNull(result, "View Result is null");     Assert.IsInstanceOf(typeof(IEnumerable<Expense>),             result.ViewData.Model, "Wrong View Model");     var expenses = result.ViewData.Model         as IEnumerable<Expense>;     Assert.AreEqual(3, expenses.Count(),         "Got wrong number of Categories"); }   In the above unit test, we are not specifying the XMLHttpRequest request header for Request object’s X-Requested-With, so that it will be normal HTTP Request. If this is a normal request, the action method will return a ViewResult with a view template named Index. The below is the implementation of Index action method Code Snippet public ActionResult Index(DateTime? startDate, DateTime? endDate) {     //If date is not passed, take current month's first and last date     DateTime dtNow;     dtNow = DateTime.Today;     if (!startDate.HasValue)     {         startDate = new DateTime(dtNow.Year, dtNow.Month, 1);         endDate = startDate.Value.AddMonths(1).AddDays(-1);     }     //take last date of start date's month, if end date is not passed     if (startDate.HasValue && !endDate.HasValue)     {         endDate = (new DateTime(startDate.Value.Year,             startDate.Value.Month, 1)).AddMonths(1).AddDays(-1);     }     var expenses = expenseRepository.GetMany(         exp => exp.Date >= startDate && exp.Date <= endDate);     //if request is Ajax will return partial view     if (Request.IsAjaxRequest())     {         return PartialView("_ExpenseList", expenses);     }     //set start date and end date to ViewBag dictionary     ViewBag.StartDate = startDate.Value.ToShortDateString();     ViewBag.EndDate = endDate.Value.ToShortDateString();     //if request is not ajax     return View("Index",expenses); }   The index action method will returns a PartialView named _ExpenseList, if it is an Ajax request and will returns a View named Index if it is a normal request. Source Code The source code has been taken from my EFMVC app which can download from here

    Read the article

  • Handle complexity in large software projects

    - by Oliver Vogel
    I am a lead developer in a larger software projects. From time to time its getting hard to handle the complexity within this project. E. g. Have the whole big picture in mind all the time Keeping track of the teammates work results Doing Code Reviews Supply management with information etc. Are there best practices/ time management techniques to handle these tasks? Are there any tools to support you having an overview?

    Read the article

  • How are you keeping abreast with latest HPC trends?

    - by Fanatic23
    For those of you primarily working on high performance computing for non-scientific purposes (as in no fortran) what are the ways by which you keep yourself abreast of the latest trends out there? Industry gossip? Random blogs from google? Search SO? I am into HPC recently and looking for the high level architectural landscape. Given that everyone from GPGPU coders to FPGA folks to Erlang developers claim they are into HPC, how are you keeping up with so much information?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >