Search Results

Search found 49435 results on 1978 pages for 'query string'.

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

  • Obtaining reference to Class instance by string name - VB.NET

    - by Jeff Williams
    Is it possible using Reflection or some other method to obtain a reference to a specific class instance from the name of that class instance? For example the framework for the applications i develop heavily uses public class instances such as: Public bMyreference as MyReference = new MyReference Then throughout the application bMyReference is used by custom controls and code. One of the properties of the custom controls is the "FieldName" which references a Property in these class instances (bMyReference.MyField) as a string. What i would like to be able to do is analyze this string "bMyReference.MyField" and then refer back to the actual Instance/Property. In VB6 I would use an EVAL or something simular to convert the string to an actual object but this obviously doesn't work in VB.net What I'm picturing is something like this Dim FieldName as String = MyControl.FieldName ' sets FielName to bMyReference.MyField Dim FieldObject() as String = FieldName.Split(".") ' Split into the Object / Property Dim myInstance as Object = ......... ' Obtain a reference to the Instance and set as myInstance Dim myProperty = myInstance.GetType().GetProperty(FieldObject(1))

    Read the article

  • PHP if string contains URL isolate it

    - by Dylan Taylor
    In PHP, I need to be able to figure out if a string contains a URL. If there is a URL, I need to isolate it as another separate string. For example: "SESAC showin the Love! http://twitpic.com/1uk7fi" I need to be able to isolate the URL in that string into a new string. At the same time the URL needs to be kept intact in the original string. Follow? I know this is probably really simple but it's killing me.

    Read the article

  • string parse and replace in for loop

    - by reffer
    i have a string that looks like this - "1AL||9CA||34CO||196WY||..." i want to use a for loop or while loop, in which if i have an integer, it should parse this string and delete the value matching that integer. example for above string string = "1AL||9CA||34CO||196WY||..." integer = 34 for ... loop new string = "1AL||9CA||196WY||..." As you can see the integer matched the integer 34 and deleted from one delimeter "||" to th next one. how can i do this?

    Read the article

  • MySQL database query returns empty result

    - by user1791096
    I am doing a data migration and getting empty result of simple query with one join. Following is the query Select * from users u INNER JOIN temp_users tu ON tu.uid = u.uid There hundreds of records which have same uid in both tables, but this query returns only one record. Following is the structure of tables users table uid: varchar(50) utf8_general_ci Yes NULL temp_users table uid: varchar(50) utf8_general_ci Yes NULL Is there anyone who faced same problem?

    Read the article

  • Rails - Trying to query from a date range...everything from today

    - by ChrisWesAllen
    I'm trying to figure the best way to query a date range from rails...I looked around on Google but am unsure about how to use this syntax. I have a Model that has various events and I like to add to my find condition a caveat that should only show events where the field :st_date is today or later, in effect only show me data that is current, nothing that happened before today. I ran into a problem because I have no end date to stop the query, I want to query everything from today to next month. I was thinking something like @events = Event.find(:all, :conditions => ["start_date between ? and ?", date.Today, date.next_month.beginning_of_month]) but I get the error undefined local variable or method `date'...... Do I need do anything particular to use the Date class? Or is there something wrong with my query syntax? I would really appreciate any help.

    Read the article

  • SQL Query in NHibernate diction

    - by Jan-Frederik Carl
    I have a SQL Query which works in SQL Management Studio: Select Id From table t Where t.Date= (Select Max(Date) From ( Select * From table where ReferenceId = xy) u) Reason is, from all entries with a certain foreign key, I want to receive the one with the highest date. I tried to reform this Query for use in NHibernate, and I got IQuery query = session.CreateQuery(String.Format( @"Select t.Id From table t Where t.Date = (Select Max(Date) From (Select * From table t where t.ReferenceItem.Id = " + item.ReferenceItem.Id + ")u)")); I get the error message: "In expected" How do I have to form the NHibernate query? What does the "In" mean?

    Read the article

  • Why is String final in Java?

    - by Alex
    From when I learned that the class java.lang.String is declared as final in Java, I was wondering why is that? I didn't find any answer back then, but this post: How to create a replica of String class in Java? reminded me of my query. Sure, String provides all the functionality I ever needed, and never thought of any operation that would require an extension of class String, but still you'll never know what someone might need! So, does anyone know what was the intent of the designers when they decided to make it final? See also: Why is String a sealed class in C#?

    Read the article

  • How to extract the Sql Command from a Complied Linq Query

    - by Harry
    In normal (not compiled) Linq to Sql queries you can extract the SQLCommand from the IQueryable via the following code: SqlCommand cmd = (SqlCommand)table.Context.GetCommand(query); Is it possible to do the same for a compiled query? The following code provides me with a delegate to a compiled query: private static readonly Func<Data.DAL.Context, string, IQueryable<Word>> Query_Get = CompiledQuery.Compile<Data.DAL.Context, string, IQueryable<Word>>( (context, name) => from r in context.GetTable<Word>() where r.Name == name select r); When i use this to generate the IQueryable and attempt to extract the SqlCommand it doesn't seem to work. When debugging the code I can see that the SqlCommand returned has the 'very' useful CommandText of 'SELECT NULL AS [EMPTY]' using (var db = new Data.DAL.Context()) { IQueryable<Word> query = Query_Get(db, "word"); SqlCommand cmd = (SqlCommand)db.GetCommand(query); Console.WriteLine(cmd != null ? cmd.CommandText : "Command Not Found"); } I can't find anything in google about this particular scenario, as no doubt it is not a common thing to attempt... So.... Any thoughts?

    Read the article

  • Linq2Sql: query - subquery optimisation

    - by Budda
    I have the following query: IList<InfrStadium> stadiums = (from sector in DbContext.sectors where sector.Type=typeValue select new InfrStadium(sector.TeamId) ).ToList(); and InfrStadium class constructor: private InfrStadium(int teamId) { IList<Sector> teamSectors = (from sector in DbContext.sectors where sector.TeamId==teamId select sector) .ToList<>(); ... work with data } Current implementation perform 1+n queries, where n - number of records fetched the 1st time. I want to optimize that. And another one I would love to do using 'group' operator in way like this: IList<InfrStadium> stadiums = (from sector in DbContext.sectors group sector by sector.TeamId into team_sectors select new InfrStadium(team_sectors.Key, team_sectors) ).ToList(); with appropriate constructor: private InfrStadium(int iTeamId, IEnumerable<InfrStadiumSector> eSectors) { IList<Sector> teamSectors = eSectors.ToList(); ... work with data } But attempt to launch query causes the following error: Expression of type 'System.Int32' cannot be used for constructor parameter of type 'System.Collections.Generic.IEnumerable`1[InfrStadiumSector]' Question 1: Could you please explain, what is wrong here, I don't understand why 'team_sectors' is applied as 'System.Int32'? I've tried to change query a little (replace IEnumerable with IQueryeable): IList<InfrStadium> stadiums = (from sector in DbContext.sectors group sector by sector.TeamId into team_sectors select new InfrStadium(team_sectors.Key, team_sectors.AsQueryable()) ).ToList(); with appropriate constructor: private InfrStadium(int iTeamId, IQueryeable<InfrStadiumSector> eSectors) { IList<Sector> teamSectors = eSectors.ToList(); ... work with data } In this case I've received another but similar error: Expression of type 'System.Int32' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable1[InfrStadiumSector]' of method 'System.Linq.IQueryable1[InfrStadiumSector] AsQueryableInfrStadiumSector' Question 2: Actually, the same question: can't understand at all what is going on here... P.S. I have another to optimize query idea (describe here: Linq2Sql: query optimisation) but I would love to find a solution with 1 request to DB).

    Read the article

  • I need to iterate a loop to every time find the string appearing after a particular string say "if(O

    - by Parth
    I need to iterate a loop to every time find the string appearing after a particular string say "if(OLD.", then which PHP function will be helpful for me? Suppose I have a variable say, $string, according to any select query say "select * friends", Now any of its value contain a string say "how are you Jack?" Now I want to iterate a loop around the above value containing variable to get the varying name of friends after a string "how are you "... Hence I need a function of PHP to accomplish it... Please help

    Read the article

  • Issue with string in c#

    - by user1740381
    I have a problem with string in c#. I have following string : Here Fonts is the string array contains google fonts name : string fontsLink = "<link rel='stylesheet' id='fontrequest' href='http://fonts.googleapis.com/css?family='" + Fonts + "type='text/css' media='all'>"; this string is rendering wrong in the browser : <link rel="stylesheet" id="fontrequest" href="http://fonts.googleapis.com/css?family=" times+new+roman|offside|dangrek|days+onetype="text/css" media="all"> The problem is with the href attribute value. How can i solve this ?

    Read the article

  • How to combine query strings in PHP

    - by incrediman
    Given a url, and a query string, how can I get the url resulting from the combination of the query string with the url? I'm looking for functionality similar to .htaccess's qsa. I realize this would be fairly trivial to implement completely by hand, however are there built-in functions that deal with query strings which could either simplify or completely solve this? Example input/result sets: Url="http://www.example.com/index.php/page?a=1" QS ="?b=2" Result="http://www.example.com/index.php/page?a=1&b=2" - Url="page.php" QS ="?b=2" Result="page.php?b=2"

    Read the article

  • Mysql query in drupal database - groupwise maximum with duplicate data

    - by nselikoff
    I'm working on a mysql query in a Drupal database that pulls together users and two different cck content types. I know people ask for help with groupwise maximum queries all the time... I've done my best but I need help. This is what I have so far: # the artists SELECT users.uid, users.name AS username, n1.title AS artist_name FROM users LEFT JOIN users_roles ur ON users.uid=ur.uid INNER JOIN role r ON ur.rid=r.rid AND r.name='artist' LEFT JOIN node n1 ON n1.uid = users.uid AND n1.type = 'submission' WHERE users.status = 1 ORDER BY users.name; This gives me data that looks like: uid username artist_name 1 foo Joe the Plumber 2 bar Jane Doe 3 baz The Tooth Fairy Also, I've got this query: # artwork SELECT n.nid, n.uid, a.field_order_value FROM node n LEFT JOIN content_type_artwork a ON n.nid = a.nid WHERE n.type = 'artwork' ORDER BY n.uid, a.field_order_value; Which gives me data like this: nid uid field_order_value 1 1 1 2 1 3 3 1 2 4 2 NULL 5 3 1 6 3 1 Additional relevant info: nid is the primary key for an Artwork every Artist has one or more Artworks valid data for field_order_value is NULL, 1, 2, 3, or 4 field_order_value is not necessarily unique per Artist - an Artist could have 4 Artworks all with field_order_value = 1. What I want is the row with the minimum field_order_value from my second query joined with the artist information from the first query. In cases where the field_order_value is not valuable information (either because the Artist has used duplicate values among their Artworks or left that field NULL), I would like the row with the minimum nid from the second query.

    Read the article

  • small string optimization for vector?

    - by BuschnicK
    I know several (all?) STL implementations implement a "small string" optimization where instead of storing the usual 3 pointers for begin, end and capacity a string will store the actual character data in the memory used for the pointers if sizeof(characters) <= sizeof(pointers). I am in a situation where I have lots of small vectors with an element size <= sizeof(pointer). I cannot use fixed size arrays, since the vectors need to be able to resize dynamically and may potentially grow quite large. However, the median (not mean) size of the vectors will only be 4-12 bytes. So a "small string" optimization adapted to vectors would be quite useful to me. Does such a thing exist? I'm thinking about rolling my own by simply brute force converting a vector to a string, i.e. providing a vector interface to a string. Good idea?

    Read the article

  • Mysql query taking too much time

    - by aditya
    I have problem related to mysql database. i am linux webserver admin and i am facing a problem with a mysql query. The database is very small. I tried to track in logs and found that a query is taking minimum 5 sec to respond . The first page of site is coming from the database. Client are using cms. when the server gets some number of hits database server starts to give response very slowly and wait time increases from 5 sec to several seconds. I checked slow query logs { Query_time: 11.480138 Lock_time: 0.003837 Rows_sent: 921 Rows_examined: 3333 SET timestamp=1346656767; SELECT `Tender`.`id`, `Tender`.`department_id`, `Tender`.`title_english`, `Tender`.`content_english`, `Tender`.`title_hindi`, `Tender`.`content_hindi`, `Tender`.`file_name`, `Tender`.`start_publish`, `Tender`.`end_publish`, `Tender`.`publish`, `Tender`.`status`, `Tender`.`createdBy`, `Tender`.`created`, `Tender`.`modifyBy`, `Tender`.`modified` FROM `mcms_tenders` AS `Tender` WHERE `Tender`.`department_id` IN ( 31, 33, 32, 30 ); } Every line in the log is same only there is diff in Query time. Is there any way tweak the performance?

    Read the article

  • Is concatenating with an empty string to do a string conversion really that bad?

    - by polygenelubricants
    Let's say I have two char variables, and later on I want to concatenate them into a string. This is how I would do it: char c1, c2; // ... String s = "" + c1 + c2; I've seen people who say that the "" + "trick" is "ugly", etc, and that you should use String.valueOf or Character.toString instead. I prefer this construct because: I prefer using language feature instead of API call if possible In general, isn't the language usually more stable than the API? If language feature only hides API call, then even stronger reason to prefer it! More abstract! Hiding is good! I like that the c1 and c2 are visually on the same level String.valueOf(c1) + c2 suggests something is special about c1 It's shorter. Is there really a good argument why String.valueOf or Character.toString is preferrable to "" +? Trivia: in java.lang.AssertionError, the following line appears 7 times, each with a different type: this("" + detailMessage);

    Read the article

  • mysql select query optimization

    - by Saharsh Shah
    I have two table testa & testb. CREATE TABLE `testa` ( `id` INT(10) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) DEFAULT NULL, PRIMARY KEY (`id`) ); CREATE TABLE `testb` ( `id` INT(10) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) DEFAULT NULL, `aid1` INT(10) DEFAULT NULL, `aid2` INT(10) DEFAULT NULL, `aid3` INT(10) DEFAULT NULL, PRIMARY KEY (`id`) ); Currently I am running below query for retrieving all rows where id in testa table matches with any columns of aid1,aid2,aid3 in tableb. The query is retreiving acurate result but it is taking minimum 30 seconds to execute which is too much. I have also tried to optimise my query using UNION but failed to do so. SELECT a.id, a.name, b.name, b.id FROM testb b INNER JOIN testa a ON b.aid1 = a.id OR b.aid2 = a.id OR b.aid3 = a.id ; How do i optimize my query so it's total execution time is within 2-3 seconds? Thanks in advance...

    Read the article

  • Parsing String into multiple variable length String (C#)

    - by Nassign
    I am currently trying to convert a VB6 program into C#. There was extensive use of string splitting into structure. For example, Dim Sample AS String Sample = "John Doe New York Test Comment" Public Type Struct1 Name As String * 15 Address As String * 10 Comment As String * 20 End Type Dim dataStruct As Struct1 Set dataStruct = Sample When the dataStruct is set, it will automatically split value into the 3 structure member. Is there a special function to do this in C#. The only way I know how to do this is thru Attributes/Annotation describing the length and start position of string. Any other suggestion?

    Read the article

  • optimize a string.Format + replace.

    - by acidzombie24
    I have this function. The visual studio profile marked the line with string.Format as hot and were i spend much of my time. How can i write this loop more efficiently? public string EscapeNoPredicate(string sz) { var s = new StringBuilder(sz); s.Replace(sepStr, sepStr + sepStr); foreach (char v in IllegalChars) { string s2 = string.Format("{0}{1:X2}", seperator, (Int16)v); s.Replace(v.ToString(), s2); } return s.ToString(); }

    Read the article

  • Convert Text with newlines to a List<String>

    - by Vaccano
    I need a way to take a list of numbers in string form to a List object. Here is an example: string ids = "10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19"; List<String> idList = new List<String>(); idList.SomeCoolMethodToParseTheText(ids); <------+ | foreach (string id in idList) | { | // Do stuff with each id. | } | | // This is the Method that I need ----------------+ Is there something in the .net library so that I don't have to write the SomeCoolMethodToParseTheText myself?

    Read the article

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