Search Results

Search found 5180 results on 208 pages for 'outside'.

Page 103/208 | < Previous Page | 99 100 101 102 103 104 105 106 107 108 109 110  | Next Page >

  • How to define implementation details?

    - by woni
    In our project, an assembly combines logic for the IoC-Container, the project internals and the communication layer. The current version evolved to have only internal classes in addin assemblies. My main problem with this approach is, that the entry point is only available over the IoC-Container. It is not possible to use anything else than reflection to initialize the assembly. Everything behind the IoC-Interface is defined as implementation detail and therefore not intended for usages outside. It is well known that you should not test implementation detail (such as private and internal methods), because they should be tested through the public interface. It is also well known, that your tests should not use the IoC-Container to setup the SUTs, because that would result in too much dependencies. So we are using the InternalsVisibleTo-Attribute to make internals visible to our test assemblies and test the so called implementation details. I recognized that one problem could be the mixup between different concerns in that assembly, changing this would make this discussion useless, because classes have to be defined public. Ignoring my concerns with this, isn't the need to test a class enough reason to make it public, the usages of InternalsVisibleTo seems unintended, and a little bit "hacky". The approach to test only against the publicly available IoC-Container is too costly and would result in integration style tests. The pros of using internals are, that the usages are well known and do not have to be implemented like a public method would have to be (documentation, completeness, versioning,...). Is there a solution, to not test against internals, but keep their advantages over public classes, or do we have to redefine what an implementation detail is.

    Read the article

  • Rendering design. How can I effectively deal with forward, deferred and transparent rendering?

    - by user1423893
    I have many objects in my game world that all derive from one base class. Each object will have different materials and will therefore be required to be drawn using various rendering techniques. I currently use the following order for rendering my objects. Deferred Forward Transparent (order independent) Each object has a rendering flag that denotes which one of the above methods should be used. The list of base objects in the scene are then iterated through and added to separate lists of deferred, forward or transparent objects based on their rendering flag value. The individual lists are then iterated through and drawn using the order above. Each list is cleared at the end of the frame. This methods works fairly well but it requires different draw methods for each material type. For example each object will require the following methods in order to be compatible with the possible flag settings. object.DrawDeferred() object.DrawForward() object.DrawTransparent() It is also hard to see where methods outside of materials, such as rendering shadow maps, would fit using this "flag & method" design. object.DrawShadow() I was hoping that someone may have some suggestions for improving this rendering process, possibly making it more generic and less verbose?

    Read the article

  • Restrict movement within a radius

    - by Phil
    I asked a similar question recently but now I think I know more about what I really want to know. I can answer my own question if I get to understand this bit. I have a situation where a sprite's center point needs to be constrained within a certain boundary in 2d space. The boundary is circular so the sprite is constrained within a radius. This radius is defined as a distance from the center of a certain point. I know the position of the center point and I can track the center position of the sprite. This is the code to detect the distance: float distance = Vector2.Distance(centerPosition, spritePosition)); if (distance > allowedDistance) { } The positions can be wherever on the grid, they are not described as in between -1 or 1. So basically the detecting code works, it only prints when the sprite is outside of it's boundary I just don't know what to do when it oversteps. Please explain any math used as I really want to understand what you're thinking to be able to elaborate on it myself.

    Read the article

  • What guidelines should be followed when implementing third-party tracking pixels?

    - by Strozykowski
    Background I work on a website that gets a fair amount of traffic, and as such, we have implemented different tracking pixels and techniques across the site for various specific reasons. Because there are many agencies who are sending traffic our way through email campaigns, print ads and SEM, we have agreements with a variety of different outside agencies for tracking these page hits. Consequently, we have tracking pixels which span the entire site, as well as some that are on specific pages only. We have worked to reduce the total number of pixels available on any one page, but occasionally the site is rendered close to unusable when one of these third-party tracking pixels fails to load. This is a huge difficulty on parts of the site where Javascript is needed for functionality built into the page, but is unable to initialize until a 404 is returned on the external tracking pixel. (Sometimes up to 30 seconds later) I have spent some time attempting to research how other firms deal with this sort of instability with third-party components, but have come up a bit short. The plan currently is to implement our own stop-gap method to deal with these external outages, but rather than reinventing the wheel, we wanted to find out how this is dealt with on other sites. Question Is there a good set of guidelines that should be followed when implementing third-party tracking pixels? I would love to see some white papers or other written documents about how other people have dealt with this issue.

    Read the article

  • I don't understand how TDD helps me get a good design if I need a design to start testing it

    - by Michael Stum
    I'm trying to wrap my head around TDD, specifically the development part. I've looked at some books, but the ones I found mainly tackle the testing part - the History of NUnit, why testing is good, Red/Green/Refactor and how to create a String Calculator. Good stuff, but that's "just" Unit Testing, not TDD. Specifically, I don't understand how TDD helps me get a good design if I need a Design to start testing it. To illustrate, imagine these 3 requirements: A catalog needs to have a list of products The catalog should remember which products a user viewed Users should be able to search for a product At this points, many books pull a magic rabbit out of a hat and just dive into "Testing the ProductService", but they don't explain how they came to the conclusion that there is a ProductService in the first place. That is the "Development" part in TDD that I'm trying to understand. There needs to be an existing design, but stuff outside of entity-services (that is: There is a Product, so there should be a ProductService) is nowhere to be found (e.g., the second requirement requires me to have some concept of a User, but where would I put the functionality to remind? And is Search a feature of the ProductService or a separate SearchService? How would I know which I should choose?) According to SOLID, I would need a UserService, but if I design a system without TDD, I might end up with a whole bunch of Single-Method Services. Isn't TDD intended to make me discover my design in the first place? I'm a .net developer, but Java resources would also work. I feel that there doesn't seem to be a real sample application or book that deals with a real line of business application. Can someone provide a clear example that illustrates the process of creating a design using TDD?

    Read the article

  • Interfaces on an abstract class

    - by insta
    My coworker and I have different opinions on the relationship between base classes and interfaces. I'm of the belief that a class should not implement an interface unless that class can be used when an implementation of the interface is required. In other words, I like to see code like this: interface IFooWorker { void Work(); } abstract class BaseWorker { ... base class behaviors ... public abstract void Work() { } protected string CleanData(string data) { ... } } class DbWorker : BaseWorker, IFooWorker { public void Work() { Repository.AddCleanData(base.CleanData(UI.GetDirtyData())); } } The DbWorker is what gets the IFooWorker interface, because it is an instantiatable implementation of the interface. It completely fulfills the contract. My coworker prefers the nearly identical: interface IFooWorker { void Work(); } abstract class BaseWorker : IFooWorker { ... base class behaviors ... public abstract void Work() { } protected string CleanData(string data) { ... } } class DbWorker : BaseWorker { public void Work() { Repository.AddCleanData(base.CleanData(UI.GetDirtyData())); } } Where the base class gets the interface, and by virtue of this all inheritors of the base class are of that interface as well. This bugs me but I can't come up with concrete reasons why, outside of "the base class cannot stand on its own as an implementation of the interface". What are the pros & cons of his method vs. mine, and why should one be used over another?

    Read the article

  • Guidelines for creating referentially transparent callables

    - by max
    In some cases, I want to use referentially transparent callables while coding in Python. My goals are to help with handling concurrency, memoization, unit testing, and verification of code correctness. I want to write down clear rules for myself and other developers to follow that would ensure referential transparency. I don't mind that Python won't enforce any rules - we trust ourselves to follow them. Note that we never modify functions or methods in place (i.e., by hacking into the bytecode). Would the following make sense? A callable object c of class C will be referentially transparent if: Whenever the returned value of c(...) depends on any instance attributes, global variables, or disk files, such attributes, variables, and files must not change for the duration of the program execution; the only exception is that instance attributes may be changed during instance initialization. When c(...) is executed, no modifications to the program state occur that may affect the behavior of any object accessed through its "public interface" (as defined by us). If we don't put any restrictions on what "public interface" includes, then rule #2 becomes: When c(...) is executed, no objects are modified that are visible outside the scope of c.__call__. Note: I unsuccessfully tried to ask this question on SO, but I'm hoping it's more appropriate to this site.

    Read the article

  • How to make NFS mounts available while offline?

    - by lpanebr
    Problem: I work on a notebook and while at work I have access to many NFS mounted drives. When I get home they are obviously not available. Windows 7 solution: My business partner uses Windows 7 and maps the folders via samba. Windows 7 has a very nice feature that let's he make these folders available offline. So when when he connects to the work network the changes get synchronized! Question: Is there a way to mimic that in ubuntu? What I have now: Server to local sync: I have added rsync entries on my crontab to copy server folders => local folders every five minutes. When at work I used the NFS mapped folders and while outside work I use the local copies. When I get at work I manually run a script that syncs local folders => server folders. Problems with my setup: slow startup when not at work (I guess do to the fstab trying to map the server folders) no conflict checking/managing I have to remember to sync manually and be careful because of the different file locations recent files do not work between work and home

    Read the article

  • Can I make a business in teaching home users Ubuntu [on hold]

    - by Dorgaldir
    I was thinking about a way to bring Ubuntu to the bigger public, since it has great advantages for people in the lower income class that only use a PC for basic usage. They pay for a windows licence without actually needing windows because 95% of what they do is in a browser and the other 5% is typing a word document or making a simpel Excel sheet. So for these people something like Ubuntu is ideal, they can prolong the life of their old PC or laptop with Ubuntu and thus saving extra money. And as we all know, saving money is not only interesting for the lowest of income but for most of us. But when I talk to people they don't want to use Ubuntu because they know Windows and they don't know this, they'll complain about having to adapt to windows 8 but adapting to Ubuntu seems a bridge too far. But what if someone in the neighborhood gave simple Ubuntu courses. Teaching people about Ubuntu, stuff like: What is an OS What is Ubuntu How do I obtain Ubuntu How do I install Ubuntu How do I set up my email in Ubuntu How do I make a text document in Ubuntu How do I update my facebook wall in Ubuntu ... Simple basic PC usage, but within Ubuntu. But as much as I would like to work for free all day, I can't do this for free for people outside of my social circle. So I was wondering if it is possible to make a business and make money with giving Ubuntu courses, or are their steps to be taken before this is possible. However... Do I need an Ubuntu or Canonical license? Do I need to get a certificate? Do I have to make some kind of deal or contract with Canonical? Just to be clear this is all just an idea in my head at this point, I'm just gathering information. I'm not a teacher at a school, just a programmer that is thinking about options in life. Thanks in advance!

    Read the article

  • Fastest approach to 3D animation

    - by HappyFerret
    I'm currently tasked with designing a small HTML5 game. Having done everything by myself so far (3D models, codebase, game design, etc) I'm now at a point where I'm running out of time. I've less than a day to animate and bind everything together. However, that's exactly my problem. I was under the naive impression that everything would be easier if I went with pre-rendered 3D models. However, I didn't consider the most difficult part. Animation. After having spent over an hour trying to figure out messiahStudio, I figured it's time to ask for outside help. Is there any easier solution to 3D animation than 3D rigging? What I'm basically looking for is some sort of tool that allows me to simply grab and move/deform select polygons. It doesn't have to be as life-like and accurate as rigging, just efficient enough. Were the circumstances any different, I might just learn how to rig. But that's sorely out of scope right now. PS:The models were created in Sculptris but are fairly low-poly.

    Read the article

  • How do I cluster strings based on a relation between two strings?

    - by Tom Wijsman
    If you don't know WEKA, you can try a theoretical answer. I don't need literal code/examples... I have a huge data set of strings in which I want to cluster the strings to find the most related ones, these could as well be seen as duplicate. I already have a set of couples of string for which I know that they are duplicate to each other, so, now I want to do some data mining on those two sets. The result I'm looking for is a system that would return me the possible most relevant couples of strings for which we don't know yet that they are duplicates, I believe that I need clustering for this, which type? Note that I want to base myself on word occurrence comparison, not on interpretation or meaning. Here is an example of two string of which we know they are duplicate (in our vision on them): The weather is really cold and it is raining. It is raining and the weather is really cold. Now, the following strings also exist (most to least relevant, ignoring stop words): Is the weather really that cold today? Rainy days are awful. I see the sunshine outside. The software would return the following two strings as most relevant, which aren't known to be duplicate: The weather is really cold and it is raining. Is the weather really that cold today? Then, I would mark that as duplicate or not duplicate and it would present me with another couple. How do I go to implement this in the most efficient way that I can apply to a large data set?

    Read the article

  • How to choose between Tell don't Ask and Command Query Separation?

    - by Dakotah North
    The principle Tell Don't Ask says: you should endeavor to tell objects what you want them to do; do not ask them questions about their state, make a decision, and then tell them what to do. The problem is that, as the caller, you should not be making decisions based on the state of the called object that result in you then changing the state of the object. The logic you are implementing is probably the called object’s responsibility, not yours. For you to make decisions outside the object violates its encapsulation. A simple example of "Tell, don't Ask" is Widget w = ...; if (w.getParent() != null) { Panel parent = w.getParent(); parent.remove(w); } and the tell version is ... Widget w = ...; w.removeFromParent(); But what if I need to know the result from the removeFromParent method? My first reaction was just to change the removeFromParent to return a boolean denoting if the parent was removed or not. But then I came across Command Query Separation Pattern which says NOT to do this. It states that every method should either be a command that performs an action, or a query that returns data to the caller, but not both. In other words, asking a question should not change the answer. More formally, methods should return a value only if they are referentially transparent and hence possess no side effects. Are these two really at odds with each other and how do I choose between the two? Do I go with the Pragmatic Programmer or Bertrand Meyer on this?

    Read the article

  • JustCode Q1 SP1 &ndash;Typing Assistance Improvements

    Our goal is to make JustCodes typing assistance save keystrokes, without getting in your way. As such, typing assistance received quite a few changes for SP1.  It now works faster, and better than ever :)      Bracket Completion When you add an  open bracket at the beginning of a line, JustCode will now add the closing bracket for you at the end of the line, even if there is code. When you hit enter, the auto formatter will run.    Prevents Bracket Doubling The SP1 release now does its best to prevent you from doubling parenthesis, braces, and brackets. Instead of doubling up these items up, it will move your cursor outside the closing item.   Auto Format on Semi-Colon, and Close Bracket JustCode now automatically runs the auto formatter when you press semi-colon, or add a closing bracket at the end of a line.    Auto Completion of Singe & ...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • ubuntu 12.04 installer does not recognize drive partitions

    - by endless forms
    I recently purchased a new HP Pavilion HPE desktop running Windows 7. I am trying to install a dual-boot system with 12.04. However, when I run the LiveCD I only get as far as the "Install" window where you can select the partitions for your drives. On the bottom where it says "device for boot loader installation" I have "/dev/sda" and cannot select any other devices. All the options to change the drives are greyed out, most likely because there are no drives in the window. I partitioned my largest drive using the tools within Windows, then booted into the CD, but nothing shows up. I then used Gparted to change the new space from unallocated to an /ext2, and still nothing shows up. The installer does not recognize anything, but when I go into an Ubuntu session and use the disk utility manager I can see the partitions I made. Anything I do has to be done outside of the installer. I have no files on this new computer, so this is the perfect time to install a parallel OS. I would like avoid completely reinstalling Windows, however. I've been over the forums many times, but all the answers I've found have not worked for me. I also tried flagging the new, empty partition as boot, but that screwed Windows up. Also, the WUBI installer hits the same point and quits. I know that the disk itself is fine because I just made another dual boot system on a Gateway PC. This makes me think something within this computer is preventing the installer from "seeing" the drives. Any help would be much appreciated! Edit in response: The main part of the partitioning window shows no partitions, everything is blank. There is no way to add partitions, and all the buttons are useless. I've tried defragging my drive multiple times, and I also used the same disk to dual-boot another PC with no problems, so it's not the disk, it's definitely the computer.

    Read the article

  • Entry level engineer question regarding memory management

    - by Ealianis
    It has been a few months since I started my position as an entry level software developer. Now that I am past some learning curves (e.g. the language, jargon, syntax of VB and C#) I'm starting to focus on more esoteric topics, as to write better software. A simple question I presented to a fellow coworker was responded with "I'm focusing on the wrong things." While I respect this coworker I do disagree that this is a "wrong thing" to focus upon. Here was the code (in VB) and followed by the question. Note: The Function GenerateAlert() returns an integer. Dim alertID as Integer = GenerateAlert() _errorDictionary.Add(argErrorID, NewErrorInfo(Now(), alertID)) vs... _errorDictionary.Add(argErrorID, New ErrorInfo(Now(), GenerateAlert())) I originally wrote the latter and rewrote it with the "Dim alertID" so that someone else might find it easier to read. But here was my concern and question: Should one write this with the Dim AlertID, it would in fact take up more memory; finite but more, and should this method be called many times could it lead to an issue? How will .NET handle this object AlertID. Outside of .NET should one manually dispose of the object after use (near the end of the sub). I want to ensure I become a knowledgeable programmer that does not just rely upon garbage collection. Am I over thinking this? Am I focusing on the wrong things?

    Read the article

  • Release Notes for 3/2/2012

    Here are the notes for today’s release: Added a progress indicator when saving issues. Added support for viewing CodePlex RSS feeds in Chrome. Deployed several bug fixes: Fixed an issue where the back button on Internet Explorer was not working as intended when browsing code. Fixed an issue where long commit comments would push the source control info box outside of the boundaries of the page. Fixed an issue where Internet Explorer users were not able to widen the frame of the source code browser until a file was selected. Fixed an issue where opening a source code file directly from a URL in Internet Explorer would cause the source code tree to be collapsed. Fixed an issue where adding a code snippet with long lines of text to a discussion thread using Internet Explorer would needlessly display a vertical scrollbar, limiting the amount of code visible. Fixed an issue where tabbing through some links would render them invisible. We deprecated support for embedding PreEmptive analytics statistics on the project statistics page. If you’re interested in collecting and reporting your own statistics, PreEmptive’s RunTime Intelligence Endpoint Starter Kit offers a good starting point for capturing data. Have ideas on how to improve CodePlex? Visit our ideas page! Vote for your favorite ideas or submit a new one. Got Twitter? Follow us and keep apprised of the latest releases and service status at @codeplex.

    Read the article

  • How similiar should the environments of PreProd and Prod be?

    - by RoboShop
    I've just recently been on a project and during the release, we realized that it didn't work in Production. It works in all other environments but because we have a separate release team, and we cannot set up the servers and environments ourselves, we have no visibility of the configuration on them. We suspect that Prod has some user permissions in its account or IIS settings that are different, so we are working though it now. So I think this whole thing has been a learning experience for me and I don't want the same thing repeated again. I would like to ask, how different should these environments be? I always thought that PreProd should be an identical copy to the Prod environment using a copy of the same database, using a copy of the same user account, should be installed on the same servers etc. But how far should I take it? If the web site is externally facing, should PreProd be externally facing? What if the website has components that don't require a user account or password to navigate to? Is it still okay to expose it to the outside world?

    Read the article

  • curl blocked at TMG firewall

    - by jemtube100
    i using TMG (threat management gateway) firewall at my web server. when i try to use Curl from outside, this firewall was blocked the connection. what rule/setting that i need to create at TMG to allow it. the error state as below : Refresh page: Search for the page again by clicking the Refresh button. The timeout may have occurred due to Internet congestion. Check spelling: Check that you typed the Web page address correctly. The address may have been mistyped. Access from a link: If there is a link to the page you are looking for, try accessing the page from that link. </UL> <HR color=#c0c0c0 noShade> <P id=L_defaultr_11>Technical Information (for support personnel)</P> <UL> <LI id=L_defaultr_12>Error Code: 403 Forbidden. The server denied the specified Uniform Resource Locator (URL). Contact the server administrator. (12202)

    Read the article

  • JCP 2.9 and Transparency Call for Spec Leads 9 November

    - by heathervc
    JCP Spec Leads are invited to participate in an online meeting/call this Friday, 9 November, to hear a talk about the the 2.9 version of the Java Community Process (effective date of 13 November) and discuss the changes with representatives of the Program Management Office.  This call will be recorded and published with materials for those not able to attend.  Details of the call are included below.JCP 2.9 is presented in two documents:The JCP 2.9 document:http://www.jcp.org/en/procedures/jcp2and the EC Standing Rules document:http://www.jcp.org/en/procedures/ec_standing_rulesIn addition, we will be reviewing ways to collect community feedback on the transparency requirements for JCP 2.7 and above JSRs (JCP 2.8, JCP 2.9), detailed as part of the Spec Lead Guide.Call details:Topic: JCP 2.9 and Transparency Date: Friday, November 9, 2012 Time: 9:00 am, Pacific Standard Time (San Francisco, GMT-08:00) Meeting Number: 800 623 574 Meeting Password: 5282 ------------------------------------------------------- To start or join the online meeting ------------------------------------------------------- Go to https://jcp.webex.com/jcp/j.php?ED=188925347&UID=491098062&PW=NMDZiYTQzZmE1&RT=MiM0 ------------------------------------------------------- Audio conference information ------------------------------------------------------- Toll-Free Dial-In Number:     866 682-4770 International (Toll) Dial-In Number:     408 774-4073 Conference code 9454597 Security code 1020 Outside the US: global access numbers   https://www.intercallonline.com/portlets/scheduling/viewNumbers/listNumbersByCode.do?confCode=6279803

    Read the article

  • Strings are UTF-16&hellip;. There is an error in XML document (1, 1).

    - by Shawn Cicoria
    I had a situation today where an xml document had a directive indicating it was utf-8.  So, the code in question was reading in the “string” of that xml then attempting to de-serialize it using an Xsd generated type. What you end up with is an exception indicating that there’s an error in the Xml document at (1,1) or something to that effect. The fix is, run it through a memory stream – which reads the string, but at utf8 bytes – if you have things that fall outside of 8 bit chars, you’ll get an exception.   //Need to read it to bytes, to undo the fact that strings are UTF-16 all the time. //We want it to handle it as UTF8. byte[] bytes = Encoding.UTF8.GetBytes(_myXmlString); TargetType myInstance = null; using (MemoryStream memStream = new MemoryStream(bytes)) { XmlSerializer tokenSerializer = new XmlSerializer(typeof(TargetType)); myInstance = (TargetType)tokenSerializer.Deserialize(memStream); }   Writing is similar – also, adding the default namespace prevents the additional xmlns additions that aren’t necessary:   XmlWriterSettings settings = new XmlWriterSettings() { Encoding = Encoding.UTF8, Indent = true, NewLineOnAttributes = true, }; XmlSerializerNamespaces xmlnsEmpty = new XmlSerializerNamespaces(); xmlnsEmpty.Add("", "http://www.wow.thisworks.com/2010/05"); MemoryStream memStr = new MemoryStream(); using (XmlWriter writer = XmlTextWriter.Create(memStr, settings)) { XmlSerializer tokenSerializer = new XmlSerializer(typeof(TargetType)); tokenSerializer.Serialize(writer, theInstance, xmlnsEmpty); }

    Read the article

  • How do I apply an arcball (using quaternions) along with mouse events, to allow the user to look around the screen using the o3d webgl framework?

    - by Chris
    How do I apply an arcball (using quaternions) along with mouse events, to allow the user to look around the screen using the o3d webgl framework? This sample (http://code.google.com/p/o3d/source/browse/trunk/samples_webgl/o3d-webgl-samples/simpleviewer/simpleviewer.html?r=215) uses the arcball for rotating the transform of an "object", but rather than apply this to a transform, I would like to apply the rotation to the camera's target, to create a first person style ability to look around the scene, as if the camera is inside the centre of the arcball instead of rotating from the outside. The code that is used in this sample is var rotationQuat = g_aball.drag([e.x, e.y]); var rot_mat = g_quaternions.quaternionToRotation(rotationQuat); g_thisRot = g_math.matrix4.mul(g_lastRot, rot_mat); The code that I am using which doesn't work var rotationQuat = g_aball.drag([e.x, e.y]); var rot_mat = g_quaternions.quaternionToRotation(rotationQuat); g_thisRot = g_math.matrix4.mul(g_lastRot, rot_mat); var cameraRotationMatrix4 = g_math.matrix4.lookAt(g_eye, g_target, [g_up[0], g_up[1] * -1, g_up[2]]); var cameraRotation = g_math.matrix4.setUpper3x3(cameraRotationMatrix4,g_thisRot); g_target = g_math.addVector(cameraRotation, g_target); where am I going wrong? Thanks

    Read the article

  • Scale an image with unscalable parts

    - by Uko
    Brief description of problem: imagine having some vector picture(s) and text annotations on the sides outside of the picture(s). Now the task is to scale the whole composition while preserving the aspect ratio in order to fit some view-port. The tricky part is that the text is not scalable only the picture(s). The distance between text and the image is still relative to the whole image, but the text size is always a constant. Example: let's assume that our total composition is two times larger than a view-port. Then we can just scale it by 1/2. But because the text parts are a fixed font size, they will become larger than we expect and won't fit in the view-port. One option I can think of is an iterative process where we repeatedly scale our composition until the delta between it and the view-port satisfies some precision. But this algorithm is quite costly as it involves working with the graphics and the image may be composed of a lot of components which will lead to a lot of matrix computations. What's more, this solution seems to be hard to debug, extend, etc. Are there any other approaches to solving this scaling problem?

    Read the article

  • What do you consider standard job perks? [closed]

    - by reseter
    What does a company need to offer you (apart from a fat pay cheque) for you to work for them? I am aware of this question, which is from an employer's perspective. I am interested in your views as employees. To get the discussion started, here is a list off the top of my head (not in any particular order): High-end computer with a huge screen or two. The best software tool money can buy as per Joel's test). That isn't too much to ask given many of the best tools are free (think git). Flexibility is a bonus- if a particular platform/ piece of software is not absolutely required, I would like to pick my OS and IDE. A quality chair Quiet workspace. Open plan is fine as long as there are meeting rooms so that there is no constant chatter going on around me. Spacious workspace. I would rather have more than three inches between my mouse and the person next to me's keyboard. Food and drink at work. Many companies these days have fruit baskets, biscuits, etc available to their employees, some even offer free lunch. Education. If my employer wants my skills to stay up-to-date, they should at the very least understand I need time to learn. If they want to pay for my books and conference registration fees, I am more than happy to accept. Other options include organizing internal knowledge exchange days or inviting speakers from outside. Flexible hours/ option to work from home is a bonus

    Read the article

  • Enable wireless greyed out. Disabled by hard switch. Details inside

    - by ltlunatic
    Ok so the basic issue here is this: My wireless has not once enabled through many environments. Wubi install: Enable wireless greyed out Live cd: greyed out Partition alongside win7: greyed out. I installed all software updates, checked additional drivers, installed the latest driver for RTL8111/8168B. rfkill list shows phy0 and phy1. Phy0 has a hardblock on. everything else is unblocked. Now consider this also: I have both a wireless adapter inside my laptop and a wireless usb adapter outside. The internal adapter does not work, hence why I think hardblock is on even if the external slider in 'on'. I have tried commands such as rfkill unblock all as well as sudo rfkill unblock all. No wireless options in the BIOS. I have tried another laptop and desktop and they get wireless from the get go. Ubuntu on my laptop seems to see my belkin adapter as well as my internal (ralink) one. But trying to scan networks yields no results and says network is down always. Ubuntu version: 12.04 lts Ask me anything else you may need to help me, thanks.

    Read the article

  • How to simulate inner join on very large files in java (without running out of memory)

    - by Constantin
    I am trying to simulate SQL joins using java and very large text files (INNER, RIGHT OUTER and LEFT OUTER). The files have already been sorted using an external sort routine. The issue I have is I am trying to find the most efficient way to deal with the INNER join part of the algorithm. Right now I am using two Lists to store the lines that have the same key and iterate through the set of lines in the right file once for every line in the left file (provided the keys still match). In other words, the join key is not unique in each file so would need to account for the Cartesian product situations ... left_01, 1 left_02, 1 right_01, 1 right_02, 1 right_03, 1 left_01 joins to right_01 using key 1 left_01 joins to right_02 using key 1 left_01 joins to right_03 using key 1 left_02 joins to right_01 using key 1 left_02 joins to right_02 using key 1 left_02 joins to right_03 using key 1 My concern is one of memory. I will run out of memory if i use the approach below but still want the inner join part to work fairly quickly. What is the best approach to deal with the INNER join part keeping in mind that these files may potentially be huge public class Joiner { private void join(BufferedReader left, BufferedReader right, BufferedWriter output) throws Throwable { BufferedReader _left = left; BufferedReader _right = right; BufferedWriter _output = output; Record _leftRecord; Record _rightRecord; _leftRecord = read(_left); _rightRecord = read(_right); while( _leftRecord != null && _rightRecord != null ) { if( _leftRecord.getKey() < _rightRecord.getKey() ) { write(_output, _leftRecord, null); _leftRecord = read(_left); } else if( _leftRecord.getKey() > _rightRecord.getKey() ) { write(_output, null, _rightRecord); _rightRecord = read(_right); } else { List<Record> leftList = new ArrayList<Record>(); List<Record> rightList = new ArrayList<Record>(); _leftRecord = readRecords(leftList, _leftRecord, _left); _rightRecord = readRecords(rightList, _rightRecord, _right); for( Record equalKeyLeftRecord : leftList ){ for( Record equalKeyRightRecord : rightList ){ write(_output, equalKeyLeftRecord, equalKeyRightRecord); } } } } if( _leftRecord != null ) { write(_output, _leftRecord, null); _leftRecord = read(_left); while(_leftRecord != null) { write(_output, _leftRecord, null); _leftRecord = read(_left); } } else { if( _rightRecord != null ) { write(_output, null, _rightRecord); _rightRecord = read(_right); while(_rightRecord != null) { write(_output, null, _rightRecord); _rightRecord = read(_right); } } } _left.close(); _right.close(); _output.flush(); _output.close(); } private Record read(BufferedReader reader) throws Throwable { Record record = null; String data = reader.readLine(); if( data != null ) { record = new Record(data.split("\t")); } return record; } private Record readRecords(List<Record> list, Record record, BufferedReader reader) throws Throwable { int key = record.getKey(); list.add(record); record = read(reader); while( record != null && record.getKey() == key) { list.add(record); record = read(reader); } return record; } private void write(BufferedWriter writer, Record left, Record right) throws Throwable { String leftKey = (left == null ? "null" : Integer.toString(left.getKey())); String leftData = (left == null ? "null" : left.getData()); String rightKey = (right == null ? "null" : Integer.toString(right.getKey())); String rightData = (right == null ? "null" : right.getData()); writer.write("[" + leftKey + "][" + leftData + "][" + rightKey + "][" + rightData + "]\n"); } public static void main(String[] args) { try { BufferedReader leftReader = new BufferedReader(new FileReader("LEFT.DAT")); BufferedReader rightReader = new BufferedReader(new FileReader("RIGHT.DAT")); BufferedWriter output = new BufferedWriter(new FileWriter("OUTPUT.DAT")); Joiner joiner = new Joiner(); joiner.join(leftReader, rightReader, output); } catch (Throwable e) { e.printStackTrace(); } } } After applying the ideas from the proposed answer, I changed the loop to this private void join(RandomAccessFile left, RandomAccessFile right, BufferedWriter output) throws Throwable { long _pointer = 0; RandomAccessFile _left = left; RandomAccessFile _right = right; BufferedWriter _output = output; Record _leftRecord; Record _rightRecord; _leftRecord = read(_left); _rightRecord = read(_right); while( _leftRecord != null && _rightRecord != null ) { if( _leftRecord.getKey() < _rightRecord.getKey() ) { write(_output, _leftRecord, null); _leftRecord = read(_left); } else if( _leftRecord.getKey() > _rightRecord.getKey() ) { write(_output, null, _rightRecord); _pointer = _right.getFilePointer(); _rightRecord = read(_right); } else { long _tempPointer = 0; int key = _leftRecord.getKey(); while( _leftRecord != null && _leftRecord.getKey() == key ) { _right.seek(_pointer); _rightRecord = read(_right); while( _rightRecord != null && _rightRecord.getKey() == key ) { write(_output, _leftRecord, _rightRecord ); _tempPointer = _right.getFilePointer(); _rightRecord = read(_right); } _leftRecord = read(_left); } _pointer = _tempPointer; } } if( _leftRecord != null ) { write(_output, _leftRecord, null); _leftRecord = read(_left); while(_leftRecord != null) { write(_output, _leftRecord, null); _leftRecord = read(_left); } } else { if( _rightRecord != null ) { write(_output, null, _rightRecord); _rightRecord = read(_right); while(_rightRecord != null) { write(_output, null, _rightRecord); _rightRecord = read(_right); } } } _left.close(); _right.close(); _output.flush(); _output.close(); } UPDATE While this approach worked, it was terribly slow and so I have modified this to create files as buffers and this works very well. Here is the update ... private long getMaxBufferedLines(File file) throws Throwable { long freeBytes = Runtime.getRuntime().freeMemory() / 2; return (freeBytes / (file.length() / getLineCount(file))); } private void join(File left, File right, File output, JoinType joinType) throws Throwable { BufferedReader leftFile = new BufferedReader(new FileReader(left)); BufferedReader rightFile = new BufferedReader(new FileReader(right)); BufferedWriter outputFile = new BufferedWriter(new FileWriter(output)); long maxBufferedLines = getMaxBufferedLines(right); Record leftRecord; Record rightRecord; leftRecord = read(leftFile); rightRecord = read(rightFile); while( leftRecord != null && rightRecord != null ) { if( leftRecord.getKey().compareTo(rightRecord.getKey()) < 0) { if( joinType == JoinType.LeftOuterJoin || joinType == JoinType.LeftExclusiveJoin || joinType == JoinType.FullExclusiveJoin || joinType == JoinType.FullOuterJoin ) { write(outputFile, leftRecord, null); } leftRecord = read(leftFile); } else if( leftRecord.getKey().compareTo(rightRecord.getKey()) > 0 ) { if( joinType == JoinType.RightOuterJoin || joinType == JoinType.RightExclusiveJoin || joinType == JoinType.FullExclusiveJoin || joinType == JoinType.FullOuterJoin ) { write(outputFile, null, rightRecord); } rightRecord = read(rightFile); } else if( leftRecord.getKey().compareTo(rightRecord.getKey()) == 0 ) { String key = leftRecord.getKey(); List<File> rightRecordFileList = new ArrayList<File>(); List<Record> rightRecordList = new ArrayList<Record>(); rightRecordList.add(rightRecord); rightRecord = consume(key, rightFile, rightRecordList, rightRecordFileList, maxBufferedLines); while( leftRecord != null && leftRecord.getKey().compareTo(key) == 0 ) { processRightRecords(outputFile, leftRecord, rightRecordFileList, rightRecordList, joinType); leftRecord = read(leftFile); } // need a dispose for deleting files in list } else { throw new Exception("DATA IS NOT SORTED"); } } if( leftRecord != null ) { if( joinType == JoinType.LeftOuterJoin || joinType == JoinType.LeftExclusiveJoin || joinType == JoinType.FullExclusiveJoin || joinType == JoinType.FullOuterJoin ) { write(outputFile, leftRecord, null); } leftRecord = read(leftFile); while(leftRecord != null) { if( joinType == JoinType.LeftOuterJoin || joinType == JoinType.LeftExclusiveJoin || joinType == JoinType.FullExclusiveJoin || joinType == JoinType.FullOuterJoin ) { write(outputFile, leftRecord, null); } leftRecord = read(leftFile); } } else { if( rightRecord != null ) { if( joinType == JoinType.RightOuterJoin || joinType == JoinType.RightExclusiveJoin || joinType == JoinType.FullExclusiveJoin || joinType == JoinType.FullOuterJoin ) { write(outputFile, null, rightRecord); } rightRecord = read(rightFile); while(rightRecord != null) { if( joinType == JoinType.RightOuterJoin || joinType == JoinType.RightExclusiveJoin || joinType == JoinType.FullExclusiveJoin || joinType == JoinType.FullOuterJoin ) { write(outputFile, null, rightRecord); } rightRecord = read(rightFile); } } } leftFile.close(); rightFile.close(); outputFile.flush(); outputFile.close(); } public void processRightRecords(BufferedWriter outputFile, Record leftRecord, List<File> rightFiles, List<Record> rightRecords, JoinType joinType) throws Throwable { for(File rightFile : rightFiles) { BufferedReader rightReader = new BufferedReader(new FileReader(rightFile)); Record rightRecord = read(rightReader); while(rightRecord != null){ if( joinType == JoinType.LeftOuterJoin || joinType == JoinType.RightOuterJoin || joinType == JoinType.FullOuterJoin || joinType == JoinType.InnerJoin ) { write(outputFile, leftRecord, rightRecord); } rightRecord = read(rightReader); } rightReader.close(); } for(Record rightRecord : rightRecords) { if( joinType == JoinType.LeftOuterJoin || joinType == JoinType.RightOuterJoin || joinType == JoinType.FullOuterJoin || joinType == JoinType.InnerJoin ) { write(outputFile, leftRecord, rightRecord); } } } /** * consume all records having key (either to a single list or multiple files) each file will * store a buffer full of data. The right record returned represents the outside flow (key is * already positioned to next one or null) so we can't use this record in below while loop or * within this block in general when comparing current key. The trick is to keep consuming * from a List. When it becomes empty, re-fill it from the next file until all files have * been consumed (and the last node in the list is read). The next outside iteration will be * ready to be processed (either it will be null or it points to the next biggest key * @throws Throwable * */ private Record consume(String key, BufferedReader reader, List<Record> records, List<File> files, long bufferMaxRecordLines ) throws Throwable { boolean processComplete = false; Record record = records.get(records.size() - 1); while(!processComplete){ long recordCount = records.size(); if( record.getKey().compareTo(key) == 0 ){ record = read(reader); while( record != null && record.getKey().compareTo(key) == 0 && recordCount < bufferMaxRecordLines ) { records.add(record); recordCount++; record = read(reader); } } processComplete = true; // if record is null, we are done if( record != null ) { // if the key has changed, we are done if( record.getKey().compareTo(key) == 0 ) { // Same key means we have exhausted the buffer. // Dump entire buffer into a file. The list of file // pointers will keep track of the files ... processComplete = false; dumpBufferToFile(records, files); records.clear(); records.add(record); } } } return record; } /** * Dump all records in List of Record objects to a file. Then, add that * file to List of File objects * * NEED TO PLACE A LIMIT ON NUMBER OF FILE POINTERS (check size of file list) * * @param records * @param files * @throws Throwable */ private void dumpBufferToFile(List<Record> records, List<File> files) throws Throwable { String prefix = "joiner_" + files.size() + 1; String suffix = ".dat"; File file = File.createTempFile(prefix, suffix, new File("cache")); BufferedWriter writer = new BufferedWriter(new FileWriter(file)); for( Record record : records ) { writer.write( record.dump() ); } files.add(file); writer.flush(); writer.close(); }

    Read the article

< Previous Page | 99 100 101 102 103 104 105 106 107 108 109 110  | Next Page >