Search Results

Search found 213 results on 9 pages for 'syntactic sugar'.

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

  • Java for each vs regular for -- are they equivalent?

    - by polygenelubricants
    Are these two constructs equivalent? char[] arr = new char[5]; for (char x : arr) { // code goes here } Compared to: char[] arr = new char[5]; for (int i = 0; i < arr.length; i++) { char x = arr[i]; // code goes here } That is, if I put exactly the same code in the body of both loops (and they compile), will they behave exactly the same??? Full disclaimer: this was inspired by another question (Java: are these 2 codes the same). My answer there turned out not to be the answer, but I feel that the exact semantics of Java for-each has some nuances that needs pointing out.

    Read the article

  • WITH statement in Java

    - by Mike Clark
    In VB.NET there is the WITH command that lets you omit an object name and only access the methods and properties needed. For example: With foo .bar() .reset(true) myVar = .getName() End With Is there any such syntax within Java? Thanks!

    Read the article

  • Nginx not working properly on subdomains [SOLVED]

    - by javipas
    I've been trying to setup a Sugar CRM instance. I've got a domain that has its main site on a server (www.domain.com) and I've created a subdomain (sugar.domain.com), but I wnat this subdomain to be hosted on another server. This second server has nginx installed, and there's a working WordPress blog there on a virtualhost, so I would need to setup a second site. To do this I've created the directory structure, and I've created a /etc/nginx/sites-enabled/sugar.domain.com configuration file that has the following: * server { listen 80; server_name sugar.domain.com *.domain.com; access_log /var/www/sugar/log/access.log; error_log /var/www/sugar/log/error.log info; location / { root /var/www/sugar; index index.php; } location ~ .php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass backend; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/sugar/$fastcgi_script_name; include fastcgi_params; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_intercept_errors on; fastcgi_ignore_client_abort on; fastcgi_read_timeout 180; } ## Disable viewing .htaccess & .htpassword location ~ /\.ht { deny all; } } upstream backend { server 127.0.0.1:9000; } As far as I know, I need the *.domain.com parameter on the "server_name" flag, but something is crashing here: I get either a 403 Forbidden error, or I get PHP code (I can read the PHP file code in the browser, like normal text) that somehow is not executed. I've tried setting permissions to 755 inside the /var/www/sugar/ directory, and I've also set up the owner:group with a chown -R www-data:www-data /var/www/sugar/ The thing is, I don't now if my mistake is in the nginx site configuration, in my folder permissions, or in other place :( Could it be because of the main domain (www.domain.com) is hosted on other server? Do they have to be together necessarily?

    Read the article

  • Nginx not working properly on subdomains

    - by javipas
    I've been trying to setup a Sugar CRM instance. I've got a domain that has its main site on a server (www.domain.com) and I've created a subdomain (sugar.domain.com), but I wnat this subdomain to be hosted on another server. This second server has nginx installed, and there's a working WordPress blog there on a virtualhost, so I would need to setup a second site. To do this I've created the directory structure, and I've created a /etc/nginx/sites-enabled/sugar.domain.com configuration file that has the following: * server { listen 80; server_name sugar.domain.com *.domain.com; access_log /var/www/sugar/log/access.log; error_log /var/www/sugar/log/error.log info; location / { root /var/www/sugar; index index.php; } location ~ .php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass backend; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/sugar/$fastcgi_script_name; include fastcgi_params; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_intercept_errors on; fastcgi_ignore_client_abort on; fastcgi_read_timeout 180; } ## Disable viewing .htaccess & .htpassword location ~ /\.ht { deny all; } } upstream backend { server 127.0.0.1:9000; } As far as I know, I need the *.domain.com parameter on the "server_name" flag, but something is crashing here: I get either a 403 Forbidden error, or I get PHP code (I can read the PHP file code in the browser, like normal text) that somehow is not executed. I've tried setting permissions to 755 inside the /var/www/sugar/ directory, and I've also set up the owner:group with a chown -R www-data:www-data /var/www/sugar/ The thing is, I don't now if my mistake is in the nginx site configuration, in my folder permissions, or in other place :( Could it be because of the main domain (www.domain.com) is hosted on other server? Do they have to be together necessarily?

    Read the article

  • Serve up syntactic XHTML5 using the text/html MIME type?

    - by cboettig
    I have a site currently written with HTML5 tags. I'd like to be able to parse the site as XML, with support for namespaces, etc, to facilitate programmatic extraction of data. Currently I have <!DOCTYPE html> and <meta charset="utf-8"> Which I gather is equivalent in HTML5 to explicitly setting the content-types as <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> for my current setup. In order to serve XML it sounds like the right thing to do is <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> Should I also change my Content-Type to <meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" /> Or is that not necessary? What is the advantage of having content-type be "application/xhtml+xml"? What is the disadvantage? (Sounds like it may break internet explorer rendering of the site? but maybe that information is out of date now?) Many thanks!

    Read the article

  • Wheaties Fuel = Wheaties FAIL

    - by Steve Bargelt
    Are you kidding me? What a load of nutritional CRAP. Don’t buy this product. Just don’t do it. They are just like Wheaties with more sugar and fat. Awesome just what we need more sugar!! Okay now I’m not against carbs… I’m really not. Being a cyclist I realize the importance of carbohydrates in the diet… but let’s be realistic here. Even though the commercials for Wheaties Fuel say they are for athletes you know that what General Mills is really hoping for is that kids will see Payton Manning, Albert Pujols and KG and buy this cereal and eat a ton of it for breakfast. Sad, really. I’ve watched all the videos and read all the propaganda on the Wheaties Fuel web site and no where do they talk about why they added sugar and fat the original Wheaties. There is a lot of double-speak by Dr. Ivy about “understanding the needs of athletes.” I had to laugh – in one of the videos Dr. Ivy even says that he thinks the "new Wheaties will have even more fiber! Wrong! My bad... there is 5g of fiber not 3g per serving. Just  Way more sugar. A serving of FROSTED FLAKES has less sugar per serving!!!   Wheaties Fuel Wheaties Frosted Flakes Honey Nut Cheerios Quaker Oatmeal Serving Size 3/4 cup 3/4 cup 3/4 cup 3/4 cup 3/4 cup Calories 210 100 110 110 225 Fat 3g .5g 0g 1.5g 4.5g Protein 3g 3g 1g 2g 7.5g Carbohydrates 46g 22g 27g 22g 40.5g Sugars 14g 4g 11g 9g 1.5g Fiber 5g 3g 1g 2g 6g   In reality it might not be a bad pre-workout meal but for a normal day-in-day-out breakfast is just seems to have too much sugar - especially when you bump the serving size up to 1 to 1.5 cups and add milk! I’ll stick with Oatmeal, thank you very much.

    Read the article

  • agent-based simulation: performance issue: Python vs NetLogo & Repast

    - by max
    I'm replicating a small piece of Sugarscape agent simulation model in Python 3. I found the performance of my code is ~3 times slower than that of NetLogo. Is it likely the problem with my code, or can it be the inherent limitation of Python? Obviously, this is just a fragment of the code, but that's where Python spends two-thirds of the run-time. I hope if I wrote something really inefficient it might show up in this fragment: UP = (0, -1) RIGHT = (1, 0) DOWN = (0, 1) LEFT = (-1, 0) all_directions = [UP, DOWN, RIGHT, LEFT] # point is just a tuple (x, y) def look_around(self): max_sugar_point = self.point max_sugar = self.world.sugar_map[self.point].level min_range = 0 random.shuffle(self.all_directions) for r in range(1, self.vision+1): for d in self.all_directions: p = ((self.point[0] + r * d[0]) % self.world.surface.length, (self.point[1] + r * d[1]) % self.world.surface.height) if self.world.occupied(p): # checks if p is in a lookup table (dict) continue if self.world.sugar_map[p].level > max_sugar: max_sugar = self.world.sugar_map[p].level max_sugar_point = p if max_sugar_point is not self.point: self.move(max_sugar_point) Roughly equivalent code in NetLogo (this fragment does a bit more than the Python function above): ; -- The SugarScape growth and motion procedures. -- to M ; Motion rule (page 25) locals [ps p v d] set ps (patches at-points neighborhood) with [count turtles-here = 0] if (count ps > 0) [ set v psugar-of max-one-of ps [psugar] ; v is max sugar w/in vision set ps ps with [psugar = v] ; ps is legal sites w/ v sugar set d distance min-one-of ps [distance myself] ; d is min dist from me to ps agents set p random-one-of ps with [distance myself = d] ; p is one of the min dist patches if (psugar >= v and includeMyPatch?) [set p patch-here] setxy pxcor-of p pycor-of p ; jump to p set sugar sugar + psugar-of p ; consume its sugar ask p [setpsugar 0] ; .. setting its sugar to 0 ] set sugar sugar - metabolism ; eat sugar (metabolism) set age age + 1 end On my computer, the Python code takes 15.5 sec to run 1000 steps; on the same laptop, the NetLogo simulation running in Java inside the browser finishes 1000 steps in less than 6 sec. EDIT: Just checked Repast, using Java implementation. And it's also about the same as NetLogo at 5.4 sec. Recent comparisons between Java and Python suggest no advantage to Java, so I guess it's just my code that's to blame? EDIT: I understand MASON is supposed to be even faster than Repast, and yet it still runs Java in the end.

    Read the article

  • Concatenate Gridview Data

    - by zahid mahmood
    I have a gridview with following Data CustomerName item qty tom sugar 1 kg Peter Rice 2 Kg Jhone Sugar .5 kg tom Rice 5 Kg Peter Tea .5 Kg tom Tea 1 kg now I want to display data with the following format: tom sugar 1kg, Rice 5 kg, Tea 1 kg Peter Rice 1kg, Tea .5 kg Jhone Sugar .5kg how to achieve this

    Read the article

  • How do developer get rid of silly requirements?

    - by sugar
    Hmm ! First of all let me give you the note of the requirement. So that you can have idea what kind of problem I am facing. Words From Project Manager : Hey ! Sugar, I am assigning you a task for developing a framework. This framework is supposed to be developed for all iOS application. Please go through brief of the required framework. It should be able to detect the thickness of my Thumb. It should be able to detect whether User is using thumb or Fingers If user is using thumbs/Fingers, Framework should calculate the size of thumb/fingers. Once size is been calculated, all elements of user interface should arranged & resized automatically. ( not specified how & where as its framework - it should be smart enough to arrange automatically ) If thumb size is larger elements should get arranged near by center area of iPad/iPhone If thumb size is smaller elements should get arranged near by corners of iPad/iPhone If thumb size is larger, fonts of all elements should get smaller. ( assuming = aged person ) If thumb size is smaller, fonts of all elements should get larger. ( assuming smaller thumb = low aged person ) Summary : This framework is required for creating user-friendly user-interfaces programmatically. We need to develop a very developer-friendly framework. Framework should be developed in such a way that we can use in as many projects as needed. Well, I am a developer. What I want to have as an answer is as follows. How to describe them - the way of they thinking is bit ridiculous ? How do I explain them - we can better concentrate on developing actual projects ? How do I convince them - that this kind of things even if possible, is not recommended to develop such things ? How do I say politely, gently & respectfully NO to this ? What should I say, So that they can not point at my experience ? ( e.g. you are 3 years experienced guy & you must have abilities to develop such things ) Feeling horror. Please help. Thanks in advance, Sugar. Note : Please help me to tag this question properly. I am stuck & this is real situation. Frustrated & tensed. You guys might have faced such requirements from TopLevel. requesting you to help with your experience. Well ! I came to know that - those TOPLEVEL guys don't have any idea of iPad, iPhone, Apple etc. I would do one thing. Sir, before we go further for framework development. It is strongly recommended to read Apple Human Interface Guidlines.

    Read the article

  • How should a developer reject impossible requirements?

    - by sugar
    Here's the problem I'm facing: Quote From Project Manager: Hey Sugar, I'm assigning you the task of developing a framework that could be used for many different iOS applications. Here are the requirements: It should be able to detect the thickness of the thumb or fingers being used to manipulate the UI. With this information, all elements of the UI should be arranged & sized automatically. For a larger thumb, elements should be arranged nearer the center of the screen. For a smaller thumb, elements should be arranged nearer the corners of the screen. For a larger thumb, all fonts should be smaller. (We're assuming an adult in this case.) For a smaller thumb, all fonts should be larger. (We're assuming a younger person in this case.) Summary: This framework is required for creating user-friendly user interfaces programmatically. The framework should be developed in such a way that we can use for as many projects as needed, so it must also be very developer-friendly. I am the developer given this task, so my questions are as follows: How can I explain that these requirements are a little ridiculous? How can I explain that it would be better to concentrate on developing actual projects? How can I explain that even if this were possible, I wouldn't recommended developing such a thing? How do I say NO to this project politely, gently, and respectfully? How can I explain that even for a developer with 3 years of experience, this might not be possible?

    Read the article

  • right click / pop up using keyboard in osx

    - by sugar
    Yes - I have gone through this & this also. But non of them includes the answer I want. I mean my question is bit different. Let me explain. In windows, to right click any where - or to bring up a pop up menu we just type a key right beside on window key / pop-up key or press Shift + F10 to bring up pop up any where. Similarly, Is there any short-key is available for just bringing pop-up on screen ? Thanks in advance for sharing your knowledge. Sugar.

    Read the article

  • DJANGO complex modelling

    - by SledgehammerPL
    Hello. I have such model now: receipt contains components. component contain product. The difference between component and product is, that component has quantity and measure unit: eg. component is 100g sugar - sugar is a product. So I need to make lots of components to satisfy different recipes - 100g sugar is not equal 200g sugar I wonder if I can remodel it to kick off components - in pure sql it's rather easy, but I'm trying to USE django - not making workarounds. class Receipt(models.Model): name = models.CharField(max_length=128) (...) components = models.ManyToManyField(Component) class Component(models.Model): quantity = models.FloatField(max_length=9) unit = models.ForeignKey(Unit) product = models.ForeignKey(Product) class Product(models.Model): name = models.CharField(max_length = 128) TIA

    Read the article

  • Calculation of Milestones/Task list

    - by sugar
    My project manager assigned me a task to estimate the development time for an iPad application. Lets assume that I gave estimation of 15 working days. He thought that the number of days where too many and client needed the changes to the application urgently (as in most of cases). So, he told me: "I am going to assign two developer including you and as per my understandings and experience it won't take more than seven working days." Clarifications I was given the task of estimating development time for an individual. How could I be sure that 2 developers are going to finish it within 7 days? (I am new to team & I hardly know the others abilities) Questions Why do most of project managers / team leaders have understandings like: If one developer requires N days, Then two developers would require N/2 days, Do they think something like developer = s/w production machines? Should a team member (developer, not team lead or any higher post) estimate other developers work? I didn't deny anything in the meeting and didn't said, but what should be the appropriate answer to convince them that N/2 formula that they follow is not correct?

    Read the article

  • Suggestions required to build an ECommerce Platform

    - by Haris
    For a prospective client we have to offer a solution to provide following system: CMS Order Management Shopping Cart CRM Helpdesk Accounting & Finance Custom Functions In order to save time and to avoid reinvent the wheel our idea is to integrate different off-the-shelf solutions. Their first requirement is that the system has to be hosted in their country which I think will exclude application like Aplicor, Netsuite & Salesforce. Basically the nucleaus would be the CMS which would integrate all the other apps. PHP or .Net based solutions would be our preferences as have inhouse expertise. So far following are few combinations I have come up with: Joomla (CMS) + Virtuemart (Cart+Ordering) + Sugar CRM + Open ERP (finance) + OTRS Magento (CMS+Cart+Ordering) + Sugar CRM + Open ERP (finance) + Helpdesk Ultimate Drupal (CMS) + Ubercart (Cart+Ordering) + Sugar CRM + Open ERP (finance) + Support Ticketing System Sharepoint (CMS) + OptimusBt (Cart+Ordering) + Dynamics CRM + Great Plains + SharepointHQ Dotnetnuke (CMS) + DNNSpot (Cart+Ordering) + Sigma Pro (CRM+Helpdesk) + Open ERP For Helpdesk I liked Zendesk but the server location was the stopping factor, similar for finance and CRM I liked Aplicor. I would not like to go into detailed requirements as it would make things very complex. Could you please suggest me which options are worth enough to start looking into? What other options we have?

    Read the article

  • What is the purpose of Java's unary plus operator?

    - by Syntactic
    Java's unary plus operator appears to have come over from C, via C++. As near as I can tell, it has the following effects: promotes its operand to int, if it's not already an int or wider unboxes its operand, if it's a wrapper object complicates slightly the parsing of evil expressions containing large numbers of consecutive plus signs It seems to me that there are better (or, at least, clearer) ways to do all of these things. In this SO question, concerning the counterpart operator in C#, someone said that "It's there to be overloaded if you feel the need." But in Java, one cannot overload any operator. So does this operator exist in Java just because it existed in C++?

    Read the article

  • SugarCRM - how to make users see only child users?

    - by John
    Hello, I want to change the behaviour of Sugar CRM community version. Here's what sugar currently does: 1) Admin logs into Sugar. 2) Admin clicks on Admin tab. 3) Admin creates a new user named George with admin access 4) Under user information section, Admin makes George report to Admin (in the database, it will show users.report_to_id is the admin's user_id) 5) Admin saves and logs out 6) George logs in with his password 7) George goes to admin tab. 8) George goes to list users page and sees all users, including Admin, the person he is supposed to report to. I want to change step 8 such that George is not allowed to see the user he reports to. Additionally, he is not allowed to see his grand parent user, great grand parent user, great great grand parent user etc... George should only be able to see users that he creates. How can I achieve this? Is this even possible?

    Read the article

  • OpenGL - What softwares are needed to learn Open GL on Osx

    - by sugar
    I strongly believe that - my question isn't related to programing, so that I asked my question here ( super user ). Here, I am not asking what links should I follow to learn OpenGL. I am asking that - What software are needed for learning Open Gl? Let me explain more briefly, I want to learn openGL for iPhone game development. Tools for creating 3D objects which are preferable tools are targeted for osx would be preferable. In short I would like to know, The list of application which are used by iPhone professional game developers on osx. Thanks in advance for sharing your knowledge. Please add comment before down voting. Sagar.

    Read the article

  • Is there a solution for SugarCRM that can map roles or privileges to Active Directory groups?

    - by Cory Larson
    We're presenting SugarCRM as an option to one of our clients, but they want to drive permissions within Sugar by users' AD groups. Current LDAP integration with SugarCRM only does password management. Does anybody know of a plug-in that supports this? I've searched and have not been able to find anything. Has anybody change the LDAP module code within Sugar to accommodate these features? I'd be interested in chatting with you. I apologize if this isn't on the correct site; neither serverfault nor stackoverflow seemed like the correct place. Perhaps webapps? Thanks!

    Read the article

  • Is there a solution for SugarCRM that can map roles or privileges to Active Directory groups?

    - by Cory Larson
    We're presenting SugarCRM as an option to one of our clients, but they want to drive permissions within Sugar by users' AD groups. Current LDAP integration with SugarCRM only does password management. Does anybody know of a plug-in that supports this? I've searched and have not been able to find anything. Has anybody change the LDAP module code within Sugar to accommodate these features? I'd be interested in chatting with you. I apologize if this isn't on the correct site; neither serverfault nor stackoverflow seemed like the correct place. Perhaps webapps? Thanks!

    Read the article

  • How to store javascript variables in iPhone application

    - by sugar
    <script type="text/javascript"> function getSelectionRange() { var sel; if (window.getSelection) { sel = window.getSelection(); if (sel.rangeCount) { return sel.getRangeAt(0); } } else if (document.selection) { return document.selection.createRange(); } return null; } var range; </script> whatShouldBeHere=[wvText stringByEvaluatingJavaScriptFromString:@"getSelectionRange();"]; Here, method getSelectionRange is returning JavaScript Object of Range type. How can I catch & store in plist file in iPhone application ? Thanks in advance for sharing your knowledge. Sagar

    Read the article

  • html - selection range - getting the range + starting node + ending node + distance

    - by sugar
    From my previous question for selecting specific html text, I have gone through this link to understand range in html string. Actually I am confused here very much. My question is as follows. For selecting a specific text on html page. We need to follow this steps. assumed html <h4 id="entry1196"><a href="http://radar.oreilly.com/archives/2007/03/call_for_a_blog_1.html" class="external">Call for a Blogger's Code of Conduct</a></h4> <p>Tim O'Reilly calls for a Blogger Code of Conduct. His proposals are:</p> <ol> <li>Take responsibility not just for your own words, but for the comments you allow on your blog.</li> <li>Label your tolerance level for abusive comments.</li> <li>Consider eliminating anonymous comments.</li> </ol> java script to make selection by range var range = document.createRange(); // create range var startPar = [the p node]; // starting parameter var endLi = [the second li node]; // ending parameter range.setStart(startPar,13); // distance from starting parameter. range.setEnd(endLi,17); // distance from ending parameter range.select(); // this statement will make selection I want to do this in invert way. I mean, assume that selection is done by user on browser (safari). My question is that How can we get starting node ( as we have 'the p node' here ) & ending node ( as we have 'the second li node' here ) and the range as well (as we have 13,17 here) ? Please help me. Thanks in advance for sharing your great knowledge. Sagar

    Read the article

  • custom UIButton with skewed area in iPhone

    - by sugar
    I want to have a button on a screen with this image. this image is transparent from its corners as you can see here. UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom]; [btn setFrame:CGRectMake(xCo, yCo, kImageSizeWidth, kImageSizeHeight)]; [btn setImage:[UIImage imageNamed:@"aboveImg.png"] forState:UIControlStateNormal]; [btn addTarget:self action:@selector(btnTapped:) forControlEvents:UIControlEventTouchDown]; But the button tap is recognized out side image & i don't want that kind of functionality. I mean tap must be recognized only when it is tapped within image not outside image. How is that possible ? Thanks in advance for sharing your great knowledge. Sagar.

    Read the article

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