Daily Archives

Articles indexed Tuesday March 23 2010

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

  • How to Create MySQL Query to Find Related Posts from Multiple Tables?

    - by Robert Samuel White
    This is a complicated situation (for me) that I'm hopeful someone on here can help me with. I've done plenty of searching for a solution and have not been able to locate one. This is essentially my situation... (I've trimmed it down because if someone can help me to create this query I can take it from there.) TABLE articles (article_id, article_title) TABLE articles_tags (row_id, article_id, tag_id) TABLE article_categories (row_id, article_id, category_id) All of the tables have article_id in common. I know what all of the tag_id and category_id rows are. What I want to do is return a list of all the articles that article_tags and article_categories MAY have in common, ordered by the number of common entries. For example: article1 - tags: tag1, tag2, tag3 - categories: cat1, cat2 article2 - tags: tag2 - categories: cat1, cat2 article3 - tags: tag1, tag3 - categories: cat1 So if my article had "tag1" and "cat1 and cat2" it should return the articles in this order: article1 (tag1, cat1 and cat2 in common) article3 (tag1, cat1 in common) article2 (cat1 in common) Any help would genuinely be appreciated! Thank you!

    Read the article

  • syntax help required on templated static member function

    - by omatai
    I have a bunch of containers of object pointers that I want to iterate through in different contexts to produce diagnostics for them. I'm struggling with the syntax required to define the functions... which, on account of these objects filtering through diverse parts of my application, seem best encapsulated in a dedicated diagnostics class thus: // Code sketch only - detail fleshed out below... class ObjectListDiagnoser { public: static void GenerateDiagnostics( /* help required here! */ ); }; ... // Elsewhere in the system... ObjectListDiagnoser::GenerateDiagnostics( /* help required here! */ ); What I'd like to be able to do (in places across my application) is at least this: std::vector<MyObject *> objGroup1; std::list<MyObject *> objGroup2; ObjectListDiagnoser::GenerateDiagnostics( objGroup1.begin(), objGroup1.end() ); ObjectListDiagnoser::GenerateDiagnostics( objGroup2.begin(), objGroup2.end() ); ObjectListDiagnoser::GenerateDiagnostics( objGroup1.rbegin(), objGroup1.rend() ); I have tried to template my function in two ways, with no success: class ObjectListDiagnoser { public: // 1 - nope. template <class ObjIter> static void GenerateDiagnostics( ObjIter first, ObjIter last ); // 2. - nope. template <class Container, class ObjIter> static void GenerateDiagnostics( Container<MyObject *>::ObjIter first, Container<MyObject *>::ObjIter last ); }; Can someone provide the correct syntax for this? The container type will vary, and the direction of iteration will vary, but always for the same type of object.

    Read the article

  • I have a having a a matrix index bounds in matlab

    - by Ben Fossen
    I keep getting the error( this is in Matlab) Attempted to access r(0,0); index must be a positive integer or logical. Error in == Romberg at 15 I ran it with Romberg(1.3, 2.19,8) I think the problem is the statment is not logical because I made it positive and still got the same error. anyone got some ideas of what i could do? function Romberg(a, b, n) h = b - a; r = zeros(n,n); for i = 1:n h = h/2; sum1 = 0; for k = 1:2:2^(i) sum1 = sum1 + f(a + k*h); end r(i,0) = (1/2)*r(i-1,0) + (sum1)*h; for j = 1:i r(i,j) = r(i,j-1) + (r(i,j-1) - r(i-1,j-1))/((4^j) - 1); end end disp(r); end function f_of_x = f(x) f_of_x = sin(x)/x; end

    Read the article

  • What are good alternatives to SQL (the language)?

    - by Brendan Long
    I occasionally hear things about how SQL sucks and it's not a good language, but I never really hear much about alternatives to it. So, are other good languages that serve the same purpose (database access) and what makes them better than SQL? Are there any good databases that use this alternative language? EDIT: I'm familiar with SQL and use it all the time. I don't have a problem with it, I'm just interested in any alternatives that might exist, and why people like them better. I'm also not looking for alternative kinds of databases (the NoSQL movement), just different ways of accessing databases.

    Read the article

  • ICC vs GCC - Optimization and CPU architecture

    - by Rayne
    Hi all, I'm interested in knowing how GCC differs from Intel's ICC in terms of the optimization levels and catering to specific processor architecture. I'm using GCC 4.1.2 20070626 and ICC v11.1 for Linux. How does ICC's optimization levels (O1 to O3) differ from GCC, if they differ at all? The ICC is able to cater specifically to different architectures (IA-32, intel64 and IA-64). I've read that GCC has the -march compiler option which I think is similar, but I can't find a list of the options to use. I'm using Intel Xeon X5570, which is 64-bit. Are there any other GCC compiler options I could use that would cater my applications for 64-bit Intel CPUs? Thank you. Regards, Rayne

    Read the article

  • How to encrypt information in aspx page?

    - by Jimmyc
    Hi all, I know it's a silly question but , My client asked for encrypting some information form their payment system to prevent user stealing personal information. The system is web-base and written by ASP.NET We have tried some annoying solution such as JavaScript no right-click or css-no-print but apparently my client didn't like it. so are there any commercial solution to encrypt information in aspx produced html pages? or someone can tell me how to pursuit my client to stop these "prevent stealing" idea in a web-base system?

    Read the article

  • Fleunt NHibernate not working outside of nunit test fixtures

    - by thorkia
    Okay, here is my problem... I created a Data Layer using the RTM Fluent Nhibernate. My create session code looks like this: _session = Fluently.Configure(). Database(SQLiteConfiguration.Standard.UsingFile("Data.s3db")) .Mappings( m => { m.FluentMappings.AddFromAssemblyOf<ProductMap>(); m.FluentMappings.AddFromAssemblyOf<ProductLogMap>(); }) .ExposeConfiguration(BuildSchema) .BuildSessionFactory(); When I reference the module in a test project, then create a test fixture that looks something like this: [Test] public void CanAddProduct() { var product = new Product {Code = "9", Name = "Test 9"}; IProductRepository repository = new ProductRepository(); repository.AddProduct(product); using (ISession session = OrmHelper.OpenSession()) { var fromDb = session.Get<Product>(product.Id); Assert.IsNotNull(fromDb); Assert.AreNotSame(fromDb, product); Assert.AreEqual(fromDb.Id, product.Id); } My tests pass. When I open up the created SQLite DB, the new Product with Code 9 is in it. the tables for Product and ProductLog are there. Now, when I create a new console application, and reference the same library, do something like this: Product product = new Product() {Code = "10", Name = "Hello"}; IProductRepository repository = new ProductRepository(); repository.AddProduct(product); Console.WriteLine(product.Id); Console.ReadLine(); It doesn't work. I actually get pretty nasty exception chain. To save you lots of head aches, here is the summary: Top Level exception: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.\r\n\r\n The PotentialReasons collection is empty The Inner exception: The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly. Both the unit test library and the console application reference the exact same version of System.Data.SQLite. Both projects have the exact same DLLs in the debug folder. I even tried copying SQLite DB the unit test library created into the debug directory of the console app, and removed the build schema lines and it still fails If anyone can help me figure out why this won't work outside of my unit tests it would be greatly appreciated. This crazy bug has me at a stand still.

    Read the article

  • How to remove duplication from RSpec

    - by Asa
    context "answer is correct" do before(:each) do @answer = stub_model(Answer, :correct => true).as_new_record assigns[:answer] = @answer render "answers/summarize" end it "should display flashcard context properly" do response.should contain("Quiz") end it "should summarize results" do response.should contain("is correct") end end context "answer is incorrect" do before(:each) do @answer = stub_model(Answer, :correct => false).as_new_record assigns[:answer] = @answer render "answers/summarize" end it "should display flashcard context properly" do response.should contain("Quiz") end it "should summarize results" do response.should contain("is incorrect") end end How do I avoid repeating the following block within both of the above contexts? it "should display flashcard context properly" do response.should contain("Quiz") end

    Read the article

  • SQLAuthority News Were sorry but your computer or network may be sending automated queries. To pro

    I use multiple browser many times when I am working with multiple projects simultaneously. Often I use Google Reader to read few feeds. Recently, I faced the following error and this error will not go. I even restarted my computer and rebooted my network. I am confident that my computer does not have viruses or [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Playing with Windows Phone Developer Tools CTP

    tweetmeme_source = 'alpascual'; Installation tips. If Visual Studio 2010 Professional or higher is already installed on your development computer, an add-in for Visual Studio 2010 Professional is automatically installed as well. The installation took an hour on a Windows 7 with 4 GB of RAM and rebooted the computer once. Something tells me the installer still needs some work.   Lets Write some code Everything installed, lets check if Visual Studio 2008 still works with Silverlight...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Restoring Time Machine from two Macs onto one (new) mac

    - by Dan
    My parents used to have two Macs...a "iLamp-style" iMac for my Dad, and an iBook G4 for my Mom. A while back, I had setup the iMac to have an external Firewire Hard Drive for a Time Machine Volume, and backed up both the iMac and iBook to that drive. Recently, the iBook died and the iMac was really slow to work with. So my parents decided to replace the iBook with an iPad, and also purchased a Mac Mini. I need to help my parents get their data from their two computers (backed up by Time Machine) onto the same machine. Pretty much everything is identical between the two systems (same apps, etc), however, they both have individual email accounts and photos that they want to retain. Is it possible to do two Time Machine restores onto one computer?

    Read the article

  • How do find line in a List

    - by Shonna
    I have a text file. I read each line with sr.readline(); as i read that line, i want to search for it in a List that it should have been added to previously, then add it to a NEW list. How do i do this?

    Read the article

  • how to get menu item text using vc++?

    - by pasham
    My problem is "how to know which menu item is clicked in visual studio 2005". i wrote some code using hook for monitoring WM_MENUSELECT..it is working fine for notepad,visual c++6.0 applications but when i use this code for VS-2005 it is not woking(these type of msgs are not generating when i click menuitem in VS2005).. is there any other way to achive this... please help me on this..i am really getting irritating becoz i am struggling from last one month... any help is greatly appreciated...

    Read the article

  • NAnt or TFS build which is better?

    - by Leszek Wachowicz
    There was a question about Msbuild and NAnt advantages and disadvantages. Now let's see which is better TFS Build(with msbuild) or NAnt. In my opinion NAnt because you can easily move the building environment in few seconds to another machine (depends on copying files), also it's easier to manage, much faster to debug and it's not integrated with Team Foundation Server, what do You think?

    Read the article

  • Why does mysqldump need to be fully pathed when called from a controller or model?

    - by Kris
    When I call mysqldump from a controller or model I need to fully path the binary, when I call it from Rake I don't need to. If I do not fully path I get a zero byte file... I can confirm both processes are run using the same user. # Works in a controller, model and Rake task system "/usr/local/mysql/bin/mysqldump -u root #{w.database_name} > #{target_file}" # Only works in a Rake task system "mysqldump -u root #{w.database_name} > #{target_file}" If I call the Rake task from the action it also fails (zero byte file). OS: Mac Ruby 1.8.6 EDIT: I use Etc.getpwuid(Process.uid).name to get the User of the current process

    Read the article

  • Android always play intro clip

    - by mrmamon
    I'm trying to make my app to play intro clip for only when I start activities. But from my code it's always play the clip after wakeup before resume to app although I did not closed the app. What can I do to fix this prob? Thanks From main: startActivity(new Intent(this, MyIntro.class)); From MyIntro: public class MyIntro extends Activity implements OnCompletionListener { int a; @Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.intro); playIntro(); } public void onConfigurationChanged(Configuration newConfig) { setContentView(R.layout.intro); } public void onCompletion(MediaPlayer arg0) { // TODO Auto-generated method stub this.finish(); } private void playIntro(){ setContentView(R.layout.intro); VideoView video = (VideoView) this.findViewById(R.id.VideoView01); Uri uri = Uri.parse("android.resource://real.app/" + R.raw.intro); video.setVideoURI(uri); video.requestFocus(); video.setOnCompletionListener(this); video.start(); } }

    Read the article

  • Height of a html window's content (not just the viewport height)

    - by gatapia
    Hi All, I'm trying to get the height of a html window's content. This is the full height of the content not the visible height. I have had some (very limited) success using: document.getElementsByTagName('html')[0].offsetHeight in FireFox. This however fails in IEs and it fails in Chrome when using absolute positioned elements (http://code.google.com/p/chromium/issues/detail?id=38999). A sample html file that can be used to reproduce this is: <html> <head> <style> div { border:solid 1px red; height:2000px; width:400px; } .broken { position:absolute; top:0; left:0; } .fixed { position:relative; top:0; left:0; } </style> <script language='javascript'> window.onload = function () { document.getElementById('window.height').innerHTML = window.innerHeight; document.getElementById('window.screen.height').innerHTML = window.screen.height; document.getElementById('document.html.height').innerHTML = document.getElementsByTagName('html')[0].offsetHeight; } </script> </head> <body> <div class='fixed'> window.height: <span id='window.height'>&nbsp;</span> <br/> window.screen.height: <span id='window.screen.height'></span> <br/> document.html.height: <span id='document.html.height'></span> <br/> </div> </body> </html> Thanks All Guido Tapia

    Read the article

  • Maybe This is dead-simple stupid question, but how PHP translate our code ?

    - by justjoe
    i got this code ` // // prints out "Hello World!" // hello_world(); //First call function hello_world() { echo "Hello World!<br/>\n"; } hello_world(); //second call ?>` Both of 'hello_world' call will print out the same result. It's easily to understand why the second call will be output 'Hello world', but how the first call output the same where it's been call before the initiation of the function hello_world itself ?enter code here

    Read the article

  • how to forward message from UITabBarController to another controller?

    - by RAGOpoR
    it cause from i insert UIViewController to subview of UITabBarController. once i want to set UIViewController shouldAutorotateToInterfaceOrientation and it not possible because it will call only in UITabBarController. how can i forward message from UITabBarController to call shouldAutorotateToInterfaceOrientation of each UIViewController instead of call UITabBarController only?

    Read the article

  • ObjectDataSource.Select with Parameters Time Out

    - by MasterMax1313
    I'm using an ObjectDataSource with a 2008 ReportViewer control and Linq to CSV. The ODS has two parameters (the SQL is spelled out in an XSD file with a table adapter). The Reportviewer takes a very long time to render the output after a button is clicked to generate the report. That's my first problem. Even though it works (most of the time), the processing time worries me, and subsequent requests don't seem to be changing the results shown on the screen. The next issue is that when I go to export the ODS to CSV I'm getting a time out exception on the select method of the ODS (shown below). This works for ODS without parameters, but it seems like now that I've added parameters that it doesn't want to cooperate. I'm fresh out of ideas, any thoughts? <asp:ObjectDataSource ID="obsGetDataAllCustomers" runat="server" SelectMethod="GetDataAllCustomers" TypeName="my.myAdapter.AllCustomers" OldValuesParameterFormatString="original_{0}" > <SelectParameters> <asp:ControlParameter ControlID="StartDate" Name="Start" PropertyName="Text" Type="DateTime" /> <asp:ControlParameter ControlID="EndDate" Name="_End" PropertyName="Text" Type="DateTime" /> </SelectParameters> </asp:ObjectDataSource> After button click to view report - rvAllCustomers.LocalReport.Refresh() Export to CSV (adding the items returned to a list which is then processed by working code) - For Each dr As DataRow In CType(obs.Select(), DataView).Table.Rows l.Add(New FullOrderOutput(dr)) Next

    Read the article

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