Search Results

Search found 964 results on 39 pages for 'ryan migita'.

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

  • When opening a file in perl, how can I automatically use STDIN/OUT if the file name is "-"?

    - by Ryan Thompson
    I have a perl program that takes input and output file arguments, and I'd like to support the convention of using "-" to specify standard input/output. The problem is that I can't just open the file name, because open(my $input, '<', '-') opens a file called -, not standard input. So I have to do something like this: my $input_fh; if ($input_filename eq '-') { # Special case: get the stdin handle $input_fh = *STDIN{IO}; } else { # Standard case: open the file open($input_fh, '<', $input_filename); } And similarly for the output file. Is there any way to do this without testing for the special case myself? I know I could hack the ARGV filehandle to do this for input, but that won't work for output.

    Read the article

  • Dynamic Variables Within Functions

    - by Ryan
    Why does this work: function myfunction($v) { $query = $v['host'] == '1'; return ( $query ); } $output = array_filter($recordset,myfunction); print_r($output); Whereas this script, which tries to accomplish the same thing with variables, does not? $column1 = 'host'; $value1 = 1; $query1 = '$v[\''.$column1.'\'] == '.$value1; function myfunction($v) { $query = $GLOBALS['query1']; return ( $query ); } $output = array_filter($recordset,myfunction); print_r($output); Any help would be great. Thanks!

    Read the article

  • parsing ip address in php

    - by Ryan
    Hi all, I am trying to create a page that shows the user their zip code when they are on my page. (if any of you are familiar with GeoIP data, thats what I am using. ) I have a conversion that converts the users IP address into an IP number, that conversion is: ipnum = 16777216*w + 65536*x + 256*y + z where w.x.y.z are the ip sections (000.000.000.000) My question is, using $_SERVER['REMOTE_ADDR']; is there a way for me to section the users ip address and assign the section of the ip address to variables? for example: usersip = 192.168.123.5 w = 192; x = 168; y = 123; z = 5; Thanks!

    Read the article

  • LINQ to SQL -- Can't modify return type of stored procedure.

    - by Kyle Ryan
    When I drag a particular stored procedure into the VS 2008 dbml designer, it shows up with Return Type set to "none", and it's read only so I can't change it. The designer code shows it as returning an int, and if I change that manually, it just gets undone on the next build. But with another (nearly identical) stored procedure, I can change the return type just fine (from "Auto Generated Type" to what I want.) I've run into this problem on two separate machines. Any idea what's going on? Here's the stored procedure that works: USE [studio] GO /****** Object: StoredProcedure [dbo].[GetCourseAnnouncements] Script Date: 05/29/2009 09:44:51 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO CREATE PROCEDURE [dbo].[GetCourseAnnouncements] @course int AS SELECT * FROM Announcements WHERE Announcements.course = @course RETURN And this one doesn't: USE [studio] GO /****** Object: StoredProcedure [dbo].[GetCourseAssignments] Script Date: 05/29/2009 09:45:32 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO CREATE PROCEDURE [dbo].[GetCourseAssignments] @course int AS SELECT * FROM Assignments WHERE Assignments.course = @course ORDER BY date_due ASC RETURN

    Read the article

  • Calling SDL/OpenGL from Assembly code on Linux

    - by Lie Ryan
    I'm write a simple graphic-based program in Assembly for learning purpose; for this, I intended to use either OpenGL or SDL. I'm trying to call OpenGL/SDL's function from assembly. The problem is, unlike many assembly and OpenGL/SDL tutorials I found in the internet, the OpenGL/SDL in my machine apparently doesn't use C calling convention. I wrote a simple program in C, compile it to assembly (using -S switch), and apparently the assembly code that is generated by GCC calls the OpenGL/SDL functions by passing parameters in the registers instead of being pushed to the stack. Now, the question is, how do I determine how to pass arguments to these OpenGL/SDL functions? That is, how do I figure out which argument corresponds to which registers? Obviously since GCC can compile C code to call OpenGL/SDL, so therefore there must be a way to figure out the correspondence between function arguments and registers. In C calling conventions, the rule is easy, push parameters backwards and return value in eax/rax, I can simply read their C documentation and I can easily figure out how to pass the parameters. But how about these? Is there a way to call OpenGL/SDL using C calling convention? btw, I'm using yasm, with gcc/ld as the linker on Gentoo Linux amd64.

    Read the article

  • jQuery image hover color overlay

    - by Ryan Max
    I can't seem to find any examples of this having been done anywhere on the internet before but here is what I am going to attempt to do...I'm trying to go about the cleanest possible way of laying this out. So I have an image gallery where the images are all different sizes. I want to make it so that when you mouseover the image, it turns a shade of orange. Just a simple hover effect. I want to do this without using an image swap, otherwise I'd have to create an orange colored hover-image for each individual gallery image, I'd like this to be a bit more dynamic. My plan is just to position an empty div over the image absolutely with a background color, width and height 100% and opacity: 0. Then using jquery, on mouseover I'd have the opacity fade to 0.3 or so, and fade back to zero on mouseout. My question is, what would be the best way to layout the html and css to do this efficiently and cleanly. Here's a brief, but incomplete setup: <li> <a href="#"> <div class="hover">&nbsp;</div> <img src="images/galerry_image.png" /> </a> </li> .hover { width: 100%; height: 100%; background: orange; opacity: 0; }

    Read the article

  • MySQL query being performed when PHP if condition not met?

    - by Ryan
    The script I'm using is if($profile['username'] == $user['username']) { $db->query("UPDATE users SET newcomments = 0 WHERE username = '$user[username]'"); echo "This is a test"; } (Note that $db-query is exactly the same as mysql_query) For some very odd reason, the MySQL query is being performed even if the defined condition is false The "This is a test" works properly and only appears when the condition is met, but the MySQL query is performed anyway Whats the problem with it?

    Read the article

  • Lookup table size reduction

    - by Ryan
    Hello: I have an application in which I have to store a couple of millions of integers, I have to store them in a Look up table, obviously I cannot store such amount of data in memory and in my requirements I am very limited I have to store the data in an embebedded system so I am very limited in the space, so I would like to ask you about recommended methods that I can use for the reduction of the look up table. I cannot use function approximation such as neural networks, the values needs to be in a table. The range of the integers is not known at the moment. When I say integers I mean a 32 bit value. Basically the idea is use some copmpression method to reduce the amount of memory but without losing many precision. This thing needs to run in hardware so the computation overhead cannot be very high. In my algorithm I have to access to one value of the table do some operations with it and after update the value. In the end what I should have is a function which I pass an index to it and then I get a value, and after I have to use another function to write a value in the table. I found one called tile coding http://www.cs.ualberta.ca/~sutton/book/8/node6.html, this one is based on several look up tables, does anyone know any other method?. Thanks.

    Read the article

  • How do I set a single virtual directory of my web app to not inherit web.config?

    - by Ryan
    I have a virtual directory setup in one of my web apps that needs to not inherit the web.config of the main app so it can run on it's own. I am wondering how I can do this because right now when I hit it (mainwebapp.domain.com/virdir) it throws an error saying it can't find some dependencies that are listed in the main apps web.config (shows main app web.config in the error message), this virdir contains it's own little app that needs to just run standalone.

    Read the article

  • Silverlight: How can I built an overview display block for any XAML?

    - by Ryan Bates
    Hi all, I am trying to create a generic "overview" control for any XAML. A good example of the desired effect would be on Google Maps or Bing maps: The main map zooms into some content, while a small "overview" block is docked to one of the map corners, showing the user where he/she is zoomed into. My content is all placed inside a <Canvas>, which can then be scaled and zoomed with transforms. While the user does this kind of navigation, I would like to give them a visual indication of where they are in the larger context of the content. I have tried to take a 'screenshot' of the XAML before the user starts navigating, i.e. create a WriteableBitmap wbImageData = new WriteableBitmap(TheCanvas, null); and then displaying it in an Image. Based on the user's scrolling and zooming activity, a Rectangle displays which part of the content is currently visible in the display area. This works OK-ish (still clunky), but the image has to be redone everytime the content changes. Is there a simple way to create this kind of preview, or does anyone know of a component that does it? Thanks!

    Read the article

  • In Python, how can I find the index of the first item in a list that is NOT some value?

    - by Ryan B. Lynch
    Python's list type has an index(x) method. It takes a single parameter x, and returns the (integer) index of the first item in the list that has the value x. Basically, I need to invert the index(x) method. I need to get the index of the first value in a list that does NOT have the value x. I would probably be able to even just use a function that returns the index of the first item with a value != None. I can think of a 'for' loop implementation with an incrementing counter variable, but I feel like I'm missing something. Is there an existing method, or a one-line Python construction that can handle this? In my program, the situation comes up when I'm handling lists returned from complex regex matches. All but one item in each list have a value of None. If I just needed the matched string, I could use a list comprehension like '[x for x in [my_list] if x is not None]', but I need the index in order to figure out which capture group in my regex actually caused the match.

    Read the article

  • How to pass an event to a method and then subscribe to it?

    - by Ryan Peschel
    Event Handler public void DeliverEvent(object sender, EventArgs e) { } #1: This Works public void StartListening(Button source) { source.Click += DeliverEvent; } #2: And so does this.. public void StartListening(EventHandler eventHandler) { eventHandler += DeliverEvent; } But in #2, you cannot call the method because if you try something like this: StartListening(button.Click); You get this error: The event 'System.Windows.Forms.Control.Click' can only appear on the left hand side of += or -= Is there any way around that error? I want to be able to pass the event and not the object housing the event to the StartListening method.

    Read the article

  • .htaccess Redirect Loop, adding multiple .php extensions

    - by Ryan Smith
    I have sort of a small parent/teacher social network set up for my school. I use my .htaccess file to make the links to teacher profiles cleaner and to add a trailing slash to all urls. I get this problem when going to /teachers/teacher-name/ the link (sometimes) redirects to /teachers/teacher-name.php.php.php.php.php.php.php.php... Below is my .htaccess file. Sometimes if I clear my browser cache in Chrome it temporarily fixes it. I can't exactly wright .htaccess syntax, but I'm pretty familiar with it. Any suggestions are appreciated! RewriteEngine on RewriteBase / #remove php ext RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^/]+)/$ $1.php RewriteRule ^([^/]+)/([^/]+)/$ $1/$2.php #force trailing slash/ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)([^/])$ /$1$2/ [L,R=301] #other rewrites RewriteRule ^teachers/([^/\.]+)/$ /teachers/profile.php?u=$1 RewriteRule ^teachers/([^/\.]+)/posts/$ /teachers/posts.php?u=$1 RewriteRule ^teachers/([^/\.]+)/posts/([^/\.]+)/$ /teachers/post.php?u=$1&p=$2 RewriteRule ^gallery/([^/\.]+)/$ /gallery/album.php?n=$1 RewriteRule ^gallery/([^/\.]+)/slideshow/$ /gallery/slideshow.php?n=$1 RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)/$ /gallery/photo.php?a=$1&p=$2&e=$3 EDIT:I have attached a screenshot of exactly what I'm talking about.

    Read the article

  • Can the Subversion client (svn) derefence symbolic links as if they were files?

    - by Ryan B. Lynch
    I have a directory on a Linux system that mostly contains symlinks to files on a different filesystem. I'd like to add the directory to a Subversion repository, dereferencing the symlinks in the process (treating them as the files they point to, rather than links). Generally, I'd like to be able to handle any working-copy operations with this behavior, but the 'svn add' command is where it starts, I think. The SVN client utility doesn't appear to have any options related to symlink dereferencing in the working copy. I didn't find any references to this in the manual (http://svnbook.red-bean.com/en/1.5/index.html), either. I found a poster on the SVN users mailing list who asked the same question but never received an answer, here: http://markmail.org/message/ngchfnzlmm43yj7h (That poster ended up using hard links instead of symlinks. That technique is not an option, in my case, because the real underlying files reside on a separate filesystem.) I'm using Subversion v1.6.1 on Fedora 11. For what it's worth, I know that there are alternative tools/techniques that could help approximate this behavior, but which I have to discard for various reasons. I've already considered [and dust-binned] these possibilities: - a "union" mount, merging all of the the directories containing the real files, with the SVN working-copy directory as the "top" layer in the union; - copying/moving the real files to the same filesystem as the SVN working-copy, and using hardlinks instead of symlinks; - non-SVN version control systems. These were all neat ideas, and I'm sure they are good solutions to other problems, but they won't work given the constraints of this environment and situation.

    Read the article

  • Create multiple TCP Connections in C# then wait for data

    - by Ryan French
    Hi Everyone, I am currently creating a Windows Service that will create TCP connections to multiple machines (same socket on all machines) and then listen for 'events' from those machines. I am attempting to write the code to create a connection and then spawn a thread that listens to the connection waiting for packets from the machine, then decode the packets that come through, and call a function depending on the payload of the packet. The problem is I'm not entirely sure how to do that in C#. Does anyone have any helpful suggestions or links that might help me do this? Thanks in advance for any help!

    Read the article

  • JSP template inheritance

    - by Ryan
    Coming from a background in Django, I often use "template inheritance", where multiple templates inherit from a common base. Is there an easy way to do this in JSP? If not, is there an alternative to JSP that does this (besides Django on Jython that is :) base template <html> <body> {% block content %} {% endblock %} </body> <html> basic content {% extends "base template" %} {% block content %} <h1>{{ content.title }} <-- Fills in a variable</h1> {{ content.body }} <-- Fills in another variable {% endblock %} Will render as follows (assuming that conten.title is "Insert Title Here", and content.body is "Insert Body Here") <html> <body> <h1>Insert title Here <-- Fills in a variable</h1> Insert Body Here <-- Fills in another variable </body> <html>

    Read the article

  • Combined sign in and registration page?

    - by Ryan
    This is somewhat against rails convention but I am trying to have one controller that manages both user session authentication and user registration. I am having troubles figuring out how to go about this. So far I am merging the User Controller and the Sessions Controller and having the 'new' method deliver both a new usersession and a new user instance. With the new routes in rails 3 though, I am having trouble figuring out how to generate forms for these items. Below is the code: user_controller.rb class UserController < ApplicationController def new @user_session = UserSession.new @user = User.new end def create_user @user = User.new(params[:user]) if @user.save flash[:notice] = "Account Successfully Registered" redirect_back_or_default signup_path else render :action => new end end def create_session @user_session = UserSession.new(params[:user_session]) if @user_session.save flash[:notice] = "Login successful!" redirect_back_or_default login_path else render :action => new end end end views/user/new.html.erb <div id="login_section"> <% form_for @user_session do |f| -%> <%= f.label :email_address, "Email Address" %> <%= f.text_field :email %> <%= f.label :password, "Password" %> <%= f.text_field :password %> <%= f.submit "Login", :disable_with => 'Logining...' %> <% end -%> </div> <div id="registration_section"> <% form_for @user do |f| -%> <%= f.label :email_address, "Email Address" %> <%= f.text_field :email %> <%= f.label :password, "Password" %> <%= f.text_field :password %> <%= f.label :password_confirmation, "Password Confirmation" %> <%= f.text_field :password_confirmation %> <%= f.submit "Register", :disable_with => 'Logining...' %> <% end -%> </div> I imagine I will need to use :url = something for those forms, but I am unsure how to specify. Within routes.rb I have yet to specify either Usersor UserSessions as resources (not convinced that this is the best way to do it... but I could be). I would like, however, the registration and login on the same page and have implemented this by doing the following: routes.rb match 'signup' => 'user#new' match 'login' => 'user#new' What's the best way to go about solving this?

    Read the article

  • Wampserver Error

    - by Ryan
    Ok http://localhost/ won't load now. Recently I installed skype and am aware of the skype port conflict error. I have removed 'use port 80 and 443 as alternatives for incoming connections' from options and still no luck. I have also uninstalled skype, reinstalled it and restarted my machine several times to no avail. Also, I just tried to run my torrent client and I am getting an error for the first time. Any ideas? many thanks

    Read the article

  • GZipping CSS and JS files

    - by Ryan Giglio
    I'm using YSlow to improve the speed of my site, and I'm having trouble with the "compress components with gzip" grade. I have this in my .htaccess file: SetOutputFilter DEFLATE AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript But YSlow is saying There are 4 plain text components that should be sent compressed * http://crewinyourcode.com/css/reset.css * http://crewinyourcode.com/css/inner-pages/index.css * http://crewinyourcode.com/script/css/jquery-ui-1.8.custom.css * http://crewinyourcode.com/js/inner-pages/index.js How can I gzip the css and js files? Also...I don't have access to the httpd.conf file.

    Read the article

  • DNS Lookup in simple C#/asp.net ajax call is extremely slow

    - by Ryan
    I'm running this out of the VS 2008 debugger on Windows 7, running .Net 3.5. The idea was to make all ajax requests with jQuery only, rather than .net, following some tutorials online. Default.aspx - HTML page, jquery triggers method in Default.aspx.cs http://pastebin.com/pxBvKA2H Default.aspx.cs - C# Webform, just defines a GetDate fuction, which only returns a string for now (trying to eliminate any possible issues) (can only post one hyperlink...) pastebin.com/pnHn50hu The ajax query takes longer than it should. Profiling with firebug revealed that it took 1.03 ms. 1s DNS Lookup | 26ms Waiting | 1ms Receiving EDIT: It continues to take the same set of times if you continue to click and resubmit the request. Is there anything I can do to cut down on the DNS Lookup time / what did I do wrong? Thanks for any help.

    Read the article

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