Daily Archives

Articles indexed Thursday May 6 2010

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

  • Grails: How to include an html link inside a <g:message> default attribute?

    - by Christoph
    Hi, I am starting with Grails and want to have one page with multilanguage content. I started using the tag which works fine. But here is what I want to do: I want to include the default text of the default language right in the text, to avoid switching back and forth in between files. <g:message code="homepage.feature.headline1" default="This is an english text" /> The above works. But now I a have a message which should include a link like this: <g:message code="homepage.feature.headline1" default="This is an english text with <a href='somefile.html'>a link</a>" /> This gives me an exception: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Grails tags were not closed! [[<g:message>]] in GSP How can I achieve that I can include a link there? I have tried escaping the < brackets but still no luck. I really would like to avoid splitting up this one sentence into multiple smaller sentences. Thanks Christoph

    Read the article

  • How do I write a constant-space length function in Haskell?

    - by Bill
    The canonical implementation of length :: [a] -> Int is: length [] = 0 length (x:xs) = 1 + length xs which is very beautiful but suffers from stack overflow as it uses linear space. The tail-recursive version: length xs = length' xs 0 where length' [] n = n length' (x:xs) n = length xs (n + 1) doesn't suffer from this problem, but I don't understand how this can run in constant space in a lazy language. Isn't the runtime accumulating numerous (n + 1) thunks as it moves through the list? Shouldn't this function Haskell to consume O(n) space and lead to stack overflow? (if it matters, I'm using GHC)

    Read the article

  • Using C# and gppg, how would I construct an abstract syntax tree?

    - by Rupert
    Is there a way to do this almost out-of-the-box? I could go and write a big method that would use the collected tokens to figure out which leaves should be put in which branches and in the end populate a TreeNode object, but since gppg already handled everything by using supplied regular expressions, I was wondering if there's an easier way? Even if not, any pointers as to how best to approach the problem of creating an AST would be appreciated. Apologies if I said anything silly, I'm only just beginning to play the compiler game. :)

    Read the article

  • Simple CSS Scale-Nine Layout

    - by rfkrocktk
    After all these years, I still haven't learned CSS layout, so bear with me. I'm trying to create a container with rounded corners that I generated in Photoshop. The background of the container is white, so I have eight images: top-left-corner, top, top-right-corner, right, bottom-right-corner, bottom, bottom-left-corner, and left. The edges have a drop shadow around them so yes, I do need 8 sides. How would I lay this out in CSS? I tried and failed miserably to do it with a table + CSS. How would I do it using divs?

    Read the article

  • My home box as my own host?

    - by Majid
    Hi all, I have a 512 kb/s DSL service at home. I do not have a static IP but I can get one if I pay some extra to my ISP. Now, if I get the static IP, can I make my home box act as my internet host? What else do I need? Thanks P.S. I know that if at all possible, the site I make available this way might be slow, that is alright, my question is if it is possible at all. Edit: I need this for very small traffic. I am a php developer and for my projects I am often asked to provide a demo. I currently use a free hosting for this purpose but it is down most of the time and support is non-existent. So I thought to set-up my home computer as my test server. With this please note that: I will only occasionally have 'visitors' and that will be one or possibly two visitors at any time. These demos, are to showcase functionality, so no big images are served and page views will normally generate under 100KB of traffic.

    Read the article

  • dynimically using pointer

    - by gcc
    Input: 3 1 2 n 4 5 d 1 21 30 x Output: 2: 4 5 21 30 Input: 3 j 3 34 6 22 10 51 n 1 2 j 1 3 4 5 n 6 7 x Output: 1: 1 2 3 4 5 2: 6 7 3: 34 6 22 10 51 'j': (Jump to array# command) 'd': (Delete array# command) 'n': (Next array command) 'x': (Exit command) #: (Integer number) int num_arrays; /* maximum number of arrays */ int **arrays; /* array of array pointers */ int *l_arrays; /* actual lengths of arrays */ int *c_arrays; /* actual capacities of arrays */ how can we write that code

    Read the article

  • Convert integer to formatted LPCWSTR. C++

    - by Mr Bell
    I have a direct3d project that uses D3DXCreateTextureFromFile() to load some images. This function takes a LPCWSTR for the path to file. I want to load a series of textures that are numbered consecutively (ie. MyImage0001.jpg, MyImage0002.jpg, etc) But c++'s crazy strings confuse me. How do i: for(int i=0; i < 3;i++) { //How do I convert i into a string path i can use with D3DXCreateTextureFromFile? }

    Read the article

  • Streamlining my javascript with a function

    - by liz
    i have a series of select lists, that i am using to populate text boxes with ids. so you click a select option and another text box is filled with its id. with just one select/id pair this works fine, but i have multiples, and the only thing that changes is the id of the select and input.. in fact just the ending changes, the inputs all start with featredproductid and the select ids all start with recipesproduct and then both end with the category. i know that listing this over and over for each category is not the way to do it. i think i need to make an array of the categories var cats = ['olive oil', "grains", "pasta"] and then use a forEach function? maybe? here is the clunky code window.addEvent('domready', function() { $('recipesproductoliveoil').addEvent('change', function(e){ pidselected = this.options[this.selectedIndex].getProperty('value') ; $("featuredproductidoliveoil").setProperties({ value: pidselected}); ; }); $('recipesproductgrains').addEvent('change', function(e){ pidselected = this.options[this.selectedIndex].getProperty('value') ; $("featuredproductidgrains").setProperties({ value: pidselected}); ; }); $('recipesproductpasta').addEvent('change', function(e){ pidselected = this.options[this.selectedIndex].getProperty('value') ; $("featuredproductidpasta").setProperties({ value: pidselected}); ; }); $('recipesproductpantry').addEvent('change', function(e){ pidselected = this.options[this.selectedIndex].getProperty('value') ; $("featuredproductidpantry").setProperties({ value: pidselected}); ; }); }); keep in mind this is mootools 1.1 (no i cant update it sorry). i am sure this is kind of basic, something i seem to have wrapping my brain around. but i am quite sure doing it as above is not really good...

    Read the article

  • Ruby 1.9: turn these 4 arrays into hash of key/value pairs

    - by randombits
    I have four arrays that are coming in from the client. Let's say that there is an array of names, birth dates, favorite color and location. The idea is I want a hash later where each name will have a hash with respective attributes: Example date coming from the client: [name0, name1, name2, name3] [loc0, loc1] [favcololor0, favcolor1] [bd0, bd1, bd2, bd3, bd4, bd5] Output I'd like to achieve: name0 => { location => loc0, favcolor => favcolor0, bd => bd0 } name1 => { location => loc1, favcolor => favcolor1, bd => bd1 } name2 => { location => nil, favcolor => nil, bd => bd2 } name3 => { location => nil, favcolor => nil, bd => bd3 } I want to have an array at the end of the day where I can iterate and work on each particular person hash. There need not be an equivalent number of values in each array. Meaning, names are required.. and I might receive 5 of them, but I only might receive 3 birth dates, 2 favorite colors and 1 location. Every missing value will result in a nil. How does one make that kind of data structure with Ruby 1.9?

    Read the article

  • gridview column popup window

    - by peter
    i want to implement ajax hover menu and i have a grid gridview1 like this <asp:GridView ID="GridView1" OnRowCommand="ScheduleGridView_RowCommand" runat="server" AutoGenerateColumns="False" Height="60px" Style="text-align: center" Width="869px" EnableViewState="False"> <Columns> <asp:BoundField HeaderText="Topic" DataField="Topic" /> <asp:BoundField DataField="Moderator" HeaderText="Moderator" /> <asp:BoundField DataField="Expert" HeaderText="Expert" /> <asp:BoundField DataField="StartTime" HeaderText="Start"> <HeaderStyle Width="175px" /> </asp:BoundField> <asp:BoundField DataField="EndTime" HeaderText="End"> <HeaderStyle Width="175px" /> </asp:BoundField> <asp:TemplateField HeaderText="Join" ShowHeader="False"> <ItemTemplate> <asp:Button ID="JoinBT" runat="server" CommandName="Join" Text="Join" Width="52px" /> </ItemTemplate> <HeaderStyle Height="15px" /> </asp:TemplateField> </Columns> </asp:GridView> so i registered <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> and added I added this way in code of gridview columns But i am getting fixed Edit/delete link in a new column rather than Hover menu,,Can any one tell me the solution to get hover menu

    Read the article

  • Android Apps not working in emulator

    - by Mohit Deshpande
    None of my apps work in the emulator. I am running Ubuntu 9.10 and everytime I try to access my UI, the app crashes. All I get is an "Sorry! The application ... has stopped unexpectedly". For EVERY app this happens. package com.mohit.helloandroid; import android.app.TabActivity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.widget.TabHost; public class HelloAndroid extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Resources res = getResources(); //Resource object to get drawables TabHost tabHost = getTabHost(); //The activity tabhost TabHost.TabSpec spec; //Reusable tab spec Intent intent; intent = new Intent().setClass(this, HelloAndroid.class); spec = tabHost.newTabSpec("artists").setIndicator("Artists", res .getDrawable(R.drawable.tab_artists)) .setContent(intent); tabHost.addTab(spec); } } I don't know how this code could possibly throw a message like that.

    Read the article

  • How to set the rpmbuild destination folder

    - by mkotechno
    I noticed rpmbuild (-bb and --buildroot options) creates the .rpm in different locations depending of what OS are you using: GNU/Linux Ubuntu <= 9.04: /usr/src/rpm/... GNU/Linux Ubuntu = 9.10: /home/rpmbuild/... GNU/Linux Fedora: /usr/src/redhat/... So how can I set manually the destination folder for all OS?

    Read the article

  • How to convert ByteString to [Word8] in Haskell?

    - by bodacydo
    I am dealing with ByteStrings and at this one place I need to use [Word8] but I have a ByteString. How do I convert a ByteString to [Word8] list? I tried unpack function from ByteString library but it returned a [Char] list rather than [Word8] list. Do I need to take this step and convert it first to [Char] list and only to [Word8] list? If so, how do I do that. Please advise the most efficient method! Thank you!

    Read the article

  • Really annoying bug with Topmost property in Windows Forms

    - by Nazgulled
    Hi, I have this Windows Forms application where it sits in the notification area. Clicking on the icon brings it up front, clicking it again (or clicking on the app X icon) sends it back. This is the type of app that having the window always on top is important when it's displayed by clicking the icon, but it's optional. Right-clicking the icon brings up a context menu where one can select to enable the "always on top" option or not. When the application first starts up, the app settings are read from an XML file and I'm 99% that this is working as it should, the Topmost properly is properly read (and written). After some time (minutes, hours, days, whatever, I normally hibernate and rarely shutdown) the Topmost stops working. I don't change the option, I don't think anything is changing the option but I click the notification area icon and app is not brought up front. It shows up (it displays on Alt+Tab) but it's on the background, it's not topmost as it should. I bring up the context menu, disable the option (cause it's enabled) and enable it back and it starts to work after that. The app is now topmost. However, it can lose this ability anytime after while. I can't understand why this happens and how this happens. Does anyone have any idea why? If not, any idea how could I try to debug such behavior?

    Read the article

  • Git-svn refuses to create branch on svn repository error: "not in the same repository"

    - by Danny
    I am attempting to create a svn branch using git-svn. The repository was created with --stdlayout. Unfortunately it generates an error stating the "Source and dest appear not to be in the same repository". The error appears to be the result of it not including the username in the source url. $ git svn branch foo-as-bar -m "Attempt to make Foo into Bar." Copying svn+ssh://my.foo.company/r/sandbox/foo/trunk at r1173 to svn+ssh://[email protected]/r/sandbox/foo/branches/foo-as-bar... Trying to use an unsupported feature: Source and dest appear not to be in the same repository (src: 'svn+ssh://my.foo.company/r/sandbox/foo/trunk'; dst: 'svn+ssh://[email protected]/r/sandbox/foo/branches/foo-as-bar') at /home/me/.install/git/libexec/git-core/git-svn line 610 I intially thought this was simply a configuration issue, examination of .git/config doesn't suggest anything incorrect. [svn-remote "svn"] url = svn+ssh://[email protected]/r fetch = sandbox/foo/trunk:refs/remotes/trunk branches = sandbox/foo/branches/*:refs/remotes/* tags = sandbox/foo/tags/*:refs/remotes/tags/* I am using git version 1.6.3.3. Can anyone shed any light on why this might be occuring, and how best to address it?

    Read the article

  • glui /usr/bin/ld: cannot find -lXmu

    - by Myx
    Hello: I have downloaded the latest GLUI source code and now I am trying to compile it. When I do so, I get the following error: g++ -O0 -Wall -pedantic -I./ -I./include -I/usr/X11R6/include -o bin/example1 example/example1.cpp -L./lib -lglui -L/usr/X11R6/lib/libXdmcp.a -lglut -lGLU -lGL -lXmu -lXext -lX11 -lXi -lm /usr/bin/ld: cannot find -lXmu collect2: ld returned 1 exit status When I did a locate libXmu, I get the following output: > %:~/src/GLUI/src$ locate libXmu > /usr/lib/libXmu.so.6 > /usr/lib/libXmu.so.6.2.0 > /usr/lib/libXmuu.so.1 > /usr/lib/libXmuu.so.1.0.0 Do I get the error because I don't have a /usr/lib/libXmu.so? If this is the case, how can I make one? (I am not experienced with linking at all). Thanks!

    Read the article

  • Windows 7 disc not recognized by DVD drive

    - by Ed Manet
    My machine is a recent model Systemax, less than 2 years old. It came with Vista 32bit and I bought Windows 7 Home Premium Upgrade for it. When I insert the Windows 7 DVD into the drive, it churns a little but does not recognize the disc. If I double click the DVD drive icon, it prompts me to insert a disc. I tried a different DVD (Office 2007) and the drive recognized the disc. I tried the Windows 7 disc in my Dell laptop and it recognized the disc. So basically, the disc is good and the drive is good, but they don't like each other. I tried to boot to the Windows 7 DVD and the system did not see it. I turned off the Lightscribe service and that didn't help. Does anybody have an idea what's wrong here? Thanks.

    Read the article

  • Color Management, Linux, Photoshop C2 via Wine

    - by Kyle Brandt
    I am new to Color Management CMS, so doing it on Linux, and then throw Wine into the mix ... and I am a little lost. However, I have Photoshop CS2 running okay with Crossover Professional on Ubuntu 9.10. I have a Canon 450D (Rebel XSI) and I imagine I will be able to find a profile for my printer. I ordered a Huey Calibrator (yet to come). I guess I will run into problems with Nvidia Twinview, but one calibrated monitor is good enough for now. Am I going to be able to get color management from Camera -- Monitor -- Print? Most specifically, when I get the Monitor profile loaded with something like xcalib, will Photoshop CS2 run through wine (crossover Pro) understand that? Will I need to select specific things / profiles in photoshop under the edit::Color Settings menu? I found several pages on http://jcornuz.wordpress.com/ helpful, but am wondering about the Wine issue, and anything else anyone can do to help.

    Read the article

  • Sorry. Not Much Happened Today!

    - by steve.diamond
    And THAT blog headline is dedicated to Seth Godin, who recently wrote that unlike its print brethren, digital media outlets aren't burdened with having to make their articles long enough to match the number of surrounding ad pages. He states that just because you CAN write more doesn't mean you SHOULD. Well, you don't have to tell me that twice. So to continue my rambling entry today, I'd suggest you read this post by Donal Daly on 10 steps to intelligent Social CRM for Sales. No seriously, read it. It's almost like a Groundswell Cliff Notes for sales people. I particularly love his third point. Of course I haven't "gotten" it yet, but I've got a whole life time, for crying out loud. Seriously, this is a great read and a fast one. And finally, in the department of longer reads, a thanks and shout out to Paul Greenberg for mentioning Oracle's new iPad app for Siebel CRM in his ZDNet blog. Hey, I warned you...not much happened today. Per se!

    Read the article

  • Strategy and AI for the game 'Proximity'

    - by smci
    'Proximity' is a strategy game of territorial domination similar to Othello, Go and Risk. Two players, uses a 10x12 hex grid. Game invented by Brian Cable in 2007. Seems to be a worthy game for discussing a) optimal strategy then b) how to build an AI Strategies are going to be probabilistic or heuristic-based, due to the randomness factor, and the high branching factor (starts out at 120). So it will be kind of hard to compare objectively. A compute time limit of 5s per turn seems reasonable. Game: Flash version here and many copies elsewhere on the web Rules: here Object: to have control of the most armies after all tiles have been placed. Each turn you received a randomly numbered tile (value between 1 and 20 armies) to place on any vacant board space. If this tile is adjacent to any ally tiles, it will strengthen each tile's defenses +1 (up to a max value of 20). If it is adjacent to any enemy tiles, it will take control over them if its number is higher than the number on the enemy tile. Thoughts on strategy: Here are some initial thoughts; setting the computer AI to Expert will probably teach a lot: minimizing your perimeter seems to be a good strategy, to prevent flips and minimize worst-case damage like in Go, leaving holes inside your formation is lethal, only more so with the hex grid because you can lose armies on up to 6 squares in one move low-numbered tiles are a liability, so place them away from your main territory, near the board edges and scattered. You can also use low-numbered tiles to plug holes in your formation, or make small gains along the perimeter which the opponent will not tend to bother attacking. a triangle formation of three pieces is strong since they mutually reinforce, and also reduce the perimeter Each tile can be flipped at most 6 times, i.e. when its neighbor tiles are occupied. Control of a formation can flow back and forth. Sometimes you lose part of a formation and plug any holes to render that part of the board 'dead' and lock in your territory/ prevent further losses. Low-numbered tiles are obvious-but-low-valued liabilities, but high-numbered tiles can be bigger liabilities if they get flipped (which is harder). One lucky play with a 20-army tile can cause a swing of 200 (from +100 to -100 armies). So tile placement will have both offensive and defensive considerations. Comment 1,2,4 seem to resemble a minimax strategy where we minimize the maximum expected possible loss (modified by some probabilistic consideration of the value ß the opponent can get from 1..20 i.e. a structure which can only be flipped by a ß=20 tile is 'nearly impregnable'.) I'm not clear what the implications of comments 3,5,6 are for optimal strategy. Interested in comments from Go, Chess or Othello players. (The sequel ProximityHD for XBox Live, allows 4-player -cooperative or -competitive local multiplayer increases the branching factor since you now have 5 tiles in your hand at any given time, of which you can only play one. Reinforcement of ally tiles is increased to +2 per ally.)

    Read the article

  • JBoss: What does the warning EJBTHREE-1246 from the InterceptorRegistry mean?

    - by Simon Lehmann
    I am currently developing an EJB 3.0 based application on the JBoss AS 5.0.0.GA and just recently the following warning showed up in the server log: 09:50:19,735 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container 09:50:19,735 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container 09:50:19,735 WARN [InterceptorRegistry] applicable interceptors is non-existent for ... ... The warnings are generated as soon as an EJB (a stateless session bean) is injected into a backing bean of my JSF web-application. The beans do work without problems though, but I still would like to know where that warning comes from and what I can do to avoid it. I have already searched a bit around, but haven't found a good answer (some say, bean developers do not have to worry, but its a warning, so I'd like to have a better solution): http://www.jboss.com/index.html?module=bb&op=viewtopic&t=147292 http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180366 http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140136 JBoss JIRA Issue about the warning (Not that helpful in my opinion) So has anyone an explanation what causes the warning (in terms of a bean developer, not application server developer) and what to do to avoid it? Update: I've just upgraded JBoss to 5.0.1.GA (Download, Release-Notes) but unfortunatly the warning still appears.

    Read the article

  • ActiveScaffold: How do I set the default value for a drop down list?

    - by Swamy g
    So I have this create form to create schedules where there is a bunch of fields and one of them is seasons. And seasons table has a field called 'is_current' which if set to 1 tells us that it is the current season. When the create form is display , I want the current season to be selected by default in the seasons drop down. Any help will be appreciated. Thanks.

    Read the article

  • ./a.out termniated . Garbage output due to smashing of stack . How to remove this error ?

    - by mekasperasky
    #include <iostream> #include <fstream> #include <cstring> using namespace std; typedef unsigned long int WORD; /* Should be 32-bit = 4 bytes */ #define w 32 /* word size in bits */ #define r 12 /* number of rounds */ #define b 16 /* number of bytes in key */ #define c 4 /* number words in key */ /* c = max(1,ceil(8*b/w)) */ #define t 26 /* size of table S = 2*(r+1) words */ WORD S [t],L[c]; /* expanded key table */ WORD P = 0xb7e15163, Q = 0x9e3779b9; /* magic constants */ /* Rotation operators. x must be unsigned, to get logical right shift*/ #define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1))))) #define ROTR(x,y) (((x)>>(y&(w-1))) | ((x)<<(w-(y&(w-1))))) void RC5_ENCRYPT(WORD *pt, WORD *ct) /* 2 WORD input pt/output ct */ { WORD i, A=pt[0]+S[0], B=pt[1]+S[1]; for (i=1; i<=r; i++) { A = ROTL(A^B,B)+S[2*i]; B = ROTL(B^A,A)+S[2*i+1]; } ct [0] = A ; ct [1] = B ; } void RC5_DECRYPT(WORD *ct, WORD *pt) /* 2 WORD input ct/output pt */ { WORD i, B=ct[1], A=ct[ 0]; for (i=r; i>0; i--) { B = ROTR(B-S [2*i+1],A)^A; A = ROTR(A-S [2*i],B)^B; } pt [1] = B-S [1] ;pt [0] = A-S [0]; } void RC5_SETUP(unsigned char *K) /* secret input key K 0...b-1] */ { WORD i, j, k, u=w/8, A, B, L [c]; /* Initialize L, then S, then mix key into S */ for (i=b-1,L[c-1]=0; i!=-1; i--) L[i/u] = (L[i/u]<<8)+K[ i]; for (S [0]=P,i=1; i<t; i++) S [i] = S [i-1]+Q; for (A=B=i=j=k=0; k<3*t; k++,i=(i+1)%t,j=(j+1)%c) /* 3*t > 3*c */ { A = S[i] = ROTL(S [i]+(A+B),3); B = L[j] = ROTL(L[j]+(A+B),(A+B)); } } void printword(WORD A) { WORD k; for (k=0 ;k<w; k+=8) printf("%c"); } int main() { WORD i, j, k,ptext, pt1 [2], pt2 [2], ct [2] = {0,0}; ifstream in("key1.txt"); ifstream in1("plt.txt"); ofstream out1("cpt.txt"); if(!in) { cout << "Cannot open file.\n"; return 1; } if(!in1) { cout << "Cannot open file.\n"; return 1; } unsigned char key[b]; in >> key; in1 >> pt1[0]; in1 >> pt1[0]; if (sizeof(WORD)!=4) printf("RC5 error: WORD has %d bytes.\n",sizeof(WORD)); RC5_SETUP(key); RC5_ENCRYPT(pt1,ct); printf("\n plaintext "); printword(pt1 [0]); printword(pt1 [1]); printf(" ---> ciphertext "); printword(ct [0]); printword(ct [1]); printf("\n"); RC5_SETUP(key); RC5_DECRYPT(ct,pt2); out1<<ct[0]; out1<<ct[1]; out1 <<"\n"; printf("\n plaintext "); printword(pt1 [0]); printword(pt1 [1]); return 0; } Let the plt.txt file contain 101 100 let the key be 111

    Read the article

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