Search Results

Search found 8391 results on 336 pages for 'partial hash arguments'.

Page 16/336 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • how to do partial updates in OpenGL?

    - by Will
    It is general wisdom that you redraw the entire viewport on each frame. I would like to use partial updates; what are the various ways can do that, and what are their pros, cons and relative performance? (Using textures, FBOs, the accumulator buffer, any kind of scissors that can affect swapbuffers etc?) A scenario: a scene with a fair few thousand visible trees; although the textures are mipmapped and they are drawn via VBOs roughly front-to-back with so on, its still a lot of polys. Would streaming a single screen-sized texture be better than throwing them at the screen every frame? You'd have to redraw and recapture them only on camera movement or as often as your wind model updates or whatever, which need not be every frame.

    Read the article

  • Arguments for or against using Try/Catch as logical operators

    - by James P. Wright
    I just discovered some lovely code in our companies app that uses Try-Catch blocks as logical operators. Meaning, "do some code, if that throws this error, do this code, but if that throws this error do this 3rd thing instead". It uses "Finally" as the "else" statement it appears. I know that this is wrong inherently, but before I go picking a fight I was hoping for some well thought out arguments. And hey, if you have arguments FOR the use of Try-Catch in this manner, please do tell. EDIT For any who are wondering, the language is C# and the code in question is about 30+ lines and is looking for specific exceptions, it is not handling ALL exceptions.

    Read the article

  • How to hide process arguments from other users?

    - by poolie
    A while ago, I used to use the grsecurity kernel patches, which had an option to hide process arguments from other non-root users. Basically this just made /proc/*/cmdline be mode 0600, and ps handles that properly by showing that the process exists but not its arguments. This is kind of nice if someone on a multiuser machine is running say vi christmas-presents.txt, to use the canonical example. Is there any supported way to do this in Ubuntu, other than by installing a new kernel? (I'm familiar with the technique that lets individual programs alter their argv, but most programs don't do that and anyhow it is racy. This stackoverflow user seems to be asking the same question, but actually just seems very confused.)

    Read the article

  • How to hide process arguments from other users?

    - by poolie
    A while ago, I used to use the grsecurity kernel patches, which had an option to hide process arguments from other non-root users. Basically this just made /proc/*/cmdline be mode 0600, and ps handles that properly by showing that the process exists but not its arguments. This is kind of nice if someone on a multiuser machine is running say vi christmas-presents.txt, to use the canonical example. Is there any supported way to do this in Ubuntu, other than by installing a new kernel? (I'm familiar with the technique that lets individual programs alter their argv, but most programs don't do that and anyhow it is racy. This stackoverflow user seems to be asking the same question, but actually just seems very confused.)

    Read the article

  • Rails: Should partials be aware of instance variables?

    - by Alexandre
    Ryan Bates' nifty_scaffolding, for example, does this edit.html.erb <%= render :partial => 'form' %> new.html.erb <%= render :partial => 'form' %> _form.html.erb <%= form_for @some_object_defined_in_action %> That hidden state makes me feel uncomfortable, so I usually like to do this edit.html.erb <%= render :partial => 'form', :locals => { :object => @my_object } %> _form.html.erb <%= form_for object %> So which is better: a) having partials access instance variables or b) passing a partial all the variables it needs? I've been opting for b) as of late, but I did run into a little pickle: some_action.html.erb <% @dad.sons.each do |a_son| %> <%= render :partial => 'partial', :locals => { :son => a_son } %> <% end %> _partial.html.erb The son's name is <%= son.name %> The dad's name is <%= son.dad.name %> son.dad makes a database call to fetch the dad! So I would either have to access @dad, which would be going back to a) having partials access instance variables or I would have to pass @dad in locals, changing render :partial to <%= render :partial = 'partial', :locals = { :dad = @dad, :son = a_son } %, and for some reason passing a bunch of vars to my partial makes me feel uncomfortable. Maybe others feel this way as well. Hopefully that made some sense. Looking for some insight into this whole thing... Thanks!

    Read the article

  • How do I sort a hash table in javascript?

    - by Colen
    I have a javascript hash table, like so: var things = [ ]; things["hello"] = {"name" : "zzz I fell asleep", "number" : 7}; things["one"] = {"name" : "something", "number" : 18}; things["two"] = {"name" : "another thing", "number" : -2}; I want to sort these into order by name, so if I iterate through the hash table it will go in order another thing something zzz I fell asleep I tried doing this: function compareThings(thing1, thing2) { var name1 = thing1["name"].toLowerCase(); var name2 = thing2["name"].toLowerCase(); if (name1 < name2) { return -1; } if (name1 > name2) { return 1; } return 0; } things.sort(compareThings); But it doesn't seem to work. Edit: it occurs to me that perhaps a sorted hash table is an oxymoron. If so, what's the best way to get access to a sorted list of the things here?

    Read the article

  • Best placement for javascript in Asp.net MVC app that heavily uses partial views

    - by KallDrexx
    What is the best place for javascript that is specific to a partial view? For example, if I have a partial view (loaded via ajax call) with some divs and I want to turn those divs into an accordian, would it be better put the $("#section").accordion() in script tags inside of the partial view, or in a .js file in the function that retrieves that partial view and inserts it into the DOM? Obviously, common methods I will be keeping in a .js file, however I am more talking about javascript very specific to the partial view itself. Most things I find on the net seem to say to put all javascript into a separate .js but nothing addresses the idea of partial views.

    Read the article

  • [Sql-Server]what data type to use for password salt and hash values and what length?

    - by Pandiya Chendur
    I am generating salt and hash values from my passwords by using, string salt = CreateSalt(TxtPassword.Text.Length); string hash = CreatePasswordHash(TxtPassword.Text, salt); private static string CreateSalt(int size) { //Generate a cryptographic random number. RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); byte[] buff = new byte[size]; rng.GetBytes(buff); // Return a Base64 string representation of the random number. return Convert.ToBase64String(buff); } private static string CreatePasswordHash(string pwd, string salt) { string saltAndPwd = String.Concat(pwd, salt); string hashedPwd = FormsAuthentication.HashPasswordForStoringInConfigFile( saltAndPwd, "sha1"); return hashedPwd; } What datatype you would suggest for storing these values in sql server? Any suggestion... Salt:9GsPWpFD Hash:E778AF0DC5F2953A00B35B35D80F6262CDBB8567

    Read the article

  • LInq to SQL - Partial Class - C#

    - by Mark Comix
    Hi, I have a system with 2 different projects, one is called LINQ_Extensions and the other is ORM_Linq. On ORM_Linq i have the LINQ diagram with the SQL tables "converted" in clases. One of the Class is called "Tipos_Pago" In the other project i have another class (partial class) "Tipos_Pago". I want to use the method OnValidate to validate the properties include in the class "Tipos_Pago", so i create this partial class. In the 2 projects i put the same NameSpace "ORM_Linq"(I changed the NameSpace of the project "LINQ_Extensions" to have the same of the project "ORM_Linq") After those chages, Visual Studio give me this error: Error 1 No defining declaration found for implementing declaration of partial method 'ORM_Linq.Tipos_Pago.OnValidate(System.Data.Linq.ChangeAction)' C..\Tipos_Pago.cs 13 22 Extensiones_Linq I don't have any Idea of what happend, can someone help me? Thanks, sorry for my poor english This is the code in the partial class: namespace ORM_Linq { public partial class Tipos_Pago { partial void OnValidate(System.Data.Linq.ChangeAction action) { //Valid code } } }

    Read the article

  • What is this Hash-like/Tree-like Construct Called?

    - by viatropos
    I want to create a "Config" class that acts somewhere between a hash and a tree. It's just for storing global values, which can have a context. Here's how I use it: Config.get("root.parent.child_b") #=> "value" Here's what the class might look like: class Construct def get(path) # split path by "." # search tree for nodes end def set(key, value) # split path by "." # create tree node if necessary # set tree value end def tree { :root => { :parent => { :child_a => "value", :child_b => "another value" }, :another_parent => { :something => { :nesting => "goes on and on" } } } } end end Is there a name for this kind of thing, somewhere between Hash and Tree (not a Computer Science major)? Basically a hash-like interface to a tree.

    Read the article

  • Forms blank when rendering a partial when using a collection of objects. Help!

    - by dustmoo
    Alright, I know my title is a little obscure but it best describes the problem I am having. Essentially, I have a list of users, and want to be able to edit their information in-line using AJAX. Since the users are showing up in rows, I am using a partial to render the data and the forms (which will be hidden initially by the ajax), however, when the rows are rendered currently only the last item has it's form's fields populated. I suspect this has something to do with the fact that all the form fields have the same id's and it is confusing the DOM. But I don't know how to make sure the id's are unique. Here is a small example: In my view: <%= render :partial => 'shared/user', :collection => @users %> My partial (broke down to just the form) note that I am using the local variable "user" <% form_for user, :html => {:multipart => true} do |f| -%> <%= f.label :name, "Name*" %> <%= f.text_field :title, :class => "input" %> <%= f.label :Address, "Address" %> <%= f.text_field :address, :class => "input" %> <%= f.label :description, "Description*" %> <%= f.text_area :description, :class => "input" %> <% end -%> When the html is rendered each form has a unique id (for the id of the user) but the elements themselves all have the same id, and only the last user form is actually getting populated with values. Does anyone have any ideas?? :) Thanks in advance!

    Read the article

  • Ignore Partial Upgrade -- Google Earth Dependencies

    - by pyraz
    I'm running a 64-bit install of Xubuntu 12.04. It took me a little while to get Google Earth working. The 64-bit Google earth package requires some 32-bit gtk libraries provided by ia32-libs. However, when I ran a simulation to install ia32-libs and it's dependencies, it wanted to remove a ton of programs, including the xubuntu-desktop meta-package. As a work-around, I used getlibs to get the 32-bit libraries I needed, and then installed Google Earth with the deb package and the --ignore-depend option to dpkg. Awesome, Google Earth is installed and is working great! Now, however, Update Manager keeps complaining about a "Partial Upgrade", and apt-get won't let me install any new applications. It wants me to do a fix-broken install, but when I do a simulation of apt-get -f install I get some very bad news, they want to uninstall the Google Earth I just worked so hard to install! $> apt-get -f -s install Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following packages will be REMOVED: googleearth 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Remv googleearth [6.0.3.2197+0.7.0-1] TL;DR The --ignore-depends passed to dpkg is not propagating to apt-get, so now I can't install any new applications until I uninstall Google Earth, because of it's missing dependencies (even though it works fine without them). How can I fix this?

    Read the article

  • Pass potentially infinite number of arguments to array except a single numeric variable in a PHP com

    - by tehalive
    I'm trying to make a PHP script that will take a potentially infinite number of URLs from the command line as arguments. I also need to pass an argument that only has a single numeric value possible (to specify timeout), e.g.: ./urltest.php 60 url1.com url2.com url3.com I'm not exactly sure how to specify argv[1] to be a single numeric variable while at the same time the rest of the arguments (i.e. the list of urls) go into an array. Maybe something like: $timeout = $argv[1]; $args = func_get_args(); function numfilter($num) { return !is_numeric($num); } $urls = array_filters($args, 'numfilter'); ? Thanks in advance!

    Read the article

  • How to create a closure and pass in variable length argument list?

    - by Jian Lin
    We can create a closure p by capturing the arguments in the scope in the following code: var p = function() { }; if (typeof(console) != 'undefined' && console.log) { p = function() { console.log(arguments); }; } but the arguments are passed like an array to console.log, instead of passed one by one as in console.log(arguments[0], arguments[1], arguments[2], ... Is there a way to expand the arguments and pass to console.log like the way above? Note that p = console.log; works well in Firefox and IE 8 but not on Chrome.

    Read the article

  • SHA1 hash question

    - by phenevo
    Hi, I have this method to hash a string: byte[] buffer = enc.GetBytes(text); SHA1CryptoServiceProvider cryptoTransformSHA1 = new SHA1CryptoServiceProvider(); string hash = BitConverter.ToString( cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", ""); return hash; My question is: Is the resulting hash always the same for the same string? I hashed a string a couple of days ago and it seems that it now resulted in another hash, but i'm not sure.

    Read the article

  • How to generate a mixed-case hash in Python?

    - by pyrony
    I am having a hard time figuring out a reasonable way to generate a mixed-case hash in Python. I want to generate something like: aZeEe9E Right now I'm using MD5, which doesn't generate case-sensitive hashes. What is a good way to generate a hash value consisting of upper- and lower- case characters + numbers?

    Read the article

  • Convert Ruby array of tuples into a hash given an array of keys?

    - by Kit Ho
    I have an simple array array = ["apple", "orange", "lemon"] array2 = [["apple", "good taste", "red"], ["orange", "bad taste", "orange"], ["lemon" , "no taste", "yellow"]] how can i convert in to this hash whenever element in array match the first element of each element in array2? hash = {"apple" => ["apple" ,"good taste", "red"], "orange" => ["orange", "bad taste", "orange"], "lemon" => ["lemon" , "no taste", "yellow"] } I am quite new to ruby, and spend a lot to do this manipulation, but no luck, any help ?

    Read the article

  • How can I use a Perl hash key that has a literal dot?

    - by imerez
    I have a hash in Perl which has been dumped into from some legacy code the name of the key has now changed from simply reqHdrs to reqHdrs.bla $rec->{reqHdrs.bla} My problem is now I cant seem to access this field from the hash any ideas? The following is my error Download Script Output: Bareword "reqHdrs" not allowed while "strict subs" in use

    Read the article

  • Best arguments for/against introducing ORM technology into a companies dev process

    - by james
    I have started using ORM technology in the last few years. My first exposure was NHibernate. I then moved onto Linq 2 Sql, and Entity Framework. The issue I have however is, there are some organisations where I have found strong opposition to introducing ORM tools. They usually have a number of reasons: they have a lot of built up SQL skills in the team, and are worried about the underlying SQL that ORM's generate. they have DBA's who like to be able to see the SQL an app uses in order that can review it for best practice. they are worried about performance (some people have "heard" the ORM's aren't as performant but have no real proof themselves - there may well be some truth in this! :). So, I'm looking for the best or most convincing arguments that you have put forward FOR the use of ORM tools. Equally, I would be interested in the against arguments too. Note: this is NOT a discussion over which ORM I should use.

    Read the article

  • Arguments for a coding standard?

    - by acidzombie24
    A few friends and i are planning to work on a project together and we want a COMPLETELY DIFFERENT coding standard. We do NOT want to use the coding standard the libraries/language uses. Its our project and we want to mess around. So i came here to ask what you guys think are good standards and arguments for it (or what not to do and arguments against it). The styles i remember most are Upper casing the entire word Camel and Pascal casing Using '_' to separate each word pre or postfixing letters or words (i hate m for member but i think IsCond() is a good func name. SomethingException as a postfix example) Using '_' at the start or end of words Brace placement. On a new or same line? I know of libs that use Pascal casing on all public and protected members. But would you ever get confused if something is a func, var or even property if the lang supports it? What about if you decide a public member to be private (or vice versa) wouldnt that great a lot of fix up work or inconsistencies? Is prefixing C to every class a good idea? I ask what do you think and why?

    Read the article

  • Arguments for discouraging satellite sites?

    - by Jjdelc
    I am working with a client who's read about satellite sites on a SEP book and has been building hundreds of keyword reach domains (buytoyotacorona1989cheap.com, brandnewsuvinred.com) with specific content about such domains. They all link to a main domain (CompanyName.com) where most of the information is either repeated(from other sites) or new. I told him to drop all the other domains and only focus on building good content for the main site as it is too difficult to maintain so many websites, plus they might look like link farms to Google. He told me to make a Google search for "Buy Toyota cheap " and two of his websites were listed among top 10. So it's seem to be doing some good, but I get the feeling that what he is doing is wrong. What other arguments are there to discourage this practice? or is he doing the right thing? My arguments have helped him to decide go down from hundreds to close to one hundred (because cost of maintainance) but I believe he should only have one or two sites. PS: The business is not actually about cars.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >