Search Results

Search found 8446 results on 338 pages for 'dynamic cast'.

Page 59/338 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • Constructing dynamic columns from parameters in Sybase

    - by Chapax
    Hi, I'm trying to write a stored proc (SP) in Sybase. The SP takes 5 varchar parameters. Based on the parameters passed, I want to construct the column names to be selected from a particular table. The below works: DECLARE @TEST VARCHAR(50) SELECT @TEST = "country" --print @TEST execute("SELECT DISTINCT id_country AS id_level, Country AS nm_level FROM tempdb..tbl_books INNER JOIN (tbl_ch2_bespoke_report INNER JOIN tbl_ch2_bespoke_rpt_mapping ON tbl_ch2_bespoke_report.id_report = tbl_ch2_bespoke_rpt_mapping.id_report) ON id_" + @TEST + "= tbl_ch2_bespoke_rpt_mapping.id_pnl_level WHERE tbl_ch2_bespoke_report.id_report = 14") but gives me multiple results: 1 1 row(s) affected. id_level nm_level 1 4376 XYZ 2 4340 ABC I would like to however only obtain the 2nd result. Do I need to necessarily use dynamic SQL to achieve this? Many thanks for your help. --Chapax

    Read the article

  • Scrambling URLS for dynamic data

    - by ggonsalv
    What is the best method to obfuscate the urls created in Dynamic Data? eg \Products\List.aspx?ProductId=2 could become \Products\List.aspx?x=UHJvZHVjdElkPTI= where "ProductId=2" is base 64 encoded to prevent casual snooping on \Products\List.aspx?ProductId=3 \Products\List.aspx?ProductId=4 etc...? I will probably have to inherit from an existing object and override some function The question is which object and what function GetActionPath of the Metamodel object seems interesting, but how does the DynamicRoute "{table}/{Action}.aspx" play in into it... Right now on Asp.net 1.1 site I use an custom implementation of the following code. http://www.mvps.org/emorcillo/en/code/aspnet/qse.shtml It is HTTPModule that uses regular expression to rewrite all the querystrings and also with reflection changes the Querystring collection with decoded values. So where is the hook to affect the change.

    Read the article

  • Determining if a .NET type is dynamic (created using Reflection.Emit)

    - by Diego Mijelshon
    While the .NET 4 framework provides the Assembly.IsDynamic method, that's not the case with .NET 2.0/3.5. The use case is simple: for logging purposes, I want to determine the underlying type name of an entity that might be wrapped by a dynamic proxy without having any references to NHibernate or Castle (which know about the proxy) For example, I might have a CatProxYadaYada, but I'm interested in Cat. What's the easiest way to get that type? I was thinking of this skeleton: var type = obj.GetType(); while (IsProxy_Dynamic_Whatever(obj)) type = type.BaseType; return type;

    Read the article

  • MVC Form and Dictionary Type

    - by Brian Schmitt
    I am attempting to use a property on my model that is of type Dictionary<string, string>. This dictionary is one of several other properties on the model, and I am using the dictionary as a key/value store to produce a 'dynamic' form. E.G.: User Name Settings A B I want to be able to submit and save any changes to settings A and B. I can submit the form and get my posted values in all my other fields, however the dictionary gets set to null. <%=Html.LabelFor(m => m.Name)%> <%=Html.DisplayFor(m => m.Name)%> <%=Html.LabelFor(m => m.Settings["A"])%> <%=Html.TextBoxFor(m => m.Settings["A"])%> <%=Html.LabelFor(m => m.Settings["B"])%> <%=Html.TextBoxFor(m => m.Settings["B"])%> Is there a better way to produce the dynamic form with a key/value pair? The actual code will be using partials (there several hundred variations), and the above is only a contrived example.

    Read the article

  • HTML + CSS dynamic render in flash?

    - by Ole Jak
    I have HTML + CSS text. I need some lib with simple function like "Render String Var conteining HTML" So no external files (like in flash lib called HTMLwraper you just have to play your SWF on top of HTML). dinamic! I give it string it renders It into some conteiner (not as a bitmab but as if it was real HTML dynamically rendered in flash). (And I need real HTML + CSS support not what normal rich text block gives us) I am going to use it in with Flex (Flash Builder) so I like MXML component model but even pure flash AS3 will workout. It should be Free and Opensource (any license like GPL, LGPL etc will be ok). So Is out there such flash\flex library for HTML + CSS dynamic rendering (rfom given String or XML)?

    Read the article

  • To call SelectMany dynamically in the way of System.Linq.Dynamic

    - by user341127
    In System.Linq.Dynamic, there are a few methods to form Select, Where and other Linq statements dynamically. But there is no for SelectMany. The method for Select is as the following: public static IQueryable Select(this IQueryable source, string selector, params object[] values) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); LambdaExpression lambda = DynamicExpression.ParseLambda(source.ElementType, null, selector, values); IQueryable result = source.Provider.CreateQuery( Expression.Call( typeof(Queryable), "Select", new Type[] { source.ElementType, lambda.Body.Type }, source.Expression, Expression.Quote(lambda))); return result; } I tried to modify the above code, after hours working, I couldn't find a way out. Any suggestions are welcome. Ying

    Read the article

  • Providing dynamic data to webpage

    - by Marius
    Hi, I have a web page that displays dynamic data which changes every 2 seconds. Data is selected from various data sources including Oracle. Currently, the page reloads every 10 seconds and runs a PHP script which retrieves the data and displays the page. I have other pages that gives a different view on the same data. This means the same query is run again for them as well. If I have 4 of these pages with 10 concurrent users each, suddenly the data retrieval happens 40 times every 10 seconds, obviously not ideal. I have some ideas on how to improve this situation, but I thought I would ask from some ideas from other experts that might have come across a similar situation. I'm not bound to PHP, and my server is on a Linux platform. Regards Marius

    Read the article

  • Providing dynamic data to webpage

    - by Marius
    Hi, I have a web page that displays dynamic data which changes every 2 seconds. Data is selected from various data sources including Oracle. Currently, the page reloads every 10 seconds and runs a PHP script which retrieves the data and displays the page. I have other pages that gives a different view on the same data. This means the same query is run again for them as well. If I have 4 of these pages with 10 concurrent users each, suddenly the data retrieval happens 40 times every 10 seconds, obviously not ideal. I have some ideas on how to improve this situation, but I thought I would ask from some ideas from other experts that might have come across a similar situation. I'm not bound to PHP, and my server is on a Linux platform. Regards Marius

    Read the article

  • Flash CS4/AS3 Dynamic Text Box

    - by Jono
    Hi, I have created a XML image gallery, which displays text in between each slide. Now I have created a movie clip with a dynamic text field (with Render HTML selected) to display the text from the XML which is pushed into an array. Now, this all works great BUT... /n or /r is not creating a new line break (as they need to be custom). Yet if I create an Array and manually push strings "Bla bla bla /n bla bla bla" I get a line break. I have tried converting the Array item to string (even though it already is), I would also avoid creating textField = new textField() any Ideas would be welcomed. Cheers

    Read the article

  • Using a dynamic number of checkboxes in a rails form

    - by TenJack
    I am trying to create a form with a dynamic number of checkboxes that each link to a string that is not a model number but is instead just a word. For examples: <% form_for(@words) do |f| %> <% ["apple","banana","orange"].each do |word| %> <%= f.check_box :word %> <%= f.submit %> <% end %> <% end %> So, if "apple" was checked, it would just send the string "apple" in the params. Anyone know how to do this?

    Read the article

  • Dynamic IMAP/Pop3 Email Address Creation

    - by Vadi
    I have a requirement in my project to create dynamic email address on the fly. For example, similar to flickr has the option of uploading photos (or blogger.com has an option of rececing blog posts in predefined email addresses). The email address can be like "[email protected]", once this email address is created what ever the incoming mails will be processed based on certain scenarios. My questions are: What are the solutions available for having our own IMAP/POP3 Server in Windows? Exchange is not an option though, any commercial softwares will do. Is there any way we can have one real email box and that will be masked with alphanumeric email addresss to minimize the creation of email addresses.

    Read the article

  • How to return a dynamic value from a Mocha mock in Ruby

    - by Vivek
    The gist of my problem is as follows:- I'm writing a Mocha mock in Ruby for the method represented as "post_to_embassy" below. It is not really our concern, for the purpose of describing the problem, what the actual method does. But I need the mock to return a dynamic value. The proc '&prc' below is executing rightly in place of the actual method. But the "with" method in Mocha only allows for boolean values to be returned. So the code below outputs nil. I need it to output the value being passed through orderInfoXml. Does anyone know of an alternate method I can use? require 'rubygems' require 'mocha' include Mocha::API class EmbassyInterface def post_to_embassy(xml) puts "This is from the original class:-" puts xml return xml end end orderInfoXml = "I am THE XML" mock = EmbassyInterface.new prc = Proc.new do |orderXml| puts "This is from the mocked proc:-" puts orderXml orderXml end mock.stubs(:post_to_embassy).with(&prc) mock_result = mock.post_to_embassy(orderInfoXml) p mock_result #p prc.call("asd") output:- This is from the mocked proc:- I am THE XML nil

    Read the article

  • Autocomplete and Dynamic Parameter Passing

    - by abcParsing
    The code below works fine using jQuery UI 1.8 and jQuery 1.4.2 $("#sid_entry_box").autocomplete( {source:"autocomplete_sid.php?database="+database_name, minLength:4, delay:1000, enable:true, cacheLength:1 }); The database name is passed as a get parameter of the php call. In this application, I have two databases selected by a radio button. Since jQuery loads and assigns this function when the document is loaded, the database name is whatever was checked at that momemnt. What I really need to pass to the php call is the following: database=$("input[name=rf_database_option]:checked").val(); Is ther ean easy to understand way to be able to pass a dynamic dom value?

    Read the article

  • Add Event Handler To Dynamic Dropdownlist

    - by Andrea Girardi
    Hi all! I have a page that contains dynamically generated Dropdown List controls and I want thant the dynamic dropdown list perform an AutoPostback to fill some other field using the value selected. This is the code I'm using to create dynamically the control: If (Not IsPostBack) Then Dim newDDL As DropDownList = New DropDownList() AddHandler newDDL.SelectedIndexChanged, AddressOf ChangeValue newDDL.ID = "Level1" [fill the DropDownList] newDDL.Items.Insert(results.Count, New ListItem("", -1)) newDDL.Width = "300" newDDL.AutoPostBack = True newDDL.SelectedIndex = results.Count LevelDDLs.Controls.Add(newDDL) LevelDDLs.Controls.Add(New LiteralControl("<br /><br />")) End If Control is correctly filled and rendered on ASP page but, after selecting a value, the page is reloaded (AutoPostBack is called) but the control is not diplayed and the sub is not called. I put a breakpoint into the ChangeValue sub but anything happens. I read on some post that handler for the first DropDownList is not necessary but, how is it possible to tell DropDownList to call my sub after changevalue? Could you help me, please? many thanks, Andrea

    Read the article

  • Dynamic/runtime method creation (code generation) in Python

    - by Eli Bendersky
    Hello, I need to generate code for a method at runtime. It's important to be able to run arbitrary code and have a docstring. I came up with a solution combining exec and setattr, here's a dummy example: class Viking(object): def __init__(self): code = ''' def dynamo(self, arg): """ dynamo's a dynamic method! """ self.weight += 1 return arg * self.weight ''' self.weight = 50 d = {} exec code.strip() in d setattr(self.__class__, 'dynamo', d['dynamo']) if __name__ == "__main__": v = Viking() print v.dynamo(10) print v.dynamo(10) print v.dynamo.__doc__ Is there a better / safer / more idiomatic way of achieving the same result?

    Read the article

  • Select dynamic string has a different value when referenced in Where clause

    - by David
    I dynamically select a string built using another string. So, if string1='David Banner', then MyDynamicString should be 'DBanne' Select ... , Left( left((select top 1 strval from dbo.SPLIT(string1,' ')) //first word ,1) //first character + (select top 1 strval from dbo.SPLIT(string1,' ') //second word where strval not in (select top 1 strval from dbo.SPLIT(string1,' '))) ,6) //1st character of 1st word, followed by up to 5 characters of second word [MyDynamicString] ,... From table1 Join table2 on table1pkey=table2fkey Where MyDynamicString <> table2.someotherfield I know table2.someotherfield is not equal to the dynamic string. However, when I replace MyDynamicString in the Where clause with the full left(left(etc.. function, it works as expected. Can I not reference this string later in the query? Do I have to build it using the left(left(etc.. function each time in the where clause?

    Read the article

  • Ho to add dynamic table list to a Fullcalendar page

    - by Dave Burton
    I have implemented a Fullcalendar on a RoR page. I would like to add a list (index) below the calendar showing events for the day the user selects. Click on a day and that days events list below the calendar. I'd like it to be dynamic (don't reload the whole page). Please point me in the right direction to learn how to do this. I have a subscription to Railscast. But, I'm not sure what to look for. Thanks

    Read the article

  • Detecting Infinite recursion in Python or dynamic languages

    - by drozzy
    Recently I tried compiling program something like this with GCC: int f(int i){ if(i<0){ return 0;} return f(i-1); and it ran just fine. When I inspected the stack frames the compiler optimized the program to use only one frame, by just jumping back to the beginning of the function and only replacing the arguments to f. And - the compiler wasn't even running in optimized mode. Now, when I try the same thing in Python - I hit maximum recursion wall (or stack overflow). Is there way that a dynamic language like python can take advantage of these nice optimizations? Maybe it's possible to use a compiler instead of an interpreter to make this work? Just curious!

    Read the article

  • Question on dynamic URL parsing

    - by jerebear
    I see many, many sites that have URLs for individual pages such as http://www.mysite.com/articles/this-is-article-1 http://www.mysite.com/galleries/575 And they don't redirect, they don't run slowly... I know how to parse URL's, that's easy enough. But in my mind, that seems slow and cumbersome on a dynamic site. As well, if the pages are all staticly built (hende the custom URL) then that means all components of the page are static as well... (which would be bad) I'd love to hear some ideas about how this is typically accomplished.

    Read the article

  • Sql Paging/Sorting - Efficent method with dynamic sort?

    - by dmose
    I'm trying to implement this style of paging: http://www.4guysfromrolla.com/webtech/042606-1.shtml CREATE PROCEDURE [dbo].[usp_PageResults_NAI] ( @startRowIndex int, @maximumRows int ) AS DECLARE @first_id int, @startRow int -- A check can be added to make sure @startRowIndex isn't > count(1) -- from employees before doing any actual work unless it is guaranteed -- the caller won't do that -- Get the first employeeID for our page of records SET ROWCOUNT @startRowIndex SELECT @first_id = employeeID FROM employees ORDER BY employeeid -- Now, set the row count to MaximumRows and get -- all records >= @first_id SET ROWCOUNT @maximumRows SELECT e.*, d.name as DepartmentName FROM employees e INNER JOIN Departments D ON e.DepartmentID = d.DepartmentID WHERE employeeid >= @first_id ORDER BY e.EmployeeID SET ROWCOUNT 0 GO This method works great, however, is it possible to use this method and have dynamic field sorting? If we change this to SELECT e.*, d.name as DepartmentName FROM employees e INNER JOIN Departments D ON e.DepartmentID = d.DepartmentID WHERE employeeid >= @first_id ORDER BY e.FirstName DESC It breaks the sorting... Is there any way to combine this method of paging with the ability to sort on different fields?

    Read the article

  • Dynamic scoping in Clojure?

    - by j-g-faustus
    Hi, I'm looking for an idiomatic way to get dynamically scoped variables in Clojure (or a similar effect) for use in templates and such. Here is an example problem using a lookup table to translate tag attributes from some non-HTML format to HTML, where the table needs access to a set of variables supplied from elsewhere: (def *attr-table* ; Key: [attr-key tag-name] or [boolean-function] ; Value: [attr-key attr-value] (empty array to ignore) ; Context: Variables "tagname", "akey", "aval" '( ; translate :LINK attribute in <a> to :href [:LINK "a"] [:href aval] ; translate :LINK attribute in <img> to :src [:LINK "img"] [:src aval] ; throw exception if :LINK attribute in any other tag [:LINK] (throw (RuntimeException. (str "No match for " tagname))) ; ... more rules ; ignore string keys, used for internal bookkeeping [(string? akey)] [] )) ; ignore I want to be able to evaluate the rules (left hand side) as well as the result (right hand side), and need some way to put the variables in scope at the location where the table is evaluated. I also want to keep the lookup and evaluation logic independent of any particular table or set of variables. I suppose there are similar issues involved in templates (for example for dynamic HTML), where you don't want to rewrite the template processing logic every time someone puts a new variable in a template. Here is one approach using global variables and bindings. I have included some logic for the table lookup: ;; Generic code, works with any table on the same format. (defn rule-match? [rule-val test-val] "true if a single rule matches a single argument value" (cond (not (coll? rule-val)) (= rule-val test-val) ; plain value (list? rule-val) (eval rule-val) ; function call :else false )) (defn rule-lookup [test-val rule-table] "looks up rule match for test-val. Returns result or nil." (loop [rules (partition 2 rule-table)] (when-not (empty? rules) (let [[select result] (first rules)] (if (every? #(boolean %) (map rule-match? select test-val)) (eval result) ; evaluate and return result (recur (rest rules)) ))))) ;; Code specific to *attr-table* (def tagname) ; need these globals for the binding in html-attr (def akey) (def aval) (defn html-attr [tagname h-attr] "converts to html attributes" (apply hash-map (flatten (map (fn [[k v :as kv]] (binding [tagname tagname akey k aval v] (or (rule-lookup [k tagname] *attr-table*) kv))) h-attr )))) (defn test-attr [] "test conversion" (prn "a" (html-attr "a" {:LINK "www.google.com" "internal" 42 :title "A link" })) (prn "img" (html-attr "img" {:LINK "logo.png" }))) user=> (test-attr) "a" {:href "www.google.com", :title "A link"} "img" {:src "logo.png"} This is nice in that the lookup logic is independent of the table, so it can be reused with other tables and different variables. (Plus of course that the general table approach is about a quarter of the size of the code I had when I did the translations "by hand" in a giant cond.) It is not so nice in that I need to declare every variable as a global for the binding to work. Here is another approach using a "semi-macro", a function with a syntax-quoted return value, that doesn't need globals: (defn attr-table [tagname akey aval] `( [:LINK "a"] [:href ~aval] [:LINK "img"] [:src ~aval] [:LINK] (throw (RuntimeException. (str "No match for " tagname))) ; ... more rules [(string? ~akey)] [] ))) Only a couple of changes are needed to the rest of the code: In rule-match?, when syntax-quoted the function call is no longer a list: - (list? rule-val) (eval rule-val) + (seq? rule-val) (eval rule-val) In html-attr: - (binding [tagname tagname akey k aval v] - (or (rule-lookup [k tagname] *attr-table*) kv))) + (or (rule-lookup [k tagname] (attr-table tagname k v)) kv))) And we get the same result without globals. (And without dynamic scoping.) Are there other alternatives to pass along sets of variable bindings declared elsewhere, without the globals required by Clojure's binding? Is there an idiomatic way of doing it, like Ruby's binding or Javascript's function.apply(context)?

    Read the article

  • Dynamic Spacer in ReportLab

    - by ptikobj
    I'm automatically generating a PDF-file with Platypus that has dynamic content. This means that it might happen that the length of the text content (which is directly at the bottom of the pdf-file) may vary. However, it might happen that a page break is done in cases where the content is too long. This is because i use a "static" spacer: s = Spacer(width=0, height=23.5*cm) as i always want to have only one page, I somehow need to dynamically set the height of the Spacer, so that it takes the "rest" of the space that is on the page as its height. Now, how do i get the "rest" of height that is left on my page?

    Read the article

  • Dynamic Linq query issue

    - by Alex
    Hey All, Im trying to query the Netflix OData feed. I have the following query that works fine in LinqPad: from g in Genres from t in g.Titles where g.Name == "Horror" && t.AverageRating == 2 && t.ReleaseYear == 2004 select t But, when I move it over to my Silverlight app, the user selects what to search on so I may or may not have all of the params. That being the case, I need to construct the query at runtime. Ive looked the the Dynamic Query stuff and that will do fine...the issue that I have is that I need an initial acceptable query to append to and this doesn't fly: from g in Genres from t in g.Titles select t; Any additional thoughts would be appreciated. Thanks in advance

    Read the article

  • How to implement dynamic queries for MNesia?

    - by Kerem
    I'm trying to implement a function that generates dynamic queries for MNesia. For example, when function is called with these arguments; dyn_query(list, person, [name, age], ["jack", 21]) I want to query MNesia to list items whose name is "jack" and age is 21 in person table. I've tried to implement this by using qlc:q(ListComprehension) and qlc:string_to_handle("ListComprehension"). First failed because of compile errors, compiler didn't let me to use functions instead of ListComprehentions and variables instead of record names like "Item#Table.Member". Second failed, because erl_eval couldn't handle records and throwed exceptions like {undefined_record, person}. Which method should I use? How could i solve these problems? Or should I use a different method? Thanks.

    Read the article

  • [PHP.ini] Can't load mcrypt.dll dynamic library.

    - by Kel
    Hey guys, I'm trying to load this module: php_mcrypt.dll' Everything in the php.ini file is correct, see for yourself: extension_dir = "C:/PHP/5.2.13/ext" extension=php_mcrypt.dll The file exists in this path. And other modules are in there as well and are loaded successfully. It only has a problem with this particular module. I have a 64bit Windows XP, Apache 2.2, PHP 5.2.13... But i get this warning (error.log of Apache): PHP Warning: PHP Startup: Unable to load dynamic library 'C:/PHP/5.2.13/ext\php_mcrypt1.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP itself is working fine. But one of our applications needs this module and it throws me this ugly error. Why on earth does it show me two backslashes in the log file?

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >