w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
on click is behaving somewhat like a for each... Hard to explain
You are probably adding the event for every item on your page. But the event code as you wrote it applies to all items, meaning that each item gets N times the same event, where N is the number of items you added.

Categories : Jquery

CORS request structure is hard to follow, can you help explain it more?
I suggest going through the MDN Documentation: https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS Both theory and practical examples are explained.

Categories : Javascript

How to creating ctypes variables using python variables instead of hard-coded values?
The field attributes of a Structure are CField descriptor objects. A descriptor is like a Python property or like a __slots__ attribute, if you're familiar with either of those. A CField knows the data type of the field and its offset into the buffer. Each C data type has a associated get/set function that converts to and from Python objects. So generally you can assign a Python object directly to the field. For example: thresholds = [1, 0.9, 0.8, 0.7] c_parameters = Params( var1 = 100, var2 = 4, var3 = 5, var4 = 5000, var5 = "modelname", var6 = 0.5, var7 = 90, var8 = (C.c_double * 4)(*thresholds), var9 = 2, H = Good('H', 0.5, 100, 20), L = Good('L', 0.5, 75, 20), ) If ctypes needs to hold a reference to a Python object to keep it alive,

Categories : Python

How can launch title bar and dummy button when Menu hard key is pressed instead of touching screen?
If I understand your situation right, you shouldn't add a OnClickListener to your contentView. This makes title bar and dummy button show up when the screen is touched. Instead you should overwrite public boolean onKeyDown(int keyCode, KeyEvent event) and do the following: if (keyCode == KeyEvent.KEYCODE_MENU) { // put your onClickListener code here return true; } EDIT: I changed your code on pastie. http://pastie.org/8221961 I deleted your onClickListener for the content view, since you don't want to go fullscreen when the screen is touched. Then I overwrote the onKeyDown method to handle the menu button. I just pasted the code from the onClickListener into this method, since you want it to do the same thing. I marked the lines where I added/removed code in the pas

Categories : Java

Deleting files using vbs without hard coding variables
Your cscript command looks ok. Then, add this to your vbscript to capture the arguments location = WScript.Arguments.Item(0) date-stamp = WScript.Arguments.Item(1) extension = WScript.Arguments.Item(2) Note, they are all strings, so you will need to parse your date value to an actual date.

Categories : Vbscript

dynamic query returning parameter giving hard time
You missed to supply @Count parameter as a part of sp_executesql call (note that in this case it should be marked OUTPUT as well): ... EXECUTE sp_executesql @SQL, N'@Count int OUTPUT', @Count OUTPUT SELECT @Count The second pararmeter in the sp_executesql call is the query parameters definition, or so called formal parameters (in your case there is single parameter N'@Count int OUTPUT'). If query is parameterized, then what should go after (the third and subsequent parameters) are so called actual parameters. Below samples may explain better: -- sample query #1 -- will fail, because of query is pararmeterized, -- and actual pararmeter is not provided EXEC sp_executesql N'SELECT @Num', N'@Num int'; -- sample query #2 -- formal parameter is @Num of type int -- actual parameter is lite

Categories : Sql Server

can anyone explain where the constants or const variables stored?
There is a difference between string literals and primitive constants. String literals are usually stored with the code in a separate area (for historical reasons this block is often called the "text block"). Primitive constants, on the other hand, are somewhat special: they can be stored in the "text" block as well, but their values can also be "baked" into the code itself. For example, when you write // Global integer constant const int a = 10; int add(int b) { return b + a; } the return expression could be translated into a piece of code that does not reference a at all. Instead of producing binary code that looks like this LOAD R0, <stack>+offset(b) LOAD R1, <address-of-a> ADD R0, R1 RET the compiler may produce something like this: LOAD R0, <stack>+offset

Categories : C++

slidify layouts: title-only, title-and-body, title-and-two-cols, title caption, and blank
Slide layouts are mustache templates that can make use of objects returned by the parser. You can find a list of objects returned by the parser here. Coming to the question raised, here is how one would go about building the layouts for the slides. Title Only <slide class="segue nobackground {{ slide.class }}" id="{{ slide.id }}"> <hgroup> {{{ slide.header }}} </hgroup> </slide> The two column layout inherits from the parent layout, and the column widths are configurable. Two Columns --- layout: slide replace: slide.content --- {{{ slide.content }}} <div class='left' style='float:left;width:{{{ slide.left.w }}}'> {{{ slide.left.html }}} </div> <div class='right' style='float:right;width:{{{ slide.right.w }}}'> {{{ slide.right

Categories : R

PHP dynamic title
Looks like you have your variable websitetitle in $_REQUEST wrong ??? As I don't "believe" you can pass the value of a "submit". <fieldset> <legend style='width:500px;'><h3>Website Title</h3></legend> <label><h4> Change Website Title </h4></label> <form action='Config.php' method='POST'> <input type='text' name='websitetitle' placeholder='Website Title'/> <br /> <input type='submit' value='Update' class='btn btn-small btn-primary' name='update'> </form> </fieldset> Then <?php if(isset($_REQUEST['websitetitle'])) { $title=strip_tags(stripslashes($_REQUEST['websitetitle'])); } Then <title><?php include 'Config.php'; echo $title; ?> </title>

Categories : PHP

Is it possible to have a dynamic linkTo title attribute?
Based on @guleria's comment and for the sake of having this question answered I'll provide an answer. {{#linkTo "route" model titleBinding=model.title}}model.title{{/linkTo}} Providing Binding as a suffix to your properties will enable bindings. As for where this is documented, here an extract of the documentation: Properties ending in a Binding suffix will be converted to Ember.Binding instances. The value of this property should be a string representing a path to another object or a custom binding instanced created using Binding helpers. Hope it helps.

Categories : Ember Js

Dynamic Title of page? PHP include links?
To output the return value of your function in the title tags just put it this way : <title><?php echo findCurrentPageURL(); ?></title> in a php page. Also to split it as you want, see Orangepill comment to the question, linking your question to Split camelCase word into words with php preg_match (Regular Expression) .

Categories : PHP

Dynamic title with submit form (wordpress)
You can get the current page title by using post_title and can put it in a hidden field. Something like below <input type="hidden" id="job_title" name="job_title" value="<?php echo $post->post_title; ?>"/> On the submitted page: $jobtitle = $_REQUEST['job_title']; // and you can mail this by using mail() function

Categories : Wordpress

Highcharts title text with two dynamic dates
I made a fiddle for you: http://jsfiddle.net/96AhK/ $(function () { var valdt1 = 'T1'; //<%=request.getParameter("T1") %> var valdt2 = 'T2'; //<%=request.getParameter("T2") %> chart = new Highcharts.Chart( { chart: { renderTo: 'PIE', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false, type: 'pie'}, title: { text: 'Database Status From ' + valdt1 +' To ' + valdt2, style: {fontSize: '10px'} }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 21

Categories : Jsp

php session variables being echoed in title but not in og meta. Timing issue?
How are you setting your $_SESSION["clientName"]? Facebook scrapes your link and cache meta data of your link. I guess facebook is not able to set your session data $_SESSION['clientName']. Are you setting that session data according to user login or something that user action have chosen? If that is case facebook will not be able to set that for you. you can try this while generating sharing link: your clientName sharing link can be this http://yoursite.com/?clientName=<?php echo $_SESSION['clientName'];?> and in your site you can do: <meta property="og:description" content="<?php echo $_GET["clientName"]; ?>"/> Add validations on $_GET["clientName"] as required.

Categories : PHP

PHP variables in dynamic CSS
I believe the problem is not what you're describing. So long as style.php is accessed via http, then the $_SERVER variables will be set. There is, however, some syntax error in the code you described: if($url == "this") $style = "blue"; else( $style = "red"; ) // Incorrect syntax The right way to write that would be: if ($url == "this") { // $url will _never_ be "this" $style = "blue"; } else { $style = "red"; } Edit: There's some funky code when evaluating the MySQL results: $row_rsTheme = mysql_fetch_assoc($rsTheme); $totalRows_rsTheme = mysql_num_rows($rsTheme); if($totalRows_rsTheme == 1){ // sucessful match, but ONLY if there's only one row ... } You should replace it with: if($row_rsTheme = mysql_fetch_assoc($rsTheme)){ // sucessful match ... } That way

Categories : PHP

dynamic variables in preg_replace in PHP
/[(.*)]/ does not escape the [ or ], and would match essentially everything if it did. Use /[(.*?)]/. Additionally, you need to strtolower the matched inner value. $template = "[FIRSTNAME] say hello to [NAME]"; $replacements = array( 'user_name' => 'myname', 'user_firstname' => 'myfirstname', ); $result['texte'] = preg_replace_callback('/[(.*?)]/', function ($match) use ($replacements) { return $replacements["user_" . strtolower($match[1])]; }, $template)

Categories : PHP

Dynamic variables in perl
If I understand you correctly, you need to locally override a global variable inside a function. package my_package; our $verbose = 0; sub function { my ($arg1, $arg2) = @_; # getting function arguments. local $verbose = $arg1; } It will restore old state of $verbose on return.

Categories : Perl

Dynamic Charts with Variables on Two Axes
I couldn't get this to work either, using the SERIES formula. Then again, I suppose it is considered an undocumented feature. However, if you edit using the Select Data dialog then it works.

Categories : Excel

JS: Storing dynamic variables across pages?
Welcome to stackoverflow! I don't really know about those plugins, but at the low level they are probably using localStorage or sessionStorage (that I think is better for your problem, as it gets cleared everytime you restart the browser, opposed to localStorage, that is permanent unless the user clears it). Your problem has a pretty easy solution, although I don't understand it fully without seeing a little code. But more or less I'd recommend you to, as you dynamically generate the fields, pre-fill them with values stored upon submitting, that is (assuming you use jquery): function generateFields(index) { $("<input/>") .attr("id","username_"+index) .val(getFieldValue("username_"+index)) .change(function() { setFieldValue("user

Categories : Javascript

less css calling dynamic variables from a loop
Why don't you use them in your CSS file? Why are you trying them in your File? its not a great idea. Using the CSS for each DIV will be good. Give it a class with the code Like: <div class='@if(condition == true) {"thisclass"} else {"thatclass"}'></div> And just use one CSS for all the conditions. That would be simple.

Categories : CSS

Why simply use PHP variables for dynamic stylesheets?
Am I overlooking some serious problems by doing it this way? I host all static assets on a CDN, which you should too. CDNs don't do PHP. Also: caching, runtime performance, minification

Categories : PHP

How to access a javascript object's property, when it has a dynamic number as property title?
There is example, how you can access to properties of your object with loop: http://jsfiddle.net/Y7mHB/ var names = { 15: '15', 117: '117' }; for(var key in names) { alert(key + ' ' + names[key]); }

Categories : Javascript

Golang dynamic amount of bind variables
Your second attempt was close to success. Build a, say var foo []interface{} containing all arguments and pass it as Bind(foo...) See also Passing arguments to ... parameters

Categories : Mysql

MySQL Join two tables with dynamic variables
You have things all over the place, I haven't tested this but it should work ... SELECT * FROM (SELECT *, MATCH(name) AGAINST('*McDonalds*' IN BOOLEAN MODE) AS `score_name_0`, MATCH(`city`) AGAINST('McDonalds*' IN BOOLEAN MODE) AS `score_city_0`, (3959 * acos(cos( radians(".$lat.")) * cos(radians(pinpoints.lat)) * cos(radians(pinpoints.lng) - radians(".$long.")) + sin( radians(".$lat.")) * sin(radians(pinpoints.lat)))) AS distance FROM `stores` JOIN pinpoints ON stores.id=pinpoints.id WHERE stores.id=pinpoints.id AND (MATCH(name) AGAINST('*McDonalds*' IN BOOLEAN MODE) OR MATCH (`city`) AGAINST('McDonalds*' IN BOOLEAN MODE)) ) AS tmp_tbl WHERE distance < 25 ORDER BY distance ASC, (`score_namn_0` + `score_s

Categories : PHP

Using dynamic variables to pass in custom objects
I see you're only using the ToString() method of a element. Why not pass a IEnumerable< string> into it? public void pageCheck(SiteData site, IEnumerable<string> pageObj, int lowAssignedScore, int highAssignedScore, int totalScore) Usage: pageCheck(site, page.H1s.Select(item => item.ToString()), 4, 6, totalScore); pageCheck(site, page.AltTags.Select(item => item.ToString()), 4, 6, totalScore); I'll always try to avoid dynamics, unless there's no other option.

Categories : C#

Retrieve object variables with dynamic key strings
Replace this : $desiredKeyArrayPart = "[courses][lessons][lesson_name_required]"; $desiredKeyAttributePart = "required"; $desiredKey = $desiredKeyAttributePart . $desiredKeyArrayPart; // Get the value (Should return 1) $desiredValue = $myObj->$desiredKey; By this : $desiredValue = $myObj->required['courses']['lessons']['lesson_name_required']; The way you were trying to do it will not work. Also, quoting the array values is preferable to avoid warnings.

Categories : PHP

Dynamic Variables in Admin Tool in Ruby on Rails
You can use gsub to replace your wildcard with the actual content when you pull it out from the db. http://www.ruby-doc.org/core-1.9.3/String.html#method-i-gsub str = "{{location.title}} is a cool place" str.gsub!('{{location.title}}', 'foo') # "foo is a cool place"

Categories : Ruby On Rails

Dynamic method creation - define_singleton_method not using expected variables
Solution You need to create a copy of the frame object before manipulating it in in_frame. def in_frame(identifier, frame=[], &block) frame = frame.dup << identifier block.call(frame) end Explanation The behaviour you observe is perfectly valid, when you follow object identities. So let's follow the frame object on it's journey :) 1 def initialize 2 in_frame(:id => 'first_frame') do |frame| 3 add_method "bar", {:frames => frame} 4 in_frame({:id => 'second_frame'}, frame) do |frame| 5 #do absolutely nothing 6 end 7 end 8 end In line 1 we call in_frame with the arguments :id => 'first_frame', and implicitly frame=[]. Here frame is given birth as a new array to which :id => 'first_frame' is appended. At the beginning of line 3 our fr

Categories : Ruby

How do I create a dynamic list of variables for a GAE datastore query?
for i in range(1, fup + 1): i = str(i) followup = 'fu' + i + '_email_sent' fuemailsent_list.append(followup) fu_check = part.followup Means you are trying to access an attribute called 'followup'. with line fu_check = part.followup. To use the name stored in the variable followup use getattr fu_check = getattr(part,followup)

Categories : Google App Engine

Passing in Dynamic Number of "Variables" to Datomic API Functions
Ok, I got this solved over on the Datomic Google Groups (see here). Basically, fig.1 works. And also, I'm able to run the generated code (fig.2) without the dreaded quoting. Hope this helps others. (datomic.api/q '{:find [?e] :in [$ [?title ?content-type]] :where [[?e :posts/title ?title] [?e :posts/content-type ?content-type]]} (datomic.api/db conn) ["t" "c/t"]) fig.1 (datomic.api/q expression-intermediate-0 (datomic.api/db conn) (into [] param-values)) fig.2

Categories : Clojure

Rails dynamic routing to different instance variables of controller
your link is not redirecting to your instance, its redirecting to your action. so you have to define a new method for new link_to that, and define your @men_clothing_tshirt object in that method like this: def your_method @men_clothing_tshirt=Category.find_by_name("clothes").sub_categories.find_by_name("t-shirt").products end and in your link_to redirect to your_method: link_to "Tshirt", your_method_path Hope it will help.Thanks

Categories : Ruby On Rails

SHOW COLUMNS, Dynamic variables, INSERT INTO.. implode?
You should seriously think about changing your database structure. It is not a good idea to dynamically add columns to a table in a running database applcation. Your request is not an unusual one, but in most cases people solve the problem by having one column specifying the actual application and then a few more where they put in the information regarding the chosen application (in form of char, integer odr date fields). This has the advantage of keeping the table structure small and manageable but being very flexible at the same time. Tables with too many (mostly unused) columns are considered ugly or messy because they slow down your SQL server unnecessarily. So, maybe something like the following might help you: CREATE TABLE applications (apid int auto_increment PRIMARY KEY, apname

Categories : PHP

Truncating table before dynamic SQL with looping variables inside of one function
CREATE OR REPLACE FUNCTION dwh.dim_table_notification() RETURNS void LANGUAGE plpgsql AS $func$ DECLARE myschema text; BEGIN -- truncate simply goes here: TRUNCATE dwh.prod_table_notify; FOR myschema IN SELECT quote_ident(table_schema) FROM information_schema.tables WHERE table_name IN ('dim_loan_type', 'dim_acct_type') AND table_schema NOT LIKE 'pg_%' AND table_schema NOT IN ('information_schema', 'ad_delivery', 'dwh', 'users', 'wand', 'ttd') ORDER BY table_schema LOOP EXECUTE ' INSERT INTO dwh.prod_table_notify (userid, acct_type_id, acct_type, acct_type_desc, loan_type) SELECT '''|| myschema ||''', loan_type_id, loan_type::varchar(10) , loan_type_desc::varchar(50), term_code, 1 AS loan_type FROM '|| myschem

Categories : SQL

ColdFusion 10 CFCHART, how to pass dynamic variables via JavaScript API method?
You're passing a JSON string to handle.exec, which is turned into a JS object in a different place to where your x variable is defined, and thus causing the error. Instead, let x be resolved as part of the string and it should work: handle.exec( ... , '{"plotindex": 0, "values": ['+x+']}');

Categories : Javascript

Dynamic LINQ to Entities, how to build query based on variables
If you only need AND logic you could just call .Where() repeatedly for every attribute that requires searching on. if(title != null) query = query.Where(x=>x.Title == title); if(genre != null) query = query.Where(x=>x.Genre == genre); If your query is always of a certain structure and you want to ignore null search values you could do one big query but short circuit the attribute comparison with null checks. query = query.Where(s => ( ((title1 == null || s.Title.Contains(title1)) && (episodeTitle1 == null || s.EpisodeTitle.Contains(episodeTitle1)) || ((title2 == null || s.Title.Contains(title2)) && (episodeTitle2 == null || s.EpisodeTitle.Contains(episodeTitle2)))) ); However if you need full control over the query the

Categories : C#

Reference variables in a separate less file using SquishIt (support dynamic LESS content)?
You are right, SquishIt does the less processing before combining files. There is no way to do what you ask using only SquishIt, but I suppose you could combine the files on your own on the way in (use the .AddString method to add your resulting .less content to the bundle). One of the alternatives may suit your needs better, I'm not sure.

Categories : CSS

dynamically apply title of html document into the title fields of images
var title = document.title; $('.sth').attr('title',title); Edit, but I don't really see the point of doing this. The title of the site has little to do with the images, if it's added to all of them, what is the point anyways?

Categories : PHP

Javascript Slider title replace html for title just working on 1st item
I found a couple of issues with your script, but first you have invalid markup in your page since you have multiple <div> elements with the same ids of tbtit and tbdescp. Id attributes should be unique in a HTML page so should change those to classes instead. Now in your script you need to change the part where you retrieve the values of the title and the description of the image that is hovered to reference the sibling elements: //THIS var tbtit = $("#tbtit").html(); var tbdesc = $("#tbdescp").html(); //SHOULD NOW BE THIS var tbtit = $(this).siblings('.tbtit').text(); var tbdesc = $(this).siblings('.tbdescp').text(); Finally when you update the text for your main image you want to set the content for your <h4> and <p> tags and not replace them completely, so use .t

Categories : Javascript

Reading dynamic/changing data from multiple threads without locks? Can it cause a crash? Or just corrupted variables?
Reading and writing to same data objects from multiple threads gives you Undefined Behavior and Undefined behavior does not mandate a crash, it simply means that the program can show any behavior. Simply put you cannot rely on the behavior to be consistent because it is simply not mandated as per the standard. The only safe way to access such a object will be to ensure: Atomic & synchronized accesses through locks

Categories : C++

(javascript / google scripts) How to get the title of a page encoded with iso-8859-1 so that the title will display correctly in my utf-8 website?
Where are you displaying the content is more important. If you are writing it to a spreadsheet, then you have to change the settings of the spreadsheet to the correct language (French). In addition, you can use the advanced parameters to specify what charset the original content is in. For example, var result = UrlFetchApp.fetch( url , {contentType : 'text/html; charset=utf-8'}); var wholePage = result.getContentText(); var scrap = wholePage.match( /<title>(.*?)</title>/ ); var title = scrap[1];

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.