Search Results

Search found 257 results on 11 pages for 'evan carroll'.

Page 8/11 | < Previous Page | 4 5 6 7 8 9 10 11  | Next Page >

  • Android WebView seems to ignore "viewport" information on web pages

    - by Evan
    I have a website that is using the viewport META tag to tell mobile browsers how to display content ( ). Viewing the page in the Android browser looks correct (and iPhone, etc). When I load the page into a WebView component in an android Application, the WebView ignores the "VIEWPORT" tag, and renders the page at "full" resolution, which is zoomed-in in this case.

    Read the article

  • Potential g++ template bug?

    - by Evan Teran
    I've encountered some code which I think should compile, but doesn't. So I'm hoping some of the local standards experts here at SO can help :-). I basically have some code which resembles this: #include <iostream> template <class T = int> class A { public: class U { }; public: U f() const { return U(); } }; // test either the work around or the code I want... #ifndef USE_FIX template <class T> bool operator==(const typename A<T>::U &x, int y) { return true; } #else typedef A<int> AI; bool operator==(const AI::U &x, int y) { return true; } #endif int main() { A<int> a; std::cout << (a.f() == 1) << std::endl; } So, to describe what is going on here. I have a class template (A) which has an internal class (U) and at least one member function which can return an instance of that internal class (f()). Then I am attempting to create an operator== function which compares this internal type to some other type (in this case an int, but it doesn't seem to matter). When USE_FIX is not defined I get the following error: test.cc: In function 'int main()': test.cc:27:25: error: no match for 'operator==' in 'a.A<T>::f [with T = int]() == 1' Which seems odd, because I am clearly (I think) defining a templated operator== which should cover this, in fact if I just do a little of the work for the compiler (enable USE_FIX), then I no longer get an error. Unfortunately, the "fix" doesn't work generically, only for a specific instantiation of the template. Is this supposed to work as I expected? Or is this simply not allowed? BTW: if it matters I am using gcc 4.5.2.

    Read the article

  • Default input and output buffering for fopen'd files?

    - by Evan Teran
    So a FILE stream can have both input and output buffers. You can adjust the output stream using setvbuf (I am unaware of any method to play with the input buffer size and behavior). Also, by default the buffer is BUFSIZ (not sure if this is a POSIX or C thing). It is very clear what this means for stdin/stdout/stderr, but what are the defaults for newly opened files? Are they buffered for both input and output? Or perhaps just one? If it is buffered, does output default to block or line mode?

    Read the article

  • problem loading texture with transparency with OpenGL ES and Android

    - by Evan Kimia
    Im trying to load an image that has background transparency that will be layered over another texture. When i try and load it, all i get is a white screen. The texture is 512 by 512, and its saved in photoshop as a 24 bit PNG (standard PNG specs in the Photoshop Save for Web and Devices config window). Any idea why its not showing? The texture without transparency shows without a problem. Here is my loadTextures method: public void loadGLTexture(GL10 gl, Context context) { //Get the texture from the Android resource directory Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.m1); Bitmap normalScheduleLines = BitmapFactory.decodeResource(context.getResources(), R.drawable.m1n); //Generate texture pointers... gl.glGenTextures(3, textures, 0); //...and bind it to our array gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[1]); //Create Nearest Filtered Texture gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR_MIPMAP_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_GENERATE_MIPMAP, GL11.GL_TRUE); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); bitmap.recycle(); //Bind our normal schedule bus map lines gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Create Nearest Filtered Texture gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR_MIPMAP_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_GENERATE_MIPMAP, GL11.GL_TRUE); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, normalScheduleLines, 0); normalScheduleLines.recycle(); }

    Read the article

  • Python How to make a cross-module function?

    - by Evan
    I want to be able to call a global function from an imported class, for example In file PetStore.py class AnimalSound(object): def __init__(self): if 'makenoise' in globals(): self.makenoise = globals()['makenoise'] else: self.makenoise = lambda: 'meow' def __str__(self): return self.makenoise() Then when I test in the Python Interpreter >>> def makenoise(): ... return 'bark' ... >>> from PetStore import AnimalSound >>> sound = AnimalSound() >>> sound.makenoise() 'meow' I get a 'meow' instead of 'bark'. I have tried using the solutions provided in python-how-to-make-a-cross-module-variable with no luck.

    Read the article

  • Playing flash video with ASP.NET MVC

    - by evan
    What's a good flash player to use on an ASP.NET MVC site? The page I'm working on will need to display a number of videos on each page dynamically based on what the user searched for. I'd like each of the videos to show up as thumbnails that can be played, paused, and or enlarged to full screen. I've worked with the standard ASP.NET and used FlashControl.dll to accomplish this. Are there better ways than using a user control for MVC pages? Any tips on including video in webpages in general? Thanks in advance!

    Read the article

  • using a database and deploying the application

    - by evan
    I have a WPF application that stores a large amount of information in XML files and as the user uses the application they add more information to the XML files. It's basically using the XML files as a database. Since over the life of the program the XML files have gotten quite large, and I've been think about putting the data on a website, I've been looking into how to move all the information into an SQL database. I've used SQL databases with web applications (PHP, Ruby, and ASP.NET) but never with a Desktop application. Ideally I'd like to be able to keep all the information in one database file and distribute it along with the application without requiring the user to connect to a remote database (so they don't need an internet connection - though eventually it would be nice if could compare the local file's version with one online somewhere and update if necessary) and without making them install a local database server on their computer. Is this possible? I'd also like to use LINQ with any new database solution so switching to a database doesn't force to many changes (I read the XML with LINQ). I'm sure this question has been asked and that there are already some good tutorials on the subject but I just can't find them.

    Read the article

  • Where is the Open Source alternative to WPF?

    - by Evan Plaice
    If we've learned anything from HTML/CSS it's that, declarative languages (like XML) work best to describe User Interfaces because: It's easy to build code preprocessors that can template the code effectively. The code is in a well defined well structured (ideally) format so it's easy to parse. The technology to effectively parse or crawl an XML based source file already exists. The UIs scripted code becomes much simpler and easier to understand. It simple enough that designers are able to design the interface themselves. Programmers suck at creating UIs so it should be made easy enough for designers. I recently took a look at the meat of a WPF application (ie. the XAML) and it looks surprisingly familiar to the declarative language style used in HTML. It's blindingly apparent to me that the current state of desktop UI development is largely fractionalized, otherwise there wouldn't be so much duplicated effort in the domain of user interfaces (IE. GTK, XUL, Qt, Winforms, WPF, etc). There are 45 GUI platforms for Python alone It's painfully obvious to me that there should be a general purpose, open source, standardized, platform independent, markup language for designing desktop GUIs. Much like what the W3C made HTML/CSS into. WPF, or more specifically XAML seems like a pretty likely step in the right direction. Why hasn't anyone in the Open Source community (AFAIK) even scratched the surface of this issue. Now that the 'browser wars' are over should we look forward to a future of 'desktop gui wars?' Note: This topic is relatively subjective in the attempt to be 'future-thinking.' I think that desktop GUI development in its current state sucks ((really)hard) and, even though WPF is still in it's infancy, it presents a likely solution to the problem. Has no one in the OS community looked into developing something similar because they don't see the value, or because it's not worth the effort?

    Read the article

  • git filter-branch chmod

    - by Evan Purkhiser
    I accidental had my umask set incorrectly for the past few months and somehow didn't notice. One of my git repositories has many files marked as executable that should be just 644. This repo has one main master branch, and about 4 private feature branches (that I keep rebased on top of the master). I've corrected the files in my master branch by running find -type f -exec chmod 644 {} \; and committing the changes. I then rebased my feature branches onto master. The problem is there are newly created files in the feature branches that are only in that branch, so they weren't corrected by my massive chmod commit. I didn't want to create a new commit for each feature branch that does the same thing as the commit I made on master. So I decided it would be best to go back through to each commit where a file was made and set the permissions. This is what I tried: git filter-branch -f --tree-filter 'chmod 644 `git show --diff-filter=ACR --pretty="format:" --name-only $GIT_COMMIT`; git add .' master.. It looked like this worked, but upon further inspection I noticed that the every commit after a commit containing a new file with the proper permissions of 644 would actually revert the change with something like: diff --git a b old mode 100644 new mode 100755 I can't for the life of me figure out why this is happening. I think I must be mis-understanding how git filter-branch works. My Solution I've managed to fix my problem using this command: git filter-branch -f --tree-filter 'FILES="$FILES "`git show --diff-filter=ACMR --pretty="format:" --name-only $GIT_COMMIT`; chmod 644 $FILES; true' development.. I keep adding onto the FILES variable to ensure that in each commit any file created at some point has the proper mode. However, I'm still not sure I really understand why git tracks the file mode for each commit. I had though that since I had fixed the mode of the file when it was first created that it would stay that mode unless one of my other commits explicit changed it to something else. That did not appear to the be the case. The reason I thought that this would work is from my understanding of rebase. If I go back to HEAD~5 and change a line of code, that change is propagated through, it doesn't just get changed back in HEAD~4.

    Read the article

  • Delete Range of Data From Text File With PHP

    - by Evan Byrne
    I want to delete a range of data from a text file using PHP. Let's assume the file contains the following: Hello, World! I want to delete everything from character 2 to character 7. The actual file I need to do this with is very large, so I don't want to have to read the large file in order to delete just a small, given range of data. The data contained within the given range is not known, so str_replace or preg_replace solutions wouldn't work anyways. Thanks!

    Read the article

  • Regex replace (in Python) - a more simple way?

    - by Evan Fosmark
    Any time I want to replace a piece of text that is part of a larger piece of text, I always have to do something like: "(?P<start>some_pattern)(?P<replace>foo)(?P<end>end)" And then concatenate the start group with the new data for replace and then the end group. Is there a better method for this?

    Read the article

  • Template type deduction with a non-copyable class

    - by Evan Teran
    Suppose I have an autolocker class which looks something like this: template <T> class autolocker { public: autolocker(T *l) : lock(l) { lock->lock(); } ~autolocker() { lock->unlock(); } private: autolocker(const autolocker&); autolocker& operator=(const autolocker&); private: T *lock; } Obviously the goal is to be able to use this autolocker with anything that has a lock/unlock method without resorting to virtual functions. Currently, it's simple enough to use like this: autolocker<some_lock_t> lock(&my_lock); // my_lock is of type "some_lock_t" but it is illegal to do: autolocker lock(&my_lock); // this would be ideal Is there anyway to get template type deduction to play nice with this (keep in my autolocker is non-copyable). Or is it just easiest to just specify the type?

    Read the article

  • Automatically number items in a wpf listbox

    - by evan
    I have a person class with two properties, Name an Age. I know how to use databinding to display a collection of person in a wpf list box and how to modify the listitemtemplate to customize how each person is displayed. Now I'd like to number each person on the list according to the order they appear on the list (which could change as the the items were sorted via name or age in the display). Is there a way to do that with the item template so instead of having a list like Rob - 14 John - 56 Suzy - 32 it would be 1) Rob - 14 2) John - 56 3) Suzy - 32 Basically i'd like to do something like: <ListView.ItemTemplate> <DataTemplate> <WrapPanel> **<TextBlock Text="{Binding CurrentPositionInList}" />** <TextBlock Text="{Binding Path=Name}" /> <TextBlock Text="{Binding Path=Age}" /> </WrapPanel> </DataTemplate> Thanks in advance!

    Read the article

  • How do I Scroll parent page to top when child page is click within iframe?

    - by Evan
    Hello, When someone clicks on a link within an iframe (child page), how do I get the parent page to scroll to the top? The issue is the child page will remain in the same spot of the page, because the iframe has a lot of height larger than the parent page. Please note: the parent and child pages are on different sub domains. I created a demo to show this: http://www.apus.edu/_test/iframe/index.htm

    Read the article

  • where did the _syscallN macros go in <linux/unistd.h>?

    - by Evan Teran
    It used to be the case that if you needed to make a system call directly in linux without the use of an existing library, you could just include <linux/unistd.h> and it would define a macro similar to this: #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3))); \ if (__res>=0) \ return (type) __res; \ errno=-__res; \ return -1; \ } Then you could just put somewhere in your code: _syscall3(ssize_t, write, int, fd, const void *, buf, size_t, count); which would define a write function for you that properly performed the system call. It seems that this system has been superseded by something (i am guessing that "[vsyscall]" page that every process gets) more robust. So what is the proper way (please be specific) for a program to perform a system call directly on newer linux kernels? I realize that I should be using libc and let it do the work for me. But let's assume that I have a decent reason for wanting to know how to do this :-).

    Read the article

  • Opinions on collision detection objects with a moving scene

    - by Evan Teran
    So my question is simple, and I guess it boils down to how anal you want to be about collision detection. To keep things simple, lets assume we're talking about 2D sprites defined by a bounding box. In addition, let's assume that my sprite object has a function to detect collisions like this: S.collidesWith(other); Finally the scene is moving and "walls" in the scene can move, an object may not touch a wall. So a simple implementation might look like this (psuedo code): moveWalls(); moveSprite(); foreach(wall as w) { if(s.collidesWith(w)) { gameover(); } } The problem with this is that if the sprite and wall move towards each other, depending on the circumstances (such as diagonal moment). They may pass though each other (unlikely but could happen). So I may do this instead. moveWalls(); foreach(wall as w) { if(s.collidesWith(w)) { gameover(); } } moveSprite(); foreach(wall as w) { if(s.collidesWith(w)) { gameover(); } } This takes care of the passing through each other issue, but another rare issue comes up. If they are adjacent to each other (literally the next pixel) and both the wall and the sprite are moving left, then I will get an invalid collision since the wall moves, checks for collision (hit) then the sprite is moved. Which seems unfair. In addition, to that, the redundant collision detection feels very inefficient. I could give the player movement priority alleviating the first issue but it is still checking twice. moveSprite(); foreach(wall as w) { if(s.collidesWith(w)) { gameover(); } } moveWalls(); foreach(wall as w) { if(s.collidesWith(w)) { gameover(); } } Am I simply over thinking this issue, should this just be chalked up to "it'll happen rare enough that no one will care"? Certainly looking at old sprite based games, I often find situations where the collision detection has subtle flaws, but I figure by now we can do better :-P. What are people's thoughts?

    Read the article

  • How do I dispatch to a method based on a parameter's runtime type in C# < 4?

    - by Evan Barkley
    I have an object o which guaranteed at runtime to be one of three types A, B, or C, all of which implement a common interface I. I can control I, but not A, B, or C. (Thus I could use an empty marker interface, or somehow take advantage of the similarities in the types by using the interface, but I can't add new methods or change existing ones in the types.) I also have a series of methods MethodA, MethodB, and MethodC. The runtime type of o is looked up and is then used as a parameter to these methods. public void MethodA(A a) { ... } public void MethodB(B b) { ... } public void MethodC(C c) { ... } Using this strategy, right now a check has to be performed on the type of o to determine which method should be invoked. Instead, I would like to simply have three overloaded methods: public void Method(A a) { ... } // these are all overloads of each other public void Method(B b) { ... } public void Method(C c) { ... } Now I'm letting C# do the dispatch instead of doing it manually myself. Can this be done? The naive straightforward approach doesn't work, of course: Cannot resolve method 'Method(object)'. Candidates are: void Method(A) void Method(B) void Method(C)

    Read the article

  • Adding a search box to a windows forms web browser control that highlights text

    - by evan
    I have a windows forms (using c#) application. It displays a webpage and has a textbox/botton combination which can be used to search for text displayed to the user. Currently I search the inner text of all elements for the text in the textbox. And then I weed out the elements that are redundant (for example a word could be in a 'p' and 'b' element where the 'b' is a child element of 'p' so the element returned should be 'b'). Finally I run the ScrollIntoView(true) method on the found element. I'd now like to add a function that highlights the text (like if you search for a term in a real webbrowser). My first thought was to just inject html and or javascript code around the text but that seems like a messy solution. Any ideas on how I should do this? Thanks for your help!

    Read the article

  • Updating an input value with Jquery

    - by Evan
    I have a form with a few fields, one of which should be updated based on the value of another. The value of the first is POSTed to another URL, and the returned value should be used to fill the second field. Here's the code: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script> function lookup(rid) { $.get("/handler?rid=" + $("input#rid").val(), function(update_rid){ $("#name").val(html(update_rid)); }) } </script> <form name="new_alert"> <input type="text" name="rid" id="rid" onkeyup="lookup(this.value);"> <br /> <input type="text" name="name" id="name"> </form> The POST works fine, and the correct data is returned from /hander, which I confirmed by making a test and filling it using $("#testdiv").html(update_rid); So it seems like the problem is in the way I'm trying to update the value, but I can't get past that.

    Read the article

  • correct way to store an exception in a variable

    - by Evan Teran
    I have an API which internally has some exceptions for error reporting. The basic structure is that it has a root exception object which inherits from std::exception, then it will throw some subclass of that. Since catching an exception thrown in one library and catching it in another can lead to undefined behavior (at least Qt complains about it and disallows it in many contexts). I would like to wrap the library calls in functions which will return a status code, and if an exception occurred, a copy of the exception object. What is the best way to store an exception (with it's polymorphic behavior) for later use? I believe that the c++0x futures API makes use of something like this. So what is the best approach? The best I can think of is to have a clone() method in each exception class which will return a pointer to an exception of the same type. But that's not very generic and doesn't deal with standard exceptions at all. Any thoughts?

    Read the article

  • wpf command pattern

    - by evan
    I have a wpf gui which displays a list of information in separate window and in a separate thread from the main application. As the user performs actions in the main window the side window is updated. (For example if you clicked page down in the main window a listbox in the side window would page down). Right now the architecture for this application feels very messy and I'm sure there is a cleaner way to do it. It looks like this: Main Window contains a singleton SideWindowControl which communicates with an instance of the SideWindowDisplay using events - so, for example, the pagedown button would work like: 1) the event handler of the button on the main window calls SideWindowControl.PageDown() 2) in the PageDown() function a event is created and thrown. 3) finally the gui, ShowSideWindowDisplay is subscribing to the SideWindowControl.Actions event handles the event and actually scrolls the listbox down - note because it is in a different thread it has to do that by running the command via Dispatcher.Invoke() This just seems like a very messy way to this and there must be a clearer way (The only part that can't change is that the main window and the side window must be on different threads). Perhaps using WPF commands? I'd really appreciate any suggestions!! Thanks

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11  | Next Page >