Daily Archives

Articles indexed Saturday March 27 2010

Page 2/84 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • dilemma about mysql. using condition to limit load on a dbf

    - by ondrobaco
    hi, I have a table of about 800 000 records. Its basically a log which I query often. I gave condition to query only queries that were entered last month in attempt to reduce the load on a database. My thinking is a) if the database goes only through the first month and then returns entries, its good. b) if the database goes through the whole database + checking the condition against every single record, it's actually worse than no condition. What is your opinion? How would you go about reducing load on a dbf?

    Read the article

  • Extracting Text from between parentheses in PHP using preg_replace

    - by Christopher
    I am trying to take a string of text like so: $string = "This (1) is (2) my (3) example (4) text"; In every instance where there is a positive integer inside of parentheses, I'd like to replace that with simply the integer itself. The code I'm using now is: $result = preg_replace("((\d+))", "$0", $string); But I keep getting a "Delimiter must not be alphanumeric or backslash" error. Any thoughts? I know there are other questions on here that sort of answer the question, but my knowledge of regex is not enough to switch it over to this example.

    Read the article

  • Wordpress Post # of #

    - by Wes
    I'm looking for an easy way to assign a post number to each post in wordpress and display it out of the total number of posts. A little info: There will be about 100 "posts", each on its own page I want users to click through each post, so start at post 1 and click "next post" to get to post 2 I want it to say post 4/100 at the top for each post I want the URL to have the post name in it I was going to use WP-PageNavi and set each page to display 1 post, however I need the url to show /post-name/ and not /page/2/ I know I can count total number of posts pretty easily, any idea how I can assign a number to each post without having to do it manually? I'd like to sort by date added.

    Read the article

  • How to make a Generic Repository?

    - by chobo2
    Hi I am wondering if anyone has any good tutorials(or maybe even a library that is already made and well documented) on making a generic repository. I am using currently linq to sql but it might change so I don't know if you can make a generic repository that would take little to no changes if I would say switch to entity framework. Thanks

    Read the article

  • jQuery Sortable .toArray with ASP.NET MVC ActionResult

    - by Stacey
    Third try at fixing this tonight - trying a different approach than before now. Given a jQuery Sortable List.. <ul id="sortable1" class="connectedSortable"> <li class="ui-state-default" id="item1">Item 1</li> <li class="ui-state-default" id="item2">Item 2</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default ">Item 4</li> <li class="ui-state-default">Item 5</li> </ul> <ul id="sortable2" class="connectedSortable"> </ul> And ASP.NET MVC ActionResult.. [AcceptVerbs(HttpVerbs.Post)] public ActionResult Insert( string[] items ) { return null; } Activated by JavaScript... $("#sortable1, #sortable2").sortable({ connectWith: '.connectedSortable', dropOnEmpty: true, receive: function () { var items = $(this).sortable('toArray'); alert(items); $.ajax({ url: '/Manage/Events/Insert', type: 'post', data: { 'items': items } }); } }).disableSelection(); The 'alert' DOES show the right items. It shows 'item1, item2' etc. But my ASP.NET MVC ActionResult gets nothing. The method DOES fire, but the 'items' parameter comes in null. Any ideas?

    Read the article

  • ASP.NET MVC 2 RTM - favicon not displayed in Internet Explorer

    - by hungster
    I have the following two lines in the head section in my masterpage: <link rel="shortcut icon" href="/Content/Images/favicon.ico" type="image/x-icon" /> <link rel="icon" href="/Content/Images/favicon.ico" type="image/ico" /> However, the favicon is not displayed in Internet Explorer (version 6, 7, 8). In Firefox and Safari the favicon works fine. I have even tried to replace href with the URL to my website (http://www......./Content/Images/favicon.ico) but that still does not work in Internet Explorer. Am I missing something?

    Read the article

  • how do I redirect from a subdirectory to another directory, but strip off the original subdirectory

    - by Eric Cope
    I have a Ruby on Rails app running on 12001. I am currently redirecting a subdomain to 127.0.0.1:12001 using some ReWriteCond detection. Now I want to redirect my subdirectory to that rails app. http[s]://domain.com/redmine to 127.0.0.1:12001 The current rules apply REQUEST_URI to the above rails path, but I need to strip "/redmine" from the front of REQUEST_URI... Any ideas?

    Read the article

  • How do I make a simple image-based button with visual states in Silverlight 3?

    - by Jacob
    At my previous company, we created our RIAs using Flex with graphical assets created in Flash. In Flash, you could simply lay out your graphics for different states, i.e. rollover, disabled. Now, I'm working on a Silverlight 3 project. I've been given a bunch of images that need to serve as the graphics for buttons that have a rollover, pressed, and normal state. I cannot figure out how to simply create buttons with different images for different visual states in Visual Studio 2008 or Expression Blend 3. Here's where I am currently. My button is defined like this in the XAML: <Button Style="{StaticResource MyButton}"/> The MyButton style appears as follows: <Style x:Key="MyButton" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Image Source="/Assets/Graphics/mybtn_up.png" Width="54" Height="24"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="FocusStates"> <VisualState x:Name="Focused"/> <VisualState x:Name="Unfocused"/> </VisualStateGroup> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"/> <VisualState x:Name="MouseOver"/> <VisualState x:Name="Pressed"/> <VisualState x:Name="Disabled"/> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Image> </ControlTemplate> </Setter.Value> </Setter> </Style> I cannot figure out how to assign a different template to different states, nor how to change the image's source based on which state I'm in. How do I do this? Also, if you know of any good documentation that describes how styles work in Silverlight, that would be great. All of the search results I can come up with are frustratingly unhelpful. Edit: I found a way to change the image via storyboards like this: <Style x:Key="MyButton" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Image Source="/Assets/Graphics/mybtn_up.png" Width="54" Height="24" x:Name="Image"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="FocusStates"> <VisualState x:Name="Focused"/> <VisualState x:Name="Unfocused"/> </VisualStateGroup> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"/> <VisualState x:Name="MouseOver"> <Storyboard Storyboard.TargetName="Image" Storyboard.TargetProperty="Source"> <ObjectAnimationUsingKeyFrames> <DiscreteObjectKeyFrame KeyTime="0" Value="/Assets/Graphics/mybtn_over.png"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Pressed"> <Storyboard Storyboard.TargetName="Image" Storyboard.TargetProperty="Source"> <ObjectAnimationUsingKeyFrames> <DiscreteObjectKeyFrame KeyTime="0" Value="/Assets/Graphics/mybtn_active.png"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Disabled"/> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Image> </ControlTemplate> </Setter.Value> </Setter> </Style> However, this seems like a strange way of doing things to me. Is there a more standard way of accomplishing this?

    Read the article

  • Plastic SCM vs. SVN

    - by jon37
    I'm currently researching new source control options for a team of 10 developers. We do .net development in Visual Studio 2008. We currently use VSS for source control. We are looking for a centralized source control solution(non-distributed), with a nice Visual Studio plugin. My manager has recommended Plastic SCM and I've always heard good things about Subversion. I'm trying to decide if we should adopt Subversion or Plastic SCM. There isn't much information out there about Plastic SCM (except what they've written) and I was wondering if it would be a good solution. They make it sound as if branching is much simpler. Subversion on the other hand has a robust, mature community, and it has been thoroughly field tested. What are the pros and cons to these tools? Also are there any other tools that you could suggest? Thanks

    Read the article

  • Rewriting URL's in codeigniter with url_title()?

    - by Craig Ward
    I am rewriting my website with codeigniter and have something I want to do but not sure it is possible. I have a gallery on my site powered by the Flickr API. Here is an example of the code I use to display the Landscape pictures: <?php foreach ($landscapes->photoset->photo as $l->photoset->photo) : ?> <a >photoset->photo->farm ?>/<?php echo $l->photoset->photo->server ?>/<?php echo $l->photoset->photo->id ?>/<?php echo $l->photoset->photo->secret ?>/<?php echo $l->photoset->photo->title ?>'> <img class='f_thumb'>photoset->photo->farm ?>.static.flickr.com/<?php echo $l->photoset->photo->server ?>/<?php echo $l->photoset->photo->id ?>_<?php echo $l->photoset->photo->secret ?>_s.jpg' title='<?php echo $l->photoset->photo->title ?>' alt='<?php echo $l->photoset->photo->title ?>' /></a> <?php endforeach; ?> As you can see when a user clicks on a picture I pass over the Farm, Server, ID, Secret and Title elements using URI segments and build the page in the controller using $data['farm'] = $this->uri->segment(3); $data['server'] = $this->uri->segment(4); $data['id'] = $this->uri->segment(5); $data['secret'] = $this->uri->segment(6); $data['title'] = $this->uri->segment(7); Everything works and is fine but the URL’s are a tad long, example “http://localhost:8888/wip/index.php/gallery/focus/3/2682/4368875046/e8f97f61d9/Old Mill House in Donegal” Is there a way to rewrite the URL so its more like “http://localhost:8888/wip/index.php/gallery/focus/Old_Mill_House_in_Donegal” I was looking at using: $url_title = $this->uri->segment(7); $url_title = url_title($url_title, 'underscore', TRUE); But I don’t seem to be able to get it to work. Any ideas?

    Read the article

  • Git: removing selected commits from repository

    - by xk0der
    I would like to remove selected commits from a linear commit tree, so that the commits do not show in the commit log. My commit tree looks something like: R--A--B--C--D--E--HEAD I would like to remove the B and C commits. So that they do not show in the commit log, but changes from A to D should be preserved. Maybe by introducing a single commit, so that B and C become BC and the tree looks like. R--A--BC--D--E--HEAD Or, ideally, after A comes D directly. D' representing changes from A to B, B to C and C to D. R--A--D'--E--HEAD Is this possible? if yes, how? Some notes that might be helpful: This is a fairly new project so has no branches as of now, hence no merges as well. Side note: It's a personal project, so no, I'm not trying to destroy any evidence :)

    Read the article

  • Should I install software on a "SAN"

    - by am2605
    Hi, I need to set up ColdFusion 9 on a ubuntu server that has a SAN disk mounted. Is it appropriate to install the CF server software on this disk? I don't really understand the ins and outs of what a SAN is, so I am not sure if the intention is for me to solely install web content on it or whether the server software itself should go here too. Any advice would be extremeness welcome. Many thanks, Andrew.

    Read the article

  • Office suite for eMAC

    - by Adam Pierce
    I have been given 10 old eMAC computers to donate to a local primary school. I am a PC person but I have volunteered to set these up with some kind of office suite. The specs are: 700MHz G4 640MB RAM (should be enough for anyone!) OS-X 10.3 40GB hard disc with 30GB free space I'd like a recommendataion for an office suite that will work on these old boxes. I have tried Open Office, both the latest version and 2.4.3 for PPC with no luck. Yes, I do have X11 installed.

    Read the article

  • Change color of text within a RichTextBox in C#

    - by Addie
    I have a RichTextBox that I write a string to every time I click a Form button. The string ends with a newline so each time I add a string, it appends to the bottom of the RichTextBox. Each string begins with the string "Long" or "Short" and ends with Environment.NewLine. I'd like to color each line red if it beings with "Long" and blue if it begins with "Short". How can I do this? If you need further clarification of the question comment below.

    Read the article

  • use proxy in python to fetch a webpage

    - by carmao
    I am trying to write a function in Python to use a public anonymous proxy and fetch a webpage, but I got a rather strange error. The code (I have Python 2.4): import urllib2 def get_source_html_proxy(url, pip, timeout): # timeout in seconds (maximum number of seconds willing for the code to wait in # case there is a proxy that is not working, then it gives up) proxy_handler = urllib2.ProxyHandler({'http': pip}) opener = urllib2.build_opener(proxy_handler) opener.addheaders = [('User-agent', 'Mozilla/5.0')] urllib2.install_opener(opener) req=urllib2.Request(url) sock=urllib2.urlopen(req) timp=0 # a counter that is going to measure the time until the result (webpage) is # returned while 1: data = sock.read(1024) timp=timp+1 if len(data) < 1024: break timpLimita=50000000 * timeout if timp==timpLimita: # 5 millions is about 1 second break if timp==timpLimita: print IPul + ": Connection is working, but the webpage is fetched in more than 50 seconds. This proxy returns the following IP: " + str(data) return str(data) else: print "This proxy " + IPul + "= good proxy. " + "It returns the following IP: " + str(data) return str(data) # Now, I call the function to test it for one single proxy (IP:port) that does not support user and password (a public high anonymity proxy) #(I put a proxy that I know is working - slow, but is working) rez=get_source_html_proxy("http://www.whatismyip.com/automation/n09230945.asp", "93.84.221.248:3128", 50) print rez The error: Traceback (most recent call last): File "./public_html/cgi-bin/teste5.py", line 43, in ? rez=get_source_html_proxy("http://www.whatismyip.com/automation/n09230945.asp", "93.84.221.248:3128", 50) File "./public_html/cgi-bin/teste5.py", line 18, in get_source_html_proxy sock=urllib2.urlopen(req) File "/usr/lib64/python2.4/urllib2.py", line 130, in urlopen return _opener.open(url, data) File "/usr/lib64/python2.4/urllib2.py", line 358, in open response = self._open(req, data) File "/usr/lib64/python2.4/urllib2.py", line 376, in _open '_open', req) File "/usr/lib64/python2.4/urllib2.py", line 337, in _call_chain result = func(*args) File "/usr/lib64/python2.4/urllib2.py", line 573, in lambda r, proxy=url, type=type, meth=self.proxy_open: \ File "/usr/lib64/python2.4/urllib2.py", line 580, in proxy_open if '@' in host: TypeError: iterable argument required I do not know why the character "@" is an issue (I have no such in my code. Should I have?) Thanks in advance for your valuable help.

    Read the article

  • Stripping blank spaces and newlines from strings in C

    - by Nazgulled
    Hi, I have some input like this: " aaaaa bbb \n cccccc\n ddddd \neeee " And I need to sanitize it like this: "aaaaa bbb cccccc ddddd neeee" Basically: Trim all blank spaces at the beginning and end of the string Strip all new lines Strip all spaces when there is more than one, but always leave ONE space between words Is there any easy way to do this or I'll have to process the string, char by char and copy the appropriate chars to a different variable?

    Read the article

  • Problem with extern keyword in C++

    - by Jeff
    What's the difference between the following two declarations? I thought they were equivalent, but the first sample works, and the second does not. I mean it compiles and runs, but the bitmap display code shows blank. I have not stepped through it yet, but am I missing something obvious? GUI_BITMAP is a simple structure describing a bitmap. This is for VC++ 2005, but I think it fails in VC++ 2008 also. Scratching my head on this one... Sample 1: extern "C" const GUI_BITMAP bmkeyA_cap_active; extern "C" const GUI_BITMAP bmkeyA_cap_inactive; Sample 2: extern "C" { const GUI_BITMAP bmkeyA_cap_active; const GUI_BITMAP bmkeyA_cap_inactive; };

    Read the article

  • authentication winform + asp

    - by user156144
    I am building a desktop application that needs to update current user's status frequently. This status will be available as RSS feed. In order to do this, I think I can create a asp.net folder and secure it using form authentication. When the desktop application written as winform in c# needs to update status, it can set WebRequest.Credentials and upload data. Is there any better way of doing this? Thanks

    Read the article

  • 2 Classes need each other declared C++

    - by Prodigga
    I have a "Game" class which holds all the games settings and manages the game. I have a "Grid" class which is the grid the game is played on. The "Game" class initializes a "Grid" object as one of its members (passing itself ("this") as one of the parameters for "Grid"s constructor).. The "Grid" object therefor needs to deal with a "Game*" pointer. To do this it needs to know what "Game" is; i need to declare it before "Grid". But "Game" uses "Grid"...so it also needs "Grid" declared before it. so confused on how to include headers/etc correctly here..

    Read the article

  • Digital Signature Device Recommendations (Mini Tablet)

    - by blu
    I'd like to capture signatures of application users with a mini-tablet/little pos signature device. I welcome any first hand experiences of which ones were good and which ones to stay away from. Off the top of my head I can think of a few features I'd like to see: USB interface Not too expensive (I don't know 100-200 dollars?) Be easy to integrate with a managed .NET application Also I realize most people, myself included, think of digitally signing assemblies with code instead of a mini-tablet device, if there is a more accurate phrase for this pleas let me know. Thanks for any input.

    Read the article

  • jQuery using .animate() fails to do ANYTHING in IE8

    - by Cypher
    So, it's official: I hate Internet Explorer. Yes, all bloody versions of it. :-D So, I didn't think I was doing anything complicated here, but apparently I am. I have a bunch of list items in an unordered list styled for a navigation menu, and in Firefox, Chrome, Safari, and Opera, things work fine. What is supposed to happen is when you hover a navigational item, it should animate some growth and animate a background color change. Nothing happens in Internet Explorer 7/8. I think it's just tied to the animate function, since if I swap .animate with .css, it works. http://project-cypher.net/wtf/ Ideas?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >