Daily Archives

Articles indexed Tuesday April 20 2010

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

  • Django BigInteger auto-increment field as primary key?

    - by Alex Letoosh
    Hi all, I'm currently building a project which involves a lot of collective intelligence. Every user visiting the web site gets created a unique profile and their data is later used to calculate best matches for themselves and other users. By default, Django creates an INT(11) id field to handle models primary keys. I'm concerned with this being overflown very quickly (i.e. ~2.4b devices visiting the page without prior cookie set up). How can I change it to be represented as BIGINT in MySQL and long() inside Django itself? I've found I could do the following (http://docs.djangoproject.com/en/dev/ref/models/fields/#bigintegerfield): class MyProfile(models.Model): id = BigIntegerField(primary_key=True) But is there a way to make it autoincrement, like usual id fields? Additionally, can I make it unsigned so that I get more space to fill in? Thanks!

    Read the article

  • Creating a menu using xslt for Umbraco

    - by rob_g
    I've created a menu in umbraco using XSLT. The menu is using the usual ul and li elements and I'm displaying only the first level of the menu. The aim is to create a menu that expands to show the sub menu when I click a parent node (in the top level). I am after the xslt I would need to expose the sub menu when clicked. I think I would need to make use of ancestor-or-self to detect the current menu and parent menu and display them and also the $currentPage variable. I have the following xslt: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:urlLib="urn:urlLib" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib urlLib "> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="currentPage"/> <xsl:template match="/"> <div id="kb-categories"> <h3>Categories</h3> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::node [@level=1]"/> </xsl:call-template> </div> </xsl:template> <xsl:template name="drawNodes"> <xsl:param name="parent"/> <xsl:if test="(umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1)) and $parent/@level = 1"> <ul class="kb-menuLevel1" > <xsl:for-each select="$parent/node [string(./data [@alias='showInMenu']) = 1]"> <li> <a href="/kb{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> <xsl:variable name="level" select="@level" /> <xsl:if test="(count(./node [string(./data [@alias='showInMenu']) = '1']) &gt; 0)"> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </xsl:if> </li> </xsl:for-each> </ul> </xsl:if> <xsl:if test="(umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1)) and $parent/@level &gt; 1"> <ul class="kb-menuLevel{@level}" style="display: none;"> <xsl:for-each select="$parent/node [string(./data [@alias='showInMenu']) = 1]"> <li> <a href="/kb{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> <xsl:variable name="level" select="@level" /> <xsl:if test="(count(./node [string(./data [@alias='showInMenu']) = '1']) &gt; 0)"> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </xsl:if> </li> </xsl:for-each> </ul> </xsl:if> </xsl:template> </xsl:stylesheet> I suspect this could be improved using apply-templates, but I'm not yet up to speed with that (this being only the second day of my learning xslt). My menu: Item 1 Item 2 Item 3 Item 4 when I click on Item 2 I want to see it's child menu too: Item 1 Item 2 -- Item 2.1 -- Item 2.2 Item 3 Item 4 and so on down the nested menu.

    Read the article

  • Django models query

    - by Hulk
    Code: class criteria(models.Model): details = models.CharField(max_length = 512) Headerid = models.ForeignKey(Header) def __unicode__(self): return self.id() the details corresponds to a textarea in the UI and a validation is done for 512 characters but when this is saved. /home/project/django/django/core/handlers/base.py in get_response, line 109 Is this any thing related with schema or number of characters entered from UI

    Read the article

  • Loop background images using jQuery

    - by da5id
    I'm trying to get the back-ground image of a legacy div (by which I mean it already has a background image, which I cannot control & thus have to initially over-write) to smoothly rotate indefinitely. Here's what I have so far: var images = [ "/images/home/19041085158.jpg", "/images/home/19041085513.jpg", "/images/home/19041085612.jpg" ]; var counter = 0; setInterval(function() { $(".home_banner").css('backgroundImage', 'url("'+images[counter]+'")'); counter ++; if (counter == colours.length) { counter = 0; } }, 2000); Trouble is, it's not smooth (I'm aiming for something like the innerfade plugin), and it's not indefinite (it only runs once through the array). All help greatfully appreciated :)

    Read the article

  • How to schedule multiple jobs in quartz scheduler using same trigger?

    - by aquero
    Hi, I am using quartz scheduler in my spring project. I have to run a job after another job which is scheduled to run in every 15 mins? I cant run this job concurrently as both of this jobs have to access same mail account using different protocols(one to send:smtp and other to receive: imap) and it may cause problems. Please reply quickly, as its an urgent requirement.

    Read the article

  • Check wether Excel file is Password protected

    - by Torben Klein
    I am trying to open an Excel (xlsm) file via VBA. It may or may not be protected with a (known) password. I am using this code: On Error Resume Next Workbooks.Open filename, Password:=user_entered_pw opened = (Err.Number=0) On Error Goto 0 Now, this works fine if the workbook has a password. But if it is unprotected, it can NOT be opened. Apparently this is a bug in XL2007 if there is also workbook structure protection active. (http://vbaadventures.blogspot.com/2009/01/possible-error-in-excel-2007.html). On old XL2003, supplying a password would open both unprotected and password protected file. I tried: Workbooks.Open filename, Password:=user_entered_pw If (Err.Number <> 0) Then workbooks.open filename This works for unprotected and protected file. However if the user enters a wrong password it runs into the second line and pops up the "enter password" prompt, which I do not want. How to get around this?

    Read the article

  • How to use 5 byte value in macro

    - by shaktisinha
    Hi All, I've just started reading C and have a question about macro. How can I use a 5 byte value with a macro For eg. #define MAX 0xdeadbeaf12 int main(){ printf(" 0x %2x \n", MAX); } This code prints adbeaf12 but not deadbeaf12. Please help. Thanks

    Read the article

  • Override LDAP shell

    - by Incredible
    I have a LDAP server and a predefined shell (bash) set in it. But there are some machine on which I want a different shell to be used whenever user login to that instead of the shell stored in LDAP. How can I do this?? Can someone give me some direction in this? Thank you

    Read the article

  • What are good link extractors out there ?

    - by ldigas
    Link extractor - since I don't know a better name for it; a utility which can take a .htm file, and give me links from it, not counting and so, just direct links. Useful for files in which you have a number of html links which are in a text and so on ... Anyone knows of some, by any chance ?

    Read the article

  • Download specific kernels for distros

    - by ant2009
    Hello, I am running CentOS 5.3. I am wondering where I can download the latest kernel for this distribution. I went to www.centos.org but could see any kernel download only the complete distribution is available to download. I just want the kernel. Kernels on the www.kernels.org are the vanilla kernels. I am wondering where to download for the specific distro? Many thanks for any advice,

    Read the article

  • Rename Exchange Server 2003 Domain

    - by Debasish Pramanik
    Hi All: We have the following exchange server deployment Windows 2003 Server + Domain Controller + Exchange Server 2003 The domain name was X.COM. everything was working fine but due to some reason we need to rename the domain name to Y.COM. The rename of Domain went well but the rename of Exchange Server 2003 is having issues. When we run the XDR-Fixup we get the following error Operation failed: Could not get 'configurationNamingContext' on RootDSE of this server. Let me know if you have any idea on this.

    Read the article

  • What is the fastest / best Base64 en/decoder for Java ?

    - by mP
    Just found the MIG Base 64 utility but its over 6 years old since its last release. It would appear to be quicker than the Apache commons equivalent but I have yet to confirm by writing up an actual test. Has anyone verified its correctness which is always a worry. If someone takes a look at the methods, please note i a referring to the non fast methods which make assumptions trading possible correctness for pure speed.

    Read the article

  • java timer and socket problem

    - by Guru
    Hi there, I'm trying to make a program which listens to the client input stream by using socket programming and timer but whenever timer executes.. it gets hanged Please help me out here is the code... private void jButton1MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: try { ServerUserName=jTextField1.getText(); ss=new ServerSocket(5000); jButton1.enable(false); jTextArea1.enable(true); jTextField2.enable(true); Timer t=new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { try { s=ss.accept(); InputStream is=s.getInputStream(); DataInputStream dis=new DataInputStream(is); jTextArea1.append(dis.readUTF()); } catch(IOException IOE) { } catch(Exception ex) { setLbl(ex.getMessage()); } } }); t.start(); } catch(IOException IOE) { } } Thanks in advance

    Read the article

  • iFrame isolation

    - by Louis
    Just a thought, but would using an IFRAME over a DIV essentially make that element isolated from the window in a way that slow scripts running in the IFRAME wouldn't affect the other frames/window?

    Read the article

  • Checking ActiveRecord Associations in RSpec.

    - by alokswain
    I am learning how to write test cases using Rspec. I have a simple Post Comments Scaffold where a Post can have many Comments. I am testing this using Rspec. How should i go about checking for Post :has_many :comments. Should I stub Post.comments method and then check this with by returning a mock object of array of comment objects? Is testing for AR associations really required ?

    Read the article

  • Invalid Parametes value

    - by Sheery
    Hi Guys, I have an application build in C#, for saving sms, MMS and contacts from the mobile attached via data cable. i am able to save sms and contacts but it gives an error of invalid parameters, my code for saving is if (iRet == PCCSErrors.CONA_OK) { dataVersit = (CAContentAccess.CADataDefinitions.CA_DATA_VERSIT)Marshal.PtrToStructure(bufData, typeof(CAContentAccess.CADataDefinitions.CA_DATA_VERSIT)); byte[] bVersitObject = new byte[dataVersit.iDataLength]; Marshal.Copy(dataVersit.pbVersitObject, bVersitObject, 0, dataVersit.iDataLength); System.IO.Stream ios = System.IO.File.Open(fileDlg.FileName, System.IO.FileMode.Create); ios.Write(bVersitObject, bVersitObject.GetLowerBound(0), dataVersit.iDataLength); ios.Flush(); ios.Close(); } else { PCCAPIUtils.ShowErrorMessage("CAReadItem", iRet); }

    Read the article

  • When i run rake db:create ,Error rake aborted! uninitialized constant Cucumber

    - by Big Bang Theory
    Hi I am trying to experiment on an open source application application . when i run $ rake db:create Following is the stacktrace rake aborted! uninitialized constant Cucumber /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:92:in `const_missing' /home/BigBangTheory/Desktop/spot-us/lib/tasks/cucumber.rake:13 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1882:in `in_namespace' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:910:in `namespace' /home/BigBangTheory/Desktop/spot-us/lib/tasks/cucumber.rake:12 /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load' /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/rails.rb:8 /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/rails.rb:8:in `each' /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/rails.rb:8 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /home/BigBangTheory/Desktop/spot-us/Rakefile:9 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19 Any help ?

    Read the article

  • Log into Launchpad from python script

    - by jack
    How can I log into my Launchpad account in a python script? Any sample code would be appreciated. The login url is https://launchpad.net/+login and then redirect to something like https://login.launchpad.net/fJLVSRbxPfKTpVDr/+decide Thanks in advance!

    Read the article

  • Recursion Issue

    - by vishwanath katharki
    I am not able to populate the Map with the following recursive code. Can anybody help ?` public Map<String,JasperReport> getCompiledSubReports(JasperDesign jasperDesign, Map<String,JasperReport> hm) throws JRException{ if(hasSubReports(jasperDesign) && !allSubreportsProcessed(jasperDesign,hm)){ HashMap hashSet = getJasperDesignsForSubReports(jasperDesign); Set keySet = (Set) hashSet.keySet(); for(String s: keySet){ System.out.println(" Calling getCompiledSubReports " ); JasperDesign jsDesign = (JasperDesign) hashSet.get(s); if(hasSubReports(jsDesign) && !allSubreportsProcessed(jsDesign,hm)){ hm.putAll(getCompiledSubReports(jsDesign,hm)); } else{ JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); String nameParameter = getParameterByName(jasperDesign); if(nameParameter == null){ System.out.println(" No Name parameter! Cannot proceed !!!"); } hm.put(nameParameter,jasperReport); return hm; } } } return hm; }

    Read the article

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