Search Results

Search found 4088 results on 164 pages for 'params keyword'.

Page 77/164 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • Using static variables for Strings

    - by Vivart
    below content is taken from Best practice: Writing efficient code but i didn't understand why private static String x = "example"; faster than private static final String x ="example"; Can anybody explain this. Using static variables for Strings When you define static fields (also called class fields) of type String, you can increase application speed by using static variables (not final) instead of constants (final). The opposite is true for primitive data types, such as int. For example, you might create a String object as follows: private static final String x = "example"; For this static constant (denoted by the final keyword), each time that you use the constant, a temporary String instance is created. The compiler eliminates "x" and replaces it with the string "example" in the bytecode, so that the BlackBerry® Java® Virtual Machine performs a hash table lookup each time that you reference "x". In contrast, for a static variable (no final keyword), the String is created once. The BlackBerry JVM performs the hash table lookup only when it initializes "x", so access is faster. private static String x = "example"; You can use public constants (that is, final fields), but you must mark variables as private.

    Read the article

  • Why does Perl's strict not let me pass a parameter hash?

    - by Thariama
    I hava a perl subroutine where i would like to pass parameters as a hash (the aim is to include a css depending on the parameter 'iconsize'). I am using the call: get_function_bar_begin('iconsize' => '32'); for the subroutine get_function_bar_begin: use strict; ... sub get_function_bar_begin { my $self = shift; my %template_params = %{ shift || {} }; return $self->render_template('global/bars /tmpl_incl_function_bar_begin.html',%template_params); } Why does this yield the error message: Error executing run mode 'start': undef error - Can't use string ("iconsize") as a HASH ref while "strict refs" in use at CheckBar.pm at line 334 Am i doing something wrong here? Is there an other way to submit my data ('iconsize') as a hash? (i am still new to Perl) EDIT: Solution which worked for me. I didn't change the call, but my function: sub get_function_bar_begin { my $self = shift; my $paramref = shift; my %params = (ref($paramref) eq 'HASH') ? %$paramref : (); my $iconsize = $params{'iconsize'} || ''; return $self->render_template('global/bars/tmpl_incl_function_bar_begin.html', { 'iconsize' => $iconsize, } ); }

    Read the article

  • Ruby on Rails unknown attribute form error

    - by Ulkmun
    I'm attempting to create a form which will allow me to upload a file.. I've got the following form.. <div class="field"> <%= f.label :title %><br /> <%= f.text_field :title %> </div> <div class="field"> <%= f.label :body %><br /> <%= f.text_area :body, "cols" => 100, "rows" => 40 %> </div> <div class="field"> <%= f.label :upload %><br /> <%= f.file_field :upload %> </div> <div class="actions"> <%= f.submit %> </div> I've got a controller which seems to error in this function.. # POST /posts # POST /posts.xml def create @post = Post.new(params[:post]) @post = DataFile.save(params[:upload]) ##render :text => "File has been uploaded successfully" respond_to do |format| if @post.save format.html { redirect_to(@post, :notice => 'Post was successfully created.') } format.xml { render :xml => @post, :status => :created, :location => @post } else format.html { render :action => "new" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end That's the method that get's called when I create the post. The error is unknown attribute: upload app/controllers/posts_controller.rb:42:in ``new' app/controllers/posts_controller.rb:42:in ``create'

    Read the article

  • How to read the birthday_date from the Facebook API

    - by Steve
    I have been chasing my tail on this! And it should be so simple!! I have an app in FaceBook that is working fine. However, I need to get the user's birth date. I have successfully got the request for extended permissions, but cannot get the birthday_date out and into a variable/store in database. <?php require_once('facebook.php'); $facebook = new Facebook(array( 'appId' => 'xxxxx', 'secret' => 'yyyyyyy', 'cookie' => true )); if ($facebook->getSession()) { $uid = $facebook->getUser(); $fbme = $facebook->api('/me'); } else { $params = array( 'fbconnect'=>0, 'canvas'=>1, 'req_perms'=>'publish_stream','email','user_location','user_birthday' ); $loginUrl = $facebook->getLoginUrl($params); print "<script type='text/javascript'>top.location.href = '$loginUrl';</script>"; } $session = $facebook->getSession(); $token = $session['access_token']; I would be very grateful if someone could show me the PHP code that reads the extended permissions and places the results into variables. Thanks Steve

    Read the article

  • Can I set Java max heap size for running from a jar file?

    - by Kip
    I am launching a java jar file which often requires more than the default 64MB max heap size. A 256MB heap size is sufficient for this app though. Is there anyway to specify (in the manifest maybe?) to always use a 256MB max heap size when launching the jar? (More specific details below, if needed.) This is a command-line app that I've written in Java, which does some image manipulation. On high-res images (about 12 megapixels and above, which is not uncommon) I get an OutOfMemoryError. Currently I'm launching the app from a jar file, i.e. java -jar MyApp.jar params... I can avoid an OutOfMemoryError by specifying 256MB max heap size on the command line, i.e.: java -Xmx256m -jar MyApp.jar params... However, I don't want to have to specify this, since I know that 256MB is sufficient even for high-res images. I'd like to have that information saved in the jar file. Is that possible?

    Read the article

  • Simple search form passing the searched string through GET

    - by Brian Roisentul
    Hi, I'd like my Search form to return the following url after submit: /anuncios/buscar/the_text_I_searched My form is the following: <% form_for :announcement, :url => search_path(:txtSearch) do |f| %> <div class="searchBox" id="basic"> <%= text_field_tag :txtSearch, params[:str_search].blank? ? "Busc&aacute; tu curso r&aacute;pido y f&aacute;cil." : params[:str_search], :maxlength=> 100, :class => "basicSearch_inputField", :onfocus => "if (this.value=='Busc&aacute; tu curso r&aacute;pido y f&aacute;cil.') this.value=''", :onblur => "if(this.value=='') { this.value='Busc&aacute; tu curso r&aacute;pido y f&aacute;cil.'; return false; }" %> <div class="basicSearch_button"> <input type="submit" value="BUSCAR" class="basicSearch_buttonButton" /> <br /><a href="#" onclick="javascript:jQuery('#advance').modal({opacity:60});">Busqueda avanzada</a> </div> </div> <% end %> My routes' line for search_path is this: map.search '/anuncios/buscar/:str_search', :controller => 'announcements', :action => 'search' Well, this will work if I manually type the url I want in the brower, but definitely, if you look at the form's url, you'll find a ":txtSearch" parameter, which is not giving me the actual value of the text field when the form is submitted. And that's what I'd like to get! Could anybody help me on this?

    Read the article

  • Logback: Logging with two loggers

    - by gammay
    I would like to use slf4j+logback for two purposes in my application - log and audit. For logging, I log the normal way: static final Logger logger = LoggerFactory.getLogger(Main.class); logger.debug("-> main()"); For Audit, I create a special named logger and log to it: static final Logger logger = LoggerFactory.getLogger("AUDIT_LOGGER"); Object[] params = { new Integer(1) /* TenantID */, new Integer(10) /* UserID */, msg}; logger.info("{}|{}|{}", params); logback configuration: <logger name="AUDIT_LOGGER" level="info"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS}|%msg%n </pattern> </encoder> </appender> </logger> <root level="all"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n </pattern> </encoder> </appender> </root> Problem: Messages logged through audit logger appear twice - once under the AUDIT_LOGGER and once under the root logger. 14:41:57.975 [main] DEBUG com.gammay.example.Main - - main() 14:41:57.978|1|10|welcome to main 14:41:57.978 [main] INFO AUDIT_LOGGER - 1|10|welcome to main How can I make sure audit messages appear only once under the audit logger?

    Read the article

  • IE AJAX/Jquery issue - redirecting to new page instead of loading it into a div

    - by phx-zs
    I have a page like this: <form class="ajax" method="post" action="add_item.php"> [text input] [submit button] </form> [list any items the user has in a div here called #items] When the user clicks the submit button, a function like this is called: $("form.ajax").live('submit', function(event) { params = $(this).serialize(); $.post($(this).attr("action"), params, function(data){ json = $.parseJSON(data); // do stuff based on the json results if(json.success.action == 'replace'){ $(json.success.container).html(json.success.message); } else{ $(json.success.container).prepend(json.success.message); $(json.success.container).find(".item:first").slideDown(); } }); event.returnValue = false; return false; }); This is supposed to load add_item.php into the #items div, and it works fine in FF, Chrome, Safari, just not IE. In IE (tested 7 and 8) when I click Submit it redirects the page to add_item.php rather than loading it into the #items div. I tried adding event.preventDefault(); to the end of the function but that didn't work. Any ideas?

    Read the article

  • How to catch unintentional function interpositioning?

    - by SiegeX
    Reading through my book Expert C Programming, I came across the chapter on function interpositioning and how it can lead to some serious hard to find bugs if done unintentionally. The example given in the book is the following: my_source.c mktemp() { ... } main() { mktemp(); getwd(); } libc mktemp(){ ... } getwd(){ ...; mktemp(); ... } According to the book, what happens in main() is that mktemp() (a standard C library function) is interposed by the implementation in my_source.c. Although having main() call my implementation of mktemp() is intended behavior, having getwd() (another C library function) also call my implementation of mktemp() is not. Apparently, this example was a real life bug that existed in SunOS 4.0.3's version of lpr. The book goes on to explain the fix was to add the keyword static to the definition of mktemp() in my_source.c; although changing the name altogether should have fixed this problem as well. This chapter leaves me with some unresolved questions that I hope you guys could answer: Does GCC have a way to warn about function interposition? We certainly don't ever intend on this happening and I'd like to know about it if it does. Should our software group adopt the practice of putting the keyword static in front of all functions that we don't want to be exposed? Can interposition happen with functions introduced by static libraries? Thanks for the help. EDIT I should note that my question is not just aimed at interposing over standard C library functions, but also functions contained in other libraries, perhaps 3rd party, perhaps ones created in-house. Essentially, I want to catch any instance of interpositioning regardless of where the interposed function resides.

    Read the article

  • How can I refactor this to work without breaking the pattern horribly?

    - by SnOrfus
    I've got a base class object that is used for filtering. It's a template method object that looks something like this. public class Filter { public void Process(User u, GeoRegion r, int countNeeded) { List<account> selected = this.Select(u, r, countNeeded); // 1 List<account> filtered = this.Filter(selected, u, r, countNeeded); // 2 if (filtered.Count > 0) { /* do businessy stuff */ } // 3 if (filtered.Count < countNeeded) this.SendToSuccessor(u, r, countNeeded - filtered) // 4 } } Select(...), Filter(...) are protected abstract methods and implemented by the derived classes. Select(...) finds objects in the based on x criteria, Filter(...) filters those selected further. If the remaining filtered collection has more than 1 object in it, we do some business stuff with it (unimportant to the problem here). SendToSuccessor(...) is called if there weren't enough objects found after filtering (it's a composite where the next class in succession will also be derived from Filter but have different filtering criteria) All has been ok, but now I'm building another set of filters, which I was going to subclass from this. The filters I'm building however would require different params and I don't want to just implement those methods and not use the params or just add to the param list the ones I need and have them not used in the existing filters. They still perform the same logical process though. I also don't want to complicated the consumer code for this (which looks like this) Filter f = new Filter1(); Filter f2 = new Filter2(); Filter f3 = new Filter3(); f.Sucessor = f2; f2.Sucessor = f3; /* and so on adding filters as successors to previous ones */ foreach (User u in users) { foreach (GeoRegion r in regions) { f.Process(u, r, ##); } } How should I go about it?

    Read the article

  • Google Data Api returning an invalid access token

    - by kingdavies
    I'm trying to pull a list of contacts from a google account. But Google returns a 401. The url used for requesting an authorization code: String codeUrl = 'https://accounts.google.com/o/oauth2/auth' + '?' + 'client_id=' + EncodingUtil.urlEncode(CLIENT_ID, 'UTF-8') + '&redirect_uri=' + EncodingUtil.urlEncode(MY_URL, 'UTF-8') + '&scope=' + EncodingUtil.urlEncode('https://www.google.com/m8/feeds/', 'UTF-8') + '&access_type=' + 'offline' + '&response_type=' + EncodingUtil.urlEncode('code', 'UTF-8') + '&approval_prompt=' + EncodingUtil.urlEncode('force', 'UTF-8'); Exchanging the returned authorization code for an access token (and refresh token): String params = 'code=' + EncodingUtil.urlEncode(authCode, 'UTF-8') + '&client_id=' + EncodingUtil.urlEncode(CLIENT_ID, 'UTF-8') + '&client_secret=' + EncodingUtil.urlEncode(CLIENT_SECRET, 'UTF-8') + '&redirect_uri=' + EncodingUtil.urlEncode(MY_URL, 'UTF-8') + '&grant_type=' + EncodingUtil.urlEncode('authorization_code', 'UTF-8'); Http con = new Http(); Httprequest req = new Httprequest(); req.setEndpoint('https://accounts.google.com/o/oauth2/token'); req.setHeader('Content-Type', 'application/x-www-form-urlencoded'); req.setBody(params); req.setMethod('POST'); Httpresponse reply = con.send(req); Which returns a JSON array with what looks like a valid access token: { "access_token" : "{access_token}", "token_type" : "Bearer", "expires_in" : 3600, "refresh_token" : "{refresh_token}" } However when I try and use the access token (either in code or curl) Google returns a 401: curl -H "Authorization: Bearer {access_token}" https://www.google.com/m8/feeds/contacts/default/full/ Incidentally the same curl command but with an access token acquired via https://code.google.com/oauthplayground/ works. Which leads me to believe there is something wrong with the exchanging authorization code for access token request as the returned access token does not work. I should add this is all within the expires_in time frame so its not that the access_token has expired

    Read the article

  • before filter not working as expected

    - by Jimmy
    Hey guys I have a ruby on rails app with a before filter setup in my application controller to ensure only the owner can edit a document, but my permission check is always failing even when it shouldn't. Here is the code: def get_logged_in_user id = session[:user_id] unless id.nil? @current_user = User.find(id) end end def require_login get_logged_in_user if @current_user.nil? session[:original_uri] = request.request_uri flash[:notice] = "You must login first." redirect_to login end end def check_current_user_permission require_login logger.debug "user id is #{params[:user_id]}" logger.debug "current user id is #{session[:user_id]}" if session[:user_id] != params[:user_id] flash[:notice] = "You don't have permission to do that." redirect_to :controller => 'home' end end The code to note is in the check_current_user_permission. Here is an example of my log output: user id is 3 current user id is 3 Redirected to http://localhost:3000/home Filter chain halted as [:check_current_user_permission] rendered_or_redirected. Can anyone shed some light into why this is failing? Obviously the user_id of 3 is equal to the session's user_id of 3. What is going wrong?

    Read the article

  • Get context for search string in text in C#

    - by soundslike
    Given a string text which contains newline there is a search keyword which matches an item within the text. How do I implement the following in C#: searchIdx = search index (starting with 0, then 1, etc. for each successive call to GetSearchContext. Initially start with 0. contextsTxt = string data to search in searchTxt = keyword to search for in contextsTxt numLines = number of lines to return surrounding the searchTxt found (ie. 1 = the line the searchTxt is found on, 2 = the line the searchTxt is found on, 3 = the line above the searchTxt is found on, the line the searchTxt is found on, and the line below the searchTxt is found on) returns the "context" based on the parameters string GetSearchContext(int searchIdx, string contentsTxt, string searchTxt, int numLines); If there's a better function interface to accomplish this feel free to suggest that as well. I tried the following but doesn't seem to work properly all the time: private string GetSearchContext(string contentValue, string search, int numLines) { int searchIdx = contentValue.IndexOf(search); int startIdx = 0; int lastIdx = 0; while (startIdx != -1 && (startIdx = contentValue.IndexOf('\n', startIdx+1)) < searchIdx) { lastIdx = startIdx; } startIdx = lastIdx; if (startIdx < 0) startIdx = 0; int endIdx = searchIdx; int lineCnt = 0; while (endIdx != -1 && lineCnt++ < numLines) { endIdx = contentValue.IndexOf('\n', endIdx + 1); } if (endIdx == -1 || endIdx > contentValue.Length - 1) endIdx = contentValue.Length - 1; string lines = contentValue.Substring(startIdx, endIdx - startIdx + 1); if (lines[0] == '\n') lines = lines.Substring(1); if (lines[lines.Length - 1] == '\n') { lines = lines.Substring(0, lines.Length - 1); } if (lines[lines.Length - 1] == '\r') { lines = lines.Substring(0, lines.Length - 1); } return lines; }

    Read the article

  • How to search within an xml data set?

    - by user187580
    Hi, I have some xml data and I am trying to keyword search data. For example, if I search "some" for the following data it returns me the <id> and <title>. <resource> <id>101</id> <title>Test Environment</title> <description><b>Some</b> description. </description> <type>classroom</type> </resource> <resource> <id>102</id> <title>ABC Test Environment</title> <description><b>Some</b> another description. </description> <type>classroom</type> </resource> ... I had a look on on xpath e.g. $xml->xpath('//title') but looks for elements only. Basically what I need to do is to create a functionality where users can keyword search within the above data set which I receive from third party api in the above format. Any ideas how I can achieve this? using PHP/ Javascript etc. Thanks.

    Read the article

  • How to catch unintentional function interpositioning with GCC?

    - by SiegeX
    Reading through my book Expert C Programming, I came across the chapter on function interpositioning and how it can lead to some serious hard to find bugs if done unintentionally. The example given in the book is the following: my_source.c mktemp() { ... } main() { mktemp(); getwd(); } libc mktemp(){ ... } getwd(){ ...; mktemp(); ... } According to the book, what happens in main() is that mktemp() (a standard C library function) is interposed by the implementation in my_source.c. Although having main() call my implementation of mktemp() is intended behavior, having getwd() (another C library function) also call my implementation of mktemp() is not. Apparently, this example was a real life bug that existed in SunOS 4.0.3's version of lpr. The book goes on to explain the fix was to add the keyword static to the definition of mktemp() in my_source.c; although changing the name altogether should have fixed this problem as well. This chapter leaves me with some unresolved questions that I hope you guys could answer: Should our software group adopt the practice of putting the keyword static in front of all functions that we don't want to be exposed? Does GCC have a way to warn about function interposition? We certainly don't ever intend on this happening and I'd like to know about it if it does. Can interposition happen with functions introduced by static libraries? Thanks for the help.

    Read the article

  • When destroying one record, another one gets destroyed

    - by normalocity
    Products (like an iPod Classic) :has_many = :listings, :dependent = :destroy Listings (like "My name is Joe, and I have an iPod for sale) :belongs_to = :product So, if I delete a given Product, all the listings that point to it get deleted. That makes sense, and is by design. However, I am writing a "merge" function, where you merge two Products into one, and combine their Listings. So, let's say my two products are "iPod Color" and "iPod Classic", and I want to merge the two. What I want to do is say, "iPod Color, merge into iPod Classic", and result should be that: All the iPod Color Listings are re-pointed to the iPod Classic product After the product_id change, the Listing(s) are saved I then delete the "iPod Color" product Well, that should all work fine, without deleting any Listings. However, I've got this controller, and for whatever reason when I destroy the "iPod Color" Product, even after confirming that the Listings have been moved to "iPod Classic" and saved to the database, the Listings that were previously pointed to "iPod Color" get destroyed as well, and I can't figure out why. It's as if they are retaining some kind of link to the destroyed product, and therefore begin destroyed themselves. What painfully obvious thing am I missing? def merge merging_from = Product.find(params[:id]) merging_to = Product.find_by_model(params[:merging_to]) unless merging_to.nil? unless merging_from.nil? unless merging_from == merging_to # you don't want to merge something with itself merging_from.listings.each do |l| l.product = merging_to l.save end # through some debugging, I've confirmed that my missing Listings are disappearing as a result of the following destroy call merging_from.destroy end end end

    Read the article

  • problems getting HTTPRiot working

    - by bwizzy
    I've got an iphone app where I'm trying to use HTTPRiot to make some API calls to a web app. Problem is I can't see that none of the HTTPRiot delegate methods are being called. I've got a log in all the delegate methods, and I'm also looking at the webserver log. I see that the URL is being hit. //API.h #import <Foundation/Foundation.h> #include <HTTPRiot/HTTPRiot.h> @interface API : HRRestModel { } +(void)runTest; @end //API.m #import "API.h" @implementation API + (void)initialize { NSLog(@"api initialize"); [self setDelegate:self]; [self setBaseURL:[NSURL URLWithString:@"http://localhost:3000/api"]]; [self setBasicAuthWithUsername:@"demo" password:@"123456"]; NSDictionary *params = [NSDictionary dictionaryWithObject:@"1234567" forKey:@"api_key"]; [self setDefaultParams:params]; }//end initialize +(void)runTest { NSLog(@"api run test"); // Would send a request to http://localhost:1234/api/people/1?api_key=1234567 [self getPath:@"/save_diet" withOptions:nil object:nil]; } +(void)restConnection:(NSURLConnection *)connection didReturnResource:(id)resource object:(id)object { NSLog(@"didReturnResource"); } +(void)restConnection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response object:(id)object { NSLog(@"didReceiveResponse"); } +(void)restConnection:(NSURLConnection *)connection didReceiveParseError:(NSError *)error responseBody:(NSString *)body object:(id)object { NSLog(@"didReceiveParseError"); } +(void)restConnection:(NSURLConnection *)connection didReceiveError:(NSError *)error response:(NSHTTPURLResponse *)response object:(id)object { NSLog(@"didReceiveError"); } +(void)restConnection:(NSURLConnection *)connection didFailWithError:(NSError *)error object:(id)object { NSLog(@"didFailWithError"); } @end //test code [API runTest]; //log output

    Read the article

  • Rails : can't write unknown attribute `url'

    - by user2954789
    I am new to ruby on rails,and I am learning by creating a blog. I am not able to save to my blogs table and I get this error "can't write unknown attribute url" Blogs migration :db/migrate/ class CreateBlogs < ActiveRecord::Migration --def change --- create_table :blogs do |t| ---- t.string :title ---- t.text :description ---- t.string :slug ---- t.timestamps --- end --end end Blogs Model :/app/models/blogs.rb class Blogs < ActiveRecord::Base --acts_as_url :title --def to_param ---url --end --validates :title, presence:true end Blogs Controller : /app/controllers/blogs_controller.rb class BlogsController < ApplicationController before_action :require_login --def new --- @blogs = Blogs.new --end --def show ---@blogs = Blogs.find(params[:id]) --end --def create ---@blogs = Blogs.new(blogs_params) --if @blogs.save ---flash[:success] = "Your Blog has been created." ---redirect_to home_path --else ---render 'new' --end -end --def blogs_params ---params.require(:blogs).permit(:title,:description) --end private --def require_login ---unless signed_in? ----flash[:error] = "You must be logged in to create a new Blog" ----redirect_to signin_path ---end --end end Blogs Form:/app/views/blogs/new.html.erb Blockquote <%= form_for @blogs, url: blogs_path do |f| %><br/> <%= render 'shared/error_messages_blogs' %><br/> <%= f.label :title %><br/> <%= f.text_field :title %><br/> <%= f.label :description %><br/> <%= f.text_area :description %><br/> <%= f.submit "Submit Blog", class: "btn btn-large btn-primary" %><br/> <% end %><br/> and I have also added "resources :blogs" to my routes.rb file. I get this error in controller at if @blogs.save

    Read the article

  • jQuery Fancy - popup window doesn't fully expand

    - by fmz
    I am using jQuery Fancybox to display a number of Flash videos on a site and I am having trouble with the window not opening fully on the first click in Firefox. It works fine in other browsers. Here is the jQuery: <script type="text/javascript"> $(document).ready(function() { $("a.videoLink").fancybox({ 'titleShow' : false, 'autoscale' : true, 'width' : '820', 'height' : '620', 'transitionIn' : 'elastic', 'transitionOut' : 'elastic' }); }); </script> Here is the html: <tr> <td class="title"><a class="videoLink" href="#video-content30">CPR Lesson 1 Movie</a></td> <td class="time">38:39</td> <td class="video" style="display:none"> <div id="video-content30"> <script type='text/javascript'> var flashvars = { file: 'http://www.stockmarketcpr.com/smsys/link/CPR-Lesson-1-Movie.flv', id: '30' }; var params = { wmode: 'opaque', bgcolor: '#CCCCCC', allowfullscreen: 'true', allowscriptaccess: 'always' }; swfobject.embedSWF('http://www.stockmarketcpr.com/_flash/player.swf', 'player30','800','600', '9.0.0','expressInstall.swf', flashvars, params); </script> <div id="player30"></div> </div> </td> </tr> I end up getting a quarter inch high, full-width window on the first click. The second click plays fine. I would appreciate any assistance. Thank you!

    Read the article

  • Error in django using Apache & mod_wsgi

    - by Ignacio
    Hey, I've been doing some changes to my django develpment env, as some of you suggested. So far I've managed to configure and run it successfully with postgres. Now I'm trying to run the app using apache2 and mod_wsgi, but I ran into this little problem after I followed the guidelines from the django docs. When I access localhost/myapp/tasks this error raises: Request Method: GET Request URL: http://localhost/myapp/tasks/ Exception Type: TemplateSyntaxError Exception Value: Caught an exception while rendering: argument 1 must be a string or unicode object Original Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py", line 71, in render_node result = node.render(context) File "/usr/local/lib/python2.6/dist-packages/django/template/defaulttags.py", line 126, in render len_values = len(values) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 81, in __len__ self._result_cache = list(self.iterator()) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 238, in iterator for row in self.query.results_iter(): File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 287, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 2369, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py", line 19, in execute return self.cursor.execute(sql, params) TypeError: argument 1 must be a string or unicode object ... ... ... And then it highlights a {% for t in tasks %} template tag, like the source of the problem is there, but it worked fine on the built-in server. The view associated with that page is really simple, just fetch all Task objects. And the template just displays them on a table. Also, some pages get rendered ok. Don't want to fill this Question with code, so if you need some more info I'd be glad to provide it. Thanks

    Read the article

  • Passing user_id, site_id, and question_id to same table on create...

    - by bgadoci
    I can't seem to figure out how to do this. I am trying to pass four different variables to a single table. To be more specific I am trying to create a "like" in a likes table that also captures the site_id (like an answer), user_id, and the question_id. Here is the set up. class Like < ActiveRecord::Base belongs_to :site belongs_to :user belongs_to :question end I will spare you the reverse, has_many associations but they are there. Here is the likes controller where I think the problem is. class LikesController < ApplicationController def create @user = current_user @site = Site.find(params[:site_id]) @like = @site.likes.create!(params[:like]) @like.user = current_user @like.save respond_to do |format| format.html { redirect_to @site} format.js end end end This code successfully passes the like and site_id but after many different variations of trying I can't get it to pass the question id. Here is my form: /views/sites/_site.html.erb (though the partial is being displayed in the /views/questions/show.html.erb file). <% remote_form_for [site, Like.new] do |f| %> <%= f.hidden_field :site_name, :value => "#{site.name}" %> <%= f.hidden_field :ip_address, :value => "#{request.remote_ip}" %> <%= f.hidden_field :like, :value => "1" %> <%= submit_tag "^" , :class => 'voteup' %> <% end %>

    Read the article

  • Access is denied. Javascript error on request to secured page

    - by ihorko
    On SomePage.aspx page by javascript (XMLHttpRequest) I call SecuredPage.aspx used next code: var httpRequest = GetXmlHttp(); var url = "https://myhost.com/SecuredPage.aspx"; var params = "param1=" + document.getElementById('param1').value + "&param2=" + document.getElementById('param2').value; httpRequest.open("POST", url, true); httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); httpRequest.onreadystatechange = function() { //Call a function when the state changes. if (httpRequest.readyState == 4 && httpRequest.status == 200) { alert(httpRequest.responseText); } } httpRequest.send(params); // HERE ACCESS IS DENIED //--------------------------------------------- function GetXmlHttp() { var xmlhttp = false; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject) // code for IE { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } } return xmlhttp; } It throws Access is denied error. if send to http (http://myhost.com/SecuredPage.aspx), it works fine. How is it possible to resolve that problem. Thanks!

    Read the article

  • Taking wrong database configuration array

    - by user309076
    Hi, I have one application in which i have used 2 database connections. In my database config file i have given two arrays as below. $active_group = ‘default’; $active_record = TRUE; FIRST ARRAY $db[‘default’][‘hostname’] = ‘hostname’; .............. .......... SECOND ARRAY $db[‘another_db’][‘hostname’] = ‘hostname’; .............. .......... this is working fine. Now, I copied the entire CI folder to develop another application in which only one database connection needed. So, now, in the database config file, i deleted the second configuration array. But, the db class is taking first application’s second array i.e. “another_db” and it is giving the below error. “You have specified an invalid database connection group.” When i change the default (only one) array name to “another_db” in configuration file. It is working fine. Can’t understand from where it is taking the group name as “another_db”. My application autoloads database library. I have debugged the ci_auto_loader in Loader.php class where it calls $this-database() function with no parameters. But in function database($params, $, $) {}, if I echo $params it shows “another_db”.

    Read the article

  • EGODatabase does not retain inserted record

    - by user135775
    Hi Guy! I'm using EGODatabase to process my data. When I tried to insert data into the database which I created with Base and attached to the project, the data that was inserted programmatically will not show up when I restart my app.However the data inserted manually using Base will show up just fine. Following is the code for inserting data into the database: NSString *path = [[NSBundle mainBundle] pathForResource:@"Database" ofType:@"db"]; db = [EGODatabase databaseWithPath:path]; if ([db open]) { NSLog(@"Database is opened successfully!"); } else { NSLog(@"Database is failed to open!"); } NSArray *params = [NSArray arrayWithObjects:[aFeed feedID], [aFeed title], nil]; [db executeUpdate:@"Insert INTO Feed (FeedID, Title) VALUES (?, ?)" parameters:params]; EGODatabaseResult *results = [db executeQuery:@"SELECT * FROM Feed"]; for ( EGODatabaseRow * row in results) { NSLog(@"ID: %@ Title: %@", [row stringForColumn:@"FeedID"], [row stringForColumn:@"Title"]); } I appreciate if anyone can share me a working sample code for EGODatabase. I'm using EGODatabase because I might have multi-threading code that write to the database. Thank in advance.

    Read the article

  • How can I get the search parameters from jqgrid in the server side?

    - by Jack
    I've been visiting this forum a lot without registering since several months ago, and I really like it. So, thanks in advance to all the members. Now I'd like to make my first question. I've been using Jqgrid for a few time, and I've managed to have it display the rows and buttons, but now I need to do a search, a complex one, and I thought that "automatically" jqgrid would send the parameters to the server, I mean: sField, searchField, sOper, searchOper, sValue, searchString, sFilter and/or filters I'm not sure at all which ones it has to send, and I thought it would be just the same as it sends 'page', 'rows' and 'sord'. But I'm missing something, because, for example, I can get 'page', 'rows' and 'sord' using: $limit = $this->getRequest()->getParam('rows', 10); but I get nothing by using: $params = $_REQUEST['filters'] or $params = $this->getRequest()->getParam('sFilter'); I'm using PHP, Zend and json. I didn't post any code because my doubt is kind of generic, but I will do it if it was needed. I've searched a lot, and read the documentation, but I just don't see it. I will appreciate your help, thanks!

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >