Search Results

Search found 306 results on 13 pages for 'kasun 456'.

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

  • Find products that have a list of attributes.

    - by bellesebastien
    I'm stuck trying to solve a problem that's proving to be more difficult than it seems. Consider there is a table that associates products with attributes, it looks like this: Products_id | Attribute_id 21 | 456 21 | 231 21 | 26 22 | 456 22 | 26 22 | 116 23 | 116 23 | 231 Next, I have a list of attribute_ids which I want to use in order to get the products that have all the attributes in that list. For example if I search in the table above using this list (456, 26) I should get these product_ids 21 and 22. Another example, if I search for (116, 231) I should get an empty response since there are no products that have both these attributes. How can I achieve this using one query? I hope I made my question clear. Thanks.

    Read the article

  • In SQL, what does Group By mean without Count(*), or Sum(), Max(), avg(), ..., and what are some use

    - by Jian Lin
    In SQL, if we use Group By without Count(*) or Sum(), etc, then the result is as follows: mysql> select * from sentGifts; +--------+------------+--------+------+---------------------+--------+ | sentID | whenSent | fromID | toID | trytryWhen | giftID | +--------+------------+--------+------+---------------------+--------+ | 1 | 2010-04-24 | 123 | 456 | 2010-04-24 01:52:20 | 100 | | 2 | 2010-04-24 | 123 | 4568 | 2010-04-24 01:56:04 | 100 | | 3 | 2010-04-24 | 123 | NULL | NULL | 1 | | 4 | 2010-04-24 | NULL | 111 | 2010-04-24 03:10:42 | 2 | | 5 | 2010-03-03 | 11 | 22 | 2010-03-03 00:00:00 | 6 | | 6 | 2010-04-24 | 11 | 222 | 2010-04-24 03:54:49 | 6 | | 7 | 2010-04-24 | 1 | 2 | 2010-04-24 03:58:45 | 6 | +--------+------------+--------+------+---------------------+--------+ 7 rows in set (0.00 sec) mysql> select *, count(*) from sentGifts group by whenSent; +--------+------------+--------+------+---------------------+--------+----------+ | sentID | whenSent | fromID | toID | trytryWhen | giftID | count(*) | +--------+------------+--------+------+---------------------+--------+----------+ | 5 | 2010-03-03 | 11 | 22 | 2010-03-03 00:00:00 | 6 | 1 | | 1 | 2010-04-24 | 123 | 456 | 2010-04-24 01:52:20 | 100 | 6 | +--------+------------+--------+------+---------------------+--------+----------+ 2 rows in set (0.00 sec) mysql> select * from sentGifts group by whenSent; +--------+------------+--------+------+---------------------+--------+ | sentID | whenSent | fromID | toID | trytryWhen | giftID | +--------+------------+--------+------+---------------------+--------+ | 5 | 2010-03-03 | 11 | 22 | 2010-03-03 00:00:00 | 6 | | 1 | 2010-04-24 | 123 | 456 | 2010-04-24 01:52:20 | 100 | +--------+------------+--------+------+---------------------+--------+ 2 rows in set (0.00 sec) Only 1 row is returned per "group". What does it mean when there is no "Count(*)", etc when using "Group By", and what are it uses? thanks.

    Read the article

  • jQuery if condition text contains

    - by olo
    I wrote a simple if condition, but not quite working. if text is 123 change to hi, if text is 456 change it to hi2 Could someone please give me a hand. <h1>123</h1> <h1>456</h1> <h1>789</h1>? $(document).ready(function() { var changeText1 = '123'; var changeText2 = '456'; var text = $(h1).text(); if (text == changeText) { $(this).text('hi'); } else if (text == changeText2 ) { $(this).text('hi2'); } }); ? http://jsfiddle.net/8P2ma/

    Read the article

  • SQL query mixing aggregated results and single values

    - by Paul Flowerdew
    I have a table with transactions. Each transaction has a transaction ID, and accounting period (AP), and a posting value (PV), as well as other fields. Some of the IDs are duplicated, usually because the transaction was done in error. To give an example, part of the table might look like: ID PV AP 123 100 2 123 -100 5 In this case the transaction was added in AP2 then removed in AP5. Another example would be: ID PV AP 456 100 2 456 -100 5 456 100 8 In the first example, the problem is that if I am analyzing what was spent in AP2, there is a transaction in there which actually shouldn't be taken into account because it was taken out again in AP5. In the second example, the second two transactions shouldn't be taken into account because they cancel each other out. I want to label as many transactions as possible which shouldn't be taken into account as erroneous. To identify these transactions, I want to find the ones with duplicate IDs whose PVs sum to zero (like ID 123 above) or transactions where the PV of the earliest one is equal to sum(PV), as in the second example. This second condition is what is causing me grief. So far I have SELECT * FROM table WHERE table.ID IN (SELECT table.ID FROM table GROUP BY table.ID HAVING COUNT(*) > 1 AND (SUM(table.PV) = 0 OR SUM(table.PV) = <PV of first transaction in each group>)) ORDER BY table.ID; The bit in chevrons is what I'm trying to do and I'm stuck. Can I do it like this or is there some other method I can use in SQL to do this? Edit 1: Btw I forgot to say that I'm using SQL Compact 3.5, in case it matters. Edit 2: I think the code snippet above is a bit misleading. I still want to mark out transactions with duplicate IDs where sum(PV) = 0, as in the first example. But where the PV of the earliest transaction = sum(PV), as in the second example, what I actually want is to keep the earliest transaction and mark out all the others with the same ID. Sorry if that caused confusion. Edit 3: I've been playing with Clodoaldo's solution and have made some progress, but still can't get quite what I want. I'm trying to get the transactions I know for certain to be erroneous. Suppose the following transactions are also in the table: ID PV AP 789 100 2 789 200 5 789 -100 8 In this example sum(PV) < 0 and the earliest PV < sum(PV) so I don't want to mark any of these out. If I modify Clodoaldo's query as follows: select t.* from t left join ( select id, min(ap) as ap, sum(pv) as sum_pv from t group by id having sum(pv) <> 0 ) s on t.id = s.id and t.ap = s.ap and t.pv = s.sum_pv where s.id is null This gives the result ID PV AP 123 100 2 123 -100 5 456 -100 5 456 100 8 789 100 3 789 200 5 789 -100 8 Whilst the first 4 transactions are ok (they would be marked out), the 789 transactions are also there, and I don't want them. But I can't figure out how to modify the query so that they're not included. Any ideas?

    Read the article

  • Proper DNS records for handling subdomains and missing subdomains

    - by Cerin
    I'm trying to craft DNS records to support: Explicitly defined subdomains, e.g. ftp.mydomain.com A missing subdomain that redirects to www. Implicitly defined subdomains, e.g. <some user entered value>.mydomain.com For 1, I'm using CNAME records. All seems to be working well. For 2, I'm using an A record, @ -> 123.456.789.012. Worked well. For 3, I ran into some trouble. I tried adding another A record, * -> 123.456.789.012. This appeared to work initially, but it broke #2. i.e. now browsing to mydomain.com doesn't redirect to www.mydomain.com. I tried adding the CNAME record @ -> 123.456.789.012, but my DNS admin tool won't accept it because it's saying the @ is already in use, even though I deleted the A record using it. Am I configuring this incorrectly? What am I doing wrong?

    Read the article

  • How to create small SPACES in HTML?

    - by karlthorwald
    There is em dash and en dash. Is there an "en" equivalent to &nbsp; ? Is there an en equivalent to pure Ascii 32? I want a better way to write this: 123<span class="spanen">&nbsp;</span>456<span class="spanen">&nbsp;</span>789 or this: 123<span class="spanen"> </span>456<span class="spanen"> </span>789

    Read the article

  • Using arrays with other arrays in Python.

    - by Scott
    Trying to find an efficient way to extract all instances of items in an array out of another. For example array1 = ["abc", "def", "ghi", "jkl"] array2 = ["abc", "ghi", "456", "789"] Array 1 is an array of items that need to be extracted out of array 2. Thus, array 2 should be modified to ["456", "789"] I know how to do this, but no in an efficient manner.

    Read the article

  • C++: Pass array created in the function call line

    - by Jarx
    How can I achieve a result like somebody would expect it according to the following code example: // assuming: void myFunction( int* arr ); myFunction( [ 123, 456, 789 ] ); // as syntactical sugar for... int values[] = { 123, 456, 789 }; myFunction( values ); The syntax I thought would work spit out a compile error. How can I define an argument array directly in the line where the function is called?

    Read the article

  • format - Help with printing a table

    - by Michael Kohl
    This question will probably end in a facepalm, but I've tried for a while and am still stuck despite reading through the hyperspec. Basically what I want to do is something like (format t "~{|~{ ~5d~}|~%~}" '((1 23 2 312) (23 456 1 7890))) but instead of hard-coding the 5 it should be calculated from the list (length of longest element from any nested list + 1) to give something like | 1 23 2 312| | 23 456 1 7890| Maybe I'm thinking way too complicated here and there is an easier way to do what I want, but I think I ran myself into a mental corner that I can't get out of.

    Read the article

  • Exact cin equivalent function in python

    - by gkt.pro
    Suppose user enter this string at terminal 123 456 456 //then hit enter How do I scan these three (could be more) numbers in different variables in python Could be something like this: for i in range(1,n) m[i]=#WHAT FUNCTION SHOULD I PUT HERE In c++ we can easily use cin>>m[i] inside above loop to scan the variables. If i use input() or raw_input() , they would scan whole line in single variable.

    Read the article

  • Using the public ssh key from local machine to access two remote users [closed]

    - by Nick
    I have an new Ubuntu (Hardy 8.04) server; it has two users, Alice and Bob. Alice is listed in sudoers. I appended my public ssh key (my local machine's public key local/Users/nick/.ssh/id_rsa.pub) to authorized_keys in remote_server/home/Alice/.ssh/authorized_keys, changed the permissions on Alice/.ssh/ to 700 and Alice/.ssh/authorized_keys to 600, and both the file and folder are owned my Alice. Then added I Alice to sshd_config (AllowUsers Alice). This works and I can login into Alice: ssh -v Alice@123.456.789.00 ... debug1: Offering public key: /Users/nick/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 277 debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug1: Entering interactive session. Last login: Mon Mar 15 09:51:01 2010 from 123.456.789.00 I then copied the authorized_keys file remote_server/home/Alice/.ssh/authorized_keys to remote_server/home/Bob/.shh/authorized_keys and changed the permissions and ownership and added Bob to AllowUsers in sshd_config (AllowUsers Alice Bob). Now when I try to login to Bob it will not authenticate the same public key. ssh -v Bob@123.456.789.00 ... debug1: Offering public key: /Users/nick/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/nick/.ssh/identity debug1: Trying private key: /Users/nick/.ssh/id_dsa debug1: No more authentication methods to try. Permission denied (publickey). Am I missing something fundamental about the way ssh works?

    Read the article

  • What can I do about ambigous wildcard patterns in Struts?

    - by Hanno Fietz
    I have a problem finding the right wildcard pattern to extract parts of my URL into action parameters in Struts. This is how I set up the action. The intent of the pattern is to capture the last two path elements and then everything that might precede them. <action name="**/*/*" class="com.example.ObjectAction"> <param name="filter">{1}</param> <param name="type">{2}</param> <param name="id">{3}</param> </action> Calling it with the URL channels/123/transmissions/456 I get the following result (the action just sets the input parameters on a POJO and returns that as XML): <result> <filter>channels/123/transmissions</filter> <id/> <type>456</type> </result> It should be: <result> <filter>channels/123</filter> <id>456</id> <type>transmissions</type> </result> Now, because ** matches all characters including the slash, I guess my pattern allows more than one way to match the URL, and Struts happens to pick one that leaves the id empty. Is the behaviour for multiple possible matches defined somewhere? Can I make the pattern less ambigous? Are there alternative ways of doing this? I'm running Struts 2.0.8. Upgrading to 2.1.9 would give me regex matching, but I got into trouble with Struts' dependencies and my OSGi environment when I went past 2.0.8, so I'd like to stick to that version for now.

    Read the article

  • Appending string in NSXMLNode

    - by iSight
    Hi, When I call the method setStringValue:mCurrentString when is encountered, the child elements which are already attached to element are detached. Can any one suggest why it is happening so. The sample XML file goes like this: <?xml version="1.0" encoding="UTF-8"?> <Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0"> <Page Id="123-234-345-456-567"> <Word/> <Text Id="234-345-456-567-678" Left="120.789" Top="120.234657" Width="300.2390" Height="50.00"> <Content> <![CDATA[<FlowDocument FontFamily="Helvetica" FontSize="24" Foreground="#FFFFFF00" TextAlignment="Left" PagePadding="5,0,5,0" AllowDrop="True" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Paragraph><Run FontFamily="Helvetica" FontSize="24" Foreground="FF00B38D" xml:lang="en-gb">This is for Testing purpose</Run></Paragraph>]]></Content> <Stroke Color="#FF00B300" Width="10"/> </Text> <Image Id="345-456-567-678-789" Left="200.345" Top="350.678" Width="200.00" Height="200.00"> <Source>Bear.png</Source> </Image> </Page> <Page Id="345-897-123-756-098" Left="100.90" Top="200.098" Width="200.098" Height="50.09"> <Image Id="756-098-978-685-298" Left="12098" Top="340.87" Right="109.78" Height="100.987"> <Source>Flower.png</Source> </Image> </Page> </Test> This is the method i am using for an NSXMLElement object: [mCurrentElement setStringValue:mCurrentString];// mCurrentString is the string that obtained through delegate method.

    Read the article

  • SQL UNION ALL with a INNER JOIN

    - by kOhm
    I'm looking for the best way to display all rows from two tables while joining first by one field (dwg) then where applicable a 2nd join on part. Table1 data consists of schematics(dwg) along with a list of parts required to build the item depicted in the drawing. Table2 consists of data about the actual parts ordered to build the schematic. Some parts in table2 are a combination of parts in table1 (ex: foo and bar in table1 were ordered as foobar in table2). I can display all rows in both tables with UNION ALL, but this doesn't join on both the dwg and part fields. I looked at FULL OUTER JOIN also, but I haven't figured out how to join first by dwg, then by part. Here is an example of the data. table1 table2 dwg part qty order dwg part qty ----- ----- ----- ----- ----- ----- ----- 123 foo 1 ord1 123 foobar 1 123 bar 1 ord1 123 bracket 2 123 widget 2 ord2 123 screw 4 123 bracket 4 ord2 123 nut 4 456 foo 1 ord2 123 widget 2 ord2 123 bracket 2 ord3 456 foo 1 Desired output: The goal is to create a view that provides visibility to all parts in table1 and the associated orders in table2 (including those parts that appear in one but not the other table) so that I can see all the drawing parts in table1 and the associated records in table2 along with records in table2 where the part wasn't in table1. part_request_order_report dwg part qty order part qty ----- ----- ----- ------ ----- ----- 123 foo 1 123 bar 1 123 widget 2 ord2 widget 2 123 bracket 4 ord1 bracket 2 123 bracket 4 ord2 bracket 2 123 ord1 foobar 1 123 ord1 screw 4 123 ord1 nut 4 456 foo 1 ord3 foo 1 Is this possible? Or am I better off iterating through the data to build the report table? Thanks in advance.

    Read the article

  • LINQ to XML query attributes

    - by kb
    Hi using LINQ to XML, this is a sample of my XML <shows> <Show Code="456" Name="My Event Name"> <Event Code="2453" VenueCode="39" Date="2010-04-13 10:30:00" /> <Event Code="2454" VenueCode="39" Date="2010-04-13 13:30:00" /> <Event Code="2455" VenueCode="39" Date="2010-04-14 10:30:00" /> <Event Code="2456" VenueCode="39" Date="2010-04-14 13:30:00" /> <Event Code="2457" VenueCode="39" Date="2010-04-15 10:30:00" /> </Show> <Show... /> <Show... /> </shows> How do I return a list of the Dates for a specfic show? I am passing the show code ("456") in the querystring and want all the dates/times returned as a list. This is the code i have so far: XDocument xDoc = XDocument.Load("path to xml"); var feeds = from feed in xDoc.Descendants("Show") where feed.Attribute("Code").Equals("456") select new { EventDate = feed.Attribute("Date").Value }; foreach(var feed in feeds) { Response.Write(feed.EventDate + "<br />"); } But i get no results returned

    Read the article

  • Read in double type from txt file - C++

    - by Greenhouse Gases
    Hi there I'm in the midst of a university project and have decided to implement a method that can accept information from a text file (in this instance called "locations.txt"). input from the text file will look like this: London 345 456 Madrid 234 345 Beinjing 345 456 Frankfurt 456 567 The function looks like this currently (and you will notice I am missing the While condition to finish adding input when reaches end of text in locations.txt, i tried using eof but this didnt work?!). Also get function expects a char and so cant accept input thats a double which is what the latitude and longitude are defined as... void populateList(){ ifstream inputFile; inputFile.open ("locations.txt"); temp = new locationNode; // declare the space for a pointer item and assign a temporary pointer to it while(HASNT REACHED END OF TEXT FILE!!) { inputFile.getline(temp-nodeCityName, MAX_LENGTH); // inputFile.get(temp-nodeLati, MAX_LENGTH); // inputFile.get(temp-nodeLongi, MAX_LENGTH); temp-Next = NULL; //set to NULL as when one is added it is currently the last in the list and so can not point to the next if(start_ptr == NULL){ // if list is currently empty, start_ptr will point to this node start_ptr = temp; } else { temp2 = start_ptr; // We know this is not NULL - list not empty! while (temp2-Next != NULL) { temp2 = temp2-Next; // Move to next link in chain until reach end of list } temp2->Next = temp; } } inputFile.close(); } Any help you can provide would be most useful. If I need to provide anymore detail I will do, I'm in a bustling canteen atm and concentrating is hard!!

    Read the article

  • Grouping arrays with consecutive keys

    - by KPL
    Hello people, I've an array like this - Array ( [16] => 424 [17] => 404 [18] => 416 [21] => 404 [22] => 456 [23] => 879 [28] => 456 [29] => 456 [32] => 123 [35] => 465 ) The output of this array would be Array ( [0] => Array ( ['start'] => 16 ['stop'] => 18 ) [1] => Array ( ['start'] => 21 ['stop'] => 23 ) [2] => Array ( ['start'] => 28 ['stop'] => 29 ) [3] => Array ( ['start'] => 32 ['stop'] => 33 ) [4] => Array ( ['start'] => 35 ['stop'] => 36 ) ) I don't really need the values. Just grouping the keys. And if consecutive integer doesn't exist for a particular key(like for [32] and [35]), 'stop' should be the consecutive integer. Thank you all for help.

    Read the article

  • SSH - using keys works, but not in a script

    - by Garfonzo
    I'm kind of confused, I have set up public keys between two servers and it works great, sort of. It only works if I ssh manually from a terminal. When I put the ssh command into a python script, it asks me for a password to login. The script is using rsync to sync up a directory from one server to the other. manual ssh command that works, no password prompt, automatic login: ssh -p 1234 garfonzo@123.456.789.123 In the Python script: rsync --ignore-existing --delete --stats --progress -rp -e "ssh -p 1234" garfonzo@123.456.789.123:/directory/ /other/directory/ What gives? (obviously, ssh details are fake)

    Read the article

  • Command-line access to remote MySQL server

    - by Jerry Krinock
    I administer a website on a remote, shared host. My web host offers MySQL, and I am able to access this from my Mac OS X computer using a GUI program, Sequel Pro. That works great. But I want to script some queries, and Sequel Pro is not scriptable. What should I do? I've read about tunneling to mysql via SSH. I have shell access to the server, with an SSH key on my Mac, so ssh jerrykri@123.456.789.123 -p 7978 gets me in. Should tunneling the MySQL port 3306 work? Like this? ssh jerrykri@123.456.789.123 -L 3306:127.0.0.1:3306 (It "times out" after a minute.) Do I need to install mysql on my Mac?

    Read the article

  • Bash: Variable substitution in variable name with default value

    - by krissi
    i have the following variables: # config file MYVAR_DEFAULT=123 MYVAR_FOO=456 #MYVAR_BAR unset # program USER_INPUT=FOO TARGET_VAR=<need to be set> If the USER_INPUT is "foo", I want TARGET_VAR to be the value of MYVAR_FOO (TARGET_VAR=456). If USER_INPUT is "bar" I want TARGET_VAR to be set to MYVAR_DEFAULT (123), because MYVAR_BAR is unset. I prefer it to be sh-compatible and as a substitution string. But it might also be bash compatible and/or in a function. I got these snippets: # Default values for variable (sh-compatible) echo ${MYVAR_FOO-$MYVAR_DEFAULT} # Uppercase (bash compatible) echo ${USER_INPUT^^} I would need something like this: TARGET_VAR="${MYVAR_${USER_INPUT^^}-$MYVAR_DEFAULT}" # or somecommand -foo "${MYVAR_${USER_INPUT^^}-$MYVAR_DEFAULT}" This is to switch a bunch of variables between multiple "profiles". In the example, FOO and BAR are profiles. New profiles should be added easily, in this example there would be an implicit profile named BAZ, too, all variables to their default values. Unfortunately it is not that easy. Do you have an idea to solve this? Thanks in advance, krissi

    Read the article

  • Varnish VCL not allowing two separate IP addresses as backends

    - by Peter Griffin
    Every time I attempt to add an extra back end into our VCL file, it's fails. Here is the DAEMON_OPTS we are running off: DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/custom.vcl \ -u varnish -g varnish \ -S /etc/varnish/secret \ -s malloc,10G" And here is the offending backend(s) backend default { .host = "114.123.456.789"; .port = "8080"; } backend alt { .host = "203.123.456.789"; .port = "80"; } Any Ideas ? Gut feeling is it might need the backends to be set somewhere, but I'm not sure where.

    Read the article

  • trying to understand how Linux /etc/hosts file works with local and external IP addresses

    - by gkdsp
    Let's say I have a Linux server with an external IP of 123.456.789.012 and a local IP of 192.168.0.1. If it's /etc/hosts file looks like, for example, 123.456.789.012 host2.mydomain.com 192.168.0.1 host2.mydomain.com When an application on the server generates traffic to send using host2.mydomain.com, how does the server know whether to use the local or external IP address (since the same host name shows two IP addresses)? Or, does it need something additional than what I've presented here to decide this? Or, does it just sent it out as host2.mydomain.com and let the receiving end deal with it (if so, how to make sure traffic intended for local network indeed goes to local network)?

    Read the article

  • Apache mod_setenvif Server_Addr

    - by user18330
    I have an Apache server in a DMZ, reachaable on the LAN from 192.168.1.1, public 123.456.789.123. I'm trying to get it to require authentication if the inbound hits are coming from the public side. This doesn't seem to work: SetEnvIf SERVER_ADDR 123.456.789.123 local_nic=1 <Location /junk> Order Deny,Allow AuthName "Access required" AuthType Basic AuthUserFile /etc/httpd/conf/htpasswd Require valid-user </Location> What am I doing wrong? Sorry, HTML tags were wiping out my Apache directives.

    Read the article

  • Getting list of opened ssh connections by name

    - by lyrae
    I have a config file in my .ssh dir that looks like this Host somehostA HostName 123.45.67.89 User katsh So from my local machine, i can ssh into multiple machines by their name in the config file, like so ssh somehostA ssh somehostB ssh somehostC ... etc Is it possible to get a list of all machines i am connected to, by their name? I know I can do: lsof -i tcp -n | grep '\<ssh\>' and i'll get something like ssh 9871 katsh 3u IPv4 400199 0t0 TCP 987.654.2.2:47329->987.654.2.2:47329:ssh (ESTABLISHED) ssh 20554 katsh 3u IPv4 443965 0t0 TCP 123.456.7.8:41923->123.456.7.8:ssh (ESTABLISHED) But it does not list their names, just IP

    Read the article

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