How to query the database from within a CodeIgniter view file
I know it's not meant to be done, but could someone show me how to run an SQL query from a view?
Join the discussion →I know it's not meant to be done, but could someone show me how to run an SQL query from a view?
Join the discussion →I have tried: preg_match("/^[a-zA-Z0-9]", $value) but im doing something wrong i guess.
Join the discussion →I am getting this error when trying to run a simple SQL C++ program (IDE used VS 2008) fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory this is how my code looks like; #include "stdafx.h" #include <iostream> #include <windows.h> #include <mysql.h> int _tmain(int argc, _TCHAR* argv[]) { return 0; } I think that my IDE is unable to find the path of the MYSQL Installation or some thing similar. What should i do to resolve this situation. Step by step instructions appreciated.
Join the discussion →For my login system, I would like to check a username and password against a remote LDAP server using PHP. Can anyone tell me if just checking a user against LDAP will work on an inexpensive hosting plan from a company such as GoDaddy, 1&1, or Dreamhost? Ex: $objConn = ldap_connect($strDomain); I don't want to run an LDAP server, just simply use the LDAP functions of PHP to verify an account.
Join the discussion →Interviewer asked me about this today ...is there an answer ?
Join the discussion →I have a server application written in C++. After startup, it uses about 480 KB of memory on x86 Linux (Ubuntu 8.04, GCC 4.2.4). I think 480 KB is an excessive amount of memory: the server isn't even doing anything yet, no clients have been connected to the server. (See also my comment below in which I explain why I think 480 KB is a lot of memory.) The only things the server does during initialization is spawning one or two threads, setting up a few sockets, and other simple things that aren't very memory-intensive. Note that I'm talking about real memory usage, not VM size. I measured it by
Join the discussion →To a Perl script that I am writing, there can be a lot (~50) of command line options provided. Most of them are optional, so a call will have only some of the options provided. I am using Getopt::Long but it does not allow me to use GetOptions more than once. As a result, I have to use all the command line options in one GetOptions call. Is there some good way to group the options while using GetOptions? $ cat test.pl use strict; use warnings; use Getopt::Long; my ($a, $b, $c, $d); GetOptions ('a=s' => \$a, 'b=s' => \$b); GetOptions ('c=s' => \$c, 'd=s' => \$d); print "a = $a\nb = $b\nc = $c\n
Join the discussion →I have been designing websites for a while now, but there is one thing that I have never been quite sure of when using PHP and HTML. Is it better to have the whole document in PHP and echo HTML like so: <?php doSomething(); echo "<div id=\"some_div\">Content</div>"; ?> Or have a HTML file like so and just add in the PHP: <html> <body> <?php doSomething(); ?> <div id="some_div">Content</div> </body> </html> It seems tidier to echo HTML, especially if lots of PHP gets used throughout the page, but doing so loses all formatting of the HTML i.e. colors in the IDE etc.
Join the discussion →I am having a lot of trouble setting up transactional replication on my test server. I am running SQL Server 2008 SP2. I am able to create a transactional publication. The snapshot agent works fine and subscribing to the publication works fine as well. The problem that I get is that the log reader agent fails with the error: The process could not execute 'sp_replcmds' on [ServerName] The snapshot and log reader agents are run under a windows account with administrator privileges on the domain and sysadmin privileges on the sql server. I have also tried running the agents under the SQL agent pr
Join the discussion →This is likely a a novice question, but google surprisingly did not provide an answer. I have this rather artificial method T HowToCast<T>(T t) { if (typeof(T) == typeof(string)) { T newT1 = "some text"; T newT2 = (string)t; } return t; } Coming from a C++ background I have expected this to work. However, it fails to compile with "Cannot implicitly convert type 'T' to string" and "Cannot convert type 'T' to string" for both of the above assignments. I am either doing something conceptually wrong or just have the wrong syntax. Please help me sort this one out. Thank you!
Join the discussion →I have a large database with thousands records. Every time a user post his information I need to know if there is already the same/similar record. Are there any algorithms or open source implementations to solve this problem? We're using Chinese, and what 'similar' means is the records have most identical content, might be 80%-100% are the same. Each record will not be too big, about 2k-6k bytes
Join the discussion →I am absolutely happy with Scala and just love it :) But sometimes I really want to go a bit more "low level", without a JVM and using "cool" CPU-Features like SSE etc. So what would be a good second language besides Scala? It should be: Compiled to machine code Easy usage of C-libraries Possible to program very close to the hardware Possible to program in a very highlevel-way when I want to So basically I want a Scala where I can just throw in inline assembler when I want to :) I assume, that such a language does not exist, but maybe there are some that come close. So what would be a good cho
Join the discussion →I'm bulk loading data and can re-calculate all trigger modifications much more cheaply after the fact than on a row-by-row basis. How can I temporarily disable all triggers in PostgreSQL?
Join the discussion →When I start a git rebase -i, I can issue commands like git rebase --continue, or git rebase --abort. Those commands only work if a rebase is in progress. How can I know if there is a rebase in progress? (I would greatly appreciate some details on how rebase works internally; what does git do to a repo that gives it the "rebase in progress" status,?)
Join the discussion →I'm new to HTML and want to make semantically correct HTML, however I'm finding it hard to work with what seems to be only headings, lists and paragraphs. Particularly, I can't find a place that makes sense for subtitles. I'm writing a blog site so lets use that as an example: A BLOG TITLE the best blog in the world post_title1 post_title2 post_title3 Semantically 'A BLOG TITLE' is h1. It makes sense to me that the post_titleX are h2, but it doesn't feel right for the subtitle - 'the best blog in the world' to be classed at the same level as them.
Join the discussion →How could I create a window which is modal and has a maximize button? So is it possible to create a modal JFrame or create a JDialog with maximize button?
Join the discussion →I am trying to raise a Warning in Python without making the program crash / stop / interrupt. I use the following simple function to check if the user passed a non-zero number to it. If so, the program should warn them, but continue as per normal. It should work like the code below, but should use class Warning(), Error() or Exception() instead of printing the warning out manually. def is_zero(i): if i != 0: print "OK" else: print "WARNING: the input is 0!" return i If I use the code below and pass 0 to the function, the program crashes and the value is never returned. Instead, I want the prog
Join the discussion →I've been trying to build a simple vb.net app that basically displays already built .rpt reports in a crystalreportviewer. No matter how many times I try to code it, I run into problems. Some reports have worked, others have thrown errors such as load report failed, invalid path, etc.. All of the reports work when I run them in crystal. Ideally, I'm looking to just have a menu with report names, and a crystalreportviewer where the user can click a report, and the app prompts them for parameter values. I'm currently working with crystal 9 I believe, and vs.net 2003, or I have access to 2005 as
Join the discussion →I have a jquery UI datePicker in my page. I have a text box on which the date is displayed. The code is: $("#cal").datepicker({ minDate: new Date(), defaultDate: new Date(), buttonImage: '/images/calendar.gif', constrainInput: false, closeText: 'Close', showButtonPanel: true, showButtonText: 'Choose a date', buttonImageOnly : true, showOn : 'button' }); $("#till").datepicker('setDate', today); I want to disable this on some conditions. I use the following code to disable: $("#cal").datePicker('disable'); It blacks out the text box but the image is still clickable. The problem is in IE, the dat
Join the discussion →If I have a pool object with 2 processors for example: p=multiprocessing.Pool(2) and I want to iterate over a list of files on directory and use the map function could someone explain what is the chunksize of this function: p.map(func, iterable[, chunksize]) If I set the chunksize for example to 10 does that means every 10 files should be processed with one processor?
Join the discussion →I have a test which runs a script. It gets the path from the app.config file: <scriptsSectionGroup> <scriptsCollection> <scripts> <add name="TestScript" path="C:\My Projects\RestServicePublishing\UtilityFixture\testScript.bat"/> </scripts> </scriptsCollection> </scriptsSectionGroup> 'testScript.bat' is located in the UtilityFixture project. It is not in a subfolder. UtilityFixture testScript.bat However I don't want to specify the full path as I have here. I want to make it so that it will find 'testScript.bat' in the project 'UtilityFixture' regardless of what directory the project is sitting
Join the discussion →i would like to write in MFC combobox that behave like the combo in the IE8 address bar. with the option of auto complete (which it is a property on the combo - right?) and the delete option on the right (is the drop down is a list control?)
Join the discussion →I'm interested in learning how to implement a News Feed / Activity Feed on a web app for multiple models like Books, Authors, Comments, etc... Any recommendations from the group? Gems/Plugins, or experience personally or from others on the best/smartest way to proceed? Thanks!
Join the discussion →I am getting this exception when trying to debug a Silverlight 4 application in Visual Studio 2010. The exception will be thrown after it passes the InitializeComponent() line. The exception will only happen during debugging, but it does not seem to be a problem to the Visual Studio Designer. System.Windows.Markup.XamlParseException occurred Message=Failed to create a 'System.Type' from the text 'local:CustomerEntity'. [Line: 11 Position: 59] LineNumber=11 LinePosition=59 StackTrace: at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at TestSilverlightApp.MainPa
Join the discussion →Nine years ago when I started to parsing HTML and free text with Perl I read the classic Data Munging with Perl. Does someone know if David is planning to update the book or if there are similar books or web pages where the new parsing modules like XML-Twig, Regexp-Grammars, etc, are explained? I assume that in the last nine years some modules still are as good as they were, some are up to date but with new interesting methods and some have better replacements. For example, is still Parse-RecDescent the only option for free text parsing or will be the Perl 6 influenced Regexp-Grammars its repl
Join the discussion →I'm trying to generate a list of primes below 1 billion. I'm trying this, but this kind of structure is pretty shitty. Any suggestions? a <- 1:1000000000 d <- 0 b <- for (i in a) {for (j in 1:i) {if (i %% j !=0) {d <- c(d,i)}}}
Join the discussion →I am using g++ 4.4.1 and want to use nullptr, but I am not being able to find which header file is required to be included. It does not seem to be keyword either, because my attempt to use it is rejected as error: 'nullptr' was not declared in this scope
Join the discussion →Anyone knows of a sensible way to create an ARBITRARY sound wave in C# and play it back from the speakers? This issue has been coming back to every now and then for years, I always end up giving it up after a lot of failure without finding a solution. What I want to do is like a reverse-visualizer, that is, I don't want to generate "numbers" from sound, I want to generate sound from numbers. Like get a function that I provide with sample rate, sample size, and the sound data (an array of integers for example), and it would generate the appropriate wav file from it (real-time sound playback wou
Join the discussion →I have a program launching a website via the following command. cmd "start /max http://url.com" When launching a website via this method, it uses the default browser with its default settings for opening a new window. For example, Firefox and Internet Explorer will open the window inside the tab of an existing window if they are set to do so. I have reports of Internet Explorer 6 replacing the content of a current opened window with the content of url.com. I've tested this and sure enough, when Internet Explorer 6 is set as the default browser and with a current webpage opened, the above will
Join the discussion →i hope this question is not too simple, but i have no idea :( How can i start a function with a var in the function name? For example ... my functions function at_26(); function at_21(); function at_99(); start the function var test_id = 21; at_'+test_id+'(); // doesn't work I hope somebody can help me. Thanks in advance! Peter
Join the discussion →