Search Results

Search found 8083 results on 324 pages for 'total newbie'.

Page 46/324 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Rails: Added new Action in Controller, but there is no path?

    - by Newbie
    Hello! I try to do following: A user is on his profile page. Now he edits his profile. He klicks on update and the data is saved. Now I want to redirect the user to another kind of profile-edit-page. I did the following in my users_controller.rb: def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = 'User was successfully updated.' if(@user.team_id != nil) format.html { redirect_to(@user) } else format.html { redirect_to choose_team_path } end format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end def choose_team @user = User.find(params[:id]) end I created a view: /users/choose_team.html.erb Now I get the following error: undefined local variable or method `choose_team_path' for #<UsersController:0x1f56650> So I added choose_team to my routes.rb: map.choose_team 'choose-team', :controller => 'users', :action => 'choose_team' Now, after submitting my first edit form, it redirects me to http://localhost:3000/choose-team and I get following error: Couldn't find User without an ID What I want: If a user has no team_id, he should be redirected to my choose_team.html.erb for choosing a team, else he should be redirected to his profile/show. How to do this?

    Read the article

  • Need help building SQL Query (simple JOIN)

    - by Newbie
    Hello! In my database, I have a "users", a "quests" and a "questings" table. A user can solve a quest. Solving a quest will save the "user_id" and the "quest_id" in my "questings" table. Now, I want to select all quests, a user has NOT solved (meaning there is no entry for this user and quest in "questings" table)! Let's say the user has the id 14. How to write this query? After solving this query, I want to filter the results, too. A quest and a user has a city, too. What to do for writing a query which returns all quests, a user has NOT solved yet, in the users city (user city == quest city)?

    Read the article

  • Is it possible to get Java fmt messages bundle from database ?

    - by newbie
    I nedd to localize application and now files are loaded from text files. Is it possible to change source to database? This is how localized messages are now loaded: <!-- Application Message Bundle --> <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basename" value="/WEB-INF/messages/messages" /> <property name="cacheSeconds" value="0" /> </bean>

    Read the article

  • How do I set up Array/List dependencies in code with Castle Windsor?

    - by SharePoint Newbie
    Hi, I have the following classes: class Repository : IRepository class ReadOnlyRepository : Repository abstract class Command abstract CommandImpl : Command { public CommandImpl(Repository repository){} } class Service { public Service (Command[] commands){} } I register them in code as follows: var container = new Container("WindsorCOntainer.config"); var container = new WindsorContainer(new XmlInterpreter("WindsorConfig.xml")); container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel)); container.AddComponent("repository", typeof(RentServiceRepository)); container.Resolve<RentServiceRepository>(); container.AddComponent("command", typeof(COmmandImpl)); container.AddComponent("rentService", typeof (RentService)); container.Resolve<RentService>(); // Fails here I get the message that "RentService is waiting for dependency commands" What am I doing wrong? Thanks,

    Read the article

  • Extract words from sentence(s) using TSQL

    - by Newbie
    I have the following input. INPUT: TableA ID Sentences --- ---------- 1 I am a student 2 Have a nice time guys! What I need to do is to extract the words from the sentence(s) and insert each individual word in another table OUTPUT: SentenceID WordOccurance Word ---------- ------------ ----- 1 1 I 1 2 am 1 3 a 1 4 student 2 1 Have 2 2 a 2 3 nice 2 4 time 2 5 guys! I am using SQL Server 2005. My fruitless approach so far is ;With numCTE As ( Select rn = 1 Union all Select rn+1 from numCTE where rn<1000) , getWords As ( Select rn, ID, indiChars From numCTE Cross Apply(Select ID, indiChars = Substring(Sentences,1,rn) From inputTbl)x where indiChars <> '' ) Select Id, Word = stuff(select ',' + cast(indiChars) from getWords g1 where g1.Id = g2.Id for xml path(''),'',1,1)x from getWords g2 Group by g2.Id I am looking for a set based solution. Thanks

    Read the article

  • Google App Engine error Object Manager has been closed

    - by newbie
    I had following error from Google App Engine when I was trying to iterate list in JSP page with EL. Object Manager has been closed I solved problem with following coe, but I don't think that it is very good solution to this problem: public List<Item> getItems() { PersistenceManager pm = getPersistenceManager(); Query query = pm.newQuery("select from " + Item.class.getName()); List<Item> items = (List<Items>) query.execute(); List<Item> items2 = new ArrayList<Item>(); // This line solved my problem Collections.copy(items, items2); // and this also pm.close(); return (List<Item>) items; } When I tried to use pm.detachCopyAll(items) it gave same error. I understood that detachCopyAll() method should do same what I did, but that method should be part of data nucelus, so it should be used instead of my owm methods. So why dosen't detachCopyAll() work at all?

    Read the article

  • Unable to type cast <AnonymousType#1> to <WindowsFormsApplication1.Attributes> [ C#3.0 ]

    - by Newbie
    I have List<Attributes> la = new List<Attributes>(); la = (from t in result let t1 = t.AttributeCollection from t2 in t1 where t2.AttributeCode.Equals(attributeType) let t3 = t2.TimeSeriesData from k in t3.ToList() where k.Key.Equals(startDate) && k.Key.Equals(endDate) select new { AttributeCode = attributeType, TimeSeriesData = fn(k.Key, k.Value.ToString()) }).ToList<Attributes>(); I am getting the error: 'System.Collections.Generic.IEnumerable<AnonymousType#1>' does not contain a definition for 'ToList' and the best extension method overload 'System.Linq.Enumerable.ToList<TSource>(System.Collections.Generic.IEnumerable<TSource>)' has some invalid arguments I understood tye error meaning but how to type cast it. I have used var and then iterating over it got the result. But without that any other way by which I can do it? Using C# 3.0 Thanks

    Read the article

  • How to read the screen pixels?

    - by Newbie
    I want to read a rectangular area, or just one pixel from my screen. As if screenshot button was pressed, but it wouldnt copy the whole screen necessary. So im not talking just about my own program window pixels. How i do this?

    Read the article

  • Extract dates from filename

    - by Newbie
    I have a situation where I need to extract dates from the file names whose general pattern is [filename_]YYYYMMDD[.fileExtension] e.g. "xxx_20100326.xls" or x2v_20100326.csv The below program does the work //Number of charecter in the substring is set to 8 //since the length of YYYYMMDD is 8 public static string ExtractDatesFromFileNames(string fileName) { return fileName.Substring(fileName.IndexOf("_") + 1, 8); } Is there any better option of achieving the same? I am basically looking for standard practice. I am using C#3.0 and dotnet framework 3.5 Edit: I have like the solution and the way of answerig of LC. I have used his program like string regExPattern = "^(?:.*_)?([0-9]{4})([0-9]{2})([0-9]{2})(?:\\..*)?$"; string result = Regex.Match(fileName, @regExPattern).Groups[1].Value; The input to the function is : "x2v_20100326.csv" But the output is: 2010 instead of 20100326(which is the expected one). Can anyone please help.

    Read the article

  • How can I change timezone in Wordpress 2.9.2?

    - by newbie
    I have changed timezone from General Settings, but that had no effect, time still shows as default UTC time zone. Then I changed timezone in wp-settings.php with date_default_timezone_set('Europe/Helsinki'); but that din't work either. What could be wrong with my settings and why isn't timezone changing?

    Read the article

  • How to get data from ExtensionObject + WCF

    - by Newbie
    I am getting some data in the form ExtensionData in Client side. However, it is coming properly in the server side(means the class properties as expected) But how to get the data from the Extension object is not known to me. I am new to WCF and is using C# Hewlp needed.

    Read the article

  • Can the below function be improve?(C#3.0)

    - by Newbie
    I have the below function public static List<DateTime> GetOnlyFridays(DateTime endDate, int weeks, bool isIncludeBaseDate) { //Get only the fridays from the date range List<DateTime> dtlist = new List<DateTime>(); List<DateTime> tempDtlist = (from dtFridays in GetDates(endDate, weeks) where dtFridays.DayOfWeek == DayOfWeek.Friday select dtFridays).ToList(); if (isIncludeBaseDate) { dtlist = tempDtlist.Skip(1).ToList(); dtlist.Add(endDate); } else { dtlist = tempDtlist; } return dtlist; } What basically I am doing is getting the datelist using the GetDates function and then depending on the isIncludeBaseDate bool value(if true) skipping the last date and adding the Base Date It is working fine but can this program can be improve? I am using C#3.0 and Framework 3.5 Thanks

    Read the article

  • Replace beginning words(SQL SERVER 2005, SET BASED)

    - by Newbie
    I have the below tables. tblInput Id WordPosition Words -- ----------- ----- 1 1 Hi 1 2 How 1 3 are 1 4 you 2 1 Ok 2 2 This 2 3 is 2 4 me tblReplacement Id ReplacementWords --- ---------------- 1 Hi 2 are 3 Ok 4 This The tblInput holds the list of words while the tblReplacement hold the words that we need to search in the tblInput and if a match is found then we need to replace those. But the problem is that, we need to replace those words if any match is found at the beginning. i.e. in the tblInput, in case of ID 1, the words that will be replaced is only 'Hi' and not 'are' since before 'are', 'How' is there and it is not in the tblReplacement list. in case of Id 2, the words that will be replaced are 'Ok' & 'This'. Since these both words are present in the tblReplacement table and after the first word i.e. 'Ok' is replaced, the second word which is 'This' here comes first in the list of ID category 2 . Since it is available in the tblReplacement, and is the first word now, so this will also be replaced. So the desired output will be Id NewWordsAfterReplacement --- ------------------------ 1 How 1 are 1 you 2 is 2 me My approach so far: ;With Cte1 As( Select t1.Id ,t1.Words ,t2.ReplacementWords From tblInput t1 Cross Join tblReplacement t2) ,Cte2 As( Select Id, NewWordsAfterReplacement = REPLACE(Words,ReplacementWords,'') From Cte1) Select * from Cte2 where NewWordsAfterReplacement <> '' But I am not getting the desired output. It is replacing all the matching words. Urgent help needed*.( SET BASED )* I am using SQL SERVER 2005. Thanks

    Read the article

  • i have problem to get new inserted columnID using sql

    - by newBie
    hi I have an identity column defined as int in sql . I use SCPOE_IDENTITY () to get the new inserted column id. this is sample of my code: Dim sql As String = "insert into infoHotel (nameHotel, knownAs1, knownAs2, knownAs3, knownAs4, streetAddress) values (N" & _ FormatSqlParam(hotel) & ",N" & _ FormatSqlParam(KnownAs(0)) & ",N" & _ FormatSqlParam(KnownAs(1)) & ",N" & _ FormatSqlParam(KnownAs(2)) & ",N" & _ FormatSqlParam(KnownAs(3)) & ",N" & _ FormatSqlParam(StreetAddress) & _ "SELECT CAST(scope_identity() AS int)")" Dim objCommand1 As New SqlCommand(sql, conn) Dim infoID As Integer = objCommand1.ExecuteScalar() my problem here is, i cant get the infoID's value..is my code wrong?..some help plzz.. im using vb.net n sql

    Read the article

  • Multiple column sorting (SQL SERVER 2005)

    - by Newbie
    I have a table which looks like Col1 col2 col3 col4 col5 1 5 1 4 6 1 4 0 3 7 0 1 5 6 3 1 8 2 1 5 4 3 2 1 4 The script is declare @t table(col1 int, col2 int, col3 int,col4 int,col5 int) insert into @t select 1,5,1,4,6 union all select 1,4,0,3,7 union all select 0,1,5,6,3 union all select 1,8,2,1,5 union all select 4,3,2,1,4 I want the output to be every column being sorted in ascending order i.e. Col1 col2 col3 col4 col5 0 1 0 1 3 1 3 1 1 4 1 4 2 3 5 1 5 2 4 6 4 8 5 6 7 I already solved tye problem by the folowing program Select x1.col1 ,x2.col2 ,x3.col3 ,x4.col4 ,x5.col5 From (Select Row_Number() Over(Order By col1) rn1, col1 From @t)x1 Join(Select Row_Number() Over(Order By col2) rn2, col2 From @t)x2 On x1.rn1=x2.rn2 Join(Select Row_Number() Over(Order By col3) rn3, col3 From @t)x3 On x1.rn1=x3.rn3 Join(Select Row_Number() Over(Order By col4) rn4, col4 From @t)x4 On x1.rn1=x4.rn4 Join(Select Row_Number() Over(Order By col5) rn5, col5 From @t)x5 On x1.rn1=x5.rn5 But I am not happy with this solution. Is there any better way to achieve the same? (Using set based approach) If so, could any one please show an example. Thanks

    Read the article

  • How to get last Friday of month(s) using .NET

    - by Newbie
    I have a function that returns me only the fridays from a range of dates public static List<DateTime> GetDates(DateTime startDate, int weeks) { int days = weeks * 7; //Get the whole date range List<DateTime> dtFulldateRange = Enumerable.Range(-days, days).Select(i => startDate.AddDays(i)).ToList(); //Get only the fridays from the date range List<DateTime> dtOnlyFridays = (from dtFridays in dtFulldateRange where dtFridays.DayOfWeek == DayOfWeek.Friday select dtFridays).ToList(); return dtOnlyFridays; } Purpose of the function: "List of dates from the Week number specified till the StartDate i.e. If startdate is 23rd April, 2010 and the week number is 1,then the program should return the dates from 16th April, 2010 till the startddate". I am calling the function as: DateTime StartDate1 = DateTime.ParseExact("20100430", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); List<DateTime> dtList = Utility.GetDates(StartDate1, 4).ToList(); Now the requirement has changed a bit. I need to find out only the last Fridays of every month. The input to the function will remain same.

    Read the article

  • How to use Many to Many in Rails?

    - by Newbie
    Hello! In my project, I have users and quests. One User can join multiple quests and one quest can have multiple users. So I created a table called questing, containing the user_id and the quest_id. In my user.rb I did following: require 'digest/sha1' class User < ActiveRecord::Base has_many :questings has_many :quests ,:through =>:questings ... My Quest.rb: class Quest < ActiveRecord::Base has_many :questings has_many :users ,:through =>:questings ... My Questing.rb: class Questing < ActiveRecord::Base belongs_to :quest belongs_to :user end Now I want to create a link or button on my /quests/show.html.erb, calling an action in my controller, which will create the relationship between user and quest. So, in my quest_controller I did: def join_quest @quest = Quest.find(params[:id]) puts '************************' puts 'join quest:' + @quest.id puts '************************' respond_to do |format| format.html { redirect_to(@quest) } format.xml { head :ok } end end and in my show.html.erb I did: <%= link_to 'join this quest!!!', :action => :join_quest %> Now, clicking on this link will cause an error like: Couldn't find Quest with ID=join_quest and the url points to */quests/join_quest* instead of */quests/1/join_quest* Now my questions: Is my quests_controller the right place for my join_quest action, or should I move it to my users_controller? Why do I get this error? How to solve it? What do I have to write in my join_quest action for saving the relationship? On my /users/show.html.erb I want to output all quests the user joined. How to do this? I have to get all this quests from my relationship table, right? How? I hope you can help me! THX!

    Read the article

  • BASH Script to cd to directory with spaces in pathname

    - by Rails Newbie
    Argggg. I've been struggling with this stupid problem for days and I can't find an answer. I'm using BASH on Mac OS X and I'd like to create a simple executable script file that would change to another directory when it's run. However, the path to that directory has spaces in it. How the heck do you do this? This is what I have... Name of file: cdcode File contents: cd ~/My Code Now granted, this isn't a long pathname, but my actual pathname is five directories deep and four of those directories have spaces in the path. BTW, I've tried cd "~/My Code" and cd "~/My\ Code" and neither of these worked. If you can help, THANKS! This is driving me crazy!!

    Read the article

  • convert a class to byte array + C#

    - by Newbie
    How can I convert a Class to byte array in C#. This is a managed one so the following code is failing int objsize = System.Runtime.InteropServices.Marshal.SizeOf(objTimeSeries3D); byte[] arr = new byte[objsize]; IntPtr buff = System.Runtime.InteropServices.Marshal.AllocHGlobal(objsize); System.Runtime.InteropServices.Marshal.StructureToPtr(objTimeSeries3D, buff, true); System.Runtime.InteropServices.Marshal.Copy(buff, arr, 0, objsize); System.Runtime.InteropServices.Marshal.FreeHGlobal(buff); Thanks

    Read the article

  • i got sql syntax error when i debug my application..

    - by newBie
    hi..i want to update my database using formatsqlparam..but when i debug it, it has error saying "Incorrect syntax near ','." this is my code: Dim sql2 As String = "update infoHotel set nameHotel = N" & FormatSqlParam(hotel) & _ ", knownAs1 = N" & FormatSqlParam(KnownAs(0)) & _ ", knownAs2 = N" & FormatSqlParam(KnownAs(1)) & _ ", knownAs3 = N" & FormatSqlParam(KnownAs(2)) & _ ", knownAs4 = N" & FormatSqlParam(KnownAs(3)) & _ ", streetAddress = N" & FormatSqlParam(StreetAddress) & _ ", locality = N" & FormatSqlParam(Locality) & _ ", postalCode = N" & FormatSqlParam(PostalCode) & _ ", country = N" & FormatSqlParam(Country) & _ ", addressFull = N" & FormatSqlParam(address) & _ ", tel = N" & FormatSqlParam(contact) & "," Dim objCommand3 As New SqlCommand(sql2, conn) objCommand3.ExecuteNonQuery() maybe i missing some syntax..but couldnt find where it is..hope somebody can help..thnks in advance..im using vb.net and sql

    Read the article

  • Should we be giving the client's management team direct access to our git hub repository so that the

    - by SharePoint Newbie
    Hi, We are presently working for a client who is new to working with distributed teams. We have teams spread across India and the UK. Although we have decent project tracking tools (Mingle), would it be a good idea to the give the PM at the client access to our git hub repo. Would this be make it easier for them (see what the devs are working on and an insight into what the team has been developing). I agree that noot all commit messages would make sense to them but would this be a good way to boost their confidence in what we are doing? They already can check out our fortnightly releases on our QA and UA environments, but this still is behind dev by 5-6 days. Also, is there any reporting for git hub which makes it easier for PM types to make sense of it all? Thanks

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >