Search Results

Search found 2229 results on 90 pages for 'newbie'.

Page 19/90 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • How can I improve the below query?

    - 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 was able to get the answer by using the below query ;With numCTE As ( Select rn = 1 Union all Select rn+1 from numCTE where rn<1000) select SentenceID=id, WordOccurance=row_number()over(partition by TableA.ID order by rn), Word = substring(' '+sentences+' ', rn+1, charindex(' ',' '+sentences+' ', rn+1)-rn-1) from TableA join numCTE on rn <= len(' '+sentences+' ') where substring(' '+sentences+' ', rn,1) = ' ' order by id, rn How can I improve this query of mine.? Basically I am looking for a better solution than the one presented Thanks

    Read the article

  • SQL, combining the result

    - by Newbie
    I am using Access and have this SQL SELECT land.id, land.official_name, vaksiner.vaksiner FROM land INNER JOIN (vaksiner INNER JOIN land_sykdom ON vaksiner.id = land_sykdom.sykdom) ON land.kort = land_sykdom.land ORDER BY land.official_name The SQL gives me a result like this: id official_name vaksiner 1 a A 1 a C 2 b A 2 b B 2 b C But I want to combine the result so that it looks like this: id official_name vaksiner 1 a A, C 2 b A, B, C

    Read the article

  • c++ function overloading, making fwrite/fread act like PHP versions

    - by Newbie
    I'm used to the PHP fwrite/fread parameter orders, and i want to make them the same in C++ too. I want it to work with char and string types, and also any data type i put in it (only if length is defined). I am total noob on c++, this is what i made so far: size_t fwrite(FILE *fp, const std::string buf, const size_t len = SIZE_MAX){ if(len == SIZE_MAX){ return fwrite(buf.c_str(), 1, buf.length(), fp); }else{ return fwrite(buf.c_str(), 1, len, fp); } } size_t fwrite(FILE *fp, const void *buf, const size_t len = SIZE_MAX){ if(len == SIZE_MAX){ return fwrite((const char *)buf, 1, strlen((const char *)buf), fp); }else{ return fwrite(buf, 1, len, fp); } } Should this work just fine? And how should this be done if i wanted to do it the absolutely best possible way?

    Read the article

  • A btter way to represent Same value given multiple values(C#3.0)

    - by Newbie
    I have a situation for which I am looking for a more elegant solution. Consider the below cases "BKP","bkp","book-to-price" (will represent) BOOK-TO-PRICE "aop","aspect oriented program" (will represent) ASPECT-ORIENTED-PROGRAM i.e. if the user enter BKP or bkp or book-to-price , the program should treat that as BOOK-TO-PRICE. The same holds good for the second example(ASPECT-ORIENTED-PROGRAM). I have the below solution: Solution: if (str == "BKP" || str == "bkp" || str == "book-to-price" ) return "BOOK-TO-PRICE". But I think that there can be many other better solutions . Could you people please give some suggestion.(with an example will be better) I am using C#3.0 and dotnet framework 3.5

    Read the article

  • Maven giving error Missing artifact

    - by newbie
    I'm adding Google App Engine, Spring and Tiles2 to same project, for some reason Apache Maven gives this error. Missing artifact org.apache.commons:com.springsource.org.apache.commons.collections:jar:3.2.1:compile here is my pom.xml where i include dependency: <dependency> <groupId>org.apache.commons</groupId> <artifactId>com.springsource.org.apache.commons.collections</artifactId> <version>3.2.1</version> <type>pom</type> </dependency>

    Read the article

  • how to make condition to update table ?

    - by newBie
    hi..i want to make condition to update my table if there's already same data (in the same column) inserted in the table. im using If String.ReferenceEquals(hotel, hotel) = False Then insertDatabase() Else updateDatabase() End If this is the updateDatabase() 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)) & _ " where hotel = " & hotel & ")" the function manage to go into updateDatabase() but has some error saying "Incorrect syntax near 'Oriental'." Oriental is the data inserted in the table. is it suitable to use ReferenceEquals? im using vb.net and sql database..tq

    Read the article

  • is_admin? function in rails? - undefined method Error

    - by Newbie
    Hello! At the moment, I am creating some kind of admin panel/backend for my site. I want to do the following: Only admins (a user has a user_role(integer) -- 1 = admin, 2 = moderator, 3 = user) can see and access a link for the admin panel. So I created an admin_controller. In my admin controller I created a new function called is_admin?: class AdminController < ApplicationController def admin_panel end def is_admin? current_user.user_role == 1 end end my route looks like. map.admin_panel '/admin-panel', :controller => 'admin', :action => 'admin_panel' and in my _sidebar.html.erb (partial in applicaton.html.erb) I created the link: <%= link_to "Admin Panel", :admin_panel unless is_admin? %> Now I get an error called: undefined method `is_admin?' Where is the problem? Please help me solving this problem!

    Read the article

  • Help needed to write a LINQ with GROUP bY(C#3.0)

    - by Newbie
    I have a datatable whose structure is as under Week Dates Key_Factors Factor_Values --- ----- ----------- ------------- 1 29/12/2000 Factor_1 19.20 1 29/12/2000 Factor_2 20.67 1 29/12/2000 Factor_3 10 2 21/12/2007 Factor_1 20.54 2 21/12/2007 Factor_4 21.70 I have a Object model like WeekNumber(int) Dates(Datetime) FactorDictionary (Dictionary<string,double>) I am trying to populate the data from DataTable to my Object Model whose needed output is as under Desired Output ---------------- WeekNumber : 1 Dates : 29/12/2000 FactorDictionary: Key_Factors: Factor_1 Factor_Values:19.20 Key_Factors: Factor_2 Factor_Values:20.67 Key_Factors: Factor_3 Factor_Values:10 WeekNumber : 2 Dates : 21/12/2007 FactorDictionary: Key_Factors: Factor_1 Factor_Values:20.54 Key_Factors: Factor_4 Factor_Values:21.70 i.e. The result is grouped by weeks. Can I achieve the same by using LINQ. I am using C#(3.0) with framework(3.5) Thanks

    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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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 I add properties to a typo3 extbase domain model object?

    - by The Newbie Qs
    I want to store a username in a coupon object, each coupon object already has the uid of the user who created it. I can loop over the coupon objects and read the associated usernames from fe_users but how then will I save those usernames into the coupons so when they are passed to the template the usernames can be read like so coupon.username, or in some other easy way so each username will appear on the page with the right coupon as they are all printed out in a table? If I was doing basic php instead of typo3 i would just define a query but what is the typo3 v4.5 way? My code so far - which dies on the line where I try to assign the new property --creatorname -- to the $coup object. public function listAction() { $coupons = $this->couponRepository->findAll(); // @var Tx_Extbase_Domain_Repository_FrontendUserRepository $userRepository */ $userRepository = $this->objectManager->get("Tx_Extbase_Domain_Repository_FrontendUserRepository"); foreach ($coupons as $coup) { echo '<br />test '.$coup->getCreator(); echo '<br />count = '.$userRepository->countAll().'<br />'; $newObject = $userRepository->findByUid( intval($coup->getCreator())); //var_dump($newObject); var_dump($coup); echo '<br />getUsername '.$newObject->getUsername() ; $coup['creatorname'] = $newObject->getUsername(); echo '<br />creatorname '.$coup['creatorname'] ; } $this->view->assign('coupons', $coupons); }

    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

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >