Search Results

Search found 13794 results on 552 pages for 'variable scope'.

Page 24/552 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Retrieve a static variable using its name dynamically using reflection

    - by user2538438
    How to retrieve a static variable using its name dynamically using Java reflection? If I have class containing some variables: public class myClass { string [][] cfg1= {{"01"},{"02"},{"81"},{"82"}}; string [][]cfg2= {{"c01"},{"c02"},{"c81"},{"c82"}}; string [][] cfg3= {{"d01"},{"d02"},{"d81"}{"d82"}}; int cfg11 = 5; int cfg22 = 10; int cfg33 = 15; } And in another class I want variable name is input from user: class test { Scanner in = new Scanner(System.in); String userInput = in.nextLine(); // get variable from class myClass that has the same name as userInput System.out.println("variable name " + // correct variable from class) } Using reflection. Any help please?

    Read the article

  • Media Information for Constant and Variable bit rate of Video files

    - by cpx
    What is this Maximum bit rate for a .mp4 format file whose bit rate mode is Constant? Media information displayed for MP4 (Using MediaInfo Tool) ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : [email protected] Format settings, CABAC : No Format settings, ReFrames : 1 frame Codec ID : avc1 Codec ID/Info : Advanced Video Coding Bit rate mode : Constant Bit rate : 1 500 Kbps Maximum bit rate : 3 961 Kbps Display aspect ratio : 4:3 Frame rate mode : Constant Frame rate : 29.970 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.163 In this case where the bit rate mode is set to Variable, is the Bit rate field where the value is displayed as 309 is its average bit rate? Media information displayed for M4V (Using MediaInfo Tool) ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : [email protected] Format settings, CABAC : No Format settings, ReFrames : 1 frame Codec ID : avc1 Codec ID/Info : Advanced Video Coding Bit rate mode : Variable Bit rate : 309 Kbps Display aspect ratio : 16:9 Frame rate mode : Variable Frame rate : 23.976 fps Minimum frame rate : 23.810 fps Maximum frame rate : 24.390 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.229 Writing library : x264 core 120

    Read the article

  • What is the EGG environment variable?

    - by Randall
    A user on our (openSuSE) linux systems attempted to run sudo, and triggered an alert. He has the environment variable EGG set - EGG=UH211åH1ÒH»ÿ/bin/shHÁSH211çH1ÀPWH211æ°;^O^Ej^A_j<X^O^EÉÃÿ This looks unusual to say the least. Is EGG a legitimate environment variable? (I've found some references to PYTHON_EGG_CACHE - could be related? But that environment variable isn't set for this user). If it's legit, then I imagine this group has the best chance of recognizing it. Or, given the embedded /bin/sh in the string above, does anyone recognize this as an exploit fingerprint? It wouldn't be the first time we had a cracked account (sigh).

    Read the article

  • HOSTNAME environment variable on Linux

    - by infogrind
    On my Linux box (Gentoo Linux 2.6.31 to be specific) I have noticed that the HOSTNAME environment variable is available in my shell, but not in scripts. For example, $ echo $HOSTNAME returns xxxxxxxx.com, but $ ruby -e 'puts ENV["HOSTNAME"]' returns nil On the other hand, the USER environment variable, for instance, is available both in the shell and in scripts. I have noticed that USER appears in the list of environment variables that appears when I type export i.e., declare -x USER="infogrind" but HOSTNAME doesn't. I suspect the issue has something to do with that. My questions: 1) how can I make HOSTNAME available in scripts, and 2) for my better understanding, where is this variable initially set, and why is it not "exported"?

    Read the article

  • Puppet - pass variable with a file create command

    - by Tim Brigham
    I need a way to pass a given variable - lets say thearch - to several different files within a given class. I need to be able to state the contents of this variable for each file individually. I have tried the following: file { "xxx": thearch => "i386", path => "/xxx/yyyy", owner => root, group => root, mode => 644, content => template("module/test.erb"), } This doesn't pass this variable so I can use it with a <%=thearch% statement within the erb file as I expect. What am I doing wrong here?

    Read the article

  • Objective-C Out of scope problem

    - by davbryn
    Hi, I'm having a few problems with some Objective-C and would appreciate some pointers. So I have a class MapFileGroup which has the following simple interface (There are other member variables but they aren't important): @interface MapFileGroup : NSObject { NSMutableArray *mapArray; } @property (nonatomic, retain) NSMutableArray *mapArray; mapArray is @synthesize'd in the .m file. It has an init method: -(MapFileGroup*) init { self = [super init]; if (self) { mapArray = [NSMutableArray arrayWithCapacity: 10]; } return self; } It also has a method for adding a custom object to the array: -(BOOL) addMapFile:(MapFile*) mapfile { if (mapfile == nil) return NO; mapArray addObject:mapfile]; return YES; } The problem I get comes when I want to use this class - obviously due to a misunderstanding of memory management on my part. In my view controller I declare as follows: (in the @interface): MapFileGroup *fullGroupOfMaps; With @property @property (nonatomic, retain) MapFileGroup *fullGroupOfMaps; Then in the .m file I have a function called loadMapData that does the following: MapFileGroup *mapContainer = [[MapFileGroup alloc] init]; // create a predicate that we can use to filter an array // for all strings ending in .png (case insensitive) NSPredicate *caseInsensitivePNGFiles = [NSPredicate predicateWithFormat:@"SELF endswith[c] '.png'"]; mapNames = [unfilteredArray filteredArrayUsingPredicate:caseInsensitivePNGFiles]; [mapNames retain]; NSEnumerator * enumerator = [mapNames objectEnumerator]; NSString * currentFileName; NSString *nameOfMap; MapFile *mapfile; while(currentFileName = [enumerator nextObject]) { nameOfMap = [currentFileName substringToIndex:[currentFileName length]-4]; //strip the extension mapfile = [[MapFile alloc] initWithName:nameOfMap]; [mapfile retain]; // add to array [fullGroupOfMaps addMapFile:mapfile]; } This seems to work ok (Though I can tell I've not got the memory management working properly, I'm still learning Objective-C); however, I have an (IBAction) that interacts with the fullGroupOfMaps later. It calls a method within fullGroupOfMaps, but if I step into the class from that line while debugging, all fullGroupOfMaps's objects are now out of scope and I get a crash. So apologies for the long question and big amount of code, but I guess my main question it: How should I handle a class with an NSMutableArray as an instance variable? What is the proper way of creating objects to be added to the class so that they don't get freed before I'm done with them? Many thanks

    Read the article

  • GLOBALS ARE BAAAAAAADDDD!!!!!

    - by Matt
    HOWEVER! would setting the $link to my database be one thing that I prolly should use a GLOBAL scope for? In my setting of (lots of functions)...it seems as though having only one variable that is on the global scope would be wise. I am currently using the functions to transfer it back and forth so that way I do not have it on global...but it is a bit of a hinder to my script. Please Advise, Thank you. Matt

    Read the article

  • c# scope/typing/assignment question

    - by Shannow
    Hi there another quick question. I would like to create a variable object so that depending on the value of something, it gets cast as needed. e.g. var rule; switch (seqRuleObj.RuleType) { case SeqRuleObj.type.Pre : rule = new preConditionRuleType(); rule = (preConditionRuleType)seqRuleObj.Rule; break; case SeqRuleObj.type.Post : rule = new postConditionRuleType(); rule = (postConditionRuleType)seqRuleObj.Rule; break; case SeqRuleObj.type.Exit : rule = new exitConditionRuleType(); rule = (exitConditionRuleType)seqRuleObj.Rule; break; default : break; } String result; foreach (sequencingRuleTypeRuleConditionsRuleCondition cond in rule.ruleConditions.ruleCondition) { ....../ blah } so basically this will not work. c# will not allow me to create an new object in every case as the name is aleady defined. i can just paste the foreach loop into each case but that to me is such a waste, as the objects are exactly the same in all but name.

    Read the article

  • Ruby on Rails: How to use a local variable in a collection_select

    - by mmacaulay
    I have a partial view which I'm passing a local variable into: <%= render :partial => "products/product_row", :locals => { :product => product } %> These are rows in a table, and I want to have a <select> in each row for product categories: <%= collection_select(:product, :category_id, @current_user.categories, :id, :name, options = {:prompt => "-- Select a category --"}, html_options = { :id => "", :class => "product_category" }) %> (Note: the id = "" is there because collection_select tries to give all these select elements the same id.) The problem is that I want to have product.category be selected by default and this doesn't work unless I have an instance variable @product. I can't do this in the controller because this is a collection of products. One way I was able to get around this was to have this line just before the collection_select: <% @product = product %> But this seems very hacky and would be a problem if I ever wanted to have an actual instance variable @product in the controller. I guess one workaround would be to name this instance variable something more specific like @product_select_tmp in hopes of not interfering with anything that might be declared in the controller. This still seems very hacky though, and I'd prefer a cleaner solution. Surely there must be a way to have collection_select use a local variable instead of an instance variable. Note that I've tried a few different ways of calling collection_select with no success: <%= collection_select(product, ... <%= collection_select('product', ... etc. Any help greatly appreciated!

    Read the article

  • How does scope in Javascript work?

    - by Jim
    I can not understand how scoping works in Javascript. E.g. <html> <head> <script>var userName = "George"; </script> </head> <body> ...... <script> document.write('Name = ' + userName); </script> </body> </html> The variable userName is declared in another "section" of a script. As I understand it the browser renders html and executes code in the order it finds it. So how does userName in the second script tag gets resolved? Does it go to a global setting? Anything I declare earlier is global? I noticed the same happens if I do something like: <html> <head> <script> do { var userName = "George"; //bla } while (someCondition); </script> </head> <body> ...... <script> document.write('Name = ' + userName); </script> </body> </html> Even when userName is declared inside {} it is still resolved in the second script. How is that possible?

    Read the article

  • Create Session Variable from different datasources?

    - by Szafranamn
    Currently I am developing a dynamic website using Dreamweaver cs5 with ColdFusion 9 and using Access to create my databases along with QuickBooks and QODBC to create database. I have established a login session variable stemming from the login page. This session variable is being drawn from one Datasource "Access" Table "Logininfo" Field "FullName" but I wanted to create another session variable either at this point or further into the member's page to use in a query sequence. This session variable would stem from another Datasoucre "QBs" Table "Invoice" Field "CustomerRefFullName" which is generated through Quickbooks and QODBC. I am not sure if this is possible but if it is how do I do it. I want to do this so I can query the Invoice database to upload the customer's Invoices unique to them onto their page. So it would have to be related to their login credentials. If there is another better route to take I would greatly appreciate the advice. Below is the login code if there is additional information needed let me know. This is my current thinking/plan to do what I wish to intend hence the need to create the session variable: I have another Datasource "QBs" with a Table "Invoice" when I create another webpage for the customer to see their invoice I need to create a recordset that accesses that Table. In order to do so I think the best way would some home convert the session.FullName (which came from Access Datasource, Logininfor Table) into a session.CustomerRefFullName (which would have to come from (Datasource: QBs Table: Invoice Field: CustomerRefFullName) that way I could set the query WHERE CustomerRefFullName and have each logged in user see their specific Invoices. So is there a way to turn the session variable off one datasource/table into a different sessionvariable off a new datasource/table even if it is unique just to that page??? <cfif IsDefined("FORM.username")> SELECT FullName, Username,Password,AccessLevels FROM Logininfo WHERE Username= AND Password=

    Read the article

  • Sharing a global/static variable between a process and DLL

    - by minjang
    I'd like to share a static/global variable only between a process and a dll that is invoked by the process. The exe and dll are in the same memory address space. I don't want the variable to be shared among other processes. Elaboration of the problem: Say that there is a static/global variable x in a.cpp. Both the exe foo.exe and the dll bar.dll have a.cpp, so the variable x is in both images. Now, foo.exe dynamically loads (or statically) bar.dll. Then, the problem is whether the variable x is shared by the exe and dll, or not. In Windows, these two guys never share the x: the exe and dll will have a separate copy of x. However, in Linux, the exe and dll do share the variable x. Unfortunately, I want the behavior of Linux. I first considered using pragma data_seg on Windows. However, even if I correctly setup the shared data segment, foo.exe and bar.dll never shares the x. Recall that bar.dll is loaded into the address space of foo.exe. However, if I run another instance of foo.exe, then x is shared. But, I don't want x to be shared by different processes. So, using data_seg was failed. I may it use a memory-mapped file by making an unique name between exe and dll, which I'm trying now. Two questions: Why the behavior of Linux and Windows is different? Can anyone explain more about this? What would be most easiest way to solve this problem on Windows?

    Read the article

  • Problems with :uniq => true/Distinct option in a has_many_through association w/ named scope (Rails)

    - by MikeH
    I had to make some tweaks to my app to add new functionality, and my changes seem to have broken the :uniq option that was previously working perfectly. Here's the set up: #User.rb has_many :products, :through = :seasons, :uniq = true has_many :varieties, :through = :seasons, :uniq = true #product.rb has_many :seasons has_many :users, :through = :seasons, :uniq = true has_many :varieties #season.rb belongs_to :product belongs_to :variety belongs_to :user named_scope :by_product_name, :joins = :product, :order = 'products.name' #variety.rb belongs_to :product has_many :seasons has_many :users, :through = :seasons, :uniq = true First I want to show you the previous version of the view that is now breaking, so that we have a baseline to compare. The view below is pulling up products and varieties that belong to the user. In both versions below, I've assigned the same products/varieties to the user so the logs will looking at the exact same use case. #user/show <% @user.products.each do |product| %> <%= link_to product.name, product %> <% @user.varieties.find_all_by_product_id(product.id).each do |variety| %> <%=h variety.name.capitalize %></p> <% end %> <% end %> This works. It displays only one of each product, and then displays each product's varieties. In the log below, product ID 1 has 3 associated varieties. And product ID 43 has none. Here's the log output for the code above: Product Load (11.3ms) SELECT DISTINCT `products`.* FROM `products` INNER JOIN `seasons` ON `products`.id = `seasons`.product_id WHERE ((`seasons`.user_id = 1)) ORDER BY name, products.name Product Columns (1.8ms) SHOW FIELDS FROM `products` Variety Columns (1.9ms) SHOW FIELDS FROM `varieties` Variety Load (0.7ms) SELECT DISTINCT `varieties`.* FROM `varieties` INNER JOIN `seasons` ON `varieties`.id = `seasons`.variety_id WHERE (`varieties`.`product_id` = 1) AND ((`seasons`.user_id = 1)) ORDER BY name Variety Load (0.5ms) SELECT DISTINCT `varieties`.* FROM `varieties` INNER JOIN `seasons` ON `varieties`.id = `seasons`.variety_id WHERE (`varieties`.`product_id` = 43) AND ((`seasons`.user_id = 1)) ORDER BY name Ok, so everything above is the previous version which was working great. In the new version, I added some columns to the join table called seasons, and made a bunch of custom methods that query those columns. As a result, I made the following changes to the view code that you saw above so that I could access those methods on the seasons model: <% @user.seasons.by_product_name.each do |season| %> <%= link_to season.product.name, season.product %> #Note: I couldn't get this loop to work at all, so I settled for the following: #<% @user.varieties.find_all_by_product_id(product.id).each do |variety| %> <%=h season.variety.name.capitalize %> <%end%> <%end%> Here's the log output for that: SQL (0.9ms) SELECT count(DISTINCT "products".id) AS count_products_id FROM "products" INNER JOIN "seasons" ON "products".id = "seasons".product_id WHERE (("seasons".user_id = 1)) Season Load (1.8ms) SELECT "seasons".* FROM "seasons" INNER JOIN "products" ON "products".id = "seasons".product_id WHERE ("seasons".user_id = 1) AND ("seasons".user_id = 1) ORDER BY products.name Product Load (0.7ms) SELECT * FROM "products" WHERE ("products"."id" = 43) ORDER BY products.name CACHE (0.0ms) SELECT "seasons".* FROM "seasons" INNER JOIN "products" ON "products".id = "seasons".product_id WHERE ("seasons".user_id = 1) AND ("seasons".user_id = 1) ORDER BY products.name Product Load (0.4ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name Variety Load (0.4ms) SELECT * FROM "varieties" WHERE ("varieties"."id" = 2) ORDER BY name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name Variety Load (0.4ms) SELECT * FROM "varieties" WHERE ("varieties"."id" = 8) ORDER BY name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name Variety Load (0.4ms) SELECT * FROM "varieties" WHERE ("varieties"."id" = 7) ORDER BY name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 43) ORDER BY products.name CACHE (0.0ms) SELECT count(DISTINCT "products".id) AS count_products_id FROM "products" INNER JOIN "seasons" ON "products".id = "seasons".product_id WHERE (("seasons".user_id = 1)) CACHE (0.0ms) SELECT "seasons".* FROM "seasons" INNER JOIN "products" ON "products".id = "seasons".product_id WHERE ("seasons".user_id = 1) AND ("seasons".user_id = 1) ORDER BY products.name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name CACHE (0.0ms) SELECT * FROM "varieties" WHERE ("varieties"."id" = 8) ORDER BY name I'm having two problems: (1) The :uniq option is not working for products. Three distinct versions of the same product are displaying on the page. (2) The :uniq option is not working for varieties. I don't have validation set up on this yet, and if the user enters the same variety twice, it does appear on the page. In the previous working version, this was not the case. The result I need is that only one product for any given ID displays, and all varieties associated with that ID display along with such unique product. One thing that sticks out to me is the sql call in the most recent log output. It's adding 'count' to the distinct call. I'm not sure why it's doing that or whether it might be an indication of an issue. I found this unresolved lighthouse ticket that seems like it could potentially be related, but I'm not sure if it's the same issue: https://rails.lighthouseapp.com/projects/8994/tickets/2189-count-breaks-sqlite-has_many-through-association-collection-with-named-scope I've tried a million variations on this and can't get it working. Any help is much appreciated!

    Read the article

  • php pdo connection scope

    - by Scarface
    Hey guys I have a connection class I found for pdo. I am calling the connection method on the page that the file is included on. The problem is that within functions the $conn variable is not defined even though I stated the method was public (bare with me I am very new to OOP), and I was wondering if anyone had an elegant solution other then using global in every function. Any suggestions are greatly appreciated. CONNECTION class PDOConnectionFactory{ // receives the connection public $con = null; // swich database? public $dbType = "mysql"; // connection parameters // when it will not be necessary leaves blank only with the double quotations marks "" public $host = "localhost"; public $user = "user"; public $senha = "password"; public $db = "database"; // arrow the persistence of the connection public $persistent = false; // new PDOConnectionFactory( true ) <--- persistent connection // new PDOConnectionFactory() <--- no persistent connection public function PDOConnectionFactory( $persistent=false ){ // it verifies the persistence of the connection if( $persistent != false){ $this->persistent = true; } } public function getConnection(){ try{ // it carries through the connection $this->con = new PDO($this->dbType.":host=".$this->host.";dbname=".$this->db, $this->user, $this->senha, array( PDO::ATTR_PERSISTENT => $this->persistent ) ); // carried through successfully, it returns connected return $this->con; // in case that an error occurs, it returns the error; }catch ( PDOException $ex ){ echo "We are currently experiencing technical difficulties. We have a bunch of monkies working really hard to fix the problem. Check back soon: ".$ex->getMessage(); } } // close connection public function Close(){ if( $this->con != null ) $this->con = null; } } PAGE USED ON include("includes/connection.php"); $db = new PDOConnectionFactory(); $conn = $db->getConnection(); function test(){ try{ $sql = 'SELECT * FROM topic'; $stmt = $conn->prepare($sql); $result=$stmt->execute(); } catch(PDOException $e){ echo $e->getMessage(); } } test();

    Read the article

  • pdo connection scope

    - by Scarface
    Hey guys I have a connection class I found for pdo. I am calling the connection method on the page that the file is included on. The problem is that within functions the $conn variable is not defined even though I stated the method was public (bare with me I am very new to OOP), and I was wondering if anyone had an elegant solution other then using global in every function. Any suggestions are greatly appreciated. CONNECTION class PDOConnectionFactory{ // receives the connection public $con = null; // swich database? public $dbType = "mysql"; // connection parameters // when it will not be necessary leaves blank only with the double quotations marks "" public $host = "localhost"; public $user = "user"; public $senha = "password"; public $db = "database"; // arrow the persistence of the connection public $persistent = false; // new PDOConnectionFactory( true ) <--- persistent connection // new PDOConnectionFactory() <--- no persistent connection public function PDOConnectionFactory( $persistent=false ){ // it verifies the persistence of the connection if( $persistent != false){ $this->persistent = true; } } public function getConnection(){ try{ // it carries through the connection $this->con = new PDO($this->dbType.":host=".$this->host.";dbname=".$this->db, $this->user, $this->senha, array( PDO::ATTR_PERSISTENT => $this->persistent ) ); // carried through successfully, it returns connected return $this->con; // in case that an error occurs, it returns the error; }catch ( PDOException $ex ){ echo "We are currently experiencing technical difficulties. We have a bunch of monkies working really hard to fix the problem. Check back soon: ".$ex->getMessage(); } } // close connection public function Close(){ if( $this->con != null ) $this->con = null; } } PAGE USED ON include("includes/connection.php"); $db = new PDOConnectionFactory(); $conn = $db->getConnection(); function test(){ try{ $sql = 'SELECT * FROM topic'; $stmt = $conn->prepare($sql); $result=$stmt->execute(); } catch(PDOException $e){ echo $e->getMessage(); } } test();

    Read the article

  • Unable to assign command output to a variable

    - by Harish Maralihalli
    I am trying to assign the latest file name obtained from the below ls command but getting some error, it would be very nice if someone can answer how can I fix this! fn=`ls -lrt pur_bom_interface_daily*.log | cut -c59-102 | tail -1` or fn=$(ls -lrt pur_bom_interface_daily*.log | cut -c59-102 | tail -1) Error got: ls: 0653-341 The file pur_bom_interface_daily*.log does not exist Note: pur_bom_interface_daily*.log I am using * since there are multiple files starting their name with pur_bom_interface_daily and concatanated with the date on which they have got created.

    Read the article

  • PSEXEC - PATH VARIABLE NOT FOUND

    - by Magesh
    Hi, I use the PSEXEC to start the java process in local machine. When I run the PSEXEC without any user account it works fine. c:/psexec java testclass But when I run with an user account c:psexec -u user -p password java test It gives me the below error PsExec could not start java: The system cannot find the file specified I checked the environemt variable for the the above user and the PATH variable has been properly mapped to the java path. Could any one help me to resolve this issue.

    Read the article

  • Addressing a variable in VB

    - by Jeff
    Why doesn't Visual Basic.NET have the addressof operator like C#? In C#, one can int i = 123; int* addr = &i; But VB has no equivalent counter part. It seems like it should be important. UPDATE Since there's some interest, Im copying my response to Strilanc below. The case I ran into didnt necessitate pointers by any means, but I was trying to trouble shoot a unit test that was failing and there was some confusion over whether or not an object being used at one point in the stack was the same object as an object several methods away.

    Read the article

  • CSS variable height columns [migrated]

    - by Rob
    I have created a website, www.unionfamilies.com. I have a header, a main section consisting of two columns, and a footer. Currently, I have specified heights for header, main, footer, etc. I would like to make the site so the header stays on top, the columns adjust to match the height of the longest column, and the footer stays at the bottom. Can someone help me with this? I am new to CSS, so please be patient. Thank you.

    Read the article

  • Toon/cel shading with variable line width?

    - by Nick Wiggill
    I see a few broad approaches out there to doing cel shading: Duplication & enlargement of model with flipped normals (not an option for me) Sobel filter / fragment shader approaches to edge detection Stencil buffer approaches to edge detection Geometry (or vertex) shader approaches that calculate face and edge normals Am I correct in assuming the geometry-centric approach gives the greatest amount of control over lighting and line thickness, as well eg. for terrain where you might see the silhouette line of a hill merging gradually into a plain? What if I didn't need pixel lighting on my terrain surfaces? (And I probably won't as I plan to use cell-based vertex- or texturemap-based lighting/shadowing.) Would I then be better off sticking with the geometry-type approach, or go for a screen space / fragment approach instead to keep things simpler? If so, how would I get the "inking" of hills within the mesh silhouette, rather than only the outline of the entire mesh (with no "ink" details inside that outline? Lastly, is it possible to cheaply emulate the flipped-normals approach, using a geometry shader? Is that exactly what the GS approaches do? What I want - varying line thickness with intrusive lines inside the silhouette... What I don't want...

    Read the article

  • wordpress woocommerce php variable usage %1$s

    - by tech
    I am using wordpress with woocommerce and I am trying to manipulate a copy of myaccount.php The default code uses some variables of some sort that I am not familiar with nor have I been able to find documentation on. The variables in question are %1$s, %2$s and %s <p class="myaccount_user"> <?php printf( __( 'Hello <strong>%1$s</strong> (not %1$s? <a href="%2$s">Sign out</a>).', 'woocommerce' ) . ' ', $current_user->display_name, wp_logout_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) ); ?> <?php printf( __( 'From this page you can view your recent orders, manage your shipping and billing addresses and <a href="%s">edit your password and account details</a>.', 'woocommerce' ), wc_customer_edit_account_url() ); ?> </p> How can I identify the variables, what they represent and how to use them? Thank you.

    Read the article

  • Overlap of the variable in mysql, my column are set to my query result

    - by foodil
    The question is not clear , let me clarify it: try{ $sql = ' SELECT UserID <==== (***********Used here for query ******) FROM user WHERE Rights != ?'; $stmt = $conn->prepare($sql); $stmt->execute(array('admin')); $result= $stmt->fetchAll(); } catch(PDOException $e) { die ($e->getMessage().'<a href="add.php"> Back</a>'); } foreach ($result as $set) { if ($set['UserID']==$_SESSION['username']) $rights='edit'; else {$rights=$_POST[$set['UserID']];} if (($rights != 'default' || $set['UserID']==$_SESSION['username']) && $_POST['public']==0 ) { $user=$set['UserID']; try { $query="INSERT INTO user_list(UserID <==== (***********Used here for insert ******),ListID,UserRights) VALUES ($user,$lastID,$rights)"; $stmt = $conn->prepare($query); $stmt->execute(); } catch(PDOException $e) { die ($e->getMessage().'<a href="add.php"> Back</a>'); $conn->rollBack(); } } } As you can see the UserID is a query result but it is also the column i need to insert, so when i insert into the table it will casued an error SQLSTATE[42S22]: Column not found: 1054 Unknown column 'UserA_ID' in 'field list' because the column is modify by my query result from: $query="INSERT INTO user_list(UserID,ListID,UserRights) VALUES ($user,$lastID,$rights)"; to: $query="INSERT INTO user_list(query_result_id,ListID,UserRights) VALUES ($user,$lastID,$rights)"; How to fix it ?Thank you.

    Read the article

  • Cfengine Perform action based on variable value

    - by Daniel
    In cfengine, I have a variable that is set to the output of a command. Let say variable myoutput is set to "hi world". How can I execute a command based on the contents of myoutput. I would like to do something like this (sudo cfengine code): bundle agent test { vars: "myoutput" string => execresult("echo 'hi world';","noshell"); commands: myoutput=="hi world":: "/usr/bin/php myaction.php"; }

    Read the article

  • Linking one uniform variable to many shaders

    - by Winged
    Let's say, that I have 3 programs, and in each of those programs there is a view matrix uniform, which should be the same in all those programs. Right now, when my camera moves, I need to re-upload the modified matrix to every program separately. Is it possible to create some kind of global uniforms which are constant for all programs linked to it, so I could just upload the matrix once? I tried creating a globalUniforms object which looked kinda like this: var globalUniforms = { program: {}, // (...) vMatrixUniform: null, // (...) initialize: function() { vMatrixUniform = gl.getUniformLocation(this.program, 'uVMatrix'); } }; So I could just link it to proper programs like this: program.vMatrixUniform = globalUniforms.vMatrixUniform;, and then pass the matrix like this: if (camera.isDirty.viewMatrix !== false) { camera.isDirty.viewMatrix = false; gl.uniformMatrix4fv(globalUniforms.vMatrixUniform, false, camera.viewMatrix.element); } but unfortunately it throws an error: Uncaught exception: gl.INVALID_VALUE was caused by call to: getUniformLocation called from line 272, column 2 in () in mysite/js/mesh.js: vMatrixUniform = gl.getUniformLocation(this.program, 'uVMatrix'); Summing up: is there a more efficient way of managing shaders which follows my logic?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >