Daily Archives

Articles indexed Friday April 16 2010

Page 11/120 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Django IN query as a string result - invalid literal for int() with base 10

    - by bmelton
    Trying to query a 'Favorites' model to get a list of items a user has favorited, and then querying against a different model to get the objects back from that query to present to the template, but I'm getting an error: "invalid literal for int() with base 10" Looking over all of the other instances of that error, I couldn't find any in which the asker actually wanted to work with a comma separated list of integers, so I'm kind of at a loss. Model class Favorite(models.Model): # key should be the model name, id is the model.id, and user is the User object. key = models.CharField(max_length=255, unique=True) val = models.IntegerField(default=0) user = models.ForeignKey(User) class Admin: list_display = ('key', 'id', 'user') View def index(request): favorites = Favorite.objects.filter(key='blog', user=request.user.pk) values = "" for favorite in favorites: values += "%s," % favorite.val #values = "[%s]" % values blogs = Blog.objects.filter(pk__in=values) return render_to_response('favorite/index.html', { "favorites" : favorites, "blogs" : blogs, "values" : values, }, context_instance=RequestContext(request) ) enter code here

    Read the article

  • How to get input value or javascript variable in Asp.Net MVC Ajax.ActionLink

    - by achu
    I want to pass an input control value (say textbox1.value or a javascript variable) to a controller action method (as a parameter) without a form post (using Ajax.ActionLink). please see the code below is it possible to assign like new {name = textbox1.value} in Ajax.ActionLink. View <input type="text" id="textbox1" /> <% =Ajax.ActionLink("mylink", "linkfunction", new {name = textbox1.value}, new AjaxOptions { UpdateTargetId = "result"})%> <span id="result"></span> and controler action is .. public string linkfunction(string name) { return DateTime.Now.ToString(); }

    Read the article

  • Port Win32 DLL hook to Linux

    - by peachykeen
    I have a program (NWShader) which hooks into a second program's OpenGL calls (NWN) to do post-processing effects and whatnot. NWShader was originally built for Windows, generally modern versions (win32), and uses both DLL exports (to get Windows to load it and grab some OpenGL functions) and Detours (to hook into other functions). I'm using the trick where Win will look in the current directory for any DLLs before checking the sysdir, so it loads mine. I have on DLL that redirects with this method: #pragma comment(linker, "/export:oldFunc=nwshader.newFunc) To send them to a different named function in my own DLL. I then do any processing and call the original function from the system DLL. I need to port NWShader to Linux (NWN exists in both flavors). As far as I can tell, what I need to make is a shared library (.so file). If this is preloaded before the NWN executable (I found a shell script to handle this), my functions will be called. The only problem is I need to call the original function (I would use various DLL dynamic loading methods for this, I think) and need to be able to do Detour-like hooking of internal functions. At the moment I'm building on Ubuntu 9.10 x64 (with the 32-bit compiler flags). I haven't been able to find much on Google to help with this, but I don't know exactly what the *nix community refers to it as. I can code C++, but I'm more used to Windows. Being OpenGL, the only part the needs modified to be compatible with Linux is the hooking code and the calls. Is there a simple and easy way to do this, or will it involve recreating Detours and dynamically loading the original function addresses?

    Read the article

  • Use absolute path for easier modify include path in future?

    - by i need help
    config.php put at the root level, this file will be included in any pages. Then at config.php <?php define( 'ROOT_DIR', dirname(__FILE__) ); ?> So at all other pages from different sub/a.php , sub/sub/b.php directories, when I want to include a specific file in specific location, I just need to include( ROOT_DIR.'/include/functions.php' ); In windows server, the ROOT_DIR bring the value to C:/inetpub/vhosts/domain.com Is this a good/secure way? It seems like via this way, when I move the b.php to other upper level folder, I don't need to do any changes to the include file path, which is good for maintenance. Any cons? Like SEO wise, or any other reason... What you guys think.

    Read the article

  • Self Authenticating Links in Django

    - by awolf
    In my web app I would like to be able to email self-authenticating links to users. These links will contain a unique token (uuid). When they click the link the token being present in the query string will be enough to authenticate them and they won't have to enter their username and password. What's the best way to do this?

    Read the article

  • Doubt about adopting CI (Hudson) into an existing automated Build Process (phing, svn)

    - by maraspin
    OUR CURRENT BUILD PROCESS We're a small team of developers (2 to 4 people depending on project) who currently use Phing to deploy code to a staging environment, before going live. We keep our code in a SVN repo, where the trunk holds current active development and, at certain times, we do make branches that we test and then (if successful), tag and export to the staging env. If everything goes well there too, we finally deploy'em in production servers. Actions are highly automated, but always triggered by human intervention. THE DOUBT We'd now like to introduce Continuous Integration (with Hudson) in the process; unfortunately we have a few doubts about activity syncing, since we're afraid that CI could somewhat interfere with our build process and cause certain problems. Considering that an automated CI cycle has a certain frequency of automatically executed actions, we in fact only see 2 possible cases for "integration", each with its own problems: Case A: each CI cycle produces a new branch with its own name; we do use such a name to manually (through phing as it happens now) export the code from the SVN to the staging env. The problem I see here is that (unless specific countermeasures are taken) the number of branches we have can grow out of control (let's suppose we commit often, so that we have a fresh new build/branch every N minutes). Case B: each CI cycle creates a new branch named 'current', for instance, which is tagged with a unique name only when we manually decide to export it to staging; the current branch, at any case is then deleted, as soon as the next CI cycle starts up. The problem we see here is that a new cycle could kick in while someone is tagging/exporting the 'current' branch to staging thus creating an inconsistent build (but maybe here I'm just too pessimist, since I confess I don't know whether SVN offers some built-in protection against this). With all this being said, I was wondering if anyone with similar experiences could be so kind to give us some hints on the subject, since none of the approaches depicted above looks completely satisfing to us. Is there something important we just completely left off in the overall picture? Thanks for your attention &, in advance, for your help!

    Read the article

  • How to create domain or router-level workgroup (dd-wrt micro)

    - by Anthony
    In Windows, is active directory required for using "Domain" instead of "workgroup"? Do I need to register a domain with a DNS provider like godaddy? What I really want to do is set up my home LAN so that everyone connecting to the main router (which is everyone, which is about 30 people) can see each other. I've tried having everyone use the same work group name, still hit or miss. I tried setting the domain name and host name on the router itself, still nothing. I've tried joining the domain name I set instead of work group, and I get an AD error. But ideally, everyone who is connected to the main router should simply just see each other and any shared folders. I've had this problem when I was not the network admin on other large LANs, and I've never been able to figure out why sometimes people disappear or never see each other. I'd really prefer using the native sharing functionality in the OS to setting up an internal FTP or Samba server, etc. Any sure-fire ways to fix this? (maybe an open source clone of AD?) Thanks!

    Read the article

  • Permanently hide network disconnected icon from system tray

    - by Steve
    On Windows XP, I have a disconnected Wireless connection which shows up in the System Tray. I have gone into Network Connections dialog box and elected not to show an icon when it is disconnected, yet it remains visible. I have gone into the Task bar properties and elected to always hide this icon, but that doesn't remove it from the system tray. How do I remove it? Thanks

    Read the article

  • Computer and internet use on a boat?

    - by dlamblin
    Let's assume that I seriously would like to be able to use my computer as easily and as carefreely while on a boat as I do while at home. In short, if I were on a boat for extended periods, such as two weeks at a time and occasionally over a few days out of port (this would be a 2 person sailing vessel), what would my options be for power, durability, and of course, internet access? I want more than just email, as I will likely keep doing a tad of development, and will be looking at google earth from time to time. I am already assuming that we're going with some kind of laptop, maybe even a macbook pro 12". I personally feel that netbooks are underpowered. And the last computer that I got a boat-friendly rating for was a ZX Spectrum, which was before the internet, and was likely due to it's 12vdc-happiness.

    Read the article

  • Keyword Generation Tool

    To have a profitable website, you need profitable keywords. Being able to generate highly targeted keywords for your campaign or product niche is worth it's weight in gold.

    Read the article

  • How Many Back Links Do You Need?

    When you first embark on a link-building campaign, it seems pretty daunting to think about building hundreds or even thousands of links back to your site. If you are a beginner to link building, you may be wondering how many back links are enough?

    Read the article

  • i am getting error like mysql_connect() acces denied for system@localhost(using password NO)

    - by user309381
    class MySQLDatabase { public $connection; function _construct() { $this->open_connection();} public function open_connection() {$this->connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS); if(!$this->connection){die("Database Connection Failed" . mysql_error());} else{$db_select = mysql_select_db(DB_NAME,$this->connection); if(!$db_select){die("Database Selection Failed" . mysql_error()); } }} public function close_connection({ if(isset($this->connection)){ mysql_close($this->connection); unset($this->connection);}} public function query(/*$sql*/){ $sql = "SELECT*FROM users where id = 1"; $result = mysql_query($sql); $this->confirm_query($result); //return $result;while( $found_user = mysql_fetch_assoc($result)) { echo $found_user ['username']; } } private function confirm_query($result) { if(!$result) { die("The Query has problem" . mysql_error()); } } } $database = new MySQLDatabase(); $database->open_connection(); $database->query(); $database->close_connection(); ?>

    Read the article

  • Error in SQL Syntax ERROR1064

    - by 01010011
    Hi, Everytime I try to create the following table in MySQL command line: CREATE TABLE book(book_id int NOT NULL AUTO_INCREMENT PRIMARY KEY, isbn char(20), title char(20), author_f_name char(20), author_l_name char(20), condition ENUM("as new","very good","good","fair","poor"), price decimal(8,2), genre char(20)); I keep getting this error message: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL version for the right syntax to use near 'condition ENUM("as new","very good","good","fair","poor"), price decimal(8,2), g' at line 6 I've tried using single quotes and double quotes for the ENUM options. Where did I go wrong?

    Read the article

  • MVVM: Thin ViewModels and Rich Models

    - by Dan Bryant
    I'm continuing to struggle with the MVVM pattern and, in attempting to create a practical design for a small/medium project, have run into a number of challenges. One of these challenges is figuring out how to get the benefits of decoupling with this pattern without creating a lot of repetitive, hard-to-maintain code. My current strategy has been to create 'rich' Model classes. They are fully aware that they will be consumed by an MVVM pattern and implement INotifyPropertyChanged, allow their collections to be observed and remain cognizant that they may always be under observation. My ViewModel classes tend to be thin, only exposing properties when data actually needs to be transformed, with the bulk of their code being RelayCommand handlers. Views happily bind to either ViewModels or Models directly, depending on whether any data transformation is required. I use AOP (via Postsharp) to ease the pain of INotifyPropertyChanged, making it easy to make all of my Model classes 'rich' in this way. Are there significant disadvantages to using this approach? Can I assume that the ViewModel and View are so tightly coupled that if I need new data transformation for the View, I can simply add it to the ViewModel as needed?

    Read the article

  • Why is my iPhone SDK 3.2 iPad code showing a white screen?

    - by Anthony Glyadchenko
    I'm trying to get a UISplitViewController working with an iPad app. I have the table view controller linked up under the Master pane and a plain UIView under the Detail view. I also have [window addSubview:splitView.view]; in my code. For some reason I just get a white screen even though the table view controller code is properly coded and linked under my nib. Any help would be great! Thanks! Here's where you can find the code: http://drop.io/s28bu4t/asset/mydevice-hd-zip

    Read the article

  • Playing Multiple Sounds at Once in Qt

    - by Ben
    I'm trying to play background music along with sound effects using Qt. However, I can't get more than one sound to play at once. For example: QSound::play("Music.wav"); QSound::play("Effect.wav"); When this code is run (on Windows), you can hear Music.wav just start to play, but then it stops and Effect.wav plays. Is there any way to get the two sounds to play at once?

    Read the article

  • Large data processing in x86 C# gives System.OutOfMemory exception

    - by Cool
    I am processing XML coming from server which contains both images and data in one C# function (compiled 32 bit). When I try to parse this xml in memory it gives me System.OutOfMemory exception. Is there any way to avoid this error? My guess is, system cannot find contiguous block of 50-100MB memory. (my pc hv 8Gig ram and its quad core)

    Read the article

  • How can I save an entire list of items true or false?

    - by JZ
    I'm following Ryan Bates, Railscast episode 52 and I've translated relevant parts of the code to work with Rails 3.0.0.beta2. In Ryan's case, he simply marks items incomplete and saves a timestamp. If an Item contains a timestamp the model returns the item in the completed list. I'm attempting to save ALL values true or false, depending on whether the check_box_tag is selected or not (using boolean). I am able to save ONLY selected items, true or false. How can I save an entire list of items true or false, depending on whether the checkbox is selected? The following is my attempt: controller logic: def yardsign Add.update_all(["yardsign=?", true], :id => params[:yard_ids]) redirect_to adds_path end html.erb: <%= form_tag yardsign_adds_path, :method => :put do %> <% @adds.each do |add| %> <td><%= check_box_tag "yard_ids[]", add.id %></td> <% end %> <% end %> routes.rb resources :adds do collection do put :yardsign end end Terminal Started POST "/adds/yardsign" for 127.0.0.1 at 2010-04-15 19:22:49 Processing by AddsController#yardsign as HTML Parameters: {"commit"=>"Update", "yardsigntakers"=>["1", "2"], "authenticity_token"=>"3arhsxg/Ky+0W7RNM2T3QditMTJmOnLR5CqmMYWN4Qw="} User Load (0.3ms) SELECT "users".* FROM "users" WHERE ("users"."id" = 1) LIMIT 1 SQL (1.8ms) UPDATE "adds" SET yardsign='t' WHERE ("adds"."id" IN (1, 2)) Redirected to http://localhost:3000/adds

    Read the article

  • 2 approaches for tracking online users with Redis. Which one is faster?

    - by Stanislav
    Recently I found an nice blog post presenting 2 approaches for tracking online users of a web site with the help of Redis. 1) Smart-keys and setting their expiration http://techno-weenie.net/2010/2/3/where-s-waldo-track-user-locations-with-node-js-and-redis 2) Set-s and intersects http://www.lukemelia.com/blog/archives/2010/01/17/redis-in-practice-whos-online/ Can you judge which one should be faster and why?

    Read the article

  • What does the "ApplicaionDirectory" Membership condition mean in .NET Code Access Security?

    - by smwikipedia
    I am not sure about the semantic of "ApplicationDirectory" membership condition. I am trying to use it in the .NET Framework 2.0 configuration tool. The tool's explanation to it is as below: The Application Directory membership condition is true for all assemblies in the same directory or in a child directory of the running application. Assemblies that meet this membership condition will be granted the permissions associated with this code group. All the other membership conditions such as strong name, hash, need me to input some criterias, only the Application Directory has not. How to use it? Could someone give an explanation by example? Many thanks.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >