Daily Archives

Articles indexed Friday March 26 2010

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

  • Is it possible to a db constraint in for this rule?

    - by Pure.Krome
    Hi folks, I wish to make sure that my data has a constraint the following check (constraint?) in place This table can only have one BorderColour per hub/category. (eg. #FFAABB) But it can have multiple nulls. (all the other rows are nulls, for this field) Table Schema ArticleId INT PRIMARY KEY NOT NULL HubId TINYINT NOT NULL CategoryId INT NOT NULL Title NVARCHAR(100) NOT NULL Content NVARCHAR(MAX) NOT NULL BorderColour VARCHAR(7) -- Can be nullable. I'm gussing I would have to make a check constraint? But i'm not sure how, etc. sample data. 1, 1, 1, 'test', 'blah...', '#FFAACC' 1, 1, 1, 'test2', 'sfsd', NULL 1, 1, 2, 'Test3', 'sdfsd dsf s', NULL 1, 1, 2, 'Test4', 'sfsdsss', '#AABBCC' now .. if i add the following line, i should get some sql error.... INSERT INTO tblArticle VALUES (1, 2, 'aaa', 'bbb', '#ABABAB') any ideas?

    Read the article

  • storing a sorted array of hashes

    - by srk
    use strict; use warnings; my @aoh =( { 3 => 15, 4 => 8, 5 => 9, }, { 3 => 11, 4 => 25, 5 => 6, }, { 3 => 5, 4 => 18, 5 => 5, }, { 0 => 16, 1 => 11, 2 => 7, }, { 0 => 21, 1 => 13, 2 => 31, }, { 0 => 11, 1 => 14, 2 => 31, }, ); #declaring a new array to store the sorted hashes my @new; print "\n-------------expected output------------\n"; foreach my $href (@aoh) { #i want a new array of hashes where the hashes are sorted my %newhash; my @sorted_keys = sort {$href->{$b} <=> $href->{$a} || $b <=> $a} keys %$href; foreach my $key (@sorted_keys) { print "$key => $href->{$key}\n"; $newhash{$key} = $href->{$key}; } print "\n"; push(@new,\%newhash); } print "-----------output i am getting---------------\n"; foreach my $ref(@new) { my @skeys = sort {$ref->{$a} <=> $ref->{$b} } keys %$ref; foreach my $key (@skeys) { print "$key => $ref->{$key}\n" } print "\n"; } The output of the program : -------------expected output------------ 3 => 15 5 => 9 4 => 8 4 => 25 3 => 11 5 => 6 4 => 18 5 => 5 3 => 5 0 => 16 1 => 11 2 => 7 2 => 31 0 => 21 1 => 13 2 => 31 1 => 14 0 => 11 -----------output i am getting--------------- 4 => 8 5 => 9 3 => 15 5 => 6 3 => 11 4 => 25 3 => 5 5 => 5 4 => 18 2 => 7 1 => 11 0 => 16 1 => 13 0 => 21 2 => 31 0 => 11 1 => 14 2 => 31 Please tell me what am i doing wrong in storing the hashes into a new array.. how do i achieve what i want.. ? Thanks in advance...

    Read the article

  • How do you manage the namespaces of your extension methods?

    - by Robert Harvey
    Do you use a global, catchall namespace for all of your extension methods, or do you put the extension methods in the same namespace as the class(es) they extend? Or do you use some other method, like an application or library-specific namespace? EDIT: I ask because I have a need to extend System.Security.Principal.IIdentity, and putting the extension method in the System.Security.Principal namespace seems to make sense, but I've never seen it done this way.

    Read the article

  • How to Increase the time till a read timeout error occurs?

    - by Alex
    Hi all. I've written in PHP a script that takes a long time to execute [Image processing for thousands of pictures]. It's a meter of hours - maybe 5. After 15 minutes of processing, I get the error: ERROR The requested URL could not be retrieved The following error was encountered while trying to retrieve the URL: The URL which I clicked Read Timeout The system returned: [No Error] A Timeout occurred while waiting to read data from the network. The network or server may be down or congested. Please retry your request. Your cache administrator is webmaster. What I need is to enable that script to run for much longer. Now, here are all the technical info: I'm writing in PHP and using the Zend Framework. I'm using Firefox. The long script that is processed is done after clicking a link. Obviously, since the script is not over I see the web page on which the link was and the web browser writes "waiting for ...". After 15 minutes the error occurs. I tried to make changes to Firefox threw about:config but without any success. I don't know, but the changes might be needed somewhere else. So, any ideas? Thanks ahead.

    Read the article

  • convert old repository to mercurial

    - by nedlud
    I've been playing around with different versioning systems to find one I'm comfortable with. I started with SVN (lets call this version of the project "f1"), then changed over to GIT. But I didn't know how to convert the old SVN repo to GIT, so I just copied the folder, deleted the .svn stuff, and turned it into a GIT repo (lets call this copied version "f2"). Now I'm playing around with Mercurial and was very pleased to find that it has a Tortoise client for Windows. I was also please to find how easy it was to convert the GIT repo into Mercurial, so I preserved the history (I still cloned it first, just in case. So I'm calling this hg version "f3"). But now what I'm wondering is: what do I do with the old SVN repo that still holds my history from before I played with GIT? I guess I can convert the old SVN repo to Mercurial, but can I then merge those two histories into the one repository so I have a complete set of histories in one place? In other words, can I prepend f1 to f3?

    Read the article

  • Ruby Regexp methods?

    - by fjs6
    Is there a gem/example_code that allows to work with regexps? I am not looking for what a regexp can do, but what can be done to a Regexp object. For example: r = Regexp.new(...) r.min_length => the minimum length of a matching string r = Regexp.new("car(less)?") r.min_length => 3 for the string "car" Thanks!

    Read the article

  • setcontext and makecontext to call a generic function pointer

    - by Simone Margaritelli
    In another question i had the problem to port the code unsigned long stack[] = { 1, 23, 33, 43 }; /* save all the registers and the stack pointer */ unsigned long esp; asm __volatile__ ( "pusha" ); asm __volatile__ ( "mov %%esp, %0" :"=m" (esp)); for( i = 0; i < sizeof(stack); i++ ){ unsigned long val = stack[i]; asm __volatile__ ( "push %0" :: "m"(val) ); } unsigned long ret = function_pointer(); /* restore registers and stack pointer */ asm __volatile__ ( "mov %0, %%esp" :: "m" (esp) ); asm __volatile__ ( "popa" ); To a 64bit platform and many guys told me i should use the setcontext and makecontext functions set instead due to the calling conversion differences between 32 and 64 bits and portability issues. Well, i really can't find any useful documentation online, or at least not the kind i need to implement this, so, how can i use those functions to push arguments onto the stack, call a generic function pointer, obtain the return value and then restore the registers?

    Read the article

  • How to bind a List of a DataObject to a Grid with BindingSources?

    - by citronas
    In an assembly I created a class like the following: [DataObject(true)] public class A { public int Foo{get;set;} [DataObjectMethod[DataObjectMethodType.Select)] public static List<A> GetAllA(string ConnectionString) { // return filled List<A> } } Now I want to display this List with a Gridcontrol under Winforms. I though of a DataGrid. Though I'm coming from ASP.net I'd first think of this.dataGridView1.DataSource = A.GetAllA(ConnectionString) Works, but I'd prefer a better databinding with BindingSources. (Because I've always heard that thats the way to go) I managed to drop a BindingSource onto the form and set the DataSource property to class A. But where can I set the SelectMethod and its parameters? If I set DataSource property of the dataGridView to the BindingSource, it will only display an empty line. Is this the right way to go? Will it only require some additional clicks in the wizard, or do I need to read tons of documentation to get this working?

    Read the article

  • Cisco VPN Client connects but unable to ping or RDP

    - by bryanroth
    I'm a developer and don't have much networking expertise, so bare with me. I'm using the Cisco VPN Client 5.0.02.0090 to connect to my work's VPN that way I can RDP into my work computer. Once connected, I can't ping anything on the local network once connected to the VPN thus I am unable to access my work's network. This used to work about two weeks ago but abruptly stopped working today. However, I have the Cisco VPN Client installed on my laptop and I am able to ping and RDP into my work computer from there. Both my desktop and laptop computers are connected to the same router at home. I have tried the following so far: Rebooted my computer Reinstalled VPN client Updated NIC drivers Disabled firewall Opened up ports 500, 4500, and 10000 Any help would be much appreciated. Thanks!

    Read the article

  • How to make gpg2 flush the stream?

    - by Vi
    I want to get some slowly flowing data saved in encrypted form at the device which can be turned off abruptly. But gpg2 seems to not to flush it's output frequently and I get broken files when I try to read such truncated file. vi@vi-notebook:~$ cat asdkfgmafl asdkfgmafl ggggg ggggg 2342 2342 cat behaves normally. I see the output right after input. vi@vi-notebook:~$ gpg2 -er _Vi --batch ?pE??x...(more binary data here)....???-??.... asdfsadf 22223 sdfsdfasf Still no data... Still no output... ^C gpg: signal Interrupt caught ... exiting vi@vi-notebook:~$ gpg2 -er _Vi --batch /tmp/qqq skdmfasldf gkvmdfwwerwer zfzdfdsfl ^\ gpg: signal Quit caught ... exiting Quit vi@vi-notebook:~$ gpg2 " 2048-bit ELG key, ID 78F446CA, created 2008-01-06 (main key ID 1735A052) gpg: [don't know]: 1st length byte missing vi@vi-notebook:~$ # Where is my "skdmfasldf" How to make gpg2 to handle such case? I want it to put enough output to reconstruct each incoming chunk of input. (Also fsyncing after each output can be benefitial as an additional option). Should I use other tool (I need pubkey encryption).

    Read the article

  • Regular expressions and the question mark

    - by James P.
    I'm having trouble finding a regular expression that matches the following String. Korben;http://feeds.feedburner.com/KorbensBlog-UpgradeYourMind?format=xml;1 One problem is escaping the question mark. Java's pattern matcher doesn't seem to accept \? as a valid escape sequence but it also fails to work with the tester at myregexp.com. Here's what I have so far: ([a-zA-Z0-9])+;http://([a-zA-Z0-9./-]+);[0-9]+ Any suggestions?

    Read the article

  • Is it practical to program with your feet?

    - by bmm
    Has anyone tried using foot pedals in addition to the traditional keyboard and mouse combo to improve your effectiveness in the editor? Any actual experiences out there? Does it work, or is it just for carpal tunnel relief? I found one blog entry from a programmer who actually tried it: So now I can type using my feet for most of the modifier keys. I am using the pedals as I type this. I am still getting used to them, but the burning in my left wrist has definitely reduced. I think I can also type a little faster, but I am too lazy to do the speed tests with and without the pedals to verify this. On the negative side: Working out where to put your feet when you aren’t typing can be a little awkward. The pedals tend to move around the carpet, despite being metal and quite heavy. Some small spikes might have helped. Although the travel on the pedals is small, they are surprisingly stiff. Another programmer's experience: Anybody with hand pain must get foot pedals, since they can remove a tremendous load from your hands. I have two foot pedals, and use one for the SHIFT key, and the other for the CONTROL key. (I still type META by hand.) I have found that in the process of using the Emacs text editor to compose computer programs, I tend to use the SHIFT, CONTROL and META keys constantly, and it is easy to remove most of this load from one's hands. Some foot switch products: Savant Elite Triple Foot Switch FragPedal Bilbo Step On It!

    Read the article

  • Enable all caches except asp net output cache

    - by Timmy O' Tool
    Hi I have different urls that points to the same code www.url1.com www.url2.com I need to use the cache, but if the asp net cache is enabled when someone access to www.url1.com next person accessing www.url2.com could get the previously cached data (www.url1.com) I need to have ALL caches activated except this one.

    Read the article

  • Unable to remove package from Delphi 2005

    - by Robo
    I needed to reinstall a package, DrRX.bpl. I removed it from the package list, and trying to install a newer version of the same package. I've replaced the old component's dir with the new one. When I open the new DrRX.bpl and click install, I get the error "Package C:\Program Files\Borland\BDS\3.0\components\rx work\output\DrRx.bpl cannot be installed because another package with the same basename is already loaded (DrRx.bpl)" I cannot find any reference to DrRX in my package list, DrRX does not appear in the Tool Palette. How do I locate where Delphi thinks this is installed, and remove it, so I can reinstall the package?

    Read the article

  • jQuery autocomplete pass null paramter to the controller in ASP.NET MVC 2

    - by myaesubi
    I'm using jQuery autocomplete plugin from jQuery website calling the controller url which return json in return. The problem is the parameter sent to the controller is always null. Here is the in-browser jQuery code for the autocomplete: $(document).ready(function() { var url = "/Building/GetMatchedCities"; $("#City").autocomplete(url); }); and here is the ASPNET MVC controller signature in C#: public JsonResult GetMatchedCities(string city) { .. return this.Json(query, JsonRequestBehavior.AllowGet); } Thanks in advance, Mohammad

    Read the article

  • Help installing Zorba (XQUERY) PHP Extension on windows

    - by Davey
    Hi, I'm trying to install zorba php extension on windows and I am having all sorts of problems. I have installed the zorba binaries on my computer, but when I try to install the PECL package (pecl install zorba-alpha) I get the following error "ERROR: the DSP zorba.dsp does not exist". I've tried searching for zorba_api.dll or zorba_api.so in order to just bypass the pecl install process, but no luck. If anyone can tell me how to get the zorba extension installed on my windows php I will be eternally grateful. Alternately, if someone knows of another xquery solution for PHP that I can install, I will be equally excited and appreciative. Thank you! Davey

    Read the article

  • In a Rails unit test, how can I get a User fixture to load its associated Profile?

    - by MikeJ
    In the documentation concerning Fixtures (http://api.rubyonrails.org/classes/Fixtures.html) they provide the following example of using label references for associations: ### in pirates.yml reginald: name: Reginald the Pirate monkey: george ### in monkeys.yml george: name: George the Monkey pirate: reginald So following their lead, I have a User model that has_one :profile, a Profile model that belongs_to :user, and tried to set up fixtures per their example: ### in users.yml reginald: id: 1 login: reginald ### in profiles.yml reginalds_profile: id: 1 name: Reginald the Pirate user: reginald (Note: since my association is one-way, the User fixture doesn't have a "profile: reginalds_profile" association--putting it in causes an error because the SQL table has no profile_id attribute.) The problem is, in my unit tests everything seems to load correctly, but users(:reginald).profile is always nil. What am I missing?

    Read the article

  • No OpenID endpoint found

    - by azamsharp
    I am trying to use the DotNetOpenId library to add OpenID support on a test website. For some reason it keeps giving me the following error when running on FireFix. Keep in mind that I am using localhost as I am testing it on my local machine. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; using DotNetOpenAuth.OpenId.RelyingParty; namespace TableSorterDemo { public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { var openid = new OpenIdRelyingParty(); if (openid.GetResponse() != null) { switch (openid.GetResponse().Status) { case AuthenticationStatus.Authenticated: var fetch = openid.GetResponse().GetExtension(typeof(ClaimsResponse)) as ClaimsResponse; var nick = fetch.Nickname; var email = fetch.Email; break; } } } protected void OpenIdLogin1_LoggedIn(object sender, OpenIdEventArgs e) { var openid = new OpenIdRelyingParty(); if(openid.GetResponse() != null) { switch(openid.GetResponse().Status) { case AuthenticationStatus.Authenticated: var fetch = openid.GetResponse().GetExtension(typeof (ClaimsResponse)) as ClaimsResponse; var nick = fetch.Nickname; var email = fetch.Email; break; } } } protected void OpenIdLogin1_LoggingIn(object sender, OpenIdEventArgs e) { var openid = new OpenIdRelyingParty(); var req = openid.CreateRequest(OpenIdLogin1.Text); var fetch = new ClaimsRequest(); fetch.Email = DemandLevel.Require; fetch.Nickname = DemandLevel.Require; req.AddExtension(fetch); req.RedirectToProvider(); return; } } } Also, if I run the same page in Chrome then I get the following: Login failed: This message has already been processed. This could indicate a replay attack in progress.

    Read the article

  • Rails: blank page - no errors or stack trace

    - by Nathan Long
    I've been trying to fix a bug in the Rails app I'm developing, and I keep getting a blank screen with no errors. I haven't found anything helpful in development.log, either (though it does show queries being run and such). Finally, I started to wonder if it's somehow set not to show errors anymore. I tried commenting out a necessary route, and sure enough, I got a blank page instead of the error and stack trace I expected. What might cause this? (I wondered if maybe I'm accidentally running production mode and errors aren't supposed to show then, but development.log is being appended, and if I open script/console and echo ENV['RAILS_ENV'], it says development.)

    Read the article

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