Daily Archives

Articles indexed Friday June 28 2013

Page 14/19 | < Previous Page | 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Mysql query: count and distinct

    - by Azevedo
    I have this hypotetical MySQL table: TABLE cars: (year, color, brand) How do I count # of cars grouped by brand and year? I mean, how can I get to know how many colors are there grouped by brand like: brand "GM": total # of colors: 8. brand "GM": total # of years (grouped together): 14 (meaning there are count of 14 different years). brand "TOYOTA": total # of colors: 3. brand "TOYOTA": total # of years (grouped together): 10 (meaning there are count of 14 different years) I tried playing some queries with COUNT, DISTINCT, GROUP BY but I can't get to it. Actually I'm trying to get the 2 queries... +-------+---------------+ | brand | count(colors) | +-------+---------------+ +-------+--------------+ | brand | count(years) | +-------+--------------+ thanks a lot!

    Read the article

  • Access: Expression too complex to be evaluated

    - by user2502964
    I'm trying to sort out values from a database by the weekending date. The script I'm using functions on 6 of my 7 databases (they are all constructed identically). The 7th database doesn't function. I get the expression too complex error. any help figuring out why?? Here is my code: SELECT UPC_Test.Type, UPC_Test.[Model No], UPC_Test.[Model Desc], UPC_Test.[Serial No], Format(DateValue([UPC_Test].[Test Date]+7-Weekday([UPC_Test].[Test Date],0)),"m/d/yyyy") AS [Test Date], UPC_Test.Parameter, UPC_Test.[Failure Symptom], UPC_Test.[Repair Action], UPC_Test.[Factory Select], UPC_Test.[Test Station] FROM UPC_Test GROUP BY UPC_Test.Type, UPC_Test.[Model No], UPC_Test.[Model Desc], UPC_Test.[Serial No], Format(DateValue([UPC_Test].[Test Date]+7-Weekday([UPC_Test].[Test Date],0)),"m/d/yyyy"), UPC_Test.Parameter, UPC_Test.[Failure Symptom], UPC_Test.[Repair Action], UPC_Test.[Factory Select], UPC_Test.[Test Station] HAVING (((UPC_Test.Type)="Production") AND ((Format(DateValue([UPC_Test].[Test Date]+7-Weekday([UPC_Test].[Test Date],0)),"m/d/yyyy"))=[Enter]) AND ((UPC_Test.[Failure Symptom])<>"") AND ((UPC_Test.[Repair Action])<>"") AND ((UPC_Test.[Test Station])="UPC RF Test")) ORDER BY Format(DateValue([UPC_Test].[Test Date]+7-Weekday([UPC_Test].[Test Date],0)),"m/d/yyyy");

    Read the article

  • PHP Variable Passing in Foreach on same page

    - by tooly228
    I've been struggling this for a while and I simply can't figure this out. Here is my code: <?php foreach($list as $id =>$name) { echo("<td style=\"vertical-align:middle;\"> <a href=\"item=$id#confirm\" role=\"button\" data-toggle=\"modal\"> Buy</a></td></tr>"); }?> <html> <div class="modal small hide fade" id="confirm" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true"> <a href="redeem.php?item=<?php echo $id; ?>"><button class="btn btn-danger"> Buy</button></a></div> The main issue here is that the $id from the foreeach is not the same as the $id in the div class link. Instead the link is the end value of the foreach list.

    Read the article

  • CONCAT_WS rows in JOIN

    - by Alex Kiselev
    i have tables profiles (id, name, deleted) categories (id, name, deleted) profiles_categories (id, profile_id, category_id, , deleted) I have wrong query SELECT p.id, p.name CONCAT_WS(', ', c.name) AS keywords_categories FROM profiles p LEFT JOIN profiles_categories pc ON p.id = pc.profile_id LEFT JOIN categories c ON pc.id = c.id WHERE p.deleted = FALSE So, i want have result with all profiles with concan categories.name. Thanks

    Read the article

  • mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in

    - by user2533440
    I cannot figure out whats wrong with this code. Every time i try to run this file I get error mysql_fetch_assoc() expects parameter 1 to be resource <?php $q = "select * from tbfood"; $rs = mysql_query($q); while($msg = mysql_fetch_assoc($rs)){ echo "<p>".$msg["name"]."</p>"; echo "<p>".$msg["price"]."</p>"; if ($msg['idDruh'] == 1) { echo "string1"; } elseif ($msg['idDruh'] == 2) { echo "string2"; } elseif ($msg['idDruh'] == 3) { echo "string3"; } elseif ($msg['idDruh'] == 4) { echo "string4"; } elseif ($msg['idDruh'] == 5) { echo "string5"; } elseif ($msg['idDruh'] == 6) { echo "string6"; } elseif ($msg['idDruh'] == 7) { echo "string7"; } } ?>

    Read the article

  • xpath: string manipulation

    - by Jindan Zhou
    So in my scrapy project I was able to isolate some particular fields, one of the field return something like: [Rank Info] on 2013-06-27 14:26 Read 174 Times which was selected by expression: (//td[@class="show_content"]/text())[4] I usually do post-processing to extract the datetime information, i.e., 2013-06-27 14:26 Now since I've learned a little more on the xpath substring manipulation, I am wondering if it is even possible to extract that piece of information in the first place, i.e., in the xpath expression itself? Thanks,

    Read the article

  • Mock static method Activator.CreateInstance to return a mock of another class

    - by Jeep87c
    I have this factory class and I want to test it correctly. Let's say I have an abstract class which have many child (inheritance). As you can see in my Factory class the method BuildChild, I want to be able to create an instance of a child class at Runtime. I must be able to create this instance during Runtime because the type won't be know before runtime. And, I can NOT use Unity for this project (if so, I would not ask how to achieve this). Here's my Factory class that I want to test: public class Factory { public AnAbstractClass BuildChild(Type childType, object parameter) { AnAbstractClass child = (AnAbstractClass) Activator.CreateInstance(childType); child.Initialize(parameter); return child; } } To test this, I want to find a way to Mock Activator.CreateInstance to return my own mocked object of a child class. How can I achieve this? Or maybe if you have a better way to do this without using Activator.CreateInstance (and Unity), I'm opened to it if it's easier to test and mock! I'm currently using Moq to create my mocks but since Activator.CreateInstance is a static method from a static class, I can't figure out how to do this (I already know that Moq can only create mock instances of objects). I took a look at Fakes from Microsoft but without success (I had some difficulties to understand how it works and to find some well explained examples). Please help me! EDIT: I need to mock Activator.CreateInstance because I want to force this method to return another mocked object. The correct thing I want is only to stub this method (not to mock it). So when I test BuildChild like this: [TestMethod] public void TestBuildChild() { var mockChildClass = new Mock(AChildClass); // TODO: Stub/Mock Activator.CreateInstance to return mockChildClass when called with "type" and "parameter" as follow. var type = typeof(AChildClass); var parameter = "A parameter"; var child = this._factory.BuildChild(type, parameters); } Activator.CreateInstance called with type and parameter will return my mocked object instead of creating a new instance of the real child class (not yet implemented).

    Read the article

  • Bubble sort dropped images based on their names

    - by user2259784
    I have written a simple bubble sort function that sort an array of Image objects based on image names. For some reason my function is not swapping the elements of array when needed ( basically new assignment is not working) Here is my code : listOfFiles = event.dataTransfer.files; sortImages(listOfFiles); function sortImages(listOfFiles) { var re = /[0-9]/; var temp; for( var index=0; index < listOfFiles.length ; index++) { for ( var index2=0; index2 < listOfFiles.length-1 ; index2++) { var one = parseFloat(re.exec(listOfFiles[index2].name )); var two = parseFloat(re.exec(listOfFiles[index2+1].name)); console.log(one + " : " + two); if (one > two) { console.log(listOfFiles[index2+1]); console.log(listOfFiles[index2]); //following three lines don't work temp = listOfFiles[index2+1]; listOfFiles[index2+1] = listOfFiles[index2]; listOfFiles[index2] = temp; console.log(listOfFiles[index2+1]); console.log(listOfFiles[index2]); } } } }

    Read the article

  • How to show/open/bringToFront a Window that is inside the MainMenu.xib File?

    - by 0SX
    This is a stupid question that I should be able to answer myself but I can't seem to get it to work. I have a window inside my MainMenu.xib file that I want to show or bring to front. Right now I have it visible at launch and it works but if I close it with orderOut: and do another instance of it, buttons quit working. How can I reopen the same window that the NSApplication launched at the beginning of the app? I've spent 2+ days trying to figure a way to make it work but no luck. I've even tried to split the window out to it's own xib file but when I do that my methods from the appDelegate fail to respond/work. Any help would be much appreciated. I feel stupid for even asking such a simplistic question. lol Thanks.

    Read the article

  • how to search values in a dictionary that is assigned to a key for a PFObject without downloading all PFObjects of that class (iOS/Parse)

    - by mkc842
    Suppose I have a set of PFObjects (essentially dictionaries) of class "myObject". Objects of this class contain for key "myDictionary" a dictionary. "myDictionary", in turn, has a key "myKey" that I want to access and search for matches against "mySearchTerm". I don't want to download all myObject objects and then iterate through them to check myKey in each, because that would be very inefficient. I want to use a findObjects message to return just the matches. Is such a query possible? In other words, how can I search the values in a dictionary that is assigned to a key for a PFObject without downloading all PFObjects of that class? Here's what it might look like if there were a simple method for it, but I made up the containsKey part to clarify what I am contemplating: PFQuery *objectQuery = [PFQuery queryWithClassName:@"myObject"]; [objectQuery whereKey:@"myDictionary" ~containsKey~:@"myKey" equalTo:"mySearchTerm"];

    Read the article

  • Why notify listeners in a content provider query method?

    - by cbrulak
    Vegeolla has this blog post about content providers and the snippet below (at the bottom) with this line: cursor.setNotificationUri(getContext().getContentResolver(), uri); I'm curious as to why one would want to notify listeners about a query operation. Am I missing something? Thanks @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { // Uisng SQLiteQueryBuilder instead of query() method SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder(); // Check if the caller has requested a column which does not exists checkColumns(projection); // Set the table queryBuilder.setTables(TodoTable.TABLE_TODO); int uriType = sURIMatcher.match(uri); switch (uriType) { case TODOS: break; case TODO_ID: // Adding the ID to the original query queryBuilder.appendWhere(TodoTable.COLUMN_ID + "=" + uri.getLastPathSegment()); break; default: throw new IllegalArgumentException("Unknown URI: " + uri); } SQLiteDatabase db = database.getWritableDatabase(); Cursor cursor = queryBuilder.query(db, projection, selection, selectionArgs, null, null, sortOrder); // Make sure that potential listeners are getting notified cursor.setNotificationUri(getContext().getContentResolver(), uri); return cursor; }

    Read the article

  • Basic formatting. sed, or cut, or what?

    - by dsclough
    Very new to this whole Unix thing. I'm currently using korn shell to try and format some lines of text. My input has a couple of lines that look something like this Date/Time :- Monday June 03 00:00:00 EDT 2013 Host Name :- HostNameHere PIDS :- NumbersNLetters Product Name :- ProductName The desired output would be as follows: Date/Time="Monday June 03 00:00:00 EDT 2013" HostName="HostNameHere" PIDS="NumbersNLetters" ProductName="ProductName" So, I need to get rid of any spaces in the leftmost column, and throw everything in the rightmost column between quotations. I've looked at the cut command, and got this far: Cut -f 1,2 -d - Which might produce a result like Date/Time:Monday June 03 00:00:00 EDT 2013, which is close to what I want, but not quite. I wasn't sure if cut could let me add parentheses, and it doesn't look like I can remove spaces that way either. sed seems like it might be closer to the answer, but I wasn't able to find through googling how I might just look for any pattern and not a specific one. I apologize for the incredibly basic question, but reading documentation only gets you so far before your brain starts to ache... If there are any better resources I should be looking at I would be happy to get pointed in the right direction. Thanks!

    Read the article

  • Zoom on multiple areas in d3.js

    - by t2k32316
    I'm planning to have a geoJSON map inside my svg alongside other svg elements. I would like to be able to zoom (zoom+pan) in the map and keep the map in the same location with a bounding box. I can accomplish this by using a clipPath to keep the map within a rectangular area. The problem is that I also want to enable zooming and panning on my entire svg. If I do d3.select("svg").call(myzoom); this overrides any zoom I applied to my map. How can I apply zoom to both my entire svg and to my map? That is, I want to be able to zoom+pan on my map when my mouse is in the map's bounding box, and when the mouse is outside the bounding box, zoom+pan on the entire svg. Here's example code: http://bl.ocks.org/nuernber/aeaac0e8edcf7ca93ade. (how do I get around the cross domain issue to load the map?) <svg id="svg" width="640" height="480" xmlns="http://www.w3.org/2000/svg" version="1.1"> <defs> <clipPath id="rectClip"> <rect x="150" y="25" width="400" height="400" style="stroke: gray; fill: none;"/> </clipPath> </defs> <g id="outer_group"> <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" /> <g id="svg_map" style="clip-path: url(#rectClip);"> </g> </g> </svg><br/> <script type="text/javascript"> var svg = d3.select("#svg_map"); var mapGroup = svg.append("g"); var projection = d3.geo.mercator(); var path = d3.geo.path().projection(projection); var zoom = d3.behavior.zoom() .translate(projection.translate()) .scale(projection.scale()) .on("zoom", zoomed); mapGroup.call(zoom); var pan = d3.behavior.zoom() .on("zoom", panned); d3.select("svg").call(pan); mapGroup.attr("transform", "translate(200,0) scale(2,2)"); d3.json("ne_110m_admin_0_countries/ne_110m_admin_0_countries.geojson", function(collection) { mapGroup.selectAll("path").data(collection.features) .enter().append("path") .attr("d", path) .attr("id", function(d) { return d.properties.name.replace(/\s+/g, "")}) .style("fill", "gray").style("stroke", "white").style("stroke-width",1); } ); function panned() { var x = d3.event.translate[0]; var y = d3.event.translate[1]; d3.select("#outer_group").attr("transform", "translate("+x+","+y+") scale(" + d3.event.scale + ")"); } function zoomed() { previousScale = d3.event.scale; projection.translate(d3.event.translate).scale(d3.event.scale); translationOffset = d3.event.translate; mapGroup.selectAll("path").attr("d", path); } </script>

    Read the article

  • Where is Google Wallet Merchant PostBack Settings

    - by kstubs
    This is part rant part question. The rant is: I am so confused with Google Wallet/Checkout/InApp/Store/blah blah blah.. And, I find it incredibly difficult to not only login but to navigate my way around. Logging in is a quest in itself, I often find myself logging into Google Wallet, but I need the Sell/Merchant site usually. Enough Rant Can someone please tell me how to find my PostBack Url setting for an InApp Google Wallet purchase verification? Right now I'm logged into wallet.google.com/merchant and I swear this setting is no where to be found. I'm looking for this equivelant: https://sandbox.google.com/checkout/inapp/merchant/settings.html Thanks, Karl..

    Read the article

  • C++ classes use of double colon [duplicate]

    - by user2444217
    This question already has an answer here: What does the :: mean in C++? 5 answers What Does :: Mean? 3 answers I am learning C++. Now I don't fully understand what this does Some_Class::SomeClass { etc... } I would do some research for myself, but I'm not sure where to begin or what's it called. Help would be appreciated.

    Read the article

  • How do I make lambda functions generic in Scala?

    - by Electric Coffee
    As most of you probably know you can define functions in 2 ways in scala, there's the 'def' method and the lambda method... making the 'def' kind generic is fairly straight forward def someFunc[T](a: T) { // insert body here what I'm having trouble with here is how to make the following generic: val someFunc = (a: Int) => // insert body here of course right now a is an integer, but what would I need to do to make it generic? val someFunc[T] = (a: T) => doesn't work, neither does val someFunc = [T](a: T) => Is it even possible to make them generic, or should I just stick to the 'def' variant?

    Read the article

  • SSRS - Sort table based on column value

    - by Ehsan
    I am trying to sort the following table: hYear hSale ------------------------------------ [year] =Count(Fields!sale.Value) The table only has one row group (year) and no column group. I'd like to: -initially sort the table based on the calculated value; is it possible? -add interactive sort to calculated column based on the value. I assume I should sort 'Detail rows', but what will be the sort expression?

    Read the article

  • error: 'QTabWidget::QTabWidget(const QTabWidget&)' is private

    - by Mahdi_Nine
    I develop a program and I have 10 backups of it. I added some lines to it and when I compiled the project and now it has the following error: C:\Qt\Qt5.0.1\5.0.1\mingw47_32\include\QtWidgets\qtabwidget.h:173: error: 'QTabWidget::QTabWidget(const QTabWidget&)' is private the error is from * line namespace Ui { class ContentControl; } class ContentControl : public QTabWidget // * from this line { Q_OBJECT public: . . . } All backups have this error now. Any idea why? I re-installed Qt but the problem is still present.

    Read the article

  • C# code not take changes on server in asp.net MVC 4 ?

    - by Anirudha
    Originally posted on: http://geekswithblogs.net/anirugu/archive/2013/06/28/c-code-not-take-changes-on-server-in-asp.net-mvc.aspxToday I got a problem that When I make changes to My c# code and put them on FTP. The site still don’t take changes. I check the filesize of compile dll of my project in bin. Yes, File is uploaded but it’s not what my new code do.   If you ran into this problem Then I suggest you to delete old .pdb and .dll file of your project. for example your project namespace is xyz. delete the xyz.pdb and xyz.dll now upload your dll from bin to project bin on server. it will work

    Read the article

  • mod_fcgid: stderr: PHP Fatal error with Plesk 11.5.30 and php-pear

    - by netsetter
    Just upgraded to Plesk 11.5.30 and found out that sending SMTP emails with php pear aren't working anymore with following error message: mod_fcgid: stderr: PHP Fatal error: require_once(): Failed opening required 'Mail.php' (include_path='.:/usr/share/pear') in /var/www/vhosts/mydomain.com/httpdocs/check.php on line 4 I know in the new Plesk 11.5 they changed the structure of all vhosts, but the strange thing is that require_once('System.php') placed into the same directory and file is working correctly with no errors and is returning bool(true). Any hints where I could have a look with this mod_fcgid error when require_once('System.php') is working but require_once('Mail.php') isn't working?

    Read the article

  • Point Subdomain to another application on another domain

    - by Juanu Haedo
    I'm not a very experienced Server Administrator and I'm trying to set up a new one I just got. I'm Using IIS7 and DNS Server What I need is that a url such as: mail.domainA.com points to www.domainB.com/webmail And I want to do this for all other domains... I want all of my domains that start with mail., point to www.domainB.com/webmail In short: I need a Subdomain to redirect to another URL... An improvement would be to let the subdomain as it is on the address bar on the redirection, if possible... Any help?

    Read the article

  • How to set up hosting on Heroku and email forwarders on a WHM (cPanel)?

    - by matija
    I'm using DNSimple for managing my records, hosting my site at Heroku and I want to use a Linux WHM (cPanel) for managing emails forwarding (DNSimple has that feature, but it's currently not working properly). Hosting works, but I'm having a hard time getting emails to work. Here are my (pseudo-)records: Type Name TTL Points to --------------------------------------------------------- ALIAS | mydomain.com | 3600 | mydomain.herokuapp.com CNAME | www.mydomain.com | 3600 | mydomain.herokuapp.com CNAME | mail.mydomain.com | 600 | <WHM server IP address> MX | mydomain.com | 600 | <WHM server IP address> NS | mydomain.com | 3600 | ns1.dnsimple.com ... | ... | ... | ... NS | mydomain.com | 3600 | ns4.dnsimple.com There are two more records, SOA and TXT, generated by DNSimple, but I don't think those are relevant. When I add an A-record: A | mydomain.com | 3600 | WHM server IP address and change the mail CNAME and MX records to mydomain.com, emails start working, but then the hosting doesn't work anymore. Is this possible to achieve?

    Read the article

  • .bat file - Nagios v3.2 service check and start if stopped

    - by LbakerIT
    I'm just barely getting into programming so I do apologize for my ignorance. I'm trying to create a .bat file that will check if a service is running on XP Pro. If service is running it will exit 0. If the service is stopped start service wait 10 seconds (via ping i'm guessing) check if service is running if service is running exit 0 if service is stopped start service wait 10 seconds Do this check a total of 3 times. if service does not come up within that time: exit 2 Exit 0 = ok exit 1 = warning exit 3 = critical (and this will alert) I need to do this for 3 different services but i'm expecting that it would be better to create one per service. That way you get notified on the specific service that is not coming back up. The goal is that if the service stops it will start it. If after 30 seconds it is unable to start the service then it will send an alert. The reason I'm trying to do it with a .bat is this is consistent with all other scripts and I did not want to complicate it further by adding different kinds of code. Yay for consistency! Again I do apologize for my ignorance I've been thrown into this project last minute. Thank you for the help and reading my question!

    Read the article

  • Trying to script rsync using pam_exec

    - by Ricky-Rose
    I'm trying to write a bash script that will execute rsync when called by pam_exec. I've tried a couple different ways, and I'm not sure what I'm doing wrong. When I try to run the script at login by adding session optional pam_exec.so /usr/bin/local/sync.sh to my sshd file, it gives me an exit code of 12. if I log in and then manually run my script, it allows me to connect to the remote server, and it lists my files, but it doesn't actually sync anything. I have tried the code below using buth $USER and $PAM_USER. $PAM_USER doesn't work at all. #!/bin/sh rsync -azv -e ssh $USER@remote_server:/home/html/$USER/ /home/html/$USER

    Read the article

  • BT socket Device over Structured Cabling

    - by TheD
    Not sure if this is the right stack* site to post on but I believe cabling is a just subject. Essentially I have a Credit Card machine which is connected to a phone line via standard BT Socket. So basically, the port of the wall has a balun plugged in which takes the RJ45 outlet on the wall to BT, so I can plug the device in. This works fine, however I need the machine to be on the other side of the room so want to route it through my patch panel (strucutered cabling). How can this be done? So Device -- ? -- RJ45 port -- Patch Panel -- ? -- Balun out wall outlet Where ? is to be filled in ! :)

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19  | Next Page >