Search Results

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

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

  • 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

  • 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

  • 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

  • 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 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

  • Unexpected behaviour of Order by clause(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 If I do a sorting (ascending), the output is Col1 col2 col3 col4 col5 0 1 5 6 3 1 4 0 3 7 1 5 1 4 6 1 8 2 1 5 4 3 2 1 4 The query is Select * from @t order by col1,col2,col3,col4,col5 But as can be seen that the sorting output is wrong (col2 to col5). Why so and how to overcome this? Thanks in advance

    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

  • 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

  • HELP Retrieving the url parameter from a JSON store from a EXTJS ComboBox

    - by Newbie
    I am having a problem retrieving the parameters from the url section of a json store for a combobox in EXTJS from my code behind page in c#. The following is the code in the store: var ColorStore = new Ext.data.JsonStore( { autoLoad: true, url: '/proxies/ReturnJSON.aspx?view=rm_colour_view', root: 'Rows', fields: ['company', 'raw_mat_col_code', 'raw_mat_col_desc'] }); And the following code is in my code behind page: protected void Page_Load(object sender, EventArgs e) { string jSonString = ""; connectionClass.connClass func = new connectionClass.connClass(); DataTable dt = func.getDataTable("sELECT * from rm_colour_view"); //Response.Write(Request.QueryString["view"]); string w = Request.Params.Get("url"); string z = Request.Params.Get("view"); string x = Request.Params.Get("view="); string c = Request.Params.Get("?view"); string s = Request.QueryString.Get("view"); string d = Request.Params["?view="]; string f = Request.Form["ColorStore"]; jSonString = Serialize(dt); Response.Write(jSonString); } The string w has gives the following output: /proxies/ReturnJSON.aspx but all the others strings return null... How can rm_colour_view from the datastore then be retrived??? Any help would be appreciated! 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

  • Cannot implicitly convert type ...

    - by Newbie
    I have the following function public Dictionary<DateTime, object> GetAttributeList( EnumFactorType attributeType ,Thomson.Financial.Vestek.Util.DateRange dateRange) { DateTime startDate = dateRange.StartDate; DateTime endDate = dateRange.EndDate; return (( //Step 1: Iterate over the attribute list and filter the records by // the supplied attribute type from assetAttribute in AttributeCollection where assetAttribute.AttributeType.Equals(attributeType) //Step2:Assign the TimeSeriesData collection into a temporary variable let timeSeriesList = assetAttribute.TimeSeriesData //Step 3: Iterate over the TimeSeriesData list and filter the records by // the supplied date from timeSeries in timeSeriesList.ToList() where timeSeries.Key >= startDate && timeSeries.Key <= endDate //Finally build the needed collection select new AssetAttribute() { TimeSeriesData = PopulateTimeSeriesData(timeSeries.Key, timeSeries.Value) }).ToList<AssetAttribute>().Select(i => i.TimeSeriesData)); } private Dictionary<DateTime, object> PopulateTimeSeriesData(DateTime dateTime, object value) { Dictionary<DateTime, object> timeSeriesData = new Dictionary<DateTime, object>(); timeSeriesData.Add(dateTime, value); return timeSeriesData; } Error:Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'System.Collections.Generic.Dictionary'. An explicit conversion exists (are you missing a cast?) Using C#3.0 Please help

    Read the article

  • How to launch new Firefox window with multiple tabs using Python

    - by newbie py
    Hi, I want to create a MSWindows Python program that would launch a new Firefox window with multiple tabs each time it is run. For example if I want to search "hello", a new window pops out (even if a Firefox window is already open) and then launches a Google and Bing tabs searching for "hello". If I change the keyword to "world", a new browser pops out again with Google and Bing tabs searching for "world". I've looked at the webbrowser module but couldn't get it to: 1. Launch a new browser when a browser is already open: e.g. webbrowser.open('http://www.google.com',new=1) will instead open a new tab 2. Launch multiple tabs simultaneously in the same window Appreciate the help. Thanks.

    Read the article

  • Rewrite the foreach using lambda + C#3.0

    - by Newbie
    I am tryingv the following foreach (DataRow dr in dt.Rows) { if (dr["TABLE_NAME"].ToString().Contains(sheetName)) { tableName = dr["TABLE_NAME"].ToString(); } } by using lambda like string tableName = ""; DataTableExtensions.AsEnumerable(dt).ToList().ForEach(i => { tableName = i["TABLE_NAME"].ToString().Contains(sheetName); } ); but getting compile time error "cannot implicitly bool to string". So how to achieve the same.? Thanks(C#3.0)

    Read the article

  • How can I apply indexer to Dictionary VALUES (C#3.0)

    - by Newbie
    I have done a program string[] arrExposureValues = stock.ExposureCollection[dt] .Values.ToArray(); for(int i=0;i<arrExposureValues .length;i++) Console.WriteLine(arrExposureValues[i]); Nothing wrong and works fine. But is it possible to do something like the below for(int i=0;i<stock.ExposureCollection[dt].Count;i++) Console.WriteLine(stock.ExposureCollection[dt].Values[i]); This is just for my sake of knowledge (Basically trying to accomplish the same in one line). Note: ExposureCollection is a dictionary object Dictionary<DateTime, Dictionary<string, string>> First of all I have the doubt if it is at all possible! I am using C#3.0. Thanks.

    Read the article

  • Passing parameters in VBA for Access

    - by Newbie
    In Access 2007 I have created a form with a textbox and a button. At the moment, when I press the button, I load a query with the textbox data passed as a parameter to the query criteria. I would like to change this so that all (manually input) options appear in a combobox (in place of the textbox). I would then like to pass the combobox text to a VBA module upon pressing the button. How do I do this? Similarly, I hope to output a different string from this module, and I hope to use this as the query criteria. How do I do this?

    Read the article

  • Rules regarding iPhone apps

    - by iphone newbie
    iphone dev has this rule for iphone developers Be certain that the items you offer for purchase do not contain, or relate to, pornography, hate speech, defamation, or gambling (simulated gambling is acceptable). But how come there are apps in the app store such as iBetMate, which, in fact, allows users to gamble? Is there a clause or something that I missed in Apple's rules?

    Read the article

  • OpenGL: How to clear only a part of the screen?

    - by Newbie
    Is it possible to not clear entire screen when using glClear() function? I need to clear only a part of the screen to save some rendering time, otherwise i would have to redraw half of the screen every frame, even if nothing is happening on the other half. Of course this should be done as quickly (or quickier) as the glClear() is now.

    Read the article

  • Pick up relevant information from a string using regular expression C#3.0

    - by Newbie
    Hi, I have a situation. I have been given some file name which can be like <filename>YYYYMMDD<fileextension> some valid file names that will satisfy the above pattern are as under xxx20100326.xls, xxx2v20100326.csv, x_20100326.xls, xy2z_abc_20100326_xyz.csv, abc.xyz.20100326.doc, ab2.v.20100326.doc, abc.v.20100326_xyz.xls In what ever be the above defined case, I need to pick up the dates only. So for all the cases, the output will be 20100326. I am trying to achieve the same but no luck. Here is what I have done so far string testdata = "x2v20100326.csv"; string strYYYY = @"\d{4}"; string strMM = @"(1[0-2]|0[1-9])"; string strDD = @"(3[0-1]|[1-2][0-9]|0[1-9])"; string regExPattern = @"\A" + strYYYY + strMM + strDD + @"\Z"; Regex regex = new Regex(regExPattern); Match match = regex.Match(testdata); if (match.Success) { string result = match.Groups[0].Value; } I am using c#3.0 and dotnet framework 3.5 Please help. It is very urgent Thanks in advance.

    Read the article

  • How can I create an Assembly program WITHOUT using libraries?

    - by Newbie
    Hello. I've literally only just started looking to learn Assembly language. I'm using the NASM assembler on Windows Vista. Usually, when I begin to learn a new language, I'll copy someone else's Hello World code and try to understand it line-by-line. However, I'm finding it suprisingy difficult to find a Hello World program that doesn't reference other libraries! You see, there's no point trying to understand each line of the code if it is closely linked with a whole library of additional code! One of the reasons I want to learn Assembly is so that I can have near complete control over the programs I write. I don't want to be depending on any libraries. And so my question is this: Can anyone give me NASM-compatible Assembly code to a completely stand-alone Hello World program that can output to the Windows Vista console? Alternatively, I appreciate that a library may be required to tell the pogram WHERE to print the output (ie. the Windows console). Other than that, I can't see why any libraries should be required. Am I overlooking anything?

    Read the article

  • Kill unload function in JS?

    - by Newbie
    Hello! Is there a way to kill the unload function with javascript(jquery)? I am looking for something like this: window.onbeforeunload = function(){ confirm("Close?") } or in jquery: $(window).unload(function() { confirm("close?") }); Now, on window unload I get my confirm alert but it will continue in any case. Clicking cancel it won't stay on my page. Can U help me plz?

    Read the article

  • AppDomain assemblies not being loaded correctly.

    - by SharePoint Newbie
    Hi, We are doing the following in the Application_Start (Global.ascx.cs) for a WCF Service hosted by IIS 7.0 (integrated pipeline). var mapperConfigurations = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(a => a.GetExportedTypes().Where(t => typeof (IMapperConfiguration).IsAssignableFrom(t) && t.IsClass)) .ToList(); The web-service has 8-10 assemblies in its bin folder and each of them have multiple implementations of IMapperConfiguration. After an IIS Reset, no mapper configurations are found (found this using debug.write). However, this behaviour is inconsistent and at other times all implementations of IMapperConfiguration are found. When exactly does IIS load assemblies and what is wrong with this code? Thanks

    Read the article

  • Get only Excel column names in C#

    - by Newbie
    Is there any easy way apart from ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+fileName+";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'"; using (objConn = new OleDbConnection(ConnectionString)) { objConn.Open(); Logger.Info("Reading the file "+fileName+"...."); objCmdSelect = new OleDbCommand("SELECT * FROM [" + sheetName + "$] WHERE 0 = 1", objConn); objAdapter = new OleDbDataAdapter(); objAdapter.SelectCommand = objCmdSelect; objDataset = new DataSet(); Logger.Info("Filling the dataset...."); objAdapter.Fill(objDataset, fileName); Logger.Info("Returning the dataset...."); return objDataset; } and then looping the datatables for getting the excel column names given a filename and sheet name? Using C#(and no interop services) Thanks

    Read the article

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