Search Results

Search found 4763 results on 191 pages for 'adams john'.

Page 104/191 | < Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >

  • Are Dynamic Prepared Statements Bad? (with php + mysqli)

    - by John
    I like the flexibility of Dynamic SQL and I like the security + improved performance of Prepared Statements. So what I really want is Dynamic Prepared Statements, which is troublesome to make because bind_param and bind_result accept "fixed" number of arguments. So I made use of an eval() statement to get around this problem. But I get the feeling this is a bad idea. Here's example code of what I mean // array of WHERE conditions $param = array('customer_id'=>1, 'qty'=>'2'); $stmt = $mysqli->stmt_init(); $types = ''; $bindParam = array(); $where = ''; $count = 0; // build the dynamic sql and param bind conditions foreach($param as $key=>$val) { $types .= 'i'; $bindParam[] = '$p'.$count.'=$param["'.$key.'"]'; $where .= "$key = ? AND "; $count++; } // prepare the query -- SELECT * FROM t1 WHERE customer_id = ? AND qty = ? $sql = "SELECT * FROM t1 WHERE ".substr($where, 0, strlen($where)-4); $stmt->prepare($sql); // assemble the bind_param command $command = '$stmt->bind_param($types, '.implode(', ', $bindParam).');'; // evaluate the command -- $stmt->bind_param($types,$p0=$param["customer_id"],$p1=$param["qty"]); eval($command); Is that last eval() statement a bad idea? I tried to avoid code injection by encapsulating values behind the variable name $param. Does anyone have an opinion or other suggestions? Are there issues I need to be aware of?

    Read the article

  • Trying to keep filled bars in a faceted plot

    - by John Horton
    Not sure what I'm doing wrong here. I have this plot: ggplot(data.PE5, aes(ybands,fill=factor(decide))) + geom_bar(position="dodge") which produces: Then I want to facet by a factor, creating two stacked plots w/ dodged, colored bars ggplot(data.PE5, aes(ybands,fill=factor(decide))) + geom_bar(position="dodge") + facet_grid(~group_label) However, I lose the factor-based coloring, which I want to keep:

    Read the article

  • Good book for learning Bourne shell?

    - by John Isaacks
    I want to learn how to write shell scripts. Particularly I want to write a svn post-commit script to upload files from a test server to a production server. I am sure I will want to write more as I get more into it. I have very little linux/unix knowledge. Can anyone recommend a good book?

    Read the article

  • how to return comma seperated values in oracle SP

    - by john
    If I have a simple query like: OPEN cursor FOR SELECT USER_ID FROM USER_TABLE WHERE USER_ID = V_SOME_USER; this will return records in different rows but how can I return the rows in the following format: 'userid1', 'userid2', 'userid3'.....'useridN' I want to do this because I want to send this off as a parameter to another stored procedure...Also, what is the limit on how big the string can be when passed to the SP as parameter

    Read the article

  • Image Gallery Manager for PHP and MySQL?

    - by John
    Can anyone recommend a plugin or library that allows people to upload images which automatically gets cropped and resized? I don't mind editting some config files to specify how images should be cropped and resized. Additionally, after uploading, the front end user should be able to drag and drop for re-ordering. Can someone recommend something that works with php?

    Read the article

  • generate php code from wsdl

    - by John Stewart
    I have a bunch of webservices that I need to write PHP clients for. Now I can manually write wrappers for each of the WSDL files but i wanted to see if there is a tool that can help me by generating the wrappers in PHP. Any idea if there are any tools that do this? Thanks

    Read the article

  • Multiprocessing vs Threading Python

    - by John
    Hello, I am trying to understand the advantages of the module Multiprocessing over Threading. I know that Multiprocessing get's around the Global Interpreter Lock, but what other advantages are there, and can threading not do the same thing?

    Read the article

  • GridView will not update underlying data source

    - by John Christensen
    So I'm been pounding on this problem all day. I've got a LinqDataSource that points to my model and a GridView that consumes it. When I attempt to do an update on the GridView, it does not update the underlying data source. I thought it might have to do with the LinqDataSource, so I added a SqlDataSource and the same thing happens. The aspx is as follows (the code-behind page is empty): <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=devsql32;Initial Catalog=Steam;Persist Security Info=True;" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [LangID], [Code], [Name] FROM [Languages]" UpdateCommand="UPDATE [Languages] SET [Code]=@Code WHERE [LangID]=@LangId"> </asp:SqlDataSource> <asp:GridView ID="_languageGridView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="LangId" DataSourceID="SqlDataSource1"> <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /> <asp:BoundField DataField="LangId" HeaderText="Id" ReadOnly="True" /> <asp:BoundField DataField="Code" HeaderText="Code" /> <asp:BoundField DataField="Name" HeaderText="Name" /> </Columns> </asp:GridView> <asp:LinqDataSource ID="_languageDataSource" ContextTypeName="GeneseeSurvey.SteamDatabaseDataContext" runat="server" TableName="Languages" EnableInsert="True" EnableUpdate="true" EnableDelete="true"> </asp:LinqDataSource> What in the world am I missing here? This problem is driving me insane.

    Read the article

  • creating matrix with probabilities

    - by John Chan
    Hi all, I want to generate a matrix of NxN to test some code that I have where each row contains floats as the elements and has to add up to 1 (i.e. a row with a set of probabilities). Where it gets tricky is that I want to make sure that randomly some of the elements should be 0 (in fact most of the elements should be 0 except for some random ones to be the probabilities). I need the probabilities to be 1/m where m is the number of elements that are not 0 within a single row. I tried to think of ways to output this, but essentially I would need this stored in a C++ array. So even if I output to a file I would still have the issue of not having it in array as I need it. At the end of it all I need that array because I want to generate a Market Matrix file. I found an implementation in C++ to take an array and convert it to the market matrix file, so this is what I am basing my findings on. My input for the rest of the code takes in this market matrix file so I need that to be the primary form of output. The language does not matter, I just want to generate the file at the end (I found a way mmwrite and mmread in python as well) Please help, I am stuck and not really sure how to implement this.

    Read the article

  • Calculating moving average/stdev in SAS?

    - by John
    Hye guys, I included a screenshot to help clarify my problem: http://i40.tinypic.com/mcrnmv.jpg. I'm trying to calculate some kind of moving average and moving standard deviation. The thing is I want to calculate the coefficients of variation (stdev/avg) for the actual value. Normally this is done by calculating the stdev and avg for the past 5 years. However sometimes there will be observations in my database for which I do not have the information of the past 5 years (maybe only 3, 2 etc). That's why i want a code that will calculate the avg and stdev even if there is no information for the whole 5 years. Also, as you see in the observations, sometimes I have information over more than 5 years, when this is the case I need some kind of moving average which allows me to calculate the avg and stdev for the past 5 year. So if a company has information for 7 years I need some kind of code that will calculate the avg and stdev for, lets say, 1997 (by 1991-1996), 1998 (by 1992-1997) and 1999 (1993-1998). As i'm not very familiar with sas commands it should look (very very roughly) like: set var if year = i then stdev=stdev(year(i-6) untill year(i-1)) and average = avg(year(i-6) untill year(i-1)) Or something like this, I really have no clue, I'm gonna try and figure it out but it's worth posting it if I won't find it myself. Thanks!

    Read the article

  • ASP.NET inline code in a server control

    - by John
    Ok, we had a problem come up today at work. It is a strange one that I never would have even thought to try. <form id="form1" runat="server" method="post" action="Default.aspx?id=<%= ID %>" > Ok, it is very ugly and I wouldn't have ever tried it myself. It came up in some code that was written years ago but had been working up until this weekend after a bunch of updates were installed on a client's web server where the code is hosted. The actual result of this is the following html: <form name="form1" method="post" action="Default.aspx?id=&lt;%= ID %>" id="form1"> The url ends up like this: http://localhost:6735/Default.aspx?id=<%= ID %> Which as you can see, demonstrates that the "<" symbol is being encoded before ASP.NET actually processes the page. It seems strange to me as I thought that even though it is not pretty by any means, it should work. I'm confused. To make matters worse, the client insists that it is a bug in IE since it appears to work in Firefox. In fact, it is broken in Firefox as well, except for some reason Firefox treats it as a 0. Any ideas on why this happens and how to fix it easily? Everything I try to render within the server control ends up getting escaped. Edit Ok, I found a "fix" <form id="form1" runat="server" method="post" action='<%# String.Format("Default.aspx?id={0}", 5) %>' > But that requires me to call DataBind which is adding more of a hack to the original hack. Guess if nobody thinks of anything else I'll have to go with that.

    Read the article

  • Django show manytomanyfield on form when definition is on other model

    - by John
    Hi I have the definition for my manytomany relationship on one model but want to display the field on a form for the other model. How do I do this? for example: # classes class modelA(models.Model): name = models.CharField(max_length=300) manytomany = models.ManyToManyField(modelA) class modelB(models.Model): name = models.CharField(max_length=300) # forms class modelBForm(forms.ModelForm): class Meta: model = modelB I want to use the form modelBForm but show a select box with a list from modelA (just how it would work if the model was set to modelA in the form class). How can I do this? Thanks

    Read the article

  • Friendfeed schemaless data in MYSQL

    - by John Stewart
    I read an article around schema-less database which sounds cool. (http://bret.appspot.com/entry/how-friendfeed-uses-mysql) But what isn't clear to me is how do they run search queries on this data? Since the data is in JSON format how do we look for it?

    Read the article

  • beta testing iphone & ipad applications

    - by John Stewart
    I want to roll a beta test session for my iphone and ipad application with general public. Want to get some feedback before officially launching the app. Does anyone know of a a good community that I can tap into? I found http://ibetatest.com via google but not sure how good/bad it is?

    Read the article

  • SVN Repository Search

    - by John
    Is there any good software that will allow me to search through my SVN respository for code snippets? I found 'FishEye' but the cost is 1,200 and well outside my budget.

    Read the article

  • Fluent NHibernate - Delete a related object when no explicit relationship exists in the model

    - by John Price
    I've got an application that keeps track of (for the sake of an example) what drinks are available at a given restaurant. My domain model looks like: class Restaurant { public IEnumerable<RestaurantDrink> GetRestaurantDrinks() { ... } //other various properties } class RestaurantDrink { public Restaurant Restaurant { get; set; } public Drink { get; set; } public string DrinkVariety { get; set; } //"fountain drink", "bottled", etc. //other various properties } class Drink { public string Name { get; set; } public string Manufacturer { get; set; } //other various properties } My db schema is (I hope) about what you'd expect; "RestaurantDrinks" is essentially a mapping table between Restaurants and Drinks with some extra properties (like "DrinkVariety" tacked on). Using Fluent NHibernate to set up mappings, I've set up a "HasMany" relationship from Restaurants to RestaurantDrinks that causes the latter to be deleted when its parent Restaurant is deleted. My question is, given that "Drink" does not have any property on it that explicitly references RestaurantDrinks (the relationship only exists in the underlying database), can I set up a mapping that will cause RestaurantDrinks to be deleted if their associated Drink is deleted?

    Read the article

  • AssemblyResolve event is not firing during compilation of a dynamic assembly for an aspx page.

    - by John
    This one is really pissing me off. Here goes: My goal is to load assemblies at run-time that contain embedded aspx,ascx etc. What I would also like is to not lock the assembly file on disk so I can update it at run-time without having to restart the application (I know this will leave the previous version(s) loaded). To that end I have written a virtual path provider that does the trick. I have subscribed to the CurrentDomain.AssemblyResolve event so as to redirect the framework to my assemblies. The problem is that the when the framework tries to compile the dynamic assembly for the aspx page I get the following: Compiler Error Message: CS0400: The type or namespace name 'Pages' could not be found in the global namespace (are you missing an assembly reference?) Source Error: public class app_resource_pages__version_1_0_0_0__culture_neutral__publickeytoken_null_default_aspx : global::Pages._Default, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandle I noticed that if I load the assembly with Assembly.Load(AssemblyName) or Assembly.LoadFrom(filename) I dont get the above error. If I load it with Assembly.Load(byte[]) (so as to not lock it), the exception is thrown but my AssemblyResolve handler, when called is returning the assembly correctly (it is called once). So I am guessing that it is called once when the framework parses the asp markup but not when it tries to create the dynamic assembly for the aspx page.

    Read the article

  • How to process XML sernt via POST?

    - by John Conde
    I'm receiving XML sent via POST. Naturally I need to parse this XML to get at the goodies it holds for me. However, when I receive the XML is seems that PHP is parsing it like a query string. For example, this xml: <?xml version="1.0" encoding="utf-8"?> <ForgotPassword> <version>1.0</version> <authentication> <login>myresllerid</login> <apikey>1234567890abcdef</apikey> </authentication> <parameters> <emailAddress>[email protected]</emailAddress> </parameters> </ForgotPassword> Becomes this (from print_r($_REQUEST)): Array ( [ <?xml_version] => "1.0" encoding="utf-8"?> <IDCForgotPassword> <version>1.0</version> <authentication> <login>myresllerid</login> <apikey>1234567890abcdef</apikey> </authentication> <parameters> <emailAddress>[email protected]</emailAddress> </parameters> </IDCForgotPassword> ) You can see the XML is being broken up at the first equals sign (=) in the XML into a key/value pair. How do I avoid this?

    Read the article

< Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >